Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
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 69de590e4d180afdd2023bc21fa28b9074645507
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, 413 insertions(+), 2863 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..e2fa0f0 100644
--- a/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
@@ -32,25 +32,6 @@
#include "southbridge/via/vt8237r/vt8237r.h"
#include "southbridge/via/k8t890/k8t890.h"
-extern const unsigned char AmlCode[];
-
-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)
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -80,77 +61,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..2a874db 100644
--- a/src/mainboard/asus/a8v-e_se/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_se/acpi_tables.c
@@ -34,25 +34,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -82,94 +63,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..da4c399 100644
--- a/src/mainboard/asus/k8v-x/acpi_tables.c
+++ b/src/mainboard/asus/k8v-x/acpi_tables.c
@@ -34,25 +34,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -82,94 +63,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..dab35d4 100644
--- a/src/mainboard/asus/m2v-mx_se/acpi_tables.c
+++ b/src/mainboard/asus/m2v-mx_se/acpi_tables.c
@@ -35,25 +35,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -83,114 +64,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..7ad045c 100644
--- a/src/mainboard/asus/m2v/acpi_tables.c
+++ b/src/mainboard/asus/m2v/acpi_tables.c
@@ -36,25 +36,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -84,115 +65,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..22bb02e
--- /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>
+
+
+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,
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 950892f4d728383d5150fc76193d41aa30f3021f
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 | 108 +------------
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, 412 insertions(+), 2862 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..e2fa0f0 100644
--- a/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
@@ -32,25 +32,6 @@
#include "southbridge/via/vt8237r/vt8237r.h"
#include "southbridge/via/k8t890/k8t890.h"
-extern const unsigned char AmlCode[];
-
-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)
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -80,77 +61,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..2a874db 100644
--- a/src/mainboard/asus/a8v-e_se/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_se/acpi_tables.c
@@ -34,25 +34,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -82,94 +63,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..da4c399 100644
--- a/src/mainboard/asus/k8v-x/acpi_tables.c
+++ b/src/mainboard/asus/k8v-x/acpi_tables.c
@@ -34,25 +34,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -82,94 +63,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..dab35d4 100644
--- a/src/mainboard/asus/m2v-mx_se/acpi_tables.c
+++ b/src/mainboard/asus/m2v-mx_se/acpi_tables.c
@@ -35,25 +35,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -83,114 +64,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..7ad045c 100644
--- a/src/mainboard/asus/m2v/acpi_tables.c
+++ b/src/mainboard/asus/m2v/acpi_tables.c
@@ -36,25 +36,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -84,115 +65,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..0cb3eb2 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 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..22bb02e
--- /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>
+
+
+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,
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 478faf8f98d2769129235b4703a4b0a2314aa90e
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 | 133 +---------------
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 | 114 +-------------
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/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 | 30 ++++
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 +++++
58 files changed, 413 insertions(+), 2862 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..e2fa0f0 100644
--- a/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
@@ -32,25 +32,6 @@
#include "southbridge/via/vt8237r/vt8237r.h"
#include "southbridge/via/k8t890/k8t890.h"
-extern const unsigned char AmlCode[];
-
-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)
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -80,77 +61,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..2a874db 100644
--- a/src/mainboard/asus/a8v-e_se/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_se/acpi_tables.c
@@ -34,25 +34,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -82,94 +63,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..da4c399 100644
--- a/src/mainboard/asus/k8v-x/acpi_tables.c
+++ b/src/mainboard/asus/k8v-x/acpi_tables.c
@@ -34,25 +34,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -82,94 +63,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..dab35d4 100644
--- a/src/mainboard/asus/m2v-mx_se/acpi_tables.c
+++ b/src/mainboard/asus/m2v-mx_se/acpi_tables.c
@@ -35,25 +35,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -83,114 +64,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..8fa0537 100644
--- a/src/mainboard/asus/m2v/acpi_tables.c
+++ b/src/mainboard/asus/m2v/acpi_tables.c
@@ -36,29 +36,12 @@
#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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
+ get_bus_conf();
+
/* Create all subtables for processors. */
current = acpi_create_madt_lapics(current);
@@ -84,115 +67,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..732a93e 100644
--- a/src/mainboard/iwill/dk8_htx/acpi_tables.c
+++ b/src/mainboard/iwill/dk8_htx/acpi_tables.c
@@ -19,22 +19,7 @@
#include <cpu/amd/amdk8_sysconf.h>
#include "northbridge/amd/amdk8/acpi.h"
#include "mb_sysconf.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;
-}
-
+#include "mainboard.h"
unsigned long acpi_fill_madt(unsigned long current)
{
@@ -42,6 +27,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 +124,8 @@ 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 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 +137,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 +174,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..22bb02e
--- /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>
+
+
+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/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..bba5833 100644
--- a/src/southbridge/amd/amd8111/lpc.c
+++ b/src/southbridge/amd/amd8111/lpc.c
@@ -11,7 +11,12 @@
#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>
+#endif
#include <stdlib.h>
+#include <string.h>
#include "amd8111.h"
#define NMI_OFF 0
@@ -112,6 +117,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 +147,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,
Isaac Christensen (isaac.christensen(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6959
-gerrit
commit c3b5d377abac763794adcfd66ca190681e7697b4
Author: Hung-Te Lin <hungte(a)chromium.org>
Date: Fri Feb 21 16:21:00 2014 +0800
vendorcode: Add ChromeOS VPD parser.
Copied (and unmodified) the minimal bits from ChromeOS libVPD:
https://chromium.googlesource.com/chromiumos/platform/vpd
Old-Change-Id: Id75d1bfd16263ac1b94c22979f9892cf7908d5e6
Signed-off-by: Hung-Te Lin <hungte(a)chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/187411
Reviewed-by: Yung-chieh Lo <yjlou(a)chromium.org>
(cherry picked from commit a10ca23686299f3fd5b639631242cadaa2ca9e8a)
vendorcode: Update ChromeOS VPD Parser.
Merge recent changes in ChromeOS VPD that allows non-memory-mapped firmware
to load VPD easier and faster (ref:
https://chromium-review.googlesource.com/188134 ).
Old-Change-Id: I3ee0b89c703f476f3d77cdde52cc7588724f7686
Reviewed-on: https://chromium-review.googlesource.com/188743
Tested-by: Hung-Te Lin <hungte(a)chromium.org>
Reviewed-by: Yung-chieh Lo <yjlou(a)chromium.org>
Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
Commit-Queue: Hung-Te Lin <hungte(a)chromium.org>
(cherry picked from commit 03f4d521a7fa711b963b0e1822e92eac16a691b1)
vendorcode: Access to ChromeOS VPD on default CBFS media.
The new function "cros_vpd_gets(key, buf, size)" provides an easy and quick way
to retrieve values in ChromeOS VPD section.
Old-Change-Id: I38e50615e515707ffaecdc4c4fae65043541b687
Signed-off-by: Hung-Te Lin <hungte(a)chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/187430
Reviewed-by: Yung-chieh Lo <yjlou(a)chromium.org>
(cherry picked from commit bcd3832c06e8ed357c50f19396da21a218dc4b39)
Squashed 3 related commits for a ChromeOS VPD parser.
Change-Id: I4ba8fce16ea123c78d7b543c8353ab9bc1e2aa9f
Signed-off-by: Isaac Christensen <isaac.christensen(a)se-eng.com>
---
src/vendorcode/google/chromeos/Makefile.inc | 2 +
src/vendorcode/google/chromeos/cros_vpd.c | 140 +++++++++++++++++
src/vendorcode/google/chromeos/cros_vpd.h | 21 +++
src/vendorcode/google/chromeos/lib_vpd.h | 226 ++++++++++++++++++++++++++++
src/vendorcode/google/chromeos/vpd_decode.c | 90 +++++++++++
src/vendorcode/google/chromeos/vpd_tables.h | 114 ++++++++++++++
6 files changed, 593 insertions(+)
diff --git a/src/vendorcode/google/chromeos/Makefile.inc b/src/vendorcode/google/chromeos/Makefile.inc
index b9e42da..d02c09f 100644
--- a/src/vendorcode/google/chromeos/Makefile.inc
+++ b/src/vendorcode/google/chromeos/Makefile.inc
@@ -28,6 +28,8 @@ romstage-y += fmap.c
ramstage-y += fmap.c
ramstage-$(CONFIG_CHROMEOS_RAMOOPS) += ramoops.c
smm-y += fmap.c
+romstage-y += vpd_decode.c cros_vpd.c
+ramstage-y += vpd_decode.c cros_vpd.c
ifeq ($(MOCK_TPM),1)
CFLAGS_common += -DMOCK_TPM=1
diff --git a/src/vendorcode/google/chromeos/cros_vpd.c b/src/vendorcode/google/chromeos/cros_vpd.c
new file mode 100644
index 0000000..26b01ee
--- /dev/null
+++ b/src/vendorcode/google/chromeos/cros_vpd.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <console/console.h>
+
+#include <cbfs.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "cros_vpd.h"
+#include "fmap.h"
+#include "lib_vpd.h"
+#include "vpd_tables.h"
+
+/*
+ * Static variables are available in ramstage (all platforms), and romstage for
+ * some platforms (ex, ARM, which uses SRAM).
+ */
+#if defined(__PRE_RAM__) && CONFIG_ARCH_X86
+#define STATIC_VAR
+#else
+#define STATIC_VAR static
+#endif
+
+/* Currently we only support Google VPD 2.0, which has a fixed offset. */
+enum {
+ GOOGLE_VPD_2_0_OFFSET = 0x600,
+};
+
+struct vpd_gets_arg {
+ const uint8_t *key;
+ const uint8_t *value;
+ int32_t key_len, value_len;
+ int matched;
+};
+
+static int cros_vpd_load(uint8_t **vpd_address, int32_t *vpd_size)
+{
+ STATIC_VAR int cached = 0;
+ STATIC_VAR uint8_t *cached_address = NULL;
+ STATIC_VAR int32_t cached_size = 0;
+ STATIC_VAR int result = -1;
+ struct google_vpd_info info;
+ int32_t base;
+
+ const struct fmap_area *area;
+ struct cbfs_media media;
+
+ if (cached) {
+ *vpd_address = cached_address;
+ *vpd_size = cached_size;
+ return result;
+ }
+
+ cached = 1;
+ area = find_fmap_area(fmap_find(), "RO_VPD");
+ if (!area) {
+ printk(BIOS_ERR, "%s: No RO_VPD FMAP section.\n", __func__);
+ return result;
+ }
+ if (area->size <= GOOGLE_VPD_2_0_OFFSET + sizeof(info)) {
+ printk(BIOS_ERR, "%s: Too small (%d) for Google VPD 2.0.\n",
+ __func__, area->size);
+ return result;
+ }
+
+ base = area->offset + GOOGLE_VPD_2_0_OFFSET;
+ cached_size = area->size - GOOGLE_VPD_2_0_OFFSET;
+ init_default_cbfs_media(&media);
+ media.open(&media);
+
+ /* Try if we can find a google_vpd_info, otherwise read whole VPD. */
+ if (media.read(&media, &info, base, sizeof(info)) == sizeof(info) &&
+ memcmp(info.header.magic, VPD_INFO_MAGIC, sizeof(info.header.magic))
+ == 0 && cached_size >= info.size + sizeof(info)) {
+ base += sizeof(info);
+ cached_size = info.size;
+ }
+
+ cached_address = media.map(&media, base, cached_size);
+ media.close(&media);
+ if (cached_address) {
+ *vpd_address = cached_address;
+ *vpd_size = cached_size;
+ printk(BIOS_DEBUG, "%s: Got VPD: %#x+%#x\n", __func__, base,
+ cached_size);
+ result = 0;
+ }
+ return result;
+}
+
+static int vpd_gets_callback(const uint8_t *key, int32_t key_len,
+ const uint8_t *value, int32_t value_len,
+ void *arg)
+{
+ struct vpd_gets_arg *result = (struct vpd_gets_arg *)arg;
+ if (key_len != result->key_len ||
+ memcmp(key, result->key, key_len) != 0)
+ /* Returns VPD_OK to continue parsing. */
+ return VPD_OK;
+
+ result->matched = 1;
+ result->value = value;
+ result->value_len = value_len;
+ /* Returns VPD_FAIL to stop parsing. */
+ return VPD_FAIL;
+}
+
+char *cros_vpd_gets(const char *key, char *buffer, int size)
+{
+ uint8_t *vpd_address = NULL;
+ int32_t vpd_size = 0;
+ struct vpd_gets_arg arg = {0};
+ int consumed = 0;
+
+ if (cros_vpd_load(&vpd_address, &vpd_size) != 0) {
+ return NULL;
+ }
+
+ arg.key = (const uint8_t *)key;
+ arg.key_len = strlen(key);
+
+ while (VPD_OK == decodeVpdString(vpd_size, vpd_address, &consumed,
+ vpd_gets_callback, &arg)) {
+ /* Iterate until found or no more entries. */
+ }
+
+ if (!arg.matched)
+ return NULL;
+
+ if (size < arg.value_len + 1)
+ size = arg.value_len + 1;
+ memcpy(buffer, arg.value, size - 1);
+ buffer[size - 1] = '\0';
+ return buffer;
+}
+
diff --git a/src/vendorcode/google/chromeos/cros_vpd.h b/src/vendorcode/google/chromeos/cros_vpd.h
new file mode 100644
index 0000000..674dbf6
--- /dev/null
+++ b/src/vendorcode/google/chromeos/cros_vpd.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __CROS_VPD_H__
+#define __CROS_VPD_H__
+
+/*
+ * Reads VPD string value by key.
+ *
+ * Reads in at most one less than size characters from VPD and stores them
+ * into buffer. A terminating null byte ('\0') is stored after the last
+ * character in the buffer.
+ *
+ * Returns NULL if key is not found, otherwise buffer.
+ */
+char *cros_vpd_gets(const char *key, char *buffer, int size);
+
+#endif /* __CROS_VPD_H__ */
diff --git a/src/vendorcode/google/chromeos/lib_vpd.h b/src/vendorcode/google/chromeos/lib_vpd.h
new file mode 100644
index 0000000..e08cb3a
--- /dev/null
+++ b/src/vendorcode/google/chromeos/lib_vpd.h
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ */
+
+#ifndef __LIB_VPD__
+#define __LIB_VPD__
+
+#include <inttypes.h>
+
+enum {
+ VPD_OK = 0,
+ VPD_FAIL,
+};
+
+enum {
+ VPD_TYPE_TERMINATOR = 0,
+ VPD_TYPE_STRING,
+ VPD_TYPE_INFO = 0xfe,
+ VPD_TYPE_IMPLICIT_TERMINATOR = 0xff,
+};
+
+enum {
+ VPD_AS_LONG_AS = -1,
+};
+
+enum { /* export_type */
+ VPD_EXPORT_KEY_VALUE = 1,
+ VPD_EXPORT_VALUE,
+ VPD_EXPORT_AS_PARAMETER,
+};
+
+/* Callback for decodeVpdString to invoke. */
+typedef int VpdDecodeCallback(const uint8_t *key, int32_t key_len,
+ const uint8_t *value, int32_t value_len,
+ void *arg);
+
+/* Container data types */
+struct StringPair {
+ uint8_t *key;
+ uint8_t *value;
+ int pad_len;
+ int filter_out; /* TRUE means not exported. */
+ struct StringPair *next;
+};
+
+struct PairContainer {
+ struct StringPair *first;
+};
+
+
+/***********************************************************************
+ * Encode and decode VPD entries
+ ***********************************************************************/
+
+/* Encodes the len into multiple bytes with the following format.
+ *
+ * 7 6 ............ 0
+ * +----+------------------+
+ * |More| Length | ...
+ * +----+------------------+
+ *
+ * The encode_buf points to the actual position we are going to store.
+ * encoded_len will return the exact bytes we encoded in this function.
+ * Returns fail if the buffer is not long enough.
+ */
+int encodeLen(
+ const int32_t len,
+ uint8_t *encode_buf,
+ const int32_t max_len,
+ int32_t *encoded_len);
+
+/* Given an encoded string, this functions decodes the length field which varies
+ * from 1 byte to many bytes.
+ *
+ * The in points the actual byte going to be decoded. The *length returns
+ * the decoded length field. The number of consumed bytes will be stroed in
+ * decoded_len.
+ *
+ * Returns VPD_FAIL if more bit is 1, but actually reaches the end of string.
+ */
+int decodeLen(
+ const int32_t max_len,
+ const uint8_t *in,
+ int32_t *length,
+ int32_t *decoded_len);
+
+
+/* Encodes the terminator.
+ * When calling, the output_buf should point to the start of buffer while
+ * *generated_len should contain how many bytes exist in buffer now.
+ * After return, *generated_len would be plused the number of bytes generated
+ * in this function.
+ */
+int encodeVpdTerminator(
+ const int max_buffer_len,
+ uint8_t *output_buf,
+ int *generated_len);
+
+/* Encodes the given type/key/value pair into buffer.
+ *
+ * The pad_value_len is used to control the output value length.
+ * When pad_value_len > 0, the value is outputted into fixed length (pad \0
+ * if the value is shorter). Truncated if too long.
+ * pad_value_len == VPD_NO_LIMIT, output the value as long as possible.
+ * This is useful when we want to fix the structure layout at beginning.
+ *
+ * The encoded string will be stored in output_buf. If it is longer than
+ * max_buffer_len, this function returns fail. If the buffer is long enough,
+ * the generated_len will be updated.
+ *
+ * When calling, the output_buf should point to the start of buffer while
+ * *generated_len should contain how many bytes exist in buffer now.
+ * After return, *generated_len would be plused the number of bytes generated
+ * in this function.
+ *
+ * The initial value of *generated_len can be non-zero, so that this value
+ * can be used between multiple calls to encodeVpd2Pair().
+ */
+int encodeVpdString(
+ const uint8_t *key,
+ const uint8_t *value,
+ const int pad_value_len,
+ const int max_buffer_len,
+ uint8_t *output_buf,
+ int *generated_len);
+
+
+/* Given the encoded string, this function invokes callback with extracted
+ * (key, value). The *consumed will be plused the number of bytes consumed in
+ * this function.
+ *
+ * The input_buf points to the first byte of the input buffer.
+ *
+ * The *consumed starts from 0, which is actually the next byte to be decoded.
+ * It can be non-zero to be used in multiple calls.
+ *
+ * If one entry is successfully decoded, sends it to callback and returns the
+ * result.
+ */
+int decodeVpdString(
+ const int32_t max_len,
+ const uint8_t *input_buf,
+ int32_t *consumed,
+ VpdDecodeCallback callback,
+ void *callback_arg);
+
+/***********************************************************************
+ * Container helpers
+ ***********************************************************************/
+void initContainer(struct PairContainer *container);
+
+struct StringPair *findString(struct PairContainer *container,
+ const uint8_t *key,
+ struct StringPair ***prev_next);
+
+/* If key is already existed in container, its value will be replaced.
+ * If not existed, creates new entry in container.
+ */
+void setString(struct PairContainer *container,
+ const uint8_t *key,
+ const uint8_t *value,
+ const int pad_len);
+
+/* merge all entries in src into dst. If key is duplicate, overwrite it.
+ */
+void mergeContainer(struct PairContainer *dst,
+ const struct PairContainer *src);
+
+/* subtract src from dst.
+*/
+int subtractContainer(struct PairContainer *dst,
+ const struct PairContainer *src);
+
+/* Given a container, encode its all entries into the buffer.
+ */
+int encodeContainer(const struct PairContainer *container,
+ const int max_buf_len,
+ uint8_t *buf,
+ int *generated);
+
+/* Given a VPD blob, decode its entries and push into container.
+ */
+int decodeToContainer(struct PairContainer *container,
+ const int32_t max_len,
+ const uint8_t *input_buf,
+ int32_t *consumed);
+
+/* Set filter for exporting functions.
+ * If filter is NULL, resets the filter so that everything can be exported.
+ */
+int setContainerFilter(struct PairContainer *container,
+ const uint8_t *filter);
+
+/*
+ * Remove a key.
+ * Returns VPD_OK if deleted successfully. Otherwise, VPD_FAIL.
+ */
+int deleteKey(struct PairContainer *container,
+ const uint8_t *key);
+
+/*
+ * Returns number of pairs in container.
+ */
+int lenOfContainer(const struct PairContainer *container);
+
+/*
+ * Export the container content with human-readable text.
+ *
+ * The buf points to the first byte of buffer and *generated contains the number
+ * of bytes already existed in buffer.
+ *
+ * Afterward, the *generated will be plused on exact bytes this function has
+ * generated.
+ */
+int exportContainer(const int export_type,
+ const struct PairContainer *container,
+ const int max_buf_len,
+ uint8_t *buf,
+ int *generated);
+
+void destroyContainer(struct PairContainer *container);
+
+#endif /* __LIB_VPD__ */
diff --git a/src/vendorcode/google/chromeos/vpd_decode.c b/src/vendorcode/google/chromeos/vpd_decode.c
new file mode 100644
index 0000000..6f8f680
--- /dev/null
+++ b/src/vendorcode/google/chromeos/vpd_decode.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ */
+#include <assert.h>
+#include <console/console.h>
+#include "lib_vpd.h"
+
+int decodeLen(
+ const int32_t max_len,
+ const uint8_t *in,
+ int32_t *length,
+ int32_t *decoded_len) {
+ uint8_t more;
+ int i = 0;
+
+ ASSERT(length);
+ ASSERT(decoded_len);
+
+ *length = 0;
+ do {
+ if (i >= max_len) return VPD_FAIL;
+ more = in[i] & 0x80;
+ *length <<= 7;
+ *length |= in[i] & 0x7f;
+ ++i;
+ } while (more);
+
+ *decoded_len = i;
+
+ return VPD_OK;
+}
+
+/* Sequentially decodes type, key, and value.
+ */
+int decodeVpdString(
+ const int32_t max_len,
+ const uint8_t *input_buf,
+ int32_t *consumed,
+ VpdDecodeCallback callback,
+ void *callback_arg) {
+ int type;
+ int32_t key_len, value_len;
+ int32_t decoded_len;
+ const uint8_t *key, *value;
+
+ /* type */
+ if (*consumed >= max_len)
+ return VPD_FAIL;
+
+ type = input_buf[*consumed];
+ switch (type) {
+ case VPD_TYPE_INFO:
+ case VPD_TYPE_STRING:
+ (*consumed)++;
+
+ /* key */
+ if (VPD_OK != decodeLen(max_len - *consumed, &input_buf[*consumed],
+ &key_len, &decoded_len) ||
+ *consumed + decoded_len >= max_len) {
+ return VPD_FAIL;
+ }
+
+ *consumed += decoded_len;
+ key = &input_buf[*consumed];
+ *consumed += key_len;
+
+ /* value */
+ if (VPD_OK != decodeLen(max_len - *consumed, &input_buf[*consumed],
+ &value_len, &decoded_len) ||
+ *consumed + decoded_len > max_len) {
+ return VPD_FAIL;
+ }
+ *consumed += decoded_len;
+ value = &input_buf[*consumed];
+ *consumed += value_len;
+
+ if (type == VPD_TYPE_STRING)
+ return callback(key, key_len, value, value_len, callback_arg);
+
+ return VPD_OK;
+
+ default:
+ return VPD_FAIL;
+ break;
+ }
+ return VPD_OK;
+}
diff --git a/src/vendorcode/google/chromeos/vpd_tables.h b/src/vendorcode/google/chromeos/vpd_tables.h
new file mode 100644
index 0000000..d58b5e8
--- /dev/null
+++ b/src/vendorcode/google/chromeos/vpd_tables.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Ported from mosys project (http://code.google.com/p/mosys/ ).
+ */
+
+#ifndef __LIB_VPD_TABLES_H__
+#define __LIB_VPD_TABLES_H__
+
+#include <inttypes.h>
+
+#define VPD_ENTRY_MAGIC "_SM_"
+#define VPD_INFO_MAGIC \
+ "\xfe" /* type: VPD header */ \
+ "\x09" /* key length, 9 = 1 + 8 */ \
+ "\x01" /* info version, 1 */ \
+ "gVpdInfo" /* signature, 8 bytes */ \
+ "\x04" /* value length */
+
+/* Google specific VPD info */
+struct google_vpd_info {
+ union {
+ struct {
+ uint8_t type;
+ uint8_t key_len;
+ uint8_t info_ver;
+ uint8_t signature[8];
+ uint8_t value_len;
+ } tlv;
+ uint8_t magic[12];
+ } header;
+ uint32_t size;
+} __attribute__((packed));
+
+/* Entry */
+struct vpd_entry {
+ uint8_t anchor_string[4];
+ uint8_t entry_cksum;
+ uint8_t entry_length;
+ uint8_t major_ver;
+ uint8_t minor_ver;
+ uint16_t max_size;
+ uint8_t entry_rev;
+ uint8_t format_area[5];
+ uint8_t inter_anchor_string[5];
+ uint8_t inter_anchor_cksum;
+ uint16_t table_length;
+ uint32_t table_address;
+ uint16_t table_entry_count;
+ uint8_t bcd_revision;
+} __attribute__ ((packed));
+
+/* Header */
+struct vpd_header {
+ uint8_t type;
+ uint8_t length;
+ uint16_t handle;
+} __attribute__ ((packed));
+
+/* Type 0 - firmware information */
+struct vpd_table_firmware {
+ uint8_t vendor;
+ uint8_t version;
+ uint16_t start_address;
+ uint8_t release_date;
+ uint8_t rom_size_64k_blocks;
+ uint32_t characteristics;
+ uint8_t extension[2]; /* v2.4+ */
+ uint8_t major_ver; /* v2.4+ */
+ uint8_t minor_ver; /* v2.4+ */
+ uint8_t ec_major_ver; /* v2.4+ */
+ uint8_t ec_minor_ver; /* v2.4+ */
+} __attribute__ ((packed));
+
+/* Type 1 - system information */
+struct vpd_table_system {
+ uint8_t manufacturer;
+ uint8_t name;
+ uint8_t version;
+ uint8_t serial_number;
+ uint8_t uuid[16];
+ uint8_t wakeup_type;
+ uint8_t sku_number; /* v2.4+ */
+ uint8_t family; /* v2.4+ */
+} __attribute__ ((packed));
+
+/* Type 127 - end of table */
+struct vpd_table_eot {
+ struct vpd_header header;
+} __attribute__ ((packed));
+
+/* Type 241 - binary blob pointer */
+struct vpd_table_binary_blob_pointer {
+ uint8_t struct_major_version;
+ uint8_t struct_minor_version;
+ uint8_t vendor;
+ uint8_t description;
+ uint8_t major_version;
+ uint8_t minor_version;
+ uint8_t variant;
+ uint8_t reserved[5];
+ uint8_t uuid[16];
+ uint32_t offset;
+ uint32_t size;
+} __attribute__ ((packed));
+
+/* The length and number of strings defined here is not a limitation of VPD.
+ * These numbers were deemed good enough during development. */
+#define VPD_MAX_STRINGS 10
+#define VPD_MAX_STRING_LENGTH 64
+
+#endif /* __LIB_VPD_TABLES_H__ */
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 d91dd9ce885c85309c07750fe25d0c14b45094b7
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 | 133 +---------------
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 | 114 +-------------
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/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 | 30 ++++
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 +++++
58 files changed, 413 insertions(+), 2862 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..e2fa0f0 100644
--- a/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
@@ -32,25 +32,6 @@
#include "southbridge/via/vt8237r/vt8237r.h"
#include "southbridge/via/k8t890/k8t890.h"
-extern const unsigned char AmlCode[];
-
-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)
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -80,77 +61,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..2a874db 100644
--- a/src/mainboard/asus/a8v-e_se/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_se/acpi_tables.c
@@ -34,25 +34,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -82,94 +63,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..da4c399 100644
--- a/src/mainboard/asus/k8v-x/acpi_tables.c
+++ b/src/mainboard/asus/k8v-x/acpi_tables.c
@@ -34,25 +34,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -82,94 +63,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..dab35d4 100644
--- a/src/mainboard/asus/m2v-mx_se/acpi_tables.c
+++ b/src/mainboard/asus/m2v-mx_se/acpi_tables.c
@@ -35,25 +35,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -83,114 +64,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..8fa0537 100644
--- a/src/mainboard/asus/m2v/acpi_tables.c
+++ b/src/mainboard/asus/m2v/acpi_tables.c
@@ -36,29 +36,12 @@
#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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
+ get_bus_conf();
+
/* Create all subtables for processors. */
current = acpi_create_madt_lapics(current);
@@ -84,115 +67,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..732a93e 100644
--- a/src/mainboard/iwill/dk8_htx/acpi_tables.c
+++ b/src/mainboard/iwill/dk8_htx/acpi_tables.c
@@ -19,22 +19,7 @@
#include <cpu/amd/amdk8_sysconf.h>
#include "northbridge/amd/amdk8/acpi.h"
#include "mb_sysconf.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;
-}
-
+#include "mainboard.h"
unsigned long acpi_fill_madt(unsigned long current)
{
@@ -42,6 +27,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 +124,8 @@ 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 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 +137,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 +174,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..22bb02e
--- /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>
+
+
+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/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..bba5833 100644
--- a/src/southbridge/amd/amd8111/lpc.c
+++ b/src/southbridge/amd/amd8111/lpc.c
@@ -11,7 +11,12 @@
#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>
+#endif
#include <stdlib.h>
+#include <string.h>
#include "amd8111.h"
#define NMI_OFF 0
@@ -112,6 +117,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 +147,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..06fcbdd 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_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,
Isaac Christensen (isaac.christensen(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6958
-gerrit
commit 27061dae5f8f435a45d19106fec78a8cd77b1124
Author: Gabe Black <gabeblack(a)google.com>
Date: Fri Feb 21 01:01:06 2014 -0800
cbfstool: If compression fails, warn and use the uncompressed data.
The LZMA compression algorithm, currently the only one available, will fail
if you ask it to write more data to the output than you've given it space for.
The code that calls into LZMA allocates an output buffer the same size as the
input, so if compression increases the size of the output the call will fail.
The caller(s) were written to assume that the call succeeded and check the
returned length to see if the size would have increased, but that will never
happen with LZMA.
Rather than try to rework the LZMA library to dynamically resize the output
buffer or try to guess what the maximal size the data could expand to is, this
change makes the caller simply print a warning and disable compression if the
call failed for some reason.
This may lead to images that are larger than necessary if compression fails
for some other reason and the user doesn't notice, but since compression
errors were ignored entirely until very recently that will hopefully not be
a problem in practice, and we should be guarnateed to at least produce a
correct image.
Change-Id: I5f59529c2d48e9c4c2e011018b40ec336c4fcca8
Signed-off-by: Gabe Black <gabeblack(a)google.com>
Reviewed-on: https://chromium-review.googlesource.com/187365
Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
Tested-by: Gabe Black <gabeblack(a)chromium.org>
Commit-Queue: Gabe Black <gabeblack(a)chromium.org>
(cherry picked from commit b9f622a554d5fb9a9aff839c64e11acb27785f13)
Signed-off-by: Isaac Christensen <isaac.christensen(a)se-eng.com>
---
util/cbfstool/cbfs-mkpayload.c | 46 +++++++++++++++++++++++-------------------
util/cbfstool/cbfs-mkstage.c | 14 ++++++++++---
2 files changed, 36 insertions(+), 24 deletions(-)
diff --git a/util/cbfstool/cbfs-mkpayload.c b/util/cbfstool/cbfs-mkpayload.c
index adbe313..08da954 100644
--- a/util/cbfstool/cbfs-mkpayload.c
+++ b/util/cbfstool/cbfs-mkpayload.c
@@ -201,22 +201,24 @@ int parse_elf_to_payload(const struct buffer *input,
segs[segments].type = PAYLOAD_SEGMENT_DATA;
segs[segments].load_addr = phdr[i].p_paddr;
segs[segments].mem_len = phdr[i].p_memsz;
- segs[segments].compression = algo;
segs[segments].offset = doffset;
- int len;
- compress((char *)&header[phdr[i].p_offset],
- phdr[i].p_filesz, output->data + doffset, &len);
- segs[segments].len = len;
-
- /* If the compressed section is larger, then use the
- original stuff */
+ /* If the compression failed or made the section is larger,
+ use the original stuff */
- if ((unsigned int)len > phdr[i].p_filesz) {
+ int len;
+ if (compress((char *)&header[phdr[i].p_offset],
+ phdr[i].p_filesz, output->data + doffset, &len) ||
+ (unsigned int)len > phdr[i].p_filesz) {
+ WARN("Compression failed or would make the data bigger "
+ "- disabled.\n");
segs[segments].compression = 0;
segs[segments].len = phdr[i].p_filesz;
memcpy(output->data + doffset,
&header[phdr[i].p_offset], phdr[i].p_filesz);
+ } else {
+ segs[segments].compression = algo;
+ segs[segments].len = len;
}
doffset += segs[segments].len;
@@ -261,12 +263,13 @@ int parse_flat_binary_to_payload(const struct buffer *input,
segs[0].mem_len = input->size;
segs[0].offset = doffset;
- compress(input->data, input->size, output->data + doffset, &len);
- segs[0].compression = algo;
- segs[0].len = len;
-
- if ((unsigned int)len >= input->size) {
- WARN("Compressing data would make it bigger - disabled.\n");
+ if (!compress(input->data, input->size, output->data + doffset, &len) &&
+ (unsigned int)len < input->size) {
+ segs[0].compression = algo;
+ segs[0].len = len;
+ } else {
+ WARN("Compression failed or would make the data bigger "
+ "- disabled.\n");
segs[0].compression = 0;
segs[0].len = input->size;
memcpy(output->data + doffset, input->data, input->size);
@@ -387,12 +390,13 @@ int parse_fv_to_payload(const struct buffer *input,
segs[0].mem_len = input->size;
segs[0].offset = doffset;
- compress(input->data, input->size, output->data + doffset, &len);
- segs[0].compression = algo;
- segs[0].len = len;
-
- if ((unsigned int)len >= input->size) {
- WARN("Compressing data would make it bigger - disabled.\n");
+ if (!compress(input->data, input->size, output->data + doffset, &len) &&
+ (unsigned int)len < input->size) {
+ segs[0].compression = algo;
+ segs[0].len = len;
+ } else {
+ WARN("Compression failed or would make the data bigger "
+ "- disabled.\n");
segs[0].compression = 0;
segs[0].len = input->size;
memcpy(output->data + doffset, input->data, input->size);
diff --git a/util/cbfstool/cbfs-mkstage.c b/util/cbfstool/cbfs-mkstage.c
index d795c7c..4a2f4d8 100644
--- a/util/cbfstool/cbfs-mkstage.c
+++ b/util/cbfstool/cbfs-mkstage.c
@@ -155,10 +155,18 @@ int parse_elf_to_stage(const struct buffer *input, struct buffer *output,
* to fill out the header. This seems backward but it works because
* - the output header is a known size (not always true in many xdr's)
* - we do need to know the compressed output size first
+ * If compression fails or makes the data bigger, we'll warn about it
+ * and use the original data.
*/
- compress(buffer, data_end - data_start,
- (output->data + sizeof(struct cbfs_stage)),
- &outlen);
+ if (compress(buffer, data_end - data_start,
+ (output->data + sizeof(struct cbfs_stage)),
+ &outlen) < 0 || outlen > data_end - data_start) {
+ WARN("Compression failed or would make the data bigger "
+ "- disabled.\n");
+ memcpy(output->data + sizeof(struct cbfs_stage),
+ buffer, data_end - data_start);
+ algo = CBFS_COMPRESS_NONE;
+ }
free(buffer);
/* Set up for output marshaling. */
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 f9342b9197de46f1feced125cbaa89bc729df8e9
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 | 133 +---------------
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 | 114 +-------------
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/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 | 30 ++++
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 | 7 +
src/southbridge/nvidia/mcp55/lpc.c | 20 +++
src/southbridge/via/k8t890/traf_ctrl.c | 41 +++++
58 files changed, 411 insertions(+), 2862 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..e2fa0f0 100644
--- a/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
@@ -32,25 +32,6 @@
#include "southbridge/via/vt8237r/vt8237r.h"
#include "southbridge/via/k8t890/k8t890.h"
-extern const unsigned char AmlCode[];
-
-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)
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -80,77 +61,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..2a874db 100644
--- a/src/mainboard/asus/a8v-e_se/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_se/acpi_tables.c
@@ -34,25 +34,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -82,94 +63,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..da4c399 100644
--- a/src/mainboard/asus/k8v-x/acpi_tables.c
+++ b/src/mainboard/asus/k8v-x/acpi_tables.c
@@ -34,25 +34,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -82,94 +63,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..dab35d4 100644
--- a/src/mainboard/asus/m2v-mx_se/acpi_tables.c
+++ b/src/mainboard/asus/m2v-mx_se/acpi_tables.c
@@ -35,25 +35,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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
@@ -83,114 +64,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..8fa0537 100644
--- a/src/mainboard/asus/m2v/acpi_tables.c
+++ b/src/mainboard/asus/m2v/acpi_tables.c
@@ -36,29 +36,12 @@
#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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
+ get_bus_conf();
+
/* Create all subtables for processors. */
current = acpi_create_madt_lapics(current);
@@ -84,115 +67,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..732a93e 100644
--- a/src/mainboard/iwill/dk8_htx/acpi_tables.c
+++ b/src/mainboard/iwill/dk8_htx/acpi_tables.c
@@ -19,22 +19,7 @@
#include <cpu/amd/amdk8_sysconf.h>
#include "northbridge/amd/amdk8/acpi.h"
#include "mb_sysconf.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;
-}
-
+#include "mainboard.h"
unsigned long acpi_fill_madt(unsigned long current)
{
@@ -42,6 +27,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 +124,8 @@ 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 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 +137,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 +174,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..22bb02e
--- /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>
+
+
+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/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..bba5833 100644
--- a/src/southbridge/amd/amd8111/lpc.c
+++ b/src/southbridge/amd/amd8111/lpc.c
@@ -11,7 +11,12 @@
#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>
+#endif
#include <stdlib.h>
+#include <string.h>
#include "amd8111.h"
#define NMI_OFF 0
@@ -112,6 +117,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 +147,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..4e0c55f 100644
--- a/src/southbridge/nvidia/mcp55/ht.c
+++ b/src/southbridge/nvidia/mcp55/ht.c
@@ -26,8 +26,15 @@
#include <device/pci.h>
#include <device/pci_ids.h>
#include <device/pci_ops.h>
+#include <arch/acpi.h>
#include "mcp55.h"
+unsigned long acpi_fill_mcfg(unsigned long current)
+{
+ /* Not implemented */
+ return current;
+}
+
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,
Isaac Christensen (isaac.christensen(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6957
-gerrit
commit 67cb9db228d003b05e587484de21aca292308a3c
Author: Kein Yuan <kein.yuan(a)intel.com>
Date: Sat Feb 22 12:26:55 2014 -0800
baytrail/rambi: S3 support and other updates
baytrail: Change all GPIO related pull resistors from 10K to 20K
Reviewed-on: https://chromium-review.googlesource.com/187570
(cherry picked from commit 762e99861dd1ae61ddcf1ebdec8e698ede54405e)
baytrail: workaround kernel using serial console on resume
Reviewed-on: https://chromium-review.googlesource.com/188011
(cherry picked from commit b0da3bdb5b6b417ad6cab0084359d4eae1cb4469)
baytrail: allow dirty cache line evictions for SMRAM to stick
Reviewed-on: https://chromium-review.googlesource.com/188015
(cherry picked from commit 50fb1e6a844e1db05574c92625da23777ad7a0ca)
baytrail: Optionally pull up TDO and TMS to avoid power loss in S3.
Reviewed-on: https://chromium-review.googlesource.com/188260
(cherry picked from commit e240856609b4eed5ed44ec4e021ed385965768d6)
rambi: always load option rom
Reviewed-on: https://chromium-review.googlesource.com/188721
(cherry picked from commit d8a1d108548d20755f8683497c215e76d513b7a9)
baytrail: use new chromeos ram oops API
Reviewed-on: https://chromium-review.googlesource.com/186394
(cherry picked from commit f38e6969df9b5453b10d49be60b5d033d38b4594)
rambi: always show dev/rec screens on eDP connected panel
Reviewed-on: https://chromium-review.googlesource.com/188731
(cherry picked from commit 7d8570ac52f68492a2250fa536d55f7cbbd9ef95)
baytrail: stop e820 reserving default SMM region
Reviewed-on: https://chromium-review.googlesource.com/189084
(cherry picked from commit 6fce823512f5db5a09a9c89048334c3524c69a24)
baytrai: update MRC wrapper header
Reviewed-on: https://chromium-review.googlesource.com/189196
(cherry picked from commit 36b33a25b6603b6a74990b00d981226440b68970)
rambi: Put LPE device into ACPI mode
Reviewed-on: https://chromium-review.googlesource.com/189371
(cherry picked from commit 5955350cd57fd1b3732b6db62911d824712a5413)
baytrail: DPTF: Enable mainboard-specific PPCC
Reviewed-on: https://chromium-review.googlesource.com/189576
(cherry picked from commit 27fae3e670244b529b7c0241742fc2b55d52c612)
baytrail: Add config option for PCIe wake
Reviewed-on: https://chromium-review.googlesource.com/189994
(cherry picked from commit 1cc31a7c021ec84311f1d4e89dd3e57ca8801ab5)
rambi: Enable PCIe wake
Reviewed-on: https://chromium-review.googlesource.com/189995
(cherry picked from commit c98ae1fee54cfb2b3d3c21a19cdbbf56a0bfa1e6)
Squashed 13 commits for baytrail/rambi.
Change-Id: I153ef5a43e2bede05cfd624f53e24a0013fd8fb4
Signed-off-by: Isaac Christensen <isaac.christensen(a)se-eng.com>
---
src/mainboard/google/rambi/Kconfig | 1 +
src/mainboard/google/rambi/acpi/dptf.asl | 21 ++++++++++++++
src/mainboard/google/rambi/devicetree.cb | 6 +++-
src/mainboard/google/rambi/mainboard.c | 8 ++---
src/soc/intel/baytrail/Kconfig | 1 +
src/soc/intel/baytrail/acpi/dptf/cpu.asl | 23 +++------------
src/soc/intel/baytrail/acpi/southcluster.asl | 4 ---
src/soc/intel/baytrail/baytrail/gpio.h | 42 ++++++++++++++++++---------
src/soc/intel/baytrail/baytrail/iosf.h | 8 +++++
src/soc/intel/baytrail/baytrail/mrc_wrapper.h | 17 +++++++++--
src/soc/intel/baytrail/baytrail/ramstage.h | 3 +-
src/soc/intel/baytrail/baytrail/smm.h | 8 ++++-
src/soc/intel/baytrail/chip.c | 2 +-
src/soc/intel/baytrail/chip.h | 10 +++++--
src/soc/intel/baytrail/cpu.c | 15 ++++++++++
src/soc/intel/baytrail/gpio.c | 12 ++++++--
src/soc/intel/baytrail/northcluster.c | 18 ++++--------
src/soc/intel/baytrail/pcie.c | 6 ++++
src/soc/intel/baytrail/ramstage.c | 8 ++---
src/soc/intel/baytrail/smm.c | 17 ++++++-----
src/soc/intel/baytrail/southcluster.c | 41 ++++++++++++++++++++++++++
21 files changed, 194 insertions(+), 77 deletions(-)
diff --git a/src/mainboard/google/rambi/Kconfig b/src/mainboard/google/rambi/Kconfig
index f784aed..e3f5bef 100644
--- a/src/mainboard/google/rambi/Kconfig
+++ b/src/mainboard/google/rambi/Kconfig
@@ -12,6 +12,7 @@ config BOARD_SPECIFIC_OPTIONS
select HAVE_OPTION_TABLE
select HAVE_ACPI_RESUME
select MAINBOARD_HAS_CHROMEOS
+ select ALWAYS_LOAD_OPROM
config VBOOT_RAMSTAGE_INDEX
hex
diff --git a/src/mainboard/google/rambi/acpi/dptf.asl b/src/mainboard/google/rambi/acpi/dptf.asl
index 975c939..507b7c6 100644
--- a/src/mainboard/google/rambi/acpi/dptf.asl
+++ b/src/mainboard/google/rambi/acpi/dptf.asl
@@ -49,5 +49,26 @@ Name (DTRT, Package () {
Package () { \_SB.DPTF.TCPU, \_SB.DPTF.TSR2, 100, 600, 0, 0, 0, 0 },
})
+Name (MPPC, Package ()
+{
+ 0x2, // Revision
+ Package () { // Power Limit 1
+ 0, // PowerLimitIndex, 0 for Power Limit 1
+ 1600, // PowerLimitMinimum
+ 6200, // PowerLimitMaximum
+ 1000, // TimeWindowMinimum
+ 1000, // TimeWindowMaximum
+ 200 // StepSize
+ },
+ Package () { // Power Limit 2
+ 1, // PowerLimitIndex, 1 for Power Limit 2
+ 8000, // PowerLimitMinimum
+ 8000, // PowerLimitMaximum
+ 1000, // TimeWindowMinimum
+ 1000, // TimeWindowMaximum
+ 1000 // StepSize
+ }
+})
+
/* Include Baytrail DPTF */
#include <soc/intel/baytrail/acpi/dptf/dptf.asl>
diff --git a/src/mainboard/google/rambi/devicetree.cb b/src/mainboard/google/rambi/devicetree.cb
index 95b2b3a..5d9eec5 100644
--- a/src/mainboard/google/rambi/devicetree.cb
+++ b/src/mainboard/google/rambi/devicetree.cb
@@ -32,8 +32,12 @@ chip soc/intel/baytrail
register "sdcard_cap_high" = "0x0"
# Enable devices in ACPI mode
- register "scc_acpi_mode" = "1"
+ register "lpe_acpi_mode" = "1"
register "lpss_acpi_mode" = "1"
+ register "scc_acpi_mode" = "1"
+
+ # Allow PCIe devices to wake system from suspend
+ register "pcie_wake_enable" = "1"
# Enable PIPEA as DP_C
register "gpu_pipea_hotplug" = "6" # 6ms Pulse
diff --git a/src/mainboard/google/rambi/mainboard.c b/src/mainboard/google/rambi/mainboard.c
index f8c80ae..19579fb 100644
--- a/src/mainboard/google/rambi/mainboard.c
+++ b/src/mainboard/google/rambi/mainboard.c
@@ -67,15 +67,15 @@ static int int15_handler(void)
* Boot Display Device Hook:
* bit 0 = CRT
* bit 1 = TV (eDP) *
- * bit 2 = EFP *
+ * bit 2 = EFP
* bit 3 = LFP
* bit 4 = CRT2
- * bit 5 = TV2 (eDP) *
- * bit 6 = EFP2 *
+ * bit 5 = TV2 (eDP)
+ * bit 6 = EFP2
* bit 7 = LFP2
*/
X86_AX = 0x005f;
- X86_CX = 0x0006;
+ X86_CX = 0x0002;
res = 1;
break;
case 0x5f51:
diff --git a/src/soc/intel/baytrail/Kconfig b/src/soc/intel/baytrail/Kconfig
index f36394e..425f6a0 100644
--- a/src/soc/intel/baytrail/Kconfig
+++ b/src/soc/intel/baytrail/Kconfig
@@ -10,6 +10,7 @@ config CPU_SPECIFIC_OPTIONS
select ARCH_BOOTBLOCK_X86_32
select ARCH_ROMSTAGE_X86_32
select ARCH_RAMSTAGE_X86_32
+ select BACKUP_DEFAULT_SMM_REGION
select CACHE_MRC_SETTINGS
select CAR_MIGRATION
select COLLECT_TIMESTAMPS
diff --git a/src/soc/intel/baytrail/acpi/dptf/cpu.asl b/src/soc/intel/baytrail/acpi/dptf/cpu.asl
index 89f9b8b..87f1d19 100644
--- a/src/soc/intel/baytrail/acpi/dptf/cpu.asl
+++ b/src/soc/intel/baytrail/acpi/dptf/cpu.asl
@@ -127,26 +127,11 @@ Device (TCPU)
}
}
- Name (PPCC, Package ()
+ /* Return PPCC table defined by mainboard */
+ Method (PPCC)
{
- 0x2, // Revision
- Package () { // Power Limit 1
- 0, // PowerLimitIndex, 0 for Power Limit 1
- 1600, // PowerLimitMinimum
- 6200, // PowerLimitMaximum
- 1000, // TimeWindowMinimum
- 1000, // TimeWindowMaximum
- 200 // StepSize
- },
- Package () { // Power Limit 2
- 1, // PowerLimitIndex, 1 for Power Limit 2
- 8000, // PowerLimitMinimum
- 8000, // PowerLimitMaximum
- 1000, // TimeWindowMinimum
- 1000, // TimeWindowMaximum
- 1000 // StepSize
- }
- })
+ Return (\_SB.MPPC)
+ }
#ifdef DPTF_CPU_CRITICAL
Method (_CRT)
diff --git a/src/soc/intel/baytrail/acpi/southcluster.asl b/src/soc/intel/baytrail/acpi/southcluster.asl
index fac252f..5382182 100644
--- a/src/soc/intel/baytrail/acpi/southcluster.asl
+++ b/src/soc/intel/baytrail/acpi/southcluster.asl
@@ -198,10 +198,6 @@ Device (PDRC)
Memory32Fixed(ReadWrite, MPHY_BASE_ADDRESS, MPHY_BASE_SIZE)
Memory32Fixed(ReadWrite, PUNIT_BASE_ADDRESS, PUNIT_BASE_SIZE)
Memory32Fixed(ReadWrite, RCBA_BASE_ADDRESS, RCBA_BASE_SIZE)
-#if CONFIG_CHROMEOS_RAMOOPS
- Memory32Fixed(ReadWrite, CONFIG_CHROMEOS_RAMOOPS_RAM_START,
- CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE)
-#endif
})
// Current Resource Settings
diff --git a/src/soc/intel/baytrail/baytrail/gpio.h b/src/soc/intel/baytrail/baytrail/gpio.h
index a5ba6a3..a431324 100644
--- a/src/soc/intel/baytrail/baytrail/gpio.h
+++ b/src/soc/intel/baytrail/baytrail/gpio.h
@@ -163,6 +163,13 @@
.use_sel = GPIO_USE_MMIO, \
.is_gpio = 1 }
+#define GPIO_INPUT_PU_20K \
+ { .pad_conf0 = PAD_PU_20K | PAD_PULL_UP | PAD_CONFIG0_DEFAULT, \
+ .pad_conf1 = PAD_CONFIG1_DEFAULT, \
+ .pad_val = PAD_VAL_INPUT, \
+ .use_sel = GPIO_USE_MMIO, \
+ .is_gpio = 1 }
+
#define GPIO_INPUT_PD_10K \
{ .pad_conf0 = PAD_PU_10K | PAD_PULL_DOWN | PAD_CONFIG0_DEFAULT, \
.pad_conf1 = PAD_CONFIG1_DEFAULT, \
@@ -170,15 +177,22 @@
.use_sel = GPIO_USE_MMIO, \
.is_gpio = 1 }
+#define GPIO_INPUT_PD_20K \
+ { .pad_conf0 = PAD_PU_20K | PAD_PULL_DOWN | PAD_CONFIG0_DEFAULT, \
+ .pad_conf1 = PAD_CONFIG1_DEFAULT, \
+ .pad_val = PAD_VAL_INPUT, \
+ .use_sel = GPIO_USE_MMIO, \
+ .is_gpio = 1 }
+
#define GPIO_INPUT_NOPU \
- { .pad_conf0 = PAD_PU_10K | PAD_PULL_DISABLE | PAD_CONFIG0_DEFAULT, \
+ { .pad_conf0 = PAD_PU_20K | PAD_PULL_DISABLE | PAD_CONFIG0_DEFAULT, \
.pad_conf1 = PAD_CONFIG1_DEFAULT, \
.pad_val = PAD_VAL_INPUT, \
.use_sel = GPIO_USE_MMIO, \
.is_gpio = 1 }
#define GPIO_INPUT_LEGACY_NOPU \
- { .pad_conf0 = PAD_PU_10K | PAD_PULL_DISABLE | PAD_CONFIG0_DEFAULT, \
+ { .pad_conf0 = PAD_PU_20K | PAD_PULL_DISABLE | PAD_CONFIG0_DEFAULT, \
.pad_conf1 = PAD_CONFIG1_DEFAULT, \
.pad_val = PAD_VAL_INPUT, \
.use_sel = GPIO_USE_LEGACY, \
@@ -187,7 +201,7 @@
/* Direct / dedicated IRQ input - pass signal directly to apic */
#define GPIO_DIRQ \
- { .pad_conf0 = PAD_PU_10K | PAD_PULL_DISABLE | PAD_CONFIG0_DEFAULT \
+ { .pad_conf0 = PAD_PU_20K | PAD_PULL_DISABLE | PAD_CONFIG0_DEFAULT \
| PAD_FUNC0 | PAD_IRQ_EN | PAD_TPE_IRQ | PAD_LEVEL_IRQ, \
.pad_conf1 = PAD_CONFIG1_DEFAULT, \
.pad_val = PAD_VAL_INPUT, }
@@ -220,13 +234,13 @@
.pad_val = PAD_VAL_DEFAULT }
/* Default functional configs -- no PU */
-#define GPIO_FUNC0 GPIO_FUNC(0, PULL_DISABLE, 10K)
-#define GPIO_FUNC1 GPIO_FUNC(1, PULL_DISABLE, 10K)
-#define GPIO_FUNC2 GPIO_FUNC(2, PULL_DISABLE, 10K)
-#define GPIO_FUNC3 GPIO_FUNC(3, PULL_DISABLE, 10K)
-#define GPIO_FUNC4 GPIO_FUNC(4, PULL_DISABLE, 10K)
-#define GPIO_FUNC5 GPIO_FUNC(5, PULL_DISABLE, 10K)
-#define GPIO_FUNC6 GPIO_FUNC(6, PULL_DISABLE, 10K)
+#define GPIO_FUNC0 GPIO_FUNC(0, PULL_DISABLE, 20K)
+#define GPIO_FUNC1 GPIO_FUNC(1, PULL_DISABLE, 20K)
+#define GPIO_FUNC2 GPIO_FUNC(2, PULL_DISABLE, 20K)
+#define GPIO_FUNC3 GPIO_FUNC(3, PULL_DISABLE, 20K)
+#define GPIO_FUNC4 GPIO_FUNC(4, PULL_DISABLE, 20K)
+#define GPIO_FUNC5 GPIO_FUNC(5, PULL_DISABLE, 20K)
+#define GPIO_FUNC6 GPIO_FUNC(6, PULL_DISABLE, 20K)
/* ACPI GPIO routing. Assume everything is externally pulled and negative edge
* triggered. SCI implies WAKE, but WAKE doesn't imply SCI. */
@@ -265,9 +279,9 @@
/* Common default GPIO settings */
#define GPIO_INPUT GPIO_INPUT_NOPU
#define GPIO_INPUT_LEGACY GPIO_INPUT_LEGACY_NOPU
-#define GPIO_INPUT_PU GPIO_INPUT_PU_10K
-#define GPIO_INPUT_PD GPIO_INPUT_PD_10K
-#define GPIO_NC GPIO_INPUT_PU_10K
+#define GPIO_INPUT_PU GPIO_INPUT_PU_20K
+#define GPIO_INPUT_PD GPIO_INPUT_PD_20K
+#define GPIO_NC GPIO_INPUT_PU_20K
#define GPIO_DEFAULT GPIO_FUNC0
/* 16 DirectIRQs per supported bank */
@@ -320,7 +334,7 @@ struct gpio_bank {
const u8 gpio_f1_range_end;
};
-void setup_soc_gpios(struct soc_gpio_config *config);
+void setup_soc_gpios(struct soc_gpio_config *config, u8 enable_xdp_tap);
/* This function is weak and can be overridden by a mainboard function. */
struct soc_gpio_config* mainboard_get_gpios(void);
diff --git a/src/soc/intel/baytrail/baytrail/iosf.h b/src/soc/intel/baytrail/baytrail/iosf.h
index f61582c..9da86f5 100644
--- a/src/soc/intel/baytrail/baytrail/iosf.h
+++ b/src/soc/intel/baytrail/baytrail/iosf.h
@@ -197,10 +197,18 @@ void iosf_ssus_write(int reg, uint32_t val);
#define BUNIT_BMBOUND_HI 0x26
#define BUNIT_MMCONF_REG 0x27
/* The SMMRR registers define the SMM region in MiB granularity. */
+#define BUNIT_SMRCP 0x2b
+#define BUNIT_SMRRAC 0x2c
+#define BUNIT_SMRWAC 0x2d
#define BUNIT_SMRRL 0x2e
#define BUNIT_SMRRH 0x2f
# define BUNIT_SMRR_ENABLE (1 << 31)
+/* SA ID bits. */
+#define SAI_IA_UNTRUSTED (1 << 0)
+#define SAI_IA_SMM (1 << 2)
+#define SAI_IA_BOOT (1 << 4)
+
/*
* DUNIT Registers.
*/
diff --git a/src/soc/intel/baytrail/baytrail/mrc_wrapper.h b/src/soc/intel/baytrail/baytrail/mrc_wrapper.h
index fc18f0c..b5009e4 100644
--- a/src/soc/intel/baytrail/baytrail/mrc_wrapper.h
+++ b/src/soc/intel/baytrail/baytrail/mrc_wrapper.h
@@ -28,7 +28,7 @@
#ifndef _MRC_WRAPPER_H_
#define _MRC_WRAPPER_H_
-#define MRC_PARAMS_VER 4
+#define MRC_PARAMS_VER 5
#define NUM_CHANNELS 2
@@ -55,12 +55,25 @@ enum mrc_wrapper_error {
PLATFORM_SETTINGS_FAIL = -4,
DIMM_DETECTION_FAILURE = -5,
MEMORY_CONFIG_FAILURE = -6,
+ INVALID_CPU_ODT_SETTING = -7,
+ INVALID_DRAM_ODT_SETTING = -8,
};
struct mrc_mainboard_params {
int dram_type;
int dram_info_location; /* DRAM_INFO_* */
- int weaker_odt_settings; /* Apply weaker on-die-termination settings. */
+ int dram_is_slotted; /* mobo has DRAM slots. */
+ /*
+ * The below ODT settings are only honored when !dram_is_slotted.
+ * Aditionally, weaker_odt_settings being non-zero causes
+ * cpu_odt_value to not be honored as weaker_odt_settings have a
+ * special training path.
+ */
+ int weaker_odt_settings;
+ /* Allowed settings: 60, 80, 100, 120, and 150. */
+ int cpu_odt_value;
+ /* Allowed settings: 60 and 120. */
+ int dram_odt_value;
int spd_addrs[NUM_CHANNELS];
void *dram_data[NUM_CHANNELS]; /* SPD or Timing specific data. */
} __attribute__((packed));
diff --git a/src/soc/intel/baytrail/baytrail/ramstage.h b/src/soc/intel/baytrail/baytrail/ramstage.h
index d2e7e62..a8b5fdc 100644
--- a/src/soc/intel/baytrail/baytrail/ramstage.h
+++ b/src/soc/intel/baytrail/baytrail/ramstage.h
@@ -21,10 +21,11 @@
#define _BAYTRAIL_RAMSTAGE_H_
#include <device/device.h>
+#include <chip.h>
/* The baytrail_init_pre_device() function is called prior to device
* initialization, but it's after console and cbmem has been reinitialized. */
-void baytrail_init_pre_device(void);
+void baytrail_init_pre_device(struct soc_intel_baytrail_config *config);
void baytrail_init_cpus(device_t dev);
void set_max_freq(void);
void southcluster_enable_dev(device_t dev);
diff --git a/src/soc/intel/baytrail/baytrail/smm.h b/src/soc/intel/baytrail/baytrail/smm.h
index e00944d..f147f73 100644
--- a/src/soc/intel/baytrail/baytrail/smm.h
+++ b/src/soc/intel/baytrail/baytrail/smm.h
@@ -37,7 +37,13 @@ void *smm_region_start(void);
#include <stdint.h>
void southcluster_smm_clear_state(void);
void southcluster_smm_enable_smi(void);
-void southcluster_smm_save_gpio_route(uint32_t route);
+void southcluster_smm_save_param(int param, uint32_t data);
#endif
+enum {
+ SMM_SAVE_PARAM_GPIO_ROUTE = 0,
+ SMM_SAVE_PARAM_PCIE_WAKE_ENABLE,
+ SMM_SAVE_PARAM_COUNT
+};
+
#endif /* _BAYTRAIL_SMM_H_ */
diff --git a/src/soc/intel/baytrail/chip.c b/src/soc/intel/baytrail/chip.c
index eedae39..ce9eb49 100644
--- a/src/soc/intel/baytrail/chip.c
+++ b/src/soc/intel/baytrail/chip.c
@@ -70,7 +70,7 @@ static void enable_dev(device_t dev)
/* Called at BS_DEV_INIT_CHIPS time -- very early. Just after BS_PRE_DEVICE. */
static void soc_init(void *chip_info)
{
- baytrail_init_pre_device();
+ baytrail_init_pre_device(chip_info);
}
struct chip_operations soc_intel_baytrail_ops = {
diff --git a/src/soc/intel/baytrail/chip.h b/src/soc/intel/baytrail/chip.h
index 0a57885..256ed4f 100644
--- a/src/soc/intel/baytrail/chip.h
+++ b/src/soc/intel/baytrail/chip.h
@@ -26,9 +26,10 @@
#include <stdint.h>
struct soc_intel_baytrail_config {
- uint8_t sata_port_map;
- uint8_t sata_ahci;
- uint8_t ide_legacy_combined;
+ uint8_t enable_xdp_tap;
+ uint8_t sata_port_map;
+ uint8_t sata_ahci;
+ uint8_t ide_legacy_combined;
uint8_t clkreq_enable;
/* VR low power settings -- enable PS2 mode for gfx and core */
@@ -68,6 +69,9 @@ struct soc_intel_baytrail_config {
int scc_acpi_mode;
int lpe_acpi_mode;
+ /* Allow PCIe devices to wake system from suspend. */
+ int pcie_wake_enable;
+
/*
* Digital Port Hotplug Enable:
* 0x04 = Enabled, 2ms short pulse
diff --git a/src/soc/intel/baytrail/cpu.c b/src/soc/intel/baytrail/cpu.c
index 1bbcb08..97d1f04 100644
--- a/src/soc/intel/baytrail/cpu.c
+++ b/src/soc/intel/baytrail/cpu.c
@@ -30,6 +30,7 @@
#include <cpu/x86/smm.h>
#include <reg_script.h>
+#include <baytrail/iosf.h>
#include <baytrail/msr.h>
#include <baytrail/pattrs.h>
#include <baytrail/ramstage.h>
@@ -103,6 +104,8 @@ void baytrail_init_cpus(device_t dev)
struct bus *cpu_bus = dev->link_list;
const struct pattrs *pattrs = pattrs_get();
struct mp_params mp_params;
+ uint32_t bsmrwac;
+ void *default_smm_area;
/* Set up MTRRs based on physical address size. */
x86_setup_fixed_mtrrs();
@@ -116,6 +119,16 @@ void baytrail_init_cpus(device_t dev)
mp_params.num_records = ARRAY_SIZE(mp_steps);
mp_params.microcode_pointer = pattrs->microcode_patch;
+ default_smm_area = backup_default_smm_area();
+
+ /*
+ * Configure the BUNIT to allow dirty cache line evictions in non-SMM
+ * mode for the lines that were dirtied while in SMM mode. Otherwise
+ * the writes would be silently dropped.
+ */
+ bsmrwac = iosf_bunit_read(BUNIT_SMRWAC) | SAI_IA_UNTRUSTED;
+ iosf_bunit_write(BUNIT_SMRWAC, bsmrwac);
+
/* Set package MSRs */
reg_script_run(package_msr_script);
@@ -125,6 +138,8 @@ void baytrail_init_cpus(device_t dev)
if (mp_init(cpu_bus, &mp_params)) {
printk(BIOS_ERR, "MP initialization failure.\n");
}
+
+ restore_default_smm_area(default_smm_area);
}
static void baytrail_core_init(device_t cpu)
diff --git a/src/soc/intel/baytrail/gpio.c b/src/soc/intel/baytrail/gpio.c
index 78aeb17..43e52ef 100644
--- a/src/soc/intel/baytrail/gpio.c
+++ b/src/soc/intel/baytrail/gpio.c
@@ -192,7 +192,7 @@ static void setup_gpio_route(const struct soc_gpio_map *sus,
route_reg |= ROUTE_SCI << (2 * (i + 8));
}
}
- southcluster_smm_save_gpio_route(route_reg);
+ southcluster_smm_save_param(SMM_SAVE_PARAM_GPIO_ROUTE, route_reg);
}
static void setup_dirqs(const u8 dirq[GPIO_MAX_DIRQS],
@@ -214,7 +214,7 @@ static void setup_dirqs(const u8 dirq[GPIO_MAX_DIRQS],
}
}
-void setup_soc_gpios(struct soc_gpio_config *config)
+void setup_soc_gpios(struct soc_gpio_config *config, u8 enable_xdp_tap)
{
if (config) {
setup_gpios(config->ncore, &gpncore_bank);
@@ -228,6 +228,14 @@ void setup_soc_gpios(struct soc_gpio_config *config)
setup_dirqs(*config->sus_dirq, &gpssus_bank);
}
+ /* Set on die termination feature with pull up value and
+ * drive the pad high for TAP_TDO and TAP_TMS
+ */
+ if (!enable_xdp_tap) {
+ printk(BIOS_DEBUG, "Tri-state TDO and TMS\n");
+ write32(GPSSUS_PAD_BASE + 0x2fc, 0xc);
+ write32(GPSSUS_PAD_BASE + 0x2cc, 0xc);
+ }
}
struct soc_gpio_config* __attribute__((weak)) mainboard_get_gpios(void)
diff --git a/src/soc/intel/baytrail/northcluster.c b/src/soc/intel/baytrail/northcluster.c
index e90c030..b119e24 100644
--- a/src/soc/intel/baytrail/northcluster.c
+++ b/src/soc/intel/baytrail/northcluster.c
@@ -22,6 +22,7 @@
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
+#include <vendorcode/google/chromeos/chromeos.h>
#include <baytrail/iomap.h>
#include <baytrail/iosf.h>
@@ -88,14 +89,8 @@ static void nc_read_resources(device_t dev)
mmconf = iosf_bunit_read(BUNIT_MMCONF_REG) & ~((1 << 28) - 1);
mmio_resource(dev, BUNIT_MMCONF_REG, RES_IN_KiB(mmconf), 256 * 1024);
- /* 0 -> SMM_DEFAULT_BASE cacheable ram. */
- ram_resource(dev, index++, 0, RES_IN_KiB(SMM_DEFAULT_BASE));
- /* Default SMM region is cacheable but reserved for coreboot */
- reserved_ram_resource(dev, index++, RES_IN_KiB(SMM_DEFAULT_BASE),
- RES_IN_KiB(SMM_DEFAULT_SIZE));
-
- /* SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE - > 0xa0000 */
- base_k = RES_IN_KiB(SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE);
+ /* 0 -> 0xa0000 */
+ base_k = RES_IN_KiB(0);
size_k = RES_IN_KiB(0xa0000) - base_k;
ram_resource(dev, index++, base_k, size_k);
@@ -132,11 +127,8 @@ static void nc_read_resources(device_t dev)
mmio_resource(dev, index++, (0xa0000 >> 10), (0xc0000 - 0xa0000) >> 10);
reserved_ram_resource(dev, index++, (0xc0000 >> 10),
(0x100000 - 0xc0000) >> 10);
-#if CONFIG_CHROMEOS_RAMOOPS
- reserved_ram_resource(dev, index++,
- CONFIG_CHROMEOS_RAMOOPS_RAM_START >> 10,
- CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE >> 10);
-#endif
+
+ chromeos_reserve_ram_oops(dev, index++);
}
static struct device_operations nc_ops = {
diff --git a/src/soc/intel/baytrail/pcie.c b/src/soc/intel/baytrail/pcie.c
index ce76d6d..4498f43 100644
--- a/src/soc/intel/baytrail/pcie.c
+++ b/src/soc/intel/baytrail/pcie.c
@@ -27,6 +27,7 @@
#include <baytrail/pci_devs.h>
#include <baytrail/pcie.h>
#include <baytrail/ramstage.h>
+#include <baytrail/smm.h>
#include "chip.h"
@@ -174,10 +175,15 @@ static void check_device_present(device_t dev)
static void byt_pcie_enable(device_t dev)
{
if (is_first_port(dev)) {
+ struct soc_intel_baytrail_config *config = dev->chip_info;
uint32_t reg = pci_read_config32(dev, PHYCTL2_IOSFBCTL);
pll_en_off = !!(reg & PLL_OFF_EN);
strpfusecfg = pci_read_config32(dev, STRPFUSECFG);
+
+ if (config && config->pcie_wake_enable)
+ southcluster_smm_save_param(
+ SMM_SAVE_PARAM_PCIE_WAKE_ENABLE, 1);
}
/* Check if device is enabled in strapping. */
diff --git a/src/soc/intel/baytrail/ramstage.c b/src/soc/intel/baytrail/ramstage.c
index e8f441f..9622930 100644
--- a/src/soc/intel/baytrail/ramstage.c
+++ b/src/soc/intel/baytrail/ramstage.c
@@ -184,9 +184,9 @@ static void s3_resume_prepare(void)
s3_save_acpi_wake_source(gnvs);
}
-void baytrail_init_pre_device(void)
+void baytrail_init_pre_device(struct soc_intel_baytrail_config *config)
{
- struct soc_gpio_config *config;
+ struct soc_gpio_config *gpio_config;
fill_in_pattrs();
@@ -200,8 +200,8 @@ void baytrail_init_pre_device(void)
baytrail_run_reference_code();
/* Get GPIO initial states from mainboard */
- config = mainboard_get_gpios();
- setup_soc_gpios(config);
+ gpio_config = mainboard_get_gpios();
+ setup_soc_gpios(gpio_config, config->enable_xdp_tap);
baytrail_init_scc();
}
diff --git a/src/soc/intel/baytrail/smm.c b/src/soc/intel/baytrail/smm.c
index d4b3d58..daf759d 100644
--- a/src/soc/intel/baytrail/smm.c
+++ b/src/soc/intel/baytrail/smm.c
@@ -31,13 +31,12 @@
#include <baytrail/pmc.h>
#include <baytrail/smm.h>
-/* Save the gpio route register. The settings are committed from
- * southcluster_smm_enable_smi(). */
-static uint32_t gpio_route;
+/* Save settings which will be committed in SMI functions. */
+static uint32_t smm_save_params[SMM_SAVE_PARAM_COUNT];
-void southcluster_smm_save_gpio_route(uint32_t route)
+void southcluster_smm_save_param(int param, uint32_t data)
{
- gpio_route = route;
+ smm_save_params[param] = data;
}
void southcluster_smm_clear_state(void)
@@ -70,7 +69,7 @@ static void southcluster_smm_route_gpios(void)
const unsigned long gpio_rout = PMC_BASE_ADDRESS + GPIO_ROUT;
const unsigned short alt_gpio_smi = ACPI_BASE_ADDRESS + ALT_GPIO_SMI;
uint32_t alt_gpio_reg = 0;
- uint32_t route_reg = gpio_route;
+ uint32_t route_reg = smm_save_params[SMM_SAVE_PARAM_GPIO_ROUTE];
int i;
printk(BIOS_DEBUG, "GPIO_ROUT = %08x\n", route_reg);
@@ -92,10 +91,12 @@ static void southcluster_smm_route_gpios(void)
void southcluster_smm_enable_smi(void)
{
+ uint16_t pm1_events = PWRBTN_EN | GBL_EN;
printk(BIOS_DEBUG, "Enabling SMIs.\n");
- /* Configure events Disable pcie wake. */
- enable_pm1(PWRBTN_EN | GBL_EN | PCIEXPWAK_DIS);
+ if (!smm_save_params[SMM_SAVE_PARAM_PCIE_WAKE_ENABLE])
+ pm1_events |= PCIEXPWAK_DIS;
+ enable_pm1(pm1_events);
disable_gpe(PME_B0_EN);
/* Set up the GPIO route. */
diff --git a/src/soc/intel/baytrail/southcluster.c b/src/soc/intel/baytrail/southcluster.c
index 49e4c91..261c95a 100644
--- a/src/soc/intel/baytrail/southcluster.c
+++ b/src/soc/intel/baytrail/southcluster.c
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <arch/io.h>
+#include <arch/acpi.h>
#include <bootstate.h>
#include <cbmem.h>
#include <console/console.h>
@@ -29,6 +30,7 @@
#include <device/pci_ids.h>
#include <pc80/mc146818rtc.h>
#include <romstage_handoff.h>
+#include <drivers/uart/uart8250reg.h>
#include <baytrail/iomap.h>
#include <baytrail/irq.h>
@@ -144,6 +146,42 @@ static void sc_rtc_init(void)
rtc_init(rtc_fail);
}
+/*
+ * The UART hardware loses power while in suspend. Because of this the kernel
+ * can hang because it doesn't re-initialize serial ports it is using for
+ * consoles at resume time. The following function configures the UART
+ * if the hardware is enabled though it may not be the correct baud rate
+ * or configuration. This is definitely a hack, but it helps the kernel
+ * along.
+ */
+static void com1_configure_resume(device_t dev)
+{
+ const uint16_t port = 0x3f8;
+
+ /* Is the UART I/O port eanbled? */
+ if (!(pci_read_config32(dev, UART_CONT) & 1))
+ return;
+
+ /* Disable interrupts */
+ outb(0x0, port + UART8250_IER);
+
+ /* Enable FIFOs */
+ outb(UART8250_FCR_FIFO_EN, port + UART8250_FCR);
+
+ /* assert DTR and RTS so the other end is happy */
+ outb(UART8250_MCR_DTR | UART8250_MCR_RTS, port + UART8250_MCR);
+
+ /* DLAB on */
+ outb(UART8250_LCR_DLAB | 3, port + UART8250_LCR);
+
+ /* Set Baud Rate Divisor. 1 ==> 115200 Baud */
+ outb(1, port + UART8250_DLL);
+ outb(0, port + UART8250_DLM);
+
+ /* Set to 3 for 8N1 */
+ outb(3, port + UART8250_LCR);
+}
+
static void sc_init(device_t dev)
{
int i;
@@ -176,6 +214,9 @@ static void sc_init(device_t dev)
write32(gen_pmcon1,
read32(gen_pmcon1) & ~DIS_SLP_X_STRCH_SUS_UP);
}
+
+ if (acpi_slp_type == 3)
+ com1_configure_resume(dev);
}
/*
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 02d5285ed040f277c64ecdee6eaeb3ae65445438
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 | 139 +----------------
src/mainboard/asus/a8v-e_deluxe/acpi_tables.c | 95 +----------
src/mainboard/asus/a8v-e_deluxe/dsdt.asl | 7 -
src/mainboard/asus/a8v-e_se/acpi_tables.c | 112 +------------
src/mainboard/asus/k8v-x/acpi_tables.c | 112 +------------
src/mainboard/asus/m2v-mx_se/acpi_tables.c | 132 +---------------
src/mainboard/asus/m2v/acpi_tables.c | 133 +---------------
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 | 114 +-------------
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 | 140 +----------------
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 | 30 ++++
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 | 6 +
src/southbridge/nvidia/mcp55/lpc.c | 20 +++
src/southbridge/via/k8t890/traf_ctrl.c | 41 +++++
58 files changed, 422 insertions(+), 2862 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..f87c6f9 100644
--- a/src/mainboard/asus/a8n_e/acpi_tables.c
+++ b/src/mainboard/asus/a8n_e/acpi_tables.c
@@ -21,36 +21,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)
-{
- 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)
{
device_t dev;
struct resource *res;
+ get_bus_conf();
+
/* create all subtables for processors */
current = acpi_create_madt_lapics(current);
@@ -86,116 +64,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..bbb3442 100644
--- a/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
@@ -32,29 +32,12 @@
#include "southbridge/via/vt8237r/vt8237r.h"
#include "southbridge/via/k8t890/k8t890.h"
-extern const unsigned char AmlCode[];
-
-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)
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
+ get_bus_conf();
+
/* Create all subtables for processors. */
current = acpi_create_madt_lapics(current);
@@ -80,77 +63,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..9717818 100644
--- a/src/mainboard/asus/a8v-e_se/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_se/acpi_tables.c
@@ -34,29 +34,12 @@
#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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
+ get_bus_conf();
+
/* Create all subtables for processors. */
current = acpi_create_madt_lapics(current);
@@ -82,94 +65,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..9cb8a43 100644
--- a/src/mainboard/asus/k8v-x/acpi_tables.c
+++ b/src/mainboard/asus/k8v-x/acpi_tables.c
@@ -34,29 +34,12 @@
#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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
+ get_bus_conf();
+
/* Create all subtables for processors. */
current = acpi_create_madt_lapics(current);
@@ -82,94 +65,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..55e62e8 100644
--- a/src/mainboard/asus/m2v-mx_se/acpi_tables.c
+++ b/src/mainboard/asus/m2v-mx_se/acpi_tables.c
@@ -35,29 +35,12 @@
#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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
+ get_bus_conf();
+
/* Create all subtables for processors. */
current = acpi_create_madt_lapics(current);
@@ -83,114 +66,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..8fa0537 100644
--- a/src/mainboard/asus/m2v/acpi_tables.c
+++ b/src/mainboard/asus/m2v/acpi_tables.c
@@ -36,29 +36,12 @@
#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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
+ get_bus_conf();
+
/* Create all subtables for processors. */
current = acpi_create_madt_lapics(current);
@@ -84,115 +67,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..732a93e 100644
--- a/src/mainboard/iwill/dk8_htx/acpi_tables.c
+++ b/src/mainboard/iwill/dk8_htx/acpi_tables.c
@@ -19,22 +19,7 @@
#include <cpu/amd/amdk8_sysconf.h>
#include "northbridge/amd/amdk8/acpi.h"
#include "mb_sysconf.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;
-}
-
+#include "mainboard.h"
unsigned long acpi_fill_madt(unsigned long current)
{
@@ -42,6 +27,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 +124,8 @@ 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 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 +137,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 +174,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..22bb02e
--- /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>
+
+
+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..a1b7fbb 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)
@@ -51,6 +26,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);
@@ -86,116 +63,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/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..bba5833 100644
--- a/src/southbridge/amd/amd8111/lpc.c
+++ b/src/southbridge/amd/amd8111/lpc.c
@@ -11,7 +11,12 @@
#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>
+#endif
#include <stdlib.h>
+#include <string.h>
#include "amd8111.h"
#define NMI_OFF 0
@@ -112,6 +117,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 +147,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..01d7839 100644
--- a/src/southbridge/nvidia/mcp55/ht.c
+++ b/src/southbridge/nvidia/mcp55/ht.c
@@ -28,6 +28,12 @@
#include <device/pci_ops.h>
#include "mcp55.h"
+unsigned long acpi_fill_mcfg(unsigned long current)
+{
+ /* Not implemented */
+ return current;
+}
+
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,
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 43b12d60716d6eccbac5a20af2321da3f1bf87a4
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 | 139 +----------------
src/mainboard/asus/a8v-e_deluxe/acpi_tables.c | 95 +----------
src/mainboard/asus/a8v-e_deluxe/dsdt.asl | 7 -
src/mainboard/asus/a8v-e_se/acpi_tables.c | 112 +------------
src/mainboard/asus/k8v-x/acpi_tables.c | 112 +------------
src/mainboard/asus/m2v-mx_se/acpi_tables.c | 132 +---------------
src/mainboard/asus/m2v/acpi_tables.c | 133 +---------------
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 | 114 +-------------
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 | 140 +----------------
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 | 30 ++++
src/southbridge/amd/rs690/ht.c | 18 +++
src/southbridge/amd/sb600/lpc.c | 19 +++
src/southbridge/amd/sb700/lpc.c | 31 +++-
src/southbridge/nvidia/ck804/ht.c | 27 ++++
src/southbridge/nvidia/ck804/lpc.c | 4 +
src/southbridge/nvidia/mcp55/ht.c | 6 +
src/southbridge/nvidia/mcp55/lpc.c | 20 +++
src/southbridge/via/k8t890/traf_ctrl.c | 41 +++++
58 files changed, 428 insertions(+), 2862 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..f87c6f9 100644
--- a/src/mainboard/asus/a8n_e/acpi_tables.c
+++ b/src/mainboard/asus/a8n_e/acpi_tables.c
@@ -21,36 +21,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)
-{
- 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)
{
device_t dev;
struct resource *res;
+ get_bus_conf();
+
/* create all subtables for processors */
current = acpi_create_madt_lapics(current);
@@ -86,116 +64,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..bbb3442 100644
--- a/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_deluxe/acpi_tables.c
@@ -32,29 +32,12 @@
#include "southbridge/via/vt8237r/vt8237r.h"
#include "southbridge/via/k8t890/k8t890.h"
-extern const unsigned char AmlCode[];
-
-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)
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
+ get_bus_conf();
+
/* Create all subtables for processors. */
current = acpi_create_madt_lapics(current);
@@ -80,77 +63,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..9717818 100644
--- a/src/mainboard/asus/a8v-e_se/acpi_tables.c
+++ b/src/mainboard/asus/a8v-e_se/acpi_tables.c
@@ -34,29 +34,12 @@
#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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
+ get_bus_conf();
+
/* Create all subtables for processors. */
current = acpi_create_madt_lapics(current);
@@ -82,94 +65,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..9cb8a43 100644
--- a/src/mainboard/asus/k8v-x/acpi_tables.c
+++ b/src/mainboard/asus/k8v-x/acpi_tables.c
@@ -34,29 +34,12 @@
#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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
+ get_bus_conf();
+
/* Create all subtables for processors. */
current = acpi_create_madt_lapics(current);
@@ -82,94 +65,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..55e62e8 100644
--- a/src/mainboard/asus/m2v-mx_se/acpi_tables.c
+++ b/src/mainboard/asus/m2v-mx_se/acpi_tables.c
@@ -35,29 +35,12 @@
#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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
+ get_bus_conf();
+
/* Create all subtables for processors. */
current = acpi_create_madt_lapics(current);
@@ -83,114 +66,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..8fa0537 100644
--- a/src/mainboard/asus/m2v/acpi_tables.c
+++ b/src/mainboard/asus/m2v/acpi_tables.c
@@ -36,29 +36,12 @@
#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;
- 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;
-}
-
unsigned long acpi_fill_madt(unsigned long current)
{
unsigned int gsi_base = 0x18;
+ get_bus_conf();
+
/* Create all subtables for processors. */
current = acpi_create_madt_lapics(current);
@@ -84,115 +67,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..732a93e 100644
--- a/src/mainboard/iwill/dk8_htx/acpi_tables.c
+++ b/src/mainboard/iwill/dk8_htx/acpi_tables.c
@@ -19,22 +19,7 @@
#include <cpu/amd/amdk8_sysconf.h>
#include "northbridge/amd/amdk8/acpi.h"
#include "mb_sysconf.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;
-}
-
+#include "mainboard.h"
unsigned long acpi_fill_madt(unsigned long current)
{
@@ -42,6 +27,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 +124,8 @@ 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 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 +137,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 +174,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..22bb02e
--- /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>
+
+
+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..a1b7fbb 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)
@@ -51,6 +26,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);
@@ -86,116 +63,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/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-&g