Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

get "struct device" out of pics



Here are patches which start to get autoconf stuff
out of "struct pic". It is not yet a device/softc split,
but that last step would be easy.
The amd64 asm bits are missing, the i386 side works for me.

Please review and test.

best regards
Matthias





-------------------------------------------------------------------
-------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich

Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt
-------------------------------------------------------------------
-------------------------------------------------------------------
#
# old_revision [b1fe9c50db90131253b9e52e563a7f3ea7814f39]
#
# patch "sys/arch/i386/i386/genassym.cf"
#  from [782349f706bb30e6352ff3c2b83f8807cd7cc335]
#    to [82877bd6be84dcca5d080c6e4065bf22244fb6f0]
# 
# patch "sys/arch/i386/include/i82093reg.h"
#  from [1c31c0301c76490d4e62d7770c6f305dbce92c82]
#    to [bdef13baacd48101e09a9643ca997c222d6f9dff]
# 
# patch "sys/arch/x86/include/i82093var.h"
#  from [df32e7a66dd2d6711f8ce909a19766757ad5aa9c]
#    to [9c6abb940691dc13dc9e8bc0679ad6196cdde610]
# 
# patch "sys/arch/x86/include/pic.h"
#  from [1ea5be7536883a31177b2893b66b64a2cb6f7f29]
#    to [3a4eff193bc1a755435c42e156aa0d50a07ff7bd]
# 
# patch "sys/arch/x86/isa/isa_machdep.c"
#  from [6e15b01219a8940fa4125c57fffde134da193ed1]
#    to [c466a03ee4533b82ba12d46d1ed7234732d97dad]
# 
# patch "sys/arch/x86/pci/pci_intr_machdep.c"
#  from [93451fc59cf3b43afd4d32d8e7810de00a0cce1e]
#    to [612c9f78e2a83bd3e505aaa476d9b6ff63e746e6]
# 
# patch "sys/arch/x86/x86/acpi_machdep.c"
#  from [8de357c9bb05ad72b175a9eea882a7ab82383824]
#    to [06dd313ec37f27d71e93b3aff7edec1bda9f0a91]
# 
# patch "sys/arch/x86/x86/i8259.c"
#  from [10d7c540acb1073879fb084fd2fd66c8d5db1733]
#    to [efce22268b0380b7dcc917082b66876173558ff0]
# 
# patch "sys/arch/x86/x86/intr.c"
#  from [b2115e209923e7717dffb100fe6650bbab8db0d7]
#    to [5dad32b879da582a6da92a0cc20497cc12573326]
# 
# patch "sys/arch/x86/x86/ioapic.c"
#  from [98ffcf1b8963984b94b24829c8155f15d26c8c9f]
#    to [762f7807cc7d8f1cd6ac404ea5930dd8c4bda4e5]
# 
# patch "sys/arch/x86/x86/lapic.c"
#  from [5d776fe529262cc6d4c70f0484a101d227f8657b]
#    to [8fa638b4fe17aea06980e74ee640f5a47fa76a19]
# 
# patch "sys/arch/x86/x86/mpacpi.c"
#  from [969059a549303c834819169f08e0b4462aec11ef]
#    to [5e27323592b82f1fcd83c8f20ab5abf6674f9594]
# 
# patch "sys/arch/x86/x86/mpbios.c"
#  from [38386d3c4b71af3b3de24bf3950fc57117a75319]
#    to [5b91c1900864c06eb644fa2992401d043e3ddb0e]
#
============================================================
--- sys/arch/i386/i386/genassym.cf      782349f706bb30e6352ff3c2b83f8807cd7cc335
+++ sys/arch/i386/i386/genassym.cf      82877bd6be84dcca5d080c6e4065bf22244fb6f0
@@ -355,6 +355,7 @@ if NIOAPIC > 0
 define ACPI_SUSPEND_CR8        offsetof(struct cpu_info, ci_suspend_cr8)
 
 if NIOAPIC > 0
+define         PIC_IOAPIC              offsetof(struct pic, pic_ioapic)
 define         IOAPIC_SC_REG           offsetof(struct ioapic_softc, sc_reg)
 define         IOAPIC_SC_DATA          offsetof(struct ioapic_softc, sc_data)
 define         PIC_LOCK                offsetof(struct pic, pic_lock)
============================================================
--- sys/arch/i386/include/i82093reg.h   1c31c0301c76490d4e62d7770c6f305dbce92c82
+++ sys/arch/i386/include/i82093reg.h   bdef13baacd48101e09a9643ca997c222d6f9dff
@@ -35,12 +35,14 @@ 77:                                                         
\
        ioapic_asm_lock(num)                                    ;\
        movl    IS_PIN(%ebp),%esi                               ;\
        leal    0x10(%esi,%esi,1),%esi                          ;\
+       movl    PIC_IOAPIC(%edi),%edi                           ;\
        movl    IOAPIC_SC_REG(%edi),%ebx                        ;\
        movl    %esi, (%ebx)                                    ;\
        movl    IOAPIC_SC_DATA(%edi),%ebx                       ;\
        movl    (%ebx),%esi                                     ;\
        orl     $IOAPIC_REDLO_MASK,%esi                         ;\
        movl    %esi,(%ebx)                                     ;\
+       movl    IS_PIC(%ebp),%edi                               ;\
        ioapic_asm_unlock(num)
 
 /*
@@ -57,6 +59,7 @@ 77:                                                           
\
        ioapic_asm_lock(num)                                    ;\
        movl    IS_PIN(%ebp),%esi                               ;\
        leal    0x10(%esi,%esi,1),%esi                          ;\
+       movl    PIC_IOAPIC(%edi),%edi                           ;\
        movl    IOAPIC_SC_REG(%edi),%ebx                        ;\
        movl    IOAPIC_SC_DATA(%edi),%eax                       ;\
        movl    %esi, (%ebx)                                    ;\
@@ -64,6 +67,7 @@ 77:                                                           
\
        andl    $~IOAPIC_REDLO_MASK,%edx                        ;\
        movl    %esi, (%ebx)                                    ;\
        movl    %edx,(%eax)                                     ;\
+       movl    IS_PIC(%ebp),%edi                               ;\
        ioapic_asm_unlock(num)                                  ;\
 79:
 
============================================================
--- sys/arch/x86/include/i82093var.h    df32e7a66dd2d6711f8ce909a19766757ad5aa9c
+++ sys/arch/x86/include/i82093var.h    9c6abb940691dc13dc9e8bc0679ad6196cdde610
@@ -46,6 +46,7 @@ struct ioapic_softc {
 };
 
 struct ioapic_softc {
+       struct device           sc_dev;
        struct pic              sc_pic;
        struct ioapic_softc     *sc_next;
        int                     sc_apicid;
============================================================
--- sys/arch/x86/include/pic.h  1ea5be7536883a31177b2893b66b64a2cb6f7f29
+++ sys/arch/x86/include/pic.h  3a4eff193bc1a755435c42e156aa0d50a07ff7bd
@@ -11,7 +11,7 @@ struct pic {
  * Structure common to all PIC softcs
  */
 struct pic {
-       struct device pic_dev;
+       const char *pic_name;
         int pic_type;
        int pic_vecbase;
        int pic_apicid;
@@ -22,10 +22,9 @@ struct pic {
        void (*pic_delroute)(struct pic *, struct cpu_info *, int, int, int);
        struct intrstub *pic_level_stubs;
        struct intrstub *pic_edge_stubs;
+       struct ioapic_softc *pic_ioapic; /* if pic_type == PIC_IOAPIC */
 };
 
-#define pic_name pic_dev.dv_xname
-
 /*
  * PIC types.
  */
============================================================
--- sys/arch/x86/isa/isa_machdep.c      6e15b01219a8940fa4125c57fffde134da193ed1
+++ sys/arch/x86/isa/isa_machdep.c      c466a03ee4533b82ba12d46d1ed7234732d97dad
@@ -227,6 +227,7 @@ isa_intr_establish(
        int pin;
 #if NIOAPIC > 0
        int mpih;
+       struct ioapic_softc *ioapic;
 #endif
 
        pin = irq;
@@ -238,14 +239,14 @@ isa_intr_establish(
                    intr_find_mpmapping(mp_eisa_bus, irq, &mpih) == 0) {
                        if (!APIC_IRQ_ISLEGACY(mpih)) {
                                pin = APIC_IRQ_PIN(mpih);
-                               pic = (struct pic *)
-                                   ioapic_find(APIC_IRQ_APIC(mpih));
-                               if (pic == NULL) {
+                               ioapic = ioapic_find(APIC_IRQ_APIC(mpih));
+                               if (ioapic == NULL) {
                                        printf("isa_intr_establish: "
                                               "unknown apic %d\n",
                                            APIC_IRQ_APIC(mpih));
                                        return NULL;
                                }
+                               pic = &ioapic->sc_pic;
                        }
                } else
                        printf("isa_intr_establish: no MP mapping found\n");
============================================================
--- sys/arch/x86/pci/pci_intr_machdep.c 93451fc59cf3b43afd4d32d8e7810de00a0cce1e
+++ sys/arch/x86/pci/pci_intr_machdep.c 612c9f78e2a83bd3e505aaa476d9b6ff63e746e6
@@ -244,6 +244,9 @@ pci_intr_establish(pci_chipset_tag_t pc,
 {
        int pin, irq;
        struct pic *pic;
+#if NIOAPIC > 0
+       struct ioapic_softc *ioapic;
+#endif
        bool mpsafe;
 
        pic = &i8259_pic;
@@ -252,12 +255,13 @@ pci_intr_establish(pci_chipset_tag_t pc,
 
 #if NIOAPIC > 0
        if (ih & APIC_INT_VIA_APIC) {
-               pic = (struct pic *)ioapic_find(APIC_IRQ_APIC(ih));
-               if (pic == NULL) {
+               ioapic = ioapic_find(APIC_IRQ_APIC(ih));
+               if (ioapic == NULL) {
                        printf("pci_intr_establish: bad ioapic %d\n",
                            APIC_IRQ_APIC(ih));
                        return NULL;
                }
+               pic = &ioapic->sc_pic;
                pin = APIC_IRQ_PIN(ih);
                irq = APIC_IRQ_LEGACY_IRQ(ih);
                if (irq < 0 || irq >= NUM_LEGACY_IRQS)
============================================================
--- sys/arch/x86/x86/acpi_machdep.c     8de357c9bb05ad72b175a9eea882a7ab82383824
+++ sys/arch/x86/x86/acpi_machdep.c     06dd313ec37f27d71e93b3aff7edec1bda9f0a91
@@ -108,6 +108,9 @@ acpi_md_OsInstallInterruptHandler(UINT32
 {
        void *ih;
        struct pic *pic;
+#if NIOAPIC > 0
+       struct ioapic_softc *sc;
+#endif
        int irq, pin, trigger;
 
 #if NIOAPIC > 0
@@ -138,9 +141,9 @@ acpi_md_OsInstallInterruptHandler(UINT32
         */
 
 #if NIOAPIC > 0
-       pic = (struct pic *)ioapic_find_bybase(InterruptNumber);
-       if (pic != NULL) {
-               struct ioapic_softc *sc = (struct ioapic_softc *)pic;
+       sc = ioapic_find_bybase(InterruptNumber);
+       if (sc != NULL) {
+               pic = &sc->sc_pic;
                struct mp_intr_map *mip;
 
                if (pic->pic_type == PIC_IOAPIC) {
============================================================
--- sys/arch/x86/x86/i8259.c    10d7c540acb1073879fb084fd2fd66c8d5db1733
+++ sys/arch/x86/x86/i8259.c    efce22268b0380b7dcc917082b66876173558ff0
@@ -108,9 +108,7 @@ struct pic i8259_pic = {
  * Perhaps this should be made into a real device.
  */
 struct pic i8259_pic = {
-       .pic_dev = {
-               .dv_xname = "pic0",
-       },
+       .pic_name = "pic0",
        .pic_type = PIC_I8259,
        .pic_vecbase = 0,
        .pic_apicid = 0,
============================================================
--- sys/arch/x86/x86/intr.c     b2115e209923e7717dffb100fe6650bbab8db0d7
+++ sys/arch/x86/x86/intr.c     5dad32b879da582a6da92a0cc20497cc12573326
@@ -175,9 +175,7 @@ struct pic softintr_pic = {
 #endif
 
 struct pic softintr_pic = {
-       .pic_dev = {
-               .dv_xname = "softintr_fakepic",
-       },
+       .pic_name = "softintr_fakepic",
        .pic_type = PIC_SOFT,
        .pic_vecbase = 0,
        .pic_apicid = 0,
@@ -507,7 +505,7 @@ intr_allocate_slot_cpu(struct cpu_info *
                snprintf(isp->is_evname, sizeof (isp->is_evname),
                    "pin %d", pin);
                evcnt_attach_dynamic(&isp->is_evcnt, EVCNT_TYPE_INTR, NULL,
-                   device_xname(&pic->pic_dev), isp->is_evname);
+                   pic->pic_name, isp->is_evname);
                ci->ci_isources[slot] = isp;
        }
        mutex_exit(&x86_intr_lock);
@@ -628,11 +626,11 @@ intr_findpic(int num)
 intr_findpic(int num)
 {
 #if NIOAPIC > 0
-       struct pic *pic;
+       struct ioapic_softc *pic;
 
-       pic = (struct pic *)ioapic_find_bybase(num);
+       pic = ioapic_find_bybase(num);
        if (pic != NULL)
-               return pic;
+               return &pic->sc_pic;
 #endif
        if (num < NUM_LEGACY_IRQS)
                return &i8259_pic;
@@ -665,7 +663,7 @@ intr_establish(int legacy_irq, struct pi
            &idt_vec);
        if (error != 0) {
                printf("failed to allocate interrupt slot for PIC %s pin %d\n",
-                   device_xname(&pic->pic_dev), pin);
+                   pic->pic_name, pin);
                return NULL;
        }
 
@@ -713,7 +711,7 @@ intr_establish(int legacy_irq, struct pi
        default:
                mutex_exit(&x86_intr_lock);
                panic("intr_establish: bad intr type %d for pic %s pin %d\n",
-                   source->is_type, device_xname(&pic->pic_dev), pin);
+                   source->is_type, pic->pic_name, pin);
        }
 
        pic->pic_hwmask(pic, pin);
@@ -813,7 +811,7 @@ intr_disestablish(struct intrhand *ih)
 
 #ifdef INTRDEBUG
        printf("%s: remove slot %d (pic %s pin %d vec %d)\n",
-           device_xname(ci->ci_dev), ih->ih_slot, device_xname(&pic->pic_dev),
+           device_xname(ci->ci_dev), ih->ih_slot, pic->pic_name,
            ih->ih_pin, idtvec);
 #endif
 
@@ -835,7 +833,7 @@ intr_string(int ih)
 {
        static char irqstr[64];
 #if NIOAPIC > 0
-       struct pic *pic;
+       struct ioapic_softc *pic;
 #endif
 
        if (ih == 0)
@@ -844,10 +842,10 @@ intr_string(int ih)
 
 #if NIOAPIC > 0
        if (ih & APIC_INT_VIA_APIC) {
-               pic = (struct pic *)ioapic_find(APIC_IRQ_APIC(ih));
+               pic = ioapic_find(APIC_IRQ_APIC(ih));
                if (pic != NULL) {
                        sprintf(irqstr, "%s pin %d",
-                           pic->pic_name, APIC_IRQ_PIN(ih));
+                           device_xname(&pic->sc_dev), APIC_IRQ_PIN(ih));
                } else {
                        sprintf(irqstr, "apic %d int %d (irq %d)",
                            APIC_IRQ_APIC(ih),
============================================================
--- sys/arch/x86/x86/ioapic.c   98ffcf1b8963984b94b24829c8155f15d26c8c9f
+++ sys/arch/x86/x86/ioapic.c   762f7807cc7d8f1cd6ac404ea5930dd8c4bda4e5
@@ -240,7 +240,7 @@ ioapic_print_redir (struct ioapic_softc 
        uint32_t redirlo = ioapic_read(sc, IOAPIC_REDLO(pin));
        uint32_t redirhi = ioapic_read(sc, IOAPIC_REDHI(pin));
 
-       apic_format_redir(device_xname(&sc->sc_pic.pic_dev), why, pin, redirhi,
+       apic_format_redir(device_xname(&sc->sc_dev), why, pin, redirhi,
            redirlo);
 }
 
@@ -268,6 +268,8 @@ ioapic_attach(struct device *parent, str
        
        sc->sc_flags = aaa->flags;
        sc->sc_pic.pic_apicid = aaa->apic_id;
+       sc->sc_pic.pic_name = device_xname(self);
+       sc->sc_pic.pic_ioapic = sc;
 
        aprint_naive("\n");
 
@@ -363,7 +365,7 @@ ioapic_attach(struct device *parent, str
         * mapping later ...
         */
        if (apic_id != sc->sc_pic.pic_apicid) {
-               aprint_debug_dev(&sc->sc_pic.pic_dev, "misconfigured as apic 
%d\n", apic_id);
+               aprint_debug_dev(&sc->sc_dev, "misconfigured as apic %d\n", 
apic_id);
 
                ioapic_write(sc,IOAPIC_ID,
                    (ioapic_read(sc,IOAPIC_ID)&~IOAPIC_ID_MASK)
@@ -372,10 +374,10 @@ ioapic_attach(struct device *parent, str
                apic_id = 
(ioapic_read(sc,IOAPIC_ID)&IOAPIC_ID_MASK)>>IOAPIC_ID_SHIFT;
                
                if (apic_id != sc->sc_pic.pic_apicid) {
-                       aprint_error_dev(&sc->sc_pic.pic_dev, "can't remap to 
apid %d\n",
+                       aprint_error_dev(&sc->sc_dev, "can't remap to apid 
%d\n",
                            sc->sc_pic.pic_apicid);
                } else {
-                       aprint_debug_dev(&sc->sc_pic.pic_dev, "remapped to apic 
%d\n",
+                       aprint_debug_dev(&sc->sc_dev, "remapped to apic %d\n",
                            sc->sc_pic.pic_apicid);
                }
        }
@@ -458,7 +460,7 @@ ioapic_enable(void)
                return;
 
        if (ioapics->sc_flags & IOAPIC_PICMODE) {
-               aprint_debug_dev(&ioapics->sc_pic.pic_dev, "writing to IMCR to 
disable pics\n");
+               aprint_debug_dev(&ioapics->sc_dev, "writing to IMCR to disable 
pics\n");
                outb(IMCR_ADDR, IMCR_REGISTER);
                outb(IMCR_DATA, IMCR_APIC);
        }
@@ -473,7 +475,7 @@ ioapic_reenable(void)
        if (ioapics == NULL)
                return;
 
-       aprint_normal("%s reenabling\n", 
device_xname(&ioapics->sc_pic.pic_dev));
+       aprint_normal("%s reenabling\n", device_xname(&ioapics->sc_dev));
 
        for (sc = ioapics; sc != NULL; sc = sc->sc_next) {
                apic_id = 
(ioapic_read(sc,IOAPIC_ID)&IOAPIC_ID_MASK)>>IOAPIC_ID_SHIFT;
@@ -496,7 +498,7 @@ ioapic_hwmask(struct pic *pic, int pin)
 ioapic_hwmask(struct pic *pic, int pin)
 {
        uint32_t redlo;
-       struct ioapic_softc *sc = (struct ioapic_softc *)pic;
+       struct ioapic_softc *sc = pic->pic_ioapic;
        u_long flags;
 
        flags = ioapic_lock(sc);
@@ -510,7 +512,7 @@ ioapic_hwunmask(struct pic *pic, int pin
 ioapic_hwunmask(struct pic *pic, int pin)
 {
        uint32_t redlo;
-       struct ioapic_softc *sc = (struct ioapic_softc *)pic;
+       struct ioapic_softc *sc = pic->pic_ioapic;
        u_long flags;
 
        flags = ioapic_lock(sc);
@@ -525,7 +527,7 @@ ioapic_addroute(struct pic *pic, struct 
                int idtvec, int type)
 
 {
-       struct ioapic_softc *sc = (struct ioapic_softc *)pic;
+       struct ioapic_softc *sc = pic->pic_ioapic;
        struct ioapic_pin *pp;
 
        pp = &sc->sc_pins[pin];
@@ -570,7 +572,7 @@ ioapic_dump_raw(void)
        uint32_t reg;
 
        for (sc = ioapics; sc != NULL; sc = sc->sc_next) {
-               printf("Register dump of %s\n", 
device_xname(&sc->sc_pic.pic_dev));
+               printf("Register dump of %s\n", device_xname(&sc->sc_dev));
                i = 0;
                do {
                        if (i % 0x08 == 0)
============================================================
--- sys/arch/x86/x86/lapic.c    5d776fe529262cc6d4c70f0484a101d227f8657b
+++ sys/arch/x86/x86/lapic.c    8fa638b4fe17aea06980e74ee640f5a47fa76a19
@@ -79,9 +79,7 @@ struct pic local_pic = {
 static void lapic_setup(struct pic *, struct cpu_info *, int, int, int);
 
 struct pic local_pic = {
-       .pic_dev = {
-               .dv_xname = "lapic",
-       },
+       .pic_name = "lapic",
        .pic_type = PIC_LAPIC,
        .pic_lock = __SIMPLELOCK_UNLOCKED,
        .pic_hwmask = lapic_hwmask,
============================================================
--- sys/arch/x86/x86/mpacpi.c   969059a549303c834819169f08e0b4462aec11ef
+++ sys/arch/x86/x86/mpacpi.c   5e27323592b82f1fcd83c8f20ab5abf6674f9594
@@ -203,7 +203,7 @@ mpacpi_nonpci_intr(ACPI_SUBTABLE_HEADER 
                mpi->redir = (IOAPIC_REDLO_DEL_NMI<<IOAPIC_REDLO_DEL_SHIFT);
 #if NIOAPIC > 0
                if (pic->pic_type == PIC_IOAPIC) {
-                       ((struct ioapic_softc *)pic)->sc_pins[pin].ip_map = mpi;
+                       pic->pic_ioapic->sc_pins[pin].ip_map = mpi;
                        mpi->ioapic_ih = APIC_INT_VIA_APIC |
                            (pic->pic_apicid << APIC_INT_APIC_SHIFT) |
                            (pin << APIC_INT_PIN_SHIFT);
@@ -299,7 +299,7 @@ mpacpi_nonpci_intr(ACPI_SUBTABLE_HEADER 
                mpi->flags = isa_ovr->IntiFlags;
 #if NIOAPIC > 0
                if (pic->pic_type == PIC_IOAPIC)
-                       ((struct ioapic_softc *)pic)->sc_pins[pin].ip_map = mpi;
+                       pic->pic_ioapic->sc_pins[pin].ip_map = mpi;
 #endif
                if (isa_ovr->SourceIrq == AcpiGbl_FADT.SciInterrupt)
                        mpacpi_sci_override = mpi;
@@ -811,7 +811,7 @@ mpacpi_pciroute(struct mpacpi_pcibus *mp
                        mpi->ioapic_pin = pin;
 #if NIOAPIC > 0
                        if (pic->pic_type == PIC_IOAPIC) {
-                               ((struct ioapic_softc 
*)pic)->sc_pins[pin].ip_map = mpi;
+                               pic->pic_ioapic->sc_pins[pin].ip_map = mpi;
                                mpi->ioapic_ih = APIC_INT_VIA_APIC |
                                    (pic->pic_apicid << APIC_INT_APIC_SHIFT) |
                                    (pin << APIC_INT_PIN_SHIFT);
@@ -939,7 +939,7 @@ mpacpi_config_irouting(struct acpi_softc
                            (i << APIC_INT_PIN_SHIFT);
                        mpi->redir =
                            (IOAPIC_REDLO_DEL_FIXED<<IOAPIC_REDLO_DEL_SHIFT);
-                       ((struct ioapic_softc *)pic)->sc_pins[i].ip_map = mpi;
+                       pic->pic_ioapic->sc_pins[i].ip_map = mpi;
                } else
 #endif
                        mpi->ioapic_ih = i;
@@ -1028,7 +1028,7 @@ mpacpi_print_intr(struct mp_intr_map *mp
                    acpi_pci_link_name(mpi->linkdev), busname);
        else
                printf("%s: pin %d attached to %s",
-                   sc ? device_xname(&sc->pic_dev) : "local apic",
+                   sc ? sc->pic_name : "local apic",
                    pin, busname);
 
        if (mpi->bus != NULL) {
@@ -1228,7 +1228,7 @@ mpacpi_findintr_linkdev(struct mp_intr_m
                mip->ioapic_ih = APIC_INT_VIA_APIC |
                    (pic->pic_apicid << APIC_INT_APIC_SHIFT) |
                    (pin << APIC_INT_PIN_SHIFT);
-               ((struct ioapic_softc *)pic)->sc_pins[pin].ip_map = mip;
+               pic->pic_ioapic->sc_pins[pin].ip_map = mip;
                mip->ioapic_pin = pin;
 #else
                return ENOENT;
============================================================
--- sys/arch/x86/x86/mpbios.c   38386d3c4b71af3b3de24bf3950fc57117a75319
+++ sys/arch/x86/x86/mpbios.c   5b91c1900864c06eb644fa2992401d043e3ddb0e
@@ -1045,7 +1045,8 @@ mpbios_int(const uint8_t *ent, int entty
 mpbios_int(const uint8_t *ent, int enttype, struct mp_intr_map *mpi)
 {
        const struct mpbios_int *entry = (const struct mpbios_int *)ent;
-       struct ioapic_softc *sc = NULL, *sc2;
+       struct ioapic_softc *sc = NULL;
+       struct pic *sc2;
 
        struct mp_intr_map *altmpi;
        struct mp_bus *mpb;
@@ -1108,8 +1109,8 @@ mpbios_int(const uint8_t *ent, int entty
                 * number.
                 */
                if (pin >= sc->sc_apic_sz) {
-                       sc2 = (struct ioapic_softc *)intr_findpic(pin);
-                       if (sc2 != sc) {
+                       sc2 = intr_findpic(pin);
+                       if (sc2 && sc2->pic_ioapic != sc) {
                                printf("mpbios: bad pin %d for apic %d\n",
                                    pin, id);
                                return;
@@ -1128,7 +1129,7 @@ mpbios_int(const uint8_t *ent, int entty
                        if ((altmpi->type != type) ||
                            (altmpi->flags != flags)) {
                                printf("%s: conflicting map entries for pin 
%d\n",
-                                   device_xname(&sc->sc_pic.pic_dev), pin);
+                                   device_xname(&sc->sc_dev), pin);
                        }
                } else {
                        sc->sc_pins[pin].ip_map = mpi;
@@ -1150,7 +1151,7 @@ mpbios_int(const uint8_t *ent, int entty
                char buf[256];
 
                printf("%s: int%d attached to %s",
-                   sc ? device_xname(&sc->sc_pic.pic_dev) : "local apic",
+                   sc ? device_xname(&sc->sc_dev) : "local apic",
                    pin, mpb->mb_name);
 
                if (mpb->mb_idx != -1)


Home | Main Index | Thread Index | Old Index