static void ami_int3(int irq, void *dev_id, struct pt_regs *fp) { unsigned short ints = custom.intreqr & custom.intenar; static struct irq_server server = {0, 0}; /* if a blitter interrupt */ if (ints & IF_BLIT) { custom.intreq = IF_BLIT; amiga_do_irq(IRQ_IDX(IRQ_AMIGA_BLIT), fp); } /* if a copper interrupt */ if (ints & IF_COPER) { custom.intreq = IF_COPER; amiga_do_irq(IRQ_IDX(IRQ_AMIGA_COPPER), fp); } /* if a vertical blank interrupt */ if (ints & IF_VERTB) amiga_do_irq_list(IRQ_IDX(IRQ_AMIGA_VERTB), fp, &server); }
void baboon_irq_disable(int irq) { int irq_idx = IRQ_IDX(irq); #ifdef DEBUG_IRQUSE printk("baboon_irq_disable(%d)\n", irq); #endif baboon_disabled |= 1 << irq_idx; if (baboon_disabled) mac_disable_irq(IRQ_NUBUS_C); }
void via_irq_enable(int irq) { int irq_src = IRQ_SRC(irq); int irq_idx = IRQ_IDX(irq); int irq_bit = 1 << irq_idx; #ifdef DEBUG_IRQUSE printk(KERN_DEBUG "via_irq_enable(%d)\n", irq); #endif if (irq_src == 1) { via1[vIER] = irq_bit | 0x80; } else if (irq_src == 2) { /* * Set vPCR for SCSI interrupts (but not on RBV) */ if ((irq_idx == 0) && !rbv_present) { if (macintosh_config->scsi_type == MAC_SCSI_OLD) { /* CB2 (IRQ) indep. input, positive edge */ /* CA2 (DRQ) indep. input, positive edge */ via2[vPCR] = 0x66; } else { /* CB2 (IRQ) indep. input, negative edge */ /* CA2 (DRQ) indep. input, negative edge */ via2[vPCR] = 0x22; } } via2[gIER] = irq_bit | 0x80; } else if (irq_src == 7) { if (rbv_present) { /* enable the slot interrupt. SIER works like IER. */ via2[rSIER] = IER_SET_BIT(irq_idx); } else { /* Make sure the bit is an input, to enable the irq */ /* But not on PowerBooks, that's ADB... */ if ((macintosh_config->adb_type != MAC_ADB_PB1) && (macintosh_config->adb_type != MAC_ADB_PB2)) { switch(macintosh_config->ident) { case MAC_MODEL_II: case MAC_MODEL_IIX: case MAC_MODEL_IICX: case MAC_MODEL_SE30: via2[vDirA] &= (~irq_bit | 0xc0); break; default: via2[vDirA] &= ~irq_bit; } } } nubus_active |= irq_bit; } }
static void ami_int1(int irq, void *dev_id, struct pt_regs *fp) { unsigned short ints = custom.intreqr & custom.intenar; /* if serial transmit buffer empty, interrupt */ if (ints & IF_TBE) { custom.intreq = IF_TBE; amiga_do_irq(IRQ_IDX(IRQ_AMIGA_TBE), fp); } /* if floppy disk transfer complete, interrupt */ if (ints & IF_DSKBLK) { custom.intreq = IF_DSKBLK; amiga_do_irq(IRQ_IDX(IRQ_AMIGA_DSKBLK), fp); } /* if software interrupt set, interrupt */ if (ints & IF_SOFT) { custom.intreq = IF_SOFT; amiga_do_irq(IRQ_IDX(IRQ_AMIGA_SOFT), fp); } }
void via_irq_clear(int irq) { int irq_src = IRQ_SRC(irq); int irq_idx = IRQ_IDX(irq); int irq_bit = 1 << irq_idx; if (irq_src == 1) { via1[vIFR] = irq_bit; } else if (irq_src == 2) { via2[gIFR] = irq_bit | rbv_clear; } else if (irq_src == 7) { /* FIXME: hmm.. */ } }
void amiga_disable_irq(unsigned int irq) { if (irq >= AMI_IRQS) { printk("%s: Unknown IRQ %d\n", __FUNCTION__, irq); return; } if (ami_ablecount[irq]++) return; if (irq >= IRQ_IDX(IRQ_AMIGA_CIAB)) { cia_able_irq(&ciab_base, 1 << (irq - IRQ_IDX(IRQ_AMIGA_CIAB))); return; } if (irq >= IRQ_IDX(IRQ_AMIGA_CIAA)) { cia_able_irq(&ciaa_base, 1 << (irq - IRQ_IDX(IRQ_AMIGA_CIAA))); return; } /* disable the interrupt */ custom.intena = ami_intena_vals[irq]; }
int via_irq_pending(int irq) { int irq_src = IRQ_SRC(irq); int irq_idx = IRQ_IDX(irq); int irq_bit = 1 << irq_idx; if (irq_src == 1) { return via1[vIFR] & irq_bit; } else if (irq_src == 2) { return via2[gIFR] & irq_bit; } else if (irq_src == 7) { return ~via2[gBufA] & irq_bit; } return 0; }
void via_irq_clear(int irq) { int irq_src = IRQ_SRC(irq); int irq_idx = IRQ_IDX(irq); int irq_bit = 1 << irq_idx; if (irq_src == 1) { via1[vIFR] = irq_bit; } else if (irq_src == 2) { via2[gIFR] = irq_bit | rbv_clear; } else if (irq_src == 7) { /* FIXME: There is no way to clear an individual nubus slot * IRQ flag, other than getting the device to do it. */ } }
int via_irq_pending(int irq) { int irq_src = IRQ_SRC(irq); int irq_idx = IRQ_IDX(irq); int irq_bit = 1 << irq_idx; if (irq_src == 1) { return via1[vIFR] & irq_bit; } else if (irq_src == 2) { return via2[gIFR] & irq_bit; } else if (irq_src == 7) { /* Always 0 for MAC_VIA_QUADRA if the slot irq is disabled. */ return ~via2[gBufA] & irq_bit; } return 0; }
void via_nubus_irq_startup(int irq) { int irq_idx = IRQ_IDX(irq); switch (macintosh_config->via_type) { case MAC_VIA_II: case MAC_VIA_QUADRA: /* Make the port A line an input. Probably redundant. */ if (macintosh_config->via_type == MAC_VIA_II) { /* The top two bits are RAM size outputs. */ via2[vDirA] &= 0xC0 | ~(1 << irq_idx); } else { /* Allow NuBus slots 9 through F. */ via2[vDirA] &= 0x80 | ~(1 << irq_idx); } /* fall through */ case MAC_VIA_IICI: via_irq_enable(irq); break; } }
int request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id) { if ((irq & IRQ_MACHSPEC) && mach_request_irq) { return mach_request_irq(IRQ_IDX(irq), handler, flags, devname, dev_id); } if (irq < 0 || irq >= NR_IRQS) { printk("%s: Incorrect IRQ %d from %s\n", __FUNCTION__, irq, devname); return -ENXIO; } if (!(vec_list[irq].flags & IRQ_FLG_STD)) { if (vec_list[irq].flags & IRQ_FLG_LOCK) { printk("%s: IRQ %d from %s is not replaceable\n", __FUNCTION__, irq, vec_list[irq].devname); return -EBUSY; } if (flags & IRQ_FLG_REPLACE) { printk("%s: %s can't replace IRQ %d from %s\n", __FUNCTION__, devname, irq, vec_list[irq].devname); return -EBUSY; } } if (flags & IRQ_FLG_FAST) { extern asmlinkage void fasthandler(void); extern void set_evector(int vecnum, void (*handler)(void)); set_evector(irq, fasthandler); } vec_list[irq].handler = handler; vec_list[irq].flags = flags; vec_list[irq].dev_id = dev_id; vec_list[irq].devname = devname; return 0; }
void via_irq_disable(int irq) { int irq_src = IRQ_SRC(irq); int irq_idx = IRQ_IDX(irq); if (irq_src == 1) { via1[vIER] = IER_CLR_BIT(irq_idx); } else if (irq_src == 2) { via2[gIER] = IER_CLR_BIT(irq_idx); } else if (irq_src == 7) { switch (macintosh_config->via_type) { case MAC_VIA_II: case MAC_VIA_QUADRA: nubus_disabled |= 1 << irq_idx; if (nubus_disabled) via2[gIER] = IER_CLR_BIT(1); break; case MAC_VIA_IICI: via2[rSIER] = IER_CLR_BIT(irq_idx); break; } } }
void via_irq_enable(int irq) { int irq_src = IRQ_SRC(irq); int irq_idx = IRQ_IDX(irq); int irq_bit = 1 << irq_idx; #ifdef DEBUG_IRQUSE printk("via_irq_enable(%d)\n", irq); #endif if (irq_src == 1) { via1[vIER] = irq_bit | 0x80; } else if (irq_src == 2) { /* * Set vPCR for SCSI interrupts (but not on RBV) */ if ((irq_idx == 0) && !rbv_present) { if (macintosh_config->scsi_type == MAC_SCSI_OLD) { /* CB2 (IRQ) indep. input, positive edge */ /* CA2 (DRQ) indep. input, positive edge */ via2[vPCR] = 0x66; } else { /* CB2 (IRQ) indep. input, negative edge */ /* CA2 (DRQ) indep. input, negative edge */ via2[vPCR] = 0x22; } } via2[gIER] = irq_bit | 0x80; } else if (irq_src == 7) { if (rbv_present) { /* enable the slot interrupt. SIER works like IER. */ via2[rSIER] = IER_SET_BIT(irq_idx); } else { /* Make sure the bit is an input, to enable the irq */ via2[vDirA] &= ~irq_bit; } nubus_active |= irq_bit; } }
void via_irq_enable(int irq) { int irq_src = IRQ_SRC(irq); int irq_idx = IRQ_IDX(irq); #ifdef DEBUG_IRQUSE printk(KERN_DEBUG "via_irq_enable(%d)\n", irq); #endif if (irq_src == 1) { via1[vIER] = IER_SET_BIT(irq_idx); } else if (irq_src == 2) { if (irq != IRQ_MAC_NUBUS || nubus_disabled == 0) via2[gIER] = IER_SET_BIT(irq_idx); } else if (irq_src == 7) { switch (macintosh_config->via_type) { case MAC_VIA_II: nubus_disabled &= ~(1 << irq_idx); /* Enable the CA1 interrupt when no slot is disabled. */ if (!nubus_disabled) via2[gIER] = IER_SET_BIT(1); break; case MAC_VIA_IIci: /* On RBV, enable the slot interrupt. * SIER works like IER. */ via2[rSIER] = IER_SET_BIT(irq_idx); break; case MAC_VIA_QUADRA: /* Make the port A line an input to enable the slot irq. * But not on PowerBooks, that's ADB. */ if ((macintosh_config->adb_type != MAC_ADB_PB1) && (macintosh_config->adb_type != MAC_ADB_PB2)) via2[vDirA] &= ~(1 << irq_idx); break; } } }
void via_irq_disable(int irq) { int irq_src = IRQ_SRC(irq); int irq_idx = IRQ_IDX(irq); int irq_bit = 1 << irq_idx; #ifdef DEBUG_IRQUSE printk("via_irq_disable(%d)\n", irq); #endif if (irq_src == 1) { via1[vIER] = irq_bit; } else if (irq_src == 2) { via2[gIER] = irq_bit; } else if (irq_src == 7) { if (rbv_present) { /* disable the slot interrupt. SIER works like IER. */ via2[rSIER] = IER_CLR_BIT(irq_idx); } else { /* disable the nubus irq by changing dir to output */ via2[vDirA] |= irq_bit; } nubus_active &= ~irq_bit; } }
void free_irq(unsigned int irq, void *dev_id) { if (irq & IRQ_MACHSPEC) { mach_free_irq(IRQ_IDX(irq), dev_id); return; } if (irq < IRQ1 || irq > IRQ7) { printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq); return; } if (irq_list[irq].dev_id != dev_id) printk("%s: Removing probably wrong IRQ %d from %s\n", __FUNCTION__, irq, irq_list[irq].devname); if (mach_default_handler) irq_list[irq].handler = (*mach_default_handler)[irq]; else irq_list[irq].handler = NULL; irq_list[irq].flags = IRQ_FLG_STD; irq_list[irq].dev_id = NULL; irq_list[irq].devname = default_names[irq]; }
static void scc_irq_disable(int irq) { int irq_idx = IRQ_IDX(irq); scc_mask &= ~(1 << irq_idx); }
static void scc_irq_enable(int irq) { int irq_idx = IRQ_IDX(irq); scc_mask |= (1 << irq_idx); }
void disable_irq(unsigned int irq) { if ((irq & IRQ_MACHSPEC) && mach_disable_irq) mach_disable_irq(IRQ_IDX(irq)); }
int baboon_irq_pending(int irq) { int irq_idx = IRQ_IDX(irq); return baboon->mb_ifr & (1 << irq_idx); }
void baboon_irq_clear(int irq) { int irq_idx = IRQ_IDX(irq); baboon->mb_ifr &= ~(1 << irq_idx); }
int via2_scsi_drq_pending(void) { return via2[gIFR] & (1 << IRQ_IDX(IRQ_MAC_SCSIDRQ)); }