diff options
author | Mayuresh Chitale <mchitale@ventanamicro.com> | 2023-09-07 17:19:46 +0530 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2023-09-24 17:04:41 +0530 |
commit | e8bc1621c6882766815d2a46f5c2ae88c977bfa4 (patch) | |
tree | 6f63a26a958955a9b51b30136dd942ad9be36e76 /lib/utils/serial/fdt_serial_htif.c | |
parent | 73aea28264977286f72d2efe615dd1773d94e2cd (diff) | |
download | opensbi-e8bc1621c6882766815d2a46f5c2ae88c977bfa4.zip opensbi-e8bc1621c6882766815d2a46f5c2ae88c977bfa4.tar.gz opensbi-e8bc1621c6882766815d2a46f5c2ae88c977bfa4.tar.bz2 |
lib: utils/serial: Add shared regions for serial drivers
The serial driver regions used by OpenSBI should be marked as a shared
read-write regions between M-mode and SU-mode as those are accessed
by earlycon and the corresponding tty serial drivers running in 'S' mode.
When the smepmp extension is enabled, PMP entries for these shared regions
will get programmed.
Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Diffstat (limited to 'lib/utils/serial/fdt_serial_htif.c')
-rw-r--r-- | lib/utils/serial/fdt_serial_htif.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/utils/serial/fdt_serial_htif.c b/lib/utils/serial/fdt_serial_htif.c index 61f66d6..7d88e7a 100644 --- a/lib/utils/serial/fdt_serial_htif.c +++ b/lib/utils/serial/fdt_serial_htif.c @@ -7,6 +7,8 @@ * Anup Patel <anup.patel@wdc.com> */ +#include <sbi/riscv_asm.h> +#include <sbi/sbi_domain.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/serial/fdt_serial.h> #include <sbi_utils/sys/htif.h> @@ -19,6 +21,7 @@ static const struct fdt_match serial_htif_match[] = { static int serial_htif_init(void *fdt, int nodeoff, const struct fdt_match *match) { + int rc; bool custom = false; uint64_t fromhost_addr = 0, tohost_addr = 0; @@ -29,6 +32,12 @@ static int serial_htif_init(void *fdt, int nodeoff, fdt_get_node_addr_size(fdt, nodeoff, 1, &tohost_addr, NULL); + rc = sbi_domain_root_add_memrange(fromhost_addr, PAGE_SIZE, PAGE_SIZE, + (SBI_DOMAIN_MEMREGION_MMIO | + SBI_DOMAIN_MEMREGION_SHARED_SURW_MRW)); + if (rc) + return rc; + return htif_serial_init(custom, fromhost_addr, tohost_addr); } |