Beispiel #1
0
static void
update_masks(intrmask_t *maskptr, int irq)
{
	intrmask_t mask = 1 << irq;

	if (maskptr == NULL)
		return;

	if (find_idesc(maskptr, irq) == NULL) {
		/* no reference to this maskptr was found in this irq's chain */
		if ((*maskptr & mask) == 0)
			return;
		/* the irq was included in the classes mask, remove it */
		INTRUNMASK(*maskptr, mask);
	} else {
		/* a reference to this maskptr was found in this irq's chain */
		if ((*maskptr & mask) != 0)
			return;
		/* put the irq into the classes mask */
		INTRMASK(*maskptr, mask);
	}
	/* we need to update all values in the intr_mask[irq] array */
	update_intr_masks();
	/* update mask in chains of the interrupt multiplex handler as well */
	update_mux_masks();
}
Beispiel #2
0
/*
 *	disable_slot - Disables the slot by removing
 *	the power and unmapping the I/O
 */
static void
disable_slot(struct slot *sp)
{
	int i;
	struct pccard_dev *devp;
	/*
	 * Unload all the drivers on this slot. Note we can't
	 * call remove_device from here, because this may be called
	 * from the event routine, which is called from the slot
	 * controller's ISR, and this could remove the device
	 * structure out in the middle of some driver activity.
	 *
	 * Note that a race condition is possible here; if a
	 * driver is accessing the device and it is removed, then
	 * all bets are off...
	 */
	for (devp = sp->devices; devp; devp = devp->next) {
		if (devp->running) {
			int s = splhigh();
			devp->drv->unload(devp);
			devp->running = 0;
			if (devp->isahd.id_irq && --sp->irqref == 0) {
				printf("Return IRQ=%d\n",sp->irq);
				sp->ctrl->mapirq(sp, 0);
				INTRDIS(1<<sp->irq);
				unregister_intr(sp->irq, slot_irq_handler);
				if (devp->drv->imask)
					INTRUNMASK(*devp->drv->imask,(1<<sp->irq));
				sp->irq = 0;
				}
			splx(s);
		}
	}
	/* Power off the slot 1/2 second after remove of the card */
	timeout(power_off_slot, (caddr_t)sp, hz / 2);
	sp->pwr_off_pending = 1;

	/* De-activate all contexts.  */
	for (i = 0; i < sp->ctrl->maxmem; i++)
		if (sp->mem[i].flags & MDF_ACTIVE) {
			sp->mem[i].flags = 0;
			(void)sp->ctrl->mapmem(sp, i);
		}
	for (i = 0; i < sp->ctrl->maxio; i++)
		if (sp->io[i].flags & IODF_ACTIVE) {
			sp->io[i].flags = 0;
			(void)sp->ctrl->mapio(sp, i);
		}
}