Commit 79d00d1d authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Update eicon driver for removal of pcibios_*

Fairly obviously, but untested.
parent 6caf77e6
......@@ -103,8 +103,7 @@ typedef struct
int card_id; /* unique id assigned to this card */
int card_type; /* use DIA_CARD_TYPE_xxx above */
int bus_type; /* use DIA_BUS_TYPE_xxx above */
int bus_num; /* bus number (instance number of bus type) */
int func_num; /* adapter function number (PCI register) */
struct pci_dev *pdev;
int slot; /* slot number in bus */
unsigned char irq; /* IRQ number */
int reset_base; /* Reset register for I/O mapped cards */
......
......@@ -42,310 +42,182 @@ int FPGA_Done=0;
int DivasCardsDiscover(void)
{
struct pci_dev *pdev = NULL;
word wNumCards = 0, wDeviceIndex = 0;
byte byBus, byFunc;
word wPCIConsultation, PCItmp;
word 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;
while ((pdev = pci_find_device(PCI_VENDOR_ID_EICON,
PCI_DEVICE_ID_EICON_MAESTRAQ,
pdev))) {
dword dwRAM, dwDivasIOBase, dwCFG, dwCTL;
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);
printk(KERN_DEBUG "Divas: DIVA Server 4BRI Found\n");
dwRAM = pci_resource_start(pdev, 2);
dwDivasIOBase = pci_resource_start(pdev, 1);
dwCFG = pci_resource_start(pdev, 0);
dwCTL = pci_resource_start(pdev, 3);
/* Retrieve the serial number */
pci_write_config_word(pdev, 0x4E, 0x00FC);
for (j=0, PCItmp=0; j<10000 && !PCItmp; j++) {
pci_read_config_word(pdev, 0x4E, &PCItmp);
PCItmp &= 0x8000; // extract done flag
}
pci_read_config_dword(pdev, 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.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.card_type = DIA_CARD_TYPE_DIVA_SERVER_Q;
Card.bus_type = DIA_BUS_TYPE_PCI;
Card.pdev = pdev;
Card.irq = pdev->irq;
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;
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;
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;
Card.slot = -1;
pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_2, (unsigned int *) &dwDivasIOBase);
dwDivasIOBase &= 0xFFFFFFFC;
sprintf(Card.name, "DIVASQ%ld", i);
pcibios_read_config_byte(byBus, byFunc, PCI_INTERRUPT_LINE, &byIRQ);
Card.serial = PCIserial;
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;
if (DivasCardNew(&Card) != 0) {
break;
}
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");
pdev = NULL;
while ((pdev = pci_find_device(PCI_VENDOR_ID_EICON,
PCI_DEVICE_ID_EICON_MAESTRA,
pdev))) {
dword dwPLXIOBase, dwDivasIOBase;
pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_1, (unsigned int *) &dwPLXIOBase);
dwPLXIOBase &= 0xFFFFFF80;
printk(KERN_DEBUG "Divas: DIVA Server BRI (S/T) Found\n");
dwPLXIOBase = pci_resource_start(pdev, 1);
dwDivasIOBase = pci_resource_start(pdev, 2);
Card.card_id = wNumCards;
Card.card_type = DIA_CARD_TYPE_DIVA_SERVER_B;
Card.bus_type = DIA_BUS_TYPE_PCI;
Card.pdev = pdev;
Card.irq = pdev->irq;
Card.reset_base = dwPLXIOBase;
Card.io_base = dwDivasIOBase;
Card.slot = -1;
strcpy(Card.name, "DIVASB");
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);
}
pcibios_read_config_dword(byBus, byFunc, PCI_BASE_ADDRESS_2, (unsigned int *) &dwDivasIOBase);
dwDivasIOBase &= 0xFFFFFFFC;
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);
continue;
}
if (DivasCardNew(&Card) != 0) {
continue;
}
wNumCards++;
}
pcibios_read_config_byte(byBus, byFunc, PCI_INTERRUPT_LINE, &byIRQ);
pdev = NULL;
while ((pdev = pci_find_device(PCI_VENDOR_ID_EICON,
PCI_DEVICE_ID_EICON_MAESTRAQ_U,
pdev))) {
dword dwPLXIOBase, dwDivasIOBase;
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;
}
printk(KERN_DEBUG "Divas: DIVA Server BRI (U) Found\n");
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;
}
dwPLXIOBase = pci_resource_start(pdev, 1);
dwDivasIOBase = pci_resource_start(pdev, 2);
Card.card_id = wNumCards;
Card.card_type = DIA_CARD_TYPE_DIVA_SERVER_B;
Card.bus_type = DIA_BUS_TYPE_PCI;
Card.pdev = pdev;
Card.irq = pdev->irq;
Card.reset_base = dwPLXIOBase;
Card.io_base = dwDivasIOBase;
Card.slot = -1;
strcpy(Card.name, "DIVASB");
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);
continue;
}
if (DivasCardNew(&Card) != 0)
{
wDeviceIndex++;
continue;
}
wNumCards++;
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);
continue;
}
wDeviceIndex++;
if (DivasCardNew(&Card) != 0) {
continue;
}
wNumCards++;
}
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;
pdev = NULL;
while ((pdev = pci_find_device(PCI_VENDOR_ID_EICON,
PCI_DEVICE_ID_EICON_MAESTRAQ_U,
pdev))) {
dword dwRAM, dwREG, dwCFG;
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++;
printk(KERN_DEBUG "Divas: DIVA Server PRI Found\n");
dwRAM = pci_resource_start(pdev, 0);
dwREG = pci_resource_start(pdev, 2);
dwCFG = pci_resource_start(pdev, 4);
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;
Card.card_id = wNumCards;
Card.card_type = DIA_CARD_TYPE_DIVA_SERVER;
Card.bus_type = DIA_BUS_TYPE_PCI;
Card.pdev = pdev;
Card.irq = pdev->irq;
Card.slot = -1;
strcpy(Card.name, "DIVASP");
if (DivasCardNew(&Card) != 0) {
continue;
}
wDeviceIndex++;
wNumCards++;
}
printk(KERN_INFO "Divas: %d cards detected\n", wNumCards);
if(wNumCards == 0)
{
if(wNumCards == 0) {
return -1;
}
......@@ -357,8 +229,7 @@ int DivasCardsDiscover(void)
Divas_major = register_chrdev(0, "Divas", &Divas_fops);
if (Divas_major < 0)
{
if (Divas_major < 0) {
printk(KERN_WARNING "Divas: Unable to register character driver\n");
return -1;
}
......
......@@ -13,6 +13,7 @@
#include <linux/config.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/smp_lock.h>
#include <asm/io.h>
#include <asm/system.h>
......@@ -67,8 +68,7 @@ int UxCardHandleGet(ux_diva_card_t **card, dia_card_t *cfg)
switch (cfg->bus_type)
{
case DIA_BUS_TYPE_PCI:
c->bus_num = cfg->bus_num;
c->func_num = cfg->func_num;
c->pdev = cfg->pdev;
c->io_base = cfg->io_base;
c->reset_base = cfg->reset_base;
c->card_type = cfg->card_type;
......@@ -625,16 +625,15 @@ void UxIsrRemove(ux_diva_card_t *card, void *dev_id)
void UxPciConfigWrite(ux_diva_card_t *card, int size, int offset, void *value)
{
switch (size)
{
switch (size) {
case sizeof(byte):
pcibios_write_config_byte(card->bus_num, card->func_num, offset, * (byte *) value);
pci_write_config_byte(card->pdev, offset, * (byte *) value);
break;
case sizeof(word):
pcibios_write_config_word(card->bus_num, card->func_num, offset, * (word *) value);
pci_write_config_word(card->pdev, offset, * (word *) value);
break;
case sizeof(dword):
pcibios_write_config_dword(card->bus_num, card->func_num, offset, * (dword *) value);
pci_write_config_dword(card->pdev, offset, * (dword *) value);
break;
default:
printk(KERN_WARNING "Divas: Invalid size in UxPciConfigWrite\n");
......@@ -643,16 +642,15 @@ void UxPciConfigWrite(ux_diva_card_t *card, int size, int offset, void *value)
void UxPciConfigRead(ux_diva_card_t *card, int size, int offset, void *value)
{
switch (size)
{
switch (size) {
case sizeof(byte):
pcibios_read_config_byte(card->bus_num, card->func_num, offset, (byte *) value);
pci_read_config_byte(card->pdev, offset, (byte *) value);
break;
case sizeof(word):
pcibios_read_config_word(card->bus_num, card->func_num, offset, (word *) value);
pci_read_config_word(card->pdev, offset, (word *) value);
break;
case sizeof(dword):
pcibios_read_config_dword(card->bus_num, card->func_num, offset, (unsigned int *) value);
pci_read_config_dword(card->pdev, offset, (unsigned int *) value);
break;
default:
printk(KERN_WARNING "Divas: Invalid size in UxPciConfigRead\n");
......
......@@ -28,8 +28,7 @@ struct ux_diva_card_s
int reset_base;
int card_type;
byte *mapped;
int bus_num;
int func_num;
struct pci_dev *pdev;
int slot;
int irq;
byte *pDRAM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment