Deleted Added
full compact
if_ed_pccard.c (150520) if_ed_pccard.c (150581)
1/*-
2 * Copyright (c) 2005, M. Warner Losh
3 * Copyright (c) 1995, David Greenman
4 * 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:

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, 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
26 * SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 2005, M. Warner Losh
3 * Copyright (c) 1995, David Greenman
4 * 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:

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, 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
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/dev/ed/if_ed_pccard.c 150520 2005-09-24 17:36:43Z imp $
28 * $FreeBSD: head/sys/dev/ed/if_ed_pccard.c 150581 2005-09-26 18:27:13Z imp $
29 */
30
31/*
32 * Notes for adding media support. Each chipset is somewhat different
33 * from the others. Linux has a table of OIDs that it uses to see what
34 * supports the misc register of the NS83903. But a sampling of datasheets
35 * I could dig up on cards I own paints a different picture.
36 *

--- 196 unchanged lines hidden (view full) ---

233static void ed_pccard_ax88x90_mii_writebits(struct ed_softc *sc, u_int val,
234 int nbits);
235static int ed_miibus_readreg(device_t dev, int phy, int reg);
236static int ed_ifmedia_upd(struct ifnet *);
237static void ed_ifmedia_sts(struct ifnet *, struct ifmediareq *);
238
239static int ed_pccard_ax88x90(device_t dev, const struct ed_product *);
240
29 */
30
31/*
32 * Notes for adding media support. Each chipset is somewhat different
33 * from the others. Linux has a table of OIDs that it uses to see what
34 * supports the misc register of the NS83903. But a sampling of datasheets
35 * I could dig up on cards I own paints a different picture.
36 *

--- 196 unchanged lines hidden (view full) ---

233static void ed_pccard_ax88x90_mii_writebits(struct ed_softc *sc, u_int val,
234 int nbits);
235static int ed_miibus_readreg(device_t dev, int phy, int reg);
236static int ed_ifmedia_upd(struct ifnet *);
237static void ed_ifmedia_sts(struct ifnet *, struct ifmediareq *);
238
239static int ed_pccard_ax88x90(device_t dev, const struct ed_product *);
240
241static void
242ed_pccard_print_entry(const struct ed_product *pp)
243{
244 int i;
245
246 printf("Product entry: ");
247 if (pp->prod.pp_name)
248 printf("name='%s',", pp->prod.pp_name);
249 printf("vendor=%#x,product=%#x", pp->prod.pp_vendor,
250 pp->prod.pp_product);
251 for (i = 0; i < 4; i++)
252 if (pp->prod.pp_cis[i])
253 printf(",CIS%d='%s'", i, pp->prod.pp_cis[i]);
254 printf("\n");
255}
256
241static int
242ed_pccard_probe(device_t dev)
243{
257static int
258ed_pccard_probe(device_t dev)
259{
244 const struct ed_product *pp;
245 int error;
260 const struct ed_product *pp, *pp2;
261 int error, first = 1;
246 uint32_t fcn = PCCARD_FUNCTION_UNSPEC;
247
248 /* Make sure we're a network function */
249 error = pccard_get_function(dev, &fcn);
250 if (error != 0)
251 return (error);
252
253 if ((pp = (const struct ed_product *) pccard_product_lookup(dev,
254 (const struct pccard_product *) ed_pccard_products,
255 sizeof(ed_pccard_products[0]), NULL)) != NULL) {
256 if (pp->prod.pp_name != NULL)
257 device_set_desc(dev, pp->prod.pp_name);
258 /*
259 * Some devices don't ID themselves as network, but
260 * that's OK if the flags say so.
261 */
262 if (!(pp->flags & NE2000DVF_ANYFUNC) &&
263 fcn != PCCARD_FUNCTION_NETWORK)
264 return (ENXIO);
262 uint32_t fcn = PCCARD_FUNCTION_UNSPEC;
263
264 /* Make sure we're a network function */
265 error = pccard_get_function(dev, &fcn);
266 if (error != 0)
267 return (error);
268
269 if ((pp = (const struct ed_product *) pccard_product_lookup(dev,
270 (const struct pccard_product *) ed_pccard_products,
271 sizeof(ed_pccard_products[0]), NULL)) != NULL) {
272 if (pp->prod.pp_name != NULL)
273 device_set_desc(dev, pp->prod.pp_name);
274 /*
275 * Some devices don't ID themselves as network, but
276 * that's OK if the flags say so.
277 */
278 if (!(pp->flags & NE2000DVF_ANYFUNC) &&
279 fcn != PCCARD_FUNCTION_NETWORK)
280 return (ENXIO);
281 /*
282 * Some devices match multiple entries. Report that
283 * as a warning to help cull the table
284 */
285 pp2 = pp;
286 while ((pp2 = (const struct ed_product *)pccard_product_lookup(
287 dev, (const struct pccard_product *)(pp2 + 1),
288 sizeof(ed_pccard_products[0]), NULL)) != NULL) {
289 if (first) {
290 device_printf(dev,
291 "Warning: card matches multiple entries. Report to imp@freebsd.org\n");
292 ed_pccard_print_entry(pp);
293 first = 0;
294 }
295 ed_pccard_print_entry(pp2);
296 }
297
265 return (0);
266 }
267 return (ENXIO);
268}
269
270static int
271ed_pccard_rom_mac(device_t dev, uint8_t *enaddr)
272{

--- 655 unchanged lines hidden ---
298 return (0);
299 }
300 return (ENXIO);
301}
302
303static int
304ed_pccard_rom_mac(device_t dev, uint8_t *enaddr)
305{

--- 655 unchanged lines hidden ---