blob: 030accfe1d40079b2127e55c6a2b8ab5128af248 [file] [log] [blame]
Thaminda Edirisooriyaa47738d2015-08-26 15:39:16 -07001/*
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äfercc5be8b2016-07-26 01:54:34 +020028#include <arch/barrier.h>
Thaminda Edirisooriyaa47738d2015-08-26 15:39:16 -070029#include <arch/errno.h>
30#include <atomic.h>
Thaminda Edirisooriyaa47738d2015-08-26 15:39:16 -070031#include <console/console.h>
Jonathan Neuschäfer99f2f112016-10-28 00:25:02 +020032#include <mcall.h>
Jonathan Neuschäfercc5be8b2016-07-26 01:54:34 +020033#include <string.h>
Jonathan Neuschäfere2e40cc2016-10-12 00:18:00 +020034#include <vm.h>
Thaminda Edirisooriyaa47738d2015-08-26 15:39:16 -070035
Ronald G. Minnich6f3a53b2017-01-15 17:40:51 +010036int mcalldebug; // set this interactively for copious debug.
37
Thaminda Edirisooriyaa47738d2015-08-26 15:39:16 -070038void hls_init(uint32_t hart_id)
39{
Ronald G. Minnich6f3a53b2017-01-15 17:40:51 +010040 printk(BIOS_SPEW, "hart %d: HLS is %p\n", hart_id, HLS());
Thaminda Edirisooriyaa47738d2015-08-26 15:39:16 -070041 memset(HLS(), 0, sizeof(*HLS()));
42 HLS()->hart_id = hart_id;
Ronald G. Minnich6f3a53b2017-01-15 17:40:51 +010043
Jonathan Neuschäfer3b2712d2017-09-24 00:43:37 +020044 /* Initialize these pointers with dummy values, for now */
45 HLS()->time = NULL;
46 HLS()->timecmp = NULL;
Ronald G. Minnich6f3a53b2017-01-15 17:40:51 +010047
48 printk(BIOS_SPEW, "Time is %p and timecmp is %p\n",
49 HLS()->time, HLS()->timecmp);
Thaminda Edirisooriyaa47738d2015-08-26 15:39:16 -070050}