o Changes to support NEWCARD.

o Add needed headers.
        o Add ncv_products[] product data and ncv_match() function.
        o Change ncv_pccard_method[] to support both OLDCARD and NEWCARD.

Suggestion for REX-5572 matching part by imp.

Approved by:	re
This commit is contained in:
Noriaki Mitsunaga 2002-11-28 01:13:58 +00:00
parent 922019c24b
commit 4a42958a2b

View File

@ -48,6 +48,9 @@
#include <sys/device_port.h>
#include <dev/pccard/pccarddevs.h>
#include <dev/pccard/pccardvar.h>
#include <cam/scsi/scsi_low.h>
#include <cam/scsi/scsi_low_pisa.h>
@ -71,6 +74,24 @@ static int ncvattach(DEVPORT_PDEVICE devi);
static void ncv_card_unload(DEVPORT_PDEVICE);
static const struct ncv_product {
struct pccard_product prod;
int flags;
} ncv_products[] = {
{ PCMCIA_CARD(EPSON, SC200, 0), 0},
{ PCMCIA_CARD(PANASONIC, KXLC002, 0), 0xb4d00000 },
{ PCMCIA_CARD(PANASONIC, KXLC004, 0), 0xb4d00100 },
{ PCMCIA_CARD(MACNICA, MPS100, 0), 0xb6250000 },
{ PCMCIA_CARD(MACNICA, MPS110, 0), 0 },
{ PCMCIA_CARD(NEC, PC9801N_J03R, 0), 0 },
{ PCMCIA_CARD(NEWMEDIA, BASICS_SCSI, 0), 0 },
{ PCMCIA_CARD(QLOGIC, PC05, 0), 0x84d00000 },
#define FLAGS_REX5572 0x84d00000
{ PCMCIA_CARD(RATOC, REX5572, 0), FLAGS_REX5572 },
{ PCMCIA_CARD(RATOC, REX_R280, 0), 0x84d00000 },
{ { NULL }, 0 }
};
/*
* Additional code for FreeBSD new-bus PCCard frontend
*/
@ -180,6 +201,32 @@ ncv_alloc_resource(DEVPORT_PDEVICE dev)
return(0);
}
static int ncv_pccard_match(device_t dev)
{
const struct ncv_product *pp;
char *vendorstr;
char *prodstr;
if ((pp = (const struct ncv_product *) pccard_product_lookup(dev,
(const struct pccard_product *) ncv_products,
sizeof(ncv_products[0]), NULL)) != NULL) {
device_set_desc(dev, pp->prod.pp_name);
device_set_flags(dev, pp->flags);
return(0);
}
if (pccard_get_vendor_str(dev, &vendorstr))
return(EIO);
if (pccard_get_product_str(dev, &prodstr))
return(EIO);
if (strcmp(vendorstr, "RATOC System Inc.") == 0 &&
strncmp(prodstr, "SOUND/SCSI2 CARD", 16) == 0) {
device_set_desc(dev, "RATOC REX-5572");
device_set_flags(dev, FLAGS_REX5572);
return (0);
}
return(EIO);
}
static int
ncv_pccard_probe(DEVPORT_PDEVICE dev)
{
@ -238,10 +285,15 @@ ncv_pccard_detach(DEVPORT_PDEVICE dev)
static device_method_t ncv_pccard_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, ncv_pccard_probe),
DEVMETHOD(device_attach, ncv_pccard_attach),
DEVMETHOD(device_probe, pccard_compat_probe),
DEVMETHOD(device_attach, pccard_compat_attach),
DEVMETHOD(device_detach, ncv_pccard_detach),
/* Card interface */
DEVMETHOD(card_compat_match, ncv_pccard_match),
DEVMETHOD(card_compat_probe, ncv_pccard_probe),
DEVMETHOD(card_compat_attach, ncv_pccard_attach),
{ 0, 0 }
};