2 * SPDX-License-Identifier: BSD-3-Clause
4 * Copyright (c) 1995 Andrew McRae. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
33 * Code cleanup, bug-fix and extension
34 * by Tatsumi Hosokawa <hosokawa@mt.cs.keio.ac.jp>
42 #include <sys/ioctl.h>
47 static void dump_config_map(struct tuple *tp);
48 static void dump_cis_config(struct tuple *tp);
49 static void dump_other_cond(u_char *p, int len);
50 static void dump_device_desc(u_char *p, int len, const char *type);
51 static void dump_info_v1(u_char *p, int len);
52 static void dump_longlink_mfc(u_char *p, int len);
53 static void dump_bar(u_char *p, int len);
54 static void dump_device_geo(u_char *p, int len);
55 static void dump_func_id(u_char *p);
56 static void dump_serial_ext(u_char *p, int len);
57 static void dump_disk_ext(u_char *p, int len);
58 static void dump_network_ext(u_char *p, int len);
59 static void dump_info_v2(u_char *p, int len);
60 static void dump_org(u_char *p, int len);
63 dumpcis(struct tuple_list *tlist)
66 struct tuple_list *tl;
67 int count = 0, sz, ad, i;
71 for (tl = tlist; tl; tl = tl->next)
72 for (tp = tl->tuples; tp; tp = tp->next) {
73 printf("Tuple #%d, code = 0x%x (%s), length = %d\n",
74 ++count, tp->code, tuple_name(tp->code), tp->length);
79 printf(" %03x: ", ad);
80 for (i = 0; i < ((sz < 16) ? sz : 16); i++)
81 printf(" %02x", p[i]);
90 case CIS_MEM_COMMON: /* 0x01 */
91 dump_device_desc(tp->data, tp->length, "Common");
93 case CIS_CONF_MAP_CB: /* 0x04 */
96 case CIS_CONFIG_CB: /* 0x05 */
99 case CIS_LONGLINK_MFC: /* 0x06 */
100 dump_longlink_mfc(tp->data, tp->length);
102 case CIS_BAR: /* 0x07 */
103 dump_bar(tp->data, tp->length);
105 case CIS_CHECKSUM: /* 0x10 */
106 printf("\tChecksum from offset %d, length %d, value is 0x%x\n",
111 case CIS_LONGLINK_A: /* 0x11 */
112 printf("\tLong link to attribute memory, address 0x%x\n",
115 case CIS_LONGLINK_C: /* 0x12 */
116 printf("\tLong link to common memory, address 0x%x\n",
119 case CIS_INFO_V1: /* 0x15 */
120 dump_info_v1(tp->data, tp->length);
122 case CIS_ALTSTR: /* 0x16 */
124 case CIS_MEM_ATTR: /* 0x17 */
125 dump_device_desc(tp->data, tp->length, "Attribute");
127 case CIS_JEDEC_C: /* 0x18 */
128 case CIS_JEDEC_A: /* 0x19 */
130 case CIS_CONF_MAP: /* 0x1A */
133 case CIS_CONFIG: /* 0x1B */
136 case CIS_DEVICE_OC: /* 0x1C */
137 case CIS_DEVICE_OA: /* 0x1D */
138 dump_other_cond(tp->data, tp->length);
140 case CIS_DEVICEGEO: /* 0x1E */
141 case CIS_DEVICEGEO_A: /* 0x1F */
142 dump_device_geo(tp->data, tp->length);
144 case CIS_MANUF_ID: /* 0x20 */
145 printf("\tPCMCIA ID = 0x%x, OEM ID = 0x%x\n",
147 tpl16(tp->data + 2));
149 case CIS_FUNC_ID: /* 0x21 */
151 dump_func_id(tp->data);
153 case CIS_FUNC_EXT: /* 0x22 */
156 dump_serial_ext(tp->data, tp->length);
159 dump_disk_ext(tp->data, tp->length);
162 dump_network_ext(tp->data, tp->length);
166 case CIS_VERS_2: /* 0x40 */
167 dump_info_v2(tp->data, tp->length);
169 case CIS_ORG: /* 0x46 */
170 dump_org(tp->data, tp->length);
177 * CIS_CONF_MAP : Dump configuration map tuple.
178 * CIS_CONF_MAP_CB: Dump configuration map for CardBus
181 dump_config_map(struct tuple *tp)
183 u_char *p = tp->data, x;
184 unsigned int rlen, mlen = 0, i;
186 rlen = (p[0] & 3) + 1;
187 if (tp->code == CIS_CONF_MAP)
188 mlen = ((p[0] >> 2) & 3) + 1;
189 if (tp->length < rlen + mlen + 2) {
190 printf("\tWrong length for configuration map tuple\n");
193 printf("\tReg len = %d, config register addr = 0x%x, last config = 0x%x\n",
194 rlen, parse_num(rlen | 0x10, p + 2, &p, 0), p[1]);
196 printf("\tRegisters: ");
197 for (i = 0; i < mlen; i++, p++) {
198 for (x = 0x1; x; x <<= 1)
199 printf("%c", x & *p ? 'X' : '-');
203 i = tp->length - (rlen + mlen + 2);
207 printf("%d bytes in subtuples", i);
214 * Dump power descriptor.
215 * call from dump_cis_config()
218 print_pwr_desc(u_char *p)
223 static const char *pname[] =
224 {"Nominal operating supply voltage",
225 "Minimum operating supply voltage",
226 "Maximum operating supply voltage",
227 "Continuous supply current",
228 "Max current average over 1 second",
229 "Max current average over 10 ms",
230 "Power down supply current",
233 static const char *vexp[] =
234 {"10uV", "100uV", "1mV", "10mV", "100mV", "1V", "10V", "100V"};
235 static const char *cexp[] =
236 {"10nA", "1uA", "10uA", "100uA", "1mA", "10mA", "100mA", "1A"};
237 static const char *mant[] =
238 {"1", "1.2", "1.3", "1.5", "2", "2.5", "3", "3.5", "4", "4.5",
239 "5", "5.5", "6", "7", "8", "9"};
243 for (i = 0; i < 8; i++)
244 if (mask & (1 << i)) {
248 printf("\t\t%s: ", pname[i]);
250 mant[(*p >> 3) & 0xF],
255 printf(", ext = 0x%x", *p);
264 * print_ext_speed - Print extended speed.
265 * call from dump_cis_config(), dump_device_desc()
268 print_ext_speed(u_char x, int scale)
270 static const char *mant[] =
271 {"Reserved", "1.0", "1.2", "1.3", "1.5", "2.0", "2.5", "3.0",
272 "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", "7.0", "8.0"};
273 static const char *exp[] =
274 {"1 ns", "10 ns", "100 ns", "1 us", "10 us", "100 us",
276 static const char *scale_name[] =
277 {"None", "10", "100", "1,000", "10,000", "100,000",
278 "1,000,000", "10,000,000"};
280 printf("Speed = %s x %s", mant[(x >> 3) & 0xF], exp[x & 7]);
282 printf(", scaled by %s", scale_name[scale & 7]);
286 * Print variable length value.
287 * call from print_io_map(), print_mem_map()
290 print_num(int sz, const char *fmt, u_char *p, int ofs)
298 printf(fmt, *p + ofs);
302 printf(fmt, tpl16(p) + ofs);
305 printf(fmt, tpl24(p) + ofs);
309 printf(fmt, tpl32(p) + ofs);
312 errx(1, "print_num(0x%x): Illegal arguments", sz);
317 * Print I/O mapping sub-tuple.
318 * call from dump_cis_config()
321 print_io_map(u_char *p, u_char *q)
328 if (CIS_IO_ADDR(*p)) /* I/O address line */
329 printf("\tCard decodes %d address lines",
332 printf("\tCard provides address decode");
335 switch (*p & (CIS_IO_8BIT | CIS_IO_16BIT)) {
337 printf(", 8 Bit I/O only");
340 printf(", limited 8/16 Bit I/O");
342 case (CIS_IO_8BIT | CIS_IO_16BIT):
343 printf(", full 8/16 Bit I/O");
348 /* I/O block sub-tuple exist */
349 if (*p++ & CIS_IO_RANGE) {
353 /* calculate byte length */
354 j = CIS_IO_ADSZ(c) + CIS_IO_BLKSZ(c);
355 if (CIS_IO_ADSZ(c) == 3)
357 if (CIS_IO_BLKSZ(c) == 3)
359 /* number of I/O block sub-tuples */
360 for (i = 0; i <= CIS_IO_BLKS(c); i++) {
363 printf("\t\tI/O address # %d: ", i + 1);
364 /* start block address */
365 p += print_num(CIS_IO_ADSZ(c),
366 "block start = 0x%x", p, 0);
368 p += print_num(CIS_IO_BLKSZ(c),
369 " block length = 0x%x", p, 1);
376 printf("\tWrong length for I/O mapping sub-tuple\n");
381 * Print IRQ sub-tuple.
382 * call from dump_cis_config()
385 print_irq_map(u_char *p, u_char *q)
392 printf("\t\tIRQ modes:");
394 if (*p & CIS_IRQ_LEVEL) { /* Level triggered interrupts */
398 if (*p & CIS_IRQ_PULSE) { /* Pulse triggered requests */
399 printf("%c Pulse", c);
402 if (*p & CIS_IRQ_SHARING) /* Interrupt sharing */
403 printf("%c Shared", c);
406 /* IRQ mask values exist */
407 if (*p & CIS_IRQ_MASK) {
410 i = tpl16(p + 1); /* IRQ mask */
411 printf("\t\tIRQs: ");
420 for (j = 0; j < 16; j++)
426 printf("\t\tIRQ level = %d\n", CIS_IRQ_IRQN(*p));
432 printf("\tWrong length for IRQ sub-tuple\n");
437 * Print memory map sub-tuple.
438 * call from dump_cis_config()
441 print_mem_map(u_char feat, u_char *p, u_char *q)
446 switch (CIS_FEAT_MEMORY(feat)) {
448 case CIS_FEAT_MEM_NONE: /* No memory block */
450 case CIS_FEAT_MEM_LEN: /* Specify memory length */
453 printf("\tMemory space length = 0x%x\n", tpl16(p));
456 case CIS_FEAT_MEM_ADDR: /* Memory address and length */
459 printf("\tMemory space address = 0x%x, length = 0x%x\n",
460 tpl16(p + 2), tpl16(p));
463 case CIS_FEAT_MEM_WIN: /* Memory descriptors. */
467 /* calculate byte length */
468 j = CIS_MEM_LENSZ(c) + CIS_MEM_ADDRSZ(c);
469 if (c & CIS_MEM_HOST)
470 j += CIS_MEM_ADDRSZ(c);
471 /* number of memory block */
472 for (i = 0; i < CIS_MEM_WINS(c); i++) {
475 printf("\tMemory descriptor %d\n\t\t", i + 1);
477 p += print_num(CIS_MEM_LENSZ(c) | 0x10,
478 " blk length = 0x%x00", p, 0);
480 p += print_num(CIS_MEM_ADDRSZ(c) | 0x10,
481 " card addr = 0x%x00", p, 0);
482 if (c & CIS_MEM_HOST) /* Host address value exist */
483 p += print_num(CIS_MEM_ADDRSZ(c) | 0x10,
484 " host addr = 0x%x00", p, 0);
492 printf("\tWrong length for memory mapping sub-tuple\n");
497 * CIS_CONFIG : Dump a config entry.
498 * CIS_CONFIG_CB: Dump a configuration entry for CardBus
501 dump_cis_config(struct tuple *tp)
509 printf("\tConfig index = 0x%x%s\n", *p & 0x3F,
510 *p & 0x40 ? "(default)" : "");
512 /* Interface byte exists */
513 if (tp->code == CIS_CONFIG && (*p & 0x80)) {
515 printf("\tInterface byte = 0x%x ", *p);
516 switch (*p & 0xF) { /* Interface type */
518 printf("(reserved)");
535 if (*p & 0x10) { /* Battery voltage detect */
536 printf(" BVD1/2 active");
539 if (*p & 0x20) { /* Write protect active */
540 printf("%c card WP active", c); /* Write protect */
543 if (*p & 0x40) { /* RdyBsy active bit */
544 printf("%c +RDY/-BSY active", c);
547 if (*p & 0x80) /* Wait signal required */
548 printf("%c wait signal supported", c);
556 /* Power structure sub-tuple */
557 switch (CIS_FEAT_POWER(feat)) { /* Power sub-tuple(s) exists */
561 printf("\tVcc pwr:\n");
562 p += print_pwr_desc(p);
565 printf("\tVcc pwr:\n");
566 p += print_pwr_desc(p);
567 printf("\tVpp pwr:\n");
568 p += print_pwr_desc(p);
571 printf("\tVcc pwr:\n");
572 p += print_pwr_desc(p);
573 printf("\tVpp1 pwr:\n");
574 p += print_pwr_desc(p);
575 printf("\tVpp2 pwr:\n");
576 p += print_pwr_desc(p);
580 /* Timing sub-tuple */
581 if (tp->code == CIS_CONFIG &&
582 (feat & CIS_FEAT_TIMING)) { /* Timing sub-tuple exists */
584 j = CIS_WAIT_SCALE(i);
586 printf("\tWait scale ");
587 print_ext_speed(*p++, j);
590 j = CIS_READY_SCALE(i);
592 printf("\tRDY/BSY scale ");
593 print_ext_speed(*p++, j);
596 j = CIS_RESERVED_SCALE(i);
598 printf("\tExternal scale ");
599 print_ext_speed(*p++, j);
604 /* I/O mapping sub-tuple */
605 if (feat & CIS_FEAT_I_O) { /* I/O space sub-tuple exists */
606 if (tp->code == CIS_CONFIG)
607 p = print_io_map(p, q);
608 else { /* CIS_CONFIG_CB */
609 printf("\tI/O base:");
610 for (i = 0; i < 8; i++)
618 /* IRQ descriptor sub-tuple */
619 if (feat & CIS_FEAT_IRQ) /* IRQ sub-tuple exists */
620 p = print_irq_map(p, q);
622 /* Memory map sub-tuple */
623 if (CIS_FEAT_MEMORY(feat)) { /* Memory space sub-tuple(s) exists */
624 if (tp->code == CIS_CONFIG)
625 p = print_mem_map(feat, p, q);
626 else { /* CIS_CONFIG_CB */
627 printf("\tMemory base:");
628 for (i = 0; i < 8; i++)
637 if (feat & CIS_FEAT_MISC) { /* Miscellaneous sub-tuple exists */
638 if (tp->code == CIS_CONFIG) {
639 printf("\tMax twin cards = %d\n", *p & 7);
640 printf("\tMisc attr:%s%s%s",
641 (*p & 8) ? " (Audio-BVD2)" : "",
642 (*p & 0x10) ? " (Read-only)" : "",
643 (*p & 0x20) ? " (Power down supported)" : "");
645 printf(" (Ext byte = 0x%x)", *p);
650 else { /* CIS_CONFIG_CB */
651 printf("\tMisc attr:");
652 printf("%s%s%s%s%s%s%s",
653 (*p & 1) ? " (Master)" : "",
654 (*p & 2) ? " (Invalidate)" : "",
655 (*p & 4) ? " (VGA palette)" : "",
656 (*p & 8) ? " (Parity)" : "",
657 (*p & 0x10) ? " (Wait)" : "",
658 (*p & 0x20) ? " (Serr)" : "",
659 (*p & 0x40) ? " (Fast back)" : "");
662 (*p & 1) ? " (Binary audio)" : "",
663 (*p & 2) ? " (pwm audio)" : "");
672 * CIS_DEVICE_OC, CIS_DEVICE_OA:
673 * Dump other conditions for common/attribute memory
676 dump_other_cond(u_char *p, int len)
678 if (p[0] && len > 0) {
683 printf(" (3V card)");
685 printf(" (Extension bytes follow)");
691 * CIS_MEM_COMMON, CIS_MEM_ATTR:
692 * Common / Attribute memory descripter
695 dump_device_desc(u_char *p, int len, const char *type)
697 static const char *un_name[] =
698 {"512b", "2Kb", "8Kb", "32Kb", "128Kb", "512Kb", "2Mb", "reserved"};
699 static const char *speed[] =
700 {"No speed", "250nS", "200nS", "150nS",
701 "100nS", "Reserved", "Reserved"};
702 static const char *dev[] =
703 {"No device", "Mask ROM", "OTPROM", "UV EPROM",
704 "EEPROM", "FLASH EEPROM", "SRAM", "DRAM",
705 "Reserved", "Reserved", "Reserved", "Reserved",
706 "Reserved", "Function specific", "Extended",
710 while (*p != 0xFF && len > 0) {
716 printf("\t%s memory device information:\n", type);
717 printf("\t\tDevice number %d, type %s, WPS = %s\n",
718 count, dev[x >> 4], (x & 0x8) ? "ON" : "OFF");
723 print_ext_speed(*p, 0);
731 printf("\t\tSpeed = %s", speed[x & 7]);
732 printf(", Memory block size = %s, %d units\n",
733 un_name[*p & 7], (*p >> 3) + 1);
739 * CIS_INFO_V1: Print version-1 info
742 dump_info_v1(u_char *p, int len)
745 printf("\tWrong length for version-1 info tuple\n");
748 printf("\tVersion = %d.%d", p[0], p[1]);
751 if (len > 1 && *p != 0xff) {
752 printf(", Manuf = [%s]", p);
753 while (*p++ && --len > 0);
755 if (len > 1 && *p != 0xff) {
756 printf(", card vers = [%s]", p);
757 while (*p++ && --len > 0);
759 printf("\n\tWrong length for version-1 info tuple\n");
763 if (len > 1 && *p != 0xff) {
764 printf("\tAddit. info = [%.*s]", len, p);
765 while (*p++ && --len > 0);
766 if (len > 1 && *p != 0xff)
767 printf(",[%.*s]", len, p);
773 * CIS_FUNC_ID: Functional ID
776 dump_func_id(u_char *p)
778 static const char *id[] = {
779 "Multifunction card",
785 "Network/LAN adapter",
792 (*p <= 9) ? id[*p] : "Unknown function",
793 (p[1] & 1) ? " - POST initialize" : "",
794 (p[1] & 2) ? " - Card has ROM" : "");
798 * CIS_FUNC_EXT: Dump functional extension tuple.
799 * (Serial port/modem)
802 dump_serial_ext(u_char *p, int len)
804 static const char *type[] = {
805 "", "Modem", "Data", "Fax", "Voice", "Data modem",
806 "Fax/modem", "Voice", " (Data)", " (Fax)", " (Voice)"
816 printf("\tSerial interface extension:%s\n", type[*p]);
819 switch (p[1] & 0x1F) {
821 printf("\t\tUnknown device");
824 printf("\t\t8250 UART");
827 printf("\t\t16450 UART");
830 printf("\t\t16550 UART");
833 printf(", Parity - %s%s%s%s\n",
834 (p[2] & 1) ? "Space," : "",
835 (p[2] & 2) ? "Mark," : "",
836 (p[2] & 4) ? "Odd," : "",
837 (p[2] & 8) ? "Even" : "");
838 printf("\t\tData bit - %s%s%s%s Stop bit - %s%s%s\n",
839 (p[3] & 1) ? "5bit," : "",
840 (p[3] & 2) ? "6bit," : "",
841 (p[3] & 4) ? "7bit," : "",
842 (p[3] & 8) ? "8bit," : "",
843 (p[3] & 0x10) ? "1bit," : "",
844 (p[3] & 0x20) ? "1.5bit," : "",
845 (p[3] & 0x40) ? "2bit" : "");
851 printf("\t%s interface capabilities:\n", type[*p]);
856 printf("\tData modem services available:\n");
858 case 0x13: /* Fax1 */
859 case 0x23: /* Fax2 */
860 case 0x33: /* Fax3 */
861 printf("\tFax%d/modem services available:\n", *p >> 4);
863 case 0x84: /* Voice */
864 printf("\tVoice services available:\n");
867 printf("\tWrong length for serial extension tuple\n");
873 * CIS_FUNC_EXT: Dump functional extension tuple.
877 dump_disk_ext(u_char *p, int len)
882 case 1: /* IDE interface */
885 printf("\tDisk interface: %s\n",
886 (p[1] & 1) ? "IDE" : "Undefined");
892 printf("\tDisk features: %s, %s%s\n",
893 (p[1] & 0x04) ? "Silicon" : "Rotating",
894 (p[1] & 0x08) ? "Unique, " : "",
895 (p[1] & 0x10) ? "Dual" : "Single");
897 printf("\t\t%s%s%s%s%s%s%s\n",
898 (p[2] & 0x01) ? "Sleep, " : "",
899 (p[2] & 0x02) ? "Standby, " : "",
900 (p[2] & 0x04) ? "Idle, " : "",
901 (p[2] & 0x08) ? "Low power, " : "",
902 (p[2] & 0x10) ? "Reg inhibit, " : "",
903 (p[2] & 0x20) ? "Index, " : "",
904 (p[2] & 0x40) ? "Iois16" : "");
907 printf("\tWrong length for fixed disk extension tuple\n");
916 printf("%u bits/sec", i);
917 else if (i < 1000000)
918 printf("%u kb/sec", i / 1000);
920 printf("%u Mb/sec", i / 1000000);
924 * CIS_FUNC_EXT: Dump functional extension tuple.
925 * (Network/LAN adapter)
928 dump_network_ext(u_char *p, int len)
930 static const char *tech[] = {
931 "Undefined", "ARCnet", "Ethernet", "Token ring",
932 "Localtalk", "FDDI/CDDI", "ATM", "Wireless"
934 static const char *media[] = {
935 "Undefined", "UTP", "STP", "Thin coax",
936 "THICK coax", "Fiber", "900 MHz", "2.4 GHz",
937 "5.4 GHz", "Diffuse Infrared", "Point to point Infrared"
944 case 1: /* Network technology */
947 printf("\tNetwork technology: %s\n", tech[p[1] & 7]);
949 case 2: /* Network speed */
952 printf("\tNetwork speed: ");
953 print_speed(tpl32(p + 1));
956 case 3: /* Network media */
961 printf("\tNetwork media: %s\n", media[i]);
963 case 4: /* Node ID */
964 if (len <= 2 || len < p[1] + 2)
966 printf("\tNetwork node ID:");
967 for (i = 0; i < p[1]; i++)
968 printf(" %02x", p[i + 2]);
971 case 5: /* Connector type */
974 printf("\tNetwork connector: %s connector standard\n",
975 (p[1] == 0) ? "open" : "closed");
978 printf("\tWrong length for network extension tuple\n");
984 * CIS_LONGLINK_MFC: Long link to next chain for Multi function card
987 dump_longlink_mfc(u_char *p, int len)
992 for (i = 0; i < n; i++) {
994 printf("\tWrong length for long link MFC tuple\n");
997 printf("\tFunction %d: %s memory, address 0x%x\n",
998 i, (*p ? "common" : "attribute"), tpl32(p + 1));
1005 * CIS_DEVICEGEO, CIS_DEVICEGEO_A:
1006 * Geometry info for common/attribute memory
1009 dump_device_geo(u_char *p, int len)
1012 printf("\twidth = %d, erase = 0x%x, read = 0x%x, write = 0x%x\n"
1013 "\t\tpartition = 0x%x, interleave = 0x%x\n",
1014 p[0], 1 << (p[1] - 1),
1015 1 << (p[2] - 1), 1 << (p[3] - 1),
1016 1 << (p[4] - 1), 1 << (p[5] - 1));
1022 * CIS_INFO_V2: Print version-2 info
1025 dump_info_v2(u_char *p, int len)
1028 printf("\tWrong length for version-2 info tuple\n");
1031 printf("\tVersion = 0x%x, compliance = 0x%x, dindex = 0x%x\n",
1032 p[0], p[1], tpl16(p + 2));
1033 printf("\tVspec8 = 0x%x, vspec9 = 0x%x, nhdr = %d\n",
1037 if (len <= 1 || *p == 0xff)
1039 printf("\tVendor = [%.*s]", len, p);
1040 while (*p++ && --len > 0);
1041 if (len > 1 && *p != 0xff)
1042 printf(", info = [%.*s]", len, p);
1047 * CIS_ORG: Organization
1050 dump_org(u_char *p, int len)
1053 printf("\tWrong length for organization tuple\n");
1058 printf("\tFilesystem");
1061 printf("\tApp specific");
1068 printf("\tReserved");
1070 printf("\tVendor specific");
1073 printf(" [%.*s]\n", len - 1, p + 1);
1080 printf("%ubits", i);
1081 else if (i < 1024*1024)
1082 printf("%ukb", i / 1024);
1084 printf("%uMb", i / (1024*1024));
1088 * CIS_BAR: Base address register for CardBus
1091 dump_bar(u_char *p, int len)
1094 printf("\tWrong length for BAR tuple\n");
1097 printf("\tBAR %d: size = ", *p & 7);
1098 print_size(tpl32(p + 2));
1099 printf(", %s%s%s%s\n",
1100 (*p & 0x10) ? "I/O" : "Memory",
1101 (*p & 0x20) ? ", Prefetch" : "",
1102 (*p & 0x40) ? ", Cacheable" : "",
1103 (*p & 0x80) ? ", <1Mb" : "");