source: mainline/boot/arch/riscv64/src/ucb.c@ d7f7a4a

Last change on this file since d7f7a4a was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 4 years ago

Replace some license headers with SPDX identifier

Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.

  • Property mode set to 100644
File size: 620 bytes
Line 
1/*
2 * SPDX-FileCopyrightText: 2016 Martin Decky
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch/ucb.h>
8#include <arch/arch.h>
9#include <macros.h>
10
11volatile uint64_t tohost __attribute__((section(".htif")));
12volatile uint64_t fromhost __attribute__((section(".htif")));
13
14static void poll_fromhost()
15{
16 uint64_t val = fromhost;
17 if (!val)
18 return;
19
20 fromhost = 0;
21}
22
23void htif_cmd(uint8_t device, uint8_t cmd, uint64_t payload)
24{
25 uint64_t val = (((uint64_t) device) << 56) |
26 (((uint64_t) cmd) << 48) |
27 (payload & UINT64_C(0xffffffffffff));
28
29 while (tohost)
30 poll_fromhost();
31
32 tohost = val;
33}
Note: See TracBrowser for help on using the repository browser.