mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Updated to use new APIC (SMP) safe interrupt register/unregister
functions. Posted for review to -smp and -mobile and -hackers with no objections. Reviewed by: Nate
This commit is contained in:
parent
ac483aaf25
commit
6fe7bbc584
2 changed files with 48 additions and 7 deletions
|
|
@ -28,7 +28,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: pccard.c,v 1.71 1999/02/13 11:31:59 kuriyama Exp $
|
||||
* $Id: pccard.c,v 1.72 1999/02/14 20:41:01 guido Exp $
|
||||
*/
|
||||
|
||||
#include "opt_devfs.h"
|
||||
|
|
@ -60,6 +60,7 @@
|
|||
|
||||
#include <pccard/cardinfo.h>
|
||||
#include <pccard/driver.h>
|
||||
#include <pccard/pcic.h>
|
||||
#include <pccard/slot.h>
|
||||
|
||||
#include <machine/md_var.h>
|
||||
|
|
@ -339,7 +340,7 @@ unregister_device_interrupt(struct pccard_devinfo *devi)
|
|||
printf("Return IRQ=%d\n",slt->irq);
|
||||
slt->ctrl->mapirq(slt, 0);
|
||||
INTRDIS(1<<slt->irq);
|
||||
unregister_intr(slt->irq, slot_irq_handler);
|
||||
unregister_pcic_intr(slt->irq, slot_irq_handler);
|
||||
if (devi->drv->imask)
|
||||
INTRUNMASK(*devi->drv->imask,(1<<slt->irq));
|
||||
/* Remove from the PCIC controller imask */
|
||||
|
|
@ -526,7 +527,7 @@ pccard_alloc_intr(u_int imask, inthand2_t *hand, int unit,
|
|||
if (!(mask & imask))
|
||||
continue;
|
||||
INTRMASK(*maskp, mask);
|
||||
if (register_intr(irq, 0, 0, hand, maskp, unit) == 0) {
|
||||
if (register_pcic_intr(irq, 0, 0, hand, maskp, unit) == 0) {
|
||||
/* add this to the PCIC controller's mask */
|
||||
if (pcic_imask)
|
||||
INTRMASK(*pcic_imask, (1 << irq));
|
||||
|
|
|
|||
|
|
@ -53,6 +53,11 @@
|
|||
#include <pccard/cardinfo.h>
|
||||
#include <pccard/driver.h>
|
||||
#include <pccard/slot.h>
|
||||
#include <pccard/pcic.h>
|
||||
|
||||
#ifdef APIC_IO
|
||||
#include <machine/smp.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Prototypes for interrupt handler.
|
||||
|
|
@ -158,6 +163,41 @@ putw(struct pcic_slot *sp, int reg, unsigned short word)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Gerneral functions for registering and unregistering interrupts.
|
||||
* isa_to_apic() is used to map the ISA IRQ onto the APIC IRQ to
|
||||
* check if the APIC IRQ is used or free.
|
||||
*/
|
||||
#ifdef APIC_IO
|
||||
int register_pcic_intr(int intr, int device_id, u_int flags,
|
||||
inthand2_t handler, u_int *maskptr, int unit){
|
||||
int apic_intr;
|
||||
apic_intr = isa_apic_irq(intr);
|
||||
if (apic_intr <0) return -1;
|
||||
else return register_intr(apic_intr, device_id, flags, handler,
|
||||
maskptr, unit);
|
||||
}
|
||||
|
||||
int unregister_pcic_intr(int intr, inthand2_t handler){
|
||||
int apic_intr;
|
||||
apic_intr = isa_apic_irq(intr);
|
||||
return unregister_intr(apic_intr, handler);
|
||||
}
|
||||
|
||||
#else /* Not APIC_IO */
|
||||
|
||||
static int register_pcic_intr(int intr, int device_id, u_int flags,
|
||||
inthand2_t handler, u_int *maskptr, int unit){
|
||||
return register_intr(intr, device_id, flags, handler, maskptr, unit);
|
||||
}
|
||||
|
||||
static int unregister_pcic_intr(int intr, inthand2_t handler){
|
||||
return unregister_intr(intr, handler);
|
||||
}
|
||||
|
||||
#endif /* APIC_IO */
|
||||
|
||||
|
||||
/*
|
||||
* Loadable kernel module interface.
|
||||
*/
|
||||
|
|
@ -228,7 +268,7 @@ pcic_unload()
|
|||
if (sp->slt)
|
||||
sp->putb(sp, PCIC_STAT_INT, 0);
|
||||
}
|
||||
unregister_intr(pcic_irq, pcicintr);
|
||||
unregister_pcic_intr(pcic_irq, pcicintr);
|
||||
}
|
||||
pccard_remove_controller(&cinfo);
|
||||
return(0);
|
||||
|
|
@ -282,12 +322,12 @@ build_freelist(u_int pcic_mask)
|
|||
*/
|
||||
mask = 1 << irq;
|
||||
if (!(mask & pcic_mask)) continue;
|
||||
|
||||
|
||||
/* See if the IRQ is free. */
|
||||
if (register_intr(irq, 0, 0, nullfunc, NULL, irq) == 0) {
|
||||
if (register_pcic_intr(irq, 0, 0, nullfunc, NULL, irq) == 0) {
|
||||
/* Give it back, but add it to the mask */
|
||||
INTRMASK(freemask, mask);
|
||||
unregister_intr(irq, nullfunc);
|
||||
unregister_pcic_intr(irq, nullfunc);
|
||||
}
|
||||
}
|
||||
#ifdef PCIC_DEBUG
|
||||
|
|
|
|||
Loading…
Reference in a new issue