[SeaBIOS] [PATCH] ACPI DSDT: Make control method `IQCR` serialized
Date: Thu, 3 Oct 2013 11:30:52 +0200 The ASL Optimizing Compiler version 20130823-32 [Sep 11 2013] issues the following warning. $ make […] Compiling IASL out/src/fw/acpi-dsdt.hex out/src/fw/acpi-dsdt.dsl.i360: Method(IQCR, 1, NotSerialized) { Remark 2120 - ^ Control Method should be made Serialized (due to creation of named objects within) […] ASL Input: out/src/fw/acpi-dsdt.dsl.i - 475 lines, 19181 bytes, 316 keywords AML Output:out/src/fw/acpi-dsdt.aml - 4407 bytes, 159 named objects, 157 executable opcodes Listing File: out/src/fw/acpi-dsdt.lst - 143715 bytes Hex Dump: out/src/fw/acpi-dsdt.hex - 41661 bytes Compilation complete. 0 Errors, 0 Warnings, 1 Remarks, 246 Optimizations […] After changing the parameter from `NotSerialized` to `Serialized`, the remark is indeed gone and there is no size change. The remark was added in ACPICA version 20130517 [1] and gives the following explanation. If a thread blocks within the method for any reason, and another thread enters the method, the method will fail because an attempt will be made to create the same (named) object twice. In this case, issue a remark that the method should be marked serialized. ACPICA BZ 909. [1] https://github.com/acpica/acpica/commit/ba84d0fc18ba910a47a3f71c68a43543c06e6831 Signed-off-by: Paul Menzel paulepan...@users.sourceforge.net --- src/fw/acpi-dsdt.dsl | 2 +- src/fw/q35-acpi-dsdt.dsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fw/acpi-dsdt.dsl b/src/fw/acpi-dsdt.dsl index 158f6b4..56243c3 100644 --- a/src/fw/acpi-dsdt.dsl +++ b/src/fw/acpi-dsdt.dsl @@ -235,7 +235,7 @@ DefinitionBlock ( } Return (0x0B) } -Method(IQCR, 1, NotSerialized) { +Method(IQCR, 1, Serialized) { // _CRS method - get current settings Name(PRR0, ResourceTemplate() { Interrupt(, Level, ActiveHigh, Shared) { 0 } diff --git a/src/fw/q35-acpi-dsdt.dsl b/src/fw/q35-acpi-dsdt.dsl index c031d83..5dec541 100644 --- a/src/fw/q35-acpi-dsdt.dsl +++ b/src/fw/q35-acpi-dsdt.dsl @@ -331,7 +331,7 @@ DefinitionBlock ( } Return (0x0B) } -Method(IQCR, 1, NotSerialized) { +Method(IQCR, 1, Serialized) { // _CRS method - get current settings Name(PRR0, ResourceTemplate() { Interrupt(, Level, ActiveHigh, Shared) { 0 } -- 1.8.4.rc3 signature.asc Description: This is a digitally signed message part ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH] hw/usb-xhci.c: Code refactoring to not override initializers in `speed_from_xhci[16]`
Date: Thu, 3 Oct 2013 11:55:48 +0200 Using Debian clang version 3.4-1 (trunk) (based on LLVM 3.4) to build SeaBIOS, the switch `-Winitializer-overrides` results in the following warnings. $ CC=clang make […] Compile checking out/src/hw/usb-xhci.o clang: warning: argument unused during compilation: '-mpreferred-stack-boundary=2' clang: warning: argument unused during compilation: '-minline-all-stringops' clang: warning: argument unused during compilation: '-fno-delete-null-pointer-checks' src/hw/usb-xhci.c:281:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides] [ 1 ] = USB_FULLSPEED, ^ src/hw/usb.h:68:24: note: expanded from macro 'USB_FULLSPEED' ^ src/hw/usb-xhci.c:280:20: note: previous initialization is here [ 0 ... 15 ] = -1, ^~ src/hw/usb-xhci.c:282:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides] [ 2 ] = USB_LOWSPEED, ^~~~ src/hw/usb.h:69:24: note: expanded from macro 'USB_LOWSPEED' ^ src/hw/usb-xhci.c:280:20: note: previous initialization is here [ 0 ... 15 ] = -1, ^~ src/hw/usb-xhci.c:283:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides] [ 3 ] = USB_HIGHSPEED, ^ src/hw/usb.h:70:24: note: expanded from macro 'USB_HIGHSPEED' ^ src/hw/usb-xhci.c:280:20: note: previous initialization is here [ 0 ... 15 ] = -1, ^~ src/hw/usb-xhci.c:284:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides] [ 4 ] = USB_SUPERSPEED, ^~ src/hw/usb.h:71:24: note: expanded from macro 'USB_SUPERSPEED' ^ src/hw/usb-xhci.c:280:20: note: previous initialization is here [ 0 ... 15 ] = -1, ^~ Refactor the code a little to get rid of the warnings. Signed-off-by: Paul Menzel paulepan...@users.sourceforge.net --- src/hw/usb-xhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hw/usb-xhci.c b/src/hw/usb-xhci.c index 83eddc9..66ce3c4 100644 --- a/src/hw/usb-xhci.c +++ b/src/hw/usb-xhci.c @@ -277,11 +277,12 @@ static const char *speed_name[16] = { }; static const int speed_from_xhci[16] = { -[ 0 ... 15 ] = -1, +[ 0 ] = -1, [ 1 ] = USB_FULLSPEED, [ 2 ] = USB_LOWSPEED, [ 3 ] = USB_HIGHSPEED, [ 4 ] = USB_SUPERSPEED, +[ 5 ... 15 ] = -1, }; static const int speed_to_xhci[] = { -- 1.8.4.rc3 signature.asc Description: This is a digitally signed message part ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH] scripts/kconfig/mconf.c: Add third person »s« in »This interface let*s*«
Date: Mon, 4 Mar 2013 12:56:56 +0100 Signed-off-by: Paul Menzel paulepan...@users.sourceforge.net --- scripts/kconfig/mconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 6c9c45f..2f9549e 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -25,7 +25,7 @@ static const char mconf_readme[] = N_( Overview\n \n -This interface let you select features and parameters for the build.\n +This interface lets you select features and parameters for the build.\n Features can either be built-in, modularized, or ignored. Parameters\n must be entered in as decimal or hexadecimal numbers or text.\n \n -- 1.8.4.rc3 signature.asc Description: This is a digitally signed message part ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH] acpi: strip compiler info in built-in DSDT if any
IASL stores it's revision in each table header it generates. That's a problem since guests see a change each time they move between hypervisors. We generally fill our own info for tables, but we forgot to do this for the built-in DSDT. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- src/fw/acpi.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fw/acpi.c b/src/fw/acpi.c index c29425c..0e3e3ad 100644 --- a/src/fw/acpi.c +++ b/src/fw/acpi.c @@ -689,13 +689,16 @@ acpi_setup(void) if (CONFIG_ACPI_DSDT fadt !fadt-dsdt) { /* default DSDT */ -void *dsdt = malloc_high(sizeof(AmlCode)); +struct acpi_table_header *dsdt = malloc_high(sizeof(AmlCode)); if (!dsdt) { warn_noalloc(); return; } memcpy(dsdt, AmlCode, sizeof(AmlCode)); fill_dsdt(fadt, dsdt); +/* Strip out compiler-generated header if any */ +memset(dsdt, 0, sizeof *dsdt); +build_header(dsdt, DSDT_SIGNATURE, sizeof(AmlCode), 1); } // Build final rsdt table -- MST ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH v7 3/3] acpi: load and link tables through romfile loader
Load files through romfile loader and use for acpi tables. We need the RSDP pointer to hang the rest of the tables off it, to detect that we simply scan all memory in FSEG. Add an option to disable this feature (useful for old QEMU versions). This saves about 1Kbytes. enabled: Total size: 134932 Fixed: 61571 Free: 127212 (used 51.5% of 256KiB rom) disabled: Total size: 133836 Fixed: 61563 Free: 128308 (used 51.1% of 256KiB rom) Signed-off-by: Michael S. Tsirkin m...@redhat.com --- src/fw/acpi.c | 21 + src/Kconfig | 11 +++ 2 files changed, 32 insertions(+) diff --git a/src/fw/acpi.c b/src/fw/acpi.c index 0497d9b..c29425c 100644 --- a/src/fw/acpi.c +++ b/src/fw/acpi.c @@ -32,6 +32,7 @@ #include string.h // memset #include util.h // MaxCountCPUs #include x86.h // readl +#include romfile_loader.h // romfile_loader_execute #include src/fw/acpi-dsdt.hex @@ -610,6 +611,26 @@ struct rsdp_descriptor *RsdpAddr; void acpi_setup(void) { +if (CONFIG_FW_ROMFILE_LOAD) { +int loader_err; + +dprintf(3, load ACPI tables\n); + +loader_err = romfile_loader_execute(etc/table-loader); + +RsdpAddr = find_acpi_rsdp(); + +if (RsdpAddr) +return; + +/* If present, loader should have installed an RSDP. + * Not installed? We might still be able to continue + * using the builtin RSDP. + */ +if (!loader_err) +warn_internalerror(); +} + if (! CONFIG_ACPI) return; diff --git a/src/Kconfig b/src/Kconfig index c40cc61..5780885 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -424,6 +424,17 @@ menu BIOS Tables This option can be disabled for QEMU 1.4 and newer to save some space in the ROM file. If unsure, say Y. +config FW_ROMFILE_LOAD +bool Load BIOS tables from ROM files +depends on QEMU_HARDWARE +default y +help +Support loading BIOS firmware tables from ROM files. +At the moment, only ACPI tables can be loaded in this way. +Required for QEMU 1.7 and newer. +This option can be disabled for QEMU 1.6 and older +to save some space in the ROM file. +If unsure, say Y. endmenu source vgasrc/Kconfig -- MST ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios
[SeaBIOS] [PATCH v7 2/3] romfile_loader: utility to patch in-memory ROM files
Add ability for a ROM file to point to it's image in memory. When file is in memory, add utility that can patch it, storing pointers to one file within another file. This is not a lot of code: together with the follow-up patch to load ACPI tables from ROM, it's about 1K extra. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- Makefile| 2 +- src/fw/romfile_loader.h | 72 src/fw/romfile_loader.c | 177 3 files changed, 250 insertions(+), 1 deletion(-) create mode 100644 src/fw/romfile_loader.h create mode 100644 src/fw/romfile_loader.c diff --git a/Makefile b/Makefile index 3984d35..797c00f 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ SRC32FLAT=$(SRCBOTH) post.c memmap.c malloc.c pmm.c romfile.c optionroms.c \ hw/usb-hub.c \ fw/coreboot.c fw/lzmadecode.c fw/csm.c fw/biostables.c \ fw/paravirt.c fw/shadow.c fw/pciinit.c fw/smm.c fw/mtrr.c fw/xen.c \ -fw/acpi.c fw/mptable.c fw/pirtable.c fw/smbios.c +fw/acpi.c fw/mptable.c fw/pirtable.c fw/smbios.c fw/romfile_loader.c SRC32SEG=string.c output.c pcibios.c apm.c stacks.c hw/pci.c DIRS=src src/hw src/fw vgasrc diff --git a/src/fw/romfile_loader.h b/src/fw/romfile_loader.h new file mode 100644 index 000..15eab2a --- /dev/null +++ b/src/fw/romfile_loader.h @@ -0,0 +1,72 @@ +#ifndef __ROMFILE_LOADER_H +#define __ROMFILE_LOADER_H + +#include types.h // u8 +#include util.h // romfile_s + +#define ROMFILE_LOADER_FILESZ 56 + +/* ROM file linker/loader interface. Linker uses little endian format */ +struct romfile_loader_entry_s { +u32 command; +union { +/* + * COMMAND_ALLOCATE - allocate a table from @alloc_file + * subject to @alloc_align alignment (must be power of 2) + * and @alloc_zone (can be HIGH or FSEG) requirements. + * + * Must appear exactly once for each file, and before + * this file is referenced by any other command. + */ +struct { +char alloc_file[ROMFILE_LOADER_FILESZ]; +u32 alloc_align; +u8 alloc_zone; +}; + +/* + * COMMAND_ADD_POINTER - patch the table (originating from + * @dest_file) at @pointer_offset, by adding a pointer to the table + * originating from @src_file. 1,2,4 or 8 byte unsigned + * addition is used depending on @pointer_size. + */ +struct { +char pointer_dest_file[ROMFILE_LOADER_FILESZ]; +char pointer_src_file[ROMFILE_LOADER_FILESZ]; +u32 pointer_offset; +u8 pointer_size; +}; + +/* + * COMMAND_ADD_CHECKSUM - calculate checksum of the range specified by + * @cksum_start and @cksum_length fields, + * and then add the value at @cksum_offset. + * Checksum simply sums -X for each byte X in the range + * using 8-bit math. + */ +struct { +char cksum_file[ROMFILE_LOADER_FILESZ]; +u32 cksum_offset; +u32 cksum_start; +u32 cksum_length; +}; + +/* padding */ +char pad[124]; +}; +}; + +enum { +ROMFILE_LOADER_COMMAND_ALLOCATE = 0x1, +ROMFILE_LOADER_COMMAND_ADD_POINTER = 0x2, +ROMFILE_LOADER_COMMAND_ADD_CHECKSUM = 0x3, +}; + +enum { +ROMFILE_LOADER_ALLOC_ZONE_HIGH = 0x1, +ROMFILE_LOADER_ALLOC_ZONE_FSEG = 0x2, +}; + +int romfile_loader_execute(const char *name); + +#endif diff --git a/src/fw/romfile_loader.c b/src/fw/romfile_loader.c new file mode 100644 index 000..325a0fa --- /dev/null +++ b/src/fw/romfile_loader.c @@ -0,0 +1,177 @@ +#include romfile_loader.h +#include byteorder.h // leXX_to_cpu/cpu_to_leXX +#include util.h // checksum +#include string.h // strcmp +#include romfile.h // struct romfile_s +#include malloc.h // Zone*, _malloc +#include output.h // warn_* + +struct romfile_loader_file { +struct romfile_s *file; +void *data; +}; +struct romfile_loader_files { +int nfiles; +struct romfile_loader_file files[]; +}; + +static struct romfile_loader_file * +romfile_loader_find(const char *name, +struct romfile_loader_files *files) +{ +int i; +if (name[ROMFILE_LOADER_FILESZ - 1]) +return NULL; +for (i = 0; i files-nfiles; ++i) +if (!strcmp(files-files[i].file-name, name)) +return files-files[i]; +return NULL; +} + +static void romfile_loader_allocate(struct romfile_loader_entry_s *entry, +struct romfile_loader_files *files) +{ +struct zone_s *zone; +struct romfile_loader_file *file = files-files[files-nfiles]; +void *data; +int ret; +unsigned alloc_align = le32_to_cpu(entry-alloc_align); + +if (alloc_align (alloc_align - 1)) +goto err; + +switch (entry-alloc_zone) { +case ROMFILE_LOADER_ALLOC_ZONE_HIGH: +zone = ZoneHigh; +
[SeaBIOS] [PATCH v7 0/3] seabios: load acpi tables from qemu
This is the seabios code that adds support for loading acpi tables from QEMU. Changes from v6: - submission was botched, it didn't compile fix up patch biostables: support looking up RSDP no changes to other patches Changes from v5: - address Kevin's comments: move code to find rsdp to biostables.c scan for RSDP at 0x10 intervals Changes from v4: - address Kevin's comments: move loader to src/fw/ simplify some code drop some unused code chunks load from ROM even if !ACPI rename option to make it non ACPI specific Changes from v3: - updated to latest bits - add option to disable loading from QEMU Changes from v2: - addressed comments from Kevin: fixed coding style, minimized changes to existing code Changes from v1: - simplified linker interfaces along the lines suggested by Kevin - fixed lots of bugs Michael S. Tsirkin (3): biostables: support looking up RSDP romfile_loader: utility to patch in-memory ROM files acpi: load and link tables through romfile loader Makefile| 2 +- src/fw/romfile_loader.h | 72 src/util.h | 1 + src/fw/acpi.c | 21 ++ src/fw/biostables.c | 41 +-- src/fw/romfile_loader.c | 177 src/Kconfig | 11 +++ 7 files changed, 317 insertions(+), 8 deletions(-) create mode 100644 src/fw/romfile_loader.h create mode 100644 src/fw/romfile_loader.c -- MST ___ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios