summaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
authorRudolf Marek <r.marek@assembler.cz>2009-02-03 22:37:22 +0000
committerRudolf Marek <r.marek@assembler.cz>2009-02-03 22:37:22 +0000
commit8db0cfefd16c9aa6dbc0ffdfd9d2ba81a1561650 (patch)
treefce5646fe8cbc78dd2a00937464cafeca6f4a3d4 /src/mainboard
parent742655bb4d18fcb0c5081f6d9c8ba5b870fa0b47 (diff)
downloadcoreboot-8db0cfefd16c9aa6dbc0ffdfd9d2ba81a1561650.tar.xz
Following patch converts the run-time SSDT patching via update_ssdt funtion to
new AML code generator. Compile-tested on all changed targets. I think it should work because it works for Asus M2V-MX SE. Signed-off-by: Rudolf Marek <r.marek@assembler.cz> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3929 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/agami/aruma/acpi_tables.c90
-rw-r--r--src/mainboard/amd/dbm690t/acpi_tables.c22
-rw-r--r--src/mainboard/amd/pistachio/acpi_tables.c23
-rw-r--r--src/mainboard/amd/serengeti_cheetah/acpi_tables.c22
-rw-r--r--src/mainboard/iwill/dk8_htx/acpi_tables.c21
5 files changed, 48 insertions, 130 deletions
diff --git a/src/mainboard/agami/aruma/acpi_tables.c b/src/mainboard/agami/aruma/acpi_tables.c
index b10b73b3b6..da1bf56d7c 100644
--- a/src/mainboard/agami/aruma/acpi_tables.c
+++ b/src/mainboard/agami/aruma/acpi_tables.c
@@ -15,6 +15,7 @@
#include <device/pci_ids.h>
#include <cpu/x86/msr.h>
#include <cpu/amd/mtrr.h>
+#include <../../../northbridge/amd/amdk8/amdk8_acpi.h>
#define DUMP_ACPI_TABLES 0
@@ -37,8 +38,6 @@ static void dump_mem(unsigned start, unsigned end)
#define HC_POSSIBLE_NUM 8
extern unsigned char AmlCode[];
-extern unsigned char AmlCode_ssdt[];
-
#if ACPI_SSDTX_NUM >= 1
extern unsigned char AmlCode_ssdt2[];
extern unsigned char AmlCode_ssdt3[];
@@ -187,78 +186,11 @@ unsigned long acpi_fill_madt(unsigned long current)
return current;
}
-//FIXME: next could be moved to northbridge/amd/amdk8/amdk8_acpi.c or cpu/amd/k8/k8_acpi.c begin
-static void int_to_stream(uint32_t val, uint8_t * dest)
-{
- int i;
- for (i = 0; i < 4; i++) {
- *(dest + i) = (val >> (8 * i)) & 0xff;
- }
+unsigned long acpi_fill_ssdt_generator(unsigned long current, char *oem_table_id) {
+ k8acpi_write_vars();
+ return (unsigned long) (acpigen_get_current());
}
-extern void get_bus_conf(void);
-
-static void update_ssdt(void *ssdt)
-{
- uint8_t *BUSN;
- uint8_t *MMIO;
- uint8_t *PCIO;
- uint8_t *SBLK;
- uint8_t *TOM1;
- uint8_t *HCLK;
- uint8_t *SBDN;
- uint8_t *HCDN;
- int i;
- device_t dev;
- uint32_t dword;
- msr_t msr;
-
- BUSN = ssdt + 0x3a; //+5 will be next BUSN
- MMIO = ssdt + 0x57; //+5 will be next MMIO
- PCIO = ssdt + 0xaf; //+5 will be next PCIO
- SBLK = ssdt + 0xdc; // one byte
- TOM1 = ssdt + 0xe3; //
- HCLK = ssdt + 0xfa; //+5 will be next HCLK
- SBDN = ssdt + 0xed; //
- HCDN = ssdt + 0x12a; //+5 will be next HCDN
-
- dev = dev_find_slot(0, PCI_DEVFN(0x18, 1));
-
- for (i = 0; i < 4; i++) {
- dword = pci_read_config32(dev, 0xe0 + i * 4);
- int_to_stream(dword, BUSN + i * 5);
- }
-
- for (i = 0; i < 0x10; i++) {
- dword = pci_read_config32(dev, 0x80 + i * 4);
- int_to_stream(dword, MMIO + i * 5);
- }
-
- for (i = 0; i < 0x08; i++) {
- dword = pci_read_config32(dev, 0xc0 + i * 4);
- int_to_stream(dword, PCIO + i * 5);
- }
-
- *SBLK = (uint8_t) (sblk);
-
- msr = rdmsr(TOP_MEM);
- int_to_stream(msr.lo, TOM1);
-
- for (i = 0; i < hc_possible_num; i++) {
- int_to_stream(pci1234[i], HCLK + i * 5);
- int_to_stream(hcdn[i], HCDN + i * 5);
- }
- for (i = hc_possible_num; i < HC_POSSIBLE_NUM; i++) { // in case we set array size to other than 8
- int_to_stream(0x00000000, HCLK + i * 5);
- int_to_stream(hcdn[i], HCDN + i * 5);
- }
-
- int_to_stream(sbdn, SBDN);
-
-}
-
-//end
-
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
@@ -322,16 +254,10 @@ unsigned long write_acpi_tables(unsigned long start)
/* SSDT */
printk_debug("ACPI: * SSDT\n");
- ssdt = (acpi_header_t *) current;
- current += ((acpi_header_t *) AmlCode_ssdt)->length;
- memcpy((void *) ssdt, (void *) AmlCode_ssdt,
- ((acpi_header_t *) AmlCode_ssdt)->length);
- //Here you need to set value in pci1234, sblk and sbdn in get_bus_conf.c
- update_ssdt((void *) ssdt);
- /* recalculate checksum */
- ssdt->checksum = 0;
- ssdt->checksum =
- acpi_checksum((unsigned char *) ssdt, ssdt->length);
+ ssdt = (acpi_header_t *)current;
+
+ acpi_create_ssdt_generator(ssdt, "DYNADATA");
+ current += ssdt->length;
acpi_add_table(rsdt, ssdt);
#if ACPI_SSDTX_NUM >= 1
diff --git a/src/mainboard/amd/dbm690t/acpi_tables.c b/src/mainboard/amd/dbm690t/acpi_tables.c
index 893ac158fd..0d890b5c60 100644
--- a/src/mainboard/amd/dbm690t/acpi_tables.c
+++ b/src/mainboard/amd/dbm690t/acpi_tables.c
@@ -25,7 +25,7 @@
#include <cpu/x86/msr.h>
#include <cpu/amd/mtrr.h>
#include <cpu/amd/amdk8_sysconf.h>
-
+#include <../../../northbridge/amd/amdk8/amdk8_acpi.h>
#include <arch/cpu.h>
#define DUMP_ACPI_TABLES 0
@@ -99,8 +99,6 @@ unsigned long acpi_fill_madt(unsigned long current)
extern void get_bus_conf(void);
-extern void update_ssdt(void *ssdt);
-
void update_ssdtx(void *ssdtx, int i)
{
uint8_t *PCI;
@@ -591,6 +589,11 @@ u32 pstates_algorithm(acpi_header_t * dsdt)
}
+unsigned long acpi_fill_ssdt_generator(unsigned long current, char *oem_table_id) {
+ k8acpi_write_vars();
+ return (unsigned long) (acpigen_get_current());
+}
+
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
@@ -657,15 +660,10 @@ unsigned long write_acpi_tables(unsigned long start)
/* SSDT */
printk_debug("ACPI: * SSDT\n");
- ssdt = (acpi_header_t *) current;
- current += ((acpi_header_t *) AmlCode_ssdt)->length;
- memcpy((void *)ssdt, (void *)AmlCode_ssdt,
- ((acpi_header_t *) AmlCode_ssdt)->length);
- /* Here you need to set value in pci1234, sblk and sbdn in get_bus_conf.c */
- update_ssdt((void *)ssdt);
- /* recalculate checksum */
- ssdt->checksum = 0;
- ssdt->checksum = acpi_checksum((u8 *)ssdt, ssdt->length);
+ ssdt = (acpi_header_t *)current;
+
+ acpi_create_ssdt_generator(ssdt, "DYNADATA");
+ current += ssdt->length;
acpi_add_table(rsdt, ssdt);
#if ACPI_SSDTX_NUM >= 1
diff --git a/src/mainboard/amd/pistachio/acpi_tables.c b/src/mainboard/amd/pistachio/acpi_tables.c
index 893ac158fd..57d8214e66 100644
--- a/src/mainboard/amd/pistachio/acpi_tables.c
+++ b/src/mainboard/amd/pistachio/acpi_tables.c
@@ -25,7 +25,7 @@
#include <cpu/x86/msr.h>
#include <cpu/amd/mtrr.h>
#include <cpu/amd/amdk8_sysconf.h>
-
+#include <../../../northbridge/amd/amdk8/amdk8_acpi.h>
#include <arch/cpu.h>
#define DUMP_ACPI_TABLES 0
@@ -55,7 +55,6 @@ static void dump_mem(u32 start, u32 end)
#endif
extern u8 AmlCode[];
-extern u8 AmlCode_ssdt[];
#if ACPI_SSDTX_NUM >= 1
extern u8 AmlCode_ssdt2[];
@@ -99,8 +98,6 @@ unsigned long acpi_fill_madt(unsigned long current)
extern void get_bus_conf(void);
-extern void update_ssdt(void *ssdt);
-
void update_ssdtx(void *ssdtx, int i)
{
uint8_t *PCI;
@@ -591,6 +588,11 @@ u32 pstates_algorithm(acpi_header_t * dsdt)
}
+unsigned long acpi_fill_ssdt_generator(unsigned long current, char *oem_table_id) {
+ k8acpi_write_vars();
+ return (unsigned long) (acpigen_get_current());
+}
+
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
@@ -657,15 +659,10 @@ unsigned long write_acpi_tables(unsigned long start)
/* SSDT */
printk_debug("ACPI: * SSDT\n");
- ssdt = (acpi_header_t *) current;
- current += ((acpi_header_t *) AmlCode_ssdt)->length;
- memcpy((void *)ssdt, (void *)AmlCode_ssdt,
- ((acpi_header_t *) AmlCode_ssdt)->length);
- /* Here you need to set value in pci1234, sblk and sbdn in get_bus_conf.c */
- update_ssdt((void *)ssdt);
- /* recalculate checksum */
- ssdt->checksum = 0;
- ssdt->checksum = acpi_checksum((u8 *)ssdt, ssdt->length);
+ ssdt = (acpi_header_t *)current;
+
+ acpi_create_ssdt_generator(ssdt, "DYNADATA");
+ current += ssdt->length;
acpi_add_table(rsdt, ssdt);
#if ACPI_SSDTX_NUM >= 1
diff --git a/src/mainboard/amd/serengeti_cheetah/acpi_tables.c b/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
index ddc8c1826f..d671907687 100644
--- a/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
+++ b/src/mainboard/amd/serengeti_cheetah/acpi_tables.c
@@ -16,6 +16,7 @@
#include <cpu/x86/msr.h>
#include <cpu/amd/mtrr.h>
#include <cpu/amd/amdk8_sysconf.h>
+#include <../../../northbridge/amd/amdk8/amdk8_acpi.h>
#include "mb_sysconf.h"
@@ -38,8 +39,6 @@ static void dump_mem(unsigned start, unsigned end)
#endif
extern unsigned char AmlCode[];
-extern unsigned char AmlCode_ssdt[];
-
#if ACPI_SSDTX_NUM >= 1
extern unsigned char AmlCode_ssdt2[];
extern unsigned char AmlCode_ssdt3[];
@@ -157,8 +156,6 @@ unsigned long acpi_fill_madt(unsigned long current)
extern void get_bus_conf(void);
-extern void update_ssdt(void *ssdt);
-
void update_ssdtx(void *ssdtx, int i)
{
uint8_t *PCI;
@@ -182,6 +179,11 @@ void update_ssdtx(void *ssdtx, int i)
}
+unsigned long acpi_fill_ssdt_generator(unsigned long current, char *oem_table_id) {
+ k8acpi_write_vars();
+ return (unsigned long) (acpigen_get_current());
+}
+
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
@@ -256,14 +258,10 @@ unsigned long write_acpi_tables(unsigned long start)
/* SSDT */
printk_debug("ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
- current += ((acpi_header_t *)AmlCode_ssdt)->length;
- memcpy((void *)ssdt, (void *)AmlCode_ssdt, ((acpi_header_t *)AmlCode_ssdt)->length);
- //Here you need to set value in pci1234, sblk and sbdn in get_bus_conf.c
- update_ssdt((void*)ssdt);
- /* recalculate checksum */
- ssdt->checksum = 0;
- ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
- acpi_add_table(rsdt,ssdt);
+
+ acpi_create_ssdt_generator(ssdt, "DYNADATA");
+ current += ssdt->length;
+ acpi_add_table(rsdt, ssdt);
#if ACPI_SSDTX_NUM >= 1
diff --git a/src/mainboard/iwill/dk8_htx/acpi_tables.c b/src/mainboard/iwill/dk8_htx/acpi_tables.c
index 1f891dae08..c382e3e298 100644
--- a/src/mainboard/iwill/dk8_htx/acpi_tables.c
+++ b/src/mainboard/iwill/dk8_htx/acpi_tables.c
@@ -16,6 +16,7 @@
#include <cpu/x86/msr.h>
#include <cpu/amd/mtrr.h>
#include <cpu/amd/amdk8_sysconf.h>
+#include <../../../northbridge/amd/amdk8/amdk8_acpi.h>
#include "mb_sysconf.h"
@@ -38,7 +39,6 @@ static void dump_mem(unsigned start, unsigned end)
#endif
extern unsigned char AmlCode[];
-extern unsigned char AmlCode_ssdt[];
#if ACPI_SSDTX_NUM >= 1
extern unsigned char AmlCode_ssdt2[];
@@ -159,8 +159,6 @@ unsigned long acpi_fill_madt(unsigned long current)
extern void get_bus_conf(void);
-extern void update_ssdt(void *ssdt);
-
void update_ssdtx(void *ssdtx, int i)
{
uint8_t *PCI;
@@ -184,6 +182,11 @@ void update_ssdtx(void *ssdtx, int i)
}
+unsigned long acpi_fill_ssdt_generator(unsigned long current, char *oem_table_id) {
+ k8acpi_write_vars();
+ return (unsigned long) (acpigen_get_current());
+}
+
unsigned long write_acpi_tables(unsigned long start)
{
unsigned long current;
@@ -258,14 +261,10 @@ unsigned long write_acpi_tables(unsigned long start)
/* SSDT */
printk_debug("ACPI: * SSDT\n");
ssdt = (acpi_header_t *)current;
- current += ((acpi_header_t *)AmlCode_ssdt)->length;
- memcpy((void *)ssdt, (void *)AmlCode_ssdt, ((acpi_header_t *)AmlCode_ssdt)->length);
- //Here you need to set value in pci1234, sblk and sbdn in get_bus_conf.c
- update_ssdt((void*)ssdt);
- /* recalculate checksum */
- ssdt->checksum = 0;
- ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
- acpi_add_table(rsdt,ssdt);
+
+ acpi_create_ssdt_generator(ssdt, "DYNADATA");
+ current += ssdt->length;
+ acpi_add_table(rsdt, ssdt);
#if ACPI_SSDTX_NUM >= 1