1 /* $NetBSD: if_ne_pcmcia.c,v 1.122 2004/07/09 03:41:23 enami Exp $ */ 2 3 /* 4 * Copyright (c) 1997 Marc Horowitz. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. All advertising materials mentioning features or use of this software 15 * must display the following acknowledgement: 16 * This product includes software developed by Marc Horowitz. 17 * 4. The name of the author may not be used to endorse or promote products 18 * derived from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32 #include <sys/cdefs.h> 33 __KERNEL_RCSID(0, "$NetBSD: if_ne_pcmcia.c,v 1.122 2004/07/09 03:41:23 enami Exp $"); 34 35 #include <sys/param.h> 36 #include <sys/systm.h> 37 #include <sys/select.h> 38 #include <sys/device.h> 39 #include <sys/socket.h> 40 41 #include <net/if_types.h> 42 #include <net/if.h> 43 #include <net/if_media.h> 44 #include <net/if_ether.h> 45 46 #include <machine/bus.h> 47 #include <machine/intr.h> 48 49 #include <dev/pcmcia/pcmciareg.h> 50 #include <dev/pcmcia/pcmciavar.h> 51 #include <dev/pcmcia/pcmciadevs.h> 52 53 #include <dev/ic/dp8390reg.h> 54 #include <dev/ic/dp8390var.h> 55 56 #include <dev/ic/ne2000reg.h> 57 #include <dev/ic/ne2000var.h> 58 59 #include <dev/ic/rtl80x9reg.h> 60 #include <dev/ic/rtl80x9var.h> 61 62 #include <dev/ic/dl10019var.h> 63 64 #include <dev/ic/ax88190reg.h> 65 #include <dev/ic/ax88190var.h> 66 67 int ne_pcmcia_match __P((struct device *, struct cfdata *, void *)); 68 void ne_pcmcia_attach __P((struct device *, struct device *, void *)); 69 int ne_pcmcia_detach __P((struct device *, int)); 70 71 int ne_pcmcia_enable __P((struct dp8390_softc *)); 72 void ne_pcmcia_disable __P((struct dp8390_softc *)); 73 74 struct ne_pcmcia_softc { 75 struct ne2000_softc sc_ne2000; /* real "ne2000" softc */ 76 77 /* PCMCIA-specific goo */ 78 struct pcmcia_io_handle sc_pcioh; /* PCMCIA i/o information */ 79 int sc_asic_io_window; /* i/o window for ASIC */ 80 int sc_nic_io_window; /* i/o window for NIC */ 81 struct pcmcia_function *sc_pf; /* our PCMCIA function */ 82 void *sc_ih; /* interrupt handle */ 83 }; 84 85 u_int8_t * 86 ne_pcmcia_get_enaddr __P((struct ne_pcmcia_softc *, int, 87 u_int8_t [ETHER_ADDR_LEN])); 88 u_int8_t * 89 ne_pcmcia_dl10019_get_enaddr __P((struct ne_pcmcia_softc *, 90 u_int8_t [ETHER_ADDR_LEN])); 91 int ne_pcmcia_ax88190_set_iobase __P((struct ne_pcmcia_softc *)); 92 93 CFATTACH_DECL(ne_pcmcia, sizeof(struct ne_pcmcia_softc), 94 ne_pcmcia_match, ne_pcmcia_attach, ne_pcmcia_detach, dp8390_activate); 95 96 static const struct ne2000dev { 97 int32_t manufacturer; 98 int32_t product; 99 char *cis_info[4]; 100 int function; 101 int enet_maddr; 102 unsigned char enet_vendor[3]; 103 int flags; 104 #define NE2000DVF_DL10019 0x0001 /* chip is D-Link DL10019 */ 105 #define NE2000DVF_AX88190 0x0002 /* chip is ASIX AX88190 */ 106 #define NE2000DVF_AX88790 0x0004 /* chip is ASIX AX88790 */ 107 } ne2000devs[] = { 108 { PCMCIA_VENDOR_EDIMAX, PCMCIA_PRODUCT_EDIMAX_EP4000A, 109 PCMCIA_CIS_EDIMAX_EP4000A, 110 0, -1, { 0x00, 0xa0, 0x0c } }, 111 112 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 113 PCMCIA_CIS_SYNERGY21_S21810, 114 0, -1, { 0x00, 0x48, 0x54 } }, 115 116 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 117 PCMCIA_CIS_AMBICOM_AMB8002T, 118 0, -1, { 0x00, 0x10, 0x7a } }, 119 120 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 121 PCMCIA_CIS_AMBICOM_AMB8110, 122 0, -1, { 0x00, 0x10, 0x7a }, NE2000DVF_AX88190 }, 123 124 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 125 PCMCIA_CIS_PREMAX_PE200, 126 0, 0x07f0, { 0x00, 0x20, 0xe0 } }, 127 128 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 129 PCMCIA_CIS_PREMAX_PE200, 130 0, -1, { 0x00, 0x20, 0xe0 } }, 131 132 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 133 PCMCIA_CIS_DIGITAL_DEPCMXX, 134 0, 0x0ff0, { 0x00, 0x00, 0xe8 } }, 135 136 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 137 PCMCIA_CIS_PLANET_SMARTCOM2000, 138 0, 0xff0, { 0x00, 0x00, 0xe8 } }, 139 140 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 141 PCMCIA_CIS_DLINK_DE660, 142 0, -1, { 0x00, 0x80, 0xc8 } }, 143 144 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 145 PCMCIA_CIS_DLINK_DE660PLUS, 146 0, -1, { 0x00, 0x80, 0xc8 } }, 147 148 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 149 PCMCIA_CIS_RPTI_EP400, 150 0, 0x110, { 0x00, 0x40, 0x95 } }, 151 152 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 153 PCMCIA_CIS_RPTI_EP401, 154 0, -1, { 0x00, 0x40, 0x95 } }, 155 156 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 157 PCMCIA_CIS_ACCTON_EN2212, 158 0, 0x0ff0, { 0x00, 0x00, 0xe8 } }, 159 160 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 161 PCMCIA_CIS_ACCTON_EN2216, 162 0, -1, { 0x00, 0x00, 0xe8 } }, 163 164 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 165 PCMCIA_CIS_SVEC_COMBOCARD, 166 0, -1, { 0x00, 0xe0, 0x98 } }, 167 168 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 169 PCMCIA_CIS_SVEC_LANCARD, 170 0, 0x7f0, { 0x00, 0xc0, 0x6c } }, 171 172 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_EPSON_EEN10B, 173 PCMCIA_CIS_EPSON_EEN10B, 174 0, 0xff0, { 0x00, 0x00, 0x48 } }, 175 176 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 177 PCMCIA_CIS_TAMARACK_ETHERNET, 178 0, -1, { 0x00, 0x00, 0x00 } }, 179 180 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 181 PCMCIA_CIS_CNET_NE2000, 182 0, -1, { 0x00, 0x80, 0xad } }, 183 184 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 185 PCMCIA_CIS_GENIUS_ME3000II, 186 0, -1, { 0x00, 0x40, 0x95 } }, 187 188 189 { PCMCIA_VENDOR_ZONET, PCMCIA_PRODUCT_ZONET_ZEN, 190 PCMCIA_CIS_ZONET_ZEN, 191 0, -1, { 0x00, 0x00, 0x00 } }, 192 193 /* 194 * You have to add new entries which contains 195 * PCMCIA_VENDOR_INVALID and/or PCMCIA_PRODUCT_INVALID 196 * in front of this comment. 197 * 198 * There are cards which use a generic vendor and product id but needs 199 * a different handling depending on the cis_info, so ne2000_match 200 * needs a table where the exceptions comes first and then the normal 201 * product and vendor entries. 202 */ 203 204 { PCMCIA_VENDOR_IBM, PCMCIA_PRODUCT_IBM_INFOMOVER, 205 PCMCIA_CIS_IBM_INFOMOVER, 206 0, 0x0ff0, { 0xff, 0xff, 0xff } }, 207 208 { PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_ECARD_1, 209 PCMCIA_CIS_LINKSYS_ECARD_1, 210 0, -1, { 0x00, 0x80, 0xc8 } }, 211 212 { PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_COMBO_ECARD, 213 PCMCIA_CIS_PLANEX_FNW3600T, 214 0, -1, { 0x00, 0x90, 0xcc }, NE2000DVF_DL10019 }, 215 216 { PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_COMBO_ECARD, 217 PCMCIA_CIS_SVEC_PN650TX, 218 0, -1, { 0x00, 0xe0, 0x98 }, NE2000DVF_DL10019 }, 219 220 /* 221 * This FNW-3700T entry should be here so that above two cards doesn't 222 * match with this. FNW-3700T won't match above entries due to 223 * MAC address check. 224 */ 225 { PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_COMBO_ECARD, 226 PCMCIA_CIS_PLANEX_FNW3700T, 227 0, -1, { 0x00, 0x90, 0xcc }, NE2000DVF_AX88190 }, 228 229 { PCMCIA_VENDOR_LANTECH, PCMCIA_PRODUCT_LANTECH_FASTNETTX, 230 PCMCIA_CIS_LANTECH_FASTNETTX, 231 0, -1, { 0x00, 0x04, 0x1c }, NE2000DVF_AX88190 }, 232 233 { PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_ETHERFAST, 234 PCMCIA_CIS_LINKSYS_ETHERFAST, 235 0, -1, { 0xff, 0xff, 0xff }, NE2000DVF_DL10019 }, 236 237 /* 238 * There are two entries for the DFE-670TXD because there are 239 * several possible Vendor IDs for the MAC address. Both are 240 * from D-Link, though. 241 * 242 * Oh, wait, there's a third possible vendor code, apparently. 243 * And it's from "ANI Communications" this time... 244 */ 245 { PCMCIA_VENDOR_NETGEAR, PCMCIA_PRODUCT_NETGEAR_FA410TXC, 246 PCMCIA_CIS_DLINK_DFE670TXD, 247 0, -1, { 0xff, 0xff, 0xff }, NE2000DVF_DL10019 }, 248 249 { PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_ETHERFAST, 250 PCMCIA_CIS_MELCO_LPC2_TX, 251 0, -1, { 0x00, 0x40, 0x26 }, NE2000DVF_DL10019 }, 252 253 { PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_COMBO_ECARD, 254 PCMCIA_CIS_LINKSYS_COMBO_ECARD, 255 0, -1, { 0x00, 0x80, 0xc8 } }, 256 257 { PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_TRUST_COMBO_ECARD, 258 PCMCIA_CIS_LINKSYS_TRUST_COMBO_ECARD, 259 0, 0x0120, { 0x20, 0x04, 0x49 } }, 260 261 /* Although the comments above say to put VENDOR/PRODUCT INVALID IDs 262 above this list, we need to keep this one below the ECARD_1, or else 263 both will match the same more-generic entry rather than the more 264 specific one above with proper vendor and product IDs. */ 265 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 266 PCMCIA_CIS_LINKSYS_ECARD_2, 267 0, -1, { 0x00, 0x80, 0xc8 } }, 268 269 /* 270 * D-Link DE-650 has many minor versions: 271 * 272 * CIS information Manufacturer Product Note 273 * 1 "D-Link, DE-650" INVALID INVALID white card 274 * 2 "D-Link, DE-650, Ver 01.00" INVALID INVALID became bare metal 275 * 3 "D-Link, DE-650, Ver 01.00" 0x149 0x265 minor change in look 276 * 4 "D-Link, DE-650, Ver 01.00" 0x149 0x265 collision LED added 277 * 278 * While the 1st and the 2nd types should use the "D-Link DE-650" entry, 279 * the 3rd and the 4th types should use the "Linksys EtherCard" entry. 280 * Therefore, this enty must be below the LINKSYS_ECARD_1. --itohy 281 */ 282 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 283 PCMCIA_CIS_DLINK_DE650, 284 0, 0x0040, { 0x00, 0x80, 0xc8 } }, 285 286 /* 287 * IO-DATA PCLA/TE and later version of PCLA/T has valid 288 * vendor/product ID and it is possible to read MAC address 289 * using standard I/O ports. It also read from CIS offset 0x01c0. 290 * On the other hand, earlier version of PCLA/T doesn't have valid 291 * vendor/product ID and MAC address must be read from CIS offset 292 * 0x0ff0 (i.e., usual ne2000 way to read it doesn't work). 293 * And CIS information of earlier and later version of PCLA/T are 294 * same except fourth element. So, for now, we place the entry for 295 * PCLA/TE (and later version of PCLA/T) followed by entry 296 * for the earlier version of PCLA/T (or, modify to match all CIS 297 * information and have three or more individual entries). 298 */ 299 { PCMCIA_VENDOR_IODATA, PCMCIA_PRODUCT_IODATA_PCLATE, 300 PCMCIA_CIS_IODATA_PCLATE, 301 0, -1, { 0x00, 0xa0, 0xb0 } }, 302 303 /* 304 * This entry should be placed after above PCLA-TE entry. 305 * See above comments for detail. 306 */ 307 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 308 PCMCIA_CIS_IODATA_PCLAT, 309 0, 0x0ff0, { 0x00, 0xa0, 0xb0 } }, 310 311 { PCMCIA_VENDOR_DAYNA, PCMCIA_PRODUCT_DAYNA_COMMUNICARD_E_1, 312 PCMCIA_CIS_DAYNA_COMMUNICARD_E_1, 313 0, 0x0110, { 0x00, 0x80, 0x19 } }, 314 315 { PCMCIA_VENDOR_DAYNA, PCMCIA_PRODUCT_DAYNA_COMMUNICARD_E_2, 316 PCMCIA_CIS_DAYNA_COMMUNICARD_E_2, 317 0, -1, { 0x00, 0x80, 0x19 } }, 318 319 { PCMCIA_VENDOR_COREGA, PCMCIA_PRODUCT_COREGA_ETHER_PCC_T, 320 PCMCIA_CIS_COREGA_ETHER_PCC_T, 321 0, -1, { 0x00, 0x00, 0xf4 } }, 322 323 { PCMCIA_VENDOR_COREGA, PCMCIA_PRODUCT_COREGA_ETHER_PCC_TD, 324 PCMCIA_CIS_COREGA_ETHER_PCC_TD, 325 0, -1, { 0x00, 0x00, 0xf4 } }, 326 327 { PCMCIA_VENDOR_COREGA, PCMCIA_PRODUCT_COREGA_ETHER_PCC_TL, 328 PCMCIA_CIS_COREGA_ETHER_PCC_TL, 329 0, -1, { 0x00, 0x00, 0xf4 } }, 330 331 { PCMCIA_VENDOR_COREGA, PCMCIA_PRODUCT_COREGA_ETHER_II_PCC_T, 332 PCMCIA_CIS_COREGA_ETHER_II_PCC_T, 333 0, -1, { 0x00, 0x00, 0xf4 } }, 334 335 { PCMCIA_VENDOR_COREGA, PCMCIA_PRODUCT_COREGA_ETHER_II_PCC_TD, 336 PCMCIA_CIS_COREGA_ETHER_II_PCC_TD, 337 0, -1, { 0x00, 0x00, 0xf4 } }, 338 339 { PCMCIA_VENDOR_COREGA, PCMCIA_PRODUCT_COREGA_FAST_ETHER_PCC_TX, 340 PCMCIA_CIS_COREGA_FAST_ETHER_PCC_TX, 341 0, -1, { 0x00, 0x00, 0xf4 }, NE2000DVF_DL10019 }, 342 343 { PCMCIA_VENDOR_COREGA, PCMCIA_PRODUCT_COREGA_FETHER_PCC_TXF, 344 PCMCIA_CIS_COREGA_FETHER_PCC_TXF, 345 0, -1, { 0x00, 0x90, 0x99 }, NE2000DVF_DL10019 }, 346 347 { PCMCIA_VENDOR_COREGA, PCMCIA_PRODUCT_COREGA_FETHER_PCC_TXD, 348 PCMCIA_CIS_COREGA_FETHER_PCC_TXD, 349 0, -1, { 0x00, 0x90, 0x99 } }, 350 351 { PCMCIA_VENDOR_COREGA, PCMCIA_PRODUCT_COREGA_FETHER_II_PCC_TXD, 352 PCMCIA_CIS_COREGA_FETHER_II_PCC_TXD, 353 0, -1, { 0x00, 0x90, 0x99 }, NE2000DVF_AX88190 | NE2000DVF_AX88790 }, 354 355 { PCMCIA_VENDOR_COMPEX, PCMCIA_PRODUCT_COMPEX_LINKPORT_ENET_B, 356 PCMCIA_CIS_COMPEX_LINKPORT_ENET_B, 357 0, 0x01c0, { 0x00, 0xa0, 0x0c } }, 358 359 { PCMCIA_VENDOR_SMC, PCMCIA_PRODUCT_SMC_EZCARD, 360 PCMCIA_CIS_SMC_EZCARD, 361 0, 0x01c0, { 0x00, 0xe0, 0x29 } }, 362 363 { PCMCIA_VENDOR_SMC, PCMCIA_PRODUCT_SMC_8041, 364 PCMCIA_CIS_SMC_8041, 365 0, -1, { 0x00, 0x04, 0xe2 } }, 366 367 { PCMCIA_VENDOR_SOCKET, PCMCIA_PRODUCT_SOCKET_EA_ETHER, 368 PCMCIA_CIS_SOCKET_EA_ETHER, 369 0, -1, { 0x00, 0xc0, 0x1b } }, 370 371 { PCMCIA_VENDOR_SOCKET, PCMCIA_PRODUCT_SOCKET_LP_ETHER_CF, 372 PCMCIA_CIS_SOCKET_LP_ETHER_CF, 373 0, -1, { 0x00, 0xc0, 0x1b } }, 374 375 { PCMCIA_VENDOR_SOCKET, PCMCIA_PRODUCT_SOCKET_LP_ETH_10_100_CF, 376 PCMCIA_CIS_SOCKET_LP_ETH_10_100_CF, 377 0, -1, { 0x00, 0xe0, 0x98 }, NE2000DVF_DL10019 }, 378 379 { PCMCIA_VENDOR_SOCKET, PCMCIA_PRODUCT_SOCKET_LP_ETHER, 380 PCMCIA_CIS_SOCKET_LP_ETHER, 381 0, -1, { 0x00, 0xc0, 0x1b } }, 382 383 { PCMCIA_VENDOR_KINGSTON, PCMCIA_PRODUCT_KINGSTON_KNE2, 384 PCMCIA_CIS_KINGSTON_KNE2, 385 0, -1, { 0x00, 0xc0, 0xf0 } }, 386 387 { PCMCIA_VENDOR_XIRCOM, PCMCIA_PRODUCT_XIRCOM_CFE_10, 388 PCMCIA_CIS_XIRCOM_CFE_10, 389 0, -1, { 0x00, 0x10, 0xa4 } }, 390 391 { PCMCIA_VENDOR_MELCO, PCMCIA_PRODUCT_MELCO_LPC3_TX, 392 PCMCIA_CIS_MELCO_LPC3_TX, 393 0, -1, { 0xff, 0xff, 0xff }, NE2000DVF_AX88190 }, 394 395 { PCMCIA_VENDOR_BUFFALO, PCMCIA_PRODUCT_BUFFALO_LPC3_CLT, 396 PCMCIA_CIS_BUFFALO_LPC3_CLT, 397 0, -1, { 0x00, 0x07, 0x40 } }, 398 399 { PCMCIA_VENDOR_BUFFALO, PCMCIA_PRODUCT_BUFFALO_LPC_CF_CLT, 400 PCMCIA_CIS_BUFFALO_LPC_CF_CLT, 401 0, -1, { 0x00, 0x07, 0x40 } }, 402 403 { PCMCIA_VENDOR_BUFFALO, PCMCIA_PRODUCT_BUFFALO_LPC4_CLX, 404 PCMCIA_CIS_BUFFALO_LPC4_CLX, 405 0, -1, { 0x00, 0x40, 0xfa }, NE2000DVF_AX88190 | NE2000DVF_AX88790 }, 406 407 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 408 PCMCIA_CIS_BILLIONTON_LNT10TN, 409 0, -1, { 0x00, 0x00, 0x00 } }, 410 411 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 412 PCMCIA_CIS_BILLIONTON_CFLT10N, 413 0, -1, { 0x00, 0x00, 0x00 } }, 414 415 { PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, 416 PCMCIA_CIS_NDC_ND5100_E, 417 0, -1, { 0x00, 0x80, 0xc6 } }, 418 419 { PCMCIA_VENDOR_TELECOMDEVICE, PCMCIA_PRODUCT_TELECOMDEVICE_TCD_HPC100, 420 PCMCIA_CIS_TELECOMDEVICE_TCD_HPC100, 421 0, -1, { 0x00, 0x40, 0x26 }, NE2000DVF_AX88190 }, 422 423 { PCMCIA_VENDOR_MACNICA, PCMCIA_PRODUCT_MACNICA_ME1_JEIDA, 424 PCMCIA_CIS_MACNICA_ME1_JEIDA, 425 0, 0x00b8, { 0x08, 0x00, 0x42 } }, 426 427 { PCMCIA_VENDOR_NETGEAR, PCMCIA_PRODUCT_NETGEAR_FA411, 428 PCMCIA_CIS_NETGEAR_FA411, 429 0, -1, { 0x00, 0x40, 0xf4 } }, 430 431 { PCMCIA_VENDOR_DYNALINK, PCMCIA_PRODUCT_DYNALINK_L10C, 432 PCMCIA_CIS_DYNALINK_L10C, 433 0, -1, { 0x00, 0x00, 0x00 } }, 434 435 #if 0 436 /* the rest of these are stolen from the linux pcnet pcmcia device 437 driver. Since I don't know the manfid or cis info strings for 438 any of them, they're not compiled in until I do. */ 439 { "APEX MultiCard", 440 0x0000, 0x0000, NULL, NULL, 0, 441 0x03f4, { 0x00, 0x20, 0xe5 } }, 442 { "ASANTE FriendlyNet", 443 0x0000, 0x0000, NULL, NULL, 0, 444 0x4910, { 0x00, 0x00, 0x94 } }, 445 { "Danpex EN-6200P2", 446 0x0000, 0x0000, NULL, NULL, 0, 447 0x0110, { 0x00, 0x40, 0xc7 } }, 448 { "DataTrek NetCard", 449 0x0000, 0x0000, NULL, NULL, 0, 450 0x0ff0, { 0x00, 0x20, 0xe8 } }, 451 { "Dayna CommuniCard E", 452 0x0000, 0x0000, NULL, NULL, 0, 453 0x0110, { 0x00, 0x80, 0x19 } }, 454 { "EP-210 Ethernet", 455 0x0000, 0x0000, NULL, NULL, 0, 456 0x0110, { 0x00, 0x40, 0x33 } }, 457 { "ELECOM Laneed LD-CDWA", 458 0x0000, 0x0000, NULL, NULL, 0, 459 0x00b8, { 0x08, 0x00, 0x42 } }, 460 { "Grey Cell GCS2220", 461 0x0000, 0x0000, NULL, NULL, 0, 462 0x0000, { 0x00, 0x47, 0x43 } }, 463 { "Hypertec Ethernet", 464 0x0000, 0x0000, NULL, NULL, 0, 465 0x01c0, { 0x00, 0x40, 0x4c } }, 466 { "IBM CCAE", 467 0x0000, 0x0000, NULL, NULL, 0, 468 0x0ff0, { 0x08, 0x00, 0x5a } }, 469 { "IBM CCAE", 470 0x0000, 0x0000, NULL, NULL, 0, 471 0x0ff0, { 0x00, 0x04, 0xac } }, 472 { "IBM CCAE", 473 0x0000, 0x0000, NULL, NULL, 0, 474 0x0ff0, { 0x00, 0x06, 0x29 } }, 475 { "IBM FME", 476 0x0000, 0x0000, NULL, NULL, 0, 477 0x0374, { 0x00, 0x04, 0xac } }, 478 { "IBM FME", 479 0x0000, 0x0000, NULL, NULL, 0, 480 0x0374, { 0x08, 0x00, 0x5a } }, 481 { "Katron PE-520", 482 0x0000, 0x0000, NULL, NULL, 0, 483 0x0110, { 0x00, 0x40, 0xf6 } }, 484 { "Kingston KNE-PCM/x", 485 0x0000, 0x0000, NULL, NULL, 0, 486 0x0ff0, { 0x00, 0xc0, 0xf0 } }, 487 { "Kingston KNE-PCM/x", 488 0x0000, 0x0000, NULL, NULL, 0, 489 0x0ff0, { 0xe2, 0x0c, 0x0f } }, 490 { "Longshine LCS-8534", 491 0x0000, 0x0000, NULL, NULL, 0, 492 0x0000, { 0x08, 0x00, 0x00 } }, 493 { "Maxtech PCN2000", 494 0x0000, 0x0000, NULL, NULL, 0, 495 0x5000, { 0x00, 0x00, 0xe8 } }, 496 { "NDC Instant-Link", 497 0x0000, 0x0000, NULL, NULL, 0, 498 0x003a, { 0x00, 0x80, 0xc6 } }, 499 { "NE2000 Compatible", 500 0x0000, 0x0000, NULL, NULL, 0, 501 0x0ff0, { 0x00, 0xa0, 0x0c } }, 502 { "Network General Sniffer", 503 0x0000, 0x0000, NULL, NULL, 0, 504 0x0ff0, { 0x00, 0x00, 0x65 } }, 505 { "Panasonic VEL211", 506 0x0000, 0x0000, NULL, NULL, 0, 507 0x0ff0, { 0x00, 0x80, 0x45 } }, 508 { "SCM Ethernet", 509 0x0000, 0x0000, NULL, NULL, 0, 510 0x0ff0, { 0x00, 0x20, 0xcb } }, 511 { "Volktek NPL-402CT", 512 0x0000, 0x0000, NULL, NULL, 0, 513 0x0060, { 0x00, 0x40, 0x05 } }, 514 #endif 515 516 { PCMCIA_VENDOR_ALLIEDTELESIS, PCMCIA_PRODUCT_ALLIEDTELESIS_LA_PCM, 517 PCMCIA_CIS_ALLIEDTELESIS_LA_PCM, 518 0, 0x0ff0, { 0x00, 0x00, 0xf4 } }, 519 520 { PCMCIA_VENDOR_NEXTCOM, PCMCIA_PRODUCT_NEXTCOM_NEXTHAWK, 521 PCMCIA_CIS_NEXTCOM_NEXTHAWK, 522 0, -1, { 0x00, 0x40, 0xb4 } }, 523 }; 524 525 #define NE2000_NDEVS (sizeof(ne2000devs) / sizeof(ne2000devs[0])) 526 527 #define ne2000_match(card, fct, n) \ 528 ((((((card)->manufacturer != PCMCIA_VENDOR_INVALID) && \ 529 ((card)->manufacturer == ne2000devs[(n)].manufacturer) && \ 530 ((card)->product != PCMCIA_PRODUCT_INVALID) && \ 531 ((card)->product == ne2000devs[(n)].product)) || \ 532 ((ne2000devs[(n)].cis_info[0]) && (ne2000devs[(n)].cis_info[1]) && \ 533 (strcmp((card)->cis1_info[0], ne2000devs[(n)].cis_info[0]) == 0) && \ 534 (strcmp((card)->cis1_info[1], ne2000devs[(n)].cis_info[1]) == 0))) && \ 535 ((fct) == ne2000devs[(n)].function))? \ 536 &ne2000devs[(n)]:NULL) 537 538 int 539 ne_pcmcia_match(parent, match, aux) 540 struct device *parent; 541 struct cfdata *match; 542 void *aux; 543 { 544 struct pcmcia_attach_args *pa = aux; 545 int i; 546 547 for (i = 0; i < NE2000_NDEVS; i++) { 548 if (ne2000_match(pa->card, pa->pf->number, i)) 549 return (1); 550 } 551 552 return (0); 553 } 554 555 void 556 ne_pcmcia_attach(parent, self, aux) 557 struct device *parent, *self; 558 void *aux; 559 { 560 struct ne_pcmcia_softc *psc = (void *) self; 561 struct ne2000_softc *nsc = &psc->sc_ne2000; 562 struct dp8390_softc *dsc = &nsc->sc_dp8390; 563 struct pcmcia_attach_args *pa = aux; 564 struct pcmcia_config_entry *cfe; 565 const struct ne2000dev *ne_dev; 566 int i; 567 u_int8_t myea[6], *enaddr; 568 const char *typestr = ""; 569 570 psc->sc_pf = pa->pf; 571 572 SIMPLEQ_FOREACH(cfe, &pa->pf->cfe_head, cfe_list) { 573 #if 0 574 /* 575 * Some ne2000 driver's claim to have memory; others don't. 576 * Since I don't care, I don't check. 577 */ 578 579 if (cfe->num_memspace != 1) { 580 printf(": unexpected number of memory spaces " 581 " %d should be 1\n", cfe->num_memspace); 582 continue; 583 } 584 #endif 585 586 if (cfe->num_iospace == 1) { 587 if (cfe->iospace[0].length != NE2000_NPORTS) { 588 printf(": unexpected I/O space configuration" 589 " (continued)\n%s", dsc->sc_dev.dv_xname); 590 /* XXX really safe for all other cards? */ 591 } 592 } else if (cfe->num_iospace == 2) { 593 /* 594 * Some cards report a separate space for NIC and ASIC. 595 * This make some sense, but we must allocate a single 596 * NE2000_NPORTS-sized chunk, due to brain damaged 597 * address decoders on some of these cards. 598 */ 599 if (cfe->iospace[0].length + cfe->iospace[1].length != 600 NE2000_NPORTS) { 601 #ifdef DIAGNOSTIC 602 printf(": unexpected I/O " 603 "space configuration; ignored\n%s", 604 dsc->sc_dev.dv_xname); 605 #endif 606 continue; 607 } 608 } else { 609 #ifdef DIAGNOSTIC 610 printf(": unexpected number of i/o spaces %d" 611 " should be 1 or 2; ignored\n%s", 612 cfe->num_iospace, dsc->sc_dev.dv_xname); 613 #endif 614 continue; 615 } 616 617 if (pcmcia_io_alloc(pa->pf, cfe->iospace[0].start, 618 NE2000_NPORTS, NE2000_NPORTS, &psc->sc_pcioh)) { 619 #ifdef DIAGNOSTIC 620 printf(": can't allocate i/o space %lx; ignored\n%s", 621 cfe->iospace[0].start, dsc->sc_dev.dv_xname); 622 #endif 623 continue; 624 } 625 626 /* Ok, found. */ 627 break; 628 } 629 630 if (cfe == NULL) { 631 printf(": no suitable config entry\n"); 632 goto fail_1; 633 } 634 635 dsc->sc_regt = psc->sc_pcioh.iot; 636 dsc->sc_regh = psc->sc_pcioh.ioh; 637 638 nsc->sc_asict = psc->sc_pcioh.iot; 639 if (bus_space_subregion(dsc->sc_regt, dsc->sc_regh, 640 NE2000_ASIC_OFFSET, NE2000_ASIC_NPORTS, 641 &nsc->sc_asich)) { 642 printf(": can't get subregion for asic\n"); 643 goto fail_2; 644 } 645 646 /* Set up power management hooks. */ 647 dsc->sc_enable = ne_pcmcia_enable; 648 dsc->sc_disable = ne_pcmcia_disable; 649 650 /* Enable the card. */ 651 pcmcia_function_init(pa->pf, cfe); 652 if (pcmcia_function_enable(pa->pf)) { 653 printf(": function enable failed\n"); 654 goto fail_2; 655 } 656 657 /* some cards claim to be io16, but they're lying. */ 658 if (pcmcia_io_map(pa->pf, PCMCIA_WIDTH_IO8, 659 NE2000_NIC_OFFSET, NE2000_NIC_NPORTS, 660 &psc->sc_pcioh, &psc->sc_nic_io_window)) { 661 printf(": can't map NIC i/o space\n"); 662 goto fail_3; 663 } 664 665 if (pcmcia_io_map(pa->pf, PCMCIA_WIDTH_IO16, 666 NE2000_ASIC_OFFSET, NE2000_ASIC_NPORTS, 667 &psc->sc_pcioh, &psc->sc_asic_io_window)) { 668 printf(": can't map ASIC i/o space\n"); 669 goto fail_4; 670 } 671 672 aprint_normal("\n"); 673 674 /* 675 * Read the station address from the board. 676 */ 677 i = 0; 678 again: 679 enaddr = NULL; /* Ask ASIC by default */ 680 typestr = ""; /* clear previous card-type */ 681 for (; i < NE2000_NDEVS; i++) { 682 ne_dev = ne2000_match(pa->card, pa->pf->number, i); 683 if (ne_dev != NULL) { 684 if (ne_dev->enet_maddr >= 0) { 685 enaddr = ne_pcmcia_get_enaddr(psc, 686 ne_dev->enet_maddr, myea); 687 if (enaddr == NULL) 688 continue; 689 } 690 goto found; 691 } 692 } 693 aprint_error("%s: can't match ethernet vendor code\n", self->dv_xname); 694 if (enaddr != NULL) 695 aprint_error("%s: ethernet vendor code %02x:%02x:%02x\n", 696 self->dv_xname, enaddr[0], enaddr[1], enaddr[2]); 697 goto fail_5; 698 699 found: 700 if ((ne_dev->flags & NE2000DVF_DL10019) != 0) { 701 u_int8_t type; 702 703 enaddr = ne_pcmcia_dl10019_get_enaddr(psc, myea); 704 if (enaddr == NULL) { 705 ++i; 706 goto again; 707 } 708 709 dsc->sc_mediachange = dl10019_mediachange; 710 dsc->sc_mediastatus = dl10019_mediastatus; 711 dsc->init_card = dl10019_init_card; 712 dsc->stop_card = dl10019_stop_card; 713 dsc->sc_media_init = dl10019_media_init; 714 dsc->sc_media_fini = dl10019_media_fini; 715 716 /* Determine if this is a DL10019 or a DL10022. */ 717 type = bus_space_read_1(nsc->sc_asict, nsc->sc_asich, 0x0f); 718 if (type == 0x91 || type == 0x99) { 719 nsc->sc_type = NE2000_TYPE_DL10022; 720 typestr = " (DL10022)"; 721 } else { 722 nsc->sc_type = NE2000_TYPE_DL10019; 723 typestr = " (DL10019)"; 724 } 725 } 726 727 if ((ne_dev->flags & NE2000DVF_AX88190) != 0) { 728 if (ne_pcmcia_ax88190_set_iobase(psc)) { 729 ++i; 730 goto again; 731 } 732 733 dsc->sc_mediachange = ax88190_mediachange; 734 dsc->sc_mediastatus = ax88190_mediastatus; 735 dsc->init_card = ax88190_init_card; 736 dsc->stop_card = ax88190_stop_card; 737 dsc->sc_media_init = ax88190_media_init; 738 dsc->sc_media_fini = ax88190_media_fini; 739 740 if ((ne_dev->flags & NE2000DVF_AX88790) != 0) { 741 nsc->sc_type = NE2000_TYPE_AX88790; 742 typestr = " (AX88790)"; 743 } else { 744 nsc->sc_type = NE2000_TYPE_AX88190; 745 typestr = " (AX88190)"; 746 } 747 } 748 749 if (enaddr != NULL && 750 ne_dev->enet_vendor[0] != 0xff) { 751 /* 752 * Make sure this is what we expect. 753 */ 754 if (enaddr[0] != ne_dev->enet_vendor[0] || 755 enaddr[1] != ne_dev->enet_vendor[1] || 756 enaddr[2] != ne_dev->enet_vendor[2]) { 757 ++i; 758 goto again; 759 } 760 } 761 762 /* 763 * Check for a Realtek 8019. 764 */ 765 if (nsc->sc_type == 0) { 766 bus_space_write_1(dsc->sc_regt, dsc->sc_regh, ED_P0_CR, 767 ED_CR_PAGE_0 | ED_CR_STP); 768 if (bus_space_read_1(dsc->sc_regt, dsc->sc_regh, 769 NERTL_RTL0_8019ID0) == RTL0_8019ID0 && 770 bus_space_read_1(dsc->sc_regt, dsc->sc_regh, 771 NERTL_RTL0_8019ID1) == RTL0_8019ID1) { 772 typestr = " (RTL8019)"; 773 dsc->sc_mediachange = rtl80x9_mediachange; 774 dsc->sc_mediastatus = rtl80x9_mediastatus; 775 dsc->init_card = rtl80x9_init_card; 776 dsc->sc_media_init = rtl80x9_media_init; 777 } 778 } 779 780 if (ne2000_attach(nsc, enaddr)) 781 goto fail_5; 782 783 pcmcia_function_disable(pa->pf); 784 return; 785 786 fail_5: 787 /* Unmap ASIC i/o windows. */ 788 pcmcia_io_unmap(psc->sc_pf, psc->sc_asic_io_window); 789 790 fail_4: 791 /* Unmap NIC i/o windows. */ 792 pcmcia_io_unmap(psc->sc_pf, psc->sc_nic_io_window); 793 794 fail_3: 795 pcmcia_function_disable(pa->pf); 796 797 fail_2: 798 /* Free our i/o space. */ 799 pcmcia_io_free(psc->sc_pf, &psc->sc_pcioh); 800 801 fail_1: 802 psc->sc_nic_io_window = -1; 803 } 804 805 int 806 ne_pcmcia_detach(self, flags) 807 struct device *self; 808 int flags; 809 { 810 struct ne_pcmcia_softc *psc = (struct ne_pcmcia_softc *)self; 811 int error; 812 813 if (psc->sc_nic_io_window == -1) 814 /* Nothing to detach. */ 815 return (0); 816 817 error = ne2000_detach(&psc->sc_ne2000, flags); 818 if (error != 0) 819 return (error); 820 821 /* Unmap our i/o windows. */ 822 pcmcia_io_unmap(psc->sc_pf, psc->sc_asic_io_window); 823 pcmcia_io_unmap(psc->sc_pf, psc->sc_nic_io_window); 824 825 /* Free our i/o space. */ 826 pcmcia_io_free(psc->sc_pf, &psc->sc_pcioh); 827 828 return (0); 829 } 830 831 int 832 ne_pcmcia_enable(dsc) 833 struct dp8390_softc *dsc; 834 { 835 struct ne_pcmcia_softc *psc = (struct ne_pcmcia_softc *)dsc; 836 struct ne2000_softc *nsc = &psc->sc_ne2000; 837 struct pcmcia_mem_handle pcmh; 838 839 /* set up the interrupt */ 840 psc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, dp8390_intr, 841 dsc); 842 if (psc->sc_ih == NULL) { 843 printf("%s: couldn't establish interrupt\n", 844 dsc->sc_dev.dv_xname); 845 goto fail_1; 846 } 847 848 if (pcmcia_function_enable(psc->sc_pf)) 849 goto fail_2; 850 851 if (nsc->sc_type == NE2000_TYPE_AX88190 || 852 nsc->sc_type == NE2000_TYPE_AX88790) { 853 if (ne_pcmcia_ax88190_set_iobase(psc)) 854 goto fail_3; 855 if (nsc->sc_type == NE2000_TYPE_AX88790) { 856 bus_size_t offset; 857 int mwindow; 858 859 if (pcmcia_mem_alloc(psc->sc_pf, 860 AX88790_CSR_SIZE, &pcmh)) { 861 printf("%s: can't alloc mem for CSR\n", 862 dsc->sc_dev.dv_xname); 863 goto fail_3; 864 } 865 866 if (pcmcia_mem_map(psc->sc_pf, PCMCIA_MEM_ATTR, 867 AX88790_CSR, AX88790_CSR_SIZE, 868 &pcmh, &offset, &mwindow)) { 869 printf("%s: can't map mem for CSR\n", 870 dsc->sc_dev.dv_xname); 871 goto fail_4; 872 } 873 874 bus_space_write_1(pcmh.memt, pcmh.memh, offset, 0x4); 875 pcmcia_mem_unmap(psc->sc_pf, mwindow); 876 pcmcia_mem_free(psc->sc_pf, &pcmh); 877 } 878 } 879 880 return (0); 881 882 fail_4: 883 pcmcia_mem_free(psc->sc_pf, &pcmh); 884 fail_3: 885 pcmcia_function_disable(psc->sc_pf); 886 fail_2: 887 pcmcia_intr_disestablish(psc->sc_pf, psc->sc_ih); 888 fail_1: 889 return (1); 890 } 891 892 void 893 ne_pcmcia_disable(dsc) 894 struct dp8390_softc *dsc; 895 { 896 struct ne_pcmcia_softc *psc = (struct ne_pcmcia_softc *)dsc; 897 898 pcmcia_function_disable(psc->sc_pf); 899 pcmcia_intr_disestablish(psc->sc_pf, psc->sc_ih); 900 } 901 902 u_int8_t * 903 ne_pcmcia_get_enaddr(psc, maddr, myea) 904 struct ne_pcmcia_softc *psc; 905 int maddr; 906 u_int8_t myea[ETHER_ADDR_LEN]; 907 { 908 struct ne2000_softc *nsc = &psc->sc_ne2000; 909 struct dp8390_softc *dsc = &nsc->sc_dp8390; 910 struct pcmcia_mem_handle pcmh; 911 bus_size_t offset; 912 u_int8_t *enaddr = NULL; 913 int j, mwindow; 914 915 if (maddr < 0) 916 return (NULL); 917 918 if (pcmcia_mem_alloc(psc->sc_pf, ETHER_ADDR_LEN * 2, &pcmh)) { 919 printf("%s: can't alloc mem for enet addr\n", 920 dsc->sc_dev.dv_xname); 921 goto fail_1; 922 } 923 if (pcmcia_mem_map(psc->sc_pf, PCMCIA_MEM_ATTR, maddr, 924 ETHER_ADDR_LEN * 2, &pcmh, &offset, &mwindow)) { 925 printf("%s: can't map mem for enet addr\n", 926 dsc->sc_dev.dv_xname); 927 goto fail_2; 928 } 929 for (j = 0; j < ETHER_ADDR_LEN; j++) 930 myea[j] = bus_space_read_1(pcmh.memt, pcmh.memh, 931 offset + (j * 2)); 932 enaddr = myea; 933 934 pcmcia_mem_unmap(psc->sc_pf, mwindow); 935 fail_2: 936 pcmcia_mem_free(psc->sc_pf, &pcmh); 937 fail_1: 938 return (enaddr); 939 } 940 941 u_int8_t * 942 ne_pcmcia_dl10019_get_enaddr(psc, myea) 943 struct ne_pcmcia_softc *psc; 944 u_int8_t myea[ETHER_ADDR_LEN]; 945 { 946 struct ne2000_softc *nsc = &psc->sc_ne2000; 947 u_int8_t sum; 948 int j; 949 950 #define PAR0 0x04 951 for (j = 0, sum = 0; j < 8; j++) 952 sum += bus_space_read_1(nsc->sc_asict, nsc->sc_asich, 953 PAR0 + j); 954 if (sum != 0xff) 955 return (NULL); 956 for (j = 0; j < ETHER_ADDR_LEN; j++) 957 myea[j] = bus_space_read_1(nsc->sc_asict, 958 nsc->sc_asich, PAR0 + j); 959 #undef PAR0 960 return (myea); 961 } 962 963 int 964 ne_pcmcia_ax88190_set_iobase(psc) 965 struct ne_pcmcia_softc *psc; 966 { 967 struct ne2000_softc *nsc = &psc->sc_ne2000; 968 struct dp8390_softc *dsc = &nsc->sc_dp8390; 969 struct pcmcia_mem_handle pcmh; 970 bus_size_t offset; 971 int rv = 1, mwindow; 972 u_int last_liobase, new_liobase; 973 974 if (pcmcia_mem_alloc(psc->sc_pf, AX88190_LAN_IOSIZE, &pcmh)) { 975 #if 0 976 printf("%s: can't alloc mem for LAN iobase\n", 977 dsc->sc_dev.dv_xname); 978 #endif 979 goto fail_1; 980 } 981 if (pcmcia_mem_map(psc->sc_pf, PCMCIA_MEM_ATTR, 982 AX88190_LAN_IOBASE, AX88190_LAN_IOSIZE, 983 &pcmh, &offset, &mwindow)) { 984 printf("%s: can't map mem for LAN iobase\n", 985 dsc->sc_dev.dv_xname); 986 goto fail_2; 987 } 988 989 last_liobase = bus_space_read_1(pcmh.memt, pcmh.memh, offset + 0) | 990 (bus_space_read_1(pcmh.memt, pcmh.memh, offset + 2) << 8); 991 #ifdef DIAGNOSTIC 992 printf("%s: LAN iobase 0x%x (0x%x) ->", dsc->sc_dev.dv_xname, 993 last_liobase, (u_int)psc->sc_pcioh.addr); 994 #endif 995 bus_space_write_1(pcmh.memt, pcmh.memh, offset, 996 psc->sc_pcioh.addr & 0xff); 997 bus_space_write_1(pcmh.memt, pcmh.memh, offset + 2, 998 psc->sc_pcioh.addr >> 8); 999 1000 new_liobase = bus_space_read_1(pcmh.memt, pcmh.memh, offset + 0) | 1001 (bus_space_read_1(pcmh.memt, pcmh.memh, offset + 2) << 8); 1002 #ifdef DIAGNOSTIC 1003 printf(" 0x%x\n", new_liobase); 1004 #endif 1005 if ((last_liobase == psc->sc_pcioh.addr) 1006 || (last_liobase != new_liobase)) 1007 rv = 0; 1008 1009 pcmcia_mem_unmap(psc->sc_pf, mwindow); 1010 fail_2: 1011 pcmcia_mem_free(psc->sc_pf, &pcmh); 1012 fail_1: 1013 return (rv); 1014 } 1015