Patchwork [SeaBIOS,1/2] acpi: report real I/O APIC ID (0) on MADT table (v2)

login
register
mail settings
Submitter Eduardo Habkost
Date July 20, 2012, 5:04 p.m.
Message ID <1342803890-1795-2-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/172311/
State New
Headers show

Comments

Eduardo Habkost - July 20, 2012, 5:04 p.m.
When resetting an I/O APIC, its ID is set to 0, and SeaBIOS doesn't
change it, so report it correctly on the MADT table.

Some hardware may require the BIOS to initialize I/O APIC ID to an
unique value, but SeaBIOS doesn't do that. This patch at least makes the
MADT table reflect reality.

Changes v1 -> v2:
 - Cosmetic: whitespace change (removed extra newline)
 - New patch description

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 src/acpi.c   |    2 +-
 src/config.h |    1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
Gleb Natapov - July 23, 2012, 12:16 p.m.
On Fri, Jul 20, 2012 at 02:04:49PM -0300, Eduardo Habkost wrote:
> When resetting an I/O APIC, its ID is set to 0, and SeaBIOS doesn't
> change it, so report it correctly on the MADT table.
> 
> Some hardware may require the BIOS to initialize I/O APIC ID to an
> unique value, but SeaBIOS doesn't do that. This patch at least makes the
> MADT table reflect reality.
> 
> Changes v1 -> v2:
>  - Cosmetic: whitespace change (removed extra newline)
>  - New patch description
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  src/acpi.c   |    2 +-
>  src/config.h |    1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/acpi.c b/src/acpi.c
> index d39cbd9..da3bc57 100644
> --- a/src/acpi.c
> +++ b/src/acpi.c
> @@ -336,7 +336,7 @@ build_madt(void)
>      struct madt_io_apic *io_apic = (void*)apic;
>      io_apic->type = APIC_IO;
>      io_apic->length = sizeof(*io_apic);
> -    io_apic->io_apic_id = CountCPUs;
> +    io_apic->io_apic_id = BUILD_IOAPIC_ID;
>      io_apic->address = cpu_to_le32(BUILD_IOAPIC_ADDR);
>      io_apic->interrupt = cpu_to_le32(0);
>  
mptable also have ioapic_id.

> diff --git a/src/config.h b/src/config.h
> index 3a70867..0d4066d 100644
> --- a/src/config.h
> +++ b/src/config.h
> @@ -52,6 +52,7 @@
>  #define BUILD_PCIMEM64_END        0x10000000000ULL
>  
>  #define BUILD_IOAPIC_ADDR         0xfec00000
> +#define BUILD_IOAPIC_ID           0
>  #define BUILD_HPET_ADDRESS        0xfed00000
>  #define BUILD_APIC_ADDR           0xfee00000
>  
> -- 
> 1.7.10.4

--
			Gleb.
Eduardo Habkost - July 24, 2012, 5:20 p.m.
On Mon, Jul 23, 2012 at 03:16:30PM +0300, Gleb Natapov wrote:
> On Fri, Jul 20, 2012 at 02:04:49PM -0300, Eduardo Habkost wrote:
> > When resetting an I/O APIC, its ID is set to 0, and SeaBIOS doesn't
> > change it, so report it correctly on the MADT table.
> > 
> > Some hardware may require the BIOS to initialize I/O APIC ID to an
> > unique value, but SeaBIOS doesn't do that. This patch at least makes the
> > MADT table reflect reality.
> > 
> > Changes v1 -> v2:
> >  - Cosmetic: whitespace change (removed extra newline)
> >  - New patch description
> > 
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
> >  src/acpi.c   |    2 +-
> >  src/config.h |    1 +
> >  2 files changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/acpi.c b/src/acpi.c
> > index d39cbd9..da3bc57 100644
> > --- a/src/acpi.c
> > +++ b/src/acpi.c
> > @@ -336,7 +336,7 @@ build_madt(void)
> >      struct madt_io_apic *io_apic = (void*)apic;
> >      io_apic->type = APIC_IO;
> >      io_apic->length = sizeof(*io_apic);
> > -    io_apic->io_apic_id = CountCPUs;
> > +    io_apic->io_apic_id = BUILD_IOAPIC_ID;
> >      io_apic->address = cpu_to_le32(BUILD_IOAPIC_ADDR);
> >      io_apic->interrupt = cpu_to_le32(0);
> >  
> mptable also have ioapic_id.

Oops. I have grepped for CountCPUs, but somehow I missed it. I will send
a new patch soon. Thanks!

> 
> > diff --git a/src/config.h b/src/config.h
> > index 3a70867..0d4066d 100644
> > --- a/src/config.h
> > +++ b/src/config.h
> > @@ -52,6 +52,7 @@
> >  #define BUILD_PCIMEM64_END        0x10000000000ULL
> >  
> >  #define BUILD_IOAPIC_ADDR         0xfec00000
> > +#define BUILD_IOAPIC_ID           0
> >  #define BUILD_HPET_ADDRESS        0xfed00000
> >  #define BUILD_APIC_ADDR           0xfee00000
> >  
> > -- 
> > 1.7.10.4
> 
> --
> 			Gleb.
>

Patch

diff --git a/src/acpi.c b/src/acpi.c
index d39cbd9..da3bc57 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -336,7 +336,7 @@  build_madt(void)
     struct madt_io_apic *io_apic = (void*)apic;
     io_apic->type = APIC_IO;
     io_apic->length = sizeof(*io_apic);
-    io_apic->io_apic_id = CountCPUs;
+    io_apic->io_apic_id = BUILD_IOAPIC_ID;
     io_apic->address = cpu_to_le32(BUILD_IOAPIC_ADDR);
     io_apic->interrupt = cpu_to_le32(0);
 
diff --git a/src/config.h b/src/config.h
index 3a70867..0d4066d 100644
--- a/src/config.h
+++ b/src/config.h
@@ -52,6 +52,7 @@ 
 #define BUILD_PCIMEM64_END        0x10000000000ULL
 
 #define BUILD_IOAPIC_ADDR         0xfec00000
+#define BUILD_IOAPIC_ID           0
 #define BUILD_HPET_ADDRESS        0xfed00000
 #define BUILD_APIC_ADDR           0xfee00000