coreboot-gerrit
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
October 2014
- 1 participants
- 1026 discussions
Patch set updated for coreboot: 17d0591 gm45: Convert to per-device ACPI
by Vladimir Serbinenko Oct. 5, 2014
by Vladimir Serbinenko Oct. 5, 2014
Oct. 5, 2014
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6803
-gerrit
commit 17d05914c34c6b1a893372ffb8074f06779b31f9
Author: Vladimir Serbinenko <phcoder(a)gmail.com>
Date: Sat Aug 30 22:39:20 2014 +0200
gm45: Convert to per-device ACPI
Change-Id: Ib04b03b2dc2ad3bfa886b43df9dd6518bbb46e3f
Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com>
---
src/mainboard/lenovo/x200/acpi_tables.c | 224 +---------------------
src/mainboard/roda/rk9/acpi_tables.c | 224 +---------------------
src/northbridge/intel/gm45/Kconfig | 1 +
src/northbridge/intel/gm45/acpi.c | 29 +++
src/northbridge/intel/gm45/gm45.h | 3 +
src/northbridge/intel/gm45/northbridge.c | 2 +
src/southbridge/intel/i82801ix/Kconfig | 4 +
src/southbridge/intel/i82801ix/acpi/globalnvs.asl | 3 +-
src/southbridge/intel/i82801ix/lpc.c | 28 +++
src/southbridge/intel/i82801ix/nvs.h | 2 +
10 files changed, 73 insertions(+), 447 deletions(-)
diff --git a/src/mainboard/lenovo/x200/acpi_tables.c b/src/mainboard/lenovo/x200/acpi_tables.c
index 6e6cd72..77491dc 100644
--- a/src/mainboard/lenovo/x200/acpi_tables.c
+++ b/src/mainboard/lenovo/x200/acpi_tables.c
@@ -30,13 +30,8 @@
#include <device/pci.h>
#include <device/pci_ids.h>
-extern const unsigned char AmlCode[];
-#if CONFIG_HAVE_ACPI_SLIC
-unsigned long acpi_create_slic(unsigned long current);
-#endif
-
#include "southbridge/intel/i82801ix/nvs.h"
-static void acpi_create_gnvs(global_nvs_t *gnvs)
+void acpi_create_gnvs(global_nvs_t *gnvs)
{
memset((void *)gnvs, 0, sizeof(*gnvs));
gnvs->apic = 1;
@@ -55,38 +50,6 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
gnvs->did[4] = 0x00000005;
}
-static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
-{
-#define HPET_ADDR 0xfed00000ULL
- acpi_header_t *header = &(hpet->header);
- acpi_addr_t *addr = &(hpet->addr);
-
- memset((void *) hpet, 0, sizeof(acpi_hpet_t));
-
- /* fill out header fields */
- memcpy(header->signature, "HPET", 4);
- memcpy(header->oem_id, OEM_ID, 6);
- memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
- memcpy(header->asl_compiler_id, ASLC, 4);
-
- header->length = sizeof(acpi_hpet_t);
- header->revision = 1;
-
- /* fill out HPET address */
- addr->space_id = 0; /* Memory */
- addr->bit_width = 64;
- addr->bit_offset = 0;
- addr->addrl = HPET_ADDR & 0xffffffff;
- addr->addrh = HPET_ADDR >> 32;
-
- hpet->id = 0x8086a201; /* Intel */
- hpet->number = 0x00;
- hpet->min_tick = 0x0080;
-
- header->checksum =
- acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
/* Local APICs */
@@ -115,12 +78,6 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
-unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
-{
- generate_cpu_entries();
- return (unsigned long) (acpigen_get_current());
-}
-
unsigned long acpi_fill_slit(unsigned long current)
{
// Not implemented
@@ -132,182 +89,3 @@ unsigned long acpi_fill_srat(unsigned long current)
/* No NUMA, no SRAT */
return current;
}
-
-void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
-
-#define ALIGN_CURRENT current = (ALIGN(current, 16))
-unsigned long write_acpi_tables(unsigned long start)
-{
- unsigned long current;
- int i;
- acpi_rsdp_t *rsdp;
- acpi_rsdt_t *rsdt;
- acpi_xsdt_t *xsdt;
- acpi_hpet_t *hpet;
- acpi_madt_t *madt;
- acpi_mcfg_t *mcfg;
- acpi_fadt_t *fadt;
- acpi_facs_t *facs;
-#if CONFIG_IOMMU
- acpi_dmar_t *dmar;
-#endif
-#if CONFIG_HAVE_ACPI_SLIC
- acpi_header_t *slic;
-#endif
- acpi_header_t *ssdt;
- acpi_header_t *dsdt;
- void *gnvs;
-
- current = start;
-
- /* Align ACPI tables to 16byte */
- ALIGN_CURRENT;
-
- printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
-
- /* We need at least an RSDP and an RSDT Table */
- rsdp = (acpi_rsdp_t *) current;
- current += sizeof(acpi_rsdp_t);
- ALIGN_CURRENT;
- rsdt = (acpi_rsdt_t *) current;
- current += sizeof(acpi_rsdt_t);
- ALIGN_CURRENT;
- xsdt = (acpi_xsdt_t *) current;
- current += sizeof(acpi_xsdt_t);
- ALIGN_CURRENT;
-
- /* clear all table memory */
- memset((void *) start, 0, current - start);
-
- acpi_write_rsdp(rsdp, rsdt, xsdt);
- acpi_write_rsdt(rsdt);
- acpi_write_xsdt(xsdt);
-
- /*
- * We explicitly add these tables later on:
- */
- printk(BIOS_DEBUG, "ACPI: * HPET\n");
-
- hpet = (acpi_hpet_t *) current;
- current += sizeof(acpi_hpet_t);
- ALIGN_CURRENT;
- acpi_create_intel_hpet(hpet);
- acpi_add_table(rsdp, hpet);
-
- /* If we want to use HPET Timers Linux wants an MADT */
- printk(BIOS_DEBUG, "ACPI: * MADT\n");
-
- madt = (acpi_madt_t *) current;
- acpi_create_madt(madt);
- current += madt->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, madt);
-
- printk(BIOS_DEBUG, "ACPI: * MCFG\n");
- mcfg = (acpi_mcfg_t *) current;
- acpi_create_mcfg(mcfg);
- current += mcfg->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, mcfg);
-
-#if CONFIG_IOMMU
- printk(BIOS_DEBUG, "ACPI: * DMAR\n");
- dmar = (acpi_dmar_t *) current;
- acpi_create_dmar(dmar);
- current += dmar->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, dmar);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FACS\n");
- facs = (acpi_facs_t *) current;
- current += sizeof(acpi_facs_t);
- ALIGN_CURRENT;
- acpi_create_facs(facs);
-
- dsdt = (acpi_header_t *) current;
- memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
-
- /* Fix up global NVS region for SMI handler. The GNVS region lives
- * in the (high) table area. The low memory map looks like this:
- *
- * 0x00000000 - 0x000003ff Real Mode IVT
- * 0x00000020 - 0x0000019c Low MP Table (XXX conflict?)
- * 0x00000400 - 0x000004ff BDA (somewhat unused)
- * 0x00000500 - 0x0000052f Moved GDT
- * 0x00000530 - 0x00000b64 coreboot table
- * 0x0007c000 - 0x0007dfff OS boot sector (unused?)
- * 0x0007e000 - 0x0007ffff free to use (so no good for acpi+smi)
- * 0x00080000 - 0x0009fbff usable ram
- * 0x0009fc00 - 0x0009ffff EBDA (unused?)
- * 0x000a0000 - 0x000bffff VGA memory
- * 0x000c0000 - 0x000cffff VGA option rom
- * 0x000d0000 - 0x000dffff free for other option roms?
- * 0x000e0000 - 0x000fffff SeaBIOS? (conflict with low tables:)
- * 0x000f0000 - 0x000f03ff PIRQ table
- * 0x000f0400 - 0x000f66?? ACPI tables
- * 0x000f66?? - 0x000f???? DMI tables
- */
-
- ALIGN_CURRENT;
-
- /* Pack GNVS into the ACPI table area */
- for (i=0; i < dsdt->length; i++) {
- if (*(u32*)(((u32)dsdt) + i) == 0xC0DEBABE) {
- printk(BIOS_DEBUG, "ACPI: Patching up global NVS in DSDT at offset 0x%04x -> 0x%08x\n", i, (u32)current);
- *(u32*)(((u32)dsdt) + i) = current; // 0x92 bytes
- break;
- }
- }
-
- /* And fill it */
- acpi_create_gnvs((global_nvs_t *)current);
-
- /* Keep pointer around */
- gnvs = (void *)current;
-
- current += 0x100;
- ALIGN_CURRENT;
-
-#if CONFIG_HAVE_SMI_HANDLER
- /* And tell SMI about it */
- smm_setup_structures(gnvs, NULL, NULL);
-#endif
-
- /* We patched up the DSDT, so we need to recalculate the checksum */
- dsdt->checksum = 0;
- dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
-
- printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
- dsdt->length);
-
-#if CONFIG_HAVE_ACPI_SLIC
- printk(BIOS_DEBUG, "ACPI: * SLIC\n");
- slic = (acpi_header_t *)current;
- current += acpi_create_slic(current);
- ALIGN_CURRENT;
- acpi_add_table(rsdp, slic);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FADT\n");
- fadt = (acpi_fadt_t *) current;
- current += sizeof(acpi_fadt_t);
- ALIGN_CURRENT;
-
- acpi_create_fadt(fadt, facs, dsdt);
- acpi_add_table(rsdp, fadt);
-
- printk(BIOS_DEBUG, "ACPI: * SSDT\n");
- ssdt = (acpi_header_t *)current;
- acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
- current += ssdt->length;
- acpi_add_table(rsdp, ssdt);
- ALIGN_CURRENT;
-
- printk(BIOS_DEBUG, "current = %lx\n", current);
- printk(BIOS_INFO, "ACPI: done.\n");
-
- return current;
-}
diff --git a/src/mainboard/roda/rk9/acpi_tables.c b/src/mainboard/roda/rk9/acpi_tables.c
index 6e6cd72..77491dc 100644
--- a/src/mainboard/roda/rk9/acpi_tables.c
+++ b/src/mainboard/roda/rk9/acpi_tables.c
@@ -30,13 +30,8 @@
#include <device/pci.h>
#include <device/pci_ids.h>
-extern const unsigned char AmlCode[];
-#if CONFIG_HAVE_ACPI_SLIC
-unsigned long acpi_create_slic(unsigned long current);
-#endif
-
#include "southbridge/intel/i82801ix/nvs.h"
-static void acpi_create_gnvs(global_nvs_t *gnvs)
+void acpi_create_gnvs(global_nvs_t *gnvs)
{
memset((void *)gnvs, 0, sizeof(*gnvs));
gnvs->apic = 1;
@@ -55,38 +50,6 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
gnvs->did[4] = 0x00000005;
}
-static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
-{
-#define HPET_ADDR 0xfed00000ULL
- acpi_header_t *header = &(hpet->header);
- acpi_addr_t *addr = &(hpet->addr);
-
- memset((void *) hpet, 0, sizeof(acpi_hpet_t));
-
- /* fill out header fields */
- memcpy(header->signature, "HPET", 4);
- memcpy(header->oem_id, OEM_ID, 6);
- memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
- memcpy(header->asl_compiler_id, ASLC, 4);
-
- header->length = sizeof(acpi_hpet_t);
- header->revision = 1;
-
- /* fill out HPET address */
- addr->space_id = 0; /* Memory */
- addr->bit_width = 64;
- addr->bit_offset = 0;
- addr->addrl = HPET_ADDR & 0xffffffff;
- addr->addrh = HPET_ADDR >> 32;
-
- hpet->id = 0x8086a201; /* Intel */
- hpet->number = 0x00;
- hpet->min_tick = 0x0080;
-
- header->checksum =
- acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
/* Local APICs */
@@ -115,12 +78,6 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
-unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
-{
- generate_cpu_entries();
- return (unsigned long) (acpigen_get_current());
-}
-
unsigned long acpi_fill_slit(unsigned long current)
{
// Not implemented
@@ -132,182 +89,3 @@ unsigned long acpi_fill_srat(unsigned long current)
/* No NUMA, no SRAT */
return current;
}
-
-void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
-
-#define ALIGN_CURRENT current = (ALIGN(current, 16))
-unsigned long write_acpi_tables(unsigned long start)
-{
- unsigned long current;
- int i;
- acpi_rsdp_t *rsdp;
- acpi_rsdt_t *rsdt;
- acpi_xsdt_t *xsdt;
- acpi_hpet_t *hpet;
- acpi_madt_t *madt;
- acpi_mcfg_t *mcfg;
- acpi_fadt_t *fadt;
- acpi_facs_t *facs;
-#if CONFIG_IOMMU
- acpi_dmar_t *dmar;
-#endif
-#if CONFIG_HAVE_ACPI_SLIC
- acpi_header_t *slic;
-#endif
- acpi_header_t *ssdt;
- acpi_header_t *dsdt;
- void *gnvs;
-
- current = start;
-
- /* Align ACPI tables to 16byte */
- ALIGN_CURRENT;
-
- printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
-
- /* We need at least an RSDP and an RSDT Table */
- rsdp = (acpi_rsdp_t *) current;
- current += sizeof(acpi_rsdp_t);
- ALIGN_CURRENT;
- rsdt = (acpi_rsdt_t *) current;
- current += sizeof(acpi_rsdt_t);
- ALIGN_CURRENT;
- xsdt = (acpi_xsdt_t *) current;
- current += sizeof(acpi_xsdt_t);
- ALIGN_CURRENT;
-
- /* clear all table memory */
- memset((void *) start, 0, current - start);
-
- acpi_write_rsdp(rsdp, rsdt, xsdt);
- acpi_write_rsdt(rsdt);
- acpi_write_xsdt(xsdt);
-
- /*
- * We explicitly add these tables later on:
- */
- printk(BIOS_DEBUG, "ACPI: * HPET\n");
-
- hpet = (acpi_hpet_t *) current;
- current += sizeof(acpi_hpet_t);
- ALIGN_CURRENT;
- acpi_create_intel_hpet(hpet);
- acpi_add_table(rsdp, hpet);
-
- /* If we want to use HPET Timers Linux wants an MADT */
- printk(BIOS_DEBUG, "ACPI: * MADT\n");
-
- madt = (acpi_madt_t *) current;
- acpi_create_madt(madt);
- current += madt->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, madt);
-
- printk(BIOS_DEBUG, "ACPI: * MCFG\n");
- mcfg = (acpi_mcfg_t *) current;
- acpi_create_mcfg(mcfg);
- current += mcfg->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, mcfg);
-
-#if CONFIG_IOMMU
- printk(BIOS_DEBUG, "ACPI: * DMAR\n");
- dmar = (acpi_dmar_t *) current;
- acpi_create_dmar(dmar);
- current += dmar->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, dmar);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FACS\n");
- facs = (acpi_facs_t *) current;
- current += sizeof(acpi_facs_t);
- ALIGN_CURRENT;
- acpi_create_facs(facs);
-
- dsdt = (acpi_header_t *) current;
- memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
-
- /* Fix up global NVS region for SMI handler. The GNVS region lives
- * in the (high) table area. The low memory map looks like this:
- *
- * 0x00000000 - 0x000003ff Real Mode IVT
- * 0x00000020 - 0x0000019c Low MP Table (XXX conflict?)
- * 0x00000400 - 0x000004ff BDA (somewhat unused)
- * 0x00000500 - 0x0000052f Moved GDT
- * 0x00000530 - 0x00000b64 coreboot table
- * 0x0007c000 - 0x0007dfff OS boot sector (unused?)
- * 0x0007e000 - 0x0007ffff free to use (so no good for acpi+smi)
- * 0x00080000 - 0x0009fbff usable ram
- * 0x0009fc00 - 0x0009ffff EBDA (unused?)
- * 0x000a0000 - 0x000bffff VGA memory
- * 0x000c0000 - 0x000cffff VGA option rom
- * 0x000d0000 - 0x000dffff free for other option roms?
- * 0x000e0000 - 0x000fffff SeaBIOS? (conflict with low tables:)
- * 0x000f0000 - 0x000f03ff PIRQ table
- * 0x000f0400 - 0x000f66?? ACPI tables
- * 0x000f66?? - 0x000f???? DMI tables
- */
-
- ALIGN_CURRENT;
-
- /* Pack GNVS into the ACPI table area */
- for (i=0; i < dsdt->length; i++) {
- if (*(u32*)(((u32)dsdt) + i) == 0xC0DEBABE) {
- printk(BIOS_DEBUG, "ACPI: Patching up global NVS in DSDT at offset 0x%04x -> 0x%08x\n", i, (u32)current);
- *(u32*)(((u32)dsdt) + i) = current; // 0x92 bytes
- break;
- }
- }
-
- /* And fill it */
- acpi_create_gnvs((global_nvs_t *)current);
-
- /* Keep pointer around */
- gnvs = (void *)current;
-
- current += 0x100;
- ALIGN_CURRENT;
-
-#if CONFIG_HAVE_SMI_HANDLER
- /* And tell SMI about it */
- smm_setup_structures(gnvs, NULL, NULL);
-#endif
-
- /* We patched up the DSDT, so we need to recalculate the checksum */
- dsdt->checksum = 0;
- dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
-
- printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
- dsdt->length);
-
-#if CONFIG_HAVE_ACPI_SLIC
- printk(BIOS_DEBUG, "ACPI: * SLIC\n");
- slic = (acpi_header_t *)current;
- current += acpi_create_slic(current);
- ALIGN_CURRENT;
- acpi_add_table(rsdp, slic);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FADT\n");
- fadt = (acpi_fadt_t *) current;
- current += sizeof(acpi_fadt_t);
- ALIGN_CURRENT;
-
- acpi_create_fadt(fadt, facs, dsdt);
- acpi_add_table(rsdp, fadt);
-
- printk(BIOS_DEBUG, "ACPI: * SSDT\n");
- ssdt = (acpi_header_t *)current;
- acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
- current += ssdt->length;
- acpi_add_table(rsdp, ssdt);
- ALIGN_CURRENT;
-
- printk(BIOS_DEBUG, "current = %lx\n", current);
- printk(BIOS_INFO, "ACPI: done.\n");
-
- return current;
-}
diff --git a/src/northbridge/intel/gm45/Kconfig b/src/northbridge/intel/gm45/Kconfig
index b9244f9..fac7329 100644
--- a/src/northbridge/intel/gm45/Kconfig
+++ b/src/northbridge/intel/gm45/Kconfig
@@ -31,6 +31,7 @@ config NORTHBRIDGE_SPECIFIC_OPTIONS # dummy
select IOMMU
select VGA
select INTEL_EDID
+ select PER_DEVICE_ACPI_TABLES
config BOOTBLOCK_NORTHBRIDGE_INIT
string
diff --git a/src/northbridge/intel/gm45/acpi.c b/src/northbridge/intel/gm45/acpi.c
index da9bfa8..445995a 100644
--- a/src/northbridge/intel/gm45/acpi.c
+++ b/src/northbridge/intel/gm45/acpi.c
@@ -27,6 +27,9 @@
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
+#include <cbmem.h>
+#include <arch/acpigen.h>
+#include <cpu/cpu.h>
#include "gm45.h"
unsigned long acpi_fill_mcfg(unsigned long current)
@@ -105,3 +108,29 @@ unsigned long acpi_fill_dmar(unsigned long current)
/* TODO: reserve GTT for 0.2.0 and 0.2.1? */
return current;
}
+
+#define ALIGN_CURRENT current = (ALIGN(current, 16))
+unsigned long northbridge_write_acpi_tables(unsigned long start, struct acpi_rsdp *rsdp)
+{
+ unsigned long current;
+#if CONFIG_IOMMU
+ acpi_dmar_t *dmar;
+#endif
+
+ current = start;
+
+#if CONFIG_IOMMU
+ printk(BIOS_DEBUG, "ACPI: * DMAR\n");
+ dmar = (acpi_dmar_t *) current;
+ acpi_create_dmar(dmar);
+ current += dmar->header.length;
+ ALIGN_CURRENT;
+ acpi_add_table(rsdp, dmar);
+#endif
+
+ ALIGN_CURRENT;
+
+ printk(BIOS_DEBUG, "current = %lx\n", current);
+
+ return current;
+}
diff --git a/src/northbridge/intel/gm45/gm45.h b/src/northbridge/intel/gm45/gm45.h
index d93b6e4..673160b 100644
--- a/src/northbridge/intel/gm45/gm45.h
+++ b/src/northbridge/intel/gm45/gm45.h
@@ -429,6 +429,9 @@ u32 decode_igd_memory_size(u32 gms);
u32 decode_igd_gtt_size(u32 gsm);
void init_iommu(void);
+
+struct acpi_rsdp;
+unsigned long northbridge_write_acpi_tables(unsigned long start, struct acpi_rsdp *rsdp);
#endif
#endif
diff --git a/src/northbridge/intel/gm45/northbridge.c b/src/northbridge/intel/gm45/northbridge.c
index 7a4b038..e93d036 100644
--- a/src/northbridge/intel/gm45/northbridge.c
+++ b/src/northbridge/intel/gm45/northbridge.c
@@ -202,6 +202,8 @@ static struct device_operations pci_domain_ops = {
.init = mch_domain_init,
.scan_bus = pci_domain_scan_bus,
.ops_pci_bus = pci_bus_default_ops,
+ .write_acpi_tables = northbridge_write_acpi_tables,
+ .acpi_fill_ssdt_generator = generate_cpu_entries,
};
diff --git a/src/southbridge/intel/i82801ix/Kconfig b/src/southbridge/intel/i82801ix/Kconfig
index 92e7f41..1ad5aad 100644
--- a/src/southbridge/intel/i82801ix/Kconfig
+++ b/src/southbridge/intel/i82801ix/Kconfig
@@ -34,6 +34,10 @@ config EHCI_BAR
hex
default 0xfef00000
+config HPET_MIN_TICKS
+ hex
+ default 0x80
+
config BOOTBLOCK_SOUTHBRIDGE_INIT
string
default "southbridge/intel/i82801ix/bootblock.c"
diff --git a/src/southbridge/intel/i82801ix/acpi/globalnvs.asl b/src/southbridge/intel/i82801ix/acpi/globalnvs.asl
index 0384376..d050594 100644
--- a/src/southbridge/intel/i82801ix/acpi/globalnvs.asl
+++ b/src/southbridge/intel/i82801ix/acpi/globalnvs.asl
@@ -31,7 +31,8 @@ Name(\DSEN, 1) // Display Output Switching Enable
*/
-OperationRegion (GNVS, SystemMemory, 0xC0DEBABE, 0x100)
+External(NVSA)
+OperationRegion (GNVS, SystemMemory, NVSA, 0x100)
Field (GNVS, ByteAcc, NoLock, Preserve)
{
/* Miscellaneous */
diff --git a/src/southbridge/intel/i82801ix/lpc.c b/src/southbridge/intel/i82801ix/lpc.c
index ea88111..8105a4d 100644
--- a/src/southbridge/intel/i82801ix/lpc.c
+++ b/src/southbridge/intel/i82801ix/lpc.c
@@ -31,7 +31,11 @@
#include <arch/acpi.h>
#include <cpu/cpu.h>
#include <cpu/x86/smm.h>
+#include <arch/acpigen.h>
+#include <cbmem.h>
+#include <string.h>
#include "i82801ix.h"
+#include "nvs.h"
#define NMI_OFF 0
@@ -534,6 +538,26 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device)
}
}
+#if IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
+static void southbridge_inject_dsdt(void)
+{
+ global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof (*gnvs));
+
+ if (gnvs) {
+ int scopelen;
+ memset(gnvs, 0, sizeof (*gnvs));
+ acpi_create_gnvs(gnvs);
+ /* And tell SMI about it */
+ smm_setup_structures(gnvs, NULL, NULL);
+
+ /* Add it to SSDT. */
+ scopelen = acpigen_write_scope("\\");
+ scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs);
+ acpigen_patch_len(scopelen - 1);
+ }
+}
+#endif
+
static struct pci_operations pci_ops = {
.set_subsystem = set_subsystem,
};
@@ -542,6 +566,10 @@ static struct device_operations device_ops = {
.read_resources = i82801ix_lpc_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
+#if IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
+ .acpi_inject_dsdt_generator = southbridge_inject_dsdt,
+ .write_acpi_tables = acpi_write_hpet,
+#endif
.init = lpc_init,
.scan_bus = scan_static_bus,
.ops_pci = &pci_ops,
diff --git a/src/southbridge/intel/i82801ix/nvs.h b/src/southbridge/intel/i82801ix/nvs.h
index 14f0ad3..cf4065c 100644
--- a/src/southbridge/intel/i82801ix/nvs.h
+++ b/src/southbridge/intel/i82801ix/nvs.h
@@ -135,3 +135,5 @@ typedef struct {
u8 bten;
u8 rsvd13[14];
} __attribute__((packed)) global_nvs_t;
+
+void acpi_create_gnvs(global_nvs_t *gnvs);
1
0
Patch set updated for coreboot: 8f971d8 gm45: Convert to per-device ACPI
by Vladimir Serbinenko Oct. 5, 2014
by Vladimir Serbinenko Oct. 5, 2014
Oct. 5, 2014
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6803
-gerrit
commit 8f971d8886973d4f3029ccbb05e8a53c12f60297
Author: Vladimir Serbinenko <phcoder(a)gmail.com>
Date: Sat Aug 30 22:39:20 2014 +0200
gm45: Convert to per-device ACPI
Change-Id: Ib04b03b2dc2ad3bfa886b43df9dd6518bbb46e3f
Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com>
---
src/mainboard/lenovo/x200/acpi_tables.c | 224 +---------------------
src/mainboard/roda/rk9/acpi_tables.c | 224 +---------------------
src/northbridge/intel/gm45/Kconfig | 1 +
src/northbridge/intel/gm45/acpi.c | 37 ++++
src/northbridge/intel/gm45/gm45.h | 5 +
src/northbridge/intel/gm45/northbridge.c | 2 +
src/southbridge/intel/i82801ix/Kconfig | 4 +
src/southbridge/intel/i82801ix/acpi/globalnvs.asl | 3 +-
src/southbridge/intel/i82801ix/lpc.c | 28 +++
src/southbridge/intel/i82801ix/nvs.h | 2 +
10 files changed, 83 insertions(+), 447 deletions(-)
diff --git a/src/mainboard/lenovo/x200/acpi_tables.c b/src/mainboard/lenovo/x200/acpi_tables.c
index 6e6cd72..77491dc 100644
--- a/src/mainboard/lenovo/x200/acpi_tables.c
+++ b/src/mainboard/lenovo/x200/acpi_tables.c
@@ -30,13 +30,8 @@
#include <device/pci.h>
#include <device/pci_ids.h>
-extern const unsigned char AmlCode[];
-#if CONFIG_HAVE_ACPI_SLIC
-unsigned long acpi_create_slic(unsigned long current);
-#endif
-
#include "southbridge/intel/i82801ix/nvs.h"
-static void acpi_create_gnvs(global_nvs_t *gnvs)
+void acpi_create_gnvs(global_nvs_t *gnvs)
{
memset((void *)gnvs, 0, sizeof(*gnvs));
gnvs->apic = 1;
@@ -55,38 +50,6 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
gnvs->did[4] = 0x00000005;
}
-static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
-{
-#define HPET_ADDR 0xfed00000ULL
- acpi_header_t *header = &(hpet->header);
- acpi_addr_t *addr = &(hpet->addr);
-
- memset((void *) hpet, 0, sizeof(acpi_hpet_t));
-
- /* fill out header fields */
- memcpy(header->signature, "HPET", 4);
- memcpy(header->oem_id, OEM_ID, 6);
- memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
- memcpy(header->asl_compiler_id, ASLC, 4);
-
- header->length = sizeof(acpi_hpet_t);
- header->revision = 1;
-
- /* fill out HPET address */
- addr->space_id = 0; /* Memory */
- addr->bit_width = 64;
- addr->bit_offset = 0;
- addr->addrl = HPET_ADDR & 0xffffffff;
- addr->addrh = HPET_ADDR >> 32;
-
- hpet->id = 0x8086a201; /* Intel */
- hpet->number = 0x00;
- hpet->min_tick = 0x0080;
-
- header->checksum =
- acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
/* Local APICs */
@@ -115,12 +78,6 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
-unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
-{
- generate_cpu_entries();
- return (unsigned long) (acpigen_get_current());
-}
-
unsigned long acpi_fill_slit(unsigned long current)
{
// Not implemented
@@ -132,182 +89,3 @@ unsigned long acpi_fill_srat(unsigned long current)
/* No NUMA, no SRAT */
return current;
}
-
-void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
-
-#define ALIGN_CURRENT current = (ALIGN(current, 16))
-unsigned long write_acpi_tables(unsigned long start)
-{
- unsigned long current;
- int i;
- acpi_rsdp_t *rsdp;
- acpi_rsdt_t *rsdt;
- acpi_xsdt_t *xsdt;
- acpi_hpet_t *hpet;
- acpi_madt_t *madt;
- acpi_mcfg_t *mcfg;
- acpi_fadt_t *fadt;
- acpi_facs_t *facs;
-#if CONFIG_IOMMU
- acpi_dmar_t *dmar;
-#endif
-#if CONFIG_HAVE_ACPI_SLIC
- acpi_header_t *slic;
-#endif
- acpi_header_t *ssdt;
- acpi_header_t *dsdt;
- void *gnvs;
-
- current = start;
-
- /* Align ACPI tables to 16byte */
- ALIGN_CURRENT;
-
- printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
-
- /* We need at least an RSDP and an RSDT Table */
- rsdp = (acpi_rsdp_t *) current;
- current += sizeof(acpi_rsdp_t);
- ALIGN_CURRENT;
- rsdt = (acpi_rsdt_t *) current;
- current += sizeof(acpi_rsdt_t);
- ALIGN_CURRENT;
- xsdt = (acpi_xsdt_t *) current;
- current += sizeof(acpi_xsdt_t);
- ALIGN_CURRENT;
-
- /* clear all table memory */
- memset((void *) start, 0, current - start);
-
- acpi_write_rsdp(rsdp, rsdt, xsdt);
- acpi_write_rsdt(rsdt);
- acpi_write_xsdt(xsdt);
-
- /*
- * We explicitly add these tables later on:
- */
- printk(BIOS_DEBUG, "ACPI: * HPET\n");
-
- hpet = (acpi_hpet_t *) current;
- current += sizeof(acpi_hpet_t);
- ALIGN_CURRENT;
- acpi_create_intel_hpet(hpet);
- acpi_add_table(rsdp, hpet);
-
- /* If we want to use HPET Timers Linux wants an MADT */
- printk(BIOS_DEBUG, "ACPI: * MADT\n");
-
- madt = (acpi_madt_t *) current;
- acpi_create_madt(madt);
- current += madt->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, madt);
-
- printk(BIOS_DEBUG, "ACPI: * MCFG\n");
- mcfg = (acpi_mcfg_t *) current;
- acpi_create_mcfg(mcfg);
- current += mcfg->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, mcfg);
-
-#if CONFIG_IOMMU
- printk(BIOS_DEBUG, "ACPI: * DMAR\n");
- dmar = (acpi_dmar_t *) current;
- acpi_create_dmar(dmar);
- current += dmar->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, dmar);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FACS\n");
- facs = (acpi_facs_t *) current;
- current += sizeof(acpi_facs_t);
- ALIGN_CURRENT;
- acpi_create_facs(facs);
-
- dsdt = (acpi_header_t *) current;
- memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
-
- /* Fix up global NVS region for SMI handler. The GNVS region lives
- * in the (high) table area. The low memory map looks like this:
- *
- * 0x00000000 - 0x000003ff Real Mode IVT
- * 0x00000020 - 0x0000019c Low MP Table (XXX conflict?)
- * 0x00000400 - 0x000004ff BDA (somewhat unused)
- * 0x00000500 - 0x0000052f Moved GDT
- * 0x00000530 - 0x00000b64 coreboot table
- * 0x0007c000 - 0x0007dfff OS boot sector (unused?)
- * 0x0007e000 - 0x0007ffff free to use (so no good for acpi+smi)
- * 0x00080000 - 0x0009fbff usable ram
- * 0x0009fc00 - 0x0009ffff EBDA (unused?)
- * 0x000a0000 - 0x000bffff VGA memory
- * 0x000c0000 - 0x000cffff VGA option rom
- * 0x000d0000 - 0x000dffff free for other option roms?
- * 0x000e0000 - 0x000fffff SeaBIOS? (conflict with low tables:)
- * 0x000f0000 - 0x000f03ff PIRQ table
- * 0x000f0400 - 0x000f66?? ACPI tables
- * 0x000f66?? - 0x000f???? DMI tables
- */
-
- ALIGN_CURRENT;
-
- /* Pack GNVS into the ACPI table area */
- for (i=0; i < dsdt->length; i++) {
- if (*(u32*)(((u32)dsdt) + i) == 0xC0DEBABE) {
- printk(BIOS_DEBUG, "ACPI: Patching up global NVS in DSDT at offset 0x%04x -> 0x%08x\n", i, (u32)current);
- *(u32*)(((u32)dsdt) + i) = current; // 0x92 bytes
- break;
- }
- }
-
- /* And fill it */
- acpi_create_gnvs((global_nvs_t *)current);
-
- /* Keep pointer around */
- gnvs = (void *)current;
-
- current += 0x100;
- ALIGN_CURRENT;
-
-#if CONFIG_HAVE_SMI_HANDLER
- /* And tell SMI about it */
- smm_setup_structures(gnvs, NULL, NULL);
-#endif
-
- /* We patched up the DSDT, so we need to recalculate the checksum */
- dsdt->checksum = 0;
- dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
-
- printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
- dsdt->length);
-
-#if CONFIG_HAVE_ACPI_SLIC
- printk(BIOS_DEBUG, "ACPI: * SLIC\n");
- slic = (acpi_header_t *)current;
- current += acpi_create_slic(current);
- ALIGN_CURRENT;
- acpi_add_table(rsdp, slic);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FADT\n");
- fadt = (acpi_fadt_t *) current;
- current += sizeof(acpi_fadt_t);
- ALIGN_CURRENT;
-
- acpi_create_fadt(fadt, facs, dsdt);
- acpi_add_table(rsdp, fadt);
-
- printk(BIOS_DEBUG, "ACPI: * SSDT\n");
- ssdt = (acpi_header_t *)current;
- acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
- current += ssdt->length;
- acpi_add_table(rsdp, ssdt);
- ALIGN_CURRENT;
-
- printk(BIOS_DEBUG, "current = %lx\n", current);
- printk(BIOS_INFO, "ACPI: done.\n");
-
- return current;
-}
diff --git a/src/mainboard/roda/rk9/acpi_tables.c b/src/mainboard/roda/rk9/acpi_tables.c
index 6e6cd72..77491dc 100644
--- a/src/mainboard/roda/rk9/acpi_tables.c
+++ b/src/mainboard/roda/rk9/acpi_tables.c
@@ -30,13 +30,8 @@
#include <device/pci.h>
#include <device/pci_ids.h>
-extern const unsigned char AmlCode[];
-#if CONFIG_HAVE_ACPI_SLIC
-unsigned long acpi_create_slic(unsigned long current);
-#endif
-
#include "southbridge/intel/i82801ix/nvs.h"
-static void acpi_create_gnvs(global_nvs_t *gnvs)
+void acpi_create_gnvs(global_nvs_t *gnvs)
{
memset((void *)gnvs, 0, sizeof(*gnvs));
gnvs->apic = 1;
@@ -55,38 +50,6 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
gnvs->did[4] = 0x00000005;
}
-static void acpi_create_intel_hpet(acpi_hpet_t * hpet)
-{
-#define HPET_ADDR 0xfed00000ULL
- acpi_header_t *header = &(hpet->header);
- acpi_addr_t *addr = &(hpet->addr);
-
- memset((void *) hpet, 0, sizeof(acpi_hpet_t));
-
- /* fill out header fields */
- memcpy(header->signature, "HPET", 4);
- memcpy(header->oem_id, OEM_ID, 6);
- memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
- memcpy(header->asl_compiler_id, ASLC, 4);
-
- header->length = sizeof(acpi_hpet_t);
- header->revision = 1;
-
- /* fill out HPET address */
- addr->space_id = 0; /* Memory */
- addr->bit_width = 64;
- addr->bit_offset = 0;
- addr->addrl = HPET_ADDR & 0xffffffff;
- addr->addrh = HPET_ADDR >> 32;
-
- hpet->id = 0x8086a201; /* Intel */
- hpet->number = 0x00;
- hpet->min_tick = 0x0080;
-
- header->checksum =
- acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
/* Local APICs */
@@ -115,12 +78,6 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
-unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
-{
- generate_cpu_entries();
- return (unsigned long) (acpigen_get_current());
-}
-
unsigned long acpi_fill_slit(unsigned long current)
{
// Not implemented
@@ -132,182 +89,3 @@ unsigned long acpi_fill_srat(unsigned long current)
/* No NUMA, no SRAT */
return current;
}
-
-void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
-
-#define ALIGN_CURRENT current = (ALIGN(current, 16))
-unsigned long write_acpi_tables(unsigned long start)
-{
- unsigned long current;
- int i;
- acpi_rsdp_t *rsdp;
- acpi_rsdt_t *rsdt;
- acpi_xsdt_t *xsdt;
- acpi_hpet_t *hpet;
- acpi_madt_t *madt;
- acpi_mcfg_t *mcfg;
- acpi_fadt_t *fadt;
- acpi_facs_t *facs;
-#if CONFIG_IOMMU
- acpi_dmar_t *dmar;
-#endif
-#if CONFIG_HAVE_ACPI_SLIC
- acpi_header_t *slic;
-#endif
- acpi_header_t *ssdt;
- acpi_header_t *dsdt;
- void *gnvs;
-
- current = start;
-
- /* Align ACPI tables to 16byte */
- ALIGN_CURRENT;
-
- printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
-
- /* We need at least an RSDP and an RSDT Table */
- rsdp = (acpi_rsdp_t *) current;
- current += sizeof(acpi_rsdp_t);
- ALIGN_CURRENT;
- rsdt = (acpi_rsdt_t *) current;
- current += sizeof(acpi_rsdt_t);
- ALIGN_CURRENT;
- xsdt = (acpi_xsdt_t *) current;
- current += sizeof(acpi_xsdt_t);
- ALIGN_CURRENT;
-
- /* clear all table memory */
- memset((void *) start, 0, current - start);
-
- acpi_write_rsdp(rsdp, rsdt, xsdt);
- acpi_write_rsdt(rsdt);
- acpi_write_xsdt(xsdt);
-
- /*
- * We explicitly add these tables later on:
- */
- printk(BIOS_DEBUG, "ACPI: * HPET\n");
-
- hpet = (acpi_hpet_t *) current;
- current += sizeof(acpi_hpet_t);
- ALIGN_CURRENT;
- acpi_create_intel_hpet(hpet);
- acpi_add_table(rsdp, hpet);
-
- /* If we want to use HPET Timers Linux wants an MADT */
- printk(BIOS_DEBUG, "ACPI: * MADT\n");
-
- madt = (acpi_madt_t *) current;
- acpi_create_madt(madt);
- current += madt->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, madt);
-
- printk(BIOS_DEBUG, "ACPI: * MCFG\n");
- mcfg = (acpi_mcfg_t *) current;
- acpi_create_mcfg(mcfg);
- current += mcfg->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, mcfg);
-
-#if CONFIG_IOMMU
- printk(BIOS_DEBUG, "ACPI: * DMAR\n");
- dmar = (acpi_dmar_t *) current;
- acpi_create_dmar(dmar);
- current += dmar->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, dmar);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FACS\n");
- facs = (acpi_facs_t *) current;
- current += sizeof(acpi_facs_t);
- ALIGN_CURRENT;
- acpi_create_facs(facs);
-
- dsdt = (acpi_header_t *) current;
- memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
-
- /* Fix up global NVS region for SMI handler. The GNVS region lives
- * in the (high) table area. The low memory map looks like this:
- *
- * 0x00000000 - 0x000003ff Real Mode IVT
- * 0x00000020 - 0x0000019c Low MP Table (XXX conflict?)
- * 0x00000400 - 0x000004ff BDA (somewhat unused)
- * 0x00000500 - 0x0000052f Moved GDT
- * 0x00000530 - 0x00000b64 coreboot table
- * 0x0007c000 - 0x0007dfff OS boot sector (unused?)
- * 0x0007e000 - 0x0007ffff free to use (so no good for acpi+smi)
- * 0x00080000 - 0x0009fbff usable ram
- * 0x0009fc00 - 0x0009ffff EBDA (unused?)
- * 0x000a0000 - 0x000bffff VGA memory
- * 0x000c0000 - 0x000cffff VGA option rom
- * 0x000d0000 - 0x000dffff free for other option roms?
- * 0x000e0000 - 0x000fffff SeaBIOS? (conflict with low tables:)
- * 0x000f0000 - 0x000f03ff PIRQ table
- * 0x000f0400 - 0x000f66?? ACPI tables
- * 0x000f66?? - 0x000f???? DMI tables
- */
-
- ALIGN_CURRENT;
-
- /* Pack GNVS into the ACPI table area */
- for (i=0; i < dsdt->length; i++) {
- if (*(u32*)(((u32)dsdt) + i) == 0xC0DEBABE) {
- printk(BIOS_DEBUG, "ACPI: Patching up global NVS in DSDT at offset 0x%04x -> 0x%08x\n", i, (u32)current);
- *(u32*)(((u32)dsdt) + i) = current; // 0x92 bytes
- break;
- }
- }
-
- /* And fill it */
- acpi_create_gnvs((global_nvs_t *)current);
-
- /* Keep pointer around */
- gnvs = (void *)current;
-
- current += 0x100;
- ALIGN_CURRENT;
-
-#if CONFIG_HAVE_SMI_HANDLER
- /* And tell SMI about it */
- smm_setup_structures(gnvs, NULL, NULL);
-#endif
-
- /* We patched up the DSDT, so we need to recalculate the checksum */
- dsdt->checksum = 0;
- dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
-
- printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
- dsdt->length);
-
-#if CONFIG_HAVE_ACPI_SLIC
- printk(BIOS_DEBUG, "ACPI: * SLIC\n");
- slic = (acpi_header_t *)current;
- current += acpi_create_slic(current);
- ALIGN_CURRENT;
- acpi_add_table(rsdp, slic);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FADT\n");
- fadt = (acpi_fadt_t *) current;
- current += sizeof(acpi_fadt_t);
- ALIGN_CURRENT;
-
- acpi_create_fadt(fadt, facs, dsdt);
- acpi_add_table(rsdp, fadt);
-
- printk(BIOS_DEBUG, "ACPI: * SSDT\n");
- ssdt = (acpi_header_t *)current;
- acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
- current += ssdt->length;
- acpi_add_table(rsdp, ssdt);
- ALIGN_CURRENT;
-
- printk(BIOS_DEBUG, "current = %lx\n", current);
- printk(BIOS_INFO, "ACPI: done.\n");
-
- return current;
-}
diff --git a/src/northbridge/intel/gm45/Kconfig b/src/northbridge/intel/gm45/Kconfig
index b9244f9..fac7329 100644
--- a/src/northbridge/intel/gm45/Kconfig
+++ b/src/northbridge/intel/gm45/Kconfig
@@ -31,6 +31,7 @@ config NORTHBRIDGE_SPECIFIC_OPTIONS # dummy
select IOMMU
select VGA
select INTEL_EDID
+ select PER_DEVICE_ACPI_TABLES
config BOOTBLOCK_NORTHBRIDGE_INIT
string
diff --git a/src/northbridge/intel/gm45/acpi.c b/src/northbridge/intel/gm45/acpi.c
index da9bfa8..8803b47 100644
--- a/src/northbridge/intel/gm45/acpi.c
+++ b/src/northbridge/intel/gm45/acpi.c
@@ -27,6 +27,9 @@
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
+#include <cbmem.h>
+#include <arch/acpigen.h>
+#include <cpu/cpu.h>
#include "gm45.h"
unsigned long acpi_fill_mcfg(unsigned long current)
@@ -105,3 +108,37 @@ unsigned long acpi_fill_dmar(unsigned long current)
/* TODO: reserve GTT for 0.2.0 and 0.2.1? */
return current;
}
+
+unsigned long northbridge_acpi_fill_ssdt_generator(unsigned long current,
+ const char *oem_table_id)
+{
+ generate_cpu_entries();
+ return (unsigned long) (acpigen_get_current());
+}
+
+
+#define ALIGN_CURRENT current = (ALIGN(current, 16))
+unsigned long northbridge_write_acpi_tables(unsigned long start, struct acpi_rsdp *rsdp)
+{
+ unsigned long current;
+#if CONFIG_IOMMU
+ acpi_dmar_t *dmar;
+#endif
+
+ current = start;
+
+#if CONFIG_IOMMU
+ printk(BIOS_DEBUG, "ACPI: * DMAR\n");
+ dmar = (acpi_dmar_t *) current;
+ acpi_create_dmar(dmar);
+ current += dmar->header.length;
+ ALIGN_CURRENT;
+ acpi_add_table(rsdp, dmar);
+#endif
+
+ ALIGN_CURRENT;
+
+ printk(BIOS_DEBUG, "current = %lx\n", current);
+
+ return current;
+}
diff --git a/src/northbridge/intel/gm45/gm45.h b/src/northbridge/intel/gm45/gm45.h
index d93b6e4..99a063a 100644
--- a/src/northbridge/intel/gm45/gm45.h
+++ b/src/northbridge/intel/gm45/gm45.h
@@ -429,6 +429,11 @@ u32 decode_igd_memory_size(u32 gms);
u32 decode_igd_gtt_size(u32 gsm);
void init_iommu(void);
+
+struct acpi_rsdp;
+unsigned long northbridge_write_acpi_tables(unsigned long start, struct acpi_rsdp *rsdp);
+unsigned long northbridge_acpi_fill_ssdt_generator(unsigned long current,
+ const char *oem_table_id);
#endif
#endif
diff --git a/src/northbridge/intel/gm45/northbridge.c b/src/northbridge/intel/gm45/northbridge.c
index 7a4b038..474122b 100644
--- a/src/northbridge/intel/gm45/northbridge.c
+++ b/src/northbridge/intel/gm45/northbridge.c
@@ -202,6 +202,8 @@ static struct device_operations pci_domain_ops = {
.init = mch_domain_init,
.scan_bus = pci_domain_scan_bus,
.ops_pci_bus = pci_bus_default_ops,
+ .write_acpi_tables = northbridge_write_acpi_tables,
+ .acpi_fill_ssdt_generator = northbridge_acpi_fill_ssdt_generator,
};
diff --git a/src/southbridge/intel/i82801ix/Kconfig b/src/southbridge/intel/i82801ix/Kconfig
index 92e7f41..1ad5aad 100644
--- a/src/southbridge/intel/i82801ix/Kconfig
+++ b/src/southbridge/intel/i82801ix/Kconfig
@@ -34,6 +34,10 @@ config EHCI_BAR
hex
default 0xfef00000
+config HPET_MIN_TICKS
+ hex
+ default 0x80
+
config BOOTBLOCK_SOUTHBRIDGE_INIT
string
default "southbridge/intel/i82801ix/bootblock.c"
diff --git a/src/southbridge/intel/i82801ix/acpi/globalnvs.asl b/src/southbridge/intel/i82801ix/acpi/globalnvs.asl
index 0384376..d050594 100644
--- a/src/southbridge/intel/i82801ix/acpi/globalnvs.asl
+++ b/src/southbridge/intel/i82801ix/acpi/globalnvs.asl
@@ -31,7 +31,8 @@ Name(\DSEN, 1) // Display Output Switching Enable
*/
-OperationRegion (GNVS, SystemMemory, 0xC0DEBABE, 0x100)
+External(NVSA)
+OperationRegion (GNVS, SystemMemory, NVSA, 0x100)
Field (GNVS, ByteAcc, NoLock, Preserve)
{
/* Miscellaneous */
diff --git a/src/southbridge/intel/i82801ix/lpc.c b/src/southbridge/intel/i82801ix/lpc.c
index ea88111..8105a4d 100644
--- a/src/southbridge/intel/i82801ix/lpc.c
+++ b/src/southbridge/intel/i82801ix/lpc.c
@@ -31,7 +31,11 @@
#include <arch/acpi.h>
#include <cpu/cpu.h>
#include <cpu/x86/smm.h>
+#include <arch/acpigen.h>
+#include <cbmem.h>
+#include <string.h>
#include "i82801ix.h"
+#include "nvs.h"
#define NMI_OFF 0
@@ -534,6 +538,26 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device)
}
}
+#if IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
+static void southbridge_inject_dsdt(void)
+{
+ global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof (*gnvs));
+
+ if (gnvs) {
+ int scopelen;
+ memset(gnvs, 0, sizeof (*gnvs));
+ acpi_create_gnvs(gnvs);
+ /* And tell SMI about it */
+ smm_setup_structures(gnvs, NULL, NULL);
+
+ /* Add it to SSDT. */
+ scopelen = acpigen_write_scope("\\");
+ scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs);
+ acpigen_patch_len(scopelen - 1);
+ }
+}
+#endif
+
static struct pci_operations pci_ops = {
.set_subsystem = set_subsystem,
};
@@ -542,6 +566,10 @@ static struct device_operations device_ops = {
.read_resources = i82801ix_lpc_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
+#if IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
+ .acpi_inject_dsdt_generator = southbridge_inject_dsdt,
+ .write_acpi_tables = acpi_write_hpet,
+#endif
.init = lpc_init,
.scan_bus = scan_static_bus,
.ops_pci = &pci_ops,
diff --git a/src/southbridge/intel/i82801ix/nvs.h b/src/southbridge/intel/i82801ix/nvs.h
index 14f0ad3..cf4065c 100644
--- a/src/southbridge/intel/i82801ix/nvs.h
+++ b/src/southbridge/intel/i82801ix/nvs.h
@@ -135,3 +135,5 @@ typedef struct {
u8 bten;
u8 rsvd13[14];
} __attribute__((packed)) global_nvs_t;
+
+void acpi_create_gnvs(global_nvs_t *gnvs);
1
0
Patch set updated for coreboot: 6f522de i945: Convert to per-device ACPI
by Vladimir Serbinenko Oct. 5, 2014
by Vladimir Serbinenko Oct. 5, 2014
Oct. 5, 2014
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6804
-gerrit
commit 6f522de2adab70d7e4511c1f891ce84ca98db636
Author: Vladimir Serbinenko <phcoder(a)gmail.com>
Date: Sun Aug 31 00:27:05 2014 +0200
i945: Convert to per-device ACPI
Change-Id: Iee3ee33ca58b8c722d2d38aae31e7130032512ad
Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com>
---
src/mainboard/apple/macbook21/acpi_tables.c | 178 +--------------------
src/mainboard/getac/p470/acpi_tables.c | 163 +-------------------
src/mainboard/getac/p470/mainboard.c | 4 +
src/mainboard/getac/p470/mainboard.h | 4 +
src/mainboard/ibase/mb899/acpi_tables.c | 151 +-----------------
src/mainboard/intel/d945gclf/acpi_tables.c | 150 +-----------------
src/mainboard/kontron/986lcd-m/acpi_tables.c | 152 +-----------------
src/mainboard/lenovo/t60/acpi_tables.c | 178 +--------------------
src/mainboard/lenovo/x60/acpi_tables.c | 180 +---------------------
src/mainboard/lenovo/x60/mainboard.c | 9 ++
src/mainboard/roda/rk886ex/acpi_tables.c | 178 +--------------------
src/northbridge/intel/i945/Kconfig | 1 +
src/northbridge/intel/i945/acpi.c | 10 ++
src/northbridge/intel/i945/i945.h | 3 +
src/northbridge/intel/i945/northbridge.c | 1 +
src/southbridge/intel/i82801gx/acpi/globalnvs.asl | 4 +-
src/southbridge/intel/i82801gx/lpc.c | 24 +++
src/southbridge/intel/i82801gx/nvs.h | 2 +
18 files changed, 70 insertions(+), 1322 deletions(-)
diff --git a/src/mainboard/apple/macbook21/acpi_tables.c b/src/mainboard/apple/macbook21/acpi_tables.c
index c81c2f6..ada7d08 100644
--- a/src/mainboard/apple/macbook21/acpi_tables.c
+++ b/src/mainboard/apple/macbook21/acpi_tables.c
@@ -30,13 +30,8 @@
#include <device/pci.h>
#include <device/pci_ids.h>
-extern const unsigned char AmlCode[];
-#if CONFIG_HAVE_ACPI_SLIC
-unsigned long acpi_create_slic(unsigned long current);
-#endif
-
#include "southbridge/intel/i82801gx/nvs.h"
-static void acpi_create_gnvs(global_nvs_t *gnvs)
+void acpi_create_gnvs(global_nvs_t *gnvs)
{
memset((void *)gnvs, 0, sizeof(*gnvs));
gnvs->apic = 1;
@@ -83,12 +78,6 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
-unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
-{
- generate_cpu_entries();
- return (unsigned long) (acpigen_get_current());
-}
-
unsigned long acpi_fill_slit(unsigned long current)
{
// Not implemented
@@ -100,168 +89,3 @@ unsigned long acpi_fill_srat(unsigned long current)
/* No NUMA, no SRAT */
return current;
}
-
-void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
-
-#define ALIGN_CURRENT current = (ALIGN(current, 16))
-unsigned long write_acpi_tables(unsigned long start)
-{
- unsigned long current;
- int i;
- acpi_rsdp_t *rsdp;
- acpi_rsdt_t *rsdt;
- acpi_xsdt_t *xsdt;
- acpi_hpet_t *hpet;
- acpi_madt_t *madt;
- acpi_mcfg_t *mcfg;
- acpi_fadt_t *fadt;
- acpi_facs_t *facs;
-#if CONFIG_HAVE_ACPI_SLIC
- acpi_header_t *slic;
-#endif
- acpi_header_t *ssdt;
- acpi_header_t *dsdt;
- void *gnvs;
-
- current = start;
-
- /* Align ACPI tables to 16byte */
- ALIGN_CURRENT;
-
- printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
-
- /* We need at least an RSDP and an RSDT Table */
- rsdp = (acpi_rsdp_t *) current;
- current += sizeof(acpi_rsdp_t);
- ALIGN_CURRENT;
- rsdt = (acpi_rsdt_t *) current;
- current += sizeof(acpi_rsdt_t);
- ALIGN_CURRENT;
- xsdt = (acpi_xsdt_t *) current;
- current += sizeof(acpi_xsdt_t);
- ALIGN_CURRENT;
-
- /* clear all table memory */
- memset((void *) start, 0, current - start);
-
- acpi_write_rsdp(rsdp, rsdt, xsdt);
- acpi_write_rsdt(rsdt);
- acpi_write_xsdt(xsdt);
-
- /*
- * We explicitly add these tables later on:
- */
- printk(BIOS_DEBUG, "ACPI: * HPET\n");
-
- hpet = (acpi_hpet_t *) current;
- current += sizeof(acpi_hpet_t);
- ALIGN_CURRENT;
- acpi_create_hpet(hpet);
- acpi_add_table(rsdp, hpet);
-
- /* If we want to use HPET Timers Linux wants an MADT */
- printk(BIOS_DEBUG, "ACPI: * MADT\n");
-
- madt = (acpi_madt_t *) current;
- acpi_create_madt(madt);
- current += madt->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, madt);
-
- printk(BIOS_DEBUG, "ACPI: * MCFG\n");
- mcfg = (acpi_mcfg_t *) current;
- acpi_create_mcfg(mcfg);
- current += mcfg->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, mcfg);
-
- printk(BIOS_DEBUG, "ACPI: * FACS\n");
- facs = (acpi_facs_t *) current;
- current += sizeof(acpi_facs_t);
- ALIGN_CURRENT;
- acpi_create_facs(facs);
-
- dsdt = (acpi_header_t *) current;
- memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
-
- /* Fix up global NVS region for SMI handler. The GNVS region lives
- * in the (high) table area. The low memory map looks like this:
- *
- * 0x00000000 - 0x000003ff Real Mode IVT
- * 0x00000020 - 0x0000019c Low MP Table (XXX conflict?)
- * 0x00000400 - 0x000004ff BDA (somewhat unused)
- * 0x00000500 - 0x0000052f Moved GDT
- * 0x00000530 - 0x00000b64 coreboot table
- * 0x0007c000 - 0x0007dfff OS boot sector (unused?)
- * 0x0007e000 - 0x0007ffff free to use (so no good for acpi+smi)
- * 0x00080000 - 0x0009fbff usable ram
- * 0x0009fc00 - 0x0009ffff EBDA (unused?)
- * 0x000a0000 - 0x000bffff VGA memory
- * 0x000c0000 - 0x000cffff VGA option rom
- * 0x000d0000 - 0x000dffff free for other option roms?
- * 0x000e0000 - 0x000fffff SeaBIOS? (conflict with low tables:)
- * 0x000f0000 - 0x000f03ff PIRQ table
- * 0x000f0400 - 0x000f66?? ACPI tables
- * 0x000f66?? - 0x000f???? DMI tables
- */
-
- ALIGN_CURRENT;
-
- /* Pack GNVS into the ACPI table area */
- for (i=0; i < dsdt->length; i++) {
- if (*(u32*)(((u32)dsdt) + i) == 0xC0DEBABE) {
- printk(BIOS_DEBUG, "ACPI: Patching up global NVS in DSDT at offset 0x%04x -> 0x%08x\n", i, (u32)current);
- *(u32*)(((u32)dsdt) + i) = current; // 0x92 bytes
- break;
- }
- }
-
- /* And fill it */
- acpi_create_gnvs((global_nvs_t *)current);
-
- /* Keep pointer around */
- gnvs = (void *)current;
-
- current += 0x100;
- ALIGN_CURRENT;
-
- /* And tell SMI about it */
- smm_setup_structures(gnvs, NULL, NULL);
-
- /* We patched up the DSDT, so we need to recalculate the checksum */
- dsdt->checksum = 0;
- dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
-
- printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
- dsdt->length);
-
-#if CONFIG_HAVE_ACPI_SLIC
- printk(BIOS_DEBUG, "ACPI: * SLIC\n");
- slic = (acpi_header_t *)current;
- current += acpi_create_slic(current);
- ALIGN_CURRENT;
- acpi_add_table(rsdp, slic);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FADT\n");
- fadt = (acpi_fadt_t *) current;
- current += sizeof(acpi_fadt_t);
- ALIGN_CURRENT;
-
- acpi_create_fadt(fadt, facs, dsdt);
- acpi_add_table(rsdp, fadt);
-
- printk(BIOS_DEBUG, "ACPI: * SSDT\n");
- ssdt = (acpi_header_t *)current;
- acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
- current += ssdt->length;
- acpi_add_table(rsdp, ssdt);
- ALIGN_CURRENT;
-
- printk(BIOS_DEBUG, "current = %lx\n", current);
- printk(BIOS_INFO, "ACPI: done.\n");
-
- return current;
-}
diff --git a/src/mainboard/getac/p470/acpi_tables.c b/src/mainboard/getac/p470/acpi_tables.c
index 9cd55f4..1e22eae 100644
--- a/src/mainboard/getac/p470/acpi_tables.c
+++ b/src/mainboard/getac/p470/acpi_tables.c
@@ -30,11 +30,10 @@
#include <device/pci.h>
#include <device/pci_ids.h>
-extern unsigned char AmlCode[];
-
#include "southbridge/intel/i82801gx/nvs.h"
+#include "mainboard.h"
-static void acpi_create_gnvs(global_nvs_t *gnvs)
+void acpi_create_gnvs(global_nvs_t *gnvs)
{
memset((void *)gnvs, 0, sizeof(*gnvs));
gnvs->apic = 1;
@@ -123,12 +122,6 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
-unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
-{
- generate_cpu_entries();
- return (unsigned long) (acpigen_get_current());
-}
-
unsigned long acpi_fill_slit(unsigned long current)
{
// Not implemented
@@ -141,173 +134,23 @@ unsigned long acpi_fill_srat(unsigned long current)
return current;
}
-void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
-
#define ALIGN_CURRENT current = (ALIGN(current, 16))
-unsigned long write_acpi_tables(unsigned long start)
+unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp)
{
unsigned long current;
- int i;
- acpi_rsdp_t *rsdp;
- acpi_rsdt_t *rsdt;
- acpi_xsdt_t *xsdt;
- acpi_hpet_t *hpet;
- acpi_madt_t *madt;
- acpi_mcfg_t *mcfg;
- acpi_fadt_t *fadt;
- acpi_facs_t *facs;
-#if CONFIG_HAVE_ACPI_SLIC
- acpi_header_t *slic;
-#endif
- acpi_header_t *ssdt;
- acpi_header_t *dsdt;
acpi_header_t *ecdt;
- void *gnvs;
-
current = start;
/* Align ACPI tables to 16byte */
ALIGN_CURRENT;
- printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
-
- /* We need at least an RSDP and an RSDT Table */
- rsdp = (acpi_rsdp_t *) current;
- current += sizeof(acpi_rsdp_t);
- ALIGN_CURRENT;
- rsdt = (acpi_rsdt_t *) current;
- current += sizeof(acpi_rsdt_t);
- ALIGN_CURRENT;
- xsdt = (acpi_xsdt_t *) current;
- current += sizeof(acpi_xsdt_t);
- ALIGN_CURRENT;
-
- /* clear all table memory */
- memset((void *) start, 0, current - start);
-
- acpi_write_rsdp(rsdp, rsdt, xsdt);
- acpi_write_rsdt(rsdt);
- acpi_write_xsdt(xsdt);
-
- /*
- * We explicitly add these tables later on:
- */
- printk(BIOS_DEBUG, "ACPI: * HPET\n");
-
- hpet = (acpi_hpet_t *) current;
- current += sizeof(acpi_hpet_t);
- ALIGN_CURRENT;
- acpi_create_hpet(hpet);
- acpi_add_table(rsdp, hpet);
-
- /* If we want to use HPET Timers Linux wants an MADT */
- printk(BIOS_DEBUG, "ACPI: * MADT\n");
-
- madt = (acpi_madt_t *) current;
- acpi_create_madt(madt);
- current += madt->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, madt);
-
- printk(BIOS_DEBUG, "ACPI: * MCFG\n");
- mcfg = (acpi_mcfg_t *) current;
- acpi_create_mcfg(mcfg);
- current += mcfg->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, mcfg);
-
- printk(BIOS_DEBUG, "ACPI: * FACS\n");
- facs = (acpi_facs_t *) current;
- current += sizeof(acpi_facs_t);
- ALIGN_CURRENT;
- acpi_create_facs(facs);
-
- dsdt = (acpi_header_t *) current;
- memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
-
- /* Fix up global NVS region for SMI handler. The GNVS region lives
- * in the (high) table area. The low memory map looks like this:
- *
- * 0x00000000 - 0x000003ff Real Mode IVT
- * 0x00000400 - 0x000004ff BDA (somewhat unused)
- * 0x00000500 - 0x00000518 coreboot table forwarder
- * 0x00000600 - 0x00000??? realmode trampoline
- * 0x0007c000 - 0x0007dfff OS boot sector (unused?)
- * 0x0007e000 - 0x0007ffff free to use (so no good for acpi+smi)
- * 0x00080000 - 0x0009fbff usable ram
- * 0x0009fc00 - 0x0009ffff EBDA (unused?)
- * 0x000a0000 - 0x000bffff VGA memory
- * 0x000c0000 - 0x000cffff VGA option rom
- * 0x000d0000 - 0x000dffff free for other option roms?
- * 0x000e0000 - 0x000fffff SeaBIOS? (conflict with low tables:)
- * 0x000f0000 - 0x000f03ff PIRQ table
- * 0x000f0400 - 0x000f66?? ACPI tables
- * 0x000f66?? - 0x000f???? DMI tables
- */
-
- ALIGN_CURRENT;
-
- /* Pack GNVS into the ACPI table area */
- for (i=0; i < dsdt->length; i++) {
- if (*(u32*)(((u32)dsdt) + i) == 0xC0DEBABE) {
- printk(BIOS_DEBUG, "ACPI: Patching up global NVS in DSDT at offset 0x%04x -> 0x%08x\n", i, (u32)current);
- *(u32*)(((u32)dsdt) + i) = current; // 0x92 bytes
- break;
- }
- }
-
- /* And fill it */
- acpi_create_gnvs((global_nvs_t *)current);
-
- /* Keep pointer around */
- gnvs = (void *)current;
-
- current += 0x100;
- ALIGN_CURRENT;
-
- /* And tell SMI about it */
- smm_setup_structures(gnvs, NULL, NULL);
-
- /* We patched up the DSDT, so we need to recalculate the checksum */
- dsdt->checksum = 0;
- dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
-
- printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
- dsdt->length);
-
printk(BIOS_DEBUG, "ACPI: * ECDT\n");
ecdt = (acpi_header_t *)current;
current += acpi_create_ecdt((acpi_ecdt_t *)current);
ALIGN_CURRENT;
acpi_add_table(rsdp, ecdt);
-#if CONFIG_HAVE_ACPI_SLIC
- printk(BIOS_DEBUG, "ACPI: * SLIC\n");
- slic = (acpi_header_t *)current;
- current += acpi_create_slic(current);
- ALIGN_CURRENT;
- acpi_add_table(rsdp, slic);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FADT\n");
- fadt = (acpi_fadt_t *) current;
- current += sizeof(acpi_fadt_t);
- ALIGN_CURRENT;
-
- acpi_create_fadt(fadt, facs, dsdt);
- acpi_add_table(rsdp, fadt);
-
- printk(BIOS_DEBUG, "ACPI: * SSDT\n");
- ssdt = (acpi_header_t *)current;
- acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
- current += ssdt->length;
- acpi_add_table(rsdp, ssdt);
- ALIGN_CURRENT;
-
printk(BIOS_DEBUG, "current = %lx\n", current);
- printk(BIOS_INFO, "ACPI: done.\n");
return current;
}
diff --git a/src/mainboard/getac/p470/mainboard.c b/src/mainboard/getac/p470/mainboard.c
index 5dcdb39..2b33ff0 100644
--- a/src/mainboard/getac/p470/mainboard.c
+++ b/src/mainboard/getac/p470/mainboard.c
@@ -28,6 +28,8 @@
#include "ec_oem.c"
+#include "mainboard.h"
+
#define MAX_LCD_BRIGHTNESS 0xd8
static void ec_enable(void)
@@ -87,6 +89,8 @@ static void mainboard_init(device_t dev)
static void mainboard_enable(device_t dev)
{
dev->ops->init = mainboard_init;
+ dev->ops->write_acpi_tables = mainboard_write_acpi_tables;
+
pcie_limit_power();
}
diff --git a/src/mainboard/getac/p470/mainboard.h b/src/mainboard/getac/p470/mainboard.h
new file mode 100644
index 0000000..45d961b
--- /dev/null
+++ b/src/mainboard/getac/p470/mainboard.h
@@ -0,0 +1,4 @@
+struct acpi_rsdp;
+
+unsigned long mainboard_write_acpi_tables(unsigned long start,
+ struct acpi_rsdp *rsdp);
diff --git a/src/mainboard/ibase/mb899/acpi_tables.c b/src/mainboard/ibase/mb899/acpi_tables.c
index e6a517e..d7012d1 100644
--- a/src/mainboard/ibase/mb899/acpi_tables.c
+++ b/src/mainboard/ibase/mb899/acpi_tables.c
@@ -29,13 +29,8 @@
#include <device/pci_ids.h>
#include <cpu/x86/msr.h>
-extern const unsigned char AmlCode[];
-#if CONFIG_HAVE_ACPI_SLIC
-unsigned long acpi_create_slic(unsigned long current);
-#endif
-
#include "southbridge/intel/i82801gx/nvs.h"
-static void acpi_create_gnvs(global_nvs_t *gnvs)
+void acpi_create_gnvs(global_nvs_t *gnvs)
{
memset((void *)gnvs, 0, sizeof(*gnvs));
gnvs->apic = 1;
@@ -72,12 +67,6 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
-unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
-{
- generate_cpu_entries();
- return (unsigned long) (acpigen_get_current());
-}
-
unsigned long acpi_fill_slit(unsigned long current)
{
// Not implemented
@@ -90,141 +79,3 @@ unsigned long acpi_fill_srat(unsigned long current)
return current;
}
-void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
-
-#define ALIGN_CURRENT current = (ALIGN(current, 16))
-unsigned long write_acpi_tables(unsigned long start)
-{
- unsigned long current;
- int i;
- acpi_rsdp_t *rsdp;
- acpi_rsdt_t *rsdt;
- acpi_xsdt_t *xsdt;
- acpi_hpet_t *hpet;
- acpi_madt_t *madt;
- acpi_mcfg_t *mcfg;
- acpi_fadt_t *fadt;
- acpi_facs_t *facs;
-#if CONFIG_HAVE_ACPI_SLIC
- acpi_header_t *slic;
-#endif
- acpi_header_t *ssdt;
- acpi_header_t *dsdt;
-
- current = start;
-
- /* Align ACPI tables to 16byte */
- ALIGN_CURRENT;
-
- printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
-
- /* We need at least an RSDP and an RSDT Table */
- rsdp = (acpi_rsdp_t *) current;
- current += sizeof(acpi_rsdp_t);
- ALIGN_CURRENT;
- rsdt = (acpi_rsdt_t *) current;
- current += sizeof(acpi_rsdt_t);
- ALIGN_CURRENT;
- xsdt = (acpi_xsdt_t *) current;
- current += sizeof(acpi_xsdt_t);
- ALIGN_CURRENT;
-
- /* clear all table memory */
- memset((void *) start, 0, current - start);
-
- acpi_write_rsdp(rsdp, rsdt, xsdt);
- acpi_write_rsdt(rsdt);
- acpi_write_xsdt(xsdt);
-
- /*
- * We explicitly add these tables later on:
- */
- printk(BIOS_DEBUG, "ACPI: * HPET\n");
-
- hpet = (acpi_hpet_t *) current;
- current += sizeof(acpi_hpet_t);
- ALIGN_CURRENT;
- acpi_create_hpet(hpet);
- acpi_add_table(rsdp, hpet);
-
- /* If we want to use HPET Timers Linux wants an MADT */
- printk(BIOS_DEBUG, "ACPI: * MADT\n");
-
- madt = (acpi_madt_t *) current;
- acpi_create_madt(madt);
- current += madt->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, madt);
-
- printk(BIOS_DEBUG, "ACPI: * MCFG\n");
- mcfg = (acpi_mcfg_t *) current;
- acpi_create_mcfg(mcfg);
- current += mcfg->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, mcfg);
-
- printk(BIOS_DEBUG, "ACPI: * FACS\n");
- facs = (acpi_facs_t *) current;
- current += sizeof(acpi_facs_t);
- ALIGN_CURRENT;
- acpi_create_facs(facs);
-
- dsdt = (acpi_header_t *) current;
- memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
-
- ALIGN_CURRENT;
-
- /* Pack GNVS into the ACPI table area */
- for (i=0; i < dsdt->length; i++) {
- if (*(u32*)(((u32)dsdt) + i) == 0xC0DEBABE) {
- printk(BIOS_DEBUG, "ACPI: Patching up global NVS in DSDT at offset 0x%04x -> 0x%08lx\n", i, current);
- *(u32*)(((u32)dsdt) + i) = current; // 0x92 bytes
- break;
- }
- }
-
- /* And fill it */
- acpi_create_gnvs((global_nvs_t *)current);
-
- current += 0x100;
- ALIGN_CURRENT;
-
- /* And tell SMI about it */
- smm_setup_structures((void *)current, NULL, NULL);
-
- /* We patched up the DSDT, so we need to recalculate the checksum */
- dsdt->checksum = 0;
- dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
-
- printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
- dsdt->length);
-
-#if CONFIG_HAVE_ACPI_SLIC
- printk(BIOS_DEBUG, "ACPI: * SLIC\n");
- slic = (acpi_header_t *)current;
- current += acpi_create_slic(current);
- ALIGN_CURRENT;
- acpi_add_table(rsdp, slic);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FADT\n");
- fadt = (acpi_fadt_t *) current;
- current += sizeof(acpi_fadt_t);
- ALIGN_CURRENT;
-
- acpi_create_fadt(fadt, facs, dsdt);
- acpi_add_table(rsdp, fadt);
-
- printk(BIOS_DEBUG, "ACPI: * SSDT\n");
- ssdt = (acpi_header_t *)current;
- acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
- current += ssdt->length;
- acpi_add_table(rsdp, ssdt);
- ALIGN_CURRENT;
-
- printk(BIOS_DEBUG, "current = %lx\n", current);
- printk(BIOS_INFO, "ACPI: done.\n");
- return current;
-}
diff --git a/src/mainboard/intel/d945gclf/acpi_tables.c b/src/mainboard/intel/d945gclf/acpi_tables.c
index fba2b42..a27ea57 100644
--- a/src/mainboard/intel/d945gclf/acpi_tables.c
+++ b/src/mainboard/intel/d945gclf/acpi_tables.c
@@ -29,14 +29,9 @@
#include <cpu/x86/msr.h>
#include <arch/ioapic.h>
-extern const unsigned char AmlCode[];
-#if CONFIG_HAVE_ACPI_SLIC
-unsigned long acpi_create_slic(unsigned long current);
-#endif
-
#include "southbridge/intel/i82801gx/nvs.h"
-static void acpi_create_gnvs(global_nvs_t *gnvs)
+void acpi_create_gnvs(global_nvs_t *gnvs)
{
memset((void *)gnvs, 0, sizeof(*gnvs));
gnvs->apic = 1;
@@ -61,12 +56,6 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
-unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
-{
- generate_cpu_entries();
- return (unsigned long) (acpigen_get_current());
-}
-
unsigned long acpi_fill_slit(unsigned long current)
{
// Not implemented
@@ -78,140 +67,3 @@ unsigned long acpi_fill_srat(unsigned long current)
/* No NUMA, no SRAT */
return current;
}
-
-#if CONFIG_HAVE_SMI_HANDLER
-void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
-#endif
-
-#define ALIGN_CURRENT current = (ALIGN(current, 16))
-unsigned long write_acpi_tables(unsigned long start)
-{
- unsigned long current;
- int i;
- acpi_rsdp_t *rsdp;
- acpi_rsdt_t *rsdt;
- acpi_hpet_t *hpet;
- acpi_madt_t *madt;
- acpi_mcfg_t *mcfg;
- acpi_fadt_t *fadt;
- acpi_facs_t *facs;
-#if CONFIG_HAVE_ACPI_SLIC
- acpi_header_t *slic;
-#endif
- acpi_header_t *ssdt;
- acpi_header_t *dsdt;
-
- current = start;
-
- /* Align ACPI tables to 16byte */
- ALIGN_CURRENT;
-
- printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
-
- /* We need at least an RSDP and an RSDT Table */
- rsdp = (acpi_rsdp_t *) current;
- current += sizeof(acpi_rsdp_t);
- ALIGN_CURRENT;
- rsdt = (acpi_rsdt_t *) current;
- current += sizeof(acpi_rsdt_t);
- ALIGN_CURRENT;
-
- /* clear all table memory */
- memset((void *) start, 0, current - start);
-
- acpi_write_rsdp(rsdp, rsdt, NULL);
- acpi_write_rsdt(rsdt);
-
- /*
- * We explicitly add these tables later on:
- */
- printk(BIOS_DEBUG, "ACPI: * HPET\n");
-
- hpet = (acpi_hpet_t *) current;
- current += sizeof(acpi_hpet_t);
- ALIGN_CURRENT;
- acpi_create_hpet(hpet);
- acpi_add_table(rsdp, hpet);
-
- /* If we want to use HPET Timers Linux wants an MADT */
- printk(BIOS_DEBUG, "ACPI: * MADT\n");
-
- madt = (acpi_madt_t *) current;
- acpi_create_madt(madt);
- current += madt->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, madt);
-
- printk(BIOS_DEBUG, "ACPI: * MCFG\n");
- mcfg = (acpi_mcfg_t *) current;
- acpi_create_mcfg(mcfg);
- current += mcfg->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, mcfg);
-
- printk(BIOS_DEBUG, "ACPI: * FACS\n");
- facs = (acpi_facs_t *) current;
- current += sizeof(acpi_facs_t);
- ALIGN_CURRENT;
- acpi_create_facs(facs);
-
- dsdt = (acpi_header_t *) current;
- memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
-
- ALIGN_CURRENT;
-
- /* Pack GNVS into the ACPI table area */
- for (i=0; i < dsdt->length; i++) {
- if (*(u32*)(((u32)dsdt) + i) == 0xC0DEBABE) {
- printk(BIOS_DEBUG, "ACPI: Patching up global NVS in DSDT at offset 0x%04x -> 0x%08lx\n", i, current);
- *(u32*)(((u32)dsdt) + i) = current; // 0x92 bytes
- break;
- }
- }
-
- /* And fill it */
- acpi_create_gnvs((global_nvs_t *)current);
-
- current += 0x100;
- ALIGN_CURRENT;
-
-#if CONFIG_HAVE_SMI_HANDLER
- /* And tell SMI about it */
- smm_setup_structures((void *)current, NULL, NULL);
-#endif
-
- /* We patched up the DSDT, so we need to recalculate the checksum */
- dsdt->checksum = 0;
- dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
-
- printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
- dsdt->length);
-
-#if CONFIG_HAVE_ACPI_SLIC
- printk(BIOS_DEBUG, "ACPI: * SLIC\n");
- slic = (acpi_header_t *)current;
- current += acpi_create_slic(current);
- ALIGN_CURRENT;
- acpi_add_table(rsdp, slic);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FADT\n");
- fadt = (acpi_fadt_t *) current;
- current += sizeof(acpi_fadt_t);
- ALIGN_CURRENT;
-
- acpi_create_fadt(fadt, facs, dsdt);
- acpi_add_table(rsdp, fadt);
-
- printk(BIOS_DEBUG, "ACPI: * SSDT\n");
- ssdt = (acpi_header_t *)current;
- acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
- current += ssdt->length;
- acpi_add_table(rsdp, ssdt);
-
- printk(BIOS_DEBUG, "current = %lx\n", current);
- printk(BIOS_INFO, "ACPI: done.\n");
- return current;
-}
diff --git a/src/mainboard/kontron/986lcd-m/acpi_tables.c b/src/mainboard/kontron/986lcd-m/acpi_tables.c
index e6a517e..0560f8a 100644
--- a/src/mainboard/kontron/986lcd-m/acpi_tables.c
+++ b/src/mainboard/kontron/986lcd-m/acpi_tables.c
@@ -29,13 +29,8 @@
#include <device/pci_ids.h>
#include <cpu/x86/msr.h>
-extern const unsigned char AmlCode[];
-#if CONFIG_HAVE_ACPI_SLIC
-unsigned long acpi_create_slic(unsigned long current);
-#endif
-
#include "southbridge/intel/i82801gx/nvs.h"
-static void acpi_create_gnvs(global_nvs_t *gnvs)
+void acpi_create_gnvs(global_nvs_t *gnvs)
{
memset((void *)gnvs, 0, sizeof(*gnvs));
gnvs->apic = 1;
@@ -72,12 +67,6 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
-unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
-{
- generate_cpu_entries();
- return (unsigned long) (acpigen_get_current());
-}
-
unsigned long acpi_fill_slit(unsigned long current)
{
// Not implemented
@@ -89,142 +78,3 @@ unsigned long acpi_fill_srat(unsigned long current)
/* No NUMA, no SRAT */
return current;
}
-
-void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
-
-#define ALIGN_CURRENT current = (ALIGN(current, 16))
-unsigned long write_acpi_tables(unsigned long start)
-{
- unsigned long current;
- int i;
- acpi_rsdp_t *rsdp;
- acpi_rsdt_t *rsdt;
- acpi_xsdt_t *xsdt;
- acpi_hpet_t *hpet;
- acpi_madt_t *madt;
- acpi_mcfg_t *mcfg;
- acpi_fadt_t *fadt;
- acpi_facs_t *facs;
-#if CONFIG_HAVE_ACPI_SLIC
- acpi_header_t *slic;
-#endif
- acpi_header_t *ssdt;
- acpi_header_t *dsdt;
-
- current = start;
-
- /* Align ACPI tables to 16byte */
- ALIGN_CURRENT;
-
- printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
-
- /* We need at least an RSDP and an RSDT Table */
- rsdp = (acpi_rsdp_t *) current;
- current += sizeof(acpi_rsdp_t);
- ALIGN_CURRENT;
- rsdt = (acpi_rsdt_t *) current;
- current += sizeof(acpi_rsdt_t);
- ALIGN_CURRENT;
- xsdt = (acpi_xsdt_t *) current;
- current += sizeof(acpi_xsdt_t);
- ALIGN_CURRENT;
-
- /* clear all table memory */
- memset((void *) start, 0, current - start);
-
- acpi_write_rsdp(rsdp, rsdt, xsdt);
- acpi_write_rsdt(rsdt);
- acpi_write_xsdt(xsdt);
-
- /*
- * We explicitly add these tables later on:
- */
- printk(BIOS_DEBUG, "ACPI: * HPET\n");
-
- hpet = (acpi_hpet_t *) current;
- current += sizeof(acpi_hpet_t);
- ALIGN_CURRENT;
- acpi_create_hpet(hpet);
- acpi_add_table(rsdp, hpet);
-
- /* If we want to use HPET Timers Linux wants an MADT */
- printk(BIOS_DEBUG, "ACPI: * MADT\n");
-
- madt = (acpi_madt_t *) current;
- acpi_create_madt(madt);
- current += madt->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, madt);
-
- printk(BIOS_DEBUG, "ACPI: * MCFG\n");
- mcfg = (acpi_mcfg_t *) current;
- acpi_create_mcfg(mcfg);
- current += mcfg->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, mcfg);
-
- printk(BIOS_DEBUG, "ACPI: * FACS\n");
- facs = (acpi_facs_t *) current;
- current += sizeof(acpi_facs_t);
- ALIGN_CURRENT;
- acpi_create_facs(facs);
-
- dsdt = (acpi_header_t *) current;
- memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
-
- ALIGN_CURRENT;
-
- /* Pack GNVS into the ACPI table area */
- for (i=0; i < dsdt->length; i++) {
- if (*(u32*)(((u32)dsdt) + i) == 0xC0DEBABE) {
- printk(BIOS_DEBUG, "ACPI: Patching up global NVS in DSDT at offset 0x%04x -> 0x%08lx\n", i, current);
- *(u32*)(((u32)dsdt) + i) = current; // 0x92 bytes
- break;
- }
- }
-
- /* And fill it */
- acpi_create_gnvs((global_nvs_t *)current);
-
- current += 0x100;
- ALIGN_CURRENT;
-
- /* And tell SMI about it */
- smm_setup_structures((void *)current, NULL, NULL);
-
- /* We patched up the DSDT, so we need to recalculate the checksum */
- dsdt->checksum = 0;
- dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
-
- printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
- dsdt->length);
-
-#if CONFIG_HAVE_ACPI_SLIC
- printk(BIOS_DEBUG, "ACPI: * SLIC\n");
- slic = (acpi_header_t *)current;
- current += acpi_create_slic(current);
- ALIGN_CURRENT;
- acpi_add_table(rsdp, slic);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FADT\n");
- fadt = (acpi_fadt_t *) current;
- current += sizeof(acpi_fadt_t);
- ALIGN_CURRENT;
-
- acpi_create_fadt(fadt, facs, dsdt);
- acpi_add_table(rsdp, fadt);
-
- printk(BIOS_DEBUG, "ACPI: * SSDT\n");
- ssdt = (acpi_header_t *)current;
- acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
- current += ssdt->length;
- acpi_add_table(rsdp, ssdt);
- ALIGN_CURRENT;
-
- printk(BIOS_DEBUG, "current = %lx\n", current);
- printk(BIOS_INFO, "ACPI: done.\n");
- return current;
-}
diff --git a/src/mainboard/lenovo/t60/acpi_tables.c b/src/mainboard/lenovo/t60/acpi_tables.c
index c81c2f6..ada7d08 100644
--- a/src/mainboard/lenovo/t60/acpi_tables.c
+++ b/src/mainboard/lenovo/t60/acpi_tables.c
@@ -30,13 +30,8 @@
#include <device/pci.h>
#include <device/pci_ids.h>
-extern const unsigned char AmlCode[];
-#if CONFIG_HAVE_ACPI_SLIC
-unsigned long acpi_create_slic(unsigned long current);
-#endif
-
#include "southbridge/intel/i82801gx/nvs.h"
-static void acpi_create_gnvs(global_nvs_t *gnvs)
+void acpi_create_gnvs(global_nvs_t *gnvs)
{
memset((void *)gnvs, 0, sizeof(*gnvs));
gnvs->apic = 1;
@@ -83,12 +78,6 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
-unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
-{
- generate_cpu_entries();
- return (unsigned long) (acpigen_get_current());
-}
-
unsigned long acpi_fill_slit(unsigned long current)
{
// Not implemented
@@ -100,168 +89,3 @@ unsigned long acpi_fill_srat(unsigned long current)
/* No NUMA, no SRAT */
return current;
}
-
-void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
-
-#define ALIGN_CURRENT current = (ALIGN(current, 16))
-unsigned long write_acpi_tables(unsigned long start)
-{
- unsigned long current;
- int i;
- acpi_rsdp_t *rsdp;
- acpi_rsdt_t *rsdt;
- acpi_xsdt_t *xsdt;
- acpi_hpet_t *hpet;
- acpi_madt_t *madt;
- acpi_mcfg_t *mcfg;
- acpi_fadt_t *fadt;
- acpi_facs_t *facs;
-#if CONFIG_HAVE_ACPI_SLIC
- acpi_header_t *slic;
-#endif
- acpi_header_t *ssdt;
- acpi_header_t *dsdt;
- void *gnvs;
-
- current = start;
-
- /* Align ACPI tables to 16byte */
- ALIGN_CURRENT;
-
- printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
-
- /* We need at least an RSDP and an RSDT Table */
- rsdp = (acpi_rsdp_t *) current;
- current += sizeof(acpi_rsdp_t);
- ALIGN_CURRENT;
- rsdt = (acpi_rsdt_t *) current;
- current += sizeof(acpi_rsdt_t);
- ALIGN_CURRENT;
- xsdt = (acpi_xsdt_t *) current;
- current += sizeof(acpi_xsdt_t);
- ALIGN_CURRENT;
-
- /* clear all table memory */
- memset((void *) start, 0, current - start);
-
- acpi_write_rsdp(rsdp, rsdt, xsdt);
- acpi_write_rsdt(rsdt);
- acpi_write_xsdt(xsdt);
-
- /*
- * We explicitly add these tables later on:
- */
- printk(BIOS_DEBUG, "ACPI: * HPET\n");
-
- hpet = (acpi_hpet_t *) current;
- current += sizeof(acpi_hpet_t);
- ALIGN_CURRENT;
- acpi_create_hpet(hpet);
- acpi_add_table(rsdp, hpet);
-
- /* If we want to use HPET Timers Linux wants an MADT */
- printk(BIOS_DEBUG, "ACPI: * MADT\n");
-
- madt = (acpi_madt_t *) current;
- acpi_create_madt(madt);
- current += madt->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, madt);
-
- printk(BIOS_DEBUG, "ACPI: * MCFG\n");
- mcfg = (acpi_mcfg_t *) current;
- acpi_create_mcfg(mcfg);
- current += mcfg->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, mcfg);
-
- printk(BIOS_DEBUG, "ACPI: * FACS\n");
- facs = (acpi_facs_t *) current;
- current += sizeof(acpi_facs_t);
- ALIGN_CURRENT;
- acpi_create_facs(facs);
-
- dsdt = (acpi_header_t *) current;
- memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
-
- /* Fix up global NVS region for SMI handler. The GNVS region lives
- * in the (high) table area. The low memory map looks like this:
- *
- * 0x00000000 - 0x000003ff Real Mode IVT
- * 0x00000020 - 0x0000019c Low MP Table (XXX conflict?)
- * 0x00000400 - 0x000004ff BDA (somewhat unused)
- * 0x00000500 - 0x0000052f Moved GDT
- * 0x00000530 - 0x00000b64 coreboot table
- * 0x0007c000 - 0x0007dfff OS boot sector (unused?)
- * 0x0007e000 - 0x0007ffff free to use (so no good for acpi+smi)
- * 0x00080000 - 0x0009fbff usable ram
- * 0x0009fc00 - 0x0009ffff EBDA (unused?)
- * 0x000a0000 - 0x000bffff VGA memory
- * 0x000c0000 - 0x000cffff VGA option rom
- * 0x000d0000 - 0x000dffff free for other option roms?
- * 0x000e0000 - 0x000fffff SeaBIOS? (conflict with low tables:)
- * 0x000f0000 - 0x000f03ff PIRQ table
- * 0x000f0400 - 0x000f66?? ACPI tables
- * 0x000f66?? - 0x000f???? DMI tables
- */
-
- ALIGN_CURRENT;
-
- /* Pack GNVS into the ACPI table area */
- for (i=0; i < dsdt->length; i++) {
- if (*(u32*)(((u32)dsdt) + i) == 0xC0DEBABE) {
- printk(BIOS_DEBUG, "ACPI: Patching up global NVS in DSDT at offset 0x%04x -> 0x%08x\n", i, (u32)current);
- *(u32*)(((u32)dsdt) + i) = current; // 0x92 bytes
- break;
- }
- }
-
- /* And fill it */
- acpi_create_gnvs((global_nvs_t *)current);
-
- /* Keep pointer around */
- gnvs = (void *)current;
-
- current += 0x100;
- ALIGN_CURRENT;
-
- /* And tell SMI about it */
- smm_setup_structures(gnvs, NULL, NULL);
-
- /* We patched up the DSDT, so we need to recalculate the checksum */
- dsdt->checksum = 0;
- dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
-
- printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
- dsdt->length);
-
-#if CONFIG_HAVE_ACPI_SLIC
- printk(BIOS_DEBUG, "ACPI: * SLIC\n");
- slic = (acpi_header_t *)current;
- current += acpi_create_slic(current);
- ALIGN_CURRENT;
- acpi_add_table(rsdp, slic);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FADT\n");
- fadt = (acpi_fadt_t *) current;
- current += sizeof(acpi_fadt_t);
- ALIGN_CURRENT;
-
- acpi_create_fadt(fadt, facs, dsdt);
- acpi_add_table(rsdp, fadt);
-
- printk(BIOS_DEBUG, "ACPI: * SSDT\n");
- ssdt = (acpi_header_t *)current;
- acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
- current += ssdt->length;
- acpi_add_table(rsdp, ssdt);
- ALIGN_CURRENT;
-
- printk(BIOS_DEBUG, "current = %lx\n", current);
- printk(BIOS_INFO, "ACPI: done.\n");
-
- return current;
-}
diff --git a/src/mainboard/lenovo/x60/acpi_tables.c b/src/mainboard/lenovo/x60/acpi_tables.c
index 5a4fffc..ada7d08 100644
--- a/src/mainboard/lenovo/x60/acpi_tables.c
+++ b/src/mainboard/lenovo/x60/acpi_tables.c
@@ -29,15 +29,9 @@
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
-#include "drivers/lenovo/lenovo.h"
-
-extern const unsigned char AmlCode[];
-#if CONFIG_HAVE_ACPI_SLIC
-unsigned long acpi_create_slic(unsigned long current);
-#endif
#include "southbridge/intel/i82801gx/nvs.h"
-static void acpi_create_gnvs(global_nvs_t *gnvs)
+void acpi_create_gnvs(global_nvs_t *gnvs)
{
memset((void *)gnvs, 0, sizeof(*gnvs));
gnvs->apic = 1;
@@ -84,13 +78,6 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
-unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
-{
- generate_cpu_entries();
- drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 1);
- return (unsigned long) (acpigen_get_current());
-}
-
unsigned long acpi_fill_slit(unsigned long current)
{
// Not implemented
@@ -102,168 +89,3 @@ unsigned long acpi_fill_srat(unsigned long current)
/* No NUMA, no SRAT */
return current;
}
-
-void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
-
-#define ALIGN_CURRENT current = (ALIGN(current, 16))
-unsigned long write_acpi_tables(unsigned long start)
-{
- unsigned long current;
- int i;
- acpi_rsdp_t *rsdp;
- acpi_rsdt_t *rsdt;
- acpi_xsdt_t *xsdt;
- acpi_hpet_t *hpet;
- acpi_madt_t *madt;
- acpi_mcfg_t *mcfg;
- acpi_fadt_t *fadt;
- acpi_facs_t *facs;
-#if CONFIG_HAVE_ACPI_SLIC
- acpi_header_t *slic;
-#endif
- acpi_header_t *ssdt;
- acpi_header_t *dsdt;
- void *gnvs;
-
- current = start;
-
- /* Align ACPI tables to 16byte */
- ALIGN_CURRENT;
-
- printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
-
- /* We need at least an RSDP and an RSDT Table */
- rsdp = (acpi_rsdp_t *) current;
- current += sizeof(acpi_rsdp_t);
- ALIGN_CURRENT;
- rsdt = (acpi_rsdt_t *) current;
- current += sizeof(acpi_rsdt_t);
- ALIGN_CURRENT;
- xsdt = (acpi_xsdt_t *) current;
- current += sizeof(acpi_xsdt_t);
- ALIGN_CURRENT;
-
- /* clear all table memory */
- memset((void *) start, 0, current - start);
-
- acpi_write_rsdp(rsdp, rsdt, xsdt);
- acpi_write_rsdt(rsdt);
- acpi_write_xsdt(xsdt);
-
- /*
- * We explicitly add these tables later on:
- */
- printk(BIOS_DEBUG, "ACPI: * HPET\n");
-
- hpet = (acpi_hpet_t *) current;
- current += sizeof(acpi_hpet_t);
- ALIGN_CURRENT;
- acpi_create_hpet(hpet);
- acpi_add_table(rsdp, hpet);
-
- /* If we want to use HPET Timers Linux wants an MADT */
- printk(BIOS_DEBUG, "ACPI: * MADT\n");
-
- madt = (acpi_madt_t *) current;
- acpi_create_madt(madt);
- current += madt->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, madt);
-
- printk(BIOS_DEBUG, "ACPI: * MCFG\n");
- mcfg = (acpi_mcfg_t *) current;
- acpi_create_mcfg(mcfg);
- current += mcfg->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, mcfg);
-
- printk(BIOS_DEBUG, "ACPI: * FACS\n");
- facs = (acpi_facs_t *) current;
- current += sizeof(acpi_facs_t);
- ALIGN_CURRENT;
- acpi_create_facs(facs);
-
- dsdt = (acpi_header_t *) current;
- memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
-
- /* Fix up global NVS region for SMI handler. The GNVS region lives
- * in the (high) table area. The low memory map looks like this:
- *
- * 0x00000000 - 0x000003ff Real Mode IVT
- * 0x00000020 - 0x0000019c Low MP Table (XXX conflict?)
- * 0x00000400 - 0x000004ff BDA (somewhat unused)
- * 0x00000500 - 0x0000052f Moved GDT
- * 0x00000530 - 0x00000b64 coreboot table
- * 0x0007c000 - 0x0007dfff OS boot sector (unused?)
- * 0x0007e000 - 0x0007ffff free to use (so no good for acpi+smi)
- * 0x00080000 - 0x0009fbff usable ram
- * 0x0009fc00 - 0x0009ffff EBDA (unused?)
- * 0x000a0000 - 0x000bffff VGA memory
- * 0x000c0000 - 0x000cffff VGA option rom
- * 0x000d0000 - 0x000dffff free for other option roms?
- * 0x000e0000 - 0x000fffff SeaBIOS? (conflict with low tables:)
- * 0x000f0000 - 0x000f03ff PIRQ table
- * 0x000f0400 - 0x000f66?? ACPI tables
- * 0x000f66?? - 0x000f???? DMI tables
- */
-
- ALIGN_CURRENT;
-
- /* Pack GNVS into the ACPI table area */
- for (i=0; i < dsdt->length; i++) {
- if (*(u32*)(((u32)dsdt) + i) == 0xC0DEBABE) {
- printk(BIOS_DEBUG, "ACPI: Patching up global NVS in DSDT at offset 0x%04x -> 0x%08x\n", i, (u32)current);
- *(u32*)(((u32)dsdt) + i) = current; // 0x92 bytes
- break;
- }
- }
-
- /* And fill it */
- acpi_create_gnvs((global_nvs_t *)current);
-
- /* Keep pointer around */
- gnvs = (void *)current;
-
- current += 0x100;
- ALIGN_CURRENT;
-
- /* And tell SMI about it */
- smm_setup_structures(gnvs, NULL, NULL);
-
- /* We patched up the DSDT, so we need to recalculate the checksum */
- dsdt->checksum = 0;
- dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
-
- printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
- dsdt->length);
-
-#if CONFIG_HAVE_ACPI_SLIC
- printk(BIOS_DEBUG, "ACPI: * SLIC\n");
- slic = (acpi_header_t *)current;
- current += acpi_create_slic(current);
- ALIGN_CURRENT;
- acpi_add_table(rsdp, slic);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FADT\n");
- fadt = (acpi_fadt_t *) current;
- current += sizeof(acpi_fadt_t);
- ALIGN_CURRENT;
-
- acpi_create_fadt(fadt, facs, dsdt);
- acpi_add_table(rsdp, fadt);
-
- printk(BIOS_DEBUG, "ACPI: * SSDT\n");
- ssdt = (acpi_header_t *)current;
- acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
- current += ssdt->length;
- acpi_add_table(rsdp, ssdt);
- ALIGN_CURRENT;
-
- printk(BIOS_DEBUG, "current = %lx\n", current);
- printk(BIOS_INFO, "ACPI: done.\n");
-
- return current;
-}
diff --git a/src/mainboard/lenovo/x60/mainboard.c b/src/mainboard/lenovo/x60/mainboard.c
index 9932bce..1f258b4 100644
--- a/src/mainboard/lenovo/x60/mainboard.c
+++ b/src/mainboard/lenovo/x60/mainboard.c
@@ -40,6 +40,7 @@
#include <smbios.h>
#include <build.h>
#include <drivers/intel/gma/int15.h>
+#include "drivers/lenovo/lenovo.h"
#define PANEL INT15_5F35_CL_DISPLAY_DEFAULT
@@ -109,9 +110,17 @@ const char *smbios_mainboard_bios_version(void)
return "CBET4000 " COREBOOT_VERSION;
}
+static unsigned long fill_ssdt(unsigned long current,
+ const char *oem_table_id)
+{
+ drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 1);
+ return (unsigned long) (acpigen_get_current());
+}
+
static void mainboard_enable(device_t dev)
{
dev->ops->init = mainboard_init;
+ dev->ops->acpi_fill_ssdt_generator = fill_ssdt;
}
struct chip_operations mainboard_ops = {
diff --git a/src/mainboard/roda/rk886ex/acpi_tables.c b/src/mainboard/roda/rk886ex/acpi_tables.c
index c81c2f6..ada7d08 100644
--- a/src/mainboard/roda/rk886ex/acpi_tables.c
+++ b/src/mainboard/roda/rk886ex/acpi_tables.c
@@ -30,13 +30,8 @@
#include <device/pci.h>
#include <device/pci_ids.h>
-extern const unsigned char AmlCode[];
-#if CONFIG_HAVE_ACPI_SLIC
-unsigned long acpi_create_slic(unsigned long current);
-#endif
-
#include "southbridge/intel/i82801gx/nvs.h"
-static void acpi_create_gnvs(global_nvs_t *gnvs)
+void acpi_create_gnvs(global_nvs_t *gnvs)
{
memset((void *)gnvs, 0, sizeof(*gnvs));
gnvs->apic = 1;
@@ -83,12 +78,6 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
-unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
-{
- generate_cpu_entries();
- return (unsigned long) (acpigen_get_current());
-}
-
unsigned long acpi_fill_slit(unsigned long current)
{
// Not implemented
@@ -100,168 +89,3 @@ unsigned long acpi_fill_srat(unsigned long current)
/* No NUMA, no SRAT */
return current;
}
-
-void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
-
-#define ALIGN_CURRENT current = (ALIGN(current, 16))
-unsigned long write_acpi_tables(unsigned long start)
-{
- unsigned long current;
- int i;
- acpi_rsdp_t *rsdp;
- acpi_rsdt_t *rsdt;
- acpi_xsdt_t *xsdt;
- acpi_hpet_t *hpet;
- acpi_madt_t *madt;
- acpi_mcfg_t *mcfg;
- acpi_fadt_t *fadt;
- acpi_facs_t *facs;
-#if CONFIG_HAVE_ACPI_SLIC
- acpi_header_t *slic;
-#endif
- acpi_header_t *ssdt;
- acpi_header_t *dsdt;
- void *gnvs;
-
- current = start;
-
- /* Align ACPI tables to 16byte */
- ALIGN_CURRENT;
-
- printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
-
- /* We need at least an RSDP and an RSDT Table */
- rsdp = (acpi_rsdp_t *) current;
- current += sizeof(acpi_rsdp_t);
- ALIGN_CURRENT;
- rsdt = (acpi_rsdt_t *) current;
- current += sizeof(acpi_rsdt_t);
- ALIGN_CURRENT;
- xsdt = (acpi_xsdt_t *) current;
- current += sizeof(acpi_xsdt_t);
- ALIGN_CURRENT;
-
- /* clear all table memory */
- memset((void *) start, 0, current - start);
-
- acpi_write_rsdp(rsdp, rsdt, xsdt);
- acpi_write_rsdt(rsdt);
- acpi_write_xsdt(xsdt);
-
- /*
- * We explicitly add these tables later on:
- */
- printk(BIOS_DEBUG, "ACPI: * HPET\n");
-
- hpet = (acpi_hpet_t *) current;
- current += sizeof(acpi_hpet_t);
- ALIGN_CURRENT;
- acpi_create_hpet(hpet);
- acpi_add_table(rsdp, hpet);
-
- /* If we want to use HPET Timers Linux wants an MADT */
- printk(BIOS_DEBUG, "ACPI: * MADT\n");
-
- madt = (acpi_madt_t *) current;
- acpi_create_madt(madt);
- current += madt->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, madt);
-
- printk(BIOS_DEBUG, "ACPI: * MCFG\n");
- mcfg = (acpi_mcfg_t *) current;
- acpi_create_mcfg(mcfg);
- current += mcfg->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, mcfg);
-
- printk(BIOS_DEBUG, "ACPI: * FACS\n");
- facs = (acpi_facs_t *) current;
- current += sizeof(acpi_facs_t);
- ALIGN_CURRENT;
- acpi_create_facs(facs);
-
- dsdt = (acpi_header_t *) current;
- memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
-
- /* Fix up global NVS region for SMI handler. The GNVS region lives
- * in the (high) table area. The low memory map looks like this:
- *
- * 0x00000000 - 0x000003ff Real Mode IVT
- * 0x00000020 - 0x0000019c Low MP Table (XXX conflict?)
- * 0x00000400 - 0x000004ff BDA (somewhat unused)
- * 0x00000500 - 0x0000052f Moved GDT
- * 0x00000530 - 0x00000b64 coreboot table
- * 0x0007c000 - 0x0007dfff OS boot sector (unused?)
- * 0x0007e000 - 0x0007ffff free to use (so no good for acpi+smi)
- * 0x00080000 - 0x0009fbff usable ram
- * 0x0009fc00 - 0x0009ffff EBDA (unused?)
- * 0x000a0000 - 0x000bffff VGA memory
- * 0x000c0000 - 0x000cffff VGA option rom
- * 0x000d0000 - 0x000dffff free for other option roms?
- * 0x000e0000 - 0x000fffff SeaBIOS? (conflict with low tables:)
- * 0x000f0000 - 0x000f03ff PIRQ table
- * 0x000f0400 - 0x000f66?? ACPI tables
- * 0x000f66?? - 0x000f???? DMI tables
- */
-
- ALIGN_CURRENT;
-
- /* Pack GNVS into the ACPI table area */
- for (i=0; i < dsdt->length; i++) {
- if (*(u32*)(((u32)dsdt) + i) == 0xC0DEBABE) {
- printk(BIOS_DEBUG, "ACPI: Patching up global NVS in DSDT at offset 0x%04x -> 0x%08x\n", i, (u32)current);
- *(u32*)(((u32)dsdt) + i) = current; // 0x92 bytes
- break;
- }
- }
-
- /* And fill it */
- acpi_create_gnvs((global_nvs_t *)current);
-
- /* Keep pointer around */
- gnvs = (void *)current;
-
- current += 0x100;
- ALIGN_CURRENT;
-
- /* And tell SMI about it */
- smm_setup_structures(gnvs, NULL, NULL);
-
- /* We patched up the DSDT, so we need to recalculate the checksum */
- dsdt->checksum = 0;
- dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
-
- printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
- dsdt->length);
-
-#if CONFIG_HAVE_ACPI_SLIC
- printk(BIOS_DEBUG, "ACPI: * SLIC\n");
- slic = (acpi_header_t *)current;
- current += acpi_create_slic(current);
- ALIGN_CURRENT;
- acpi_add_table(rsdp, slic);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FADT\n");
- fadt = (acpi_fadt_t *) current;
- current += sizeof(acpi_fadt_t);
- ALIGN_CURRENT;
-
- acpi_create_fadt(fadt, facs, dsdt);
- acpi_add_table(rsdp, fadt);
-
- printk(BIOS_DEBUG, "ACPI: * SSDT\n");
- ssdt = (acpi_header_t *)current;
- acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
- current += ssdt->length;
- acpi_add_table(rsdp, ssdt);
- ALIGN_CURRENT;
-
- printk(BIOS_DEBUG, "current = %lx\n", current);
- printk(BIOS_INFO, "ACPI: done.\n");
-
- return current;
-}
diff --git a/src/northbridge/intel/i945/Kconfig b/src/northbridge/intel/i945/Kconfig
index a4da1a5..c578011 100644
--- a/src/northbridge/intel/i945/Kconfig
+++ b/src/northbridge/intel/i945/Kconfig
@@ -30,6 +30,7 @@ config NORTHBRIDGE_SPECIFIC_OPTIONS # dummy
select HAVE_DEBUG_RAM_SETUP
select LAPIC_MONOTONIC_TIMER
select VGA
+ select PER_DEVICE_ACPI_TABLES
config NORTHBRIDGE_INTEL_SUBTYPE_I945GC
def_bool n
diff --git a/src/northbridge/intel/i945/acpi.c b/src/northbridge/intel/i945/acpi.c
index e05bd58..a1c3274 100644
--- a/src/northbridge/intel/i945/acpi.c
+++ b/src/northbridge/intel/i945/acpi.c
@@ -27,6 +27,9 @@
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
+#include <cbmem.h>
+#include <arch/acpigen.h>
+#include <cpu/cpu.h>
#include "i945.h"
unsigned long acpi_fill_mcfg(unsigned long current)
@@ -71,3 +74,10 @@ unsigned long acpi_fill_mcfg(unsigned long current)
return current;
}
+
+unsigned long northbridge_acpi_fill_ssdt_generator(unsigned long current,
+ const char *oem_table_id)
+{
+ generate_cpu_entries();
+ return (unsigned long) (acpigen_get_current());
+}
diff --git a/src/northbridge/intel/i945/i945.h b/src/northbridge/intel/i945/i945.h
index 9be9379..60e6579 100644
--- a/src/northbridge/intel/i945/i945.h
+++ b/src/northbridge/intel/i945/i945.h
@@ -352,6 +352,9 @@ int i945_silicon_revision(void);
void i945_early_initialization(void);
void i945_late_initialization(void);
+unsigned long northbridge_acpi_fill_ssdt_generator(unsigned long current,
+ const char *oem_table_id);
+
/* provided by mainboard code */
void setup_ich7_gpios(void);
diff --git a/src/northbridge/intel/i945/northbridge.c b/src/northbridge/intel/i945/northbridge.c
index 68d6d91..b4a47b2 100644
--- a/src/northbridge/intel/i945/northbridge.c
+++ b/src/northbridge/intel/i945/northbridge.c
@@ -260,6 +260,7 @@ static struct device_operations mc_ops = {
.read_resources = mc_read_resources,
.set_resources = mc_set_resources,
.enable_resources = pci_dev_enable_resources,
+ .acpi_fill_ssdt_generator = northbridge_acpi_fill_ssdt_generator,
#if CONFIG_HAVE_ACPI_RESUME
.init = northbridge_init,
#endif
diff --git a/src/southbridge/intel/i82801gx/acpi/globalnvs.asl b/src/southbridge/intel/i82801gx/acpi/globalnvs.asl
index 0384376..027391c 100644
--- a/src/southbridge/intel/i82801gx/acpi/globalnvs.asl
+++ b/src/southbridge/intel/i82801gx/acpi/globalnvs.asl
@@ -30,8 +30,8 @@ Name(\DSEN, 1) // Display Output Switching Enable
* we have to fix it up in coreboot's ACPI creation phase.
*/
-
-OperationRegion (GNVS, SystemMemory, 0xC0DEBABE, 0x100)
+External(NVSA)
+OperationRegion (GNVS, SystemMemory, NVSA, 0x100)
Field (GNVS, ByteAcc, NoLock, Preserve)
{
/* Miscellaneous */
diff --git a/src/southbridge/intel/i82801gx/lpc.c b/src/southbridge/intel/i82801gx/lpc.c
index b208339..279bea6 100644
--- a/src/southbridge/intel/i82801gx/lpc.c
+++ b/src/southbridge/intel/i82801gx/lpc.c
@@ -31,6 +31,10 @@
#include <cpu/cpu.h>
#include "i82801gx.h"
#include <cpu/x86/smm.h>
+#include <arch/acpigen.h>
+#include <cbmem.h>
+#include <string.h>
+#include "nvs.h"
#define NMI_OFF 0
@@ -488,6 +492,24 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device)
}
}
+static void southbridge_inject_dsdt(void)
+{
+ global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof (*gnvs));
+
+ if (gnvs) {
+ int scopelen;
+ memset(gnvs, 0, sizeof(*gnvs));
+ acpi_create_gnvs(gnvs);
+ /* And tell SMI about it */
+ smm_setup_structures(gnvs, NULL, NULL);
+
+ /* Add it to SSDT. */
+ scopelen = acpigen_write_scope("\\");
+ scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs);
+ acpigen_patch_len(scopelen - 1);
+ }
+}
+
static struct pci_operations pci_ops = {
.set_subsystem = set_subsystem,
};
@@ -496,6 +518,8 @@ static struct device_operations device_ops = {
.read_resources = i82801gx_lpc_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
+ .acpi_inject_dsdt_generator = southbridge_inject_dsdt,
+ .write_acpi_tables = acpi_write_hpet,
.init = lpc_init,
.scan_bus = scan_static_bus,
.enable = i82801gx_enable,
diff --git a/src/southbridge/intel/i82801gx/nvs.h b/src/southbridge/intel/i82801gx/nvs.h
index 14f0ad3..cf4065c 100644
--- a/src/southbridge/intel/i82801gx/nvs.h
+++ b/src/southbridge/intel/i82801gx/nvs.h
@@ -135,3 +135,5 @@ typedef struct {
u8 bten;
u8 rsvd13[14];
} __attribute__((packed)) global_nvs_t;
+
+void acpi_create_gnvs(global_nvs_t *gnvs);
1
0
Patch set updated for coreboot: 93ff061 sch: Switch to per-device ACPI
by Vladimir Serbinenko Oct. 5, 2014
by Vladimir Serbinenko Oct. 5, 2014
Oct. 5, 2014
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6811
-gerrit
commit 93ff061b746404d469487af68e65e60f2870da59
Author: Vladimir Serbinenko <phcoder(a)gmail.com>
Date: Sun Aug 31 02:21:43 2014 +0200
sch: Switch to per-device ACPI
Change-Id: I4cf0a67b0251d2d3adff5de74bf56b7d4c4524ee
Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com>
---
src/mainboard/iwave/iWRainbowG6/acpi_tables.c | 156 +-------------------------
src/northbridge/intel/sch/Kconfig | 1 +
src/northbridge/intel/sch/acpi.c | 11 ++
src/northbridge/intel/sch/northbridge.c | 1 +
src/northbridge/intel/sch/sch.h | 2 +
src/southbridge/intel/sch/acpi/globalnvs.asl | 4 +-
src/southbridge/intel/sch/lpc.c | 26 +++++
src/southbridge/intel/sch/nvs.h | 2 +
8 files changed, 46 insertions(+), 157 deletions(-)
diff --git a/src/mainboard/iwave/iWRainbowG6/acpi_tables.c b/src/mainboard/iwave/iWRainbowG6/acpi_tables.c
index ae7239b..4dcda79 100644
--- a/src/mainboard/iwave/iWRainbowG6/acpi_tables.c
+++ b/src/mainboard/iwave/iWRainbowG6/acpi_tables.c
@@ -29,14 +29,9 @@
#include <device/pci_ids.h>
#include <cpu/x86/msr.h>
-extern const unsigned char AmlCode[];
-#if CONFIG_HAVE_ACPI_SLIC
-unsigned long acpi_create_slic(unsigned long current);
-#endif
-
#include "southbridge/intel/sch/nvs.h"
-static void acpi_create_gnvs(global_nvs_t * gnvs)
+void acpi_create_gnvs(global_nvs_t * gnvs)
{
memset((void *)gnvs, 0, sizeof(*gnvs));
gnvs->apic = 1;
@@ -75,13 +70,6 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
-unsigned long acpi_fill_ssdt_generator(unsigned long current,
- const char *oem_table_id)
-{
- generate_cpu_entries();
- return (unsigned long)(acpigen_get_current());
-}
-
unsigned long acpi_fill_slit(unsigned long current)
{
/* Not implemented. */
@@ -93,145 +81,3 @@ unsigned long acpi_fill_srat(unsigned long current)
/* No NUMA, no SRAT */
return current;
}
-
-void smm_setup_structures(void *gnvs, void *tcg, void *smi1);
-
-#define ALIGN_CURRENT current = (ALIGN(current, 16))
-unsigned long write_acpi_tables(unsigned long start)
-{
- unsigned long current;
- int i;
-
- acpi_rsdp_t *rsdp;
- acpi_rsdt_t *rsdt;
- acpi_xsdt_t *xsdt;
- acpi_hpet_t *hpet;
- acpi_madt_t *madt;
- acpi_mcfg_t *mcfg;
- acpi_fadt_t *fadt;
- acpi_facs_t *facs;
-#if CONFIG_HAVE_ACPI_SLIC
- acpi_header_t *slic;
-#endif
- acpi_header_t *ssdt;
- acpi_header_t *dsdt;
-
- current = start;
-
- /* Align ACPI tables to 16byte */
- ALIGN_CURRENT;
-
- printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start);
-
- /* We need at least an RSDP and an RSDT Table */
- rsdp = (acpi_rsdp_t *) current;
- current += sizeof(acpi_rsdp_t);
- ALIGN_CURRENT;
- rsdt = (acpi_rsdt_t *) current;
- current += sizeof(acpi_rsdt_t);
- ALIGN_CURRENT;
- xsdt = (acpi_xsdt_t *) current;
- current += sizeof(acpi_xsdt_t);
- ALIGN_CURRENT;
-
- /* clear all table memory */
- memset((void *)start, 0, current - start);
-
- acpi_write_rsdp(rsdp, rsdt, xsdt);
- acpi_write_rsdt(rsdt);
- acpi_write_xsdt(xsdt);
-
- /*
- * We explicitly add these tables later on:
- */
- printk(BIOS_DEBUG, "ACPI: * HPET\n");
-
- hpet = (acpi_hpet_t *) current;
- current += sizeof(acpi_hpet_t);
- ALIGN_CURRENT;
- acpi_create_hpet(hpet);
- acpi_add_table(rsdp, hpet);
-
- /* If we want to use HPET Timers Linux wants an MADT */
- printk(BIOS_DEBUG, "ACPI: * MADT\n");
-
- madt = (acpi_madt_t *) current;
- acpi_create_madt(madt);
- current += madt->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, madt);
-
- printk(BIOS_DEBUG, "ACPI: * MCFG\n");
- mcfg = (acpi_mcfg_t *) current;
- acpi_create_mcfg(mcfg);
- current += mcfg->header.length;
- ALIGN_CURRENT;
- acpi_add_table(rsdp, mcfg);
-
- printk(BIOS_DEBUG, "ACPI: * FACS\n");
- facs = (acpi_facs_t *) current;
- current += sizeof(acpi_facs_t);
- ALIGN_CURRENT;
- acpi_create_facs(facs);
-
- dsdt = (acpi_header_t *) current;
- memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
-
- ALIGN_CURRENT;
-
- /* Pack GNVS into the ACPI table area */
- for (i = 0; i < dsdt->length; i++) {
- if (*(u32 *) (((u32) dsdt) + i) == 0xC0DEBABE) {
- printk(BIOS_DEBUG, "ACPI: Patching up global NVS in "
- "DSDT at offset 0x%04x -> 0x%08lx\n",
- i, current);
- *(u32 *) (((u32) dsdt) + i) = current; // 0x92 bytes
- break;
- }
- }
-
- /* And fill it */
- acpi_create_gnvs((global_nvs_t *) current);
-
- current += 0x100;
- ALIGN_CURRENT;
-
- /* And tell SMI about it */
- smm_setup_structures((void *)current, NULL, NULL);
-
- /* We patched up the DSDT, so we need to recalculate the checksum */
- dsdt->checksum = 0;
- dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
-
- printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt,
- dsdt->length);
-
-#if CONFIG_HAVE_ACPI_SLIC
- printk(BIOS_DEBUG, "ACPI: * SLIC\n");
- slic = (acpi_header_t *) current;
- current += acpi_create_slic(current);
- ALIGN_CURRENT;
- acpi_add_table(rsdp, slic);
-#endif
-
- printk(BIOS_DEBUG, "ACPI: * FADT\n");
- fadt = (acpi_fadt_t *) current;
- current += sizeof(acpi_fadt_t);
- ALIGN_CURRENT;
-
- acpi_create_fadt(fadt, facs, dsdt);
- acpi_add_table(rsdp, fadt);
-
- printk(BIOS_DEBUG, "ACPI: * SSDT\n");
- ssdt = (acpi_header_t *) current;
- acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR);
- current += ssdt->length;
- acpi_add_table(rsdp, ssdt);
- ALIGN_CURRENT;
-
- printk(BIOS_DEBUG, "current = %lx\n", current);
- printk(BIOS_INFO, "ACPI: done.\n");
- return current;
-}
diff --git a/src/northbridge/intel/sch/Kconfig b/src/northbridge/intel/sch/Kconfig
index f87afdf..b8dad72 100644
--- a/src/northbridge/intel/sch/Kconfig
+++ b/src/northbridge/intel/sch/Kconfig
@@ -20,6 +20,7 @@
config NORTHBRIDGE_INTEL_SCH
bool
select MMCONF_SUPPORT
+ select PER_DEVICE_ACPI_TABLES
if NORTHBRIDGE_INTEL_SCH
diff --git a/src/northbridge/intel/sch/acpi.c b/src/northbridge/intel/sch/acpi.c
index 6dd495f..34a6706 100644
--- a/src/northbridge/intel/sch/acpi.c
+++ b/src/northbridge/intel/sch/acpi.c
@@ -25,6 +25,10 @@
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
+#include <cbmem.h>
+#include <arch/acpigen.h>
+#include <cpu/cpu.h>
+#include "sch.h"
unsigned long acpi_fill_mcfg(unsigned long current)
{
@@ -72,3 +76,10 @@ unsigned long acpi_fill_mcfg(unsigned long current)
#endif
return current;
}
+
+unsigned long northbridge_acpi_fill_ssdt_generator(unsigned long current,
+ const char *oem_table_id)
+{
+ generate_cpu_entries();
+ return (unsigned long) (acpigen_get_current());
+}
diff --git a/src/northbridge/intel/sch/northbridge.c b/src/northbridge/intel/sch/northbridge.c
index 0bbf91b..ba7830b 100644
--- a/src/northbridge/intel/sch/northbridge.c
+++ b/src/northbridge/intel/sch/northbridge.c
@@ -281,6 +281,7 @@ static struct device_operations mc_ops = {
#if CONFIG_HAVE_ACPI_RESUME
.init = northbridge_init,
#endif
+ .acpi_fill_ssdt_generator = northbridge_acpi_fill_ssdt_generator,
.scan_bus = 0,
.ops_pci = &intel_pci_ops,
};
diff --git a/src/northbridge/intel/sch/sch.h b/src/northbridge/intel/sch/sch.h
index 5700842..19a1a40 100644
--- a/src/northbridge/intel/sch/sch.h
+++ b/src/northbridge/intel/sch/sch.h
@@ -25,6 +25,8 @@
int sch_port_access_read(int port, int reg, int bytes);
void sch_port_access_write(int port, int reg, int bytes, long data);
void sch_port_access_write_ram_cmd(int cmd, int port, int reg, int data);
+unsigned long northbridge_acpi_fill_ssdt_generator(unsigned long current,
+ const char *oem_table_id);
/* Southbridge IO BARs */
/* TODO Make sure these don't get changed by stage2 */
diff --git a/src/southbridge/intel/sch/acpi/globalnvs.asl b/src/southbridge/intel/sch/acpi/globalnvs.asl
index 5ac1c83..7db71f9 100644
--- a/src/southbridge/intel/sch/acpi/globalnvs.asl
+++ b/src/southbridge/intel/sch/acpi/globalnvs.asl
@@ -30,8 +30,8 @@ Name(\DSEN, 1) // Display Output Switching Enable
* we have to fix it up in coreboot's ACPI creation phase.
*/
-
-OperationRegion (GNVS, SystemMemory, 0xC0DEBABE, 0x100)
+External(NVSA)
+OperationRegion (GNVS, SystemMemory, NVSA, 0x100)
Field (GNVS, ByteAcc, NoLock, Preserve)
{
/* Miscellaneous */
diff --git a/src/southbridge/intel/sch/lpc.c b/src/southbridge/intel/sch/lpc.c
index 08f4162..7d209b1 100644
--- a/src/southbridge/intel/sch/lpc.c
+++ b/src/southbridge/intel/sch/lpc.c
@@ -24,6 +24,12 @@
#include <device/pci_ids.h>
#include <arch/io.h>
#include <arch/ioapic.h>
+#include <arch/acpigen.h>
+#include <arch/acpigen.h>
+#include <cpu/cpu.h>
+#include <cbmem.h>
+#include <string.h>
+#include "nvs.h"
#include "chip.h"
/* SCH LPC defines */
@@ -182,6 +188,24 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device)
}
}
+static void southbridge_inject_dsdt(void)
+{
+ global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof (*gnvs));
+
+ if (gnvs) {
+ int scopelen;
+ memset(gnvs, 0, sizeof(*gnvs));
+ acpi_create_gnvs(gnvs);
+ /* And tell SMI about it */
+ smm_setup_structures(gnvs, NULL, NULL);
+
+ /* Add it to SSDT. */
+ scopelen = acpigen_write_scope("\\");
+ scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs);
+ acpigen_patch_len(scopelen - 1);
+ }
+}
+
static struct pci_operations pci_ops = {
.set_subsystem = set_subsystem,
};
@@ -190,6 +214,8 @@ static struct device_operations device_ops = {
.read_resources = sch_lpc_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
+ .acpi_inject_dsdt_generator = southbridge_inject_dsdt,
+ .write_acpi_tables = acpi_write_hpet,
.init = lpc_init,
.scan_bus = scan_static_bus,
.ops_pci = &pci_ops,
diff --git a/src/southbridge/intel/sch/nvs.h b/src/southbridge/intel/sch/nvs.h
index 14f0ad3..c987d92 100644
--- a/src/southbridge/intel/sch/nvs.h
+++ b/src/southbridge/intel/sch/nvs.h
@@ -135,3 +135,5 @@ typedef struct {
u8 bten;
u8 rsvd13[14];
} __attribute__((packed)) global_nvs_t;
+
+void acpi_create_gnvs(global_nvs_t * gnvs);
1
0
Patch set updated for coreboot: 1c30bc4 lynxpoint: Change OEM table ID for serialio.
by Vladimir Serbinenko Oct. 5, 2014
by Vladimir Serbinenko Oct. 5, 2014
Oct. 5, 2014
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7016
-gerrit
commit 1c30bc4421e7e567c32d6e09c1fb91d5bc568e29
Author: Vladimir Serbinenko <phcoder(a)gmail.com>
Date: Sun Oct 5 11:08:40 2014 +0200
lynxpoint: Change OEM table ID for serialio.
According to ACPI spec all SSDTs should have distinct OEM table ID.
We end up with 2 SSDTs named "COREBOOT". Fix this.
Change-Id: I01bccb72758baf51c6b4263778716f4bb9d438c9
Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com>
---
src/southbridge/intel/lynxpoint/acpi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/southbridge/intel/lynxpoint/acpi.c b/src/southbridge/intel/lynxpoint/acpi.c
index ef1c9d8..d1c8934 100644
--- a/src/southbridge/intel/lynxpoint/acpi.c
+++ b/src/southbridge/intel/lynxpoint/acpi.c
@@ -78,8 +78,8 @@ void acpi_create_serialio_ssdt(acpi_header_t *ssdt)
memcpy(&ssdt->signature, "SSDT", 4);
ssdt->revision = 2;
memcpy(&ssdt->oem_id, OEM_ID, 6);
- memcpy(&ssdt->oem_table_id, ACPI_TABLE_CREATOR, 8);
- ssdt->oem_revision = 42;
+ memcpy(&ssdt->oem_table_id, "SERIALIO", 8);
+ ssdt->oem_revision = 43;
memcpy(&ssdt->asl_compiler_id, ASLC, 4);
ssdt->asl_compiler_revision = 42;
ssdt->length = sizeof(acpi_header_t);
1
0
Patch set updated for coreboot: cb2078d bd82x6x, ibexpeak, lynxpoint: Declare NVSA before its use.
by Vladimir Serbinenko Oct. 5, 2014
by Vladimir Serbinenko Oct. 5, 2014
Oct. 5, 2014
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7017
-gerrit
commit cb2078d32950dd6080709ac8d401c99ea8b1414f
Author: Vladimir Serbinenko <phcoder(a)gmail.com>
Date: Sun Oct 5 11:10:35 2014 +0200
bd82x6x, ibexpeak, lynxpoint: Declare NVSA before its use.
Windows chokes if it's not the case.
Change-Id: I3df15228ed00c3124b8d42fc01d7d63ff3fe07ba
Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com>
---
src/arch/x86/boot/acpi.c | 23 +++++++++++++++++++++--
src/include/device/device.h | 1 +
src/southbridge/intel/bd82x6x/lpc.c | 8 +++-----
src/southbridge/intel/ibexpeak/lpc.c | 6 ++----
src/southbridge/intel/lynxpoint/lpc.c | 8 +++-----
5 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c
index 3a30d31..6c74268 100644
--- a/src/arch/x86/boot/acpi.c
+++ b/src/arch/x86/boot/acpi.c
@@ -707,8 +707,27 @@ unsigned long write_acpi_tables(unsigned long start)
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *) current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
+ if (dsdt->length >= sizeof(acpi_header_t)) {
+ current += sizeof(acpi_header_t);
+
+#if IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
+ acpigen_set_current((char *) current);
+ for (dev = all_devices; dev; dev = dev->next)
+ if (dev->ops && dev->ops->acpi_inject_dsdt_generator) {
+ dev->ops->acpi_inject_dsdt_generator();
+ }
+ current = (unsigned long) acpigen_get_current();
+#endif
+ memcpy((char *)current, (char *)&AmlCode + sizeof(acpi_header_t), dsdt->length - sizeof(acpi_header_t));
+ current += dsdt->length - sizeof(acpi_header_t);
+
+#if IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
+ /* (Re)calculate length and checksum. */
+ dsdt->length = current - (unsigned long)dsdt;
+ dsdt->checksum = 0;
+ dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
+#endif
+ }
ALIGN_CURRENT;
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 256afd4..7ae49f5 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -61,6 +61,7 @@ struct device_operations {
unsigned long (*write_acpi_tables)(unsigned long start, struct acpi_rsdp *rsdp);
unsigned long (*acpi_fill_ssdt_generator)(unsigned long current,
const char *oem_table_id);
+ void (*acpi_inject_dsdt_generator)(void);
#endif
const struct pci_operations *ops_pci;
const struct smbus_bus_operations *ops_smbus_bus;
diff --git a/src/southbridge/intel/bd82x6x/lpc.c b/src/southbridge/intel/bd82x6x/lpc.c
index a1c7c2a..6218874 100644
--- a/src/southbridge/intel/bd82x6x/lpc.c
+++ b/src/southbridge/intel/bd82x6x/lpc.c
@@ -671,7 +671,7 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device)
}
}
-static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oem_table_id)
+static void southbridge_inject_dsdt(void)
{
global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof (*gnvs));
void *opregion;
@@ -690,13 +690,11 @@ static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oe
/* And tell SMI about it */
smm_setup_structures(gnvs, NULL, NULL);
- /* Add it to SSDT. */
+ /* Add it to DSDT. */
scopelen = acpigen_write_scope("\\");
scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs);
acpigen_patch_len(scopelen - 1);
}
-
- return (unsigned long) (acpigen_get_current());
}
static struct pci_operations pci_ops = {
@@ -708,7 +706,7 @@ static struct device_operations device_ops = {
.set_resources = pci_dev_set_resources,
.enable_resources = pch_lpc_enable_resources,
.write_acpi_tables = acpi_write_hpet,
- .acpi_fill_ssdt_generator = southbridge_fill_ssdt,
+ .acpi_inject_dsdt_generator = southbridge_inject_dsdt,
.init = lpc_init,
.enable = pch_lpc_enable,
.scan_bus = scan_static_bus,
diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c
index 27ece63..31bb4e7 100644
--- a/src/southbridge/intel/ibexpeak/lpc.c
+++ b/src/southbridge/intel/ibexpeak/lpc.c
@@ -665,7 +665,7 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device)
}
}
-static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oem_table_id)
+static void southbridge_inject_dsdt(void)
{
global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof (*gnvs));
void *opregion;
@@ -689,8 +689,6 @@ static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oe
scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs);
acpigen_patch_len(scopelen - 1);
}
-
- return (unsigned long) (acpigen_get_current());
}
static struct pci_operations pci_ops = {
@@ -701,7 +699,7 @@ static struct device_operations device_ops = {
.read_resources = pch_lpc_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pch_lpc_enable_resources,
- .acpi_fill_ssdt_generator = southbridge_fill_ssdt,
+ .acpi_inject_dsdt_generator = southbridge_inject_dsdt,
.write_acpi_tables = acpi_write_hpet,
.init = lpc_init,
.enable = pch_lpc_enable,
diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c
index 451aeab..9e860d0 100644
--- a/src/southbridge/intel/lynxpoint/lpc.c
+++ b/src/southbridge/intel/lynxpoint/lpc.c
@@ -743,7 +743,7 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device)
}
}
-static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oem_table_id)
+static void southbridge_inject_dsdt(void)
{
global_nvs_t *gnvs;
@@ -761,13 +761,11 @@ static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oe
/* And tell SMI about it */
smm_setup_structures(gnvs, NULL, NULL);
- /* Add it to SSDT. */
+ /* Add it to DSDT. */
scopelen = acpigen_write_scope("\\");
scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs);
acpigen_patch_len(scopelen - 1);
}
-
- return (unsigned long) (acpigen_get_current());
}
#define ALIGN_CURRENT current = (ALIGN(current, 16))
@@ -815,7 +813,7 @@ static struct device_operations device_ops = {
.read_resources = pch_lpc_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
- .acpi_fill_ssdt_generator = southbridge_fill_ssdt,
+ .acpi_inject_dsdt_generator = southbridge_inject_dsdt,
.write_acpi_tables = southbridge_write_acpi_tables,
.init = lpc_init,
.enable = pch_lpc_enable,
1
0
Patch set updated for coreboot: 63b216e bd82x6x, ibexpeak, lynxpoint: Ensure 0-filling of uninited GNVS vars.
by Vladimir Serbinenko Oct. 5, 2014
by Vladimir Serbinenko Oct. 5, 2014
Oct. 5, 2014
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7015
-gerrit
commit 63b216ec6a8efb4aba041d235f6ade42887fd9d0
Author: Vladimir Serbinenko <phcoder(a)gmail.com>
Date: Sun Oct 5 11:07:33 2014 +0200
bd82x6x, ibexpeak, lynxpoint: Ensure 0-filling of uninited GNVS vars.
Change-Id: I672c3ca9e7f30a21330cf1920a25b1ab38b3f282
Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com>
---
src/southbridge/intel/bd82x6x/lpc.c | 4 ++++
src/southbridge/intel/ibexpeak/lpc.c | 4 ++++
src/southbridge/intel/lynxpoint/lpc.c | 9 ++++++++-
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/southbridge/intel/bd82x6x/lpc.c b/src/southbridge/intel/bd82x6x/lpc.c
index fa05d54..a1c7c2a 100644
--- a/src/southbridge/intel/bd82x6x/lpc.c
+++ b/src/southbridge/intel/bd82x6x/lpc.c
@@ -33,6 +33,7 @@
#include <arch/acpigen.h>
#include <drivers/intel/gma/i915.h>
#include <cbmem.h>
+#include <string.h>
#include "pch.h"
#include "nvs.h"
@@ -680,6 +681,9 @@ static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oe
if (gnvs) {
int scopelen;
+
+ memset(gnvs, 0, sizeof (*gnvs));
+
acpi_create_gnvs(gnvs);
/* IGD OpRegion Base Address */
gnvs->aslb = (u32)opregion;
diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c
index 7580aa9..27ece63 100644
--- a/src/southbridge/intel/ibexpeak/lpc.c
+++ b/src/southbridge/intel/ibexpeak/lpc.c
@@ -34,6 +34,7 @@
#include <arch/acpigen.h>
#include <drivers/intel/gma/i915.h>
#include <cbmem.h>
+#include <string.h>
#include "pch.h"
#include "nvs.h"
@@ -674,6 +675,9 @@ static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oe
if (gnvs) {
int scopelen;
+
+ memset(gnvs, 0, sizeof (*gnvs));
+
acpi_create_gnvs(gnvs);
/* IGD OpRegion Base Address */
gnvs->aslb = (u32)opregion;
diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c
index d1a7203..451aeab 100644
--- a/src/southbridge/intel/lynxpoint/lpc.c
+++ b/src/southbridge/intel/lynxpoint/lpc.c
@@ -745,7 +745,14 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device)
static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oem_table_id)
{
- global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof (*gnvs));
+ global_nvs_t *gnvs;
+
+ gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
+ if (!gnvs) {
+ gnvs = cbmem_add(CBMEM_ID_ACPI_GNVS, sizeof (*gnvs));
+ if (gnvs)
+ memset(gnvs, 0, sizeof(*gnvs));
+ }
if (gnvs) {
int scopelen;
1
0
Patch set updated for coreboot: c3c1f2d acpi_add_ssdt_pstates: Remove function.
by Vladimir Serbinenko Oct. 5, 2014
by Vladimir Serbinenko Oct. 5, 2014
Oct. 5, 2014
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7012
-gerrit
commit c3c1f2d75afc665e26dcc28ca8faa46ab076c4c9
Author: Vladimir Serbinenko <phcoder(a)gmail.com>
Date: Fri Oct 3 09:39:31 2014 +0200
acpi_add_ssdt_pstates: Remove function.
Nowhere in codebase p_state_num is set. So this whole function ends up
being a noop. Moreover the offsets used by it are wrong with any
optimizing iasl. Remove it in preparation of move to per-device ACPI.
Change-Id: I1f1f9743565aa8f0b8fca472ad4cb6d7542fcecb
Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com>
---
src/arch/x86/include/arch/acpi.h | 3 -
src/include/cpu/amd/amdfam10_sysconf.h | 2 -
src/mainboard/advansus/a785e-i/acpi_tables.c | 3 -
src/mainboard/amd/bimini_fam10/acpi_tables.c | 3 -
.../amd/serengeti_cheetah_fam10/acpi_tables.c | 3 -
src/mainboard/amd/tilapia_fam10/acpi_tables.c | 3 -
src/mainboard/asus/m4a78-em/acpi_tables.c | 3 -
src/mainboard/asus/m5a88-v/acpi_tables.c | 3 -
src/mainboard/avalue/eax-785e/acpi_tables.c | 3 -
src/mainboard/gigabyte/ma785gm/acpi_tables.c | 3 -
src/mainboard/gigabyte/ma785gmt/acpi_tables.c | 3 -
src/mainboard/gigabyte/ma78gm/acpi_tables.c | 3 -
src/mainboard/jetway/pa78vm5/acpi_tables.c | 3 -
src/mainboard/supermicro/h8scm_fam10/acpi_tables.c | 3 -
src/northbridge/amd/amdfam10/Makefile.inc | 5 --
src/northbridge/amd/amdfam10/acpi.c | 87 ----------------------
16 files changed, 133 deletions(-)
diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h
index 4adf89e..aec698a 100644
--- a/src/arch/x86/include/arch/acpi.h
+++ b/src/arch/x86/include/arch/acpi.h
@@ -575,9 +575,6 @@ void acpi_jump_to_wakeup(void *wakeup_addr);
int __attribute__((weak)) acpi_get_sleep_type(void);
#endif /* IS_ENABLED(CONFIG_HAVE_ACPI_RESUME) */
-/* northbridge/amd/amdfam10/amdfam10_acpi.c */
-unsigned long acpi_add_ssdt_pstates(acpi_rsdp_t *rsdp, unsigned long current);
-
/* cpu/intel/speedstep/acpi.c */
void generate_cpu_entries(void);
diff --git a/src/include/cpu/amd/amdfam10_sysconf.h b/src/include/cpu/amd/amdfam10_sysconf.h
index baba6ce..261c2db 100644
--- a/src/include/cpu/amd/amdfam10_sysconf.h
+++ b/src/include/cpu/amd/amdfam10_sysconf.h
@@ -56,8 +56,6 @@ struct amdfam10_sysconf_t {
msr_t msr_pstate[NODE_NUMS * 5]; // quad cores all cores in one node should be the same, and p0,..p5
unsigned needs_update_pstate_msrs;
- struct p_state_t p_state[NODE_NUMS * 5];
- unsigned p_state_num;
unsigned bsp_apicid;
int enabled_apic_ext_id;
diff --git a/src/mainboard/advansus/a785e-i/acpi_tables.c b/src/mainboard/advansus/a785e-i/acpi_tables.c
index 7853bd1..3f9bd60 100644
--- a/src/mainboard/advansus/a785e-i/acpi_tables.c
+++ b/src/mainboard/advansus/a785e-i/acpi_tables.c
@@ -157,9 +157,6 @@ unsigned long write_acpi_tables(unsigned long start)
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
acpi_add_table(rsdp,ssdt);
- printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
- current = acpi_add_ssdt_pstates(rsdp, current);
-
#if CONFIG_ACPI_SSDTX_NUM >= 1
/* same htio, but different position? We may have to copy,
diff --git a/src/mainboard/amd/bimini_fam10/acpi_tables.c b/src/mainboard/amd/bimini_fam10/acpi_tables.c
index 2ec11bb..84abaaa 100644
--- a/src/mainboard/amd/bimini_fam10/acpi_tables.c
+++ b/src/mainboard/amd/bimini_fam10/acpi_tables.c
@@ -182,9 +182,6 @@ unsigned long write_acpi_tables(unsigned long start)
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
acpi_add_table(rsdp,ssdt);
- printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
- current = acpi_add_ssdt_pstates(rsdp, current);
-
#if CONFIG_ACPI_SSDTX_NUM >= 1
/* same htio, but different position? We may have to copy,
diff --git a/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c b/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c
index f624424..32649ba 100644
--- a/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c
+++ b/src/mainboard/amd/serengeti_cheetah_fam10/acpi_tables.c
@@ -252,9 +252,6 @@ unsigned long write_acpi_tables(unsigned long start)
ssdt->checksum = acpi_checksum((unsigned char *)ssdt, ssdt->length);
acpi_add_table(rsdp, ssdt);
- printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
- current = acpi_add_ssdt_pstates(rsdp, current);
-
#if CONFIG_ACPI_SSDTX_NUM >= 1
/* same htio, but different possition? We may have to copy,
diff --git a/src/mainboard/amd/tilapia_fam10/acpi_tables.c b/src/mainboard/amd/tilapia_fam10/acpi_tables.c
index 898a955..4e56e8b 100644
--- a/src/mainboard/amd/tilapia_fam10/acpi_tables.c
+++ b/src/mainboard/amd/tilapia_fam10/acpi_tables.c
@@ -182,9 +182,6 @@ unsigned long write_acpi_tables(unsigned long start)
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
acpi_add_table(rsdp,ssdt);
- printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
- current = acpi_add_ssdt_pstates(rsdp, current);
-
#if CONFIG_ACPI_SSDTX_NUM >= 1
/* same htio, but different position? We may have to copy,
diff --git a/src/mainboard/asus/m4a78-em/acpi_tables.c b/src/mainboard/asus/m4a78-em/acpi_tables.c
index 2398c01..65f94d5 100644
--- a/src/mainboard/asus/m4a78-em/acpi_tables.c
+++ b/src/mainboard/asus/m4a78-em/acpi_tables.c
@@ -156,9 +156,6 @@ unsigned long write_acpi_tables(unsigned long start)
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
acpi_add_table(rsdp,ssdt);
- printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
- current = acpi_add_ssdt_pstates(rsdp, current);
-
#if CONFIG_ACPI_SSDTX_NUM >= 1
/* same htio, but different position? We may have to copy,
diff --git a/src/mainboard/asus/m5a88-v/acpi_tables.c b/src/mainboard/asus/m5a88-v/acpi_tables.c
index 7853bd1..3f9bd60 100644
--- a/src/mainboard/asus/m5a88-v/acpi_tables.c
+++ b/src/mainboard/asus/m5a88-v/acpi_tables.c
@@ -157,9 +157,6 @@ unsigned long write_acpi_tables(unsigned long start)
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
acpi_add_table(rsdp,ssdt);
- printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
- current = acpi_add_ssdt_pstates(rsdp, current);
-
#if CONFIG_ACPI_SSDTX_NUM >= 1
/* same htio, but different position? We may have to copy,
diff --git a/src/mainboard/avalue/eax-785e/acpi_tables.c b/src/mainboard/avalue/eax-785e/acpi_tables.c
index 7853bd1..3f9bd60 100644
--- a/src/mainboard/avalue/eax-785e/acpi_tables.c
+++ b/src/mainboard/avalue/eax-785e/acpi_tables.c
@@ -157,9 +157,6 @@ unsigned long write_acpi_tables(unsigned long start)
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
acpi_add_table(rsdp,ssdt);
- printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
- current = acpi_add_ssdt_pstates(rsdp, current);
-
#if CONFIG_ACPI_SSDTX_NUM >= 1
/* same htio, but different position? We may have to copy,
diff --git a/src/mainboard/gigabyte/ma785gm/acpi_tables.c b/src/mainboard/gigabyte/ma785gm/acpi_tables.c
index 7a5df88..d97a75e 100644
--- a/src/mainboard/gigabyte/ma785gm/acpi_tables.c
+++ b/src/mainboard/gigabyte/ma785gm/acpi_tables.c
@@ -157,9 +157,6 @@ unsigned long write_acpi_tables(unsigned long start)
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
acpi_add_table(rsdp,ssdt);
- printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
- current = acpi_add_ssdt_pstates(rsdp, current);
-
#if CONFIG_ACPI_SSDTX_NUM >= 1
/* same htio, but different position? We may have to copy,
diff --git a/src/mainboard/gigabyte/ma785gmt/acpi_tables.c b/src/mainboard/gigabyte/ma785gmt/acpi_tables.c
index 07b174c..60e0312 100644
--- a/src/mainboard/gigabyte/ma785gmt/acpi_tables.c
+++ b/src/mainboard/gigabyte/ma785gmt/acpi_tables.c
@@ -155,9 +155,6 @@ unsigned long write_acpi_tables(unsigned long start)
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
acpi_add_table(rsdp,ssdt);
- printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
- current = acpi_add_ssdt_pstates(rsdp, current);
-
#if CONFIG_ACPI_SSDTX_NUM >= 1
/* same htio, but different position? We may have to copy,
diff --git a/src/mainboard/gigabyte/ma78gm/acpi_tables.c b/src/mainboard/gigabyte/ma78gm/acpi_tables.c
index 07b174c..60e0312 100644
--- a/src/mainboard/gigabyte/ma78gm/acpi_tables.c
+++ b/src/mainboard/gigabyte/ma78gm/acpi_tables.c
@@ -155,9 +155,6 @@ unsigned long write_acpi_tables(unsigned long start)
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
acpi_add_table(rsdp,ssdt);
- printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
- current = acpi_add_ssdt_pstates(rsdp, current);
-
#if CONFIG_ACPI_SSDTX_NUM >= 1
/* same htio, but different position? We may have to copy,
diff --git a/src/mainboard/jetway/pa78vm5/acpi_tables.c b/src/mainboard/jetway/pa78vm5/acpi_tables.c
index fc6f186..007d536 100644
--- a/src/mainboard/jetway/pa78vm5/acpi_tables.c
+++ b/src/mainboard/jetway/pa78vm5/acpi_tables.c
@@ -156,9 +156,6 @@ unsigned long write_acpi_tables(unsigned long start)
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
acpi_add_table(rsdp,ssdt);
- printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
- current = acpi_add_ssdt_pstates(rsdp, current);
-
#if CONFIG_ACPI_SSDTX_NUM >= 1
/* same htio, but different position? We may have to copy,
diff --git a/src/mainboard/supermicro/h8scm_fam10/acpi_tables.c b/src/mainboard/supermicro/h8scm_fam10/acpi_tables.c
index ae9cca9..660ea6f 100644
--- a/src/mainboard/supermicro/h8scm_fam10/acpi_tables.c
+++ b/src/mainboard/supermicro/h8scm_fam10/acpi_tables.c
@@ -170,9 +170,6 @@ unsigned long write_acpi_tables(unsigned long start)
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
acpi_add_table(rsdp,ssdt);
- printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
- current = acpi_add_ssdt_pstates(rsdp, current);
-
#if CONFIG_ACPI_SSDTX_NUM >= 1
/* same htio, but different position? We may have to copy,
diff --git a/src/northbridge/amd/amdfam10/Makefile.inc b/src/northbridge/amd/amdfam10/Makefile.inc
index a24783b..7dc74df 100644
--- a/src/northbridge/amd/amdfam10/Makefile.inc
+++ b/src/northbridge/amd/amdfam10/Makefile.inc
@@ -3,11 +3,6 @@ ramstage-y += misc_control.c
ramstage-$(CONFIG_GENERATE_ACPI_TABLES) += acpi.c
ramstage-$(CONFIG_GENERATE_ACPI_TABLES) += ssdt.asl
-ramstage-$(CONFIG_GENERATE_ACPI_TABLES) += sspr1.asl
-ramstage-$(CONFIG_GENERATE_ACPI_TABLES) += sspr2.asl
-ramstage-$(CONFIG_GENERATE_ACPI_TABLES) += sspr3.asl
-ramstage-$(CONFIG_GENERATE_ACPI_TABLES) += sspr4.asl
-ramstage-$(CONFIG_GENERATE_ACPI_TABLES) += sspr5.asl
ramstage-y += get_pci1234.c
diff --git a/src/northbridge/amd/amdfam10/acpi.c b/src/northbridge/amd/amdfam10/acpi.c
index abba0ce..513fa58 100644
--- a/src/northbridge/amd/amdfam10/acpi.c
+++ b/src/northbridge/amd/amdfam10/acpi.c
@@ -290,90 +290,3 @@ void update_ssdtx(void *ssdtx, int i)
}
-static void update_sspr(void *sspr, u32 nodeid, u32 cpuindex)
-{
- u8 *CPU;
- u8 *CPUIN;
- u8 *COREFREQ;
- u8 *POWER;
- u8 *TRANSITION_LAT;
- u8 *BUSMASTER_LAT;
- u8 *CONTROL;
- u8 *STATUS;
- unsigned offset = 0x94 - 0x7f;
- int i;
-
- CPU = sspr + 0x38;
- CPUIN = sspr + 0x3a;
-
- COREFREQ = sspr + 0x7f; //2 byte
- POWER = sspr + 0x82; //3 bytes
- TRANSITION_LAT = sspr + 0x87; //two bytes
- BUSMASTER_LAT = sspr + 0x8a; //two bytes
- CONTROL = sspr + 0x8d;
- STATUS = sspr + 0x8f;
-
- snprintf((char*)CPU, 3, "%02x", (char)cpuindex);
- *CPUIN = (u8) cpuindex;
-
- for(i=0;i<sysconf.p_state_num;i++) {
- struct p_state_t *p_state = &sysconf.p_state[nodeid * 5 + i];
- intx_to_stream(p_state->corefreq, 2, COREFREQ + i*offset);
- intx_to_stream(p_state->power, 3, POWER + i*offset);
- intx_to_stream(p_state->transition_lat, 2, TRANSITION_LAT + i*offset);
- intx_to_stream(p_state->busmaster_lat, 2, BUSMASTER_LAT + i*offset);
- *((u8 *)(CONTROL + i*offset)) =(u8) p_state->control;
- *((u8 *)(STATUS + i*offset)) =(u8) p_state->status;
- }
-}
-
-extern const unsigned char AmlCode_sspr5[];
-extern const unsigned char AmlCode_sspr4[];
-extern const unsigned char AmlCode_sspr3[];
-extern const unsigned char AmlCode_sspr2[];
-extern const unsigned char AmlCode_sspr1[];
-
-/* fixme: find one good way for different p_state_num */
-unsigned long acpi_add_ssdt_pstates(acpi_rsdp_t *rsdp, unsigned long current)
-{
- device_t cpu;
- int cpu_index = 0;
-
- acpi_header_t *ssdt;
-
- if(!sysconf.p_state_num) return current;
-
- void *AmlCode_sspr;
- switch(sysconf.p_state_num) {
- case 1: AmlCode_sspr = &AmlCode_sspr1; break;
- case 2: AmlCode_sspr = &AmlCode_sspr2; break;
- case 3: AmlCode_sspr = &AmlCode_sspr3; break;
- case 4: AmlCode_sspr = &AmlCode_sspr4; break;
- default: AmlCode_sspr = &AmlCode_sspr5; break;
- }
-
- for(cpu = all_devices; cpu; cpu = cpu->next) {
- if ((cpu->path.type != DEVICE_PATH_APIC) ||
- (cpu->bus->dev->path.type != DEVICE_PATH_CPU_CLUSTER)) {
- continue;
- }
- if (!cpu->enabled) {
- continue;
- }
- printk(BIOS_DEBUG, "ACPI: pstate cpu_index=%02x, node_id=%02x, core_id=%02x\n", cpu_index, cpu->path.apic.node_id, cpu->path.apic.core_id);
-
- current = ALIGN(current, 16);
- ssdt = (acpi_header_t *)current;
- memcpy(ssdt, AmlCode_sspr, sizeof(acpi_header_t));
- current += ssdt->length;
- memcpy(ssdt, AmlCode_sspr, ssdt->length);
- update_sspr((void*)ssdt,cpu->path.apic.node_id, cpu_index);
- /* recalculate checksum */
- ssdt->checksum = 0;
- ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
- acpi_add_table(rsdp, ssdt);
-
- cpu_index++;
- }
- return current;
-}
1
0
New patch to review for coreboot: 22ce30f bd82x6x, ibexpeak, lynxpoint: Declare NVSA before its use.
by Vladimir Serbinenko Oct. 5, 2014
by Vladimir Serbinenko Oct. 5, 2014
Oct. 5, 2014
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7017
-gerrit
commit 22ce30feedc034c73ec2198a957c5870d65f4a53
Author: Vladimir Serbinenko <phcoder(a)gmail.com>
Date: Sun Oct 5 11:10:35 2014 +0200
bd82x6x, ibexpeak, lynxpoint: Declare NVSA before its use.
Windows chokes if it's not the case.
Change-Id: I3df15228ed00c3124b8d42fc01d7d63ff3fe07ba
Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com>
---
src/arch/x86/boot/acpi.c | 23 +++++++++++++++++++++--
src/include/device/device.h | 1 +
src/southbridge/intel/bd82x6x/lpc.c | 8 +++-----
src/southbridge/intel/ibexpeak/lpc.c | 6 ++----
src/southbridge/intel/lynxpoint/lpc.c | 8 +++-----
5 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c
index 3a30d31..6c74268 100644
--- a/src/arch/x86/boot/acpi.c
+++ b/src/arch/x86/boot/acpi.c
@@ -707,8 +707,27 @@ unsigned long write_acpi_tables(unsigned long start)
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
dsdt = (acpi_header_t *) current;
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
- current += dsdt->length;
- memcpy(dsdt, &AmlCode, dsdt->length);
+ if (dsdt->length >= sizeof(acpi_header_t)) {
+ current += sizeof(acpi_header_t);
+
+#if IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
+ acpigen_set_current((char *) current);
+ for (dev = all_devices; dev; dev = dev->next)
+ if (dev->ops && dev->ops->acpi_inject_dsdt_generator) {
+ dev->ops->acpi_inject_dsdt_generator();
+ }
+ current = (unsigned long) acpigen_get_current();
+#endif
+ memcpy((char *)current, (char *)&AmlCode + sizeof(acpi_header_t), dsdt->length - sizeof(acpi_header_t));
+ current += dsdt->length - sizeof(acpi_header_t);
+
+#if IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES)
+ /* (Re)calculate length and checksum. */
+ dsdt->length = current - (unsigned long)dsdt;
+ dsdt->checksum = 0;
+ dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length);
+#endif
+ }
ALIGN_CURRENT;
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 256afd4..7ae49f5 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -61,6 +61,7 @@ struct device_operations {
unsigned long (*write_acpi_tables)(unsigned long start, struct acpi_rsdp *rsdp);
unsigned long (*acpi_fill_ssdt_generator)(unsigned long current,
const char *oem_table_id);
+ void (*acpi_inject_dsdt_generator)(void);
#endif
const struct pci_operations *ops_pci;
const struct smbus_bus_operations *ops_smbus_bus;
diff --git a/src/southbridge/intel/bd82x6x/lpc.c b/src/southbridge/intel/bd82x6x/lpc.c
index a1c7c2a..6218874 100644
--- a/src/southbridge/intel/bd82x6x/lpc.c
+++ b/src/southbridge/intel/bd82x6x/lpc.c
@@ -671,7 +671,7 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device)
}
}
-static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oem_table_id)
+static void southbridge_inject_dsdt(void)
{
global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof (*gnvs));
void *opregion;
@@ -690,13 +690,11 @@ static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oe
/* And tell SMI about it */
smm_setup_structures(gnvs, NULL, NULL);
- /* Add it to SSDT. */
+ /* Add it to DSDT. */
scopelen = acpigen_write_scope("\\");
scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs);
acpigen_patch_len(scopelen - 1);
}
-
- return (unsigned long) (acpigen_get_current());
}
static struct pci_operations pci_ops = {
@@ -708,7 +706,7 @@ static struct device_operations device_ops = {
.set_resources = pci_dev_set_resources,
.enable_resources = pch_lpc_enable_resources,
.write_acpi_tables = acpi_write_hpet,
- .acpi_fill_ssdt_generator = southbridge_fill_ssdt,
+ .acpi_inject_dsdt_generator = southbridge_inject_dsdt,
.init = lpc_init,
.enable = pch_lpc_enable,
.scan_bus = scan_static_bus,
diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c
index 1d893e9..81f3141 100644
--- a/src/southbridge/intel/ibexpeak/lpc.c
+++ b/src/southbridge/intel/ibexpeak/lpc.c
@@ -664,7 +664,7 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device)
}
}
-static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oem_table_id)
+static void southbridge_inject_dsdt(void)
{
global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof (*gnvs));
void *opregion;
@@ -688,8 +688,6 @@ static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oe
scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs);
acpigen_patch_len(scopelen - 1);
}
-
- return (unsigned long) (acpigen_get_current());
}
static struct pci_operations pci_ops = {
@@ -700,7 +698,7 @@ static struct device_operations device_ops = {
.read_resources = pch_lpc_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pch_lpc_enable_resources,
- .acpi_fill_ssdt_generator = southbridge_fill_ssdt,
+ .acpi_inject_dsdt_generator = southbridge_inject_dsdt,
.write_acpi_tables = acpi_write_hpet,
.init = lpc_init,
.enable = pch_lpc_enable,
diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c
index 451aeab..9e860d0 100644
--- a/src/southbridge/intel/lynxpoint/lpc.c
+++ b/src/southbridge/intel/lynxpoint/lpc.c
@@ -743,7 +743,7 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device)
}
}
-static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oem_table_id)
+static void southbridge_inject_dsdt(void)
{
global_nvs_t *gnvs;
@@ -761,13 +761,11 @@ static unsigned long southbridge_fill_ssdt(unsigned long current, const char *oe
/* And tell SMI about it */
smm_setup_structures(gnvs, NULL, NULL);
- /* Add it to SSDT. */
+ /* Add it to DSDT. */
scopelen = acpigen_write_scope("\\");
scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs);
acpigen_patch_len(scopelen - 1);
}
-
- return (unsigned long) (acpigen_get_current());
}
#define ALIGN_CURRENT current = (ALIGN(current, 16))
@@ -815,7 +813,7 @@ static struct device_operations device_ops = {
.read_resources = pch_lpc_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
- .acpi_fill_ssdt_generator = southbridge_fill_ssdt,
+ .acpi_inject_dsdt_generator = southbridge_inject_dsdt,
.write_acpi_tables = southbridge_write_acpi_tables,
.init = lpc_init,
.enable = pch_lpc_enable,
1
0
New patch to review for coreboot: 179bd88 lynxpoint: Change OEM table ID for serialio.
by Vladimir Serbinenko Oct. 5, 2014
by Vladimir Serbinenko Oct. 5, 2014
Oct. 5, 2014
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7016
-gerrit
commit 179bd8825f2cddd92fada1d58c2341cb9353a34d
Author: Vladimir Serbinenko <phcoder(a)gmail.com>
Date: Sun Oct 5 11:08:40 2014 +0200
lynxpoint: Change OEM table ID for serialio.
According to ACPI spec all SSDTs should have distinct OEM table ID.
We end up with 2 SSDTs named "COREBOOT". Fix this.
Change-Id: I01bccb72758baf51c6b4263778716f4bb9d438c9
Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com>
---
src/southbridge/intel/lynxpoint/acpi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/southbridge/intel/lynxpoint/acpi.c b/src/southbridge/intel/lynxpoint/acpi.c
index ef1c9d8..d1c8934 100644
--- a/src/southbridge/intel/lynxpoint/acpi.c
+++ b/src/southbridge/intel/lynxpoint/acpi.c
@@ -78,8 +78,8 @@ void acpi_create_serialio_ssdt(acpi_header_t *ssdt)
memcpy(&ssdt->signature, "SSDT", 4);
ssdt->revision = 2;
memcpy(&ssdt->oem_id, OEM_ID, 6);
- memcpy(&ssdt->oem_table_id, ACPI_TABLE_CREATOR, 8);
- ssdt->oem_revision = 42;
+ memcpy(&ssdt->oem_table_id, "SERIALIO", 8);
+ ssdt->oem_revision = 43;
memcpy(&ssdt->asl_compiler_id, ASLC, 4);
ssdt->asl_compiler_revision = 42;
ssdt->length = sizeof(acpi_header_t);
1
0