home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / inc / devsym.inc < prev    next >
Text File  |  1999-03-15  |  16KB  |  360 lines

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