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