From 5e597572ef9b32dfd0ea0b94a9fddd998bfd0f77 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sat, 11 Oct 2014 23:45:40 +0200 Subject: acpi: make fill_slit and fill_srat into arguments. SLIT and SRAT are created this way only on amdk8 and amdfam10. This saves the need of having a lot of dummies. Change-Id: I76d042702209cd6d11ee78ac22cf9fe9d30d0ca5 Signed-off-by: Vladimir Serbinenko Reviewed-on: http://review.coreboot.org/7052 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/northbridge/amd/agesa/family12/northbridge.c | 12 -------- src/northbridge/amd/agesa/family14/northbridge.c | 13 --------- src/northbridge/amd/agesa/family15/northbridge.c | 12 -------- src/northbridge/amd/agesa/family15rl/northbridge.c | 12 -------- src/northbridge/amd/agesa/family15tn/northbridge.c | 12 -------- src/northbridge/amd/agesa/family16kb/northbridge.c | 12 -------- src/northbridge/amd/amdfam10/acpi.c | 8 +++--- src/northbridge/amd/amdk8/acpi.c | 33 ++++++++++++++++++++-- src/northbridge/amd/amdk8/acpi.h | 1 + src/northbridge/amd/amdk8/northbridge.c | 31 -------------------- src/northbridge/amd/pi/00630F01/northbridge.c | 12 -------- src/northbridge/amd/pi/00730F01/northbridge.c | 12 -------- 12 files changed, 36 insertions(+), 134 deletions(-) (limited to 'src/northbridge/amd') diff --git a/src/northbridge/amd/agesa/family12/northbridge.c b/src/northbridge/amd/agesa/family12/northbridge.c index 9d078ed33d..26d4eee856 100644 --- a/src/northbridge/amd/agesa/family12/northbridge.c +++ b/src/northbridge/amd/agesa/family12/northbridge.c @@ -811,18 +811,6 @@ unsigned long acpi_fill_hest(acpi_hest_t *hest) return (unsigned long)current; } -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_slit(unsigned long current) -{ - return current; -} - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_srat(unsigned long current) -{ - return current; -} - static void northbridge_fill_ssdt_generator(void) { msr_t msr; diff --git a/src/northbridge/amd/agesa/family14/northbridge.c b/src/northbridge/amd/agesa/family14/northbridge.c index 4017944595..e4da36cfd3 100644 --- a/src/northbridge/amd/agesa/family14/northbridge.c +++ b/src/northbridge/amd/agesa/family14/northbridge.c @@ -907,19 +907,6 @@ static unsigned long agesa_write_acpi_tables(unsigned long current, return current; } - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_slit(unsigned long current) -{ - return current; -} - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_srat(unsigned long current) -{ - return current; -} - static struct device_operations northbridge_operations = { .read_resources = nb_read_resources, .set_resources = nb_set_resources, diff --git a/src/northbridge/amd/agesa/family15/northbridge.c b/src/northbridge/amd/agesa/family15/northbridge.c index 593579ecd5..14f56f2594 100644 --- a/src/northbridge/amd/agesa/family15/northbridge.c +++ b/src/northbridge/amd/agesa/family15/northbridge.c @@ -501,18 +501,6 @@ unsigned long acpi_fill_hest(acpi_hest_t *hest) return (unsigned long)current; } -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_slit(unsigned long current) -{ - return current; -} - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_srat(unsigned long current) -{ - return current; -} - static void northbridge_fill_ssdt_generator(void) { msr_t msr; diff --git a/src/northbridge/amd/agesa/family15rl/northbridge.c b/src/northbridge/amd/agesa/family15rl/northbridge.c index 223a0a0af7..b9baf0c8f7 100644 --- a/src/northbridge/amd/agesa/family15rl/northbridge.c +++ b/src/northbridge/amd/agesa/family15rl/northbridge.c @@ -477,18 +477,6 @@ unsigned long acpi_fill_hest(acpi_hest_t *hest) return (unsigned long)current; } -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_slit(unsigned long current) -{ - return current; -} - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_srat(unsigned long current) -{ - return current; -} - static void northbridge_fill_ssdt_generator(void) { msr_t msr; diff --git a/src/northbridge/amd/agesa/family15tn/northbridge.c b/src/northbridge/amd/agesa/family15tn/northbridge.c index a18da684c5..29337fbe16 100644 --- a/src/northbridge/amd/agesa/family15tn/northbridge.c +++ b/src/northbridge/amd/agesa/family15tn/northbridge.c @@ -476,18 +476,6 @@ unsigned long acpi_fill_hest(acpi_hest_t *hest) return (unsigned long)current; } -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_slit(unsigned long current) -{ - return current; -} - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_srat(unsigned long current) -{ - return current; -} - static void northbridge_fill_ssdt_generator(void) { msr_t msr; diff --git a/src/northbridge/amd/agesa/family16kb/northbridge.c b/src/northbridge/amd/agesa/family16kb/northbridge.c index d0638caaa9..86d5a922da 100644 --- a/src/northbridge/amd/agesa/family16kb/northbridge.c +++ b/src/northbridge/amd/agesa/family16kb/northbridge.c @@ -477,18 +477,6 @@ unsigned long acpi_fill_hest(acpi_hest_t *hest) return (unsigned long)current; } -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_slit(unsigned long current) -{ - return current; -} - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_srat(unsigned long current) -{ - return current; -} - static void northbridge_fill_ssdt_generator(void) { msr_t msr; diff --git a/src/northbridge/amd/amdfam10/acpi.c b/src/northbridge/amd/amdfam10/acpi.c index c6e004c97d..7897709460 100644 --- a/src/northbridge/amd/amdfam10/acpi.c +++ b/src/northbridge/amd/amdfam10/acpi.c @@ -109,7 +109,7 @@ static void set_srat_mem(void *gp, struct device *dev, struct resource *res) state->current += acpi_create_srat_mem((acpi_srat_mem_t *)state->current, (res->index & 0xf), basek, sizek, 1); } -unsigned long acpi_fill_srat(unsigned long current) +static unsigned long acpi_fill_srat(unsigned long current) { struct acpi_srat_mem_state srat_mem_state; @@ -130,7 +130,7 @@ unsigned long acpi_fill_srat(unsigned long current) return current; } -unsigned long acpi_fill_slit(unsigned long current) +static unsigned long acpi_fill_slit(unsigned long current) { /* Implement SLIT algorithm in BKDG Rev. 3.62 ยง 2.3.6.1 * Fill the first 8 bytes with the node number, @@ -342,7 +342,7 @@ unsigned long northbridge_write_acpi_tables(unsigned long current, current = ALIGN(current, 8); printk(BIOS_DEBUG, "ACPI: * SRAT at %lx\n", current); srat = (acpi_srat_t *) current; - acpi_create_srat(srat); + acpi_create_srat(srat, acpi_fill_srat); current += srat->header.length; acpi_add_table(rsdp, srat); @@ -350,7 +350,7 @@ unsigned long northbridge_write_acpi_tables(unsigned long current, current = ALIGN(current, 8); printk(BIOS_DEBUG, "ACPI: * SLIT at %lx\n", current); slit = (acpi_slit_t *) current; - acpi_create_slit(slit); + acpi_create_slit(slit, acpi_fill_slit); current += slit->header.length; acpi_add_table(rsdp, slit); diff --git a/src/northbridge/amd/amdk8/acpi.c b/src/northbridge/amd/amdk8/acpi.c index 3f3b009a7a..7086ba8115 100644 --- a/src/northbridge/amd/amdk8/acpi.c +++ b/src/northbridge/amd/amdk8/acpi.c @@ -114,7 +114,7 @@ static void set_srat_mem(void *gp, struct device *dev, struct resource *res) state->current += acpi_create_srat_mem((acpi_srat_mem_t *)state->current, (res->index & 0xf), basek, sizek, 1); } -unsigned long acpi_fill_srat(unsigned long current) +static unsigned long acpi_fill_srat(unsigned long current) { struct acpi_srat_mem_state srat_mem_state; @@ -135,7 +135,7 @@ unsigned long acpi_fill_srat(unsigned long current) return current; } -unsigned long acpi_fill_slit(unsigned long current) +static unsigned long acpi_fill_slit(unsigned long current) { /* need to find out the node num at first */ /* fill the first 8 byte with that num */ @@ -204,6 +204,35 @@ unsigned long acpi_fill_slit(unsigned long current) return current; } +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; + + /* Fills sysconf structure needed for SRAT and SLIT. */ + get_bus_conf(); + + current = ALIGN(current, 16); + srat = (acpi_srat_t *) current; + printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat); + acpi_create_srat(srat, acpi_fill_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, acpi_fill_slit); + current+=slit->header.length; + acpi_add_table(rsdp,slit); + + return current; +} + static void k8acpi_write_HT(void) { int i; diff --git a/src/northbridge/amd/amdk8/acpi.h b/src/northbridge/amd/amdk8/acpi.h index 6d7c4d9753..4d71507355 100644 --- a/src/northbridge/amd/amdk8/acpi.h +++ b/src/northbridge/amd/amdk8/acpi.h @@ -22,5 +22,6 @@ #include void k8acpi_write_vars(void); +unsigned long northbridge_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp); #endif diff --git a/src/northbridge/amd/amdk8/northbridge.c b/src/northbridge/amd/amdk8/northbridge.c index a17aa65a82..f2e0e4c5f7 100644 --- a/src/northbridge/amd/amdk8/northbridge.c +++ b/src/northbridge/amd/amdk8/northbridge.c @@ -579,37 +579,6 @@ static void mcf0_control_init(struct device *dev) #endif } -#if IS_ENABLED(CONFIG_HAVE_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; - - /* Fills sysconf structure needed for SRAT and SLIT. */ - get_bus_conf(); - - 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, diff --git a/src/northbridge/amd/pi/00630F01/northbridge.c b/src/northbridge/amd/pi/00630F01/northbridge.c index f8b32460d9..76581cdf0a 100644 --- a/src/northbridge/amd/pi/00630F01/northbridge.c +++ b/src/northbridge/amd/pi/00630F01/northbridge.c @@ -471,18 +471,6 @@ unsigned long acpi_fill_hest(acpi_hest_t *hest) return (unsigned long)current; } -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_slit(unsigned long current) -{ - return current; -} - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_srat(unsigned long current) -{ - return current; -} - static void northbridge_fill_ssdt_generator(void) { msr_t msr; diff --git a/src/northbridge/amd/pi/00730F01/northbridge.c b/src/northbridge/amd/pi/00730F01/northbridge.c index b10da3d39b..4f646f7b9f 100644 --- a/src/northbridge/amd/pi/00730F01/northbridge.c +++ b/src/northbridge/amd/pi/00730F01/northbridge.c @@ -465,18 +465,6 @@ unsigned long acpi_fill_hest(acpi_hest_t *hest) return (unsigned long)current; } -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_slit(unsigned long current) -{ - return current; -} - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_srat(unsigned long current) -{ - return current; -} - static void northbridge_fill_ssdt_generator(void) { msr_t msr; -- cgit v1.2.3