usbnet: Omit needless detachcv name parameter to usbnet_attach.diff -r1.189 -r1.190 src/sys/dev/usb/if_aue.c
(riastradh)
--- src/sys/dev/usb/if_aue.c 2022/03/03 05:56:09 1.189
+++ src/sys/dev/usb/if_aue.c 2022/03/03 05:56:28 1.190
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_aue.c,v 1.189 2022/03/03 05:56:09 riastradh Exp $ */ | 1 | /* $NetBSD: if_aue.c,v 1.190 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997, 1998, 1999, 2000 | 4 | * Copyright (c) 1997, 1998, 1999, 2000 | |
5 | * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. | 5 | * Bill Paul <wpaul@ee.columbia.edu>. 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. | |
@@ -66,27 +66,27 @@ | @@ -66,27 +66,27 @@ | |||
66 | /* | 66 | /* | |
67 | * Ported to NetBSD and somewhat rewritten by Lennart Augustsson. | 67 | * Ported to NetBSD and somewhat rewritten by Lennart Augustsson. | |
68 | */ | 68 | */ | |
69 | 69 | |||
70 | /* | 70 | /* | |
71 | * TODO: | 71 | * TODO: | |
72 | * better error messages from rxstat | 72 | * better error messages from rxstat | |
73 | * more error checks | 73 | * more error checks | |
74 | * investigate short rx problem | 74 | * investigate short rx problem | |
75 | * proper cleanup on errors | 75 | * proper cleanup on errors | |
76 | */ | 76 | */ | |
77 | 77 | |||
78 | #include <sys/cdefs.h> | 78 | #include <sys/cdefs.h> | |
79 | __KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.189 2022/03/03 05:56:09 riastradh Exp $"); | 79 | __KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.190 2022/03/03 05:56:28 riastradh Exp $"); | |
80 | 80 | |||
81 | #ifdef _KERNEL_OPT | 81 | #ifdef _KERNEL_OPT | |
82 | #include "opt_usb.h" | 82 | #include "opt_usb.h" | |
83 | #include "opt_inet.h" | 83 | #include "opt_inet.h" | |
84 | #endif | 84 | #endif | |
85 | 85 | |||
86 | #include <sys/param.h> | 86 | #include <sys/param.h> | |
87 | 87 | |||
88 | #include <dev/usb/usbnet.h> | 88 | #include <dev/usb/usbnet.h> | |
89 | #include <dev/usb/usbhist.h> | 89 | #include <dev/usb/usbhist.h> | |
90 | #include <dev/usb/if_auereg.h> | 90 | #include <dev/usb/if_auereg.h> | |
91 | 91 | |||
92 | #ifdef INET | 92 | #ifdef INET | |
@@ -837,27 +837,27 @@ aue_attach(device_t parent, device_t sel | @@ -837,27 +837,27 @@ aue_attach(device_t parent, device_t sel | |||
837 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | 837 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | |
838 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | 838 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | |
839 | } | 839 | } | |
840 | } | 840 | } | |
841 | 841 | |||
842 | if (un->un_ed[USBNET_ENDPT_RX] == 0 || | 842 | if (un->un_ed[USBNET_ENDPT_RX] == 0 || | |
843 | un->un_ed[USBNET_ENDPT_TX] == 0 || | 843 | un->un_ed[USBNET_ENDPT_TX] == 0 || | |
844 | un->un_ed[USBNET_ENDPT_INTR] == 0) { | 844 | un->un_ed[USBNET_ENDPT_INTR] == 0) { | |
845 | aprint_error_dev(self, "missing endpoint\n"); | 845 | aprint_error_dev(self, "missing endpoint\n"); | |
846 | return; | 846 | return; | |
847 | } | 847 | } | |
848 | 848 | |||
849 | /* First level attach. */ | 849 | /* First level attach. */ | |
850 | usbnet_attach(un, "auedet"); | 850 | usbnet_attach(un); | |
851 | 851 | |||
852 | /* Reset the adapter and get station address from the EEPROM. */ | 852 | /* Reset the adapter and get station address from the EEPROM. */ | |
853 | aue_reset(sc); | 853 | aue_reset(sc); | |
854 | aue_read_mac(un); | 854 | aue_read_mac(un); | |
855 | 855 | |||
856 | usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST, | 856 | usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST, | |
857 | 0, &unm); | 857 | 0, &unm); | |
858 | } | 858 | } | |
859 | 859 | |||
860 | static void | 860 | static void | |
861 | aue_uno_intr(struct usbnet *un, usbd_status status) | 861 | aue_uno_intr(struct usbnet *un, usbd_status status) | |
862 | { | 862 | { | |
863 | struct ifnet *ifp = usbnet_ifp(un); | 863 | struct ifnet *ifp = usbnet_ifp(un); |
--- src/sys/dev/usb/if_axe.c 2022/03/03 05:56:09 1.149
+++ src/sys/dev/usb/if_axe.c 2022/03/03 05:56:28 1.150
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_axe.c,v 1.149 2022/03/03 05:56:09 riastradh Exp $ */ | 1 | /* $NetBSD: if_axe.c,v 1.150 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | /* $OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */ | 2 | /* $OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2005, 2006, 2007 Jonathan Gray <jsg@openbsd.org> | 5 | * Copyright (c) 2005, 2006, 2007 Jonathan Gray <jsg@openbsd.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
@@ -77,27 +77,27 @@ | @@ -77,27 +77,27 @@ | |||
77 | * (Adam Weinberger wanted me to name this driver if_gir.c.) | 77 | * (Adam Weinberger wanted me to name this driver if_gir.c.) | |
78 | */ | 78 | */ | |
79 | 79 | |||
80 | /* | 80 | /* | |
81 | * Ax88178 and Ax88772 support backported from the OpenBSD driver. | 81 | * Ax88178 and Ax88772 support backported from the OpenBSD driver. | |
82 | * 2007/02/12, J.R. Oldroyd, fbsd@opal.com | 82 | * 2007/02/12, J.R. Oldroyd, fbsd@opal.com | |
83 | * | 83 | * | |
84 | * Manual here: | 84 | * Manual here: | |
85 | * http://www.asix.com.tw/FrootAttach/datasheet/AX88178_datasheet_Rev10.pdf | 85 | * http://www.asix.com.tw/FrootAttach/datasheet/AX88178_datasheet_Rev10.pdf | |
86 | * http://www.asix.com.tw/FrootAttach/datasheet/AX88772_datasheet_Rev10.pdf | 86 | * http://www.asix.com.tw/FrootAttach/datasheet/AX88772_datasheet_Rev10.pdf | |
87 | */ | 87 | */ | |
88 | 88 | |||
89 | #include <sys/cdefs.h> | 89 | #include <sys/cdefs.h> | |
90 | __KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.149 2022/03/03 05:56:09 riastradh Exp $"); | 90 | __KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.150 2022/03/03 05:56:28 riastradh Exp $"); | |
91 | 91 | |||
92 | #ifdef _KERNEL_OPT | 92 | #ifdef _KERNEL_OPT | |
93 | #include "opt_usb.h" | 93 | #include "opt_usb.h" | |
94 | #include "opt_net_mpsafe.h" | 94 | #include "opt_net_mpsafe.h" | |
95 | #endif | 95 | #endif | |
96 | 96 | |||
97 | #include <sys/param.h> | 97 | #include <sys/param.h> | |
98 | 98 | |||
99 | #include <dev/usb/usbnet.h> | 99 | #include <dev/usb/usbnet.h> | |
100 | #include <dev/usb/usbhist.h> | 100 | #include <dev/usb/usbhist.h> | |
101 | #include <dev/usb/if_axereg.h> | 101 | #include <dev/usb/if_axereg.h> | |
102 | 102 | |||
103 | struct axe_type { | 103 | struct axe_type { | |
@@ -915,27 +915,27 @@ axe_attach(device_t parent, device_t sel | @@ -915,27 +915,27 @@ axe_attach(device_t parent, device_t sel | |||
915 | 915 | |||
916 | if (dir == UE_DIR_IN && xt == UE_BULK && | 916 | if (dir == UE_DIR_IN && xt == UE_BULK && | |
917 | un->un_ed[USBNET_ENDPT_RX] == 0) { | 917 | un->un_ed[USBNET_ENDPT_RX] == 0) { | |
918 | un->un_ed[USBNET_ENDPT_RX] = ed->bEndpointAddress; | 918 | un->un_ed[USBNET_ENDPT_RX] = ed->bEndpointAddress; | |
919 | } else if (dir == UE_DIR_OUT && xt == UE_BULK && | 919 | } else if (dir == UE_DIR_OUT && xt == UE_BULK && | |
920 | un->un_ed[USBNET_ENDPT_TX] == 0) { | 920 | un->un_ed[USBNET_ENDPT_TX] == 0) { | |
921 | un->un_ed[USBNET_ENDPT_TX] = ed->bEndpointAddress; | 921 | un->un_ed[USBNET_ENDPT_TX] = ed->bEndpointAddress; | |
922 | } else if (dir == UE_DIR_IN && xt == UE_INTERRUPT) { | 922 | } else if (dir == UE_DIR_IN && xt == UE_INTERRUPT) { | |
923 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | 923 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | |
924 | } | 924 | } | |
925 | } | 925 | } | |
926 | 926 | |||
927 | /* Set these up now for axe_cmd(). */ | 927 | /* Set these up now for axe_cmd(). */ | |
928 | usbnet_attach(un, "axedet"); | 928 | usbnet_attach(un); | |
929 | 929 | |||
930 | /* We need the PHYID for init dance in some cases */ | 930 | /* We need the PHYID for init dance in some cases */ | |
931 | if (axe_cmd(sc, AXE_CMD_READ_PHYID, 0, 0, &sc->axe_phyaddrs)) { | 931 | if (axe_cmd(sc, AXE_CMD_READ_PHYID, 0, 0, &sc->axe_phyaddrs)) { | |
932 | aprint_error_dev(self, "failed to read phyaddrs\n"); | 932 | aprint_error_dev(self, "failed to read phyaddrs\n"); | |
933 | return; | 933 | return; | |
934 | } | 934 | } | |
935 | 935 | |||
936 | DPRINTF(" phyaddrs[0]: %jx phyaddrs[1]: %jx", | 936 | DPRINTF(" phyaddrs[0]: %jx phyaddrs[1]: %jx", | |
937 | sc->axe_phyaddrs[0], sc->axe_phyaddrs[1], 0, 0); | 937 | sc->axe_phyaddrs[0], sc->axe_phyaddrs[1], 0, 0); | |
938 | un->un_phyno = axe_get_phyno(sc, AXE_PHY_SEL_PRI); | 938 | un->un_phyno = axe_get_phyno(sc, AXE_PHY_SEL_PRI); | |
939 | if (un->un_phyno == -1) | 939 | if (un->un_phyno == -1) | |
940 | un->un_phyno = axe_get_phyno(sc, AXE_PHY_SEL_SEC); | 940 | un->un_phyno = axe_get_phyno(sc, AXE_PHY_SEL_SEC); | |
941 | if (un->un_phyno == -1) { | 941 | if (un->un_phyno == -1) { |
--- src/sys/dev/usb/if_axen.c 2022/03/03 05:56:09 1.92
+++ src/sys/dev/usb/if_axen.c 2022/03/03 05:56:28 1.93
@@ -1,39 +1,39 @@ | @@ -1,39 +1,39 @@ | |||
1 | /* $NetBSD: if_axen.c,v 1.92 2022/03/03 05:56:09 riastradh Exp $ */ | 1 | /* $NetBSD: if_axen.c,v 1.93 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | /* $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */ | 2 | /* $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2013 Yojiro UO <yuo@openbsd.org> | 5 | * Copyright (c) 2013 Yojiro UO <yuo@openbsd.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | */ | 18 | */ | |
19 | 19 | |||
20 | /* | 20 | /* | |
21 | * ASIX Electronics AX88178a USB 2.0 ethernet and AX88179 USB 3.0 Ethernet | 21 | * ASIX Electronics AX88178a USB 2.0 ethernet and AX88179 USB 3.0 Ethernet | |
22 | * driver. | 22 | * driver. | |
23 | */ | 23 | */ | |
24 | 24 | |||
25 | #include <sys/cdefs.h> | 25 | #include <sys/cdefs.h> | |
26 | __KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.92 2022/03/03 05:56:09 riastradh Exp $"); | 26 | __KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.93 2022/03/03 05:56:28 riastradh Exp $"); | |
27 | 27 | |||
28 | #ifdef _KERNEL_OPT | 28 | #ifdef _KERNEL_OPT | |
29 | #include "opt_usb.h" | 29 | #include "opt_usb.h" | |
30 | #endif | 30 | #endif | |
31 | 31 | |||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> | |
33 | 33 | |||
34 | #include <netinet/in.h> /* XXX for netinet/ip.h */ | 34 | #include <netinet/in.h> /* XXX for netinet/ip.h */ | |
35 | #include <netinet/ip.h> /* XXX for IP_MAXPACKET */ | 35 | #include <netinet/ip.h> /* XXX for IP_MAXPACKET */ | |
36 | 36 | |||
37 | #include <dev/usb/usbnet.h> | 37 | #include <dev/usb/usbnet.h> | |
38 | 38 | |||
39 | #include <dev/usb/if_axenreg.h> | 39 | #include <dev/usb/if_axenreg.h> | |
@@ -640,27 +640,27 @@ axen_attach(device_t parent, device_t se | @@ -640,27 +640,27 @@ axen_attach(device_t parent, device_t se | |||
640 | un->un_ed[USBNET_ENDPT_RX] = ed->bEndpointAddress; | 640 | un->un_ed[USBNET_ENDPT_RX] = ed->bEndpointAddress; | |
641 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 641 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
642 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 642 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
643 | un->un_ed[USBNET_ENDPT_TX] = ed->bEndpointAddress; | 643 | un->un_ed[USBNET_ENDPT_TX] = ed->bEndpointAddress; | |
644 | #if 0 /* not used yet */ | 644 | #if 0 /* not used yet */ | |
645 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 645 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
646 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | 646 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | |
647 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | 647 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | |
648 | #endif | 648 | #endif | |
649 | } | 649 | } | |
650 | } | 650 | } | |
651 | 651 | |||
652 | /* Set these up now for axen_cmd(). */ | 652 | /* Set these up now for axen_cmd(). */ | |
653 | usbnet_attach(un, "axendet"); | 653 | usbnet_attach(un); | |
654 | 654 | |||
655 | un->un_phyno = AXEN_PHY_ID; | 655 | un->un_phyno = AXEN_PHY_ID; | |
656 | DPRINTF(("%s: phyno %d\n", device_xname(self), un->un_phyno)); | 656 | DPRINTF(("%s: phyno %d\n", device_xname(self), un->un_phyno)); | |
657 | 657 | |||
658 | /* Get station address. */ | 658 | /* Get station address. */ | |
659 | if (axen_get_eaddr(un, &un->un_eaddr)) { | 659 | if (axen_get_eaddr(un, &un->un_eaddr)) { | |
660 | printf("EEPROM checksum error\n"); | 660 | printf("EEPROM checksum error\n"); | |
661 | return; | 661 | return; | |
662 | } | 662 | } | |
663 | 663 | |||
664 | axen_ax88179_init(un); | 664 | axen_ax88179_init(un); | |
665 | 665 | |||
666 | /* An ASIX chip was detected. Inform the world. */ | 666 | /* An ASIX chip was detected. Inform the world. */ |
--- src/sys/dev/usb/if_cdce.c 2022/03/03 05:56:18 1.80
+++ src/sys/dev/usb/if_cdce.c 2022/03/03 05:56:28 1.81
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_cdce.c,v 1.80 2022/03/03 05:56:18 riastradh Exp $ */ | 1 | /* $NetBSD: if_cdce.c,v 1.81 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com> | 4 | * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com> | |
5 | * Copyright (c) 2003 Craig Boston | 5 | * Copyright (c) 2003 Craig Boston | |
6 | * Copyright (c) 2004 Daniel Hartmeier | 6 | * Copyright (c) 2004 Daniel Hartmeier | |
7 | * All rights reserved. | 7 | * All rights reserved. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -30,27 +30,27 @@ | @@ -30,27 +30,27 @@ | |||
30 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 30 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
31 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 31 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
32 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 32 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
33 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 33 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
34 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 34 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | /* | 37 | /* | |
38 | * USB Communication Device Class (Ethernet Networking Control Model) | 38 | * USB Communication Device Class (Ethernet Networking Control Model) | |
39 | * http://www.usb.org/developers/devclass_docs/usbcdc11.pdf | 39 | * http://www.usb.org/developers/devclass_docs/usbcdc11.pdf | |
40 | */ | 40 | */ | |
41 | 41 | |||
42 | #include <sys/cdefs.h> | 42 | #include <sys/cdefs.h> | |
43 | __KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.80 2022/03/03 05:56:18 riastradh Exp $"); | 43 | __KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.81 2022/03/03 05:56:28 riastradh Exp $"); | |
44 | 44 | |||
45 | #include <sys/param.h> | 45 | #include <sys/param.h> | |
46 | 46 | |||
47 | #include <dev/usb/usbnet.h> | 47 | #include <dev/usb/usbnet.h> | |
48 | #include <dev/usb/usbcdc.h> | 48 | #include <dev/usb/usbcdc.h> | |
49 | 49 | |||
50 | #include <dev/usb/if_cdcereg.h> | 50 | #include <dev/usb/if_cdcereg.h> | |
51 | 51 | |||
52 | struct cdce_type { | 52 | struct cdce_type { | |
53 | struct usb_devno cdce_dev; | 53 | struct usb_devno cdce_dev; | |
54 | uint16_t cdce_flags; | 54 | uint16_t cdce_flags; | |
55 | #define CDCE_ZAURUS 1 | 55 | #define CDCE_ZAURUS 1 | |
56 | #define CDCE_NO_UNION 2 | 56 | #define CDCE_NO_UNION 2 | |
@@ -238,27 +238,27 @@ cdce_attach(device_t parent, device_t se | @@ -238,27 +238,27 @@ cdce_attach(device_t parent, device_t se | |||
238 | 238 | |||
239 | ue = (const usb_cdc_ethernet_descriptor_t *)usb_find_desc_if(dev, | 239 | ue = (const usb_cdc_ethernet_descriptor_t *)usb_find_desc_if(dev, | |
240 | UDESC_CS_INTERFACE, UDESCSUB_CDC_ENF, | 240 | UDESC_CS_INTERFACE, UDESCSUB_CDC_ENF, | |
241 | usbd_get_interface_descriptor(uiaa->uiaa_iface)); | 241 | usbd_get_interface_descriptor(uiaa->uiaa_iface)); | |
242 | if (!ue || usbd_get_string(dev, ue->iMacAddress, eaddr_str) || | 242 | if (!ue || usbd_get_string(dev, ue->iMacAddress, eaddr_str) || | |
243 | ether_aton_r(un->un_eaddr, sizeof(un->un_eaddr), eaddr_str)) { | 243 | ether_aton_r(un->un_eaddr, sizeof(un->un_eaddr), eaddr_str)) { | |
244 | aprint_normal_dev(self, "faking address\n"); | 244 | aprint_normal_dev(self, "faking address\n"); | |
245 | un->un_eaddr[0] = 0x2a; | 245 | un->un_eaddr[0] = 0x2a; | |
246 | uint32_t ticks = getticks(); | 246 | uint32_t ticks = getticks(); | |
247 | memcpy(&un->un_eaddr[1], &ticks, sizeof(ticks)); | 247 | memcpy(&un->un_eaddr[1], &ticks, sizeof(ticks)); | |
248 | un->un_eaddr[5] = (uint8_t)(device_unit(un->un_dev)); | 248 | un->un_eaddr[5] = (uint8_t)(device_unit(un->un_dev)); | |
249 | } | 249 | } | |
250 | 250 | |||
251 | usbnet_attach(un, "cdcedet"); | 251 | usbnet_attach(un); | |
252 | usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST, | 252 | usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST, | |
253 | 0, NULL); | 253 | 0, NULL); | |
254 | } | 254 | } | |
255 | 255 | |||
256 | static void | 256 | static void | |
257 | cdce_uno_rx_loop(struct usbnet * un, struct usbnet_chain *c, uint32_t total_len) | 257 | cdce_uno_rx_loop(struct usbnet * un, struct usbnet_chain *c, uint32_t total_len) | |
258 | { | 258 | { | |
259 | struct ifnet *ifp = usbnet_ifp(un); | 259 | struct ifnet *ifp = usbnet_ifp(un); | |
260 | 260 | |||
261 | /* Strip off CRC added by Zaurus, if present */ | 261 | /* Strip off CRC added by Zaurus, if present */ | |
262 | if (un->un_flags & CDCE_ZAURUS && total_len > 4) | 262 | if (un->un_flags & CDCE_ZAURUS && total_len > 4) | |
263 | total_len -= 4; | 263 | total_len -= 4; | |
264 | 264 |
--- src/sys/dev/usb/if_mue.c 2022/03/03 05:56:09 1.80
+++ src/sys/dev/usb/if_mue.c 2022/03/03 05:56:28 1.81
@@ -1,36 +1,36 @@ | @@ -1,36 +1,36 @@ | |||
1 | /* $NetBSD: if_mue.c,v 1.80 2022/03/03 05:56:09 riastradh Exp $ */ | 1 | /* $NetBSD: if_mue.c,v 1.81 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | /* $OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $ */ | 2 | /* $OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2018 Kevin Lo <kevlo@openbsd.org> | 5 | * Copyright (c) 2018 Kevin Lo <kevlo@openbsd.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | */ | 18 | */ | |
19 | 19 | |||
20 | /* Driver for Microchip LAN7500/LAN7800 chipsets. */ | 20 | /* Driver for Microchip LAN7500/LAN7800 chipsets. */ | |
21 | 21 | |||
22 | #include <sys/cdefs.h> | 22 | #include <sys/cdefs.h> | |
23 | __KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.80 2022/03/03 05:56:09 riastradh Exp $"); | 23 | __KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.81 2022/03/03 05:56:28 riastradh Exp $"); | |
24 | 24 | |||
25 | #ifdef _KERNEL_OPT | 25 | #ifdef _KERNEL_OPT | |
26 | #include "opt_usb.h" | 26 | #include "opt_usb.h" | |
27 | #include "opt_inet.h" | 27 | #include "opt_inet.h" | |
28 | #endif | 28 | #endif | |
29 | 29 | |||
30 | #include <sys/param.h> | 30 | #include <sys/param.h> | |
31 | 31 | |||
32 | #include <dev/usb/usbnet.h> | 32 | #include <dev/usb/usbnet.h> | |
33 | 33 | |||
34 | #include <dev/usb/if_muereg.h> | 34 | #include <dev/usb/if_muereg.h> | |
35 | #include <dev/usb/if_muevar.h> | 35 | #include <dev/usb/if_muevar.h> | |
36 | 36 | |||
@@ -846,27 +846,27 @@ mue_attach(device_t parent, device_t sel | @@ -846,27 +846,27 @@ mue_attach(device_t parent, device_t sel | |||
846 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 846 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
847 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | 847 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | |
848 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | 848 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | |
849 | } | 849 | } | |
850 | } | 850 | } | |
851 | if (un->un_ed[USBNET_ENDPT_RX] == 0 || | 851 | if (un->un_ed[USBNET_ENDPT_RX] == 0 || | |
852 | un->un_ed[USBNET_ENDPT_TX] == 0 || | 852 | un->un_ed[USBNET_ENDPT_TX] == 0 || | |
853 | un->un_ed[USBNET_ENDPT_INTR] == 0) { | 853 | un->un_ed[USBNET_ENDPT_INTR] == 0) { | |
854 | aprint_error_dev(self, "failed to find endpoints\n"); | 854 | aprint_error_dev(self, "failed to find endpoints\n"); | |
855 | return; | 855 | return; | |
856 | } | 856 | } | |
857 | 857 | |||
858 | /* Set these up now for mue_cmd(). */ | 858 | /* Set these up now for mue_cmd(). */ | |
859 | usbnet_attach(un, "muedet"); | 859 | usbnet_attach(un); | |
860 | 860 | |||
861 | un->un_phyno = 1; | 861 | un->un_phyno = 1; | |
862 | 862 | |||
863 | if (mue_chip_init(un)) { | 863 | if (mue_chip_init(un)) { | |
864 | aprint_error_dev(self, "failed to initialize chip\n"); | 864 | aprint_error_dev(self, "failed to initialize chip\n"); | |
865 | return; | 865 | return; | |
866 | } | 866 | } | |
867 | 867 | |||
868 | /* A Microchip chip was detected. Inform the world. */ | 868 | /* A Microchip chip was detected. Inform the world. */ | |
869 | id_rev = mue_csr_read(un, MUE_ID_REV); | 869 | id_rev = mue_csr_read(un, MUE_ID_REV); | |
870 | descr = (un->un_flags & LAN7500) ? "LAN7500" : "LAN7800"; | 870 | descr = (un->un_flags & LAN7500) ? "LAN7500" : "LAN7800"; | |
871 | aprint_normal_dev(self, "%s id %#x rev %#x\n", descr, | 871 | aprint_normal_dev(self, "%s id %#x rev %#x\n", descr, | |
872 | (unsigned)__SHIFTOUT(id_rev, MUE_ID_REV_ID), | 872 | (unsigned)__SHIFTOUT(id_rev, MUE_ID_REV_ID), |
--- src/sys/dev/usb/if_cue.c 2022/03/03 05:56:09 1.105
+++ src/sys/dev/usb/if_cue.c 2022/03/03 05:56:28 1.106
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_cue.c,v 1.105 2022/03/03 05:56:09 riastradh Exp $ */ | 1 | /* $NetBSD: if_cue.c,v 1.106 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997, 1998, 1999, 2000 | 4 | * Copyright (c) 1997, 1998, 1999, 2000 | |
5 | * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. | 5 | * Bill Paul <wpaul@ee.columbia.edu>. 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. | |
@@ -47,27 +47,27 @@ | @@ -47,27 +47,27 @@ | |||
47 | * The CATC USB-EL1210A provides USB ethernet support at 10Mbps. The | 47 | * The CATC USB-EL1210A provides USB ethernet support at 10Mbps. The | |
48 | * RX filter uses a 512-bit multicast hash table, single perfect entry | 48 | * RX filter uses a 512-bit multicast hash table, single perfect entry | |
49 | * for the station address, and promiscuous mode. Unlike the ADMtek | 49 | * for the station address, and promiscuous mode. Unlike the ADMtek | |
50 | * and KLSI chips, the CATC ASIC supports read and write combining | 50 | * and KLSI chips, the CATC ASIC supports read and write combining | |
51 | * mode where multiple packets can be transferred using a single bulk | 51 | * mode where multiple packets can be transferred using a single bulk | |
52 | * transaction, which helps performance a great deal. | 52 | * transaction, which helps performance a great deal. | |
53 | */ | 53 | */ | |
54 | 54 | |||
55 | /* | 55 | /* | |
56 | * Ported to NetBSD and somewhat rewritten by Lennart Augustsson. | 56 | * Ported to NetBSD and somewhat rewritten by Lennart Augustsson. | |
57 | */ | 57 | */ | |
58 | 58 | |||
59 | #include <sys/cdefs.h> | 59 | #include <sys/cdefs.h> | |
60 | __KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.105 2022/03/03 05:56:09 riastradh Exp $"); | 60 | __KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.106 2022/03/03 05:56:28 riastradh Exp $"); | |
61 | 61 | |||
62 | #ifdef _KERNEL_OPT | 62 | #ifdef _KERNEL_OPT | |
63 | #include "opt_inet.h" | 63 | #include "opt_inet.h" | |
64 | #include "opt_usb.h" | 64 | #include "opt_usb.h" | |
65 | #endif | 65 | #endif | |
66 | 66 | |||
67 | #include <sys/param.h> | 67 | #include <sys/param.h> | |
68 | 68 | |||
69 | #include <dev/usb/usbnet.h> | 69 | #include <dev/usb/usbnet.h> | |
70 | #include <dev/usb/if_cuereg.h> | 70 | #include <dev/usb/if_cuereg.h> | |
71 | 71 | |||
72 | #ifdef INET | 72 | #ifdef INET | |
73 | #include <netinet/in.h> | 73 | #include <netinet/in.h> | |
@@ -515,27 +515,27 @@ cue_attach(device_t parent, device_t sel | @@ -515,27 +515,27 @@ cue_attach(device_t parent, device_t sel | |||
515 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 515 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
516 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 516 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
517 | un->un_ed[USBNET_ENDPT_RX] = ed->bEndpointAddress; | 517 | un->un_ed[USBNET_ENDPT_RX] = ed->bEndpointAddress; | |
518 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 518 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
519 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 519 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
520 | un->un_ed[USBNET_ENDPT_TX] = ed->bEndpointAddress; | 520 | un->un_ed[USBNET_ENDPT_TX] = ed->bEndpointAddress; | |
521 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 521 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
522 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | 522 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | |
523 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | 523 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | |
524 | } | 524 | } | |
525 | } | 525 | } | |
526 | 526 | |||
527 | /* First level attach. */ | 527 | /* First level attach. */ | |
528 | usbnet_attach(un, "cuedet"); | 528 | usbnet_attach(un); | |
529 | 529 | |||
530 | #if 0 | 530 | #if 0 | |
531 | /* Reset the adapter. */ | 531 | /* Reset the adapter. */ | |
532 | cue_reset(un); | 532 | cue_reset(un); | |
533 | #endif | 533 | #endif | |
534 | /* | 534 | /* | |
535 | * Get station address. | 535 | * Get station address. | |
536 | */ | 536 | */ | |
537 | cue_getmac(un); | 537 | cue_getmac(un); | |
538 | 538 | |||
539 | usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST, | 539 | usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST, | |
540 | 0, NULL); | 540 | 0, NULL); | |
541 | } | 541 | } |
--- src/sys/dev/usb/if_kue.c 2022/03/03 05:56:09 1.117
+++ src/sys/dev/usb/if_kue.c 2022/03/03 05:56:28 1.118
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_kue.c,v 1.117 2022/03/03 05:56:09 riastradh Exp $ */ | 1 | /* $NetBSD: if_kue.c,v 1.118 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997, 1998, 1999, 2000 | 4 | * Copyright (c) 1997, 1998, 1999, 2000 | |
5 | * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. | 5 | * Bill Paul <wpaul@ee.columbia.edu>. 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. | |
@@ -61,27 +61,27 @@ | @@ -61,27 +61,27 @@ | |||
61 | * powered on and retain its firmware. In this case, we don't need | 61 | * powered on and retain its firmware. In this case, we don't need | |
62 | * to load the firmware a second time. | 62 | * to load the firmware a second time. | |
63 | * | 63 | * | |
64 | * Special thanks to Rob Furr for providing an ADS Technologies | 64 | * Special thanks to Rob Furr for providing an ADS Technologies | |
65 | * adapter for development and testing. No monkeys were harmed during | 65 | * adapter for development and testing. No monkeys were harmed during | |
66 | * the development of this driver. | 66 | * the development of this driver. | |
67 | */ | 67 | */ | |
68 | 68 | |||
69 | /* | 69 | /* | |
70 | * Ported to NetBSD and somewhat rewritten by Lennart Augustsson. | 70 | * Ported to NetBSD and somewhat rewritten by Lennart Augustsson. | |
71 | */ | 71 | */ | |
72 | 72 | |||
73 | #include <sys/cdefs.h> | 73 | #include <sys/cdefs.h> | |
74 | __KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.117 2022/03/03 05:56:09 riastradh Exp $"); | 74 | __KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.118 2022/03/03 05:56:28 riastradh Exp $"); | |
75 | 75 | |||
76 | #ifdef _KERNEL_OPT | 76 | #ifdef _KERNEL_OPT | |
77 | #include "opt_inet.h" | 77 | #include "opt_inet.h" | |
78 | #include "opt_usb.h" | 78 | #include "opt_usb.h" | |
79 | #endif | 79 | #endif | |
80 | 80 | |||
81 | #include <sys/param.h> | 81 | #include <sys/param.h> | |
82 | #include <sys/kmem.h> | 82 | #include <sys/kmem.h> | |
83 | 83 | |||
84 | #include <dev/usb/usbnet.h> | 84 | #include <dev/usb/usbnet.h> | |
85 | 85 | |||
86 | #ifdef INET | 86 | #ifdef INET | |
87 | #include <netinet/in.h> | 87 | #include <netinet/in.h> | |
@@ -484,27 +484,27 @@ kue_attach(device_t parent, device_t sel | @@ -484,27 +484,27 @@ kue_attach(device_t parent, device_t sel | |||
484 | * KLSI part. | 484 | * KLSI part. | |
485 | */ | 485 | */ | |
486 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | 486 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | |
487 | } | 487 | } | |
488 | } | 488 | } | |
489 | 489 | |||
490 | if (un->un_ed[USBNET_ENDPT_RX] == 0 || | 490 | if (un->un_ed[USBNET_ENDPT_RX] == 0 || | |
491 | un->un_ed[USBNET_ENDPT_TX] == 0) { | 491 | un->un_ed[USBNET_ENDPT_TX] == 0) { | |
492 | aprint_error_dev(self, "missing endpoint\n"); | 492 | aprint_error_dev(self, "missing endpoint\n"); | |
493 | return; | 493 | return; | |
494 | } | 494 | } | |
495 | 495 | |||
496 | /* First level attach, so kue_ctl() works. */ | 496 | /* First level attach, so kue_ctl() works. */ | |
497 | usbnet_attach(un, "kuedet"); | 497 | usbnet_attach(un); | |
498 | 498 | |||
499 | /* Read ethernet descriptor */ | 499 | /* Read ethernet descriptor */ | |
500 | err = kue_ctl(un, KUE_CTL_READ, KUE_CMD_GET_ETHER_DESCRIPTOR, | 500 | err = kue_ctl(un, KUE_CTL_READ, KUE_CMD_GET_ETHER_DESCRIPTOR, | |
501 | 0, &sc->kue_desc, sizeof(sc->kue_desc)); | 501 | 0, &sc->kue_desc, sizeof(sc->kue_desc)); | |
502 | if (err) { | 502 | if (err) { | |
503 | aprint_error_dev(self, "could not read Ethernet descriptor\n"); | 503 | aprint_error_dev(self, "could not read Ethernet descriptor\n"); | |
504 | return; | 504 | return; | |
505 | } | 505 | } | |
506 | memcpy(un->un_eaddr, sc->kue_desc.kue_macaddr, sizeof(un->un_eaddr)); | 506 | memcpy(un->un_eaddr, sc->kue_desc.kue_macaddr, sizeof(un->un_eaddr)); | |
507 | 507 | |||
508 | sc->kue_mcfilters = kmem_alloc(KUE_MCFILTCNT(sc) * ETHER_ADDR_LEN, | 508 | sc->kue_mcfilters = kmem_alloc(KUE_MCFILTCNT(sc) * ETHER_ADDR_LEN, | |
509 | KM_SLEEP); | 509 | KM_SLEEP); | |
510 | 510 |
--- src/sys/dev/usb/if_mos.c 2022/03/03 05:56:09 1.21
+++ src/sys/dev/usb/if_mos.c 2022/03/03 05:56:28 1.22
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_mos.c,v 1.21 2022/03/03 05:56:09 riastradh Exp $ */ | 1 | /* $NetBSD: if_mos.c,v 1.22 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | /* $OpenBSD: if_mos.c,v 1.40 2019/07/07 06:40:10 kevlo Exp $ */ | 2 | /* $OpenBSD: if_mos.c,v 1.40 2019/07/07 06:40:10 kevlo Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2008 Johann Christian Rode <jcrode@gmx.net> | 5 | * Copyright (c) 2008 Johann Christian Rode <jcrode@gmx.net> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
@@ -62,27 +62,27 @@ | @@ -62,27 +62,27 @@ | |||
62 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 62 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
63 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 63 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
64 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 64 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
65 | * THE POSSIBILITY OF SUCH DAMAGE. | 65 | * THE POSSIBILITY OF SUCH DAMAGE. | |
66 | */ | 66 | */ | |
67 | 67 | |||
68 | /* | 68 | /* | |
69 | * Moschip MCS7730/MCS7830/MCS7832 USB to Ethernet controller | 69 | * Moschip MCS7730/MCS7830/MCS7832 USB to Ethernet controller | |
70 | * The datasheet is available at the following URL: | 70 | * The datasheet is available at the following URL: | |
71 | * http://www.moschip.com/data/products/MCS7830/Data%20Sheet_7830.pdf | 71 | * http://www.moschip.com/data/products/MCS7830/Data%20Sheet_7830.pdf | |
72 | */ | 72 | */ | |
73 | 73 | |||
74 | #include <sys/cdefs.h> | 74 | #include <sys/cdefs.h> | |
75 | __KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.21 2022/03/03 05:56:09 riastradh Exp $"); | 75 | __KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.22 2022/03/03 05:56:28 riastradh Exp $"); | |
76 | 76 | |||
77 | #include <sys/param.h> | 77 | #include <sys/param.h> | |
78 | 78 | |||
79 | #include <dev/usb/usbnet.h> | 79 | #include <dev/usb/usbnet.h> | |
80 | #include <dev/usb/if_mosreg.h> | 80 | #include <dev/usb/if_mosreg.h> | |
81 | 81 | |||
82 | #define MOS_PAUSE_REWRITES 3 | 82 | #define MOS_PAUSE_REWRITES 3 | |
83 | 83 | |||
84 | #define MOS_TIMEOUT 1000 | 84 | #define MOS_TIMEOUT 1000 | |
85 | 85 | |||
86 | #define MOS_RX_LIST_CNT 1 | 86 | #define MOS_RX_LIST_CNT 1 | |
87 | #define MOS_TX_LIST_CNT 1 | 87 | #define MOS_TX_LIST_CNT 1 | |
88 | 88 | |||
@@ -629,27 +629,27 @@ mos_attach(device_t parent, device_t sel | @@ -629,27 +629,27 @@ mos_attach(device_t parent, device_t sel | |||
629 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | 629 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | |
630 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | 630 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | |
631 | } | 631 | } | |
632 | } | 632 | } | |
633 | 633 | |||
634 | if (un->un_flags & MCS7730) | 634 | if (un->un_flags & MCS7730) | |
635 | aprint_normal_dev(self, "MCS7730\n"); | 635 | aprint_normal_dev(self, "MCS7730\n"); | |
636 | else if (un->un_flags & MCS7830) | 636 | else if (un->un_flags & MCS7830) | |
637 | aprint_normal_dev(self, "MCS7830\n"); | 637 | aprint_normal_dev(self, "MCS7830\n"); | |
638 | else if (un->un_flags & MCS7832) | 638 | else if (un->un_flags & MCS7832) | |
639 | aprint_normal_dev(self, "MCS7832\n"); | 639 | aprint_normal_dev(self, "MCS7832\n"); | |
640 | 640 | |||
641 | /* Set these up now for register access. */ | 641 | /* Set these up now for register access. */ | |
642 | usbnet_attach(un, "mosdet"); | 642 | usbnet_attach(un); | |
643 | 643 | |||
644 | mos_chip_init(un); | 644 | mos_chip_init(un); | |
645 | 645 | |||
646 | /* | 646 | /* | |
647 | * Read MAC address, inform the world. | 647 | * Read MAC address, inform the world. | |
648 | */ | 648 | */ | |
649 | err = mos_readmac(un); | 649 | err = mos_readmac(un); | |
650 | if (err) { | 650 | if (err) { | |
651 | aprint_error_dev(self, "couldn't read MAC address\n"); | 651 | aprint_error_dev(self, "couldn't read MAC address\n"); | |
652 | return; | 652 | return; | |
653 | } | 653 | } | |
654 | 654 | |||
655 | struct ifnet *ifp = usbnet_ifp(un); | 655 | struct ifnet *ifp = usbnet_ifp(un); |
--- src/sys/dev/usb/if_smsc.c 2022/03/03 05:56:09 1.91
+++ src/sys/dev/usb/if_smsc.c 2022/03/03 05:56:28 1.92
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_smsc.c,v 1.91 2022/03/03 05:56:09 riastradh Exp $ */ | 1 | /* $NetBSD: if_smsc.c,v 1.92 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */ | 3 | /* $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */ | |
4 | /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */ | 4 | /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */ | |
5 | /*- | 5 | /*- | |
6 | * Copyright (c) 2012 | 6 | * Copyright (c) 2012 | |
7 | * Ben Gray <bgray@freebsd.org>. | 7 | * Ben Gray <bgray@freebsd.org>. | |
8 | * All rights reserved. | 8 | * All rights reserved. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -51,27 +51,27 @@ | @@ -51,27 +51,27 @@ | |||
51 | * the H/W checksum will be incorrect, however the rx code compensates for this. | 51 | * the H/W checksum will be incorrect, however the rx code compensates for this. | |
52 | * | 52 | * | |
53 | * TX checksuming is more complicated, the device requires a special header to | 53 | * TX checksuming is more complicated, the device requires a special header to | |
54 | * be prefixed onto the start of the frame which indicates the start and end | 54 | * be prefixed onto the start of the frame which indicates the start and end | |
55 | * positions of the UDP or TCP frame. This requires the driver to manually | 55 | * positions of the UDP or TCP frame. This requires the driver to manually | |
56 | * go through the packet data and decode the headers prior to sending. | 56 | * go through the packet data and decode the headers prior to sending. | |
57 | * On Linux they generally provide cues to the location of the csum and the | 57 | * On Linux they generally provide cues to the location of the csum and the | |
58 | * area to calculate it over, on FreeBSD we seem to have to do it all ourselves, | 58 | * area to calculate it over, on FreeBSD we seem to have to do it all ourselves, | |
59 | * hence this is not as optimal and therefore h/w TX checksum is currently not | 59 | * hence this is not as optimal and therefore h/w TX checksum is currently not | |
60 | * implemented. | 60 | * implemented. | |
61 | */ | 61 | */ | |
62 | 62 | |||
63 | #include <sys/cdefs.h> | 63 | #include <sys/cdefs.h> | |
64 | __KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.91 2022/03/03 05:56:09 riastradh Exp $"); | 64 | __KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.92 2022/03/03 05:56:28 riastradh Exp $"); | |
65 | 65 | |||
66 | #ifdef _KERNEL_OPT | 66 | #ifdef _KERNEL_OPT | |
67 | #include "opt_usb.h" | 67 | #include "opt_usb.h" | |
68 | #endif | 68 | #endif | |
69 | 69 | |||
70 | #include <sys/param.h> | 70 | #include <sys/param.h> | |
71 | 71 | |||
72 | #include <dev/usb/usbnet.h> | 72 | #include <dev/usb/usbnet.h> | |
73 | #include <dev/usb/usbhist.h> | 73 | #include <dev/usb/usbhist.h> | |
74 | 74 | |||
75 | #include <dev/usb/if_smscreg.h> | 75 | #include <dev/usb/if_smscreg.h> | |
76 | 76 | |||
77 | #include "ioconf.h" | 77 | #include "ioconf.h" | |
@@ -816,27 +816,27 @@ smsc_attach(device_t parent, device_t se | @@ -816,27 +816,27 @@ smsc_attach(device_t parent, device_t se | |||
816 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 816 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
817 | un->un_ed[USBNET_ENDPT_RX] = ed->bEndpointAddress; | 817 | un->un_ed[USBNET_ENDPT_RX] = ed->bEndpointAddress; | |
818 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 818 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
819 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 819 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
820 | un->un_ed[USBNET_ENDPT_TX] = ed->bEndpointAddress; | 820 | un->un_ed[USBNET_ENDPT_TX] = ed->bEndpointAddress; | |
821 | #if 0 /* not used yet */ | 821 | #if 0 /* not used yet */ | |
822 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 822 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
823 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | 823 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | |
824 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | 824 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | |
825 | #endif | 825 | #endif | |
826 | } | 826 | } | |
827 | } | 827 | } | |
828 | 828 | |||
829 | usbnet_attach(un, "smscdet"); | 829 | usbnet_attach(un); | |
830 | 830 | |||
831 | #ifdef notyet | 831 | #ifdef notyet | |
832 | /* | 832 | /* | |
833 | * We can do TCPv4, and UDPv4 checksums in hardware. | 833 | * We can do TCPv4, and UDPv4 checksums in hardware. | |
834 | */ | 834 | */ | |
835 | struct ifnet *ifp = usbnet_ifp(un); | 835 | struct ifnet *ifp = usbnet_ifp(un); | |
836 | 836 | |||
837 | ifp->if_capabilities |= | 837 | ifp->if_capabilities |= | |
838 | /*IFCAP_CSUM_TCPv4_Tx |*/ IFCAP_CSUM_TCPv4_Rx | | 838 | /*IFCAP_CSUM_TCPv4_Tx |*/ IFCAP_CSUM_TCPv4_Rx | | |
839 | /*IFCAP_CSUM_UDPv4_Tx |*/ IFCAP_CSUM_UDPv4_Rx; | 839 | /*IFCAP_CSUM_UDPv4_Tx |*/ IFCAP_CSUM_UDPv4_Rx; | |
840 | #endif | 840 | #endif | |
841 | struct ethercom *ec = usbnet_ec(un); | 841 | struct ethercom *ec = usbnet_ec(un); | |
842 | ec->ec_capabilities = ETHERCAP_VLAN_MTU; | 842 | ec->ec_capabilities = ETHERCAP_VLAN_MTU; |
--- src/sys/dev/usb/if_udav.c 2022/03/03 05:56:09 1.96
+++ src/sys/dev/usb/if_udav.c 2022/03/03 05:56:28 1.97
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_udav.c,v 1.96 2022/03/03 05:56:09 riastradh Exp $ */ | 1 | /* $NetBSD: if_udav.c,v 1.97 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | /* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ | 2 | /* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2003 | 5 | * Copyright (c) 2003 | |
6 | * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. | 6 | * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -35,27 +35,27 @@ | @@ -35,27 +35,27 @@ | |||
35 | * DM9601(DAVICOM USB to Ethernet MAC Controller with Integrated 10/100 PHY) | 35 | * DM9601(DAVICOM USB to Ethernet MAC Controller with Integrated 10/100 PHY) | |
36 | * The spec can be found at the following url. | 36 | * The spec can be found at the following url. | |
37 | * http://www.davicom.com.tw/big5/download/Data%20Sheet/DM9601-DS-F01-062202s.pdf | 37 | * http://www.davicom.com.tw/big5/download/Data%20Sheet/DM9601-DS-F01-062202s.pdf | |
38 | */ | 38 | */ | |
39 | 39 | |||
40 | /* | 40 | /* | |
41 | * TODO: | 41 | * TODO: | |
42 | * Interrupt Endpoint support | 42 | * Interrupt Endpoint support | |
43 | * External PHYs | 43 | * External PHYs | |
44 | * powerhook() support? | 44 | * powerhook() support? | |
45 | */ | 45 | */ | |
46 | 46 | |||
47 | #include <sys/cdefs.h> | 47 | #include <sys/cdefs.h> | |
48 | __KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.96 2022/03/03 05:56:09 riastradh Exp $"); | 48 | __KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.97 2022/03/03 05:56:28 riastradh Exp $"); | |
49 | 49 | |||
50 | #ifdef _KERNEL_OPT | 50 | #ifdef _KERNEL_OPT | |
51 | #include "opt_usb.h" | 51 | #include "opt_usb.h" | |
52 | #endif | 52 | #endif | |
53 | 53 | |||
54 | #include <sys/param.h> | 54 | #include <sys/param.h> | |
55 | 55 | |||
56 | #include <dev/usb/usbnet.h> | 56 | #include <dev/usb/usbnet.h> | |
57 | #include <dev/usb/if_udavreg.h> | 57 | #include <dev/usb/if_udavreg.h> | |
58 | 58 | |||
59 | /* Function declarations */ | 59 | /* Function declarations */ | |
60 | static int udav_match(device_t, cfdata_t, void *); | 60 | static int udav_match(device_t, cfdata_t, void *); | |
61 | static void udav_attach(device_t, device_t, void *); | 61 | static void udav_attach(device_t, device_t, void *); | |
@@ -226,27 +226,27 @@ udav_attach(device_t parent, device_t se | @@ -226,27 +226,27 @@ udav_attach(device_t parent, device_t se | |||
226 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | 226 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | |
227 | } | 227 | } | |
228 | 228 | |||
229 | if (un->un_ed[USBNET_ENDPT_RX] == 0 || | 229 | if (un->un_ed[USBNET_ENDPT_RX] == 0 || | |
230 | un->un_ed[USBNET_ENDPT_TX] == 0 || | 230 | un->un_ed[USBNET_ENDPT_TX] == 0 || | |
231 | un->un_ed[USBNET_ENDPT_INTR] == 0) { | 231 | un->un_ed[USBNET_ENDPT_INTR] == 0) { | |
232 | aprint_error_dev(self, "missing endpoint\n"); | 232 | aprint_error_dev(self, "missing endpoint\n"); | |
233 | return; | 233 | return; | |
234 | } | 234 | } | |
235 | 235 | |||
236 | /* Not supported yet. */ | 236 | /* Not supported yet. */ | |
237 | un->un_ed[USBNET_ENDPT_INTR] = 0; | 237 | un->un_ed[USBNET_ENDPT_INTR] = 0; | |
238 | 238 | |||
239 | usbnet_attach(un, "udavdet"); | 239 | usbnet_attach(un); | |
240 | 240 | |||
241 | // /* reset the adapter */ | 241 | // /* reset the adapter */ | |
242 | // udav_reset(un); | 242 | // udav_reset(un); | |
243 | 243 | |||
244 | /* Get Ethernet Address */ | 244 | /* Get Ethernet Address */ | |
245 | err = udav_csr_read(un, UDAV_PAR, un->un_eaddr, ETHER_ADDR_LEN); | 245 | err = udav_csr_read(un, UDAV_PAR, un->un_eaddr, ETHER_ADDR_LEN); | |
246 | if (err) { | 246 | if (err) { | |
247 | aprint_error_dev(self, "read MAC address failed\n"); | 247 | aprint_error_dev(self, "read MAC address failed\n"); | |
248 | return; | 248 | return; | |
249 | } | 249 | } | |
250 | 250 | |||
251 | if (ISSET(un->un_flags, UDAV_NO_PHY)) | 251 | if (ISSET(un->un_flags, UDAV_NO_PHY)) | |
252 | unmp = NULL; | 252 | unmp = NULL; |
--- src/sys/dev/usb/if_upl.c 2022/03/03 05:56:18 1.76
+++ src/sys/dev/usb/if_upl.c 2022/03/03 05:56:28 1.77
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_upl.c,v 1.76 2022/03/03 05:56:18 riastradh Exp $ */ | 1 | /* $NetBSD: if_upl.c,v 1.77 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Lennart Augustsson (lennart@augustsson.net) at | 8 | * by Lennart Augustsson (lennart@augustsson.net) at | |
9 | * Carlstedt Research & Technology. | 9 | * Carlstedt Research & Technology. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -25,27 +25,27 @@ | @@ -25,27 +25,27 @@ | |||
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
30 | * POSSIBILITY OF SUCH DAMAGE. | 30 | * POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | /* | 33 | /* | |
34 | * Prolific PL2301/PL2302 driver | 34 | * Prolific PL2301/PL2302 driver | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #include <sys/cdefs.h> | 37 | #include <sys/cdefs.h> | |
38 | __KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.76 2022/03/03 05:56:18 riastradh Exp $"); | 38 | __KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.77 2022/03/03 05:56:28 riastradh Exp $"); | |
39 | 39 | |||
40 | #ifdef _KERNEL_OPT | 40 | #ifdef _KERNEL_OPT | |
41 | #include "opt_inet.h" | 41 | #include "opt_inet.h" | |
42 | #include "opt_usb.h" | 42 | #include "opt_usb.h" | |
43 | #endif | 43 | #endif | |
44 | 44 | |||
45 | #include <sys/param.h> | 45 | #include <sys/param.h> | |
46 | 46 | |||
47 | #include <dev/usb/usbnet.h> | 47 | #include <dev/usb/usbnet.h> | |
48 | 48 | |||
49 | #include <net/if_types.h> | 49 | #include <net/if_types.h> | |
50 | 50 | |||
51 | #ifdef INET | 51 | #ifdef INET | |
@@ -195,27 +195,27 @@ upl_attach(device_t parent, device_t sel | @@ -195,27 +195,27 @@ upl_attach(device_t parent, device_t sel | |||
195 | un->un_ed[USBNET_ENDPT_RX] = ed->bEndpointAddress; | 195 | un->un_ed[USBNET_ENDPT_RX] = ed->bEndpointAddress; | |
196 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 196 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
197 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 197 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
198 | un->un_ed[USBNET_ENDPT_TX] = ed->bEndpointAddress; | 198 | un->un_ed[USBNET_ENDPT_TX] = ed->bEndpointAddress; | |
199 | } | 199 | } | |
200 | } | 200 | } | |
201 | 201 | |||
202 | if (un->un_ed[USBNET_ENDPT_RX] == 0 || un->un_ed[USBNET_ENDPT_TX] == 0 /*|| | 202 | if (un->un_ed[USBNET_ENDPT_RX] == 0 || un->un_ed[USBNET_ENDPT_TX] == 0 /*|| | |
203 | un->un_ed[USBNET_ENDPT_INTR] == 0*/) { | 203 | un->un_ed[USBNET_ENDPT_INTR] == 0*/) { | |
204 | aprint_error_dev(self, "missing endpoint\n"); | 204 | aprint_error_dev(self, "missing endpoint\n"); | |
205 | return; | 205 | return; | |
206 | } | 206 | } | |
207 | 207 | |||
208 | usbnet_attach(un, "upldet"); | 208 | usbnet_attach(un); | |
209 | 209 | |||
210 | /* Initialize interface info.*/ | 210 | /* Initialize interface info.*/ | |
211 | struct ifnet *ifp = usbnet_ifp(un); | 211 | struct ifnet *ifp = usbnet_ifp(un); | |
212 | ifp->if_mtu = UPL_BUFSZ; | 212 | ifp->if_mtu = UPL_BUFSZ; | |
213 | ifp->if_type = IFT_OTHER; | 213 | ifp->if_type = IFT_OTHER; | |
214 | ifp->if_addrlen = 0; | 214 | ifp->if_addrlen = 0; | |
215 | ifp->if_hdrlen = 0; | 215 | ifp->if_hdrlen = 0; | |
216 | ifp->if_output = upl_output; | 216 | ifp->if_output = upl_output; | |
217 | ifp->_if_input = upl_input; | 217 | ifp->_if_input = upl_input; | |
218 | ifp->if_baudrate = 12000000; | 218 | ifp->if_baudrate = 12000000; | |
219 | ifp->if_dlt = DLT_RAW; | 219 | ifp->if_dlt = DLT_RAW; | |
220 | 220 | |||
221 | usbnet_attach_ifp(un, IFF_POINTOPOINT | IFF_NOARP | IFF_SIMPLEX, | 221 | usbnet_attach_ifp(un, IFF_POINTOPOINT | IFF_NOARP | IFF_SIMPLEX, |
--- src/sys/dev/usb/if_ure.c 2022/03/03 05:56:09 1.55
+++ src/sys/dev/usb/if_ure.c 2022/03/03 05:56:28 1.56
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_ure.c,v 1.55 2022/03/03 05:56:09 riastradh Exp $ */ | 1 | /* $NetBSD: if_ure.c,v 1.56 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | /* $OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $ */ | 2 | /* $OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $ */ | |
3 | 3 | |||
4 | /*- | 4 | /*- | |
5 | * Copyright (c) 2015-2016 Kevin Lo <kevlo@FreeBSD.org> | 5 | * Copyright (c) 2015-2016 Kevin Lo <kevlo@FreeBSD.org> | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
27 | * SUCH DAMAGE. | 27 | * SUCH DAMAGE. | |
28 | */ | 28 | */ | |
29 | 29 | |||
30 | /* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */ | 30 | /* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.55 2022/03/03 05:56:09 riastradh Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.56 2022/03/03 05:56:28 riastradh Exp $"); | |
34 | 34 | |||
35 | #ifdef _KERNEL_OPT | 35 | #ifdef _KERNEL_OPT | |
36 | #include "opt_usb.h" | 36 | #include "opt_usb.h" | |
37 | #include "opt_inet.h" | 37 | #include "opt_inet.h" | |
38 | #endif | 38 | #endif | |
39 | 39 | |||
40 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
41 | #include <sys/cprng.h> | 41 | #include <sys/cprng.h> | |
42 | 42 | |||
43 | #include <net/route.h> | 43 | #include <net/route.h> | |
44 | 44 | |||
45 | #include <dev/usb/usbnet.h> | 45 | #include <dev/usb/usbnet.h> | |
46 | 46 | |||
@@ -845,27 +845,27 @@ ure_attach(device_t parent, device_t sel | @@ -845,27 +845,27 @@ ure_attach(device_t parent, device_t sel | |||
845 | aprint_error_dev(self, "couldn't get ep %d\n", i); | 845 | aprint_error_dev(self, "couldn't get ep %d\n", i); | |
846 | return; /* XXX */ | 846 | return; /* XXX */ | |
847 | } | 847 | } | |
848 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 848 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
849 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 849 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
850 | un->un_ed[USBNET_ENDPT_RX] = ed->bEndpointAddress; | 850 | un->un_ed[USBNET_ENDPT_RX] = ed->bEndpointAddress; | |
851 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 851 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
852 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 852 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
853 | un->un_ed[USBNET_ENDPT_TX] = ed->bEndpointAddress; | 853 | un->un_ed[USBNET_ENDPT_TX] = ed->bEndpointAddress; | |
854 | } | 854 | } | |
855 | } | 855 | } | |
856 | 856 | |||
857 | /* Set these up now for ure_ctl(). */ | 857 | /* Set these up now for ure_ctl(). */ | |
858 | usbnet_attach(un, "uredet"); | 858 | usbnet_attach(un); | |
859 | 859 | |||
860 | un->un_phyno = 0; | 860 | un->un_phyno = 0; | |
861 | 861 | |||
862 | ver = ure_read_2(un, URE_PLA_TCR1, URE_MCU_TYPE_PLA) & URE_VERSION_MASK; | 862 | ver = ure_read_2(un, URE_PLA_TCR1, URE_MCU_TYPE_PLA) & URE_VERSION_MASK; | |
863 | switch (ver) { | 863 | switch (ver) { | |
864 | case 0x4c00: | 864 | case 0x4c00: | |
865 | un->un_flags |= URE_FLAG_VER_4C00; | 865 | un->un_flags |= URE_FLAG_VER_4C00; | |
866 | break; | 866 | break; | |
867 | case 0x4c10: | 867 | case 0x4c10: | |
868 | un->un_flags |= URE_FLAG_VER_4C10; | 868 | un->un_flags |= URE_FLAG_VER_4C10; | |
869 | break; | 869 | break; | |
870 | case 0x5c00: | 870 | case 0x5c00: | |
871 | un->un_flags |= URE_FLAG_VER_5C00; | 871 | un->un_flags |= URE_FLAG_VER_5C00; |
--- src/sys/dev/usb/if_url.c 2022/03/03 05:56:09 1.95
+++ src/sys/dev/usb/if_url.c 2022/03/03 05:56:28 1.96
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_url.c,v 1.95 2022/03/03 05:56:09 riastradh Exp $ */ | 1 | /* $NetBSD: if_url.c,v 1.96 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2001, 2002 | 4 | * Copyright (c) 2001, 2002 | |
5 | * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. | 5 | * Shingo WATANABE <nabe@nabechan.org>. 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. | |
@@ -34,27 +34,27 @@ | @@ -34,27 +34,27 @@ | |||
34 | * The RTL8150L(Realtek USB to fast ethernet controller) spec can be found at | 34 | * The RTL8150L(Realtek USB to fast ethernet controller) spec can be found at | |
35 | * ftp://ftp.realtek.com.tw/lancard/data_sheet/8150/8150v14.pdf | 35 | * ftp://ftp.realtek.com.tw/lancard/data_sheet/8150/8150v14.pdf | |
36 | * ftp://152.104.125.40/lancard/data_sheet/8150/8150v14.pdf | 36 | * ftp://152.104.125.40/lancard/data_sheet/8150/8150v14.pdf | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | /* | 39 | /* | |
40 | * TODO: | 40 | * TODO: | |
41 | * Interrupt Endpoint support | 41 | * Interrupt Endpoint support | |
42 | * External PHYs | 42 | * External PHYs | |
43 | * powerhook() support? | 43 | * powerhook() support? | |
44 | */ | 44 | */ | |
45 | 45 | |||
46 | #include <sys/cdefs.h> | 46 | #include <sys/cdefs.h> | |
47 | __KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.95 2022/03/03 05:56:09 riastradh Exp $"); | 47 | __KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.96 2022/03/03 05:56:28 riastradh Exp $"); | |
48 | 48 | |||
49 | #ifdef _KERNEL_OPT | 49 | #ifdef _KERNEL_OPT | |
50 | #include "opt_inet.h" | 50 | #include "opt_inet.h" | |
51 | #include "opt_usb.h" | 51 | #include "opt_usb.h" | |
52 | #endif | 52 | #endif | |
53 | 53 | |||
54 | #include <sys/param.h> | 54 | #include <sys/param.h> | |
55 | 55 | |||
56 | #include <net/if_ether.h> | 56 | #include <net/if_ether.h> | |
57 | #ifdef INET | 57 | #ifdef INET | |
58 | #include <netinet/in.h> | 58 | #include <netinet/in.h> | |
59 | #include <netinet/if_inarp.h> | 59 | #include <netinet/if_inarp.h> | |
60 | #endif | 60 | #endif | |
@@ -230,27 +230,27 @@ url_attach(device_t parent, device_t sel | @@ -230,27 +230,27 @@ url_attach(device_t parent, device_t sel | |||
230 | else if ((ed->bmAttributes & UE_XFERTYPE) == UE_INTERRUPT && | 230 | else if ((ed->bmAttributes & UE_XFERTYPE) == UE_INTERRUPT && | |
231 | UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN) | 231 | UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN) | |
232 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | 232 | un->un_ed[USBNET_ENDPT_INTR] = ed->bEndpointAddress; | |
233 | } | 233 | } | |
234 | 234 | |||
235 | if (un->un_ed[USBNET_ENDPT_RX] == 0 || | 235 | if (un->un_ed[USBNET_ENDPT_RX] == 0 || | |
236 | un->un_ed[USBNET_ENDPT_TX] == 0 || | 236 | un->un_ed[USBNET_ENDPT_TX] == 0 || | |
237 | un->un_ed[USBNET_ENDPT_INTR] == 0) { | 237 | un->un_ed[USBNET_ENDPT_INTR] == 0) { | |
238 | aprint_error_dev(self, "missing endpoint\n"); | 238 | aprint_error_dev(self, "missing endpoint\n"); | |
239 | return; | 239 | return; | |
240 | } | 240 | } | |
241 | 241 | |||
242 | /* Set these up now for url_mem(). */ | 242 | /* Set these up now for url_mem(). */ | |
243 | usbnet_attach(un, "urldet"); | 243 | usbnet_attach(un); | |
244 | 244 | |||
245 | /* reset the adapter */ | 245 | /* reset the adapter */ | |
246 | url_reset(un); | 246 | url_reset(un); | |
247 | 247 | |||
248 | /* Get Ethernet Address */ | 248 | /* Get Ethernet Address */ | |
249 | err = url_mem(un, URL_CMD_READMEM, URL_IDR0, (void *)un->un_eaddr, | 249 | err = url_mem(un, URL_CMD_READMEM, URL_IDR0, (void *)un->un_eaddr, | |
250 | ETHER_ADDR_LEN); | 250 | ETHER_ADDR_LEN); | |
251 | if (err) { | 251 | if (err) { | |
252 | aprint_error_dev(self, "read MAC address failed\n"); | 252 | aprint_error_dev(self, "read MAC address failed\n"); | |
253 | return; | 253 | return; | |
254 | } | 254 | } | |
255 | 255 | |||
256 | /* initialize interface information */ | 256 | /* initialize interface information */ |
--- src/sys/dev/usb/if_urndis.c 2022/03/03 05:56:09 1.45
+++ src/sys/dev/usb/if_urndis.c 2022/03/03 05:56:28 1.46
@@ -1,37 +1,37 @@ | @@ -1,37 +1,37 @@ | |||
1 | /* $NetBSD: if_urndis.c,v 1.45 2022/03/03 05:56:09 riastradh Exp $ */ | 1 | /* $NetBSD: if_urndis.c,v 1.46 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | /* $OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */ | 2 | /* $OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2010 Jonathan Armani <armani@openbsd.org> | 5 | * Copyright (c) 2010 Jonathan Armani <armani@openbsd.org> | |
6 | * Copyright (c) 2010 Fabien Romano <fabien@openbsd.org> | 6 | * Copyright (c) 2010 Fabien Romano <fabien@openbsd.org> | |
7 | * Copyright (c) 2010 Michael Knudsen <mk@openbsd.org> | 7 | * Copyright (c) 2010 Michael Knudsen <mk@openbsd.org> | |
8 | * All rights reserved. | 8 | * All rights reserved. | |
9 | * | 9 | * | |
10 | * Permission to use, copy, modify, and distribute this software for any | 10 | * Permission to use, copy, modify, and distribute this software for any | |
11 | * purpose with or without fee is hereby granted, provided that the above | 11 | * purpose with or without fee is hereby granted, provided that the above | |
12 | * copyright notice and this permission notice appear in all copies. | 12 | * copyright notice and this permission notice appear in all copies. | |
13 | * | 13 | * | |
14 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 14 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
15 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 15 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
16 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 16 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
17 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 17 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
18 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 18 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
19 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 19 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
20 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 20 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
21 | */ | 21 | */ | |
22 | 22 | |||
23 | #include <sys/cdefs.h> | 23 | #include <sys/cdefs.h> | |
24 | __KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.45 2022/03/03 05:56:09 riastradh Exp $"); | 24 | __KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.46 2022/03/03 05:56:28 riastradh Exp $"); | |
25 | 25 | |||
26 | #ifdef _KERNEL_OPT | 26 | #ifdef _KERNEL_OPT | |
27 | #include "opt_usb.h" | 27 | #include "opt_usb.h" | |
28 | #endif | 28 | #endif | |
29 | 29 | |||
30 | #include <sys/param.h> | 30 | #include <sys/param.h> | |
31 | #include <sys/kmem.h> | 31 | #include <sys/kmem.h> | |
32 | 32 | |||
33 | #include <dev/usb/usbnet.h> | 33 | #include <dev/usb/usbnet.h> | |
34 | #include <dev/usb/usbdevs.h> | 34 | #include <dev/usb/usbdevs.h> | |
35 | #include <dev/usb/usbcdc.h> | 35 | #include <dev/usb/usbcdc.h> | |
36 | 36 | |||
37 | #include <dev/ic/rndisreg.h> | 37 | #include <dev/ic/rndisreg.h> | |
@@ -1032,27 +1032,27 @@ urndis_attach(device_t parent, device_t | @@ -1032,27 +1032,27 @@ urndis_attach(device_t parent, device_t | |||
1032 | } | 1032 | } | |
1033 | 1033 | |||
1034 | if (un->un_ed[USBNET_ENDPT_RX] == 0) | 1034 | if (un->un_ed[USBNET_ENDPT_RX] == 0) | |
1035 | aprint_error("%s: could not find data bulk in\n", DEVNAME(un)); | 1035 | aprint_error("%s: could not find data bulk in\n", DEVNAME(un)); | |
1036 | if (un->un_ed[USBNET_ENDPT_TX] == 0) | 1036 | if (un->un_ed[USBNET_ENDPT_TX] == 0) | |
1037 | aprint_error("%s: could not find data bulk out\n",DEVNAME(un)); | 1037 | aprint_error("%s: could not find data bulk out\n",DEVNAME(un)); | |
1038 | if (un->un_ed[USBNET_ENDPT_RX] == 0 || un->un_ed[USBNET_ENDPT_TX] == 0) | 1038 | if (un->un_ed[USBNET_ENDPT_RX] == 0 || un->un_ed[USBNET_ENDPT_TX] == 0) | |
1039 | return; | 1039 | return; | |
1040 | 1040 | |||
1041 | #if 0 | 1041 | #if 0 | |
1042 | ifp->if_watchdog = urndis_watchdog; | 1042 | ifp->if_watchdog = urndis_watchdog; | |
1043 | #endif | 1043 | #endif | |
1044 | 1044 | |||
1045 | usbnet_attach(un, "urndisdet"); | 1045 | usbnet_attach(un); | |
1046 | 1046 | |||
1047 | struct ifnet *ifp = usbnet_ifp(un); | 1047 | struct ifnet *ifp = usbnet_ifp(un); | |
1048 | urndis_init_un(ifp, un); | 1048 | urndis_init_un(ifp, un); | |
1049 | 1049 | |||
1050 | if (urndis_ctrl_query(un, OID_802_3_PERMANENT_ADDRESS, NULL, 0, | 1050 | if (urndis_ctrl_query(un, OID_802_3_PERMANENT_ADDRESS, NULL, 0, | |
1051 | &buf, &bufsz) != RNDIS_STATUS_SUCCESS) { | 1051 | &buf, &bufsz) != RNDIS_STATUS_SUCCESS) { | |
1052 | aprint_error("%s: unable to get hardware address\n", | 1052 | aprint_error("%s: unable to get hardware address\n", | |
1053 | DEVNAME(un)); | 1053 | DEVNAME(un)); | |
1054 | return; | 1054 | return; | |
1055 | } | 1055 | } | |
1056 | 1056 | |||
1057 | if (bufsz == ETHER_ADDR_LEN) { | 1057 | if (bufsz == ETHER_ADDR_LEN) { | |
1058 | memcpy(un->un_eaddr, buf, ETHER_ADDR_LEN); | 1058 | memcpy(un->un_eaddr, buf, ETHER_ADDR_LEN); |
--- src/sys/dev/usb/usbnet.c 2022/03/03 05:56:18 1.89
+++ src/sys/dev/usb/usbnet.c 2022/03/03 05:56:28 1.90
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: usbnet.c,v 1.89 2022/03/03 05:56:18 riastradh Exp $ */ | 1 | /* $NetBSD: usbnet.c,v 1.90 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2019 Matthew R. Green | 4 | * Copyright (c) 2019 Matthew R. Green | |
5 | * All rights reserved. | 5 | * 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. | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
26 | * SUCH DAMAGE. | 26 | * SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | /* | 29 | /* | |
30 | * Common code shared between USB network drivers. | 30 | * Common code shared between USB network drivers. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.89 2022/03/03 05:56:18 riastradh Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.90 2022/03/03 05:56:28 riastradh Exp $"); | |
35 | 35 | |||
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/kernel.h> | 37 | #include <sys/kernel.h> | |
38 | #include <sys/kmem.h> | 38 | #include <sys/kmem.h> | |
39 | #include <sys/module.h> | 39 | #include <sys/module.h> | |
40 | #include <sys/atomic.h> | 40 | #include <sys/atomic.h> | |
41 | 41 | |||
42 | #include <dev/usb/usbnet.h> | 42 | #include <dev/usb/usbnet.h> | |
43 | #include <dev/usb/usbhist.h> | 43 | #include <dev/usb/usbhist.h> | |
44 | 44 | |||
45 | struct usbnet_cdata { | 45 | struct usbnet_cdata { | |
46 | struct usbnet_chain *uncd_tx_chain; | 46 | struct usbnet_chain *uncd_tx_chain; | |
47 | struct usbnet_chain *uncd_rx_chain; | 47 | struct usbnet_chain *uncd_rx_chain; | |
@@ -1380,28 +1380,27 @@ usbnet_empty_eaddr(struct usbnet * const | @@ -1380,28 +1380,27 @@ usbnet_empty_eaddr(struct usbnet * const | |||
1380 | * usbnet_attach() and usbnet_attach_ifp() perform setup of the relevant | 1380 | * usbnet_attach() and usbnet_attach_ifp() perform setup of the relevant | |
1381 | * 'usbnet'. The first is enough to enable device access (eg, endpoints | 1381 | * 'usbnet'. The first is enough to enable device access (eg, endpoints | |
1382 | * are connected and commands can be sent), and the second connects the | 1382 | * are connected and commands can be sent), and the second connects the | |
1383 | * device to the system networking. | 1383 | * device to the system networking. | |
1384 | * | 1384 | * | |
1385 | * Always call usbnet_detach(), even if usbnet_attach_ifp() is skippped. | 1385 | * Always call usbnet_detach(), even if usbnet_attach_ifp() is skippped. | |
1386 | * Also usable as driver detach directly. | 1386 | * Also usable as driver detach directly. | |
1387 | * | 1387 | * | |
1388 | * To skip ethernet configuration (eg, point-to-point), make sure that | 1388 | * To skip ethernet configuration (eg, point-to-point), make sure that | |
1389 | * the un_eaddr[] is fully zero. | 1389 | * the un_eaddr[] is fully zero. | |
1390 | */ | 1390 | */ | |
1391 | 1391 | |||
1392 | void | 1392 | void | |
1393 | usbnet_attach(struct usbnet *un, | 1393 | usbnet_attach(struct usbnet *un) | |
1394 | const char *detname) /* detach cv name */ | |||
1395 | { | 1394 | { | |
1396 | USBNETHIST_FUNC(); USBNETHIST_CALLED(); | 1395 | USBNETHIST_FUNC(); USBNETHIST_CALLED(); | |
1397 | 1396 | |||
1398 | /* Required inputs. */ | 1397 | /* Required inputs. */ | |
1399 | KASSERT(un->un_ops->uno_tx_prepare); | 1398 | KASSERT(un->un_ops->uno_tx_prepare); | |
1400 | KASSERT(un->un_ops->uno_rx_loop); | 1399 | KASSERT(un->un_ops->uno_rx_loop); | |
1401 | KASSERT(un->un_ops->uno_init); | 1400 | KASSERT(un->un_ops->uno_init); | |
1402 | KASSERT(un->un_rx_bufsz); | 1401 | KASSERT(un->un_rx_bufsz); | |
1403 | KASSERT(un->un_tx_bufsz); | 1402 | KASSERT(un->un_tx_bufsz); | |
1404 | KASSERT(un->un_rx_list_cnt); | 1403 | KASSERT(un->un_rx_list_cnt); | |
1405 | KASSERT(un->un_tx_list_cnt); | 1404 | KASSERT(un->un_tx_list_cnt); | |
1406 | 1405 | |||
1407 | /* Unfortunate fact. */ | 1406 | /* Unfortunate fact. */ |
--- src/sys/dev/usb/usbnet.h 2022/03/03 05:56:09 1.30
+++ src/sys/dev/usb/usbnet.h 2022/03/03 05:56:28 1.31
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: usbnet.h,v 1.30 2022/03/03 05:56:09 riastradh Exp $ */ | 1 | /* $NetBSD: usbnet.h,v 1.31 2022/03/03 05:56:28 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2019 Matthew R. Green | 4 | * Copyright (c) 2019 Matthew R. Green | |
5 | * All rights reserved. | 5 | * 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. | |
@@ -305,27 +305,27 @@ bool usbnet_isdying(struct usbnet *); | @@ -305,27 +305,27 @@ bool usbnet_isdying(struct usbnet *); | |||
305 | * usbnet_stop() stops pipes, cleans (not frees) rx/tx chains, locked | 305 | * usbnet_stop() stops pipes, cleans (not frees) rx/tx chains, locked | |
306 | * version assumes un_lock is held | 306 | * version assumes un_lock is held | |
307 | * usbnet_detach() frees the rx/tx chains | 307 | * usbnet_detach() frees the rx/tx chains | |
308 | * | 308 | * | |
309 | * Setup un_ed[] with valid end points before calling usbnet_attach(). | 309 | * Setup un_ed[] with valid end points before calling usbnet_attach(). | |
310 | */ | 310 | */ | |
311 | 311 | |||
312 | /* interrupt handling */ | 312 | /* interrupt handling */ | |
313 | void usbnet_enqueue(struct usbnet * const, uint8_t *, size_t, int, | 313 | void usbnet_enqueue(struct usbnet * const, uint8_t *, size_t, int, | |
314 | uint32_t, int); | 314 | uint32_t, int); | |
315 | void usbnet_input(struct usbnet * const, uint8_t *, size_t); | 315 | void usbnet_input(struct usbnet * const, uint8_t *, size_t); | |
316 | 316 | |||
317 | /* autoconf */ | 317 | /* autoconf */ | |
318 | void usbnet_attach(struct usbnet *un, const char *); | 318 | void usbnet_attach(struct usbnet *); | |
319 | void usbnet_attach_ifp(struct usbnet *, unsigned, unsigned, | 319 | void usbnet_attach_ifp(struct usbnet *, unsigned, unsigned, | |
320 | const struct usbnet_mii *); | 320 | const struct usbnet_mii *); | |
321 | int usbnet_detach(device_t, int); | 321 | int usbnet_detach(device_t, int); | |
322 | int usbnet_activate(device_t, devact_t); | 322 | int usbnet_activate(device_t, devact_t); | |
323 | 323 | |||
324 | /* module hook up */ | 324 | /* module hook up */ | |
325 | 325 | |||
326 | #ifdef _MODULE | 326 | #ifdef _MODULE | |
327 | #define USBNET_INIT(name) \ | 327 | #define USBNET_INIT(name) \ | |
328 | error = config_init_component(cfdriver_ioconf_##name, \ | 328 | error = config_init_component(cfdriver_ioconf_##name, \ | |
329 | cfattach_ioconf_##name, cfdata_ioconf_##name); | 329 | cfattach_ioconf_##name, cfdata_ioconf_##name); | |
330 | #define USBNET_FINI(name) \ | 330 | #define USBNET_FINI(name) \ | |
331 | error = config_fini_component(cfdriver_ioconf_##name, \ | 331 | error = config_fini_component(cfdriver_ioconf_##name, \ |