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.
30 static const char rcsid[] =
35 * Code cleanup, bug-fix and extension
36 * by Tatsumi Hosokawa <hosokawa@mt.cs.keio.ac.jp>
44 #include <sys/ioctl.h>
49 static void dump_config_map(struct tuple *tp);
50 static void dump_cis_config(struct tuple *tp);
51 static void dump_other_cond(u_char *p, int len);
52 static void dump_device_desc(u_char *p, int len, const char *type);
53 static void dump_info_v1(u_char *p, int len);
54 static void dump_longlink_mfc(u_char *p, int len);
55 static void dump_bar(u_char *p, int len);
56 static void dump_device_geo(u_char *p, int len);
57 static void dump_func_id(u_char *p);
58 static void dump_serial_ext(u_char *p, int len);
59 static void dump_disk_ext(u_char *p, int len);
60 static void dump_network_ext(u_char *p, int len);
61 static void dump_info_v2(u_char *p, int len);
62 static void dump_org(u_char *p, int len);
65 dumpcis(struct tuple_list *tlist)
68 struct tuple_list *tl;
69 int count = 0, sz, ad, i;
73 for (tl = tlist; tl; tl = tl->next)
74 for (tp = tl->tuples; tp; tp = tp->next) {
75 printf("Tuple #%d, code = 0x%x (%s), length = %d\n",
76 ++count, tp->code, tuple_name(tp->code), tp->length);
81 printf(" %03x: ", ad);
82 for (i = 0; i < ((sz < 16) ? sz : 16); i++)
83 printf(" %02x", p[i]);
92 case CIS_MEM_COMMON: /* 0x01 */
93 dump_device_desc(tp->data, tp->length, "Common");
95 case CIS_CONF_MAP_CB: /* 0x04 */
98 case CIS_CONFIG_CB: /* 0x05 */
101 case CIS_LONGLINK_MFC: /* 0x06 */
102 dump_longlink_mfc(tp->data, tp->length);
104 case CIS_BAR: /* 0x07 */
105 dump_bar(tp->data, tp->length);
107 case CIS_CHECKSUM: /* 0x10 */
108 printf("\tChecksum from offset %d, length %d, value is 0x%x\n",
113 case CIS_LONGLINK_A: /* 0x11 */
114 printf("\tLong link to attribute memory, address 0x%x\n",
117 case CIS_LONGLINK_C: /* 0x12 */
118 printf("\tLong link to common memory, address 0x%x\n",
121 case CIS_INFO_V1: /* 0x15 */
122 dump_info_v1(tp->data, tp->length);
124 case CIS_ALTSTR: /* 0x16 */
126 case CIS_MEM_ATTR: /* 0x17 */
127 dump_device_desc(tp->data, tp->length, "Attribute");
129 case CIS_JEDEC_C: /* 0x18 */
130 case CIS_JEDEC_A: /* 0x19 */
132 case CIS_CONF_MAP: /* 0x1A */
135 case CIS_CONFIG: /* 0x1B */
138 case CIS_DEVICE_OC: /* 0x1C */
139 case CIS_DEVICE_OA: /* 0x1D */
140 dump_other_cond(tp->data, tp->length);
142 case CIS_DEVICEGEO: /* 0x1E */
143 case CIS_DEVICEGEO_A: /* 0x1F */
144 dump_device_geo(tp->data, tp->length);
146 case CIS_MANUF_ID: /* 0x20 */
147 printf("\tPCMCIA ID = 0x%x, OEM ID = 0x%x\n",
149 tpl16(tp->data + 2));
151 case CIS_FUNC_ID: /* 0x21 */
153 dump_func_id(tp->data);
155 case CIS_FUNC_EXT: /* 0x22 */
158 dump_serial_ext(tp->data, tp->length);
161 dump_disk_ext(tp->data, tp->length);
164 dump_network_ext(tp->data, tp->length);
168 case CIS_VERS_2: /* 0x40 */
169 dump_info_v2(tp->data, tp->length);
171 case CIS_ORG: /* 0x46 */
172 dump_org(tp->data, tp->length);
179 * CIS_CONF_MAP : Dump configuration map tuple.
180 * CIS_CONF_MAP_CB: Dump configuration map for CardBus
183 dump_config_map(struct tuple *tp)
185 u_char *p = tp->data, x;
189 rlen = (p[0] & 3) + 1;
190 if (tp->code == CIS_CONF_MAP)
191 mlen = ((p[0] >> 2) & 3) + 1;
192 if (tp->length < rlen + mlen + 2) {
193 printf("\tWrong length for configuration map tuple\n");
196 printf("\tReg len = %d, config register addr = 0x%x, last config = 0x%x\n",
197 rlen, parse_num(rlen | 0x10, p + 2, &p, 0), p[1]);
199 printf("\tRegisters: ");
200 for (i = 0; i < mlen; i++, p++) {
201 for (x = 0x1; x; x <<= 1)
202 printf("%c", x & *p ? 'X' : '-');
206 i = tp->length - (rlen + mlen + 2);
210 printf("%d bytes in subtuples", i);
217 * Dump power descriptor.
218 * call from dump_cis_config()
221 print_pwr_desc(u_char *p)
226 static const char *pname[] =
227 {"Nominal operating supply voltage",
228 "Minimum operating supply voltage",
229 "Maximum operating supply voltage",
230 "Continuous supply current",
231 "Max current average over 1 second",
232 "Max current average over 10 ms",
233 "Power down supply current",
236 static const char *vexp[] =
237 {"10uV", "100uV", "1mV", "10mV", "100mV", "1V", "10V", "100V"};
238 static const char *cexp[] =
239 {"10nA", "1uA", "10uA", "100uA", "1mA", "10mA", "100mA", "1A"};
240 static const char *mant[] =
241 {"1", "1.2", "1.3", "1.5", "2", "2.5", "3", "3.5", "4", "4.5",
242 "5", "5.5", "6", "7", "8", "9"};
246 for (i = 0; i < 8; i++)
247 if (mask & (1 << i)) {
251 printf("\t\t%s: ", pname[i]);
253 mant[(*p >> 3) & 0xF],
258 printf(", ext = 0x%x", *p);
267 * print_ext_speed - Print extended speed.
268 * call from dump_cis_config(), dump_device_desc()
271 print_ext_speed(u_char x, int scale)
273 static const char *mant[] =
274 {"Reserved", "1.0", "1.2", "1.3", "1.5", "2.0", "2.5", "3.0",
275 "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", "7.0", "8.0"};
276 static const char *exp[] =
277 {"1 ns", "10 ns", "100 ns", "1 us", "10 us", "100 us",
279 static const char *scale_name[] =
280 {"None", "10", "100", "1,000", "10,000", "100,000",
281 "1,000,000", "10,000,000"};
283 printf("Speed = %s x %s", mant[(x >> 3) & 0xF], exp[x & 7]);
285 printf(", scaled by %s", scale_name[scale & 7]);
289 * Print variable length value.
290 * call from print_io_map(), print_mem_map()
293 print_num(int sz, const char *fmt, u_char *p, int ofs)
301 printf(fmt, *p + ofs);
305 printf(fmt, tpl16(p) + ofs);
308 printf(fmt, tpl24(p) + ofs);
312 printf(fmt, tpl32(p) + ofs);
315 errx(1, "print_num(0x%x): Illegal arguments", sz);
320 * Print I/O mapping sub-tuple.
321 * call from dump_cis_config()
324 print_io_map(u_char *p, u_char *q)
331 if (CIS_IO_ADDR(*p)) /* I/O address line */
332 printf("\tCard decodes %d address lines",
335 printf("\tCard provides address decode");
338 switch (*p & (CIS_IO_8BIT | CIS_IO_16BIT)) {
340 printf(", 8 Bit I/O only");
343 printf(", limited 8/16 Bit I/O");
345 case (CIS_IO_8BIT | CIS_IO_16BIT):
346 printf(", full 8/16 Bit I/O");
351 /* I/O block sub-tuple exist */
352 if (*p++ & CIS_IO_RANGE) {
356 /* calculate byte length */
357 j = CIS_IO_ADSZ(c) + CIS_IO_BLKSZ(c);
358 if (CIS_IO_ADSZ(c) == 3)
360 if (CIS_IO_BLKSZ(c) == 3)
362 /* number of I/O block sub-tuples */
363 for (i = 0; i <= CIS_IO_BLKS(c); i++) {
366 printf("\t\tI/O address # %d: ", i + 1);
367 /* start block address */
368 p += print_num(CIS_IO_ADSZ(c),
369 "block start = 0x%x", p, 0);
371 p += print_num(CIS_IO_BLKSZ(c),
372 " block length = 0x%x", p, 1);
379 printf("\tWrong length for I/O mapping sub-tuple\n");
384 * Print IRQ sub-tuple.
385 * call from dump_cis_config()
388 print_irq_map(u_char *p, u_char *q)
395 printf("\t\tIRQ modes:");
397 if (*p & CIS_IRQ_LEVEL) { /* Level triggered interrupts */
401 if (*p & CIS_IRQ_PULSE) { /* Pulse triggered requests */
402 printf("%c Pulse", c);
405 if (*p & CIS_IRQ_SHARING) /* Interrupt sharing */
406 printf("%c Shared", c);
409 /* IRQ mask values exist */
410 if (*p & CIS_IRQ_MASK) {
413 i = tpl16(p + 1); /* IRQ mask */
414 printf("\t\tIRQs: ");
423 for (j = 0; j < 16; j++)
429 printf("\t\tIRQ level = %d\n", CIS_IRQ_IRQN(*p));
435 printf("\tWrong length for IRQ sub-tuple\n");
440 * Print memory map sub-tuple.
441 * call from dump_cis_config()
444 print_mem_map(u_char feat, u_char *p, u_char *q)
449 switch (CIS_FEAT_MEMORY(feat)) {
451 case CIS_FEAT_MEM_NONE: /* No memory block */
453 case CIS_FEAT_MEM_LEN: /* Specify memory length */
456 printf("\tMemory space length = 0x%x\n", tpl16(p));
459 case CIS_FEAT_MEM_ADDR: /* Memory address and length */
462 printf("\tMemory space address = 0x%x, length = 0x%x\n",
463 tpl16(p + 2), tpl16(p));
466 case CIS_FEAT_MEM_WIN: /* Memory descriptors. */
470 /* calculate byte length */
471 j = CIS_MEM_LENSZ(c) + CIS_MEM_ADDRSZ(c);
472 if (c & CIS_MEM_HOST)
473 j += CIS_MEM_ADDRSZ(c);
474 /* number of memory block */
475 for (i = 0; i < CIS_MEM_WINS(c); i++) {
478 printf("\tMemory descriptor %d\n\t\t", i + 1);
480 p += print_num(CIS_MEM_LENSZ(c) | 0x10,
481 " blk length = 0x%x00", p, 0);
483 p += print_num(CIS_MEM_ADDRSZ(c) | 0x10,
484 " card addr = 0x%x00", p, 0);
485 if (c & CIS_MEM_HOST) /* Host address value exist */
486 p += print_num(CIS_MEM_ADDRSZ(c) | 0x10,
487 " host addr = 0x%x00", p, 0);
495 printf("\tWrong length for memory mapping sub-tuple\n");
500 * CIS_CONFIG : Dump a config entry.
501 * CIS_CONFIG_CB: Dump a configuration entry for CardBus
504 dump_cis_config(struct tuple *tp)
512 printf("\tConfig index = 0x%x%s\n", *p & 0x3F,
513 *p & 0x40 ? "(default)" : "");
515 /* Interface byte exists */
516 if (tp->code == CIS_CONFIG && (*p & 0x80)) {
518 printf("\tInterface byte = 0x%x ", *p);
519 switch (*p & 0xF) { /* Interface type */
521 printf("(reserved)");
538 if (*p & 0x10) { /* Battery voltage detect */
539 printf(" BVD1/2 active");
542 if (*p & 0x20) { /* Write protect active */
543 printf("%c card WP active", c); /* Write protect */
546 if (*p & 0x40) { /* RdyBsy active bit */
547 printf("%c +RDY/-BSY active", c);
550 if (*p & 0x80) /* Wait signal required */
551 printf("%c wait signal supported", c);
559 /* Power structure sub-tuple */
560 switch (CIS_FEAT_POWER(feat)) { /* Power sub-tuple(s) exists */
564 printf("\tVcc pwr:\n");
565 p += print_pwr_desc(p);
568 printf("\tVcc pwr:\n");
569 p += print_pwr_desc(p);
570 printf("\tVpp pwr:\n");
571 p += print_pwr_desc(p);
574 printf("\tVcc pwr:\n");
575 p += print_pwr_desc(p);
576 printf("\tVpp1 pwr:\n");
577 p += print_pwr_desc(p);
578 printf("\tVpp2 pwr:\n");
579 p += print_pwr_desc(p);
583 /* Timing sub-tuple */
584 if (tp->code == CIS_CONFIG &&
585 (feat & CIS_FEAT_TIMING)) { /* Timing sub-tuple exists */
587 j = CIS_WAIT_SCALE(i);
589 printf("\tWait scale ");
590 print_ext_speed(*p++, j);
593 j = CIS_READY_SCALE(i);
595 printf("\tRDY/BSY scale ");
596 print_ext_speed(*p++, j);
599 j = CIS_RESERVED_SCALE(i);
601 printf("\tExternal scale ");
602 print_ext_speed(*p++, j);
607 /* I/O mapping sub-tuple */
608 if (feat & CIS_FEAT_I_O) { /* I/O space sub-tuple exists */
609 if (tp->code == CIS_CONFIG)
610 p = print_io_map(p, q);
611 else { /* CIS_CONFIG_CB */
612 printf("\tI/O base:");
613 for (i = 0; i < 8; i++)
621 /* IRQ descriptor sub-tuple */
622 if (feat & CIS_FEAT_IRQ) /* IRQ sub-tuple exists */
623 p = print_irq_map(p, q);
625 /* Memory map sub-tuple */
626 if (CIS_FEAT_MEMORY(feat)) { /* Memory space sub-tuple(s) exists */
627 if (tp->code == CIS_CONFIG)
628 p = print_mem_map(feat, p, q);
629 else { /* CIS_CONFIG_CB */
630 printf("\tMemory base:");
631 for (i = 0; i < 8; i++)
640 if (feat & CIS_FEAT_MISC) { /* Miscellaneous sub-tuple exists */
641 if (tp->code == CIS_CONFIG) {
642 printf("\tMax twin cards = %d\n", *p & 7);
643 printf("\tMisc attr:%s%s%s",
644 (*p & 8) ? " (Audio-BVD2)" : "",
645 (*p & 0x10) ? " (Read-only)" : "",
646 (*p & 0x20) ? " (Power down supported)" : "");
648 printf(" (Ext byte = 0x%x)", *p);
653 else { /* CIS_CONFIG_CB */
654 printf("\tMisc attr:");
655 printf("%s%s%s%s%s%s%s",
656 (*p & 1) ? " (Master)" : "",
657 (*p & 2) ? " (Invalidate)" : "",
658 (*p & 4) ? " (VGA palette)" : "",
659 (*p & 8) ? " (Parity)" : "",
660 (*p & 0x10) ? " (Wait)" : "",
661 (*p & 0x20) ? " (Serr)" : "",
662 (*p & 0x40) ? " (Fast back)" : "");
665 (*p & 1) ? " (Binary audio)" : "",
666 (*p & 2) ? " (pwm audio)" : "");
675 * CIS_DEVICE_OC, CIS_DEVICE_OA:
676 * Dump other conditions for common/attribute memory
679 dump_other_cond(u_char *p, int len)
681 if (p[0] && len > 0) {
686 printf(" (3V card)");
688 printf(" (Extension bytes follow)");
694 * CIS_MEM_COMMON, CIS_MEM_ATTR:
695 * Common / Attribute memory descripter
698 dump_device_desc(u_char *p, int len, const char *type)
700 static const char *un_name[] =
701 {"512b", "2Kb", "8Kb", "32Kb", "128Kb", "512Kb", "2Mb", "reserved"};
702 static const char *speed[] =
703 {"No speed", "250nS", "200nS", "150nS",
704 "100nS", "Reserved", "Reserved"};
705 static const char *dev[] =
706 {"No device", "Mask ROM", "OTPROM", "UV EPROM",
707 "EEPROM", "FLASH EEPROM", "SRAM", "DRAM",
708 "Reserved", "Reserved", "Reserved", "Reserved",
709 "Reserved", "Function specific", "Extended",
713 while (*p != 0xFF && len > 0) {
719 printf("\t%s memory device information:\n", type);
720 printf("\t\tDevice number %d, type %s, WPS = %s\n",
721 count, dev[x >> 4], (x & 0x8) ? "ON" : "OFF");
726 print_ext_speed(*p, 0);
734 printf("\t\tSpeed = %s", speed[x & 7]);
735 printf(", Memory block size = %s, %d units\n",
736 un_name[*p & 7], (*p >> 3) + 1);
742 * CIS_INFO_V1: Print version-1 info
745 dump_info_v1(u_char *p, int len)
748 printf("\tWrong length for version-1 info tuple\n");
751 printf("\tVersion = %d.%d", p[0], p[1]);
754 if (len > 1 && *p != 0xff) {
755 printf(", Manuf = [%s]", p);
756 while (*p++ && --len > 0);
758 if (len > 1 && *p != 0xff) {
759 printf(", card vers = [%s]", p);
760 while (*p++ && --len > 0);
762 printf("\n\tWrong length for version-1 info tuple\n");
766 if (len > 1 && *p != 0xff) {
767 printf("\tAddit. info = [%.*s]", len, p);
768 while (*p++ && --len > 0);
769 if (len > 1 && *p != 0xff)
770 printf(",[%.*s]", len, p);
776 * CIS_FUNC_ID: Functional ID
779 dump_func_id(u_char *p)
781 static const char *id[] = {
782 "Multifunction card",
788 "Network/LAN adapter",
795 (*p <= 9) ? id[*p] : "Unknown function",
796 (p[1] & 1) ? " - POST initialize" : "",
797 (p[1] & 2) ? " - Card has ROM" : "");
801 * CIS_FUNC_EXT: Dump functional extension tuple.
802 * (Serial port/modem)
805 dump_serial_ext(u_char *p, int len)
807 static const char *type[] = {
808 "", "Modem", "Data", "Fax", "Voice", "Data modem",
809 "Fax/modem", "Voice", " (Data)", " (Fax)", " (Voice)"
819 printf("\tSerial interface extension:%s\n", type[*p]);
822 switch (p[1] & 0x1F) {
824 printf("\t\tUnknown device");
827 printf("\t\t8250 UART");
830 printf("\t\t16450 UART");
833 printf("\t\t16550 UART");
836 printf(", Parity - %s%s%s%s\n",
837 (p[2] & 1) ? "Space," : "",
838 (p[2] & 2) ? "Mark," : "",
839 (p[2] & 4) ? "Odd," : "",
840 (p[2] & 8) ? "Even" : "");
841 printf("\t\tData bit - %s%s%s%s Stop bit - %s%s%s\n",
842 (p[3] & 1) ? "5bit," : "",
843 (p[3] & 2) ? "6bit," : "",
844 (p[3] & 4) ? "7bit," : "",
845 (p[3] & 8) ? "8bit," : "",
846 (p[3] & 0x10) ? "1bit," : "",
847 (p[3] & 0x20) ? "1.5bit," : "",
848 (p[3] & 0x40) ? "2bit" : "");
854 printf("\t%s interface capabilities:\n", type[*p]);
859 printf("\tData modem services available:\n");
861 case 0x13: /* Fax1 */
862 case 0x23: /* Fax2 */
863 case 0x33: /* Fax3 */
864 printf("\tFax%d/modem services available:\n", *p >> 4);
866 case 0x84: /* Voice */
867 printf("\tVoice services available:\n");
870 printf("\tWrong length for serial extension tuple\n");
876 * CIS_FUNC_EXT: Dump functional extension tuple.
880 dump_disk_ext(u_char *p, int len)
885 case 1: /* IDE interface */
888 printf("\tDisk interface: %s\n",
889 (p[1] & 1) ? "IDE" : "Undefined");
895 printf("\tDisk features: %s, %s%s\n",
896 (p[1] & 0x04) ? "Silicon" : "Rotating",
897 (p[1] & 0x08) ? "Unique, " : "",
898 (p[1] & 0x10) ? "Dual" : "Single");
900 printf("\t\t%s%s%s%s%s%s%s\n",
901 (p[2] & 0x01) ? "Sleep, " : "",
902 (p[2] & 0x02) ? "Standby, " : "",
903 (p[2] & 0x04) ? "Idle, " : "",
904 (p[2] & 0x08) ? "Low power, " : "",
905 (p[2] & 0x10) ? "Reg inhibit, " : "",
906 (p[2] & 0x20) ? "Index, " : "",
907 (p[2] & 0x40) ? "Iois16" : "");
910 printf("\tWrong length for fixed disk extension tuple\n");
919 printf("%u bits/sec", i);
920 else if (i < 1000000)
921 printf("%u kb/sec", i / 1000);
923 printf("%u Mb/sec", i / 1000000);
927 * CIS_FUNC_EXT: Dump functional extension tuple.
928 * (Network/LAN adapter)
931 dump_network_ext(u_char *p, int len)
933 static const char *tech[] = {
934 "Undefined", "ARCnet", "Ethernet", "Token ring",
935 "Localtalk", "FDDI/CDDI", "ATM", "Wireless"
937 static const char *media[] = {
938 "Undefined", "UTP", "STP", "Thin coax",
939 "THICK coax", "Fiber", "900 MHz", "2.4 GHz",
940 "5.4 GHz", "Diffuse Infrared", "Point to point Infrared"
947 case 1: /* Network technology */
950 printf("\tNetwork technology: %s\n", tech[p[1] & 7]);
952 case 2: /* Network speed */
955 printf("\tNetwork speed: ");
956 print_speed(tpl32(p + 1));
959 case 3: /* Network media */
964 printf("\tNetwork media: %s\n", media[i]);
966 case 4: /* Node ID */
967 if (len <= 2 || len < p[1] + 2)
969 printf("\tNetwork node ID:");
970 for (i = 0; i < p[1]; i++)
971 printf(" %02x", p[i + 2]);
974 case 5: /* Connector type */
977 printf("\tNetwork connector: %s connector standard\n",
978 (p[1] == 0) ? "open" : "closed");
981 printf("\tWrong length for network extension tuple\n");
987 * CIS_LONGLINK_MFC: Long link to next chain for Multi function card
990 dump_longlink_mfc(u_char *p, int len)
995 for (i = 0; i < n; i++) {
997 printf("\tWrong length for long link MFC tuple\n");
1000 printf("\tFunction %d: %s memory, address 0x%x\n",
1001 i, (*p ? "common" : "attribute"), tpl32(p + 1));
1008 * CIS_DEVICEGEO, CIS_DEVICEGEO_A:
1009 * Geometry info for common/attribute memory
1012 dump_device_geo(u_char *p, int len)
1015 printf("\twidth = %d, erase = 0x%x, read = 0x%x, write = 0x%x\n"
1016 "\t\tpartition = 0x%x, interleave = 0x%x\n",
1017 p[0], 1 << (p[1] - 1),
1018 1 << (p[2] - 1), 1 << (p[3] - 1),
1019 1 << (p[4] - 1), 1 << (p[5] - 1));
1025 * CIS_INFO_V2: Print version-2 info
1028 dump_info_v2(u_char *p, int len)
1031 printf("\tWrong length for version-2 info tuple\n");
1034 printf("\tVersion = 0x%x, compliance = 0x%x, dindex = 0x%x\n",
1035 p[0], p[1], tpl16(p + 2));
1036 printf("\tVspec8 = 0x%x, vspec9 = 0x%x, nhdr = %d\n",
1040 if (len <= 1 || *p == 0xff)
1042 printf("\tVendor = [%.*s]", len, p);
1043 while (*p++ && --len > 0);
1044 if (len > 1 && *p != 0xff)
1045 printf(", info = [%.*s]", len, p);
1050 * CIS_ORG: Organization
1053 dump_org(u_char *p, int len)
1056 printf("\tWrong length for organization tuple\n");
1061 printf("\tFilesystem");
1064 printf("\tApp specific");
1071 printf("\tReserved");
1073 printf("\tVendor specific");
1076 printf(" [%.*s]\n", len - 1, p + 1);
1083 printf("%ubits", i);
1084 else if (i < 1024*1024)
1085 printf("%ukb", i / 1024);
1087 printf("%uMb", i / (1024*1024));
1091 * CIS_BAR: Base address register for CardBus
1094 dump_bar(u_char *p, int len)
1097 printf("\tWrong length for BAR tuple\n");
1100 printf("\tBAR %d: size = ", *p & 7);
1101 print_size(tpl32(p + 2));
1102 printf(", %s%s%s%s\n",
1103 (*p & 0x10) ? "I/O" : "Memory",
1104 (*p & 0x20) ? ", Prefetch" : "",
1105 (*p & 0x40) ? ", Cacheable" : "",
1106 (*p & 0x80) ? ", <1Mb" : "");