Thaminda Edirisooriya | a47738d | 2015-08-26 15:39:16 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013, The Regents of the University of California (Regents). |
| 3 | * All Rights Reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * 3. Neither the name of the Regents nor the |
| 13 | * names of its contributors may be used to endorse or promote products |
| 14 | * derived from this software without specific prior written permission. |
| 15 | * |
| 16 | * IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, |
| 17 | * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING |
| 18 | * OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS |
| 19 | * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 20 | * |
| 21 | * REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 23 | * PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED |
| 24 | * HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE |
| 25 | * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 26 | */ |
| 27 | |
Jonathan Neuschäfer | cc5be8b | 2016-07-26 01:54:34 +0200 | [diff] [blame] | 28 | #include <arch/barrier.h> |
Thaminda Edirisooriya | a47738d | 2015-08-26 15:39:16 -0700 | [diff] [blame] | 29 | #include <arch/errno.h> |
| 30 | #include <atomic.h> |
Thaminda Edirisooriya | a47738d | 2015-08-26 15:39:16 -0700 | [diff] [blame] | 31 | #include <console/console.h> |
Jonathan Neuschäfer | 99f2f11 | 2016-10-28 00:25:02 +0200 | [diff] [blame] | 32 | #include <mcall.h> |
Jonathan Neuschäfer | cc5be8b | 2016-07-26 01:54:34 +0200 | [diff] [blame] | 33 | #include <string.h> |
Jonathan Neuschäfer | e2e40cc | 2016-10-12 00:18:00 +0200 | [diff] [blame] | 34 | #include <vm.h> |
Thaminda Edirisooriya | a47738d | 2015-08-26 15:39:16 -0700 | [diff] [blame] | 35 | |
Ronald G. Minnich | 6f3a53b | 2017-01-15 17:40:51 +0100 | [diff] [blame] | 36 | int mcalldebug; // set this interactively for copious debug. |
| 37 | |
Thaminda Edirisooriya | a47738d | 2015-08-26 15:39:16 -0700 | [diff] [blame] | 38 | void hls_init(uint32_t hart_id) |
| 39 | { |
Ronald G. Minnich | 6f3a53b | 2017-01-15 17:40:51 +0100 | [diff] [blame] | 40 | printk(BIOS_SPEW, "hart %d: HLS is %p\n", hart_id, HLS()); |
Thaminda Edirisooriya | a47738d | 2015-08-26 15:39:16 -0700 | [diff] [blame] | 41 | memset(HLS(), 0, sizeof(*HLS())); |
| 42 | HLS()->hart_id = hart_id; |
Ronald G. Minnich | 6f3a53b | 2017-01-15 17:40:51 +0100 | [diff] [blame] | 43 | |
Jonathan Neuschäfer | 3b2712d | 2017-09-24 00:43:37 +0200 | [diff] [blame] | 44 | /* Initialize these pointers with dummy values, for now */ |
| 45 | HLS()->time = NULL; |
| 46 | HLS()->timecmp = NULL; |
Ronald G. Minnich | 6f3a53b | 2017-01-15 17:40:51 +0100 | [diff] [blame] | 47 | |
| 48 | printk(BIOS_SPEW, "Time is %p and timecmp is %p\n", |
| 49 | HLS()->time, HLS()->timecmp); |
Thaminda Edirisooriya | a47738d | 2015-08-26 15:39:16 -0700 | [diff] [blame] | 50 | } |