mail.coreboot.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
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
List overview
Download
coreboot-gerrit
October 2014
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
coreboot-gerrit@coreboot.org
1 participants
1026 discussions
Start a n
N
ew thread
Patch set updated for coreboot: 97bc7eb sch: Switch to per-device ACPI
by Vladimir Serbinenko
05 Oct '14
05 Oct '14
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 97bc7eba91f3d4b318e51bd55a43b3a5e69197a9 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 | 4 + src/northbridge/intel/sch/northbridge.c | 1 + src/southbridge/intel/sch/acpi/globalnvs.asl | 4 +- src/southbridge/intel/sch/lpc.c | 26 +++++ src/southbridge/intel/sch/nvs.h | 2 + 7 files changed, 37 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..40347c7 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) { diff --git a/src/northbridge/intel/sch/northbridge.c b/src/northbridge/intel/sch/northbridge.c index 0bbf91b..1f327c6 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 = generate_cpu_entries, .scan_bus = 0, .ops_pci = &intel_pci_ops, }; 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
0
0
Patch set updated for coreboot: 6ee7e0d via/vx800: Migrate to collaborative ACPI
by Vladimir Serbinenko
05 Oct '14
05 Oct '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/6944
-gerrit commit 6ee7e0d12fecb631c43ef199f988b5a33aa1a0ef Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Tue Sep 2 00:15:02 2014 +0200 via/vx800: Migrate to collaborative ACPI Change-Id: I00d0d0e2556d4cd0553a2b3351ace26bf747ff6a Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/mainboard/via/epia-m700/Kconfig | 1 + src/mainboard/via/epia-m700/acpi_tables.c | 89 ------------------------------- src/northbridge/via/vx800/northbridge.c | 3 ++ 3 files changed, 4 insertions(+), 89 deletions(-) diff --git a/src/mainboard/via/epia-m700/Kconfig b/src/mainboard/via/epia-m700/Kconfig index c64f8d2..7d21038 100644 --- a/src/mainboard/via/epia-m700/Kconfig +++ b/src/mainboard/via/epia-m700/Kconfig @@ -9,6 +9,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy # Note: For ACPI, you need to use the 'get_dsdt' script and uncomment # the "select HAVE_ACPI_TABLES" line below. # select HAVE_ACPI_TABLES + # select PER_DEVICE_ACPI_TABLES select HAVE_OPTION_TABLE select BOARD_ROMSIZE_KB_512 diff --git a/src/mainboard/via/epia-m700/acpi_tables.c b/src/mainboard/via/epia-m700/acpi_tables.c index 7d95616..c841f2c 100644 --- a/src/mainboard/via/epia-m700/acpi_tables.c +++ b/src/mainboard/via/epia-m700/acpi_tables.c @@ -113,92 +113,3 @@ unsigned long acpi_fill_srat(unsigned long current) /* No NUMA, no SRAT. */ return current; } - -#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) -#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_header_t *dsdt; -#if 0 - acpi_header_t *ssdt; -#endif - - /* Align ACPI tables to 16 byte. */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* 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: * FACS\n"); - current = ALIGN(current, 64); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - printk(BIOS_DEBUG, "ACPI: * DSDT\n"); - dsdt = (acpi_header_t *) current; - memcpy(dsdt, &AmlCode_dsdt, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode_dsdt, dsdt->length); - dsdt->checksum = 0; /* Don't trust iasl to get this right. */ - dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length); - - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - /* If we want to use HPET timers Linux wants it in MADT. */ - printk(BIOS_DEBUG, "ACPI: * MADT\n"); - madt = (acpi_madt_t *) current; - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - - /* NO MCFG in VX855, no PCI-E. */ - - printk(BIOS_DEBUG, "ACPI: * HPET\n"); - hpet = (acpi_hpet_t *) current; - acpi_create_hpet(hpet); - current += hpet->header.length; - acpi_add_table(rsdp, hpet); - -#if 0 - printk(BIOS_DEBUG, "ACPI: * SSDT\n"); - ssdt = (acpi_header_t *) current; - memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t)); - current += ssdt->length; - memcpy(ssdt, &AmlCode_ssdt, ssdt->length); - ssdt->checksum = 0; /* Don't trust iasl to get this right. */ - ssdt->checksum = acpi_checksum((u8*)ssdt, ssdt->length); - acpi_add_table(rsdp, ssdt); - printk(BIOS_DEBUG, "ACPI: * SSDT @ %08x Length %x\n", ssdt, ssdt->length); -#endif - - printk(BIOS_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/northbridge/via/vx800/northbridge.c b/src/northbridge/via/vx800/northbridge.c index a87e65e..9c58289 100644 --- a/src/northbridge/via/vx800/northbridge.c +++ b/src/northbridge/via/vx800/northbridge.c @@ -136,6 +136,9 @@ if register with invalid value we set frame buffer size to 32M for default, but static struct device_operations pci_domain_ops = { .read_resources = pci_domain_read_resources, .set_resources = pci_domain_set_resources, +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) + .write_acpi_tables = acpi_write_hpet, +#endif .enable_resources = NULL, .init = NULL, .scan_bus = pci_domain_scan_bus,
1
0
0
0
Patch set updated for coreboot: 2fb18a9 acpi_add_ssdt_pstates: Remove function.
by Vladimir Serbinenko
05 Oct '14
05 Oct '14
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 2fb18a9bf9ece2b5a7f66bf289a91fb1d4e18400 Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Fri Oct 3 09:39:31 2014 +0200 acpi_add_ssdt_pstates: Remove function. Nowhere in database 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 a015635..d32a079 100644 --- a/src/arch/x86/include/arch/acpi.h +++ b/src/arch/x86/include/arch/acpi.h @@ -577,9 +577,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 8d7f723..30a7388 100644 --- a/src/mainboard/amd/tilapia_fam10/acpi_tables.c +++ b/src/mainboard/amd/tilapia_fam10/acpi_tables.c @@ -176,9 +176,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 a132b7b..7e159b4 100644 --- a/src/mainboard/asus/m4a78-em/acpi_tables.c +++ b/src/mainboard/asus/m4a78-em/acpi_tables.c @@ -150,9 +150,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 e961b6e..4c0cb77 100644 --- a/src/mainboard/gigabyte/ma785gm/acpi_tables.c +++ b/src/mainboard/gigabyte/ma785gm/acpi_tables.c @@ -151,9 +151,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 3b776ae..a9e72eb 100644 --- a/src/mainboard/gigabyte/ma785gmt/acpi_tables.c +++ b/src/mainboard/gigabyte/ma785gmt/acpi_tables.c @@ -149,9 +149,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 3b776ae..a9e72eb 100644 --- a/src/mainboard/gigabyte/ma78gm/acpi_tables.c +++ b/src/mainboard/gigabyte/ma78gm/acpi_tables.c @@ -149,9 +149,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 eac5619..1c5404f 100644 --- a/src/mainboard/jetway/pa78vm5/acpi_tables.c +++ b/src/mainboard/jetway/pa78vm5/acpi_tables.c @@ -150,9 +150,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 48a396e..66a5239 100644 --- a/src/mainboard/supermicro/h8scm_fam10/acpi_tables.c +++ b/src/mainboard/supermicro/h8scm_fam10/acpi_tables.c @@ -164,9 +164,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
0
0
Patch set updated for coreboot: 66f3b5e NOTFORMERGE: amdk8: Move to per-device ACPI
by Vladimir Serbinenko
05 Oct '14
05 Oct '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/6948
-gerrit commit 66f3b5e9fa7bc6dcd90817be54cf757d43dc912c Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sun Sep 21 14:31:19 2014 +0200 NOTFORMERGE: amdk8: Move to per-device ACPI Change-Id: I485791015aa7eaabba53813945c216f5725554b1 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/mainboard/amd/dbm690t/acpi_tables.c | 108 +------------ src/mainboard/amd/mahogany/acpi_tables.c | 159 +------------------ src/mainboard/amd/mahogany_fam10/acpi_tables.c | 6 - src/mainboard/amd/pistachio/acpi_tables.c | 107 +------------ src/mainboard/amd/serengeti_cheetah/acpi_tables.c | 102 +----------- src/mainboard/amd/serengeti_cheetah/mainboard.c | 15 ++ src/mainboard/amd/serengeti_cheetah/mainboard.h | 1 + src/mainboard/amd/tilapia_fam10/acpi_tables.c | 6 - src/mainboard/asrock/939a785gmh/acpi_tables.c | 159 +------------------ src/mainboard/asus/a8n_e/acpi_tables.c | 137 ---------------- src/mainboard/asus/a8v-e_deluxe/acpi_tables.c | 93 +---------- src/mainboard/asus/a8v-e_deluxe/dsdt.asl | 7 - src/mainboard/asus/a8v-e_se/acpi_tables.c | 110 +------------ src/mainboard/asus/k8v-x/acpi_tables.c | 110 +------------ src/mainboard/asus/m2v-mx_se/acpi_tables.c | 130 +--------------- src/mainboard/asus/m2v/acpi_tables.c | 131 +--------------- src/mainboard/asus/m4a78-em/acpi_tables.c | 6 - src/mainboard/asus/m4a785-m/acpi_tables.c | 8 - src/mainboard/gigabyte/m57sli/acpi_tables.c | 117 -------------- src/mainboard/gigabyte/ma785gm/acpi_tables.c | 6 - src/mainboard/gigabyte/ma785gmt/acpi_tables.c | 6 - src/mainboard/gigabyte/ma78gm/acpi_tables.c | 6 - src/mainboard/hp/dl145_g1/acpi_tables.c | 173 +-------------------- src/mainboard/iei/kino-780am2-fam10/acpi_tables.c | 6 - src/mainboard/iwill/dk8_htx/acpi_tables.c | 110 +------------ src/mainboard/iwill/dk8_htx/mainboard.c | 17 ++ src/mainboard/iwill/dk8_htx/mainboard.h | 1 + src/mainboard/jetway/pa78vm5/acpi_tables.c | 6 - src/mainboard/kontron/kt690/acpi_tables.c | 107 +------------ src/mainboard/msi/ms7135/acpi_tables.c | 138 ---------------- src/mainboard/msi/ms9652_fam10/acpi_tables.c | 6 - src/mainboard/siemens/sitemp_g1p1/acpi_tables.c | 166 ++------------------ src/mainboard/siemens/sitemp_g1p1/dsdt.asl | 4 +- src/mainboard/siemens/sitemp_g1p1/mainboard.c | 2 + src/mainboard/siemens/sitemp_g1p1/mainboard.h | 1 + src/mainboard/supermicro/h8scm_fam10/acpi_tables.c | 6 - src/mainboard/technexion/tim5690/acpi_tables.c | 107 +------------ src/mainboard/technexion/tim8690/acpi_tables.c | 107 +------------ src/mainboard/tyan/s2891/acpi_tables.c | 114 +------------- src/mainboard/tyan/s2891/mainboard.c | 23 +++ src/mainboard/tyan/s2892/acpi_tables.c | 114 +------------- src/mainboard/tyan/s2892/mainboard.c | 23 +++ src/mainboard/tyan/s2895/acpi_tables.c | 114 +------------- src/mainboard/tyan/s2895/mainboard.c | 23 +++ src/mainboard/winent/mb6047/acpi_tables.c | 114 +------------- src/mainboard/winent/mb6047/mainboard.c | 23 +++ src/northbridge/amd/amdk8/Kconfig | 1 + src/northbridge/amd/amdk8/acpi.c | 8 +- src/northbridge/amd/amdk8/acpi.h | 2 +- src/northbridge/amd/amdk8/northbridge.c | 36 +++++ src/southbridge/amd/amd8111/lpc.c | 31 ++++ src/southbridge/amd/rs690/ht.c | 18 +++ src/southbridge/amd/sb600/lpc.c | 19 +++ src/southbridge/amd/sb700/lpc.c | 25 ++- src/southbridge/nvidia/ck804/ht.c | 27 ++++ src/southbridge/nvidia/ck804/lpc.c | 4 + src/southbridge/nvidia/mcp55/ht.c | 9 ++ src/southbridge/nvidia/mcp55/lpc.c | 20 +++ src/southbridge/via/k8t890/traf_ctrl.c | 41 +++++ 59 files changed, 428 insertions(+), 2848 deletions(-) diff --git a/src/mainboard/amd/dbm690t/acpi_tables.c b/src/mainboard/amd/dbm690t/acpi_tables.c index 87ff5ea..da75062 100644 --- a/src/mainboard/amd/dbm690t/acpi_tables.c +++ b/src/mainboard/amd/dbm690t/acpi_tables.c @@ -28,28 +28,11 @@ #include <cpu/amd/amdk8_sysconf.h> #include "northbridge/amd/amdk8/acpi.h" #include <arch/cpu.h> -#include <cpu/amd/model_fxx_powernow.h> - -extern u16 pm_base; - -/* -* Assume the max pstate number is 8 -* 0x21(33 bytes) is one package length of _PSS package -*/ - -#define Maxpstate 8 -#define Defpkglength 0x21 - -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} unsigned long acpi_fill_madt(unsigned long current) { + get_bus_conf(); + /* create all subtables for processors */ current = acpi_create_madt_lapics(current); @@ -72,90 +55,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(pm_base + 8, 6, 1); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_header_t *dsdt; - acpi_header_t *ssdt; - - get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */ - - /* Align ACPI tables to 16byte */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* clear all table memory */ - memset((void *)start, 0, current - start); - - acpi_write_rsdp(rsdp, rsdt, NULL); - acpi_write_rsdt(rsdt); - - /* FACS */ - printk(BIOS_DEBUG, "ACPI: * FACS\n"); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - 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); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length); - /* FADT */ - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - /* - * We explicitly add these tables later on: - */ - /* If we want to use HPET Timers Linux wants an MADT */ - printk(BIOS_DEBUG, "ACPI: * HPET\n"); - hpet = (acpi_hpet_t *) current; - current += sizeof(acpi_hpet_t); - acpi_create_hpet(hpet); - acpi_add_table(rsdp, hpet); - - printk(BIOS_DEBUG, "ACPI: * MADT\n"); - madt = (acpi_madt_t *) current; - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - - /* SSDT */ - 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_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/mainboard/amd/mahogany/acpi_tables.c b/src/mainboard/amd/mahogany/acpi_tables.c index ef2690a..f7154ad 100644 --- a/src/mainboard/amd/mahogany/acpi_tables.c +++ b/src/mainboard/amd/mahogany/acpi_tables.c @@ -28,34 +28,12 @@ #include <cpu/amd/amdk8_sysconf.h> #include "northbridge/amd/amdk8/acpi.h" #include <arch/cpu.h> -#include <cpu/amd/model_fxx_powernow.h> #include <southbridge/amd/sb700/sb700.h> -/* -* Assume the max pstate number is 8 -* 0x21(33 bytes) is one package length of _PSS package -*/ - -#define Maxpstate 8 -#define Defpkglength 0x21 - -extern const unsigned char AmlCode[]; - -#if CONFIG_ACPI_SSDTX_NUM >= 1 -extern const unsigned char AmlCode_ssdt2[]; -extern const unsigned char AmlCode_ssdt3[]; -extern const unsigned char AmlCode_ssdt4[]; -extern const unsigned char AmlCode_ssdt5[]; -#endif - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { + get_bus_conf(); + /* create all subtables for processors */ current = acpi_create_madt_lapics(current); @@ -78,136 +56,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(ACPI_CPU_CONTROL, 6, 1); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_header_t *dsdt; - acpi_header_t *ssdt; -#if CONFIG_ACPI_SSDTX_NUM >= 1 - acpi_header_t *ssdtx; - void *p; - int i; -#endif - - get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */ - - /* Align ACPI tables to 16 bytes */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* clear all table memory */ - memset((void *)start, 0, current - start); - - acpi_write_rsdp(rsdp, rsdt, NULL); - acpi_write_rsdt(rsdt); - - /* FACS */ - printk(BIOS_DEBUG, "ACPI: * FACS\n"); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - 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); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length); - /* FADT */ - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - /* - * We explicitly add these tables later on: - */ - /* If we want to use HPET Timers Linux wants an MADT */ - printk(BIOS_DEBUG, "ACPI: * HPET\n"); - hpet = (acpi_hpet_t *) current; - current += sizeof(acpi_hpet_t); - acpi_create_hpet(hpet); - acpi_add_table(rsdp, hpet); - - printk(BIOS_DEBUG, "ACPI: * MADT\n"); - madt = (acpi_madt_t *) current; - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - - /* SSDT */ - 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); - -#if CONFIG_ACPI_SSDTX_NUM >= 1 - - /* same htio, but different position? We may have to copy, change HCIN, and recalculate the checknum and add_table */ - - for (i = 1; i < sysconf.hc_possible_num; i++) { /* 0: is hc sblink */ - if ((sysconf.pci1234[i] & 1) != 1) - continue; - u8 c; - if (i < 7) { - c = (u8) ('4' + i - 1); - } else { - c = (u8) ('A' + i - 1 - 6); - } - printk(BIOS_DEBUG, "ACPI: * SSDT for PCI%c Aka hcid = %d\n", c, sysconf.hcid[i]); /* pci0 and pci1 are in dsdt */ - current = ALIGN(current, 8); - ssdtx = (acpi_header_t *) current; - switch (sysconf.hcid[i]) { - case 1: /* 8132 */ - p = &AmlCode_ssdt2; - break; - case 2: /* 8151 */ - p = &AmlCode_ssdt3; - break; - case 3: /* 8131 */ - p = &AmlCode_ssdt4; - break; - default: - /* HTX no io apic */ - p = &AmlCode_ssdt5; - break; - } - memcpy(ssdtx, p, sizeof(acpi_header_t)); - current += ssdtx->length; - memcpy(ssdtx, p, ssdtx->length); - update_ssdtx((void *)ssdtx, i); - ssdtx->checksum = 0; - ssdtx->checksum = acpi_checksum((u8 *)ssdtx, ssdtx->length); - acpi_add_table(rsdp, ssdtx); - } -#endif - - printk(BIOS_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/mainboard/amd/mahogany_fam10/acpi_tables.c b/src/mainboard/amd/mahogany_fam10/acpi_tables.c index 01172ad..5efb0ee 100644 --- a/src/mainboard/amd/mahogany_fam10/acpi_tables.c +++ b/src/mainboard/amd/mahogany_fam10/acpi_tables.c @@ -60,12 +60,6 @@ unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_ta return (unsigned long) (acpigen_get_current()); } -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { /* create all subtables for processors */ diff --git a/src/mainboard/amd/pistachio/acpi_tables.c b/src/mainboard/amd/pistachio/acpi_tables.c index 5ef0da5..2a587cd 100644 --- a/src/mainboard/amd/pistachio/acpi_tables.c +++ b/src/mainboard/amd/pistachio/acpi_tables.c @@ -30,26 +30,10 @@ #include <arch/cpu.h> #include <cpu/amd/model_fxx_powernow.h> -extern u16 pm_base; - -/* -* Assume the max pstate number is 8 -* 0x21(33 bytes) is one package length of _PSS package -*/ - -#define Maxpstate 8 -#define Defpkglength 0x21 - -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { + get_bus_conf(); + /* create all subtables for processors */ current = acpi_create_madt_lapics(current); @@ -73,90 +57,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(pm_base + 8, 6, 1); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_header_t *dsdt; - acpi_header_t *ssdt; - - get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */ - - /* Align ACPI tables to 16byte */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* clear all table memory */ - memset((void *)start, 0, current - start); - - acpi_write_rsdp(rsdp, rsdt, NULL); - acpi_write_rsdt(rsdt); - - /* FACS */ - printk(BIOS_DEBUG, "ACPI: * FACS\n"); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - 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); - - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length); - /* FADT */ - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - /* - * We explicitly add these tables later on: - */ - /* If we want to use HPET Timers Linux wants an MADT */ - printk(BIOS_DEBUG, "ACPI: * HPET\n"); - hpet = (acpi_hpet_t *) current; - current += sizeof(acpi_hpet_t); - acpi_create_hpet(hpet); - acpi_add_table(rsdp, hpet); - - printk(BIOS_DEBUG, "ACPI: * MADT\n"); - madt = (acpi_madt_t *) current; - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - - /* SSDT */ - 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_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/mainboard/amd/serengeti_cheetah/acpi_tables.c b/src/mainboard/amd/serengeti_cheetah/acpi_tables.c index a429c1f..65b8fc5 100644 --- a/src/mainboard/amd/serengeti_cheetah/acpi_tables.c +++ b/src/mainboard/amd/serengeti_cheetah/acpi_tables.c @@ -19,19 +19,11 @@ #include <cpu/amd/amdk8_sysconf.h> #include "northbridge/amd/amdk8/acpi.h" #include "mb_sysconf.h" +#include "mainboard.h" -extern const unsigned char AmlCode[]; -#if CONFIG_ACPI_SSDTX_NUM >= 1 extern const unsigned char AmlCode_ssdt2[]; extern const unsigned char AmlCode_ssdt3[]; extern const unsigned char AmlCode_ssdt4[]; -#endif - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} unsigned long acpi_fill_madt(unsigned long current) { @@ -130,24 +122,9 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) +unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp) { unsigned long current; - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_srat_t *srat; - acpi_slit_t *slit; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_header_t *dsdt; - acpi_header_t *ssdt; acpi_header_t *ssdtx; void *p; @@ -159,80 +136,6 @@ unsigned long write_acpi_tables(unsigned long start) start = ALIGN(start, 16); current = start; - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* clear all table memory */ - memset((void *)start, 0, current - start); - - acpi_write_rsdp(rsdp, rsdt, NULL); - acpi_write_rsdt(rsdt); - - /* FACS */ - printk(BIOS_DEBUG, "ACPI: * FACS\n"); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - printk(BIOS_DEBUG, "ACPI: * DSDT at %lx\n", current); - dsdt = (acpi_header_t *)current; - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length); - - /* FADT */ - printk(BIOS_DEBUG, "ACPI: * FADT at %lx\n", current); - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - /* - * We explicitly add these tables later on: - */ - printk(BIOS_DEBUG, "ACPI: * HPET at %lx\n", current); - hpet = (acpi_hpet_t *) current; - current += sizeof(acpi_hpet_t); - 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 at %lx\n", current); - madt = (acpi_madt_t *) current; - acpi_create_madt(madt); - current+=madt->header.length; - acpi_add_table(rsdp, madt); - - /* SRAT */ - printk(BIOS_DEBUG, "ACPI: * SRAT at %lx\n", current); - srat = (acpi_srat_t *) current; - acpi_create_srat(srat); - current+=srat->header.length; - acpi_add_table(rsdp, srat); - - /* SLIT */ - printk(BIOS_DEBUG, "ACPI: * SLIT at %lx\n", current); - slit = (acpi_slit_t *) current; - acpi_create_slit(slit); - current+=slit->header.length; - acpi_add_table(rsdp, slit); - - /* SSDT */ - printk(BIOS_DEBUG, "ACPI: * SSDT at %lx\n", current); - ssdt = (acpi_header_t *)current; - - acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR); - current += ssdt->length; - acpi_add_table(rsdp, ssdt); - #if CONFIG_ACPI_SSDTX_NUM >= 1 //same htio, but different position? We may have to copy, change HCIN, and recalculate the checknum and add_table @@ -272,6 +175,5 @@ unsigned long write_acpi_tables(unsigned long start) } #endif - printk(BIOS_INFO, "ACPI: done.\n"); return current; } diff --git a/src/mainboard/amd/serengeti_cheetah/mainboard.c b/src/mainboard/amd/serengeti_cheetah/mainboard.c new file mode 100644 index 0000000..b9c88f6 --- /dev/null +++ b/src/mainboard/amd/serengeti_cheetah/mainboard.c @@ -0,0 +1,15 @@ +#include <console/console.h> +#include <device/device.h> +#include <arch/acpi.h> +#include <arch/acpi.h> +#include <arch/acpigen.h> +#include "mainboard.h" + +static void mainboard_enable(device_t dev) +{ + dev->ops->write_acpi_tables = mainboard_write_acpi_tables; +} + +struct chip_operations mainboard_ops = { + .enable_dev = mainboard_enable, +}; diff --git a/src/mainboard/amd/serengeti_cheetah/mainboard.h b/src/mainboard/amd/serengeti_cheetah/mainboard.h new file mode 100644 index 0000000..80d8f2a --- /dev/null +++ b/src/mainboard/amd/serengeti_cheetah/mainboard.h @@ -0,0 +1 @@ +unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp); diff --git a/src/mainboard/amd/tilapia_fam10/acpi_tables.c b/src/mainboard/amd/tilapia_fam10/acpi_tables.c index 898a955..8d7f723 100644 --- a/src/mainboard/amd/tilapia_fam10/acpi_tables.c +++ b/src/mainboard/amd/tilapia_fam10/acpi_tables.c @@ -39,12 +39,6 @@ extern const unsigned char AmlCode_ssdt4[]; extern const unsigned char AmlCode_ssdt5[]; #endif -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { /* create all subtables for processors */ diff --git a/src/mainboard/asrock/939a785gmh/acpi_tables.c b/src/mainboard/asrock/939a785gmh/acpi_tables.c index 52b45f7..2b05888 100644 --- a/src/mainboard/asrock/939a785gmh/acpi_tables.c +++ b/src/mainboard/asrock/939a785gmh/acpi_tables.c @@ -31,31 +31,10 @@ #include <cpu/amd/model_fxx_powernow.h> #include <southbridge/amd/sb700/sb700.h> -/* -* Assume the max pstate number is 8 -* 0x21(33 bytes) is one package length of _PSS package -*/ - -#define Maxpstate 8 -#define Defpkglength 0x21 - -extern const unsigned char AmlCode[]; - -#if CONFIG_ACPI_SSDTX_NUM >= 1 -extern const unsigned char AmlCode_ssdt2[]; -extern const unsigned char AmlCode_ssdt3[]; -extern const unsigned char AmlCode_ssdt4[]; -extern const unsigned char AmlCode_ssdt5[]; -#endif - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { + get_bus_conf(); + /* create all subtables for processors */ current = acpi_create_madt_lapics(current); @@ -78,137 +57,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(ACPI_CPU_CONTROL, 6, 1); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_header_t *dsdt; - acpi_header_t *ssdt; -#if CONFIG_ACPI_SSDTX_NUM >= 1 - acpi_header_t *ssdtx; - void *p; - int i; -#endif - - get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */ - - /* Align ACPI tables to 16 bytes */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* 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: - */ - /* If we want to use HPET Timers Linux wants an MADT */ - printk(BIOS_DEBUG, "ACPI: * HPET\n"); - hpet = (acpi_hpet_t *) current; - current += sizeof(acpi_hpet_t); - acpi_create_hpet(hpet); - acpi_add_table(rsdp, hpet); - - printk(BIOS_DEBUG, "ACPI: * MADT\n"); - madt = (acpi_madt_t *) current; - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - - /* SSDT */ - 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); - -#if CONFIG_ACPI_SSDTX_NUM >= 1 - - /* same htio, but different position? We may have to copy, change HCIN, and recalculate the checknum and add_table */ - - for (i = 1; i < sysconf.hc_possible_num; i++) { /* 0: is hc sblink */ - if ((sysconf.pci1234[i] & 1) != 1) - continue; - u8 c; - if (i < 7) { - c = (u8) ('4' + i - 1); - } else { - c = (u8) ('A' + i - 1 - 6); - } - printk(BIOS_DEBUG, "ACPI: * SSDT for PCI%c Aka hcid = %d\n", c, sysconf.hcid[i]); /* pci0 and pci1 are in dsdt */ - current = ALIGN(current, 8); - ssdtx = (acpi_header_t *) current; - switch (sysconf.hcid[i]) { - case 1: /* 8132 */ - p = &AmlCode_ssdt2; - break; - case 2: /* 8151 */ - p = &AmlCode_ssdt3; - break; - case 3: /* 8131 */ - p = &AmlCode_ssdt4; - break; - default: - /* HTX no io apic */ - p = &AmlCode_ssdt5; - break; - } - memcpy(ssdtx, p, sizeof(acpi_header_t)); - current += ssdtx->length; - memcpy(ssdtx, p, ssdtx->length); - update_ssdtx((void *)ssdtx, i); - ssdtx->checksum = 0; - ssdtx->checksum = acpi_checksum((u8 *)ssdtx, ssdtx->length); - acpi_add_table(rsdp, ssdtx); - } -#endif - - /* FACS */ - printk(BIOS_DEBUG, "ACPI: * FACS\n"); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - 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); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length); - /* FADT */ - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - - printk(BIOS_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/mainboard/asus/a8n_e/acpi_tables.c b/src/mainboard/asus/a8n_e/acpi_tables.c index ee8e81f..2e06915 100644 --- a/src/mainboard/asus/a8n_e/acpi_tables.c +++ b/src/mainboard/asus/a8n_e/acpi_tables.c @@ -21,30 +21,6 @@ #include "../../../northbridge/amd/amdk8/acpi.h" //#include <cpu/amd/model_fxx_powernow.h> -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - device_t dev; - unsigned long mcfg_base; - - dev = dev_find_slot(0x0, PCI_DEVFN(0x0,0)); - if (!dev) - return current; - - mcfg_base = pci_read_config16(dev, 0x90); - if ((mcfg_base & 0x1000) == 0) - return current; - - mcfg_base = (mcfg_base & 0xf) << 28; - - printk(BIOS_INFO, "mcfg_base %lx.\n", mcfg_base); - - current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *) - current, mcfg_base, 0x0, 0x0, 0xff); - return current; -} - /* APIC */ unsigned long acpi_fill_madt(unsigned long current) { @@ -86,116 +62,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - //amd_model_fxx_generate_powernow(0, 0, 0); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_srat_t *srat; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_mcfg_t *mcfg; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_slit_t *slit; - acpi_header_t *ssdt; - acpi_header_t *dsdt; - - /* Align ACPI tables to 16 byte. */ - start = ALIGN(start, 16); - current = start; - - 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); - - current = ALIGN(current, 16); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* Clear all table memory. */ - memset((void *) start, 0, current - start); - - acpi_write_rsdp(rsdp, rsdt, NULL); - acpi_write_rsdt(rsdt); - - current = ALIGN(current, 64); - facs = (acpi_facs_t *) current; - printk(BIOS_DEBUG, "ACPI: * FACS %p\n", facs); - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - current = ALIGN(current, 16); - dsdt = (acpi_header_t *) current; - printk(BIOS_DEBUG, "ACPI: * DSDT %p\n", dsdt); - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length); - - current = ALIGN(current, 16); - fadt = (acpi_fadt_t *) current; - printk(BIOS_DEBUG, "ACPI: * FACP (FADT) @ %p\n", fadt); - current += sizeof(acpi_fadt_t); - - /* Add FADT now that we have facs and dsdt. */ - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - current = ALIGN(current, 16); - mcfg = (acpi_mcfg_t *) current; - printk(BIOS_DEBUG, "ACPI: * MCFG @ %p\n", mcfg); - acpi_create_mcfg(mcfg); - current += mcfg->header.length; - acpi_add_table(rsdp, mcfg); - - current = ALIGN(current, 16); - hpet = (acpi_hpet_t *) current; - printk(BIOS_DEBUG, "ACPI: * HPET @ %p\n", hpet); - acpi_create_hpet(hpet); - acpi_add_table(rsdp, hpet); - current += hpet->header.length; - - current = ALIGN(current, 16); - madt = (acpi_madt_t *) current; - printk(BIOS_DEBUG, "ACPI: * APIC/MADT @ %p\n", madt); - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - - current = ALIGN(current, 16); - srat = (acpi_srat_t *) current; - printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat); - acpi_create_srat(srat); - current += srat->header.length; - acpi_add_table(rsdp, srat); - - /* SLIT */ - current = ALIGN(current, 16); - slit = (acpi_slit_t *) current; - printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit); - acpi_create_slit(slit); - current+=slit->header.length; - acpi_add_table(rsdp,slit); - - /* SSDT */ - current = ALIGN(current, 16); - ssdt = (acpi_header_t *)current; - printk(BIOS_DEBUG, "ACPI: * SSDT @ %p\n", ssdt); - acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR); - current += ssdt->length; - acpi_add_table(rsdp, ssdt); - - printk(BIOS_INFO, "ACPI: done %p.\n", (void *)current); - return current; -} diff --git a/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c b/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c index 30914e4..b86e4d2 100644 --- a/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c +++ b/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c @@ -31,24 +31,11 @@ #include <device/pci_ids.h> #include "southbridge/via/vt8237r/vt8237r.h" #include "southbridge/via/k8t890/k8t890.h" +#include <cpu/amd/amdk8_sysconf.h> -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) +void get_bus_conf(void) { - device_t dev; - struct resource *res; - - dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8T890CE_5, 0); - if (!dev) - return current; - - res = find_resource(dev, K8T890_MMCONFIG_MBAR); - if (res) { - current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *) - current, res->base, 0x0, 0x0, 0xff); - } - return current; + /* FIXME: implement this. */ } unsigned long acpi_fill_madt(unsigned long current) @@ -80,77 +67,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_srat_t *srat; - acpi_rsdt_t *rsdt; - acpi_madt_t *madt; - acpi_mcfg_t *mcfg; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_header_t *dsdt; - - /* Align ACPI tables to 16 byte. */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* 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: * FACS\n"); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - dsdt = (acpi_header_t *)current; - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - dsdt->checksum = 0; /* Don't trust iasl to get this right. */ - dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, - dsdt->length); - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - /* If we want to use HPET timers Linux wants it in MADT. */ - printk(BIOS_DEBUG, "ACPI: * MADT\n"); - madt = (acpi_madt_t *) current; - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - printk(BIOS_DEBUG, "ACPI: * MCFG\n"); - mcfg = (acpi_mcfg_t *) current; - acpi_create_mcfg(mcfg); - current += mcfg->header.length; - acpi_add_table(rsdp, mcfg); - - printk(BIOS_DEBUG, "ACPI: * SRAT\n"); - srat = (acpi_srat_t *) current; - acpi_create_srat(srat); - current += srat->header.length; - acpi_add_table(rsdp, srat); - - printk(BIOS_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/mainboard/asus/a8v-e_deluxe/dsdt.asl b/src/mainboard/asus/a8v-e_deluxe/dsdt.asl index 3afcdc3..8f1e197 100644 --- a/src/mainboard/asus/a8v-e_deluxe/dsdt.asl +++ b/src/mainboard/asus/a8v-e_deluxe/dsdt.asl @@ -24,13 +24,6 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, "CORE ", "COREBOOT", 1) { - /* Define the main processor.*/ - Scope (\_PR) - { - Processor (\_PR.CPU0, 0x00, 0x000000, 0x00) {} - Processor (\_PR.CPU1, 0x01, 0x000000, 0x00) {} - } - /* For now only define 2 power states: * - S0 which is fully on * - S5 which is soft off diff --git a/src/mainboard/asus/a8v-e_se/acpi_tables.c b/src/mainboard/asus/a8v-e_se/acpi_tables.c index f5f081a..2c76878 100644 --- a/src/mainboard/asus/a8v-e_se/acpi_tables.c +++ b/src/mainboard/asus/a8v-e_se/acpi_tables.c @@ -33,24 +33,11 @@ #include "southbridge/via/k8t890/k8t890.h" #include "northbridge/amd/amdk8/acpi.h" #include <cpu/amd/model_fxx_powernow.h> +#include <cpu/amd/amdk8_sysconf.h> -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) +void get_bus_conf(void) { - device_t dev; - struct resource *res; - - dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8T890CE_5, 0); - if (!dev) - return current; - - res = find_resource(dev, K8T890_MMCONFIG_MBAR); - if (res) { - current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *) - current, res->base, 0x0, 0x0, 0xff); - } - return current; + /* FIXME: implement this. */ } unsigned long acpi_fill_madt(unsigned long current) @@ -82,94 +69,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) -{ - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(0, 0, 0); - acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS"); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_srat_t *srat; - acpi_rsdt_t *rsdt; - acpi_madt_t *madt; - acpi_mcfg_t *mcfg; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_header_t *ssdt; - acpi_header_t *dsdt; - - /* Align ACPI tables to 16 byte. */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* 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: * FACS\n"); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - dsdt = (acpi_header_t *)current; - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - dsdt->checksum = 0; /* Don't trust iasl to get this right. */ - dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, - dsdt->length); - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - /* If we want to use HPET timers Linux wants it in MADT. */ - printk(BIOS_DEBUG, "ACPI: * MADT\n"); - madt = (acpi_madt_t *) current; - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - printk(BIOS_DEBUG, "ACPI: * MCFG\n"); - mcfg = (acpi_mcfg_t *) current; - acpi_create_mcfg(mcfg); - current += mcfg->header.length; - acpi_add_table(rsdp, mcfg); - - printk(BIOS_DEBUG, "ACPI: * SRAT\n"); - srat = (acpi_srat_t *) current; - acpi_create_srat(srat); - current += srat->header.length; - acpi_add_table(rsdp, srat); - - /* SSDT */ - 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_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/mainboard/asus/k8v-x/acpi_tables.c b/src/mainboard/asus/k8v-x/acpi_tables.c index 065db1a..5273c00 100644 --- a/src/mainboard/asus/k8v-x/acpi_tables.c +++ b/src/mainboard/asus/k8v-x/acpi_tables.c @@ -33,24 +33,11 @@ #include "southbridge/via/k8t890/k8x8xx.h" #include "northbridge/amd/amdk8/acpi.h" #include <cpu/amd/model_fxx_powernow.h> +#include <cpu/amd/amdk8_sysconf.h> -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) +void get_bus_conf(void) { - device_t dev; - struct resource *res; - - dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8T890CE_5, 0); - if (!dev) - return current; - - res = find_resource(dev, K8T890_MMCONFIG_MBAR); - if (res) { - current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *) - current, res->base, 0x0, 0x0, 0xff); - } - return current; + /* FIXME: implement this. */ } unsigned long acpi_fill_madt(unsigned long current) @@ -82,94 +69,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) -{ - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(0, 0, 0); - acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS"); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_srat_t *srat; - acpi_rsdt_t *rsdt; - acpi_madt_t *madt; - acpi_mcfg_t *mcfg; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_header_t *ssdt; - acpi_header_t *dsdt; - - /* Align ACPI tables to 16 byte. */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* 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: * FACS\n"); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - dsdt = (acpi_header_t *)current; - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - dsdt->checksum = 0; /* Don't trust iasl to get this right. */ - dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, - dsdt->length); - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - /* If we want to use HPET timers Linux wants it in MADT. */ - printk(BIOS_DEBUG, "ACPI: * MADT\n"); - madt = (acpi_madt_t *) current; - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - printk(BIOS_DEBUG, "ACPI: * MCFG\n"); - mcfg = (acpi_mcfg_t *) current; - acpi_create_mcfg(mcfg); - current += mcfg->header.length; - acpi_add_table(rsdp, mcfg); - - printk(BIOS_DEBUG, "ACPI: * SRAT\n"); - srat = (acpi_srat_t *) current; - acpi_create_srat(srat); - current += srat->header.length; - acpi_add_table(rsdp, srat); - - /* SSDT */ - 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_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/mainboard/asus/m2v-mx_se/acpi_tables.c b/src/mainboard/asus/m2v-mx_se/acpi_tables.c index 91a5da1..faed40b 100644 --- a/src/mainboard/asus/m2v-mx_se/acpi_tables.c +++ b/src/mainboard/asus/m2v-mx_se/acpi_tables.c @@ -34,24 +34,11 @@ #include "southbridge/via/k8t890/k8t890.h" #include "northbridge/amd/amdk8/acpi.h" #include <cpu/amd/model_fxx_powernow.h> +#include <cpu/amd/amdk8_sysconf.h> -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) +void get_bus_conf(void) { - device_t dev; - struct resource *res; - - dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8M890CE_5, 0); - if (!dev) - return current; - - res = find_resource(dev, K8T890_MMCONFIG_MBAR); - if (res) { - current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *) - current, res->base, 0x0, 0x0, 0xff); - } - return current; + /* FIXME: implement this. */ } unsigned long acpi_fill_madt(unsigned long current) @@ -83,114 +70,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) -{ - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(0, 0, 0); - acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS"); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_srat_t *srat; - acpi_rsdt_t *rsdt; - acpi_mcfg_t *mcfg; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_slit_t *slit; - acpi_header_t *ssdt; - acpi_header_t *dsdt; - - /* Align ACPI tables to 16 byte. */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* 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: * FACS\n"); - - /* we should align FACS to 64B as per ACPI specs */ - - current = ALIGN(current, 64); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - dsdt = (acpi_header_t *) current; - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - dsdt->checksum = 0; /* Don't trust iasl to get this right. */ - dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, - dsdt->length); - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - printk(BIOS_DEBUG, "ACPI: * HPET\n"); - hpet = (acpi_hpet_t *) current; - current += sizeof(acpi_hpet_t); - 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; - acpi_add_table(rsdp, madt); - - printk(BIOS_DEBUG, "ACPI: * MCFG\n"); - mcfg = (acpi_mcfg_t *) current; - acpi_create_mcfg(mcfg); - current += mcfg->header.length; - acpi_add_table(rsdp, mcfg); - - printk(BIOS_DEBUG, "ACPI: * SRAT\n"); - srat = (acpi_srat_t *) current; - acpi_create_srat(srat); - current += srat->header.length; - acpi_add_table(rsdp, srat); - - /* SLIT */ - printk(BIOS_DEBUG, "ACPI: * SLIT\n"); - slit = (acpi_slit_t *) current; - acpi_create_slit(slit); - current+=slit->header.length; - acpi_add_table(rsdp,slit); - - /* SSDT */ - 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_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/mainboard/asus/m2v/acpi_tables.c b/src/mainboard/asus/m2v/acpi_tables.c index cc1070e..c0449ec 100644 --- a/src/mainboard/asus/m2v/acpi_tables.c +++ b/src/mainboard/asus/m2v/acpi_tables.c @@ -35,24 +35,11 @@ #include "southbridge/via/k8t890/k8t890.h" #include "northbridge/amd/amdk8/acpi.h" #include <cpu/amd/model_fxx_powernow.h> +#include <cpu/amd/amdk8_sysconf.h> -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) +void get_bus_conf(void) { - device_t dev; - struct resource *res; - - dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8T890CF_5, 0); - if (!dev) - return current; - - res = find_resource(dev, K8T890_MMCONFIG_MBAR); - if (res) { - current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *) - current, res->base, 0x0, 0x0, 0xff); - } - return current; + /* FIXME: implement this. */ } unsigned long acpi_fill_madt(unsigned long current) @@ -84,115 +71,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) -{ - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(0, 0, 0); - acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS"); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_srat_t *srat; - acpi_rsdt_t *rsdt; - acpi_mcfg_t *mcfg; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_slit_t *slit; - acpi_header_t *ssdt; - acpi_header_t *dsdt; - - /* Align ACPI tables to 16 byte. */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* 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: * FACS\n"); - - /* we should align FACS to 64B as per ACPI specs */ - - current = ALIGN(current, 64); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - dsdt = (acpi_header_t *) current; - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - dsdt->checksum = 0; /* Don't trust iasl to get this right. */ - dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, - dsdt->length); - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - printk(BIOS_DEBUG, "ACPI: * HPET\n"); - hpet = (acpi_hpet_t *) current; - current += sizeof(acpi_hpet_t); - 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; - acpi_add_table(rsdp, madt); - - printk(BIOS_DEBUG, "ACPI: * MCFG\n"); - mcfg = (acpi_mcfg_t *) current; - acpi_create_mcfg(mcfg); - current += mcfg->header.length; - acpi_add_table(rsdp, mcfg); - - printk(BIOS_DEBUG, "ACPI: * SRAT\n"); - srat = (acpi_srat_t *) current; - acpi_create_srat(srat); - current += srat->header.length; - acpi_add_table(rsdp, srat); - - /* SLIT */ - printk(BIOS_DEBUG, "ACPI: * SLIT\n"); - slit = (acpi_slit_t *) current; - acpi_create_slit(slit); - current+=slit->header.length; - acpi_add_table(rsdp,slit); - - /* SSDT */ - 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_INFO, "ACPI: done.\n"); - - return current; -} diff --git a/src/mainboard/asus/m4a78-em/acpi_tables.c b/src/mainboard/asus/m4a78-em/acpi_tables.c index 2398c01..a132b7b 100644 --- a/src/mainboard/asus/m4a78-em/acpi_tables.c +++ b/src/mainboard/asus/m4a78-em/acpi_tables.c @@ -38,12 +38,6 @@ extern const unsigned char AmlCode_ssdt4[]; extern const unsigned char AmlCode_ssdt5[]; #endif -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { /* create all subtables for processors */ diff --git a/src/mainboard/asus/m4a785-m/acpi_tables.c b/src/mainboard/asus/m4a785-m/acpi_tables.c index a8b6365..1c0afeb 100644 --- a/src/mainboard/asus/m4a785-m/acpi_tables.c +++ b/src/mainboard/asus/m4a785-m/acpi_tables.c @@ -60,14 +60,6 @@ unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_ta return (unsigned long) (acpigen_get_current()); } - - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { /* create all subtables for processors */ diff --git a/src/mainboard/gigabyte/m57sli/acpi_tables.c b/src/mainboard/gigabyte/m57sli/acpi_tables.c index 2e2e590..c9fc33b 100644 --- a/src/mainboard/gigabyte/m57sli/acpi_tables.c +++ b/src/mainboard/gigabyte/m57sli/acpi_tables.c @@ -34,14 +34,6 @@ #include <device/pci.h> #include <cpu/amd/amdk8_sysconf.h> -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Not implemented */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { unsigned int gsi_base = 0x18; @@ -92,112 +84,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) -{ - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(0, 0, 0); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_srat_t *srat; - acpi_rsdt_t *rsdt; - acpi_mcfg_t *mcfg; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_slit_t *slit; - acpi_header_t *ssdt; - acpi_header_t *dsdt; - - /* Align ACPI tables to 16 byte. */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* 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: * FACS\n"); - - /* we should align FACS to 64B as per ACPI specs */ - current = ALIGN(current, 64); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - dsdt = (acpi_header_t *) current; - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - dsdt->checksum = 0; /* Don't trust iasl to get this right. */ - dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, - dsdt->length); - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - printk(BIOS_DEBUG, "ACPI: * HPET\n"); - hpet = (acpi_hpet_t *) current; - current += sizeof(acpi_hpet_t); - 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; - acpi_add_table(rsdp, madt); - - printk(BIOS_DEBUG, "ACPI: * MCFG\n"); - mcfg = (acpi_mcfg_t *) current; - acpi_create_mcfg(mcfg); - current += mcfg->header.length; - acpi_add_table(rsdp, mcfg); - - printk(BIOS_DEBUG, "ACPI: * SRAT\n"); - srat = (acpi_srat_t *) current; - acpi_create_srat(srat); - current += srat->header.length; - acpi_add_table(rsdp, srat); - - /* SLIT */ - printk(BIOS_DEBUG, "ACPI: * SLIT\n"); - slit = (acpi_slit_t *) current; - acpi_create_slit(slit); - current+=slit->header.length; - acpi_add_table(rsdp, slit); - - /* SSDT */ - 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_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/mainboard/gigabyte/ma785gm/acpi_tables.c b/src/mainboard/gigabyte/ma785gm/acpi_tables.c index 7a5df88..e961b6e 100644 --- a/src/mainboard/gigabyte/ma785gm/acpi_tables.c +++ b/src/mainboard/gigabyte/ma785gm/acpi_tables.c @@ -39,12 +39,6 @@ extern const unsigned char AmlCode_ssdt4[]; extern const unsigned char AmlCode_ssdt5[]; #endif -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { /* create all subtables for processors */ diff --git a/src/mainboard/gigabyte/ma785gmt/acpi_tables.c b/src/mainboard/gigabyte/ma785gmt/acpi_tables.c index 07b174c..3b776ae 100644 --- a/src/mainboard/gigabyte/ma785gmt/acpi_tables.c +++ b/src/mainboard/gigabyte/ma785gmt/acpi_tables.c @@ -37,12 +37,6 @@ extern const unsigned char AmlCode_ssdt4[]; extern const unsigned char AmlCode_ssdt5[]; #endif -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { /* create all subtables for processors */ diff --git a/src/mainboard/gigabyte/ma78gm/acpi_tables.c b/src/mainboard/gigabyte/ma78gm/acpi_tables.c index 07b174c..3b776ae 100644 --- a/src/mainboard/gigabyte/ma78gm/acpi_tables.c +++ b/src/mainboard/gigabyte/ma78gm/acpi_tables.c @@ -37,12 +37,6 @@ extern const unsigned char AmlCode_ssdt4[]; extern const unsigned char AmlCode_ssdt5[]; #endif -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { /* create all subtables for processors */ diff --git a/src/mainboard/hp/dl145_g1/acpi_tables.c b/src/mainboard/hp/dl145_g1/acpi_tables.c index 8756d1e..34cfff5 100644 --- a/src/mainboard/hp/dl145_g1/acpi_tables.c +++ b/src/mainboard/hp/dl145_g1/acpi_tables.c @@ -23,30 +23,14 @@ #include "mb_sysconf.h" #include <cpu/amd/model_fxx_powernow.h> -extern unsigned pm_base; - -extern const unsigned char AmlCode[]; - -#if CONFIG_ACPI_SSDTX_NUM >= 1 -extern const unsigned char AmlCode_ssdt2[]; -extern const unsigned char AmlCode_ssdt3[]; -extern const unsigned char AmlCode_ssdt4[]; -extern const unsigned char AmlCode_ssdt5[]; -#endif - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - - unsigned long acpi_fill_madt(unsigned long current) { unsigned int gsi_base=0x18; struct mb_sysconf_t *m; + get_bus_conf(); + m = sysconf.mb; /* create all subtables for processors */ @@ -144,156 +128,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); -#if CONFIG_SET_FIDVID - amd_model_fxx_generate_powernow(pm_base + 0x10, 6, 1); - acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS"); -#endif - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_xsdt_t *xsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_srat_t *srat; - acpi_slit_t *slit; - acpi_facs_t *facs; - acpi_header_t *dsdt; - acpi_header_t *ssdt; - - get_bus_conf(); //it will get sblk, pci1234, hcdn, and sbdn - - /* Align ACPI tables to 16byte */ - start = ( start + 0x0f ) & -0x10; - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - xsdt = (acpi_xsdt_t *) current; - current += sizeof(acpi_xsdt_t); - - /* 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); - 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; - acpi_add_table(rsdp,madt); - - - /* SRAT */ - printk(BIOS_DEBUG, "ACPI: * SRAT\n"); - srat = (acpi_srat_t *) current; - acpi_create_srat(srat); - current+=srat->header.length; - acpi_add_table(rsdp,srat); - - /* SLIT */ - printk(BIOS_DEBUG, "ACPI: * SLIT\n"); - slit = (acpi_slit_t *) current; - acpi_create_slit(slit); - current+=slit->header.length; - acpi_add_table(rsdp,slit); - - /* SSDT */ - printk(BIOS_DEBUG, "ACPI: * SSDT\n"); - ssdt = (acpi_header_t *)current; - - acpi_create_ssdt_generator(ssdt, "DYNADATA"); - current += ssdt->length; - acpi_add_table(rsdp, ssdt); - -#if CONFIG_ACPI_SSDTX_NUM >= 1 - int i; - void *p; - acpi_header_t *ssdtx; - //same htio, but different position? We may have to copy, change HCIN, and recalculate the checknum and add_table - - for(i=1;i<sysconf.hc_possible_num;i++) { // 0: is hc sblink - if((sysconf.pci1234[i] & 1) != 1 ) continue; - uint8_t c; - if(i<7) { - c = (uint8_t) ('4' + i - 1); - } - else { - c = (uint8_t) ('A' + i - 1 - 6); - } - printk(BIOS_DEBUG, "ACPI: * SSDT for PCI%c Aka hcid = %d\n", c, sysconf.hcid[i]); //pci0 and pci1 are in dsdt - current = ( current + 0x07) & -0x08; - ssdtx = (acpi_header_t *)current; - switch(sysconf.hcid[i]) { - case 1: //8132 - p = &AmlCode_ssdt2; - break; - case 2: //8151 - p = &AmlCode_ssdt3; - break; - case 3: //8131 - p = &AmlCode_ssdt4; - break; - default: - //HTX no io apic - p = &AmlCode_ssdt5; - break; - } - memcpy(ssdtx, p, sizeof(acpi_header_t)); - current += ssdtx->length; - memcpy(ssdtx, p, ssdtx->length); - update_ssdtx((void *)ssdtx, i); - ssdtx->checksum = 0; - ssdtx->checksum = acpi_checksum((unsigned char *)ssdtx,ssdtx->length); - acpi_add_table(rsdp,ssdtx); - } -#endif - - /* FACS */ - printk(BIOS_DEBUG, "ACPI: * FACS\n"); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - 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); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length); - - /* FADT */ - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - acpi_fadt_t *fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt,facs,dsdt); - acpi_add_table(rsdp,fadt); - - printk(BIOS_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/mainboard/iei/kino-780am2-fam10/acpi_tables.c b/src/mainboard/iei/kino-780am2-fam10/acpi_tables.c index 01172ad..5efb0ee 100644 --- a/src/mainboard/iei/kino-780am2-fam10/acpi_tables.c +++ b/src/mainboard/iei/kino-780am2-fam10/acpi_tables.c @@ -60,12 +60,6 @@ unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_ta return (unsigned long) (acpigen_get_current()); } -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { /* create all subtables for processors */ diff --git a/src/mainboard/iwill/dk8_htx/acpi_tables.c b/src/mainboard/iwill/dk8_htx/acpi_tables.c index 3d180eb..53e79b0 100644 --- a/src/mainboard/iwill/dk8_htx/acpi_tables.c +++ b/src/mainboard/iwill/dk8_htx/acpi_tables.c @@ -19,22 +19,12 @@ #include <cpu/amd/amdk8_sysconf.h> #include "northbridge/amd/amdk8/acpi.h" #include "mb_sysconf.h" +#include "mainboard.h" -extern const unsigned char AmlCode[]; - -#if CONFIG_ACPI_SSDTX_NUM >= 1 extern const unsigned char AmlCode_ssdt2[]; extern const unsigned char AmlCode_ssdt3[]; extern const unsigned char AmlCode_ssdt4[]; extern const unsigned char AmlCode_ssdt5[]; -#endif - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { @@ -42,6 +32,8 @@ unsigned long acpi_fill_madt(unsigned long current) struct mb_sysconf_t *m; + get_bus_conf(); + m = sysconf.mb; /* create all subtables for processors */ @@ -137,24 +129,9 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) +unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp) { unsigned long current; - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_srat_t *srat; - acpi_slit_t *slit; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_header_t *dsdt; - acpi_header_t *ssdt; acpi_header_t *ssdtx; void *p; @@ -166,61 +143,6 @@ unsigned long write_acpi_tables(unsigned long start) start = ALIGN(start, 16); current = start; - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* 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); - 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; - acpi_add_table(rsdp,madt); - - - /* SRAT */ - printk(BIOS_DEBUG, "ACPI: * SRAT\n"); - srat = (acpi_srat_t *) current; - acpi_create_srat(srat); - current+=srat->header.length; - acpi_add_table(rsdp,srat); - - /* SLIT */ - printk(BIOS_DEBUG, "ACPI: * SLIT\n"); - slit = (acpi_slit_t *) current; - acpi_create_slit(slit); - current+=slit->header.length; - acpi_add_table(rsdp,slit); - - /* SSDT */ - 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); - -#if CONFIG_ACPI_SSDTX_NUM >= 1 - //same htio, but different position? We may have to copy, change HCIN, and recalculate the checknum and add_table for(i=1;i<sysconf.hc_possible_num;i++) { // 0: is hc sblink @@ -258,30 +180,6 @@ unsigned long write_acpi_tables(unsigned long start) ssdtx->checksum = acpi_checksum((unsigned char *)ssdtx,ssdtx->length); acpi_add_table(rsdp,ssdtx); } -#endif - - /* FACS */ - printk(BIOS_DEBUG, "ACPI: * FACS\n"); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - 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); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length); - - /* FADT */ - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt,facs,dsdt); - acpi_add_table(rsdp,fadt); - printk(BIOS_INFO, "ACPI: done.\n"); return current; } diff --git a/src/mainboard/iwill/dk8_htx/mainboard.c b/src/mainboard/iwill/dk8_htx/mainboard.c new file mode 100644 index 0000000..fba0b6a --- /dev/null +++ b/src/mainboard/iwill/dk8_htx/mainboard.c @@ -0,0 +1,17 @@ +#include <console/console.h> +#include <device/device.h> +#include <arch/acpi.h> +#include <cpu/amd/model_fxx_powernow.h> +#include <arch/acpi.h> +#include <arch/acpigen.h> +#include <cpu/amd/amdk8_sysconf.h> +#include "mainboard.h" + +static void mainboard_enable(device_t dev) +{ + dev->ops->write_acpi_tables = mainboard_write_acpi_tables; +} + +struct chip_operations mainboard_ops = { + .enable_dev = mainboard_enable, +}; diff --git a/src/mainboard/iwill/dk8_htx/mainboard.h b/src/mainboard/iwill/dk8_htx/mainboard.h new file mode 100644 index 0000000..80d8f2a --- /dev/null +++ b/src/mainboard/iwill/dk8_htx/mainboard.h @@ -0,0 +1 @@ +unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp); diff --git a/src/mainboard/jetway/pa78vm5/acpi_tables.c b/src/mainboard/jetway/pa78vm5/acpi_tables.c index fc6f186..eac5619 100644 --- a/src/mainboard/jetway/pa78vm5/acpi_tables.c +++ b/src/mainboard/jetway/pa78vm5/acpi_tables.c @@ -38,12 +38,6 @@ extern const unsigned char AmlCode_ssdt4[]; extern const unsigned char AmlCode_ssdt5[]; #endif -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { /* create all subtables for processors */ diff --git a/src/mainboard/kontron/kt690/acpi_tables.c b/src/mainboard/kontron/kt690/acpi_tables.c index 520dc6c..0a9c2e8 100644 --- a/src/mainboard/kontron/kt690/acpi_tables.c +++ b/src/mainboard/kontron/kt690/acpi_tables.c @@ -30,26 +30,10 @@ #include <arch/cpu.h> #include <cpu/amd/model_fxx_powernow.h> -extern u16 pm_base; - -/* -* Assume the max pstate number is 8 -* 0x21(33 bytes) is one package length of _PSS package -*/ - -#define Maxpstate 8 -#define Defpkglength 0x21 - -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { + get_bus_conf(); + /* create all subtables for processors */ current = acpi_create_madt_lapics(current); @@ -72,90 +56,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(pm_base + 8, 6, 1); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_header_t *dsdt; - acpi_header_t *ssdt; - - get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */ - - /* Align ACPI tables to 16byte */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* 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: - */ - /* If we want to use HPET Timers Linux wants an MADT */ - printk(BIOS_DEBUG, "ACPI: * HPET\n"); - hpet = (acpi_hpet_t *) current; - current += sizeof(acpi_hpet_t); - acpi_create_hpet(hpet); - acpi_add_table(rsdp, hpet); - - printk(BIOS_DEBUG, "ACPI: * MADT\n"); - madt = (acpi_madt_t *) current; - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - - /* SSDT */ - 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); - - /* FACS */ - printk(BIOS_DEBUG, "ACPI: * FACS\n"); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - 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); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length); - /* FADT */ - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - printk(BIOS_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/mainboard/msi/ms7135/acpi_tables.c b/src/mainboard/msi/ms7135/acpi_tables.c index ee8e81f..f5ddec3 100644 --- a/src/mainboard/msi/ms7135/acpi_tables.c +++ b/src/mainboard/msi/ms7135/acpi_tables.c @@ -19,31 +19,6 @@ #include <cpu/amd/mtrr.h> #include <cpu/amd/amdk8_sysconf.h> #include "../../../northbridge/amd/amdk8/acpi.h" -//#include <cpu/amd/model_fxx_powernow.h> - -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - device_t dev; - unsigned long mcfg_base; - - dev = dev_find_slot(0x0, PCI_DEVFN(0x0,0)); - if (!dev) - return current; - - mcfg_base = pci_read_config16(dev, 0x90); - if ((mcfg_base & 0x1000) == 0) - return current; - - mcfg_base = (mcfg_base & 0xf) << 28; - - printk(BIOS_INFO, "mcfg_base %lx.\n", mcfg_base); - - current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *) - current, mcfg_base, 0x0, 0x0, 0xff); - return current; -} /* APIC */ unsigned long acpi_fill_madt(unsigned long current) @@ -86,116 +61,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - //amd_model_fxx_generate_powernow(0, 0, 0); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_srat_t *srat; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_mcfg_t *mcfg; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_slit_t *slit; - acpi_header_t *ssdt; - acpi_header_t *dsdt; - - /* Align ACPI tables to 16 byte. */ - start = ALIGN(start, 16); - current = start; - - 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); - - current = ALIGN(current, 16); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* Clear all table memory. */ - memset((void *) start, 0, current - start); - - acpi_write_rsdp(rsdp, rsdt, NULL); - acpi_write_rsdt(rsdt); - - current = ALIGN(current, 64); - facs = (acpi_facs_t *) current; - printk(BIOS_DEBUG, "ACPI: * FACS %p\n", facs); - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - current = ALIGN(current, 16); - dsdt = (acpi_header_t *) current; - printk(BIOS_DEBUG, "ACPI: * DSDT %p\n", dsdt); - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length); - - current = ALIGN(current, 16); - fadt = (acpi_fadt_t *) current; - printk(BIOS_DEBUG, "ACPI: * FACP (FADT) @ %p\n", fadt); - current += sizeof(acpi_fadt_t); - - /* Add FADT now that we have facs and dsdt. */ - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - current = ALIGN(current, 16); - mcfg = (acpi_mcfg_t *) current; - printk(BIOS_DEBUG, "ACPI: * MCFG @ %p\n", mcfg); - acpi_create_mcfg(mcfg); - current += mcfg->header.length; - acpi_add_table(rsdp, mcfg); - - current = ALIGN(current, 16); - hpet = (acpi_hpet_t *) current; - printk(BIOS_DEBUG, "ACPI: * HPET @ %p\n", hpet); - acpi_create_hpet(hpet); - acpi_add_table(rsdp, hpet); - current += hpet->header.length; - - current = ALIGN(current, 16); - madt = (acpi_madt_t *) current; - printk(BIOS_DEBUG, "ACPI: * APIC/MADT @ %p\n", madt); - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - - current = ALIGN(current, 16); - srat = (acpi_srat_t *) current; - printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat); - acpi_create_srat(srat); - current += srat->header.length; - acpi_add_table(rsdp, srat); - - /* SLIT */ - current = ALIGN(current, 16); - slit = (acpi_slit_t *) current; - printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit); - acpi_create_slit(slit); - current+=slit->header.length; - acpi_add_table(rsdp,slit); - - /* SSDT */ - current = ALIGN(current, 16); - ssdt = (acpi_header_t *)current; - printk(BIOS_DEBUG, "ACPI: * SSDT @ %p\n", ssdt); - acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR); - current += ssdt->length; - acpi_add_table(rsdp, ssdt); - - printk(BIOS_INFO, "ACPI: done %p.\n", (void *)current); - return current; -} diff --git a/src/mainboard/msi/ms9652_fam10/acpi_tables.c b/src/mainboard/msi/ms9652_fam10/acpi_tables.c index b1df30d..541c903 100644 --- a/src/mainboard/msi/ms9652_fam10/acpi_tables.c +++ b/src/mainboard/msi/ms9652_fam10/acpi_tables.c @@ -37,12 +37,6 @@ extern const unsigned char AmlCode[]; -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Not implemented */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { unsigned int gsi_base = 0x18; diff --git a/src/mainboard/siemens/sitemp_g1p1/acpi_tables.c b/src/mainboard/siemens/sitemp_g1p1/acpi_tables.c index 18e1bf9..d092308 100644 --- a/src/mainboard/siemens/sitemp_g1p1/acpi_tables.c +++ b/src/mainboard/siemens/sitemp_g1p1/acpi_tables.c @@ -33,16 +33,9 @@ #include <arch/cpu.h> #include <cpu/amd/model_fxx_powernow.h> #include <southbridge/amd/rs690/rs690.h> +#include "mainboard.h" +#include <cbmem.h> -extern u16 pm_base; - -/* -* Assume the max pstate number is 8 -* 0x21(33 bytes) is one package length of _PSS package -*/ - -#define Maxpstate 8 -#define Defpkglength 0x21 #define GLOBAL_VARS_SIZE 0x100 typedef struct { @@ -70,24 +63,6 @@ static void acpi_write_gvars(global_vars_t *gvars) gvars->mpen = 1; } -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - struct resource *res; - resource_t mmconf_base = EXT_CONF_BASE_ADDRESS; // default - - device_t dev = dev_find_slot(0,PCI_DEVFN(0,0)); - // we report mmconf base - res = probe_resource(dev, 0x1C); - if( res ) - mmconf_base = res->base; - - current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)current, mmconf_base, 0x0, 0x0, 0x1f); // Fix me: should i reserve 255 busses ? - - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { /* create all subtables for processors */ @@ -116,133 +91,20 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(pm_base + 8, 6, 1); - return (unsigned long) (acpigen_get_current()); -} +unsigned long mainboard_fill_ssdt(unsigned long current, const char *oem_table_id) +{ + global_vars_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, GLOBAL_VARS_SIZE); -#define ALIGN_CURRENT current = (ALIGN(current, 16)) + if (gnvs) { + int scopelen; + acpi_write_gvars(gnvs); -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - int i; - - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_srat_t *srat; - acpi_xsdt_t *xsdt; - acpi_mcfg_t *mcfg; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_header_t *dsdt; - acpi_header_t *ssdt; - - get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */ - - /* Align ACPI tables to 16byte */ - current = start; - 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: - */ - current = ALIGN(current, 64); - /* FACS */ - printk(BIOS_DEBUG, "ACPI: * FACS\n"); - facs = (acpi_facs_t *) current; - acpi_create_facs(facs); - current += sizeof(acpi_facs_t); - - /* HPET */ - printk(BIOS_DEBUG, "ACPI: * HPET\n"); - hpet = (acpi_hpet_t *) current; - acpi_create_hpet(hpet); - current += sizeof(acpi_hpet_t); - 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; - acpi_add_table(rsdp, madt); - - /* MCFG */ - printk(BIOS_DEBUG, "ACPI: * MCFG\n"); - mcfg = (acpi_mcfg_t *) current; - acpi_create_mcfg(mcfg); - current += mcfg->header.length; - acpi_add_table(rsdp, mcfg); - - /* SSDT */ - 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); - - /* DSDT */ - 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); - - /* Pack gvars into the ACPI table area */ - for (i=0; i < dsdt->length; i++) { - if (*(u32*)(((u32)dsdt) + i) == 0xBADEAFFE) { - printk(BIOS_DEBUG, "ACPI: Patching up globals in DSDT at offset 0x%04x -> 0x%08lx\n", i, current); - *(u32*)(((u32)dsdt) + i) = current; - break; - } + /* Add it to SSDT. */ + scopelen = acpigen_write_scope("\\"); + scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs); + acpigen_patch_len(scopelen - 1); } - /* And fill it */ - acpi_write_gvars((global_vars_t *)current); - current += GLOBAL_VARS_SIZE; - /* 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); - - /* FADT */ - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - /* SRAT */ - printk(BIOS_DEBUG, "ACPI: * SRAT\n"); - srat = (acpi_srat_t *) current; - acpi_create_srat(srat); - acpi_add_table(rsdp, srat); - - printk(BIOS_DEBUG, "current = %lx\n", current); - - printk(BIOS_INFO, "ACPI: done.\n"); - return current; + return (unsigned long) (acpigen_get_current()); } + diff --git a/src/mainboard/siemens/sitemp_g1p1/dsdt.asl b/src/mainboard/siemens/sitemp_g1p1/dsdt.asl index 7890df7..e106561 100644 --- a/src/mainboard/siemens/sitemp_g1p1/dsdt.asl +++ b/src/mainboard/siemens/sitemp_g1p1/dsdt.asl @@ -245,7 +245,9 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, "SIEMENS", "SITEMP ", 0x20101005) PWDA, 1, } - OperationRegion (GVAR, SystemMemory, 0xBADEAFFE, 0x100) + External(\NVSA) + + OperationRegion (GVAR, SystemMemory, \NVSA, 0x100) Field (GVAR, ByteAcc, NoLock, Preserve) { Offset (0x00), diff --git a/src/mainboard/siemens/sitemp_g1p1/mainboard.c b/src/mainboard/siemens/sitemp_g1p1/mainboard.c index 960496f..066dfb4 100644 --- a/src/mainboard/siemens/sitemp_g1p1/mainboard.c +++ b/src/mainboard/siemens/sitemp_g1p1/mainboard.c @@ -38,6 +38,7 @@ #include <x86emu/x86emu.h> #endif #include "int15_func.h" +#include "mainboard.h" // ****LCD panel ID support: ***** // Callback Sub-Function 00h - Get LCD Panel ID @@ -846,6 +847,7 @@ static void mainboard_enable(device_t dev) update_subsystemid(dev); dev->ops->init = mainboard_init; // rest of mainboard init later + dev->ops->acpi_fill_ssdt_generator = mainboard_fill_ssdt; } struct chip_operations mainboard_ops = { diff --git a/src/mainboard/siemens/sitemp_g1p1/mainboard.h b/src/mainboard/siemens/sitemp_g1p1/mainboard.h new file mode 100644 index 0000000..fd70365 --- /dev/null +++ b/src/mainboard/siemens/sitemp_g1p1/mainboard.h @@ -0,0 +1 @@ +unsigned long mainboard_fill_ssdt(unsigned long current, const char *oem_table_id); diff --git a/src/mainboard/supermicro/h8scm_fam10/acpi_tables.c b/src/mainboard/supermicro/h8scm_fam10/acpi_tables.c index ae9cca9..48a396e 100644 --- a/src/mainboard/supermicro/h8scm_fam10/acpi_tables.c +++ b/src/mainboard/supermicro/h8scm_fam10/acpi_tables.c @@ -39,12 +39,6 @@ extern const unsigned char AmlCode_ssdt4[]; extern const unsigned char AmlCode_ssdt5[]; #endif -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { device_t dev; diff --git a/src/mainboard/technexion/tim5690/acpi_tables.c b/src/mainboard/technexion/tim5690/acpi_tables.c index 520dc6c..0a9c2e8 100644 --- a/src/mainboard/technexion/tim5690/acpi_tables.c +++ b/src/mainboard/technexion/tim5690/acpi_tables.c @@ -30,26 +30,10 @@ #include <arch/cpu.h> #include <cpu/amd/model_fxx_powernow.h> -extern u16 pm_base; - -/* -* Assume the max pstate number is 8 -* 0x21(33 bytes) is one package length of _PSS package -*/ - -#define Maxpstate 8 -#define Defpkglength 0x21 - -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { + get_bus_conf(); + /* create all subtables for processors */ current = acpi_create_madt_lapics(current); @@ -72,90 +56,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(pm_base + 8, 6, 1); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_header_t *dsdt; - acpi_header_t *ssdt; - - get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */ - - /* Align ACPI tables to 16byte */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* 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: - */ - /* If we want to use HPET Timers Linux wants an MADT */ - printk(BIOS_DEBUG, "ACPI: * HPET\n"); - hpet = (acpi_hpet_t *) current; - current += sizeof(acpi_hpet_t); - acpi_create_hpet(hpet); - acpi_add_table(rsdp, hpet); - - printk(BIOS_DEBUG, "ACPI: * MADT\n"); - madt = (acpi_madt_t *) current; - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - - /* SSDT */ - 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); - - /* FACS */ - printk(BIOS_DEBUG, "ACPI: * FACS\n"); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - 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); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length); - /* FADT */ - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - printk(BIOS_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/mainboard/technexion/tim8690/acpi_tables.c b/src/mainboard/technexion/tim8690/acpi_tables.c index 520dc6c..0a9c2e8 100644 --- a/src/mainboard/technexion/tim8690/acpi_tables.c +++ b/src/mainboard/technexion/tim8690/acpi_tables.c @@ -30,26 +30,10 @@ #include <arch/cpu.h> #include <cpu/amd/model_fxx_powernow.h> -extern u16 pm_base; - -/* -* Assume the max pstate number is 8 -* 0x21(33 bytes) is one package length of _PSS package -*/ - -#define Maxpstate 8 -#define Defpkglength 0x21 - -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { + get_bus_conf(); + /* create all subtables for processors */ current = acpi_create_madt_lapics(current); @@ -72,90 +56,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(pm_base + 8, 6, 1); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_header_t *dsdt; - acpi_header_t *ssdt; - - get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */ - - /* Align ACPI tables to 16byte */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* 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: - */ - /* If we want to use HPET Timers Linux wants an MADT */ - printk(BIOS_DEBUG, "ACPI: * HPET\n"); - hpet = (acpi_hpet_t *) current; - current += sizeof(acpi_hpet_t); - acpi_create_hpet(hpet); - acpi_add_table(rsdp, hpet); - - printk(BIOS_DEBUG, "ACPI: * MADT\n"); - madt = (acpi_madt_t *) current; - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - - /* SSDT */ - 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); - - /* FACS */ - printk(BIOS_DEBUG, "ACPI: * FACS\n"); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - 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); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, dsdt->length); - /* FADT */ - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - printk(BIOS_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/mainboard/tyan/s2891/acpi_tables.c b/src/mainboard/tyan/s2891/acpi_tables.c index 42d9152..8138b83 100644 --- a/src/mainboard/tyan/s2891/acpi_tables.c +++ b/src/mainboard/tyan/s2891/acpi_tables.c @@ -20,13 +20,6 @@ #include "northbridge/amd/amdk8/acpi.h" #include <cpu/amd/model_fxx_powernow.h> -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - return current; -} - /* APIC */ unsigned long acpi_fill_madt(unsigned long current) { @@ -34,6 +27,8 @@ unsigned long acpi_fill_madt(unsigned long current) device_t dev; struct resource *res; + get_bus_conf(); + /* create all subtables for processors */ current = acpi_create_madt_lapics(current); @@ -83,108 +78,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(0, 0, 0); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_srat_t *srat; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_slit_t *slit; - acpi_header_t *ssdt; - acpi_header_t *dsdt; - - /* Align ACPI tables to 16 byte. */ - start = ALIGN(start, 16); - current = start; - - 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); - - current = ALIGN(current, 16); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* Clear all table memory. */ - memset((void *) start, 0, current - start); - - acpi_write_rsdp(rsdp, rsdt, NULL); - acpi_write_rsdt(rsdt); - - current = ALIGN(current, 64); - facs = (acpi_facs_t *) current; - printk(BIOS_DEBUG, "ACPI: * FACS %p\n", facs); - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - current = ALIGN(current, 16); - dsdt = (acpi_header_t *) current; - printk(BIOS_DEBUG, "ACPI: * DSDT %p\n", dsdt); - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length); - - current = ALIGN(current, 16); - fadt = (acpi_fadt_t *) current; - printk(BIOS_DEBUG, "ACPI: * FACP (FADT) @ %p\n", fadt); - current += sizeof(acpi_fadt_t); - - /* Add FADT now that we have facs and dsdt. */ - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - current = ALIGN(current, 16); - hpet = (acpi_hpet_t *) current; - printk(BIOS_DEBUG, "ACPI: * HPET @ %p\n", hpet); - current += sizeof(acpi_hpet_t); - acpi_create_hpet(hpet); - acpi_add_table(rsdp, hpet); - - current = ALIGN(current, 16); - madt = (acpi_madt_t *) current; - printk(BIOS_DEBUG, "ACPI: * APIC/MADT @ %p\n", madt); - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - - current = ALIGN(current, 16); - srat = (acpi_srat_t *) current; - printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat); - acpi_create_srat(srat); - current += srat->header.length; - acpi_add_table(rsdp, srat); - - /* SLIT */ - current = ALIGN(current, 16); - slit = (acpi_slit_t *) current; - printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit); - acpi_create_slit(slit); - current+=slit->header.length; - acpi_add_table(rsdp,slit); - - /* SSDT */ - current = ALIGN(current, 16); - ssdt = (acpi_header_t *)current; - printk(BIOS_DEBUG, "ACPI: * SSDT @ %p\n", ssdt); - acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR); - current += ssdt->length; - acpi_add_table(rsdp, ssdt); - - printk(BIOS_INFO, "ACPI: done %p.\n", (void *)current); - return current; -} diff --git a/src/mainboard/tyan/s2891/mainboard.c b/src/mainboard/tyan/s2891/mainboard.c new file mode 100644 index 0000000..204268c --- /dev/null +++ b/src/mainboard/tyan/s2891/mainboard.c @@ -0,0 +1,23 @@ +#include <console/console.h> +#include <device/device.h> +#include <arch/acpi.h> +#include <cpu/amd/model_fxx_powernow.h> +#include <arch/acpi.h> +#include <arch/acpigen.h> +#include <cpu/amd/amdk8_sysconf.h> + +extern u16 pm_base; + +static unsigned long mainboard_acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { + amd_model_fxx_generate_powernow(0, 0, 0); + return (unsigned long) (acpigen_get_current()); +} + +static void mainboard_enable(device_t dev) +{ + dev->ops->acpi_fill_ssdt_generator = mainboard_acpi_fill_ssdt_generator; +} + +struct chip_operations mainboard_ops = { + .enable_dev = mainboard_enable, +}; diff --git a/src/mainboard/tyan/s2892/acpi_tables.c b/src/mainboard/tyan/s2892/acpi_tables.c index 42d9152..8138b83 100644 --- a/src/mainboard/tyan/s2892/acpi_tables.c +++ b/src/mainboard/tyan/s2892/acpi_tables.c @@ -20,13 +20,6 @@ #include "northbridge/amd/amdk8/acpi.h" #include <cpu/amd/model_fxx_powernow.h> -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - return current; -} - /* APIC */ unsigned long acpi_fill_madt(unsigned long current) { @@ -34,6 +27,8 @@ unsigned long acpi_fill_madt(unsigned long current) device_t dev; struct resource *res; + get_bus_conf(); + /* create all subtables for processors */ current = acpi_create_madt_lapics(current); @@ -83,108 +78,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(0, 0, 0); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_srat_t *srat; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_slit_t *slit; - acpi_header_t *ssdt; - acpi_header_t *dsdt; - - /* Align ACPI tables to 16 byte. */ - start = ALIGN(start, 16); - current = start; - - 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); - - current = ALIGN(current, 16); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* Clear all table memory. */ - memset((void *) start, 0, current - start); - - acpi_write_rsdp(rsdp, rsdt, NULL); - acpi_write_rsdt(rsdt); - - current = ALIGN(current, 64); - facs = (acpi_facs_t *) current; - printk(BIOS_DEBUG, "ACPI: * FACS %p\n", facs); - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - current = ALIGN(current, 16); - dsdt = (acpi_header_t *) current; - printk(BIOS_DEBUG, "ACPI: * DSDT %p\n", dsdt); - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length); - - current = ALIGN(current, 16); - fadt = (acpi_fadt_t *) current; - printk(BIOS_DEBUG, "ACPI: * FACP (FADT) @ %p\n", fadt); - current += sizeof(acpi_fadt_t); - - /* Add FADT now that we have facs and dsdt. */ - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - current = ALIGN(current, 16); - hpet = (acpi_hpet_t *) current; - printk(BIOS_DEBUG, "ACPI: * HPET @ %p\n", hpet); - current += sizeof(acpi_hpet_t); - acpi_create_hpet(hpet); - acpi_add_table(rsdp, hpet); - - current = ALIGN(current, 16); - madt = (acpi_madt_t *) current; - printk(BIOS_DEBUG, "ACPI: * APIC/MADT @ %p\n", madt); - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - - current = ALIGN(current, 16); - srat = (acpi_srat_t *) current; - printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat); - acpi_create_srat(srat); - current += srat->header.length; - acpi_add_table(rsdp, srat); - - /* SLIT */ - current = ALIGN(current, 16); - slit = (acpi_slit_t *) current; - printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit); - acpi_create_slit(slit); - current+=slit->header.length; - acpi_add_table(rsdp,slit); - - /* SSDT */ - current = ALIGN(current, 16); - ssdt = (acpi_header_t *)current; - printk(BIOS_DEBUG, "ACPI: * SSDT @ %p\n", ssdt); - acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR); - current += ssdt->length; - acpi_add_table(rsdp, ssdt); - - printk(BIOS_INFO, "ACPI: done %p.\n", (void *)current); - return current; -} diff --git a/src/mainboard/tyan/s2892/mainboard.c b/src/mainboard/tyan/s2892/mainboard.c new file mode 100644 index 0000000..204268c --- /dev/null +++ b/src/mainboard/tyan/s2892/mainboard.c @@ -0,0 +1,23 @@ +#include <console/console.h> +#include <device/device.h> +#include <arch/acpi.h> +#include <cpu/amd/model_fxx_powernow.h> +#include <arch/acpi.h> +#include <arch/acpigen.h> +#include <cpu/amd/amdk8_sysconf.h> + +extern u16 pm_base; + +static unsigned long mainboard_acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { + amd_model_fxx_generate_powernow(0, 0, 0); + return (unsigned long) (acpigen_get_current()); +} + +static void mainboard_enable(device_t dev) +{ + dev->ops->acpi_fill_ssdt_generator = mainboard_acpi_fill_ssdt_generator; +} + +struct chip_operations mainboard_ops = { + .enable_dev = mainboard_enable, +}; diff --git a/src/mainboard/tyan/s2895/acpi_tables.c b/src/mainboard/tyan/s2895/acpi_tables.c index 1974171..9e724dc 100644 --- a/src/mainboard/tyan/s2895/acpi_tables.c +++ b/src/mainboard/tyan/s2895/acpi_tables.c @@ -20,13 +20,6 @@ #include "northbridge/amd/amdk8/acpi.h" #include <cpu/amd/model_fxx_powernow.h> -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - return current; -} - /* APIC */ unsigned long acpi_fill_madt(unsigned long current) { @@ -34,6 +27,8 @@ unsigned long acpi_fill_madt(unsigned long current) device_t dev; struct resource *res; + get_bus_conf(); + /* create all subtables for processors */ current = acpi_create_madt_lapics(current); @@ -102,108 +97,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(0, 0, 0); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_srat_t *srat; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_slit_t *slit; - acpi_header_t *ssdt; - acpi_header_t *dsdt; - - /* Align ACPI tables to 16 byte. */ - start = ALIGN(start, 16); - current = start; - - 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); - - current = ALIGN(current, 16); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* Clear all table memory. */ - memset((void *) start, 0, current - start); - - acpi_write_rsdp(rsdp, rsdt, NULL); - acpi_write_rsdt(rsdt); - - current = ALIGN(current, 64); - facs = (acpi_facs_t *) current; - printk(BIOS_DEBUG, "ACPI: * FACS %p\n", facs); - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - current = ALIGN(current, 16); - dsdt = (acpi_header_t *) current; - printk(BIOS_DEBUG, "ACPI: * DSDT %p\n", dsdt); - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length); - - current = ALIGN(current, 16); - fadt = (acpi_fadt_t *) current; - printk(BIOS_DEBUG, "ACPI: * FACP (FADT) @ %p\n", fadt); - current += sizeof(acpi_fadt_t); - - /* Add FADT now that we have facs and dsdt. */ - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - current = ALIGN(current, 16); - hpet = (acpi_hpet_t *) current; - printk(BIOS_DEBUG, "ACPI: * HPET @ %p\n", hpet); - current += sizeof(acpi_hpet_t); - acpi_create_hpet(hpet); - acpi_add_table(rsdp, hpet); - - current = ALIGN(current, 16); - madt = (acpi_madt_t *) current; - printk(BIOS_DEBUG, "ACPI: * APIC/MADT @ %p\n", madt); - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - - current = ALIGN(current, 16); - srat = (acpi_srat_t *) current; - printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat); - acpi_create_srat(srat); - current += srat->header.length; - acpi_add_table(rsdp, srat); - - /* SLIT */ - current = ALIGN(current, 16); - slit = (acpi_slit_t *) current; - printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit); - acpi_create_slit(slit); - current+=slit->header.length; - acpi_add_table(rsdp,slit); - - /* SSDT */ - current = ALIGN(current, 16); - ssdt = (acpi_header_t *)current; - printk(BIOS_DEBUG, "ACPI: * SSDT @ %p\n", ssdt); - acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR); - current += ssdt->length; - acpi_add_table(rsdp, ssdt); - - printk(BIOS_INFO, "ACPI: done %p.\n", (void *)current); - return current; -} diff --git a/src/mainboard/tyan/s2895/mainboard.c b/src/mainboard/tyan/s2895/mainboard.c new file mode 100644 index 0000000..204268c --- /dev/null +++ b/src/mainboard/tyan/s2895/mainboard.c @@ -0,0 +1,23 @@ +#include <console/console.h> +#include <device/device.h> +#include <arch/acpi.h> +#include <cpu/amd/model_fxx_powernow.h> +#include <arch/acpi.h> +#include <arch/acpigen.h> +#include <cpu/amd/amdk8_sysconf.h> + +extern u16 pm_base; + +static unsigned long mainboard_acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { + amd_model_fxx_generate_powernow(0, 0, 0); + return (unsigned long) (acpigen_get_current()); +} + +static void mainboard_enable(device_t dev) +{ + dev->ops->acpi_fill_ssdt_generator = mainboard_acpi_fill_ssdt_generator; +} + +struct chip_operations mainboard_ops = { + .enable_dev = mainboard_enable, +}; diff --git a/src/mainboard/winent/mb6047/acpi_tables.c b/src/mainboard/winent/mb6047/acpi_tables.c index 1b59fbb..150cc7d 100644 --- a/src/mainboard/winent/mb6047/acpi_tables.c +++ b/src/mainboard/winent/mb6047/acpi_tables.c @@ -20,19 +20,14 @@ #include "northbridge/amd/amdk8/acpi.h" #include <cpu/amd/model_fxx_powernow.h> -extern const unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - return current; -} - /* APIC */ unsigned long acpi_fill_madt(unsigned long current) { device_t dev; struct resource *res; + get_bus_conf(); + /* create all subtables for processors */ current = acpi_create_madt_lapics(current); @@ -67,108 +62,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { - k8acpi_write_vars(); - amd_model_fxx_generate_powernow(0, 0, 0); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_srat_t *srat; - acpi_rsdt_t *rsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_slit_t *slit; - acpi_header_t *ssdt; - acpi_header_t *dsdt; - - /* Align ACPI tables to 16 byte. */ - start = ALIGN(start, 16); - current = start; - - 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); - - current = ALIGN(current, 16); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* Clear all table memory. */ - memset((void *) start, 0, current - start); - - acpi_write_rsdp(rsdp, rsdt, NULL); - acpi_write_rsdt(rsdt); - - current = ALIGN(current, 64); - facs = (acpi_facs_t *) current; - printk(BIOS_DEBUG, "ACPI: * FACS %p\n", facs); - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - /* DSDT */ - current = ALIGN(current, 16); - dsdt = (acpi_header_t *) current; - printk(BIOS_DEBUG, "ACPI: * DSDT %p\n", dsdt); - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length); - - current = ALIGN(current, 16); - fadt = (acpi_fadt_t *) current; - printk(BIOS_DEBUG, "ACPI: * FACP (FADT) @ %p\n", fadt); - current += sizeof(acpi_fadt_t); - - /* Add FADT now that we have facs and dsdt. */ - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - current = ALIGN(current, 16); - hpet = (acpi_hpet_t *) current; - printk(BIOS_DEBUG, "ACPI: * HPET @ %p\n", hpet); - current += sizeof(acpi_hpet_t); - acpi_create_hpet(hpet); - acpi_add_table(rsdp, hpet); - - current = ALIGN(current, 16); - madt = (acpi_madt_t *) current; - printk(BIOS_DEBUG, "ACPI: * APIC/MADT @ %p\n", madt); - acpi_create_madt(madt); - current += madt->header.length; - acpi_add_table(rsdp, madt); - - current = ALIGN(current, 16); - srat = (acpi_srat_t *) current; - printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat); - acpi_create_srat(srat); - current += srat->header.length; - acpi_add_table(rsdp, srat); - - /* SLIT */ - current = ALIGN(current, 16); - slit = (acpi_slit_t *) current; - printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit); - acpi_create_slit(slit); - current+=slit->header.length; - acpi_add_table(rsdp,slit); - - /* SSDT */ - current = ALIGN(current, 16); - ssdt = (acpi_header_t *)current; - printk(BIOS_DEBUG, "ACPI: * SSDT @ %p\n", ssdt); - acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR); - current += ssdt->length; - acpi_add_table(rsdp, ssdt); - - printk(BIOS_INFO, "ACPI: done %p.\n", (void *)current); - return current; -} diff --git a/src/mainboard/winent/mb6047/mainboard.c b/src/mainboard/winent/mb6047/mainboard.c new file mode 100644 index 0000000..204268c --- /dev/null +++ b/src/mainboard/winent/mb6047/mainboard.c @@ -0,0 +1,23 @@ +#include <console/console.h> +#include <device/device.h> +#include <arch/acpi.h> +#include <cpu/amd/model_fxx_powernow.h> +#include <arch/acpi.h> +#include <arch/acpigen.h> +#include <cpu/amd/amdk8_sysconf.h> + +extern u16 pm_base; + +static unsigned long mainboard_acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { + amd_model_fxx_generate_powernow(0, 0, 0); + return (unsigned long) (acpigen_get_current()); +} + +static void mainboard_enable(device_t dev) +{ + dev->ops->acpi_fill_ssdt_generator = mainboard_acpi_fill_ssdt_generator; +} + +struct chip_operations mainboard_ops = { + .enable_dev = mainboard_enable, +}; diff --git a/src/northbridge/amd/amdk8/Kconfig b/src/northbridge/amd/amdk8/Kconfig index 3f8861e..e79b6b2 100644 --- a/src/northbridge/amd/amdk8/Kconfig +++ b/src/northbridge/amd/amdk8/Kconfig @@ -23,6 +23,7 @@ config NORTHBRIDGE_AMD_AMDK8 select HAVE_DEBUG_SMBUS select HAVE_DEBUG_CAR select HYPERTRANSPORT_PLUGIN_SUPPORT + select PER_DEVICE_ACPI_TABLES if NORTHBRIDGE_AMD_AMDK8 config AGP_APERTURE_SIZE diff --git a/src/northbridge/amd/amdk8/acpi.c b/src/northbridge/amd/amdk8/acpi.c index f7134f6..2bbfc4a 100644 --- a/src/northbridge/amd/amdk8/acpi.c +++ b/src/northbridge/amd/amdk8/acpi.c @@ -118,6 +118,8 @@ unsigned long acpi_fill_srat(unsigned long current) { struct acpi_srat_mem_state srat_mem_state; + get_bus_conf(); + /* create all subtables for processors */ current = acpi_create_srat_lapics(current); @@ -141,6 +143,8 @@ unsigned long acpi_fill_slit(unsigned long current) /* fill the first 8 byte with that num */ /* fill the next num*num byte with distance, local is 10, 1 hop mean 20, and 2 hop with 30.... */ + get_bus_conf(); + /* because We has assume that we know the topology of the HT connection, So we can have set if we know the node_num */ static u8 hops_8[] = { 0, 1, 1, 2, 2, 3, 3, 4, 1, 0, 2, 1, 3, 2, 4, 3, @@ -253,7 +257,7 @@ static int k8acpi_write_pci_data(int dlen, const char *name, int offset) { return len + lenp; } -int k8acpi_write_vars(void) +unsigned long k8acpi_write_vars(unsigned long current, const char *oem_table_id) { int lens; msr_t msr; @@ -283,7 +287,7 @@ int k8acpi_write_vars(void) lens += k8acpi_write_HT(); //minus opcode acpigen_patch_len(lens - 1); - return lens; + return (unsigned long) (acpigen_get_current()); } void update_ssdtx(void *ssdtx, int i) diff --git a/src/northbridge/amd/amdk8/acpi.h b/src/northbridge/amd/amdk8/acpi.h index 9d0a73a..0570716 100644 --- a/src/northbridge/amd/amdk8/acpi.h +++ b/src/northbridge/amd/amdk8/acpi.h @@ -21,6 +21,6 @@ #define AMDK8_ACPI_H #include <arch/acpigen.h> -int k8acpi_write_vars(void); +unsigned long k8acpi_write_vars(unsigned long current, const char *oem_table_id); #endif diff --git a/src/northbridge/amd/amdk8/northbridge.c b/src/northbridge/amd/amdk8/northbridge.c index 2c19b3a..bfd2c0f 100644 --- a/src/northbridge/amd/amdk8/northbridge.c +++ b/src/northbridge/amd/amdk8/northbridge.c @@ -16,6 +16,10 @@ #include <string.h> #include <lib.h> #include <cpu/cpu.h> +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) +#include <arch/acpi.h> +#include "acpi.h" +#endif #include <cpu/x86/lapic.h> #include <cpu/amd/mtrr.h> @@ -580,10 +584,42 @@ static void mcf0_control_init(struct device *dev) #endif } +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) +static unsigned long northbridge_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp) +{ + unsigned long current; + acpi_srat_t *srat; + acpi_slit_t *slit; + + current = start; + + current = ALIGN(current, 16); + srat = (acpi_srat_t *) current; + printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat); + acpi_create_srat(srat); + current += srat->header.length; + acpi_add_table(rsdp, srat); + + /* SLIT */ + current = ALIGN(current, 16); + slit = (acpi_slit_t *) current; + printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit); + acpi_create_slit(slit); + current+=slit->header.length; + acpi_add_table(rsdp,slit); + + return current; +} +#endif + static struct device_operations northbridge_operations = { .read_resources = amdk8_read_resources, .set_resources = amdk8_set_resources, .enable_resources = pci_dev_enable_resources, +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) + .acpi_fill_ssdt_generator = k8acpi_write_vars, + .write_acpi_tables = northbridge_write_acpi_tables, +#endif .init = mcf0_control_init, .scan_bus = amdk8_scan_chains, .enable = 0, diff --git a/src/southbridge/amd/amd8111/lpc.c b/src/southbridge/amd/amd8111/lpc.c index e9bd5fc..d9ff9aa 100644 --- a/src/southbridge/amd/amd8111/lpc.c +++ b/src/southbridge/amd/amd8111/lpc.c @@ -11,7 +11,13 @@ #include <pc80/isa-dma.h> #include <cpu/x86/lapic.h> #include <arch/ioapic.h> +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) +#include <arch/acpi.h> +#include <arch/acpigen.h> +#include <cpu/amd/model_fxx_powernow.h> +#endif #include <stdlib.h> +#include <string.h> #include "amd8111.h" #define NMI_OFF 0 @@ -112,6 +118,27 @@ static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device) ((device & 0xffff) << 16) | (vendor & 0xffff)); } +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) + +extern u16 pm_base; + +unsigned long acpi_fill_mcfg(unsigned long current) +{ + /* Just a dummy */ + return current; +} + +static unsigned long southbridge_acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { +#if CONFIG_SET_FIDVID + amd_model_fxx_generate_powernow(pm_base + 0x10, 6, 1); + acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS"); +#endif + return (unsigned long) (acpigen_get_current()); +} + +#endif + + static struct pci_operations lops_pci = { .set_subsystem = lpci_set_subsystem, }; @@ -121,6 +148,10 @@ static struct device_operations lpc_ops = { .set_resources = pci_dev_set_resources, .enable_resources = pci_dev_enable_resources, .init = lpc_init, +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) + .write_acpi_tables = acpi_write_hpet, + .acpi_fill_ssdt_generator = southbridge_acpi_fill_ssdt_generator, +#endif .scan_bus = scan_static_bus, .enable = amd8111_enable, .ops_pci = &lops_pci, diff --git a/src/southbridge/amd/rs690/ht.c b/src/southbridge/amd/rs690/ht.c index 7353f76..33fce0f 100644 --- a/src/southbridge/amd/rs690/ht.c +++ b/src/southbridge/amd/rs690/ht.c @@ -23,6 +23,7 @@ #include <device/pci_ids.h> #include <device/pci_ops.h> #include <lib.h> +#include <arch/acpi.h> #include "rs690.h" static void ht_dev_set_resources(device_t dev) @@ -84,6 +85,23 @@ static void ht_dev_set_resources(device_t dev) pci_dev_set_resources(dev); } +unsigned long acpi_fill_mcfg(unsigned long current) +{ +#if CONFIG_EXT_CONF_SUPPORT + struct resource *res; + resource_t mmconf_base = EXT_CONF_BASE_ADDRESS; // default + + device_t dev = dev_find_slot(0,PCI_DEVFN(0,0)); + // we report mmconf base + res = probe_resource(dev, 0x1C); + if( res ) + mmconf_base = res->base; + + current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)current, mmconf_base, 0x0, 0x0, 0x1f); // Fix me: should i reserve 255 busses ? +#endif + return current; +} + static void ht_dev_read_resources(device_t dev) { #if CONFIG_EXT_CONF_SUPPORT diff --git a/src/southbridge/amd/sb600/lpc.c b/src/southbridge/amd/sb600/lpc.c index 7ef49d1..d83b811 100644 --- a/src/southbridge/amd/sb600/lpc.c +++ b/src/southbridge/amd/sb600/lpc.c @@ -24,9 +24,13 @@ #include <device/pci_ids.h> #include <device/pci_ops.h> #include <pc80/mc146818rtc.h> +#include <arch/acpi.h> +#include <arch/acpigen.h> #include <pc80/isa-dma.h> #include <arch/io.h> #include <arch/ioapic.h> +#include <arch/acpi.h> +#include <cpu/amd/model_fxx_powernow.h> #include "sb600.h" static void lpc_init(device_t dev) @@ -215,6 +219,17 @@ static void sb600_lpc_enable_resources(device_t dev) sb600_lpc_enable_childrens_resources(dev); } +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) + +extern u16 pm_base; + +static unsigned long southbridge_acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { + amd_model_fxx_generate_powernow(pm_base + 8, 6, 1); + return (unsigned long) (acpigen_get_current()); +} + +#endif + static struct pci_operations lops_pci = { .set_subsystem = pci_dev_set_subsystem, }; @@ -223,6 +238,10 @@ static struct device_operations lpc_ops = { .read_resources = sb600_lpc_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = sb600_lpc_enable_resources, +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) + .write_acpi_tables = acpi_write_hpet, + .acpi_fill_ssdt_generator = southbridge_acpi_fill_ssdt_generator, +#endif .init = lpc_init, .scan_bus = scan_static_bus, /* .enable = sb600_enable, */ diff --git a/src/southbridge/amd/sb700/lpc.c b/src/southbridge/amd/sb700/lpc.c index a175210..647006f 100644 --- a/src/southbridge/amd/sb700/lpc.c +++ b/src/southbridge/amd/sb700/lpc.c @@ -24,12 +24,22 @@ #include <device/pci_ids.h> #include <device/pci_ops.h> #include <pc80/mc146818rtc.h> +#include <arch/acpi.h> +#include <arch/acpigen.h> #include <pc80/isa-dma.h> #include <arch/io.h> #include <arch/ioapic.h> +#include <arch/acpi.h> #include <cbmem.h> +#include <cpu/amd/model_fxx_powernow.h> #include "sb700.h" +unsigned long acpi_fill_mcfg(unsigned long current) +{ + /* Just a dummy */ + return current; +} + static void lpc_init(device_t dev) { u8 byte; @@ -74,7 +84,6 @@ static void lpc_init(device_t dev) is doing the acpi init */ #if CONFIG_HAVE_ACPI_RESUME { - extern u8 acpi_slp_type; u16 tmp = inw(ACPI_PM1_CNT_BLK); acpi_slp_type = ((tmp & (7 << 10)) >> 10); printk(BIOS_DEBUG, "SLP_TYP type was %x\n", acpi_slp_type); @@ -259,6 +268,16 @@ static void sb700_lpc_enable_resources(device_t dev) sb700_lpc_enable_childrens_resources(dev); } +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) + +static unsigned long southbridge_acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { + amd_model_fxx_generate_powernow(ACPI_CPU_CONTROL, 6, 1); + return (unsigned long) (acpigen_get_current()); +} + +#endif + + static struct pci_operations lops_pci = { .set_subsystem = pci_dev_set_subsystem, }; @@ -267,6 +286,10 @@ static struct device_operations lpc_ops = { .read_resources = sb700_lpc_read_resources, .set_resources = sb700_lpc_set_resources, .enable_resources = sb700_lpc_enable_resources, +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) + .write_acpi_tables = acpi_write_hpet, + .acpi_fill_ssdt_generator = southbridge_acpi_fill_ssdt_generator, +#endif .init = lpc_init, .scan_bus = scan_static_bus, .ops_pci = &lops_pci, diff --git a/src/southbridge/nvidia/ck804/ht.c b/src/southbridge/nvidia/ck804/ht.c index a2ba295..6ef39e3 100644 --- a/src/southbridge/nvidia/ck804/ht.c +++ b/src/southbridge/nvidia/ck804/ht.c @@ -24,6 +24,33 @@ #include <device/pci_ids.h> #include <device/pci_ops.h> #include "ck804.h" +#include <arch/acpi.h> + +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) + +unsigned long acpi_fill_mcfg(unsigned long current) +{ + device_t dev; + unsigned long mcfg_base; + + dev = dev_find_slot(0x0, PCI_DEVFN(0x0,0)); + if (!dev) + return current; + + mcfg_base = pci_read_config16(dev, 0x90); + if ((mcfg_base & 0x1000) == 0) + return current; + + mcfg_base = (mcfg_base & 0xf) << 28; + + printk(BIOS_INFO, "mcfg_base %lx.\n", mcfg_base); + + current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *) + current, mcfg_base, 0x0, 0x0, 0xff); + return current; +} + +#endif static struct device_operations ht_ops = { .read_resources = pci_dev_read_resources, diff --git a/src/southbridge/nvidia/ck804/lpc.c b/src/southbridge/nvidia/ck804/lpc.c index b3a9b00..d12dffb 100644 --- a/src/southbridge/nvidia/ck804/lpc.c +++ b/src/southbridge/nvidia/ck804/lpc.c @@ -30,6 +30,7 @@ #include <pc80/isa-dma.h> #include <arch/io.h> #include <arch/ioapic.h> +#include <arch/acpi.h> #include <cpu/x86/lapic.h> #include <stdlib.h> #include <assert.h> @@ -316,6 +317,9 @@ static struct device_operations lpc_ops = { .read_resources = ck804_lpc_read_resources, .set_resources = ck804_lpc_set_resources, .enable_resources = ck804_lpc_enable_resources, +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) + .write_acpi_tables = acpi_write_hpet, +#endif .init = lpc_init, .scan_bus = scan_static_bus, // .enable = ck804_enable, diff --git a/src/southbridge/nvidia/mcp55/ht.c b/src/southbridge/nvidia/mcp55/ht.c index 633221c..2daa5bb 100644 --- a/src/southbridge/nvidia/mcp55/ht.c +++ b/src/southbridge/nvidia/mcp55/ht.c @@ -26,8 +26,17 @@ #include <device/pci.h> #include <device/pci_ids.h> #include <device/pci_ops.h> +#include <arch/acpi.h> #include "mcp55.h" +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) +unsigned long acpi_fill_mcfg(unsigned long current) +{ + /* Not implemented */ + return current; +} +#endif + static struct device_operations ht_ops = { .read_resources = pci_dev_read_resources, .set_resources = pci_dev_set_resources, diff --git a/src/southbridge/nvidia/mcp55/lpc.c b/src/southbridge/nvidia/mcp55/lpc.c index 585232d..4533699 100644 --- a/src/southbridge/nvidia/mcp55/lpc.c +++ b/src/southbridge/nvidia/mcp55/lpc.c @@ -34,7 +34,13 @@ #include <arch/io.h> #include <arch/ioapic.h> #include <cpu/x86/lapic.h> +#include <arch/acpi.h> #include <stdlib.h> +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) +#include <arch/acpi.h> +#include <arch/acpigen.h> +#endif +#include <cpu/amd/model_fxx_powernow.h> #include "mcp55.h" #define NMI_OFF 0 @@ -275,10 +281,24 @@ static const struct pci_driver lpc_driver __pci_driver = { .devices = lpc_ids, }; +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) + +static unsigned long southbridge_acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) +{ + amd_model_fxx_generate_powernow(0, 0, 0); + return (unsigned long) (acpigen_get_current()); +} + +#endif + static struct device_operations lpc_slave_ops = { .read_resources = mcp55_lpc_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = pci_dev_enable_resources, +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) + .acpi_fill_ssdt_generator = southbridge_acpi_fill_ssdt_generator, + .write_acpi_tables = acpi_write_hpet, +#endif .init = lpc_slave_init, // .enable = mcp55_enable, .ops_pci = &mcp55_pci_ops, diff --git a/src/southbridge/via/k8t890/traf_ctrl.c b/src/southbridge/via/k8t890/traf_ctrl.c index 464cb6c..0abb9af 100644 --- a/src/southbridge/via/k8t890/traf_ctrl.c +++ b/src/southbridge/via/k8t890/traf_ctrl.c @@ -21,6 +21,9 @@ #include <device/pci.h> #include <device/pci_ids.h> #include <console/console.h> +#include <arch/acpi.h> +#include <arch/acpigen.h> +#include <cpu/amd/model_fxx_powernow.h> #include "k8t890.h" extern unsigned long log2(unsigned long x); @@ -122,11 +125,25 @@ static void traf_ctrl_enable_k8t890(struct device *dev) pci_write_config8(dev, 0x60, 0x80 | reg); } +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) + +static unsigned long southbridge_acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id) { + amd_model_fxx_generate_powernow(0, 0, 0); + acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS"); + return (unsigned long) (acpigen_get_current()); +} + +#endif + static const struct device_operations traf_ctrl_ops_m = { .read_resources = apic_mmconfig_read_resources, .set_resources = mmconfig_set_resources, .enable_resources = pci_dev_enable_resources, .enable = traf_ctrl_enable_k8m890, +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) + .write_acpi_tables = acpi_write_hpet, + .acpi_fill_ssdt_generator = southbridge_acpi_fill_ssdt_generator, +#endif .ops_pci = 0, }; @@ -135,11 +152,35 @@ static const struct device_operations traf_ctrl_ops_t = { .set_resources = mmconfig_set_resources, .enable_resources = pci_dev_enable_resources, .enable = traf_ctrl_enable_k8t890, +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) + .write_acpi_tables = acpi_write_hpet, +#endif .ops_pci = 0, }; /* K8X800 chipsets have no APIC; no 800 PCI ids here */ +unsigned long acpi_fill_mcfg(unsigned long current) +{ + device_t dev; + struct resource *res; + + dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8T890CE_5, 0); + if (!dev) + dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8T890CF_5, 0); + if (!dev) + dev = dev_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_K8M890CE_5, 0); + if (!dev) + return current; + + res = find_resource(dev, K8T890_MMCONFIG_MBAR); + if (res) { + current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *) + current, res->base, 0x0, 0x0, 0xff); + } + return current; +} + static const struct pci_driver northbridge_driver_t __pci_driver = { .ops = &traf_ctrl_ops_t,
1
0
0
0
Patch set updated for coreboot: a784473 acpi: Remove explicit pointer tracking in per-device ssdt.
by Vladimir Serbinenko
05 Oct '14
05 Oct '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/7018
-gerrit commit a784473a3f995e287e51402514b20c7ba050625a Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sun Oct 5 14:34:17 2014 +0200 acpi: Remove explicit pointer tracking in per-device ssdt. It's useless and error-prone. Change-Id: Ie385e147d42b05290ab8c3ca193c5c871306f4ac Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/arch/x86/boot/acpi.c | 3 ++- src/include/device/device.h | 3 +-- src/mainboard/lenovo/x201/mainboard.c | 4 +--- src/northbridge/intel/haswell/acpi.c | 7 ------- src/northbridge/intel/haswell/haswell.h | 2 -- src/northbridge/intel/haswell/northbridge.c | 2 +- src/northbridge/intel/nehalem/acpi.c | 8 -------- src/northbridge/intel/nehalem/nehalem.h | 2 -- src/northbridge/intel/nehalem/northbridge.c | 2 +- src/northbridge/intel/sandybridge/acpi.c | 7 ------- src/northbridge/intel/sandybridge/northbridge.c | 3 +-- src/northbridge/intel/sandybridge/sandybridge.h | 2 -- 12 files changed, 7 insertions(+), 38 deletions(-) diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c index 6c74268..10620f4 100644 --- a/src/arch/x86/boot/acpi.c +++ b/src/arch/x86/boot/acpi.c @@ -281,8 +281,9 @@ void acpi_create_ssdt_generator(acpi_header_t *ssdt, const char *oem_table_id) device_t dev; for (dev = all_devices; dev; dev = dev->next) if (dev->ops && dev->ops->acpi_fill_ssdt_generator) { - current = dev->ops->acpi_fill_ssdt_generator(current, oem_table_id); + dev->ops->acpi_fill_ssdt_generator(); } + current = (unsigned long) acpigen_get_current(); #else current = acpi_fill_ssdt_generator(current, oem_table_id); #endif diff --git a/src/include/device/device.h b/src/include/device/device.h index 7ae49f5..a715802 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -59,8 +59,7 @@ struct device_operations { #endif #if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) 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_fill_ssdt_generator)(void); void (*acpi_inject_dsdt_generator)(void); #endif const struct pci_operations *ops_pci; diff --git a/src/mainboard/lenovo/x201/mainboard.c b/src/mainboard/lenovo/x201/mainboard.c index 57ef86d..5b76be2 100644 --- a/src/mainboard/lenovo/x201/mainboard.c +++ b/src/mainboard/lenovo/x201/mainboard.c @@ -112,11 +112,9 @@ static void mainboard_init(device_t dev) 0x42, 0x142); } -static unsigned long fill_ssdt(unsigned long current, - const char *oem_table_id) +static void fill_ssdt(void) { drivers_lenovo_serial_ports_ssdt_generate("\\_SB.PCI0.LPCB", 0); - return (unsigned long) (acpigen_get_current()); } static void mainboard_enable(device_t dev) diff --git a/src/northbridge/intel/haswell/acpi.c b/src/northbridge/intel/haswell/acpi.c index 7862f02..37f3717 100644 --- a/src/northbridge/intel/haswell/acpi.c +++ b/src/northbridge/intel/haswell/acpi.c @@ -194,10 +194,3 @@ int init_igd_opregion(igd_opregion_t *opregion) return 0; } - -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/haswell/haswell.h b/src/northbridge/intel/haswell/haswell.h index 0086dd0..55f6f28 100644 --- a/src/northbridge/intel/haswell/haswell.h +++ b/src/northbridge/intel/haswell/haswell.h @@ -229,8 +229,6 @@ struct mrc_data_container *find_current_mrc_cache(void); #if !defined(__PRE_RAM__) #include "gma.h" int init_igd_opregion(igd_opregion_t *igd_opregion); -unsigned long northbridge_acpi_fill_ssdt_generator(unsigned long current, - const char *oem_table_id); #endif #endif diff --git a/src/northbridge/intel/haswell/northbridge.c b/src/northbridge/intel/haswell/northbridge.c index eaac723..1b4658a 100644 --- a/src/northbridge/intel/haswell/northbridge.c +++ b/src/northbridge/intel/haswell/northbridge.c @@ -463,7 +463,7 @@ static struct device_operations mc_ops = { .enable_resources = pci_dev_enable_resources, .init = northbridge_init, .enable = northbridge_enable, - .acpi_fill_ssdt_generator = northbridge_acpi_fill_ssdt_generator, + .acpi_fill_ssdt_generator = generate_cpu_entries, .scan_bus = 0, .ops_pci = &intel_pci_ops, }; diff --git a/src/northbridge/intel/nehalem/acpi.c b/src/northbridge/intel/nehalem/acpi.c index 6f694e2..ed418fd 100644 --- a/src/northbridge/intel/nehalem/acpi.c +++ b/src/northbridge/intel/nehalem/acpi.c @@ -211,11 +211,3 @@ void *igd_make_opregion(void) init_igd_opregion(opregion); return opregion; } - -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/nehalem/nehalem.h b/src/northbridge/intel/nehalem/nehalem.h index 1a2165f..60cafdf 100644 --- a/src/northbridge/intel/nehalem/nehalem.h +++ b/src/northbridge/intel/nehalem/nehalem.h @@ -619,8 +619,6 @@ struct mrc_data_container *find_current_mrc_cache(void); #if !defined(__PRE_RAM__) #include "gma.h" int init_igd_opregion(igd_opregion_t *igd_opregion); -unsigned long northbridge_acpi_fill_ssdt_generator(unsigned long current, - const char *oem_table_id); #endif #endif diff --git a/src/northbridge/intel/nehalem/northbridge.c b/src/northbridge/intel/nehalem/northbridge.c index e6b9ca7..a31e85c 100644 --- a/src/northbridge/intel/nehalem/northbridge.c +++ b/src/northbridge/intel/nehalem/northbridge.c @@ -313,7 +313,7 @@ static struct device_operations mc_ops = { .enable_resources = pci_dev_enable_resources, .init = northbridge_init, .enable = northbridge_enable, - .acpi_fill_ssdt_generator = northbridge_acpi_fill_ssdt_generator, + .acpi_fill_ssdt_generator = generate_cpu_entries, .scan_bus = 0, .ops_pci = &intel_pci_ops, }; diff --git a/src/northbridge/intel/sandybridge/acpi.c b/src/northbridge/intel/sandybridge/acpi.c index c77b5cc..2925588 100644 --- a/src/northbridge/intel/sandybridge/acpi.c +++ b/src/northbridge/intel/sandybridge/acpi.c @@ -214,10 +214,3 @@ void *igd_make_opregion(void) return opregion; } -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/sandybridge/northbridge.c b/src/northbridge/intel/sandybridge/northbridge.c index 39a95af..9331afa 100644 --- a/src/northbridge/intel/sandybridge/northbridge.c +++ b/src/northbridge/intel/sandybridge/northbridge.c @@ -444,8 +444,7 @@ static struct device_operations mc_ops = { .enable = northbridge_enable, .scan_bus = 0, .ops_pci = &intel_pci_ops, - .acpi_fill_ssdt_generator = northbridge_acpi_fill_ssdt_generator, - + .acpi_fill_ssdt_generator = generate_cpu_entries, }; static const struct pci_driver mc_driver_0100 __pci_driver = { diff --git a/src/northbridge/intel/sandybridge/sandybridge.h b/src/northbridge/intel/sandybridge/sandybridge.h index 71a9d2f..291ea46 100644 --- a/src/northbridge/intel/sandybridge/sandybridge.h +++ b/src/northbridge/intel/sandybridge/sandybridge.h @@ -235,8 +235,6 @@ struct mrc_data_container *find_current_mrc_cache(void); #if !defined(__PRE_RAM__) #include "gma.h" int init_igd_opregion(igd_opregion_t *igd_opregion); -unsigned long northbridge_acpi_fill_ssdt_generator(unsigned long current, - const char *oem_table_id); #endif #endif
1
0
0
0
Patch set updated for coreboot: 050b8d1 i82371eb & qemu: Move to per-device ACPI.
by Vladimir Serbinenko
05 Oct '14
05 Oct '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/6939
-gerrit commit 050b8d1dce9ac047916314b48ac39882fca2f217 Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Mon Sep 1 22:18:01 2014 +0200 i82371eb & qemu: Move to per-device ACPI. This one is special because qemu is really far from anything real but shares some common features. Change-Id: Ia1631611724a074780e1fece50166730b2ee94ae Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/arch/x86/boot/acpi.c | 10 ++ src/arch/x86/include/arch/acpi.h | 2 + src/mainboard/emulation/qemu-i440fx/Kconfig | 1 + src/mainboard/emulation/qemu-i440fx/acpi.h | 1 + src/mainboard/emulation/qemu-i440fx/acpi_tables.c | 134 +------------------- src/mainboard/emulation/qemu-i440fx/fw_cfg.h | 1 - src/mainboard/emulation/qemu-i440fx/northbridge.c | 1 + src/mainboard/emulation/qemu-q35/acpi_tables.c | 148 +++------------------- src/southbridge/intel/i82371eb/Kconfig | 8 ++ src/southbridge/intel/i82371eb/acpi_tables.c | 80 +----------- src/southbridge/intel/i82371eb/i82371eb.h | 3 + src/southbridge/intel/i82371eb/isa.c | 8 ++ src/southbridge/intel/i82801ix/Kconfig | 1 + src/southbridge/intel/i82801ix/lpc.c | 4 - 14 files changed, 54 insertions(+), 348 deletions(-) diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c index 10620f4..c65f83e 100644 --- a/src/arch/x86/boot/acpi.c +++ b/src/arch/x86/boot/acpi.c @@ -656,6 +656,11 @@ void acpi_write_hest(acpi_hest_t *hest) extern const unsigned char AmlCode[]; +unsigned long __attribute__ ((weak)) fw_cfg_acpi_tables(unsigned long start) +{ + return 0; +} + #define ALIGN_CURRENT current = (ALIGN(current, 16)) unsigned long write_acpi_tables(unsigned long start) { @@ -673,12 +678,17 @@ unsigned long write_acpi_tables(unsigned long start) acpi_mcfg_t *mcfg; acpi_madt_t *madt; device_t dev; + unsigned long fw; current = start; /* Align ACPI tables to 16byte */ ALIGN_CURRENT; + fw = fw_cfg_acpi_tables(current); + if (fw) + return fw; + printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start); /* We need at least an RSDP and an RSDT Table */ diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h index 4adf89e..a015635 100644 --- a/src/arch/x86/include/arch/acpi.h +++ b/src/arch/x86/include/arch/acpi.h @@ -484,6 +484,8 @@ typedef struct acpi_tstate { u32 status; } __attribute__ ((packed)) acpi_tstate_t; +unsigned long fw_cfg_acpi_tables(unsigned long start); + /* These are implemented by the target port or north/southbridge. */ unsigned long write_acpi_tables(unsigned long addr); unsigned long acpi_fill_madt(unsigned long current); diff --git a/src/mainboard/emulation/qemu-i440fx/Kconfig b/src/mainboard/emulation/qemu-i440fx/Kconfig index 34f3342..b002c21 100644 --- a/src/mainboard/emulation/qemu-i440fx/Kconfig +++ b/src/mainboard/emulation/qemu-i440fx/Kconfig @@ -12,6 +12,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select MAINBOARD_HAS_NATIVE_VGA_INIT select MAINBOARD_DO_NATIVE_VGA_INIT select MAINBOARD_HAS_NATIVE_VGA_INIT_TEXTMODECFG + select PER_DEVICE_ACPI_TABLES config MAINBOARD_DIR string diff --git a/src/mainboard/emulation/qemu-i440fx/acpi.h b/src/mainboard/emulation/qemu-i440fx/acpi.h new file mode 100644 index 0000000..c0d4e6e --- /dev/null +++ b/src/mainboard/emulation/qemu-i440fx/acpi.h @@ -0,0 +1 @@ +unsigned long northbridge_write_acpi_tables(unsigned long start); diff --git a/src/mainboard/emulation/qemu-i440fx/acpi_tables.c b/src/mainboard/emulation/qemu-i440fx/acpi_tables.c index 8be187a..da1a78d 100644 --- a/src/mainboard/emulation/qemu-i440fx/acpi_tables.c +++ b/src/mainboard/emulation/qemu-i440fx/acpi_tables.c @@ -30,11 +30,7 @@ #include <cpu/x86/msr.h> #include "fw_cfg.h" - -extern const unsigned char AmlCode[]; -#if CONFIG_HAVE_ACPI_SLIC -unsigned long acpi_create_slic(unsigned long current); -#endif +#include "acpi.h" unsigned long acpi_fill_madt(unsigned long current) { @@ -54,12 +50,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 @@ -71,125 +61,3 @@ unsigned long acpi_fill_srat(unsigned long current) /* No NUMA, no SRAT */ return current; } - -#define ALIGN_CURRENT current = (ALIGN(current, 16)) -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - 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 = fw_cfg_acpi_tables(start); - if (current) - return current; - - 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; - - /* 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/emulation/qemu-i440fx/fw_cfg.h b/src/mainboard/emulation/qemu-i440fx/fw_cfg.h index 5ab024f..2a10d8b 100644 --- a/src/mainboard/emulation/qemu-i440fx/fw_cfg.h +++ b/src/mainboard/emulation/qemu-i440fx/fw_cfg.h @@ -19,4 +19,3 @@ void fw_cfg_get(int entry, void *dst, int dstlen); int fw_cfg_check_file(const char *name); void fw_cfg_load_file(const char *name, void *dst); int fw_cfg_max_cpus(void); -unsigned long fw_cfg_acpi_tables(unsigned long start); diff --git a/src/mainboard/emulation/qemu-i440fx/northbridge.c b/src/mainboard/emulation/qemu-i440fx/northbridge.c index 0f8c0c2..433e729 100644 --- a/src/mainboard/emulation/qemu-i440fx/northbridge.c +++ b/src/mainboard/emulation/qemu-i440fx/northbridge.c @@ -16,6 +16,7 @@ #include "fw_cfg_if.h" #include "memory.c" +#include "acpi.h" static unsigned long qemu_get_high_memory_size(void) { diff --git a/src/mainboard/emulation/qemu-q35/acpi_tables.c b/src/mainboard/emulation/qemu-q35/acpi_tables.c index 4e79b2c..2d00a0d 100644 --- a/src/mainboard/emulation/qemu-q35/acpi_tables.c +++ b/src/mainboard/emulation/qemu-q35/acpi_tables.c @@ -30,11 +30,23 @@ #include <cpu/x86/msr.h> #include "../qemu-i440fx/fw_cfg.h" +#include "../qemu-i440fx/acpi.h" +#include "southbridge/intel/i82801ix/nvs.h" + +void acpi_create_gnvs(global_nvs_t *gnvs) +{ + memset((void *)gnvs, 0, sizeof(*gnvs)); + gnvs->apic = 1; + gnvs->mpen = 1; /* Enable Multi Processing */ + + /* Enable both COM ports */ + gnvs->cmap = 0x01; + gnvs->cmbp = 0x01; + + /* IGD Displays */ + gnvs->ndid = 0; /* Will use default of 0x00000400. */ +} -extern const unsigned char AmlCode[]; -#if CONFIG_HAVE_ACPI_SLIC -unsigned long acpi_create_slic(unsigned long current); -#endif void acpi_create_fadt(acpi_fadt_t * fadt, acpi_facs_t * facs, void *dsdt) { @@ -186,12 +198,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) -{ - // Not implemented - return current; -} - unsigned long acpi_fill_slit(unsigned long current) { // Not implemented @@ -221,125 +227,3 @@ unsigned long acpi_fill_srat(unsigned long current) /* No NUMA, no SRAT */ return current; } - -#define ALIGN_CURRENT current = (ALIGN(current, 16)) -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - 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 = fw_cfg_acpi_tables(start); - if (current) - return current; - - 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; - - /* 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/southbridge/intel/i82371eb/Kconfig b/src/southbridge/intel/i82371eb/Kconfig index d91c8b7..5ddbe0f 100644 --- a/src/southbridge/intel/i82371eb/Kconfig +++ b/src/southbridge/intel/i82371eb/Kconfig @@ -6,3 +6,11 @@ config BOOTBLOCK_SOUTHBRIDGE_INIT default "southbridge/intel/i82371eb/bootblock.c" depends on SOUTHBRIDGE_INTEL_I82371EB + +if SOUTHBRIDGE_INTEL_I82371EB + +config SOUTH_BRIDGE_OPTIONS # dummy + def_bool y + select PER_DEVICE_ACPI_TABLES + +endif diff --git a/src/southbridge/intel/i82371eb/acpi_tables.c b/src/southbridge/intel/i82371eb/acpi_tables.c index a0cc82b..21e056a 100644 --- a/src/southbridge/intel/i82371eb/acpi_tables.c +++ b/src/southbridge/intel/i82371eb/acpi_tables.c @@ -90,8 +90,8 @@ unsigned long __attribute__((weak)) acpi_fill_mcfg(unsigned long current) return current; } -unsigned long __attribute__((weak)) acpi_fill_ssdt_generator(unsigned long current, - const char *oem_table_id) +unsigned long southbridge_acpi_fill_ssdt_generator(unsigned long current, + const char *oem_table_id) { acpigen_write_mainboard_resources("\\_SB.PCI0.MBRS", "_CRS"); /* generate_cpu_entries() generates weird bytecode and has to come @@ -100,79 +100,3 @@ unsigned long __attribute__((weak)) acpi_fill_ssdt_generator(unsigned long curre generate_cpu_entries(); return (unsigned long) acpigen_get_current(); } - -unsigned long __attribute__((weak)) write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_fadt_t *fadt; - acpi_facs_t *facs; - acpi_madt_t *madt; - acpi_header_t *ssdt; - acpi_header_t *dsdt; - - /* Align ACPI tables to 16 byte. */ - start = ALIGN(start, 16); - current = start; - - 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); - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - - /* 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: * FACS\n"); - - /* we should align FACS to 64B as per ACPI specs */ - current = ALIGN(current, 64); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - acpi_create_facs(facs); - - dsdt = (acpi_header_t *)current; - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - /* Don't trust iasl to get checksum right. */ - dsdt->checksum = 0; /* needs to be set to 0 first (part of csum) */ - dsdt->checksum = acpi_checksum((u8*)dsdt, dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, - dsdt->length); - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - printk(BIOS_DEBUG, "ACPI: * MADT\n"); - madt = (acpi_madt_t *) current; - acpi_create_madt(madt); - if (madt->header.length > sizeof(acpi_madt_t)) { - current += madt->header.length; - acpi_add_table(rsdp, madt); - } else { - /* don't add empty madt */ - current = (unsigned long)madt; - } - - 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_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/southbridge/intel/i82371eb/i82371eb.h b/src/southbridge/intel/i82371eb/i82371eb.h index e6062c6..991f49e 100644 --- a/src/southbridge/intel/i82371eb/i82371eb.h +++ b/src/southbridge/intel/i82371eb/i82371eb.h @@ -26,6 +26,9 @@ #include <arch/io.h> #include <device/device.h> #include "chip.h" +unsigned long southbridge_acpi_fill_ssdt_generator(unsigned long current, + const char *oem_table_id); + void i82371eb_enable(device_t dev); void i82371eb_hard_reset(void); #else diff --git a/src/southbridge/intel/i82371eb/isa.c b/src/southbridge/intel/i82371eb/isa.c index 5605106..9b25b98 100644 --- a/src/southbridge/intel/i82371eb/isa.c +++ b/src/southbridge/intel/i82371eb/isa.c @@ -26,6 +26,10 @@ #include <pc80/isa-dma.h> #include <pc80/mc146818rtc.h> #include <arch/ioapic.h> +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) +#include <arch/acpi.h> +#include <arch/acpigen.h> +#endif #include "i82371eb.h" #if CONFIG_IOAPIC @@ -128,6 +132,10 @@ static const struct device_operations isa_ops = { .read_resources = sb_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = pci_dev_enable_resources, +#if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) + .write_acpi_tables = acpi_write_hpet, + .acpi_fill_ssdt_generator = southbridge_acpi_fill_ssdt_generator, +#endif .init = isa_init, .scan_bus = scan_static_bus, /* TODO: Needed? */ .enable = 0, diff --git a/src/southbridge/intel/i82801ix/Kconfig b/src/southbridge/intel/i82801ix/Kconfig index 1ad5aad..d8a32e5 100644 --- a/src/southbridge/intel/i82801ix/Kconfig +++ b/src/southbridge/intel/i82801ix/Kconfig @@ -27,6 +27,7 @@ config SOUTHBRIDGE_INTEL_I82801IX select USE_WATCHDOG_ON_BOOT select HAVE_SMI_HANDLER select HAVE_USBDEBUG_OPTIONS + select PER_DEVICE_ACPI_TABLES if SOUTHBRIDGE_INTEL_I82801IX diff --git a/src/southbridge/intel/i82801ix/lpc.c b/src/southbridge/intel/i82801ix/lpc.c index 8105a4d..4742d2e 100644 --- a/src/southbridge/intel/i82801ix/lpc.c +++ b/src/southbridge/intel/i82801ix/lpc.c @@ -538,7 +538,6 @@ 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)); @@ -556,7 +555,6 @@ static void southbridge_inject_dsdt(void) acpigen_patch_len(scopelen - 1); } } -#endif static struct pci_operations pci_ops = { .set_subsystem = set_subsystem, @@ -566,10 +564,8 @@ 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,
1
0
0
0
Patch set updated for coreboot: 9b1aa5c e750[15]: Move to per-device ACPI
by Vladimir Serbinenko
05 Oct '14
05 Oct '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/6938
-gerrit commit 9b1aa5cf86d01b39f32efe693c443f28259008af Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Mon Sep 1 09:45:05 2014 +0200 e750[15]: Move to per-device ACPI Change-Id: I706891b9408cf14b559ef228766c04e98345ff6e Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/mainboard/aopen/dxplplusu/acpi_tables.c | 77 ----------------------------- src/northbridge/intel/e7505/Kconfig | 1 + src/northbridge/intel/e7505/northbridge.c | 7 +++ 3 files changed, 8 insertions(+), 77 deletions(-) diff --git a/src/mainboard/aopen/dxplplusu/acpi_tables.c b/src/mainboard/aopen/dxplplusu/acpi_tables.c index 2985e86..405c420 100644 --- a/src/mainboard/aopen/dxplplusu/acpi_tables.c +++ b/src/mainboard/aopen/dxplplusu/acpi_tables.c @@ -30,14 +30,6 @@ #include <assert.h> #include "bus.h" -extern unsigned char AmlCode[]; - -unsigned long acpi_fill_mcfg(unsigned long current) -{ - /* Just a dummy */ - return current; -} - unsigned long acpi_fill_slit(unsigned long current) { // Not implemented @@ -91,72 +83,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -#define ALIGN_CURRENT current = (ALIGN(current, 16)) -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_madt_t *madt; - acpi_facs_t *facs; - acpi_fadt_t *fadt; - 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: * FADT\n"); - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - ALIGN_CURRENT; - - 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,(void *)AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - ALIGN_CURRENT; - memcpy(dsdt,(void *)AmlCode, dsdt->length); - dsdt->checksum = 0; - dsdt->checksum = acpi_checksum((void *)dsdt,dsdt->length); - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n",dsdt,dsdt->length); - - acpi_create_fadt(fadt,facs,dsdt); - acpi_add_table(rsdp,fadt); - - 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_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/northbridge/intel/e7505/Kconfig b/src/northbridge/intel/e7505/Kconfig index 117bd03..ff7f5a5 100644 --- a/src/northbridge/intel/e7505/Kconfig +++ b/src/northbridge/intel/e7505/Kconfig @@ -25,6 +25,7 @@ if NORTHBRIDGE_INTEL_E7505 config NORTHBRIDGE_SPECIFIC_OPTIONS # dummy def_bool y select HAVE_DEBUG_RAM_SETUP + select PER_DEVICE_ACPI_TABLES config HW_SCRUBBER bool diff --git a/src/northbridge/intel/e7505/northbridge.c b/src/northbridge/intel/e7505/northbridge.c index 8f1632d..54c700b 100644 --- a/src/northbridge/intel/e7505/northbridge.c +++ b/src/northbridge/intel/e7505/northbridge.c @@ -8,6 +8,13 @@ #include <string.h> #include "e7505.h" #include <cbmem.h> +#include <arch/acpi.h> + +unsigned long acpi_fill_mcfg(unsigned long current) +{ + /* Just a dummy */ + return current; +} static void pci_domain_set_resources(device_t dev) {
1
0
0
0
Patch set updated for coreboot: d9d7995 sch: Switch to per-device ACPI
by Vladimir Serbinenko
05 Oct '14
05 Oct '14
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 d9d7995b8d77954e9627631d255f452f1027f9d8 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 | 4 + src/northbridge/intel/sch/northbridge.c | 1 + src/southbridge/intel/sch/acpi/globalnvs.asl | 4 +- src/southbridge/intel/sch/lpc.c | 26 +++++ src/southbridge/intel/sch/nvs.h | 2 + 7 files changed, 37 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..40347c7 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) { diff --git a/src/northbridge/intel/sch/northbridge.c b/src/northbridge/intel/sch/northbridge.c index 0bbf91b..1f327c6 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 = generate_cpu_entries, .scan_bus = 0, .ops_pci = &intel_pci_ops, }; 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
0
0
Patch set updated for coreboot: 3a7b39d i945: Convert to per-device ACPI
by Vladimir Serbinenko
05 Oct '14
05 Oct '14
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 3a7b39dbba10d3265713c2c057c6fb1cb1d7db73 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 | 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 + 17 files changed, 60 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..4212e95 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) diff --git a/src/northbridge/intel/i945/northbridge.c b/src/northbridge/intel/i945/northbridge.c index 68d6d91..815d4bf 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 = generate_cpu_entries, #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
0
0
New patch to review for coreboot: d3e6eaf acpi: Remove explicit pointer tracking in per-device ssdt.
by Vladimir Serbinenko
05 Oct '14
05 Oct '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/7018
-gerrit commit d3e6eaf125f860193b5366f5a68a6fc76d978d7e Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sun Oct 5 14:34:17 2014 +0200 acpi: Remove explicit pointer tracking in per-device ssdt. It's useless and error-prone. Change-Id: Ie385e147d42b05290ab8c3ca193c5c871306f4ac Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/arch/x86/boot/acpi.c | 3 ++- src/include/device/device.h | 3 +-- src/northbridge/intel/haswell/acpi.c | 7 ------- src/northbridge/intel/haswell/haswell.h | 2 -- src/northbridge/intel/haswell/northbridge.c | 2 +- src/northbridge/intel/nehalem/acpi.c | 8 -------- src/northbridge/intel/nehalem/nehalem.h | 2 -- src/northbridge/intel/nehalem/northbridge.c | 2 +- src/northbridge/intel/sandybridge/acpi.c | 7 ------- src/northbridge/intel/sandybridge/northbridge.c | 3 +-- src/northbridge/intel/sandybridge/sandybridge.h | 2 -- 11 files changed, 6 insertions(+), 35 deletions(-) diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c index 6c74268..10620f4 100644 --- a/src/arch/x86/boot/acpi.c +++ b/src/arch/x86/boot/acpi.c @@ -281,8 +281,9 @@ void acpi_create_ssdt_generator(acpi_header_t *ssdt, const char *oem_table_id) device_t dev; for (dev = all_devices; dev; dev = dev->next) if (dev->ops && dev->ops->acpi_fill_ssdt_generator) { - current = dev->ops->acpi_fill_ssdt_generator(current, oem_table_id); + dev->ops->acpi_fill_ssdt_generator(); } + current = (unsigned long) acpigen_get_current(); #else current = acpi_fill_ssdt_generator(current, oem_table_id); #endif diff --git a/src/include/device/device.h b/src/include/device/device.h index 7ae49f5..a715802 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -59,8 +59,7 @@ struct device_operations { #endif #if IS_ENABLED(CONFIG_GENERATE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) 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_fill_ssdt_generator)(void); void (*acpi_inject_dsdt_generator)(void); #endif const struct pci_operations *ops_pci; diff --git a/src/northbridge/intel/haswell/acpi.c b/src/northbridge/intel/haswell/acpi.c index 7862f02..37f3717 100644 --- a/src/northbridge/intel/haswell/acpi.c +++ b/src/northbridge/intel/haswell/acpi.c @@ -194,10 +194,3 @@ int init_igd_opregion(igd_opregion_t *opregion) return 0; } - -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/haswell/haswell.h b/src/northbridge/intel/haswell/haswell.h index 0086dd0..55f6f28 100644 --- a/src/northbridge/intel/haswell/haswell.h +++ b/src/northbridge/intel/haswell/haswell.h @@ -229,8 +229,6 @@ struct mrc_data_container *find_current_mrc_cache(void); #if !defined(__PRE_RAM__) #include "gma.h" int init_igd_opregion(igd_opregion_t *igd_opregion); -unsigned long northbridge_acpi_fill_ssdt_generator(unsigned long current, - const char *oem_table_id); #endif #endif diff --git a/src/northbridge/intel/haswell/northbridge.c b/src/northbridge/intel/haswell/northbridge.c index eaac723..1b4658a 100644 --- a/src/northbridge/intel/haswell/northbridge.c +++ b/src/northbridge/intel/haswell/northbridge.c @@ -463,7 +463,7 @@ static struct device_operations mc_ops = { .enable_resources = pci_dev_enable_resources, .init = northbridge_init, .enable = northbridge_enable, - .acpi_fill_ssdt_generator = northbridge_acpi_fill_ssdt_generator, + .acpi_fill_ssdt_generator = generate_cpu_entries, .scan_bus = 0, .ops_pci = &intel_pci_ops, }; diff --git a/src/northbridge/intel/nehalem/acpi.c b/src/northbridge/intel/nehalem/acpi.c index 6f694e2..ed418fd 100644 --- a/src/northbridge/intel/nehalem/acpi.c +++ b/src/northbridge/intel/nehalem/acpi.c @@ -211,11 +211,3 @@ void *igd_make_opregion(void) init_igd_opregion(opregion); return opregion; } - -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/nehalem/nehalem.h b/src/northbridge/intel/nehalem/nehalem.h index 1a2165f..60cafdf 100644 --- a/src/northbridge/intel/nehalem/nehalem.h +++ b/src/northbridge/intel/nehalem/nehalem.h @@ -619,8 +619,6 @@ struct mrc_data_container *find_current_mrc_cache(void); #if !defined(__PRE_RAM__) #include "gma.h" int init_igd_opregion(igd_opregion_t *igd_opregion); -unsigned long northbridge_acpi_fill_ssdt_generator(unsigned long current, - const char *oem_table_id); #endif #endif diff --git a/src/northbridge/intel/nehalem/northbridge.c b/src/northbridge/intel/nehalem/northbridge.c index e6b9ca7..a31e85c 100644 --- a/src/northbridge/intel/nehalem/northbridge.c +++ b/src/northbridge/intel/nehalem/northbridge.c @@ -313,7 +313,7 @@ static struct device_operations mc_ops = { .enable_resources = pci_dev_enable_resources, .init = northbridge_init, .enable = northbridge_enable, - .acpi_fill_ssdt_generator = northbridge_acpi_fill_ssdt_generator, + .acpi_fill_ssdt_generator = generate_cpu_entries, .scan_bus = 0, .ops_pci = &intel_pci_ops, }; diff --git a/src/northbridge/intel/sandybridge/acpi.c b/src/northbridge/intel/sandybridge/acpi.c index c77b5cc..2925588 100644 --- a/src/northbridge/intel/sandybridge/acpi.c +++ b/src/northbridge/intel/sandybridge/acpi.c @@ -214,10 +214,3 @@ void *igd_make_opregion(void) return opregion; } -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/sandybridge/northbridge.c b/src/northbridge/intel/sandybridge/northbridge.c index 39a95af..9331afa 100644 --- a/src/northbridge/intel/sandybridge/northbridge.c +++ b/src/northbridge/intel/sandybridge/northbridge.c @@ -444,8 +444,7 @@ static struct device_operations mc_ops = { .enable = northbridge_enable, .scan_bus = 0, .ops_pci = &intel_pci_ops, - .acpi_fill_ssdt_generator = northbridge_acpi_fill_ssdt_generator, - + .acpi_fill_ssdt_generator = generate_cpu_entries, }; static const struct pci_driver mc_driver_0100 __pci_driver = { diff --git a/src/northbridge/intel/sandybridge/sandybridge.h b/src/northbridge/intel/sandybridge/sandybridge.h index 71a9d2f..291ea46 100644 --- a/src/northbridge/intel/sandybridge/sandybridge.h +++ b/src/northbridge/intel/sandybridge/sandybridge.h @@ -235,8 +235,6 @@ struct mrc_data_container *find_current_mrc_cache(void); #if !defined(__PRE_RAM__) #include "gma.h" int init_igd_opregion(igd_opregion_t *igd_opregion); -unsigned long northbridge_acpi_fill_ssdt_generator(unsigned long current, - const char *oem_table_id); #endif #endif
1
0
0
0
← Newer
1
...
95
96
97
98
99
100
101
102
103
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Results per page:
10
25
50
100
200