diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2021-10-06 12:50:11 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2021-10-06 12:50:11 +0000 |
commit | 9cbd0537eb1404b0b5d9e696fa948b802a3cbec5 (patch) | |
tree | 8bbe5aa11391ee078f8eeaacada4c5da602d2c6c /sys | |
parent | e61f7842ffb8c6b0413c386c13b75f4716ab8883 (diff) |
Add openbsd,dma-constraint property to /chosen node on armv7
On the Zynq-7000, the DMA constraint has to be adjusted because many
bus masters are unable to access the lowest part of RAM.
OK patrick@ kettenis@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/armv7/armv7/armv7_machdep.c | 8 | ||||
-rw-r--r-- | sys/arch/armv7/stand/efiboot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/armv7/stand/efiboot/efiboot.c | 25 |
3 files changed, 33 insertions, 4 deletions
diff --git a/sys/arch/armv7/armv7/armv7_machdep.c b/sys/arch/armv7/armv7/armv7_machdep.c index 804167188c4..b33e3f21fc3 100644 --- a/sys/arch/armv7/armv7/armv7_machdep.c +++ b/sys/arch/armv7/armv7/armv7_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: armv7_machdep.c,v 1.63 2021/03/25 04:12:01 jsg Exp $ */ +/* $OpenBSD: armv7_machdep.c,v 1.64 2021/10/06 12:50:10 visa Exp $ */ /* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */ /* @@ -453,6 +453,12 @@ initarm(void *arg0, void *arg1, void *arg2, paddr_t loadaddr) len = fdt_node_property(node, "openbsd,uefi-mmap-desc-ver", &prop); if (len == sizeof(mmap_desc_ver)) mmap_desc_ver = bemtoh32((uint32_t *)prop); + + len = fdt_node_property(node, "openbsd,dma-constraint", &prop); + if (len == sizeof(uint64_t[2])) { + dma_constraint.ucr_low = bemtoh64((uint64_t *)prop); + dma_constraint.ucr_high = bemtoh64((uint64_t *)prop + 1); + } } process_kernel_args(); diff --git a/sys/arch/armv7/stand/efiboot/conf.c b/sys/arch/armv7/stand/efiboot/conf.c index bc093179811..9968136184a 100644 --- a/sys/arch/armv7/stand/efiboot/conf.c +++ b/sys/arch/armv7/stand/efiboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.31 2021/06/10 22:17:58 krw Exp $ */ +/* $OpenBSD: conf.c,v 1.32 2021/10/06 12:50:10 visa Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -42,7 +42,7 @@ #include "efidev.h" #include "efipxe.h" -const char version[] = "1.18"; +const char version[] = "1.19"; int debug = 0; struct fs_ops file_system[] = { diff --git a/sys/arch/armv7/stand/efiboot/efiboot.c b/sys/arch/armv7/stand/efiboot/efiboot.c index 2e452ff6b94..588e1c99b10 100644 --- a/sys/arch/armv7/stand/efiboot/efiboot.c +++ b/sys/arch/armv7/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.34 2021/06/07 21:18:31 krw Exp $ */ +/* $OpenBSD: efiboot.c,v 1.35 2021/10/06 12:50:10 visa Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -435,6 +435,28 @@ efi_framebuffer(void) sizeof(framebuffer_path)); } +uint64_t dma_constraint[2] = { 0, -1 }; + +void +efi_dma_constraint(void) +{ + void *node; + + /* Raspberry Pi 4 is "special". */ + node = fdt_find_node("/"); + if (fdt_node_is_compatible(node, "brcm,bcm2711")) + dma_constraint[1] = htobe64(0x3bffffff); + + /* Not all bus masters can access 0x0-0x7ffff on Zynq-7000. */ + if (fdt_node_is_compatible(node, "xlnx,zynq-7000")) + dma_constraint[0] = htobe64(0x00080000); + + /* Pass DMA constraint. */ + node = fdt_find_node("/chosen"); + fdt_node_add_property(node, "openbsd,dma-constraint", + dma_constraint, sizeof(dma_constraint)); +} + void efi_console(void) { @@ -515,6 +537,7 @@ efi_makebootargs(char *bootargs, int howto) efi_framebuffer(); efi_console(); + efi_dma_constraint(); fdt_finalize(); |