From 2a19fb1d76c42cb516a4ab6f253de8c65d8cc3ad Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Thu, 2 Oct 2014 20:09:19 +0200 Subject: amdfam10: Move to per-device ACPI Change-Id: I9ce2333e1ea527843f83d411dea2a669263156c2 Signed-off-by: Vladimir Serbinenko Reviewed-on: http://review.coreboot.org/7027 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan --- src/northbridge/amd/amdfam10/acpi.c | 209 +++++++++++++++++++++--------------- 1 file changed, 124 insertions(+), 85 deletions(-) (limited to 'src/northbridge/amd/amdfam10/acpi.c') diff --git a/src/northbridge/amd/amdfam10/acpi.c b/src/northbridge/amd/amdfam10/acpi.c index 513fa58f7e..463fb7cb8a 100644 --- a/src/northbridge/amd/amdfam10/acpi.c +++ b/src/northbridge/amd/amdfam10/acpi.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -162,131 +163,169 @@ unsigned long acpi_fill_slit(unsigned long current) return current; } -// moved from mb acpi_tables.c -static void intx_to_stream(u32 val, u32 len, u8 *dest) +void update_ssdtx(void *ssdtx, int i) { - int i; - for(i=0;i> (8*i)) & 0xff; + u8 *PCI; + u8 *HCIN; + u8 *UID; + + PCI = ssdtx + 0x32; + HCIN = ssdtx + 0x39; + UID = ssdtx + 0x40; + + if (i < 7) { + *PCI = (u8) ('4' + i - 1); + } else { + *PCI = (u8) ('A' + i - 1 - 6); } -} + *HCIN = (u8) i; + *UID = (u8) (i + 3); + + /* FIXME: need to update the GSI id in the ssdtx too */ -static void int_to_stream(u32 val, u8 *dest) -{ - return intx_to_stream(val, 4, dest); } -// used by acpi_tables.h -void update_ssdt(void *ssdt) +void northbridge_acpi_write_vars(void) { - u8 *BUSN; - u8 *MMIO; - u8 *PCIO; - u8 *SBLK; - u8 *TOM1; - u8 *SBDN; - u8 *HCLK; - u8 *HCDN; - u8 *CBST; - u8 *CBBX; - u8 *CBS2; - u8 *CBB2; + msr_t msr; + char pscope[] = "\\_SB.PCI0"; + int i; + get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */ - int i; - u32 dword; - msr_t msr; + acpigen_write_scope(pscope); - // the offset could be different if have different HC_NUMS, and HC_POSSIBLE_NUM and ssdt.asl - BUSN = ssdt+0x3b; //+5 will be next BUSN - MMIO = ssdt+0xe4; //+5 will be next MMIO - PCIO = ssdt+0x36d; //+5 will be next PCIO - SBLK = ssdt+0x4b2; // one byte - TOM1 = ssdt+0x4b9; // - SBDN = ssdt+0x4c3;// - HCLK = ssdt+0x4d1; //+5 will be next HCLK - HCDN = ssdt+0x57a; //+5 will be next HCDN - CBBX = ssdt+0x61f; // - CBST = ssdt+0x626; - CBB2 = ssdt+0x62d; // - CBS2 = ssdt+0x634; - - for(i=0;i> 20); - int_to_stream(sysconf.sbdn, SBDN); + + acpigen_write_name_dword("SBDN", sysconf.sbdn); + + acpigen_write_name("HCLK"); + + acpigen_write_package(HC_POSSIBLE_NUM); for(i=0;i> 12) & 0xff) { //sb chain on other than bus 0 - *CBST = (u8) (0x0f); + CBST = (u8) (0x0f); } else { - *CBST = (u8) (0x00); + CBST = (u8) (0x00); } } + acpigen_write_name_byte("CBST", CBST); + if((CONFIG_CBB == 0xff) && (sysconf.nodes>32)) { - *CBS2 = 0x0f; - *CBB2 = (u8)(CONFIG_CBB-1); + CBS2 = 0x0f; + CBB2 = (u8)(CONFIG_CBB-1); } else { - *CBS2 = 0x00; - *CBB2 = 0x00; + CBS2 = 0x00; + CBB2 = 0x00; } + acpigen_write_name_byte("CBB2", CBB2); + acpigen_write_name_byte("CBS2", CBS2); + + //minus opcode + acpigen_pop_len(); } -void update_ssdtx(void *ssdtx, int i) +unsigned long northbridge_write_acpi_tables(unsigned long current, + struct acpi_rsdp *rsdp) { - u8 *PCI; - u8 *HCIN; - u8 *UID; - - PCI = ssdtx + 0x32; - HCIN = ssdtx + 0x39; - UID = ssdtx + 0x40; - - if (i < 7) { - *PCI = (u8) ('4' + i - 1); - } else { - *PCI = (u8) ('A' + i - 1 - 6); - } - *HCIN = (u8) i; - *UID = (u8) (i + 3); - - /* FIXME: need to update the GSI id in the ssdtx too */ + acpi_srat_t *srat; + acpi_slit_t *slit; + + get_bus_conf(); /* it will get sblk, pci1234, hcdn, and sbdn */ + + /* SRAT */ + current = ALIGN(current, 8); + 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 */ + current = ALIGN(current, 8); + 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); + return current; } - -- cgit v1.2.3