| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_atu.c,v 1.57 2018/05/01 16:18:13 maya Exp $ */ | | 1 | /* $NetBSD: if_atu.c,v 1.58 2018/06/03 10:59:35 maxv Exp $ */ |
2 | /* $OpenBSD: if_atu.c,v 1.48 2004/12/30 01:53:21 dlg Exp $ */ | | 2 | /* $OpenBSD: if_atu.c,v 1.48 2004/12/30 01:53:21 dlg Exp $ */ |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2003, 2004 | | 4 | * Copyright (c) 2003, 2004 |
5 | * Daan Vreeken <Danovitsch@Vitsch.net>. All rights reserved. | | 5 | * Daan Vreeken <Danovitsch@Vitsch.net>. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -38,27 +38,27 @@ | | | @@ -38,27 +38,27 @@ |
38 | * | | 38 | * |
39 | * Originally written by Daan Vreeken <Danovitsch @ Vitsch . net> | | 39 | * Originally written by Daan Vreeken <Danovitsch @ Vitsch . net> |
40 | * http://vitsch.net/bsd/atuwi | | 40 | * http://vitsch.net/bsd/atuwi |
41 | * | | 41 | * |
42 | * Contributed to by : | | 42 | * Contributed to by : |
43 | * Chris Whitehouse, Alistair Phillips, Peter Pilka, Martijn van Buul, | | 43 | * Chris Whitehouse, Alistair Phillips, Peter Pilka, Martijn van Buul, |
44 | * Suihong Liang, Arjan van Leeuwen, Stuart Walsh | | 44 | * Suihong Liang, Arjan van Leeuwen, Stuart Walsh |
45 | * | | 45 | * |
46 | * Ported to OpenBSD by Theo de Raadt and David Gwynne. | | 46 | * Ported to OpenBSD by Theo de Raadt and David Gwynne. |
47 | * Ported to NetBSD by Jesse Off | | 47 | * Ported to NetBSD by Jesse Off |
48 | */ | | 48 | */ |
49 | | | 49 | |
50 | #include <sys/cdefs.h> | | 50 | #include <sys/cdefs.h> |
51 | __KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.57 2018/05/01 16:18:13 maya Exp $"); | | 51 | __KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.58 2018/06/03 10:59:35 maxv Exp $"); |
52 | | | 52 | |
53 | #ifdef _KERNEL_OPT | | 53 | #ifdef _KERNEL_OPT |
54 | #include "opt_usb.h" | | 54 | #include "opt_usb.h" |
55 | #endif | | 55 | #endif |
56 | | | 56 | |
57 | #include <sys/param.h> | | 57 | #include <sys/param.h> |
58 | #include <sys/sockio.h> | | 58 | #include <sys/sockio.h> |
59 | #include <sys/mbuf.h> | | 59 | #include <sys/mbuf.h> |
60 | #include <sys/kernel.h> | | 60 | #include <sys/kernel.h> |
61 | #include <sys/socket.h> | | 61 | #include <sys/socket.h> |
62 | #include <sys/systm.h> | | 62 | #include <sys/systm.h> |
63 | #include <sys/kthread.h> | | 63 | #include <sys/kthread.h> |
64 | #include <sys/queue.h> | | 64 | #include <sys/queue.h> |
| @@ -98,27 +98,27 @@ __KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1 | | | @@ -98,27 +98,27 @@ __KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1 |
98 | | | 98 | |
99 | #ifdef ATU_DEBUG | | 99 | #ifdef ATU_DEBUG |
100 | #define DPRINTF(x) do { if (atudebug) printf x; } while (0) | | 100 | #define DPRINTF(x) do { if (atudebug) printf x; } while (0) |
101 | #define DPRINTFN(n,x) do { if (atudebug>(n)) printf x; } while (0) | | 101 | #define DPRINTFN(n,x) do { if (atudebug>(n)) printf x; } while (0) |
102 | int atudebug = 1; | | 102 | int atudebug = 1; |
103 | #else | | 103 | #else |
104 | #define DPRINTF(x) | | 104 | #define DPRINTF(x) |
105 | #define DPRINTFN(n,x) | | 105 | #define DPRINTFN(n,x) |
106 | #endif | | 106 | #endif |
107 | | | 107 | |
108 | /* | | 108 | /* |
109 | * Various supported device vendors/products/radio type. | | 109 | * Various supported device vendors/products/radio type. |
110 | */ | | 110 | */ |
111 | struct atu_type atu_devs[] = { | | 111 | static const struct atu_type atu_devs[] = { |
112 | { USB_VENDOR_3COM, USB_PRODUCT_3COM_3CRSHEW696, | | 112 | { USB_VENDOR_3COM, USB_PRODUCT_3COM_3CRSHEW696, |
113 | RadioRFMD, ATU_NO_QUIRK }, | | 113 | RadioRFMD, ATU_NO_QUIRK }, |
114 | { USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_BWU613, | | 114 | { USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_BWU613, |
115 | RadioRFMD, ATU_NO_QUIRK }, | | 115 | RadioRFMD, ATU_NO_QUIRK }, |
116 | { USB_VENDOR_ACCTON, USB_PRODUCT_ACCTON_2664W, | | 116 | { USB_VENDOR_ACCTON, USB_PRODUCT_ACCTON_2664W, |
117 | AT76C503_rfmd_acc, ATU_NO_QUIRK }, | | 117 | AT76C503_rfmd_acc, ATU_NO_QUIRK }, |
118 | { USB_VENDOR_ACERP, USB_PRODUCT_ACERP_AWL300, | | 118 | { USB_VENDOR_ACERP, USB_PRODUCT_ACERP_AWL300, |
119 | RadioIntersil, ATU_NO_QUIRK }, | | 119 | RadioIntersil, ATU_NO_QUIRK }, |
120 | { USB_VENDOR_ACERP, USB_PRODUCT_ACERP_AWL400, | | 120 | { USB_VENDOR_ACERP, USB_PRODUCT_ACERP_AWL400, |
121 | RadioRFMD, ATU_NO_QUIRK }, | | 121 | RadioRFMD, ATU_NO_QUIRK }, |
122 | { USB_VENDOR_ACTIONTEC, USB_PRODUCT_ACTIONTEC_UAT1, | | 122 | { USB_VENDOR_ACTIONTEC, USB_PRODUCT_ACTIONTEC_UAT1, |
123 | RadioRFMD, ATU_NO_QUIRK }, | | 123 | RadioRFMD, ATU_NO_QUIRK }, |
124 | { USB_VENDOR_ADDTRON, USB_PRODUCT_ADDTRON_AWU120, | | 124 | { USB_VENDOR_ADDTRON, USB_PRODUCT_ADDTRON_AWU120, |
| @@ -1091,27 +1091,27 @@ atu_get_card_config(struct atu_softc *sc | | | @@ -1091,27 +1091,27 @@ atu_get_card_config(struct atu_softc *sc |
1091 | return 0; | | 1091 | return 0; |
1092 | } | | 1092 | } |
1093 | | | 1093 | |
1094 | /* | | 1094 | /* |
1095 | * Probe for an AT76c503 chip. | | 1095 | * Probe for an AT76c503 chip. |
1096 | */ | | 1096 | */ |
1097 | int | | 1097 | int |
1098 | atu_match(device_t parent, cfdata_t match, void *aux) | | 1098 | atu_match(device_t parent, cfdata_t match, void *aux) |
1099 | { | | 1099 | { |
1100 | struct usb_attach_arg *uaa = aux; | | 1100 | struct usb_attach_arg *uaa = aux; |
1101 | int i; | | 1101 | int i; |
1102 | | | 1102 | |
1103 | for (i = 0; i < __arraycount(atu_devs); i++) { | | 1103 | for (i = 0; i < __arraycount(atu_devs); i++) { |
1104 | struct atu_type *t = &atu_devs[i]; | | 1104 | const struct atu_type *t = &atu_devs[i]; |
1105 | | | 1105 | |
1106 | if (uaa->uaa_vendor == t->atu_vid && | | 1106 | if (uaa->uaa_vendor == t->atu_vid && |
1107 | uaa->uaa_product == t->atu_pid) { | | 1107 | uaa->uaa_product == t->atu_pid) { |
1108 | return(UMATCH_VENDOR_PRODUCT); | | 1108 | return(UMATCH_VENDOR_PRODUCT); |
1109 | } | | 1109 | } |
1110 | } | | 1110 | } |
1111 | return(UMATCH_NONE); | | 1111 | return(UMATCH_NONE); |
1112 | } | | 1112 | } |
1113 | | | 1113 | |
1114 | int | | 1114 | int |
1115 | atu_media_change(struct ifnet *ifp) | | 1115 | atu_media_change(struct ifnet *ifp) |
1116 | { | | 1116 | { |
1117 | struct atu_softc *sc = ifp->if_softc; | | 1117 | struct atu_softc *sc = ifp->if_softc; |
| @@ -1270,27 +1270,27 @@ atu_attach(device_t parent, device_t sel | | | @@ -1270,27 +1270,27 @@ atu_attach(device_t parent, device_t sel |
1270 | if (err) { | | 1270 | if (err) { |
1271 | aprint_error_dev(self, "getting interface handle failed\n"); | | 1271 | aprint_error_dev(self, "getting interface handle failed\n"); |
1272 | return; | | 1272 | return; |
1273 | } | | 1273 | } |
1274 | | | 1274 | |
1275 | sc->atu_unit = device_unit(self); | | 1275 | sc->atu_unit = device_unit(self); |
1276 | sc->atu_udev = dev; | | 1276 | sc->atu_udev = dev; |
1277 | | | 1277 | |
1278 | /* | | 1278 | /* |
1279 | * look up the radio_type for the device | | 1279 | * look up the radio_type for the device |
1280 | * basically does the same as atu_match | | 1280 | * basically does the same as atu_match |
1281 | */ | | 1281 | */ |
1282 | for (i = 0; i < __arraycount(atu_devs); i++) { | | 1282 | for (i = 0; i < __arraycount(atu_devs); i++) { |
1283 | struct atu_type *t = &atu_devs[i]; | | 1283 | const struct atu_type *t = &atu_devs[i]; |
1284 | | | 1284 | |
1285 | if (uaa->uaa_vendor == t->atu_vid && | | 1285 | if (uaa->uaa_vendor == t->atu_vid && |
1286 | uaa->uaa_product == t->atu_pid) { | | 1286 | uaa->uaa_product == t->atu_pid) { |
1287 | sc->atu_radio = t->atu_radio; | | 1287 | sc->atu_radio = t->atu_radio; |
1288 | sc->atu_quirk = t->atu_quirk; | | 1288 | sc->atu_quirk = t->atu_quirk; |
1289 | } | | 1289 | } |
1290 | } | | 1290 | } |
1291 | | | 1291 | |
1292 | /* | | 1292 | /* |
1293 | * Check in the interface descriptor if we're in DFU mode | | 1293 | * Check in the interface descriptor if we're in DFU mode |
1294 | * If we're in DFU mode, we upload the external firmware | | 1294 | * If we're in DFU mode, we upload the external firmware |
1295 | * If we're not, the PC must have rebooted without power-cycling | | 1295 | * If we're not, the PC must have rebooted without power-cycling |
1296 | * the device.. I've tried this out, a reboot only requeres the | | 1296 | * the device.. I've tried this out, a reboot only requeres the |