Add a cis decoding function which decodes some CISTPL_FUNCE tuples for
disk and network functions.
This commit is contained in:
parent
7cc4fa0618
commit
8130f0ec5d
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: pcmcia_cis.c,v 1.19 2000/07/14 08:02:12 jun Exp $ */
|
/* $NetBSD: pcmcia_cis.c,v 1.20 2000/10/17 10:13:46 haya Exp $ */
|
||||||
|
|
||||||
#define PCMCIACISDEBUG
|
#define PCMCIACISDEBUG
|
||||||
|
|
||||||
|
@ -60,6 +60,8 @@ struct cis_state {
|
||||||
};
|
};
|
||||||
|
|
||||||
int pcmcia_parse_cis_tuple __P((struct pcmcia_tuple *, void *));
|
int pcmcia_parse_cis_tuple __P((struct pcmcia_tuple *, void *));
|
||||||
|
static int decode_funce __P((struct pcmcia_tuple *, struct pcmcia_function *));
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pcmcia_read_cis(sc)
|
pcmcia_read_cis(sc)
|
||||||
|
@ -529,6 +531,13 @@ pcmcia_print_cis(sc)
|
||||||
break;
|
break;
|
||||||
case PCMCIA_FUNCTION_DISK:
|
case PCMCIA_FUNCTION_DISK:
|
||||||
printf("fixed disk");
|
printf("fixed disk");
|
||||||
|
switch (pf->pf_funce_disk_interface) {
|
||||||
|
case PCMCIA_TPLFE_DDI_PCCARD_ATA:
|
||||||
|
printf("(ata)");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PCMCIA_FUNCTION_VIDEO:
|
case PCMCIA_FUNCTION_VIDEO:
|
||||||
printf("video adapter");
|
printf("video adapter");
|
||||||
|
@ -828,6 +837,16 @@ pcmcia_parse_cis_tuple(tuple, arg)
|
||||||
|
|
||||||
DPRINTF(("CISTPL_FUNCID\n"));
|
DPRINTF(("CISTPL_FUNCID\n"));
|
||||||
break;
|
break;
|
||||||
|
case PCMCIA_CISTPL_FUNCE:
|
||||||
|
if (state->pf == NULL || state->pf->function <= 0) {
|
||||||
|
DPRINTF(("CISTPL_FUNCE is not followed by "
|
||||||
|
"valid CISTPL_FUNCID\n"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (tuple->length >= 2) {
|
||||||
|
decode_funce(tuple, state->pf);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case PCMCIA_CISTPL_CONFIG:
|
case PCMCIA_CISTPL_CONFIG:
|
||||||
if (tuple->length < 3) {
|
if (tuple->length < 3) {
|
||||||
DPRINTF(("CISTPL_CONFIG too short %d\n",
|
DPRINTF(("CISTPL_CONFIG too short %d\n",
|
||||||
|
@ -1283,3 +1302,41 @@ pcmcia_parse_cis_tuple(tuple, arg)
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
decode_funce(tuple, pf)
|
||||||
|
struct pcmcia_tuple *tuple;
|
||||||
|
struct pcmcia_function *pf;
|
||||||
|
{
|
||||||
|
int type = pcmcia_tuple_read_1(tuple, 0);
|
||||||
|
|
||||||
|
switch (pf->function) {
|
||||||
|
case PCMCIA_FUNCTION_DISK:
|
||||||
|
if (type == PCMCIA_TPLFE_TYPE_DISK_DEVICE_INTERFACE) {
|
||||||
|
pf->pf_funce_disk_interface
|
||||||
|
= pcmcia_tuple_read_1(tuple, 1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PCMCIA_FUNCTION_NETWORK:
|
||||||
|
if (type == PCMCIA_TPLFE_TYPE_LAN_NID) {
|
||||||
|
int i;
|
||||||
|
int len = pcmcia_tuple_read_1(tuple, 1);
|
||||||
|
if (tuple->length < 2 + len || len > 8) {
|
||||||
|
/* tuple length not enough or nid too long */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (i = 0; i < len; ++i) {
|
||||||
|
pf->pf_funce_lan_nid[i]
|
||||||
|
= pcmcia_tuple_read_1(tuple, 2 + i);
|
||||||
|
}
|
||||||
|
pf->pf_funce_lan_nidlen = len;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: pcmciavar.h,v 1.12 2000/02/08 12:51:31 enami Exp $ */
|
/* $NetBSD: pcmciavar.h,v 1.13 2000/10/17 10:13:47 haya Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997 Marc Horowitz. All rights reserved.
|
* Copyright (c) 1997 Marc Horowitz. All rights reserved.
|
||||||
|
@ -105,6 +105,22 @@ struct pcmcia_config_entry {
|
||||||
SIMPLEQ_ENTRY(pcmcia_config_entry) cfe_list;
|
SIMPLEQ_ENTRY(pcmcia_config_entry) cfe_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct pcmcia_funce_disk {
|
||||||
|
int pfd_interface;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pcmcia_funce_lan {
|
||||||
|
int pfl_nidlen;
|
||||||
|
u_int8_t pfl_nid[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
union pcmcia_funce {
|
||||||
|
struct pcmcia_funce_disk pfv_disk;
|
||||||
|
struct pcmcia_funce_lan pfv_lan;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct pcmcia_function {
|
struct pcmcia_function {
|
||||||
/* read off the card */
|
/* read off the card */
|
||||||
int number;
|
int number;
|
||||||
|
@ -131,6 +147,11 @@ struct pcmcia_function {
|
||||||
void *ih_arg;
|
void *ih_arg;
|
||||||
int ih_ipl;
|
int ih_ipl;
|
||||||
int pf_flags;
|
int pf_flags;
|
||||||
|
|
||||||
|
union pcmcia_funce pf_funce; /* CISTPL_FUNCE */
|
||||||
|
#define pf_funce_disk_interface pf_funce.pfv_disk.pfd_interface
|
||||||
|
#define pf_funce_lan_nid pf_funce.pfv_lan.pfl_nid
|
||||||
|
#define pf_funce_lan_nidlen pf_funce.pfv_lan.pfl_nidlen
|
||||||
};
|
};
|
||||||
|
|
||||||
/* pf_flags */
|
/* pf_flags */
|
||||||
|
|
Loading…
Reference in New Issue