home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / DEV / DASD / OS2DASD / DMDATA.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-14  |  11.6 KB  |  241 lines

  1. /*DDK*************************************************************************/
  2. /*                                                                           */
  3. /* COPYRIGHT    Copyright (C) 1995 IBM Corporation                           */
  4. /*                                                                           */
  5. /*    The following IBM OS/2 WARP source code is provided to you solely for  */
  6. /*    the purpose of assisting you in your development of OS/2 WARP device   */
  7. /*    drivers. You may use this code in accordance with the IBM License      */
  8. /*    Agreement provided in the IBM Device Driver Source Kit for OS/2. This  */
  9. /*    Copyright statement may not be removed.                                */
  10. /*                                                                           */
  11. /*****************************************************************************/
  12. /*static char *SCCSID = "src/dev/dasd/os2dasd/dmdata.c, dsdm, r207 93/10/08";*/
  13. #define SCCSID  "src/dev/dasd/os2dasd/dmdata.c, dsdm, r207 93/10/08"
  14.  
  15. /**************************************************************************
  16.  *
  17.  * SOURCE FILE NAME = DMDATA.C
  18.  *
  19.  * DESCRIPTIVE NAME = OS2DASD.DMD - OS/2 DASD Device Manager
  20.  *
  21.  *
  22.  *
  23.  * VERSION = V2.0
  24.  *
  25.  * DATE
  26.  *
  27.  * DESCRIPTION : Static/Initialization data for DASD Device Mgr
  28.  *
  29.  *
  30.  *
  31. */
  32.  
  33. #define INCL_NOBASEAPI
  34. #define INCL_NOPMAPI
  35. #define INCL_ERROR_H
  36.  
  37. #include "os2.h"
  38. #include "misc.h"
  39. #include "dmdefs.h"
  40.  
  41. #include "devhdr.h"
  42. #include "devcmd.h"
  43. #include "strat2.h"
  44. #include "reqpkt.h"
  45. #include "dhcalls.h"
  46. #include "scb.h"
  47. #include "abios.h"
  48. #include "iorb.h"
  49.  
  50. #include "rmbase.h"
  51. #include "rmcalls.h"
  52.  
  53. #include "dmtrace.h"
  54. #include "dmgencb.h"
  55. #include "dmproto.h"
  56. #include "dmioctl.h"
  57. #include "ioctl.h"
  58. #include "dskioctl.h"
  59.  
  60. /***************************************************************/
  61. /*  GLOBAL DATA                                                */
  62. /*  -----------                                                */
  63. /*  1. Static data                                             */
  64. /*  2. Dynamic data allocated at init time:                    */
  65. /*     - UnitCB                                                */
  66. /*     - VolCB                                                 */
  67. /*     - VCS                                                   */
  68. /*  3. Dynamic data allocated at run time:                     */
  69. /*     - IORB                                                  */
  70. /*  4. Static init data discarded after init time              */
  71. /***************************************************************/
  72.  
  73. #define MAXADAPTERDRIVERS       32         /* Max adapter device drivers     */
  74.  
  75. /*  ScratchBuffer should appear after DiskDDHeader and should not be         */
  76. /*  moved to make sure it does not span a 64K boundary.  It wont here        */
  77. /*  since the data segment is page frame aligned.                            */
  78.  
  79. UCHAR           ScratchBuffer[512] = {0};  /* Scratch buffer for I/O         */
  80.  
  81. PFN             Device_Help=0L;            /* far ptr to devhelp function    */
  82. PBYTE           pSysInfoSeg=0L;            /* Pointer to sys info seg        */
  83. PBYTE           pSIS_mec_table=0L;         /* Pointer to RAS MEC Trace Table */
  84. PVOID           pDataSeg=0L;               /* virt ptr of our data segment   */
  85. ULONG           ppDataSeg=0L;              /* phys addr of our data segment  */
  86. ULONG           plDataSeg=0L;              /* linear addr of our data seg    */
  87. ULONG           ppScratchBuffer=0L;        /* Phys addr of ScratchBuffer     */
  88. USHORT          ScratchBufSem=0;           /* Semaphore for ScratchBuffer    */
  89. USHORT          DDFlags=0;                 /* Global driver flags            */
  90. USHORT          DefaultQueueMethod=0;      /* Queuing - priority/nopriority  */ /*@V74404*/
  91. USHORT          DefaultSortMethod=0;       /* Sorting - fifo/elevator        */ /*@V74404*/
  92.  
  93. NPUNITCB        UnitCB_Head=0;             /* near ptr to first UnitCB       */
  94. NPVOLCB         VolCB_Head=0;              /* near ptr to first VolCB        */
  95. NPVOLCB         pVolCB_DriveA=0;           /* Pointer to A: VolCB            */
  96. NPVOLCB         pVolCB_DriveB=0;           /* Pointer to B: VolCB            */
  97. NPVOLCB         pVolCB_DriveC=0;           /* Pointer to C: VolCB            */
  98. NPVOLCB         pVolCB_80=0;               /* Pointer to VolCB for drive 80H */
  99. USHORT          NextLogDriveNum=0;         /* next logical drive number      */
  100.  
  101. NPBYTE          pNextFreeCB=0;             /* ptr to next free control blk   */
  102. NPVOLCB         pLastLogVolCB=0;
  103.  
  104. USHORT          NumDrivers=0;              /* number of adapter drivers      */
  105. USHORT          NumUnitCBs=0;              /* number of unit control blocks  */
  106. USHORT          NumVolCBs=0;               /* number of volume control blocks*/
  107. USHORT          NumLogDrives=0;            /* number of logical drives       */
  108. USHORT          NumRemovableDisks=0;       /* number of removable disk drives*/
  109. USHORT          NumFixedDisks=0;           /* number of fixed disk drives    */
  110. USHORT          NumPartitions=0;           /* number of fixed disk partitions*/
  111. USHORT          NumFTPartitions=0;         /* number of fault tol. partitions*/
  112. NPVOLCB         pExtraVolCBs=0;            /* Pointer to extra volcbs        */
  113. USHORT          NumExtraVolCBs=0;          /* number of extra volcbs         */
  114. USHORT          NumAdapters=0;             /* number of adapters             */
  115. USHORT          NumReqsInProgress=0;       /* num requests in progress       */
  116. USHORT          NumReqsWaiting=0;          /* num requests on waiting queues */
  117. USHORT          TraceFlags=0;              /* Trace Flags                    */
  118. NPBYTE          pDMTraceBuf=0;             /* pointer to internal trace buffer*/
  119. NPBYTE          pDMTraceHead=0;            /* pointer to head of trace buffer */
  120. NPBYTE          pDMTraceEnd=0;             /* pointer to end of trace buffer */
  121.  
  122. NPBYTE          CB_FreeList=0;             /* Control Block Free List for    */
  123.                                            /*  IORBs and CWAs                */
  124.  
  125. USHORT          PoolSem=0;                 /* Pool semaphore                 */
  126. USHORT          PoolSize=0;                /* Size of control block pool     */
  127. USHORT          FreePoolSpace=0;           /* Free space left in pool        */
  128.  
  129. UCHAR           fBigFat=0;                 /* flags for drives               */
  130. UCHAR           XActPDrv=0;
  131.  
  132. PVOID           pFSD_EndofInt=0L;          /* FSD's End of interrupt routine */
  133. PVOID           pFSD_AccValidate=0L;       /* FSD's Access Validation routine*/
  134. PVOID           pDiskFT_Request=0L;        /* DISKFT's Request routine       */
  135. PVOID           pDiskFT_Done=0L;           /* DISKFT's Done routine          */
  136. USHORT          DiskFT_DS=0L;              /* DISKFT's DS selector           */
  137.  
  138. PRTYQ           DeferredQRP={0};           /* Queue for Deferred FT Requests */
  139. PRTYQ           DeferredQRLE={0};          /* Queue for Deferred FT Requests */
  140. USHORT          NumReqsDeferred=0;         /* num requests on Deferred queues*/
  141.  
  142.  
  143. DriverCaps      DriverCapabilities= {0};   /* Driver Capabilities structure  */
  144.  
  145. BYTE            PFV_PreviousState=0;                                 /*@V55646*/
  146.  
  147. DISKTABLE_ENTRY  DiskTable[DISKTABLECOUNT] =
  148.                            {
  149.                                { 32l*KB, 3,   8, 512, 0},
  150.                                { 64l*KB, 2,   4, 512, vf_Big},
  151.                                {256l*KB, 2,   4, 512, vf_Big},
  152.                                {512l*KB, 3,   8, 512, vf_Big},
  153.                                {  1l*MB, 4,  16, 512, vf_Big},
  154.                                {  2l*MB, 5,  32, 512, vf_Big},
  155.                                {  4l*MB, 6,  64, 512, vf_Big},
  156.                                {  8l*MB, 7,  64, 512, vf_Big+vf_NoDOSPartition},
  157.                             {0xFFFFFFFF, 7,  64, 512, vf_Big+vf_NoDOSPartition}
  158.                            };
  159.  
  160.  
  161.  
  162. BPB  BPB_Minimum = {512, 1, 1, 1, 16,  4,    0xF0,        1,  0, 0, 0, 0};
  163. BPB  BPB_160KB   = {512, 1, 1, 2, 64,  320,  MEDIA_160KB, 1,  8, 1, 0, 0};
  164. BPB  BPB_180KB   = {512, 1, 1, 2, 64,  360,  MEDIA_180KB, 2,  9, 1, 0, 0};
  165. BPB  BPB_320KB   = {512, 2, 1, 2, 112, 640,  MEDIA_320KB, 1,  8, 2, 0, 0};
  166. BPB  BPB_360KB   = {512, 2, 1, 2, 112, 720,  MEDIA_360KB, 2,  9, 2, 0, 0};
  167. BPB  BPB_12MB    = {512, 1, 1, 2, 224, 2400, MEDIA_12MB,  7, 15, 2, 0, 0};
  168. BPB  BPB_720KB   = {512, 2, 1, 2, 112, 1440, MEDIA_720KB, 3,  9, 2, 0, 0};
  169. BPB  BPB_144MB   = {512, 1, 1, 2, 224, 2880, MEDIA_144MB, 9, 18, 2, 0, 0};
  170. BPB  BPB_288MB   = {512, 2, 1, 2, 240, 5760, MEDIA_288MB, 9, 36, 2, 0, 0};
  171.  
  172. PBPB DummyBPB = 0L;                     /* Pointer to BPB for drive aliasing*/
  173.  
  174. NPBPB InitBPBArray[MAX_DRIVE_LETTERS]={0}; /* BPB array returned in INIT packet*/
  175.  
  176. /* Note: If changing number of CmdTable entries, update DMDATA.H also */
  177.  
  178. CMDTABLE CmdTable[20] =                                              /*@V84908*/
  179. {                                                                    /*VVVVVVV*/
  180.    {PB_REQ_LIST*256 + PB_READ_X,            TRACE_READ},
  181.    {PB_REQ_LIST*256 + PB_WRITE_X,           TRACE_WRITE},
  182.    {PB_REQ_LIST*256 + PB_WRITEV_X,          TRACE_WRITE + TRACE_VERIFY},
  183.    {PB_REQ_LIST*256 + PB_PREFETCH_X,        TRACE_READ + TRACE_PREFETCH},
  184.    {IOCC_EXECUTE_IO*256+IOCM_READ,          TRACE_READ},
  185.    {IOCC_EXECUTE_IO*256+IOCM_WRITE,         TRACE_WRITE},
  186.    {IOCC_EXECUTE_IO*256+IOCM_WRITE_VERIFY,  TRACE_WRITE | TRACE_VERIFY},
  187.    {IOCC_EXECUTE_IO*256+IOCM_READ_VERIFY,   TRACE_READ | TRACE_VERIFY},
  188.    {IOCC_EXECUTE_IO*256+IOCM_READ_PREFETCH, TRACE_READ | TRACE_PREFETCH},
  189.    {IOCC_FORMAT*256+IOCM_FORMAT_TRACK,      TRACE_FORMAT | TRACE_VERIFY},
  190.    {CMDINPUT,         TRACE_READ},
  191.    {CMDInputBypass,   TRACE_READ},
  192.    {CMDOUTPUT,        TRACE_WRITE},
  193.    {CMDOutputBypass,  TRACE_WRITE},
  194.    {CMDOUTPUTV,       TRACE_WRITE | TRACE_VERIFY},
  195.    {CMDOutputBypassV, TRACE_WRITE | TRACE_VERIFY},
  196.    {CMDGenIOCTL*256 + IODC_RT, TRACE_IOCTL | TRACE_READ},
  197.    {CMDGenIOCTL*256 + IODC_WT, TRACE_IOCTL | TRACE_WRITE},
  198.    {CMDGenIOCTL*256 + IODC_VT, TRACE_IOCTL | TRACE_READ | TRACE_VERIFY},
  199.    {CMDGenIOCTL*256 + IODC_FT, TRACE_IOCTL | TRACE_FORMAT | TRACE_VERIFY},
  200. };                                                                   /*AAAAAAA*/
  201.                                                                      /*@V84908*/
  202. PFNRM   RM_Help0   = NULL;
  203. PFNRM   RM_Help3   = NULL;
  204.  
  205. HDRIVER hRMOS2DASD = NULL;
  206.  
  207. USHORT  RMFlags    = 0;
  208.  
  209. /*  UnitCBs are allocated after all static data                              */
  210. UNITCB          FirstUnitCB[1]={0};     /* First UnitCB allocated here       */
  211.  
  212. USHORT          CBPool[24*KB]={0};      /* Pool for Control blocks           */
  213.  
  214.  
  215. UCHAR RMFixed_Txt[]     = "FIXDSK_#  Fixed Disk Drive ";
  216. UCHAR RMRemovable_Txt[] = "REMDSK_#  Removable Disk Drive";
  217. UCHAR RMDskt_Txt[]      = "DSKT_#  Diskette Drive "  ;
  218.  
  219. UCHAR RMSysName_Txt[]   = "x:  Logical DASD Volume";
  220.  
  221. UCHAR OS2DASD_Txt01[] = "OS2DASD.DMD";
  222. UCHAR OS2DASD_Txt02[] = "OS2DASD OS/2 DASD Device Manager";
  223. UCHAR OS2DASD_Txt03[] = "IBM";
  224.  
  225. #define OS2DASD_VER_MAJOR       3
  226. #define OS2DASD_VER_MINOR       0
  227.  
  228. DRIVERSTRUCT RMDASDDesc =
  229. {
  230.   OS2DASD_Txt01,              /* DrvrName;       */
  231.   OS2DASD_Txt02,              /* DrvrDescript;   */
  232.   OS2DASD_Txt03,              /* VendorName;     */
  233.   CMVERSION_MAJOR,            /* MajorVer;       */
  234.   CMVERSION_MINOR,            /* MinorVer;       */
  235.   1994, 9, 13,                /* Date;           */
  236.   DRF_STATIC,                 /* DrvrFlags;      */
  237.   DRT_ADDDM,                  /* DrvrType;       */
  238.   DRS_DM,                     /* DrvrSubType;    */
  239.   NULL                        /* DrvrCallback;   */
  240. };
  241.