diff options
Diffstat (limited to 'drivers/char/rio/rio_linux.c')
-rw-r--r-- | drivers/char/rio/rio_linux.c | 69 |
1 files changed, 24 insertions, 45 deletions
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index c9af283a811d..f1e9e9a20c85 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -297,7 +297,7 @@ static void my_hd(void *ad, int len) | |||
297 | unsigned char *addr = ad; | 297 | unsigned char *addr = ad; |
298 | 298 | ||
299 | for (i = 0; i < len; i += 16) { | 299 | for (i = 0; i < len; i += 16) { |
300 | rio_dprintk(RIO_DEBUG_PARAM, "%08x ", (int) addr + i); | 300 | rio_dprintk(RIO_DEBUG_PARAM, "%08lx ", (unsigned long) addr + i); |
301 | for (j = 0; j < 16; j++) { | 301 | for (j = 0; j < 16; j++) { |
302 | rio_dprintk(RIO_DEBUG_PARAM, "%02x %s", addr[j + i], (j == 7) ? " " : ""); | 302 | rio_dprintk(RIO_DEBUG_PARAM, "%02x %s", addr[j + i], (j == 7) ? " " : ""); |
303 | } | 303 | } |
@@ -340,13 +340,16 @@ int RIODelay_ni(struct Port *PortP, int njiffies) | |||
340 | return !RIO_FAIL; | 340 | return !RIO_FAIL; |
341 | } | 341 | } |
342 | 342 | ||
343 | void rio_copy_to_card(void *to, void *from, int len) | ||
344 | { | ||
345 | rio_memcpy_toio(NULL, to, from, len); | ||
346 | } | ||
343 | 347 | ||
344 | int rio_minor(struct tty_struct *tty) | 348 | int rio_minor(struct tty_struct *tty) |
345 | { | 349 | { |
346 | return tty->index + (tty->driver == rio_driver) ? 0 : 256; | 350 | return tty->index + (tty->driver == rio_driver) ? 0 : 256; |
347 | } | 351 | } |
348 | 352 | ||
349 | |||
350 | int rio_ismodem(struct tty_struct *tty) | 353 | int rio_ismodem(struct tty_struct *tty) |
351 | { | 354 | { |
352 | return 1; | 355 | return 1; |
@@ -379,7 +382,7 @@ static void rio_reset_interrupt(struct Host *HostP) | |||
379 | case RIO_AT: | 382 | case RIO_AT: |
380 | case RIO_MCA: | 383 | case RIO_MCA: |
381 | case RIO_PCI: | 384 | case RIO_PCI: |
382 | WBYTE(HostP->ResetInt, 0xff); | 385 | writeb(0xFF, &HostP->ResetInt); |
383 | } | 386 | } |
384 | 387 | ||
385 | func_exit(); | 388 | func_exit(); |
@@ -397,9 +400,6 @@ static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs) | |||
397 | /* AAargh! The order in which to do these things is essential and | 400 | /* AAargh! The order in which to do these things is essential and |
398 | not trivial. | 401 | not trivial. |
399 | 402 | ||
400 | - Rate limit goes before "recursive". Otherwise a series of | ||
401 | recursive calls will hang the machine in the interrupt routine. | ||
402 | |||
403 | - hardware twiddling goes before "recursive". Otherwise when we | 403 | - hardware twiddling goes before "recursive". Otherwise when we |
404 | poll the card, and a recursive interrupt happens, we won't | 404 | poll the card, and a recursive interrupt happens, we won't |
405 | ack the card, so it might keep on interrupting us. (especially | 405 | ack the card, so it might keep on interrupting us. (especially |
@@ -414,26 +414,6 @@ static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs) | |||
414 | - The initialized test goes before recursive. | 414 | - The initialized test goes before recursive. |
415 | */ | 415 | */ |
416 | 416 | ||
417 | |||
418 | |||
419 | #ifdef IRQ_RATE_LIMIT | ||
420 | /* Aaargh! I'm ashamed. This costs more lines-of-code than the | ||
421 | actual interrupt routine!. (Well, used to when I wrote that comment) */ | ||
422 | { | ||
423 | static int lastjif; | ||
424 | static int nintr = 0; | ||
425 | |||
426 | if (lastjif == jiffies) { | ||
427 | if (++nintr > IRQ_RATE_LIMIT) { | ||
428 | free_irq(HostP->Ivec, ptr); | ||
429 | printk(KERN_ERR "rio: Too many interrupts. Turning off interrupt %d.\n", HostP->Ivec); | ||
430 | } | ||
431 | } else { | ||
432 | lastjif = jiffies; | ||
433 | nintr = 0; | ||
434 | } | ||
435 | } | ||
436 | #endif | ||
437 | rio_dprintk(RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n"); | 417 | rio_dprintk(RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n"); |
438 | if (HostP->Ivec == irq) { | 418 | if (HostP->Ivec == irq) { |
439 | /* Tell the card we've noticed the interrupt. */ | 419 | /* Tell the card we've noticed the interrupt. */ |
@@ -444,13 +424,13 @@ static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs) | |||
444 | return IRQ_HANDLED; | 424 | return IRQ_HANDLED; |
445 | 425 | ||
446 | if (test_and_set_bit(RIO_BOARD_INTR_LOCK, &HostP->locks)) { | 426 | if (test_and_set_bit(RIO_BOARD_INTR_LOCK, &HostP->locks)) { |
447 | printk(KERN_ERR "Recursive interrupt! (host %d/irq%d)\n", (int) ptr, HostP->Ivec); | 427 | printk(KERN_ERR "Recursive interrupt! (host %p/irq%d)\n", ptr, HostP->Ivec); |
448 | return IRQ_HANDLED; | 428 | return IRQ_HANDLED; |
449 | } | 429 | } |
450 | 430 | ||
451 | RIOServiceHost(p, HostP, irq); | 431 | RIOServiceHost(p, HostP, irq); |
452 | 432 | ||
453 | rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %d type %d\n", (int) ptr, HostP->Type); | 433 | rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %p type %d\n", ptr, HostP->Type); |
454 | 434 | ||
455 | clear_bit(RIO_BOARD_INTR_LOCK, &HostP->locks); | 435 | clear_bit(RIO_BOARD_INTR_LOCK, &HostP->locks); |
456 | rio_dprintk(RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", irq, HostP->Ivec); | 436 | rio_dprintk(RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", irq, HostP->Ivec); |
@@ -873,7 +853,7 @@ static int rio_init_datastructures(void) | |||
873 | #define HOST_SZ sizeof(struct Host) | 853 | #define HOST_SZ sizeof(struct Host) |
874 | #define PORT_SZ sizeof(struct Port *) | 854 | #define PORT_SZ sizeof(struct Port *) |
875 | #define TMIO_SZ sizeof(struct termios *) | 855 | #define TMIO_SZ sizeof(struct termios *) |
876 | rio_dprintk(RIO_DEBUG_INIT, "getting : %d %d %d %d %d bytes\n", RI_SZ, RIO_HOSTS * HOST_SZ, RIO_PORTS * PORT_SZ, RIO_PORTS * TMIO_SZ, RIO_PORTS * TMIO_SZ); | 856 | rio_dprintk(RIO_DEBUG_INIT, "getting : %Zd %Zd %Zd %Zd %Zd bytes\n", RI_SZ, RIO_HOSTS * HOST_SZ, RIO_PORTS * PORT_SZ, RIO_PORTS * TMIO_SZ, RIO_PORTS * TMIO_SZ); |
877 | 857 | ||
878 | if (!(p = ckmalloc(RI_SZ))) | 858 | if (!(p = ckmalloc(RI_SZ))) |
879 | goto free0; | 859 | goto free0; |
@@ -963,22 +943,21 @@ static void __exit rio_release_drivers(void) | |||
963 | 943 | ||
964 | static void fix_rio_pci(struct pci_dev *pdev) | 944 | static void fix_rio_pci(struct pci_dev *pdev) |
965 | { | 945 | { |
966 | unsigned int hwbase; | 946 | unsigned long hwbase; |
967 | unsigned long rebase; | 947 | unsigned char *rebase; |
968 | unsigned int t; | 948 | unsigned int t; |
969 | 949 | ||
970 | #define CNTRL_REG_OFFSET 0x50 | 950 | #define CNTRL_REG_OFFSET 0x50 |
971 | #define CNTRL_REG_GOODVALUE 0x18260000 | 951 | #define CNTRL_REG_GOODVALUE 0x18260000 |
972 | 952 | ||
973 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase); | 953 | hwbase = pci_resource_start(pdev, 0); |
974 | hwbase &= PCI_BASE_ADDRESS_MEM_MASK; | 954 | rebase = ioremap(hwbase, 0x80); |
975 | rebase = (ulong) ioremap(hwbase, 0x80); | ||
976 | t = readl(rebase + CNTRL_REG_OFFSET); | 955 | t = readl(rebase + CNTRL_REG_OFFSET); |
977 | if (t != CNTRL_REG_GOODVALUE) { | 956 | if (t != CNTRL_REG_GOODVALUE) { |
978 | printk(KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", t, CNTRL_REG_GOODVALUE); | 957 | printk(KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", t, CNTRL_REG_GOODVALUE); |
979 | writel(CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET); | 958 | writel(CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET); |
980 | } | 959 | } |
981 | iounmap((char *) rebase); | 960 | iounmap(rebase); |
982 | } | 961 | } |
983 | #endif | 962 | #endif |
984 | 963 | ||
@@ -1049,7 +1028,7 @@ static int __init rio_init(void) | |||
1049 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | 1028 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); |
1050 | hp->CardP = (struct DpRam *) hp->Caddr; | 1029 | hp->CardP = (struct DpRam *) hp->Caddr; |
1051 | hp->Type = RIO_PCI; | 1030 | hp->Type = RIO_PCI; |
1052 | hp->Copy = rio_pcicopy; | 1031 | hp->Copy = rio_copy_to_card; |
1053 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; | 1032 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; |
1054 | spin_lock_init(&hp->HostLock); | 1033 | spin_lock_init(&hp->HostLock); |
1055 | rio_reset_interrupt(hp); | 1034 | rio_reset_interrupt(hp); |
@@ -1058,10 +1037,10 @@ static int __init rio_init(void) | |||
1058 | rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); | 1037 | rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); |
1059 | if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) { | 1038 | if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) { |
1060 | rio_dprintk(RIO_DEBUG_INIT, "Done RIOBoardTest\n"); | 1039 | rio_dprintk(RIO_DEBUG_INIT, "Done RIOBoardTest\n"); |
1061 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); | 1040 | writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); |
1062 | p->RIOHosts[p->RIONumHosts].UniqueNum = | 1041 | p->RIOHosts[p->RIONumHosts].UniqueNum = |
1063 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | | 1042 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | |
1064 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); | 1043 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); |
1065 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); | 1044 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); |
1066 | 1045 | ||
1067 | fix_rio_pci(pdev); | 1046 | fix_rio_pci(pdev); |
@@ -1099,7 +1078,7 @@ static int __init rio_init(void) | |||
1099 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | 1078 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); |
1100 | hp->CardP = (struct DpRam *) hp->Caddr; | 1079 | hp->CardP = (struct DpRam *) hp->Caddr; |
1101 | hp->Type = RIO_PCI; | 1080 | hp->Type = RIO_PCI; |
1102 | hp->Copy = rio_pcicopy; | 1081 | hp->Copy = rio_copy_to_card; |
1103 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; | 1082 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; |
1104 | spin_lock_init(&hp->HostLock); | 1083 | spin_lock_init(&hp->HostLock); |
1105 | 1084 | ||
@@ -1110,10 +1089,10 @@ static int __init rio_init(void) | |||
1110 | rio_start_card_running(hp); | 1089 | rio_start_card_running(hp); |
1111 | rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); | 1090 | rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); |
1112 | if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) { | 1091 | if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) { |
1113 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); | 1092 | writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); |
1114 | p->RIOHosts[p->RIONumHosts].UniqueNum = | 1093 | p->RIOHosts[p->RIONumHosts].UniqueNum = |
1115 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | | 1094 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | |
1116 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); | 1095 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); |
1117 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); | 1096 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); |
1118 | 1097 | ||
1119 | p->RIOLastPCISearch = RIO_SUCCESS; | 1098 | p->RIOLastPCISearch = RIO_SUCCESS; |
@@ -1137,8 +1116,8 @@ static int __init rio_init(void) | |||
1137 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | 1116 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); |
1138 | hp->CardP = (struct DpRam *) hp->Caddr; | 1117 | hp->CardP = (struct DpRam *) hp->Caddr; |
1139 | hp->Type = RIO_AT; | 1118 | hp->Type = RIO_AT; |
1140 | hp->Copy = rio_pcicopy; /* AT card PCI???? - PVDL | 1119 | hp->Copy = rio_copy_to_card; /* AT card PCI???? - PVDL |
1141 | * -- YES! this is now a normal copy. Only the | 1120 | * -- YES! this is now a normal copy. Only the |
1142 | * old PCI card uses the special PCI copy. | 1121 | * old PCI card uses the special PCI copy. |
1143 | * Moreover, the ISA card will work with the | 1122 | * Moreover, the ISA card will work with the |
1144 | * special PCI copy anyway. -- REW */ | 1123 | * special PCI copy anyway. -- REW */ |