summaryrefslogtreecommitdiffstats
path: root/sys/dev/cardbus/cardbus_cis.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2002-11-27 06:56:29 +0000
committerimp <imp@FreeBSD.org>2002-11-27 06:56:29 +0000
commit7fba790820da57f694d05dd3433422165bcc78e5 (patch)
tree6367d5bd430a1f97e9f089ae24f95874017b90e9 /sys/dev/cardbus/cardbus_cis.c
parent5a806bdbdee9e13bd51cc934d44461cb417c21ba (diff)
downloadFreeBSD-src-7fba790820da57f694d05dd3433422165bcc78e5.zip
FreeBSD-src-7fba790820da57f694d05dd3433422165bcc78e5.tar.gz
Implement PCI_IVAR_ETHADDR. Cardbus has the MAC addr in the CIS,
sometimes, so return it when requested and it does. Also a little more infrastructure for a few other things. Submitted by: sam Approved by: re (blanket for NEWCARD)
Diffstat (limited to 'sys/dev/cardbus/cardbus_cis.c')
-rw-r--r--sys/dev/cardbus/cardbus_cis.c67
1 files changed, 65 insertions, 2 deletions
diff --git a/sys/dev/cardbus/cardbus_cis.c b/sys/dev/cardbus/cardbus_cis.c
index 20b0d33..7c7712a 100644
--- a/sys/dev/cardbus/cardbus_cis.c
+++ b/sys/dev/cardbus/cardbus_cis.c
@@ -211,6 +211,7 @@ DECODE_PROTOTYPE(linktarget)
DECODE_PROTOTYPE(vers_1)
{
int i;
+
printf("Product version: %d.%d\n", tupledata[0], tupledata[1]);
printf("Product name: ");
for (i = 2; i < len; i++) {
@@ -227,8 +228,9 @@ DECODE_PROTOTYPE(vers_1)
DECODE_PROTOTYPE(funcid)
{
- int i;
+ struct cardbus_devinfo *dinfo = device_get_ivars(child);
int numnames = sizeof(funcnames) / sizeof(funcnames[0]);
+ int i;
printf("Functions: ");
for (i = 0; i < len; i++) {
@@ -239,27 +241,88 @@ DECODE_PROTOTYPE(funcid)
if (i < len-1)
printf(", ");
}
+
+ if (len > 0)
+ dinfo->funcid = tupledata[0]; /* use first in list */
printf("\n");
return (0);
}
DECODE_PROTOTYPE(manfid)
{
+ struct cardbus_devinfo *dinfo = device_get_ivars(child);
int i;
+
printf("Manufacturer ID: ");
for (i = 0; i < len; i++)
printf("%02x", tupledata[i]);
printf("\n");
+
+ if (len == 5) {
+ dinfo->mfrid = tupledata[1] | (tupledata[2]<<8);
+ dinfo->prodid = tupledata[3] | (tupledata[4]<<8);
+ }
return (0);
}
DECODE_PROTOTYPE(funce)
{
- int i;
+ struct cardbus_devinfo *dinfo = device_get_ivars(child);
+ int type, i;
+
printf("Function Extension: ");
for (i = 0; i < len; i++)
printf("%02x", tupledata[i]);
printf("\n");
+ if (len < 2) /* too short */
+ return (0);
+ type = tupledata[0]; /* XXX <32 always? */
+ switch (dinfo->funcid) {
+ case TPL_FUNC_SERIAL:
+ if (type == TPL_FUNCE_SER_UART) { /* NB: len known > 1 */
+ dinfo->funce.sio.type = tupledata[1] & 0x1f;
+ }
+ dinfo->fepresent |= 1<<type;
+ break;
+ case TPL_FUNC_LAN:
+ switch (type) {
+ case TPL_FUNCE_LAN_TECH:
+ dinfo->funce.lan.tech = tupledata[1]; /* XXX mask? */
+ break;
+#if 0
+ case TPL_FUNCE_LAN_SPEED:
+ for (i = 0; i < 3; i++) {
+ if (dinfo->funce.lan.speed[i] == 0) {
+ if (len > 4) {
+ dinfo->funce.lan.speed[i] =
+ ...;
+ }
+ break;
+ }
+ }
+ break;
+#endif
+ case TPL_FUNCE_LAN_MEDIA:
+ for (i = 0; i < 4 && dinfo->funce.lan.media[i]; i++) {
+ if (dinfo->funce.lan.media[i] == 0) {
+ /* NB: len known > 1 */
+ dinfo->funce.lan.media[i] =
+ tupledata[1]; /*XXX? mask */
+ break;
+ }
+ }
+ break;
+ case TPL_FUNCE_LAN_NID:
+ if (len > 6)
+ bcopy(&tupledata[1], dinfo->funce.lan.nid, 6);
+ break;
+ case TPL_FUNCE_LAN_CONN:
+ dinfo->funce.lan.contype = tupledata[1];/*XXX mask? */
+ break;
+ }
+ dinfo->fepresent |= 1<<type;
+ break;
+ }
return (0);
}
OpenPOWER on IntegriCloud