Make DSDT a file in CBFS rather than embedding it into ramstage.
Makes it cleaner by putting AML into separate file rather than having an array in C code. Change-Id: Ia5d6b50ad9dabdb97ed05c837dc3ccc48b8f490f Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-on: http://review.coreboot.org/10385 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
parent
1cac2c9713
commit
36f8d27ea9
14
Makefile.inc
14
Makefile.inc
|
@ -169,15 +169,15 @@ endef
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# Add handler to compile ACPI's ASL
|
# Add handler to compile ACPI's ASL
|
||||||
define ramstage-objs_asl_template
|
define asl_template
|
||||||
$$(call src-to-obj,ramstage,$(1).asl): $(1).asl $(obj)/config.h
|
$(call strip_quotes,$(CONFIG_CBFS_PREFIX))/$(1).aml-file = $(obj)/$(1).aml
|
||||||
|
$(call strip_quotes,$(CONFIG_CBFS_PREFIX))/$(1).aml-type = raw
|
||||||
|
$(call strip_quotes,$(CONFIG_CBFS_PREFIX))/$(1).aml-compression = none
|
||||||
|
cbfs-files-y += $(call strip_quotes,$(CONFIG_CBFS_PREFIX))/$(1).aml
|
||||||
|
$(obj)/$(1).aml: $(src)/mainboard/$(MAINBOARDDIR)/$(1).asl $(obj)/config.h
|
||||||
@printf " IASL $$(subst $(top)/,,$$(@))\n"
|
@printf " IASL $$(subst $(top)/,,$$(@))\n"
|
||||||
$(CC_ramstage) -x assembler-with-cpp -E -MMD -MT $$(@) $$(CPPFLAGS_ramstage) -D__ACPI__ -P -include $(src)/include/kconfig.h -I$(obj) -I$(src) -I$(src)/include -I$(src)/arch/$(ARCHDIR-$(ARCH-ramstage-y))/include -I$(src)/mainboard/$(MAINBOARDDIR) $$< -o $$@
|
$(CC_ramstage) -x assembler-with-cpp -E -MMD -MT $$(@) $$(CPPFLAGS_ramstage) -D__ACPI__ -P -include $(src)/include/kconfig.h -I$(obj) -I$(src) -I$(src)/include -I$(src)/arch/$(ARCHDIR-$(ARCH-ramstage-y))/include -I$(src)/mainboard/$(MAINBOARDDIR) $$< -o $$@
|
||||||
cd $$(dir $$@); $(IASL) -p $$(notdir $$@) -tc $$(notdir $$@)
|
cd $$(dir $$@); $(IASL) -p $$(notdir $$@) $$(notdir $$@)
|
||||||
mv $$(basename $$@).hex $$(basename $$@).c
|
|
||||||
$(CC_ramstage) $$(CFLAGS_ramstage) $$(CPPFLAGS_ramstage) $$(if $$(subst dsdt,,$$(basename $$(notdir $(1)))), -DAmlCode=AmlCode_$$(basename $$(notdir $(1)))) -c -o $$@ $$(basename $$@).c
|
|
||||||
# keep %.o: %.c rule from catching the temporary .c file after a make clean
|
|
||||||
mv $$(basename $$@).c $$(basename $$@).hex
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
|
@ -262,19 +262,7 @@ ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/reset.c
|
||||||
endif
|
endif
|
||||||
ifeq ($(CONFIG_HAVE_ACPI_TABLES),y)
|
ifeq ($(CONFIG_HAVE_ACPI_TABLES),y)
|
||||||
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/acpi_tables.c
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/acpi_tables.c
|
||||||
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/dsdt.asl
|
$(eval $(call asl_template,dsdt))
|
||||||
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt2.asl),)
|
|
||||||
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt2.asl
|
|
||||||
endif
|
|
||||||
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt3.asl),)
|
|
||||||
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt3.asl
|
|
||||||
endif
|
|
||||||
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt4.asl),)
|
|
||||||
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt4.asl
|
|
||||||
endif
|
|
||||||
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/ssdt5.asl),)
|
|
||||||
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt5.asl
|
|
||||||
endif
|
|
||||||
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/fadt.c),)
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/fadt.c),)
|
||||||
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/fadt.c
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/fadt.c
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -723,8 +723,6 @@ void acpi_create_fadt(acpi_fadt_t *fadt,acpi_facs_t *facs, void *dsdt)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const unsigned char AmlCode[];
|
|
||||||
|
|
||||||
unsigned long __attribute__ ((weak)) fw_cfg_acpi_tables(unsigned long start)
|
unsigned long __attribute__ ((weak)) fw_cfg_acpi_tables(unsigned long start)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -741,13 +739,13 @@ unsigned long write_acpi_tables(unsigned long start)
|
||||||
acpi_facs_t *facs;
|
acpi_facs_t *facs;
|
||||||
acpi_header_t *slic_file, *slic;
|
acpi_header_t *slic_file, *slic;
|
||||||
acpi_header_t *ssdt;
|
acpi_header_t *ssdt;
|
||||||
acpi_header_t *dsdt;
|
acpi_header_t *dsdt_file, *dsdt;
|
||||||
acpi_mcfg_t *mcfg;
|
acpi_mcfg_t *mcfg;
|
||||||
acpi_tcpa_t *tcpa;
|
acpi_tcpa_t *tcpa;
|
||||||
acpi_madt_t *madt;
|
acpi_madt_t *madt;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
unsigned long fw;
|
unsigned long fw;
|
||||||
size_t slic_size;
|
size_t slic_size, dsdt_size;
|
||||||
char oem_id[6], oem_table_id[8];
|
char oem_id[6], oem_table_id[8];
|
||||||
|
|
||||||
current = start;
|
current = start;
|
||||||
|
@ -759,6 +757,21 @@ unsigned long write_acpi_tables(unsigned long start)
|
||||||
if (fw)
|
if (fw)
|
||||||
return fw;
|
return fw;
|
||||||
|
|
||||||
|
dsdt_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA,
|
||||||
|
CONFIG_CBFS_PREFIX "/dsdt.aml",
|
||||||
|
CBFS_TYPE_RAW, &dsdt_size);
|
||||||
|
if (!dsdt_file) {
|
||||||
|
printk(BIOS_ERR, "No DSDT file, skipping ACPI tables\n");
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dsdt_file->length > dsdt_size
|
||||||
|
|| dsdt_file->length < sizeof (acpi_header_t)
|
||||||
|
|| memcmp(dsdt_file->signature, "DSDT", 4) != 0) {
|
||||||
|
printk(BIOS_ERR, "Invalid DSDT file, skipping ACPI tables\n");
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
slic_file = cbfs_boot_map_with_leak(CONFIG_CBFS_PREFIX "/slic",
|
slic_file = cbfs_boot_map_with_leak(CONFIG_CBFS_PREFIX "/slic",
|
||||||
CBFS_TYPE_RAW, &slic_size);
|
CBFS_TYPE_RAW, &slic_size);
|
||||||
if (slic_file
|
if (slic_file
|
||||||
|
@ -804,7 +817,7 @@ unsigned long write_acpi_tables(unsigned long start)
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
|
printk(BIOS_DEBUG, "ACPI: * DSDT\n");
|
||||||
dsdt = (acpi_header_t *) current;
|
dsdt = (acpi_header_t *) current;
|
||||||
memcpy(dsdt, &AmlCode, sizeof(acpi_header_t));
|
memcpy(dsdt, dsdt_file, sizeof(acpi_header_t));
|
||||||
if (dsdt->length >= sizeof(acpi_header_t)) {
|
if (dsdt->length >= sizeof(acpi_header_t)) {
|
||||||
current += sizeof(acpi_header_t);
|
current += sizeof(acpi_header_t);
|
||||||
|
|
||||||
|
@ -815,7 +828,7 @@ unsigned long write_acpi_tables(unsigned long start)
|
||||||
}
|
}
|
||||||
current = (unsigned long) acpigen_get_current();
|
current = (unsigned long) acpigen_get_current();
|
||||||
memcpy((char *)current,
|
memcpy((char *)current,
|
||||||
(char *)&AmlCode + sizeof(acpi_header_t),
|
(char *)dsdt_file + sizeof(acpi_header_t),
|
||||||
dsdt->length - sizeof(acpi_header_t));
|
dsdt->length - sizeof(acpi_header_t));
|
||||||
current += dsdt->length - sizeof(acpi_header_t);
|
current += dsdt->length - sizeof(acpi_header_t);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
$(eval $(call asl_template,ssdt2))
|
||||||
|
$(eval $(call asl_template,ssdt3))
|
||||||
|
$(eval $(call asl_template,ssdt4))
|
|
@ -17,14 +17,11 @@
|
||||||
#include <cpu/x86/msr.h>
|
#include <cpu/x86/msr.h>
|
||||||
#include <cpu/amd/mtrr.h>
|
#include <cpu/amd/mtrr.h>
|
||||||
#include <cpu/amd/amdk8_sysconf.h>
|
#include <cpu/amd/amdk8_sysconf.h>
|
||||||
|
#include <cbfs.h>
|
||||||
#include "northbridge/amd/amdk8/acpi.h"
|
#include "northbridge/amd/amdk8/acpi.h"
|
||||||
#include "mb_sysconf.h"
|
#include "mb_sysconf.h"
|
||||||
#include "mainboard.h"
|
#include "mainboard.h"
|
||||||
|
|
||||||
extern const unsigned char AmlCode_ssdt2[];
|
|
||||||
extern const unsigned char AmlCode_ssdt3[];
|
|
||||||
extern const unsigned char AmlCode_ssdt4[];
|
|
||||||
|
|
||||||
unsigned long acpi_fill_madt(unsigned long current)
|
unsigned long acpi_fill_madt(unsigned long current)
|
||||||
{
|
{
|
||||||
u32 gsi_base=0x18;
|
u32 gsi_base=0x18;
|
||||||
|
@ -127,6 +124,7 @@ unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp
|
||||||
unsigned long current;
|
unsigned long current;
|
||||||
acpi_header_t *ssdtx;
|
acpi_header_t *ssdtx;
|
||||||
const void *p;
|
const void *p;
|
||||||
|
size_t p_size;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -139,6 +137,7 @@ unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp
|
||||||
//same htio, but different position? We may have to copy, change HCIN, and recalculate the checknum and add_table
|
//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
|
for(i=1;i<sysconf.hc_possible_num;i++) { // 0: is hc sblink
|
||||||
|
const char *file_name;
|
||||||
if((sysconf.pci1234[i] & 1) != 1 ) continue;
|
if((sysconf.pci1234[i] & 1) != 1 ) continue;
|
||||||
u8 c;
|
u8 c;
|
||||||
if(i<7) {
|
if(i<7) {
|
||||||
|
@ -152,17 +151,23 @@ unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp
|
||||||
ssdtx = (acpi_header_t *)current;
|
ssdtx = (acpi_header_t *)current;
|
||||||
switch(sysconf.hcid[i]) {
|
switch(sysconf.hcid[i]) {
|
||||||
case 1: //8132
|
case 1: //8132
|
||||||
p = &AmlCode_ssdt2;
|
file_name = CONFIG_CBFS_PREFIX "/ssdt2.aml";
|
||||||
break;
|
break;
|
||||||
case 2: //8151
|
case 2: //8151
|
||||||
p = &AmlCode_ssdt3;
|
file_name = CONFIG_CBFS_PREFIX "/ssdt3.aml";
|
||||||
break;
|
break;
|
||||||
case 3: //8131
|
case 3: //8131
|
||||||
p = &AmlCode_ssdt4;
|
file_name = CONFIG_CBFS_PREFIX "/ssdt4.aml";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
p = cbfs_get_file_content(CBFS_DEFAULT_MEDIA,
|
||||||
|
file_name,
|
||||||
|
CBFS_TYPE_RAW, &p_size);
|
||||||
|
if (!p || p_size < sizeof(acpi_header_t))
|
||||||
|
continue;
|
||||||
|
|
||||||
memcpy(ssdtx, p, sizeof(acpi_header_t));
|
memcpy(ssdtx, p, sizeof(acpi_header_t));
|
||||||
current += ssdtx->length;
|
current += ssdtx->length;
|
||||||
memcpy(ssdtx, p, ssdtx->length);
|
memcpy(ssdtx, p, ssdtx->length);
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
$(eval $(call asl_template,ssdt2))
|
||||||
|
$(eval $(call asl_template,ssdt3))
|
||||||
|
$(eval $(call asl_template,ssdt4))
|
||||||
|
$(eval $(call asl_template,ssdt5))
|
|
@ -26,15 +26,11 @@
|
||||||
#include <cpu/x86/msr.h>
|
#include <cpu/x86/msr.h>
|
||||||
#include <cpu/amd/mtrr.h>
|
#include <cpu/amd/mtrr.h>
|
||||||
#include <cpu/amd/amdfam10_sysconf.h>
|
#include <cpu/amd/amdfam10_sysconf.h>
|
||||||
|
#include <cbfs.h>
|
||||||
|
|
||||||
#include "mb_sysconf.h"
|
#include "mb_sysconf.h"
|
||||||
#include "mainboard.h"
|
#include "mainboard.h"
|
||||||
|
|
||||||
extern const unsigned char AmlCode_ssdt2[];
|
|
||||||
extern const unsigned char AmlCode_ssdt3[];
|
|
||||||
extern const unsigned char AmlCode_ssdt4[];
|
|
||||||
extern const unsigned char AmlCode_ssdt5[];
|
|
||||||
|
|
||||||
unsigned long acpi_fill_madt(unsigned long current)
|
unsigned long acpi_fill_madt(unsigned long current)
|
||||||
{
|
{
|
||||||
u32 gsi_base=0x18;
|
u32 gsi_base=0x18;
|
||||||
|
@ -136,6 +132,7 @@ unsigned long mainboard_write_acpi_tables(unsigned long current,
|
||||||
{
|
{
|
||||||
acpi_header_t *ssdtx;
|
acpi_header_t *ssdtx;
|
||||||
const void *p;
|
const void *p;
|
||||||
|
size_t p_size;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -145,6 +142,7 @@ unsigned long mainboard_write_acpi_tables(unsigned long current,
|
||||||
change HCIN, and recalculate the checknum and add_table */
|
change HCIN, and recalculate the checknum and add_table */
|
||||||
|
|
||||||
for(i=1;i<sysconf.hc_possible_num;i++) { // 0: is hc sblink
|
for(i=1;i<sysconf.hc_possible_num;i++) { // 0: is hc sblink
|
||||||
|
const char *file_name;
|
||||||
if((sysconf.pci1234[i] & 1) != 1 ) continue;
|
if((sysconf.pci1234[i] & 1) != 1 ) continue;
|
||||||
u8 c;
|
u8 c;
|
||||||
if(i<7) {
|
if(i<7) {
|
||||||
|
@ -158,18 +156,23 @@ unsigned long mainboard_write_acpi_tables(unsigned long current,
|
||||||
ssdtx = (acpi_header_t *)current;
|
ssdtx = (acpi_header_t *)current;
|
||||||
switch(sysconf.hcid[i]) {
|
switch(sysconf.hcid[i]) {
|
||||||
case 1:
|
case 1:
|
||||||
p = &AmlCode_ssdt2;
|
file_name = CONFIG_CBFS_PREFIX "/ssdt2.aml";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
p = &AmlCode_ssdt3;
|
file_name = CONFIG_CBFS_PREFIX "/ssdt3.aml";
|
||||||
break;
|
break;
|
||||||
case 3: //8131
|
case 3: //8131
|
||||||
p = &AmlCode_ssdt4;
|
file_name = CONFIG_CBFS_PREFIX "/ssdt4.aml";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//HTX no io apic
|
//HTX no io apic
|
||||||
p = &AmlCode_ssdt5;
|
file_name = CONFIG_CBFS_PREFIX "/ssdt5.aml";
|
||||||
}
|
}
|
||||||
|
p = cbfs_get_file_content(CBFS_DEFAULT_MEDIA,
|
||||||
|
file_name,
|
||||||
|
CBFS_TYPE_RAW, &p_size);
|
||||||
|
if (!p || p_size < sizeof(acpi_header_t))
|
||||||
|
continue;
|
||||||
memcpy(ssdtx, p, sizeof(acpi_header_t));
|
memcpy(ssdtx, p, sizeof(acpi_header_t));
|
||||||
current += ssdtx->length;
|
current += ssdtx->length;
|
||||||
memcpy(ssdtx, p, ssdtx->length);
|
memcpy(ssdtx, p, ssdtx->length);
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
$(eval $(call asl_template,ssdt2))
|
||||||
|
$(eval $(call asl_template,ssdt3))
|
||||||
|
$(eval $(call asl_template,ssdt4))
|
||||||
|
$(eval $(call asl_template,ssdt5))
|
|
@ -20,11 +20,7 @@
|
||||||
#include "northbridge/amd/amdk8/acpi.h"
|
#include "northbridge/amd/amdk8/acpi.h"
|
||||||
#include "mb_sysconf.h"
|
#include "mb_sysconf.h"
|
||||||
#include "mainboard.h"
|
#include "mainboard.h"
|
||||||
|
#include <cbfs.h>
|
||||||
extern const unsigned char AmlCode_ssdt2[];
|
|
||||||
extern const unsigned char AmlCode_ssdt3[];
|
|
||||||
extern const unsigned char AmlCode_ssdt4[];
|
|
||||||
extern const unsigned char AmlCode_ssdt5[];
|
|
||||||
|
|
||||||
unsigned long acpi_fill_madt(unsigned long current)
|
unsigned long acpi_fill_madt(unsigned long current)
|
||||||
{
|
{
|
||||||
|
@ -134,6 +130,7 @@ unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp
|
||||||
unsigned long current;
|
unsigned long current;
|
||||||
acpi_header_t *ssdtx;
|
acpi_header_t *ssdtx;
|
||||||
const void *p;
|
const void *p;
|
||||||
|
size_t p_size;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -146,6 +143,7 @@ unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp
|
||||||
//same htio, but different position? We may have to copy, change HCIN, and recalculate the checknum and add_table
|
//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
|
for(i=1;i<sysconf.hc_possible_num;i++) { // 0: is hc sblink
|
||||||
|
const char *file_name;
|
||||||
if((sysconf.pci1234[i] & 1) != 1 ) continue;
|
if((sysconf.pci1234[i] & 1) != 1 ) continue;
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
if(i<7) {
|
if(i<7) {
|
||||||
|
@ -159,19 +157,25 @@ unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp
|
||||||
ssdtx = (acpi_header_t *)current;
|
ssdtx = (acpi_header_t *)current;
|
||||||
switch(sysconf.hcid[i]) {
|
switch(sysconf.hcid[i]) {
|
||||||
case 1: //8132
|
case 1: //8132
|
||||||
p = &AmlCode_ssdt2;
|
file_name = CONFIG_CBFS_PREFIX "/ssdt2.aml";
|
||||||
break;
|
break;
|
||||||
case 2: //8151
|
case 2: //8151
|
||||||
p = &AmlCode_ssdt3;
|
file_name = CONFIG_CBFS_PREFIX "/ssdt3.aml";
|
||||||
break;
|
break;
|
||||||
case 3: //8131
|
case 3: //8131
|
||||||
p = &AmlCode_ssdt4;
|
file_name = CONFIG_CBFS_PREFIX "/ssdt4.aml";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//HTX no io apic
|
//HTX no io apic
|
||||||
p = &AmlCode_ssdt5;
|
file_name = CONFIG_CBFS_PREFIX "/ssdt5.aml";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
p = cbfs_get_file_content(CBFS_DEFAULT_MEDIA,
|
||||||
|
file_name,
|
||||||
|
CBFS_TYPE_RAW, &p_size);
|
||||||
|
if (!p || p_size < sizeof(acpi_header_t))
|
||||||
|
continue;
|
||||||
|
|
||||||
memcpy(ssdtx, p, sizeof(acpi_header_t));
|
memcpy(ssdtx, p, sizeof(acpi_header_t));
|
||||||
current += ssdtx->length;
|
current += ssdtx->length;
|
||||||
memcpy(ssdtx, p, ssdtx->length);
|
memcpy(ssdtx, p, ssdtx->length);
|
||||||
|
|
Loading…
Reference in New Issue