2 * Copyright (c) 1995 Andrew McRae. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 static const char rcsid[] =
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;
187 rlen = (p[0] & 3) + 1;
188 if (tp->code == CIS_CONF_MAP)
189 mlen = ((p[0] >> 2) & 3) + 1;
190 if (tp->length < rlen + mlen + 2) {
191 printf("\tWrong length for configuration map tuple\n");
194 printf("\tReg len = %d, config register addr = 0x%x, last config = 0x%x\n",
195 rlen, parse_num(rlen | 0x10, p + 2, &p, 0), p[1]);
197 printf("\tRegisters: ");
198 for (i = 0; i < mlen; i++, p++) {
199 for (x = 0x1; x; x <<= 1)
200 printf("%c", x & *p ? 'X' : '-');
204 i = tp->length - (rlen + mlen + 2);
208 printf("%d bytes in subtuples", i);
215 * Dump power descriptor.
216 * call from dump_cis_config()
219 print_pwr_desc(u_char *p)
224 static const char *pname[] =
225 {"Nominal operating supply voltage",
226 "Minimum operating supply voltage",
227 "Maximum operating supply voltage",
228 "Continuous supply current",
229 "Max current average over 1 second",
230 "Max current average over 10 ms",
231 "Power down supply current",
234 static const char *vexp[] =
235 {"10uV", "100uV", "1mV", "10mV", "100mV", "1V", "10V", "100V"};
236 static const char *cexp[] =
237 {"10nA", "1uA", "10uA", "100uA", "1mA", "10mA", "100mA", "1A"};
238 static const char *mant[] =
239 {"1", "1.2", "1.3", "1.5", "2", "2.5", "3", "3.5", "4", "4.5",
240 "5", "5.5", "6", "7", "8", "9"};
244 for (i = 0; i < 8; i++)
245 if (mask & (1 << i)) {
249 printf("\t\t%s: ", pname[i]);
251 mant[(*p >> 3) & 0xF],
256 printf(", ext = 0x%x", *p);
265 * print_ext_speed - Print extended speed.
266 * call from dump_cis_config(), dump_device_desc()
269 print_ext_speed(u_char x, int scale)
271 static const char *mant[] =
272 {"Reserved", "1.0", "1.2", "1.3", "1.5", "2.0", "2.5", "3.0",
273 "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", "7.0", "8.0"};
274 static const char *exp[] =
275 {"1 ns", "10 ns", "100 ns", "1 us", "10 us", "100 us",
277 static const char *scale_name[] =
278 {"None", "10", "100", "1,000", "10,000", "100,000",
279 "1,000,000", "10,000,000"};
281 printf("Speed = %s x %s", mant[(x >> 3) & 0xF], exp[x & 7]);
283 printf(", scaled by %s", scale_name[scale & 7]);
287 * Print variable length value.
288 * call from print_io_map(), print_mem_map()
291 print_num(int sz, const char *fmt, u_char *p, int ofs)
299 printf(fmt, *p + ofs);
303 printf(fmt, tpl16(p) + ofs);
306 printf(fmt, tpl24(p) + ofs);
310 printf(fmt, tpl32(p) + ofs);
313 errx(1, "print_num(0x%x): Illegal arguments", sz);
318 * Print I/O mapping sub-tuple.
319 * call from dump_cis_config()
322 print_io_map(u_char *p, u_char *q)
329 if (CIS_IO_ADDR(*p)) /* I/O address line */
330 printf("\tCard decodes %d address lines",
333 printf("\tCard provides address decode");
336 switch (*p & (CIS_IO_8BIT | CIS_IO_16BIT)) {
338 printf(", 8 Bit I/O only");
341 printf(", limited 8/16 Bit I/O");
343 case (CIS_IO_8BIT | CIS_IO_16BIT):
344 printf(", full 8/16 Bit I/O");
349 /* I/O block sub-tuple exist */
350 if (*p++ & CIS_IO_RANGE) {
354 /* calculate byte length */
355 j = CIS_IO_ADSZ(c) + CIS_IO_BLKSZ(c);
356 if (CIS_IO_ADSZ(c) == 3)
358 if (CIS_IO_BLKSZ(c) == 3)
360 /* number of I/O block sub-tuples */
361 for (i = 0; i <= CIS_IO_BLKS(c); i++) {
364 printf("\t\tI/O address # %d: ", i + 1);
365 /* start block address */
366 p += print_num(CIS_IO_ADSZ(c),
367 "block start = 0x%x", p, 0);
369 p += print_num(CIS_IO_BLKSZ(c),
370 " block length = 0x%x", p, 1);
377 printf("\tWrong length for I/O mapping sub-tuple\n");
382 * Print IRQ sub-tuple.
383 * call from dump_cis_config()
386 print_irq_map(u_char *p, u_char *q)
393 printf("\t\tIRQ modes:");
395 if (*p & CIS_IRQ_LEVEL) { /* Level triggered interrupts */
399 if (*p & CIS_IRQ_PULSE) { /* Pulse triggered requests */
400 printf("%c Pulse", c);
403 if (*p & CIS_IRQ_SHARING) /* Interrupt sharing */
404 printf("%c Shared", c);
407 /* IRQ mask values exist */
408 if (*p & CIS_IRQ_MASK) {
411 i = tpl16(p + 1); /* IRQ mask */
412 printf("\t\tIRQs: ");
421 for (j = 0; j < 16; j++)
427 printf("\t\tIRQ level = %d\n", CIS_IRQ_IRQN(*p));
433 printf("\tWrong length for IRQ sub-tuple\n");
438 * Print memory map sub-tuple.
439 * call from dump_cis_config()
442 print_mem_map(u_char feat, u_char *p, u_char *q)
447 switch (CIS_FEAT_MEMORY(feat)) {
449 case CIS_FEAT_MEM_NONE: /* No memory block */
451 case CIS_FEAT_MEM_LEN: /* Specify memory length */
454 printf("\tMemory space length = 0x%x\n", tpl16(p));
457 case CIS_FEAT_MEM_ADDR: /* Memory address and length */
460 printf("\tMemory space address = 0x%x, length = 0x%x\n",
461 tpl16(p + 2), tpl16(p));
464 case CIS_FEAT_MEM_WIN: /* Memory descriptors. */
468 /* calculate byte length */
469 j = CIS_MEM_LENSZ(c) + CIS_MEM_ADDRSZ(c);
470 if (c & CIS_MEM_HOST)
471 j += CIS_MEM_ADDRSZ(c);
472 /* number of memory block */
473 for (i = 0; i < CIS_MEM_WINS(c); i++) {
476 printf("\tMemory descriptor %d\n\t\t", i + 1);
478 p += print_num(CIS_MEM_LENSZ(c) | 0x10,
479 " blk length = 0x%x00", p, 0);
481 p += print_num(CIS_MEM_ADDRSZ(c) | 0x10,
482 " card addr = 0x%x00", p, 0);
483 if (c & CIS_MEM_HOST) /* Host address value exist */
484 p += print_num(CIS_MEM_ADDRSZ(c) | 0x10,
485 " host addr = 0x%x00", p, 0);
493 printf("\tWrong length for memory mapping sub-tuple\n");
498 * CIS_CONFIG : Dump a config entry.
499 * CIS_CONFIG_CB: Dump a configuration entry for CardBus
502 dump_cis_config(struct tuple *tp)
510 printf("\tConfig index = 0x%x%s\n", *p & 0x3F,
511 *p & 0x40 ? "(default)" : "");
513 /* Interface byte exists */
514 if (tp->code == CIS_CONFIG && (*p & 0x80)) {
516 printf("\tInterface byte = 0x%x ", *p);
517 switch (*p & 0xF) { /* Interface type */
519 printf("(reserved)");
536 if (*p & 0x10) { /* Battery voltage detect */
537 printf(" BVD1/2 active");
540 if (*p & 0x20) { /* Write protect active */
541 printf("%c card WP active", c); /* Write protect */
544 if (*p & 0x40) { /* RdyBsy active bit */
545 printf("%c +RDY/-BSY active", c);
548 if (*p & 0x80) /* Wait signal required */
549 printf("%c wait signal supported", c);
557 /* Power structure sub-tuple */
558 switch (CIS_FEAT_POWER(feat)) { /* Power sub-tuple(s) exists */
562 printf("\tVcc pwr:\n");
563 p += print_pwr_desc(p);
566 printf("\tVcc pwr:\n");
567 p += print_pwr_desc(p);
568 printf("\tVpp pwr:\n");
569 p += print_pwr_desc(p);
572 printf("\tVcc pwr:\n");
573 p += print_pwr_desc(p);
574 printf("\tVpp1 pwr:\n");
575 p += print_pwr_desc(p);
576 printf("\tVpp2 pwr:\n");
577 p += print_pwr_desc(p);
581 /* Timing sub-tuple */
582 if (tp->code == CIS_CONFIG &&
583 (feat & CIS_FEAT_TIMING)) { /* Timing sub-tuple exists */
585 j = CIS_WAIT_SCALE(i);
587 printf("\tWait scale ");
588 print_ext_speed(*p++, j);
591 j = CIS_READY_SCALE(i);
593 printf("\tRDY/BSY scale ");
594 print_ext_speed(*p++, j);
597 j = CIS_RESERVED_SCALE(i);
599 printf("\tExternal scale ");
600 print_ext_speed(*p++, j);
605 /* I/O mapping sub-tuple */
606 if (feat & CIS_FEAT_I_O) { /* I/O space sub-tuple exists */
607 if (tp->code == CIS_CONFIG)
608 p = print_io_map(p, q);
609 else { /* CIS_CONFIG_CB */
610 printf("\tI/O base:");
611 for (i = 0; i < 8; i++)
619 /* IRQ descriptor sub-tuple */
620 if (feat & CIS_FEAT_IRQ) /* IRQ sub-tuple exists */
621 p = print_irq_map(p, q);
623 /* Memory map sub-tuple */
624 if (CIS_FEAT_MEMORY(feat)) { /* Memory space sub-tuple(s) exists */
625 if (tp->code == CIS_CONFIG)
626 p = print_mem_map(feat, p, q);
627 else { /* CIS_CONFIG_CB */
628 printf("\tMemory base:");
629 for (i = 0; i < 8; i++)
638 if (feat & CIS_FEAT_MISC) { /* Miscellaneous sub-tuple exists */
639 if (tp->code == CIS_CONFIG) {
640 printf("\tMax twin cards = %d\n", *p & 7);
641 printf("\tMisc attr:%s%s%s",
642 (*p & 8) ? " (Audio-BVD2)" : "",
643 (*p & 0x10) ? " (Read-only)" : "",
644 (*p & 0x20) ? " (Power down supported)" : "");
646 printf(" (Ext byte = 0x%x)", *p);
651 else { /* CIS_CONFIG_CB */
652 printf("\tMisc attr:");
653 printf("%s%s%s%s%s%s%s",
654 (*p & 1) ? " (Master)" : "",
655 (*p & 2) ? " (Invalidate)" : "",
656 (*p & 4) ? " (VGA palette)" : "",
657 (*p & 8) ? " (Parity)" : "",
658 (*p & 0x10) ? " (Wait)" : "",
659 (*p & 0x20) ? " (Serr)" : "",
660 (*p & 0x40) ? " (Fast back)" : "");
663 (*p & 1) ? " (Binary audio)" : "",
664 (*p & 2) ? " (pwm audio)" : "");
673 * CIS_DEVICE_OC, CIS_DEVICE_OA:
674 * Dump other conditions for common/attribute memory
677 dump_other_cond(u_char *p, int len)
679 if (p[0] && len > 0) {
684 printf(" (3V card)");
686 printf(" (Extension bytes follow)");
692 * CIS_MEM_COMMON, CIS_MEM_ATTR:
693 * Common / Attribute memory descripter
696 dump_device_desc(u_char *p, int len, const char *type)
698 static const char *un_name[] =
699 {"512b", "2Kb", "8Kb", "32Kb", "128Kb", "512Kb", "2Mb", "reserved"};
700 static const char *speed[] =
701 {"No speed", "250nS", "200nS", "150nS",
702 "100nS", "Reserved", "Reserved"};
703 static const char *dev[] =
704 {"No device", "Mask ROM", "OTPROM", "UV EPROM",
705 "EEPROM", "FLASH EEPROM", "SRAM", "DRAM",
706 "Reserved", "Reserved", "Reserved", "Reserved",
707 "Reserved", "Function specific", "Extended",
711 while (*p != 0xFF && len > 0) {
717 printf("\t%s memory device information:\n", type);
718 printf("\t\tDevice number %d, type %s, WPS = %s\n",
719 count, dev[x >> 4], (x & 0x8) ? "ON" : "OFF");
724 print_ext_speed(*p, 0);
732 printf("\t\tSpeed = %s", speed[x & 7]);
733 printf(", Memory block size = %s, %d units\n",
734 un_name[*p & 7], (*p >> 3) + 1);
740 * CIS_INFO_V1: Print version-1 info
743 dump_info_v1(u_char *p, int len)
746 printf("\tWrong length for version-1 info tuple\n");
749 printf("\tVersion = %d.%d", p[0], p[1]);
752 if (len > 1 && *p != 0xff) {
753 printf(", Manuf = [%s]", p);
754 while (*p++ && --len > 0);
756 if (len > 1 && *p != 0xff) {
757 printf(", card vers = [%s]", p);
758 while (*p++ && --len > 0);
760 printf("\n\tWrong length for version-1 info tuple\n");
764 if (len > 1 && *p != 0xff) {
765 printf("\tAddit. info = [%.*s]", len, p);
766 while (*p++ && --len > 0);
767 if (len > 1 && *p != 0xff)
768 printf(",[%.*s]", len, p);
774 * CIS_FUNC_ID: Functional ID
777 dump_func_id(u_char *p)
779 static const char *id[] = {
780 "Multifunction card",
786 "Network/LAN adapter",
793 (*p <= 9) ? id[*p] : "Unknown function",
794 (p[1] & 1) ? " - POST initialize" : "",
795 (p[1] & 2) ? " - Card has ROM" : "");
799 * CIS_FUNC_EXT: Dump functional extension tuple.
800 * (Serial port/modem)
803 dump_serial_ext(u_char *p, int len)
805 static const char *type[] = {
806 "", "Modem", "Data", "Fax", "Voice", "Data modem",
807 "Fax/modem", "Voice", " (Data)", " (Fax)", " (Voice)"
817 printf("\tSerial interface extension:%s\n", type[*p]);
820 switch (p[1] & 0x1F) {
822 printf("\t\tUnknown device");
825 printf("\t\t8250 UART");
828 printf("\t\t16450 UART");
831 printf("\t\t16550 UART");
834 printf(", Parity - %s%s%s%s\n",
835 (p[2] & 1) ? "Space," : "",
836 (p[2] & 2) ? "Mark," : "",
837 (p[2] & 4) ? "Odd," : "",
838 (p[2] & 8) ? "Even" : "");
839 printf("\t\tData bit - %s%s%s%s Stop bit - %s%s%s\n",
840 (p[3] & 1) ? "5bit," : "",
841 (p[3] & 2) ? "6bit," : "",
842 (p[3] & 4) ? "7bit," : "",
843 (p[3] & 8) ? "8bit," : "",
844 (p[3] & 0x10) ? "1bit," : "",
845 (p[3] & 0x20) ? "1.5bit," : "",
846 (p[3] & 0x40) ? "2bit" : "");
852 printf("\t%s interface capabilities:\n", type[*p]);
857 printf("\tData modem services available:\n");
859 case 0x13: /* Fax1 */
860 case 0x23: /* Fax2 */
861 case 0x33: /* Fax3 */
862 printf("\tFax%d/modem services available:\n", *p >> 4);
864 case 0x84: /* Voice */
865 printf("\tVoice services available:\n");
868 printf("\tWrong length for serial extension tuple\n");
874 * CIS_FUNC_EXT: Dump functional extension tuple.
878 dump_disk_ext(u_char *p, int len)
883 case 1: /* IDE interface */
886 printf("\tDisk interface: %s\n",
887 (p[1] & 1) ? "IDE" : "Undefined");
893 printf("\tDisk features: %s, %s%s\n",
894 (p[1] & 0x04) ? "Silicon" : "Rotating",
895 (p[1] & 0x08) ? "Unique, " : "",
896 (p[1] & 0x10) ? "Dual" : "Single");
898 printf("\t\t%s%s%s%s%s%s%s\n",
899 (p[2] & 0x01) ? "Sleep, " : "",
900 (p[2] & 0x02) ? "Standby, " : "",
901 (p[2] & 0x04) ? "Idle, " : "",
902 (p[2] & 0x08) ? "Low power, " : "",
903 (p[2] & 0x10) ? "Reg inhibit, " : "",
904 (p[2] & 0x20) ? "Index, " : "",
905 (p[2] & 0x40) ? "Iois16" : "");
908 printf("\tWrong length for fixed disk extension tuple\n");
917 printf("%u bits/sec", i);
918 else if (i < 1000000)
919 printf("%u kb/sec", i / 1000);
921 printf("%u Mb/sec", i / 1000000);
925 * CIS_FUNC_EXT: Dump functional extension tuple.
926 * (Network/LAN adapter)
929 dump_network_ext(u_char *p, int len)
931 static const char *tech[] = {
932 "Undefined", "ARCnet", "Ethernet", "Token ring",
933 "Localtalk", "FDDI/CDDI", "ATM", "Wireless"
935 static const char *media[] = {
936 "Undefined", "UTP", "STP", "Thin coax",
937 "THICK coax", "Fiber", "900 MHz", "2.4 GHz",
938 "5.4 GHz", "Diffuse Infrared", "Point to point Infrared"
945 case 1: /* Network technology */
948 printf("\tNetwork technology: %s\n", tech[p[1] & 7]);
950 case 2: /* Network speed */
953 printf("\tNetwork speed: ");
954 print_speed(tpl32(p + 1));
957 case 3: /* Network media */
962 printf("\tNetwork media: %s\n", media[i]);
964 case 4: /* Node ID */
965 if (len <= 2 || len < p[1] + 2)
967 printf("\tNetwork node ID:");
968 for (i = 0; i < p[1]; i++)
969 printf(" %02x", p[i + 2]);
972 case 5: /* Connector type */
975 printf("\tNetwork connector: %s connector standard\n",
976 (p[1] == 0) ? "open" : "closed");
979 printf("\tWrong length for network extension tuple\n");
985 * CIS_LONGLINK_MFC: Long link to next chain for Multi function card
988 dump_longlink_mfc(u_char *p, int len)
993 for (i = 0; i < n; i++) {
995 printf("\tWrong length for long link MFC tuple\n");
998 printf("\tFunction %d: %s memory, address 0x%x\n",
999 i, (*p ? "common" : "attribute"), tpl32(p + 1));
1006 * CIS_DEVICEGEO, CIS_DEVICEGEO_A:
1007 * Geometry info for common/attribute memory
1010 dump_device_geo(u_char *p, int len)
1013 printf("\twidth = %d, erase = 0x%x, read = 0x%x, write = 0x%x\n"
1014 "\t\tpartition = 0x%x, interleave = 0x%x\n",
1015 p[0], 1 << (p[1] - 1),
1016 1 << (p[2] - 1), 1 << (p[3] - 1),
1017 1 << (p[4] - 1), 1 << (p[5] - 1));
1023 * CIS_INFO_V2: Print version-2 info
1026 dump_info_v2(u_char *p, int len)
1029 printf("\tWrong length for version-2 info tuple\n");
1032 printf("\tVersion = 0x%x, compliance = 0x%x, dindex = 0x%x\n",
1033 p[0], p[1], tpl16(p + 2));
1034 printf("\tVspec8 = 0x%x, vspec9 = 0x%x, nhdr = %d\n",
1038 if (len <= 1 || *p == 0xff)
1040 printf("\tVendor = [%.*s]", len, p);
1041 while (*p++ && --len > 0);
1042 if (len > 1 && *p != 0xff)
1043 printf(", info = [%.*s]", len, p);
1048 * CIS_ORG: Organization
1051 dump_org(u_char *p, int len)
1054 printf("\tWrong length for organization tuple\n");
1059 printf("\tFilesystem");
1062 printf("\tApp specific");
1069 printf("\tReserved");
1071 printf("\tVendor specific");
1074 printf(" [%.*s]\n", len - 1, p + 1);
1081 printf("%ubits", i);
1082 else if (i < 1024*1024)
1083 printf("%ukb", i / 1024);
1085 printf("%uMb", i / (1024*1024));
1089 * CIS_BAR: Base address register for CardBus
1092 dump_bar(u_char *p, int len)
1095 printf("\tWrong length for BAR tuple\n");
1098 printf("\tBAR %d: size = ", *p & 7);
1099 print_size(tpl32(p + 2));
1100 printf(", %s%s%s%s\n",
1101 (*p & 0x10) ? "I/O" : "Memory",
1102 (*p & 0x20) ? ", Prefetch" : "",
1103 (*p & 0x40) ? ", Cacheable" : "",
1104 (*p & 0x80) ? ", <1Mb" : "");