home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v2.zip / DDKX86 / DBCSDD / INC / DEVSYM.INC < prev    next >
Text File  |  1995-04-14  |  12KB  |  330 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. ;       SCCSID = @(#)devsym.inc    6.1 90/11/16
  12. ;      SCCSID = @(#)devsym.inc    13.12 90/06/14
  13.  
  14. page ,132
  15.  
  16. include devhdr.inc
  17. include devcmd.inc
  18.  
  19. ;**    Static Request Header
  20. ;
  21. ;    This structure defines the fixed first part of a device request
  22. ;    record.  Depending upon the request there may be other fields
  23. ;    which follow this header.
  24. ;
  25. ; Zibo notes that we should STOP using this weird stuff and use one set of
  26. ; structures and equates rather than lots of casting.  After this section is
  27. ; the new stuff we should use.
  28. ;
  29.  
  30. SrHead    STRUC
  31. ReqLen    DB    ?        ; Length in bytes of request block
  32. ReqUnit DB    ?        ; Device unit number
  33. ReqFunc DB    ?        ; Type of request
  34. ReqStat DW    ?        ; Status Word
  35.     DD    ?        ; RESERVED
  36. DevLink DD    ?        ; link field for use by driver to chain
  37.                 ;   requests.  (A service in DevHelp)
  38. SrHead    ENDS
  39.  
  40.  
  41. ;*    Other fields beyond the standard 13 byte header
  42.  
  43.  
  44. ; Status word masks
  45. STERR    EQU    8000H        ; Bit 15 - Error
  46. STINTER EQU    0400H        ; Bit 10 - Interim character
  47. STBUI    EQU    0200H        ; Bit  9 - Busy
  48. STDON    EQU    0100H        ; Bit  8 - Done
  49. STECODE EQU    00FFH        ; Error code
  50. WRECODE EQU    0
  51.  
  52. ;**    Device Driver Request Packet Defintions
  53. ;
  54.  
  55.  
  56. PktMax        equ    18
  57. PktHeadSize    equ    13
  58.  
  59. Packet        struc
  60. PktLen        db    ?        ; length in bytes of packet
  61. PktUnit        db    ?        ; subunit number of block device
  62. PktCmd        db    ?        ; command code
  63. PktStatus    dw    ?        ; status word
  64. PktFlag         db      ?        ; disk driver internal flags
  65.         db    3 dup(?)        ; reserved
  66. PktDevLink    dd    ?        ; device multiple-request link
  67. PktData        db    PktMax dup (?)    ; data pertaining to specific packet
  68. Packet        ends
  69.  
  70. PktDOSLink    equ    (dword ptr PktFlag)
  71.  
  72. ;**    Device Driver Request Packet Equates
  73. ;
  74.  
  75.  
  76. fPktInt13RP    equ    01H        ; Int 13 Request Packet 
  77. fPktCallOutDone equ    02H        ; Int 13 Callout completed
  78. fPktDiskIOTchd  equ    04H        ; Disk_IO has touched this packet
  79.  
  80.  
  81. ;CMDInit        equ    0            ; INIT command
  82. ;CMDInitBase    equ    27            ; INIT command for base DDs
  83. InitcUnit    equ    byte ptr PktData    ; number of units returned
  84. InitpEnd    equ    dword ptr PktData+1    ; pointer to free mem after dev
  85. InitDevHlp    equ    dword ptr PktData+1    ; address of Device Helper router
  86. InitEcode    equ    word ptr PktData+1    ; size of code segment
  87. InitEdata    equ    word ptr PktData+3    ; size of data segment
  88. InitParms    equ    dword ptr PktData+5    ; pointer parameters
  89. InitpBPB    equ    dword ptr PktData+5    ; pointer to BPBs
  90. Initdrv        equ    byte ptr PktData+9    ; drive no. assigned to unit 0
  91.                         ; for resident drivers only:
  92. InitSysiData    equ    byte ptr PktData+11    ; SysInit's DOSALIAS selector
  93.  
  94. LENInit        equ    10            ; non-resident drivers
  95. LENInitRes    equ    (LENInit + 2)        ; resident drivers
  96. .errnz        (PktMax LT LENInit)
  97. .errnz        (PktMax LT LENInitRes)
  98.  
  99. ;CMDGetDevSupport equ    1dh            ; query for extended capability    
  100. DCS_Addr    equ    dword ptr PktData+3    ; 16:16 of driver caps struc
  101. VCS_Addr    equ    dword ptr PktData+7    ; 16:16 of volume char struc
  102. LENGetDevSpprt    equ    11
  103.  
  104. ;CMDMedChk    equ    1            ; Media Check
  105. MedChkmedia    equ    byte ptr PktData    ; last media byte seen
  106. MedChkflag    equ    byte ptr PktData+1    ; -1=change 0=dont know 1=no change
  107. MedChkpVID    equ    dword ptr PktData+2    ; pointer to VID
  108. LENMedChk    equ    6
  109. .errnz        (PktMax LT LENMedChk)
  110.  
  111. ;CMDBldBPB    equ    2            ; build BPB
  112. BldBPBmedia    equ    byte ptr PktData    ; media byte
  113. BldBPBbuffer    equ    dword ptr PktData+1    ; scratch buffer
  114. BldBPBpBPB    equ    dword ptr PktData+5    ; returned pointer to BPB
  115. LENBldBPB    equ    9
  116. .errnz        (PktMax LT LENBldBPB)
  117.  
  118. ;CMDIOCTLR    equ    3            ; reserved for 3.x compatability
  119. ;CMDINPUT    equ    4            ; read data from device
  120. ;CMDOUTPUT    equ    8            ; write data to device
  121. ;CMDOUTPUTV    equ    9            ; write data and verify
  122. ;CMDInputBypass         EQU    24            ; cache bypass read data    ?? Needed any more ??
  123. ;CMDOutputBypass         EQU    25            ; cache bypass write data   ?? Needed any more ??
  124. ;CMDOutputBypassV     EQU    26            ; cache bypass write data and verify  ?? Needed any more ??
  125. ;CMDIOCTLW    equ    12            ; reserved for 3.x compatability
  126. IOmedia        equ    byte ptr PktData    ; media byte
  127. IOpData        equ    dword ptr PktData+1    ; transfer address
  128. IOcount        equ    word ptr PktData+5    ; count of bytes/sectors
  129. IOstart        equ    word ptr PktData+7    ; starting sector (block)
  130.                         ; starting sector is a DD
  131. IOPhysRBA    equ    dword ptr PktData+7    ; physical starting sector
  132.  
  133. ; IOSFN allows char device to virtualize based on open instance. E.g. if user
  134. ; opens LPT twice the spooler can use IOSFN field to tell one from another.
  135. ; IOSFN is mapped as follows (let N = RESIOSFN):
  136. ;         0    to     MAXSFN-1: real SFN    [MAXSFN <= 65536-512-N]
  137. ;  65536-512-N    to  65536-256-N-1: fake SFN
  138. ;  65536-256-N    to    65536-N-1: FCB SFN
  139. ;      65536-N    to      65536-1: unknown
  140. ;
  141. ; Note for multiple 3xbox the range for fake SFN will have to be expanded by
  142. ; 256 per 3xbox. Either that or choose a different mapping scheme.
  143.  
  144. IOSFN        equ    word ptr PktData+11    ; for device only
  145. LENIO        equ    13
  146. PktAdvise    equ    word ptr PktData+13    ; for >= v12 only
  147. .errnz        (PktMax LT LENIO)
  148.  
  149. ReadBypassAdj    equ    CMDInputBypass-CMDINPUT ; used internally by kernel
  150. WriteBypassAdj    equ    CMDOutputBypass-CMDOUTPUT ; used internally by kernel
  151.  
  152. ;CMDNDR        equ    5            ; non-destructive read
  153. NDRbyte        equ    byte ptr PktData    ; byte read from device
  154. LENNDR        equ    1
  155. .errnz        (PktMax LT LENNDR)
  156.  
  157. ;CMDInputS    equ    6            ; input status
  158. ;CMDOutputS    equ    10            ; output status
  159. LENStatus    equ    0
  160. .errnz        (PktMax LT LENStatus)
  161.  
  162. ;CMDInputF    equ    7            ; input flush
  163. ;CMDOutputF    equ    11            ; output flush
  164. LENFlush    equ    0
  165. .errnz        (PktMax LT LENFlush)
  166.  
  167. ;CMDOpen        equ    13            ; device open
  168. ;CMDClose    equ    14            ; device close
  169. OCSFN        equ    word ptr PktData    ; sfn of open instance for virtualization
  170. OCLastRef    equ    word ptr PktData+2    ; flag indicating last close
  171. LENOpnCls    equ    4
  172. .errnz        (PktMax LT LENOpnCls)
  173.  
  174. ;CMDRemMed    equ    15            ; is media removable
  175. LENRemMed    equ    0
  176. .errnz        (PktMax LT LENRemMed)
  177.  
  178. ;CMDStart EQU    98                ; start console output
  179. ;CMDStop EQU    99                ; stop console output
  180. CStpSKG EQU    BYTE PTR PktData+0        ; Screen/Keyboard number
  181. LenStp    EQU    1                ; Size of request additions.
  182. .errnz        (PktMax LT LenStp)
  183.  
  184. ;CMDGenIOCTL    EQU    16            ; Generic IOCTL
  185. GIOCategory    EQU    BYTE PTR PktData    ; Category Code
  186. GIOFunction    EQU    BYTE PTR PktData+1    ; Function code
  187. GIOParaPack    EQU    DWORD PTR PktData+2    ; pointer to parameter packet
  188. GIODataPack    EQU    DWORD PTR PktData+6    ; pointer to data packet
  189. GIOSFN        EQU    WORD PTR PktData+10    ; (used by Spooler?)
  190. LENGenIOCTL    EQU    12            ; length w/o new parameters
  191. .errnz        (PktMax LT LENGenIOCTL)
  192.                         ; new parameters
  193. GIOParaLen    EQU    WORD PTR PktData+12    ; length of parameter packet
  194. GIODataLen    EQU    WORD PTR PktData+14    ; length of data packet
  195. LENGenIOCTL2    EQU    16            ; length w/ new parameters
  196. .errnz        (PktMax LT LENGenIOCTL2)
  197.  
  198.  
  199. ;CMDDeInstall    EQU    20            ; De-Install driver
  200. ; DINEndLocn    EQU    DWORD PTR PktData
  201. ; DINLength    EQU    WORD PTR PktData+5
  202. LENDeIn        EQU    0
  203. .errnz        (PktMax LT LENDeIn)
  204.  
  205. ;CMDResMed    EQU    17            ; reset media uncertain
  206. LENResMed    equ    0
  207. .errnz        (PktMax LT LENResMed)
  208.  
  209. ;CMDAddOnPrep    EQU    97            ; Prepare for add on
  210. Add_On_NewDD    EQU    DWORD PTR PktData
  211. Add_On_SrvRout    EQU    DWORD PTR PktData
  212. LenAddOn    EQU    4
  213.  
  214. ;CMDGetLogMap    EQU    18
  215. ;CMDSetLogMap    EQU    19
  216. Logical_Drive    EQU    BYTE PTR PktData; logical drive number
  217. LenGetSetLog    EQU    1
  218.  
  219. ;CMDPartfixeddisks    EQU  22           ; Partitionable Fixed Disks
  220. ;CMDGetfd_logunitsmap    EQU  23           ; Get Fixed Disk/Logical Unit Map
  221.  
  222. LENShutdown    equ    5
  223. SDFuncCode    equ    byte ptr PktData
  224. SDReserveLow    equ    word ptr PktData+1
  225. SDReserveHigh    equ    word ptr PktData+3
  226. ;CMDShutdown    equ    28
  227.  
  228. STDDERROR         EQU     4000H         ; Equate for Device Driver Defined Error
  229. ERROR_DEVICEDRIVER_DEFINED_BASE EQU 0FE00H     ; Equate for Device Driver Defined Error High Byte
  230.  
  231. ;
  232. ; The next two symbols are used in the files DEV.ASM and SPROC.ASM to
  233. ; set up and verify the set of request packets that the kernel keeps in
  234. ; a segment, and to control req pkt allocation and initialization.
  235. ;
  236. ; See: dev.asm, sproc.asm
  237. ;
  238. StaticPackets     EQU    128        ; 128 * 32 = 4k
  239.  
  240. ReqPktSize    EQU    32        ; "Nice" size for packet (power of 2)
  241. .ERRNZ    (SIZE Packet - 31)        ; Device Driver packet size has changed
  242. ;
  243.  
  244. ; ***********************************************
  245. ;  PhysDiskTbl - Physical Disk Entry Structure    *
  246. ; ***********************************************
  247.  
  248.  diskentry  STRUC
  249.  
  250.  ddheader    DD  0         ; Pointer to Device Driver Header
  251.  ereserved    DB  0         ; Reserved
  252.  reldisknum    DB  0         ; Relative Physical Disk # for Device Driver
  253.  devpid        DW  0         ; PID
  254.  deveflags    DW  0         ; Flags for the physical disk
  255.  logunitbitmap    DD  0         ; Logical Unit Bit Map
  256.  
  257.  diskentry  ends
  258.  
  259. SUBTTL
  260.  
  261. ;*    Obsolete information - use for background info only
  262. ;
  263. ;
  264. ; Attribute bit masks
  265. ;
  266. ;   Character devices:
  267. ;
  268. ;   Bit 15 -> must be 1
  269. ;    14 -> 1 if the device understands IOCTL control strings
  270. ;    13 -> 1 if the device supports output-until-busy
  271. ;    12 -> unused
  272. ;    11 -> 1 if the device understands Open/Close
  273. ;    10 -> must be 0
  274. ;     9 -> must be 0
  275. ;     8 -> 1 if the device understands Pause/Restart/Gen. IOCTL
  276. ;     7 -> unused
  277. ;     6 -> unused
  278. ;     5 -> unused
  279. ;     4 -> 1 if device is recipient of INT 29h
  280. ;     3 -> 1 if device is clock device
  281. ;     2 -> 1 if device is null device
  282. ;     1 -> 1 if device is console output
  283. ;     0 -> 1 if device is console input
  284. ;
  285. ;   Block devices:
  286. ;
  287. ;   Bit 15 -> must be 0
  288. ;    14 -> 1 if the device understands IOCTL control strings
  289. ;    13 -> 1 if the device determines media by examining the FAT ID byte.
  290. ;        This requires the first sector of the fat to *always* reside in
  291. ;        the same place.
  292. ;    12 -> unused
  293. ;    11 -> 1 if the device understands Open/Close/removable media
  294. ;    10 -> must be 0
  295. ;     9 -> must be 0
  296. ;     8 -> 1 if the device understands Pause/Restart/Gen. IOCTL
  297. ;     7 -> unused
  298. ;     6 -> unused
  299. ;     5 -> unused
  300. ;     4 -> unused
  301. ;     3 -> unused
  302. ;     2 -> unused
  303. ;     1 -> unused
  304. ;     0 -> unused
  305. ;
  306. ;DevTyp         EQU     8000H         ; Bit 15 - 1  if Char, 0 if block
  307. ;DevIOCtl    EQU     4000H         ; Bit 14 - CONTROL mode bit
  308. ;ISFATBYDEV  EQU     2000H         ; Bit 13 - Device uses FAT ID bytes,
  309. ;                    ;  comp media.
  310. ;ISNET         EQU     1000H         ; Bit 12 - 1 if a NET device, 0 if
  311. ;                    ;  not.  Currently block only.
  312. ;DEVOPCL     EQU     0800H         ; Bit 11 - 1 if this device has
  313. ;                    ;  OPEN,CLOSE and REMOVABLE MEDIA
  314. ;                    ;  entry points, 0 if not
  315. ;
  316. ; NOTE Bit 9 is currently used on IBM systems to indicate "drive is shared".
  317. ;    See IOCTL function 9.  THIS USE IS NOT DOCUMENTED, it is used by some
  318. ;    of the utilities which are supposed to FAIL on shared drives on server
  319. ;    machines (FORMAT,CHKDSK,RECOVER,..).
  320. ;
  321. ;IsVID         equ     0080h         ; bit 7 - 1 if device issues UNCERTAIN MEDIA
  322. ;;ISSPEC     EQU     0010H         ; Bit 4 - This is special UNUSED
  323. ;ISCLOCK     EQU     0008H         ; Bit 3 - This is the clock device.
  324. ;ISNULL         EQU     0004H         ; Bit 2 - This is the null device.
  325. ;ISCOUT         EQU     0002H         ; Bit 1 - This is the console output.
  326. ;ISCIN         EQU     0001H         ; Bit 0 - This is the console input.
  327.  
  328. OutTilBusy  EQU     2000h         ; Output until busy is enabled
  329. DEV320        EQU     0040H         ; Bit 6 - If Device supports Dos 3.2
  330.