[SeaBIOS] [PATCH 2/2] accept MADT over fw_cfg

Michael S. Tsirkin mst at redhat.com
Thu Mar 21 13:02:35 CET 2013


On Wed, Mar 20, 2013 at 10:53:05PM +0100, Laszlo Ersek wrote:
> 
> Signed-off-by: Laszlo Ersek <lersek at redhat.com>

I think this is a bit too aggressive.
Let's do what I did for DSDT, add a config
option and default to yes.
In QEMU, override it to remove MADT from bios.

> ---
>  src/acpi.c |   19 ++++++++++++++++---
>  1 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/src/acpi.c b/src/acpi.c
> index 8bbc92b..611553e 100644
> --- a/src/acpi.c
> +++ b/src/acpi.c
> @@ -797,13 +797,13 @@ acpi_setup(void)
>      struct fadt_descriptor_rev1 *fadt = build_fadt(pci);
>      ACPI_INIT_TABLE(fadt);
>      ACPI_INIT_TABLE(build_ssdt());
> -    ACPI_INIT_TABLE(build_madt());
>      ACPI_INIT_TABLE(build_hpet());
>      ACPI_INIT_TABLE(build_srat());
>      if (pci->device == PCI_DEVICE_ID_INTEL_ICH9_LPC)
>          ACPI_INIT_TABLE(build_mcfg_q35());
>  
>      struct romfile_s *file = NULL;
> +    int madt_found = 0;
>      for (;;) {
>          file = romfile_findprefix("acpi/", file);
>          if (!file)
> @@ -816,13 +816,19 @@ acpi_setup(void)
>          int ret = file->copy(file, table, file->size);
>          if (ret <= sizeof(*table))
>              continue;
> -        if (table->signature == DSDT_SIGNATURE) {
> +        switch (table->signature) {
> +        case DSDT_SIGNATURE:
>              if (fadt) {
>                  fill_dsdt(fadt, table);
>              }
> -        } else {
> +            break;
> +        case APIC_SIGNATURE:
> +            madt_found = 1;
> +            /* fall through */
> +        default:
>              ACPI_INIT_TABLE(table);
>          }
> +
>          if (tbl_idx == MAX_ACPI_TABLES) {
>              warn_noalloc();
>              break;
> @@ -838,6 +844,13 @@ acpi_setup(void)
>          memcpy(dsdt, AmlCode, sizeof(AmlCode));
>          fill_dsdt(fadt, dsdt);
>      }
> +    if (!madt_found) {
> +        if (tbl_idx == MAX_ACPI_TABLES) {
> +            warn_noalloc();
> +            return;
> +        }
> +        ACPI_INIT_TABLE(build_madt());
> +    }
>  
>      // Build final rsdt table
>      struct rsdt_descriptor_rev1 *rsdt;
> -- 
> 1.7.1



More information about the SeaBIOS mailing list