/* * Find the controller and initialize it */ static int cpqarray_pci_detect(void) { int index; unchar bus=0, dev_fn=0; for(index=0; ; index++) { if (pcibios_find_device(PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_SMART2P, index, &bus, &dev_fn)) break; if (index == 1000000) break; if (nr_ctlr == 8) { printk("This driver supports a maximum of " "8 controllers.\n"); break; } hba[nr_ctlr] = kmalloc(sizeof(ctlr_info_t), GFP_KERNEL); memset(hba[nr_ctlr], 0, sizeof(ctlr_info_t)); cpqarray_pci_init(hba[nr_ctlr], bus, dev_fn); sprintf(hba[nr_ctlr]->devname, "ida%d", nr_ctlr); hba[nr_ctlr]->ctlr = nr_ctlr; nr_ctlr++; } return nr_ctlr; }
unsigned long dec21040_init(unsigned long mem_start, unsigned long mem_end) { if (pcibios_present()) { int pci_index; for (pci_index = 0; pci_index < 8; pci_index++) { unsigned char pci_bus, pci_device_fn, pci_irq_line; unsigned long pci_ioaddr; if (pcibios_find_device (DEC_VENDOR_ID, DEC_21040_ID, pci_index, &pci_bus, &pci_device_fn) != 0) break; pcibios_read_config_byte(pci_bus, pci_device_fn, PCI_INTERRUPT_LINE, &pci_irq_line); pcibios_read_config_dword(pci_bus, pci_device_fn, PCI_BASE_ADDRESS_0, &pci_ioaddr); /* Remove I/O space marker in bit 0. */ pci_ioaddr &= ~3; if (tulip_debug > 2) printk("Found DEC PCI Tulip at I/O %#lx, IRQ %d.\n", pci_ioaddr, pci_irq_line); mem_start = tulip_probe1(mem_start, pci_ioaddr, pci_irq_line); } } return mem_start; }
__initfunc(int safl_scan(void)) { if (pcibios_present()) { int index; /* * Search for an EBSA-285 board or an IOP board. Stop at * first one found. */ for (index = 0; index < 8; index++) { if (pcibios_find_device (PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21554, index, &safl_pci_bus, &safl_pci_devfn) == PCIBIOS_SUCCESSFUL) { safl_devid = PCI_DEVICE_ID_DEC_21554; break; } if (pcibios_find_device (PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21285, index, &safl_pci_bus, &safl_pci_devfn) == PCIBIOS_SUCCESSFUL) { safl_devid = PCI_DEVICE_ID_DEC_21285; break; } } if (index < 8) { #ifdef PCI_SUPPORT_VER2 safl_pdev = pci_find_slot(safl_pci_bus, safl_pci_devfn); #endif misc_register(&safl_dev); return 0; } } if (safl_debug) printk(KERN_INFO "Can't find device.\n"); return -ENODEV; }
static int RCscan(void) { int cards_found = 0; struct device *dev = 0; if (pcibios_present()) { static int pci_index = 0; unsigned char pci_bus, pci_device_fn; int scan_status; int board_index = 0; for (; pci_index < 0xff; pci_index++) { unsigned char pci_irq_line; unsigned short pci_command, vendor, device, class; unsigned int pci_ioaddr; scan_status = (pcibios_find_device (RC_PCI45_VENDOR_ID, RC_PCI45_DEVICE_ID, pci_index, &pci_bus, &pci_device_fn)); #ifdef RCDEBUG printk("rc scan_status = 0x%X\n", scan_status); #endif if (scan_status != PCIBIOS_SUCCESSFUL) break; pcibios_read_config_word(pci_bus, pci_device_fn, PCI_VENDOR_ID, &vendor); pcibios_read_config_word(pci_bus, pci_device_fn, PCI_DEVICE_ID, &device); pcibios_read_config_byte(pci_bus, pci_device_fn, PCI_INTERRUPT_LINE, &pci_irq_line); pcibios_read_config_dword(pci_bus, pci_device_fn, PCI_BASE_ADDRESS_0, &pci_ioaddr); pcibios_read_config_word(pci_bus, pci_device_fn, PCI_CLASS_DEVICE, &class); pci_ioaddr &= ~0xf; #ifdef RCDEBUG printk("rc: Found RedCreek PCI adapter\n"); printk("rc: pci class = 0x%x 0x%x \n", class, class>>8); printk("rc: pci_bus = %d, pci_device_fn = %d\n", pci_bus, pci_device_fn); printk("rc: pci_irq_line = 0x%x \n", pci_irq_line); printk("rc: pci_ioaddr = 0x%x\n", pci_ioaddr); #endif #if 0 if (check_region(pci_ioaddr, 32768)) { printk("rc: check_region failed\n"); continue; } else { printk("rc: check_region passed\n"); } #endif /* * Get and check the bus-master and latency values. * Some PCI BIOSes fail to set the master-enable bit. */ pcibios_read_config_word(pci_bus, pci_device_fn, PCI_COMMAND, &pci_command); if ( ! (pci_command & PCI_COMMAND_MASTER)) { printk("rc: PCI Master Bit has not been set!\n"); pci_command |= PCI_COMMAND_MASTER; pcibios_write_config_word(pci_bus, pci_device_fn, PCI_COMMAND, pci_command); } if ( ! (pci_command & PCI_COMMAND_MEMORY)) { /* * If the BIOS did not set the memory enable bit, what else * did it not initialize? Skip this adapter. */ printk("rc: Adapter %d, PCI Memory Bit has not been set!\n", cards_found); printk("rc: Bios problem? \n"); continue; } dev = RCfound_device(dev, pci_ioaddr, pci_irq_line, pci_bus, pci_device_fn, board_index++, cards_found); if (dev) { dev = 0; cards_found++; } } } printk("rc: found %d cards \n", cards_found); return cards_found; }
/***************************************************************************** Function name : orc_ReturnNumberOfAdapters Description : This function will scan PCI bus to get all Orchid card Input : None. Output : None. Return : SUCCESSFUL - Successful scan ohterwise - No drives founded *****************************************************************************/ int orc_ReturnNumberOfAdapters(void) { unsigned int i, iAdapters; iAdapters = 0; /* * PCI-bus probe. */ if (pcibios_present()) { struct { unsigned short vendor_id; unsigned short device_id; } const inia100_pci_devices[] = { {ORC_VENDOR_ID, I920_DEVICE_ID}, {ORC_VENDOR_ID, ORC_DEVICE_ID} }; unsigned int dRegValue; unsigned short command; WORD wBIOS, wBASE; BYTE bPCIBusNum, bInterrupt, bPCIDeviceNum; #ifdef MMAPIO unsigned long page_offset, base; #endif #if LINUX_VERSION_CODE > CVT_LINUX_VERSION(2,1,92) struct pci_dev *pdev = NULL; #else int index; unsigned char pci_bus, pci_devfn; #endif bPCIBusNum = 0; bPCIDeviceNum = 0; init_inia100Adapter_table(); for (i = 0; i < NUMBER(inia100_pci_devices); i++) { #if LINUX_VERSION_CODE > CVT_LINUX_VERSION(2,1,92) pdev = NULL; while ((pdev = pci_find_device(inia100_pci_devices[i].vendor_id, inia100_pci_devices[i].device_id, pdev))) #else index = 0; while (!(pcibios_find_device(inia100_pci_devices[i].vendor_id, inia100_pci_devices[i].device_id, index++, &pci_bus, &pci_devfn))) #endif { if (iAdapters >= MAX_SUPPORTED_ADAPTERS) break; /* Never greater than maximum */ if (i == 0) { /* printk("inia100: The RAID controller is not supported by\n"); printk("inia100: this driver, we are ignoring it.\n"); */ } else { /* * Read sundry information from PCI BIOS. */ #if LINUX_VERSION_CODE > CVT_LINUX_VERSION(2,1,92) bPCIBusNum = pdev->bus->number; bPCIDeviceNum = pdev->devfn; dRegValue = pdev->base_address[0]; if (dRegValue == -1) { /* Check return code */ printk("\n\rinia100: orchid read configuration error.\n"); return (0); /* Read configuration space error */ } /* <02> read from base address + 0x50 offset to get the wBIOS balue. */ wBASE = (WORD) dRegValue; /* Now read the interrupt line */ dRegValue = pdev->irq; bInterrupt = dRegValue & 0xFF; /* Assign interrupt line */ pci_read_config_word(pdev, PCI_COMMAND, &command); pci_write_config_word(pdev, PCI_COMMAND, command | PCI_COMMAND_MASTER | PCI_COMMAND_IO); #else bPCIBusNum = pci_bus; bPCIDeviceNum = pci_devfn; pcibios_read_config_dword(pci_bus, pci_devfn, PCI_BASE_ADDRESS_0, &dRegValue); if (dRegValue == -1) { /* Check return code */ printk("\n\rinia100: Orchid read configuration error.\n"); return (0); /* Read configuration space error */ } /* <02> read from base address + 0x50 offset to get the wBIOS balue. */ wBASE = (WORD) dRegValue; /* Now read the interrupt line */ pcibios_read_config_dword(pci_bus, pci_devfn, PCI_INTERRUPT_LINE, &dRegValue); bInterrupt = dRegValue & 0xFF; /* Assign interrupt line */ pcibios_read_config_word(pci_bus, pci_devfn, PCI_COMMAND, &command); pcibios_write_config_word(pci_bus, pci_devfn, PCI_COMMAND, command | PCI_COMMAND_MASTER | PCI_COMMAND_IO); #endif wBASE &= PCI_BASE_ADDRESS_IO_MASK; wBIOS = ORC_RDWORD(wBASE, 0x50); #ifdef MMAPIO base = wBASE & PAGE_MASK; page_offset = wBASE - base; /* * replace the next line with this one if you are using 2.1.x: * temp_p->maddr = ioremap(base, page_offset + 256); */ #if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,0) wBASE = ioremap(base, page_offset + 256); #else wBASE = (WORD) vremap(base, page_offset + 256); #endif if (wBASE) { wBASE += page_offset; } #endif if (Addinia100_into_Adapter_table(wBIOS, wBASE, bInterrupt, bPCIBusNum, bPCIDeviceNum) == SUCCESSFUL) iAdapters++; } } /* while(pdev=....) */ } /* for PCI_DEVICES */ } /* PCI BIOS present */ return (iAdapters); }
int DivasCardsDiscover(void) { word wNumCards = 0, wDeviceIndex = 0; byte byBus, byFunc; word wPCIConsultation, PCItmp; dword j, i; unsigned int PCIserial; dia_card_t Card; byte *b; while (wDeviceIndex < 10) { wPCIConsultation = pcibios_find_device(PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_MAESTRAQ, wDeviceIndex, &byBus, &byFunc); if (wPCIConsultation == PCIBIOS_SUCCESSFUL) { dword dwRAM, dwDivasIOBase, dwCFG, dwCTL; byte byIRQ; printk(KERN_DEBUG "Divas: DIVA Server 4BRI Found\n"); pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_2,(unsigned int *) &dwRAM); dwRAM &= 0xFFC00000; pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_1,(unsigned int *) &dwDivasIOBase); dwDivasIOBase &= 0xFFFFFF00; pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_0,(unsigned int *) &dwCFG); dwCFG &= 0xFFFFFF00; pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_3,(unsigned int *) &dwCTL); dwCTL &= 0xFFFFE000; pcibios_read_config_byte(byBus, byFunc, PCI_INTERRUPT_LINE, &byIRQ); /* Retrieve the serial number */ pcibios_write_config_word(byBus,byFunc,0x4E,0x00FC); for (j=0, PCItmp=0; j<10000 && !PCItmp; j++) { pcibios_read_config_word(byBus,byFunc,0x4E, &PCItmp); PCItmp &= 0x8000; // extract done flag } pcibios_read_config_dword(byBus,byFunc,0x50, &PCIserial); Card.memory[DIVAS_RAM_MEMORY] = ioremap(dwRAM, 0x400000); Card.memory[DIVAS_CTL_MEMORY] = ioremap(dwCTL, 0x2000); Card.memory[DIVAS_CFG_MEMORY] = ioremap(dwCFG, 0x100); Card.io_base=dwDivasIOBase; Card.irq = byIRQ; Card.card_type = DIA_CARD_TYPE_DIVA_SERVER_Q; Card.bus_type = DIA_BUS_TYPE_PCI; FPGA_Done = 0; /* Create four virtual card structures as we want to treat the 4Bri card as 4 Bri cards*/ for(i=0;i<4;i++) { b=Card.memory[DIVAS_RAM_MEMORY]; b+=(MQ_PROTCODE_OFFSET) * (i==0?0:1); DPRINTF(("divas: offset = 0x%x", i* MQ_PROTCODE_OFFSET)); Card.memory[DIVAS_RAM_MEMORY]=b; b = Card.memory[DIVAS_RAM_MEMORY]; b += MQ_SM_OFFSET; Card.memory[DIVAS_SHARED_MEMORY] = b; Card.bus_num = byBus; Card.func_num = byFunc; Card.slot = -1; /* Fill in Name */ Card.name[0] = 'D'; Card.name[1] = 'I'; Card.name[2] = 'V'; Card.name[3] = 'A'; Card.name[4] = 'S'; Card.name[5] = 'Q'; Card.name[6] = '0' + i; Card.name[7] = '\0'; Card.serial = PCIserial; Card.card_id = wNumCards; if (DivasCardNew(&Card) != 0) { // Force for loop to terminate i = 4; continue; } wNumCards++; }//for } wDeviceIndex++; } wDeviceIndex = 0; while (wDeviceIndex < 10) { wPCIConsultation = pcibios_find_device(PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_MAESTRA, wDeviceIndex, &byBus, &byFunc); if (wPCIConsultation == PCIBIOS_SUCCESSFUL) { dword dwPLXIOBase, dwDivasIOBase; byte byIRQ; printk(KERN_DEBUG "Divas: DIVA Server BRI (S/T) Found\n"); pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_1, (unsigned int *) &dwPLXIOBase); dwPLXIOBase &= 0xFFFFFF80; pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_2, (unsigned int *) &dwDivasIOBase); dwDivasIOBase &= 0xFFFFFFFC; pcibios_read_config_byte(byBus, byFunc, PCI_INTERRUPT_LINE, &byIRQ); Card.card_id = wNumCards; Card.card_type = DIA_CARD_TYPE_DIVA_SERVER_B; Card.bus_type = DIA_BUS_TYPE_PCI; Card.irq = byIRQ; Card.reset_base = dwPLXIOBase; Card.io_base = dwDivasIOBase; Card.bus_num = byBus; Card.func_num = byFunc; Card.slot = -1; Card.name[0] = 'D'; Card.name[1] = 'I'; Card.name[2] = 'V'; Card.name[3] = 'A'; Card.name[4] = 'S'; Card.name[5] = 'B'; Card.name[6] = '\0'; if (check_region(Card.io_base, 0x20)) { printk(KERN_WARNING "Divas: DIVA I/O Base already in use 0x%x-0x%x\n", Card.io_base, Card.io_base + 0x1F); wDeviceIndex++; continue; } if (check_region(Card.reset_base, 0x80)) { printk(KERN_WARNING "Divas: PLX I/O Base already in use 0x%x-0x%x\n", Card.reset_base, Card.reset_base + 0x7F); wDeviceIndex++; continue; } if (DivasCardNew(&Card) != 0) { wDeviceIndex++; continue; } wNumCards++; } wPCIConsultation = pcibios_find_device(PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_MAESTRAQ_U, wDeviceIndex, &byBus, &byFunc); if (wPCIConsultation == PCIBIOS_SUCCESSFUL) { dword dwPLXIOBase, dwDivasIOBase; byte byIRQ; printk(KERN_DEBUG "Divas: DIVA Server BRI (U) Found\n"); pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_1, (unsigned int *) &dwPLXIOBase); dwPLXIOBase &= 0xFFFFFF80; pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_2, (unsigned int *) &dwDivasIOBase); dwDivasIOBase &= 0xFFFFFFFC; pcibios_read_config_byte(byBus, byFunc, PCI_INTERRUPT_LINE, &byIRQ); Card.card_id = wNumCards; Card.card_type = DIA_CARD_TYPE_DIVA_SERVER_B; Card.bus_type = DIA_BUS_TYPE_PCI; Card.irq = byIRQ; Card.reset_base = dwPLXIOBase; Card.io_base = dwDivasIOBase; Card.bus_num = byBus; Card.func_num = byFunc; Card.slot = -1; Card.name[0] = 'D'; Card.name[1] = 'I'; Card.name[2] = 'V'; Card.name[3] = 'A'; Card.name[4] = 'S'; Card.name[5] = 'B'; Card.name[6] = '\0'; if (check_region(Card.io_base, 0x20)) { printk(KERN_WARNING "Divas: DIVA I/O Base already in use 0x%x-0x%x\n", Card.io_base, Card.io_base + 0x1F); wDeviceIndex++; continue; } if (check_region(Card.reset_base, 0x80)) { printk(KERN_WARNING "Divas: PLX I/O Base already in use 0x%x-0x%x\n", Card.reset_base, Card.reset_base + 0x7F); wDeviceIndex++; continue; } if (DivasCardNew(&Card) != 0) { wDeviceIndex++; continue; } wNumCards++; } wDeviceIndex++; } wDeviceIndex = 0; while (wDeviceIndex < 10) { wPCIConsultation = pcibios_find_device(PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_MAESTRAP, wDeviceIndex, &byBus, &byFunc); if (wPCIConsultation == PCIBIOS_SUCCESSFUL) { dword dwRAM, dwREG, dwCFG; byte byIRQ; printk(KERN_DEBUG "Divas: DIVA Server PRI Found\n"); pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_0, (unsigned int *) &dwRAM); dwRAM &= 0xFFFFF000; pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_2, (unsigned int *) &dwREG); dwREG &= 0xFFFFF000; pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_4, (unsigned int *) &dwCFG); dwCFG &= 0xFFFFF000; pcibios_read_config_byte(byBus, byFunc, PCI_INTERRUPT_LINE, &byIRQ); Card.memory[DIVAS_RAM_MEMORY] = ioremap(dwRAM, 0x10000); Card.memory[DIVAS_REG_MEMORY] = ioremap(dwREG, 0x4000); Card.memory[DIVAS_CFG_MEMORY] = ioremap(dwCFG, 0x1000); Card.memory[DIVAS_SHARED_MEMORY] = Card.memory[DIVAS_RAM_MEMORY] + DIVAS_SHARED_OFFSET; /* pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_1, (unsigned int *) &dwPLXIOBase); dwPLXIOBase &= 0xFFFFFFFc; pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_2, (unsigned int *) &dwDivasIOBase); dwDivasIOBase &= 0xFFFFFF80; pcibios_read_config_byte(byBus, byFunc, PCI_INTERRUPT_LINE, &byIRQ); */ Card.card_id = wNumCards; Card.card_type = DIA_CARD_TYPE_DIVA_SERVER; Card.bus_type = DIA_BUS_TYPE_PCI; Card.irq = byIRQ; /* Card.reset_base = dwPLXIOBase; Card.io_base = dwDivasIOBase;*/ Card.bus_num = byBus; Card.func_num = byFunc; Card.slot = -1; Card.name[0] = 'D'; Card.name[1] = 'I'; Card.name[2] = 'V'; Card.name[3] = 'A'; Card.name[4] = 'S'; Card.name[5] = 'P'; Card.name[6] = '\0'; if (DivasCardNew(&Card) != 0) { wDeviceIndex++; continue; } wNumCards++; } wDeviceIndex++; } printk(KERN_INFO "Divas: %d cards detected\n", wNumCards); if(wNumCards == 0) { return -1; } Divas_fops.ioctl = do_ioctl; Divas_fops.poll = do_poll; Divas_fops.read = do_read; Divas_fops.open = do_open; Divas_fops.release = do_release; Divas_major = register_chrdev(0, "Divas", &Divas_fops); if (Divas_major < 0) { printk(KERN_WARNING "Divas: Unable to register character driver\n"); return -1; } return 0; }
__initfunc(int setup_diva(struct IsdnCard *card)) { int bytecnt; u_char val; struct IsdnCardState *cs = card->cs; char tmp[64]; strcpy(tmp, Diva_revision); printk(KERN_INFO "HiSax: Eicon.Diehl Diva driver Rev. %s\n", HiSax_getrev(tmp)); if (cs->typ != ISDN_CTYPE_DIEHLDIVA) return(0); cs->hw.diva.status = 0; if (card->para[1]) { cs->hw.diva.ctrl_reg = 0; cs->hw.diva.cfg_reg = card->para[1]; val = readreg(cs->hw.diva.cfg_reg + DIVA_IPAC_ADR, cs->hw.diva.cfg_reg + DIVA_IPAC_DATA, IPAC_ID); printk(KERN_INFO "Diva: IPAC version %x\n", val); if (val == 1) { cs->subtyp = DIVA_IPAC_ISA; cs->hw.diva.ctrl = 0; cs->hw.diva.isac = card->para[1] + DIVA_IPAC_DATA; cs->hw.diva.hscx = card->para[1] + DIVA_IPAC_DATA; cs->hw.diva.isac_adr = card->para[1] + DIVA_IPAC_ADR; cs->hw.diva.hscx_adr = card->para[1] + DIVA_IPAC_ADR; test_and_set_bit(HW_IPAC, &cs->HW_Flags); } else { cs->subtyp = DIVA_ISA; cs->hw.diva.ctrl = card->para[1] + DIVA_ISA_CTRL; cs->hw.diva.isac = card->para[1] + DIVA_ISA_ISAC_DATA; cs->hw.diva.hscx = card->para[1] + DIVA_HSCX_DATA; cs->hw.diva.isac_adr = card->para[1] + DIVA_ISA_ISAC_ADR; cs->hw.diva.hscx_adr = card->para[1] + DIVA_HSCX_ADR; } cs->irq = card->para[0]; bytecnt = 8; } else { #if CONFIG_PCI u_char pci_bus, pci_device_fn, pci_irq; u_int pci_ioaddr; cs->subtyp = 0; for (; pci_index < 0xff; pci_index++) { if (pcibios_find_device(PCI_VENDOR_EICON_DIEHL, PCI_DIVA20_ID, pci_index, &pci_bus, &pci_device_fn) == PCIBIOS_SUCCESSFUL) cs->subtyp = DIVA_PCI; else if (pcibios_find_device(PCI_VENDOR_EICON_DIEHL, PCI_DIVA20_ID, pci_index, &pci_bus, &pci_device_fn) == PCIBIOS_SUCCESSFUL) cs->subtyp = DIVA_PCI; else break; /* get IRQ */ pcibios_read_config_byte(pci_bus, pci_device_fn, PCI_INTERRUPT_LINE, &pci_irq); /* get IO address */ pcibios_read_config_dword(pci_bus, pci_device_fn, PCI_BASE_ADDRESS_2, &pci_ioaddr); if (cs->subtyp) break; } if (!cs->subtyp) { printk(KERN_WARNING "Diva: No PCI card found\n"); return(0); } pci_index++; if (!pci_irq) { printk(KERN_WARNING "Diva: No IRQ for PCI card found\n"); return(0); } if (!pci_ioaddr) { printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n"); return(0); } pci_ioaddr &= ~3; /* remove io/mem flag */ cs->hw.diva.cfg_reg = pci_ioaddr; cs->hw.diva.ctrl = pci_ioaddr + DIVA_PCI_CTRL; cs->hw.diva.isac = pci_ioaddr + DIVA_PCI_ISAC_DATA; cs->hw.diva.hscx = pci_ioaddr + DIVA_HSCX_DATA; cs->hw.diva.isac_adr = pci_ioaddr + DIVA_PCI_ISAC_ADR; cs->hw.diva.hscx_adr = pci_ioaddr + DIVA_HSCX_ADR; cs->irq = pci_irq; bytecnt = 32; #else printk(KERN_WARNING "Diva: cfgreg 0 and NO_PCI_BIOS\n"); printk(KERN_WARNING "Diva: unable to config DIVA PCI\n"); return (0); #endif /* CONFIG_PCI */ } printk(KERN_INFO "Diva: %s card configured at 0x%x IRQ %d\n", (cs->subtyp == DIVA_PCI) ? "PCI" : (cs->subtyp == DIVA_ISA) ? "ISA" : "IPAC", cs->hw.diva.cfg_reg, cs->irq); if (check_region(cs->hw.diva.cfg_reg, bytecnt)) { printk(KERN_WARNING "HiSax: %s config port %x-%x already in use\n", CardType[card->typ], cs->hw.diva.cfg_reg, cs->hw.diva.cfg_reg + bytecnt); return (0); } else { request_region(cs->hw.diva.cfg_reg, bytecnt, "diva isdn"); } reset_diva(cs); cs->BC_Read_Reg = &ReadHSCX; cs->BC_Write_Reg = &WriteHSCX; cs->BC_Send_Data = &hscx_fill_fifo; cs->cardmsg = &Diva_card_msg; if (cs->subtyp == DIVA_IPAC_ISA) { cs->readisac = &ReadISAC_IPAC; cs->writeisac = &WriteISAC_IPAC; cs->readisacfifo = &ReadISACfifo_IPAC; cs->writeisacfifo = &WriteISACfifo_IPAC; val = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_ID); printk(KERN_INFO "Diva: IPAC version %x\n", val); } else { cs->hw.diva.tl.function = (void *) diva_led_handler; cs->hw.diva.tl.data = (long) cs; init_timer(&cs->hw.diva.tl); cs->readisac = &ReadISAC; cs->writeisac = &WriteISAC; cs->readisacfifo = &ReadISACfifo; cs->writeisacfifo = &WriteISACfifo; ISACVersion(cs, "Diva:"); if (HscxVersion(cs, "Diva:")) { printk(KERN_WARNING "Diva: wrong HSCX versions check IO address\n"); release_io_diva(cs); return (0); } } return (1); }
static int initialize_pcicard( DEV *dev, int index ) { dbg1("%s(): dev=%08X", __FUNCTION__, (uint)dev); { #if 0 u32 PlxIntCsrPort, cport, rport, wtcport, rtr; int irq; char bus, function; if( !pcibios_present() ) { err( "PCI bios not present\n" ); return -ENODEV; } if( pcibios_find_device( VENDOR_ID, DEVICE_ID, index, &bus, &function ) ) { err( "PCI device not found\n" ); return -ENODEV; } pcibios_read_config_dword( bus, function, 0x14, (int *)&rtr ); pcibios_read_config_dword( bus, function, 0x18, (int *)&cport ); pcibios_read_config_dword( bus, function, 0x1C, (int *)&rport ); pcibios_read_config_dword( bus, function, 0x24, (int *)&wtcport ); pcibios_read_config_dword( bus, function, 0x3C, &irq ); PlxIntCsrPort = (rtr & 0xFFF0) + P9050_INTCSR; cport &= 0xFFF0; rport &= 0xFFF0; irq &= 0x0F; outw( 0, PlxIntCsrPort ); if( check_region(cport, 4) ) { err( "unable to register port 0x%X\n", cport ); return -ENODEV; } if( check_region(rport, 4) ) { err( "unable to register port 0x%X\n", rport ); return -ENODEV; } request_region( cport, 4, DRIVER_DEV_NAME ); request_region( rport, 4, DRIVER_DEV_NAME ); dev->cport = cport; dev->rport = rport; dev->wport = rport; dev->wtcport = wtcport; dev->irq = irq; dev->PlxIntCsrPort = PlxIntCsrPort; #else u32 cport; u16 IntCsr; cport = dev->cport; #endif dev->ctl = 0x0D; SETCTL; SETCTL; dev->ctl = 0x16; SETCTL; SETCTL; dev->ctl = 0x02; SETCTL; SETCTL; dev->ctl = 0x16; SETCTL; IntCsr = inw(dev->PlxIntCsrPort); dbg1("? %s(): PlxIntCsrPort=%04X IntCsr=%04X", __FUNCTION__, dev->PlxIntCsrPort, IntCsr); IntCsr |= PLX_9050_INTR_ENABLE | PLX_9050_LINT1_ENABLE; // | PLX_9050_LINT2_ENABLE; outw(IntCsr, dev->PlxIntCsrPort); dbg1("? %s(): PlxIntCsrPort=%04X IntCsr=%04X", __FUNCTION__, dev->PlxIntCsrPort, IntCsr); if( request_irq(dev->irq, lpc_pci_interrupt, SA_SHIRQ, DRIVER_DEV_NAME, dev) ) { err("unable to register IRQ%d\n", dev->irq); #if 0 release_region(rport, 4); release_region(cport, 4); #endif return -ENODEV; } return 0; } }
__initfunc(int setup_telespci(struct IsdnCard *card)) { int found=0; struct IsdnCardState *cs = card->cs; char tmp[64]; u_char pci_bus, pci_device_fn, pci_irq; u_int pci_memaddr; strcpy(tmp, telespci_revision); printk(KERN_INFO "HiSax: Teles/PCI driver Rev. %s\n", HiSax_getrev(tmp)); if (cs->typ != ISDN_CTYPE_TELESPCI) return (0); #if CONFIG_PCI for (; pci_index < 0xff; pci_index++) { if (pcibios_find_device (0x11DE, 0x6120, pci_index, &pci_bus, &pci_device_fn) == PCIBIOS_SUCCESSFUL) { found = 1; } else { break; } pcibios_read_config_dword(pci_bus, pci_device_fn, PCI_BASE_ADDRESS_0, &pci_memaddr); pcibios_read_config_byte(pci_bus, pci_device_fn, PCI_INTERRUPT_LINE, &pci_irq); printk(KERN_INFO "Found: Zoran, base-address: 0x%x," " irq: 0x%x\n", pci_memaddr, pci_irq); break; } if (!found) { printk(KERN_WARNING "TelesPCI: No PCI card found\n"); return(0); } pci_index++; cs->hw.teles0.membase = (u_int) vremap(pci_memaddr, PAGE_SIZE); cs->irq = pci_irq; #else printk(KERN_WARNING "HiSax: Teles/PCI and NO_PCI_BIOS\n"); printk(KERN_WARNING "HiSax: Teles/PCI unable to config\n"); return (0); #endif /* CONFIG_PCI */ /* Initialize Zoran PCI controller */ writel(0x00000000, cs->hw.teles0.membase + 0x28); writel(0x01000000, cs->hw.teles0.membase + 0x28); writel(0x01000000, cs->hw.teles0.membase + 0x28); writel(0x7BFFFFFF, cs->hw.teles0.membase + 0x2C); writel(0x70000000, cs->hw.teles0.membase + 0x3C); writel(0x61000000, cs->hw.teles0.membase + 0x40); /* writel(0x00800000, cs->hw.teles0.membase + 0x200); */ printk(KERN_INFO "HiSax: %s config irq:%d mem:%x\n", CardType[cs->typ], cs->irq, cs->hw.teles0.membase); 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 = &TelesPCI_card_msg; ISACVersion(cs, "TelesPCI:"); if (HscxVersion(cs, "TelesPCI:")) { printk(KERN_WARNING "TelesPCI: wrong HSCX versions check IO/MEM addresses\n"); release_io_telespci(cs); return (0); } return (1); }
__initfunc(int setup_niccy(struct IsdnCard *card)) { struct IsdnCardState *cs = card->cs; char tmp[64]; strcpy(tmp, niccy_revision); printk(KERN_INFO "HiSax: Niccy driver Rev. %s\n", HiSax_getrev(tmp)); if (cs->typ != ISDN_CTYPE_NICCY) return (0); if (card->para[1]) { cs->hw.niccy.isac = card->para[1] + ISAC_PNP; cs->hw.niccy.hscx = card->para[1] + HSCX_PNP; cs->hw.niccy.isac_ale = card->para[2] + ISAC_PNP; cs->hw.niccy.hscx_ale = card->para[2] + HSCX_PNP; cs->hw.niccy.cfg_reg = 0; cs->subtyp = NICCY_PNP; cs->irq = card->para[0]; if (check_region((cs->hw.niccy.isac), 2)) { printk(KERN_WARNING "HiSax: %s data port %x-%x already in use\n", CardType[card->typ], cs->hw.niccy.isac, cs->hw.niccy.isac + 1); return (0); } else request_region(cs->hw.niccy.isac, 2, "niccy data"); if (check_region((cs->hw.niccy.isac_ale), 2)) { printk(KERN_WARNING "HiSax: %s address port %x-%x already in use\n", CardType[card->typ], cs->hw.niccy.isac_ale, cs->hw.niccy.isac_ale + 1); release_region(cs->hw.niccy.isac, 2); return (0); } else request_region(cs->hw.niccy.isac_ale, 2, "niccy addr"); } else { #if CONFIG_PCI u_char pci_bus, pci_device_fn, pci_irq; u_int pci_ioaddr; cs->subtyp = 0; for (; pci_index < 0xff; pci_index++) { if (pcibios_find_device(PCI_VENDOR_DR_NEUHAUS, PCI_NICCY_ID, pci_index, &pci_bus, &pci_device_fn) == PCIBIOS_SUCCESSFUL) cs->subtyp = NICCY_PCI; else break; /* get IRQ */ pcibios_read_config_byte(pci_bus, pci_device_fn, PCI_INTERRUPT_LINE, &pci_irq); /* get IO pci AMCC address */ pcibios_read_config_dword(pci_bus, pci_device_fn, PCI_BASE_ADDRESS_0, &pci_ioaddr); if (!pci_ioaddr) { printk(KERN_WARNING "Niccy: No IO-Adr for PCI cfg found\n"); return(0); } cs->hw.niccy.cfg_reg = pci_ioaddr & ~3 ; /* get IO address */ pcibios_read_config_dword(pci_bus, pci_device_fn, PCI_BASE_ADDRESS_1, &pci_ioaddr); if (cs->subtyp) break; } if (!cs->subtyp) { printk(KERN_WARNING "Niccy: No PCI card found\n"); return(0); } pci_index++; if (!pci_irq) { printk(KERN_WARNING "Niccy: No IRQ for PCI card found\n"); return(0); } if (!pci_ioaddr) { printk(KERN_WARNING "Niccy: No IO-Adr for PCI card found\n"); return(0); } pci_ioaddr &= ~3; /* remove io/mem flag */ cs->hw.niccy.isac = pci_ioaddr + ISAC_PCI_DATA; cs->hw.niccy.isac_ale = pci_ioaddr + ISAC_PCI_ADDR; cs->hw.niccy.hscx = pci_ioaddr + HSCX_PCI_DATA; cs->hw.niccy.hscx_ale = pci_ioaddr + HSCX_PCI_ADDR; cs->irq = pci_irq; if (check_region((cs->hw.niccy.isac), 4)) { printk(KERN_WARNING "HiSax: %s data port %x-%x already in use\n", CardType[card->typ], cs->hw.niccy.isac, cs->hw.niccy.isac + 4); return (0); } else request_region(cs->hw.niccy.isac, 4, "niccy"); if (check_region(cs->hw.niccy.cfg_reg, 0x80)) { printk(KERN_WARNING "HiSax: %s pci port %x-%x already in use\n", CardType[card->typ], cs->hw.niccy.cfg_reg, cs->hw.niccy.cfg_reg + 0x80); release_region(cs->hw.niccy.isac, 4); return (0); } else { request_region(cs->hw.niccy.cfg_reg, 0x80, "niccy pci"); } #else printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n"); printk(KERN_WARNING "Niccy: unable to config NICCY PCI\n"); return (0); #endif /* CONFIG_PCI */ } printk(KERN_INFO "HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n", CardType[cs->typ], (cs->subtyp==1) ? "PnP":"PCI", cs->irq, cs->hw.niccy.isac, cs->hw.niccy.isac_ale); 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 = &niccy_card_msg; ISACVersion(cs, "Niccy:"); if (HscxVersion(cs, "Niccy:")) { printk(KERN_WARNING "Niccy: wrong HSCX versions check IO address\n"); release_io_niccy(cs); return (0); } return (1); }