On Wed, Apr 29, 2020 at 03:46:41PM +0200, Gerd Hoffmann wrote:
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
Makefile | 2 +- src/util.h | 11 + src/fw/biostables.c | 9 + src/fw/dsdt_parser.c | 668 +++++++++++++++++++++++++++++++++++++++++++ src/fw/paravirt.c | 5 +- src/Kconfig | 7 + 6 files changed, 699 insertions(+), 3 deletions(-) create mode 100644 src/fw/dsdt_parser.c
diff --git a/Makefile b/Makefile index 985ef591a13b..f02eda314784 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ SRC32FLAT=$(SRCBOTH) post.c e820map.c malloc.c romfile.c x86.c optionroms.c \ hw/pcidevice.c hw/ahci.c hw/pvscsi.c hw/usb-xhci.c hw/usb-hub.c hw/sdcard.c \ fw/coreboot.c fw/lzmadecode.c fw/multiboot.c fw/csm.c fw/biostables.c \ fw/paravirt.c fw/shadow.c fw/pciinit.c fw/smm.c fw/smp.c fw/mtrr.c fw/xen.c \
- fw/acpi.c fw/mptable.c fw/pirtable.c fw/smbios.c fw/romfile_loader.c \
- fw/acpi.c fw/mptable.c fw/pirtable.c fw/smbios.c fw/romfile_loader.c fw/dsdt_parser.c \ hw/virtio-ring.c hw/virtio-pci.c hw/virtio-mmio.c hw/virtio-blk.c hw/virtio-scsi.c \ hw/tpm_drivers.c hw/nvme.c
As a very minor comment, this file and a few other files add lines that are over 80 characters. I think it would be good to try and keep the code to a max of 80 characters (I know I've not always done a good job at this myself).
SRC32SEG=string.c output.c pcibios.c apm.c stacks.c hw/pci.c hw/serialio.c diff --git a/src/util.h b/src/util.h index 4f27fc307439..0de35229dc0c 100644 --- a/src/util.h +++ b/src/util.h @@ -94,6 +94,17 @@ void display_uuid(void); void copy_table(void *pos); void smbios_setup(void);
+// fw/dsdt_parser.c +struct acpi_device; +void acpi_dsdt_parse(void); +struct acpi_device *acpi_dsdt_find_string(struct acpi_device *prev, const char *hid); +struct acpi_device *acpi_dsdt_find_eisaid(struct acpi_device *prev, u16 eisaid); +char *acpi_dsdt_name(struct acpi_device *dev); +int acpi_dsdt_present_eisaid(u16 eisaid); +int acpi_dsdt_find_io(struct acpi_device *dev, u64 *min, u64 *max); +int acpi_dsdt_find_mem(struct acpi_device *dev, u64 *min, u64 *max); +int acpi_dsdt_find_irq(struct acpi_device *dev, u64 *irq);
// fw/coreboot.c extern const char *CBvendor, *CBpart; struct cbfs_file; diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 0d4fdb9c22e8..0597459e9875 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -4,6 +4,14 @@ // // This file may be distributed under the terms of the GNU LGPLv3 license.
+#include "byteorder.h" // le32_to_cpu +#include "config.h" // CONFIG_* +// Support for manipulating bios tables (pir, mptable, acpi, smbios). +// +// Copyright (C) 2008,2009 Kevin O'Connor kevin@koconnor.net +// +// This file may be distributed under the terms of the GNU LGPLv3 license.
This looks like a cut-and-paste error (or perhaps git merge error)?
FYI, the series looks fine to me. -Kevin