mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-02 12:20:51 +00:00
Add some code which read manufucturer id. This is for NEWCARD compatibility.
Reviewed by: imp
This commit is contained in:
parent
9198b952b5
commit
d9dd0fde5f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90968
@ -347,12 +347,27 @@ card_inserted(struct slot *sp)
|
||||
sp->cis->manuf, sp->cis->vers);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Copy CIS_MANUF_ID and CIS_FUNC_EXT from "struct cis"
|
||||
* to "struct slot"
|
||||
*/
|
||||
if (sp->cis->lan_nid && sp->cis->lan_nid[0] == sizeof(sp->eaddr)) {
|
||||
bcopy(sp->cis->lan_nid + 1, sp->eaddr, sizeof(sp->eaddr));
|
||||
sp->flags |= EADDR_CONFIGED;
|
||||
} else {
|
||||
bzero(sp->eaddr, sizeof(sp->eaddr));
|
||||
}
|
||||
if (sp->cis->manufacturer && sp->cis->product) {
|
||||
sp->manufacturer=sp->cis->manufacturer;
|
||||
sp->product=sp->cis->product;
|
||||
if(sp->cis->prodext) {
|
||||
sp->prodext=sp->cis->prodext; /* For xe driver */
|
||||
}
|
||||
} else {
|
||||
sp->manufacturer=0;
|
||||
sp->product=0;
|
||||
sp->prodext=0;
|
||||
}
|
||||
|
||||
if (cp->ether) {
|
||||
struct ether *e = 0;
|
||||
@ -968,6 +983,13 @@ setup_slot(struct slot *sp)
|
||||
drv.iobase + sp->io.size - 1, drv.mem, drv.memsize,
|
||||
sp->irq, drv.flags);
|
||||
}
|
||||
/*
|
||||
* Copy CIS_MANUF_ID from "struct slot" to "struct dev_desc"
|
||||
* This means moving CIS_MANUF_ID to kernel driver area.
|
||||
*/
|
||||
drv.manufacturer = sp->manufacturer;
|
||||
drv.product = sp->product;
|
||||
drv.prodext = sp->prodext;
|
||||
/*
|
||||
* If the driver fails to be connected to the device,
|
||||
* then it may mean that the driver did not recognise it.
|
||||
|
@ -121,6 +121,9 @@ struct slot {
|
||||
struct card_config *config; /* Current configuration */
|
||||
struct cis_config *card_config;
|
||||
char devname[16];
|
||||
u_int manufacturer;
|
||||
u_int product;
|
||||
u_int prodext;
|
||||
unsigned char eaddr[6]; /* If any */
|
||||
struct allocblk io; /* I/O block spec */
|
||||
struct allocblk mem; /* Memory block spec */
|
||||
|
@ -56,6 +56,7 @@ static void cis_info(struct cis *, unsigned char *, int);
|
||||
static void device_desc(unsigned char *, int, struct dev_mem *);
|
||||
static void config_map(struct cis *, unsigned char *, int);
|
||||
static void cis_config(struct cis *, unsigned char *, int);
|
||||
static void cis_manuf_id(struct cis *, unsigned char *, int);
|
||||
static void cis_func_id(struct cis *, unsigned char *, int);
|
||||
static void cis_network_ext(struct cis *, unsigned char *, int);
|
||||
static struct tuple_list *read_one_tuplelist(int, int, off_t);
|
||||
@ -140,6 +141,9 @@ readcis(int fd)
|
||||
case CIS_CONFIG: /* 0x1B */
|
||||
cis_config(cp, tp->data, tp->length);
|
||||
break;
|
||||
case CIS_MANUF_ID: /* 0x20 */
|
||||
cis_manuf_id(cp, tp->data, tp->length);
|
||||
break;
|
||||
case CIS_FUNC_ID: /* 0x21 */
|
||||
cis_func_id(cp, tp->data, tp->length);
|
||||
break;
|
||||
@ -238,6 +242,20 @@ cis_info(struct cis *cp, unsigned char *p, int len)
|
||||
cp->add_info2 = strdup("[none]");
|
||||
}
|
||||
|
||||
static void
|
||||
cis_manuf_id(struct cis *cp, unsigned char *p, int len)
|
||||
{
|
||||
if (len > 4) {
|
||||
cp->manufacturer = tpl16(p);
|
||||
cp->product = tpl16(p+2);
|
||||
if (len == 5)
|
||||
cp->prodext = *(p+4); /* For xe driver */
|
||||
} else {
|
||||
cp->manufacturer=0;
|
||||
cp->product=0;
|
||||
cp->prodext=0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Fills in CIS function ID.
|
||||
*/
|
||||
|
@ -118,6 +118,9 @@ struct cis {
|
||||
unsigned char last_config;
|
||||
unsigned char ccrs;
|
||||
unsigned long reg_addr;
|
||||
u_int manufacturer;
|
||||
u_int product;
|
||||
u_int prodext;
|
||||
unsigned char func_id1, func_id2;
|
||||
struct dev_mem attr_mem;
|
||||
struct dev_mem common_mem;
|
||||
|
Loading…
Reference in New Issue
Block a user