static int BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg) { switch (mt) { case CARD_RESET: /* Disable ints */ set_ipac_active(cs->subtyp, 0); enable_bkm_int(cs, 0); reset_bkm(cs); return (0); case CARD_RELEASE: /* Sanity */ set_ipac_active(cs->subtyp, 0); enable_bkm_int(cs, 0); reset_bkm(cs); release_io_sct_quadro(cs); return (0); case CARD_INIT: cs->debug |= L1_DEB_IPAC; set_ipac_active(cs->subtyp, 1); inithscxisac(cs, 3); /* Enable ints */ enable_bkm_int(cs, 1); return (0); case CARD_TEST: return (0); } return (0); }
static int BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg) { u_long flags; switch (mt) { case CARD_RESET: spin_lock_irqsave(&cs->lock, flags); /* Disable ints */ set_ipac_active(cs, 0); enable_bkm_int(cs, 0); reset_bkm(cs); spin_unlock_irqrestore(&cs->lock, flags); return (0); case CARD_RELEASE: /* Sanity */ spin_lock_irqsave(&cs->lock, flags); set_ipac_active(cs, 0); enable_bkm_int(cs, 0); spin_unlock_irqrestore(&cs->lock, flags); release_io_sct_quadro(cs); return (0); case CARD_INIT: spin_lock_irqsave(&cs->lock, flags); cs->debug |= L1_DEB_IPAC; set_ipac_active(cs, 1); inithscxisac(cs, 3); /* Enable ints */ enable_bkm_int(cs, 1); spin_unlock_irqrestore(&cs->lock, flags); return (0); case CARD_TEST: return (0); } return (0); }
__initfunc(int setup_sct_quadro(struct IsdnCard *card)) { struct IsdnCardState *cs = card->cs; char tmp[64]; #if CONFIG_PCI u_char pci_bus = 0, pci_device_fn = 0, pci_irq = 0, pci_rev_id; u_int found = 0; u_int pci_ioaddr1, pci_ioaddr2, pci_ioaddr3, pci_ioaddr4, pci_ioaddr5; #endif strcpy(tmp, sct_quadro_revision); printk(KERN_INFO "HiSax: T-Berkom driver Rev. %s\n", HiSax_getrev(tmp)); if (cs->typ == ISDN_CTYPE_SCT_QUADRO) { cs->subtyp = SCT_1; /* Preset */ } else return (0); /* Identify subtype by para[0] */ if (card->para[0] >= SCT_1 && card->para[0] <= SCT_4) cs->subtyp = card->para[0]; else printk(KERN_WARNING "HiSax: %s: Invalid subcontroller in configuration, default to 1\n", CardType[card->typ]); #if CONFIG_PCI if (!pci_present()) { printk(KERN_ERR "bkm_a4t: no PCI bus present\n"); return (0); } if ((dev_a8 = pci_find_device(PLX_VENDOR_ID, PLX_DEVICE_ID, dev_a8))) { u_int sub_sys_id = 0; pci_read_config_dword(dev_a8, PCI_SUBSYSTEM_VENDOR_ID, &sub_sys_id); if (sub_sys_id == ((SCT_SUBSYS_ID << 16) | SCT_SUBVEN_ID)) { found = 1; pci_ioaddr1 = dev_a8->base_address[ 1]; pci_irq = dev_a8->irq; pci_bus = dev_a8->bus->number; pci_device_fn = dev_a8->devfn; } } if (!found) { printk(KERN_WARNING "HiSax: %s (%s): Card not found\n", CardType[card->typ], sct_quadro_subtypes[cs->subtyp]); return (0); } if (!pci_irq) { /* IRQ range check ?? */ printk(KERN_WARNING "HiSax: %s (%s): No IRQ\n", CardType[card->typ], sct_quadro_subtypes[cs->subtyp]); return (0); } #ifdef ATTEMPT_PCI_REMAPPING /* HACK: PLX revision 1 bug: PLX address bit 7 must not be set */ pcibios_read_config_byte(pci_bus, pci_device_fn, PCI_REVISION_ID, &pci_rev_id); if ((pci_ioaddr1 & 0x80) && (pci_rev_id == 1)) { printk(KERN_WARNING "HiSax: %s (%s): PLX rev 1, remapping required!\n", CardType[card->typ], sct_quadro_subtypes[cs->subtyp]); /* Restart PCI negotiation */ pcibios_write_config_dword(pci_bus, pci_device_fn, PCI_BASE_ADDRESS_1, (u_int) - 1); /* Move up by 0x80 byte */ pci_ioaddr1 += 0x80; pci_ioaddr1 &= PCI_BASE_ADDRESS_IO_MASK; pcibios_write_config_dword(pci_bus, pci_device_fn, PCI_BASE_ADDRESS_1, pci_ioaddr1); dev_a8->base_address[ 1] = pci_ioaddr1; } /* End HACK */ #endif pcibios_read_config_dword(pci_bus, pci_device_fn, PCI_BASE_ADDRESS_1, &pci_ioaddr1); pcibios_read_config_dword(pci_bus, pci_device_fn, PCI_BASE_ADDRESS_2, &pci_ioaddr2); pcibios_read_config_dword(pci_bus, pci_device_fn, PCI_BASE_ADDRESS_3, &pci_ioaddr3); pcibios_read_config_dword(pci_bus, pci_device_fn, PCI_BASE_ADDRESS_4, &pci_ioaddr4); pcibios_read_config_dword(pci_bus, pci_device_fn, PCI_BASE_ADDRESS_5, &pci_ioaddr5); if (!pci_ioaddr1 || !pci_ioaddr2 || !pci_ioaddr3 || !pci_ioaddr4 || !pci_ioaddr5) { printk(KERN_WARNING "HiSax: %s (%s): No IO base address(es)\n", CardType[card->typ], sct_quadro_subtypes[cs->subtyp]); return (0); } pci_ioaddr1 &= PCI_BASE_ADDRESS_IO_MASK; pci_ioaddr2 &= PCI_BASE_ADDRESS_IO_MASK; pci_ioaddr3 &= PCI_BASE_ADDRESS_IO_MASK; pci_ioaddr4 &= PCI_BASE_ADDRESS_IO_MASK; pci_ioaddr5 &= PCI_BASE_ADDRESS_IO_MASK; /* Take over */ cs->irq = pci_irq; cs->irq_flags |= SA_SHIRQ; /* pci_ioaddr1 is unique to all subdevices */ /* pci_ioaddr2 is for the fourth subdevice only */ /* pci_ioaddr3 is for the third subdevice only */ /* pci_ioaddr4 is for the second subdevice only */ /* pci_ioaddr5 is for the first subdevice only */ cs->hw.ax.plx_adr = pci_ioaddr1; /* Enter all ipac_base addresses */ ipac_state[SCT_1].base = pci_ioaddr5 + 0x00; ipac_state[SCT_2].base = pci_ioaddr4 + 0x08; ipac_state[SCT_3].base = pci_ioaddr3 + 0x10; ipac_state[SCT_4].base = pci_ioaddr2 + 0x20; /* For isac and hscx control path */ cs->hw.ax.base = ipac_state[cs->subtyp].base; /* For isac and hscx data path */ cs->hw.ax.data_adr = cs->hw.ax.base + 4; #else printk(KERN_WARNING "HiSax: %s (%s): NO_PCI_BIOS\n", CardType[card->typ], sct_quadro_subtypes[cs->subtyp]); printk(KERN_WARNING "HiSax: %s (%s): Unable to configure\n", CardType[card->typ], sct_quadro_subtypes[cs->subtyp]); return (0); #endif /* CONFIG_PCI */ printk(KERN_INFO "HiSax: %s (%s) configured at 0x%.4X, 0x%.4X, 0x%.4X and IRQ %d\n", CardType[card->typ], sct_quadro_subtypes[cs->subtyp], cs->hw.ax.plx_adr, cs->hw.ax.base, cs->hw.ax.data_adr, cs->irq); test_and_set_bit(HW_IPAC, &cs->HW_Flags); /* Disable all currently not active ipacs */ if (!is_ipac_active(SCT_1)) set_ipac_active(SCT_1, 0); if (!is_ipac_active(SCT_2)) set_ipac_active(SCT_2, 0); if (!is_ipac_active(SCT_3)) set_ipac_active(SCT_3, 0); if (!is_ipac_active(SCT_4)) set_ipac_active(SCT_4, 0); /* Perfom general reset (if possible) */ reset_bkm(cs); cs->readisac = &ReadISAC; cs->writeisac = &WriteISAC; cs->readisacfifo = &ReadISACfifo; cs->writeisacfifo = &WriteISACfifo; cs->BC_Read_Reg = &ReadHSCX; cs->BC_Write_Reg = &WriteHSCX; cs->BC_Send_Data = &hscx_fill_fifo; cs->cardmsg = &BKM_card_msg; cs->irq_func = &bkm_interrupt_ipac; printk(KERN_INFO "HiSax: %s (%s): IPAC Version %d\n", CardType[card->typ], sct_quadro_subtypes[cs->subtyp], readreg(cs->hw.ax.base, cs->hw.ax.data_adr, IPAC_ID)); return (1); }