aboutsummaryrefslogtreecommitdiffstats
path: root/src/fw/biostables.c
Commit message (Collapse)AuthorAgeFilesLines
* smbios: Support SMBIOS 3.0 entry point at smbios_romfile_setup()Eduardo Habkost2021-12-181-3/+30
| | | | | | Support SMBIOS 3.0 entry points if exposed by QEMU in fw_cfg. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: Support SMBIOS 3.0 entry point at copy_table()Eduardo Habkost2021-12-181-0/+1
| | | | | | | | This will make coreboot code (scan_tables()) and xen code (xen_biostable_setup()) copy SMBIOS 3.0 entry points if found. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: copy_smbios_30() functionEduardo Habkost2021-12-181-2/+34
| | | | | | | | | | | | | | | Add new copy_smbios_30() function, that will be used to support SMBIOS 3.0 entry points. The SMBIOS 3.0 entry point will be tracked in a separate SMBios30Addr variable, because both 2.1 and 3.0 entry points may exist at the same time. Adjust the smbios_get_tables(), smbios_major_version(), and smbios_minor_version() helpers to use the SMBIOS 3.0 entry point if available. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: Make smbios_build_tables() ready for 64-bit tablesEduardo Habkost2021-12-181-3/+13
| | | | | | | | | Make smbios_build_tables() get u64 address and u32 length arguments, making it usable for SMBIOS 3.0. Adapt smbios_21_setup_entry_point() to use intermediate variables when calling smbios_build_tables(). Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: Make some smbios_build_tables() arguments optionalEduardo Habkost2021-12-181-2/+6
| | | | | | | Make max_structure_size and number_of_structures optional, as we don't have those fields in SMBIOS 3.0 entry points. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: smbios_21_setup_entry_point() functionEduardo Habkost2021-12-181-13/+20
| | | | | | | | Extract the code specific for building the SMBIOS 2.1 entry point from smbios_romfile_setup() to a new smbios_21_setup_entry_point() function. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: Make smbios_build_tables() more genericEduardo Habkost2021-12-181-13/+19
| | | | | | | | | Instead of taking a SMBIOS 2.1 entry point as argument, make smbios_build_tables() take pointers to the fields it actually changes. This will allow us to reuse the function for SMBIOS 3.0 later. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: Extract SMBIOS table building code to separate functionEduardo Habkost2021-12-181-20/+34
| | | | | | | | | | | | Move the code that builds the SMBIOS tables to a separate smbios_build_tables() function, to keep it isolated from the code that initializes the SMBIOS entry point. Thew new function will still take a smbios_21_entry_point argument to make code review easier, but this will be changed by the next commits. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: Use smbios_next() at smbios_romfile_setup()Eduardo Habkost2021-12-181-3/+4
| | | | | | | | | | | Use smbios_next() instead of smbios_21_next(), to make the code more generic and reusable for SMBIOS 3.0 support. Note that `qtables_len` is initialized to `ftables->size` instead of `ep.structure_table_length` now, but both fields are guaranteed to have exactly the same value. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: Make SMBios21Addr variable staticEduardo Habkost2021-12-181-1/+1
| | | | | | | The variable is now only used inside biostables.c, there's no need to make it global. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: smbios_major_version()/smbios_minor_version() helpersEduardo Habkost2021-12-181-3/+21
| | | | | | | They new helpers will be useful when we start supporting SMBIOS 3.0 entry points. Use the new helpers at display_uuid(). Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: Use smbios_get_tables()/smbios_next() at display_uuid()Eduardo Habkost2021-12-181-2/+4
| | | | | | | Make the code more generic, and not specific for SMBIOS 2.1 entry points. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: smbios_get_tables() functionEduardo Habkost2021-12-181-0/+9
| | | | | | | The new function will be useful for code that just needs the address and length of SMBIOS tables. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: Generic smbios_next() functionEduardo Habkost2021-12-181-4/+12
| | | | | | | Extract generic code from smbios_21_next(), so it can be reused for SMBIOS 3.0 support. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: Rename code specific for SMBIOS 2.1 entry pointsEduardo Habkost2021-12-181-18/+18
| | | | | | | | Rename copy_smbios(), smbios_next(), SMBIOS_SIGNATURE, smbios_entry_point, and SMBiosAddr, to indicate they refer to SMBIOS 2.1 entry points. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* biostables: copy_fseg_table() functionEduardo Habkost2021-12-181-24/+16
| | | | | | | Replace the common malloc_fseg() + memcpy() code pattern with a helper function. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* smbios: avoid integer overflow when adding SMBIOS type 0 tableDaniel P. Berrangé2020-09-081-4/+10
| | | | | | | | | SeaBIOS implements the SMBIOS 2.1 entry point which is limited to a maximum length of 0xffff. If the SMBIOS data received from QEMU is large enough, then adding the type 0 table will cause integer overflow. This results in fun behaviour such as KVM crash, or hangs in SeaBIOS. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* acpi: add dsdt parserGerd Hoffmann2020-05-151-0/+1
| | | | | | | | Create a list of devices found in the DSDT table. Add helper functions to find devices, walk the list and figure device informations like mmio ranges and irqs. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* acpi: add xsdt supportGerd Hoffmann2020-05-151-10/+30
| | | | | | | In case a xsdt table is present (and located below 4G) prefer it over rsdt. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* acpi: Generalize find_fadt() and find_tcpa_by_rsdp() into find_acpi_table()Kevin O'Connor2016-11-271-9/+9
| | | | | | | | The find_fadt() and find_tcpa_by_rsdp() functions are very similar. Create a new find_acpi_table() function and replace the two functions with this new function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* biostables: Support SMBIOS 2.6+ UUID formatCole Robinson2016-01-151-11/+36
| | | | | | | | SMBIOS 2.6+ stores the UUID in a different format, with the first 3 fields in little endian format. This is what modern qemu delivers and what dmidecode also handles, so let's follow suit too. Signed-off-by: Cole Robinson <crobinso@redhat.com>
* biostables: Minor - fix incorrect indentationKevin O'Connor2015-10-241-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* memmap: Introduce SYMBOL() macro to access linker script symbolsKevin O'Connor2015-10-151-5/+5
| | | | | | | Use a macro to define and obtain the value of a symbol introduced by the linker scripts (scripts/layoutrom.py). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mptable: Don't create mptable if it is very largeKevin O'Connor2015-08-041-0/+5
| | | | | | | | | | | | | Very large mptable structures can fill up the space in the f-segment and cause other important f-segment allocations to fail. Limit the maximum size of the mptable to prevent this. On QEMU, with the current maximum size of 600 bytes, the mptable will not be created in configurations of ~20 cpus or more. The mptable is rarely used in modern OSes so this should not be a problem. Reported-by: Huaitong Han <huaitong.han@intel.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* smbios: Use integer signature instead of string signatureKevin O'Connor2015-04-101-1/+1
| | | | | | | | | | | | | Change the smbios structure to use a 4 byte u32 signature field instead of a 4 byte character string field. In practice, this allows the compiler to place the signature in the initialize code segment and thus makes it less likely the signature would be found in the f-segment. (If the smbios signature is found in the f-segment it can confuse some table scans.) Reviewed-by: Bruce Rogers <brogers@suse.com> Tested-by: Bruce Rogers <brogers@suse.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* acpi: remove PORT_ACPI_PM_BASE constantGerd Hoffmann2014-05-201-0/+1
| | | | | | Use the new acpi_pm_base variable instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* SMBIOS: Check for aggregate tables & entry point in fw_cfgGabriel L. Somlo2014-05-061-0/+135
| | | | | | | | | | | | | | Check fw_cfg for the presence of an aggregate set of smbios tables (etc/smbios/smbios-tables) and an entry point structure (etc/smbios/smbios-anchor), and, if found, use them instead of generating entries locally. We ensure the presence of a type 0 (bios information) structure by generating it locally if necessary, which is expected to be the common case. Signed-off-by: Gabriel L. Somlo <somlo@cmu.edu> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Factor out smbios table walking from display_uuid to smbios_next().Kevin O'Connor2014-04-121-62/+46
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Minor - replace some tab characters that slipped into the code.Kevin O'Connor2014-04-111-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Use biostables.c for copying bios tables even when generating them.Kevin O'Connor2014-04-071-3/+6
| | | | | | | | | Use the biostables.c copy_pir(), copy_smbios(), copy_acpi_rsdp(), and copy_mptable() code even when using the legacy bios table generation code. This unifies the final bios table deployment code between qemu, coreboot, and csm. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move PirAddr definition from pirtable.c to biostables.c.Kevin O'Connor2014-04-071-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* smbios: Move smbios parsing logic from smbios.c to biostables.c.Kevin O'Connor2014-04-071-0/+71
| | | | | | | | After this change, src/fw/smbios.c only contains the legacy code for generating SMBIOS tables. This change only contains code movement - no logic is changed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* acpi: Move acpi parsing logic from acpi.c to biostables.c / paravirt.c.Kevin O'Connor2014-04-071-14/+132
| | | | | | | | After this change, src/fw/acpi.c only contains the legacy code for generating ACPI tables. This change only contains code movement - no logic is changed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Minor - fix some typos in comments.Kevin O'Connor2014-04-051-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* biostables: support looking up RSDPMichael S. Tsirkin2013-11-061-7/+34
| | | | | | | Will be used when it's loaded from QEMU. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Move fw/acpi.h to std/acpi.h.Kevin O'Connor2013-09-181-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move fw/mptable.h to std/mptable.h.Kevin O'Connor2013-09-181-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move fw/smbios.h to std/smbios.h.Kevin O'Connor2013-09-181-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move pirtable definitions from hw/pci.h to std/pirtable.h and util.h.Kevin O'Connor2013-09-181-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor2013-09-181-2/+3
| | | | | | Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move malloc code from pmm.c to new files malloc.c and malloc.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Rename util.c to string.c and introduce string.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move code cenetered around firmware initialization to src/fw/Kevin O'Connor2013-09-021-0/+117
Move many C files from the src/ directory to the new src/fw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>