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>
31 * Code cleanup, bug-fix and extension
32 * by Tatsumi Hosokawa <hosokawa@mt.cs.keio.ac.jp>
40 #include <sys/ioctl.h>
45 static void dump_config_map(struct tuple *tp);
46 static void dump_cis_config(struct tuple *tp);
47 static void dump_other_cond(u_char *p, int len);
48 static void dump_device_desc(u_char *p, int len, const char *type);
49 static void dump_info_v1(u_char *p, int len);
50 static void dump_longlink_mfc(u_char *p, int len);
51 static void dump_bar(u_char *p, int len);
52 static void dump_device_geo(u_char *p, int len);
53 static void dump_func_id(u_char *p);
54 static void dump_serial_ext(u_char *p, int len);
55 static void dump_disk_ext(u_char *p, int len);
56 static void dump_network_ext(u_char *p, int len);
57 static void dump_info_v2(u_char *p, int len);
58 static void dump_org(u_char *p, int len);
61 dumpcis(struct tuple_list *tlist)
64 struct tuple_list *tl;
65 int count = 0, sz, ad, i;
69 for (tl = tlist; tl; tl = tl->next)
70 for (tp = tl->tuples; tp; tp = tp->next) {
71 printf("Tuple #%d, code = 0x%x (%s), length = %d\n",
72 ++count, tp->code, tuple_name(tp->code), tp->length);
77 printf(" %03x: ", ad);
78 for (i = 0; i < ((sz < 16) ? sz : 16); i++)
79 printf(" %02x", p[i]);
88 case CIS_MEM_COMMON: /* 0x01 */
89 dump_device_desc(tp->data, tp->length, "Common");
91 case CIS_CONF_MAP_CB: /* 0x04 */
94 case CIS_CONFIG_CB: /* 0x05 */
97 case CIS_LONGLINK_MFC: /* 0x06 */
98 dump_longlink_mfc(tp->data, tp->length);
100 case CIS_BAR: /* 0x07 */
101 dump_bar(tp->data, tp->length);
103 case CIS_CHECKSUM: /* 0x10 */
104 printf("\tChecksum from offset %d, length %d, value is 0x%x\n",
109 case CIS_LONGLINK_A: /* 0x11 */
110 printf("\tLong link to attribute memory, address 0x%x\n",
113 case CIS_LONGLINK_C: /* 0x12 */
114 printf("\tLong link to common memory, address 0x%x\n",
117 case CIS_INFO_V1: /* 0x15 */
118 dump_info_v1(tp->data, tp->length);
120 case CIS_ALTSTR: /* 0x16 */
122 case CIS_MEM_ATTR: /* 0x17 */
123 dump_device_desc(tp->data, tp->length, "Attribute");
125 case CIS_JEDEC_C: /* 0x18 */
126 case CIS_JEDEC_A: /* 0x19 */
128 case CIS_CONF_MAP: /* 0x1A */
131 case CIS_CONFIG: /* 0x1B */
134 case CIS_DEVICE_OC: /* 0x1C */
135 case CIS_DEVICE_OA: /* 0x1D */
136 dump_other_cond(tp->data, tp->length);
138 case CIS_DEVICEGEO: /* 0x1E */
139 case CIS_DEVICEGEO_A: /* 0x1F */
140 dump_device_geo(tp->data, tp->length);
142 case CIS_MANUF_ID: /* 0x20 */
143 printf("\tPCMCIA ID = 0x%x, OEM ID = 0x%x\n",
145 tpl16(tp->data + 2));
147 case CIS_FUNC_ID: /* 0x21 */
149 dump_func_id(tp->data);
151 case CIS_FUNC_EXT: /* 0x22 */
154 dump_serial_ext(tp->data, tp->length);
157 dump_disk_ext(tp->data, tp->length);
160 dump_network_ext(tp->data, tp->length);
164 case CIS_VERS_2: /* 0x40 */
165 dump_info_v2(tp->data, tp->length);
167 case CIS_ORG: /* 0x46 */
168 dump_org(tp->data, tp->length);
175 * CIS_CONF_MAP : Dump configuration map tuple.
176 * CIS_CONF_MAP_CB: Dump configuration map for CardBus
179 dump_config_map(struct tuple *tp)
181 u_char *p = tp->data, x;
182 unsigned int rlen, mlen = 0, i;
184 rlen = (p[0] & 3) + 1;
185 if (tp->code == CIS_CONF_MAP)
186 mlen = ((p[0] >> 2) & 3) + 1;
187 if (tp->length < rlen + mlen + 2) {
188 printf("\tWrong length for configuration map tuple\n");
191 printf("\tReg len = %d, config register addr = 0x%x, last config = 0x%x\n",
192 rlen, parse_num(rlen | 0x10, p + 2, &p, 0), p[1]);
194 printf("\tRegisters: ");
195 for (i = 0; i < mlen; i++, p++) {
196 for (x = 0x1; x; x <<= 1)
197 printf("%c", x & *p ? 'X' : '-');
201 i = tp->length - (rlen + mlen + 2);
205 printf("%d bytes in subtuples", i);
212 * Dump power descriptor.
213 * call from dump_cis_config()
216 print_pwr_desc(u_char *p)
221 static const char *pname[] =
222 {"Nominal operating supply voltage",
223 "Minimum operating supply voltage",
224 "Maximum operating supply voltage",
225 "Continuous supply current",
226 "Max current average over 1 second",
227 "Max current average over 10 ms",
228 "Power down supply current",
231 static const char *vexp[] =
232 {"10uV", "100uV", "1mV", "10mV", "100mV", "1V", "10V", "100V"};
233 static const char *cexp[] =
234 {"10nA", "1uA", "10uA", "100uA", "1mA", "10mA", "100mA", "1A"};
235 static const char *mant[] =
236 {"1", "1.2", "1.3", "1.5", "2", "2.5", "3", "3.5", "4", "4.5",
237 "5", "5.5", "6", "7", "8", "9"};
241 for (i = 0; i < 8; i++)
242 if (mask & (1 << i)) {
246 printf("\t\t%s: ", pname[i]);
248 mant[(*p >> 3) & 0xF],
253 printf(", ext = 0x%x", *p);
262 * print_ext_speed - Print extended speed.
263 * call from dump_cis_config(), dump_device_desc()
266 print_ext_speed(u_char x, int scale)
268 static const char *mant[] =
269 {"Reserved", "1.0", "1.2", "1.3", "1.5", "2.0", "2.5", "3.0",
270 "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", "7.0", "8.0"};
271 static const char *exp[] =
272 {"1 ns", "10 ns", "100 ns", "1 us", "10 us", "100 us",
274 static const char *scale_name[] =
275 {"None", "10", "100", "1,000", "10,000", "100,000",
276 "1,000,000", "10,000,000"};
278 printf("Speed = %s x %s", mant[(x >> 3) & 0xF], exp[x & 7]);
280 printf(", scaled by %s", scale_name[scale & 7]);
284 * Print variable length value.
285 * call from print_io_map(), print_mem_map()
288 print_num(int sz, const char *fmt, u_char *p, int ofs)
296 printf(fmt, *p + ofs);
300 printf(fmt, tpl16(p) + ofs);
303 printf(fmt, tpl24(p) + ofs);
307 printf(fmt, tpl32(p) + ofs);
310 errx(1, "print_num(0x%x): Illegal arguments", sz);
315 * Print I/O mapping sub-tuple.
316 * call from dump_cis_config()
319 print_io_map(u_char *p, u_char *q)
326 if (CIS_IO_ADDR(*p)) /* I/O address line */
327 printf("\tCard decodes %d address lines",
330 printf("\tCard provides address decode");
333 switch (*p & (CIS_IO_8BIT | CIS_IO_16BIT)) {
335 printf(", 8 Bit I/O only");
338 printf(", limited 8/16 Bit I/O");
340 case (CIS_IO_8BIT | CIS_IO_16BIT):
341 printf(", full 8/16 Bit I/O");
346 /* I/O block sub-tuple exist */
347 if (*p++ & CIS_IO_RANGE) {
351 /* calculate byte length */
352 j = CIS_IO_ADSZ(c) + CIS_IO_BLKSZ(c);
353 if (CIS_IO_ADSZ(c) == 3)
355 if (CIS_IO_BLKSZ(c) == 3)
357 /* number of I/O block sub-tuples */
358 for (i = 0; i <= CIS_IO_BLKS(c); i++) {
361 printf("\t\tI/O address # %d: ", i + 1);
362 /* start block address */
363 p += print_num(CIS_IO_ADSZ(c),
364 "block start = 0x%x", p, 0);
366 p += print_num(CIS_IO_BLKSZ(c),
367 " block length = 0x%x", p, 1);
374 printf("\tWrong length for I/O mapping sub-tuple\n");
379 * Print IRQ sub-tuple.
380 * call from dump_cis_config()
383 print_irq_map(u_char *p, u_char *q)
390 printf("\t\tIRQ modes:");
392 if (*p & CIS_IRQ_LEVEL) { /* Level triggered interrupts */
396 if (*p & CIS_IRQ_PULSE) { /* Pulse triggered requests */
397 printf("%c Pulse", c);
400 if (*p & CIS_IRQ_SHARING) /* Interrupt sharing */
401 printf("%c Shared", c);
404 /* IRQ mask values exist */
405 if (*p & CIS_IRQ_MASK) {
408 i = tpl16(p + 1); /* IRQ mask */
409 printf("\t\tIRQs: ");
418 for (j = 0; j < 16; j++)
424 printf("\t\tIRQ level = %d\n", CIS_IRQ_IRQN(*p));
430 printf("\tWrong length for IRQ sub-tuple\n");
435 * Print memory map sub-tuple.
436 * call from dump_cis_config()
439 print_mem_map(u_char feat, u_char *p, u_char *q)
444 switch (CIS_FEAT_MEMORY(feat)) {
446 case CIS_FEAT_MEM_NONE: /* No memory block */
448 case CIS_FEAT_MEM_LEN: /* Specify memory length */
451 printf("\tMemory space length = 0x%x\n", tpl16(p));
454 case CIS_FEAT_MEM_ADDR: /* Memory address and length */
457 printf("\tMemory space address = 0x%x, length = 0x%x\n",
458 tpl16(p + 2), tpl16(p));
461 case CIS_FEAT_MEM_WIN: /* Memory descriptors. */
465 /* calculate byte length */
466 j = CIS_MEM_LENSZ(c) + CIS_MEM_ADDRSZ(c);
467 if (c & CIS_MEM_HOST)
468 j += CIS_MEM_ADDRSZ(c);
469 /* number of memory block */
470 for (i = 0; i < CIS_MEM_WINS(c); i++) {
473 printf("\tMemory descriptor %d\n\t\t", i + 1);
475 p += print_num(CIS_MEM_LENSZ(c) | 0x10,
476 " blk length = 0x%x00", p, 0);
478 p += print_num(CIS_MEM_ADDRSZ(c) | 0x10,
479 " card addr = 0x%x00", p, 0);
480 if (c & CIS_MEM_HOST) /* Host address value exist */
481 p += print_num(CIS_MEM_ADDRSZ(c) | 0x10,
482 " host addr = 0x%x00", p, 0);
490 printf("\tWrong length for memory mapping sub-tuple\n");
495 * CIS_CONFIG : Dump a config entry.
496 * CIS_CONFIG_CB: Dump a configuration entry for CardBus
499 dump_cis_config(struct tuple *tp)
507 printf("\tConfig index = 0x%x%s\n", *p & 0x3F,
508 *p & 0x40 ? "(default)" : "");
510 /* Interface byte exists */
511 if (tp->code == CIS_CONFIG && (*p & 0x80)) {
513 printf("\tInterface byte = 0x%x ", *p);
514 switch (*p & 0xF) { /* Interface type */
516 printf("(reserved)");
533 if (*p & 0x10) { /* Battery voltage detect */
534 printf(" BVD1/2 active");
537 if (*p & 0x20) { /* Write protect active */
538 printf("%c card WP active", c); /* Write protect */
541 if (*p & 0x40) { /* RdyBsy active bit */
542 printf("%c +RDY/-BSY active", c);
545 if (*p & 0x80) /* Wait signal required */
546 printf("%c wait signal supported", c);
554 /* Power structure sub-tuple */
555 switch (CIS_FEAT_POWER(feat)) { /* Power sub-tuple(s) exists */
559 printf("\tVcc pwr:\n");
560 p += print_pwr_desc(p);
563 printf("\tVcc pwr:\n");
564 p += print_pwr_desc(p);
565 printf("\tVpp pwr:\n");
566 p += print_pwr_desc(p);
569 printf("\tVcc pwr:\n");
570 p += print_pwr_desc(p);
571 printf("\tVpp1 pwr:\n");
572 p += print_pwr_desc(p);
573 printf("\tVpp2 pwr:\n");
574 p += print_pwr_desc(p);
578 /* Timing sub-tuple */
579 if (tp->code == CIS_CONFIG &&
580 (feat & CIS_FEAT_TIMING)) { /* Timing sub-tuple exists */
582 j = CIS_WAIT_SCALE(i);
584 printf("\tWait scale ");
585 print_ext_speed(*p++, j);
588 j = CIS_READY_SCALE(i);
590 printf("\tRDY/BSY scale ");
591 print_ext_speed(*p++, j);
594 j = CIS_RESERVED_SCALE(i);
596 printf("\tExternal scale ");
597 print_ext_speed(*p++, j);
602 /* I/O mapping sub-tuple */
603 if (feat & CIS_FEAT_I_O) { /* I/O space sub-tuple exists */
604 if (tp->code == CIS_CONFIG)
605 p = print_io_map(p, q);
606 else { /* CIS_CONFIG_CB */
607 printf("\tI/O base:");
608 for (i = 0; i < 8; i++)
616 /* IRQ descriptor sub-tuple */
617 if (feat & CIS_FEAT_IRQ) /* IRQ sub-tuple exists */
618 p = print_irq_map(p, q);
620 /* Memory map sub-tuple */
621 if (CIS_FEAT_MEMORY(feat)) { /* Memory space sub-tuple(s) exists */
622 if (tp->code == CIS_CONFIG)
623 p = print_mem_map(feat, p, q);
624 else { /* CIS_CONFIG_CB */
625 printf("\tMemory base:");
626 for (i = 0; i < 8; i++)
635 if (feat & CIS_FEAT_MISC) { /* Miscellaneous sub-tuple exists */
636 if (tp->code == CIS_CONFIG) {
637 printf("\tMax twin cards = %d\n", *p & 7);
638 printf("\tMisc attr:%s%s%s",
639 (*p & 8) ? " (Audio-BVD2)" : "",
640 (*p & 0x10) ? " (Read-only)" : "",
641 (*p & 0x20) ? " (Power down supported)" : "");
643 printf(" (Ext byte = 0x%x)", *p);
648 else { /* CIS_CONFIG_CB */
649 printf("\tMisc attr:");
650 printf("%s%s%s%s%s%s%s",
651 (*p & 1) ? " (Master)" : "",
652 (*p & 2) ? " (Invalidate)" : "",
653 (*p & 4) ? " (VGA palette)" : "",
654 (*p & 8) ? " (Parity)" : "",
655 (*p & 0x10) ? " (Wait)" : "",
656 (*p & 0x20) ? " (Serr)" : "",
657 (*p & 0x40) ? " (Fast back)" : "");
660 (*p & 1) ? " (Binary audio)" : "",
661 (*p & 2) ? " (pwm audio)" : "");
670 * CIS_DEVICE_OC, CIS_DEVICE_OA:
671 * Dump other conditions for common/attribute memory
674 dump_other_cond(u_char *p, int len)
676 if (p[0] && len > 0) {
681 printf(" (3V card)");
683 printf(" (Extension bytes follow)");
689 * CIS_MEM_COMMON, CIS_MEM_ATTR:
690 * Common / Attribute memory descripter
693 dump_device_desc(u_char *p, int len, const char *type)
695 static const char *un_name[] =
696 {"512b", "2Kb", "8Kb", "32Kb", "128Kb", "512Kb", "2Mb", "reserved"};
697 static const char *speed[] =
698 {"No speed", "250nS", "200nS", "150nS",
699 "100nS", "Reserved", "Reserved"};
700 static const char *dev[] =
701 {"No device", "Mask ROM", "OTPROM", "UV EPROM",
702 "EEPROM", "FLASH EEPROM", "SRAM", "DRAM",
703 "Reserved", "Reserved", "Reserved", "Reserved",
704 "Reserved", "Function specific", "Extended",
708 while (*p != 0xFF && len > 0) {
714 printf("\t%s memory device information:\n", type);
715 printf("\t\tDevice number %d, type %s, WPS = %s\n",
716 count, dev[x >> 4], (x & 0x8) ? "ON" : "OFF");
721 print_ext_speed(*p, 0);
729 printf("\t\tSpeed = %s", speed[x & 7]);
730 printf(", Memory block size = %s, %d units\n",
731 un_name[*p & 7], (*p >> 3) + 1);
737 * CIS_INFO_V1: Print version-1 info
740 dump_info_v1(u_char *p, int len)
743 printf("\tWrong length for version-1 info tuple\n");
746 printf("\tVersion = %d.%d", p[0], p[1]);
749 if (len > 1 && *p != 0xff) {
750 printf(", Manuf = [%s]", p);
751 while (*p++ && --len > 0);
753 if (len > 1 && *p != 0xff) {
754 printf(", card vers = [%s]", p);
755 while (*p++ && --len > 0);
757 printf("\n\tWrong length for version-1 info tuple\n");
761 if (len > 1 && *p != 0xff) {
762 printf("\tAddit. info = [%.*s]", len, p);
763 while (*p++ && --len > 0);
764 if (len > 1 && *p != 0xff)
765 printf(",[%.*s]", len, p);
771 * CIS_FUNC_ID: Functional ID
774 dump_func_id(u_char *p)
776 static const char *id[] = {
777 "Multifunction card",
783 "Network/LAN adapter",
790 (*p <= 9) ? id[*p] : "Unknown function",
791 (p[1] & 1) ? " - POST initialize" : "",
792 (p[1] & 2) ? " - Card has ROM" : "");
796 * CIS_FUNC_EXT: Dump functional extension tuple.
797 * (Serial port/modem)
800 dump_serial_ext(u_char *p, int len)
802 static const char *type[] = {
803 "", "Modem", "Data", "Fax", "Voice", "Data modem",
804 "Fax/modem", "Voice", " (Data)", " (Fax)", " (Voice)"
814 printf("\tSerial interface extension:%s\n", type[*p]);
817 switch (p[1] & 0x1F) {
819 printf("\t\tUnknown device");
822 printf("\t\t8250 UART");
825 printf("\t\t16450 UART");
828 printf("\t\t16550 UART");
831 printf(", Parity - %s%s%s%s\n",
832 (p[2] & 1) ? "Space," : "",
833 (p[2] & 2) ? "Mark," : "",
834 (p[2] & 4) ? "Odd," : "",
835 (p[2] & 8) ? "Even" : "");
836 printf("\t\tData bit - %s%s%s%s Stop bit - %s%s%s\n",
837 (p[3] & 1) ? "5bit," : "",
838 (p[3] & 2) ? "6bit," : "",
839 (p[3] & 4) ? "7bit," : "",
840 (p[3] & 8) ? "8bit," : "",
841 (p[3] & 0x10) ? "1bit," : "",
842 (p[3] & 0x20) ? "1.5bit," : "",
843 (p[3] & 0x40) ? "2bit" : "");
849 printf("\t%s interface capabilities:\n", type[*p]);
854 printf("\tData modem services available:\n");
856 case 0x13: /* Fax1 */
857 case 0x23: /* Fax2 */
858 case 0x33: /* Fax3 */
859 printf("\tFax%d/modem services available:\n", *p >> 4);
861 case 0x84: /* Voice */
862 printf("\tVoice services available:\n");
865 printf("\tWrong length for serial extension tuple\n");
871 * CIS_FUNC_EXT: Dump functional extension tuple.
875 dump_disk_ext(u_char *p, int len)
880 case 1: /* IDE interface */
883 printf("\tDisk interface: %s\n",
884 (p[1] & 1) ? "IDE" : "Undefined");
890 printf("\tDisk features: %s, %s%s\n",
891 (p[1] & 0x04) ? "Silicon" : "Rotating",
892 (p[1] & 0x08) ? "Unique, " : "",
893 (p[1] & 0x10) ? "Dual" : "Single");
895 printf("\t\t%s%s%s%s%s%s%s\n",
896 (p[2] & 0x01) ? "Sleep, " : "",
897 (p[2] & 0x02) ? "Standby, " : "",
898 (p[2] & 0x04) ? "Idle, " : "",
899 (p[2] & 0x08) ? "Low power, " : "",
900 (p[2] & 0x10) ? "Reg inhibit, " : "",
901 (p[2] & 0x20) ? "Index, " : "",
902 (p[2] & 0x40) ? "Iois16" : "");
905 printf("\tWrong length for fixed disk extension tuple\n");
914 printf("%u bits/sec", i);
915 else if (i < 1000000)
916 printf("%u kb/sec", i / 1000);
918 printf("%u Mb/sec", i / 1000000);
922 * CIS_FUNC_EXT: Dump functional extension tuple.
923 * (Network/LAN adapter)
926 dump_network_ext(u_char *p, int len)
928 static const char *tech[] = {
929 "Undefined", "ARCnet", "Ethernet", "Token ring",
930 "Localtalk", "FDDI/CDDI", "ATM", "Wireless"
932 static const char *media[] = {
933 "Undefined", "UTP", "STP", "Thin coax",
934 "THICK coax", "Fiber", "900 MHz", "2.4 GHz",
935 "5.4 GHz", "Diffuse Infrared", "Point to point Infrared"
942 case 1: /* Network technology */
945 printf("\tNetwork technology: %s\n", tech[p[1] & 7]);
947 case 2: /* Network speed */
950 printf("\tNetwork speed: ");
951 print_speed(tpl32(p + 1));
954 case 3: /* Network media */
959 printf("\tNetwork media: %s\n", media[i]);
961 case 4: /* Node ID */
962 if (len <= 2 || len < p[1] + 2)
964 printf("\tNetwork node ID:");
965 for (i = 0; i < p[1]; i++)
966 printf(" %02x", p[i + 2]);
969 case 5: /* Connector type */
972 printf("\tNetwork connector: %s connector standard\n",
973 (p[1] == 0) ? "open" : "closed");
976 printf("\tWrong length for network extension tuple\n");
982 * CIS_LONGLINK_MFC: Long link to next chain for Multi function card
985 dump_longlink_mfc(u_char *p, int len)
990 for (i = 0; i < n; i++) {
992 printf("\tWrong length for long link MFC tuple\n");
995 printf("\tFunction %d: %s memory, address 0x%x\n",
996 i, (*p ? "common" : "attribute"), tpl32(p + 1));
1003 * CIS_DEVICEGEO, CIS_DEVICEGEO_A:
1004 * Geometry info for common/attribute memory
1007 dump_device_geo(u_char *p, int len)
1010 printf("\twidth = %d, erase = 0x%x, read = 0x%x, write = 0x%x\n"
1011 "\t\tpartition = 0x%x, interleave = 0x%x\n",
1012 p[0], 1 << (p[1] - 1),
1013 1 << (p[2] - 1), 1 << (p[3] - 1),
1014 1 << (p[4] - 1), 1 << (p[5] - 1));
1020 * CIS_INFO_V2: Print version-2 info
1023 dump_info_v2(u_char *p, int len)
1026 printf("\tWrong length for version-2 info tuple\n");
1029 printf("\tVersion = 0x%x, compliance = 0x%x, dindex = 0x%x\n",
1030 p[0], p[1], tpl16(p + 2));
1031 printf("\tVspec8 = 0x%x, vspec9 = 0x%x, nhdr = %d\n",
1035 if (len <= 1 || *p == 0xff)
1037 printf("\tVendor = [%.*s]", len, p);
1038 while (*p++ && --len > 0);
1039 if (len > 1 && *p != 0xff)
1040 printf(", info = [%.*s]", len, p);
1045 * CIS_ORG: Organization
1048 dump_org(u_char *p, int len)
1051 printf("\tWrong length for organization tuple\n");
1056 printf("\tFilesystem");
1059 printf("\tApp specific");
1066 printf("\tReserved");
1068 printf("\tVendor specific");
1071 printf(" [%.*s]\n", len - 1, p + 1);
1078 printf("%ubits", i);
1079 else if (i < 1024*1024)
1080 printf("%ukb", i / 1024);
1082 printf("%uMb", i / (1024*1024));
1086 * CIS_BAR: Base address register for CardBus
1089 dump_bar(u_char *p, int len)
1092 printf("\tWrong length for BAR tuple\n");
1095 printf("\tBAR %d: size = ", *p & 7);
1096 print_size(tpl32(p + 2));
1097 printf(", %s%s%s%s\n",
1098 (*p & 0x10) ? "I/O" : "Memory",
1099 (*p & 0x20) ? ", Prefetch" : "",
1100 (*p & 0x40) ? ", Cacheable" : "",
1101 (*p & 0x80) ? ", <1Mb" : "");