[coreboot-gerrit] Patch set updated for coreboot: c761f0c ACPI: slic support

Vladimir Serbinenko (phcoder@gmail.com) gerrit at coreboot.org
Mon Oct 27 00:25:48 CET 2014


Vladimir Serbinenko (phcoder at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7202

-gerrit

commit c761f0c2ec6b7440dd25b353c60a1c63e93cd6b3
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date:   Sun Oct 26 20:42:08 2014 +0100

    ACPI: slic support
    
    Change-Id: Id0e7fe0a49b9cd50b5e43cd15030e1c2098728ec
    Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
---
 src/Kconfig                           |  4 ---
 src/arch/x86/boot/acpi.c              | 61 +++++++++++++++++++++++------------
 src/arch/x86/boot/tables.c            |  6 ++--
 src/arch/x86/include/arch/acpi.h      |  8 -----
 src/mainboard/getac/p470/Kconfig      |  1 -
 src/mainboard/getac/p470/Makefile.inc |  1 -
 src/mainboard/getac/p470/acpi_slic.c  | 38 ----------------------
 7 files changed, 43 insertions(+), 76 deletions(-)

diff --git a/src/Kconfig b/src/Kconfig
index 5255130..81fbe93 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -342,10 +342,6 @@ config HAVE_ACPI_RESUME
 	bool
 	default n
 
-config HAVE_ACPI_SLIC
-	bool
-	default n
-
 config ACPI_SSDTX_NUM
 	int
 	default 0
diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c
index baea65c..e94e3fe 100644
--- a/src/arch/x86/boot/acpi.c
+++ b/src/arch/x86/boot/acpi.c
@@ -33,6 +33,7 @@
 #include <cbmem.h>
 #include <cpu/x86/lapic_def.h>
 #include <cpu/cpu.h>
+#include <cbfs.h>
 #if CONFIG_COLLECT_TIMESTAMPS
 #include <timestamp.h>
 #endif
@@ -502,14 +503,14 @@ void acpi_create_facs(acpi_facs_t *facs)
 	facs->version = 1; /* ACPI 1.0: 0, ACPI 2.0/3.0: 1, ACPI 4.0: 2 */
 }
 
-void acpi_write_rsdt(acpi_rsdt_t *rsdt)
+static void acpi_write_rsdt(acpi_rsdt_t *rsdt, char *oem_id, char *oem_table_id)
 {
 	acpi_header_t *header = &(rsdt->header);
 
 	/* Fill out header fields. */
 	memcpy(header->signature, "RSDT", 4);
-	memcpy(header->oem_id, OEM_ID, 6);
-	memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
+	memcpy(header->oem_id, oem_id, 6);
+	memcpy(header->oem_table_id, oem_table_id, 8);
 	memcpy(header->asl_compiler_id, ASLC, 4);
 
 	header->length = sizeof(acpi_rsdt_t);
@@ -521,14 +522,14 @@ void acpi_write_rsdt(acpi_rsdt_t *rsdt)
 	header->checksum = acpi_checksum((void *)rsdt, sizeof(acpi_rsdt_t));
 }
 
-void acpi_write_xsdt(acpi_xsdt_t *xsdt)
+static void acpi_write_xsdt(acpi_xsdt_t *xsdt, char *oem_id, char *oem_table_id)
 {
 	acpi_header_t *header = &(xsdt->header);
 
 	/* Fill out header fields. */
 	memcpy(header->signature, "XSDT", 4);
-	memcpy(header->oem_id, OEM_ID, 6);
-	memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
+	memcpy(header->oem_id, oem_id, 6);
+	memcpy(header->oem_table_id, oem_table_id, 8);
 	memcpy(header->asl_compiler_id, ASLC, 4);
 
 	header->length = sizeof(acpi_xsdt_t);
@@ -540,12 +541,13 @@ void acpi_write_xsdt(acpi_xsdt_t *xsdt)
 	header->checksum = acpi_checksum((void *)xsdt, sizeof(acpi_xsdt_t));
 }
 
-void acpi_write_rsdp(acpi_rsdp_t *rsdp, acpi_rsdt_t *rsdt, acpi_xsdt_t *xsdt)
+static void acpi_write_rsdp(acpi_rsdp_t *rsdp, acpi_rsdt_t *rsdt,
+			    acpi_xsdt_t *xsdt, char *oem_id)
 {
 	memset(rsdp, 0, sizeof(acpi_rsdp_t));
 
 	memcpy(rsdp->signature, RSDP_SIG, 8);
-	memcpy(rsdp->oem_id, OEM_ID, 6);
+	memcpy(rsdp->oem_id, oem_id, 6);
 
 	rsdp->length = sizeof(acpi_rsdp_t);
 	rsdp->rsdt_address = (u32)rsdt;
@@ -700,14 +702,30 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_xsdt_t *xsdt;
 	acpi_fadt_t *fadt;
 	acpi_facs_t *facs;
-#if CONFIG_HAVE_ACPI_SLIC
-	acpi_header_t *slic;
-#endif
+	acpi_header_t *slic_file, *slic;
 	acpi_header_t *ssdt;
 	acpi_header_t *dsdt;
 	acpi_mcfg_t *mcfg;
 	acpi_madt_t *madt;
 	device_t dev;
+	size_t slic_size;
+	char oem_id[6], oem_table_id[8];
+
+	slic_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA,
+				     CONFIG_CBFS_PREFIX "/slic",
+				     CBFS_TYPE_RAW, &slic_size);
+	if (slic_file && (slic_file->length > slic_size
+			  || slic_file->length < sizeof (acpi_header_t))) {
+		slic_file = 0;
+	}
+
+	if (slic_file) {
+		memcpy(oem_id, slic_file->oem_id, 6);
+		memcpy(oem_table_id, slic_file->oem_table_id, 8);
+	} else {
+		memcpy(oem_id, OEM_ID, 6);
+		memcpy(oem_table_id, ACPI_TABLE_CREATOR, 8);
+	}
 
 	current = start;
 
@@ -730,9 +748,9 @@ unsigned long write_acpi_tables(unsigned long start)
 	/* clear all table memory */
 	memset((void *) start, 0, current - start);
 
-	acpi_write_rsdp(rsdp, rsdt, xsdt);
-	acpi_write_rsdt(rsdt);
-	acpi_write_xsdt(xsdt);
+	acpi_write_rsdp(rsdp, rsdt, xsdt, oem_id);
+	acpi_write_rsdt(rsdt, oem_id, oem_table_id);
+	acpi_write_xsdt(xsdt, oem_id, oem_table_id);
 
 	printk(BIOS_DEBUG, "ACPI:    * FACS\n");
 	facs = (acpi_facs_t *) current;
@@ -773,13 +791,14 @@ unsigned long write_acpi_tables(unsigned long start)
 	acpi_create_fadt(fadt, facs, dsdt);
 	acpi_add_table(rsdp, fadt);
 
-#if CONFIG_HAVE_ACPI_SLIC
-	printk(BIOS_DEBUG, "ACPI:     * SLIC\n");
-	slic = (acpi_header_t *)current;
-	current += acpi_create_slic(current);
-	ALIGN_CURRENT;
-	acpi_add_table(rsdp, slic);
-#endif
+	if (slic_file) {
+		printk(BIOS_DEBUG, "ACPI:     * SLIC\n");
+		slic = (acpi_header_t *)current;
+		memcpy(slic, slic_file, slic_file->length);
+		current += slic_file->length;
+		ALIGN_CURRENT;
+		acpi_add_table(rsdp, slic);
+	}
 
 	printk(BIOS_DEBUG, "ACPI:     * SSDT\n");
 	ssdt = (acpi_header_t *)current;
diff --git a/src/arch/x86/boot/tables.c b/src/arch/x86/boot/tables.c
index 9f2afd4..d412596 100644
--- a/src/arch/x86/boot/tables.c
+++ b/src/arch/x86/boot/tables.c
@@ -158,9 +158,9 @@ void write_tables(void)
 			acpi_rsdp_t *low_rsdp = (acpi_rsdp_t *)rom_table_end,
 				    *high_rsdp = (acpi_rsdp_t *)acpi_start;
 
-			acpi_write_rsdp(low_rsdp,
-				(acpi_rsdt_t *)(high_rsdp->rsdt_address),
-				(acpi_xsdt_t *)((unsigned long)high_rsdp->xsdt_address));
+			/* Technically rsdp length varies but coreboot always
+			   writes longest size available.  */
+			memcpy(low_rsdp, high_rsdp, sizeof(acpi_rsdp_t));
 		} else {
 			printk(BIOS_ERR, "ERROR: Didn't find RSDP in high table.\n");
 		}
diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h
index 313bdf1..255f0a2 100644
--- a/src/arch/x86/include/arch/acpi.h
+++ b/src/arch/x86/include/arch/acpi.h
@@ -544,14 +544,6 @@ unsigned long acpi_create_dmar_drhd_ds_pci(unsigned long current, u8 segment,
 
 unsigned long acpi_fill_dmar(unsigned long);
 
-#if CONFIG_HAVE_ACPI_SLIC
-unsigned long acpi_create_slic(unsigned long current);
-#endif
-
-void acpi_write_rsdt(acpi_rsdt_t *rsdt);
-void acpi_write_xsdt(acpi_xsdt_t *xsdt);
-void acpi_write_rsdp(acpi_rsdp_t *rsdp, acpi_rsdt_t *rsdt, acpi_xsdt_t *xsdt);
-
 void acpi_write_hest(acpi_hest_t *hest);
 unsigned long acpi_create_hest_error_source(acpi_hest_t *hest, acpi_hest_esd_t *esd, u16 type, void *data, u16 len);
 unsigned long acpi_fill_hest(acpi_hest_t *hest);
diff --git a/src/mainboard/getac/p470/Kconfig b/src/mainboard/getac/p470/Kconfig
index 22a45e8..d09d7a0 100644
--- a/src/mainboard/getac/p470/Kconfig
+++ b/src/mainboard/getac/p470/Kconfig
@@ -34,7 +34,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy
 	select HAVE_MP_TABLE
 	select HAVE_OPTION_TABLE
 	select HAVE_ACPI_RESUME
-	select HAVE_ACPI_SLIC
 	select UDELAY_LAPIC
 	select BOARD_ROMSIZE_KB_1024
 	select CHANNEL_XOR_RANDOMIZATION
diff --git a/src/mainboard/getac/p470/Makefile.inc b/src/mainboard/getac/p470/Makefile.inc
index ebfdd49..1ba662e 100644
--- a/src/mainboard/getac/p470/Makefile.inc
+++ b/src/mainboard/getac/p470/Makefile.inc
@@ -17,4 +17,3 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 ##
 
-ramstage-$(CONFIG_HAVE_ACPI_SLIC) += acpi_slic.c
diff --git a/src/mainboard/getac/p470/acpi_slic.c b/src/mainboard/getac/p470/acpi_slic.c
deleted file mode 100644
index b042f36..0000000
--- a/src/mainboard/getac/p470/acpi_slic.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2009 coresystems GmbH
- *
- * 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
- */
-
-#include <string.h>
-#include <device/pci.h>
-#include <arch/acpi.h>
-
-static const char slic[0x4] = {
-	0x53, 0x4c, 0x49, 0x43 /* incomplete. */
-	/* If you wish to compile coreboot images with a windows license key
-	 * built in, you need to extract the ACPI SLIC from your machine and
-	 * add it here.
-	 */
-};
-
-unsigned long acpi_create_slic(unsigned long current)
-{
-	memcpy((void *) current, slic, sizeof(slic));
-	return sizeof(slic);
-}



More information about the coreboot-gerrit mailing list