Clean up AMD Fam14 SSDT
The old SSDT ACPI code would only include the AGESA or the coreboot SSDT. Now include both. AGESA generates the Pstate SSDT and the second coreboot SSDT is for TOM and TOM2. Now, generate the coreboot SSDT instead of patching it. This fixes some ACPI errors in Linux and Windows bluescreens. The Persimmon acpi_tables.c is where the main changes were made and then replicated in the other Fam14 boards. Please test the other mainbords if you have one. Change-Id: I808c863597e024e3e8aeec0821e8618d96cc96a6 Signed-off-by: Marc Jones <marcj303@gmail.com> Reviewed-on: http://review.coreboot.org/516 Tested-by: build bot (Jenkins) Reviewed-by: Kerry Sheh <shekairui@gmail.com> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
parent
522ba28874
commit
84e0dfcbf2
|
@ -21,17 +21,14 @@
|
|||
#include <string.h>
|
||||
#include <arch/acpi.h>
|
||||
#include <arch/ioapic.h>
|
||||
#include <arch/io.h>
|
||||
#include <device/pci.h>
|
||||
#include <device/pci_ids.h>
|
||||
#include <cpu/x86/msr.h>
|
||||
#include <cpu/amd/mtrr.h>
|
||||
|
||||
#include "agesawrapper.h"
|
||||
#include <cpu/amd/mtrr.h>
|
||||
#include <cpu/amd/amdfam14.h>
|
||||
|
||||
#define DUMP_ACPI_TABLES 0
|
||||
extern u32 apicid_sb800;
|
||||
|
||||
|
||||
#if DUMP_ACPI_TABLES == 1
|
||||
|
||||
|
@ -51,8 +48,29 @@ static void dump_mem(u32 start, u32 end)
|
|||
#endif
|
||||
|
||||
extern const unsigned char AmlCode[];
|
||||
extern const unsigned char AmlCode_ssdt[];
|
||||
|
||||
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
|
||||
{
|
||||
int lens;
|
||||
msr_t msr;
|
||||
char pscope[] = "\\_SB.PCI0";
|
||||
|
||||
lens = acpigen_write_scope(pscope);
|
||||
msr = rdmsr(TOP_MEM);
|
||||
lens += acpigen_write_name_dword("TOM1", msr.lo);
|
||||
msr = rdmsr(TOP_MEM2);
|
||||
/*
|
||||
* Since XP only implements parts of ACPI 2.0, we can't use a qword
|
||||
* here.
|
||||
* See http://www.acpi.info/presentations/S01USMOBS169_OS%2520new.ppt
|
||||
* slide 22ff.
|
||||
* Shift value right by 20 bit to make it fit into 32bit,
|
||||
* giving us 1MB granularity and a limit of almost 4Exabyte of memory.
|
||||
*/
|
||||
lens += acpigen_write_name_dword("TOM2", (msr.hi << 12) | msr.lo >> 20);
|
||||
acpigen_patch_len(lens - 1);
|
||||
return (unsigned long) (acpigen_get_current());
|
||||
}
|
||||
|
||||
unsigned long acpi_fill_mcfg(unsigned long current)
|
||||
{
|
||||
|
@ -62,17 +80,17 @@ unsigned long acpi_fill_mcfg(unsigned long current)
|
|||
|
||||
unsigned long acpi_fill_madt(unsigned long current)
|
||||
{
|
||||
|
||||
/* create all subtables for processors */
|
||||
current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, 0, 0);
|
||||
current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, 1, 1);
|
||||
current = acpi_create_madt_lapics(current);
|
||||
|
||||
/* Write SB800 IOAPIC, only one */
|
||||
current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, apicid_sb800,
|
||||
IO_APIC_ADDR, 0);
|
||||
current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current,
|
||||
CONFIG_MAX_CPUS, IO_APIC_ADDR, 0);
|
||||
|
||||
current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
|
||||
current, 0, 0, 2, 0);
|
||||
current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
|
||||
current, 0, 9, 9, 0xF);
|
||||
|
||||
/* 0: mean bus 0--->ISA */
|
||||
/* 0: PIC 0 */
|
||||
|
@ -80,8 +98,7 @@ unsigned long acpi_fill_madt(unsigned long current)
|
|||
/* 5 mean: 0101 --> Edige-triggered, Active high */
|
||||
|
||||
/* create all subtables for processors */
|
||||
current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current, 0, 5, 1);
|
||||
current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current, 1, 5, 1);
|
||||
/* current = acpi_create_madt_lapic_nmis(current, 5, 1); */
|
||||
/* 1: LINT1 connect to NMI */
|
||||
|
||||
return current;
|
||||
|
@ -112,6 +129,7 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
acpi_facs_t *facs;
|
||||
acpi_header_t *dsdt;
|
||||
acpi_header_t *ssdt;
|
||||
acpi_header_t *ssdt2;
|
||||
|
||||
get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
|
||||
|
||||
|
@ -136,7 +154,7 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
/* DSDT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * DSDT at %lx\n", current);
|
||||
dsdt = (acpi_header_t *)current; // it will used by fadt
|
||||
dsdt = (acpi_header_t *)current;
|
||||
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
|
||||
current += dsdt->length;
|
||||
memcpy(dsdt, &AmlCode, dsdt->length);
|
||||
|
@ -145,7 +163,7 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
/* FACS */ // it needs 64 bit alignment
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * FACS at %lx\n", current);
|
||||
facs = (acpi_facs_t *) current; // it will be used by fadt
|
||||
facs = (acpi_facs_t *) current;
|
||||
current += sizeof(acpi_facs_t);
|
||||
acpi_create_facs(facs);
|
||||
|
||||
|
@ -161,14 +179,12 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
/*
|
||||
* We explicitly add these tables later on:
|
||||
*/
|
||||
#if 0 // Don't need HPET table.
|
||||
current = ( current + 0x07) & -0x08;
|
||||
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);
|
||||
#endif
|
||||
|
||||
/* If we want to use HPET Timers Linux wants an MADT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
|
@ -183,46 +199,49 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
printk(BIOS_DEBUG, "ACPI: * SRAT at %lx\n", current);
|
||||
srat = (acpi_srat_t *) agesawrapper_getlateinitptr (PICK_SRAT);
|
||||
if (srat != NULL) {
|
||||
memcpy(current, srat, srat->header.length);
|
||||
memcpy((void *)current, srat, srat->header.length);
|
||||
srat = (acpi_srat_t *) current;
|
||||
//acpi_create_srat(srat);
|
||||
current += srat->header.length;
|
||||
acpi_add_table(rsdp, srat);
|
||||
}
|
||||
else {
|
||||
printk(BIOS_DEBUG, " AGESA SRAT table NULL. Skipping.\n");
|
||||
}
|
||||
|
||||
/* SLIT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * SLIT at %lx\n", current);
|
||||
slit = (acpi_slit_t *) agesawrapper_getlateinitptr (PICK_SLIT);
|
||||
if (slit != NULL) {
|
||||
memcpy(current, slit, slit->header.length);
|
||||
memcpy((void *)current, slit, slit->header.length);
|
||||
slit = (acpi_slit_t *) current;
|
||||
//acpi_create_slit(slit);
|
||||
current += slit->header.length;
|
||||
acpi_add_table(rsdp, slit);
|
||||
}
|
||||
else {
|
||||
printk(BIOS_DEBUG, " AGESA SLIT table NULL. Skipping.\n");
|
||||
}
|
||||
|
||||
/* SSDT */
|
||||
current = ( current + 0x0f) & -0x10;
|
||||
printk(BIOS_DEBUG, "ACPI: * SSDT at %lx\n", current);
|
||||
printk(BIOS_DEBUG, "ACPI: * AGESA SSDT Pstate at %lx\n", current);
|
||||
ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE);
|
||||
if (ssdt != NULL) {
|
||||
memcpy(current, ssdt, ssdt->length);
|
||||
memcpy((void *)current, ssdt, ssdt->length);
|
||||
ssdt = (acpi_header_t *) current;
|
||||
current += ssdt->length;
|
||||
}
|
||||
else {
|
||||
ssdt = (acpi_header_t *) current;
|
||||
memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
|
||||
current += ssdt->length;
|
||||
memcpy(ssdt, &AmlCode_ssdt, ssdt->length);
|
||||
/* recalculate checksum */
|
||||
ssdt->checksum = 0;
|
||||
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
|
||||
printk(BIOS_DEBUG, " AGESA SSDT table NULL. Skipping.\n");
|
||||
}
|
||||
acpi_add_table(rsdp,ssdt);
|
||||
|
||||
printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
|
||||
current = ( current + 0x0f) & -0x10;
|
||||
printk(BIOS_DEBUG, "ACPI: * coreboot TOM SSDT2 at %lx\n", current);
|
||||
ssdt2 = (acpi_header_t *) current;
|
||||
acpi_create_ssdt_generator(ssdt2, ACPI_TABLE_CREATOR);
|
||||
current += ssdt2->length;
|
||||
acpi_add_table(rsdp,ssdt2);
|
||||
|
||||
#if DUMP_ACPI_TABLES == 1
|
||||
printk(BIOS_DEBUG, "rsdp\n");
|
||||
|
@ -243,6 +262,9 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
printk(BIOS_DEBUG, "ssdt\n");
|
||||
dump_mem(ssdt, ((void *)ssdt) + ssdt->length);
|
||||
|
||||
printk(BIOS_DEBUG, "ssdt2\n");
|
||||
dump_mem(ssdt2, ((void *)ssdt2) + ssdt2->length);
|
||||
|
||||
printk(BIOS_DEBUG, "fadt\n");
|
||||
dump_mem(fadt, ((void *)fadt) + fadt->header.length);
|
||||
#endif
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright (C) 2011 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
DefinitionBlock ("SSDT2.aml", "SSDT", 1, "AMD-FAM10", "AMDACPI", 100925440)
|
||||
{
|
||||
Scope (_SB)
|
||||
{
|
||||
External (DADD, MethodObj)
|
||||
External (GHCE, MethodObj)
|
||||
External (GHCN, MethodObj)
|
||||
External (GHCL, MethodObj)
|
||||
External (GHCD, MethodObj)
|
||||
External (GNUS, MethodObj)
|
||||
External (GIOR, MethodObj)
|
||||
External (GMEM, MethodObj)
|
||||
External (GWBN, MethodObj)
|
||||
External (GBUS, MethodObj)
|
||||
|
||||
External (PICF)
|
||||
|
||||
External (\_SB.PCI0.LNKA, DeviceObj)
|
||||
External (\_SB.PCI0.LNKB, DeviceObj)
|
||||
External (\_SB.PCI0.LNKC, DeviceObj)
|
||||
External (\_SB.PCI0.LNKD, DeviceObj)
|
||||
|
||||
Device (PCIX)
|
||||
{
|
||||
|
||||
// BUS ? Second HT Chain
|
||||
Name (HCIN, 0xcc) // HC2 0x01
|
||||
|
||||
Name (_UID, 0xdd) // HC 0x03
|
||||
|
||||
Name (_HID, "PNP0A03")
|
||||
|
||||
Method (_ADR, 0, NotSerialized) //Fake bus should be 0
|
||||
{
|
||||
Return (DADD(GHCN(HCIN), 0x00000000))
|
||||
}
|
||||
|
||||
Method (_BBN, 0, NotSerialized)
|
||||
{
|
||||
Return (GBUS (GHCN(HCIN), GHCL(HCIN)))
|
||||
}
|
||||
|
||||
Method (_STA, 0, NotSerialized)
|
||||
{
|
||||
Return (\_SB.GHCE(HCIN))
|
||||
}
|
||||
|
||||
Method (_CRS, 0, NotSerialized)
|
||||
{
|
||||
Name (BUF0, ResourceTemplate () { })
|
||||
Store( GHCN(HCIN), Local4)
|
||||
Store( GHCL(HCIN), Local5)
|
||||
|
||||
Concatenate (\_SB.GIOR (Local4, Local5), BUF0, Local1)
|
||||
Concatenate (\_SB.GMEM (Local4, Local5), Local1, Local2)
|
||||
Concatenate (\_SB.GWBN (Local4, Local5), Local2, Local3)
|
||||
Return (Local3)
|
||||
}
|
||||
|
||||
#include "acpi/pci2_hc.asl"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright (C) 2011 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
DefinitionBlock ("SSDT3.aml", "SSDT", 1, "AMD-FAM10", "AMDACPI", 100925440)
|
||||
{
|
||||
Scope (_SB)
|
||||
{
|
||||
External (DADD, MethodObj)
|
||||
External (GHCE, MethodObj)
|
||||
External (GHCN, MethodObj)
|
||||
External (GHCL, MethodObj)
|
||||
External (GHCD, MethodObj)
|
||||
External (GNUS, MethodObj)
|
||||
External (GIOR, MethodObj)
|
||||
External (GMEM, MethodObj)
|
||||
External (GWBN, MethodObj)
|
||||
External (GBUS, MethodObj)
|
||||
|
||||
External (PICF)
|
||||
|
||||
External (\_SB.PCI0.LNKA, DeviceObj)
|
||||
External (\_SB.PCI0.LNKB, DeviceObj)
|
||||
External (\_SB.PCI0.LNKC, DeviceObj)
|
||||
External (\_SB.PCI0.LNKD, DeviceObj)
|
||||
|
||||
Device (PCIX)
|
||||
{
|
||||
|
||||
// BUS ? Second HT Chain
|
||||
Name (HCIN, 0xcc) // HC2 0x01
|
||||
|
||||
Name (_UID, 0xdd) // HC 0x03
|
||||
|
||||
Name (_HID, "PNP0A03")
|
||||
|
||||
Method (_ADR, 0, NotSerialized) //Fake bus should be 0
|
||||
{
|
||||
Return (DADD(GHCN(HCIN), 0x00000000))
|
||||
}
|
||||
|
||||
Method (_BBN, 0, NotSerialized)
|
||||
{
|
||||
Return (GBUS (GHCN(HCIN), GHCL(HCIN)))
|
||||
}
|
||||
|
||||
Method (_STA, 0, NotSerialized)
|
||||
{
|
||||
Return (\_SB.GHCE(HCIN))
|
||||
}
|
||||
|
||||
Method (_CRS, 0, NotSerialized)
|
||||
{
|
||||
Name (BUF0, ResourceTemplate () { })
|
||||
Store( GHCN(HCIN), Local4)
|
||||
Store( GHCL(HCIN), Local5)
|
||||
|
||||
Concatenate (\_SB.GIOR (Local4, Local5), BUF0, Local1)
|
||||
Concatenate (\_SB.GMEM (Local4, Local5), Local1, Local2)
|
||||
Concatenate (\_SB.GWBN (Local4, Local5), Local2, Local3)
|
||||
Return (Local3)
|
||||
}
|
||||
|
||||
#include "acpi/pci3_hc.asl"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright (C) 2011 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
DefinitionBlock ("SSDT4.aml", "SSDT", 1, "AMD-FAM10", "AMDACPI", 100925440)
|
||||
{
|
||||
Scope (_SB)
|
||||
{
|
||||
External (DADD, MethodObj)
|
||||
External (GHCE, MethodObj)
|
||||
External (GHCN, MethodObj)
|
||||
External (GHCL, MethodObj)
|
||||
External (GHCD, MethodObj)
|
||||
External (GNUS, MethodObj)
|
||||
External (GIOR, MethodObj)
|
||||
External (GMEM, MethodObj)
|
||||
External (GWBN, MethodObj)
|
||||
External (GBUS, MethodObj)
|
||||
|
||||
External (PICF)
|
||||
|
||||
External (\_SB.PCI0.LNKA, DeviceObj)
|
||||
External (\_SB.PCI0.LNKB, DeviceObj)
|
||||
External (\_SB.PCI0.LNKC, DeviceObj)
|
||||
External (\_SB.PCI0.LNKD, DeviceObj)
|
||||
|
||||
Device (PCIX)
|
||||
{
|
||||
|
||||
// BUS ? Second HT Chain
|
||||
Name (HCIN, 0xcc) // HC2 0x01
|
||||
|
||||
Name (_UID, 0xdd) // HC 0x03
|
||||
|
||||
Name (_HID, "PNP0A03")
|
||||
|
||||
Method (_ADR, 0, NotSerialized) //Fake bus should be 0
|
||||
{
|
||||
Return (DADD(GHCN(HCIN), 0x00000000))
|
||||
}
|
||||
|
||||
Method (_BBN, 0, NotSerialized)
|
||||
{
|
||||
Return (GBUS (GHCN(HCIN), GHCL(HCIN)))
|
||||
}
|
||||
|
||||
Method (_STA, 0, NotSerialized)
|
||||
{
|
||||
Return (\_SB.GHCE(HCIN))
|
||||
}
|
||||
|
||||
Method (_CRS, 0, NotSerialized)
|
||||
{
|
||||
Name (BUF0, ResourceTemplate () { })
|
||||
Store( GHCN(HCIN), Local4)
|
||||
Store( GHCL(HCIN), Local5)
|
||||
|
||||
Concatenate (\_SB.GIOR (Local4, Local5), BUF0, Local1)
|
||||
Concatenate (\_SB.GMEM (Local4, Local5), Local1, Local2)
|
||||
Concatenate (\_SB.GWBN (Local4, Local5), Local2, Local3)
|
||||
Return (Local3)
|
||||
}
|
||||
|
||||
#include "acpi/pci4_hc.asl"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright (C) 2011 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
DefinitionBlock ("SSDT5.aml", "SSDT", 1, "AMD-FAM10", "AMDACPI", 100925440)
|
||||
{
|
||||
Scope (_SB)
|
||||
{
|
||||
External (DADD, MethodObj)
|
||||
External (GHCE, MethodObj)
|
||||
External (GHCN, MethodObj)
|
||||
External (GHCL, MethodObj)
|
||||
External (GHCD, MethodObj)
|
||||
External (GNUS, MethodObj)
|
||||
External (GIOR, MethodObj)
|
||||
External (GMEM, MethodObj)
|
||||
External (GWBN, MethodObj)
|
||||
External (GBUS, MethodObj)
|
||||
|
||||
External (PICF)
|
||||
|
||||
External (\_SB.PCI0.LNKA, DeviceObj)
|
||||
External (\_SB.PCI0.LNKB, DeviceObj)
|
||||
External (\_SB.PCI0.LNKC, DeviceObj)
|
||||
External (\_SB.PCI0.LNKD, DeviceObj)
|
||||
|
||||
Device (PCIX)
|
||||
{
|
||||
|
||||
// BUS ? Second HT Chain
|
||||
Name (HCIN, 0xcc) // HC2 0x01
|
||||
|
||||
Name (_UID, 0xdd) // HC 0x03
|
||||
|
||||
Name (_HID, "PNP0A03")
|
||||
|
||||
Method (_ADR, 0, NotSerialized) //Fake bus should be 0
|
||||
{
|
||||
Return (DADD(GHCN(HCIN), 0x00000000))
|
||||
}
|
||||
|
||||
Method (_BBN, 0, NotSerialized)
|
||||
{
|
||||
Return (GBUS (GHCN(HCIN), GHCL(HCIN)))
|
||||
}
|
||||
|
||||
Method (_STA, 0, NotSerialized)
|
||||
{
|
||||
Return (\_SB.GHCE(HCIN))
|
||||
}
|
||||
|
||||
Method (_CRS, 0, NotSerialized)
|
||||
{
|
||||
Name (BUF0, ResourceTemplate () { })
|
||||
Store( GHCN(HCIN), Local4)
|
||||
Store( GHCL(HCIN), Local5)
|
||||
|
||||
Concatenate (\_SB.GIOR (Local4, Local5), BUF0, Local1)
|
||||
Concatenate (\_SB.GMEM (Local4, Local5), Local1, Local2)
|
||||
Concatenate (\_SB.GWBN (Local4, Local5), Local2, Local3)
|
||||
Return (Local3)
|
||||
}
|
||||
|
||||
#include "acpi/pci5_hc.asl"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -48,7 +48,29 @@ static void dump_mem(u32 start, u32 end)
|
|||
#endif
|
||||
|
||||
extern const unsigned char AmlCode[];
|
||||
extern const unsigned char AmlCode_ssdt[];
|
||||
|
||||
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
|
||||
{
|
||||
int lens;
|
||||
msr_t msr;
|
||||
char pscope[] = "\\_SB.PCI0";
|
||||
|
||||
lens = acpigen_write_scope(pscope);
|
||||
msr = rdmsr(TOP_MEM);
|
||||
lens += acpigen_write_name_dword("TOM1", msr.lo);
|
||||
msr = rdmsr(TOP_MEM2);
|
||||
/*
|
||||
* Since XP only implements parts of ACPI 2.0, we can't use a qword
|
||||
* here.
|
||||
* See http://www.acpi.info/presentations/S01USMOBS169_OS%2520new.ppt
|
||||
* slide 22ff.
|
||||
* Shift value right by 20 bit to make it fit into 32bit,
|
||||
* giving us 1MB granularity and a limit of almost 4Exabyte of memory.
|
||||
*/
|
||||
lens += acpigen_write_name_dword("TOM2", (msr.hi << 12) | msr.lo >> 20);
|
||||
acpigen_patch_len(lens - 1);
|
||||
return (unsigned long) (acpigen_get_current());
|
||||
}
|
||||
|
||||
unsigned long acpi_fill_mcfg(unsigned long current)
|
||||
{
|
||||
|
@ -107,6 +129,7 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
acpi_facs_t *facs;
|
||||
acpi_header_t *dsdt;
|
||||
acpi_header_t *ssdt;
|
||||
acpi_header_t *ssdt2;
|
||||
|
||||
get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
|
||||
|
||||
|
@ -131,7 +154,7 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
/* DSDT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * DSDT at %lx\n", current);
|
||||
dsdt = (acpi_header_t *)current; // it will used by fadt
|
||||
dsdt = (acpi_header_t *)current;
|
||||
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
|
||||
current += dsdt->length;
|
||||
memcpy(dsdt, &AmlCode, dsdt->length);
|
||||
|
@ -140,11 +163,11 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
/* FACS */ // it needs 64 bit alignment
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * FACS at %lx\n", current);
|
||||
facs = (acpi_facs_t *) current; // it will be used by fadt
|
||||
facs = (acpi_facs_t *) current;
|
||||
current += sizeof(acpi_facs_t);
|
||||
acpi_create_facs(facs);
|
||||
|
||||
/* FDAT */
|
||||
/* FADT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * FADT at %lx\n", current);
|
||||
fadt = (acpi_fadt_t *) current;
|
||||
|
@ -178,10 +201,12 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
if (srat != NULL) {
|
||||
memcpy((void *)current, srat, srat->header.length);
|
||||
srat = (acpi_srat_t *) current;
|
||||
//acpi_create_srat(srat);
|
||||
current += srat->header.length;
|
||||
acpi_add_table(rsdp, srat);
|
||||
}
|
||||
else {
|
||||
printk(BIOS_DEBUG, " AGESA SRAT table NULL. Skipping.\n");
|
||||
}
|
||||
|
||||
/* SLIT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
|
@ -190,14 +215,16 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
if (slit != NULL) {
|
||||
memcpy((void *)current, slit, slit->header.length);
|
||||
slit = (acpi_slit_t *) current;
|
||||
//acpi_create_slit(slit);
|
||||
current += slit->header.length;
|
||||
acpi_add_table(rsdp, slit);
|
||||
}
|
||||
else {
|
||||
printk(BIOS_DEBUG, " AGESA SLIT table NULL. Skipping.\n");
|
||||
}
|
||||
|
||||
/* SSDT */
|
||||
current = ( current + 0x0f) & -0x10;
|
||||
printk(BIOS_DEBUG, "ACPI: * SSDT at %lx\n", current);
|
||||
printk(BIOS_DEBUG, "ACPI: * AGESA SSDT Pstate at %lx\n", current);
|
||||
ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE);
|
||||
if (ssdt != NULL) {
|
||||
memcpy((void *)current, ssdt, ssdt->length);
|
||||
|
@ -205,17 +232,16 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
current += ssdt->length;
|
||||
}
|
||||
else {
|
||||
ssdt = (acpi_header_t *) current;
|
||||
memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
|
||||
current += ssdt->length;
|
||||
memcpy(ssdt, &AmlCode_ssdt, ssdt->length);
|
||||
/* recalculate checksum */
|
||||
ssdt->checksum = 0;
|
||||
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
|
||||
printk(BIOS_DEBUG, " AGESA SSDT table NULL. Skipping.\n");
|
||||
}
|
||||
acpi_add_table(rsdp,ssdt);
|
||||
|
||||
printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
|
||||
current = ( current + 0x0f) & -0x10;
|
||||
printk(BIOS_DEBUG, "ACPI: * coreboot TOM SSDT2 at %lx\n", current);
|
||||
ssdt2 = (acpi_header_t *) current;
|
||||
acpi_create_ssdt_generator(ssdt2, ACPI_TABLE_CREATOR);
|
||||
current += ssdt2->length;
|
||||
acpi_add_table(rsdp,ssdt2);
|
||||
|
||||
#if DUMP_ACPI_TABLES == 1
|
||||
printk(BIOS_DEBUG, "rsdp\n");
|
||||
|
@ -236,6 +262,9 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
printk(BIOS_DEBUG, "ssdt\n");
|
||||
dump_mem(ssdt, ((void *)ssdt) + ssdt->length);
|
||||
|
||||
printk(BIOS_DEBUG, "ssdt2\n");
|
||||
dump_mem(ssdt2, ((void *)ssdt2) + ssdt2->length);
|
||||
|
||||
printk(BIOS_DEBUG, "fadt\n");
|
||||
dump_mem(fadt, ((void *)fadt) + fadt->header.length);
|
||||
#endif
|
||||
|
|
|
@ -48,7 +48,29 @@ static void dump_mem(u32 start, u32 end)
|
|||
#endif
|
||||
|
||||
extern const unsigned char AmlCode[];
|
||||
extern const unsigned char AmlCode_ssdt[];
|
||||
|
||||
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
|
||||
{
|
||||
int lens;
|
||||
msr_t msr;
|
||||
char pscope[] = "\\_SB.PCI0";
|
||||
|
||||
lens = acpigen_write_scope(pscope);
|
||||
msr = rdmsr(TOP_MEM);
|
||||
lens += acpigen_write_name_dword("TOM1", msr.lo);
|
||||
msr = rdmsr(TOP_MEM2);
|
||||
/*
|
||||
* Since XP only implements parts of ACPI 2.0, we can't use a qword
|
||||
* here.
|
||||
* See http://www.acpi.info/presentations/S01USMOBS169_OS%2520new.ppt
|
||||
* slide 22ff.
|
||||
* Shift value right by 20 bit to make it fit into 32bit,
|
||||
* giving us 1MB granularity and a limit of almost 4Exabyte of memory.
|
||||
*/
|
||||
lens += acpigen_write_name_dword("TOM2", (msr.hi << 12) | msr.lo >> 20);
|
||||
acpigen_patch_len(lens - 1);
|
||||
return (unsigned long) (acpigen_get_current());
|
||||
}
|
||||
|
||||
unsigned long acpi_fill_mcfg(unsigned long current)
|
||||
{
|
||||
|
@ -62,13 +84,14 @@ unsigned long acpi_fill_madt(unsigned long current)
|
|||
current = acpi_create_madt_lapics(current);
|
||||
|
||||
/* Write SB800 IOAPIC, only one */
|
||||
current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, CONFIG_MAX_CPUS,
|
||||
IO_APIC_ADDR, 0);
|
||||
current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current,
|
||||
CONFIG_MAX_CPUS, IO_APIC_ADDR, 0);
|
||||
|
||||
current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
|
||||
current, 0, 0, 2, 0);
|
||||
current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
|
||||
current, 0, 9, 9, 0xF);
|
||||
|
||||
/* 0: mean bus 0--->ISA */
|
||||
/* 0: PIC 0 */
|
||||
/* 2: APIC 2 */
|
||||
|
@ -106,6 +129,7 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
acpi_facs_t *facs;
|
||||
acpi_header_t *dsdt;
|
||||
acpi_header_t *ssdt;
|
||||
acpi_header_t *ssdt2;
|
||||
|
||||
get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
|
||||
|
||||
|
@ -130,7 +154,7 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
/* DSDT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * DSDT at %lx\n", current);
|
||||
dsdt = (acpi_header_t *)current; // it will used by fadt
|
||||
dsdt = (acpi_header_t *)current;
|
||||
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
|
||||
current += dsdt->length;
|
||||
memcpy(dsdt, &AmlCode, dsdt->length);
|
||||
|
@ -139,11 +163,11 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
/* FACS */ // it needs 64 bit alignment
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * FACS at %lx\n", current);
|
||||
facs = (acpi_facs_t *) current; // it will be used by fadt
|
||||
facs = (acpi_facs_t *) current;
|
||||
current += sizeof(acpi_facs_t);
|
||||
acpi_create_facs(facs);
|
||||
|
||||
/* FDAT */
|
||||
/* FADT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * FADT at %lx\n", current);
|
||||
fadt = (acpi_fadt_t *) current;
|
||||
|
@ -177,10 +201,12 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
if (srat != NULL) {
|
||||
memcpy((void *)current, srat, srat->header.length);
|
||||
srat = (acpi_srat_t *) current;
|
||||
//acpi_create_srat(srat);
|
||||
current += srat->header.length;
|
||||
acpi_add_table(rsdp, srat);
|
||||
}
|
||||
else {
|
||||
printk(BIOS_DEBUG, " AGESA SRAT table NULL. Skipping.\n");
|
||||
}
|
||||
|
||||
/* SLIT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
|
@ -189,14 +215,16 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
if (slit != NULL) {
|
||||
memcpy((void *)current, slit, slit->header.length);
|
||||
slit = (acpi_slit_t *) current;
|
||||
//acpi_create_slit(slit);
|
||||
current += slit->header.length;
|
||||
acpi_add_table(rsdp, slit);
|
||||
}
|
||||
else {
|
||||
printk(BIOS_DEBUG, " AGESA SLIT table NULL. Skipping.\n");
|
||||
}
|
||||
|
||||
/* SSDT */
|
||||
current = ( current + 0x0f) & -0x10;
|
||||
printk(BIOS_DEBUG, "ACPI: * SSDT at %lx\n", current);
|
||||
printk(BIOS_DEBUG, "ACPI: * AGESA SSDT Pstate at %lx\n", current);
|
||||
ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE);
|
||||
if (ssdt != NULL) {
|
||||
memcpy((void *)current, ssdt, ssdt->length);
|
||||
|
@ -204,21 +232,16 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
current += ssdt->length;
|
||||
}
|
||||
else {
|
||||
ssdt = (acpi_header_t *) current;
|
||||
memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
|
||||
current += ssdt->length;
|
||||
memcpy(ssdt, &AmlCode_ssdt, ssdt->length);
|
||||
char *position = ssdt;
|
||||
if (memcmp(position + 50, "TOM1", 4) == 0)
|
||||
*(u32 *)(position + 55) = __readmsr(0xc001001a);
|
||||
|
||||
/* recalculate checksum */
|
||||
ssdt->checksum = 0;
|
||||
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
|
||||
printk(BIOS_DEBUG, " AGESA SSDT table NULL. Skipping.\n");
|
||||
}
|
||||
acpi_add_table(rsdp,ssdt);
|
||||
|
||||
printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
|
||||
current = ( current + 0x0f) & -0x10;
|
||||
printk(BIOS_DEBUG, "ACPI: * coreboot TOM SSDT2 at %lx\n", current);
|
||||
ssdt2 = (acpi_header_t *) current;
|
||||
acpi_create_ssdt_generator(ssdt2, ACPI_TABLE_CREATOR);
|
||||
current += ssdt2->length;
|
||||
acpi_add_table(rsdp,ssdt2);
|
||||
|
||||
#if DUMP_ACPI_TABLES == 1
|
||||
printk(BIOS_DEBUG, "rsdp\n");
|
||||
|
@ -239,6 +262,9 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
printk(BIOS_DEBUG, "ssdt\n");
|
||||
dump_mem(ssdt, ((void *)ssdt) + ssdt->length);
|
||||
|
||||
printk(BIOS_DEBUG, "ssdt2\n");
|
||||
dump_mem(ssdt2, ((void *)ssdt2) + ssdt2->length);
|
||||
|
||||
printk(BIOS_DEBUG, "fadt\n");
|
||||
dump_mem(fadt, ((void *)fadt) + fadt->header.length);
|
||||
#endif
|
||||
|
|
|
@ -48,7 +48,29 @@ static void dump_mem(u32 start, u32 end)
|
|||
#endif
|
||||
|
||||
extern const unsigned char AmlCode[];
|
||||
extern const unsigned char AmlCode_ssdt[];
|
||||
|
||||
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
|
||||
{
|
||||
int lens;
|
||||
msr_t msr;
|
||||
char pscope[] = "\\_SB.PCI0";
|
||||
|
||||
lens = acpigen_write_scope(pscope);
|
||||
msr = rdmsr(TOP_MEM);
|
||||
lens += acpigen_write_name_dword("TOM1", msr.lo);
|
||||
msr = rdmsr(TOP_MEM2);
|
||||
/*
|
||||
* Since XP only implements parts of ACPI 2.0, we can't use a qword
|
||||
* here.
|
||||
* See http://www.acpi.info/presentations/S01USMOBS169_OS%2520new.ppt
|
||||
* slide 22ff.
|
||||
* Shift value right by 20 bit to make it fit into 32bit,
|
||||
* giving us 1MB granularity and a limit of almost 4Exabyte of memory.
|
||||
*/
|
||||
lens += acpigen_write_name_dword("TOM2", (msr.hi << 12) | msr.lo >> 20);
|
||||
acpigen_patch_len(lens - 1);
|
||||
return (unsigned long) (acpigen_get_current());
|
||||
}
|
||||
|
||||
unsigned long acpi_fill_mcfg(unsigned long current)
|
||||
{
|
||||
|
@ -62,13 +84,14 @@ unsigned long acpi_fill_madt(unsigned long current)
|
|||
current = acpi_create_madt_lapics(current);
|
||||
|
||||
/* Write SB800 IOAPIC, only one */
|
||||
current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, CONFIG_MAX_CPUS,
|
||||
IO_APIC_ADDR, 0);
|
||||
current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current,
|
||||
CONFIG_MAX_CPUS, IO_APIC_ADDR, 0);
|
||||
|
||||
current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
|
||||
current, 0, 0, 2, 0);
|
||||
current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
|
||||
current, 0, 9, 9, 0xF);
|
||||
|
||||
/* 0: mean bus 0--->ISA */
|
||||
/* 0: PIC 0 */
|
||||
/* 2: APIC 2 */
|
||||
|
@ -106,6 +129,7 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
acpi_facs_t *facs;
|
||||
acpi_header_t *dsdt;
|
||||
acpi_header_t *ssdt;
|
||||
acpi_header_t *ssdt2;
|
||||
|
||||
get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
|
||||
|
||||
|
@ -130,7 +154,7 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
/* DSDT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * DSDT at %lx\n", current);
|
||||
dsdt = (acpi_header_t *)current; // it will used by fadt
|
||||
dsdt = (acpi_header_t *)current;
|
||||
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
|
||||
current += dsdt->length;
|
||||
memcpy(dsdt, &AmlCode, dsdt->length);
|
||||
|
@ -139,11 +163,11 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
/* FACS */ // it needs 64 bit alignment
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * FACS at %lx\n", current);
|
||||
facs = (acpi_facs_t *) current; // it will be used by fadt
|
||||
facs = (acpi_facs_t *) current;
|
||||
current += sizeof(acpi_facs_t);
|
||||
acpi_create_facs(facs);
|
||||
|
||||
/* FDAT */
|
||||
/* FADT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * FADT at %lx\n", current);
|
||||
fadt = (acpi_fadt_t *) current;
|
||||
|
@ -177,10 +201,12 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
if (srat != NULL) {
|
||||
memcpy((void *)current, srat, srat->header.length);
|
||||
srat = (acpi_srat_t *) current;
|
||||
//acpi_create_srat(srat);
|
||||
current += srat->header.length;
|
||||
acpi_add_table(rsdp, srat);
|
||||
}
|
||||
else {
|
||||
printk(BIOS_DEBUG, " AGESA SRAT table NULL. Skipping.\n");
|
||||
}
|
||||
|
||||
/* SLIT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
|
@ -189,14 +215,16 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
if (slit != NULL) {
|
||||
memcpy((void *)current, slit, slit->header.length);
|
||||
slit = (acpi_slit_t *) current;
|
||||
//acpi_create_slit(slit);
|
||||
current += slit->header.length;
|
||||
acpi_add_table(rsdp, slit);
|
||||
}
|
||||
else {
|
||||
printk(BIOS_DEBUG, " AGESA SLIT table NULL. Skipping.\n");
|
||||
}
|
||||
|
||||
/* SSDT */
|
||||
current = ( current + 0x0f) & -0x10;
|
||||
printk(BIOS_DEBUG, "ACPI: * SSDT at %lx\n", current);
|
||||
printk(BIOS_DEBUG, "ACPI: * AGESA SSDT Pstate at %lx\n", current);
|
||||
ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE);
|
||||
if (ssdt != NULL) {
|
||||
memcpy((void *)current, ssdt, ssdt->length);
|
||||
|
@ -204,21 +232,16 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
current += ssdt->length;
|
||||
}
|
||||
else {
|
||||
ssdt = (acpi_header_t *) current;
|
||||
memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
|
||||
current += ssdt->length;
|
||||
memcpy(ssdt, &AmlCode_ssdt, ssdt->length);
|
||||
char *position = ssdt;
|
||||
if (memcmp(position + 50, "TOM1", 4) == 0)
|
||||
*(u32 *)(position + 55) = __readmsr(0xc001001a);
|
||||
|
||||
/* recalculate checksum */
|
||||
ssdt->checksum = 0;
|
||||
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
|
||||
printk(BIOS_DEBUG, " AGESA SSDT table NULL. Skipping.\n");
|
||||
}
|
||||
acpi_add_table(rsdp,ssdt);
|
||||
|
||||
printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
|
||||
current = ( current + 0x0f) & -0x10;
|
||||
printk(BIOS_DEBUG, "ACPI: * coreboot TOM SSDT2 at %lx\n", current);
|
||||
ssdt2 = (acpi_header_t *) current;
|
||||
acpi_create_ssdt_generator(ssdt2, ACPI_TABLE_CREATOR);
|
||||
current += ssdt2->length;
|
||||
acpi_add_table(rsdp,ssdt2);
|
||||
|
||||
#if DUMP_ACPI_TABLES == 1
|
||||
printk(BIOS_DEBUG, "rsdp\n");
|
||||
|
@ -239,6 +262,9 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
printk(BIOS_DEBUG, "ssdt\n");
|
||||
dump_mem(ssdt, ((void *)ssdt) + ssdt->length);
|
||||
|
||||
printk(BIOS_DEBUG, "ssdt2\n");
|
||||
dump_mem(ssdt2, ((void *)ssdt2) + ssdt2->length);
|
||||
|
||||
printk(BIOS_DEBUG, "fadt\n");
|
||||
dump_mem(fadt, ((void *)fadt) + fadt->header.length);
|
||||
#endif
|
||||
|
|
|
@ -24,11 +24,9 @@
|
|||
#include <device/pci.h>
|
||||
#include <device/pci_ids.h>
|
||||
#include <cpu/x86/msr.h>
|
||||
#include <cpu/amd/mtrr.h>
|
||||
//#include <cpu/amd/amdfam10_sysconf.h>
|
||||
|
||||
//#include "mb_sysconf.h"
|
||||
#include "agesawrapper.h"
|
||||
#include <cpu/amd/mtrr.h>
|
||||
#include <cpu/amd/amdfam14.h>
|
||||
|
||||
#define DUMP_ACPI_TABLES 0
|
||||
|
||||
|
@ -50,7 +48,29 @@ static void dump_mem(u32 start, u32 end)
|
|||
#endif
|
||||
|
||||
extern const unsigned char AmlCode[];
|
||||
extern const unsigned char AmlCode_ssdt[];
|
||||
|
||||
unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id)
|
||||
{
|
||||
int lens;
|
||||
msr_t msr;
|
||||
char pscope[] = "\\_SB.PCI0";
|
||||
|
||||
lens = acpigen_write_scope(pscope);
|
||||
msr = rdmsr(TOP_MEM);
|
||||
lens += acpigen_write_name_dword("TOM1", msr.lo);
|
||||
msr = rdmsr(TOP_MEM2);
|
||||
/*
|
||||
* Since XP only implements parts of ACPI 2.0, we can't use a qword
|
||||
* here.
|
||||
* See http://www.acpi.info/presentations/S01USMOBS169_OS%2520new.ppt
|
||||
* slide 22ff.
|
||||
* Shift value right by 20 bit to make it fit into 32bit,
|
||||
* giving us 1MB granularity and a limit of almost 4Exabyte of memory.
|
||||
*/
|
||||
lens += acpigen_write_name_dword("TOM2", (msr.hi << 12) | msr.lo >> 20);
|
||||
acpigen_patch_len(lens - 1);
|
||||
return (unsigned long) (acpigen_get_current());
|
||||
}
|
||||
|
||||
unsigned long acpi_fill_mcfg(unsigned long current)
|
||||
{
|
||||
|
@ -109,6 +129,7 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
acpi_facs_t *facs;
|
||||
acpi_header_t *dsdt;
|
||||
acpi_header_t *ssdt;
|
||||
acpi_header_t *ssdt2;
|
||||
|
||||
get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */
|
||||
|
||||
|
@ -130,6 +151,31 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
acpi_write_rsdp(rsdp, rsdt, NULL);
|
||||
acpi_write_rsdt(rsdt);
|
||||
|
||||
/* DSDT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
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);
|
||||
|
||||
/* FACS */ // it needs 64 bit alignment
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * FACS at %lx\n", current);
|
||||
facs = (acpi_facs_t *) current;
|
||||
current += sizeof(acpi_facs_t);
|
||||
acpi_create_facs(facs);
|
||||
|
||||
/* FADT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
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:
|
||||
*/
|
||||
|
@ -153,76 +199,49 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
printk(BIOS_DEBUG, "ACPI: * SRAT at %lx\n", current);
|
||||
srat = (acpi_srat_t *) agesawrapper_getlateinitptr (PICK_SRAT);
|
||||
if (srat != NULL) {
|
||||
memcpy(current, srat, srat->header.length);
|
||||
memcpy((void *)current, srat, srat->header.length);
|
||||
srat = (acpi_srat_t *) current;
|
||||
//acpi_create_srat(srat);
|
||||
current += srat->header.length;
|
||||
acpi_add_table(rsdp, srat);
|
||||
}
|
||||
else {
|
||||
printk(BIOS_DEBUG, " AGESA SRAT table NULL. Skipping.\n");
|
||||
}
|
||||
|
||||
/* SLIT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * SLIT at %lx\n", current);
|
||||
slit = (acpi_slit_t *) agesawrapper_getlateinitptr (PICK_SLIT);
|
||||
if (slit != NULL) {
|
||||
memcpy(current, slit, slit->header.length);
|
||||
memcpy((void *)current, slit, slit->header.length);
|
||||
slit = (acpi_slit_t *) current;
|
||||
//acpi_create_slit(slit);
|
||||
current += slit->header.length;
|
||||
acpi_add_table(rsdp, slit);
|
||||
}
|
||||
else {
|
||||
printk(BIOS_DEBUG, " AGESA SLIT table NULL. Skipping.\n");
|
||||
}
|
||||
|
||||
/* SSDT */
|
||||
current = ( current + 0x0f) & -0x10;
|
||||
printk(BIOS_DEBUG, "ACPI: * SSDT at %lx\n", current);
|
||||
printk(BIOS_DEBUG, "ACPI: * AGESA SSDT Pstate at %lx\n", current);
|
||||
ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE);
|
||||
if (ssdt != NULL) {
|
||||
memcpy(current, ssdt, ssdt->length);
|
||||
memcpy((void *)current, ssdt, ssdt->length);
|
||||
ssdt = (acpi_header_t *) current;
|
||||
current += ssdt->length;
|
||||
}
|
||||
else {
|
||||
ssdt = (acpi_header_t *) current;
|
||||
memcpy(ssdt, &AmlCode_ssdt, sizeof(acpi_header_t));
|
||||
current += ssdt->length;
|
||||
memcpy(ssdt, &AmlCode_ssdt, ssdt->length);
|
||||
|
||||
char *position = ssdt;
|
||||
if (memcmp (position + 50, "TOM1", 4) == 0)
|
||||
*(u32 *) (position + 55) = __readmsr (0xc001001a);
|
||||
|
||||
/* recalculate checksum */
|
||||
ssdt->checksum = 0;
|
||||
ssdt->checksum = acpi_checksum((unsigned char *)ssdt,ssdt->length);
|
||||
printk(BIOS_DEBUG, " AGESA SSDT table NULL. Skipping.\n");
|
||||
}
|
||||
acpi_add_table(rsdp,ssdt);
|
||||
|
||||
printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
|
||||
|
||||
/* DSDT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * DSDT at %lx\n", current);
|
||||
dsdt = (acpi_header_t *)current; // it will used by fadt
|
||||
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);
|
||||
|
||||
/* FACS */ // it needs 64 bit alignment
|
||||
current = ( current + 0x07) & -0x08;
|
||||
printk(BIOS_DEBUG, "ACPI: * FACS at %lx\n", current);
|
||||
facs = (acpi_facs_t *) current; // it will be used by fadt
|
||||
current += sizeof(acpi_facs_t);
|
||||
acpi_create_facs(facs);
|
||||
|
||||
/* FDAT */
|
||||
current = ( current + 0x07) & -0x08;
|
||||
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);
|
||||
current = ( current + 0x0f) & -0x10;
|
||||
printk(BIOS_DEBUG, "ACPI: * coreboot TOM SSDT2 at %lx\n", current);
|
||||
ssdt2 = (acpi_header_t *) current;
|
||||
acpi_create_ssdt_generator(ssdt2, ACPI_TABLE_CREATOR);
|
||||
current += ssdt2->length;
|
||||
acpi_add_table(rsdp,ssdt2);
|
||||
|
||||
#if DUMP_ACPI_TABLES == 1
|
||||
printk(BIOS_DEBUG, "rsdp\n");
|
||||
|
@ -243,6 +262,9 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||
printk(BIOS_DEBUG, "ssdt\n");
|
||||
dump_mem(ssdt, ((void *)ssdt) + ssdt->length);
|
||||
|
||||
printk(BIOS_DEBUG, "ssdt2\n");
|
||||
dump_mem(ssdt2, ((void *)ssdt2) + ssdt2->length);
|
||||
|
||||
printk(BIOS_DEBUG, "fadt\n");
|
||||
dump_mem(fadt, ((void *)fadt) + fadt->header.length);
|
||||
#endif
|
||||
|
|
|
@ -18,5 +18,3 @@
|
|||
#
|
||||
|
||||
driver-y += northbridge.c
|
||||
|
||||
ramstage-$(CONFIG_GENERATE_ACPI_TABLES) += ssdt.asl
|
|
@ -1,346 +0,0 @@
|
|||
/*
|
||||
* This file is part of the coreboot project.
|
||||
*
|
||||
* Copyright (C) 2011 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* Make sure HC_NUMS and HC_POSSIBLE_NUM setting is consistent to this file
|
||||
*/
|
||||
|
||||
DefinitionBlock ("SSDT.aml", "SSDT", 1, "AMD-FAM14H", "AMD-ACPI", 0x1000)
|
||||
{
|
||||
/*
|
||||
* These objects were referenced but not defined in this table
|
||||
*/
|
||||
External (\_SB_.PCI0, DeviceObj)
|
||||
|
||||
Scope (\_SB.PCI0)
|
||||
{
|
||||
Name (TOM1, 0xaaaaaaaa)
|
||||
Name (BUSN, Package (0x20) /* HC_NUMS */
|
||||
{
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0xbbbbbbbb,
|
||||
0xcccccccc,
|
||||
0xdddddddd,
|
||||
0xeeeeeeee,
|
||||
0x10101010,
|
||||
0x11111111,
|
||||
0x12121212,
|
||||
0x13131313,
|
||||
0x14141414,
|
||||
0x15151515,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0xbbbbbbbb,
|
||||
0xcccccccc
|
||||
})
|
||||
Name (MMIO, Package (0x80) /* HC_NUMS * 4 */
|
||||
{
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0xbbbbbbbb,
|
||||
0xcccccccc,
|
||||
0xdddddddd,
|
||||
0xeeeeeeee,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0xbbbbbbbb,
|
||||
0xcccccccc,
|
||||
0xdddddddd,
|
||||
0xeeeeeeee,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0xbbbbbbbb,
|
||||
0xcccccccc,
|
||||
0xdddddddd,
|
||||
0xeeeeeeee,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0xbbbbbbbb,
|
||||
0xcccccccc,
|
||||
0xdddddddd,
|
||||
0xeeeeeeee,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0xbbbbbbbb,
|
||||
0xcccccccc,
|
||||
0xdddddddd,
|
||||
0xeeeeeeee,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888
|
||||
})
|
||||
Name (PCIO, Package (0x40) /* HC_NUMS * 2 */
|
||||
{
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0xbbbbbbbb,
|
||||
0xcccccccc,
|
||||
0xdddddddd,
|
||||
0xeeeeeeee,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0xbbbbbbbb,
|
||||
0xcccccccc,
|
||||
0xdddddddd,
|
||||
0xeeeeeeee,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0xbbbbbbbb,
|
||||
0xcccccccc,
|
||||
0xdddddddd,
|
||||
0xeeeeeeee,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0xbbbbbbbb,
|
||||
0xcccccccc,
|
||||
0xdddddddd,
|
||||
0xeeeeeeee,
|
||||
0xaaaaaaaa,
|
||||
0xbbbbbbbb,
|
||||
0xcccccccc,
|
||||
0xdddddddd,
|
||||
0xeeeeeeee,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x99999999,
|
||||
0xaaaaaaaa,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444
|
||||
})
|
||||
Name (SBLK, 0x11)
|
||||
Name (SBDN, 0xbbbbbbbb)
|
||||
Name (HCLK, Package (0x20) /* HC_POSSIBLE_NUM */
|
||||
{
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888
|
||||
})
|
||||
Name (HCDN, Package (0x20) /* HC_POSSIBLE_NUM */
|
||||
{
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888,
|
||||
0x11111111,
|
||||
0x22222222,
|
||||
0x33333333,
|
||||
0x44444444,
|
||||
0x55555555,
|
||||
0x66666666,
|
||||
0x77777777,
|
||||
0x88888888
|
||||
})
|
||||
Name (CBB, 0x99)
|
||||
Name (CBST, 0x88)
|
||||
Name (CBB2, 0x77)
|
||||
Name (CBS2, 0x66)
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue