generate ACPI firmware volume and removed Linux ACPI table hacks (issue #266)

This commit is contained in:
Trammell hudson 2017-09-25 15:21:16 -04:00
parent 86f90c8947
commit 212b030660
Failed to extract signature
25 changed files with 21 additions and 140 deletions

View File

@ -18,6 +18,7 @@ AcpiTableProtocolGuid := { 0xFFE06BDD, 0x6107, 0x46A6, { 0x7B, 0xB2, 0x5A, 0x9C,
dxe-y += DxeCore
DxeCore-filetype := EFI_FV_FILETYPE_DXE_CORE
DxeCore-guid := D6A2CB7F-6A18-4E2F-B43B-9920A733700A
DxeCore-align := 1K
dxe-y += RuntimeDxe
RuntimeDxe-depex := TRUE
@ -31,6 +32,23 @@ dxe-y += AcpiPlatform
AcpiPlatform-guid := cb933912-df8f-4305-b1f9-7b44fa11395c
AcpiPlatform-depex := $(RuntimeArchProtocolGuid) AND $(AcpiTableProtocolGuid)
#dxe-y += Acpi-data
Acpi-data-file := /dev/null
Acpi-data-guid := 7E374E25-8E01-4FEE-87F2-390C23C606CD
Acpi-data-filetype := EFI_FV_FILETYPE_FREEFORM
Acpi-data-sectiontype := EFI_SECTION_RAW
Acpi-data.ffs: $(sort blobs/r630/acpi/*)
for file in $^; do \
$(EDK2_DIR)/GenSec \
-s EFI_SECTION_RAW \
-o `basename $$file`.sec $$file; \
done
$(EDK2_DIR)/GenFfs \
-t EFI_FV_FILETYPE_FREEFORM \
-g $(Acpi-data-guid) \
-o $@ \
$(foreach f,$^,-i $(notdir $f).sec)
dxe-y += Linux
Linux-file := $(build)/$(linux_dir)/arch/x86/boot/bzImage
@ -79,7 +97,7 @@ $1.ffs: $1.file.sec $1.ver.sec $1.name.sec \
$(EDK2_DIR)/GenFfs \
-t $(or $($1-filetype),EFI_FV_FILETYPE_DRIVER) \
-g $($1-guid) \
--align 64K \
--align $(or $($1-align),4K) \
-o $$@ \
$$(addprefix -i ,$$^)
@ -114,9 +132,9 @@ $(build)/$(linux_dir)/arch/x86/boot/bzImage: linux.intermediate
#
# But you can also replace the entire region from 0x310000
# up to PEI at 0xE40000, which leaves us almost 11 MB of space.
nerf.vol: $(addsuffix .ffs,$(dxe-y)) blobs/r630/acpi-data.ffs
nerf.vol: $(addsuffix .ffs,$(dxe-y)) Acpi-data.ffs # blobs/r630/acpi-data.ffs.uncompressed
$(EDK2_DIR)/GenFv \
--numberblock 0xB3 \
--numberblock 0xb3 \
--blocksize 0x10000 \
--FvNameGuid 4652454e-482f-6165-6473-2f4c696e7578 \
-o $@ \

Binary file not shown.

BIN
blobs/r630/acpi/APIC Normal file

Binary file not shown.

BIN
blobs/r630/acpi/BERT Normal file

Binary file not shown.

BIN
blobs/r630/acpi/DMAR Normal file

Binary file not shown.

BIN
blobs/r630/acpi/DSDT Normal file

Binary file not shown.

BIN
blobs/r630/acpi/EINJ Normal file

Binary file not shown.

BIN
blobs/r630/acpi/ERST Normal file

Binary file not shown.

BIN
blobs/r630/acpi/FACP Normal file

Binary file not shown.

BIN
blobs/r630/acpi/FACS Normal file

Binary file not shown.

BIN
blobs/r630/acpi/HEST Normal file

Binary file not shown.

BIN
blobs/r630/acpi/HPET Normal file

Binary file not shown.

BIN
blobs/r630/acpi/MCEJ Normal file

Binary file not shown.

BIN
blobs/r630/acpi/MCFG Normal file

Binary file not shown.

BIN
blobs/r630/acpi/MSCT Normal file

Binary file not shown.

BIN
blobs/r630/acpi/PMCT Normal file

Binary file not shown.

BIN
blobs/r630/acpi/PRAD Normal file

Binary file not shown.

BIN
blobs/r630/acpi/SLIC Normal file

Binary file not shown.

BIN
blobs/r630/acpi/SLIT Normal file

Binary file not shown.

BIN
blobs/r630/acpi/SRAT Normal file

Binary file not shown.

BIN
blobs/r630/acpi/SSDT1 Normal file

Binary file not shown.

BIN
blobs/r630/acpi/SSDT2 Normal file

Binary file not shown.

BIN
blobs/r630/acpi/SSDT3 Normal file

Binary file not shown.

BIN
blobs/r630/acpi/WD__ Normal file

Binary file not shown.

View File

@ -330,128 +330,6 @@ diff -u --recursive ../clean/linux-4.9.38/drivers/acpi/acpica/hwacpi.c linux-4.9
return_UINT32(ACPI_SYS_MODE_LEGACY);
}
}
diff -u --recursive ../clean/linux-4.9.38/drivers/acpi/acpica/tbfadt.c linux-4.9.38/drivers/acpi/acpica/tbfadt.c
--- ../clean/linux-4.9.38/drivers/acpi/acpica/tbfadt.c 2017-07-15 06:17:55.000000000 -0400
+++ linux-4.9.38/drivers/acpi/acpica/tbfadt.c 2017-09-20 10:58:06.101915625 -0400
@@ -344,6 +344,7 @@
/* Obtain the DSDT and FACS tables via their addresses within the FADT */
+#if 0 // NERF: the dsdt and facs tables will be updated later
acpi_tb_install_standard_table((acpi_physical_address)acpi_gbl_FADT.
Xdsdt,
ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL,
@@ -367,6 +368,7 @@
&acpi_gbl_xfacs_index);
}
}
+#endif
}
/*******************************************************************************
diff -u --recursive ../clean/linux-4.9.38/drivers/acpi/acpica/tbxface.c linux-4.9.38/drivers/acpi/acpica/tbxface.c
--- ../clean/linux-4.9.38/drivers/acpi/acpica/tbxface.c 2017-07-15 06:17:55.000000000 -0400
+++ linux-4.9.38/drivers/acpi/acpica/tbxface.c 2017-09-20 10:58:06.101915625 -0400
@@ -136,7 +136,11 @@
rsdp_address = acpi_os_get_root_pointer();
if (!rsdp_address) {
- return_ACPI_STATUS(AE_NOT_FOUND);
+// NERF: there is no root table since we came straight from DxeCore
+printk("%s:%d No root table found, hoping for the best\n", __func__, __LINE__);
+ return_ACPI_STATUS(0);
+ //return_ACPI_STATUS(AE_NOT_FOUND);
+ //rsdp_address = fake_rsdp;
}
/*
diff -u --recursive ../clean/linux-4.9.38/drivers/acpi/acpica/tbxfload.c linux-4.9.38/drivers/acpi/acpica/tbxfload.c
--- ../clean/linux-4.9.38/drivers/acpi/acpica/tbxfload.c 2017-07-15 06:17:55.000000000 -0400
+++ linux-4.9.38/drivers/acpi/acpica/tbxfload.c 2017-09-20 10:58:06.101915625 -0400
@@ -277,6 +277,7 @@
acpi_status status;
u8 flags;
u32 table_index;
+ union acpi_name_union * sig;
ACPI_FUNCTION_TRACE(acpi_install_table);
@@ -289,6 +290,30 @@
status = acpi_tb_install_standard_table(address, flags,
FALSE, FALSE, &table_index);
+ if (!ACPI_SUCCESS(status))
+ return_ACPI_STATUS(status);
+
+ // NERF: the tables have been added *after* the root table
+ // was looked for, so we have to update the global pointers
+ // now that we have the actual tables.
+ sig = &acpi_gbl_root_table_list.tables[table_index].signature;
+
+ if (ACPI_COMPARE_NAME(sig, ACPI_SIG_FADT)) {
+ printk("%s: FADT index=%d\n", __func__, table_index);
+ acpi_gbl_fadt_index = table_index;
+ acpi_tb_parse_fadt();
+ } else
+ if (ACPI_COMPARE_NAME(sig, ACPI_SIG_FACS)) {
+ printk("%s: FACS index=%d\n", __func__, table_index);
+ acpi_gbl_facs_index = table_index;
+ } else
+ if (ACPI_COMPARE_NAME(sig, ACPI_SIG_DSDT)) {
+ printk("%s: DSDT index=%d\n", __func__, table_index);
+ acpi_gbl_dsdt_index = table_index;
+ } else {
+ // nothing special about this table
+ }
+
return_ACPI_STATUS(status);
}
diff -u --recursive ../clean/linux-4.9.38/drivers/acpi/tables.c linux-4.9.38/drivers/acpi/tables.c
--- ../clean/linux-4.9.38/drivers/acpi/tables.c 2017-07-15 06:17:55.000000000 -0400
+++ linux-4.9.38/drivers/acpi/tables.c 2017-09-20 10:58:06.101915625 -0400
@@ -475,7 +475,8 @@
ACPI_SIG_SLIC, ACPI_SIG_SPCR, ACPI_SIG_SPMI, ACPI_SIG_TCPA,
ACPI_SIG_UEFI, ACPI_SIG_WAET, ACPI_SIG_WDAT, ACPI_SIG_WDDT,
ACPI_SIG_WDRT, ACPI_SIG_DSDT, ACPI_SIG_FADT, ACPI_SIG_PSDT,
- ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT, NULL };
+ ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT, ACPI_SIG_FACS,
+ NULL };
#define ACPI_HEADER_SIZE sizeof(struct acpi_table_header)
@@ -487,8 +488,18 @@
void __init acpi_table_upgrade(void)
{
+#if 0
void *data = (void *)initrd_start;
size_t size = initrd_end - initrd_start;
+#else
+ // NERF: The initramfs that is bundled with the kernel has
+ // our tables in its cpio file. There is no boot loader to
+ // set the initrd_start variable, so we have to use this one.
+extern char __initramfs_start[];
+extern unsigned long __initramfs_size;
+ void *data = (void *)__initramfs_start;
+ size_t size = __initramfs_size;
+#endif
int sig, no, table_nr = 0, total_offset = 0;
long offset = 0;
struct acpi_table_header *table;
@@ -528,7 +539,11 @@
cpio_path, file.name);
continue;
}
- if (acpi_table_checksum(file.data, table->length)) {
+
+ // NERF: ignore checksum errors on FACS since it doesn't have one
+ // but allow it to be added anyway.
+ if (memcmp(table->signature, ACPI_SIG_FACS, 4) != 0
+ && acpi_table_checksum(file.data, table->length)) {
pr_err("ACPI OVERRIDE: Bad table checksum [%s%s]\n",
cpio_path, file.name);
continue;
diff -u --recursive ../clean/linux-4.9.38/drivers/firmware/efi/vars.c linux-4.9.38/drivers/firmware/efi/vars.c
--- ../clean/linux-4.9.38/drivers/firmware/efi/vars.c 2017-07-15 06:17:55.000000000 -0400
+++ linux-4.9.38/drivers/firmware/efi/vars.c 2017-09-20 10:58:06.101915625 -0400
@ -480,18 +358,3 @@ diff -u --recursive ../clean/linux-4.9.38/init/initramfs.c linux-4.9.38/init/ini
if (initrd_start) {
#ifdef CONFIG_BLK_DEV_RAM
int fd;
diff -u --recursive ../clean/linux-4.9.38/usr/Makefile linux-4.9.38/usr/Makefile
--- ../clean/linux-4.9.38/usr/Makefile 2017-07-15 06:17:55.000000000 -0400
+++ linux-4.9.38/usr/Makefile 2017-09-22 15:16:19.128175394 -0400
@@ -24,6 +24,11 @@
# Gzip
suffix_$(CONFIG_RD_GZIP) = .gz
+# NERF doesn't support compressed initramfs, so it must disable
+# the compression here. The initrd image will be compressed in
+# the EFI firmware, however.
+suffix_y =
+
AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/initramfs_data.cpio$(suffix_y)"
# Generate builtin.o based on initramfs_data.o