if_fe_pccard.c (179959) | if_fe_pccard.c (189681) |
---|---|
1/*- 2 * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 3 * 4 * This software may be used, modified, copied, distributed, and sold, in 5 * both source and binary form provided that the above copyright, these 6 * terms and the following disclaimer are retained. The name of the author 7 * and/or the contributor may not be used to endorse or promote products 8 * derived from this software without specific prior written permission. --- 8 unchanged lines hidden (view full) --- 17 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 18 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 19 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 20 * SUCH DAMAGE. 21 * 22 */ 23 24#include <sys/cdefs.h> | 1/*- 2 * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 3 * 4 * This software may be used, modified, copied, distributed, and sold, in 5 * both source and binary form provided that the above copyright, these 6 * terms and the following disclaimer are retained. The name of the author 7 * and/or the contributor may not be used to endorse or promote products 8 * derived from this software without specific prior written permission. --- 8 unchanged lines hidden (view full) --- 17 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 18 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 19 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 20 * SUCH DAMAGE. 21 * 22 */ 23 24#include <sys/cdefs.h> |
25__FBSDID("$FreeBSD: head/sys/dev/fe/if_fe_pccard.c 179959 2008-06-23 18:16:25Z jhb $"); | 25__FBSDID("$FreeBSD: head/sys/dev/fe/if_fe_pccard.c 189681 2009-03-11 08:12:28Z imp $"); |
26 27#include <sys/param.h> 28#include <sys/kernel.h> 29#include <sys/socket.h> 30#include <sys/systm.h> 31#include <sys/module.h> 32 33#include <sys/bus.h> --- 25 unchanged lines hidden (view full) --- 59static int fe_pccard_attach(device_t); 60static int fe_pccard_detach(device_t); 61 62static const struct fe_pccard_product { 63 struct pccard_product mpp_product; 64 int mpp_flags; 65#define MPP_MBH10302 1 66#define MPP_ANYFUNC 2 | 26 27#include <sys/param.h> 28#include <sys/kernel.h> 29#include <sys/socket.h> 30#include <sys/systm.h> 31#include <sys/module.h> 32 33#include <sys/bus.h> --- 25 unchanged lines hidden (view full) --- 59static int fe_pccard_attach(device_t); 60static int fe_pccard_detach(device_t); 61 62static const struct fe_pccard_product { 63 struct pccard_product mpp_product; 64 int mpp_flags; 65#define MPP_MBH10302 1 66#define MPP_ANYFUNC 2 |
67#define MPP_SKIP_TO_CFE_10 4 |
|
67} fe_pccard_products[] = { 68 /* These need to be first */ 69 { PCMCIA_CARD(FUJITSU2, FMV_J181), MPP_MBH10302 }, 70 { PCMCIA_CARD(FUJITSU2, FMV_J182), 0 }, 71 { PCMCIA_CARD(FUJITSU2, FMV_J182A), 0 }, 72 { PCMCIA_CARD(FUJITSU2, ITCFJ182A), 0 }, 73 /* These need to be second */ 74 { PCMCIA_CARD(TDK, LAK_CD021BX), 0 }, 75 { PCMCIA_CARD(TDK, LAK_CF010), 0 }, 76#if 0 /* XXX 86960-based? */ 77 { PCMCIA_CARD(TDK, LAK_DFL9610), 0 }, 78#endif 79 { PCMCIA_CARD(CONTEC, CNETPC), 0 }, 80 { PCMCIA_CARD(FUJITSU, LA501), 0 }, 81 { PCMCIA_CARD(FUJITSU, LA10S), 0 }, 82 { PCMCIA_CARD(FUJITSU, NE200T), MPP_MBH10302 },/* Sold by Eagle */ | 68} fe_pccard_products[] = { 69 /* These need to be first */ 70 { PCMCIA_CARD(FUJITSU2, FMV_J181), MPP_MBH10302 }, 71 { PCMCIA_CARD(FUJITSU2, FMV_J182), 0 }, 72 { PCMCIA_CARD(FUJITSU2, FMV_J182A), 0 }, 73 { PCMCIA_CARD(FUJITSU2, ITCFJ182A), 0 }, 74 /* These need to be second */ 75 { PCMCIA_CARD(TDK, LAK_CD021BX), 0 }, 76 { PCMCIA_CARD(TDK, LAK_CF010), 0 }, 77#if 0 /* XXX 86960-based? */ 78 { PCMCIA_CARD(TDK, LAK_DFL9610), 0 }, 79#endif 80 { PCMCIA_CARD(CONTEC, CNETPC), 0 }, 81 { PCMCIA_CARD(FUJITSU, LA501), 0 }, 82 { PCMCIA_CARD(FUJITSU, LA10S), 0 }, 83 { PCMCIA_CARD(FUJITSU, NE200T), MPP_MBH10302 },/* Sold by Eagle */ |
84 { PCMCIA_CARD(HITACHI, HT_4840), MPP_MBH10302 | MPP_SKIP_TO_CFE_10}, |
|
83 { PCMCIA_CARD(RATOC, REX_R280), 0 }, 84 { PCMCIA_CARD(XIRCOM, CE), MPP_ANYFUNC }, 85 { { NULL } } 86}; 87 88static int 89fe_pccard_probe(device_t dev) 90{ 91 int error; 92 uint32_t fcn = PCCARD_FUNCTION_UNSPEC; 93 const struct fe_pccard_product *pp; | 85 { PCMCIA_CARD(RATOC, REX_R280), 0 }, 86 { PCMCIA_CARD(XIRCOM, CE), MPP_ANYFUNC }, 87 { { NULL } } 88}; 89 90static int 91fe_pccard_probe(device_t dev) 92{ 93 int error; 94 uint32_t fcn = PCCARD_FUNCTION_UNSPEC; 95 const struct fe_pccard_product *pp; |
96 int i; |
|
94 95 if ((pp = (const struct fe_pccard_product *)pccard_product_lookup(dev, 96 (const struct pccard_product *)fe_pccard_products, 97 sizeof(fe_pccard_products[0]), NULL)) != NULL) { 98 if (pp->mpp_product.pp_name != NULL) 99 device_set_desc(dev, pp->mpp_product.pp_name); 100 if (pp->mpp_flags & MPP_ANYFUNC) 101 return (0); 102 /* Make sure we're a network function */ 103 error = pccard_get_function(dev, &fcn); 104 if (error != 0) 105 return (error); 106 if (fcn != PCCARD_FUNCTION_NETWORK) 107 return (ENXIO); | 97 98 if ((pp = (const struct fe_pccard_product *)pccard_product_lookup(dev, 99 (const struct pccard_product *)fe_pccard_products, 100 sizeof(fe_pccard_products[0]), NULL)) != NULL) { 101 if (pp->mpp_product.pp_name != NULL) 102 device_set_desc(dev, pp->mpp_product.pp_name); 103 if (pp->mpp_flags & MPP_ANYFUNC) 104 return (0); 105 /* Make sure we're a network function */ 106 error = pccard_get_function(dev, &fcn); 107 if (error != 0) 108 return (error); 109 if (fcn != PCCARD_FUNCTION_NETWORK) 110 return (ENXIO); |
111 if (pp->mpp_flags & MPP_SKIP_TO_CFE_10) { 112 for (i = 10; i < 27; i++) { 113 if (pccard_select_cfe(dev, i) == 0) 114 goto good; 115 } 116 device_printf(dev, 117 "Hitachi HT-4840-11 workaround failed\n"); 118 return ENXIO; 119 } 120 good:; |
|
108 return (0); 109 } 110 return (ENXIO); 111} 112 113static device_method_t fe_pccard_methods[] = { 114 /* Device interface */ 115 DEVMETHOD(device_probe, fe_pccard_probe), --- 5 unchanged lines hidden (view full) --- 121 122static driver_t fe_pccard_driver = { 123 "fe", 124 fe_pccard_methods, 125 sizeof (struct fe_softc) 126}; 127 128DRIVER_MODULE(fe, pccard, fe_pccard_driver, fe_devclass, 0, 0); | 121 return (0); 122 } 123 return (ENXIO); 124} 125 126static device_method_t fe_pccard_methods[] = { 127 /* Device interface */ 128 DEVMETHOD(device_probe, fe_pccard_probe), --- 5 unchanged lines hidden (view full) --- 134 135static driver_t fe_pccard_driver = { 136 "fe", 137 fe_pccard_methods, 138 sizeof (struct fe_softc) 139}; 140 141DRIVER_MODULE(fe, pccard, fe_pccard_driver, fe_devclass, 0, 0); |
142MODULE_DEPEND(fe, pccard, 1, 1, 1); |
|
129 130static int fe_probe_mbh(device_t, const struct fe_pccard_product *); 131static int fe_probe_tdk(device_t, const struct fe_pccard_product *); 132/* 133 * Initialize the device - called from Slot manager. 134 */ 135static int 136fe_pccard_attach(device_t dev) --- 207 unchanged lines hidden --- | 143 144static int fe_probe_mbh(device_t, const struct fe_pccard_product *); 145static int fe_probe_tdk(device_t, const struct fe_pccard_product *); 146/* 147 * Initialize the device - called from Slot manager. 148 */ 149static int 150fe_pccard_attach(device_t dev) --- 207 unchanged lines hidden --- |