From: Michael S. Tsirkin Date: Tue, 4 Oct 2011 13:26:19 +0000 (+0200) Subject: acpi: automatically generated ssdt proc X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=seabios.git;a=commitdiff_plain;h=c736f0ae235ea3d90aafe3a3dd9f3c9600fb42e5 acpi: automatically generated ssdt proc Get rid of manually cut and pasted ssdt_proc, use ssdt compiled by iasl and offsets extracted by acpi_extract instead. Signed-off-by: Michael S. Tsirkin --- diff --git a/Makefile b/Makefile index 7a06d67..91d9b77 100644 --- a/Makefile +++ b/Makefile @@ -200,7 +200,7 @@ src/%.hex: src/%.dsl ./tools/acpi_extract_preprocess.py ./tools/acpi_extract.py $(Q)./tools/acpi_extract.py $(OUT)$*.lst > $(OUT)$*.off $(Q)cat $(OUT)$*.hex $(OUT)$*.off > $@ -$(OUT)ccode32flat.o: src/acpi-dsdt.hex +$(OUT)ccode32flat.o: src/acpi-dsdt.hex src/ssdt-proc.hex ####### Kconfig rules export HOSTCC := $(CC) diff --git a/src/acpi-dsdt.hex b/src/acpi-dsdt.hex index 34fa269..f894a5f 100644 --- a/src/acpi-dsdt.hex +++ b/src/acpi-dsdt.hex @@ -5,7 +5,7 @@ * Copyright (c) 2000 - 2010 Intel Corporation * Supports ACPI Specification Revision 4.0a * - * Compilation of "out/acpi-dsdt.dsl.i" - Wed Oct 12 21:10:28 2011 + * Compilation of "out/acpi-dsdt.dsl.i" - Wed Oct 12 21:14:18 2011 * * C source code output * AML code block contains 0x1B72 bytes diff --git a/src/acpi.c b/src/acpi.c index 3d8b7c8..27a939e 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -366,23 +366,16 @@ encodeLen(u8 *ssdt_ptr, int length, int bytes) return ssdt_ptr + bytes; } -// AML Processor() object. See src/ssdt-proc.dsl for info. -static unsigned char ssdt_proc[] = { - 0x5b,0x83,0x42,0x05,0x43,0x50,0x41,0x41, - 0xaa,0x10,0xb0,0x00,0x00,0x06,0x08,0x49, - 0x44,0x5f,0x5f,0x0a,0xaa,0x08,0x5f,0x48, - 0x49,0x44,0x0d,0x41,0x43,0x50,0x49,0x30, - 0x30,0x30,0x37,0x00,0x14,0x0f,0x5f,0x4d, - 0x41,0x54,0x00,0xa4,0x43,0x50,0x4d,0x41, - 0x49,0x44,0x5f,0x5f,0x14,0x0f,0x5f,0x53, - 0x54,0x41,0x00,0xa4,0x43,0x50,0x53,0x54, - 0x49,0x44,0x5f,0x5f,0x14,0x0f,0x5f,0x45, - 0x4a,0x30,0x01,0x43,0x50,0x45,0x4a,0x49, - 0x44,0x5f,0x5f,0x68 -}; -#define SD_OFFSET_CPUHEX 6 -#define SD_OFFSET_CPUID1 8 -#define SD_OFFSET_CPUID2 20 +#define AmlCode static ssdp_proc_aml +#include "ssdt-proc.hex" +#undef AmlCode + +/* 0x5B 0x83 ProcessorOp PkgLength NameString ProcID */ +#define SD_OFFSET_CPUHEX (*ssdt_proc_name - *ssdt_proc_start + 2) +#define SD_OFFSET_CPUID1 (*ssdt_proc_name - *ssdt_proc_start + 4) +#define SD_OFFSET_CPUID2 (*ssdt_proc_id - *ssdt_proc_start) +#define SD_SIZEOF (*ssdt_proc_end - *ssdt_proc_start) +#define SD_PROC (ssdp_proc_aml + *ssdt_proc_start) #define SSDT_SIGNATURE 0x54445353 // SSDT static void* @@ -391,7 +384,7 @@ build_ssdt(void) int acpi_cpus = MaxCountCPUs > 0xff ? 0xff : MaxCountCPUs; // length = ScopeOp + procs + NTYF method + CPON package int length = ((1+3+4) - + (acpi_cpus * sizeof(ssdt_proc)) + + (acpi_cpus * SD_SIZEOF) + (1+2+5+(12*acpi_cpus)) + (6+2+1+(1*acpi_cpus))); u8 *ssdt = malloc_high(sizeof(struct acpi_table_header) + length); @@ -412,12 +405,12 @@ build_ssdt(void) // build Processor object for each processor int i; for (i=0; i> 4); ssdt_ptr[SD_OFFSET_CPUHEX+1] = getHex(i); ssdt_ptr[SD_OFFSET_CPUID1] = i; ssdt_ptr[SD_OFFSET_CPUID2] = i; - ssdt_ptr += sizeof(ssdt_proc); + ssdt_ptr += SD_SIZEOF; } // build "Method(NTFY, 2) {If (LEqual(Arg0, 0x00)) {Notify(CP00, Arg1)} ...}" diff --git a/src/ssdt-proc.dsl b/src/ssdt-proc.dsl index 358afa8..a461636 100644 --- a/src/ssdt-proc.dsl +++ b/src/ssdt-proc.dsl @@ -1,16 +1,9 @@ -/* This file is the basis for the ssdt_proc[] variable in src/acpi.c. +/* This file is the basis for the ssdt table generated in src/acpi.c. * It defines the contents of the per-cpu Processor() object. At * runtime, a dynamically generated SSDT will contain one copy of this * AML snippet for every possible cpu in the system. The objects will * be placed in the \_SB_ namespace. * - * To generate a new ssdt_proc[], run the commands: - * cpp -P src/ssdt-proc.dsl > out/ssdt-proc.dsl.i - * iasl -ta -p out/ssdt-proc out/ssdt-proc.dsl.i - * tail -c +37 < out/ssdt-proc.aml | hexdump -e '" " 8/1 "0x%02x," "\n"' - * and then cut-and-paste the output into the src/acpi.c ssdt_proc[] - * array. - * * In addition to the aml code generated from this file, the * src/acpi.c file creates a NTFY method with an entry for each cpu: * Method(NTFY, 2) { @@ -22,13 +15,15 @@ * Name(CPON, Package() { One, One, ..., Zero, Zero, ... }) */ DefinitionBlock ("ssdt-proc.aml", "SSDT", 0x01, "BXPC", "BXSSDT", 0x1) -/* v------------------ DO NOT EDIT ------------------v */ { + ACPI_EXTRACT_PROCESSOR_START ssdt_proc_start + ACPI_EXTRACT_PROCESSOR_END ssdt_proc_end + ACPI_EXTRACT_PROCESSOR_STRING ssdt_proc_name Processor (CPAA, 0xAA, 0x0000b010, 0x06) { + ACPI_EXTRACT_NAME_BYTE_CONST ssdt_proc_id Name (ID, 0xAA) -/* ^------------------ DO NOT EDIT ------------------^ - * - * The src/acpi.c code requires the above layout so that it can update +/* + * The src/acpi.c code requires the above ACP_EXTRACT tags so that it can update * CPAA and 0xAA with the appropriate CPU id (see * SD_OFFSET_CPUHEX/CPUID1/CPUID2). Don't change the above without * also updating the C code. diff --git a/src/ssdt-proc.hex b/src/ssdt-proc.hex new file mode 100644 index 0000000..fb9ae06 --- /dev/null +++ b/src/ssdt-proc.hex @@ -0,0 +1,43 @@ +/* + * + * Intel ACPI Component Architecture + * ASL Optimizing Compiler version 20100528 [Feb 9 2011] + * Copyright (c) 2000 - 2010 Intel Corporation + * Supports ACPI Specification Revision 4.0a + * + * Compilation of "out/ssdt-proc.dsl.i" - Wed Oct 12 21:14:18 2011 + * + * C source code output + * AML code block contains 0x78 bytes + * + */ +unsigned char AmlCode[] = +{ + 0x53,0x53,0x44,0x54,0x78,0x00,0x00,0x00, /* 00000000 "SSDTx..." */ + 0x01,0xB3,0x42,0x58,0x50,0x43,0x00,0x00, /* 00000008 "..BXPC.." */ + 0x42,0x58,0x53,0x53,0x44,0x54,0x00,0x00, /* 00000010 "BXSSDT.." */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x28,0x05,0x10,0x20,0x5B,0x83,0x42,0x05, /* 00000020 "(.. [.B." */ + 0x43,0x50,0x41,0x41,0xAA,0x10,0xB0,0x00, /* 00000028 "CPAA...." */ + 0x00,0x06,0x08,0x49,0x44,0x5F,0x5F,0x0A, /* 00000030 "...ID__." */ + 0xAA,0x08,0x5F,0x48,0x49,0x44,0x0D,0x41, /* 00000038 ".._HID.A" */ + 0x43,0x50,0x49,0x30,0x30,0x30,0x37,0x00, /* 00000040 "CPI0007." */ + 0x14,0x0F,0x5F,0x4D,0x41,0x54,0x00,0xA4, /* 00000048 ".._MAT.." */ + 0x43,0x50,0x4D,0x41,0x49,0x44,0x5F,0x5F, /* 00000050 "CPMAID__" */ + 0x14,0x0F,0x5F,0x53,0x54,0x41,0x00,0xA4, /* 00000058 ".._STA.." */ + 0x43,0x50,0x53,0x54,0x49,0x44,0x5F,0x5F, /* 00000060 "CPSTID__" */ + 0x14,0x0F,0x5F,0x45,0x4A,0x30,0x01,0x43, /* 00000068 ".._EJ0.C" */ + 0x50,0x45,0x4A,0x49,0x44,0x5F,0x5F,0x68 /* 00000070 "PEJID__h" */ +}; +static unsigned char ssdt_proc_id[] = { +0x38 +}; +static unsigned char ssdt_proc_name[] = { +0x28 +}; +static unsigned char ssdt_proc_end[] = { +0x78 +}; +static unsigned char ssdt_proc_start[] = { +0x24 +};