home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / DEV / DASD / OS2DASD / DMASUBR.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-04-14  |  28.5 KB  |  873 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 = src/dev/dasd/os2dasd/dmasubr.asm, dsdm, ddk_subset, b_bdd.032 93/03/19
  12.         page    ,132
  13.  
  14. ;/*****************************************************************************
  15. ;*
  16. ;* SOURCE FILE NAME =   DMASUBR.ASM
  17. ;*
  18. ;* DESCRIPTIVE NAME =   OS2DASD.DMD - OS/2 DASD Device Manager
  19. ;*
  20. ;*
  21. ;*
  22. ;* VERSION      V2.0
  23. ;*
  24. ;* DATE
  25. ;*
  26. ;* DESCRIPTION : Assembly language subroutines for OS/2 DASD Mgr
  27. ;*
  28. ;*
  29. ;* CHANGE ACTIVITY =
  30. ;*   DATE      FLAG        APAR   CHANGE DESCRIPTION
  31. ;*   --------  ----------  -----  --------------------------------------
  32. ;*   mm/dd/yy  @Vnnnnn     xxxxx  xxxxxxx
  33. ;*****************************************************************************/
  34.  
  35.         title   ddasubr - OS/2 2.0 OS2DASD.DMD device driver
  36.         name    ddasubr
  37.  
  38.         page    ,132
  39.  
  40.         .xlist
  41.         include struc.inc
  42.         include abmac.inc
  43.         include basemaca.inc
  44.         include devhlp.inc
  45.         include devsym.inc
  46.         include strat2.inc
  47.         .list
  48.  
  49. _DATA           segment dword public 'DATA'
  50. _DATA           ends
  51.  
  52. CONST           segment dword public 'CONST'
  53. CONST           ends
  54.  
  55. _BSS            segment dword public 'BSS'
  56. _BSS            ends
  57.  
  58. _TEXT           segment dword public 'CODE'
  59. _TEXT           ends
  60.  
  61. Code            segment dword public 'CODE'
  62. Code            ends
  63.  
  64. SwapCode        segment dword public 'CODE'
  65. SwapCode        ends
  66.  
  67. DGROUP          group   CONST, _BSS, _DATA
  68. StaticGroup     group   Code, _TEXT
  69. SwapGroup       group   SwapCode
  70.  
  71. ;/*---------------*/
  72. ;/* ABIOS Related */
  73. ;/*---------------*/
  74.  
  75. ;StaticCode SEGMENT use16 'CODE'
  76. ;           assume cs:StaticCode
  77.  
  78. _DATA   segment dword public 'DATA'
  79.         extrn   _Device_Help:dword
  80.         extrn   _pDiskFT_Request:dword
  81.         extrn   _pDiskFT_Done:dword
  82.         extrn   _DiskFT_DS:word
  83.         extrn   _pFSD_EndofInt:dword
  84.         extrn   _pFSD_AccValidate:dword
  85.  
  86. _DATA   ends
  87.  
  88. _TEXT   segment dword public 'CODE'
  89.         extrn   _DD_ChgPriority:dword
  90. _TEXT   ends
  91.  
  92. _TEXT     segment dword public 'CODE'
  93.           assume  CS:_TEXT, DS:_DATA
  94.  
  95.         .386
  96.  
  97. ;--------------------------------------------------------------------
  98. ;
  99. ;  SUBROUTINE NAME: SortPriorityQueue
  100. ;
  101. ;  DESCRIPTIVE NAME: Sort a Request on a priorty queue
  102. ;
  103. ;  FUNCTION:  This routine inserts a request on the priority
  104. ;             based waiting queue for the device.  The
  105. ;             request is inserted on the queue using an elevator
  106. ;             algorithm based on the starting sector number of the
  107. ;             request. If the new request is less than the queue
  108. ;             head request, the new request is placed in the queue
  109. ;             in descending order by placing it just before the
  110. ;             first entry less than the new entry.  If the new
  111. ;             request is greater than the queue head, the new entry
  112. ;             is inserted in ascending order (just before the first
  113. ;             entry greater than the new one).  This algorithm
  114. ;             places new entries into the queue according to an
  115. ;             elevator algorithm intended to reduce cylinder to
  116. ;             cylinder seeks when stepping through requests in the
  117. ;             queue.
  118. ;             NOTE: This algorithm has the side effect of never
  119. ;                   replacing the entry at the head of the queue.
  120. ;
  121. ;             NOTE:  This routine will accept either an old style
  122. ;                    request packet or a new style request entry
  123. ;                    as input.  However, the queue which the request
  124. ;                    is inserted on must be of a single type.
  125. ;
  126. ;
  127. ;   VOID NEAR SortPriorityQueue (NPBYTE pPrtyQHead, PBYTE pReq, )
  128. ;
  129. ;   ENTRY:    pPrtyQHead       -  Priority Queue head pointer
  130. ;             pReq             -  Request Packet or Request List Entry
  131. ;
  132. ;   RETURN:   VOID
  133. ;
  134. ;   EFFECTS:
  135. ;--------------------------------------------------------------------
  136. pPrtyQHead      EQU     [bp+4]
  137. pReq            EQU     [bp+6]
  138.  
  139. Procedure _SortPriorityQueue,near
  140.  
  141.    LocalVar NewRequest,dword
  142.    LocalVar SWQ_Offset,word
  143.    EnterProc
  144.  
  145.    pushf
  146.    pushad
  147.    push   ds
  148.    DISABLE
  149.  
  150.    mov     si,pPrtyQHead                ; ds:si -> pPrtyQHead
  151.    les     bx,pReq                      ; es:bx -> pReq
  152.  
  153.    movzx   esi,si                       ; So we can use as index reg
  154.    movzx   ebx,bx                       ; So we can use as index reg
  155.  
  156. ;  This routine handles both request packets and request list entries.
  157. ;  This is done by testing which case is being handled and then putting
  158. ;  the offsets for the two relevant fields (forward link and RBA) into
  159. ;  index registers.  These fields can then be accessed using indexed
  160. ;  references so the code is freed from the specific structure format.
  161. ;
  162.    .IF <es:[bx].RH_Old_Command eq PB_REQ_LIST>  ; Request List Entry ?
  163.       mov   edi,RH_Waiting                      ; edi -> offset for link
  164.       mov   edx,PB_Start_Block                  ; edx -> offset for RBA
  165.    .ELSE                                ; else it's a request packet
  166.       mov  edi,PktDevLink               ; edi -> offset for link
  167.       mov  edx,IOPhysRBA                ; edx -> offset for RBA
  168.    .ENDIF
  169.  
  170. SWQ_Link  equ  [edi]                    ; use equates for readability
  171. SWQ_RBA   equ  [edx]                    ; 
  172.  
  173.    mov  es:dword ptr [ebx].SWQ_Link,0   ; Zero this entry's forward link ptr
  174.    mov  word ptr NewRequest,bx          ; Save pointer to request
  175.    mov  word ptr NewRequest+2,es        ; 
  176. ;
  177. ;  If the queue is empty then make the new request the new queue head
  178. ;
  179.    cmp dword ptr [si],0                 ; Empty queue ?
  180.    jne SWQ_ChkSort                      ; N: then continue
  181.    push  NewRequest                     ; Make new request the new head
  182.    push  NewRequest                     ; 
  183.    pop   dword ptr [si]                 ; 
  184.    pop   dword ptr [si+4]               ; and the new tail
  185.    jmp  SWQ_Ret                         ;  and return
  186.  
  187. ;
  188. ;  Sort the request on the queue. First determine if the queue starts
  189. ;  out in ascending or descending order.
  190. ;    es:[ebx] = Q[n],   ds:[esi] = Q[n+1]
  191. ;
  192. SWQ_ChkSort:
  193.    mov  ecx,es:dword ptr [ebx].SWQ_RBA  ; ecx = this request's RBA
  194.    les   bx,[si]                        ; es:bx -> first entry on the queue
  195.  
  196. SWQ_Order:
  197.    cmp  es:dword ptr [ebx].SWQ_Link,0   ; Is Q[n] last entry on the queue ?
  198.    je   SWQ_Insert                      ; Y: insert new request after it
  199.    mov  eax,es:[ebx].SWQ_RBA            ; eax = Q[n].RBA
  200.    lds  si,es:[ebx].SWQ_Link            ; Q[n+1] = Q[n].QLink
  201.    cmp  eax,ds:[esi].SWQ_RBA            ; 
  202.    jb   SWQ_asc                         ; If Q[n].RBA < Q[n+1].RBA then asc
  203.    ja   SWQ_desc                        ; If Q[n].RBA > Q[n+1].RBA then desc
  204.                                         ;  else Q[n].RBA = Q[n+1].RBA
  205.    push ds                              ; 
  206.    pop  es                              ; 
  207.    mov  bx,si                           ; Q[n] = Q[n+1]
  208.    jmp  SWQ_Order                       ; Get next Q entry and try again
  209. ;----------
  210. ;  The queue starts out in ascending order.  If the new request is less than
  211. ;  the first request in the queue, then put the new request on the descending
  212. ;  slope of the queue.
  213. ;----------
  214. SWQ_asc:                                ; Queue Ascending
  215.    mov  SWQ_Offset,offset SWQ_asc_desc  ; Set offset for return jmp
  216.    cmp  ecx,eax                         ; New.RBA < Q[n].RBA ?
  217.    jb   SWQ_asc_desc                    ; Y: insert new entry on desc. slope
  218.    mov  SWQ_Offset,offset SWQ_asc_asc   ; Set offset for return jmp
  219. ;
  220. ;  The queue starts out ascending and we want to place the request
  221. ;  on the ascending slope.
  222. ;
  223. SWQ_asc_asc:                            ; Insert on ascending slop
  224.    cmp  ecx,ds:[esi].SWQ_RBA            ; New.RBA <= Q[n+1].RBA ?
  225.    jbe  SWQ_Insert                      ; Y: insert new before Q[n+1]
  226.    cmp  eax,ds:[esi].SWQ_RBA            ; At the top of the ascending slope ?
  227.    ja   SWQ_Insert                      ; Y: put new entry at the top
  228.    jmp  SWQ_try_next                    ;  else get next Q entry
  229. ;
  230. ;  The queue starts out ascending and we want to place the request
  231. ;  on the descending slope.
  232. ;
  233. SWQ_asc_desc:
  234.    cmp  ecx,ds:[esi].SWQ_RBA            ; New.RBA >= Q[n+1].RBA
  235.    jae  SWQ_Insert                      ; Y: insert new before Q[n+1]
  236.    jmp  SWQ_try_next                    ;  else get next Q entry
  237.  
  238. ;----------
  239. ;  The queue starts out in descending order.  If the new request greater than
  240. ;  the first request in the queue, then put the new request on the ascending
  241. ;  slope of the queue.
  242. ;----------
  243. SWQ_desc:                               ; Queue Descending
  244.    mov  SWQ_Offset,offset SWQ_desc_asc  ; Set offset for return jmp
  245.    cmp  ecx,eax                         ; New.RBA > Q[n].RBA ?
  246.    ja   SWQ_desc_asc                    ; Y: insert new on asc. slope
  247.    mov  SWQ_Offset,offset SWQ_desc_desc ; Set offset for return jmp
  248. ;
  249. ;  The queue starts out descending and we want to place the request
  250. ;  on the descending slope.
  251. ;
  252. SWQ_desc_desc:                          ; Insert on descending slope
  253.    cmp  ecx,ds:[esi].SWQ_RBA            ; New.RBA >= Q[n+1].RBA
  254.    jae  SWQ_Insert                      ; Y: insert new before Q[n+1]
  255.    cmp  eax,ds:[esi].SWQ_RBA            ; At the bottom of descending slope ?
  256.    jb   SWQ_Insert                      ; Y: put new entry at the bottom
  257.    jmp  SWQ_try_next                    ;  else get next queue entry
  258. ;
  259. ;  The queue starts out descending, but we want to put the new request
  260. ;  on the ascending slope of the queue.
  261. ;
  262. SWQ_desc_asc:
  263.    cmp  ecx,ds:[esi].SWQ_RBA            ; New.RBA <= Q[n+1].RBA
  264.    jb   SWQ_Insert                      ; Y: insert new before Q[n+1]
  265. ;----------
  266. ;  Get the next entry in the queue.  Jump indirect back to the specified
  267. ;  insertion routine.
  268. ;----------
  269. SWQ_try_next:
  270.    push ds                              ; 
  271.    pop  es                              ; 
  272.    mov  bx,si                           ; Q[n] = Q[n+1]
  273.    cmp  es:dword ptr [ebx].SWQ_Link,0   ; Is Q[n] last entry on the queue ?
  274.    je   SWQ_Insert                      ; Y: Insert new request after it
  275.    mov  eax,es:dword ptr [ebx].SWQ_RBA  ; eax = Q[n].RBA
  276.    lds  si,dword ptr es:[ebx].SWQ_Link  ; Q[n+1] = Q[n].Qlink
  277.    jmp  [SWQ_Offset]                    ; jmp back for another try
  278. ;
  279. ;  Insert the new request after the request pointed to by es:[ebx].
  280. ;
  281. SWQ_Insert:
  282.    mov   si,word ptr NewRequest           ; 
  283.    mov   ds,word ptr NewRequest+2         ; ds:si -> New Request
  284.    mov   eax,es:[ebx].SWQ_Link            ; eax = Q[n+1]
  285.    mov   es:word ptr [ebx].SWQ_Link,si    ; Insert new after Q[n]
  286.    mov   es:word ptr [ebx+2].SWQ_Link,ds  ; 
  287.    mov   ds:dword ptr [esi].SWQ_Link,eax  ; Link new to Q[n+1]
  288.    cmp   eax,0                            ; If end of queue
  289.    jne   SWQ_Ret                          ;   then update tail pointer
  290.    push  DGROUP                           ; 
  291.    pop   ds                               ; 
  292.    mov   bx,pPrtyQHead                    ; 
  293.    push  NewRequest                       ; 
  294.    pop   dword ptr ds:[bx+4]              ; 
  295.  
  296. SWQ_Ret:
  297.    pop   ds
  298.    popad
  299.    popf
  300.    LeaveProc
  301.    ret
  302.  
  303. EndProc _SortPriorityQueue
  304.  
  305.  
  306. ;/*------------------------------------------------------------------------
  307. ;
  308. ;** SWait - Wait for a semaphore
  309. ;
  310. ;   This is the same routine as the DOS "ram semaphore" routine.
  311. ;   It operates on a semaphore made up of a pair of bytes- an "in
  312. ;   use" flag and a "someone is wait" flag.
  313. ;
  314. ;   USABLE IN SYSTEM and USER MODE.
  315. ;
  316. ;   WARNING - Enables Interrupts
  317. ;
  318. ;   DB      busyflag
  319. ;   DB      waitingflag
  320. ;
  321. ;   If busyflag is clear then
  322. ;           set busyflag
  323. ;           return
  324. ;   else
  325. ;           set waitingflag (to notify owner to do a wakeup when he's done)
  326. ;           ProcBlock on address of busyflag
  327. ;
  328. ;   Note that when ProcBlock returns interrupts will be enabled.
  329. ;   Since the entire procblock interval was an "interrupts enabled"
  330. ;   window we figure we must be called with interrupts on and
  331. ;   thus don't mess with PUSHF/POPFF but just jam the interrupts
  332. ;   on and off as necessary.  (In keeping with good practice we
  333. ;   keep them on as much as possible.)
  334. ;
  335. ;
  336. ;   VOID NEAR SWait (NPUSHORT Semaphore)
  337. ;
  338. ;   VOID FAR  f_SWait (NPUSHORT Semaphore)
  339. ;
  340. ;   ENTRY:    Semaphore        - semaphore to wait on
  341. ;
  342. ;   RETURN:   VOID
  343. ;
  344. ;   EFFECTS:
  345. ;
  346. ;   NOTES:
  347. ;------------------------------------------------------------------------*/
  348.  
  349. BIOS_BLOCK_ID   equ     0fffch
  350.  
  351.          public _f_SWait
  352. _f_SWait proc far
  353.  
  354.         push    bp
  355.         mov     bp,sp
  356.         push    bx
  357.         mov     bx,[bp+6]
  358.         push    bx
  359.         call    _SWait
  360.         pop     bx
  361.         pop     bx
  362.         pop     bp
  363.         ret
  364.  
  365. _f_SWait endp
  366.  
  367.  
  368. WaitSem         equ     [bp+4]
  369.  
  370.       public _SWait
  371. _SWait proc near
  372.  
  373.         push    bp
  374.         mov     bp,sp
  375.  
  376.         SaveReg <ax,bx>
  377.         mov     bx,WaitSem
  378. ;       retest semaphore
  379. ;
  380. ;       (ds:bx) = address
  381. ;       (TOS) = caller's AX
  382.  
  383. swa0:   DISABLE
  384.         mov     al,1
  385.         xchg    al,BYTE PTR ds:[bx]     ; set semaphore
  386.  
  387. ;       If busyflag was set then its still set and (al) = 1
  388. ;       If busyflag was clear then its set now and (al) = 0
  389.  
  390.         and     al,al
  391.         jnz     swa1                    ; foo - it was already set so Block
  392.         ENABLE
  393.         RestoreReg <bx, ax>
  394.         pop     bp
  395.         ret                             ; done  - we've got it
  396.  
  397. ;       The thing is set.  We're going to have to block on it
  398. ;
  399. ;       (al) = 1
  400.  
  401. swa1:   mov     BYTE PTR ds:1[bx],al        ; set waiting
  402.  
  403.         SaveReg <bx,cx,dx,di>
  404.         mov     ax,BIOS_BLOCK_ID
  405.         mov     di,-1
  406.         mov     cx,-1                   ; Never time out
  407.         mov     dh,1                    ; Non-Interruptible
  408.         DEVHLP DevHlp_ProcBlock         ; Block until Proc_Run
  409.         RestoreReg <di,dx,cx,bx>
  410.  
  411.         jmp     swa0                            ; Re-Test this.
  412.  
  413. _SWait   endp
  414.  
  415.  
  416. ;/*------------------------------------------------------------------------
  417. ;
  418. ;** SSig- Signal a disk semaphore
  419. ;
  420. ;   SSig releases a semaphore (it is presumed that the caller indeed
  421. ;   owns it!) and, if anyone was waiting, wakes them up.
  422. ;
  423. ;   Usable in SYSTEM-TASK, USER and INTERRUPT mode.
  424. ;   Callable in BOOT mode if we're sure no one is "waiting" on the
  425. ;           semaphore (which should always be the case)
  426. ;
  427. ;   VOID NEAR SSig (NPUSHORT Semaphore)
  428. ;
  429. ;   VOID FAR  f_SSig (NPUSHORT Semaphore)
  430. ;
  431. ;   ENTRY:    Semaphore        - semaphore to signal
  432. ;
  433. ;   RETURN:   VOID
  434. ;
  435. ;   EFFECTS:
  436. ;
  437. ;   NOTES:
  438. ;------------------------------------------------------------------------*/
  439.  
  440.          public _f_SSig
  441. _f_SSig  proc far
  442.  
  443.         push    bp
  444.         mov     bp,sp
  445.         push    bx
  446.         mov     bx,[bp+6]
  447.         push    bx
  448.         call    _SSig
  449.         pop     bx
  450.         pop     bx
  451.         pop     bp
  452.         ret
  453.  
  454. _f_SSig  endp
  455.  
  456.  
  457. SigSem  EQU  [bp+4]
  458.  
  459.       public _SSig
  460. _SSig proc near
  461.  
  462.         push    bp
  463.         mov     bp,sp
  464.         SaveReg <ax,bx>
  465.  
  466.         mov     bx,SigSem
  467.         xor     ax,ax
  468.         xchg    ax,ds:[bx]              ; clear semaphore and wait flag
  469.  
  470. ;       (al) = semaphore flag
  471. ;       (ah) = wait flag
  472.  
  473.         and     al,al
  474.         jz      SSig8                   ; TROUBLE! Not SET!
  475.         and     ah,ah
  476.         jz      SSig2                   ; nobody waiting, don't ProcRun
  477.  
  478. ;       Someone is waiting on this semaphore.  Wake him/them up.
  479. ;
  480. ;       (AX:BX) = block/run code value
  481.  
  482.         SaveReg <bx, cx, dx>
  483.         mov     ax, BIOS_BLOCK_ID
  484.         DEVHLP  DevHlp_ProcRun          ; Block until Proc_Run
  485.         RestoreReg <dx, cx, bx>
  486. SSig2:
  487.         RestoreReg <bx, ax>
  488.         pop     bp
  489.         ret
  490.  
  491. SSig8:  jmp     SSig8
  492.         db      "Semaphore cleared that was never set!!"
  493.  
  494. _SSig    endp
  495.  
  496.  
  497.  
  498.  
  499. ;--------------------------------------
  500. ; ULONG = add32 (ULONG operand1, ULONG operand2)
  501. ;
  502. ;
  503. ;--------------------------------------
  504. AddOp1  EQU    [bp+6]
  505. AddOp2  EQU    [bp+10]
  506.  
  507. public _f_add32
  508. _f_add32 proc far
  509.  
  510.         push    bp
  511.         mov     bp,sp
  512.         mov     eax,AddOp1
  513.         add     eax,AddOp2
  514.         jc      Over
  515.         mov     edx,eax
  516.         shr     edx,16
  517.         jmp     short NotOver
  518. Over:
  519.         mov     ax,0
  520.         mov     dx,0
  521. NotOver:
  522.         pop     bp
  523.         ret
  524.  
  525.  
  526. _f_add32 endp
  527.  
  528.  
  529. ;-----------------------------------------------------;
  530. ; VOID _f_ZeroCB (PBYTE ControlBlock, USHORT Length)  ;
  531. ;                                                     ;
  532. ; Function: Zero fill the input control block         ;
  533. ;                                                     ;
  534. ;-----------------------------------------------------;
  535. CtrlBlk EQU [bp+6]
  536. BlkLen  EQU [bp+10]
  537.  
  538. public _f_ZeroCB
  539. _f_ZeroCB proc far
  540.  
  541.         push    bp
  542.         mov     bp,sp
  543.  
  544.         SaveReg <es,bx,cx,di>
  545.  
  546.         xor     eax,eax
  547.         les     di,CtrlBlk
  548.         mov     cx,BlkLen
  549.         mov     bx,cx
  550.         and     bx,3
  551.         shr     cx,2
  552.         cmp     cx,0
  553.         je      zcb_rem
  554.         rep     stosd
  555.  
  556. zcb_rem:
  557.         mov     cx,bx
  558.         cmp     cx,0
  559.         je      zcb_ret
  560.         rep     stosb
  561.  
  562. zcb_ret:
  563.         RestoreReg <di,cx,bx,es>
  564.  
  565.         pop     bp
  566.         ret
  567.  
  568. _f_ZeroCB endp
  569.  
  570.  
  571. ;----------------------------------------------------------;
  572. ; VOID _f_BlockCopy (PBYTE Dest, PBYTE Orig, USHORT Length ;
  573. ;                                                          ;
  574. ; Function: Copy a block of data                           ;
  575. ;                                                          ;
  576. ;----------------------------------------------------------;
  577. BlkDest  EQU [bp+6]
  578. BlkSrc   EQU [bp+10]
  579. BlkCLen  EQU [bp+14]
  580.  
  581. public _f_BlockCopy
  582. _f_BlockCopy proc far
  583.  
  584.         push    bp
  585.         mov     bp,sp
  586.  
  587.         SaveReg <ds,es,di,si,cx,bx>
  588.  
  589.         les     di,BlkDest
  590.         lds     si,BlkSrc
  591.         mov     cx,BlkCLen
  592.  
  593.         mov     bx,cx
  594.         and     bx,3
  595.         shr     cx,2
  596.         cmp     cx,0
  597.         je      bc_rem
  598.         rep     movsd
  599.  
  600. bc_rem:
  601.         mov     cx,bx
  602.         cmp     cx,0
  603.         je      bc_ret
  604.         rep     movsb
  605.  
  606. bc_ret:
  607.         RestoreReg <bx,cx,si,di,es,ds>
  608.  
  609.         pop     bp
  610.  
  611.         ret
  612.  
  613. _f_BlockCopy endp
  614.  
  615. ;----------------------------------------------------------------------------;
  616. ;                                                                            ;
  617. ;** _FSD_Notify - Strategy-2 File System callout notification                ;
  618. ;                                                                            ;
  619. ;   Notify the file system a strategy-2 request has completed.               ;
  620. ;                                                                            ;
  621. ;                                                                            ;
  622. ;   VOID _f_FSD_Notify (PBYTE pRequest, PVOID NotifyAdress, USHORT ErrorFlag ;
  623. ;                                                                            ;
  624. ;   ENTRY:    pRequest         - Far pointer to RLE or RLH                   ;
  625. ;             NotifyAddress    - Far pointer containing notification address ;
  626. ;             ErrorFlag        - 0= no error, 1=error                        ;
  627. ;                                                                            ;
  628. ;                                                                            ;
  629. ;----------------------------------------------------------------------------;
  630. pRequest EQU     [bp+4]
  631. NtfyAddr EQU     [bp+8]
  632. ErrFlag  EQU     [bp+12]
  633.  
  634.  
  635. public _FSD_Notify
  636. _FSD_Notify proc near
  637.  
  638.         push    bp
  639.         mov     bp,sp
  640.  
  641.         push    ds
  642.         push    es
  643.         pusha
  644.  
  645.         les     bx,pRequest             ; es:bx = pRequest
  646.         shr     word ptr ErrFlag,1      ; CY = error
  647.         call    dword ptr NtfyAddr      ; call [NotifyAddress]
  648.  
  649.         popa
  650.         pop     es
  651.         pop     ds
  652.         pop     bp
  653.  
  654.         ret
  655.  
  656. _FSD_Notify endp
  657.  
  658.  
  659. ;----------------------------------------------------------------------------;
  660. ;                                                                            ;
  661. ;** f_FT_Request - Call DISKFT's FT_Request entry point                      ;
  662. ;                                                                            ;
  663. ;   USHORT f_FT_Request (USHORT CmdPart, USHORT SzReqPkt, PBYTE pResults,    ;
  664. ;                                                          PBYTE ActionCode  ;
  665. ;                                                                            ;
  666. ;   ENTRY:    CmdPart          - Command and Partition Number                ;
  667. ;             SzReqPkt         - size of reqpkt for shadow write             ;
  668. ;             pResults         - pointer to results structure                ;
  669. ;             pActionCode      - returned Action Code                        ;
  670. ;                                                                            ;
  671. ;                                                                            ;
  672. ;   RETURN:   USHORT           -  Zero = No Error, 1 = Error                 ;
  673. ;                                                                            ;
  674. ;----------------------------------------------------------------------------;
  675. CmdPart  EQU     [bp+6]
  676. SzReqPkt EQU     [bp+8]
  677. pResults EQU     [bp+10]
  678. pActCode EQU     [bp+14]
  679.  
  680.  
  681. public _f_FT_Request
  682. _f_FT_Request proc far
  683.  
  684.         push    bp
  685.         mov     bp,sp
  686.  
  687.         SaveReg <bx,cx,dx,si,di,ds,es>
  688.  
  689.         push    ds
  690.         pop     es
  691.  
  692.         push    CmdPart              ; CmdPart Parm
  693.         push    0
  694.         push    SzReqPkt             ; SzReqPkt Parm
  695.         push    dword ptr pResults   ; Pointer to results
  696.         mov     ax,_DiskFT_DS        ; 
  697.         mov     ds,ax                ; ds = DiskFT's ds
  698.         call    es:_pDiskFT_Request  ; call DiskFT's Request routine
  699.  
  700.         les     bx,pActCode
  701.         mov     es:[bx],al             ; Save Return Code
  702.  
  703.         RestoreReg <es,ds,di,si,dx,cx,bx>
  704.         pop     bp
  705.  
  706.         mov     ax,0
  707.         jnc     ftreq_ok
  708.         mov     ax,1
  709. ftreq_ok:
  710.         ret
  711.  
  712. _f_FT_Request endp
  713.  
  714. ;----------------------------------------------------------------------------;
  715. ;                                                                            ;
  716. ;** f_FT_Done - Call DISKFT's FT_Done entry point                            ;
  717. ;                                                                            ;
  718. ;   USHORT f_FT_Done (USHORT ErrPart, USHORT ReqHandle, ULONG RelativeSec)   ;
  719. ;                                                                            ;
  720. ;   ENTRY:    ErrPart          - ErrorCode and Partition Number              ;
  721. ;             ReqHandle        - Request Handle                              ;
  722. ;             RelativeSec      - sector number from start of partition       ;
  723. ;                                                                            ;
  724. ;   RETURN:   USHORT           -  Packet Status                              ;
  725. ;                                                                            ;
  726. ;----------------------------------------------------------------------------;
  727. ErrPart   EQU [bp+6]
  728. ReqHandle EQU [bp+8]
  729. RelSect   EQU [bp+10]
  730.  
  731.  
  732. public _f_FT_Done
  733. _f_FT_Done proc far
  734.  
  735.         push    bp
  736.         mov     bp,sp
  737.  
  738.         SaveReg <bx,cx,dx,si,di,ds,es>
  739.  
  740.         push    ds
  741.         pop     es
  742.  
  743.         push    ErrPart              ; ErrPart Parm
  744.         push    0
  745.         push    ReqHandle            ; ReqHandle Parm
  746.         push    dword ptr RelSect    ; Relative Sector
  747.         mov     ax,_DiskFT_DS        ; 
  748.         mov     ds,ax                ; ds = DiskFT's ds
  749.         call    es:_pDiskFT_Done     ; call DiskFT's Done routine
  750.  
  751.         mov     bx,0
  752.         jnc     noerr                ; Error ?
  753.         or      bx,STERR             ; set error bit
  754.         mov     bl,ah                ;   and error code
  755. noerr:
  756.         cmp     al,0                 ; request done ?
  757.         jne     notdone
  758.         or      bx,STDON             ; yes, set done bit
  759. notdone:
  760.         mov     ax,bx                ; return status in ax
  761.  
  762.         RestoreReg <es,ds,di,si,dx,cx,bx>
  763.         pop     bp
  764.         ret
  765.  
  766. _f_FT_Done endp
  767.  
  768. ;----------------------------------------------------------------------------;
  769. ;                                                                            ;
  770. ;** FSD_EndofInt - Call FSD's End of interrupt routine                       ;
  771. ;                                                                            ;
  772. ;   VOID FSD_EndofInt (VOID)                                                 ;
  773. ;                                                                            ;
  774. ;   ENTRY:    VOID                                                           ;
  775. ;                                                                            ;
  776. ;   RETURN:   VOID                                                           ;
  777. ;                                                                            ;
  778. ;----------------------------------------------------------------------------;
  779. public _FSD_EndofInt
  780. _FSD_EndofInt proc near
  781.  
  782.    pusha
  783.    push ds
  784.    push es
  785.  
  786.    call _pFSD_EndofInt          ; call FSD's end of interrupt routine
  787.  
  788.    pop  es
  789.    pop  ds
  790.    popa
  791.  
  792.    ret
  793.  
  794. _FSD_EndofInt endp
  795.  
  796. ;----------------------------------------------------------------------------;
  797. ;                                                                            ;
  798. ;** f_FSD_AccValidate - Call FSD's Access Validation routine                 ;
  799. ;                                                                            ;
  800. ;   USHORT f_FSD_AccValidate (USHORT Destructive)                            ;                   ;
  801. ;                                                                            ;
  802. ;   ENTRY:    Destructive               = 0, not destructive                 ;
  803. ;                                       = 1, destructive                     ;
  804. ;                                                                            ;
  805. ;   RETURN:   USHORT                    = 0, validate ok                     ;
  806. ;                                       = 1, validation failure              ;
  807. ;                                                                            ;
  808. ;----------------------------------------------------------------------------;
  809. DestrFlag   EQU  [bp+6]
  810.  
  811. public _f_FSD_AccValidate
  812. _f_FSD_AccValidate proc far
  813.  
  814.         push    bp
  815.         mov     bp,sp
  816.  
  817.         mov     ax,DestrFlag            ; Get destructive code
  818.         call    _pFSD_AccValidate       ; 
  819.         mov     ax,0
  820.         jnc     Acc_ret
  821.         mov     ax,1
  822.  
  823. Acc_ret:
  824.         pop     bp
  825.         ret
  826.  
  827. _f_FSD_AccValidate endp
  828.  
  829. ;----------------------------------------------------------------------------;
  830. ;                                                                            ;
  831. ;** _DD_ChgPriority_asm - Change priority entry point for FSD                ;
  832. ;                                                                            ;
  833. ;   ENTRY:    es:bx             Pointer to request entry                     ;
  834. ;                al             Priority                                     ;
  835. ;                                                                            ;
  836. ;   RETURN:   NC                Priority changed                             ;
  837. ;             CY Set            Priority not changed                         ;
  838. ;                                                                            ;
  839. ;----------------------------------------------------------------------------;
  840. public _DD_ChgPriority_asm
  841. _DD_ChgPriority_asm  proc far
  842.  
  843.         push    ds
  844.         push    es
  845.  
  846.         push    DGROUP
  847.         pop     ds
  848.  
  849.         push    es
  850.         push    bx
  851.         push    ax
  852.         call    _DD_ChgPriority
  853.         cmp     ax,0
  854.         je      DDC_Retok
  855.         stc
  856.         jmp     short DDC_Ret
  857.  
  858. DDC_Retok:
  859.         clc
  860.  
  861. DDC_Ret:
  862.         add     sp,6
  863.         pop     es
  864.         pop     ds
  865.         ret
  866.  
  867. _DD_ChgPriority_asm  endp
  868.  
  869.  
  870. _TEXT ends
  871.      end
  872.  
  873.