Add a pcmcia_devinfo() function (akin to pci_devinfo). It generates a

string suitable for printing in the attach message.
This commit is contained in:
augustss 2000-02-07 09:35:29 +00:00
parent 2687887f38
commit e2ab50484b
2 changed files with 27 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcmcia.c,v 1.17 2000/02/05 20:02:43 nathanw Exp $ */
/* $NetBSD: pcmcia.c,v 1.18 2000/02/07 09:35:29 augustss Exp $ */
#define PCMCIADEBUG
@ -302,26 +302,36 @@ pcmcia_print(arg, pnp)
struct pcmcia_attach_args *pa = arg;
struct pcmcia_softc *sc = pa->pf->sc;
struct pcmcia_card *card = &sc->card;
int i;
char devinfo[256];
if (pnp) {
for (i = 0; i < 4; i++) {
if (card->cis1_info[i] == NULL)
break;
if (i)
printf(", ");
printf("%s", card->cis1_info[i]);
}
if (i)
printf(" ");
printf("(manufacturer 0x%x, product 0x%x)", card->manufacturer,
card->product);
pcmcia_devinfo(card, 1, devinfo, sizeof devinfo);
printf("%s", devinfo);
}
printf(" function %d", pa->pf->number);
return (UNCONF);
}
void
pcmcia_devinfo(card, showhex, cp, cplen)
struct pcmcia_card *card;
char *cp;
int cplen;
{
int i, n;
for (i = 0; i < 4 && card->cis1_info[i] != NULL && cplen > 0; i++) {
n = snprintf(cp, cplen, "%s%s", i ? ", " : "",
card->cis1_info[i]);
cp += n;
cplen -= n;
}
if (showhex && cplen > 0)
snprintf(cp, cplen, "%s(manufacturer 0x%04x, product 0x%04x)",
i ? " " : "", card->manufacturer, card->product);
}
const struct pcmcia_product *
pcmcia_product_lookup(pa, tab, ent_size, matchfn)
struct pcmcia_attach_args *pa;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcmciavar.h,v 1.10 2000/02/04 01:27:14 cgd Exp $ */
/* $NetBSD: pcmciavar.h,v 1.11 2000/02/07 09:35:29 augustss Exp $ */
/*
* Copyright (c) 1997 Marc Horowitz. All rights reserved.
@ -217,6 +217,9 @@ const struct pcmcia_product
const struct pcmcia_product *tab, size_t ent_size,
pcmcia_product_match_fn matchfn));
void pcmcia_devinfo __P((struct pcmcia_card *card, int showhex, char *cp,
int cplen));
void pcmcia_read_cis __P((struct pcmcia_softc *));
void pcmcia_check_cis_quirks __P((struct pcmcia_softc *));
void pcmcia_print_cis __P((struct pcmcia_softc *));