aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ray_cs.c347
1 files changed, 169 insertions, 178 deletions
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 88cd58eb3b9f..28db7914a5d1 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -71,25 +71,7 @@ typedef u_char mac_addr[ETH_ALEN]; /* Hardware address */
71#include "rayctl.h" 71#include "rayctl.h"
72#include "ray_cs.h" 72#include "ray_cs.h"
73 73
74/* All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
75 you do not define PCMCIA_DEBUG at all, all the debug code will be
76 left out. If you compile with PCMCIA_DEBUG=0, the debug code will
77 be present but disabled -- but it can then be enabled for specific
78 modules at load time with a 'pc_debug=#' option to insmod.
79*/
80 74
81#ifdef RAYLINK_DEBUG
82#define PCMCIA_DEBUG RAYLINK_DEBUG
83#endif
84#ifdef PCMCIA_DEBUG
85static int ray_debug;
86static int pc_debug = PCMCIA_DEBUG;
87module_param(pc_debug, int, 0);
88/* #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); */
89#define DEBUG(n, args...) if (pc_debug > (n)) printk(args);
90#else
91#define DEBUG(n, args...)
92#endif
93/** Prototypes based on PCMCIA skeleton driver *******************************/ 75/** Prototypes based on PCMCIA skeleton driver *******************************/
94static int ray_config(struct pcmcia_device *link); 76static int ray_config(struct pcmcia_device *link);
95static void ray_release(struct pcmcia_device *link); 77static void ray_release(struct pcmcia_device *link);
@@ -325,7 +307,7 @@ static int ray_probe(struct pcmcia_device *p_dev)
325 ray_dev_t *local; 307 ray_dev_t *local;
326 struct net_device *dev; 308 struct net_device *dev;
327 309
328 DEBUG(1, "ray_attach()\n"); 310 dev_dbg(&p_dev->dev, "ray_attach()\n");
329 311
330 /* Allocate space for private device-specific data */ 312 /* Allocate space for private device-specific data */
331 dev = alloc_etherdev(sizeof(ray_dev_t)); 313 dev = alloc_etherdev(sizeof(ray_dev_t));
@@ -357,7 +339,7 @@ static int ray_probe(struct pcmcia_device *p_dev)
357 local->card_status = CARD_INSERTED; 339 local->card_status = CARD_INSERTED;
358 local->authentication_state = UNAUTHENTICATED; 340 local->authentication_state = UNAUTHENTICATED;
359 local->num_multi = 0; 341 local->num_multi = 0;
360 DEBUG(2, "ray_attach p_dev = %p, dev = %p, local = %p, intr = %p\n", 342 dev_dbg(&p_dev->dev, "ray_attach p_dev = %p, dev = %p, local = %p, intr = %p\n",
361 p_dev, dev, local, &ray_interrupt); 343 p_dev, dev, local, &ray_interrupt);
362 344
363 /* Raylink entries in the device structure */ 345 /* Raylink entries in the device structure */
@@ -370,7 +352,7 @@ static int ray_probe(struct pcmcia_device *p_dev)
370#endif /* WIRELESS_SPY */ 352#endif /* WIRELESS_SPY */
371 353
372 354
373 DEBUG(2, "ray_cs ray_attach calling ether_setup.)\n"); 355 dev_dbg(&p_dev->dev, "ray_cs ray_attach calling ether_setup.)\n");
374 netif_stop_queue(dev); 356 netif_stop_queue(dev);
375 357
376 init_timer(&local->timer); 358 init_timer(&local->timer);
@@ -393,7 +375,7 @@ static void ray_detach(struct pcmcia_device *link)
393 struct net_device *dev; 375 struct net_device *dev;
394 ray_dev_t *local; 376 ray_dev_t *local;
395 377
396 DEBUG(1, "ray_detach(0x%p)\n", link); 378 dev_dbg(&link->dev, "ray_detach\n");
397 379
398 this_device = NULL; 380 this_device = NULL;
399 dev = link->priv; 381 dev = link->priv;
@@ -408,7 +390,7 @@ static void ray_detach(struct pcmcia_device *link)
408 unregister_netdev(dev); 390 unregister_netdev(dev);
409 free_netdev(dev); 391 free_netdev(dev);
410 } 392 }
411 DEBUG(2, "ray_cs ray_detach ending\n"); 393 dev_dbg(&link->dev, "ray_cs ray_detach ending\n");
412} /* ray_detach */ 394} /* ray_detach */
413 395
414/*============================================================================= 396/*=============================================================================
@@ -416,19 +398,17 @@ static void ray_detach(struct pcmcia_device *link)
416 is received, to configure the PCMCIA socket, and to make the 398 is received, to configure the PCMCIA socket, and to make the
417 ethernet device available to the system. 399 ethernet device available to the system.
418=============================================================================*/ 400=============================================================================*/
419#define CS_CHECK(fn, ret) \
420do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
421#define MAX_TUPLE_SIZE 128 401#define MAX_TUPLE_SIZE 128
422static int ray_config(struct pcmcia_device *link) 402static int ray_config(struct pcmcia_device *link)
423{ 403{
424 int last_fn = 0, last_ret = 0; 404 int ret = 0;
425 int i; 405 int i;
426 win_req_t req; 406 win_req_t req;
427 memreq_t mem; 407 memreq_t mem;
428 struct net_device *dev = (struct net_device *)link->priv; 408 struct net_device *dev = (struct net_device *)link->priv;
429 ray_dev_t *local = netdev_priv(dev); 409 ray_dev_t *local = netdev_priv(dev);
430 410
431 DEBUG(1, "ray_config(0x%p)\n", link); 411 dev_dbg(&link->dev, "ray_config\n");
432 412
433 /* Determine card type and firmware version */ 413 /* Determine card type and firmware version */
434 printk(KERN_INFO "ray_cs Detected: %s%s%s%s\n", 414 printk(KERN_INFO "ray_cs Detected: %s%s%s%s\n",
@@ -440,14 +420,17 @@ static int ray_config(struct pcmcia_device *link)
440 /* Now allocate an interrupt line. Note that this does not 420 /* Now allocate an interrupt line. Note that this does not
441 actually assign a handler to the interrupt. 421 actually assign a handler to the interrupt.
442 */ 422 */
443 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 423 ret = pcmcia_request_irq(link, &link->irq);
424 if (ret)
425 goto failed;
444 dev->irq = link->irq.AssignedIRQ; 426 dev->irq = link->irq.AssignedIRQ;
445 427
446 /* This actually configures the PCMCIA socket -- setting up 428 /* This actually configures the PCMCIA socket -- setting up
447 the I/O windows and the interrupt mapping. 429 the I/O windows and the interrupt mapping.
448 */ 430 */
449 CS_CHECK(RequestConfiguration, 431 ret = pcmcia_request_configuration(link, &link->conf);
450 pcmcia_request_configuration(link, &link->conf)); 432 if (ret)
433 goto failed;
451 434
452/*** Set up 32k window for shared memory (transmit and control) ************/ 435/*** Set up 32k window for shared memory (transmit and control) ************/
453 req.Attributes = 436 req.Attributes =
@@ -455,10 +438,14 @@ static int ray_config(struct pcmcia_device *link)
455 req.Base = 0; 438 req.Base = 0;
456 req.Size = 0x8000; 439 req.Size = 0x8000;
457 req.AccessSpeed = ray_mem_speed; 440 req.AccessSpeed = ray_mem_speed;
458 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); 441 ret = pcmcia_request_window(&link, &req, &link->win);
442 if (ret)
443 goto failed;
459 mem.CardOffset = 0x0000; 444 mem.CardOffset = 0x0000;
460 mem.Page = 0; 445 mem.Page = 0;
461 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); 446 ret = pcmcia_map_mem_page(link->win, &mem);
447 if (ret)
448 goto failed;
462 local->sram = ioremap(req.Base, req.Size); 449 local->sram = ioremap(req.Base, req.Size);
463 450
464/*** Set up 16k window for shared memory (receive buffer) ***************/ 451/*** Set up 16k window for shared memory (receive buffer) ***************/
@@ -467,11 +454,14 @@ static int ray_config(struct pcmcia_device *link)
467 req.Base = 0; 454 req.Base = 0;
468 req.Size = 0x4000; 455 req.Size = 0x4000;
469 req.AccessSpeed = ray_mem_speed; 456 req.AccessSpeed = ray_mem_speed;
470 CS_CHECK(RequestWindow, 457 ret = pcmcia_request_window(&link, &req, &local->rmem_handle);
471 pcmcia_request_window(&link, &req, &local->rmem_handle)); 458 if (ret)
459 goto failed;
472 mem.CardOffset = 0x8000; 460 mem.CardOffset = 0x8000;
473 mem.Page = 0; 461 mem.Page = 0;
474 CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->rmem_handle, &mem)); 462 ret = pcmcia_map_mem_page(local->rmem_handle, &mem);
463 if (ret)
464 goto failed;
475 local->rmem = ioremap(req.Base, req.Size); 465 local->rmem = ioremap(req.Base, req.Size);
476 466
477/*** Set up window for attribute memory ***********************************/ 467/*** Set up window for attribute memory ***********************************/
@@ -480,16 +470,19 @@ static int ray_config(struct pcmcia_device *link)
480 req.Base = 0; 470 req.Base = 0;
481 req.Size = 0x1000; 471 req.Size = 0x1000;
482 req.AccessSpeed = ray_mem_speed; 472 req.AccessSpeed = ray_mem_speed;
483 CS_CHECK(RequestWindow, 473 ret = pcmcia_request_window(&link, &req, &local->amem_handle);
484 pcmcia_request_window(&link, &req, &local->amem_handle)); 474 if (ret)
475 goto failed;
485 mem.CardOffset = 0x0000; 476 mem.CardOffset = 0x0000;
486 mem.Page = 0; 477 mem.Page = 0;
487 CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->amem_handle, &mem)); 478 ret = pcmcia_map_mem_page(local->amem_handle, &mem);
479 if (ret)
480 goto failed;
488 local->amem = ioremap(req.Base, req.Size); 481 local->amem = ioremap(req.Base, req.Size);
489 482
490 DEBUG(3, "ray_config sram=%p\n", local->sram); 483 dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram);
491 DEBUG(3, "ray_config rmem=%p\n", local->rmem); 484 dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem);
492 DEBUG(3, "ray_config amem=%p\n", local->amem); 485 dev_dbg(&link->dev, "ray_config amem=%p\n", local->amem);
493 if (ray_init(dev) < 0) { 486 if (ray_init(dev) < 0) {
494 ray_release(link); 487 ray_release(link);
495 return -ENODEV; 488 return -ENODEV;
@@ -511,9 +504,7 @@ static int ray_config(struct pcmcia_device *link)
511 504
512 return 0; 505 return 0;
513 506
514cs_failed: 507failed:
515 cs_error(link, last_fn, last_ret);
516
517 ray_release(link); 508 ray_release(link);
518 return -ENODEV; 509 return -ENODEV;
519} /* ray_config */ 510} /* ray_config */
@@ -543,9 +534,9 @@ static int ray_init(struct net_device *dev)
543 struct ccs __iomem *pccs; 534 struct ccs __iomem *pccs;
544 ray_dev_t *local = netdev_priv(dev); 535 ray_dev_t *local = netdev_priv(dev);
545 struct pcmcia_device *link = local->finder; 536 struct pcmcia_device *link = local->finder;
546 DEBUG(1, "ray_init(0x%p)\n", dev); 537 dev_dbg(&link->dev, "ray_init(0x%p)\n", dev);
547 if (!(pcmcia_dev_present(link))) { 538 if (!(pcmcia_dev_present(link))) {
548 DEBUG(0, "ray_init - device not present\n"); 539 dev_dbg(&link->dev, "ray_init - device not present\n");
549 return -1; 540 return -1;
550 } 541 }
551 542
@@ -567,13 +558,13 @@ static int ray_init(struct net_device *dev)
567 local->fw_ver = local->startup_res.firmware_version[0]; 558 local->fw_ver = local->startup_res.firmware_version[0];
568 local->fw_bld = local->startup_res.firmware_version[1]; 559 local->fw_bld = local->startup_res.firmware_version[1];
569 local->fw_var = local->startup_res.firmware_version[2]; 560 local->fw_var = local->startup_res.firmware_version[2];
570 DEBUG(1, "ray_init firmware version %d.%d \n", local->fw_ver, 561 dev_dbg(&link->dev, "ray_init firmware version %d.%d \n", local->fw_ver,
571 local->fw_bld); 562 local->fw_bld);
572 563
573 local->tib_length = 0x20; 564 local->tib_length = 0x20;
574 if ((local->fw_ver == 5) && (local->fw_bld >= 30)) 565 if ((local->fw_ver == 5) && (local->fw_bld >= 30))
575 local->tib_length = local->startup_res.tib_length; 566 local->tib_length = local->startup_res.tib_length;
576 DEBUG(2, "ray_init tib_length = 0x%02x\n", local->tib_length); 567 dev_dbg(&link->dev, "ray_init tib_length = 0x%02x\n", local->tib_length);
577 /* Initialize CCS's to buffer free state */ 568 /* Initialize CCS's to buffer free state */
578 pccs = ccs_base(local); 569 pccs = ccs_base(local);
579 for (i = 0; i < NUMBER_OF_CCS; i++) { 570 for (i = 0; i < NUMBER_OF_CCS; i++) {
@@ -592,7 +583,7 @@ static int ray_init(struct net_device *dev)
592 583
593 clear_interrupt(local); /* Clear any interrupt from the card */ 584 clear_interrupt(local); /* Clear any interrupt from the card */
594 local->card_status = CARD_AWAITING_PARAM; 585 local->card_status = CARD_AWAITING_PARAM;
595 DEBUG(2, "ray_init ending\n"); 586 dev_dbg(&link->dev, "ray_init ending\n");
596 return 0; 587 return 0;
597} /* ray_init */ 588} /* ray_init */
598 589
@@ -605,9 +596,9 @@ static int dl_startup_params(struct net_device *dev)
605 struct ccs __iomem *pccs; 596 struct ccs __iomem *pccs;
606 struct pcmcia_device *link = local->finder; 597 struct pcmcia_device *link = local->finder;
607 598
608 DEBUG(1, "dl_startup_params entered\n"); 599 dev_dbg(&link->dev, "dl_startup_params entered\n");
609 if (!(pcmcia_dev_present(link))) { 600 if (!(pcmcia_dev_present(link))) {
610 DEBUG(2, "ray_cs dl_startup_params - device not present\n"); 601 dev_dbg(&link->dev, "ray_cs dl_startup_params - device not present\n");
611 return -1; 602 return -1;
612 } 603 }
613 604
@@ -625,7 +616,7 @@ static int dl_startup_params(struct net_device *dev)
625 local->dl_param_ccs = ccsindex; 616 local->dl_param_ccs = ccsindex;
626 pccs = ccs_base(local) + ccsindex; 617 pccs = ccs_base(local) + ccsindex;
627 writeb(CCS_DOWNLOAD_STARTUP_PARAMS, &pccs->cmd); 618 writeb(CCS_DOWNLOAD_STARTUP_PARAMS, &pccs->cmd);
628 DEBUG(2, "dl_startup_params start ccsindex = %d\n", 619 dev_dbg(&link->dev, "dl_startup_params start ccsindex = %d\n",
629 local->dl_param_ccs); 620 local->dl_param_ccs);
630 /* Interrupt the firmware to process the command */ 621 /* Interrupt the firmware to process the command */
631 if (interrupt_ecf(local, ccsindex)) { 622 if (interrupt_ecf(local, ccsindex)) {
@@ -641,7 +632,7 @@ static int dl_startup_params(struct net_device *dev)
641 local->timer.data = (long)local; 632 local->timer.data = (long)local;
642 local->timer.function = &verify_dl_startup; 633 local->timer.function = &verify_dl_startup;
643 add_timer(&local->timer); 634 add_timer(&local->timer);
644 DEBUG(2, 635 dev_dbg(&link->dev,
645 "ray_cs dl_startup_params started timer for verify_dl_startup\n"); 636 "ray_cs dl_startup_params started timer for verify_dl_startup\n");
646 return 0; 637 return 0;
647} /* dl_startup_params */ 638} /* dl_startup_params */
@@ -717,11 +708,11 @@ static void verify_dl_startup(u_long data)
717 struct pcmcia_device *link = local->finder; 708 struct pcmcia_device *link = local->finder;
718 709
719 if (!(pcmcia_dev_present(link))) { 710 if (!(pcmcia_dev_present(link))) {
720 DEBUG(2, "ray_cs verify_dl_startup - device not present\n"); 711 dev_dbg(&link->dev, "ray_cs verify_dl_startup - device not present\n");
721 return; 712 return;
722 } 713 }
723#ifdef PCMCIA_DEBUG 714#if 0
724 if (pc_debug > 2) { 715 {
725 int i; 716 int i;
726 printk(KERN_DEBUG 717 printk(KERN_DEBUG
727 "verify_dl_startup parameters sent via ccs %d:\n", 718 "verify_dl_startup parameters sent via ccs %d:\n",
@@ -760,7 +751,7 @@ static void start_net(u_long data)
760 int ccsindex; 751 int ccsindex;
761 struct pcmcia_device *link = local->finder; 752 struct pcmcia_device *link = local->finder;
762 if (!(pcmcia_dev_present(link))) { 753 if (!(pcmcia_dev_present(link))) {
763 DEBUG(2, "ray_cs start_net - device not present\n"); 754 dev_dbg(&link->dev, "ray_cs start_net - device not present\n");
764 return; 755 return;
765 } 756 }
766 /* Fill in the CCS fields for the ECF */ 757 /* Fill in the CCS fields for the ECF */
@@ -771,7 +762,7 @@ static void start_net(u_long data)
771 writeb(0, &pccs->var.start_network.update_param); 762 writeb(0, &pccs->var.start_network.update_param);
772 /* Interrupt the firmware to process the command */ 763 /* Interrupt the firmware to process the command */
773 if (interrupt_ecf(local, ccsindex)) { 764 if (interrupt_ecf(local, ccsindex)) {
774 DEBUG(1, "ray start net failed - card not ready for intr\n"); 765 dev_dbg(&link->dev, "ray start net failed - card not ready for intr\n");
775 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); 766 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
776 return; 767 return;
777 } 768 }
@@ -790,7 +781,7 @@ static void join_net(u_long data)
790 struct pcmcia_device *link = local->finder; 781 struct pcmcia_device *link = local->finder;
791 782
792 if (!(pcmcia_dev_present(link))) { 783 if (!(pcmcia_dev_present(link))) {
793 DEBUG(2, "ray_cs join_net - device not present\n"); 784 dev_dbg(&link->dev, "ray_cs join_net - device not present\n");
794 return; 785 return;
795 } 786 }
796 /* Fill in the CCS fields for the ECF */ 787 /* Fill in the CCS fields for the ECF */
@@ -802,7 +793,7 @@ static void join_net(u_long data)
802 writeb(0, &pccs->var.join_network.net_initiated); 793 writeb(0, &pccs->var.join_network.net_initiated);
803 /* Interrupt the firmware to process the command */ 794 /* Interrupt the firmware to process the command */
804 if (interrupt_ecf(local, ccsindex)) { 795 if (interrupt_ecf(local, ccsindex)) {
805 DEBUG(1, "ray join net failed - card not ready for intr\n"); 796 dev_dbg(&link->dev, "ray join net failed - card not ready for intr\n");
806 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); 797 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
807 return; 798 return;
808 } 799 }
@@ -821,7 +812,7 @@ static void ray_release(struct pcmcia_device *link)
821 ray_dev_t *local = netdev_priv(dev); 812 ray_dev_t *local = netdev_priv(dev);
822 int i; 813 int i;
823 814
824 DEBUG(1, "ray_release(0x%p)\n", link); 815 dev_dbg(&link->dev, "ray_release\n");
825 816
826 del_timer(&local->timer); 817 del_timer(&local->timer);
827 818
@@ -831,13 +822,13 @@ static void ray_release(struct pcmcia_device *link)
831 /* Do bother checking to see if these succeed or not */ 822 /* Do bother checking to see if these succeed or not */
832 i = pcmcia_release_window(local->amem_handle); 823 i = pcmcia_release_window(local->amem_handle);
833 if (i != 0) 824 if (i != 0)
834 DEBUG(0, "ReleaseWindow(local->amem) ret = %x\n", i); 825 dev_dbg(&link->dev, "ReleaseWindow(local->amem) ret = %x\n", i);
835 i = pcmcia_release_window(local->rmem_handle); 826 i = pcmcia_release_window(local->rmem_handle);
836 if (i != 0) 827 if (i != 0)
837 DEBUG(0, "ReleaseWindow(local->rmem) ret = %x\n", i); 828 dev_dbg(&link->dev, "ReleaseWindow(local->rmem) ret = %x\n", i);
838 pcmcia_disable_device(link); 829 pcmcia_disable_device(link);
839 830
840 DEBUG(2, "ray_release ending\n"); 831 dev_dbg(&link->dev, "ray_release ending\n");
841} 832}
842 833
843static int ray_suspend(struct pcmcia_device *link) 834static int ray_suspend(struct pcmcia_device *link)
@@ -871,9 +862,9 @@ static int ray_dev_init(struct net_device *dev)
871 ray_dev_t *local = netdev_priv(dev); 862 ray_dev_t *local = netdev_priv(dev);
872 struct pcmcia_device *link = local->finder; 863 struct pcmcia_device *link = local->finder;
873 864
874 DEBUG(1, "ray_dev_init(dev=%p)\n", dev); 865 dev_dbg(&link->dev, "ray_dev_init(dev=%p)\n", dev);
875 if (!(pcmcia_dev_present(link))) { 866 if (!(pcmcia_dev_present(link))) {
876 DEBUG(2, "ray_dev_init - device not present\n"); 867 dev_dbg(&link->dev, "ray_dev_init - device not present\n");
877 return -1; 868 return -1;
878 } 869 }
879#ifdef RAY_IMMEDIATE_INIT 870#ifdef RAY_IMMEDIATE_INIT
@@ -887,7 +878,7 @@ static int ray_dev_init(struct net_device *dev)
887 /* Postpone the card init so that we can still configure the card, 878 /* Postpone the card init so that we can still configure the card,
888 * for example using the Wireless Extensions. The init will happen 879 * for example using the Wireless Extensions. The init will happen
889 * in ray_open() - Jean II */ 880 * in ray_open() - Jean II */
890 DEBUG(1, 881 dev_dbg(&link->dev,
891 "ray_dev_init: postponing card init to ray_open() ; Status = %d\n", 882 "ray_dev_init: postponing card init to ray_open() ; Status = %d\n",
892 local->card_status); 883 local->card_status);
893#endif /* RAY_IMMEDIATE_INIT */ 884#endif /* RAY_IMMEDIATE_INIT */
@@ -896,7 +887,7 @@ static int ray_dev_init(struct net_device *dev)
896 memcpy(dev->dev_addr, &local->sparm.b4.a_mac_addr, ADDRLEN); 887 memcpy(dev->dev_addr, &local->sparm.b4.a_mac_addr, ADDRLEN);
897 memset(dev->broadcast, 0xff, ETH_ALEN); 888 memset(dev->broadcast, 0xff, ETH_ALEN);
898 889
899 DEBUG(2, "ray_dev_init ending\n"); 890 dev_dbg(&link->dev, "ray_dev_init ending\n");
900 return 0; 891 return 0;
901} 892}
902 893
@@ -906,9 +897,9 @@ static int ray_dev_config(struct net_device *dev, struct ifmap *map)
906 ray_dev_t *local = netdev_priv(dev); 897 ray_dev_t *local = netdev_priv(dev);
907 struct pcmcia_device *link = local->finder; 898 struct pcmcia_device *link = local->finder;
908 /* Dummy routine to satisfy device structure */ 899 /* Dummy routine to satisfy device structure */
909 DEBUG(1, "ray_dev_config(dev=%p,ifmap=%p)\n", dev, map); 900 dev_dbg(&link->dev, "ray_dev_config(dev=%p,ifmap=%p)\n", dev, map);
910 if (!(pcmcia_dev_present(link))) { 901 if (!(pcmcia_dev_present(link))) {
911 DEBUG(2, "ray_dev_config - device not present\n"); 902 dev_dbg(&link->dev, "ray_dev_config - device not present\n");
912 return -1; 903 return -1;
913 } 904 }
914 905
@@ -924,14 +915,14 @@ static netdev_tx_t ray_dev_start_xmit(struct sk_buff *skb,
924 short length = skb->len; 915 short length = skb->len;
925 916
926 if (!pcmcia_dev_present(link)) { 917 if (!pcmcia_dev_present(link)) {
927 DEBUG(2, "ray_dev_start_xmit - device not present\n"); 918 dev_dbg(&link->dev, "ray_dev_start_xmit - device not present\n");
928 dev_kfree_skb(skb); 919 dev_kfree_skb(skb);
929 return NETDEV_TX_OK; 920 return NETDEV_TX_OK;
930 } 921 }
931 922
932 DEBUG(3, "ray_dev_start_xmit(skb=%p, dev=%p)\n", skb, dev); 923 dev_dbg(&link->dev, "ray_dev_start_xmit(skb=%p, dev=%p)\n", skb, dev);
933 if (local->authentication_state == NEED_TO_AUTH) { 924 if (local->authentication_state == NEED_TO_AUTH) {
934 DEBUG(0, "ray_cs Sending authentication request.\n"); 925 dev_dbg(&link->dev, "ray_cs Sending authentication request.\n");
935 if (!build_auth_frame(local, local->auth_id, OPEN_AUTH_REQUEST)) { 926 if (!build_auth_frame(local, local->auth_id, OPEN_AUTH_REQUEST)) {
936 local->authentication_state = AUTHENTICATED; 927 local->authentication_state = AUTHENTICATED;
937 netif_stop_queue(dev); 928 netif_stop_queue(dev);
@@ -971,7 +962,7 @@ static int ray_hw_xmit(unsigned char *data, int len, struct net_device *dev,
971 struct tx_msg __iomem *ptx; /* Address of xmit buffer in PC space */ 962 struct tx_msg __iomem *ptx; /* Address of xmit buffer in PC space */
972 short int addr; /* Address of xmit buffer in card space */ 963 short int addr; /* Address of xmit buffer in card space */
973 964
974 DEBUG(3, "ray_hw_xmit(data=%p, len=%d, dev=%p)\n", data, len, dev); 965 pr_debug("ray_hw_xmit(data=%p, len=%d, dev=%p)\n", data, len, dev);
975 if (len + TX_HEADER_LENGTH > TX_BUF_SIZE) { 966 if (len + TX_HEADER_LENGTH > TX_BUF_SIZE) {
976 printk(KERN_INFO "ray_hw_xmit packet too large: %d bytes\n", 967 printk(KERN_INFO "ray_hw_xmit packet too large: %d bytes\n",
977 len); 968 len);
@@ -979,9 +970,9 @@ static int ray_hw_xmit(unsigned char *data, int len, struct net_device *dev,
979 } 970 }
980 switch (ccsindex = get_free_tx_ccs(local)) { 971 switch (ccsindex = get_free_tx_ccs(local)) {
981 case ECCSBUSY: 972 case ECCSBUSY:
982 DEBUG(2, "ray_hw_xmit tx_ccs table busy\n"); 973 pr_debug("ray_hw_xmit tx_ccs table busy\n");
983 case ECCSFULL: 974 case ECCSFULL:
984 DEBUG(2, "ray_hw_xmit No free tx ccs\n"); 975 pr_debug("ray_hw_xmit No free tx ccs\n");
985 case ECARDGONE: 976 case ECARDGONE:
986 netif_stop_queue(dev); 977 netif_stop_queue(dev);
987 return XMIT_NO_CCS; 978 return XMIT_NO_CCS;
@@ -1018,12 +1009,12 @@ static int ray_hw_xmit(unsigned char *data, int len, struct net_device *dev,
1018 writeb(PSM_CAM, &pccs->var.tx_request.pow_sav_mode); 1009 writeb(PSM_CAM, &pccs->var.tx_request.pow_sav_mode);
1019 writeb(local->net_default_tx_rate, &pccs->var.tx_request.tx_rate); 1010 writeb(local->net_default_tx_rate, &pccs->var.tx_request.tx_rate);
1020 writeb(0, &pccs->var.tx_request.antenna); 1011 writeb(0, &pccs->var.tx_request.antenna);
1021 DEBUG(3, "ray_hw_xmit default_tx_rate = 0x%x\n", 1012 pr_debug("ray_hw_xmit default_tx_rate = 0x%x\n",
1022 local->net_default_tx_rate); 1013 local->net_default_tx_rate);
1023 1014
1024 /* Interrupt the firmware to process the command */ 1015 /* Interrupt the firmware to process the command */
1025 if (interrupt_ecf(local, ccsindex)) { 1016 if (interrupt_ecf(local, ccsindex)) {
1026 DEBUG(2, "ray_hw_xmit failed - ECF not ready for intr\n"); 1017 pr_debug("ray_hw_xmit failed - ECF not ready for intr\n");
1027/* TBD very inefficient to copy packet to buffer, and then not 1018/* TBD very inefficient to copy packet to buffer, and then not
1028 send it, but the alternative is to queue the messages and that 1019 send it, but the alternative is to queue the messages and that
1029 won't be done for a while. Maybe set tbusy until a CCS is free? 1020 won't be done for a while. Maybe set tbusy until a CCS is free?
@@ -1040,7 +1031,7 @@ static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx,
1040{ 1031{
1041 __be16 proto = ((struct ethhdr *)data)->h_proto; 1032 __be16 proto = ((struct ethhdr *)data)->h_proto;
1042 if (ntohs(proto) >= 1536) { /* DIX II ethernet frame */ 1033 if (ntohs(proto) >= 1536) { /* DIX II ethernet frame */
1043 DEBUG(3, "ray_cs translate_frame DIX II\n"); 1034 pr_debug("ray_cs translate_frame DIX II\n");
1044 /* Copy LLC header to card buffer */ 1035 /* Copy LLC header to card buffer */
1045 memcpy_toio(&ptx->var, eth2_llc, sizeof(eth2_llc)); 1036 memcpy_toio(&ptx->var, eth2_llc, sizeof(eth2_llc));
1046 memcpy_toio(((void __iomem *)&ptx->var) + sizeof(eth2_llc), 1037 memcpy_toio(((void __iomem *)&ptx->var) + sizeof(eth2_llc),
@@ -1056,9 +1047,9 @@ static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx,
1056 len - ETH_HLEN); 1047 len - ETH_HLEN);
1057 return (int)sizeof(struct snaphdr_t) - ETH_HLEN; 1048 return (int)sizeof(struct snaphdr_t) - ETH_HLEN;
1058 } else { /* already 802 type, and proto is length */ 1049 } else { /* already 802 type, and proto is length */
1059 DEBUG(3, "ray_cs translate_frame 802\n"); 1050 pr_debug("ray_cs translate_frame 802\n");
1060 if (proto == htons(0xffff)) { /* evil netware IPX 802.3 without LLC */ 1051 if (proto == htons(0xffff)) { /* evil netware IPX 802.3 without LLC */
1061 DEBUG(3, "ray_cs translate_frame evil IPX\n"); 1052 pr_debug("ray_cs translate_frame evil IPX\n");
1062 memcpy_toio(&ptx->var, data + ETH_HLEN, len - ETH_HLEN); 1053 memcpy_toio(&ptx->var, data + ETH_HLEN, len - ETH_HLEN);
1063 return 0 - ETH_HLEN; 1054 return 0 - ETH_HLEN;
1064 } 1055 }
@@ -1603,7 +1594,7 @@ static int ray_open(struct net_device *dev)
1603 struct pcmcia_device *link; 1594 struct pcmcia_device *link;
1604 link = local->finder; 1595 link = local->finder;
1605 1596
1606 DEBUG(1, "ray_open('%s')\n", dev->name); 1597 dev_dbg(&link->dev, "ray_open('%s')\n", dev->name);
1607 1598
1608 if (link->open == 0) 1599 if (link->open == 0)
1609 local->num_multi = 0; 1600 local->num_multi = 0;
@@ -1613,7 +1604,7 @@ static int ray_open(struct net_device *dev)
1613 if (local->card_status == CARD_AWAITING_PARAM) { 1604 if (local->card_status == CARD_AWAITING_PARAM) {
1614 int i; 1605 int i;
1615 1606
1616 DEBUG(1, "ray_open: doing init now !\n"); 1607 dev_dbg(&link->dev, "ray_open: doing init now !\n");
1617 1608
1618 /* Download startup parameters */ 1609 /* Download startup parameters */
1619 if ((i = dl_startup_params(dev)) < 0) { 1610 if ((i = dl_startup_params(dev)) < 0) {
@@ -1629,7 +1620,7 @@ static int ray_open(struct net_device *dev)
1629 else 1620 else
1630 netif_start_queue(dev); 1621 netif_start_queue(dev);
1631 1622
1632 DEBUG(2, "ray_open ending\n"); 1623 dev_dbg(&link->dev, "ray_open ending\n");
1633 return 0; 1624 return 0;
1634} /* end ray_open */ 1625} /* end ray_open */
1635 1626
@@ -1640,7 +1631,7 @@ static int ray_dev_close(struct net_device *dev)
1640 struct pcmcia_device *link; 1631 struct pcmcia_device *link;
1641 link = local->finder; 1632 link = local->finder;
1642 1633
1643 DEBUG(1, "ray_dev_close('%s')\n", dev->name); 1634 dev_dbg(&link->dev, "ray_dev_close('%s')\n", dev->name);
1644 1635
1645 link->open--; 1636 link->open--;
1646 netif_stop_queue(dev); 1637 netif_stop_queue(dev);
@@ -1656,7 +1647,7 @@ static int ray_dev_close(struct net_device *dev)
1656/*===========================================================================*/ 1647/*===========================================================================*/
1657static void ray_reset(struct net_device *dev) 1648static void ray_reset(struct net_device *dev)
1658{ 1649{
1659 DEBUG(1, "ray_reset entered\n"); 1650 pr_debug("ray_reset entered\n");
1660 return; 1651 return;
1661} 1652}
1662 1653
@@ -1669,17 +1660,17 @@ static int interrupt_ecf(ray_dev_t *local, int ccs)
1669 struct pcmcia_device *link = local->finder; 1660 struct pcmcia_device *link = local->finder;
1670 1661
1671 if (!(pcmcia_dev_present(link))) { 1662 if (!(pcmcia_dev_present(link))) {
1672 DEBUG(2, "ray_cs interrupt_ecf - device not present\n"); 1663 dev_dbg(&link->dev, "ray_cs interrupt_ecf - device not present\n");
1673 return -1; 1664 return -1;
1674 } 1665 }
1675 DEBUG(2, "interrupt_ecf(local=%p, ccs = 0x%x\n", local, ccs); 1666 dev_dbg(&link->dev, "interrupt_ecf(local=%p, ccs = 0x%x\n", local, ccs);
1676 1667
1677 while (i && 1668 while (i &&
1678 (readb(local->amem + CIS_OFFSET + ECF_INTR_OFFSET) & 1669 (readb(local->amem + CIS_OFFSET + ECF_INTR_OFFSET) &
1679 ECF_INTR_SET)) 1670 ECF_INTR_SET))
1680 i--; 1671 i--;
1681 if (i == 0) { 1672 if (i == 0) {
1682 DEBUG(2, "ray_cs interrupt_ecf card not ready for interrupt\n"); 1673 dev_dbg(&link->dev, "ray_cs interrupt_ecf card not ready for interrupt\n");
1683 return -1; 1674 return -1;
1684 } 1675 }
1685 /* Fill the mailbox, then kick the card */ 1676 /* Fill the mailbox, then kick the card */
@@ -1698,12 +1689,12 @@ static int get_free_tx_ccs(ray_dev_t *local)
1698 struct pcmcia_device *link = local->finder; 1689 struct pcmcia_device *link = local->finder;
1699 1690
1700 if (!(pcmcia_dev_present(link))) { 1691 if (!(pcmcia_dev_present(link))) {
1701 DEBUG(2, "ray_cs get_free_tx_ccs - device not present\n"); 1692 dev_dbg(&link->dev, "ray_cs get_free_tx_ccs - device not present\n");
1702 return ECARDGONE; 1693 return ECARDGONE;
1703 } 1694 }
1704 1695
1705 if (test_and_set_bit(0, &local->tx_ccs_lock)) { 1696 if (test_and_set_bit(0, &local->tx_ccs_lock)) {
1706 DEBUG(1, "ray_cs tx_ccs_lock busy\n"); 1697 dev_dbg(&link->dev, "ray_cs tx_ccs_lock busy\n");
1707 return ECCSBUSY; 1698 return ECCSBUSY;
1708 } 1699 }
1709 1700
@@ -1716,7 +1707,7 @@ static int get_free_tx_ccs(ray_dev_t *local)
1716 } 1707 }
1717 } 1708 }
1718 local->tx_ccs_lock = 0; 1709 local->tx_ccs_lock = 0;
1719 DEBUG(2, "ray_cs ERROR no free tx CCS for raylink card\n"); 1710 dev_dbg(&link->dev, "ray_cs ERROR no free tx CCS for raylink card\n");
1720 return ECCSFULL; 1711 return ECCSFULL;
1721} /* get_free_tx_ccs */ 1712} /* get_free_tx_ccs */
1722 1713
@@ -1730,11 +1721,11 @@ static int get_free_ccs(ray_dev_t *local)
1730 struct pcmcia_device *link = local->finder; 1721 struct pcmcia_device *link = local->finder;
1731 1722
1732 if (!(pcmcia_dev_present(link))) { 1723 if (!(pcmcia_dev_present(link))) {
1733 DEBUG(2, "ray_cs get_free_ccs - device not present\n"); 1724 dev_dbg(&link->dev, "ray_cs get_free_ccs - device not present\n");
1734 return ECARDGONE; 1725 return ECARDGONE;
1735 } 1726 }
1736 if (test_and_set_bit(0, &local->ccs_lock)) { 1727 if (test_and_set_bit(0, &local->ccs_lock)) {
1737 DEBUG(1, "ray_cs ccs_lock busy\n"); 1728 dev_dbg(&link->dev, "ray_cs ccs_lock busy\n");
1738 return ECCSBUSY; 1729 return ECCSBUSY;
1739 } 1730 }
1740 1731
@@ -1747,7 +1738,7 @@ static int get_free_ccs(ray_dev_t *local)
1747 } 1738 }
1748 } 1739 }
1749 local->ccs_lock = 0; 1740 local->ccs_lock = 0;
1750 DEBUG(1, "ray_cs ERROR no free CCS for raylink card\n"); 1741 dev_dbg(&link->dev, "ray_cs ERROR no free CCS for raylink card\n");
1751 return ECCSFULL; 1742 return ECCSFULL;
1752} /* get_free_ccs */ 1743} /* get_free_ccs */
1753 1744
@@ -1823,7 +1814,7 @@ static struct net_device_stats *ray_get_stats(struct net_device *dev)
1823 struct pcmcia_device *link = local->finder; 1814 struct pcmcia_device *link = local->finder;
1824 struct status __iomem *p = local->sram + STATUS_BASE; 1815 struct status __iomem *p = local->sram + STATUS_BASE;
1825 if (!(pcmcia_dev_present(link))) { 1816 if (!(pcmcia_dev_present(link))) {
1826 DEBUG(2, "ray_cs net_device_stats - device not present\n"); 1817 dev_dbg(&link->dev, "ray_cs net_device_stats - device not present\n");
1827 return &local->stats; 1818 return &local->stats;
1828 } 1819 }
1829 if (readb(&p->mrx_overflow_for_host)) { 1820 if (readb(&p->mrx_overflow_for_host)) {
@@ -1856,12 +1847,12 @@ static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value,
1856 struct ccs __iomem *pccs; 1847 struct ccs __iomem *pccs;
1857 1848
1858 if (!(pcmcia_dev_present(link))) { 1849 if (!(pcmcia_dev_present(link))) {
1859 DEBUG(2, "ray_update_parm - device not present\n"); 1850 dev_dbg(&link->dev, "ray_update_parm - device not present\n");
1860 return; 1851 return;
1861 } 1852 }
1862 1853
1863 if ((ccsindex = get_free_ccs(local)) < 0) { 1854 if ((ccsindex = get_free_ccs(local)) < 0) {
1864 DEBUG(0, "ray_update_parm - No free ccs\n"); 1855 dev_dbg(&link->dev, "ray_update_parm - No free ccs\n");
1865 return; 1856 return;
1866 } 1857 }
1867 pccs = ccs_base(local) + ccsindex; 1858 pccs = ccs_base(local) + ccsindex;
@@ -1874,7 +1865,7 @@ static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value,
1874 } 1865 }
1875 /* Interrupt the firmware to process the command */ 1866 /* Interrupt the firmware to process the command */
1876 if (interrupt_ecf(local, ccsindex)) { 1867 if (interrupt_ecf(local, ccsindex)) {
1877 DEBUG(0, "ray_cs associate failed - ECF not ready for intr\n"); 1868 dev_dbg(&link->dev, "ray_cs associate failed - ECF not ready for intr\n");
1878 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); 1869 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
1879 } 1870 }
1880} 1871}
@@ -1891,12 +1882,12 @@ static void ray_update_multi_list(struct net_device *dev, int all)
1891 void __iomem *p = local->sram + HOST_TO_ECF_BASE; 1882 void __iomem *p = local->sram + HOST_TO_ECF_BASE;
1892 1883
1893 if (!(pcmcia_dev_present(link))) { 1884 if (!(pcmcia_dev_present(link))) {
1894 DEBUG(2, "ray_update_multi_list - device not present\n"); 1885 dev_dbg(&link->dev, "ray_update_multi_list - device not present\n");
1895 return; 1886 return;
1896 } else 1887 } else
1897 DEBUG(2, "ray_update_multi_list(%p)\n", dev); 1888 dev_dbg(&link->dev, "ray_update_multi_list(%p)\n", dev);
1898 if ((ccsindex = get_free_ccs(local)) < 0) { 1889 if ((ccsindex = get_free_ccs(local)) < 0) {
1899 DEBUG(1, "ray_update_multi - No free ccs\n"); 1890 dev_dbg(&link->dev, "ray_update_multi - No free ccs\n");
1900 return; 1891 return;
1901 } 1892 }
1902 pccs = ccs_base(local) + ccsindex; 1893 pccs = ccs_base(local) + ccsindex;
@@ -1910,7 +1901,7 @@ static void ray_update_multi_list(struct net_device *dev, int all)
1910 for (dmip = &dev->mc_list; (dmi = *dmip) != NULL; 1901 for (dmip = &dev->mc_list; (dmi = *dmip) != NULL;
1911 dmip = &dmi->next) { 1902 dmip = &dmi->next) {
1912 memcpy_toio(p, dmi->dmi_addr, ETH_ALEN); 1903 memcpy_toio(p, dmi->dmi_addr, ETH_ALEN);
1913 DEBUG(1, 1904 dev_dbg(&link->dev,
1914 "ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n", 1905 "ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n",
1915 dmi->dmi_addr[0], dmi->dmi_addr[1], 1906 dmi->dmi_addr[0], dmi->dmi_addr[1],
1916 dmi->dmi_addr[2], dmi->dmi_addr[3], 1907 dmi->dmi_addr[2], dmi->dmi_addr[3],
@@ -1921,12 +1912,12 @@ static void ray_update_multi_list(struct net_device *dev, int all)
1921 if (i > 256 / ADDRLEN) 1912 if (i > 256 / ADDRLEN)
1922 i = 256 / ADDRLEN; 1913 i = 256 / ADDRLEN;
1923 writeb((UCHAR) i, &pccs->var); 1914 writeb((UCHAR) i, &pccs->var);
1924 DEBUG(1, "ray_cs update_multi %d addresses in list\n", i); 1915 dev_dbg(&link->dev, "ray_cs update_multi %d addresses in list\n", i);
1925 /* Interrupt the firmware to process the command */ 1916 /* Interrupt the firmware to process the command */
1926 local->num_multi = i; 1917 local->num_multi = i;
1927 } 1918 }
1928 if (interrupt_ecf(local, ccsindex)) { 1919 if (interrupt_ecf(local, ccsindex)) {
1929 DEBUG(1, 1920 dev_dbg(&link->dev,
1930 "ray_cs update_multi failed - ECF not ready for intr\n"); 1921 "ray_cs update_multi failed - ECF not ready for intr\n");
1931 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); 1922 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
1932 } 1923 }
@@ -1938,11 +1929,11 @@ static void set_multicast_list(struct net_device *dev)
1938 ray_dev_t *local = netdev_priv(dev); 1929 ray_dev_t *local = netdev_priv(dev);
1939 UCHAR promisc; 1930 UCHAR promisc;
1940 1931
1941 DEBUG(2, "ray_cs set_multicast_list(%p)\n", dev); 1932 pr_debug("ray_cs set_multicast_list(%p)\n", dev);
1942 1933
1943 if (dev->flags & IFF_PROMISC) { 1934 if (dev->flags & IFF_PROMISC) {
1944 if (local->sparm.b5.a_promiscuous_mode == 0) { 1935 if (local->sparm.b5.a_promiscuous_mode == 0) {
1945 DEBUG(1, "ray_cs set_multicast_list promisc on\n"); 1936 pr_debug("ray_cs set_multicast_list promisc on\n");
1946 local->sparm.b5.a_promiscuous_mode = 1; 1937 local->sparm.b5.a_promiscuous_mode = 1;
1947 promisc = 1; 1938 promisc = 1;
1948 ray_update_parm(dev, OBJID_promiscuous_mode, 1939 ray_update_parm(dev, OBJID_promiscuous_mode,
@@ -1950,7 +1941,7 @@ static void set_multicast_list(struct net_device *dev)
1950 } 1941 }
1951 } else { 1942 } else {
1952 if (local->sparm.b5.a_promiscuous_mode == 1) { 1943 if (local->sparm.b5.a_promiscuous_mode == 1) {
1953 DEBUG(1, "ray_cs set_multicast_list promisc off\n"); 1944 pr_debug("ray_cs set_multicast_list promisc off\n");
1954 local->sparm.b5.a_promiscuous_mode = 0; 1945 local->sparm.b5.a_promiscuous_mode = 0;
1955 promisc = 0; 1946 promisc = 0;
1956 ray_update_parm(dev, OBJID_promiscuous_mode, 1947 ray_update_parm(dev, OBJID_promiscuous_mode,
@@ -1984,19 +1975,19 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
1984 if (dev == NULL) /* Note that we want interrupts with dev->start == 0 */ 1975 if (dev == NULL) /* Note that we want interrupts with dev->start == 0 */
1985 return IRQ_NONE; 1976 return IRQ_NONE;
1986 1977
1987 DEBUG(4, "ray_cs: interrupt for *dev=%p\n", dev); 1978 pr_debug("ray_cs: interrupt for *dev=%p\n", dev);
1988 1979
1989 local = netdev_priv(dev); 1980 local = netdev_priv(dev);
1990 link = (struct pcmcia_device *)local->finder; 1981 link = (struct pcmcia_device *)local->finder;
1991 if (!pcmcia_dev_present(link)) { 1982 if (!pcmcia_dev_present(link)) {
1992 DEBUG(2, 1983 pr_debug(
1993 "ray_cs interrupt from device not present or suspended.\n"); 1984 "ray_cs interrupt from device not present or suspended.\n");
1994 return IRQ_NONE; 1985 return IRQ_NONE;
1995 } 1986 }
1996 rcsindex = readb(&((struct scb __iomem *)(local->sram))->rcs_index); 1987 rcsindex = readb(&((struct scb __iomem *)(local->sram))->rcs_index);
1997 1988
1998 if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) { 1989 if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) {
1999 DEBUG(1, "ray_cs interrupt bad rcsindex = 0x%x\n", rcsindex); 1990 dev_dbg(&link->dev, "ray_cs interrupt bad rcsindex = 0x%x\n", rcsindex);
2000 clear_interrupt(local); 1991 clear_interrupt(local);
2001 return IRQ_HANDLED; 1992 return IRQ_HANDLED;
2002 } 1993 }
@@ -2008,33 +1999,33 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2008 case CCS_DOWNLOAD_STARTUP_PARAMS: /* Happens in firmware someday */ 1999 case CCS_DOWNLOAD_STARTUP_PARAMS: /* Happens in firmware someday */
2009 del_timer(&local->timer); 2000 del_timer(&local->timer);
2010 if (status == CCS_COMMAND_COMPLETE) { 2001 if (status == CCS_COMMAND_COMPLETE) {
2011 DEBUG(1, 2002 dev_dbg(&link->dev,
2012 "ray_cs interrupt download_startup_parameters OK\n"); 2003 "ray_cs interrupt download_startup_parameters OK\n");
2013 } else { 2004 } else {
2014 DEBUG(1, 2005 dev_dbg(&link->dev,
2015 "ray_cs interrupt download_startup_parameters fail\n"); 2006 "ray_cs interrupt download_startup_parameters fail\n");
2016 } 2007 }
2017 break; 2008 break;
2018 case CCS_UPDATE_PARAMS: 2009 case CCS_UPDATE_PARAMS:
2019 DEBUG(1, "ray_cs interrupt update params done\n"); 2010 dev_dbg(&link->dev, "ray_cs interrupt update params done\n");
2020 if (status != CCS_COMMAND_COMPLETE) { 2011 if (status != CCS_COMMAND_COMPLETE) {
2021 tmp = 2012 tmp =
2022 readb(&pccs->var.update_param. 2013 readb(&pccs->var.update_param.
2023 failure_cause); 2014 failure_cause);
2024 DEBUG(0, 2015 dev_dbg(&link->dev,
2025 "ray_cs interrupt update params failed - reason %d\n", 2016 "ray_cs interrupt update params failed - reason %d\n",
2026 tmp); 2017 tmp);
2027 } 2018 }
2028 break; 2019 break;
2029 case CCS_REPORT_PARAMS: 2020 case CCS_REPORT_PARAMS:
2030 DEBUG(1, "ray_cs interrupt report params done\n"); 2021 dev_dbg(&link->dev, "ray_cs interrupt report params done\n");
2031 break; 2022 break;
2032 case CCS_UPDATE_MULTICAST_LIST: /* Note that this CCS isn't returned */ 2023 case CCS_UPDATE_MULTICAST_LIST: /* Note that this CCS isn't returned */
2033 DEBUG(1, 2024 dev_dbg(&link->dev,
2034 "ray_cs interrupt CCS Update Multicast List done\n"); 2025 "ray_cs interrupt CCS Update Multicast List done\n");
2035 break; 2026 break;
2036 case CCS_UPDATE_POWER_SAVINGS_MODE: 2027 case CCS_UPDATE_POWER_SAVINGS_MODE:
2037 DEBUG(1, 2028 dev_dbg(&link->dev,
2038 "ray_cs interrupt update power save mode done\n"); 2029 "ray_cs interrupt update power save mode done\n");
2039 break; 2030 break;
2040 case CCS_START_NETWORK: 2031 case CCS_START_NETWORK:
@@ -2043,11 +2034,11 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2043 if (readb 2034 if (readb
2044 (&pccs->var.start_network.net_initiated) == 2035 (&pccs->var.start_network.net_initiated) ==
2045 1) { 2036 1) {
2046 DEBUG(0, 2037 dev_dbg(&link->dev,
2047 "ray_cs interrupt network \"%s\" started\n", 2038 "ray_cs interrupt network \"%s\" started\n",
2048 local->sparm.b4.a_current_ess_id); 2039 local->sparm.b4.a_current_ess_id);
2049 } else { 2040 } else {
2050 DEBUG(0, 2041 dev_dbg(&link->dev,
2051 "ray_cs interrupt network \"%s\" joined\n", 2042 "ray_cs interrupt network \"%s\" joined\n",
2052 local->sparm.b4.a_current_ess_id); 2043 local->sparm.b4.a_current_ess_id);
2053 } 2044 }
@@ -2075,12 +2066,12 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2075 local->timer.expires = jiffies + HZ * 5; 2066 local->timer.expires = jiffies + HZ * 5;
2076 local->timer.data = (long)local; 2067 local->timer.data = (long)local;
2077 if (status == CCS_START_NETWORK) { 2068 if (status == CCS_START_NETWORK) {
2078 DEBUG(0, 2069 dev_dbg(&link->dev,
2079 "ray_cs interrupt network \"%s\" start failed\n", 2070 "ray_cs interrupt network \"%s\" start failed\n",
2080 local->sparm.b4.a_current_ess_id); 2071 local->sparm.b4.a_current_ess_id);
2081 local->timer.function = &start_net; 2072 local->timer.function = &start_net;
2082 } else { 2073 } else {
2083 DEBUG(0, 2074 dev_dbg(&link->dev,
2084 "ray_cs interrupt network \"%s\" join failed\n", 2075 "ray_cs interrupt network \"%s\" join failed\n",
2085 local->sparm.b4.a_current_ess_id); 2076 local->sparm.b4.a_current_ess_id);
2086 local->timer.function = &join_net; 2077 local->timer.function = &join_net;
@@ -2091,19 +2082,19 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2091 case CCS_START_ASSOCIATION: 2082 case CCS_START_ASSOCIATION:
2092 if (status == CCS_COMMAND_COMPLETE) { 2083 if (status == CCS_COMMAND_COMPLETE) {
2093 local->card_status = CARD_ASSOC_COMPLETE; 2084 local->card_status = CARD_ASSOC_COMPLETE;
2094 DEBUG(0, "ray_cs association successful\n"); 2085 dev_dbg(&link->dev, "ray_cs association successful\n");
2095 } else { 2086 } else {
2096 DEBUG(0, "ray_cs association failed,\n"); 2087 dev_dbg(&link->dev, "ray_cs association failed,\n");
2097 local->card_status = CARD_ASSOC_FAILED; 2088 local->card_status = CARD_ASSOC_FAILED;
2098 join_net((u_long) local); 2089 join_net((u_long) local);
2099 } 2090 }
2100 break; 2091 break;
2101 case CCS_TX_REQUEST: 2092 case CCS_TX_REQUEST:
2102 if (status == CCS_COMMAND_COMPLETE) { 2093 if (status == CCS_COMMAND_COMPLETE) {
2103 DEBUG(3, 2094 dev_dbg(&link->dev,
2104 "ray_cs interrupt tx request complete\n"); 2095 "ray_cs interrupt tx request complete\n");
2105 } else { 2096 } else {
2106 DEBUG(1, 2097 dev_dbg(&link->dev,
2107 "ray_cs interrupt tx request failed\n"); 2098 "ray_cs interrupt tx request failed\n");
2108 } 2099 }
2109 if (!sniffer) 2100 if (!sniffer)
@@ -2111,21 +2102,21 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2111 netif_wake_queue(dev); 2102 netif_wake_queue(dev);
2112 break; 2103 break;
2113 case CCS_TEST_MEMORY: 2104 case CCS_TEST_MEMORY:
2114 DEBUG(1, "ray_cs interrupt mem test done\n"); 2105 dev_dbg(&link->dev, "ray_cs interrupt mem test done\n");
2115 break; 2106 break;
2116 case CCS_SHUTDOWN: 2107 case CCS_SHUTDOWN:
2117 DEBUG(1, 2108 dev_dbg(&link->dev,
2118 "ray_cs interrupt Unexpected CCS returned - Shutdown\n"); 2109 "ray_cs interrupt Unexpected CCS returned - Shutdown\n");
2119 break; 2110 break;
2120 case CCS_DUMP_MEMORY: 2111 case CCS_DUMP_MEMORY:
2121 DEBUG(1, "ray_cs interrupt dump memory done\n"); 2112 dev_dbg(&link->dev, "ray_cs interrupt dump memory done\n");
2122 break; 2113 break;
2123 case CCS_START_TIMER: 2114 case CCS_START_TIMER:
2124 DEBUG(2, 2115 dev_dbg(&link->dev,
2125 "ray_cs interrupt DING - raylink timer expired\n"); 2116 "ray_cs interrupt DING - raylink timer expired\n");
2126 break; 2117 break;
2127 default: 2118 default:
2128 DEBUG(1, 2119 dev_dbg(&link->dev,
2129 "ray_cs interrupt Unexpected CCS 0x%x returned 0x%x\n", 2120 "ray_cs interrupt Unexpected CCS 0x%x returned 0x%x\n",
2130 rcsindex, cmd); 2121 rcsindex, cmd);
2131 } 2122 }
@@ -2139,7 +2130,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2139 ray_rx(dev, local, prcs); 2130 ray_rx(dev, local, prcs);
2140 break; 2131 break;
2141 case REJOIN_NET_COMPLETE: 2132 case REJOIN_NET_COMPLETE:
2142 DEBUG(1, "ray_cs interrupt rejoin net complete\n"); 2133 dev_dbg(&link->dev, "ray_cs interrupt rejoin net complete\n");
2143 local->card_status = CARD_ACQ_COMPLETE; 2134 local->card_status = CARD_ACQ_COMPLETE;
2144 /* do we need to clear tx buffers CCS's? */ 2135 /* do we need to clear tx buffers CCS's? */
2145 if (local->sparm.b4.a_network_type == ADHOC) { 2136 if (local->sparm.b4.a_network_type == ADHOC) {
@@ -2149,7 +2140,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2149 memcpy_fromio(&local->bss_id, 2140 memcpy_fromio(&local->bss_id,
2150 prcs->var.rejoin_net_complete. 2141 prcs->var.rejoin_net_complete.
2151 bssid, ADDRLEN); 2142 bssid, ADDRLEN);
2152 DEBUG(1, 2143 dev_dbg(&link->dev,
2153 "ray_cs new BSSID = %02x%02x%02x%02x%02x%02x\n", 2144 "ray_cs new BSSID = %02x%02x%02x%02x%02x%02x\n",
2154 local->bss_id[0], local->bss_id[1], 2145 local->bss_id[0], local->bss_id[1],
2155 local->bss_id[2], local->bss_id[3], 2146 local->bss_id[2], local->bss_id[3],
@@ -2159,15 +2150,15 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2159 } 2150 }
2160 break; 2151 break;
2161 case ROAMING_INITIATED: 2152 case ROAMING_INITIATED:
2162 DEBUG(1, "ray_cs interrupt roaming initiated\n"); 2153 dev_dbg(&link->dev, "ray_cs interrupt roaming initiated\n");
2163 netif_stop_queue(dev); 2154 netif_stop_queue(dev);
2164 local->card_status = CARD_DOING_ACQ; 2155 local->card_status = CARD_DOING_ACQ;
2165 break; 2156 break;
2166 case JAPAN_CALL_SIGN_RXD: 2157 case JAPAN_CALL_SIGN_RXD:
2167 DEBUG(1, "ray_cs interrupt japan call sign rx\n"); 2158 dev_dbg(&link->dev, "ray_cs interrupt japan call sign rx\n");
2168 break; 2159 break;
2169 default: 2160 default:
2170 DEBUG(1, 2161 dev_dbg(&link->dev,
2171 "ray_cs Unexpected interrupt for RCS 0x%x cmd = 0x%x\n", 2162 "ray_cs Unexpected interrupt for RCS 0x%x cmd = 0x%x\n",
2172 rcsindex, 2163 rcsindex,
2173 (unsigned int)readb(&prcs->interrupt_id)); 2164 (unsigned int)readb(&prcs->interrupt_id));
@@ -2186,7 +2177,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local,
2186 int rx_len; 2177 int rx_len;
2187 unsigned int pkt_addr; 2178 unsigned int pkt_addr;
2188 void __iomem *pmsg; 2179 void __iomem *pmsg;
2189 DEBUG(4, "ray_rx process rx packet\n"); 2180 pr_debug("ray_rx process rx packet\n");
2190 2181
2191 /* Calculate address of packet within Rx buffer */ 2182 /* Calculate address of packet within Rx buffer */
2192 pkt_addr = ((readb(&prcs->var.rx_packet.rx_data_ptr[0]) << 8) 2183 pkt_addr = ((readb(&prcs->var.rx_packet.rx_data_ptr[0]) << 8)
@@ -2199,28 +2190,28 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local,
2199 pmsg = local->rmem + pkt_addr; 2190 pmsg = local->rmem + pkt_addr;
2200 switch (readb(pmsg)) { 2191 switch (readb(pmsg)) {
2201 case DATA_TYPE: 2192 case DATA_TYPE:
2202 DEBUG(4, "ray_rx data type\n"); 2193 pr_debug("ray_rx data type\n");
2203 rx_data(dev, prcs, pkt_addr, rx_len); 2194 rx_data(dev, prcs, pkt_addr, rx_len);
2204 break; 2195 break;
2205 case AUTHENTIC_TYPE: 2196 case AUTHENTIC_TYPE:
2206 DEBUG(4, "ray_rx authentic type\n"); 2197 pr_debug("ray_rx authentic type\n");
2207 if (sniffer) 2198 if (sniffer)
2208 rx_data(dev, prcs, pkt_addr, rx_len); 2199 rx_data(dev, prcs, pkt_addr, rx_len);
2209 else 2200 else
2210 rx_authenticate(local, prcs, pkt_addr, rx_len); 2201 rx_authenticate(local, prcs, pkt_addr, rx_len);
2211 break; 2202 break;
2212 case DEAUTHENTIC_TYPE: 2203 case DEAUTHENTIC_TYPE:
2213 DEBUG(4, "ray_rx deauth type\n"); 2204 pr_debug("ray_rx deauth type\n");
2214 if (sniffer) 2205 if (sniffer)
2215 rx_data(dev, prcs, pkt_addr, rx_len); 2206 rx_data(dev, prcs, pkt_addr, rx_len);
2216 else 2207 else
2217 rx_deauthenticate(local, prcs, pkt_addr, rx_len); 2208 rx_deauthenticate(local, prcs, pkt_addr, rx_len);
2218 break; 2209 break;
2219 case NULL_MSG_TYPE: 2210 case NULL_MSG_TYPE:
2220 DEBUG(3, "ray_cs rx NULL msg\n"); 2211 pr_debug("ray_cs rx NULL msg\n");
2221 break; 2212 break;
2222 case BEACON_TYPE: 2213 case BEACON_TYPE:
2223 DEBUG(4, "ray_rx beacon type\n"); 2214 pr_debug("ray_rx beacon type\n");
2224 if (sniffer) 2215 if (sniffer)
2225 rx_data(dev, prcs, pkt_addr, rx_len); 2216 rx_data(dev, prcs, pkt_addr, rx_len);
2226 2217
@@ -2233,7 +2224,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local,
2233 ray_get_stats(dev); 2224 ray_get_stats(dev);
2234 break; 2225 break;
2235 default: 2226 default:
2236 DEBUG(0, "ray_cs unknown pkt type %2x\n", 2227 pr_debug("ray_cs unknown pkt type %2x\n",
2237 (unsigned int)readb(pmsg)); 2228 (unsigned int)readb(pmsg));
2238 break; 2229 break;
2239 } 2230 }
@@ -2262,7 +2253,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs,
2262 rx_len > 2253 rx_len >
2263 (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + 2254 (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN +
2264 FCS_LEN)) { 2255 FCS_LEN)) {
2265 DEBUG(0, 2256 pr_debug(
2266 "ray_cs invalid packet length %d received \n", 2257 "ray_cs invalid packet length %d received \n",
2267 rx_len); 2258 rx_len);
2268 return; 2259 return;
@@ -2273,17 +2264,17 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs,
2273 rx_len > 2264 rx_len >
2274 (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + 2265 (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN +
2275 FCS_LEN)) { 2266 FCS_LEN)) {
2276 DEBUG(0, 2267 pr_debug(
2277 "ray_cs invalid packet length %d received \n", 2268 "ray_cs invalid packet length %d received \n",
2278 rx_len); 2269 rx_len);
2279 return; 2270 return;
2280 } 2271 }
2281 } 2272 }
2282 } 2273 }
2283 DEBUG(4, "ray_cs rx_data packet\n"); 2274 pr_debug("ray_cs rx_data packet\n");
2284 /* If fragmented packet, verify sizes of fragments add up */ 2275 /* If fragmented packet, verify sizes of fragments add up */
2285 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { 2276 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) {
2286 DEBUG(1, "ray_cs rx'ed fragment\n"); 2277 pr_debug("ray_cs rx'ed fragment\n");
2287 tmp = (readb(&prcs->var.rx_packet.totalpacketlength[0]) << 8) 2278 tmp = (readb(&prcs->var.rx_packet.totalpacketlength[0]) << 8)
2288 + readb(&prcs->var.rx_packet.totalpacketlength[1]); 2279 + readb(&prcs->var.rx_packet.totalpacketlength[1]);
2289 total_len = tmp; 2280 total_len = tmp;
@@ -2301,7 +2292,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs,
2301 } while (1); 2292 } while (1);
2302 2293
2303 if (tmp < 0) { 2294 if (tmp < 0) {
2304 DEBUG(0, 2295 pr_debug(
2305 "ray_cs rx_data fragment lengths don't add up\n"); 2296 "ray_cs rx_data fragment lengths don't add up\n");
2306 local->stats.rx_dropped++; 2297 local->stats.rx_dropped++;
2307 release_frag_chain(local, prcs); 2298 release_frag_chain(local, prcs);
@@ -2313,7 +2304,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs,
2313 2304
2314 skb = dev_alloc_skb(total_len + 5); 2305 skb = dev_alloc_skb(total_len + 5);
2315 if (skb == NULL) { 2306 if (skb == NULL) {
2316 DEBUG(0, "ray_cs rx_data could not allocate skb\n"); 2307 pr_debug("ray_cs rx_data could not allocate skb\n");
2317 local->stats.rx_dropped++; 2308 local->stats.rx_dropped++;
2318 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) 2309 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF)
2319 release_frag_chain(local, prcs); 2310 release_frag_chain(local, prcs);
@@ -2321,7 +2312,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs,
2321 } 2312 }
2322 skb_reserve(skb, 2); /* Align IP on 16 byte (TBD check this) */ 2313 skb_reserve(skb, 2); /* Align IP on 16 byte (TBD check this) */
2323 2314
2324 DEBUG(4, "ray_cs rx_data total_len = %x, rx_len = %x\n", total_len, 2315 pr_debug("ray_cs rx_data total_len = %x, rx_len = %x\n", total_len,
2325 rx_len); 2316 rx_len);
2326 2317
2327/************************/ 2318/************************/
@@ -2354,7 +2345,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs,
2354 tmp = 17; 2345 tmp = 17;
2355 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { 2346 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) {
2356 prcslink = prcs; 2347 prcslink = prcs;
2357 DEBUG(1, "ray_cs rx_data in fragment loop\n"); 2348 pr_debug("ray_cs rx_data in fragment loop\n");
2358 do { 2349 do {
2359 prcslink = rcs_base(local) 2350 prcslink = rcs_base(local)
2360 + 2351 +
@@ -2426,8 +2417,8 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len)
2426 memcpy(destaddr, ieee80211_get_DA(pmac), ADDRLEN); 2417 memcpy(destaddr, ieee80211_get_DA(pmac), ADDRLEN);
2427 memcpy(srcaddr, ieee80211_get_SA(pmac), ADDRLEN); 2418 memcpy(srcaddr, ieee80211_get_SA(pmac), ADDRLEN);
2428 2419
2429#ifdef PCMCIA_DEBUG 2420#if 0
2430 if (pc_debug > 3) { 2421 if {
2431 print_hex_dump(KERN_DEBUG, "skb->data before untranslate: ", 2422 print_hex_dump(KERN_DEBUG, "skb->data before untranslate: ",
2432 DUMP_PREFIX_NONE, 16, 1, 2423 DUMP_PREFIX_NONE, 16, 1,
2433 skb->data, 64, true); 2424 skb->data, 64, true);
@@ -2441,7 +2432,7 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len)
2441 2432
2442 if (psnap->dsap != 0xaa || psnap->ssap != 0xaa || psnap->ctrl != 3) { 2433 if (psnap->dsap != 0xaa || psnap->ssap != 0xaa || psnap->ctrl != 3) {
2443 /* not a snap type so leave it alone */ 2434 /* not a snap type so leave it alone */
2444 DEBUG(3, "ray_cs untranslate NOT SNAP %02x %02x %02x\n", 2435 pr_debug("ray_cs untranslate NOT SNAP %02x %02x %02x\n",
2445 psnap->dsap, psnap->ssap, psnap->ctrl); 2436 psnap->dsap, psnap->ssap, psnap->ctrl);
2446 2437
2447 delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; 2438 delta = RX_MAC_HEADER_LENGTH - ETH_HLEN;
@@ -2450,7 +2441,7 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len)
2450 } else { /* Its a SNAP */ 2441 } else { /* Its a SNAP */
2451 if (memcmp(psnap->org, org_bridge, 3) == 0) { 2442 if (memcmp(psnap->org, org_bridge, 3) == 0) {
2452 /* EtherII and nuke the LLC */ 2443 /* EtherII and nuke the LLC */
2453 DEBUG(3, "ray_cs untranslate Bridge encap\n"); 2444 pr_debug("ray_cs untranslate Bridge encap\n");
2454 delta = RX_MAC_HEADER_LENGTH 2445 delta = RX_MAC_HEADER_LENGTH
2455 + sizeof(struct snaphdr_t) - ETH_HLEN; 2446 + sizeof(struct snaphdr_t) - ETH_HLEN;
2456 peth = (struct ethhdr *)(skb->data + delta); 2447 peth = (struct ethhdr *)(skb->data + delta);
@@ -2459,14 +2450,14 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len)
2459 switch (ntohs(type)) { 2450 switch (ntohs(type)) {
2460 case ETH_P_IPX: 2451 case ETH_P_IPX:
2461 case ETH_P_AARP: 2452 case ETH_P_AARP:
2462 DEBUG(3, "ray_cs untranslate RFC IPX/AARP\n"); 2453 pr_debug("ray_cs untranslate RFC IPX/AARP\n");
2463 delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; 2454 delta = RX_MAC_HEADER_LENGTH - ETH_HLEN;
2464 peth = (struct ethhdr *)(skb->data + delta); 2455 peth = (struct ethhdr *)(skb->data + delta);
2465 peth->h_proto = 2456 peth->h_proto =
2466 htons(len - RX_MAC_HEADER_LENGTH); 2457 htons(len - RX_MAC_HEADER_LENGTH);
2467 break; 2458 break;
2468 default: 2459 default:
2469 DEBUG(3, "ray_cs untranslate RFC default\n"); 2460 pr_debug("ray_cs untranslate RFC default\n");
2470 delta = RX_MAC_HEADER_LENGTH + 2461 delta = RX_MAC_HEADER_LENGTH +
2471 sizeof(struct snaphdr_t) - ETH_HLEN; 2462 sizeof(struct snaphdr_t) - ETH_HLEN;
2472 peth = (struct ethhdr *)(skb->data + delta); 2463 peth = (struct ethhdr *)(skb->data + delta);
@@ -2482,12 +2473,12 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len)
2482 } 2473 }
2483/* TBD reserve skb_reserve(skb, delta); */ 2474/* TBD reserve skb_reserve(skb, delta); */
2484 skb_pull(skb, delta); 2475 skb_pull(skb, delta);
2485 DEBUG(3, "untranslate after skb_pull(%d), skb->data = %p\n", delta, 2476 pr_debug("untranslate after skb_pull(%d), skb->data = %p\n", delta,
2486 skb->data); 2477 skb->data);
2487 memcpy(peth->h_dest, destaddr, ADDRLEN); 2478 memcpy(peth->h_dest, destaddr, ADDRLEN);
2488 memcpy(peth->h_source, srcaddr, ADDRLEN); 2479 memcpy(peth->h_source, srcaddr, ADDRLEN);
2489#ifdef PCMCIA_DEBUG 2480#if 0
2490 if (pc_debug > 3) { 2481 {
2491 int i; 2482 int i;
2492 printk(KERN_DEBUG "skb->data after untranslate:"); 2483 printk(KERN_DEBUG "skb->data after untranslate:");
2493 for (i = 0; i < 64; i++) 2484 for (i = 0; i < 64; i++)
@@ -2529,7 +2520,7 @@ static void release_frag_chain(ray_dev_t *local, struct rcs __iomem *prcs)
2529 while (tmp--) { 2520 while (tmp--) {
2530 writeb(CCS_BUFFER_FREE, &prcslink->buffer_status); 2521 writeb(CCS_BUFFER_FREE, &prcslink->buffer_status);
2531 if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) { 2522 if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) {
2532 DEBUG(1, "ray_cs interrupt bad rcsindex = 0x%x\n", 2523 pr_debug("ray_cs interrupt bad rcsindex = 0x%x\n",
2533 rcsindex); 2524 rcsindex);
2534 break; 2525 break;
2535 } 2526 }
@@ -2543,9 +2534,9 @@ static void release_frag_chain(ray_dev_t *local, struct rcs __iomem *prcs)
2543static void authenticate(ray_dev_t *local) 2534static void authenticate(ray_dev_t *local)
2544{ 2535{
2545 struct pcmcia_device *link = local->finder; 2536 struct pcmcia_device *link = local->finder;
2546 DEBUG(0, "ray_cs Starting authentication.\n"); 2537 dev_dbg(&link->dev, "ray_cs Starting authentication.\n");
2547 if (!(pcmcia_dev_present(link))) { 2538 if (!(pcmcia_dev_present(link))) {
2548 DEBUG(2, "ray_cs authenticate - device not present\n"); 2539 dev_dbg(&link->dev, "ray_cs authenticate - device not present\n");
2549 return; 2540 return;
2550 } 2541 }
2551 2542
@@ -2573,11 +2564,11 @@ static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs,
2573 copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff); 2564 copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff);
2574 /* if we are trying to get authenticated */ 2565 /* if we are trying to get authenticated */
2575 if (local->sparm.b4.a_network_type == ADHOC) { 2566 if (local->sparm.b4.a_network_type == ADHOC) {
2576 DEBUG(1, "ray_cs rx_auth var= %02x %02x %02x %02x %02x %02x\n", 2567 pr_debug("ray_cs rx_auth var= %02x %02x %02x %02x %02x %02x\n",
2577 msg->var[0], msg->var[1], msg->var[2], msg->var[3], 2568 msg->var[0], msg->var[1], msg->var[2], msg->var[3],
2578 msg->var[4], msg->var[5]); 2569 msg->var[4], msg->var[5]);
2579 if (msg->var[2] == 1) { 2570 if (msg->var[2] == 1) {
2580 DEBUG(0, "ray_cs Sending authentication response.\n"); 2571 pr_debug("ray_cs Sending authentication response.\n");
2581 if (!build_auth_frame 2572 if (!build_auth_frame
2582 (local, msg->mac.addr_2, OPEN_AUTH_RESPONSE)) { 2573 (local, msg->mac.addr_2, OPEN_AUTH_RESPONSE)) {
2583 local->authentication_state = NEED_TO_AUTH; 2574 local->authentication_state = NEED_TO_AUTH;
@@ -2591,13 +2582,13 @@ static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs,
2591 /* Verify authentication sequence #2 and success */ 2582 /* Verify authentication sequence #2 and success */
2592 if (msg->var[2] == 2) { 2583 if (msg->var[2] == 2) {
2593 if ((msg->var[3] | msg->var[4]) == 0) { 2584 if ((msg->var[3] | msg->var[4]) == 0) {
2594 DEBUG(1, "Authentication successful\n"); 2585 pr_debug("Authentication successful\n");
2595 local->card_status = CARD_AUTH_COMPLETE; 2586 local->card_status = CARD_AUTH_COMPLETE;
2596 associate(local); 2587 associate(local);
2597 local->authentication_state = 2588 local->authentication_state =
2598 AUTHENTICATED; 2589 AUTHENTICATED;
2599 } else { 2590 } else {
2600 DEBUG(0, "Authentication refused\n"); 2591 pr_debug("Authentication refused\n");
2601 local->card_status = CARD_AUTH_REFUSED; 2592 local->card_status = CARD_AUTH_REFUSED;
2602 join_net((u_long) local); 2593 join_net((u_long) local);
2603 local->authentication_state = 2594 local->authentication_state =
@@ -2617,22 +2608,22 @@ static void associate(ray_dev_t *local)
2617 struct net_device *dev = link->priv; 2608 struct net_device *dev = link->priv;
2618 int ccsindex; 2609 int ccsindex;
2619 if (!(pcmcia_dev_present(link))) { 2610 if (!(pcmcia_dev_present(link))) {
2620 DEBUG(2, "ray_cs associate - device not present\n"); 2611 dev_dbg(&link->dev, "ray_cs associate - device not present\n");
2621 return; 2612 return;
2622 } 2613 }
2623 /* If no tx buffers available, return */ 2614 /* If no tx buffers available, return */
2624 if ((ccsindex = get_free_ccs(local)) < 0) { 2615 if ((ccsindex = get_free_ccs(local)) < 0) {
2625/* TBD should never be here but... what if we are? */ 2616/* TBD should never be here but... what if we are? */
2626 DEBUG(1, "ray_cs associate - No free ccs\n"); 2617 dev_dbg(&link->dev, "ray_cs associate - No free ccs\n");
2627 return; 2618 return;
2628 } 2619 }
2629 DEBUG(1, "ray_cs Starting association with access point\n"); 2620 dev_dbg(&link->dev, "ray_cs Starting association with access point\n");
2630 pccs = ccs_base(local) + ccsindex; 2621 pccs = ccs_base(local) + ccsindex;
2631 /* fill in the CCS */ 2622 /* fill in the CCS */
2632 writeb(CCS_START_ASSOCIATION, &pccs->cmd); 2623 writeb(CCS_START_ASSOCIATION, &pccs->cmd);
2633 /* Interrupt the firmware to process the command */ 2624 /* Interrupt the firmware to process the command */
2634 if (interrupt_ecf(local, ccsindex)) { 2625 if (interrupt_ecf(local, ccsindex)) {
2635 DEBUG(1, "ray_cs associate failed - ECF not ready for intr\n"); 2626 dev_dbg(&link->dev, "ray_cs associate failed - ECF not ready for intr\n");
2636 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); 2627 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
2637 2628
2638 del_timer(&local->timer); 2629 del_timer(&local->timer);
@@ -2655,7 +2646,7 @@ static void rx_deauthenticate(ray_dev_t *local, struct rcs __iomem *prcs,
2655/* UCHAR buff[256]; 2646/* UCHAR buff[256];
2656 struct rx_msg *msg = (struct rx_msg *)buff; 2647 struct rx_msg *msg = (struct rx_msg *)buff;
2657*/ 2648*/
2658 DEBUG(0, "Deauthentication frame received\n"); 2649 pr_debug("Deauthentication frame received\n");
2659 local->authentication_state = UNAUTHENTICATED; 2650 local->authentication_state = UNAUTHENTICATED;
2660 /* Need to reauthenticate or rejoin depending on reason code */ 2651 /* Need to reauthenticate or rejoin depending on reason code */
2661/* copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff); 2652/* copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff);
@@ -2823,7 +2814,7 @@ static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type)
2823 2814
2824 /* If no tx buffers available, return */ 2815 /* If no tx buffers available, return */
2825 if ((ccsindex = get_free_tx_ccs(local)) < 0) { 2816 if ((ccsindex = get_free_tx_ccs(local)) < 0) {
2826 DEBUG(1, "ray_cs send authenticate - No free tx ccs\n"); 2817 pr_debug("ray_cs send authenticate - No free tx ccs\n");
2827 return -1; 2818 return -1;
2828 } 2819 }
2829 2820
@@ -2855,7 +2846,7 @@ static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type)
2855 2846
2856 /* Interrupt the firmware to process the command */ 2847 /* Interrupt the firmware to process the command */
2857 if (interrupt_ecf(local, ccsindex)) { 2848 if (interrupt_ecf(local, ccsindex)) {
2858 DEBUG(1, 2849 pr_debug(
2859 "ray_cs send authentication request failed - ECF not ready for intr\n"); 2850 "ray_cs send authentication request failed - ECF not ready for intr\n");
2860 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); 2851 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
2861 return -1; 2852 return -1;
@@ -2942,9 +2933,9 @@ static int __init init_ray_cs(void)
2942{ 2933{
2943 int rc; 2934 int rc;
2944 2935
2945 DEBUG(1, "%s\n", rcsid); 2936 pr_debug("%s\n", rcsid);
2946 rc = pcmcia_register_driver(&ray_driver); 2937 rc = pcmcia_register_driver(&ray_driver);
2947 DEBUG(1, "raylink init_module register_pcmcia_driver returns 0x%x\n", 2938 pr_debug("raylink init_module register_pcmcia_driver returns 0x%x\n",
2948 rc); 2939 rc);
2949 2940
2950#ifdef CONFIG_PROC_FS 2941#ifdef CONFIG_PROC_FS
@@ -2964,7 +2955,7 @@ static int __init init_ray_cs(void)
2964 2955
2965static void __exit exit_ray_cs(void) 2956static void __exit exit_ray_cs(void)
2966{ 2957{
2967 DEBUG(0, "ray_cs: cleanup_module\n"); 2958 pr_debug("ray_cs: cleanup_module\n");
2968 2959
2969#ifdef CONFIG_PROC_FS 2960#ifdef CONFIG_PROC_FS
2970 remove_proc_entry("driver/ray_cs/ray_cs", NULL); 2961 remove_proc_entry("driver/ray_cs/ray_cs", NULL);