Changeset 34 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common
- Timestamp:
- Aug 23, 2010, 6:57:51 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HError.asm
r33 r34 8 8 ; Section containing code 9 9 SECTION .text 10 11 ;--------------------------------------------------------------------12 ; HError_ProcessErrorsAfterPollingTaskFlag13 ; Parameters:14 ; DS: RAMVARS segment15 ; CF: Set if timeout16 ; Cleared if task flag was properly set17 ; Returns:18 ; AH: BIOS error code19 ; CF: Set if error20 ; Cleared if no error21 ; Corrupts registers:22 ; AL23 ;--------------------------------------------------------------------24 ALIGN JUMP_ALIGN25 HError_ProcessErrorsAfterPollingTaskFlag:26 jnc SHORT HError_ProcessErrorsAfterPollingBSY27 ; Fall to HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit28 10 29 11 ;-------------------------------------------------------------------- -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm
r33 r34 10 10 11 11 ;-------------------------------------------------------------------- 12 ; Wait for IRQ. 13 ; 14 ; HIRQ_WaitIRQ 12 ; HIRQ_WaitForIRQ 15 13 ; Parameters: 16 14 ; DS: RAMVARS segment 17 ; Returns:18 ; AH: BIOS Error code19 ; CF: Cleared if wait succesfull20 ; Set if any error21 ; Corrupts registers:22 ; AL23 ;--------------------------------------------------------------------24 ALIGN JUMP_ALIGN25 HIRQ_WaitIRQ:26 push es27 28 LOAD_BDA_SEGMENT_TO es, ax29 %ifdef USE_AT ; OS hook only available on AT+ machines30 call .NotifyOperatingSystemAboutWaitingForIRQ31 cmc32 jnc SHORT .TaskFlagPollingComplete33 %endif34 call .WaitUntilTaskFlagIsSet ; Process errors35 36 ALIGN JUMP_ALIGN37 .TaskFlagPollingComplete:38 pop es39 jmp HError_ProcessErrorsAfterPollingTaskFlag40 41 42 ;--------------------------------------------------------------------43 ; .NotifyOperatingSystemAboutWaitingForIRQ44 ; Parameters:45 ; ES: BDA segment (zero)46 15 ; Returns: 47 16 ; CF: Set if wait done by operating system … … 50 19 ; AX 51 20 ;-------------------------------------------------------------------- 52 %ifdef USE_AT 21 ALIGN JUMP_ALIGN 22 HIRQ_WaitForIRQ: 23 test BYTE [bx+DPT.bDrvCtrl], FLG_IDE_CTRL_nIEN ; Clears CF 24 jz SHORT .NotifyOperatingSystemAboutWaitingForIRQ 25 ret ; Go to poll status register 26 27 ;-------------------------------------------------------------------- 28 ; .NotifyOperatingSystemAboutWaitingForIRQ 29 ; Parameters: 30 ; Nothing 31 ; Returns: 32 ; CF: Set if wait done by operating system 33 ; Cleared if BIOS must perform task flag polling 34 ; Corrupts registers: 35 ; AX 36 ;-------------------------------------------------------------------- 53 37 ALIGN JUMP_ALIGN 54 38 .NotifyOperatingSystemAboutWaitingForIRQ: 39 push ds 40 41 LOAD_BDA_SEGMENT_TO ds, ax ; Zero AX 55 42 cli ; Disable interrupts 56 xor ax, ax 57 cmp al, [es:BDA.bHDTaskFlg] ; Task flag already set? 43 cmp al, [ds:BDA.bHDTaskFlg] ; Task flag already set? 58 44 jc SHORT .ReturnFromWaitNotify ; If so, skip OS notification 59 45 … … 67 53 stc ; Set CF since wait done by OS 68 54 .ReturnFromWaitNotify: 55 pop ds 69 56 sti ; Enable interrupts 70 ret71 %endif72 73 ;--------------------------------------------------------------------74 ; Polls IRQ Task Flag until it has been set or timeout.75 ;76 ; .WaitUntilTaskFlagIsSet77 ; Parameters:78 ; DS: RAMVARS segment79 ; ES: BDA segment80 ; Returns:81 ; CF: Set if timeout82 ; Cleared if Task Flag set83 ; Corrupts registers:84 ; AX85 ;--------------------------------------------------------------------86 ALIGN JUMP_ALIGN87 .WaitUntilTaskFlagIsSet:88 push cx89 90 mov cl, B_TIMEOUT_DRQ ; Load timeout ticks91 call SoftDelay_InitTimeout ; Initialize timeout counter92 xor ax, ax ; Zero AX93 ALIGN JUMP_ALIGN94 .PollIrqFlag:95 cli ; Disable interrupt until next HLT96 cmp [es:BDA.bHDTaskFlg], al ; Task flag set? (clears CF)97 jne SHORT .Return98 call SoftDelay_UpdTimeout ; Update timeout99 jc SHORT .Return ; Return if timeout100 sti ; Enable interrupts (STI has delay so HLT will catch all interrupts)101 hlt ; Sleep until any interrupt102 jmp SHORT .PollIrqFlag ; Jump to check if IDE interrupt103 ALIGN JUMP_ALIGN104 .Return:105 pop cx106 sti107 57 ret 108 58 … … 158 108 out WPORT_8259MA_COMMAND, al ; Acknowledge Master 8259 159 109 160 %ifdef USE_AT ; OS hook only available on AT+ machines161 110 ; Issue Int 15h, function AX=9100h (Interrupt ready) 162 111 mov ax, 9100h ; Interrupt ready, device 0 (HD) 163 112 int INTV_SYSTEM_SERVICES 164 %endif165 113 166 114 pop ax ; Restore AX … … 187 135 188 136 ; Reading Status Register acknowledges IDE interrupt 189 ;call RamVars_GetSegmentToDS 190 ;call HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA 191 LOAD_BDA_SEGMENT_TO ds, ax 137 call RamVars_GetSegmentToDS 138 call HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA 192 139 mov BYTE [BDA.bHDTaskFlg], 0FFh ; Set task flag 193 140 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HStatus.asm
r28 r34 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 15.12.2009 4 ; Last update : 1.8.20104 ; Last update : 23.8.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : IDE Status Register polling functions. … … 25 25 ALIGN JUMP_ALIGN 26 26 HStatus_WaitIrqOrRdy: 27 test BYTE [bx+DPT.bDrvCtrl], FLG_IDE_CTRL_nIEN28 jn z SHORT .PollRdySinceInterruptsAreDisabled29 jmp H IRQ_WaitIRQ30 31 ALIGN JUMP_ALIGN 32 .PollRdySince InterruptsAreDisabled:27 call HIRQ_WaitForIRQ 28 jnc SHORT .PollRdySinceNoWaitingOnOsHook 29 jmp HError_ProcessErrorsAfterPollingBSY 30 31 ALIGN JUMP_ALIGN 32 .PollRdySinceNoWaitingOnOsHook: 33 33 mov cl, B_TIMEOUT_DRQ ; Load DRQ (not RDY) timeout 34 34 jmp SHORT HStatus_WaitRdy ; Jump to poll RDY … … 50 50 ALIGN JUMP_ALIGN 51 51 HStatus_WaitIrqOrDrq: 52 test BYTE [bx+DPT.bDrvCtrl], FLG_IDE_CTRL_nIEN53 jn z SHORT .PollDrqSinceInterruptsAreDisabled54 jmp H IRQ_WaitIRQ55 56 ALIGN JUMP_ALIGN 57 .PollDrqSince InterruptsAreDisabled:52 call HIRQ_WaitForIRQ 53 jnc SHORT .PollDrqSinceNoWaitingOnOsHook 54 jmp HError_ProcessErrorsAfterPollingBSY 55 56 ALIGN JUMP_ALIGN 57 .PollDrqSinceNoWaitingOnOsHook: 58 58 push dx 59 59 push cx
Note:
See TracChangeset
for help on using the changeset viewer.