Lines Matching +full:firmware +full:- +full:initialised
1 // SPDX-License-Identifier: GPL-2.0-only
11 * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/08/2000
12 * - reorganize kmallocs in ray_attach, checking all for failure
15 * Daniele Bellucci <bellucda@tiscali.it> - 07/10/2003
16 * - Audit copy_to_user in ioctl(SIOCGIWESSID)
194 0xff, 0xff, /* roam-low snr, low snr count */
197 /* b4 - b5 differences start here */
229 0xff, 0xff, /* roam-low snr, low snr count */
232 /* b4 - b5 differences start here */
255 "Raylink/WebGear wireless LAN - Corey <Thomas corey@world.std.com>";
274 dev_dbg(&p_dev->dev, "ray_attach()\n"); in ray_probe()
276 /* Allocate space for private device-specific data */ in ray_probe()
282 local->finder = p_dev; in ray_probe()
285 p_dev->resource[0]->end = 0; in ray_probe()
286 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; in ray_probe()
289 p_dev->config_flags |= CONF_ENABLE_IRQ; in ray_probe()
290 p_dev->config_index = 1; in ray_probe()
292 p_dev->priv = dev; in ray_probe()
294 local->finder = p_dev; in ray_probe()
295 local->card_status = CARD_INSERTED; in ray_probe()
296 local->authentication_state = UNAUTHENTICATED; in ray_probe()
297 local->num_multi = 0; in ray_probe()
298 dev_dbg(&p_dev->dev, "ray_attach p_dev = %p, dev = %p, local = %p, intr = %p\n", in ray_probe()
302 dev->netdev_ops = &ray_netdev_ops; in ray_probe()
303 dev->wireless_handlers = &ray_handler_def; in ray_probe()
305 local->wireless_data.spy_data = &local->spy_data; in ray_probe()
306 dev->wireless_data = &local->wireless_data; in ray_probe()
310 dev_dbg(&p_dev->dev, "ray_cs ray_attach calling ether_setup.)\n"); in ray_probe()
313 timer_setup(&local->timer, NULL, 0); in ray_probe()
319 return -ENOMEM; in ray_probe()
327 dev_dbg(&link->dev, "ray_detach\n"); in ray_detach()
330 dev = link->priv; in ray_detach()
335 del_timer_sync(&local->timer); in ray_detach()
337 if (link->priv) { in ray_detach()
341 dev_dbg(&link->dev, "ray_cs ray_detach ending\n"); in ray_detach()
349 struct net_device *dev = (struct net_device *)link->priv; in ray_config()
352 dev_dbg(&link->dev, "ray_config\n"); in ray_config()
354 /* Determine card type and firmware version */ in ray_config()
356 link->prod_id[0] ? link->prod_id[0] : " ", in ray_config()
357 link->prod_id[1] ? link->prod_id[1] : " ", in ray_config()
358 link->prod_id[2] ? link->prod_id[2] : " ", in ray_config()
359 link->prod_id[3] ? link->prod_id[3] : " "); in ray_config()
367 dev->irq = link->irq; in ray_config()
374 link->resource[2]->flags |= WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; in ray_config()
375 link->resource[2]->start = 0; in ray_config()
376 link->resource[2]->end = 0x8000; in ray_config()
377 ret = pcmcia_request_window(link, link->resource[2], ray_mem_speed); in ray_config()
380 ret = pcmcia_map_mem_page(link, link->resource[2], 0); in ray_config()
383 local->sram = ioremap(link->resource[2]->start, in ray_config()
384 resource_size(link->resource[2])); in ray_config()
387 link->resource[3]->flags |= in ray_config()
389 link->resource[3]->start = 0; in ray_config()
390 link->resource[3]->end = 0x4000; in ray_config()
391 ret = pcmcia_request_window(link, link->resource[3], ray_mem_speed); in ray_config()
394 ret = pcmcia_map_mem_page(link, link->resource[3], 0x8000); in ray_config()
397 local->rmem = ioremap(link->resource[3]->start, in ray_config()
398 resource_size(link->resource[3])); in ray_config()
401 link->resource[4]->flags |= in ray_config()
403 link->resource[4]->start = 0; in ray_config()
404 link->resource[4]->end = 0x1000; in ray_config()
405 ret = pcmcia_request_window(link, link->resource[4], ray_mem_speed); in ray_config()
408 ret = pcmcia_map_mem_page(link, link->resource[4], 0); in ray_config()
411 local->amem = ioremap(link->resource[4]->start, in ray_config()
412 resource_size(link->resource[4])); in ray_config()
414 dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); in ray_config()
415 dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); in ray_config()
416 dev_dbg(&link->dev, "ray_config amem=%p\n", local->amem); in ray_config()
419 return -ENODEV; in ray_config()
422 SET_NETDEV_DEV(dev, &link->dev); in ray_config()
431 dev->name, dev->irq, dev->dev_addr); in ray_config()
437 return -ENODEV; in ray_config()
442 return dev->sram + CCS_BASE; in ccs_base()
454 return dev->sram + CCS_BASE; in rcs_base()
463 struct pcmcia_device *link = local->finder; in ray_init()
464 dev_dbg(&link->dev, "ray_init(0x%p)\n", dev); in ray_init()
466 dev_dbg(&link->dev, "ray_init - device not present\n"); in ray_init()
467 return -1; in ray_init()
470 local->net_type = net_type; in ray_init()
471 local->sta_type = TYPE_STA; in ray_init()
474 memcpy_fromio(&local->startup_res, local->sram + ECF_TO_HOST_BASE, in ray_init()
478 if (local->startup_res.startup_word != 0x80) { in ray_init()
480 local->startup_res.startup_word); in ray_init()
481 local->card_status = CARD_INIT_ERROR; in ray_init()
482 return -1; in ray_init()
485 local->fw_ver = local->startup_res.firmware_version[0]; in ray_init()
486 local->fw_bld = local->startup_res.firmware_version[1]; in ray_init()
487 local->fw_var = local->startup_res.firmware_version[2]; in ray_init()
488 dev_dbg(&link->dev, "ray_init firmware version %d.%d\n", local->fw_ver, in ray_init()
489 local->fw_bld); in ray_init()
491 local->tib_length = 0x20; in ray_init()
492 if ((local->fw_ver == 5) && (local->fw_bld >= 30)) in ray_init()
493 local->tib_length = local->startup_res.tib_length; in ray_init()
494 dev_dbg(&link->dev, "ray_init tib_length = 0x%02x\n", local->tib_length); in ray_init()
498 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); in ray_init()
503 if (!parse_addr(phy_addr, local->sparm.b4.a_mac_addr)) { in ray_init()
504 memcpy(&local->sparm.b4.a_mac_addr, in ray_init()
505 &local->startup_res.station_addr, ADDRLEN); in ray_init()
509 local->card_status = CARD_AWAITING_PARAM; in ray_init()
510 dev_dbg(&link->dev, "ray_init ending\n"); in ray_init()
521 struct pcmcia_device *link = local->finder; in dl_startup_params()
523 dev_dbg(&link->dev, "dl_startup_params entered\n"); in dl_startup_params()
525 dev_dbg(&link->dev, "ray_cs dl_startup_params - device not present\n"); in dl_startup_params()
526 return -1; in dl_startup_params()
530 if (local->fw_ver == 0x55) in dl_startup_params()
531 memcpy_toio(local->sram + HOST_TO_ECF_BASE, &local->sparm.b4, in dl_startup_params()
534 memcpy_toio(local->sram + HOST_TO_ECF_BASE, &local->sparm.b5, in dl_startup_params()
539 return -1; in dl_startup_params()
540 local->dl_param_ccs = ccsindex; in dl_startup_params()
542 writeb(CCS_DOWNLOAD_STARTUP_PARAMS, &pccs->cmd); in dl_startup_params()
543 dev_dbg(&link->dev, "dl_startup_params start ccsindex = %d\n", in dl_startup_params()
544 local->dl_param_ccs); in dl_startup_params()
545 /* Interrupt the firmware to process the command */ in dl_startup_params()
547 printk(KERN_INFO "ray dl_startup_params failed - " in dl_startup_params()
549 local->card_status = CARD_DL_PARAM_ERROR; in dl_startup_params()
550 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); in dl_startup_params()
551 return -2; in dl_startup_params()
553 local->card_status = CARD_DL_PARAM; in dl_startup_params()
555 local->timer.expires = jiffies + HZ / 2; in dl_startup_params()
556 local->timer.function = verify_dl_startup; in dl_startup_params()
557 add_timer(&local->timer); in dl_startup_params()
558 dev_dbg(&link->dev, in dl_startup_params()
573 * New 802.11D6.1 format. Card firmware is still using old format in init_startup_params()
584 if (local->fw_ver == 0x55) { in init_startup_params()
585 memcpy(&local->sparm.b4, b4_default_startup_parms, in init_startup_params()
590 local->sparm.b4.a_hop_time[0] = (i >> 16) & 0xff; in init_startup_params()
591 local->sparm.b4.a_hop_time[1] = (i >> 8) & 0xff; in init_startup_params()
592 local->sparm.b4.a_beacon_period[0] = 0; in init_startup_params()
593 local->sparm.b4.a_beacon_period[1] = in init_startup_params()
594 ((beacon_period / hop_dwell) - 1) & 0xff; in init_startup_params()
595 local->sparm.b4.a_curr_country_code = country; in init_startup_params()
596 local->sparm.b4.a_hop_pattern_length = in init_startup_params()
597 hop_pattern_length[(int)country] - 1; in init_startup_params()
599 local->sparm.b4.a_ack_timeout = 0x50; in init_startup_params()
600 local->sparm.b4.a_sifs = 0x3f; in init_startup_params()
603 memcpy((UCHAR *) &local->sparm.b5, b5_default_startup_parms, in init_startup_params()
606 local->sparm.b5.a_hop_time[0] = (hop_dwell >> 8) & 0xff; in init_startup_params()
607 local->sparm.b5.a_hop_time[1] = hop_dwell & 0xff; in init_startup_params()
608 local->sparm.b5.a_beacon_period[0] = in init_startup_params()
610 local->sparm.b5.a_beacon_period[1] = beacon_period & 0xff; in init_startup_params()
612 local->sparm.b5.a_power_mgt_state = 1; in init_startup_params()
613 local->sparm.b5.a_curr_country_code = country; in init_startup_params()
614 local->sparm.b5.a_hop_pattern_length = in init_startup_params()
618 local->sparm.b4.a_network_type = net_type & 0x01; in init_startup_params()
619 local->sparm.b4.a_acting_as_ap_status = TYPE_STA; in init_startup_params()
622 strncpy(local->sparm.b4.a_current_ess_id, essid, ESSID_SIZE); in init_startup_params()
629 struct ccs __iomem *pccs = ccs_base(local) + local->dl_param_ccs; in verify_dl_startup()
631 struct pcmcia_device *link = local->finder; in verify_dl_startup()
634 dev_dbg(&link->dev, "ray_cs verify_dl_startup - device not present\n"); in verify_dl_startup()
642 local->dl_param_ccs); in verify_dl_startup()
645 (unsigned int)readb(local->sram + in verify_dl_startup()
652 status = readb(&pccs->buffer_status); in verify_dl_startup()
657 local->card_status = CARD_DL_PARAM_ERROR; in verify_dl_startup()
660 if (local->sparm.b4.a_network_type == ADHOC) in verify_dl_startup()
661 start_net(&local->timer); in verify_dl_startup()
663 join_net(&local->timer); in verify_dl_startup()
673 struct pcmcia_device *link = local->finder; in start_net()
675 dev_dbg(&link->dev, "ray_cs start_net - device not present\n"); in start_net()
682 writeb(CCS_START_NETWORK, &pccs->cmd); in start_net()
683 writeb(0, &pccs->var.start_network.update_param); in start_net()
684 /* Interrupt the firmware to process the command */ in start_net()
686 dev_dbg(&link->dev, "ray start net failed - card not ready for intr\n"); in start_net()
687 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); in start_net()
690 local->card_status = CARD_DOING_ACQ; in start_net()
701 struct pcmcia_device *link = local->finder; in join_net()
704 dev_dbg(&link->dev, "ray_cs join_net - device not present\n"); in join_net()
711 writeb(CCS_JOIN_NETWORK, &pccs->cmd); in join_net()
712 writeb(0, &pccs->var.join_network.update_param); in join_net()
713 writeb(0, &pccs->var.join_network.net_initiated); in join_net()
714 /* Interrupt the firmware to process the command */ in join_net()
716 dev_dbg(&link->dev, "ray join net failed - card not ready for intr\n"); in join_net()
717 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); in join_net()
720 local->card_status = CARD_DOING_ACQ; in join_net()
726 struct net_device *dev = link->priv; in ray_release()
729 dev_dbg(&link->dev, "ray_release\n"); in ray_release()
731 del_timer(&local->timer); in ray_release()
733 iounmap(local->sram); in ray_release()
734 iounmap(local->rmem); in ray_release()
735 iounmap(local->amem); in ray_release()
738 dev_dbg(&link->dev, "ray_release ending\n"); in ray_release()
743 struct net_device *dev = link->priv; in ray_suspend()
745 if (link->open) in ray_suspend()
753 struct net_device *dev = link->priv; in ray_resume()
755 if (link->open) { in ray_resume()
770 struct pcmcia_device *link = local->finder; in ray_dev_init()
772 dev_dbg(&link->dev, "ray_dev_init(dev=%p)\n", dev); in ray_dev_init()
774 dev_dbg(&link->dev, "ray_dev_init - device not present\n"); in ray_dev_init()
775 return -1; in ray_dev_init()
780 printk(KERN_INFO "ray_dev_init dl_startup_params failed - " in ray_dev_init()
782 return -1; in ray_dev_init()
787 * in ray_open() - Jean II */ in ray_dev_init()
788 dev_dbg(&link->dev, in ray_dev_init()
790 local->card_status); in ray_dev_init()
794 memcpy(dev->dev_addr, &local->sparm.b4.a_mac_addr, ADDRLEN); in ray_dev_init()
795 eth_broadcast_addr(dev->broadcast); in ray_dev_init()
797 dev_dbg(&link->dev, "ray_dev_init ending\n"); in ray_dev_init()
805 struct pcmcia_device *link = local->finder; in ray_dev_config()
807 dev_dbg(&link->dev, "ray_dev_config(dev=%p,ifmap=%p)\n", dev, map); in ray_dev_config()
809 dev_dbg(&link->dev, "ray_dev_config - device not present\n"); in ray_dev_config()
810 return -1; in ray_dev_config()
821 struct pcmcia_device *link = local->finder; in ray_dev_start_xmit()
822 short length = skb->len; in ray_dev_start_xmit()
825 dev_dbg(&link->dev, "ray_dev_start_xmit - device not present\n"); in ray_dev_start_xmit()
830 dev_dbg(&link->dev, "ray_dev_start_xmit(skb=%p, dev=%p)\n", skb, dev); in ray_dev_start_xmit()
831 if (local->authentication_state == NEED_TO_AUTH) { in ray_dev_start_xmit()
832 dev_dbg(&link->dev, "ray_cs Sending authentication request.\n"); in ray_dev_start_xmit()
833 if (!build_auth_frame(local, local->auth_id, OPEN_AUTH_REQUEST)) { in ray_dev_start_xmit()
834 local->authentication_state = AUTHENTICATED; in ray_dev_start_xmit()
845 switch (ray_hw_xmit(skb->data, length, dev, DATA_TYPE)) { in ray_dev_start_xmit()
893 local->stats.tx_bytes += len; in ray_hw_xmit()
894 local->stats.tx_packets++; in ray_hw_xmit()
897 ptx = local->sram + addr; in ray_hw_xmit()
903 /* TBD TIB length will move address of ptx->var */ in ray_hw_xmit()
904 memcpy_toio(&ptx->var, data, len); in ray_hw_xmit()
911 writeb(CCS_TX_REQUEST, &pccs->cmd); in ray_hw_xmit()
912 writeb(addr >> 8, &pccs->var.tx_request.tx_data_ptr[0]); in ray_hw_xmit()
913 writeb(local->tib_length, &pccs->var.tx_request.tx_data_ptr[1]); in ray_hw_xmit()
914 writeb(len >> 8, &pccs->var.tx_request.tx_data_length[0]); in ray_hw_xmit()
915 writeb(len & 0xff, &pccs->var.tx_request.tx_data_length[1]); in ray_hw_xmit()
917 writeb(PSM_CAM, &pccs->var.tx_request.pow_sav_mode); in ray_hw_xmit()
918 writeb(local->net_default_tx_rate, &pccs->var.tx_request.tx_rate); in ray_hw_xmit()
919 writeb(0, &pccs->var.tx_request.antenna); in ray_hw_xmit()
921 local->net_default_tx_rate); in ray_hw_xmit()
923 /* Interrupt the firmware to process the command */ in ray_hw_xmit()
925 pr_debug("ray_hw_xmit failed - ECF not ready for intr\n"); in ray_hw_xmit()
930 writeb(CCS_BUFFER_FREE, &pccs->buffer_status); in ray_hw_xmit()
940 __be16 proto = ((struct ethhdr *)data)->h_proto; in translate_frame()
944 memcpy_toio(&ptx->var, eth2_llc, sizeof(eth2_llc)); in translate_frame()
945 memcpy_toio(((void __iomem *)&ptx->var) + sizeof(eth2_llc), in translate_frame()
950 &((struct snaphdr_t __iomem *)ptx->var)->org[2]); in translate_frame()
953 memcpy_toio((void __iomem *)&ptx->var + in translate_frame()
955 len - ETH_HLEN); in translate_frame()
956 return (int)sizeof(struct snaphdr_t) - ETH_HLEN; in translate_frame()
961 memcpy_toio(&ptx->var, data + ETH_HLEN, len - ETH_HLEN); in translate_frame()
962 return 0 - ETH_HLEN; in translate_frame()
964 memcpy_toio(&ptx->var, data + ETH_HLEN, len - ETH_HLEN); in translate_frame()
965 return 0 - ETH_HLEN; in translate_frame()
974 writeb(PROTOCOL_VER | msg_type, &ptx->mac.frame_ctl_1); in ray_build_header()
982 if (local->net_type == ADHOC) { in ray_build_header()
983 writeb(0, &ptx->mac.frame_ctl_2); in ray_build_header()
984 memcpy_toio(ptx->mac.addr_1, ((struct ethhdr *)data)->h_dest, in ray_build_header()
986 memcpy_toio(ptx->mac.addr_3, local->bss_id, ADDRLEN); in ray_build_header()
989 if (local->sparm.b4.a_acting_as_ap_status) { in ray_build_header()
990 writeb(FC2_FROM_DS, &ptx->mac.frame_ctl_2); in ray_build_header()
991 memcpy_toio(ptx->mac.addr_1, in ray_build_header()
992 ((struct ethhdr *)data)->h_dest, ADDRLEN); in ray_build_header()
993 memcpy_toio(ptx->mac.addr_2, local->bss_id, 6); in ray_build_header()
994 memcpy_toio(ptx->mac.addr_3, in ray_build_header()
995 ((struct ethhdr *)data)->h_source, ADDRLEN); in ray_build_header()
998 writeb(FC2_TO_DS, &ptx->mac.frame_ctl_2); in ray_build_header()
999 memcpy_toio(ptx->mac.addr_1, local->bss_id, ADDRLEN); in ray_build_header()
1000 memcpy_toio(ptx->mac.addr_2, in ray_build_header()
1001 ((struct ethhdr *)data)->h_source, ADDRLEN); in ray_build_header()
1002 memcpy_toio(ptx->mac.addr_3, in ray_build_header()
1003 ((struct ethhdr *)data)->h_dest, ADDRLEN); in ray_build_header()
1010 /*------------------------------------------------------------------*/
1017 strcpy(wrqu->name, "IEEE 802.11-FH"); in ray_get_name()
1021 /*------------------------------------------------------------------*/
1029 int err = -EINPROGRESS; /* Call commit handler */ in ray_set_freq()
1031 /* Reject if card is already initialised */ in ray_set_freq()
1032 if (local->card_status != CARD_AWAITING_PARAM) in ray_set_freq()
1033 return -EBUSY; in ray_set_freq()
1036 if ((wrqu->freq.m > USA_HOP_MOD) || (wrqu->freq.e > 0)) in ray_set_freq()
1037 err = -EOPNOTSUPP; in ray_set_freq()
1039 local->sparm.b5.a_hop_pattern = wrqu->freq.m; in ray_set_freq()
1044 /*------------------------------------------------------------------*/
1053 wrqu->freq.m = local->sparm.b5.a_hop_pattern; in ray_get_freq()
1054 wrqu->freq.e = 0; in ray_get_freq()
1058 /*------------------------------------------------------------------*/
1067 /* Reject if card is already initialised */ in ray_set_essid()
1068 if (local->card_status != CARD_AWAITING_PARAM) in ray_set_essid()
1069 return -EBUSY; in ray_set_essid()
1072 if (wrqu->essid.flags == 0) in ray_set_essid()
1074 return -EOPNOTSUPP; in ray_set_essid()
1077 if (wrqu->essid.length > IW_ESSID_MAX_SIZE) in ray_set_essid()
1078 return -E2BIG; in ray_set_essid()
1081 memset(local->sparm.b5.a_current_ess_id, 0, IW_ESSID_MAX_SIZE); in ray_set_essid()
1082 memcpy(local->sparm.b5.a_current_ess_id, extra, wrqu->essid.length); in ray_set_essid()
1084 return -EINPROGRESS; /* Call commit handler */ in ray_set_essid()
1087 /*------------------------------------------------------------------*/
1098 memcpy(extra, local->sparm.b5.a_current_ess_id, IW_ESSID_MAX_SIZE); in ray_get_essid()
1099 memcpy(tmp, local->sparm.b5.a_current_ess_id, IW_ESSID_MAX_SIZE); in ray_get_essid()
1103 wrqu->essid.length = strlen(tmp); in ray_get_essid()
1104 wrqu->essid.flags = 1; /* active */ in ray_get_essid()
1109 /*------------------------------------------------------------------*/
1118 memcpy(wrqu->ap_addr.sa_data, local->bss_id, ETH_ALEN); in ray_get_wap()
1119 wrqu->ap_addr.sa_family = ARPHRD_ETHER; in ray_get_wap()
1124 /*------------------------------------------------------------------*/
1126 * Wireless Handler : set Bit-Rate
1133 /* Reject if card is already initialised */ in ray_set_rate()
1134 if (local->card_status != CARD_AWAITING_PARAM) in ray_set_rate()
1135 return -EBUSY; in ray_set_rate()
1138 if ((wrqu->bitrate.value != 1000000) && (wrqu->bitrate.value != 2000000)) in ray_set_rate()
1139 return -EINVAL; in ray_set_rate()
1142 if ((local->fw_ver == 0x55) && /* Please check */ in ray_set_rate()
1143 (wrqu->bitrate.value == 2000000)) in ray_set_rate()
1144 local->net_default_tx_rate = 3; in ray_set_rate()
1146 local->net_default_tx_rate = wrqu->bitrate.value / 500000; in ray_set_rate()
1151 /*------------------------------------------------------------------*/
1153 * Wireless Handler : get Bit-Rate
1160 if (local->net_default_tx_rate == 3) in ray_get_rate()
1161 wrqu->bitrate.value = 2000000; /* Hum... */ in ray_get_rate()
1163 wrqu->bitrate.value = local->net_default_tx_rate * 500000; in ray_get_rate()
1164 wrqu->bitrate.fixed = 0; /* We are in auto mode */ in ray_get_rate()
1169 /*------------------------------------------------------------------*/
1177 int rthr = wrqu->rts.value; in ray_set_rts()
1179 /* Reject if card is already initialised */ in ray_set_rts()
1180 if (local->card_status != CARD_AWAITING_PARAM) in ray_set_rts()
1181 return -EBUSY; in ray_set_rts()
1183 /* if(wrq->u.rts.fixed == 0) we should complain */ in ray_set_rts()
1184 if (wrqu->rts.disabled) in ray_set_rts()
1188 return -EINVAL; in ray_set_rts()
1190 local->sparm.b5.a_rts_threshold[0] = (rthr >> 8) & 0xFF; in ray_set_rts()
1191 local->sparm.b5.a_rts_threshold[1] = rthr & 0xFF; in ray_set_rts()
1193 return -EINPROGRESS; /* Call commit handler */ in ray_set_rts()
1196 /*------------------------------------------------------------------*/
1205 wrqu->rts.value = (local->sparm.b5.a_rts_threshold[0] << 8) in ray_get_rts()
1206 + local->sparm.b5.a_rts_threshold[1]; in ray_get_rts()
1207 wrqu->rts.disabled = (wrqu->rts.value == 32767); in ray_get_rts()
1208 wrqu->rts.fixed = 1; in ray_get_rts()
1213 /*------------------------------------------------------------------*/
1221 int fthr = wrqu->frag.value; in ray_set_frag()
1223 /* Reject if card is already initialised */ in ray_set_frag()
1224 if (local->card_status != CARD_AWAITING_PARAM) in ray_set_frag()
1225 return -EBUSY; in ray_set_frag()
1227 /* if(wrq->u.frag.fixed == 0) should complain */ in ray_set_frag()
1228 if (wrqu->frag.disabled) in ray_set_frag()
1232 return -EINVAL; in ray_set_frag()
1234 local->sparm.b5.a_frag_threshold[0] = (fthr >> 8) & 0xFF; in ray_set_frag()
1235 local->sparm.b5.a_frag_threshold[1] = fthr & 0xFF; in ray_set_frag()
1237 return -EINPROGRESS; /* Call commit handler */ in ray_set_frag()
1240 /*------------------------------------------------------------------*/
1249 wrqu->frag.value = (local->sparm.b5.a_frag_threshold[0] << 8) in ray_get_frag()
1250 + local->sparm.b5.a_frag_threshold[1]; in ray_get_frag()
1251 wrqu->frag.disabled = (wrqu->frag.value == 32767); in ray_get_frag()
1252 wrqu->frag.fixed = 1; in ray_get_frag()
1257 /*------------------------------------------------------------------*/
1265 int err = -EINPROGRESS; /* Call commit handler */ in ray_set_mode()
1268 /* Reject if card is already initialised */ in ray_set_mode()
1269 if (local->card_status != CARD_AWAITING_PARAM) in ray_set_mode()
1270 return -EBUSY; in ray_set_mode()
1272 switch (wrqu->mode) { in ray_set_mode()
1277 local->sparm.b5.a_network_type = card_mode; in ray_set_mode()
1280 err = -EINVAL; in ray_set_mode()
1286 /*------------------------------------------------------------------*/
1295 if (local->sparm.b5.a_network_type) in ray_get_mode()
1296 wrqu->mode = IW_MODE_INFRA; in ray_get_mode()
1298 wrqu->mode = IW_MODE_ADHOC; in ray_get_mode()
1303 /*------------------------------------------------------------------*/
1315 wrqu->data.length = sizeof(struct iw_range); in ray_get_range()
1318 range->we_version_compiled = WIRELESS_EXT; in ray_get_range()
1319 range->we_version_source = 9; in ray_get_range()
1322 range->throughput = 1.1 * 1000 * 1000; /* Put the right number here */ in ray_get_range()
1323 range->num_channels = hop_pattern_length[(int)country]; in ray_get_range()
1324 range->num_frequency = 0; in ray_get_range()
1325 range->max_qual.qual = 0; in ray_get_range()
1326 range->max_qual.level = 255; /* What's the correct value ? */ in ray_get_range()
1327 range->max_qual.noise = 255; /* Idem */ in ray_get_range()
1328 range->num_bitrates = 2; in ray_get_range()
1329 range->bitrate[0] = 1000000; /* 1 Mb/s */ in ray_get_range()
1330 range->bitrate[1] = 2000000; /* 2 Mb/s */ in ray_get_range()
1334 /*------------------------------------------------------------------*/
1346 /*------------------------------------------------------------------*/
1358 /*------------------------------------------------------------------*/
1370 /*------------------------------------------------------------------*/
1380 /*------------------------------------------------------------------*/
1387 struct pcmcia_device *link = local->finder; in ray_get_wireless_stats()
1388 struct status __iomem *p = local->sram + STATUS_BASE; in ray_get_wireless_stats()
1390 local->wstats.status = local->card_status; in ray_get_wireless_stats()
1392 if ((local->spy_data.spy_number > 0) in ray_get_wireless_stats()
1393 && (local->sparm.b5.a_network_type == 0)) { in ray_get_wireless_stats()
1395 local->wstats.qual.qual = local->spy_data.spy_stat[0].qual; in ray_get_wireless_stats()
1396 local->wstats.qual.level = local->spy_data.spy_stat[0].level; in ray_get_wireless_stats()
1397 local->wstats.qual.noise = local->spy_data.spy_stat[0].noise; in ray_get_wireless_stats()
1398 local->wstats.qual.updated = in ray_get_wireless_stats()
1399 local->spy_data.spy_stat[0].updated; in ray_get_wireless_stats()
1404 local->wstats.qual.noise = readb(&p->rxnoise); in ray_get_wireless_stats()
1405 local->wstats.qual.updated |= 4; in ray_get_wireless_stats()
1408 return &local->wstats; in ray_get_wireless_stats()
1411 /*------------------------------------------------------------------*/
1476 link = local->finder; in ray_open()
1478 dev_dbg(&link->dev, "ray_open('%s')\n", dev->name); in ray_open()
1480 if (link->open == 0) in ray_open()
1481 local->num_multi = 0; in ray_open()
1482 link->open++; in ray_open()
1484 /* If the card is not started, time to start it ! - Jean II */ in ray_open()
1485 if (local->card_status == CARD_AWAITING_PARAM) { in ray_open()
1488 dev_dbg(&link->dev, "ray_open: doing init now !\n"); in ray_open()
1493 "ray_dev_init dl_startup_params failed - " in ray_open()
1495 return -1; in ray_open()
1504 dev_dbg(&link->dev, "ray_open ending\n"); in ray_open()
1513 link = local->finder; in ray_dev_close()
1515 dev_dbg(&link->dev, "ray_dev_close('%s')\n", dev->name); in ray_dev_close()
1517 link->open--; in ray_dev_close()
1521 * and set local->card_status to CARD_AWAITING_PARAM, so that while the in ray_dev_close()
1523 * Probably also need a COR reset to get sane state - Jean II */ in ray_dev_close()
1535 /* Cause a firmware interrupt if it is ready for one */
1540 struct pcmcia_device *link = local->finder; in interrupt_ecf()
1543 dev_dbg(&link->dev, "ray_cs interrupt_ecf - device not present\n"); in interrupt_ecf()
1544 return -1; in interrupt_ecf()
1546 dev_dbg(&link->dev, "interrupt_ecf(local=%p, ccs = 0x%x\n", local, ccs); in interrupt_ecf()
1549 (readb(local->amem + CIS_OFFSET + ECF_INTR_OFFSET) & in interrupt_ecf()
1551 i--; in interrupt_ecf()
1553 dev_dbg(&link->dev, "ray_cs interrupt_ecf card not ready for interrupt\n"); in interrupt_ecf()
1554 return -1; in interrupt_ecf()
1557 writeb(ccs, local->sram + SCB_BASE); in interrupt_ecf()
1558 writeb(ECF_INTR_SET, local->amem + CIS_OFFSET + ECF_INTR_OFFSET); in interrupt_ecf()
1564 /* Return - index of current tx ccs */
1569 struct pcmcia_device *link = local->finder; in get_free_tx_ccs()
1572 dev_dbg(&link->dev, "ray_cs get_free_tx_ccs - device not present\n"); in get_free_tx_ccs()
1576 if (test_and_set_bit(0, &local->tx_ccs_lock)) { in get_free_tx_ccs()
1577 dev_dbg(&link->dev, "ray_cs tx_ccs_lock busy\n"); in get_free_tx_ccs()
1582 if (readb(&(pccs + i)->buffer_status) == CCS_BUFFER_FREE) { in get_free_tx_ccs()
1583 writeb(CCS_BUFFER_BUSY, &(pccs + i)->buffer_status); in get_free_tx_ccs()
1584 writeb(CCS_END_LIST, &(pccs + i)->link); in get_free_tx_ccs()
1585 local->tx_ccs_lock = 0; in get_free_tx_ccs()
1589 local->tx_ccs_lock = 0; in get_free_tx_ccs()
1590 dev_dbg(&link->dev, "ray_cs ERROR no free tx CCS for raylink card\n"); in get_free_tx_ccs()
1596 /* Return - index of current ccs */
1601 struct pcmcia_device *link = local->finder; in get_free_ccs()
1604 dev_dbg(&link->dev, "ray_cs get_free_ccs - device not present\n"); in get_free_ccs()
1607 if (test_and_set_bit(0, &local->ccs_lock)) { in get_free_ccs()
1608 dev_dbg(&link->dev, "ray_cs ccs_lock busy\n"); in get_free_ccs()
1613 if (readb(&(pccs + i)->buffer_status) == CCS_BUFFER_FREE) { in get_free_ccs()
1614 writeb(CCS_BUFFER_BUSY, &(pccs + i)->buffer_status); in get_free_ccs()
1615 writeb(CCS_END_LIST, &(pccs + i)->link); in get_free_ccs()
1616 local->ccs_lock = 0; in get_free_ccs()
1620 local->ccs_lock = 0; in get_free_ccs()
1621 dev_dbg(&link->dev, "ray_cs ERROR no free CCS for raylink card\n"); in get_free_ccs()
1629 del_timer(&local->timer); in authenticate_timeout()
1631 " - timeout\n"); in authenticate_timeout()
1632 join_net(&local->timer); in authenticate_timeout()
1649 j = len - 1; in parse_addr()
1655 if ((k = hex_to_bin(in_str[j--])) != -1) in parse_addr()
1662 if ((k = hex_to_bin(in_str[j--])) != -1) in parse_addr()
1666 if (!i--) in parse_addr()
1676 struct pcmcia_device *link = local->finder; in ray_get_stats()
1677 struct status __iomem *p = local->sram + STATUS_BASE; in ray_get_stats()
1679 dev_dbg(&link->dev, "ray_cs net_device_stats - device not present\n"); in ray_get_stats()
1680 return &local->stats; in ray_get_stats()
1682 if (readb(&p->mrx_overflow_for_host)) { in ray_get_stats()
1683 local->stats.rx_over_errors += swab16(readw(&p->mrx_overflow)); in ray_get_stats()
1684 writeb(0, &p->mrx_overflow); in ray_get_stats()
1685 writeb(0, &p->mrx_overflow_for_host); in ray_get_stats()
1687 if (readb(&p->mrx_checksum_error_for_host)) { in ray_get_stats()
1688 local->stats.rx_crc_errors += in ray_get_stats()
1689 swab16(readw(&p->mrx_checksum_error)); in ray_get_stats()
1690 writeb(0, &p->mrx_checksum_error); in ray_get_stats()
1691 writeb(0, &p->mrx_checksum_error_for_host); in ray_get_stats()
1693 if (readb(&p->rx_hec_error_for_host)) { in ray_get_stats()
1694 local->stats.rx_frame_errors += swab16(readw(&p->rx_hec_error)); in ray_get_stats()
1695 writeb(0, &p->rx_hec_error); in ray_get_stats()
1696 writeb(0, &p->rx_hec_error_for_host); in ray_get_stats()
1698 return &local->stats; in ray_get_stats()
1706 struct pcmcia_device *link = local->finder; in ray_update_parm()
1712 dev_dbg(&link->dev, "ray_update_parm - device not present\n"); in ray_update_parm()
1717 dev_dbg(&link->dev, "ray_update_parm - No free ccs\n"); in ray_update_parm()
1721 writeb(CCS_UPDATE_PARAMS, &pccs->cmd); in ray_update_parm()
1722 writeb(objid, &pccs->var.update_param.object_id); in ray_update_parm()
1723 writeb(1, &pccs->var.update_param.number_objects); in ray_update_parm()
1724 writeb(0, &pccs->var.update_param.failure_cause); in ray_update_parm()
1726 writeb(value[i], local->sram + HOST_TO_ECF_BASE); in ray_update_parm()
1728 /* Interrupt the firmware to process the command */ in ray_update_parm()
1730 dev_dbg(&link->dev, "ray_cs associate failed - ECF not ready for intr\n"); in ray_update_parm()
1731 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); in ray_update_parm()
1741 struct pcmcia_device *link = local->finder; in ray_update_multi_list()
1742 void __iomem *p = local->sram + HOST_TO_ECF_BASE; in ray_update_multi_list()
1745 dev_dbg(&link->dev, "ray_update_multi_list - device not present\n"); in ray_update_multi_list()
1748 dev_dbg(&link->dev, "ray_update_multi_list(%p)\n", dev); in ray_update_multi_list()
1750 dev_dbg(&link->dev, "ray_update_multi - No free ccs\n"); in ray_update_multi_list()
1754 writeb(CCS_UPDATE_MULTICAST_LIST, &pccs->cmd); in ray_update_multi_list()
1757 writeb(0xff, &pccs->var); in ray_update_multi_list()
1758 local->num_multi = 0xff; in ray_update_multi_list()
1765 memcpy_toio(p, ha->addr, ETH_ALEN); in ray_update_multi_list()
1766 dev_dbg(&link->dev, "ray_update_multi add addr %pm\n", in ray_update_multi_list()
1767 ha->addr); in ray_update_multi_list()
1773 writeb((UCHAR) i, &pccs->var); in ray_update_multi_list()
1774 dev_dbg(&link->dev, "ray_cs update_multi %d addresses in list\n", i); in ray_update_multi_list()
1775 /* Interrupt the firmware to process the command */ in ray_update_multi_list()
1776 local->num_multi = i; in ray_update_multi_list()
1779 dev_dbg(&link->dev, in ray_update_multi_list()
1780 "ray_cs update_multi failed - ECF not ready for intr\n"); in ray_update_multi_list()
1781 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); in ray_update_multi_list()
1793 if (dev->flags & IFF_PROMISC) { in set_multicast_list()
1794 if (local->sparm.b5.a_promiscuous_mode == 0) { in set_multicast_list()
1796 local->sparm.b5.a_promiscuous_mode = 1; in set_multicast_list()
1802 if (local->sparm.b5.a_promiscuous_mode == 1) { in set_multicast_list()
1804 local->sparm.b5.a_promiscuous_mode = 0; in set_multicast_list()
1811 if (dev->flags & IFF_ALLMULTI) in set_multicast_list()
1814 if (local->num_multi != netdev_mc_count(dev)) in set_multicast_list()
1836 if (dev == NULL) /* Note that we want interrupts with dev->start == 0 */ in ray_interrupt()
1842 link = local->finder; in ray_interrupt()
1848 rcsindex = readb(&((struct scb __iomem *)(local->sram))->rcs_index); in ray_interrupt()
1851 dev_dbg(&link->dev, "ray_cs interrupt bad rcsindex = 0x%x\n", rcsindex); in ray_interrupt()
1857 cmd = readb(&pccs->cmd); in ray_interrupt()
1858 status = readb(&pccs->buffer_status); in ray_interrupt()
1860 case CCS_DOWNLOAD_STARTUP_PARAMS: /* Happens in firmware someday */ in ray_interrupt()
1861 del_timer(&local->timer); in ray_interrupt()
1863 dev_dbg(&link->dev, in ray_interrupt()
1866 dev_dbg(&link->dev, in ray_interrupt()
1871 dev_dbg(&link->dev, "ray_cs interrupt update params done\n"); in ray_interrupt()
1874 readb(&pccs->var.update_param. in ray_interrupt()
1876 dev_dbg(&link->dev, in ray_interrupt()
1877 "ray_cs interrupt update params failed - reason %d\n", in ray_interrupt()
1882 dev_dbg(&link->dev, "ray_cs interrupt report params done\n"); in ray_interrupt()
1885 dev_dbg(&link->dev, in ray_interrupt()
1889 dev_dbg(&link->dev, in ray_interrupt()
1894 memcpy(memtmp, local->sparm.b4.a_current_ess_id, in ray_interrupt()
1900 (&pccs->var.start_network.net_initiated) == in ray_interrupt()
1902 dev_dbg(&link->dev, in ray_interrupt()
1906 dev_dbg(&link->dev, in ray_interrupt()
1910 memcpy_fromio(&local->bss_id, in ray_interrupt()
1911 pccs->var.start_network.bssid, in ray_interrupt()
1914 if (local->fw_ver == 0x55) in ray_interrupt()
1915 local->net_default_tx_rate = 3; in ray_interrupt()
1917 local->net_default_tx_rate = in ray_interrupt()
1918 readb(&pccs->var.start_network. in ray_interrupt()
1920 local->encryption = in ray_interrupt()
1921 readb(&pccs->var.start_network.encryption); in ray_interrupt()
1922 if (!sniffer && (local->net_type == INFRA) in ray_interrupt()
1923 && !(local->sparm.b4.a_acting_as_ap_status)) { in ray_interrupt()
1926 local->card_status = CARD_ACQ_COMPLETE; in ray_interrupt()
1928 local->card_status = CARD_ACQ_FAILED; in ray_interrupt()
1930 del_timer(&local->timer); in ray_interrupt()
1931 local->timer.expires = jiffies + HZ * 5; in ray_interrupt()
1933 dev_dbg(&link->dev, in ray_interrupt()
1936 local->timer.function = start_net; in ray_interrupt()
1938 dev_dbg(&link->dev, in ray_interrupt()
1941 local->timer.function = join_net; in ray_interrupt()
1943 add_timer(&local->timer); in ray_interrupt()
1948 local->card_status = CARD_ASSOC_COMPLETE; in ray_interrupt()
1949 dev_dbg(&link->dev, "ray_cs association successful\n"); in ray_interrupt()
1951 dev_dbg(&link->dev, "ray_cs association failed,\n"); in ray_interrupt()
1952 local->card_status = CARD_ASSOC_FAILED; in ray_interrupt()
1953 join_net(&local->timer); in ray_interrupt()
1958 dev_dbg(&link->dev, in ray_interrupt()
1961 dev_dbg(&link->dev, in ray_interrupt()
1969 dev_dbg(&link->dev, "ray_cs interrupt mem test done\n"); in ray_interrupt()
1972 dev_dbg(&link->dev, in ray_interrupt()
1973 "ray_cs interrupt Unexpected CCS returned - Shutdown\n"); in ray_interrupt()
1976 dev_dbg(&link->dev, "ray_cs interrupt dump memory done\n"); in ray_interrupt()
1979 dev_dbg(&link->dev, in ray_interrupt()
1980 "ray_cs interrupt DING - raylink timer expired\n"); in ray_interrupt()
1983 dev_dbg(&link->dev, in ray_interrupt()
1987 writeb(CCS_BUFFER_FREE, &pccs->buffer_status); in ray_interrupt()
1992 switch (readb(&prcs->interrupt_id)) { in ray_interrupt()
1997 dev_dbg(&link->dev, "ray_cs interrupt rejoin net complete\n"); in ray_interrupt()
1998 local->card_status = CARD_ACQ_COMPLETE; in ray_interrupt()
2000 if (local->sparm.b4.a_network_type == ADHOC) { in ray_interrupt()
2004 memcpy_fromio(&local->bss_id, in ray_interrupt()
2005 prcs->var.rejoin_net_complete. in ray_interrupt()
2007 dev_dbg(&link->dev, "ray_cs new BSSID = %pm\n", in ray_interrupt()
2008 local->bss_id); in ray_interrupt()
2014 dev_dbg(&link->dev, "ray_cs interrupt roaming initiated\n"); in ray_interrupt()
2016 local->card_status = CARD_DOING_ACQ; in ray_interrupt()
2019 dev_dbg(&link->dev, "ray_cs interrupt japan call sign rx\n"); in ray_interrupt()
2022 dev_dbg(&link->dev, in ray_interrupt()
2025 (unsigned int)readb(&prcs->interrupt_id)); in ray_interrupt()
2028 writeb(CCS_BUFFER_FREE, &prcs->buffer_status); in ray_interrupt()
2044 pkt_addr = ((readb(&prcs->var.rx_packet.rx_data_ptr[0]) << 8) in ray_rx()
2045 + readb(&prcs->var.rx_packet.rx_data_ptr[1])) & RX_BUFF_END; in ray_rx()
2047 rx_len = (readb(&prcs->var.rx_packet.rx_data_length[0]) << 8) in ray_rx()
2048 + readb(&prcs->var.rx_packet.rx_data_length[1]); in ray_rx()
2050 local->last_rsl = readb(&prcs->var.rx_packet.rx_sig_lev); in ray_rx()
2051 pmsg = local->rmem + pkt_addr; in ray_rx()
2079 copy_from_rx_buff(local, (UCHAR *) &local->last_bcn, pkt_addr, in ray_rx()
2083 local->beacon_rxed = 1; in ray_rx()
2106 int siglev = local->last_rsl; in rx_data()
2115 (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + in rx_data()
2126 (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + in rx_data()
2137 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { in rx_data()
2139 tmp = (readb(&prcs->var.rx_packet.totalpacketlength[0]) << 8) in rx_data()
2140 + readb(&prcs->var.rx_packet.totalpacketlength[1]); in rx_data()
2144 tmp -= in rx_data()
2145 (readb(&prcslink->var.rx_packet.rx_data_length[0]) in rx_data()
2147 + readb(&prcslink->var.rx_packet.rx_data_length[1]); in rx_data()
2148 if (readb(&prcslink->var.rx_packet.next_frag_rcs_index) in rx_data()
2152 + readb(&prcslink->link_field); in rx_data()
2158 local->stats.rx_dropped++; in rx_data()
2169 local->stats.rx_dropped++; in rx_data()
2170 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) in rx_data()
2207 if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { in rx_data()
2213 readb(&prcslink->var.rx_packet.next_frag_rcs_index); in rx_data()
2215 ((readb(&prcslink->var.rx_packet.rx_data_length[0]) in rx_data()
2218 readb(&prcslink->var.rx_packet.rx_data_length[1])) in rx_data()
2221 ((readb(&prcslink->var.rx_packet.rx_data_ptr[0]) << in rx_data()
2223 + readb(&prcslink->var.rx_packet.rx_data_ptr[1])) in rx_data()
2229 } while (tmp-- && in rx_data()
2230 readb(&prcslink->var.rx_packet.next_frag_rcs_index) != in rx_data()
2235 skb->protocol = eth_type_trans(skb, dev); in rx_data()
2237 local->stats.rx_packets++; in rx_data()
2238 local->stats.rx_bytes += total_len; in rx_data()
2242 /* For the Access Point or the node having started the ad-hoc net in rx_data()
2243 * note : ad-hoc work only in some specific configurations, but we in rx_data()
2245 if (!memcmp(linksrcaddr, local->bss_id, ETH_ALEN)) { in rx_data()
2247 /*local->wstats.qual.qual = none ? */ in rx_data()
2248 local->wstats.qual.level = siglev; in rx_data()
2249 /*local->wstats.qual.noise = none ? */ in rx_data()
2250 local->wstats.qual.updated = 0x2; in rx_data()
2268 snaphdr_t *psnap = (snaphdr_t *) (skb->data + RX_MAC_HEADER_LENGTH); in untranslate()
2269 struct ieee80211_hdr *pmac = (struct ieee80211_hdr *)skb->data; in untranslate()
2270 __be16 type = *(__be16 *) psnap->ethertype; in untranslate()
2283 print_hex_dump(KERN_DEBUG, "skb->data before untranslate: ", in untranslate()
2285 skb->data, 64, true); in untranslate()
2288 ntohs(type), psnap->dsap, psnap->ssap, psnap->ctrl, in untranslate()
2289 psnap->org[0], psnap->org[1], psnap->org[2]); in untranslate()
2290 printk(KERN_DEBUG "untranslate skb->data = %p\n", skb->data); in untranslate()
2294 if (psnap->dsap != 0xaa || psnap->ssap != 0xaa || psnap->ctrl != 3) { in untranslate()
2297 psnap->dsap, psnap->ssap, psnap->ctrl); in untranslate()
2299 delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; in untranslate()
2300 peth = (struct ethhdr *)(skb->data + delta); in untranslate()
2301 peth->h_proto = htons(len - RX_MAC_HEADER_LENGTH); in untranslate()
2303 if (memcmp(psnap->org, org_bridge, 3) == 0) { in untranslate()
2307 + sizeof(struct snaphdr_t) - ETH_HLEN; in untranslate()
2308 peth = (struct ethhdr *)(skb->data + delta); in untranslate()
2309 peth->h_proto = type; in untranslate()
2310 } else if (memcmp(psnap->org, org_1042, 3) == 0) { in untranslate()
2315 delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; in untranslate()
2316 peth = (struct ethhdr *)(skb->data + delta); in untranslate()
2317 peth->h_proto = in untranslate()
2318 htons(len - RX_MAC_HEADER_LENGTH); in untranslate()
2323 sizeof(struct snaphdr_t) - ETH_HLEN; in untranslate()
2324 peth = (struct ethhdr *)(skb->data + delta); in untranslate()
2325 peth->h_proto = type; in untranslate()
2330 delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; in untranslate()
2331 peth = (struct ethhdr *)(skb->data + delta); in untranslate()
2332 peth->h_proto = type; in untranslate()
2337 pr_debug("untranslate after skb_pull(%d), skb->data = %p\n", delta, in untranslate()
2338 skb->data); in untranslate()
2339 memcpy(peth->h_dest, destaddr, ADDRLEN); in untranslate()
2340 memcpy(peth->h_source, srcaddr, ADDRLEN); in untranslate()
2344 printk(KERN_DEBUG "skb->data after untranslate:"); in untranslate()
2346 printk("%02x ", skb->data[i]); in untranslate()
2361 int wrap_bytes = (pkt_addr + length) - (RX_BUFF_END + 1); in copy_from_rx_buff()
2363 memcpy_fromio(dest, local->rmem + pkt_addr, length); in copy_from_rx_buff()
2366 memcpy_fromio(dest, local->rmem + pkt_addr, in copy_from_rx_buff()
2367 length - wrap_bytes); in copy_from_rx_buff()
2368 memcpy_fromio(dest + length - wrap_bytes, local->rmem, in copy_from_rx_buff()
2379 unsigned rcsindex = readb(&prcs->var.rx_packet.next_frag_rcs_index); in release_frag_chain()
2381 while (tmp--) { in release_frag_chain()
2382 writeb(CCS_BUFFER_FREE, &prcslink->buffer_status); in release_frag_chain()
2389 rcsindex = readb(&prcslink->var.rx_packet.next_frag_rcs_index); in release_frag_chain()
2391 writeb(CCS_BUFFER_FREE, &prcslink->buffer_status); in release_frag_chain()
2397 struct pcmcia_device *link = local->finder; in authenticate()
2398 dev_dbg(&link->dev, "ray_cs Starting authentication.\n"); in authenticate()
2400 dev_dbg(&link->dev, "ray_cs authenticate - device not present\n"); in authenticate()
2404 del_timer(&local->timer); in authenticate()
2405 if (build_auth_frame(local, local->bss_id, OPEN_AUTH_REQUEST)) { in authenticate()
2406 local->timer.function = join_net; in authenticate()
2408 local->timer.function = authenticate_timeout; in authenticate()
2410 local->timer.expires = jiffies + HZ * 2; in authenticate()
2411 add_timer(&local->timer); in authenticate()
2412 local->authentication_state = AWAITING_RESPONSE; in authenticate()
2422 del_timer(&local->timer); in rx_authenticate()
2426 if (local->sparm.b4.a_network_type == ADHOC) { in rx_authenticate()
2428 msg->var[0], msg->var[1], msg->var[2], msg->var[3], in rx_authenticate()
2429 msg->var[4], msg->var[5]); in rx_authenticate()
2430 if (msg->var[2] == 1) { in rx_authenticate()
2433 (local, msg->mac.addr_2, OPEN_AUTH_RESPONSE)) { in rx_authenticate()
2434 local->authentication_state = NEED_TO_AUTH; in rx_authenticate()
2435 memcpy(local->auth_id, msg->mac.addr_2, in rx_authenticate()
2441 if (local->authentication_state == AWAITING_RESPONSE) { in rx_authenticate()
2443 if (msg->var[2] == 2) { in rx_authenticate()
2444 if ((msg->var[3] | msg->var[4]) == 0) { in rx_authenticate()
2446 local->card_status = CARD_AUTH_COMPLETE; in rx_authenticate()
2448 local->authentication_state = in rx_authenticate()
2452 local->card_status = CARD_AUTH_REFUSED; in rx_authenticate()
2453 join_net(&local->timer); in rx_authenticate()
2454 local->authentication_state = in rx_authenticate()
2467 struct pcmcia_device *link = local->finder; in associate()
2468 struct net_device *dev = link->priv; in associate()
2471 dev_dbg(&link->dev, "ray_cs associate - device not present\n"); in associate()
2477 dev_dbg(&link->dev, "ray_cs associate - No free ccs\n"); in associate()
2480 dev_dbg(&link->dev, "ray_cs Starting association with access point\n"); in associate()
2483 writeb(CCS_START_ASSOCIATION, &pccs->cmd); in associate()
2484 /* Interrupt the firmware to process the command */ in associate()
2486 dev_dbg(&link->dev, "ray_cs associate failed - ECF not ready for intr\n"); in associate()
2487 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); in associate()
2489 del_timer(&local->timer); in associate()
2490 local->timer.expires = jiffies + HZ * 2; in associate()
2491 local->timer.function = join_net; in associate()
2492 add_timer(&local->timer); in associate()
2493 local->card_status = CARD_ASSOC_FAILED; in associate()
2509 local->authentication_state = UNAUTHENTICATED; in rx_deauthenticate()
2518 writeb(0, local->amem + CIS_OFFSET + HCS_INTR_OFFSET); in clear_interrupt()
2523 #define MAXDATA (PAGE_SIZE - 80)
2526 "Card inserted - uninitialized", /* 0 */
2563 dev = (struct net_device *)link->priv; in ray_cs_proc_show()
2573 seq_puts(m, "Firmware version = "); in ray_cs_proc_show()
2574 if (local->fw_ver == 0x55) in ray_cs_proc_show()
2575 seq_puts(m, "4 - Use dump_cis for more details\n"); in ray_cs_proc_show()
2578 local->fw_ver, local->fw_bld, local->fw_var); in ray_cs_proc_show()
2581 c[i] = local->sparm.b5.a_current_ess_id[i]; in ray_cs_proc_show()
2584 nettype[local->sparm.b5.a_network_type], c); in ray_cs_proc_show()
2586 p = local->bss_id; in ray_cs_proc_show()
2590 local->sparm.b5.a_curr_country_code); in ray_cs_proc_show()
2592 i = local->card_status; in ray_cs_proc_show()
2601 seq_printf(m, "Last pkt signal lvl = %d\n", local->last_rsl); in ray_cs_proc_show()
2603 if (local->beacon_rxed) { in ray_cs_proc_show()
2606 local->last_bcn.beacon_intvl[0] in ray_cs_proc_show()
2607 + 256 * local->last_bcn.beacon_intvl[1]); in ray_cs_proc_show()
2609 p = local->last_bcn.elements; in ray_cs_proc_show()
2633 pfh->dwell_time[0] + in ray_cs_proc_show()
2634 256 * pfh->dwell_time[1]); in ray_cs_proc_show()
2636 pfh->hop_set); in ray_cs_proc_show()
2638 pfh->hop_pattern); in ray_cs_proc_show()
2640 pfh->hop_index); in ray_cs_proc_show()
2663 pr_debug("ray_cs send authenticate - No free tx ccs\n"); in build_auth_frame()
2664 return -1; in build_auth_frame()
2672 writeb(CCS_TX_REQUEST, &pccs->cmd); in build_auth_frame()
2673 writeb(addr >> 8, pccs->var.tx_request.tx_data_ptr); in build_auth_frame()
2674 writeb(0x20, pccs->var.tx_request.tx_data_ptr + 1); in build_auth_frame()
2675 writeb(TX_AUTHENTICATE_LENGTH_MSB, pccs->var.tx_request.tx_data_length); in build_auth_frame()
2677 pccs->var.tx_request.tx_data_length + 1); in build_auth_frame()
2678 writeb(0, &pccs->var.tx_request.pow_sav_mode); in build_auth_frame()
2680 ptx = local->sram + addr; in build_auth_frame()
2682 writeb(PROTOCOL_VER | AUTHENTIC_TYPE, &ptx->mac.frame_ctl_1); in build_auth_frame()
2683 writeb(0, &ptx->mac.frame_ctl_2); in build_auth_frame()
2685 memcpy_toio(ptx->mac.addr_1, dest, ADDRLEN); in build_auth_frame()
2686 memcpy_toio(ptx->mac.addr_2, local->sparm.b4.a_mac_addr, ADDRLEN); in build_auth_frame()
2687 memcpy_toio(ptx->mac.addr_3, local->bss_id, ADDRLEN); in build_auth_frame()
2690 memset_io(ptx->var, 0, 6); in build_auth_frame()
2691 writeb(auth_type & 0xff, ptx->var + 2); in build_auth_frame()
2693 /* Interrupt the firmware to process the command */ in build_auth_frame()
2696 "ray_cs send authentication request failed - ECF not ready for intr\n"); in build_auth_frame()
2697 writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); in build_auth_frame()
2698 return -1; in build_auth_frame()
2715 return -EFAULT; in ray_cs_essid_proc_write()
2736 return -EINVAL; in int_proc_write()
2738 return -EFAULT; in int_proc_write()
2743 unsigned int c = *p - '0'; in int_proc_write()
2745 return -EINVAL; in int_proc_write()
2748 } while (--len); in int_proc_write()