Broken MP BIOS workaround

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Broken MP BIOS workaround

Mark Kettenis
The attached patch brings over a hack from the amd64 to work around
some broken MP BIOSes.  This might fix some machines running
GENERIC.MP.  Please test if you have some cpu cycles to waste ;-).

Mark

Index: mpbios.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/mpbios.c,v
retrieving revision 1.12
diff -u -p -r1.12 mpbios.c
--- mpbios.c 9 May 2006 18:41:22 -0000 1.12
+++ mpbios.c 9 May 2006 21:34:13 -0000
@@ -1078,7 +1078,7 @@ mpbios_int(ent, mpi)
 {
  const struct mpbios_int *entry = (const struct mpbios_int *)ent;
  struct mpbios_int rw_entry = *entry;
- struct ioapic_softc *sc = NULL;
+ struct ioapic_softc *sc = NULL, *sc2;
 
  struct mp_intr_map *altmpi;
  struct mp_bus *mpb;
@@ -1128,6 +1128,23 @@ mpbios_int(ent, mpi)
  if (sc == NULL) {
  printf("mpbios: can't find ioapic %d\n", id);
  return (1);
+ }
+
+ /*
+ * XXX workaround for broken BIOSs that put the ACPI
+ * global interrupt number in the entry, not the pin
+ * number.
+ */
+ if (pin >= sc->sc_apic_sz) {
+ sc2 = ioapic_find_bybase(pin);
+ if (sc2 != sc) {
+ printf("mpbios: bad pin %d for apic %d\n",
+    pin, id);
+ return (1);
+ }
+ printf("mpbios: WARNING: pin %d for apic %d too high; "
+       "assuming ACPI global int value\n", pin, id);
+ pin -= sc->sc_apic_vecbase;
  }
 
  mpi->ioapic = sc;