cisShow.c
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:43k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* cisShow.c - PCMCIA CIS show library */
  2. /* Copyright 1984-2001 Wind River Systems, Inc. */
  3. #include "copyright_wrs.h"
  4. /*
  5. modification history
  6. --------------------
  7. 01e,10oct01,dat  SPR 70829, add note about VX_FP_TASK being necessary
  8. 01d,21jun00,rsh  upgrade to dosFs 2.0
  9. 01c,28mar96,jdi  doc: cleaned up language and format.
  10. 01b,22feb96,hdn  cleaned up
  11. 01a,09feb95,hdn  written.
  12. */
  13. /*
  14. DESCRIPTION
  15. This library provides a show routine for CIS tuples. This is provided
  16. for engineering debug use.
  17. This module uses floating point calculations.  Any task calling cisShow()
  18. needs to have the VX_FP_TASK bit set in the task flags.
  19. */
  20. #include "vxWorks.h"
  21. #include "stdio.h"
  22. #include "stdlib.h"
  23. #include "string.h"
  24. #include "drv/pcmcia/pcmciaLib.h"
  25. #include "drv/pcmcia/cisLib.h"
  26. /* defines */
  27. /* imports */
  28. IMPORT PCMCIA_CTRL pcmciaCtrl;
  29. /* globals */
  30. /* locals */
  31. LOCAL u_char cisFuncid = 0;
  32. LOCAL CIS_TUPLE *cisCdefault = (CIS_TUPLE *)0;
  33. LOCAL u_char systemInitByte = 0;
  34. LOCAL u_int deviceInfos = 0;
  35. LOCAL double speedMantisa [] = {0.0, 1.0, 1.2, 1.3, 1.5, 2.0, 2.5, 3.0,
  36.            3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 7.0, 8.0 };
  37. LOCAL double speedExponent [] = {1.0e-9, 10.0e-9, 100.0e-9, 1.0e-6,
  38.         10.0e-6, 100.0e-6, 1.0e-3, 10.0e-3 };
  39. LOCAL u_int deviceSize [] = {512, 2000, 8000, 32000, 128000,
  40.         512000, 2000000, 0 };
  41. LOCAL char *interfaceType[] = {"memory", "IO", "reserved", "reserved",
  42.         "custom interface 0", "custom interface 1",
  43.         "custom interface 2", "custom interface 3" };
  44. /* forward declarations */
  45. LOCAL void cisTupleShow (int sock);
  46. LOCAL void cisConfigShow (int sock);
  47. LOCAL void cisShowDevice (CIS_TUPLE *pTuple);
  48. LOCAL void cisShowVers1 (CIS_TUPLE *pTuple);
  49. LOCAL void cisShowVers2 (CIS_TUPLE *pTuple);
  50. LOCAL void cisShowFormat (CIS_TUPLE *pTuple);
  51. LOCAL void cisShowGeometry (CIS_TUPLE *pTuple);
  52. LOCAL void cisShowJedec (CIS_TUPLE *pTuple);
  53. LOCAL void cisShowDevgeo (CIS_TUPLE *pTuple);
  54. LOCAL void cisShowManfid (CIS_TUPLE *pTuple);
  55. LOCAL void cisShowFuncid (CIS_TUPLE *pTuple);
  56. LOCAL void cisShowFunce (CIS_TUPLE *pTuple);
  57. LOCAL void cisShowFunceSerial (CIS_TUPLE *pTuple);
  58. LOCAL void cisShowFunceModem (CIS_TUPLE *pTuple);
  59. LOCAL void cisShowFunceDmodem (CIS_TUPLE *pTuple);
  60. LOCAL void cisShowFunceFmodem (CIS_TUPLE *pTuple);
  61. LOCAL void cisShowFunceVmodem (CIS_TUPLE *pTuple);
  62. LOCAL void cisShowConfig (CIS_TUPLE *pTuple);
  63. LOCAL void cisShowCtable (CIS_TUPLE *pTuple);
  64. LOCAL u_char *cisShowCpower (u_char *pChar, u_char featureSelection);
  65. LOCAL u_char *cisShowCtiming (u_char *pChar, u_char featureSelection);
  66. LOCAL u_char *cisShowCio (u_char *pChar, u_char featureSelection);
  67. LOCAL u_char *cisShowCirq (u_char *pChar, u_char featureSelection);
  68. LOCAL u_char *cisShowCmem (u_char *pChar, u_char featureSelection);
  69. LOCAL u_char *cisShowCmisc (u_char *pChar, u_char featureSelection);
  70. LOCAL void cisShowCsub (CIS_TUPLE *pTuple);
  71. /*******************************************************************************
  72. *
  73. * cisShow - show CIS information
  74. *
  75. * This routine shows CIS information.
  76. *
  77. * NOTE: This routine uses floating point calculations.  The calling task needs
  78. * to be spawned with the VX_FP_TASK flag.  If this is not done, the data
  79. * printed by cisShow may be corrupted and unreliable.
  80. *
  81. * RETURNS: N/A
  82. */
  83. void cisShow
  84.     (
  85.     int sock /* socket no. */
  86.     )
  87.     {
  88.     cisTupleShow (sock);
  89.     cisConfigShow (sock);
  90.     }
  91. /*******************************************************************************
  92. *
  93. * cisTupleShow - Traverse the tuple link list, and show information in a tuple.
  94. *
  95. * This routine traverses the link list of tuples and shows CIS (Configuration
  96. * Information Structure) in each tuple.
  97. *
  98. * RETURNS: N/A
  99. */
  100. LOCAL void cisTupleShow
  101.     (
  102.     int sock /* socket no. */
  103.     )
  104.     {
  105.     PCMCIA_CTRL *pCtrl = &pcmciaCtrl;
  106.     PCMCIA_CARD *pCard = &pCtrl->card[sock];
  107.     DL_LIST *pList = &pCard->cisTupleList;
  108.     DL_NODE *pNode;
  109.     CIS_TUPLE *pTuple;
  110.     for (pNode = DLL_FIRST(pList); pNode != NULL; pNode = DLL_NEXT(pNode))
  111. {
  112. pTuple = (CIS_TUPLE *)((char *)pNode + sizeof(DL_NODE));
  113. switch (pTuple->code)
  114.     {
  115.     case CISTPL_DEVICE:
  116. printf ("Device information tuple for common memoryn");
  117. cisShowDevice (pTuple);
  118. break;
  119.     case CISTPL_DEVICE_A:
  120. printf ("Device information tuple for attribute memoryn");
  121. cisShowDevice (pTuple);
  122. break;
  123.     case CISTPL_VERS_1:
  124. printf ("Level-1 version/product-information tuplen");
  125. cisShowVers1 (pTuple);
  126. break;
  127.     case CISTPL_GEOMETRY:
  128. printf ("Geometry tuplen");
  129. cisShowGeometry (pTuple);
  130. break;
  131.     case CISTPL_JEDEC_C:
  132. printf ("JEDEC tuple for common memoryn");
  133. cisShowJedec (pTuple);
  134. break;
  135.     case CISTPL_JEDEC_A:
  136. printf ("JEDEC tuple for attribute memoryn");
  137. cisShowJedec (pTuple);
  138. break;
  139.     case CISTPL_DEVICE_GEO:
  140. printf ("Device geometry tuple for common memoryn");
  141. cisShowDevgeo (pTuple);
  142. break;
  143.     case CISTPL_DEVICE_GEO_A:
  144. printf ("Device geometry tuple for attribute memoryn");
  145. cisShowDevgeo (pTuple);
  146. break;
  147.     case CISTPL_MANFID:
  148. printf ("Manufacturer identification tuplen");
  149. cisShowManfid (pTuple);
  150. break;
  151.     case CISTPL_FUNCID:
  152. printf ("Function identification tuplen");
  153. cisShowFuncid (pTuple);
  154. break;
  155.     case CISTPL_FUNCE:
  156. printf ("Function extension tuplen");
  157. cisShowFunce (pTuple);
  158. break;
  159.     case CISTPL_CONFIG:
  160. printf ("Configuration tuplen");
  161. cisShowConfig (pTuple);
  162. break;
  163.     case CISTPL_CFTABLE_ENTRY:
  164. printf ("Configuration table entry tuplen");
  165. cisShowCtable (pTuple);
  166. break;
  167.     case CISTPL_VERS_2:
  168. printf ("Level-2 version/product-information tuplen");
  169. cisShowVers2 (pTuple);
  170. break;
  171.     case CISTPL_FORMAT:
  172. printf ("Format tuplen");
  173. cisShowFormat (pTuple);
  174. break;
  175.     case CISTPL_NULL:
  176.     case CISTPL_LONGLINK_A:
  177.     case CISTPL_LONGLINK_C:
  178.     case CISTPL_NO_LINK:
  179.     case CISTPL_END:
  180.     case CISTPL_CHECKSUM:
  181. break;
  182.     default:
  183. printf ("Unsupported tuple 0x%xn", pTuple->code);
  184.          }
  185.         }
  186.     }
  187. /*******************************************************************************
  188. *
  189. * cisConfigShow - Show information in a configuration table link list.
  190. *
  191. * This routine traverses the link list of configuration table and shows 
  192. * information in each entry.
  193. *
  194. * RETURNS: N/A
  195. */
  196. LOCAL void cisConfigShow
  197.     (
  198.     int sock /* socket no. */
  199.     )
  200.     {
  201.     PCMCIA_CTRL *pCtrl = &pcmciaCtrl;
  202.     PCMCIA_CARD *pCard = &pCtrl->card[sock];
  203.     DL_LIST *pList = &pCard->cisConfigList;
  204.     DL_NODE *pNode;
  205.     CIS_CONFIG *pConfig;
  206.     int ix;
  207.     printf ("socket        = %dn", sock);
  208.     printf ("configReg base= 0x%-8x mask    = 0x%-8xn",
  209.     pCard->regBase, pCard->regMask);
  210.     for (pNode = DLL_FIRST(pList); pNode != NULL; pNode = DLL_NEXT(pNode))
  211. {
  212. pConfig = (CIS_CONFIG *)pNode;
  213. printf ("index         = 0x%-8xn", pConfig->index);
  214. printf ("interface     = 0x%-8xn", pConfig->interfaceType);
  215. printf ("Vcc  nom      = 0x%-8x min     = 0x%-8x max    = 0x%-8xn",
  216. pConfig->vcc[0], pConfig->vcc[1], pConfig->vcc[2]);
  217. printf ("Vpp1  nom     = 0x%-8x min     = 0x%-8x max    = 0x%-8xn",
  218. pConfig->vpp1[0], pConfig->vpp1[1], pConfig->vpp1[2]);
  219. printf ("Vpp2  nom     = 0x%-8x min     = 0x%-8x max    = 0x%-8xn",
  220. pConfig->vpp2[0], pConfig->vpp2[1], pConfig->vpp2[2]);
  221. printf ("IO Bus width  = 0x%-8x Lines   = 0x%-8x Ranges = 0x%-8xn",
  222. pConfig->ioBuswidth, pConfig->ioAddrlines, pConfig->ioRanges);
  223. for (ix = 0; ix < pConfig->ioRanges; ix++)
  224.     printf ("  start         = 0x%-8x stop    = 0x%-8xn",
  225.     pConfig->io[ix].start, pConfig->io[ix].stop);
  226. printf ("IRQ Mode      = 0x%-8x Mask    = 0x%-8xn",
  227. pConfig->irqMode, pConfig->irqMask);
  228. printf ("IRQ Level     = 0x%-8x Special = 0x%-8x Bitmap = 0x%4xn",
  229. pConfig->irqLevel, pConfig->irqSpecial, pConfig->irqBit.s);
  230. for (ix = 0; ix < 8; ix++)
  231.     {
  232.     if ((pConfig->mem[ix].length == 0) &&
  233. (pConfig->mem[ix].cAddr == 0) && 
  234.      (pConfig->mem[ix].hAddr == 0))
  235. continue;
  236.     printf ("  length        = 0x%-8x cAddr   = 0x%-8x hAddr  = 0x%-8xn",
  237.     pConfig->mem[ix].length, pConfig->mem[ix].cAddr, 
  238.     pConfig->mem[ix].hAddr);
  239.     }
  240. printf ("twins         = 0x%-8x audio   = 0x%-8xn",
  241. pConfig->twins, pConfig->audio);
  242. printf ("readonly      = 0x%-8x pwrdown = 0x%-8xnn",
  243. pConfig->readonly, pConfig->pwrdown);
  244. }
  245.     }
  246. /*******************************************************************************
  247. *
  248. * cisShowDevice - Show information in device information tuple.
  249. *
  250. * This routine shows CIS in the device information tuple.  Uses floating
  251. * point calculations.  The calling task needs to have VX_FP_TASK bit set
  252. * in its task flags.
  253. *
  254. * RETURNS: N/A
  255. */
  256. LOCAL void cisShowDevice
  257.     (
  258.     CIS_TUPLE *pTuple /* pointer to a tuple */
  259.     )
  260.     {
  261.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  262.     u_char *pEnd = pChar + pTuple->link;
  263.     BOOL speedExtended = FALSE;
  264.     BOOL typeExtended = FALSE;
  265.     u_char unit;
  266.     u_int size;
  267.     double speed;
  268.     while ((pChar < pEnd) && (*pChar != 0xff))
  269. {
  270. deviceInfos++;
  271. switch (*pChar & 0xf0)
  272.     {
  273.     case DTYPE_NULL:
  274. printf ("  Not a memory devicen");
  275. break;
  276.     case DTYPE_ROM:
  277. printf ("  Masked ROMn");
  278. break;
  279.     case DTYPE_OTPROM:
  280. printf ("  One-time programmable ROMn");
  281. break;
  282.     case DTYPE_EPROM:
  283. printf ("  UV EPROMn");
  284. break;
  285.     case DTYPE_EEPROM:
  286. printf ("  EEPROMn");
  287. break;
  288.     case DTYPE_FLASH:
  289. printf ("  Flash EPROMn");
  290. break;
  291.     case DTYPE_SRAM:
  292. printf ("  SRAMn");
  293. break;
  294.     case DTYPE_DRAM:
  295. printf ("  DRAMn");
  296. break;
  297.     case DTYPE_FUNCSPEC:
  298. printf ("  Function-specific memory address rangen");
  299. break;
  300.     case DTYPE_EXTEND:
  301. typeExtended = TRUE;
  302. break;
  303.     default:
  304. printf ("  Reserved device typen");
  305.     }
  306. if (*pChar & 0x08)
  307.     printf ("  Always writablen");
  308. else
  309.     printf ("  WPS and WP signal indicates itn");
  310. switch (*pChar & 0x07)
  311.     {
  312.     case DSPEED_NULL:
  313. break;
  314.     case DSPEED_250NS:
  315. printf ("  250nsn");
  316. break;
  317.     case DSPEED_200NS:
  318. printf ("  200nsn");
  319. break;
  320.     case DSPEED_150NS:
  321. printf ("  150nsn");
  322. break;
  323.     case DSPEED_100NS:
  324. printf ("  100nsn");
  325. break;
  326.     case DSPEED_EXT:
  327. speedExtended = TRUE;
  328. break;
  329.     default:
  330. printf ("  Reserved device speedn");
  331.     }
  332. pChar++;
  333. while (speedExtended)
  334.     {
  335.     if ((*pChar & 0x80) == 0x00)
  336. speedExtended = FALSE;
  337.     
  338.     speed = speedMantisa[(*pChar & 0x78) >> 3] * 
  339.     speedExponent[(*pChar & 0x07)];
  340.     printf ("  Speed=%1.9fn", speed);
  341.     pChar++;
  342.     }
  343. while (typeExtended)
  344.     {
  345.     if ((*pChar & 0x80) == 0x00)
  346. typeExtended = FALSE;
  347.     pChar++;
  348.     }
  349.     
  350. unit = ((*pChar & 0xf8) >> 3) + 1;
  351. size = deviceSize[*pChar & 0x07];
  352. printf ("  Device size = %d * 0x%x = 0x%xn", unit, size, unit * size);
  353. pChar++;
  354. }
  355.     }
  356. /*******************************************************************************
  357. *
  358. * cisShowVers1 - Show information in level-1 version/product information tuple.
  359. *
  360. * This routine shows CIS in the level-1 version/product information tuple.
  361. *
  362. * RETURNS: N/A
  363. */
  364. LOCAL void cisShowVers1
  365.     (
  366.     CIS_TUPLE *pTuple /* pointer to a tuple */
  367.     )
  368.     {
  369.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  370.     u_char *pEnd = pChar + pTuple->link;
  371.     printf ("  Major version number = %dn", *pChar++);
  372.     printf ("  Minor version number = %dn  ", *pChar++);
  373.     while ((pChar < pEnd) && (*pChar != 0xff))
  374. pChar += printf ("%s", pChar) + 1;
  375.     printf ("n");
  376.     }
  377. /*******************************************************************************
  378. *
  379. * cisShowGeometry - Show information in geometry tuple.
  380. *
  381. * This routine shows CIS in the geometry tuple.
  382. *
  383. * RETURNS: N/A
  384. */
  385. LOCAL void cisShowGeometry
  386.     (
  387.     CIS_TUPLE *pTuple /* pointer to a tuple */
  388.     )
  389.     {
  390.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  391.     CIS_BYTE2 cylinder;
  392.     printf ("  Sectors/track = %dn", *pChar++);
  393.     printf ("  Tracks/cylinder = %dn", *pChar++);
  394.     cylinder.c[0] = *pChar++;
  395.     cylinder.c[1] = *pChar++;
  396.     printf ("  Cylinder = %dn", cylinder.s);
  397.     }
  398. /*******************************************************************************
  399. *
  400. * cisShowJedec - Show information in JEDEC programming information tuple.
  401. *
  402. * This routine shows CIS in the JEDEC programming information tuple.
  403. *
  404. * RETURNS: N/A
  405. */
  406. LOCAL void cisShowJedec
  407.     (
  408.     CIS_TUPLE *pTuple /* pointer to a tuple */
  409.     )
  410.     {
  411.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  412.     u_char *pEnd = pChar + pTuple->link;
  413.     while ((pChar < pEnd) && (deviceInfos-- != 0))
  414. {
  415. printf ("  Manufacturer ID = 0x%xn", *pChar++);
  416. printf ("  Manufacturer's info = 0x%xn", *pChar++);
  417. }
  418.     }
  419. /*******************************************************************************
  420. *
  421. * cisShowDevgeo - Show information in Device geometry tuple.
  422. *
  423. * This routine shows CIS in the Device geometry tuple.
  424. *
  425. * RETURNS: N/A
  426. */
  427. LOCAL void cisShowDevgeo
  428.     (
  429.     CIS_TUPLE *pTuple /* pointer to a tuple */
  430.     )
  431.     {
  432.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  433.     u_char *pEnd = pChar + pTuple->link;
  434.     while ((pChar < pEnd) && (*pChar != 0xff))
  435. {
  436. printf ("  Internal bus width of card = %d bytesn",
  437. 1 << (*pChar++ - 1)); 
  438. printf ("  Erase geometry block size = %dn", 1 << (*pChar++ - 1)); 
  439. printf ("  Read geometry block size = %dn", 1 << (*pChar++ - 1)); 
  440. printf ("  Write geometry block size = %dn", 1 << (*pChar++ - 1)); 
  441. printf ("  Partition size = %dn", 1 << (*pChar++ - 1)); 
  442. printf ("  Interleave size = %dn", 1 << (*pChar++ - 1)); 
  443. }
  444.     }
  445. /*******************************************************************************
  446. *
  447. * cisShowManfid - Show information in Manufacturer ID tuple.
  448. *
  449. * This routine shows CIS in the Manufacturer ID tuple.
  450. *
  451. * RETURNS: N/A
  452. */
  453. LOCAL void cisShowManfid
  454.     (
  455.     CIS_TUPLE *pTuple /* pointer to a tuple */
  456.     )
  457.     {
  458.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  459.     CIS_BYTE2 manufacturerCode;
  460.     CIS_BYTE2 manufacturerInfo;
  461.     manufacturerCode.c[0] = *pChar++;
  462.     manufacturerCode.c[1] = *pChar++;
  463.     manufacturerInfo.c[0] = *pChar++;
  464.     manufacturerInfo.c[1] = *pChar++;
  465.     printf ("  Manufacturer code = 0x%xn", manufacturerCode.s);
  466.     printf ("  Manufacturer info = 0x%xn", manufacturerInfo.s);
  467.     }
  468. /*******************************************************************************
  469. *
  470. * cisShowFuncid - Show information in Function ID tuple.
  471. *
  472. * This routine shows CIS in the Function ID tuple.
  473. *
  474. * RETURNS: N/A
  475. */
  476. LOCAL void cisShowFuncid
  477.     (
  478.     CIS_TUPLE *pTuple /* pointer to a tuple */
  479.     )
  480.     {
  481.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  482.     switch (*pChar++)
  483. {
  484. case FUNC_MULTI:
  485.             cisFuncid = FUNC_MULTI;
  486.     printf ("  Multi functionn");
  487.     break;
  488. case FUNC_MEMORY:
  489.             cisFuncid = FUNC_MEMORY;
  490.     printf ("  Memoryn");
  491.     break;
  492. case FUNC_SERIAL:
  493.             cisFuncid = FUNC_SERIAL;
  494.     printf ("  Serial portn");
  495.     break;
  496. case FUNC_PARALLEL:
  497.             cisFuncid = FUNC_PARALLEL;
  498.     printf ("  Parallel portn");
  499.     break;
  500. case FUNC_FIXEDDISK:
  501.             cisFuncid = FUNC_FIXEDDISK;
  502.     printf ("  Fixed diskn");
  503.     break;
  504. case FUNC_VIDEO:
  505.             cisFuncid = FUNC_VIDEO;
  506.     printf ("  Video adaptorn");
  507.     break;
  508. case FUNC_LAN:
  509.             cisFuncid = FUNC_LAN;
  510.     printf ("  Network LAN adaptorn");
  511.     break;
  512. case FUNC_AIMS:
  513.             cisFuncid = FUNC_AIMS;
  514.     printf ("  AIMSn");
  515.     break;
  516. default:
  517.     printf ("  Reservedn");
  518.     break;
  519. }
  520.     
  521.     systemInitByte |= *pChar;
  522.     if (systemInitByte & 0x01)
  523. printf ("  System initialization is POSTn");
  524.     else
  525. printf ("  System initialization is ROMn");
  526.     }
  527. /*******************************************************************************
  528. *
  529. * cisShowFunce - Show information in Function extension tuple.
  530. *
  531. * This routine shows CIS in the Function extension tuple.
  532. *
  533. * RETURNS: N/A
  534. */
  535. LOCAL void cisShowFunce
  536.     (
  537.     CIS_TUPLE *pTuple /* pointer to a tuple */
  538.     )
  539.     {
  540.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  541.     if (cisFuncid == FUNC_SERIAL)
  542. {
  543. switch (*pChar & 0x0f)
  544.     {
  545.     case 0x00:
  546.     case 0x08:
  547.     case 0x09:
  548.     case 0x0a:
  549. printf ("  Serial port interfacen");
  550. cisShowFunceSerial (pTuple);
  551. break;
  552.     case 0x01:
  553.     case 0x05:
  554.     case 0x06:
  555.     case 0x07:
  556. printf ("  Modem interfacen");
  557. cisShowFunceModem (pTuple);
  558. break;
  559.     case 0x02:
  560. printf ("  Data modem interfacen");
  561. cisShowFunceDmodem (pTuple);
  562. break;
  563.     case 0x03:
  564. printf ("  Facsimile modem interfacen");
  565. cisShowFunceFmodem (pTuple);
  566. break;
  567.     case 0x04:
  568. printf ("  Voice modem interfacen");
  569. cisShowFunceVmodem (pTuple);
  570. break;
  571.     
  572.     default:
  573. printf ("  Reservedn");
  574.     }
  575. }
  576.     if (cisFuncid == FUNC_FIXEDDISK)
  577. {
  578. switch (*pChar++)
  579.     {
  580.     case 0x01:
  581. if (*pChar == 0x01)
  582.     printf ("  ATA interfacen");
  583. else
  584.     printf ("  Non ATA interfacen");
  585. break;
  586.     case 0x02:
  587. if ((*pChar & 0x03) == 0x00)
  588.     printf ("  Vpp power not requiredn");
  589. else if ((*pChar & 0x03) == 0x01)
  590.     printf ("  Vpp power required for media modification accessn");
  591. else if ((*pChar & 0x03) == 0x02)
  592.     printf ("  Vpp power required for all media accessn");
  593. else if ((*pChar & 0x03) == 0x03)
  594.     printf ("  Vpp power required continuouslyn");
  595. if (*pChar & 0x04)
  596.     printf ("  Silicon devicen");
  597. else
  598.     printf ("  Rotating devicen");
  599. if (*pChar & 0x08)
  600.     printf ("  Serial number is guaranteed uniquen");
  601. else
  602.     printf ("  Serial number may not be uniquen");
  603. pChar++;
  604. if (*pChar & 0x01)
  605.     printf ("  Sleep mode supportedn");
  606. else
  607.     printf ("  Sleep mode not supportedn");
  608. if (*pChar & 0x02)
  609.     printf ("  Standby mode supportedn");
  610. else
  611.     printf ("  Standby mode not supportedn");
  612. if (*pChar & 0x04)
  613.     printf ("  Idle mode supportedn");
  614. else
  615.     printf ("  Idle mode not supportedn");
  616. if (*pChar & 0x08)
  617.     printf ("  Drive automatically minimize powern");
  618. else
  619.     printf ("  Low power mode use required to minimize powern");
  620. if (*pChar & 0x10)
  621.     printf ("  Some primary or secondly IO addressing modes exclude 3F7 and/or 377 for floppy interfacen");
  622. else
  623.     printf ("  All primary and secondly IO addressing modes include ports 3F7/377n");
  624. if (*pChar & 0x20)
  625.     printf ("  Index bit is supported or emulatedn");
  626. else
  627.     printf ("  Index bit is not supported or emulatedn");
  628. if (*pChar & 0x40)
  629.     printf ("  -IOis16 is asserted only for data register on twin-card configurationn");
  630. else
  631.     printf ("  -IOis16 use is unspecified on twin-card configurationn");
  632.     }
  633. }
  634.     }
  635. /*******************************************************************************
  636. *
  637. * cisShowFunceSerial - Show information in Serial port Function extension tuple.
  638. *
  639. * This routine shows CIS in the Serial port Function extension tuple.
  640. *
  641. * RETURNS: N/A
  642. */
  643. LOCAL void cisShowFunceSerial
  644.     (
  645.     CIS_TUPLE *pTuple /* pointer to a tuple */
  646.     )
  647.     {
  648.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  649.     pChar++; /* skip the type of extended data */
  650.     switch (*pChar++)
  651. {
  652. case 0x0:
  653.     printf ("  8250 UART is presentn");
  654.     break;
  655. case 0x01:
  656.     printf ("  16450 UART is presentn");
  657.     break;
  658. case 0x02:
  659.     printf ("  16550 UART is presentn");
  660.     break;
  661. default:
  662.     printf ("  Reservedn");
  663. }
  664.     
  665.     if (*pChar & 0x01)
  666. printf ("  Space parity supportedn");
  667.     else
  668. printf ("  Space parity not supportedn");
  669.     if (*pChar & 0x02)
  670. printf ("  Mark parity supportedn");
  671.     else
  672. printf ("  Mark parity not supportedn");
  673.     if (*pChar & 0x04)
  674. printf ("  Odd parity supportedn");
  675.     else
  676. printf ("  Odd parity not supportedn");
  677.     if (*pChar & 0x08)
  678. printf ("  Even parity supportedn");
  679.     else
  680. printf ("  Even parity not supportedn");
  681.     
  682.     pChar++;
  683.     if (*pChar & 0x01)
  684. printf ("  5 bit data format is supportedn");
  685.     else
  686. printf ("  5 bit data format is not supportedn");
  687.     if (*pChar & 0x02)
  688. printf ("  6 bit data format is supportedn");
  689.     else
  690. printf ("  6 bit data format is not supportedn");
  691.     if (*pChar & 0x04)
  692. printf ("  7 bit data format is supportedn");
  693.     else
  694. printf ("  7 bit data format is not supportedn");
  695.     if (*pChar & 0x08)
  696. printf ("  8 bit data format is supportedn");
  697.     else
  698. printf ("  8 bit data format is not supportedn");
  699.     if (*pChar & 0x10)
  700. printf ("  1 stop bit is supportedn");
  701.     else
  702. printf ("  1 stop bit is not supportedn");
  703.     if (*pChar & 0x20)
  704. printf ("  1.5 stop bit is supportedn");
  705.     else
  706. printf ("  1.5 stop bit is not supportedn");
  707.     if (*pChar & 0x40)
  708. printf ("  2 stop bit is supportedn");
  709.     else
  710. printf ("  2 stop bit is not supportedn");
  711.     } 
  712. /*******************************************************************************
  713. *
  714. * cisShowFunceModem - Show information in Modem Function extension tuple.
  715. *
  716. * This routine shows CIS in the Modem Function extension tuple.
  717. *
  718. * RETURNS: N/A
  719. */
  720. LOCAL void cisShowFunceModem
  721.     (
  722.     CIS_TUPLE *pTuple /* pointer to a tuple */
  723.     )
  724.     {
  725.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  726.     CIS_BYTE4 rxBuf;
  727.     CIS_BYTE4 txBuf;
  728.     pChar++;
  729.     if (*pChar & 0x01)
  730. printf ("  Tx xon/xoff is supportedn");
  731.     else
  732. printf ("  Tx xon/xoff is not supportedn");
  733.     if (*pChar & 0x02)
  734. printf ("  Rx xon/xoff is supportedn");
  735.     else
  736. printf ("  Rx xon/xoff is not supportedn");
  737.     if (*pChar & 0x04)
  738. printf ("  Tx CTS is supportedn");
  739.     else
  740. printf ("  Tx CTS is not supportedn");
  741.     if (*pChar & 0x08)
  742. printf ("  Rx RTS is supportedn");
  743.     else
  744. printf ("  Rx RTS is not supportedn");
  745.     if (*pChar & 0x10)
  746. printf ("  Transparent flow control is supportedn");
  747.     else
  748. printf ("  Transparent flow control is not supportedn");
  749.     
  750.     pChar++;
  751.     printf ("  Size of command buffer = 0x%xn", (*pChar++ + 1) * 4);
  752.     rxBuf.c[0] = *pChar++;
  753.     rxBuf.c[1] = *pChar++;
  754.     rxBuf.c[2] = *pChar++;
  755.     rxBuf.c[3] = 0x00;
  756.     printf ("  Size of rx buffer = 0x%xn", rxBuf.l);
  757.     txBuf.c[0] = *pChar++;
  758.     txBuf.c[1] = *pChar++;
  759.     txBuf.c[2] = *pChar++;
  760.     txBuf.c[3] = 0x00;
  761.     printf ("  Size of tx buffer = 0x%xn", txBuf.l);
  762.     }
  763. /*******************************************************************************
  764. *
  765. * cisShowFunceDmodem - Show information in Data Modem Function extension tuple.
  766. *
  767. * This routine shows CIS in the Data Modem Function extension tuple.
  768. *
  769. * RETURNS: N/A
  770. */
  771. LOCAL void cisShowFunceDmodem
  772.     (
  773.     CIS_TUPLE *pTuple /* pointer to a tuple */
  774.     )
  775.     {
  776.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  777.     u_char *pEnd = pChar + pTuple->link;
  778.     CIS_BYTE2 maxdataRate;
  779.     pChar++;
  780.     maxdataRate.c[1] = *pChar++;
  781.     maxdataRate.c[0] = *pChar++;
  782.     printf ("  DTE to UART max data rate = %dn", maxdataRate.s);
  783.     printf ("  Modulation standart: ");
  784.     if (*pChar & 0x01)
  785. printf ("Bell-103 ");
  786.     if (*pChar & 0x02)
  787. printf ("V.21 ");
  788.     if (*pChar & 0x04)
  789. printf ("V.23 ");
  790.     if (*pChar & 0x08)
  791. printf ("V.22-A&B ");
  792.     if (*pChar & 0x10)
  793. printf ("Bell-212A ");
  794.     if (*pChar & 0x20)
  795. printf ("V.22-bis ");
  796.     if (*pChar & 0x40)
  797. printf ("V.26 ");
  798.     if (*pChar & 0x80)
  799. printf ("V.26-bis ");
  800.     pChar++;
  801.     if (*pChar & 0x01)
  802. printf ("V.27-bis ");
  803.     if (*pChar & 0x02)
  804. printf ("V.29 ");
  805.     if (*pChar & 0x04)
  806. printf ("V.32 ");
  807.     if (*pChar & 0x08)
  808. printf ("V.32-bis ");
  809.     if (*pChar & 0x10)
  810. printf ("VFAST ");
  811.     printf ("n");
  812.     pChar++;
  813.     printf ("  Error correction/detection protocol: ");
  814.     if (*pChar & 0x01)
  815. printf ("MNP2-4 ");
  816.     if (*pChar & 0x02)
  817. printf ("V.42/LAPM ");
  818.     printf ("n");
  819.     
  820.     pChar++;
  821.     printf ("  Data compression protocol: ");
  822.     if (*pChar & 0x01)
  823. printf ("V.42-bis ");
  824.     if (*pChar & 0x02)
  825. printf ("MNP5 ");
  826.     printf ("n");
  827.     
  828.     pChar++;
  829.     printf ("  Command protocols: ");
  830.     if (*pChar & 0x01)
  831. printf ("AT1 ");
  832.     if (*pChar & 0x02)
  833. printf ("AT2 ");
  834.     if (*pChar & 0x04)
  835. printf ("AT3 ");
  836.     if (*pChar & 0x08)
  837. printf ("MNP-AT ");
  838.     if (*pChar & 0x10)
  839. printf ("V.25-bis ");
  840.     if (*pChar & 0x20)
  841. printf ("V.25-A ");
  842.     if (*pChar & 0x40)
  843. printf ("DMCL ");
  844.     printf ("n");
  845.     pChar++;
  846.     printf ("  Escape mechanisms: ");
  847.     if (*pChar & 0x01)
  848. printf ("BREAK ");
  849.     if (*pChar & 0x02)
  850. printf ("+++ ");
  851.     if (*pChar & 0x04)
  852. printf ("user defined ");
  853.     printf ("n");
  854.     pChar++;
  855.     printf ("  Data encryption: reservedn");
  856.     pChar++;
  857.     printf ("  End user feature selection: ");
  858.     if (*pChar & 0x01)
  859. printf ("caller ID decodingn");
  860.     else
  861. printf ("caller ID not decodingn");
  862.     pChar++;
  863.     printf ("  Country code: ");
  864.     while ((pChar < pEnd) && (*pChar != 0xff))
  865. printf ("0x%x ", *pChar++);
  866.     printf ("n");
  867.     }
  868. /*******************************************************************************
  869. *
  870. * cisShowFunceFmodem - Show information in Fax Modem Function extension tuple.
  871. *
  872. * This routine shows CIS in the Fax Modem Function extension tuple.
  873. *
  874. * RETURNS: N/A
  875. */
  876. LOCAL void cisShowFunceFmodem
  877.     (
  878.     CIS_TUPLE *pTuple /* pointer to a tuple */
  879.     )
  880.     {
  881.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  882.     u_char *pEnd = pChar + pTuple->link;
  883.     CIS_BYTE2 maxdataRate;
  884.     if ((*pChar & 0xf0) == 0x10)
  885. printf ("  EIA/TIA-578 Service Class 1n");
  886.     if ((*pChar & 0xf0) == 0x20)
  887. printf ("  EIA/TIA-578 Service Class 2n");
  888.     if ((*pChar & 0xf0) == 0x30)
  889. printf ("  EIA/TIA-578 Service Class 3n");
  890.     pChar++;
  891.     maxdataRate.c[1] = *pChar++;
  892.     maxdataRate.c[0] = *pChar++;
  893.     printf ("  DTE to UART max data rate = %dn", maxdataRate.s * 75);
  894.     printf ("  Moduration standard: ");
  895.     if (*pChar & 0x01)
  896. printf ("V.21-C2 ");
  897.     if (*pChar & 0x02)
  898. printf ("V.27ter ");
  899.     if (*pChar & 0x04)
  900. printf ("V.29 ");
  901.     if (*pChar & 0x08)
  902. printf ("V.17 ");
  903.     if (*pChar & 0x10)
  904. printf ("V.33 ");
  905.     printf ("n");
  906.     
  907.     pChar++;
  908.     printf ("  Document Facsimile Feature Selection: ");
  909.     if (*pChar & 0x01)
  910. printf ("T.3 ");
  911.     if (*pChar & 0x02)
  912. printf ("T.4 ");
  913.     if (*pChar & 0x04)
  914. printf ("T.6 ");
  915.     if (*pChar & 0x08)
  916. printf ("error-correction-mode ");
  917.     if (*pChar & 0x10)
  918. printf ("voice-request ");
  919.     if (*pChar & 0x20)
  920. printf ("polling ");
  921.     if (*pChar & 0x40)
  922. printf ("file-transfer ");
  923.     if (*pChar & 0x80)
  924. printf ("password ");
  925.     printf ("n");
  926.     pChar += 2;
  927.     printf ("  Country code: ");
  928.     while ((pChar < pEnd) && (*pChar != 0xff))
  929. printf ("0x%x ", *pChar++);
  930.     printf ("n");
  931.     }
  932. /*******************************************************************************
  933. *
  934. * cisShowFunceVmodem - Show information in Voice Modem Function extension tuple.
  935. *
  936. * This routine shows CIS in the Voice Modem Function extension tuple.
  937. *
  938. * RETURNS: N/A
  939. */
  940. LOCAL void cisShowFunceVmodem
  941.     (
  942.     CIS_TUPLE *pTuple /* pointer to a tuple */
  943.     )
  944.     {
  945.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  946.     CIS_BYTE2 maxdataRate;
  947.     printf ("  Service class %dn", (*pChar & 0xf0) >> 14);
  948.     pChar++;
  949.     maxdataRate.c[1] = *pChar++;
  950.     maxdataRate.c[0] = *pChar++;
  951.     printf ("  DTE to UART max data rate = %dn", maxdataRate.s * 75);
  952.     while (*pChar != 0x00)
  953. {
  954. printf ("  Sample rate = %dn", *pChar * 1000 + *(pChar+1) * 10);
  955. pChar += 2;
  956. }
  957.     pChar++;
  958.     while (*pChar != 0x00)
  959. {
  960. printf ("  Sample size = %d.%dn", *pChar, *(pChar+1));
  961. pChar += 2;
  962. }
  963.     printf ("  Voice compression methods: reservedn");
  964.     }
  965. /*******************************************************************************
  966. *
  967. * cisShowConfig - Show information in Configuration tuple.
  968. *
  969. * This routine shows CIS in the Configuration tuple.
  970. *
  971. * RETURNS: N/A
  972. */
  973. LOCAL void cisShowConfig
  974.     (
  975.     CIS_TUPLE *pTuple /* pointer to a tuple */
  976.     )
  977.     {
  978.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  979.     u_char *pEnd = pChar + pTuple->link;
  980.     u_char mask[16];
  981.     u_char cisCentries;
  982.     u_int addrSize;
  983.     u_int maskSize;
  984.     u_int ix;
  985.     u_int size;
  986.     CIS_BYTE4 base;
  987.     CIS_BYTE4 interface;
  988.     CIS_TUPLE subtuple;
  989.     addrSize = (*pChar & 0x03) + 1;
  990.     maskSize = ((*pChar & 0x3c) >> 2) + 1;
  991.     printf ("  Sizeof configuration register base address = %dn", addrSize);
  992.     printf ("  Sizeof configuration register presence mask = %dn", maskSize);
  993.     pChar++;
  994.     if (pChar > pEnd)
  995. return;
  996.     
  997.     cisCentries = *pChar++;
  998.     printf ("  Last index = %dn", cisCentries);
  999.     base.l = 0;
  1000.     for (ix = 0; ix < addrSize; ix++)
  1001. base.c[ix] = *pChar++;
  1002.     
  1003.     printf ("  Base address = 0x%xn", base.l);
  1004.     printf ("  Mask = ");
  1005.     for (ix = 0; ix < maskSize; ix++)
  1006. {
  1007. mask[ix] = *pChar++;
  1008. printf ("0x%x ", mask[ix]);
  1009. }
  1010.     printf ("n");
  1011.     pChar++;
  1012.     while ((pChar < pEnd) && (*pChar != 0xff))
  1013. {
  1014. subtuple.code = *pChar++;
  1015. subtuple.link = *pChar++;
  1016. pEnd = pChar + subtuple.link;
  1017. size = ((*pChar & 0xc0) >> 6) + 1;
  1018. interface.l = 0;
  1019. for (ix = 0; ix < size; ix++)
  1020.     interface.c[ix] = *pChar++;
  1021. pChar++;
  1022.         printf ("  ");
  1023. while ((pChar < pEnd) && (*pChar != 0xff))
  1024.     pChar += printf ("%s", pChar) + 1;
  1025. printf ("n");
  1026. }
  1027.     }
  1028. /*******************************************************************************
  1029. *
  1030. * cisShowCtable - Show information in Configuration tuple.
  1031. *
  1032. * This routine shows CIS in the Configuration tuple.
  1033. *
  1034. * RETURNS: N/A
  1035. */
  1036. LOCAL void cisShowCtable
  1037.     (
  1038.     CIS_TUPLE *pTuple /* pointer to a tuple */
  1039.     )
  1040.     {
  1041.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  1042.     u_char featureSelection;
  1043.     u_char index;
  1044.     
  1045.     index = *pChar & 0x3f;
  1046.     printf ("  Index = %dn", index);
  1047.     if (*pChar & 0x40)
  1048. cisCdefault = pTuple;
  1049.     if (*pChar++ & 0x80)
  1050. {
  1051. printf ("  Interface type is %sn", interfaceType[*pChar & 0x07]);
  1052. if (*pChar & 0x10)
  1053.     printf ("  BVDs Activen");
  1054. else
  1055.     printf ("  BVDs Inactiven");
  1056. if (*pChar & 0x20)
  1057.     printf ("  WP Activen");
  1058. else
  1059.     printf ("  WP Inactiven");
  1060. if (*pChar & 0x40)
  1061.     printf ("  RdyBsy Activen");
  1062. else
  1063.     printf ("  RdyBsy Inactiven");
  1064. if (*pChar & 0x80)
  1065.     printf ("  M Wait Requiredn");
  1066. else
  1067.     printf ("  M Wait Not requiredn");
  1068. pChar++;
  1069. }
  1070.     featureSelection = *pChar++;
  1071.     if (featureSelection & 0x03)
  1072. {
  1073. printf ("  Power descriptionn");
  1074. pChar = cisShowCpower (pChar, featureSelection);
  1075. }
  1076.     if (featureSelection & 0x04)
  1077. {
  1078. printf ("  Timing descriptionn");
  1079. pChar = cisShowCtiming (pChar, featureSelection);
  1080. }
  1081.     if (featureSelection & 0x08)
  1082. {
  1083. printf ("  IOspace descriptionn");
  1084. pChar = cisShowCio (pChar, featureSelection);
  1085. }
  1086.     if (featureSelection & 0x10)
  1087. {
  1088. printf ("  IRQ descriptionn");
  1089. pChar = cisShowCirq (pChar, featureSelection);
  1090. }
  1091.     if (featureSelection & 0x60)
  1092. {
  1093. printf ("  MEMspace descriptionn");
  1094. pChar = cisShowCmem (pChar, featureSelection);
  1095. }
  1096.     if (featureSelection & 0x80)
  1097. {
  1098. printf ("  Misc descriptionn");
  1099. pChar = cisShowCmisc (pChar, featureSelection);
  1100. }
  1101.     
  1102.     cisShowCsub ((CIS_TUPLE *)pChar);
  1103.     }
  1104. /*******************************************************************************
  1105. *
  1106. * cisShowCpower - Show information in Power description structure.
  1107. *
  1108. * This routine shows CIS in the Power description structure.
  1109. *
  1110. * RETURNS: A pointer to next entry.
  1111. */
  1112. LOCAL u_char *cisShowCpower
  1113.     (
  1114.     u_char *pChar, /* pointer to power description */
  1115.     u_char featureSelection /* feature selection byte */
  1116.     )
  1117.     {
  1118.     u_char parameterSelection;
  1119.     char *pV = "";
  1120.     u_int ix;
  1121.     featureSelection &= 0x03;
  1122.     for (ix = 1; ix <= featureSelection; ix++)
  1123. {
  1124. if (ix == 1)
  1125.     pV = "Vcc";
  1126. if ((ix == 2) && (featureSelection == 2))
  1127.     pV = "Vpp";
  1128. if ((ix == 2) && (featureSelection == 3))
  1129.     pV = "Vpp1";
  1130. if (ix == 3)
  1131.     pV = "Vpp2";
  1132. parameterSelection = *pChar++;
  1133. if (parameterSelection & 0x01)
  1134.     do  {
  1135. printf ("    %s nominal V = 0x%xn", pV, *pChar++ & 0x7f);
  1136. } while (*(pChar-1) & 0x80);
  1137. if (parameterSelection & 0x02)
  1138.     do  {
  1139. printf ("    %s minimum V = 0x%xn", pV, *pChar++ & 0x7f);
  1140. } while (*(pChar-1) & 0x80);
  1141. if (parameterSelection & 0x04)
  1142.     do  {
  1143. printf ("    %s maximum V = 0x%xn", pV, *pChar++ & 0x7f);
  1144. } while (*(pChar-1) & 0x80);
  1145. if (parameterSelection & 0x08)
  1146.     do  {
  1147. printf ("    %s static I = 0x%xn", pV, *pChar++ & 0x7f);
  1148. } while (*(pChar-1) & 0x80);
  1149. if (parameterSelection & 0x10)
  1150.     do  {
  1151. printf ("    %s average I = 0x%xn", pV, *pChar++ & 0x7f);
  1152. } while (*(pChar-1) & 0x80);
  1153. if (parameterSelection & 0x20)
  1154.     do  {
  1155. printf ("    %s no peak I = 0x%xn", pV, *pChar++ & 0x7f);
  1156. } while (*(pChar-1) & 0x80);
  1157. if (parameterSelection & 0x40)
  1158.     do  {
  1159. printf ("    %s power down I = 0x%xn", pV, *pChar++ & 0x7f);
  1160. } while (*(pChar-1) & 0x80);
  1161. }
  1162.     return (pChar);
  1163.     }
  1164. /*******************************************************************************
  1165. *
  1166. * cisShowCtiming - Show information in Timing description structure.
  1167. *
  1168. * This routine shows CIS in the Timing description structure.
  1169. *
  1170. * RETURNS: A pointer to next entry.
  1171. * ARGSUSED
  1172. */
  1173. LOCAL u_char *cisShowCtiming
  1174.     (
  1175.     u_char *pChar, /* pointer to timing description */
  1176.     u_char featureSelection /* feature selection byte */
  1177.     )
  1178.     {
  1179.     u_int waitScale = *pChar & 0x03;
  1180.     u_int busyScale = (*pChar & 0x1c) >> 2;
  1181.     u_int reservedScale = (*pChar & 0xe0) >> 5;
  1182.     BOOL speedExtended;
  1183.     double waitTime;
  1184.     double busyTime;
  1185.     double reservedTime;
  1186.     pChar++;
  1187.     if (waitScale != 0x03)
  1188. {
  1189. speedExtended = TRUE;
  1190. while (speedExtended)
  1191.     {
  1192.     if ((*pChar & 0x80) == 0x00)
  1193. speedExtended = FALSE;
  1194.     waitTime = speedMantisa [(*pChar & 0x78) >> 3] *
  1195.        speedExponent [(*pChar & 0x07)] * waitScale;
  1196.     printf ("    Wait time = %1.9fn", waitTime);
  1197.     pChar++;
  1198.     }
  1199. }
  1200.     else
  1201. printf ("    Wait signal is not usedn");
  1202.     if (busyScale != 0x07)
  1203. {
  1204. speedExtended = TRUE;
  1205. while (speedExtended)
  1206.     {
  1207.     if ((*pChar & 0x80) == 0x00)
  1208. speedExtended = FALSE;
  1209.     busyTime = speedMantisa [(*pChar & 0x78) >> 3] *
  1210.        speedExponent [(*pChar & 0x07)] * busyScale;
  1211.     printf ("    Busy time = %1.9fn", busyTime);
  1212.     pChar++;
  1213.     }
  1214. }
  1215.     else
  1216. printf ("    Ready/Busy signal is not usedn");
  1217.     if (reservedScale != 0x07)
  1218. {
  1219. speedExtended = TRUE;
  1220. while (speedExtended)
  1221.     {
  1222.     if ((*pChar & 0x80) == 0x00)
  1223. speedExtended = FALSE;
  1224.     reservedTime = speedMantisa [(*pChar & 0x78) >> 3] *
  1225.    speedExponent [(*pChar & 0x07)] * reservedScale;
  1226.     printf ("    Reserved time = %1.9fn", reservedTime);
  1227.     pChar++;
  1228.     }
  1229. }
  1230.     else
  1231. printf ("    No reserved-time is definedn");
  1232.     
  1233.     return (pChar);
  1234.     }
  1235. /*******************************************************************************
  1236. *
  1237. * cisShowCio - Show information in IO description structure.
  1238. *
  1239. * This routine shows CIS in the IO description structure.
  1240. *
  1241. * RETURNS: A pointer to next entry.
  1242. */
  1243. LOCAL u_char *cisShowCio
  1244.     (
  1245.     u_char *pChar, /* pointer to IO description */
  1246.     u_char featureSelection /* feature selection byte */
  1247.     )
  1248.     {
  1249.     CIS_BYTE4 addr;
  1250.     CIS_BYTE4 length;
  1251.     u_int ioRanges;
  1252.     u_int addrSize;
  1253.     u_int lengthSize;
  1254.     printf ("    IO address lines = %dn", *pChar & 0x1f);
  1255.     printf ("    Bus width = ");
  1256.     if (*pChar & 0x20)
  1257. printf ("8 ");
  1258.     if (*pChar & 0x40)
  1259. printf ("16 ");
  1260.     printf ("n");
  1261.     if (*pChar++ & 0x80)
  1262. {
  1263. ioRanges = (*pChar & 0x07) + 1;
  1264. addrSize = (*pChar & 0x30) >> 4;
  1265. lengthSize = (*pChar & 0xc0) >> 6;
  1266. pChar++;
  1267. while (ioRanges--)
  1268.     {
  1269.     addr.l = 0;
  1270.     length.l = 0;
  1271.     if (addrSize == 1)
  1272. addr.c[0] = *pChar++;
  1273.     if (addrSize == 2)
  1274. {
  1275. addr.c[0] = *pChar++;
  1276. addr.c[1] = *pChar++;
  1277. }
  1278.     if (addrSize == 3)
  1279. {
  1280. addr.c[0] = *pChar++;
  1281. addr.c[1] = *pChar++;
  1282. addr.c[2] = *pChar++;
  1283. addr.c[3] = *pChar++;
  1284. }
  1285.     if (lengthSize == 1)
  1286. length.c[0] = *pChar++;
  1287.     if (lengthSize == 2)
  1288. {
  1289. length.c[0] = *pChar++;
  1290. length.c[1] = *pChar++;
  1291. }
  1292.     if (lengthSize == 3)
  1293. {
  1294. length.c[0] = *pChar++;
  1295. length.c[1] = *pChar++;
  1296. length.c[2] = *pChar++;
  1297. length.c[3] = *pChar++;
  1298. }
  1299.     printf ("    Addr = 0x%x length = 0x%xn", addr.l, length.l + 1);
  1300.     }
  1301. }
  1302.     
  1303.     return (pChar);
  1304.     }
  1305. /*******************************************************************************
  1306. *
  1307. * cisShowCirq - Show information in IRQ description structure.
  1308. *
  1309. * This routine shows CIS in the IRQ description structure.
  1310. *
  1311. * RETURNS: A pointer to next entry.
  1312. */
  1313. LOCAL u_char *cisShowCirq
  1314.     (
  1315.     u_char *pChar, /* pointer to IRQ description */
  1316.     u_char featureSelection /* feature selection byte */
  1317.     )
  1318.     {
  1319.     u_int ix;
  1320.     printf ("    Interrupt request mode is ");
  1321.     if (*pChar & 0x80)
  1322. printf ("Share ");
  1323.     if (*pChar & 0x40)
  1324. printf ("Pulse ");
  1325.     if (*pChar & 0x20)
  1326. printf ("Level ");
  1327.     printf ("n");
  1328.     printf ("    Interrupt request line is ");
  1329.     if (*pChar & 0x10)
  1330. {
  1331. if (*pChar & 0x08)
  1332.     printf ("VEND ");
  1333. if (*pChar & 0x04)
  1334.     printf ("BERR ");
  1335. if (*pChar & 0x02)
  1336.     printf ("IOCK ");
  1337. if (*pChar & 0x01)
  1338.     printf ("NMI ");
  1339.     
  1340.         for (ix = 0; ix < 8; ix++)
  1341.     if (*(pChar+1) & (1 << ix))
  1342.         printf ("%d ", ix);
  1343.         for (ix = 0; ix < 8; ix++)
  1344.     if (*(pChar+2) & (1 << ix))
  1345.         printf ("%d ", ix + 8);
  1346.     
  1347.         pChar += 3;
  1348.         }
  1349.     else
  1350. {
  1351. printf ("%d", *pChar & 0x0f);
  1352. pChar++;
  1353. }
  1354.     printf ("n");
  1355.     return (pChar);
  1356.     }
  1357. /*******************************************************************************
  1358. *
  1359. * cisShowCmem - Show information in Memory description structure.
  1360. *
  1361. * This routine shows CIS in the Memory description structure.
  1362. *
  1363. * RETURNS: A pointer to next entry.
  1364. */
  1365. LOCAL u_char *cisShowCmem
  1366.     (
  1367.     u_char *pChar, /* pointer to memory description */
  1368.     u_char featureSelection /* feature selection byte */
  1369.     )
  1370.     {
  1371.     u_char addrSize;
  1372.     u_char lengthSize;
  1373.     u_char windows;
  1374.     u_char hostaddr;
  1375.     CIS_BYTE4 cAddr;
  1376.     CIS_BYTE4 hAddr;
  1377.     CIS_BYTE4 length;
  1378.     if ((featureSelection & 0x60) == 0x20)
  1379. {
  1380. length.l = 0;
  1381. length.c[0] = *pChar++;
  1382. length.c[1] = *pChar++;
  1383. printf ("    Length = 0x%x  cardAddress = 0n", length.l * 256);
  1384. }
  1385.     else if ((featureSelection & 0x60) == 0x40)
  1386. {
  1387. length.l = 0;
  1388. cAddr.l = 0;
  1389. length.c[0] = *pChar++;
  1390. length.c[1] = *pChar++;
  1391. cAddr.c[0] = *pChar++;
  1392. cAddr.c[1] = *pChar++;
  1393. printf ("    Length = 0x%x cardAddress = 0x%xn",
  1394. length.l * 256, cAddr.l * 256);
  1395. }
  1396.     else if ((featureSelection & 0x60) == 0x60)
  1397. {
  1398. windows = (*pChar & 0x07) + 1;
  1399. lengthSize = (*pChar & 0x18) >> 3;
  1400. addrSize = (*pChar & 0x60) >> 5;
  1401. hostaddr = *pChar & 0x80;
  1402. while (windows--)
  1403.     {
  1404.     length.l = 0;
  1405.     cAddr.l = 0;
  1406.     hAddr.l = 0;
  1407.     if (lengthSize == 1)
  1408. length.c[0] = *pChar++;
  1409.     if (lengthSize == 2)
  1410. {
  1411. length.c[0] = *pChar++;
  1412. length.c[1] = *pChar++;
  1413. }
  1414.     if (lengthSize == 3)
  1415. {
  1416. length.c[0] = *pChar++;
  1417. length.c[1] = *pChar++;
  1418. length.c[2] = *pChar++;
  1419. length.c[3] = *pChar++;
  1420. }
  1421.     if (addrSize == 1)
  1422. cAddr.c[0] = *pChar++;
  1423.     if (addrSize == 2)
  1424. {
  1425. cAddr.c[0] = *pChar++;
  1426. cAddr.c[1] = *pChar++;
  1427. }
  1428.     if (addrSize == 3)
  1429. {
  1430. cAddr.c[0] = *pChar++;
  1431. cAddr.c[1] = *pChar++;
  1432. cAddr.c[2] = *pChar++;
  1433. cAddr.c[3] = *pChar++;
  1434. }
  1435.     if (hostaddr == 0x80)
  1436. {
  1437.         if (addrSize == 1)
  1438.     hAddr.c[0] = *pChar++;
  1439.         if (addrSize == 2)
  1440.     {
  1441.     hAddr.c[0] = *pChar++;
  1442.     hAddr.c[1] = *pChar++;
  1443.     }
  1444.         if (addrSize == 3)
  1445.     {
  1446.     hAddr.c[0] = *pChar++;
  1447.     hAddr.c[1] = *pChar++;
  1448.     hAddr.c[2] = *pChar++;
  1449.     hAddr.c[3] = *pChar++;
  1450.     }
  1451.         }
  1452.     printf ("    Length = 0x%x cardAddress = 0x%x hostAddress = 0x%xn",
  1453.     length.l * 256, cAddr.l * 256, hAddr.l * 256);
  1454.     }
  1455. }
  1456.     
  1457.     return (pChar);
  1458.     }
  1459. /*******************************************************************************
  1460. *
  1461. * cisShowCmisc - Show information in Misc description structure.
  1462. *
  1463. * This routine shows CIS in the Misc description structure.
  1464. *
  1465. * RETURNS: A pointer to next entry.
  1466. */
  1467. LOCAL u_char *cisShowCmisc
  1468.     (
  1469.     u_char *pChar, /* pointer to misc description */
  1470.     u_char featureSelection /* feature selection byte */
  1471.     )
  1472.     {
  1473.     BOOL extension = TRUE;
  1474.     while (extension)
  1475. {
  1476. if ((*pChar & 0x80) == 0x00)
  1477.     extension = FALSE;
  1478. printf ("    Max twins = %dn", *pChar & 0x07);
  1479. if (*pChar & 0x08)
  1480.     printf ("    Audion");
  1481. if (*pChar & 0x10)
  1482.     printf ("    Read onlyn");
  1483. if (*pChar & 0x20)
  1484.     printf ("    Power down bit is supportedn");
  1485. if (*pChar & 0x40)
  1486.     printf ("    Reservedn");
  1487. pChar++;
  1488. }
  1489.     
  1490.     return (pChar);
  1491.     }
  1492. /*******************************************************************************
  1493. *
  1494. * cisShowCsub - Show information in Sub tuple.
  1495. *
  1496. * This routine shows CIS in the Sub tuple.
  1497. *
  1498. * RETURNS: N/A
  1499. */
  1500. LOCAL void cisShowCsub
  1501.     (
  1502.     CIS_TUPLE *pTuple /* pointer to a tuple */
  1503.     )
  1504.     {
  1505.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  1506.     u_char *pEnd = pChar + pTuple->link;
  1507.     while ((pTuple->code == 0xc0) || (pTuple->code == 0xc1))
  1508. {
  1509.         printf ("    Configuration subtuplen");
  1510.         printf ("    ");
  1511. while ((pChar < pEnd) && (*pChar != 0xff))
  1512.     pChar += printf ("%s", pChar) + 1;
  1513. printf ("n");
  1514. pTuple = (CIS_TUPLE *)pEnd;
  1515. }
  1516.     }
  1517. /*******************************************************************************
  1518. *
  1519. * cisShowVers2 - Show information in level-2 version/product information tuple.
  1520. *
  1521. * This routine shows CIS in the level-2 version/product information tuple.
  1522. *
  1523. * RETURNS: N/A
  1524. */
  1525. LOCAL void cisShowVers2
  1526.     (
  1527.     CIS_TUPLE *pTuple /* pointer to a tuple */
  1528.     )
  1529.     {
  1530.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  1531.     CIS_BYTE2  index;
  1532.     pChar++;
  1533.     printf ("  Level of compliance = %dn", *pChar++);
  1534.     index.c[0] = *pChar++;
  1535.     index.c[1] = *pChar++;
  1536.     printf ("  Address of first data byte in card = 0x%xn", index.s);
  1537.     pChar += 2;
  1538.     printf ("  Vender specific bytes = 0x%x 0x%xn", *pChar++, *pChar++);
  1539.     printf ("  Number of copies of the CIS = 0x%xn", *pChar++);
  1540.     printf ("  ");
  1541.     pChar += printf ("%s", pChar) + 1;
  1542.     printf ("n  ");
  1543.     printf ("%sn", pChar);
  1544.     }
  1545. /*******************************************************************************
  1546. *
  1547. * cisShowFormat - Show information in format tuple.
  1548. *
  1549. * This routine shows CIS in the format tuple.
  1550. *
  1551. * RETURNS: N/A
  1552. */
  1553. LOCAL void cisShowFormat
  1554.     (
  1555.     CIS_TUPLE *pTuple /* pointer to a tuple */
  1556.     )
  1557.     {
  1558.     u_char *pChar = (u_char *)pTuple + sizeof(CIS_TUPLE);
  1559.     u_char type;
  1560.     u_char flag;
  1561.     u_char edc;
  1562.     CIS_BYTE4 offset;
  1563.     CIS_BYTE4 nBytes;
  1564.     CIS_BYTE4 nBlocks;
  1565.     CIS_BYTE4 edcLoc;
  1566.     CIS_BYTE4 addr;
  1567.     CIS_BYTE2 blockSize;
  1568.     type = *pChar++;
  1569.     if (type == 0)
  1570. printf ("  Format type = Diskn");
  1571.     else if (type == 0)
  1572. printf ("  Format type = Memoryn");
  1573.     else
  1574. printf ("  Format type = Vender specific 0x%xn", type);
  1575.     edc = *pChar++;
  1576.     printf ("  EDC type   = 0x%xn", (edc & 0x78) >> 3);
  1577.     printf ("  EDC length = 0x%xn", (edc & 0x07));
  1578.     offset.c[0] = *pChar++;
  1579.     offset.c[1] = *pChar++;
  1580.     offset.c[2] = *pChar++;
  1581.     offset.c[3] = *pChar++;
  1582.     printf ("  Address of first data byte  = 0x%xn", offset.l);
  1583.     nBytes.c[0] = *pChar++;
  1584.     nBytes.c[1] = *pChar++;
  1585.     nBytes.c[2] = *pChar++;
  1586.     nBytes.c[3] = *pChar++;
  1587.     printf ("  Number of data bytes  = 0x%xn", nBytes.l);
  1588.     if (type == 0)
  1589. {
  1590. blockSize.c[0] = *pChar++;
  1591. blockSize.c[1] = *pChar++;
  1592. nBlocks.c[0] = *pChar++;
  1593. nBlocks.c[1] = *pChar++;
  1594. nBlocks.c[2] = *pChar++;
  1595. nBlocks.c[3] = *pChar++;
  1596. printf ("  Block size            = %dn", 1 << blockSize.s);
  1597. printf ("  Number of data blocks = %dn", nBlocks.l);
  1598. edcLoc.c[0] = *pChar++;
  1599. edcLoc.c[1] = *pChar++;
  1600. edcLoc.c[2] = *pChar++;
  1601. edcLoc.c[3] = *pChar++;
  1602. if ((edc == 1) || (edc == 2))
  1603.     printf ("  EDC Location          = 0x%xn", edcLoc.l);
  1604. else if (edc == 3)
  1605.     printf ("  EDC PCC               = 0x%xn", edcLoc.c[0]);
  1606. }
  1607.     else if (type == 1)
  1608. {
  1609. flag = *pChar++;
  1610. pChar++;
  1611. addr.c[0] = *pChar++;
  1612. addr.c[1] = *pChar++;
  1613. addr.c[2] = *pChar++;
  1614. addr.c[3] = *pChar++;
  1615. edcLoc.c[0] = *pChar++;
  1616. edcLoc.c[1] = *pChar++;
  1617. edcLoc.c[2] = *pChar++;
  1618. edcLoc.c[3] = *pChar++;
  1619. printf ("  Flags = 0x%xn", flag);
  1620. if (flag & 1)
  1621.     printf ("  Mapped physical address = 0x%xn", addr.l);
  1622. printf ("  EDC location = 0x%xn", edcLoc.l);
  1623. }
  1624.     }