Skip to content

Commit a88d149

Browse files
committed
Add an openbsd,dma-constraint property to the /chosen node and set it
to an appropriate value for the Raspberry Pi 4. ok patrick@
1 parent 76c5fbc commit a88d149

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

sys/arch/arm64/stand/efiboot/conf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: conf.c,v 1.26 2020/03/22 14:59:11 kettenis Exp $ */
1+
/* $OpenBSD: conf.c,v 1.27 2020/04/21 07:54:01 kettenis Exp $ */
22

33
/*
44
* Copyright (c) 1996 Michael Shalayeff
@@ -46,7 +46,7 @@
4646
#include "efipxe.h"
4747
#include "softraid_arm64.h"
4848

49-
const char version[] = "0.21";
49+
const char version[] = "0.22";
5050
int debug = 0;
5151

5252
struct fs_ops file_system[] = {

sys/arch/arm64/stand/efiboot/efiacpi.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: efiacpi.c,v 1.6 2019/12/26 13:13:18 kettenis Exp $ */
1+
/* $OpenBSD: efiacpi.c,v 1.7 2020/04/21 07:54:01 kettenis Exp $ */
22

33
/*
44
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
@@ -659,6 +659,7 @@ efi_acpi_spcr(struct acpi_table_header *hdr)
659659
void *
660660
efi_acpi(void)
661661
{
662+
extern uint64_t dma_constraint[2];
662663
extern u_char dt_blob_start[];
663664
void *fdt = dt_blob_start;
664665
struct acpi_table_header *hdr;
@@ -714,6 +715,11 @@ efi_acpi(void)
714715
node = fdt_find_node("/acpi");
715716
fdt_node_set_property(node, "reg", reg, sizeof(reg));
716717

718+
/* Raspberry Pi 4 is "special". */
719+
if (memcmp(xsdt->hdr_oemid, "RPIFDN", 6) == 0 &&
720+
memcmp(xsdt->hdr_oemtableid, "RPI4", 4) == 0)
721+
dma_constraint[1] = htobe64(0x3bffffff);
722+
717723
fdt_finalize();
718724

719725
return fdt;

sys/arch/arm64/stand/efiboot/efiboot.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: efiboot.c,v 1.27 2020/03/22 14:59:11 kettenis Exp $ */
1+
/* $OpenBSD: efiboot.c,v 1.28 2020/04/21 07:54:01 kettenis Exp $ */
22

33
/*
44
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
@@ -457,6 +457,24 @@ efi_console(void)
457457
fdt_node_add_property(node, "stdout-path", path, strlen(path) + 1);
458458
}
459459

460+
uint64_t dma_constraint[2] = { 0, -1 };
461+
462+
void
463+
efi_dma_constraint(void)
464+
{
465+
void *node;
466+
467+
/* Raspberry Pi 4 is "special". */
468+
node = fdt_find_node("/");
469+
if (fdt_node_is_compatible(node, "brcm,bcm2711"))
470+
dma_constraint[1] = htobe64(0x3bffffff);
471+
472+
/* Pass DMA constraint. */
473+
node = fdt_find_node("/chosen");
474+
fdt_node_add_property(node, "openbsd,dma-constraint",
475+
dma_constraint, sizeof(dma_constraint));
476+
}
477+
460478
int acpi = 0;
461479
void *fdt = NULL;
462480
char *bootmac = NULL;
@@ -534,6 +552,7 @@ efi_makebootargs(char *bootargs)
534552

535553
efi_framebuffer();
536554
efi_console();
555+
efi_dma_constraint();
537556

538557
fdt_finalize();
539558

0 commit comments

Comments
 (0)