diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2006-12-08 05:39:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:28:58 -0500 |
commit | 15b611f63f0fb8709a5fae498c2d688b5d05edc9 (patch) | |
tree | 18622ece3ecda7d3c8e19f312af36a28cf2b4c88 /drivers/char/sx.c | |
parent | 55e7071a3c6cdb65fb5ce3ea9c692a8d78ed0844 (diff) |
[PATCH] Char: sx, whitespace cleanup
Use Lindent to cleanup whitespace. Wrap long lines by hand.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/sx.c')
-rw-r--r-- | drivers/char/sx.c | 1822 |
1 files changed, 976 insertions, 846 deletions
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index ca6d51895013..401ebab26018 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -238,7 +238,6 @@ | |||
238 | #include <linux/generic_serial.h> | 238 | #include <linux/generic_serial.h> |
239 | #include "sx.h" | 239 | #include "sx.h" |
240 | 240 | ||
241 | |||
242 | /* I don't think that this driver can handle more than 256 ports on | 241 | /* I don't think that this driver can handle more than 256 ports on |
243 | one machine. You'll have to increase the number of boards in sx.h | 242 | one machine. You'll have to increase the number of boards in sx.h |
244 | if you want more than 4 boards. */ | 243 | if you want more than 4 boards. */ |
@@ -253,7 +252,6 @@ | |||
253 | /* Am I paranoid or not ? ;-) */ | 252 | /* Am I paranoid or not ? ;-) */ |
254 | #undef SX_PARANOIA_CHECK | 253 | #undef SX_PARANOIA_CHECK |
255 | 254 | ||
256 | |||
257 | /* 20 -> 2000 per second. The card should rate-limit interrupts at 100 | 255 | /* 20 -> 2000 per second. The card should rate-limit interrupts at 100 |
258 | Hz, but it is user configurable. I don't recommend going above 1000 | 256 | Hz, but it is user configurable. I don't recommend going above 1000 |
259 | Hz. The interrupt ratelimit might trigger if the interrupt is | 257 | Hz. The interrupt ratelimit might trigger if the interrupt is |
@@ -267,7 +265,6 @@ | |||
267 | interrupt. Use polling. */ | 265 | interrupt. Use polling. */ |
268 | #undef IRQ_RATE_LIMIT | 266 | #undef IRQ_RATE_LIMIT |
269 | 267 | ||
270 | |||
271 | #if 0 | 268 | #if 0 |
272 | /* Not implemented */ | 269 | /* Not implemented */ |
273 | /* | 270 | /* |
@@ -276,26 +273,24 @@ | |||
276 | */ | 273 | */ |
277 | #define SX_REPORT_FIFO | 274 | #define SX_REPORT_FIFO |
278 | #define SX_REPORT_OVERRUN | 275 | #define SX_REPORT_OVERRUN |
279 | #endif | 276 | #endif |
280 | |||
281 | 277 | ||
282 | /* Function prototypes */ | 278 | /* Function prototypes */ |
283 | static void sx_disable_tx_interrupts (void * ptr); | 279 | static void sx_disable_tx_interrupts(void *ptr); |
284 | static void sx_enable_tx_interrupts (void * ptr); | 280 | static void sx_enable_tx_interrupts(void *ptr); |
285 | static void sx_disable_rx_interrupts (void * ptr); | 281 | static void sx_disable_rx_interrupts(void *ptr); |
286 | static void sx_enable_rx_interrupts (void * ptr); | 282 | static void sx_enable_rx_interrupts(void *ptr); |
287 | static int sx_get_CD (void * ptr); | 283 | static int sx_get_CD(void *ptr); |
288 | static void sx_shutdown_port (void * ptr); | 284 | static void sx_shutdown_port(void *ptr); |
289 | static int sx_set_real_termios (void *ptr); | 285 | static int sx_set_real_termios(void *ptr); |
290 | static void sx_close (void *ptr); | 286 | static void sx_close(void *ptr); |
291 | static int sx_chars_in_buffer (void * ptr); | 287 | static int sx_chars_in_buffer(void *ptr); |
292 | static int sx_init_board (struct sx_board *board); | 288 | static int sx_init_board(struct sx_board *board); |
293 | static int sx_init_portstructs (int nboards, int nports); | 289 | static int sx_init_portstructs(int nboards, int nports); |
294 | static int sx_fw_ioctl (struct inode *inode, struct file *filp, | 290 | static int sx_fw_ioctl(struct inode *inode, struct file *filp, |
295 | unsigned int cmd, unsigned long arg); | 291 | unsigned int cmd, unsigned long arg); |
296 | static int sx_init_drivers(void); | 292 | static int sx_init_drivers(void); |
297 | 293 | ||
298 | |||
299 | static struct tty_driver *sx_driver; | 294 | static struct tty_driver *sx_driver; |
300 | 295 | ||
301 | static DEFINE_MUTEX(sx_boards_lock); | 296 | static DEFINE_MUTEX(sx_boards_lock); |
@@ -305,7 +300,6 @@ static int sx_initialized; | |||
305 | static int sx_nports; | 300 | static int sx_nports; |
306 | static int sx_debug; | 301 | static int sx_debug; |
307 | 302 | ||
308 | |||
309 | /* You can have the driver poll your card. | 303 | /* You can have the driver poll your card. |
310 | - Set sx_poll to 1 to poll every timer tick (10ms on Intel). | 304 | - Set sx_poll to 1 to poll every timer tick (10ms on Intel). |
311 | This is used when the card cannot use an interrupt for some reason. | 305 | This is used when the card cannot use an interrupt for some reason. |
@@ -330,11 +324,17 @@ static int sx_maxints = 100; | |||
330 | or less.... -- REW | 324 | or less.... -- REW |
331 | duh: Card at 0xa0000 is possible on HP Netserver?? -- pvdl | 325 | duh: Card at 0xa0000 is possible on HP Netserver?? -- pvdl |
332 | */ | 326 | */ |
333 | static int sx_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000, | 327 | static int sx_probe_addrs[] = { |
334 | 0xc8000, 0xd8000, 0xe8000}; | 328 | 0xc0000, 0xd0000, 0xe0000, |
335 | static int si_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000, | 329 | 0xc8000, 0xd8000, 0xe8000 |
336 | 0xc8000, 0xd8000, 0xe8000, 0xa0000}; | 330 | }; |
337 | static int si1_probe_addrs[]= { 0xd0000}; | 331 | static int si_probe_addrs[] = { |
332 | 0xc0000, 0xd0000, 0xe0000, | ||
333 | 0xc8000, 0xd8000, 0xe8000, 0xa0000 | ||
334 | }; | ||
335 | static int si1_probe_addrs[] = { | ||
336 | 0xd0000 | ||
337 | }; | ||
338 | 338 | ||
339 | #define NR_SX_ADDRS ARRAY_SIZE(sx_probe_addrs) | 339 | #define NR_SX_ADDRS ARRAY_SIZE(sx_probe_addrs) |
340 | #define NR_SI_ADDRS ARRAY_SIZE(si_probe_addrs) | 340 | #define NR_SI_ADDRS ARRAY_SIZE(si_probe_addrs) |
@@ -362,13 +362,12 @@ static struct real_driver sx_real_driver = { | |||
362 | sx_disable_rx_interrupts, | 362 | sx_disable_rx_interrupts, |
363 | sx_enable_rx_interrupts, | 363 | sx_enable_rx_interrupts, |
364 | sx_get_CD, | 364 | sx_get_CD, |
365 | sx_shutdown_port, | 365 | sx_shutdown_port, |
366 | sx_set_real_termios, | 366 | sx_set_real_termios, |
367 | sx_chars_in_buffer, | 367 | sx_chars_in_buffer, |
368 | sx_close, | 368 | sx_close, |
369 | }; | 369 | }; |
370 | 370 | ||
371 | |||
372 | /* | 371 | /* |
373 | This driver can spew a whole lot of debugging output at you. If you | 372 | This driver can spew a whole lot of debugging output at you. If you |
374 | need maximum performance, you should disable the DEBUG define. To | 373 | need maximum performance, you should disable the DEBUG define. To |
@@ -379,23 +378,17 @@ static struct real_driver sx_real_driver = { | |||
379 | */ | 378 | */ |
380 | #define DEBUG | 379 | #define DEBUG |
381 | 380 | ||
382 | |||
383 | #ifdef DEBUG | 381 | #ifdef DEBUG |
384 | #define sx_dprintk(f, str...) if (sx_debug & f) printk (str) | 382 | #define sx_dprintk(f, str...) if (sx_debug & f) printk (str) |
385 | #else | 383 | #else |
386 | #define sx_dprintk(f, str...) /* nothing */ | 384 | #define sx_dprintk(f, str...) /* nothing */ |
387 | #endif | 385 | #endif |
388 | 386 | ||
387 | #define func_enter() sx_dprintk(SX_DEBUG_FLOW, "sx: enter %s\n",__FUNCTION__) | ||
388 | #define func_exit() sx_dprintk(SX_DEBUG_FLOW, "sx: exit %s\n",__FUNCTION__) | ||
389 | 389 | ||
390 | 390 | #define func_enter2() sx_dprintk(SX_DEBUG_FLOW, "sx: enter %s (port %d)\n", \ | |
391 | #define func_enter() sx_dprintk (SX_DEBUG_FLOW, "sx: enter %s\n",__FUNCTION__) | 391 | __FUNCTION__, port->line) |
392 | #define func_exit() sx_dprintk (SX_DEBUG_FLOW, "sx: exit %s\n", __FUNCTION__) | ||
393 | |||
394 | #define func_enter2() sx_dprintk (SX_DEBUG_FLOW, "sx: enter %s (port %d)\n", \ | ||
395 | __FUNCTION__, port->line) | ||
396 | |||
397 | |||
398 | |||
399 | 392 | ||
400 | /* | 393 | /* |
401 | * Firmware loader driver specific routines | 394 | * Firmware loader driver specific routines |
@@ -403,31 +396,26 @@ static struct real_driver sx_real_driver = { | |||
403 | */ | 396 | */ |
404 | 397 | ||
405 | static const struct file_operations sx_fw_fops = { | 398 | static const struct file_operations sx_fw_fops = { |
406 | .owner = THIS_MODULE, | 399 | .owner = THIS_MODULE, |
407 | .ioctl = sx_fw_ioctl, | 400 | .ioctl = sx_fw_ioctl, |
408 | }; | 401 | }; |
409 | 402 | ||
410 | static struct miscdevice sx_fw_device = { | 403 | static struct miscdevice sx_fw_device = { |
411 | SXCTL_MISC_MINOR, "sxctl", &sx_fw_fops | 404 | SXCTL_MISC_MINOR, "sxctl", &sx_fw_fops |
412 | }; | 405 | }; |
413 | 406 | ||
414 | |||
415 | |||
416 | |||
417 | |||
418 | #ifdef SX_PARANOIA_CHECK | 407 | #ifdef SX_PARANOIA_CHECK |
419 | 408 | ||
420 | /* This doesn't work. Who's paranoid around here? Not me! */ | 409 | /* This doesn't work. Who's paranoid around here? Not me! */ |
421 | 410 | ||
422 | static inline int sx_paranoia_check(struct sx_port const * port, | 411 | static inline int sx_paranoia_check(struct sx_port const *port, |
423 | char *name, const char *routine) | 412 | char *name, const char *routine) |
424 | { | 413 | { |
414 | static const char *badmagic = KERN_ERR "sx: Warning: bad sx port magic " | ||
415 | "number for device %s in %s\n"; | ||
416 | static const char *badinfo = KERN_ERR "sx: Warning: null sx port for " | ||
417 | "device %s in %s\n"; | ||
425 | 418 | ||
426 | static const char *badmagic = | ||
427 | KERN_ERR "sx: Warning: bad sx port magic number for device %s in %s\n"; | ||
428 | static const char *badinfo = | ||
429 | KERN_ERR "sx: Warning: null sx port for device %s in %s\n"; | ||
430 | |||
431 | if (!port) { | 419 | if (!port) { |
432 | printk(badinfo, name, routine); | 420 | printk(badinfo, name, routine); |
433 | return 1; | 421 | return 1; |
@@ -450,23 +438,24 @@ static inline int sx_paranoia_check(struct sx_port const * port, | |||
450 | #define TIMEOUT_1 30 | 438 | #define TIMEOUT_1 30 |
451 | #define TIMEOUT_2 1000000 | 439 | #define TIMEOUT_2 1000000 |
452 | 440 | ||
453 | |||
454 | #ifdef DEBUG | 441 | #ifdef DEBUG |
455 | static void my_hd_io(void __iomem *p, int len) | 442 | static void my_hd_io(void __iomem *p, int len) |
456 | { | 443 | { |
457 | int i, j, ch; | 444 | int i, j, ch; |
458 | unsigned char __iomem *addr = p; | 445 | unsigned char __iomem *addr = p; |
459 | 446 | ||
460 | for (i=0;i<len;i+=16) { | 447 | for (i = 0; i < len; i += 16) { |
461 | printk ("%p ", addr+i); | 448 | printk("%p ", addr + i); |
462 | for (j=0;j<16;j++) { | 449 | for (j = 0; j < 16; j++) { |
463 | printk ("%02x %s", readb(addr+j+i), (j==7)?" ":""); | 450 | printk("%02x %s", readb(addr + j + i), |
451 | (j == 7) ? " " : ""); | ||
464 | } | 452 | } |
465 | for (j=0;j<16;j++) { | 453 | for (j = 0; j < 16; j++) { |
466 | ch = readb(addr+j+i); | 454 | ch = readb(addr + j + i); |
467 | printk ("%c", (ch < 0x20)?'.':((ch > 0x7f)?'.':ch)); | 455 | printk("%c", (ch < 0x20) ? '.' : |
456 | ((ch > 0x7f) ? '.' : ch)); | ||
468 | } | 457 | } |
469 | printk ("\n"); | 458 | printk("\n"); |
470 | } | 459 | } |
471 | } | 460 | } |
472 | static void my_hd(void *p, int len) | 461 | static void my_hd(void *p, int len) |
@@ -474,419 +463,468 @@ static void my_hd(void *p, int len) | |||
474 | int i, j, ch; | 463 | int i, j, ch; |
475 | unsigned char *addr = p; | 464 | unsigned char *addr = p; |
476 | 465 | ||
477 | for (i=0;i<len;i+=16) { | 466 | for (i = 0; i < len; i += 16) { |
478 | printk ("%p ", addr+i); | 467 | printk("%p ", addr + i); |
479 | for (j=0;j<16;j++) { | 468 | for (j = 0; j < 16; j++) { |
480 | printk ("%02x %s", addr[j+i], (j==7)?" ":""); | 469 | printk("%02x %s", addr[j + i], (j == 7) ? " " : ""); |
481 | } | 470 | } |
482 | for (j=0;j<16;j++) { | 471 | for (j = 0; j < 16; j++) { |
483 | ch = addr[j+i]; | 472 | ch = addr[j + i]; |
484 | printk ("%c", (ch < 0x20)?'.':((ch > 0x7f)?'.':ch)); | 473 | printk("%c", (ch < 0x20) ? '.' : |
474 | ((ch > 0x7f) ? '.' : ch)); | ||
485 | } | 475 | } |
486 | printk ("\n"); | 476 | printk("\n"); |
487 | } | 477 | } |
488 | } | 478 | } |
489 | #endif | 479 | #endif |
490 | 480 | ||
491 | |||
492 | |||
493 | /* This needs redoing for Alpha -- REW -- Done. */ | 481 | /* This needs redoing for Alpha -- REW -- Done. */ |
494 | 482 | ||
495 | static inline void write_sx_byte (struct sx_board *board, int offset, u8 byte) | 483 | static inline void write_sx_byte(struct sx_board *board, int offset, u8 byte) |
496 | { | 484 | { |
497 | writeb (byte, board->base+offset); | 485 | writeb(byte, board->base + offset); |
498 | } | 486 | } |
499 | 487 | ||
500 | static inline u8 read_sx_byte (struct sx_board *board, int offset) | 488 | static inline u8 read_sx_byte(struct sx_board *board, int offset) |
501 | { | 489 | { |
502 | return readb (board->base+offset); | 490 | return readb(board->base + offset); |
503 | } | 491 | } |
504 | 492 | ||
505 | 493 | static inline void write_sx_word(struct sx_board *board, int offset, u16 word) | |
506 | static inline void write_sx_word (struct sx_board *board, int offset, u16 word) | ||
507 | { | 494 | { |
508 | writew (word, board->base+offset); | 495 | writew(word, board->base + offset); |
509 | } | 496 | } |
510 | 497 | ||
511 | static inline u16 read_sx_word (struct sx_board *board, int offset) | 498 | static inline u16 read_sx_word(struct sx_board *board, int offset) |
512 | { | 499 | { |
513 | return readw (board->base + offset); | 500 | return readw(board->base + offset); |
514 | } | 501 | } |
515 | 502 | ||
516 | 503 | static int sx_busy_wait_eq(struct sx_board *board, | |
517 | static int sx_busy_wait_eq (struct sx_board *board, | 504 | int offset, int mask, int correctval) |
518 | int offset, int mask, int correctval) | ||
519 | { | 505 | { |
520 | int i; | 506 | int i; |
521 | 507 | ||
522 | func_enter (); | 508 | func_enter(); |
523 | 509 | ||
524 | for (i=0; i < TIMEOUT_1 ;i++) | 510 | for (i = 0; i < TIMEOUT_1; i++) |
525 | if ((read_sx_byte (board, offset) & mask) == correctval) { | 511 | if ((read_sx_byte(board, offset) & mask) == correctval) { |
526 | func_exit (); | 512 | func_exit(); |
527 | return 1; | 513 | return 1; |
528 | } | 514 | } |
529 | 515 | ||
530 | for (i=0; i < TIMEOUT_2 ;i++) { | 516 | for (i = 0; i < TIMEOUT_2; i++) { |
531 | if ((read_sx_byte (board, offset) & mask) == correctval) { | 517 | if ((read_sx_byte(board, offset) & mask) == correctval) { |
532 | func_exit (); | 518 | func_exit(); |
533 | return 1; | 519 | return 1; |
534 | } | 520 | } |
535 | udelay (1); | 521 | udelay(1); |
536 | } | 522 | } |
537 | 523 | ||
538 | func_exit (); | 524 | func_exit(); |
539 | return 0; | 525 | return 0; |
540 | } | 526 | } |
541 | 527 | ||
542 | 528 | static int sx_busy_wait_neq(struct sx_board *board, | |
543 | static int sx_busy_wait_neq (struct sx_board *board, | 529 | int offset, int mask, int badval) |
544 | int offset, int mask, int badval) | ||
545 | { | 530 | { |
546 | int i; | 531 | int i; |
547 | 532 | ||
548 | func_enter (); | 533 | func_enter(); |
549 | 534 | ||
550 | for (i=0; i < TIMEOUT_1 ;i++) | 535 | for (i = 0; i < TIMEOUT_1; i++) |
551 | if ((read_sx_byte (board, offset) & mask) != badval) { | 536 | if ((read_sx_byte(board, offset) & mask) != badval) { |
552 | func_exit (); | 537 | func_exit(); |
553 | return 1; | 538 | return 1; |
554 | } | 539 | } |
555 | 540 | ||
556 | for (i=0; i < TIMEOUT_2 ;i++) { | 541 | for (i = 0; i < TIMEOUT_2; i++) { |
557 | if ((read_sx_byte (board, offset) & mask) != badval) { | 542 | if ((read_sx_byte(board, offset) & mask) != badval) { |
558 | func_exit (); | 543 | func_exit(); |
559 | return 1; | 544 | return 1; |
560 | } | 545 | } |
561 | udelay (1); | 546 | udelay(1); |
562 | } | 547 | } |
563 | 548 | ||
564 | func_exit (); | 549 | func_exit(); |
565 | return 0; | 550 | return 0; |
566 | } | 551 | } |
567 | 552 | ||
568 | |||
569 | |||
570 | /* 5.6.4 of 6210028 r2.3 */ | 553 | /* 5.6.4 of 6210028 r2.3 */ |
571 | static int sx_reset (struct sx_board *board) | 554 | static int sx_reset(struct sx_board *board) |
572 | { | 555 | { |
573 | func_enter (); | 556 | func_enter(); |
574 | 557 | ||
575 | if (IS_SX_BOARD (board)) { | 558 | if (IS_SX_BOARD(board)) { |
576 | 559 | ||
577 | write_sx_byte (board, SX_CONFIG, 0); | 560 | write_sx_byte(board, SX_CONFIG, 0); |
578 | write_sx_byte (board, SX_RESET, 1); /* Value doesn't matter */ | 561 | write_sx_byte(board, SX_RESET, 1); /* Value doesn't matter */ |
579 | 562 | ||
580 | if (!sx_busy_wait_eq (board, SX_RESET_STATUS, 1, 0)) { | 563 | if (!sx_busy_wait_eq(board, SX_RESET_STATUS, 1, 0)) { |
581 | printk (KERN_INFO "sx: Card doesn't respond to reset....\n"); | 564 | printk(KERN_INFO "sx: Card doesn't respond to " |
565 | "reset...\n"); | ||
582 | return 0; | 566 | return 0; |
583 | } | 567 | } |
584 | } else if (IS_EISA_BOARD(board)) { | 568 | } else if (IS_EISA_BOARD(board)) { |
585 | outb(board->irq<<4, board->eisa_base+0xc02); | 569 | outb(board->irq << 4, board->eisa_base + 0xc02); |
586 | } else if (IS_SI1_BOARD(board)) { | 570 | } else if (IS_SI1_BOARD(board)) { |
587 | write_sx_byte (board, SI1_ISA_RESET, 0); // value does not matter | 571 | write_sx_byte(board, SI1_ISA_RESET, 0); /*value doesn't matter*/ |
588 | } else { | 572 | } else { |
589 | /* Gory details of the SI/ISA board */ | 573 | /* Gory details of the SI/ISA board */ |
590 | write_sx_byte (board, SI2_ISA_RESET, SI2_ISA_RESET_SET); | 574 | write_sx_byte(board, SI2_ISA_RESET, SI2_ISA_RESET_SET); |
591 | write_sx_byte (board, SI2_ISA_IRQ11, SI2_ISA_IRQ11_CLEAR); | 575 | write_sx_byte(board, SI2_ISA_IRQ11, SI2_ISA_IRQ11_CLEAR); |
592 | write_sx_byte (board, SI2_ISA_IRQ12, SI2_ISA_IRQ12_CLEAR); | 576 | write_sx_byte(board, SI2_ISA_IRQ12, SI2_ISA_IRQ12_CLEAR); |
593 | write_sx_byte (board, SI2_ISA_IRQ15, SI2_ISA_IRQ15_CLEAR); | 577 | write_sx_byte(board, SI2_ISA_IRQ15, SI2_ISA_IRQ15_CLEAR); |
594 | write_sx_byte (board, SI2_ISA_INTCLEAR, SI2_ISA_INTCLEAR_CLEAR); | 578 | write_sx_byte(board, SI2_ISA_INTCLEAR, SI2_ISA_INTCLEAR_CLEAR); |
595 | write_sx_byte (board, SI2_ISA_IRQSET, SI2_ISA_IRQSET_CLEAR); | 579 | write_sx_byte(board, SI2_ISA_IRQSET, SI2_ISA_IRQSET_CLEAR); |
596 | } | 580 | } |
597 | 581 | ||
598 | func_exit (); | 582 | func_exit(); |
599 | return 1; | 583 | return 1; |
600 | } | 584 | } |
601 | 585 | ||
602 | |||
603 | /* This doesn't work on machines where "NULL" isn't 0 */ | 586 | /* This doesn't work on machines where "NULL" isn't 0 */ |
604 | /* If you have one of those, someone will need to write | 587 | /* If you have one of those, someone will need to write |
605 | the equivalent of this, which will amount to about 3 lines. I don't | 588 | the equivalent of this, which will amount to about 3 lines. I don't |
606 | want to complicate this right now. -- REW | 589 | want to complicate this right now. -- REW |
607 | (See, I do write comments every now and then :-) */ | 590 | (See, I do write comments every now and then :-) */ |
608 | #define OFFSETOF(strct, elem) ((long)&(((struct strct *)NULL)->elem)) | 591 | #define OFFSETOF(strct, elem) ((long)&(((struct strct *)NULL)->elem)) |
609 | |||
610 | |||
611 | #define CHAN_OFFSET(port,elem) (port->ch_base + OFFSETOF (_SXCHANNEL, elem)) | ||
612 | #define MODU_OFFSET(board,addr,elem) (addr + OFFSETOF (_SXMODULE, elem)) | ||
613 | #define BRD_OFFSET(board,elem) (OFFSETOF (_SXCARD, elem)) | ||
614 | 592 | ||
593 | #define CHAN_OFFSET(port,elem) (port->ch_base + OFFSETOF (_SXCHANNEL, elem)) | ||
594 | #define MODU_OFFSET(board,addr,elem) (addr + OFFSETOF (_SXMODULE, elem)) | ||
595 | #define BRD_OFFSET(board,elem) (OFFSETOF (_SXCARD, elem)) | ||
615 | 596 | ||
616 | #define sx_write_channel_byte(port, elem, val) \ | 597 | #define sx_write_channel_byte(port, elem, val) \ |
617 | write_sx_byte (port->board, CHAN_OFFSET (port, elem), val) | 598 | write_sx_byte (port->board, CHAN_OFFSET (port, elem), val) |
618 | 599 | ||
619 | #define sx_read_channel_byte(port, elem) \ | 600 | #define sx_read_channel_byte(port, elem) \ |
620 | read_sx_byte (port->board, CHAN_OFFSET (port, elem)) | 601 | read_sx_byte (port->board, CHAN_OFFSET (port, elem)) |
621 | 602 | ||
622 | #define sx_write_channel_word(port, elem, val) \ | 603 | #define sx_write_channel_word(port, elem, val) \ |
623 | write_sx_word (port->board, CHAN_OFFSET (port, elem), val) | 604 | write_sx_word (port->board, CHAN_OFFSET (port, elem), val) |
624 | 605 | ||
625 | #define sx_read_channel_word(port, elem) \ | 606 | #define sx_read_channel_word(port, elem) \ |
626 | read_sx_word (port->board, CHAN_OFFSET (port, elem)) | 607 | read_sx_word (port->board, CHAN_OFFSET (port, elem)) |
627 | |||
628 | 608 | ||
629 | #define sx_write_module_byte(board, addr, elem, val) \ | 609 | #define sx_write_module_byte(board, addr, elem, val) \ |
630 | write_sx_byte (board, MODU_OFFSET (board, addr, elem), val) | 610 | write_sx_byte (board, MODU_OFFSET (board, addr, elem), val) |
631 | 611 | ||
632 | #define sx_read_module_byte(board, addr, elem) \ | 612 | #define sx_read_module_byte(board, addr, elem) \ |
633 | read_sx_byte (board, MODU_OFFSET (board, addr, elem)) | 613 | read_sx_byte (board, MODU_OFFSET (board, addr, elem)) |
634 | 614 | ||
635 | #define sx_write_module_word(board, addr, elem, val) \ | 615 | #define sx_write_module_word(board, addr, elem, val) \ |
636 | write_sx_word (board, MODU_OFFSET (board, addr, elem), val) | 616 | write_sx_word (board, MODU_OFFSET (board, addr, elem), val) |
637 | 617 | ||
638 | #define sx_read_module_word(board, addr, elem) \ | 618 | #define sx_read_module_word(board, addr, elem) \ |
639 | read_sx_word (board, MODU_OFFSET (board, addr, elem)) | 619 | read_sx_word (board, MODU_OFFSET (board, addr, elem)) |
640 | |||
641 | 620 | ||
642 | #define sx_write_board_byte(board, elem, val) \ | 621 | #define sx_write_board_byte(board, elem, val) \ |
643 | write_sx_byte (board, BRD_OFFSET (board, elem), val) | 622 | write_sx_byte (board, BRD_OFFSET (board, elem), val) |
644 | 623 | ||
645 | #define sx_read_board_byte(board, elem) \ | 624 | #define sx_read_board_byte(board, elem) \ |
646 | read_sx_byte (board, BRD_OFFSET (board, elem)) | 625 | read_sx_byte (board, BRD_OFFSET (board, elem)) |
647 | 626 | ||
648 | #define sx_write_board_word(board, elem, val) \ | 627 | #define sx_write_board_word(board, elem, val) \ |
649 | write_sx_word (board, BRD_OFFSET (board, elem), val) | 628 | write_sx_word (board, BRD_OFFSET (board, elem), val) |
650 | 629 | ||
651 | #define sx_read_board_word(board, elem) \ | 630 | #define sx_read_board_word(board, elem) \ |
652 | read_sx_word (board, BRD_OFFSET (board, elem)) | 631 | read_sx_word (board, BRD_OFFSET (board, elem)) |
653 | |||
654 | 632 | ||
655 | static int sx_start_board (struct sx_board *board) | 633 | static int sx_start_board(struct sx_board *board) |
656 | { | 634 | { |
657 | if (IS_SX_BOARD (board)) { | 635 | if (IS_SX_BOARD(board)) { |
658 | write_sx_byte (board, SX_CONFIG, SX_CONF_BUSEN); | 636 | write_sx_byte(board, SX_CONFIG, SX_CONF_BUSEN); |
659 | } else if (IS_EISA_BOARD(board)) { | 637 | } else if (IS_EISA_BOARD(board)) { |
660 | write_sx_byte(board, SI2_EISA_OFF, SI2_EISA_VAL); | 638 | write_sx_byte(board, SI2_EISA_OFF, SI2_EISA_VAL); |
661 | outb((board->irq<<4)|4, board->eisa_base+0xc02); | 639 | outb((board->irq << 4) | 4, board->eisa_base + 0xc02); |
662 | } else if (IS_SI1_BOARD(board)) { | 640 | } else if (IS_SI1_BOARD(board)) { |
663 | write_sx_byte (board, SI1_ISA_RESET_CLEAR, 0); | 641 | write_sx_byte(board, SI1_ISA_RESET_CLEAR, 0); |
664 | write_sx_byte (board, SI1_ISA_INTCL, 0); | 642 | write_sx_byte(board, SI1_ISA_INTCL, 0); |
665 | } else { | 643 | } else { |
666 | /* Don't bug me about the clear_set. | 644 | /* Don't bug me about the clear_set. |
667 | I haven't the foggiest idea what it's about -- REW */ | 645 | I haven't the foggiest idea what it's about -- REW */ |
668 | write_sx_byte (board, SI2_ISA_RESET, SI2_ISA_RESET_CLEAR); | 646 | write_sx_byte(board, SI2_ISA_RESET, SI2_ISA_RESET_CLEAR); |
669 | write_sx_byte (board, SI2_ISA_INTCLEAR, SI2_ISA_INTCLEAR_SET); | 647 | write_sx_byte(board, SI2_ISA_INTCLEAR, SI2_ISA_INTCLEAR_SET); |
670 | } | 648 | } |
671 | return 1; | 649 | return 1; |
672 | } | 650 | } |
673 | 651 | ||
674 | #define SX_IRQ_REG_VAL(board) \ | 652 | #define SX_IRQ_REG_VAL(board) \ |
675 | ((board->flags & SX_ISA_BOARD)?(board->irq << 4):0) | 653 | ((board->flags & SX_ISA_BOARD) ? (board->irq << 4) : 0) |
676 | 654 | ||
677 | /* Note. The SX register is write-only. Therefore, we have to enable the | 655 | /* Note. The SX register is write-only. Therefore, we have to enable the |
678 | bus too. This is a no-op, if you don't mess with this driver... */ | 656 | bus too. This is a no-op, if you don't mess with this driver... */ |
679 | static int sx_start_interrupts (struct sx_board *board) | 657 | static int sx_start_interrupts(struct sx_board *board) |
680 | { | 658 | { |
681 | 659 | ||
682 | /* Don't call this with board->irq == 0 */ | 660 | /* Don't call this with board->irq == 0 */ |
683 | 661 | ||
684 | if (IS_SX_BOARD(board)) { | 662 | if (IS_SX_BOARD(board)) { |
685 | write_sx_byte (board, SX_CONFIG, SX_IRQ_REG_VAL (board) | | 663 | write_sx_byte(board, SX_CONFIG, SX_IRQ_REG_VAL(board) | |
686 | SX_CONF_BUSEN | | 664 | SX_CONF_BUSEN | SX_CONF_HOSTIRQ); |
687 | SX_CONF_HOSTIRQ); | ||
688 | } else if (IS_EISA_BOARD(board)) { | 665 | } else if (IS_EISA_BOARD(board)) { |
689 | inb(board->eisa_base+0xc03); | 666 | inb(board->eisa_base + 0xc03); |
690 | } else if (IS_SI1_BOARD(board)) { | 667 | } else if (IS_SI1_BOARD(board)) { |
691 | write_sx_byte (board, SI1_ISA_INTCL,0); | 668 | write_sx_byte(board, SI1_ISA_INTCL, 0); |
692 | write_sx_byte (board, SI1_ISA_INTCL_CLEAR,0); | 669 | write_sx_byte(board, SI1_ISA_INTCL_CLEAR, 0); |
693 | } else { | 670 | } else { |
694 | switch (board->irq) { | 671 | switch (board->irq) { |
695 | case 11:write_sx_byte (board, SI2_ISA_IRQ11, SI2_ISA_IRQ11_SET);break; | 672 | case 11: |
696 | case 12:write_sx_byte (board, SI2_ISA_IRQ12, SI2_ISA_IRQ12_SET);break; | 673 | write_sx_byte(board, SI2_ISA_IRQ11, SI2_ISA_IRQ11_SET); |
697 | case 15:write_sx_byte (board, SI2_ISA_IRQ15, SI2_ISA_IRQ15_SET);break; | 674 | break; |
698 | default:printk (KERN_INFO "sx: SI/XIO card doesn't support interrupt %d.\n", | 675 | case 12: |
699 | board->irq); | 676 | write_sx_byte(board, SI2_ISA_IRQ12, SI2_ISA_IRQ12_SET); |
700 | return 0; | 677 | break; |
678 | case 15: | ||
679 | write_sx_byte(board, SI2_ISA_IRQ15, SI2_ISA_IRQ15_SET); | ||
680 | break; | ||
681 | default: | ||
682 | printk(KERN_INFO "sx: SI/XIO card doesn't support " | ||
683 | "interrupt %d.\n", board->irq); | ||
684 | return 0; | ||
701 | } | 685 | } |
702 | write_sx_byte (board, SI2_ISA_INTCLEAR, SI2_ISA_INTCLEAR_SET); | 686 | write_sx_byte(board, SI2_ISA_INTCLEAR, SI2_ISA_INTCLEAR_SET); |
703 | } | 687 | } |
704 | 688 | ||
705 | return 1; | 689 | return 1; |
706 | } | 690 | } |
707 | 691 | ||
708 | 692 | static int sx_send_command(struct sx_port *port, | |
709 | static int sx_send_command (struct sx_port *port, | 693 | int command, int mask, int newstat) |
710 | int command, int mask, int newstat) | ||
711 | { | 694 | { |
712 | func_enter2 (); | 695 | func_enter2(); |
713 | write_sx_byte (port->board, CHAN_OFFSET (port, hi_hstat), command); | 696 | write_sx_byte(port->board, CHAN_OFFSET(port, hi_hstat), command); |
714 | func_exit (); | 697 | func_exit(); |
715 | return sx_busy_wait_eq (port->board, CHAN_OFFSET (port, hi_hstat), mask, newstat); | 698 | return sx_busy_wait_eq(port->board, CHAN_OFFSET(port, hi_hstat), mask, |
699 | newstat); | ||
716 | } | 700 | } |
717 | 701 | ||
718 | 702 | static char *mod_type_s(int module_type) | |
719 | static char *mod_type_s (int module_type) | ||
720 | { | 703 | { |
721 | switch (module_type) { | 704 | switch (module_type) { |
722 | case TA4: return "TA4"; | 705 | case TA4: |
723 | case TA8: return "TA8"; | 706 | return "TA4"; |
724 | case TA4_ASIC: return "TA4_ASIC"; | 707 | case TA8: |
725 | case TA8_ASIC: return "TA8_ASIC"; | 708 | return "TA8"; |
726 | case MTA_CD1400:return "MTA_CD1400"; | 709 | case TA4_ASIC: |
727 | case SXDC: return "SXDC"; | 710 | return "TA4_ASIC"; |
728 | default:return "Unknown/invalid"; | 711 | case TA8_ASIC: |
712 | return "TA8_ASIC"; | ||
713 | case MTA_CD1400: | ||
714 | return "MTA_CD1400"; | ||
715 | case SXDC: | ||
716 | return "SXDC"; | ||
717 | default: | ||
718 | return "Unknown/invalid"; | ||
729 | } | 719 | } |
730 | } | 720 | } |
731 | 721 | ||
732 | 722 | static char *pan_type_s(int pan_type) | |
733 | static char *pan_type_s (int pan_type) | ||
734 | { | 723 | { |
735 | switch (pan_type) { | 724 | switch (pan_type) { |
736 | case MOD_RS232DB25: return "MOD_RS232DB25"; | 725 | case MOD_RS232DB25: |
737 | case MOD_RS232RJ45: return "MOD_RS232RJ45"; | 726 | return "MOD_RS232DB25"; |
738 | case MOD_RS422DB25: return "MOD_RS422DB25"; | 727 | case MOD_RS232RJ45: |
739 | case MOD_PARALLEL: return "MOD_PARALLEL"; | 728 | return "MOD_RS232RJ45"; |
740 | case MOD_2_RS232DB25: return "MOD_2_RS232DB25"; | 729 | case MOD_RS422DB25: |
741 | case MOD_2_RS232RJ45: return "MOD_2_RS232RJ45"; | 730 | return "MOD_RS422DB25"; |
742 | case MOD_2_RS422DB25: return "MOD_2_RS422DB25"; | 731 | case MOD_PARALLEL: |
743 | case MOD_RS232DB25MALE: return "MOD_RS232DB25MALE"; | 732 | return "MOD_PARALLEL"; |
744 | case MOD_2_PARALLEL: return "MOD_2_PARALLEL"; | 733 | case MOD_2_RS232DB25: |
745 | case MOD_BLANK: return "empty"; | 734 | return "MOD_2_RS232DB25"; |
746 | default:return "invalid"; | 735 | case MOD_2_RS232RJ45: |
736 | return "MOD_2_RS232RJ45"; | ||
737 | case MOD_2_RS422DB25: | ||
738 | return "MOD_2_RS422DB25"; | ||
739 | case MOD_RS232DB25MALE: | ||
740 | return "MOD_RS232DB25MALE"; | ||
741 | case MOD_2_PARALLEL: | ||
742 | return "MOD_2_PARALLEL"; | ||
743 | case MOD_BLANK: | ||
744 | return "empty"; | ||
745 | default: | ||
746 | return "invalid"; | ||
747 | } | 747 | } |
748 | } | 748 | } |
749 | 749 | ||
750 | 750 | static int mod_compat_type(int module_type) | |
751 | static int mod_compat_type (int module_type) | ||
752 | { | 751 | { |
753 | return module_type >> 4; | 752 | return module_type >> 4; |
754 | } | 753 | } |
755 | 754 | ||
756 | static void sx_reconfigure_port(struct sx_port *port) | 755 | static void sx_reconfigure_port(struct sx_port *port) |
757 | { | 756 | { |
758 | if (sx_read_channel_byte (port, hi_hstat) == HS_IDLE_OPEN) { | 757 | if (sx_read_channel_byte(port, hi_hstat) == HS_IDLE_OPEN) { |
759 | if (sx_send_command (port, HS_CONFIG, -1, HS_IDLE_OPEN) != 1) { | 758 | if (sx_send_command(port, HS_CONFIG, -1, HS_IDLE_OPEN) != 1) { |
760 | printk (KERN_WARNING "sx: Sent reconfigure command, but card didn't react.\n"); | 759 | printk(KERN_WARNING "sx: Sent reconfigure command, but " |
760 | "card didn't react.\n"); | ||
761 | } | 761 | } |
762 | } else { | 762 | } else { |
763 | sx_dprintk (SX_DEBUG_TERMIOS, | 763 | sx_dprintk(SX_DEBUG_TERMIOS, "sx: Not sending reconfigure: " |
764 | "sx: Not sending reconfigure: port isn't open (%02x).\n", | 764 | "port isn't open (%02x).\n", |
765 | sx_read_channel_byte (port, hi_hstat)); | 765 | sx_read_channel_byte(port, hi_hstat)); |
766 | } | 766 | } |
767 | } | 767 | } |
768 | 768 | ||
769 | static void sx_setsignals (struct sx_port *port, int dtr, int rts) | 769 | static void sx_setsignals(struct sx_port *port, int dtr, int rts) |
770 | { | 770 | { |
771 | int t; | 771 | int t; |
772 | func_enter2 (); | 772 | func_enter2(); |
773 | 773 | ||
774 | t = sx_read_channel_byte (port, hi_op); | 774 | t = sx_read_channel_byte(port, hi_op); |
775 | if (dtr >= 0) t = dtr? (t | OP_DTR): (t & ~OP_DTR); | 775 | if (dtr >= 0) |
776 | if (rts >= 0) t = rts? (t | OP_RTS): (t & ~OP_RTS); | 776 | t = dtr ? (t | OP_DTR) : (t & ~OP_DTR); |
777 | sx_write_channel_byte (port, hi_op, t); | 777 | if (rts >= 0) |
778 | sx_dprintk (SX_DEBUG_MODEMSIGNALS, "setsignals: %d/%d\n", dtr, rts); | 778 | t = rts ? (t | OP_RTS) : (t & ~OP_RTS); |
779 | sx_write_channel_byte(port, hi_op, t); | ||
780 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "setsignals: %d/%d\n", dtr, rts); | ||
779 | 781 | ||
780 | func_exit (); | 782 | func_exit(); |
781 | } | 783 | } |
782 | 784 | ||
783 | 785 | static int sx_getsignals(struct sx_port *port) | |
784 | |||
785 | static int sx_getsignals (struct sx_port *port) | ||
786 | { | 786 | { |
787 | int i_stat,o_stat; | 787 | int i_stat, o_stat; |
788 | 788 | ||
789 | o_stat = sx_read_channel_byte (port, hi_op); | 789 | o_stat = sx_read_channel_byte(port, hi_op); |
790 | i_stat = sx_read_channel_byte (port, hi_ip); | 790 | i_stat = sx_read_channel_byte(port, hi_ip); |
791 | 791 | ||
792 | sx_dprintk (SX_DEBUG_MODEMSIGNALS, "getsignals: %d/%d (%d/%d) %02x/%02x\n", | 792 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "getsignals: %d/%d (%d/%d) " |
793 | (o_stat & OP_DTR) != 0, (o_stat & OP_RTS) != 0, | 793 | "%02x/%02x\n", |
794 | port->c_dcd, sx_get_CD (port), | 794 | (o_stat & OP_DTR) != 0, (o_stat & OP_RTS) != 0, |
795 | sx_read_channel_byte (port, hi_ip), | 795 | port->c_dcd, sx_get_CD(port), |
796 | sx_read_channel_byte (port, hi_state)); | 796 | sx_read_channel_byte(port, hi_ip), |
797 | 797 | sx_read_channel_byte(port, hi_state)); | |
798 | return (((o_stat & OP_DTR)?TIOCM_DTR:0) | | 798 | |
799 | ((o_stat & OP_RTS)?TIOCM_RTS:0) | | 799 | return (((o_stat & OP_DTR) ? TIOCM_DTR : 0) | |
800 | ((i_stat & IP_CTS)?TIOCM_CTS:0) | | 800 | ((o_stat & OP_RTS) ? TIOCM_RTS : 0) | |
801 | ((i_stat & IP_DCD)?TIOCM_CAR:0) | | 801 | ((i_stat & IP_CTS) ? TIOCM_CTS : 0) | |
802 | ((i_stat & IP_DSR)?TIOCM_DSR:0) | | 802 | ((i_stat & IP_DCD) ? TIOCM_CAR : 0) | |
803 | ((i_stat & IP_RI)?TIOCM_RNG:0) | 803 | ((i_stat & IP_DSR) ? TIOCM_DSR : 0) | |
804 | ); | 804 | ((i_stat & IP_RI) ? TIOCM_RNG : 0)); |
805 | } | 805 | } |
806 | 806 | ||
807 | 807 | static void sx_set_baud(struct sx_port *port) | |
808 | static void sx_set_baud (struct sx_port *port) | ||
809 | { | 808 | { |
810 | int t; | 809 | int t; |
811 | 810 | ||
812 | if (port->board->ta_type == MOD_SXDC) { | 811 | if (port->board->ta_type == MOD_SXDC) { |
813 | switch (port->gs.baud) { | 812 | switch (port->gs.baud) { |
814 | /* Save some typing work... */ | 813 | /* Save some typing work... */ |
815 | #define e(x) case x:t= BAUD_ ## x ; break | 814 | #define e(x) case x: t = BAUD_ ## x; break |
816 | e(50);e(75);e(110);e(150);e(200);e(300);e(600); | 815 | e(50); |
817 | e(1200);e(1800);e(2000);e(2400);e(4800);e(7200); | 816 | e(75); |
818 | e(9600);e(14400);e(19200);e(28800);e(38400); | 817 | e(110); |
819 | e(56000);e(57600);e(64000);e(76800);e(115200); | 818 | e(150); |
820 | e(128000);e(150000);e(230400);e(256000);e(460800); | 819 | e(200); |
821 | e(921600); | 820 | e(300); |
822 | case 134 :t = BAUD_134_5; break; | 821 | e(600); |
823 | case 0 :t = -1; | 822 | e(1200); |
824 | break; | 823 | e(1800); |
824 | e(2000); | ||
825 | e(2400); | ||
826 | e(4800); | ||
827 | e(7200); | ||
828 | e(9600); | ||
829 | e(14400); | ||
830 | e(19200); | ||
831 | e(28800); | ||
832 | e(38400); | ||
833 | e(56000); | ||
834 | e(57600); | ||
835 | e(64000); | ||
836 | e(76800); | ||
837 | e(115200); | ||
838 | e(128000); | ||
839 | e(150000); | ||
840 | e(230400); | ||
841 | e(256000); | ||
842 | e(460800); | ||
843 | e(921600); | ||
844 | case 134: | ||
845 | t = BAUD_134_5; | ||
846 | break; | ||
847 | case 0: | ||
848 | t = -1; | ||
849 | break; | ||
825 | default: | 850 | default: |
826 | /* Can I return "invalid"? */ | 851 | /* Can I return "invalid"? */ |
827 | t = BAUD_9600; | 852 | t = BAUD_9600; |
828 | printk (KERN_INFO "sx: unsupported baud rate: %d.\n", port->gs.baud); | 853 | printk(KERN_INFO "sx: unsupported baud rate: %d.\n", |
854 | port->gs.baud); | ||
829 | break; | 855 | break; |
830 | } | 856 | } |
831 | #undef e | 857 | #undef e |
832 | if (t > 0) { | 858 | if (t > 0) { |
833 | /* The baud rate is not set to 0, so we're enabeling DTR... -- REW */ | 859 | /* The baud rate is not set to 0, so we're enabeling DTR... -- REW */ |
834 | sx_setsignals (port, 1, -1); | 860 | sx_setsignals(port, 1, -1); |
835 | /* XXX This is not TA & MTA compatible */ | 861 | /* XXX This is not TA & MTA compatible */ |
836 | sx_write_channel_byte (port, hi_csr, 0xff); | 862 | sx_write_channel_byte(port, hi_csr, 0xff); |
837 | 863 | ||
838 | sx_write_channel_byte (port, hi_txbaud, t); | 864 | sx_write_channel_byte(port, hi_txbaud, t); |
839 | sx_write_channel_byte (port, hi_rxbaud, t); | 865 | sx_write_channel_byte(port, hi_rxbaud, t); |
840 | } else { | 866 | } else { |
841 | sx_setsignals (port, 0, -1); | 867 | sx_setsignals(port, 0, -1); |
842 | } | 868 | } |
843 | } else { | 869 | } else { |
844 | switch (port->gs.baud) { | 870 | switch (port->gs.baud) { |
845 | #define e(x) case x:t= CSR_ ## x ; break | 871 | #define e(x) case x: t = CSR_ ## x; break |
846 | e(75);e(150);e(300);e(600);e(1200);e(2400);e(4800); | 872 | e(75); |
847 | e(1800);e(9600); | 873 | e(150); |
848 | e(19200);e(57600);e(38400); | 874 | e(300); |
849 | /* TA supports 110, but not 115200, MTA supports 115200, but not 110 */ | 875 | e(600); |
850 | case 110: | 876 | e(1200); |
877 | e(2400); | ||
878 | e(4800); | ||
879 | e(1800); | ||
880 | e(9600); | ||
881 | e(19200); | ||
882 | e(57600); | ||
883 | e(38400); | ||
884 | /* TA supports 110, but not 115200, MTA supports 115200, but not 110 */ | ||
885 | case 110: | ||
851 | if (port->board->ta_type == MOD_TA) { | 886 | if (port->board->ta_type == MOD_TA) { |
852 | t = CSR_110; | 887 | t = CSR_110; |
853 | break; | 888 | break; |
854 | } else { | 889 | } else { |
855 | t = CSR_9600; | 890 | t = CSR_9600; |
856 | printk (KERN_INFO "sx: Unsupported baud rate: %d.\n", port->gs.baud); | 891 | printk(KERN_INFO "sx: Unsupported baud rate: " |
892 | "%d.\n", port->gs.baud); | ||
857 | break; | 893 | break; |
858 | } | 894 | } |
859 | case 115200: | 895 | case 115200: |
860 | if (port->board->ta_type == MOD_TA) { | 896 | if (port->board->ta_type == MOD_TA) { |
861 | t = CSR_9600; | 897 | t = CSR_9600; |
862 | printk (KERN_INFO "sx: Unsupported baud rate: %d.\n", port->gs.baud); | 898 | printk(KERN_INFO "sx: Unsupported baud rate: " |
899 | "%d.\n", port->gs.baud); | ||
863 | break; | 900 | break; |
864 | } else { | 901 | } else { |
865 | t = CSR_110; | 902 | t = CSR_110; |
866 | break; | 903 | break; |
867 | } | 904 | } |
868 | case 0 :t = -1; | 905 | case 0: |
869 | break; | 906 | t = -1; |
907 | break; | ||
870 | default: | 908 | default: |
871 | t = CSR_9600; | 909 | t = CSR_9600; |
872 | printk (KERN_INFO "sx: Unsupported baud rate: %d.\n", port->gs.baud); | 910 | printk(KERN_INFO "sx: Unsupported baud rate: %d.\n", |
911 | port->gs.baud); | ||
873 | break; | 912 | break; |
874 | } | 913 | } |
875 | #undef e | 914 | #undef e |
876 | if (t >= 0) { | 915 | if (t >= 0) { |
877 | sx_setsignals (port, 1, -1); | 916 | sx_setsignals(port, 1, -1); |
878 | sx_write_channel_byte (port, hi_csr, t * 0x11); | 917 | sx_write_channel_byte(port, hi_csr, t * 0x11); |
879 | } else { | 918 | } else { |
880 | sx_setsignals (port, 0, -1); | 919 | sx_setsignals(port, 0, -1); |
881 | } | 920 | } |
882 | } | 921 | } |
883 | } | 922 | } |
884 | 923 | ||
885 | |||
886 | /* Simon Allen's version of this routine was 225 lines long. 85 is a lot | 924 | /* Simon Allen's version of this routine was 225 lines long. 85 is a lot |
887 | better. -- REW */ | 925 | better. -- REW */ |
888 | 926 | ||
889 | static int sx_set_real_termios (void *ptr) | 927 | static int sx_set_real_termios(void *ptr) |
890 | { | 928 | { |
891 | struct sx_port *port = ptr; | 929 | struct sx_port *port = ptr; |
892 | 930 | ||
@@ -901,80 +939,83 @@ static int sx_set_real_termios (void *ptr) | |||
901 | belongs (next to the drop dtr if baud == 0) -- REW */ | 939 | belongs (next to the drop dtr if baud == 0) -- REW */ |
902 | /* sx_setsignals (port, 1, -1); */ | 940 | /* sx_setsignals (port, 1, -1); */ |
903 | 941 | ||
904 | sx_set_baud (port); | 942 | sx_set_baud(port); |
905 | 943 | ||
906 | #define CFLAG port->gs.tty->termios->c_cflag | 944 | #define CFLAG port->gs.tty->termios->c_cflag |
907 | sx_write_channel_byte (port, hi_mr1, | 945 | sx_write_channel_byte(port, hi_mr1, |
908 | (C_PARENB (port->gs.tty)? MR1_WITH:MR1_NONE) | | 946 | (C_PARENB(port->gs.tty) ? MR1_WITH : MR1_NONE) | |
909 | (C_PARODD (port->gs.tty)? MR1_ODD:MR1_EVEN) | | 947 | (C_PARODD(port->gs.tty) ? MR1_ODD : MR1_EVEN) | |
910 | (C_CRTSCTS(port->gs.tty)? MR1_RTS_RXFLOW:0) | | 948 | (C_CRTSCTS(port->gs.tty) ? MR1_RTS_RXFLOW : 0) | |
911 | (((CFLAG & CSIZE)==CS8) ? MR1_8_BITS:0) | | 949 | (((CFLAG & CSIZE) == CS8) ? MR1_8_BITS : 0) | |
912 | (((CFLAG & CSIZE)==CS7) ? MR1_7_BITS:0) | | 950 | (((CFLAG & CSIZE) == CS7) ? MR1_7_BITS : 0) | |
913 | (((CFLAG & CSIZE)==CS6) ? MR1_6_BITS:0) | | 951 | (((CFLAG & CSIZE) == CS6) ? MR1_6_BITS : 0) | |
914 | (((CFLAG & CSIZE)==CS5) ? MR1_5_BITS:0) ); | 952 | (((CFLAG & CSIZE) == CS5) ? MR1_5_BITS : 0)); |
915 | 953 | ||
916 | sx_write_channel_byte (port, hi_mr2, | 954 | sx_write_channel_byte(port, hi_mr2, |
917 | (C_CRTSCTS(port->gs.tty)?MR2_CTS_TXFLOW:0) | | 955 | (C_CRTSCTS(port->gs.tty) ? MR2_CTS_TXFLOW : 0) | |
918 | (C_CSTOPB (port->gs.tty)?MR2_2_STOP:MR2_1_STOP)); | 956 | (C_CSTOPB(port->gs.tty) ? MR2_2_STOP : |
957 | MR2_1_STOP)); | ||
919 | 958 | ||
920 | switch (CFLAG & CSIZE) { | 959 | switch (CFLAG & CSIZE) { |
921 | case CS8:sx_write_channel_byte (port, hi_mask, 0xff);break; | 960 | case CS8: |
922 | case CS7:sx_write_channel_byte (port, hi_mask, 0x7f);break; | 961 | sx_write_channel_byte(port, hi_mask, 0xff); |
923 | case CS6:sx_write_channel_byte (port, hi_mask, 0x3f);break; | 962 | break; |
924 | case CS5:sx_write_channel_byte (port, hi_mask, 0x1f);break; | 963 | case CS7: |
964 | sx_write_channel_byte(port, hi_mask, 0x7f); | ||
965 | break; | ||
966 | case CS6: | ||
967 | sx_write_channel_byte(port, hi_mask, 0x3f); | ||
968 | break; | ||
969 | case CS5: | ||
970 | sx_write_channel_byte(port, hi_mask, 0x1f); | ||
971 | break; | ||
925 | default: | 972 | default: |
926 | printk (KERN_INFO "sx: Invalid wordsize: %u\n", CFLAG & CSIZE); | 973 | printk(KERN_INFO "sx: Invalid wordsize: %u\n", CFLAG & CSIZE); |
927 | break; | 974 | break; |
928 | } | 975 | } |
929 | 976 | ||
930 | sx_write_channel_byte (port, hi_prtcl, | 977 | sx_write_channel_byte(port, hi_prtcl, |
931 | (I_IXON (port->gs.tty)?SP_TXEN:0) | | 978 | (I_IXON(port->gs.tty) ? SP_TXEN : 0) | |
932 | (I_IXOFF (port->gs.tty)?SP_RXEN:0) | | 979 | (I_IXOFF(port->gs.tty) ? SP_RXEN : 0) | |
933 | (I_IXANY (port->gs.tty)?SP_TANY:0) | | 980 | (I_IXANY(port->gs.tty) ? SP_TANY : 0) | SP_DCEN); |
934 | SP_DCEN); | ||
935 | 981 | ||
936 | sx_write_channel_byte (port, hi_break, | 982 | sx_write_channel_byte(port, hi_break, |
937 | (I_IGNBRK(port->gs.tty)?BR_IGN:0 | | 983 | (I_IGNBRK(port->gs.tty) ? BR_IGN : 0 | |
938 | I_BRKINT(port->gs.tty)?BR_INT:0)); | 984 | I_BRKINT(port->gs.tty) ? BR_INT : 0)); |
939 | 985 | ||
940 | sx_write_channel_byte (port, hi_txon, START_CHAR (port->gs.tty)); | 986 | sx_write_channel_byte(port, hi_txon, START_CHAR(port->gs.tty)); |
941 | sx_write_channel_byte (port, hi_rxon, START_CHAR (port->gs.tty)); | 987 | sx_write_channel_byte(port, hi_rxon, START_CHAR(port->gs.tty)); |
942 | sx_write_channel_byte (port, hi_txoff, STOP_CHAR (port->gs.tty)); | 988 | sx_write_channel_byte(port, hi_txoff, STOP_CHAR(port->gs.tty)); |
943 | sx_write_channel_byte (port, hi_rxoff, STOP_CHAR (port->gs.tty)); | 989 | sx_write_channel_byte(port, hi_rxoff, STOP_CHAR(port->gs.tty)); |
944 | 990 | ||
945 | sx_reconfigure_port(port); | 991 | sx_reconfigure_port(port); |
946 | 992 | ||
947 | /* Tell line discipline whether we will do input cooking */ | 993 | /* Tell line discipline whether we will do input cooking */ |
948 | if(I_OTHER(port->gs.tty)) { | 994 | if (I_OTHER(port->gs.tty)) { |
949 | clear_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); | 995 | clear_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); |
950 | } else { | 996 | } else { |
951 | set_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); | 997 | set_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); |
952 | } | 998 | } |
953 | sx_dprintk (SX_DEBUG_TERMIOS, "iflags: %x(%d) ", | 999 | sx_dprintk(SX_DEBUG_TERMIOS, "iflags: %x(%d) ", |
954 | port->gs.tty->termios->c_iflag, | 1000 | port->gs.tty->termios->c_iflag, I_OTHER(port->gs.tty)); |
955 | I_OTHER(port->gs.tty)); | ||
956 | |||
957 | 1001 | ||
958 | /* Tell line discipline whether we will do output cooking. | 1002 | /* Tell line discipline whether we will do output cooking. |
959 | * If OPOST is set and no other output flags are set then we can do output | 1003 | * If OPOST is set and no other output flags are set then we can do output |
960 | * processing. Even if only *one* other flag in the O_OTHER group is set | 1004 | * processing. Even if only *one* other flag in the O_OTHER group is set |
961 | * we do cooking in software. | 1005 | * we do cooking in software. |
962 | */ | 1006 | */ |
963 | if(O_OPOST(port->gs.tty) && !O_OTHER(port->gs.tty)) { | 1007 | if (O_OPOST(port->gs.tty) && !O_OTHER(port->gs.tty)) { |
964 | set_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); | 1008 | set_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); |
965 | } else { | 1009 | } else { |
966 | clear_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); | 1010 | clear_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); |
967 | } | 1011 | } |
968 | sx_dprintk (SX_DEBUG_TERMIOS, "oflags: %x(%d)\n", | 1012 | sx_dprintk(SX_DEBUG_TERMIOS, "oflags: %x(%d)\n", |
969 | port->gs.tty->termios->c_oflag, | 1013 | port->gs.tty->termios->c_oflag, O_OTHER(port->gs.tty)); |
970 | O_OTHER(port->gs.tty)); | ||
971 | /* port->c_dcd = sx_get_CD (port); */ | 1014 | /* port->c_dcd = sx_get_CD (port); */ |
972 | func_exit (); | 1015 | func_exit(); |
973 | return 0; | 1016 | return 0; |
974 | } | 1017 | } |
975 | 1018 | ||
976 | |||
977 | |||
978 | /* ********************************************************************** * | 1019 | /* ********************************************************************** * |
979 | * the interrupt related routines * | 1020 | * the interrupt related routines * |
980 | * ********************************************************************** */ | 1021 | * ********************************************************************** */ |
@@ -990,245 +1031,260 @@ static int sx_set_real_termios (void *ptr) | |||
990 | know I'm dead against that, but I think it is required in this | 1031 | know I'm dead against that, but I think it is required in this |
991 | case. */ | 1032 | case. */ |
992 | 1033 | ||
993 | 1034 | static void sx_transmit_chars(struct sx_port *port) | |
994 | static void sx_transmit_chars (struct sx_port *port) | ||
995 | { | 1035 | { |
996 | int c; | 1036 | int c; |
997 | int tx_ip; | 1037 | int tx_ip; |
998 | int txroom; | 1038 | int txroom; |
999 | 1039 | ||
1000 | func_enter2 (); | 1040 | func_enter2(); |
1001 | sx_dprintk (SX_DEBUG_TRANSMIT, "Port %p: transmit %d chars\n", | 1041 | sx_dprintk(SX_DEBUG_TRANSMIT, "Port %p: transmit %d chars\n", |
1002 | port, port->gs.xmit_cnt); | 1042 | port, port->gs.xmit_cnt); |
1003 | 1043 | ||
1004 | if (test_and_set_bit (SX_PORT_TRANSMIT_LOCK, &port->locks)) { | 1044 | if (test_and_set_bit(SX_PORT_TRANSMIT_LOCK, &port->locks)) { |
1005 | return; | 1045 | return; |
1006 | } | 1046 | } |
1007 | 1047 | ||
1008 | while (1) { | 1048 | while (1) { |
1009 | c = port->gs.xmit_cnt; | 1049 | c = port->gs.xmit_cnt; |
1010 | 1050 | ||
1011 | sx_dprintk (SX_DEBUG_TRANSMIT, "Copying %d ", c); | 1051 | sx_dprintk(SX_DEBUG_TRANSMIT, "Copying %d ", c); |
1012 | tx_ip = sx_read_channel_byte (port, hi_txipos); | 1052 | tx_ip = sx_read_channel_byte(port, hi_txipos); |
1013 | 1053 | ||
1014 | /* Took me 5 minutes to deduce this formula. | 1054 | /* Took me 5 minutes to deduce this formula. |
1015 | Luckily it is literally in the manual in section 6.5.4.3.5 */ | 1055 | Luckily it is literally in the manual in section 6.5.4.3.5 */ |
1016 | txroom = (sx_read_channel_byte (port, hi_txopos) - tx_ip - 1) & 0xff; | 1056 | txroom = (sx_read_channel_byte(port, hi_txopos) - tx_ip - 1) & |
1057 | 0xff; | ||
1017 | 1058 | ||
1018 | /* Don't copy more bytes than there is room for in the buffer */ | 1059 | /* Don't copy more bytes than there is room for in the buffer */ |
1019 | if (c > txroom) | 1060 | if (c > txroom) |
1020 | c = txroom; | 1061 | c = txroom; |
1021 | sx_dprintk (SX_DEBUG_TRANSMIT, " %d(%d) ", c, txroom ); | 1062 | sx_dprintk(SX_DEBUG_TRANSMIT, " %d(%d) ", c, txroom); |
1022 | 1063 | ||
1023 | /* Don't copy past the end of the hardware transmit buffer */ | 1064 | /* Don't copy past the end of the hardware transmit buffer */ |
1024 | if (c > 0x100 - tx_ip) | 1065 | if (c > 0x100 - tx_ip) |
1025 | c = 0x100 - tx_ip; | 1066 | c = 0x100 - tx_ip; |
1026 | 1067 | ||
1027 | sx_dprintk (SX_DEBUG_TRANSMIT, " %d(%d) ", c, 0x100-tx_ip ); | 1068 | sx_dprintk(SX_DEBUG_TRANSMIT, " %d(%d) ", c, 0x100 - tx_ip); |
1028 | 1069 | ||
1029 | /* Don't copy pas the end of the source buffer */ | 1070 | /* Don't copy pas the end of the source buffer */ |
1030 | if (c > SERIAL_XMIT_SIZE - port->gs.xmit_tail) | 1071 | if (c > SERIAL_XMIT_SIZE - port->gs.xmit_tail) |
1031 | c = SERIAL_XMIT_SIZE - port->gs.xmit_tail; | 1072 | c = SERIAL_XMIT_SIZE - port->gs.xmit_tail; |
1032 | 1073 | ||
1033 | sx_dprintk (SX_DEBUG_TRANSMIT, " %d(%ld) \n", | 1074 | sx_dprintk(SX_DEBUG_TRANSMIT, " %d(%ld) \n", |
1034 | c, SERIAL_XMIT_SIZE- port->gs.xmit_tail); | 1075 | c, SERIAL_XMIT_SIZE - port->gs.xmit_tail); |
1035 | |||
1036 | /* If for one reason or another, we can't copy more data, we're done! */ | ||
1037 | if (c == 0) break; | ||
1038 | 1076 | ||
1077 | /* If for one reason or another, we can't copy more data, we're | ||
1078 | done! */ | ||
1079 | if (c == 0) | ||
1080 | break; | ||
1039 | 1081 | ||
1040 | memcpy_toio (port->board->base + CHAN_OFFSET(port,hi_txbuf) + tx_ip, | 1082 | memcpy_toio(port->board->base + CHAN_OFFSET(port, hi_txbuf) + |
1041 | port->gs.xmit_buf + port->gs.xmit_tail, c); | 1083 | tx_ip, port->gs.xmit_buf + port->gs.xmit_tail, c); |
1042 | 1084 | ||
1043 | /* Update the pointer in the card */ | 1085 | /* Update the pointer in the card */ |
1044 | sx_write_channel_byte (port, hi_txipos, (tx_ip+c) & 0xff); | 1086 | sx_write_channel_byte(port, hi_txipos, (tx_ip + c) & 0xff); |
1045 | 1087 | ||
1046 | /* Update the kernel buffer end */ | 1088 | /* Update the kernel buffer end */ |
1047 | port->gs.xmit_tail = (port->gs.xmit_tail + c) & (SERIAL_XMIT_SIZE-1); | 1089 | port->gs.xmit_tail = (port->gs.xmit_tail + c) & |
1090 | (SERIAL_XMIT_SIZE - 1); | ||
1048 | 1091 | ||
1049 | /* This one last. (this is essential) | 1092 | /* This one last. (this is essential) |
1050 | It would allow others to start putting more data into the buffer! */ | 1093 | It would allow others to start putting more data into the |
1094 | buffer! */ | ||
1051 | port->gs.xmit_cnt -= c; | 1095 | port->gs.xmit_cnt -= c; |
1052 | } | 1096 | } |
1053 | 1097 | ||
1054 | if (port->gs.xmit_cnt == 0) { | 1098 | if (port->gs.xmit_cnt == 0) { |
1055 | sx_disable_tx_interrupts (port); | 1099 | sx_disable_tx_interrupts(port); |
1056 | } | 1100 | } |
1057 | 1101 | ||
1058 | if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.tty) { | 1102 | if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.tty) { |
1059 | tty_wakeup(port->gs.tty); | 1103 | tty_wakeup(port->gs.tty); |
1060 | sx_dprintk (SX_DEBUG_TRANSMIT, "Waking up.... ldisc (%d)....\n", | 1104 | sx_dprintk(SX_DEBUG_TRANSMIT, "Waking up.... ldisc (%d)....\n", |
1061 | port->gs.wakeup_chars); | 1105 | port->gs.wakeup_chars); |
1062 | } | 1106 | } |
1063 | 1107 | ||
1064 | clear_bit (SX_PORT_TRANSMIT_LOCK, &port->locks); | 1108 | clear_bit(SX_PORT_TRANSMIT_LOCK, &port->locks); |
1065 | func_exit (); | 1109 | func_exit(); |
1066 | } | 1110 | } |
1067 | 1111 | ||
1068 | |||
1069 | /* Note the symmetry between receiving chars and transmitting them! | 1112 | /* Note the symmetry between receiving chars and transmitting them! |
1070 | Note: The kernel should have implemented both a receive buffer and | 1113 | Note: The kernel should have implemented both a receive buffer and |
1071 | a transmit buffer. */ | 1114 | a transmit buffer. */ |
1072 | 1115 | ||
1073 | /* Inlined: Called only once. Remove the inline when you add another call */ | 1116 | /* Inlined: Called only once. Remove the inline when you add another call */ |
1074 | static inline void sx_receive_chars (struct sx_port *port) | 1117 | static inline void sx_receive_chars(struct sx_port *port) |
1075 | { | 1118 | { |
1076 | int c; | 1119 | int c; |
1077 | int rx_op; | 1120 | int rx_op; |
1078 | struct tty_struct *tty; | 1121 | struct tty_struct *tty; |
1079 | int copied=0; | 1122 | int copied = 0; |
1080 | unsigned char *rp; | 1123 | unsigned char *rp; |
1081 | 1124 | ||
1082 | func_enter2 (); | 1125 | func_enter2(); |
1083 | tty = port->gs.tty; | 1126 | tty = port->gs.tty; |
1084 | while (1) { | 1127 | while (1) { |
1085 | rx_op = sx_read_channel_byte (port, hi_rxopos); | 1128 | rx_op = sx_read_channel_byte(port, hi_rxopos); |
1086 | c = (sx_read_channel_byte (port, hi_rxipos) - rx_op) & 0xff; | 1129 | c = (sx_read_channel_byte(port, hi_rxipos) - rx_op) & 0xff; |
1087 | 1130 | ||
1088 | sx_dprintk (SX_DEBUG_RECEIVE, "rxop=%d, c = %d.\n", rx_op, c); | 1131 | sx_dprintk(SX_DEBUG_RECEIVE, "rxop=%d, c = %d.\n", rx_op, c); |
1089 | 1132 | ||
1090 | /* Don't copy past the end of the hardware receive buffer */ | 1133 | /* Don't copy past the end of the hardware receive buffer */ |
1091 | if (rx_op + c > 0x100) c = 0x100 - rx_op; | 1134 | if (rx_op + c > 0x100) |
1135 | c = 0x100 - rx_op; | ||
1092 | 1136 | ||
1093 | sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); | 1137 | sx_dprintk(SX_DEBUG_RECEIVE, "c = %d.\n", c); |
1094 | 1138 | ||
1095 | /* Don't copy more bytes than there is room for in the buffer */ | 1139 | /* Don't copy more bytes than there is room for in the buffer */ |
1096 | 1140 | ||
1097 | c = tty_prepare_flip_string(tty, &rp, c); | 1141 | c = tty_prepare_flip_string(tty, &rp, c); |
1098 | 1142 | ||
1099 | sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); | 1143 | sx_dprintk(SX_DEBUG_RECEIVE, "c = %d.\n", c); |
1100 | 1144 | ||
1101 | /* If for one reason or another, we can't copy more data, we're done! */ | 1145 | /* If for one reason or another, we can't copy more data, we're done! */ |
1102 | if (c == 0) break; | 1146 | if (c == 0) |
1147 | break; | ||
1103 | 1148 | ||
1104 | sx_dprintk (SX_DEBUG_RECEIVE , "Copying over %d chars. First is %d at %lx\n", c, | 1149 | sx_dprintk(SX_DEBUG_RECEIVE, "Copying over %d chars. First is " |
1105 | read_sx_byte (port->board, CHAN_OFFSET(port,hi_rxbuf) + rx_op), | 1150 | "%d at %lx\n", c, read_sx_byte(port->board, |
1106 | CHAN_OFFSET(port, hi_rxbuf)); | 1151 | CHAN_OFFSET(port, hi_rxbuf) + rx_op), |
1107 | memcpy_fromio (rp, | 1152 | CHAN_OFFSET(port, hi_rxbuf)); |
1108 | port->board->base + CHAN_OFFSET(port,hi_rxbuf) + rx_op, c); | 1153 | memcpy_fromio(rp, port->board->base + |
1154 | CHAN_OFFSET(port, hi_rxbuf) + rx_op, c); | ||
1109 | 1155 | ||
1110 | /* This one last. ( Not essential.) | 1156 | /* This one last. ( Not essential.) |
1111 | It allows the card to start putting more data into the buffer! | 1157 | It allows the card to start putting more data into the |
1158 | buffer! | ||
1112 | Update the pointer in the card */ | 1159 | Update the pointer in the card */ |
1113 | sx_write_channel_byte (port, hi_rxopos, (rx_op + c) & 0xff); | 1160 | sx_write_channel_byte(port, hi_rxopos, (rx_op + c) & 0xff); |
1114 | 1161 | ||
1115 | copied += c; | 1162 | copied += c; |
1116 | } | 1163 | } |
1117 | if (copied) { | 1164 | if (copied) { |
1118 | struct timeval tv; | 1165 | struct timeval tv; |
1119 | 1166 | ||
1120 | do_gettimeofday (&tv); | 1167 | do_gettimeofday(&tv); |
1121 | sx_dprintk (SX_DEBUG_RECEIVE, | 1168 | sx_dprintk(SX_DEBUG_RECEIVE, "pushing flipq port %d (%3d " |
1122 | "pushing flipq port %d (%3d chars): %d.%06d (%d/%d)\n", | 1169 | "chars): %d.%06d (%d/%d)\n", port->line, |
1123 | port->line, copied, | 1170 | copied, (int)(tv.tv_sec % 60), (int)tv.tv_usec, |
1124 | (int) (tv.tv_sec % 60), (int)tv.tv_usec, tty->raw, tty->real_raw); | 1171 | tty->raw, tty->real_raw); |
1125 | 1172 | ||
1126 | /* Tell the rest of the system the news. Great news. New characters! */ | 1173 | /* Tell the rest of the system the news. Great news. New |
1127 | tty_flip_buffer_push (tty); | 1174 | characters! */ |
1175 | tty_flip_buffer_push(tty); | ||
1128 | /* tty_schedule_flip (tty); */ | 1176 | /* tty_schedule_flip (tty); */ |
1129 | } | 1177 | } |
1130 | 1178 | ||
1131 | func_exit (); | 1179 | func_exit(); |
1132 | } | 1180 | } |
1133 | 1181 | ||
1134 | /* Inlined: it is called only once. Remove the inline if you add another | 1182 | /* Inlined: it is called only once. Remove the inline if you add another |
1135 | call */ | 1183 | call */ |
1136 | static inline void sx_check_modem_signals (struct sx_port *port) | 1184 | static inline void sx_check_modem_signals(struct sx_port *port) |
1137 | { | 1185 | { |
1138 | int hi_state; | 1186 | int hi_state; |
1139 | int c_dcd; | 1187 | int c_dcd; |
1140 | 1188 | ||
1141 | hi_state = sx_read_channel_byte (port, hi_state); | 1189 | hi_state = sx_read_channel_byte(port, hi_state); |
1142 | sx_dprintk (SX_DEBUG_MODEMSIGNALS, "Checking modem signals (%d/%d)\n", | 1190 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "Checking modem signals (%d/%d)\n", |
1143 | port->c_dcd, sx_get_CD (port)); | 1191 | port->c_dcd, sx_get_CD(port)); |
1144 | 1192 | ||
1145 | if (hi_state & ST_BREAK) { | 1193 | if (hi_state & ST_BREAK) { |
1146 | hi_state &= ~ST_BREAK; | 1194 | hi_state &= ~ST_BREAK; |
1147 | sx_dprintk (SX_DEBUG_MODEMSIGNALS, "got a break.\n"); | 1195 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "got a break.\n"); |
1148 | sx_write_channel_byte (port, hi_state, hi_state); | 1196 | sx_write_channel_byte(port, hi_state, hi_state); |
1149 | gs_got_break (&port->gs); | 1197 | gs_got_break(&port->gs); |
1150 | } | 1198 | } |
1151 | if (hi_state & ST_DCD) { | 1199 | if (hi_state & ST_DCD) { |
1152 | hi_state &= ~ST_DCD; | 1200 | hi_state &= ~ST_DCD; |
1153 | sx_dprintk (SX_DEBUG_MODEMSIGNALS, "got a DCD change.\n"); | 1201 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "got a DCD change.\n"); |
1154 | sx_write_channel_byte (port, hi_state, hi_state); | 1202 | sx_write_channel_byte(port, hi_state, hi_state); |
1155 | c_dcd = sx_get_CD (port); | 1203 | c_dcd = sx_get_CD(port); |
1156 | sx_dprintk (SX_DEBUG_MODEMSIGNALS, "DCD is now %d\n", c_dcd); | 1204 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD is now %d\n", c_dcd); |
1157 | if (c_dcd != port->c_dcd) { | 1205 | if (c_dcd != port->c_dcd) { |
1158 | port->c_dcd = c_dcd; | 1206 | port->c_dcd = c_dcd; |
1159 | if (sx_get_CD (port)) { | 1207 | if (sx_get_CD(port)) { |
1160 | /* DCD went UP */ | 1208 | /* DCD went UP */ |
1161 | if ((sx_read_channel_byte(port, hi_hstat) != HS_IDLE_CLOSED) && | 1209 | if ((sx_read_channel_byte(port, hi_hstat) != |
1162 | !(port->gs.tty->termios->c_cflag & CLOCAL) ) { | 1210 | HS_IDLE_CLOSED) && |
1163 | /* Are we blocking in open?*/ | 1211 | !(port->gs.tty->termios-> |
1164 | sx_dprintk (SX_DEBUG_MODEMSIGNALS, "DCD active, unblocking open\n"); | 1212 | c_cflag & CLOCAL)) { |
1165 | wake_up_interruptible(&port->gs.open_wait); | 1213 | /* Are we blocking in open? */ |
1214 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " | ||
1215 | "active, unblocking open\n"); | ||
1216 | wake_up_interruptible(&port->gs. | ||
1217 | open_wait); | ||
1166 | } else { | 1218 | } else { |
1167 | sx_dprintk (SX_DEBUG_MODEMSIGNALS, "DCD raised. Ignoring.\n"); | 1219 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " |
1220 | "raised. Ignoring.\n"); | ||
1168 | } | 1221 | } |
1169 | } else { | 1222 | } else { |
1170 | /* DCD went down! */ | 1223 | /* DCD went down! */ |
1171 | if (!(port->gs.tty->termios->c_cflag & CLOCAL) ) { | 1224 | if (!(port->gs.tty->termios->c_cflag & CLOCAL)){ |
1172 | sx_dprintk (SX_DEBUG_MODEMSIGNALS, "DCD dropped. hanging up....\n"); | 1225 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " |
1173 | tty_hangup (port->gs.tty); | 1226 | "dropped. hanging up....\n"); |
1227 | tty_hangup(port->gs.tty); | ||
1174 | } else { | 1228 | } else { |
1175 | sx_dprintk (SX_DEBUG_MODEMSIGNALS, "DCD dropped. ignoring.\n"); | 1229 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " |
1230 | "dropped. ignoring.\n"); | ||
1176 | } | 1231 | } |
1177 | } | 1232 | } |
1178 | } else { | 1233 | } else { |
1179 | sx_dprintk (SX_DEBUG_MODEMSIGNALS, "Hmmm. card told us DCD changed, but it didn't.\n"); | 1234 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "Hmmm. card told us " |
1235 | "DCD changed, but it didn't.\n"); | ||
1180 | } | 1236 | } |
1181 | } | 1237 | } |
1182 | } | 1238 | } |
1183 | 1239 | ||
1184 | |||
1185 | /* This is what an interrupt routine should look like. | 1240 | /* This is what an interrupt routine should look like. |
1186 | * Small, elegant, clear. | 1241 | * Small, elegant, clear. |
1187 | */ | 1242 | */ |
1188 | 1243 | ||
1189 | static irqreturn_t sx_interrupt (int irq, void *ptr) | 1244 | static irqreturn_t sx_interrupt(int irq, void *ptr) |
1190 | { | 1245 | { |
1191 | struct sx_board *board = ptr; | 1246 | struct sx_board *board = ptr; |
1192 | struct sx_port *port; | 1247 | struct sx_port *port; |
1193 | int i; | 1248 | int i; |
1194 | 1249 | ||
1195 | func_enter (); | 1250 | func_enter(); |
1196 | sx_dprintk (SX_DEBUG_FLOW, "sx: enter sx_interrupt (%d/%d)\n", irq, board->irq); | 1251 | sx_dprintk(SX_DEBUG_FLOW, "sx: enter sx_interrupt (%d/%d)\n", irq, |
1252 | board->irq); | ||
1197 | 1253 | ||
1198 | /* AAargh! The order in which to do these things is essential and | 1254 | /* AAargh! The order in which to do these things is essential and |
1199 | not trivial. | 1255 | not trivial. |
1200 | 1256 | ||
1201 | - Rate limit goes before "recursive". Otherwise a series of | 1257 | - Rate limit goes before "recursive". Otherwise a series of |
1202 | recursive calls will hang the machine in the interrupt routine. | 1258 | recursive calls will hang the machine in the interrupt routine. |
1203 | 1259 | ||
1204 | - hardware twiddling goes before "recursive". Otherwise when we | 1260 | - hardware twiddling goes before "recursive". Otherwise when we |
1205 | poll the card, and a recursive interrupt happens, we won't | 1261 | poll the card, and a recursive interrupt happens, we won't |
1206 | ack the card, so it might keep on interrupting us. (especially | 1262 | ack the card, so it might keep on interrupting us. (especially |
1207 | level sensitive interrupt systems like PCI). | 1263 | level sensitive interrupt systems like PCI). |
1208 | 1264 | ||
1209 | - Rate limit goes before hardware twiddling. Otherwise we won't | 1265 | - Rate limit goes before hardware twiddling. Otherwise we won't |
1210 | catch a card that has gone bonkers. | 1266 | catch a card that has gone bonkers. |
1211 | 1267 | ||
1212 | - The "initialized" test goes after the hardware twiddling. Otherwise | 1268 | - The "initialized" test goes after the hardware twiddling. Otherwise |
1213 | the card will stick us in the interrupt routine again. | 1269 | the card will stick us in the interrupt routine again. |
1214 | 1270 | ||
1215 | - The initialized test goes before recursive. | 1271 | - The initialized test goes before recursive. |
1216 | */ | 1272 | */ |
1217 | |||
1218 | |||
1219 | 1273 | ||
1220 | #ifdef IRQ_RATE_LIMIT | 1274 | #ifdef IRQ_RATE_LIMIT |
1221 | /* Aaargh! I'm ashamed. This costs more lines-of-code than the | 1275 | /* Aaargh! I'm ashamed. This costs more lines-of-code than the |
1222 | actual interrupt routine!. (Well, used to when I wrote that comment) */ | 1276 | actual interrupt routine!. (Well, used to when I wrote that |
1277 | comment) */ | ||
1223 | { | 1278 | { |
1224 | static int lastjif; | 1279 | static int lastjif; |
1225 | static int nintr=0; | 1280 | static int nintr = 0; |
1226 | 1281 | ||
1227 | if (lastjif == jiffies) { | 1282 | if (lastjif == jiffies) { |
1228 | if (++nintr > IRQ_RATE_LIMIT) { | 1283 | if (++nintr > IRQ_RATE_LIMIT) { |
1229 | free_irq (board->irq, board); | 1284 | free_irq(board->irq, board); |
1230 | printk (KERN_ERR "sx: Too many interrupts. Turning off interrupt %d.\n", | 1285 | printk(KERN_ERR "sx: Too many interrupts. " |
1231 | board->irq); | 1286 | "Turning off interrupt %d.\n", |
1287 | board->irq); | ||
1232 | } | 1288 | } |
1233 | } else { | 1289 | } else { |
1234 | lastjif = jiffies; | 1290 | lastjif = jiffies; |
@@ -1237,19 +1293,20 @@ static irqreturn_t sx_interrupt (int irq, void *ptr) | |||
1237 | } | 1293 | } |
1238 | #endif | 1294 | #endif |
1239 | 1295 | ||
1240 | |||
1241 | if (board->irq == irq) { | 1296 | if (board->irq == irq) { |
1242 | /* Tell the card we've noticed the interrupt. */ | 1297 | /* Tell the card we've noticed the interrupt. */ |
1243 | 1298 | ||
1244 | sx_write_board_word (board, cc_int_pending, 0); | 1299 | sx_write_board_word(board, cc_int_pending, 0); |
1245 | if (IS_SX_BOARD (board)) { | 1300 | if (IS_SX_BOARD(board)) { |
1246 | write_sx_byte (board, SX_RESET_IRQ, 1); | 1301 | write_sx_byte(board, SX_RESET_IRQ, 1); |
1247 | } else if (IS_EISA_BOARD(board)) { | 1302 | } else if (IS_EISA_BOARD(board)) { |
1248 | inb(board->eisa_base+0xc03); | 1303 | inb(board->eisa_base + 0xc03); |
1249 | write_sx_word(board, 8, 0); | 1304 | write_sx_word(board, 8, 0); |
1250 | } else { | 1305 | } else { |
1251 | write_sx_byte (board, SI2_ISA_INTCLEAR, SI2_ISA_INTCLEAR_CLEAR); | 1306 | write_sx_byte(board, SI2_ISA_INTCLEAR, |
1252 | write_sx_byte (board, SI2_ISA_INTCLEAR, SI2_ISA_INTCLEAR_SET); | 1307 | SI2_ISA_INTCLEAR_CLEAR); |
1308 | write_sx_byte(board, SI2_ISA_INTCLEAR, | ||
1309 | SI2_ISA_INTCLEAR_SET); | ||
1253 | } | 1310 | } |
1254 | } | 1311 | } |
1255 | 1312 | ||
@@ -1258,53 +1315,51 @@ static irqreturn_t sx_interrupt (int irq, void *ptr) | |||
1258 | if (!(board->flags & SX_BOARD_INITIALIZED)) | 1315 | if (!(board->flags & SX_BOARD_INITIALIZED)) |
1259 | return IRQ_HANDLED; | 1316 | return IRQ_HANDLED; |
1260 | 1317 | ||
1261 | if (test_and_set_bit (SX_BOARD_INTR_LOCK, &board->locks)) { | 1318 | if (test_and_set_bit(SX_BOARD_INTR_LOCK, &board->locks)) { |
1262 | printk (KERN_ERR "Recursive interrupt! (%d)\n", board->irq); | 1319 | printk(KERN_ERR "Recursive interrupt! (%d)\n", board->irq); |
1263 | return IRQ_HANDLED; | 1320 | return IRQ_HANDLED; |
1264 | } | 1321 | } |
1265 | 1322 | ||
1266 | for (i=0;i<board->nports;i++) { | 1323 | for (i = 0; i < board->nports; i++) { |
1267 | port = &board->ports[i]; | 1324 | port = &board->ports[i]; |
1268 | if (port->gs.flags & GS_ACTIVE) { | 1325 | if (port->gs.flags & GS_ACTIVE) { |
1269 | if (sx_read_channel_byte (port, hi_state)) { | 1326 | if (sx_read_channel_byte(port, hi_state)) { |
1270 | sx_dprintk (SX_DEBUG_INTERRUPTS, | 1327 | sx_dprintk(SX_DEBUG_INTERRUPTS, "Port %d: " |
1271 | "Port %d: modem signal change?... \n", i); | 1328 | "modem signal change?... \n",i); |
1272 | sx_check_modem_signals (port); | 1329 | sx_check_modem_signals(port); |
1273 | } | 1330 | } |
1274 | if (port->gs.xmit_cnt) { | 1331 | if (port->gs.xmit_cnt) { |
1275 | sx_transmit_chars (port); | 1332 | sx_transmit_chars(port); |
1276 | } | 1333 | } |
1277 | if (!(port->gs.flags & SX_RX_THROTTLE)) { | 1334 | if (!(port->gs.flags & SX_RX_THROTTLE)) { |
1278 | sx_receive_chars (port); | 1335 | sx_receive_chars(port); |
1279 | } | 1336 | } |
1280 | } | 1337 | } |
1281 | } | 1338 | } |
1282 | 1339 | ||
1283 | clear_bit (SX_BOARD_INTR_LOCK, &board->locks); | 1340 | clear_bit(SX_BOARD_INTR_LOCK, &board->locks); |
1284 | 1341 | ||
1285 | sx_dprintk (SX_DEBUG_FLOW, "sx: exit sx_interrupt (%d/%d)\n", irq, board->irq); | 1342 | sx_dprintk(SX_DEBUG_FLOW, "sx: exit sx_interrupt (%d/%d)\n", irq, |
1286 | func_exit (); | 1343 | board->irq); |
1344 | func_exit(); | ||
1287 | return IRQ_HANDLED; | 1345 | return IRQ_HANDLED; |
1288 | } | 1346 | } |
1289 | 1347 | ||
1290 | 1348 | static void sx_pollfunc(unsigned long data) | |
1291 | static void sx_pollfunc (unsigned long data) | ||
1292 | { | 1349 | { |
1293 | struct sx_board *board = (struct sx_board *) data; | 1350 | struct sx_board *board = (struct sx_board *)data; |
1294 | 1351 | ||
1295 | func_enter (); | 1352 | func_enter(); |
1296 | 1353 | ||
1297 | sx_interrupt (0, board); | 1354 | sx_interrupt(0, board); |
1298 | 1355 | ||
1299 | init_timer(&board->timer); | 1356 | init_timer(&board->timer); |
1300 | 1357 | ||
1301 | board->timer.expires = jiffies + sx_poll; | 1358 | board->timer.expires = jiffies + sx_poll; |
1302 | add_timer (&board->timer); | 1359 | add_timer(&board->timer); |
1303 | func_exit (); | 1360 | func_exit(); |
1304 | } | 1361 | } |
1305 | 1362 | ||
1306 | |||
1307 | |||
1308 | /* ********************************************************************** * | 1363 | /* ********************************************************************** * |
1309 | * Here are the routines that actually * | 1364 | * Here are the routines that actually * |
1310 | * interface with the generic_serial driver * | 1365 | * interface with the generic_serial driver * |
@@ -1313,9 +1368,9 @@ static void sx_pollfunc (unsigned long data) | |||
1313 | /* Ehhm. I don't know how to fiddle with interrupts on the SX card. --REW */ | 1368 | /* Ehhm. I don't know how to fiddle with interrupts on the SX card. --REW */ |
1314 | /* Hmm. Ok I figured it out. You don't. */ | 1369 | /* Hmm. Ok I figured it out. You don't. */ |
1315 | 1370 | ||
1316 | static void sx_disable_tx_interrupts (void * ptr) | 1371 | static void sx_disable_tx_interrupts(void *ptr) |
1317 | { | 1372 | { |
1318 | struct sx_port *port = ptr; | 1373 | struct sx_port *port = ptr; |
1319 | func_enter2(); | 1374 | func_enter2(); |
1320 | 1375 | ||
1321 | port->gs.flags &= ~GS_TX_INTEN; | 1376 | port->gs.flags &= ~GS_TX_INTEN; |
@@ -1323,30 +1378,28 @@ static void sx_disable_tx_interrupts (void * ptr) | |||
1323 | func_exit(); | 1378 | func_exit(); |
1324 | } | 1379 | } |
1325 | 1380 | ||
1326 | 1381 | static void sx_enable_tx_interrupts(void *ptr) | |
1327 | static void sx_enable_tx_interrupts (void * ptr) | ||
1328 | { | 1382 | { |
1329 | struct sx_port *port = ptr; | 1383 | struct sx_port *port = ptr; |
1330 | int data_in_buffer; | 1384 | int data_in_buffer; |
1331 | func_enter2(); | 1385 | func_enter2(); |
1332 | 1386 | ||
1333 | /* First transmit the characters that we're supposed to */ | 1387 | /* First transmit the characters that we're supposed to */ |
1334 | sx_transmit_chars (port); | 1388 | sx_transmit_chars(port); |
1335 | 1389 | ||
1336 | /* The sx card will never interrupt us if we don't fill the buffer | 1390 | /* The sx card will never interrupt us if we don't fill the buffer |
1337 | past 25%. So we keep considering interrupts off if that's the case. */ | 1391 | past 25%. So we keep considering interrupts off if that's the case. */ |
1338 | data_in_buffer = (sx_read_channel_byte (port, hi_txipos) - | 1392 | data_in_buffer = (sx_read_channel_byte(port, hi_txipos) - |
1339 | sx_read_channel_byte (port, hi_txopos)) & 0xff; | 1393 | sx_read_channel_byte(port, hi_txopos)) & 0xff; |
1340 | 1394 | ||
1341 | /* XXX Must be "HIGH_WATER" for SI card according to doc. */ | 1395 | /* XXX Must be "HIGH_WATER" for SI card according to doc. */ |
1342 | if (data_in_buffer < LOW_WATER) | 1396 | if (data_in_buffer < LOW_WATER) |
1343 | port->gs.flags &= ~GS_TX_INTEN; | 1397 | port->gs.flags &= ~GS_TX_INTEN; |
1344 | 1398 | ||
1345 | func_exit(); | 1399 | func_exit(); |
1346 | } | 1400 | } |
1347 | 1401 | ||
1348 | 1402 | static void sx_disable_rx_interrupts(void *ptr) | |
1349 | static void sx_disable_rx_interrupts (void * ptr) | ||
1350 | { | 1403 | { |
1351 | /* struct sx_port *port = ptr; */ | 1404 | /* struct sx_port *port = ptr; */ |
1352 | func_enter(); | 1405 | func_enter(); |
@@ -1354,7 +1407,7 @@ static void sx_disable_rx_interrupts (void * ptr) | |||
1354 | func_exit(); | 1407 | func_exit(); |
1355 | } | 1408 | } |
1356 | 1409 | ||
1357 | static void sx_enable_rx_interrupts (void * ptr) | 1410 | static void sx_enable_rx_interrupts(void *ptr) |
1358 | { | 1411 | { |
1359 | /* struct sx_port *port = ptr; */ | 1412 | /* struct sx_port *port = ptr; */ |
1360 | func_enter(); | 1413 | func_enter(); |
@@ -1362,55 +1415,48 @@ static void sx_enable_rx_interrupts (void * ptr) | |||
1362 | func_exit(); | 1415 | func_exit(); |
1363 | } | 1416 | } |
1364 | 1417 | ||
1365 | |||
1366 | /* Jeez. Isn't this simple? */ | 1418 | /* Jeez. Isn't this simple? */ |
1367 | static int sx_get_CD (void * ptr) | 1419 | static int sx_get_CD(void *ptr) |
1368 | { | 1420 | { |
1369 | struct sx_port *port = ptr; | 1421 | struct sx_port *port = ptr; |
1370 | func_enter2(); | 1422 | func_enter2(); |
1371 | 1423 | ||
1372 | func_exit(); | 1424 | func_exit(); |
1373 | return ((sx_read_channel_byte (port, hi_ip) & IP_DCD) != 0); | 1425 | return ((sx_read_channel_byte(port, hi_ip) & IP_DCD) != 0); |
1374 | } | 1426 | } |
1375 | 1427 | ||
1376 | |||
1377 | /* Jeez. Isn't this simple? */ | 1428 | /* Jeez. Isn't this simple? */ |
1378 | static int sx_chars_in_buffer (void * ptr) | 1429 | static int sx_chars_in_buffer(void *ptr) |
1379 | { | 1430 | { |
1380 | struct sx_port *port = ptr; | 1431 | struct sx_port *port = ptr; |
1381 | func_enter2(); | 1432 | func_enter2(); |
1382 | 1433 | ||
1383 | func_exit(); | 1434 | func_exit(); |
1384 | return ((sx_read_channel_byte (port, hi_txipos) - | 1435 | return ((sx_read_channel_byte(port, hi_txipos) - |
1385 | sx_read_channel_byte (port, hi_txopos)) & 0xff); | 1436 | sx_read_channel_byte(port, hi_txopos)) & 0xff); |
1386 | } | 1437 | } |
1387 | 1438 | ||
1388 | 1439 | static void sx_shutdown_port(void *ptr) | |
1389 | static void sx_shutdown_port (void * ptr) | ||
1390 | { | 1440 | { |
1391 | struct sx_port *port = ptr; | 1441 | struct sx_port *port = ptr; |
1392 | 1442 | ||
1393 | func_enter(); | 1443 | func_enter(); |
1394 | 1444 | ||
1395 | port->gs.flags &= ~ GS_ACTIVE; | 1445 | port->gs.flags &= ~GS_ACTIVE; |
1396 | if (port->gs.tty && (port->gs.tty->termios->c_cflag & HUPCL)) { | 1446 | if (port->gs.tty && (port->gs.tty->termios->c_cflag & HUPCL)) { |
1397 | sx_setsignals (port, 0, 0); | 1447 | sx_setsignals(port, 0, 0); |
1398 | sx_reconfigure_port(port); | 1448 | sx_reconfigure_port(port); |
1399 | } | 1449 | } |
1400 | 1450 | ||
1401 | func_exit(); | 1451 | func_exit(); |
1402 | } | 1452 | } |
1403 | 1453 | ||
1404 | |||
1405 | |||
1406 | |||
1407 | |||
1408 | /* ********************************************************************** * | 1454 | /* ********************************************************************** * |
1409 | * Here are the routines that actually * | 1455 | * Here are the routines that actually * |
1410 | * interface with the rest of the system * | 1456 | * interface with the rest of the system * |
1411 | * ********************************************************************** */ | 1457 | * ********************************************************************** */ |
1412 | 1458 | ||
1413 | static int sx_open (struct tty_struct * tty, struct file * filp) | 1459 | static int sx_open(struct tty_struct *tty, struct file *filp) |
1414 | { | 1460 | { |
1415 | struct sx_port *port; | 1461 | struct sx_port *port; |
1416 | int retval, line; | 1462 | int retval, line; |
@@ -1423,18 +1469,18 @@ static int sx_open (struct tty_struct * tty, struct file * filp) | |||
1423 | } | 1469 | } |
1424 | 1470 | ||
1425 | line = tty->index; | 1471 | line = tty->index; |
1426 | sx_dprintk (SX_DEBUG_OPEN, "%d: opening line %d. tty=%p ctty=%p, np=%d)\n", | 1472 | sx_dprintk(SX_DEBUG_OPEN, "%d: opening line %d. tty=%p ctty=%p, " |
1427 | current->pid, line, tty, current->signal->tty, sx_nports); | 1473 | "np=%d)\n", current->pid, line, tty, |
1474 | current->signal->tty, sx_nports); | ||
1428 | 1475 | ||
1429 | if ((line < 0) || (line >= SX_NPORTS) || (line >= sx_nports)) | 1476 | if ((line < 0) || (line >= SX_NPORTS) || (line >= sx_nports)) |
1430 | return -ENODEV; | 1477 | return -ENODEV; |
1431 | 1478 | ||
1432 | port = & sx_ports[line]; | 1479 | port = &sx_ports[line]; |
1433 | port->c_dcd = 0; /* Make sure that the first interrupt doesn't detect a | 1480 | port->c_dcd = 0; /* Make sure that the first interrupt doesn't detect a |
1434 | 1 -> 0 transition. */ | 1481 | 1 -> 0 transition. */ |
1435 | |||
1436 | 1482 | ||
1437 | sx_dprintk (SX_DEBUG_OPEN, "port = %p c_dcd = %d\n", port, port->c_dcd); | 1483 | sx_dprintk(SX_DEBUG_OPEN, "port = %p c_dcd = %d\n", port, port->c_dcd); |
1438 | 1484 | ||
1439 | spin_lock_irqsave(&port->gs.driver_lock, flags); | 1485 | spin_lock_irqsave(&port->gs.driver_lock, flags); |
1440 | 1486 | ||
@@ -1443,13 +1489,13 @@ static int sx_open (struct tty_struct * tty, struct file * filp) | |||
1443 | port->gs.count++; | 1489 | port->gs.count++; |
1444 | spin_unlock_irqrestore(&port->gs.driver_lock, flags); | 1490 | spin_unlock_irqrestore(&port->gs.driver_lock, flags); |
1445 | 1491 | ||
1446 | sx_dprintk (SX_DEBUG_OPEN, "starting port\n"); | 1492 | sx_dprintk(SX_DEBUG_OPEN, "starting port\n"); |
1447 | 1493 | ||
1448 | /* | 1494 | /* |
1449 | * Start up serial port | 1495 | * Start up serial port |
1450 | */ | 1496 | */ |
1451 | retval = gs_init_port(&port->gs); | 1497 | retval = gs_init_port(&port->gs); |
1452 | sx_dprintk (SX_DEBUG_OPEN, "done gs_init\n"); | 1498 | sx_dprintk(SX_DEBUG_OPEN, "done gs_init\n"); |
1453 | if (retval) { | 1499 | if (retval) { |
1454 | port->gs.count--; | 1500 | port->gs.count--; |
1455 | return retval; | 1501 | return retval; |
@@ -1457,19 +1503,20 @@ static int sx_open (struct tty_struct * tty, struct file * filp) | |||
1457 | 1503 | ||
1458 | port->gs.flags |= GS_ACTIVE; | 1504 | port->gs.flags |= GS_ACTIVE; |
1459 | if (port->gs.count <= 1) | 1505 | if (port->gs.count <= 1) |
1460 | sx_setsignals (port, 1,1); | 1506 | sx_setsignals(port, 1, 1); |
1461 | 1507 | ||
1462 | #if 0 | 1508 | #if 0 |
1463 | if (sx_debug & SX_DEBUG_OPEN) | 1509 | if (sx_debug & SX_DEBUG_OPEN) |
1464 | my_hd (port, sizeof (*port)); | 1510 | my_hd(port, sizeof(*port)); |
1465 | #else | 1511 | #else |
1466 | if (sx_debug & SX_DEBUG_OPEN) | 1512 | if (sx_debug & SX_DEBUG_OPEN) |
1467 | my_hd_io (port->board->base + port->ch_base, sizeof (*port)); | 1513 | my_hd_io(port->board->base + port->ch_base, sizeof(*port)); |
1468 | #endif | 1514 | #endif |
1469 | 1515 | ||
1470 | if (port->gs.count <= 1) { | 1516 | if (port->gs.count <= 1) { |
1471 | if (sx_send_command (port, HS_LOPEN, -1, HS_IDLE_OPEN) != 1) { | 1517 | if (sx_send_command(port, HS_LOPEN, -1, HS_IDLE_OPEN) != 1) { |
1472 | printk (KERN_ERR "sx: Card didn't respond to LOPEN command.\n"); | 1518 | printk(KERN_ERR "sx: Card didn't respond to LOPEN " |
1519 | "command.\n"); | ||
1473 | spin_lock_irqsave(&port->gs.driver_lock, flags); | 1520 | spin_lock_irqsave(&port->gs.driver_lock, flags); |
1474 | port->gs.count--; | 1521 | port->gs.count--; |
1475 | spin_unlock_irqrestore(&port->gs.driver_lock, flags); | 1522 | spin_unlock_irqrestore(&port->gs.driver_lock, flags); |
@@ -1478,75 +1525,76 @@ static int sx_open (struct tty_struct * tty, struct file * filp) | |||
1478 | } | 1525 | } |
1479 | 1526 | ||
1480 | retval = gs_block_til_ready(port, filp); | 1527 | retval = gs_block_til_ready(port, filp); |
1481 | sx_dprintk (SX_DEBUG_OPEN, "Block til ready returned %d. Count=%d\n", | 1528 | sx_dprintk(SX_DEBUG_OPEN, "Block til ready returned %d. Count=%d\n", |
1482 | retval, port->gs.count); | 1529 | retval, port->gs.count); |
1483 | 1530 | ||
1484 | if (retval) { | 1531 | if (retval) { |
1485 | /* | 1532 | /* |
1486 | * Don't lower gs.count here because sx_close() will be called later | 1533 | * Don't lower gs.count here because sx_close() will be called later |
1487 | */ | 1534 | */ |
1488 | 1535 | ||
1489 | return retval; | 1536 | return retval; |
1490 | } | 1537 | } |
1491 | /* tty->low_latency = 1; */ | 1538 | /* tty->low_latency = 1; */ |
1492 | 1539 | ||
1493 | port->c_dcd = sx_get_CD (port); | 1540 | port->c_dcd = sx_get_CD(port); |
1494 | sx_dprintk (SX_DEBUG_OPEN, "at open: cd=%d\n", port->c_dcd); | 1541 | sx_dprintk(SX_DEBUG_OPEN, "at open: cd=%d\n", port->c_dcd); |
1495 | 1542 | ||
1496 | func_exit(); | 1543 | func_exit(); |
1497 | return 0; | 1544 | return 0; |
1498 | 1545 | ||
1499 | } | 1546 | } |
1500 | 1547 | ||
1501 | 1548 | static void sx_close(void *ptr) | |
1502 | static void sx_close (void *ptr) | ||
1503 | { | 1549 | { |
1504 | struct sx_port *port = ptr; | 1550 | struct sx_port *port = ptr; |
1505 | /* Give the port 5 seconds to close down. */ | 1551 | /* Give the port 5 seconds to close down. */ |
1506 | int to = 5 * HZ; | 1552 | int to = 5 * HZ; |
1507 | 1553 | ||
1508 | func_enter (); | 1554 | func_enter(); |
1509 | 1555 | ||
1510 | sx_setsignals (port, 0, 0); | 1556 | sx_setsignals(port, 0, 0); |
1511 | sx_reconfigure_port(port); | 1557 | sx_reconfigure_port(port); |
1512 | sx_send_command (port, HS_CLOSE, 0, 0); | 1558 | sx_send_command(port, HS_CLOSE, 0, 0); |
1513 | 1559 | ||
1514 | while (to-- && (sx_read_channel_byte (port, hi_hstat) != HS_IDLE_CLOSED)) | 1560 | while (to-- && (sx_read_channel_byte(port, hi_hstat) != HS_IDLE_CLOSED)) |
1515 | if (msleep_interruptible(10)) | 1561 | if (msleep_interruptible(10)) |
1516 | break; | 1562 | break; |
1517 | if (sx_read_channel_byte (port, hi_hstat) != HS_IDLE_CLOSED) { | 1563 | if (sx_read_channel_byte(port, hi_hstat) != HS_IDLE_CLOSED) { |
1518 | if (sx_send_command (port, HS_FORCE_CLOSED, -1, HS_IDLE_CLOSED) != 1) { | 1564 | if (sx_send_command(port, HS_FORCE_CLOSED, -1, HS_IDLE_CLOSED) |
1519 | printk (KERN_ERR | 1565 | != 1) { |
1520 | "sx: sent the force_close command, but card didn't react\n"); | 1566 | printk(KERN_ERR "sx: sent the force_close command, but " |
1567 | "card didn't react\n"); | ||
1521 | } else | 1568 | } else |
1522 | sx_dprintk (SX_DEBUG_CLOSE, "sent the force_close command.\n"); | 1569 | sx_dprintk(SX_DEBUG_CLOSE, "sent the force_close " |
1570 | "command.\n"); | ||
1523 | } | 1571 | } |
1524 | 1572 | ||
1525 | sx_dprintk (SX_DEBUG_CLOSE, "waited %d jiffies for close. count=%d\n", | 1573 | sx_dprintk(SX_DEBUG_CLOSE, "waited %d jiffies for close. count=%d\n", |
1526 | 5 * HZ - to - 1, port->gs.count); | 1574 | 5 * HZ - to - 1, port->gs.count); |
1527 | 1575 | ||
1528 | if(port->gs.count) { | 1576 | if (port->gs.count) { |
1529 | sx_dprintk(SX_DEBUG_CLOSE, "WARNING port count:%d\n", port->gs.count); | 1577 | sx_dprintk(SX_DEBUG_CLOSE, "WARNING port count:%d\n", |
1530 | //printk ("%s SETTING port count to zero: %p count: %d\n", __FUNCTION__, port, port->gs.count); | 1578 | port->gs.count); |
1531 | //port->gs.count = 0; | 1579 | /*printk("%s SETTING port count to zero: %p count: %d\n", |
1580 | __FUNCTION__, port, port->gs.count); | ||
1581 | port->gs.count = 0;*/ | ||
1532 | } | 1582 | } |
1533 | 1583 | ||
1534 | func_exit (); | 1584 | func_exit(); |
1535 | } | 1585 | } |
1536 | 1586 | ||
1537 | |||
1538 | |||
1539 | /* This is relatively thorough. But then again it is only 20 lines. */ | 1587 | /* This is relatively thorough. But then again it is only 20 lines. */ |
1540 | #define MARCHUP for (i=min;i<max;i++) | 1588 | #define MARCHUP for (i = min; i < max; i++) |
1541 | #define MARCHDOWN for (i=max-1;i>=min;i--) | 1589 | #define MARCHDOWN for (i = max - 1; i >= min; i--) |
1542 | #define W0 write_sx_byte (board, i, 0x55) | 1590 | #define W0 write_sx_byte(board, i, 0x55) |
1543 | #define W1 write_sx_byte (board, i, 0xaa) | 1591 | #define W1 write_sx_byte(board, i, 0xaa) |
1544 | #define R0 if (read_sx_byte (board, i) != 0x55) return 1 | 1592 | #define R0 if (read_sx_byte(board, i) != 0x55) return 1 |
1545 | #define R1 if (read_sx_byte (board, i) != 0xaa) return 1 | 1593 | #define R1 if (read_sx_byte(board, i) != 0xaa) return 1 |
1546 | 1594 | ||
1547 | /* This memtest takes a human-noticable time. You normally only do it | 1595 | /* This memtest takes a human-noticable time. You normally only do it |
1548 | once a boot, so I guess that it is worth it. */ | 1596 | once a boot, so I guess that it is worth it. */ |
1549 | static int do_memtest (struct sx_board *board, int min, int max) | 1597 | static int do_memtest(struct sx_board *board, int min, int max) |
1550 | { | 1598 | { |
1551 | int i; | 1599 | int i; |
1552 | 1600 | ||
@@ -1555,16 +1603,37 @@ static int do_memtest (struct sx_board *board, int min, int max) | |||
1555 | intermittent errors. -- REW | 1603 | intermittent errors. -- REW |
1556 | (For the theory behind memory testing see: | 1604 | (For the theory behind memory testing see: |
1557 | Testing Semiconductor Memories by A.J. van de Goor.) */ | 1605 | Testing Semiconductor Memories by A.J. van de Goor.) */ |
1558 | MARCHUP {W0;} | 1606 | MARCHUP { |
1559 | MARCHUP {R0;W1;R1;W0;R0;W1;} | 1607 | W0; |
1560 | MARCHUP {R1;W0;W1;} | 1608 | } |
1561 | MARCHDOWN {R1;W0;W1;W0;} | 1609 | MARCHUP { |
1562 | MARCHDOWN {R0;W1;W0;} | 1610 | R0; |
1611 | W1; | ||
1612 | R1; | ||
1613 | W0; | ||
1614 | R0; | ||
1615 | W1; | ||
1616 | } | ||
1617 | MARCHUP { | ||
1618 | R1; | ||
1619 | W0; | ||
1620 | W1; | ||
1621 | } | ||
1622 | MARCHDOWN { | ||
1623 | R1; | ||
1624 | W0; | ||
1625 | W1; | ||
1626 | W0; | ||
1627 | } | ||
1628 | MARCHDOWN { | ||
1629 | R0; | ||
1630 | W1; | ||
1631 | W0; | ||
1632 | } | ||
1563 | 1633 | ||
1564 | return 0; | 1634 | return 0; |
1565 | } | 1635 | } |
1566 | 1636 | ||
1567 | |||
1568 | #undef MARCHUP | 1637 | #undef MARCHUP |
1569 | #undef MARCHDOWN | 1638 | #undef MARCHDOWN |
1570 | #undef W0 | 1639 | #undef W0 |
@@ -1572,33 +1641,54 @@ static int do_memtest (struct sx_board *board, int min, int max) | |||
1572 | #undef R0 | 1641 | #undef R0 |
1573 | #undef R1 | 1642 | #undef R1 |
1574 | 1643 | ||
1575 | #define MARCHUP for (i=min;i<max;i+=2) | 1644 | #define MARCHUP for (i = min; i < max; i += 2) |
1576 | #define MARCHDOWN for (i=max-1;i>=min;i-=2) | 1645 | #define MARCHDOWN for (i = max - 1; i >= min; i -= 2) |
1577 | #define W0 write_sx_word (board, i, 0x55aa) | 1646 | #define W0 write_sx_word(board, i, 0x55aa) |
1578 | #define W1 write_sx_word (board, i, 0xaa55) | 1647 | #define W1 write_sx_word(board, i, 0xaa55) |
1579 | #define R0 if (read_sx_word (board, i) != 0x55aa) return 1 | 1648 | #define R0 if (read_sx_word(board, i) != 0x55aa) return 1 |
1580 | #define R1 if (read_sx_word (board, i) != 0xaa55) return 1 | 1649 | #define R1 if (read_sx_word(board, i) != 0xaa55) return 1 |
1581 | 1650 | ||
1582 | #if 0 | 1651 | #if 0 |
1583 | /* This memtest takes a human-noticable time. You normally only do it | 1652 | /* This memtest takes a human-noticable time. You normally only do it |
1584 | once a boot, so I guess that it is worth it. */ | 1653 | once a boot, so I guess that it is worth it. */ |
1585 | static int do_memtest_w (struct sx_board *board, int min, int max) | 1654 | static int do_memtest_w(struct sx_board *board, int min, int max) |
1586 | { | 1655 | { |
1587 | int i; | 1656 | int i; |
1588 | 1657 | ||
1589 | MARCHUP {W0;} | 1658 | MARCHUP { |
1590 | MARCHUP {R0;W1;R1;W0;R0;W1;} | 1659 | W0; |
1591 | MARCHUP {R1;W0;W1;} | 1660 | } |
1592 | MARCHDOWN {R1;W0;W1;W0;} | 1661 | MARCHUP { |
1593 | MARCHDOWN {R0;W1;W0;} | 1662 | R0; |
1663 | W1; | ||
1664 | R1; | ||
1665 | W0; | ||
1666 | R0; | ||
1667 | W1; | ||
1668 | } | ||
1669 | MARCHUP { | ||
1670 | R1; | ||
1671 | W0; | ||
1672 | W1; | ||
1673 | } | ||
1674 | MARCHDOWN { | ||
1675 | R1; | ||
1676 | W0; | ||
1677 | W1; | ||
1678 | W0; | ||
1679 | } | ||
1680 | MARCHDOWN { | ||
1681 | R0; | ||
1682 | W1; | ||
1683 | W0; | ||
1684 | } | ||
1594 | 1685 | ||
1595 | return 0; | 1686 | return 0; |
1596 | } | 1687 | } |
1597 | #endif | 1688 | #endif |
1598 | 1689 | ||
1599 | 1690 | static int sx_fw_ioctl(struct inode *inode, struct file *filp, | |
1600 | static int sx_fw_ioctl (struct inode *inode, struct file *filp, | 1691 | unsigned int cmd, unsigned long arg) |
1601 | unsigned int cmd, unsigned long arg) | ||
1602 | { | 1692 | { |
1603 | int rc = 0; | 1693 | int rc = 0; |
1604 | int __user *descr = (int __user *)arg; | 1694 | int __user *descr = (int __user *)arg; |
@@ -1610,7 +1700,7 @@ static int sx_fw_ioctl (struct inode *inode, struct file *filp, | |||
1610 | 1700 | ||
1611 | func_enter(); | 1701 | func_enter(); |
1612 | 1702 | ||
1613 | #if 0 | 1703 | #if 0 |
1614 | /* Removed superuser check: Sysops can use the permissions on the device | 1704 | /* Removed superuser check: Sysops can use the permissions on the device |
1615 | file to restrict access. Recommendation: Root only. (root.root 600) */ | 1705 | file to restrict access. Recommendation: Root only. (root.root 600) */ |
1616 | if (!capable(CAP_SYS_ADMIN)) { | 1706 | if (!capable(CAP_SYS_ADMIN)) { |
@@ -1618,103 +1708,115 @@ static int sx_fw_ioctl (struct inode *inode, struct file *filp, | |||
1618 | } | 1708 | } |
1619 | #endif | 1709 | #endif |
1620 | 1710 | ||
1621 | sx_dprintk (SX_DEBUG_FIRMWARE, "IOCTL %x: %lx\n", cmd, arg); | 1711 | sx_dprintk(SX_DEBUG_FIRMWARE, "IOCTL %x: %lx\n", cmd, arg); |
1622 | 1712 | ||
1623 | if (!board) board = &boards[0]; | 1713 | if (!board) |
1714 | board = &boards[0]; | ||
1624 | if (board->flags & SX_BOARD_PRESENT) { | 1715 | if (board->flags & SX_BOARD_PRESENT) { |
1625 | sx_dprintk (SX_DEBUG_FIRMWARE, "Board present! (%x)\n", | 1716 | sx_dprintk(SX_DEBUG_FIRMWARE, "Board present! (%x)\n", |
1626 | board->flags); | 1717 | board->flags); |
1627 | } else { | 1718 | } else { |
1628 | sx_dprintk (SX_DEBUG_FIRMWARE, "Board not present! (%x) all:", | 1719 | sx_dprintk(SX_DEBUG_FIRMWARE, "Board not present! (%x) all:", |
1629 | board->flags); | 1720 | board->flags); |
1630 | for (i=0;i< SX_NBOARDS;i++) | 1721 | for (i = 0; i < SX_NBOARDS; i++) |
1631 | sx_dprintk (SX_DEBUG_FIRMWARE, "<%x> ", boards[i].flags); | 1722 | sx_dprintk(SX_DEBUG_FIRMWARE, "<%x> ", boards[i].flags); |
1632 | sx_dprintk (SX_DEBUG_FIRMWARE, "\n"); | 1723 | sx_dprintk(SX_DEBUG_FIRMWARE, "\n"); |
1633 | return -EIO; | 1724 | return -EIO; |
1634 | } | 1725 | } |
1635 | 1726 | ||
1636 | switch (cmd) { | 1727 | switch (cmd) { |
1637 | case SXIO_SET_BOARD: | 1728 | case SXIO_SET_BOARD: |
1638 | sx_dprintk (SX_DEBUG_FIRMWARE, "set board to %ld\n", arg); | 1729 | sx_dprintk(SX_DEBUG_FIRMWARE, "set board to %ld\n", arg); |
1639 | if (arg >= SX_NBOARDS) return -EIO; | 1730 | if (arg >= SX_NBOARDS) |
1640 | sx_dprintk (SX_DEBUG_FIRMWARE, "not out of range\n"); | 1731 | return -EIO; |
1641 | if (!(boards[arg].flags & SX_BOARD_PRESENT)) return -EIO; | 1732 | sx_dprintk(SX_DEBUG_FIRMWARE, "not out of range\n"); |
1642 | sx_dprintk (SX_DEBUG_FIRMWARE, ".. and present!\n"); | 1733 | if (!(boards[arg].flags & SX_BOARD_PRESENT)) |
1734 | return -EIO; | ||
1735 | sx_dprintk(SX_DEBUG_FIRMWARE, ".. and present!\n"); | ||
1643 | board = &boards[arg]; | 1736 | board = &boards[arg]; |
1644 | break; | 1737 | break; |
1645 | case SXIO_GET_TYPE: | 1738 | case SXIO_GET_TYPE: |
1646 | rc = -ENOENT; /* If we manage to miss one, return error. */ | 1739 | rc = -ENOENT; /* If we manage to miss one, return error. */ |
1647 | if (IS_SX_BOARD (board)) rc = SX_TYPE_SX; | 1740 | if (IS_SX_BOARD(board)) |
1648 | if (IS_CF_BOARD (board)) rc = SX_TYPE_CF; | 1741 | rc = SX_TYPE_SX; |
1649 | if (IS_SI_BOARD (board)) rc = SX_TYPE_SI; | 1742 | if (IS_CF_BOARD(board)) |
1650 | if (IS_SI1_BOARD (board)) rc = SX_TYPE_SI; | 1743 | rc = SX_TYPE_CF; |
1651 | if (IS_EISA_BOARD (board)) rc = SX_TYPE_SI; | 1744 | if (IS_SI_BOARD(board)) |
1652 | sx_dprintk (SX_DEBUG_FIRMWARE, "returning type= %d\n", rc); | 1745 | rc = SX_TYPE_SI; |
1746 | if (IS_SI1_BOARD(board)) | ||
1747 | rc = SX_TYPE_SI; | ||
1748 | if (IS_EISA_BOARD(board)) | ||
1749 | rc = SX_TYPE_SI; | ||
1750 | sx_dprintk(SX_DEBUG_FIRMWARE, "returning type= %d\n", rc); | ||
1653 | break; | 1751 | break; |
1654 | case SXIO_DO_RAMTEST: | 1752 | case SXIO_DO_RAMTEST: |
1655 | if (sx_initialized) /* Already initialized: better not ramtest the board. */ | 1753 | if (sx_initialized) /* Already initialized: better not ramtest the board. */ |
1656 | return -EPERM; | 1754 | return -EPERM; |
1657 | if (IS_SX_BOARD (board)) { | 1755 | if (IS_SX_BOARD(board)) { |
1658 | rc = do_memtest (board, 0, 0x7000); | 1756 | rc = do_memtest(board, 0, 0x7000); |
1659 | if (!rc) rc = do_memtest (board, 0, 0x7000); | 1757 | if (!rc) |
1660 | /*if (!rc) rc = do_memtest_w (board, 0, 0x7000);*/ | 1758 | rc = do_memtest(board, 0, 0x7000); |
1759 | /*if (!rc) rc = do_memtest_w (board, 0, 0x7000); */ | ||
1661 | } else { | 1760 | } else { |
1662 | rc = do_memtest (board, 0, 0x7ff8); | 1761 | rc = do_memtest(board, 0, 0x7ff8); |
1663 | /* if (!rc) rc = do_memtest_w (board, 0, 0x7ff8); */ | 1762 | /* if (!rc) rc = do_memtest_w (board, 0, 0x7ff8); */ |
1664 | } | 1763 | } |
1665 | sx_dprintk (SX_DEBUG_FIRMWARE, "returning memtest result= %d\n", rc); | 1764 | sx_dprintk(SX_DEBUG_FIRMWARE, "returning memtest result= %d\n", |
1765 | rc); | ||
1666 | break; | 1766 | break; |
1667 | case SXIO_DOWNLOAD: | 1767 | case SXIO_DOWNLOAD: |
1668 | if (sx_initialized) /* Already initialized */ | 1768 | if (sx_initialized) /* Already initialized */ |
1669 | return -EEXIST; | 1769 | return -EEXIST; |
1670 | if (!sx_reset (board)) | 1770 | if (!sx_reset(board)) |
1671 | return -EIO; | 1771 | return -EIO; |
1672 | sx_dprintk (SX_DEBUG_INIT, "reset the board...\n"); | 1772 | sx_dprintk(SX_DEBUG_INIT, "reset the board...\n"); |
1673 | 1773 | ||
1674 | tmp = kmalloc (SX_CHUNK_SIZE, GFP_USER); | 1774 | tmp = kmalloc(SX_CHUNK_SIZE, GFP_USER); |
1675 | if (!tmp) return -ENOMEM; | 1775 | if (!tmp) |
1676 | get_user (nbytes, descr++); | 1776 | return -ENOMEM; |
1677 | get_user (offset, descr++); | 1777 | get_user(nbytes, descr++); |
1678 | get_user (data, descr++); | 1778 | get_user(offset, descr++); |
1779 | get_user(data, descr++); | ||
1679 | while (nbytes && data) { | 1780 | while (nbytes && data) { |
1680 | for (i=0;i<nbytes;i += SX_CHUNK_SIZE) { | 1781 | for (i = 0; i < nbytes; i += SX_CHUNK_SIZE) { |
1681 | if (copy_from_user(tmp, (char __user *)data+i, | 1782 | if (copy_from_user(tmp, (char __user *)data + i, |
1682 | (i + SX_CHUNK_SIZE > | 1783 | (i + SX_CHUNK_SIZE > nbytes) ? |
1683 | nbytes) ? nbytes - i : | 1784 | nbytes - i : SX_CHUNK_SIZE)) { |
1684 | SX_CHUNK_SIZE)) { | 1785 | kfree(tmp); |
1685 | kfree (tmp); | ||
1686 | return -EFAULT; | 1786 | return -EFAULT; |
1687 | } | 1787 | } |
1688 | memcpy_toio(board->base2 + offset + i, tmp, | 1788 | memcpy_toio(board->base2 + offset + i, tmp, |
1689 | (i+SX_CHUNK_SIZE>nbytes)?nbytes-i:SX_CHUNK_SIZE); | 1789 | (i + SX_CHUNK_SIZE > nbytes) ? |
1790 | nbytes - i : SX_CHUNK_SIZE); | ||
1690 | } | 1791 | } |
1691 | 1792 | ||
1692 | get_user (nbytes, descr++); | 1793 | get_user(nbytes, descr++); |
1693 | get_user (offset, descr++); | 1794 | get_user(offset, descr++); |
1694 | get_user (data, descr++); | 1795 | get_user(data, descr++); |
1695 | } | 1796 | } |
1696 | kfree (tmp); | 1797 | kfree(tmp); |
1697 | sx_nports += sx_init_board (board); | 1798 | sx_nports += sx_init_board(board); |
1698 | rc = sx_nports; | 1799 | rc = sx_nports; |
1699 | break; | 1800 | break; |
1700 | case SXIO_INIT: | 1801 | case SXIO_INIT: |
1701 | if (sx_initialized) /* Already initialized */ | 1802 | if (sx_initialized) /* Already initialized */ |
1702 | return -EEXIST; | 1803 | return -EEXIST; |
1703 | /* This is not allowed until all boards are initialized... */ | 1804 | /* This is not allowed until all boards are initialized... */ |
1704 | for (i=0;i<SX_NBOARDS;i++) { | 1805 | for (i = 0; i < SX_NBOARDS; i++) { |
1705 | if ( (boards[i].flags & SX_BOARD_PRESENT) && | 1806 | if ((boards[i].flags & SX_BOARD_PRESENT) && |
1706 | !(boards[i].flags & SX_BOARD_INITIALIZED)) | 1807 | !(boards[i].flags & SX_BOARD_INITIALIZED)) |
1707 | return -EIO; | 1808 | return -EIO; |
1708 | } | 1809 | } |
1709 | for (i=0;i<SX_NBOARDS;i++) | 1810 | for (i = 0; i < SX_NBOARDS; i++) |
1710 | if (!(boards[i].flags & SX_BOARD_PRESENT)) break; | 1811 | if (!(boards[i].flags & SX_BOARD_PRESENT)) |
1711 | 1812 | break; | |
1712 | sx_dprintk (SX_DEBUG_FIRMWARE, "initing portstructs, %d boards, " | 1813 | |
1713 | "%d channels, first board: %d ports\n", | 1814 | sx_dprintk(SX_DEBUG_FIRMWARE, "initing portstructs, %d boards, " |
1714 | i, sx_nports, boards[0].nports); | 1815 | "%d channels, first board: %d ports\n", |
1715 | rc = sx_init_portstructs (i, sx_nports); | 1816 | i, sx_nports, boards[0].nports); |
1716 | sx_init_drivers (); | 1817 | rc = sx_init_portstructs(i, sx_nports); |
1717 | if (rc >= 0) | 1818 | sx_init_drivers(); |
1819 | if (rc >= 0) | ||
1718 | sx_initialized++; | 1820 | sx_initialized++; |
1719 | break; | 1821 | break; |
1720 | case SXIO_SETDEBUG: | 1822 | case SXIO_SETDEBUG: |
@@ -1731,32 +1833,32 @@ static int sx_fw_ioctl (struct inode *inode, struct file *filp, | |||
1731 | rc = sx_nports; | 1833 | rc = sx_nports; |
1732 | break; | 1834 | break; |
1733 | default: | 1835 | default: |
1734 | printk (KERN_WARNING "Unknown ioctl on firmware device (%x).\n", cmd); | 1836 | printk(KERN_WARNING "Unknown ioctl on firmware device (%x).\n", |
1837 | cmd); | ||
1735 | break; | 1838 | break; |
1736 | } | 1839 | } |
1737 | func_exit (); | 1840 | func_exit(); |
1738 | return rc; | 1841 | return rc; |
1739 | } | 1842 | } |
1740 | 1843 | ||
1741 | 1844 | static void sx_break(struct tty_struct *tty, int flag) | |
1742 | static void sx_break (struct tty_struct * tty, int flag) | ||
1743 | { | 1845 | { |
1744 | struct sx_port *port = tty->driver_data; | 1846 | struct sx_port *port = tty->driver_data; |
1745 | int rv; | 1847 | int rv; |
1746 | 1848 | ||
1747 | func_enter (); | 1849 | func_enter(); |
1748 | 1850 | ||
1749 | if (flag) | 1851 | if (flag) |
1750 | rv = sx_send_command (port, HS_START, -1, HS_IDLE_BREAK); | 1852 | rv = sx_send_command(port, HS_START, -1, HS_IDLE_BREAK); |
1751 | else | 1853 | else |
1752 | rv = sx_send_command (port, HS_STOP, -1, HS_IDLE_OPEN); | 1854 | rv = sx_send_command(port, HS_STOP, -1, HS_IDLE_OPEN); |
1753 | if (rv != 1) printk (KERN_ERR "sx: couldn't send break (%x).\n", | 1855 | if (rv != 1) |
1754 | read_sx_byte (port->board, CHAN_OFFSET (port, hi_hstat))); | 1856 | printk(KERN_ERR "sx: couldn't send break (%x).\n", |
1857 | read_sx_byte(port->board, CHAN_OFFSET(port, hi_hstat))); | ||
1755 | 1858 | ||
1756 | func_exit (); | 1859 | func_exit(); |
1757 | } | 1860 | } |
1758 | 1861 | ||
1759 | |||
1760 | static int sx_tiocmget(struct tty_struct *tty, struct file *file) | 1862 | static int sx_tiocmget(struct tty_struct *tty, struct file *file) |
1761 | { | 1863 | { |
1762 | struct sx_port *port = tty->driver_data; | 1864 | struct sx_port *port = tty->driver_data; |
@@ -1764,7 +1866,7 @@ static int sx_tiocmget(struct tty_struct *tty, struct file *file) | |||
1764 | } | 1866 | } |
1765 | 1867 | ||
1766 | static int sx_tiocmset(struct tty_struct *tty, struct file *file, | 1868 | static int sx_tiocmset(struct tty_struct *tty, struct file *file, |
1767 | unsigned int set, unsigned int clear) | 1869 | unsigned int set, unsigned int clear) |
1768 | { | 1870 | { |
1769 | struct sx_port *port = tty->driver_data; | 1871 | struct sx_port *port = tty->driver_data; |
1770 | int rts = -1, dtr = -1; | 1872 | int rts = -1, dtr = -1; |
@@ -1783,8 +1885,8 @@ static int sx_tiocmset(struct tty_struct *tty, struct file *file, | |||
1783 | return 0; | 1885 | return 0; |
1784 | } | 1886 | } |
1785 | 1887 | ||
1786 | static int sx_ioctl (struct tty_struct * tty, struct file * filp, | 1888 | static int sx_ioctl(struct tty_struct *tty, struct file *filp, |
1787 | unsigned int cmd, unsigned long arg) | 1889 | unsigned int cmd, unsigned long arg) |
1788 | { | 1890 | { |
1789 | int rc; | 1891 | int rc; |
1790 | struct sx_port *port = tty->driver_data; | 1892 | struct sx_port *port = tty->driver_data; |
@@ -1797,10 +1899,10 @@ static int sx_ioctl (struct tty_struct * tty, struct file * filp, | |||
1797 | switch (cmd) { | 1899 | switch (cmd) { |
1798 | case TIOCGSOFTCAR: | 1900 | case TIOCGSOFTCAR: |
1799 | rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), | 1901 | rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), |
1800 | (unsigned __user *) argp); | 1902 | (unsigned __user *)argp); |
1801 | break; | 1903 | break; |
1802 | case TIOCSSOFTCAR: | 1904 | case TIOCSSOFTCAR: |
1803 | if ((rc = get_user(ival, (unsigned __user *) argp)) == 0) { | 1905 | if ((rc = get_user(ival, (unsigned __user *)argp)) == 0) { |
1804 | tty->termios->c_cflag = | 1906 | tty->termios->c_cflag = |
1805 | (tty->termios->c_cflag & ~CLOCAL) | | 1907 | (tty->termios->c_cflag & ~CLOCAL) | |
1806 | (ival ? CLOCAL : 0); | 1908 | (ival ? CLOCAL : 0); |
@@ -1821,7 +1923,6 @@ static int sx_ioctl (struct tty_struct * tty, struct file * filp, | |||
1821 | return rc; | 1923 | return rc; |
1822 | } | 1924 | } |
1823 | 1925 | ||
1824 | |||
1825 | /* The throttle/unthrottle scheme for the Specialix card is different | 1926 | /* The throttle/unthrottle scheme for the Specialix card is different |
1826 | * from other drivers and deserves some explanation. | 1927 | * from other drivers and deserves some explanation. |
1827 | * The Specialix hardware takes care of XON/XOFF | 1928 | * The Specialix hardware takes care of XON/XOFF |
@@ -1838,7 +1939,7 @@ static int sx_ioctl (struct tty_struct * tty, struct file * filp, | |||
1838 | * flow control scheme is in use for that port. -- Simon Allen | 1939 | * flow control scheme is in use for that port. -- Simon Allen |
1839 | */ | 1940 | */ |
1840 | 1941 | ||
1841 | static void sx_throttle (struct tty_struct * tty) | 1942 | static void sx_throttle(struct tty_struct *tty) |
1842 | { | 1943 | { |
1843 | struct sx_port *port = (struct sx_port *)tty->driver_data; | 1944 | struct sx_port *port = (struct sx_port *)tty->driver_data; |
1844 | 1945 | ||
@@ -1846,14 +1947,13 @@ static void sx_throttle (struct tty_struct * tty) | |||
1846 | /* If the port is using any type of input flow | 1947 | /* If the port is using any type of input flow |
1847 | * control then throttle the port. | 1948 | * control then throttle the port. |
1848 | */ | 1949 | */ |
1849 | if((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty)) ) { | 1950 | if ((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty))) { |
1850 | port->gs.flags |= SX_RX_THROTTLE; | 1951 | port->gs.flags |= SX_RX_THROTTLE; |
1851 | } | 1952 | } |
1852 | func_exit(); | 1953 | func_exit(); |
1853 | } | 1954 | } |
1854 | 1955 | ||
1855 | 1956 | static void sx_unthrottle(struct tty_struct *tty) | |
1856 | static void sx_unthrottle (struct tty_struct * tty) | ||
1857 | { | 1957 | { |
1858 | struct sx_port *port = (struct sx_port *)tty->driver_data; | 1958 | struct sx_port *port = (struct sx_port *)tty->driver_data; |
1859 | 1959 | ||
@@ -1867,15 +1967,11 @@ static void sx_unthrottle (struct tty_struct * tty) | |||
1867 | return; | 1967 | return; |
1868 | } | 1968 | } |
1869 | 1969 | ||
1870 | |||
1871 | /* ********************************************************************** * | 1970 | /* ********************************************************************** * |
1872 | * Here are the initialization routines. * | 1971 | * Here are the initialization routines. * |
1873 | * ********************************************************************** */ | 1972 | * ********************************************************************** */ |
1874 | 1973 | ||
1875 | 1974 | static int sx_init_board(struct sx_board *board) | |
1876 | |||
1877 | |||
1878 | static int sx_init_board (struct sx_board *board) | ||
1879 | { | 1975 | { |
1880 | int addr; | 1976 | int addr; |
1881 | int chans; | 1977 | int chans; |
@@ -1887,36 +1983,38 @@ static int sx_init_board (struct sx_board *board) | |||
1887 | 1983 | ||
1888 | board->flags |= SX_BOARD_INITIALIZED; | 1984 | board->flags |= SX_BOARD_INITIALIZED; |
1889 | 1985 | ||
1890 | if (read_sx_byte (board, 0)) | 1986 | if (read_sx_byte(board, 0)) |
1891 | /* CF boards may need this. */ | 1987 | /* CF boards may need this. */ |
1892 | write_sx_byte(board,0, 0); | 1988 | write_sx_byte(board, 0, 0); |
1893 | 1989 | ||
1894 | /* This resets the processor again, to make sure it didn't do any | 1990 | /* This resets the processor again, to make sure it didn't do any |
1895 | foolish things while we were downloading the image */ | 1991 | foolish things while we were downloading the image */ |
1896 | if (!sx_reset (board)) | 1992 | if (!sx_reset(board)) |
1897 | return 0; | 1993 | return 0; |
1898 | 1994 | ||
1899 | sx_start_board (board); | 1995 | sx_start_board(board); |
1900 | udelay (10); | 1996 | udelay(10); |
1901 | if (!sx_busy_wait_neq (board, 0, 0xff, 0)) { | 1997 | if (!sx_busy_wait_neq(board, 0, 0xff, 0)) { |
1902 | printk (KERN_ERR "sx: Ooops. Board won't initialize.\n"); | 1998 | printk(KERN_ERR "sx: Ooops. Board won't initialize.\n"); |
1903 | return 0; | 1999 | return 0; |
1904 | } | 2000 | } |
1905 | 2001 | ||
1906 | /* Ok. So now the processor on the card is running. It gathered | 2002 | /* Ok. So now the processor on the card is running. It gathered |
1907 | some info for us... */ | 2003 | some info for us... */ |
1908 | sx_dprintk (SX_DEBUG_INIT, "The sxcard structure:\n"); | 2004 | sx_dprintk(SX_DEBUG_INIT, "The sxcard structure:\n"); |
1909 | if (sx_debug & SX_DEBUG_INIT) my_hd_io (board->base, 0x10); | 2005 | if (sx_debug & SX_DEBUG_INIT) |
1910 | sx_dprintk (SX_DEBUG_INIT, "the first sx_module structure:\n"); | 2006 | my_hd_io(board->base, 0x10); |
1911 | if (sx_debug & SX_DEBUG_INIT) my_hd_io (board->base + 0x80, 0x30); | 2007 | sx_dprintk(SX_DEBUG_INIT, "the first sx_module structure:\n"); |
1912 | 2008 | if (sx_debug & SX_DEBUG_INIT) | |
1913 | sx_dprintk (SX_DEBUG_INIT, | 2009 | my_hd_io(board->base + 0x80, 0x30); |
1914 | "init_status: %x, %dk memory, firmware V%x.%02x,\n", | 2010 | |
1915 | read_sx_byte (board, 0), read_sx_byte(board, 1), | 2011 | sx_dprintk(SX_DEBUG_INIT, "init_status: %x, %dk memory, firmware " |
1916 | read_sx_byte (board, 5), read_sx_byte(board, 4)); | 2012 | "V%x.%02x,\n", |
1917 | 2013 | read_sx_byte(board, 0), read_sx_byte(board, 1), | |
1918 | if (read_sx_byte (board, 0) == 0xff) { | 2014 | read_sx_byte(board, 5), read_sx_byte(board, 4)); |
1919 | printk (KERN_INFO "sx: No modules found. Sorry.\n"); | 2015 | |
2016 | if (read_sx_byte(board, 0) == 0xff) { | ||
2017 | printk(KERN_INFO "sx: No modules found. Sorry.\n"); | ||
1920 | board->nports = 0; | 2018 | board->nports = 0; |
1921 | return 0; | 2019 | return 0; |
1922 | } | 2020 | } |
@@ -1924,81 +2022,97 @@ static int sx_init_board (struct sx_board *board) | |||
1924 | chans = 0; | 2022 | chans = 0; |
1925 | 2023 | ||
1926 | if (IS_SX_BOARD(board)) { | 2024 | if (IS_SX_BOARD(board)) { |
1927 | sx_write_board_word (board, cc_int_count, sx_maxints); | 2025 | sx_write_board_word(board, cc_int_count, sx_maxints); |
1928 | } else { | 2026 | } else { |
1929 | if (sx_maxints) | 2027 | if (sx_maxints) |
1930 | sx_write_board_word (board, cc_int_count, SI_PROCESSOR_CLOCK/8/sx_maxints); | 2028 | sx_write_board_word(board, cc_int_count, |
2029 | SI_PROCESSOR_CLOCK / 8 / sx_maxints); | ||
1931 | } | 2030 | } |
1932 | 2031 | ||
1933 | /* grab the first module type... */ | 2032 | /* grab the first module type... */ |
1934 | /* board->ta_type = mod_compat_type (read_sx_byte (board, 0x80 + 0x08)); */ | 2033 | /* board->ta_type = mod_compat_type (read_sx_byte (board, 0x80 + 0x08)); */ |
1935 | board->ta_type = mod_compat_type (sx_read_module_byte (board, 0x80, mc_chip)); | 2034 | board->ta_type = mod_compat_type(sx_read_module_byte(board, 0x80, |
2035 | mc_chip)); | ||
1936 | 2036 | ||
1937 | /* XXX byteorder */ | 2037 | /* XXX byteorder */ |
1938 | for (addr = 0x80;addr != 0;addr = read_sx_word (board, addr) & 0x7fff) { | 2038 | for (addr = 0x80; addr != 0; addr = read_sx_word(board, addr) & 0x7fff){ |
1939 | type = sx_read_module_byte (board, addr, mc_chip); | 2039 | type = sx_read_module_byte(board, addr, mc_chip); |
1940 | sx_dprintk (SX_DEBUG_INIT, "Module at %x: %d channels\n", | 2040 | sx_dprintk(SX_DEBUG_INIT, "Module at %x: %d channels\n", |
1941 | addr, read_sx_byte (board, addr + 2)); | 2041 | addr, read_sx_byte(board, addr + 2)); |
1942 | 2042 | ||
1943 | chans += sx_read_module_byte (board, addr, mc_type); | 2043 | chans += sx_read_module_byte(board, addr, mc_type); |
1944 | 2044 | ||
1945 | sx_dprintk (SX_DEBUG_INIT, "module is an %s, which has %s/%s panels\n", | 2045 | sx_dprintk(SX_DEBUG_INIT, "module is an %s, which has %s/%s " |
1946 | mod_type_s (type), | 2046 | "panels\n", |
1947 | pan_type_s (sx_read_module_byte (board, addr, mc_mods) & 0xf), | 2047 | mod_type_s(type), |
1948 | pan_type_s (sx_read_module_byte (board, addr, mc_mods) >> 4)); | 2048 | pan_type_s(sx_read_module_byte(board, addr, |
1949 | 2049 | mc_mods) & 0xf), | |
1950 | sx_dprintk (SX_DEBUG_INIT, "CD1400 versions: %x/%x, ASIC version: %x\n", | 2050 | pan_type_s(sx_read_module_byte(board, addr, |
1951 | sx_read_module_byte (board, addr, mc_rev1), | 2051 | mc_mods) >> 4)); |
1952 | sx_read_module_byte (board, addr, mc_rev2), | 2052 | |
1953 | sx_read_module_byte (board, addr, mc_mtaasic_rev)); | 2053 | sx_dprintk(SX_DEBUG_INIT, "CD1400 versions: %x/%x, ASIC " |
2054 | "version: %x\n", | ||
2055 | sx_read_module_byte(board, addr, mc_rev1), | ||
2056 | sx_read_module_byte(board, addr, mc_rev2), | ||
2057 | sx_read_module_byte(board, addr, mc_mtaasic_rev)); | ||
1954 | 2058 | ||
1955 | /* The following combinations are illegal: It should theoretically | 2059 | /* The following combinations are illegal: It should theoretically |
1956 | work, but timing problems make the bus HANG. */ | 2060 | work, but timing problems make the bus HANG. */ |
1957 | 2061 | ||
1958 | if (mod_compat_type (type) != board->ta_type) { | 2062 | if (mod_compat_type(type) != board->ta_type) { |
1959 | printk (KERN_ERR "sx: This is an invalid configuration.\n" | 2063 | printk(KERN_ERR "sx: This is an invalid " |
1960 | "Don't mix TA/MTA/SXDC on the same hostadapter.\n"); | 2064 | "configuration.\nDon't mix TA/MTA/SXDC on the " |
1961 | chans=0; | 2065 | "same hostadapter.\n"); |
2066 | chans = 0; | ||
1962 | break; | 2067 | break; |
1963 | } | 2068 | } |
1964 | if ((IS_EISA_BOARD(board) || | 2069 | if ((IS_EISA_BOARD(board) || |
1965 | IS_SI_BOARD(board)) && (mod_compat_type(type) == 4)) { | 2070 | IS_SI_BOARD(board)) && |
1966 | printk (KERN_ERR "sx: This is an invalid configuration.\n" | 2071 | (mod_compat_type(type) == 4)) { |
1967 | "Don't use SXDCs on an SI/XIO adapter.\n"); | 2072 | printk(KERN_ERR "sx: This is an invalid " |
1968 | chans=0; | 2073 | "configuration.\nDon't use SXDCs on an SI/XIO " |
2074 | "adapter.\n"); | ||
2075 | chans = 0; | ||
1969 | break; | 2076 | break; |
1970 | } | 2077 | } |
1971 | #if 0 /* Problem fixed: firmware 3.05 */ | 2078 | #if 0 /* Problem fixed: firmware 3.05 */ |
1972 | if (IS_SX_BOARD(board) && (type == TA8)) { | 2079 | if (IS_SX_BOARD(board) && (type == TA8)) { |
1973 | /* There are some issues with the firmware and the DCD/RTS | 2080 | /* There are some issues with the firmware and the DCD/RTS |
1974 | lines. It might work if you tie them together or something. | 2081 | lines. It might work if you tie them together or something. |
1975 | It might also work if you get a newer sx_firmware. Therefore | 2082 | It might also work if you get a newer sx_firmware. Therefore |
1976 | this is just a warning. */ | 2083 | this is just a warning. */ |
1977 | printk (KERN_WARNING "sx: The SX host doesn't work too well " | 2084 | printk(KERN_WARNING |
1978 | "with the TA8 adapters.\nSpecialix is working on it.\n"); | 2085 | "sx: The SX host doesn't work too well " |
2086 | "with the TA8 adapters.\nSpecialix is working on it.\n"); | ||
1979 | } | 2087 | } |
1980 | #endif | 2088 | #endif |
1981 | } | 2089 | } |
1982 | 2090 | ||
1983 | if (chans) { | 2091 | if (chans) { |
1984 | if(board->irq > 0) { | 2092 | if (board->irq > 0) { |
1985 | /* fixed irq, probably PCI */ | 2093 | /* fixed irq, probably PCI */ |
1986 | if(sx_irqmask & (1 << board->irq)) { /* may we use this irq? */ | 2094 | if (sx_irqmask & (1 << board->irq)) { /* may we use this irq? */ |
1987 | if(request_irq(board->irq, sx_interrupt, IRQF_SHARED | IRQF_DISABLED, "sx", board)) { | 2095 | if (request_irq(board->irq, sx_interrupt, |
1988 | printk(KERN_ERR "sx: Cannot allocate irq %d.\n", board->irq); | 2096 | IRQF_SHARED | IRQF_DISABLED, |
2097 | "sx", board)) { | ||
2098 | printk(KERN_ERR "sx: Cannot allocate " | ||
2099 | "irq %d.\n", board->irq); | ||
1989 | board->irq = 0; | 2100 | board->irq = 0; |
1990 | } | 2101 | } |
1991 | } else | 2102 | } else |
1992 | board->irq = 0; | 2103 | board->irq = 0; |
1993 | } else if(board->irq < 0 && sx_irqmask) { | 2104 | } else if (board->irq < 0 && sx_irqmask) { |
1994 | /* auto-allocate irq */ | 2105 | /* auto-allocate irq */ |
1995 | int irqnr; | 2106 | int irqnr; |
1996 | int irqmask = sx_irqmask & (IS_SX_BOARD(board) ? SX_ISA_IRQ_MASK : SI2_ISA_IRQ_MASK); | 2107 | int irqmask = sx_irqmask & (IS_SX_BOARD(board) ? |
1997 | for(irqnr = 15; irqnr > 0; irqnr--) | 2108 | SX_ISA_IRQ_MASK : SI2_ISA_IRQ_MASK); |
1998 | if(irqmask & (1 << irqnr)) | 2109 | for (irqnr = 15; irqnr > 0; irqnr--) |
1999 | if(! request_irq(irqnr, sx_interrupt, IRQF_SHARED | IRQF_DISABLED, "sx", board)) | 2110 | if (irqmask & (1 << irqnr)) |
2111 | if (!request_irq(irqnr, sx_interrupt, | ||
2112 | IRQF_SHARED | IRQF_DISABLED, | ||
2113 | "sx", board)) | ||
2000 | break; | 2114 | break; |
2001 | if(! irqnr) | 2115 | if (!irqnr) |
2002 | printk(KERN_ERR "sx: Cannot allocate IRQ.\n"); | 2116 | printk(KERN_ERR "sx: Cannot allocate IRQ.\n"); |
2003 | board->irq = irqnr; | 2117 | board->irq = irqnr; |
2004 | } else | 2118 | } else |
@@ -2006,52 +2120,52 @@ static int sx_init_board (struct sx_board *board) | |||
2006 | 2120 | ||
2007 | if (board->irq) { | 2121 | if (board->irq) { |
2008 | /* Found a valid interrupt, start up interrupts! */ | 2122 | /* Found a valid interrupt, start up interrupts! */ |
2009 | sx_dprintk (SX_DEBUG_INIT, "Using irq %d.\n", board->irq); | 2123 | sx_dprintk(SX_DEBUG_INIT, "Using irq %d.\n", |
2010 | sx_start_interrupts (board); | 2124 | board->irq); |
2125 | sx_start_interrupts(board); | ||
2011 | board->poll = sx_slowpoll; | 2126 | board->poll = sx_slowpoll; |
2012 | board->flags |= SX_IRQ_ALLOCATED; | 2127 | board->flags |= SX_IRQ_ALLOCATED; |
2013 | } else { | 2128 | } else { |
2014 | /* no irq: setup board for polled operation */ | 2129 | /* no irq: setup board for polled operation */ |
2015 | board->poll = sx_poll; | 2130 | board->poll = sx_poll; |
2016 | sx_dprintk (SX_DEBUG_INIT, "Using poll-interval %d.\n", board->poll); | 2131 | sx_dprintk(SX_DEBUG_INIT, "Using poll-interval %d.\n", |
2132 | board->poll); | ||
2017 | } | 2133 | } |
2018 | 2134 | ||
2019 | /* The timer should be initialized anyway: That way we can safely | 2135 | /* The timer should be initialized anyway: That way we can |
2020 | del_timer it when the module is unloaded. */ | 2136 | safely del_timer it when the module is unloaded. */ |
2021 | init_timer (&board->timer); | 2137 | init_timer(&board->timer); |
2022 | 2138 | ||
2023 | if (board->poll) { | 2139 | if (board->poll) { |
2024 | board->timer.data = (unsigned long) board; | 2140 | board->timer.data = (unsigned long)board; |
2025 | board->timer.function = sx_pollfunc; | 2141 | board->timer.function = sx_pollfunc; |
2026 | board->timer.expires = jiffies + board->poll; | 2142 | board->timer.expires = jiffies + board->poll; |
2027 | add_timer (&board->timer); | 2143 | add_timer(&board->timer); |
2028 | } | 2144 | } |
2029 | } else { | 2145 | } else { |
2030 | board->irq = 0; | 2146 | board->irq = 0; |
2031 | } | 2147 | } |
2032 | 2148 | ||
2033 | board->nports = chans; | 2149 | board->nports = chans; |
2034 | sx_dprintk (SX_DEBUG_INIT, "returning %d ports.", board->nports); | 2150 | sx_dprintk(SX_DEBUG_INIT, "returning %d ports.", board->nports); |
2035 | 2151 | ||
2036 | func_exit(); | 2152 | func_exit(); |
2037 | return chans; | 2153 | return chans; |
2038 | } | 2154 | } |
2039 | 2155 | ||
2040 | |||
2041 | static void __devinit printheader(void) | 2156 | static void __devinit printheader(void) |
2042 | { | 2157 | { |
2043 | static int header_printed; | 2158 | static int header_printed; |
2044 | 2159 | ||
2045 | if (!header_printed) { | 2160 | if (!header_printed) { |
2046 | printk (KERN_INFO "Specialix SX driver " | 2161 | printk(KERN_INFO "Specialix SX driver " |
2047 | "(C) 1998/1999 R.E.Wolff@BitWizard.nl \n"); | 2162 | "(C) 1998/1999 R.E.Wolff@BitWizard.nl\n"); |
2048 | printk (KERN_INFO "sx: version " __stringify(SX_VERSION) "\n"); | 2163 | printk(KERN_INFO "sx: version " __stringify(SX_VERSION) "\n"); |
2049 | header_printed = 1; | 2164 | header_printed = 1; |
2050 | } | 2165 | } |
2051 | } | 2166 | } |
2052 | 2167 | ||
2053 | 2168 | static int __devinit probe_sx(struct sx_board *board) | |
2054 | static int __devinit probe_sx (struct sx_board *board) | ||
2055 | { | 2169 | { |
2056 | struct vpd_prom vpdp; | 2170 | struct vpd_prom vpdp; |
2057 | char *p; | 2171 | char *p; |
@@ -2059,51 +2173,57 @@ static int __devinit probe_sx (struct sx_board *board) | |||
2059 | 2173 | ||
2060 | func_enter(); | 2174 | func_enter(); |
2061 | 2175 | ||
2062 | if (!IS_CF_BOARD (board)) { | 2176 | if (!IS_CF_BOARD(board)) { |
2063 | sx_dprintk (SX_DEBUG_PROBE, "Going to verify vpd prom at %p.\n", | 2177 | sx_dprintk(SX_DEBUG_PROBE, "Going to verify vpd prom at %p.\n", |
2064 | board->base + SX_VPD_ROM); | 2178 | board->base + SX_VPD_ROM); |
2065 | 2179 | ||
2066 | if (sx_debug & SX_DEBUG_PROBE) | 2180 | if (sx_debug & SX_DEBUG_PROBE) |
2067 | my_hd_io(board->base + SX_VPD_ROM, 0x40); | 2181 | my_hd_io(board->base + SX_VPD_ROM, 0x40); |
2068 | 2182 | ||
2069 | p = (char *) &vpdp; | 2183 | p = (char *)&vpdp; |
2070 | for (i=0;i< sizeof (struct vpd_prom);i++) | 2184 | for (i = 0; i < sizeof(struct vpd_prom); i++) |
2071 | *p++ = read_sx_byte (board, SX_VPD_ROM + i*2); | 2185 | *p++ = read_sx_byte(board, SX_VPD_ROM + i * 2); |
2072 | 2186 | ||
2073 | if (sx_debug & SX_DEBUG_PROBE) | 2187 | if (sx_debug & SX_DEBUG_PROBE) |
2074 | my_hd (&vpdp, 0x20); | 2188 | my_hd(&vpdp, 0x20); |
2075 | 2189 | ||
2076 | sx_dprintk (SX_DEBUG_PROBE, "checking identifier...\n"); | 2190 | sx_dprintk(SX_DEBUG_PROBE, "checking identifier...\n"); |
2077 | 2191 | ||
2078 | if (strncmp (vpdp.identifier, SX_VPD_IDENT_STRING, 16) != 0) { | 2192 | if (strncmp(vpdp.identifier, SX_VPD_IDENT_STRING, 16) != 0) { |
2079 | sx_dprintk (SX_DEBUG_PROBE, "Got non-SX identifier: '%s'\n", | 2193 | sx_dprintk(SX_DEBUG_PROBE, "Got non-SX identifier: " |
2080 | vpdp.identifier); | 2194 | "'%s'\n", vpdp.identifier); |
2081 | return 0; | 2195 | return 0; |
2082 | } | 2196 | } |
2083 | } | 2197 | } |
2084 | 2198 | ||
2085 | printheader (); | 2199 | printheader(); |
2086 | |||
2087 | if (!IS_CF_BOARD (board)) { | ||
2088 | printk (KERN_DEBUG "sx: Found an SX board at %lx\n", board->hw_base); | ||
2089 | printk (KERN_DEBUG "sx: hw_rev: %d, assembly level: %d, uniq ID:%08x, ", | ||
2090 | vpdp.hwrev, vpdp.hwass, vpdp.uniqid); | ||
2091 | printk ( "Manufactured: %d/%d\n", | ||
2092 | 1970 + vpdp.myear, vpdp.mweek); | ||
2093 | 2200 | ||
2201 | if (!IS_CF_BOARD(board)) { | ||
2202 | printk(KERN_DEBUG "sx: Found an SX board at %lx\n", | ||
2203 | board->hw_base); | ||
2204 | printk(KERN_DEBUG "sx: hw_rev: %d, assembly level: %d, " | ||
2205 | "uniq ID:%08x, ", | ||
2206 | vpdp.hwrev, vpdp.hwass, vpdp.uniqid); | ||
2207 | printk("Manufactured: %d/%d\n", 1970 + vpdp.myear, vpdp.mweek); | ||
2094 | 2208 | ||
2095 | if ((((vpdp.uniqid >> 24) & SX_UNIQUEID_MASK) != SX_PCI_UNIQUEID1) && | 2209 | if ((((vpdp.uniqid >> 24) & SX_UNIQUEID_MASK) != |
2096 | (((vpdp.uniqid >> 24) & SX_UNIQUEID_MASK) != SX_ISA_UNIQUEID1)) { | 2210 | SX_PCI_UNIQUEID1) && (((vpdp.uniqid >> 24) & |
2097 | /* This might be a bit harsh. This was the primary reason the | 2211 | SX_UNIQUEID_MASK) != SX_ISA_UNIQUEID1)) { |
2098 | SX/ISA card didn't work at first... */ | 2212 | /* This might be a bit harsh. This was the primary |
2099 | printk (KERN_ERR "sx: Hmm. Not an SX/PCI or SX/ISA card. Sorry: giving up.\n"); | 2213 | reason the SX/ISA card didn't work at first... */ |
2214 | printk(KERN_ERR "sx: Hmm. Not an SX/PCI or SX/ISA " | ||
2215 | "card. Sorry: giving up.\n"); | ||
2100 | return (0); | 2216 | return (0); |
2101 | } | 2217 | } |
2102 | 2218 | ||
2103 | if (((vpdp.uniqid >> 24) & SX_UNIQUEID_MASK) == SX_ISA_UNIQUEID1) { | 2219 | if (((vpdp.uniqid >> 24) & SX_UNIQUEID_MASK) == |
2220 | SX_ISA_UNIQUEID1) { | ||
2104 | if (((unsigned long)board->hw_base) & 0x8000) { | 2221 | if (((unsigned long)board->hw_base) & 0x8000) { |
2105 | printk (KERN_WARNING "sx: Warning: There may be hardware problems with the card at %lx.\n", board->hw_base); | 2222 | printk(KERN_WARNING "sx: Warning: There may be " |
2106 | printk (KERN_WARNING "sx: Read sx.txt for more info.\n"); | 2223 | "hardware problems with the card at " |
2224 | "%lx.\n", board->hw_base); | ||
2225 | printk(KERN_WARNING "sx: Read sx.txt for more " | ||
2226 | "info.\n"); | ||
2107 | } | 2227 | } |
2108 | } | 2228 | } |
2109 | } | 2229 | } |
@@ -2111,9 +2231,9 @@ static int __devinit probe_sx (struct sx_board *board) | |||
2111 | board->nports = -1; | 2231 | board->nports = -1; |
2112 | 2232 | ||
2113 | /* This resets the processor, and keeps it off the bus. */ | 2233 | /* This resets the processor, and keeps it off the bus. */ |
2114 | if (!sx_reset (board)) | 2234 | if (!sx_reset(board)) |
2115 | return 0; | 2235 | return 0; |
2116 | sx_dprintk (SX_DEBUG_INIT, "reset the board...\n"); | 2236 | sx_dprintk(SX_DEBUG_INIT, "reset the board...\n"); |
2117 | 2237 | ||
2118 | func_exit(); | 2238 | func_exit(); |
2119 | return 1; | 2239 | return 1; |
@@ -2127,28 +2247,27 @@ static int __devinit probe_sx (struct sx_board *board) | |||
2127 | card. 0xe0000 and 0xf0000 are taken by the BIOS. That only leaves | 2247 | card. 0xe0000 and 0xf0000 are taken by the BIOS. That only leaves |
2128 | 0xc0000, 0xc8000, 0xd0000 and 0xd8000 . */ | 2248 | 0xc0000, 0xc8000, 0xd0000 and 0xd8000 . */ |
2129 | 2249 | ||
2130 | static int __devinit probe_si (struct sx_board *board) | 2250 | static int __devinit probe_si(struct sx_board *board) |
2131 | { | 2251 | { |
2132 | int i; | 2252 | int i; |
2133 | 2253 | ||
2134 | func_enter(); | 2254 | func_enter(); |
2135 | sx_dprintk (SX_DEBUG_PROBE, "Going to verify SI signature hw %lx at %p.\n", board->hw_base, | 2255 | sx_dprintk(SX_DEBUG_PROBE, "Going to verify SI signature hw %lx at " |
2136 | board->base + SI2_ISA_ID_BASE); | 2256 | "%p.\n", board->hw_base, board->base + SI2_ISA_ID_BASE); |
2137 | 2257 | ||
2138 | if (sx_debug & SX_DEBUG_PROBE) | 2258 | if (sx_debug & SX_DEBUG_PROBE) |
2139 | my_hd_io(board->base + SI2_ISA_ID_BASE, 0x8); | 2259 | my_hd_io(board->base + SI2_ISA_ID_BASE, 0x8); |
2140 | 2260 | ||
2141 | if (!IS_EISA_BOARD(board)) { | 2261 | if (!IS_EISA_BOARD(board)) { |
2142 | if( IS_SI1_BOARD(board) ) | 2262 | if (IS_SI1_BOARD(board)) { |
2143 | { | 2263 | for (i = 0; i < 8; i++) { |
2144 | for (i=0;i<8;i++) { | 2264 | write_sx_byte(board, SI2_ISA_ID_BASE + 7 - i,i); |
2145 | write_sx_byte (board, SI2_ISA_ID_BASE+7-i,i); | 2265 | } |
2146 | |||
2147 | } | 2266 | } |
2148 | } | 2267 | for (i = 0; i < 8; i++) { |
2149 | for (i=0;i<8;i++) { | 2268 | if ((read_sx_byte(board, SI2_ISA_ID_BASE + 7 - i) & 7) |
2150 | if ((read_sx_byte (board, SI2_ISA_ID_BASE+7-i) & 7) != i) { | 2269 | != i) { |
2151 | func_exit (); | 2270 | func_exit(); |
2152 | return 0; | 2271 | return 0; |
2153 | } | 2272 | } |
2154 | } | 2273 | } |
@@ -2158,20 +2277,20 @@ static int __devinit probe_si (struct sx_board *board) | |||
2158 | but to prevent trouble, we'd better double check that we don't | 2277 | but to prevent trouble, we'd better double check that we don't |
2159 | have an SI1 board when we're probing for an SI2 board.... */ | 2278 | have an SI1 board when we're probing for an SI2 board.... */ |
2160 | 2279 | ||
2161 | write_sx_byte (board, SI2_ISA_ID_BASE,0x10); | 2280 | write_sx_byte(board, SI2_ISA_ID_BASE, 0x10); |
2162 | if ( IS_SI1_BOARD(board)) { | 2281 | if (IS_SI1_BOARD(board)) { |
2163 | /* This should be an SI1 board, which has this | 2282 | /* This should be an SI1 board, which has this |
2164 | location writable... */ | 2283 | location writable... */ |
2165 | if (read_sx_byte (board, SI2_ISA_ID_BASE) != 0x10) { | 2284 | if (read_sx_byte(board, SI2_ISA_ID_BASE) != 0x10) { |
2166 | func_exit (); | 2285 | func_exit(); |
2167 | return 0; | 2286 | return 0; |
2168 | } | 2287 | } |
2169 | } else { | 2288 | } else { |
2170 | /* This should be an SI2 board, which has the bottom | 2289 | /* This should be an SI2 board, which has the bottom |
2171 | 3 bits non-writable... */ | 2290 | 3 bits non-writable... */ |
2172 | if (read_sx_byte (board, SI2_ISA_ID_BASE) == 0x10) { | 2291 | if (read_sx_byte(board, SI2_ISA_ID_BASE) == 0x10) { |
2173 | func_exit (); | 2292 | func_exit(); |
2174 | return 0; | 2293 | return 0; |
2175 | } | 2294 | } |
2176 | } | 2295 | } |
2177 | 2296 | ||
@@ -2179,35 +2298,35 @@ static int __devinit probe_si (struct sx_board *board) | |||
2179 | but to prevent trouble, we'd better double check that we don't | 2298 | but to prevent trouble, we'd better double check that we don't |
2180 | have an SI1 board when we're probing for an SI2 board.... */ | 2299 | have an SI1 board when we're probing for an SI2 board.... */ |
2181 | 2300 | ||
2182 | write_sx_byte (board, SI2_ISA_ID_BASE,0x10); | 2301 | write_sx_byte(board, SI2_ISA_ID_BASE, 0x10); |
2183 | if ( IS_SI1_BOARD(board)) { | 2302 | if (IS_SI1_BOARD(board)) { |
2184 | /* This should be an SI1 board, which has this | 2303 | /* This should be an SI1 board, which has this |
2185 | location writable... */ | 2304 | location writable... */ |
2186 | if (read_sx_byte (board, SI2_ISA_ID_BASE) != 0x10) { | 2305 | if (read_sx_byte(board, SI2_ISA_ID_BASE) != 0x10) { |
2187 | func_exit(); | 2306 | func_exit(); |
2188 | return 0; | 2307 | return 0; |
2189 | } | 2308 | } |
2190 | } else { | 2309 | } else { |
2191 | /* This should be an SI2 board, which has the bottom | 2310 | /* This should be an SI2 board, which has the bottom |
2192 | 3 bits non-writable... */ | 2311 | 3 bits non-writable... */ |
2193 | if (read_sx_byte (board, SI2_ISA_ID_BASE) == 0x10) { | 2312 | if (read_sx_byte(board, SI2_ISA_ID_BASE) == 0x10) { |
2194 | func_exit (); | 2313 | func_exit(); |
2195 | return 0; | 2314 | return 0; |
2196 | } | 2315 | } |
2197 | } | 2316 | } |
2198 | 2317 | ||
2199 | printheader (); | 2318 | printheader(); |
2200 | 2319 | ||
2201 | printk (KERN_DEBUG "sx: Found an SI board at %lx\n", board->hw_base); | 2320 | printk(KERN_DEBUG "sx: Found an SI board at %lx\n", board->hw_base); |
2202 | /* Compared to the SX boards, it is a complete guess as to what | 2321 | /* Compared to the SX boards, it is a complete guess as to what |
2203 | this card is up to... */ | 2322 | this card is up to... */ |
2204 | 2323 | ||
2205 | board->nports = -1; | 2324 | board->nports = -1; |
2206 | 2325 | ||
2207 | /* This resets the processor, and keeps it off the bus. */ | 2326 | /* This resets the processor, and keeps it off the bus. */ |
2208 | if (!sx_reset (board)) | 2327 | if (!sx_reset(board)) |
2209 | return 0; | 2328 | return 0; |
2210 | sx_dprintk (SX_DEBUG_INIT, "reset the board...\n"); | 2329 | sx_dprintk(SX_DEBUG_INIT, "reset the board...\n"); |
2211 | 2330 | ||
2212 | func_exit(); | 2331 | func_exit(); |
2213 | return 1; | 2332 | return 1; |
@@ -2216,7 +2335,7 @@ static int __devinit probe_si (struct sx_board *board) | |||
2216 | 2335 | ||
2217 | static const struct tty_operations sx_ops = { | 2336 | static const struct tty_operations sx_ops = { |
2218 | .break_ctl = sx_break, | 2337 | .break_ctl = sx_break, |
2219 | .open = sx_open, | 2338 | .open = sx_open, |
2220 | .close = gs_close, | 2339 | .close = gs_close, |
2221 | .write = gs_write, | 2340 | .write = gs_write, |
2222 | .put_char = gs_put_char, | 2341 | .put_char = gs_put_char, |
@@ -2251,8 +2370,7 @@ static int sx_init_drivers(void) | |||
2251 | sx_driver->type = TTY_DRIVER_TYPE_SERIAL; | 2370 | sx_driver->type = TTY_DRIVER_TYPE_SERIAL; |
2252 | sx_driver->subtype = SERIAL_TYPE_NORMAL; | 2371 | sx_driver->subtype = SERIAL_TYPE_NORMAL; |
2253 | sx_driver->init_termios = tty_std_termios; | 2372 | sx_driver->init_termios = tty_std_termios; |
2254 | sx_driver->init_termios.c_cflag = | 2373 | sx_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; |
2255 | B9600 | CS8 | CREAD | HUPCL | CLOCAL; | ||
2256 | sx_driver->init_termios.c_ispeed = 9600; | 2374 | sx_driver->init_termios.c_ispeed = 9600; |
2257 | sx_driver->init_termios.c_ospeed = 9600; | 2375 | sx_driver->init_termios.c_ospeed = 9600; |
2258 | sx_driver->flags = TTY_DRIVER_REAL_RAW; | 2376 | sx_driver->flags = TTY_DRIVER_REAL_RAW; |
@@ -2261,14 +2379,14 @@ static int sx_init_drivers(void) | |||
2261 | if ((error = tty_register_driver(sx_driver))) { | 2379 | if ((error = tty_register_driver(sx_driver))) { |
2262 | put_tty_driver(sx_driver); | 2380 | put_tty_driver(sx_driver); |
2263 | printk(KERN_ERR "sx: Couldn't register sx driver, error = %d\n", | 2381 | printk(KERN_ERR "sx: Couldn't register sx driver, error = %d\n", |
2264 | error); | 2382 | error); |
2265 | return 1; | 2383 | return 1; |
2266 | } | 2384 | } |
2267 | func_exit(); | 2385 | func_exit(); |
2268 | return 0; | 2386 | return 0; |
2269 | } | 2387 | } |
2270 | 2388 | ||
2271 | static int sx_init_portstructs (int nboards, int nports) | 2389 | static int sx_init_portstructs(int nboards, int nports) |
2272 | { | 2390 | { |
2273 | struct sx_board *board; | 2391 | struct sx_board *board; |
2274 | struct sx_port *port; | 2392 | struct sx_port *port; |
@@ -2279,7 +2397,8 @@ static int sx_init_portstructs (int nboards, int nports) | |||
2279 | func_enter(); | 2397 | func_enter(); |
2280 | 2398 | ||
2281 | /* Many drivers statically allocate the maximum number of ports | 2399 | /* Many drivers statically allocate the maximum number of ports |
2282 | There is no reason not to allocate them dynamically. Is there? -- REW */ | 2400 | There is no reason not to allocate them dynamically. |
2401 | Is there? -- REW */ | ||
2283 | sx_ports = kcalloc(nports, sizeof(struct sx_port), GFP_KERNEL); | 2402 | sx_ports = kcalloc(nports, sizeof(struct sx_port), GFP_KERNEL); |
2284 | if (!sx_ports) | 2403 | if (!sx_ports) |
2285 | return -ENOMEM; | 2404 | return -ENOMEM; |
@@ -2288,10 +2407,10 @@ static int sx_init_portstructs (int nboards, int nports) | |||
2288 | for (i = 0; i < nboards; i++) { | 2407 | for (i = 0; i < nboards; i++) { |
2289 | board = &boards[i]; | 2408 | board = &boards[i]; |
2290 | board->ports = port; | 2409 | board->ports = port; |
2291 | for (j=0; j < boards[i].nports;j++) { | 2410 | for (j = 0; j < boards[i].nports; j++) { |
2292 | sx_dprintk (SX_DEBUG_INIT, "initing port %d\n", j); | 2411 | sx_dprintk(SX_DEBUG_INIT, "initing port %d\n", j); |
2293 | port->gs.magic = SX_MAGIC; | 2412 | port->gs.magic = SX_MAGIC; |
2294 | port->gs.close_delay = HZ/2; | 2413 | port->gs.close_delay = HZ / 2; |
2295 | port->gs.closing_wait = 30 * HZ; | 2414 | port->gs.closing_wait = 30 * HZ; |
2296 | port->board = board; | 2415 | port->board = board; |
2297 | port->gs.rd = &sx_real_driver; | 2416 | port->gs.rd = &sx_real_driver; |
@@ -2303,8 +2422,8 @@ static int sx_init_portstructs (int nboards, int nports) | |||
2303 | * Initializing wait queue | 2422 | * Initializing wait queue |
2304 | */ | 2423 | */ |
2305 | init_waitqueue_head(&port->gs.open_wait); | 2424 | init_waitqueue_head(&port->gs.open_wait); |
2306 | init_waitqueue_head(&port->gs.close_wait); | 2425 | init_waitqueue_head(&port->gs.close_wait); |
2307 | 2426 | ||
2308 | port++; | 2427 | port++; |
2309 | } | 2428 | } |
2310 | } | 2429 | } |
@@ -2315,28 +2434,36 @@ static int sx_init_portstructs (int nboards, int nports) | |||
2315 | board = &boards[i]; | 2434 | board = &boards[i]; |
2316 | board->port_base = portno; | 2435 | board->port_base = portno; |
2317 | /* Possibly the configuration was rejected. */ | 2436 | /* Possibly the configuration was rejected. */ |
2318 | sx_dprintk (SX_DEBUG_PROBE, "Board has %d channels\n", board->nports); | 2437 | sx_dprintk(SX_DEBUG_PROBE, "Board has %d channels\n", |
2319 | if (board->nports <= 0) continue; | 2438 | board->nports); |
2439 | if (board->nports <= 0) | ||
2440 | continue; | ||
2320 | /* XXX byteorder ?? */ | 2441 | /* XXX byteorder ?? */ |
2321 | for (addr = 0x80;addr != 0;addr = read_sx_word (board, addr) & 0x7fff) { | 2442 | for (addr = 0x80; addr != 0; |
2322 | chans = sx_read_module_byte (board, addr, mc_type); | 2443 | addr = read_sx_word(board, addr) & 0x7fff) { |
2323 | sx_dprintk (SX_DEBUG_PROBE, "Module at %x: %d channels\n", addr, chans); | 2444 | chans = sx_read_module_byte(board, addr, mc_type); |
2324 | sx_dprintk (SX_DEBUG_PROBE, "Port at"); | 2445 | sx_dprintk(SX_DEBUG_PROBE, "Module at %x: %d " |
2325 | for (j=0;j<chans;j++) { | 2446 | "channels\n", addr, chans); |
2326 | /* The "sx-way" is the way it SHOULD be done. That way in the | 2447 | sx_dprintk(SX_DEBUG_PROBE, "Port at"); |
2327 | future, the firmware may for example pack the structures a bit | 2448 | for (j = 0; j < chans; j++) { |
2328 | more efficient. Neil tells me it isn't going to happen anytime | 2449 | /* The "sx-way" is the way it SHOULD be done. |
2329 | soon though. */ | 2450 | That way in the future, the firmware may for |
2451 | example pack the structures a bit more | ||
2452 | efficient. Neil tells me it isn't going to | ||
2453 | happen anytime soon though. */ | ||
2330 | if (IS_SX_BOARD(board)) | 2454 | if (IS_SX_BOARD(board)) |
2331 | port->ch_base = sx_read_module_word (board, addr+j*2, mc_chan_pointer); | 2455 | port->ch_base = sx_read_module_word( |
2456 | board, addr + j * 2, | ||
2457 | mc_chan_pointer); | ||
2332 | else | 2458 | else |
2333 | port->ch_base = addr + 0x100 + 0x300*j; | 2459 | port->ch_base = addr + 0x100 + 0x300 *j; |
2334 | 2460 | ||
2335 | sx_dprintk (SX_DEBUG_PROBE, " %x", port->ch_base); | 2461 | sx_dprintk(SX_DEBUG_PROBE, " %x", |
2462 | port->ch_base); | ||
2336 | port->line = portno++; | 2463 | port->line = portno++; |
2337 | port++; | 2464 | port++; |
2338 | } | 2465 | } |
2339 | sx_dprintk (SX_DEBUG_PROBE, "\n"); | 2466 | sx_dprintk(SX_DEBUG_PROBE, "\n"); |
2340 | } | 2467 | } |
2341 | /* This has to be done earlier. */ | 2468 | /* This has to be done earlier. */ |
2342 | /* board->flags |= SX_BOARD_INITIALIZED; */ | 2469 | /* board->flags |= SX_BOARD_INITIALIZED; */ |
@@ -2350,7 +2477,7 @@ static unsigned int sx_find_free_board(void) | |||
2350 | { | 2477 | { |
2351 | unsigned int i; | 2478 | unsigned int i; |
2352 | 2479 | ||
2353 | for (i = 0; i < SX_NBOARDS; i++) | 2480 | for (i = 0; i < SX_NBOARDS; i++) |
2354 | if (!(boards[i].flags & SX_BOARD_PRESENT)) | 2481 | if (!(boards[i].flags & SX_BOARD_PRESENT)) |
2355 | break; | 2482 | break; |
2356 | 2483 | ||
@@ -2378,7 +2505,7 @@ static void __devexit sx_remove_card(struct sx_board *board) | |||
2378 | del_timer(&board->timer); | 2505 | del_timer(&board->timer); |
2379 | iounmap(board->base); | 2506 | iounmap(board->base); |
2380 | 2507 | ||
2381 | board->flags &= ~(SX_BOARD_INITIALIZED|SX_BOARD_PRESENT); | 2508 | board->flags &= ~(SX_BOARD_INITIALIZED | SX_BOARD_PRESENT); |
2382 | } | 2509 | } |
2383 | } | 2510 | } |
2384 | 2511 | ||
@@ -2403,17 +2530,17 @@ static int __devinit sx_eisa_probe(struct device *dev) | |||
2403 | mutex_unlock(&sx_boards_lock); | 2530 | mutex_unlock(&sx_boards_lock); |
2404 | 2531 | ||
2405 | dev_info(dev, "XIO : Signature found in EISA slot %lu, " | 2532 | dev_info(dev, "XIO : Signature found in EISA slot %lu, " |
2406 | "Product %d Rev %d (REPORT THIS TO LKLM)\n", | 2533 | "Product %d Rev %d (REPORT THIS TO LKLM)\n", |
2407 | eisa_slot >> 12, | 2534 | eisa_slot >> 12, |
2408 | inb(eisa_slot + EISA_VENDOR_ID_OFFSET + 2), | 2535 | inb(eisa_slot + EISA_VENDOR_ID_OFFSET + 2), |
2409 | inb(eisa_slot + EISA_VENDOR_ID_OFFSET + 3)); | 2536 | inb(eisa_slot + EISA_VENDOR_ID_OFFSET + 3)); |
2410 | 2537 | ||
2411 | board->eisa_base = eisa_slot; | 2538 | board->eisa_base = eisa_slot; |
2412 | board->flags &= ~SX_BOARD_TYPE; | 2539 | board->flags &= ~SX_BOARD_TYPE; |
2413 | board->flags |= SI_EISA_BOARD; | 2540 | board->flags |= SI_EISA_BOARD; |
2414 | 2541 | ||
2415 | board->hw_base = ((inb(eisa_slot + 0xc01) << 8) + | 2542 | board->hw_base = ((inb(eisa_slot + 0xc01) << 8) + |
2416 | inb(eisa_slot + 0xc00)) << 16; | 2543 | inb(eisa_slot + 0xc00)) << 16; |
2417 | board->base2 = | 2544 | board->base2 = |
2418 | board->base = ioremap(board->hw_base, SI2_EISA_WINDOW_LEN); | 2545 | board->base = ioremap(board->hw_base, SI2_EISA_WINDOW_LEN); |
2419 | 2546 | ||
@@ -2448,6 +2575,7 @@ static struct eisa_device_id sx_eisa_tbl[] = { | |||
2448 | { "SLX" }, | 2575 | { "SLX" }, |
2449 | { "" } | 2576 | { "" } |
2450 | }; | 2577 | }; |
2578 | |||
2451 | MODULE_DEVICE_TABLE(eisa, sx_eisa_tbl); | 2579 | MODULE_DEVICE_TABLE(eisa, sx_eisa_tbl); |
2452 | 2580 | ||
2453 | static struct eisa_driver sx_eisadriver = { | 2581 | static struct eisa_driver sx_eisadriver = { |
@@ -2478,22 +2606,23 @@ static void __devinit fix_sx_pci(struct pci_dev *pdev, struct sx_board *board) | |||
2478 | void __iomem *rebase; | 2606 | void __iomem *rebase; |
2479 | unsigned int t; | 2607 | unsigned int t; |
2480 | 2608 | ||
2481 | #define CNTRL_REG_OFFSET 0x50 | 2609 | #define CNTRL_REG_OFFSET 0x50 |
2482 | #define CNTRL_REG_GOODVALUE 0x18260000 | 2610 | #define CNTRL_REG_GOODVALUE 0x18260000 |
2483 | 2611 | ||
2484 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase); | 2612 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase); |
2485 | hwbase &= PCI_BASE_ADDRESS_MEM_MASK; | 2613 | hwbase &= PCI_BASE_ADDRESS_MEM_MASK; |
2486 | rebase = ioremap(hwbase, 0x80); | 2614 | rebase = ioremap(hwbase, 0x80); |
2487 | t = readl (rebase + CNTRL_REG_OFFSET); | 2615 | t = readl(rebase + CNTRL_REG_OFFSET); |
2488 | if (t != CNTRL_REG_GOODVALUE) { | 2616 | if (t != CNTRL_REG_GOODVALUE) { |
2489 | printk (KERN_DEBUG "sx: performing cntrl reg fix: %08x -> %08x\n", t, CNTRL_REG_GOODVALUE); | 2617 | printk(KERN_DEBUG "sx: performing cntrl reg fix: %08x -> " |
2490 | writel (CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET); | 2618 | "%08x\n", t, CNTRL_REG_GOODVALUE); |
2619 | writel(CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET); | ||
2491 | } | 2620 | } |
2492 | iounmap(rebase); | 2621 | iounmap(rebase); |
2493 | } | 2622 | } |
2494 | 2623 | ||
2495 | static int __devinit sx_pci_probe(struct pci_dev *pdev, | 2624 | static int __devinit sx_pci_probe(struct pci_dev *pdev, |
2496 | const struct pci_device_id *ent) | 2625 | const struct pci_device_id *ent) |
2497 | { | 2626 | { |
2498 | struct sx_board *board; | 2627 | struct sx_board *board; |
2499 | unsigned int i; | 2628 | unsigned int i; |
@@ -2515,28 +2644,28 @@ static int __devinit sx_pci_probe(struct pci_dev *pdev, | |||
2515 | 2644 | ||
2516 | board->flags &= ~SX_BOARD_TYPE; | 2645 | board->flags &= ~SX_BOARD_TYPE; |
2517 | board->flags |= (pdev->subsystem_vendor == 0x200) ? SX_PCI_BOARD : | 2646 | board->flags |= (pdev->subsystem_vendor == 0x200) ? SX_PCI_BOARD : |
2518 | SX_CFPCI_BOARD; | 2647 | SX_CFPCI_BOARD; |
2519 | 2648 | ||
2520 | /* CF boards use base address 3.... */ | 2649 | /* CF boards use base address 3.... */ |
2521 | if (IS_CF_BOARD (board)) | 2650 | if (IS_CF_BOARD(board)) |
2522 | board->hw_base = pci_resource_start(pdev, 3); | 2651 | board->hw_base = pci_resource_start(pdev, 3); |
2523 | else | 2652 | else |
2524 | board->hw_base = pci_resource_start(pdev, 2); | 2653 | board->hw_base = pci_resource_start(pdev, 2); |
2525 | board->base2 = | 2654 | board->base2 = |
2526 | board->base = ioremap(board->hw_base, WINDOW_LEN (board)); | 2655 | board->base = ioremap(board->hw_base, WINDOW_LEN(board)); |
2527 | if (!board->base) { | 2656 | if (!board->base) { |
2528 | dev_err(&pdev->dev, "ioremap failed\n"); | 2657 | dev_err(&pdev->dev, "ioremap failed\n"); |
2529 | goto err_flag; | 2658 | goto err_flag; |
2530 | } | 2659 | } |
2531 | 2660 | ||
2532 | /* Most of the stuff on the CF board is offset by 0x18000 .... */ | 2661 | /* Most of the stuff on the CF board is offset by 0x18000 .... */ |
2533 | if (IS_CF_BOARD (board)) | 2662 | if (IS_CF_BOARD(board)) |
2534 | board->base += 0x18000; | 2663 | board->base += 0x18000; |
2535 | 2664 | ||
2536 | board->irq = pdev->irq; | 2665 | board->irq = pdev->irq; |
2537 | 2666 | ||
2538 | dev_info(&pdev->dev, "Got a specialix card: %p(%d) %x.\n", board->base, | 2667 | dev_info(&pdev->dev, "Got a specialix card: %p(%d) %x.\n", board->base, |
2539 | board->irq, board->flags); | 2668 | board->irq, board->flags); |
2540 | 2669 | ||
2541 | if (!probe_sx(board)) { | 2670 | if (!probe_sx(board)) { |
2542 | retval = -EIO; | 2671 | retval = -EIO; |
@@ -2567,11 +2696,12 @@ static void __devexit sx_pci_remove(struct pci_dev *pdev) | |||
2567 | its because the standard requires it. So check for SUBVENDOR_ID. */ | 2696 | its because the standard requires it. So check for SUBVENDOR_ID. */ |
2568 | static struct pci_device_id sx_pci_tbl[] = { | 2697 | static struct pci_device_id sx_pci_tbl[] = { |
2569 | { PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, | 2698 | { PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, |
2570 | .subvendor = 0x0200, .subdevice = PCI_ANY_ID }, | 2699 | .subvendor = 0x0200,.subdevice = PCI_ANY_ID }, |
2571 | { PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, | 2700 | { PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, |
2572 | .subvendor = 0x0300, .subdevice = PCI_ANY_ID }, | 2701 | .subvendor = 0x0300,.subdevice = PCI_ANY_ID }, |
2573 | { 0 } | 2702 | { 0 } |
2574 | }; | 2703 | }; |
2704 | |||
2575 | MODULE_DEVICE_TABLE(pci, sx_pci_tbl); | 2705 | MODULE_DEVICE_TABLE(pci, sx_pci_tbl); |
2576 | 2706 | ||
2577 | static struct pci_driver sx_pcidriver = { | 2707 | static struct pci_driver sx_pcidriver = { |
@@ -2581,7 +2711,7 @@ static struct pci_driver sx_pcidriver = { | |||
2581 | .remove = __devexit_p(sx_pci_remove) | 2711 | .remove = __devexit_p(sx_pci_remove) |
2582 | }; | 2712 | }; |
2583 | 2713 | ||
2584 | static int __init sx_init(void) | 2714 | static int __init sx_init(void) |
2585 | { | 2715 | { |
2586 | #ifdef CONFIG_EISA | 2716 | #ifdef CONFIG_EISA |
2587 | int retval1; | 2717 | int retval1; |
@@ -2594,29 +2724,30 @@ static int __init sx_init(void) | |||
2594 | int retval; | 2724 | int retval; |
2595 | 2725 | ||
2596 | func_enter(); | 2726 | func_enter(); |
2597 | sx_dprintk (SX_DEBUG_INIT, "Initing sx module... (sx_debug=%d)\n", sx_debug); | 2727 | sx_dprintk(SX_DEBUG_INIT, "Initing sx module... (sx_debug=%d)\n", |
2598 | if (abs ((long) (&sx_debug) - sx_debug) < 0x10000) { | 2728 | sx_debug); |
2599 | printk (KERN_WARNING "sx: sx_debug is an address, instead of a value. " | 2729 | if (abs((long)(&sx_debug) - sx_debug) < 0x10000) { |
2600 | "Assuming -1.\n"); | 2730 | printk(KERN_WARNING "sx: sx_debug is an address, instead of a " |
2601 | printk ("(%p)\n", &sx_debug); | 2731 | "value. Assuming -1.\n(%p)\n", &sx_debug); |
2602 | sx_debug=-1; | 2732 | sx_debug = -1; |
2603 | } | 2733 | } |
2604 | 2734 | ||
2605 | if (misc_register(&sx_fw_device) < 0) { | 2735 | if (misc_register(&sx_fw_device) < 0) { |
2606 | printk(KERN_ERR "SX: Unable to register firmware loader driver.\n"); | 2736 | printk(KERN_ERR "SX: Unable to register firmware loader " |
2737 | "driver.\n"); | ||
2607 | return -EIO; | 2738 | return -EIO; |
2608 | } | 2739 | } |
2609 | #ifdef CONFIG_ISA | 2740 | #ifdef CONFIG_ISA |
2610 | for (i=0;i<NR_SX_ADDRS;i++) { | 2741 | for (i = 0; i < NR_SX_ADDRS; i++) { |
2611 | board = &boards[found]; | 2742 | board = &boards[found]; |
2612 | board->hw_base = sx_probe_addrs[i]; | 2743 | board->hw_base = sx_probe_addrs[i]; |
2613 | board->base2 = | 2744 | board->base2 = |
2614 | board->base = ioremap(board->hw_base, SX_WINDOW_LEN); | 2745 | board->base = ioremap(board->hw_base, SX_WINDOW_LEN); |
2615 | board->flags &= ~SX_BOARD_TYPE; | 2746 | board->flags &= ~SX_BOARD_TYPE; |
2616 | board->flags |= SX_ISA_BOARD; | 2747 | board->flags |= SX_ISA_BOARD; |
2617 | board->irq = sx_irqmask?-1:0; | 2748 | board->irq = sx_irqmask ? -1 : 0; |
2618 | 2749 | ||
2619 | if (probe_sx (board)) { | 2750 | if (probe_sx(board)) { |
2620 | board->flags |= SX_BOARD_PRESENT; | 2751 | board->flags |= SX_BOARD_PRESENT; |
2621 | found++; | 2752 | found++; |
2622 | } else { | 2753 | } else { |
@@ -2624,36 +2755,36 @@ static int __init sx_init(void) | |||
2624 | } | 2755 | } |
2625 | } | 2756 | } |
2626 | 2757 | ||
2627 | for (i=0;i<NR_SI_ADDRS;i++) { | 2758 | for (i = 0; i < NR_SI_ADDRS; i++) { |
2628 | board = &boards[found]; | 2759 | board = &boards[found]; |
2629 | board->hw_base = si_probe_addrs[i]; | 2760 | board->hw_base = si_probe_addrs[i]; |
2630 | board->base2 = | 2761 | board->base2 = |
2631 | board->base = ioremap(board->hw_base, SI2_ISA_WINDOW_LEN); | 2762 | board->base = ioremap(board->hw_base, SI2_ISA_WINDOW_LEN); |
2632 | board->flags &= ~SX_BOARD_TYPE; | 2763 | board->flags &= ~SX_BOARD_TYPE; |
2633 | board->flags |= SI_ISA_BOARD; | 2764 | board->flags |= SI_ISA_BOARD; |
2634 | board->irq = sx_irqmask ?-1:0; | 2765 | board->irq = sx_irqmask ? -1 : 0; |
2635 | 2766 | ||
2636 | if (probe_si (board)) { | 2767 | if (probe_si(board)) { |
2637 | board->flags |= SX_BOARD_PRESENT; | 2768 | board->flags |= SX_BOARD_PRESENT; |
2638 | found++; | 2769 | found++; |
2639 | } else { | 2770 | } else { |
2640 | iounmap (board->base); | 2771 | iounmap(board->base); |
2641 | } | 2772 | } |
2642 | } | 2773 | } |
2643 | for (i=0;i<NR_SI1_ADDRS;i++) { | 2774 | for (i = 0; i < NR_SI1_ADDRS; i++) { |
2644 | board = &boards[found]; | 2775 | board = &boards[found]; |
2645 | board->hw_base = si1_probe_addrs[i]; | 2776 | board->hw_base = si1_probe_addrs[i]; |
2646 | board->base2 = | 2777 | board->base2 = |
2647 | board->base = ioremap(board->hw_base, SI1_ISA_WINDOW_LEN); | 2778 | board->base = ioremap(board->hw_base, SI1_ISA_WINDOW_LEN); |
2648 | board->flags &= ~SX_BOARD_TYPE; | 2779 | board->flags &= ~SX_BOARD_TYPE; |
2649 | board->flags |= SI1_ISA_BOARD; | 2780 | board->flags |= SI1_ISA_BOARD; |
2650 | board->irq = sx_irqmask ?-1:0; | 2781 | board->irq = sx_irqmask ? -1 : 0; |
2651 | 2782 | ||
2652 | if (probe_si (board)) { | 2783 | if (probe_si(board)) { |
2653 | board->flags |= SX_BOARD_PRESENT; | 2784 | board->flags |= SX_BOARD_PRESENT; |
2654 | found++; | 2785 | found++; |
2655 | } else { | 2786 | } else { |
2656 | iounmap (board->base); | 2787 | iounmap(board->base); |
2657 | } | 2788 | } |
2658 | } | 2789 | } |
2659 | #endif | 2790 | #endif |
@@ -2663,23 +2794,22 @@ static int __init sx_init(void) | |||
2663 | retval = pci_register_driver(&sx_pcidriver); | 2794 | retval = pci_register_driver(&sx_pcidriver); |
2664 | 2795 | ||
2665 | if (found) { | 2796 | if (found) { |
2666 | printk (KERN_INFO "sx: total of %d boards detected.\n", found); | 2797 | printk(KERN_INFO "sx: total of %d boards detected.\n", found); |
2667 | retval = 0; | 2798 | retval = 0; |
2668 | } else if (retval) { | 2799 | } else if (retval) { |
2669 | #ifdef CONFIG_EISA | 2800 | #ifdef CONFIG_EISA |
2670 | if (retval1) | 2801 | if (retval1) |
2671 | #endif | 2802 | #endif |
2672 | misc_deregister(&sx_fw_device); | 2803 | misc_deregister(&sx_fw_device); |
2673 | } | 2804 | } |
2674 | 2805 | ||
2675 | func_exit(); | 2806 | func_exit(); |
2676 | return retval; | 2807 | return retval; |
2677 | } | 2808 | } |
2678 | 2809 | ||
2679 | 2810 | static void __exit sx_exit(void) | |
2680 | static void __exit sx_exit (void) | ||
2681 | { | 2811 | { |
2682 | int i; | 2812 | int i; |
2683 | 2813 | ||
2684 | func_enter(); | 2814 | func_enter(); |
2685 | #ifdef CONFIG_EISA | 2815 | #ifdef CONFIG_EISA |
@@ -2691,17 +2821,17 @@ static void __exit sx_exit (void) | |||
2691 | sx_remove_card(&boards[i]); | 2821 | sx_remove_card(&boards[i]); |
2692 | 2822 | ||
2693 | if (misc_deregister(&sx_fw_device) < 0) { | 2823 | if (misc_deregister(&sx_fw_device) < 0) { |
2694 | printk (KERN_INFO "sx: couldn't deregister firmware loader device\n"); | 2824 | printk(KERN_INFO "sx: couldn't deregister firmware loader " |
2825 | "device\n"); | ||
2695 | } | 2826 | } |
2696 | sx_dprintk (SX_DEBUG_CLEANUP, "Cleaning up drivers (%d)\n", sx_initialized); | 2827 | sx_dprintk(SX_DEBUG_CLEANUP, "Cleaning up drivers (%d)\n", |
2828 | sx_initialized); | ||
2697 | if (sx_initialized) | 2829 | if (sx_initialized) |
2698 | sx_release_drivers (); | 2830 | sx_release_drivers(); |
2699 | 2831 | ||
2700 | kfree (sx_ports); | 2832 | kfree(sx_ports); |
2701 | func_exit(); | 2833 | func_exit(); |
2702 | } | 2834 | } |
2703 | 2835 | ||
2704 | module_init(sx_init); | 2836 | module_init(sx_init); |
2705 | module_exit(sx_exit); | 2837 | module_exit(sx_exit); |
2706 | |||
2707 | |||