home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warptlk3.zip / TOOLKIT / INC / DEVSYM.INC < prev    next >
Text File  |  1995-08-24  |  14KB  |  324 lines

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