Julien Viard de Galbert has uploaded this change for review. ( https://review.coreboot.org/25445
Change subject: arch/x86/acpi: Add DMAR RMRR helper functions ......................................................................
arch/x86/acpi: Add DMAR RMRR helper functions
Change-Id: Id4e7d95d2d13a7f7b49fcb6f6b9e8ccd6ae12a9e Signed-off-by: Julien Viard de Galbert jviarddegalbert@online.net --- M src/arch/x86/acpi.c M src/arch/x86/include/arch/acpi.h 2 files changed, 33 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/45/25445/1
diff --git a/src/arch/x86/acpi.c b/src/arch/x86/acpi.c index 601b6f0..7d66285 100644 --- a/src/arch/x86/acpi.c +++ b/src/arch/x86/acpi.c @@ -9,6 +9,7 @@ * Copyright (C) 2015 Timothy Pearson tpearson@raptorengineeringinc.com, * Raptor Engineering * Copyright (C) 2016-2017 Siemens AG + * Copyright (C) 2018 Online SAS * * ACPI FADT, FACS, and DSDT table support added by * Nick Barker nick.barker9@btinternet.com, and those portions @@ -461,6 +462,20 @@ return drhd->length; }
+unsigned long acpi_create_dmar_rmrr(unsigned long current, u16 segment, + u32 bar, u64 limit) +{ + dmar_rmrr_entry_t *rmrr = (dmar_rmrr_entry_t *)current; + memset(rmrr, 0, sizeof(*rmrr)); + rmrr->type = DMAR_RMRR; + rmrr->length = sizeof(*rmrr); /* will be fixed up later */ + rmrr->segment = segment; + rmrr->bar = bar; + rmrr->limit = limit; + + return rmrr->length; +} + unsigned long acpi_create_dmar_atsr(unsigned long current, u8 flags, u16 segment) { @@ -480,6 +495,12 @@ drhd->length = current - base; }
+void acpi_dmar_rmrr_fixup(unsigned long base, unsigned long current) +{ + dmar_rmrr_entry_t *rmrr = (dmar_rmrr_entry_t *)base; + rmrr->length = current - base; +} + void acpi_dmar_atsr_fixup(unsigned long base, unsigned long current) { dmar_atsr_entry_t *atsr = (dmar_atsr_entry_t *)base; diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h index 5418420..a1ed338 100644 --- a/src/arch/x86/include/arch/acpi.h +++ b/src/arch/x86/include/arch/acpi.h @@ -331,6 +331,15 @@ u64 bar; } __packed dmar_entry_t;
+typedef struct dmar_rmrr_entry { + u16 type; + u16 length; + u16 reserved; + u16 segment; + u64 bar; + u64 limit; +} __packed dmar_rmrr_entry_t; + typedef struct dmar_atsr_entry { u16 type; u16 length; @@ -715,9 +724,12 @@ unsigned long (*acpi_fill_dmar)(unsigned long)); unsigned long acpi_create_dmar_drhd(unsigned long current, u8 flags, u16 segment, u32 bar); +unsigned long acpi_create_dmar_rmrr(unsigned long current, u16 segment, + u32 bar, u64 limit); unsigned long acpi_create_dmar_atsr(unsigned long current, u8 flags, u16 segment); void acpi_dmar_drhd_fixup(unsigned long base, unsigned long current); +void acpi_dmar_rmrr_fixup(unsigned long base, unsigned long current); void acpi_dmar_atsr_fixup(unsigned long base, unsigned long current); unsigned long acpi_create_dmar_drhd_ds_pci_br(unsigned long current, u8 bus, u8 dev, u8 fn);