Changeset 262 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm
- Timestamp:
- Feb 24, 2012, 10:28:31 AM (13 years ago)
- google:author:
- gregli@hotmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm
r200 r262 40 40 ; CF: 0 if succesfull, 1 if error 41 41 ; Corrupts registers: 42 ; AL, CX, SI , DI42 ; AL, CX, SI 43 43 ;-------------------------------------------------------------------- 44 44 ;ALIGN JUMP_ALIGN … … 46 46 push dx 47 47 push bx 48 push di 48 49 49 call FindDPT_ForDriveNumber ; DS:DI now points to DPT50 50 call Interrupts_UnmaskInterruptControllerForDriveInDSDI 51 51 call Device_ResetMasterAndSlaveController 52 ;jc SHORT .ReturnError ; CF would be set if slave drive present without master53 ; (error register has special values after reset)52 ;jc SHORT .ReturnError ; CF would be set if slave drive present without master 53 ; (error register has special values after reset) 54 54 55 55 ; Initialize Master and Slave drives 56 eMOVZX bx, BYTE [di+DPT.bIdevarsOffset] 57 mov dx, [cs:bx+IDEVARS.wPort] 58 call InitializeMasterAndSlaveDriveFromPortInDX 56 mov al, [di+DPT.bIdevarsOffset] ; pointer to controller we are looking to reset 57 mov ah, 0 ; initialize error code, assume success 58 59 mov si, IterateAndResetDrives 60 call IterateAllDPTs 59 61 62 shr ah, 1 ; Move error code and CF into proper position 63 64 pop di 60 65 pop bx 61 66 pop dx 62 67 ret 63 68 64 65 69 ;-------------------------------------------------------------------- 66 ; InitializeMasterAndSlaveDriveFromPortInDX 67 ; Parameters: 68 ; DX: IDE Base Port address 69 ; SS:BP: Ptr to IDEPACK 70 ; Returns: 71 ; AH: Error code 72 ; CF: 0 if initialization succesfull 73 ; 1 if any error 74 ; Corrupts registers: 75 ; AL, BX, CX, DX, SI, DI 70 ; IterateAndResetDrives: Iteration routine for use with IterateAllDPTs. 71 ; 72 ; When a drive on the controller is found, it is reset, and the error code 73 ; merged into overall error code for this controller. Master will be reset 74 ; first. Note that the iteration will go until the end of the DPT list. 76 75 ;-------------------------------------------------------------------- 77 ALIGN JUMP_ALIGN 78 InitializeMasterAndSlaveDriveFromPortInDX: 79 push dx ; Store base port address 80 xor cx, cx ; Assume no errors 81 FindDPT_ToDSDIForIdeMasterAtPortDX 82 jnc SHORT .InitializeSlave ; Master drive not present 83 call AH9h_InitializeDriveForUse 84 mov cl, ah ; Copy error code to CL 85 .InitializeSlave: 86 pop dx ; Restore base port address 87 FindDPT_ToDSDIForIdeSlaveAtPortDX 88 jnc SHORT .CombineErrors ; Slave drive not present 89 call AH9h_InitializeDriveForUse 90 mov ch, ah ; Copy error code to CH 91 .CombineErrors: 92 or cl, ch ; OR error codes, clear CF 93 jz SHORT .Return 94 mov ah, RET_HD_RESETFAIL ; Load Reset Failed error code 95 stc 96 .Return: 76 IterateAndResetDrives: 77 cmp al, [di+DPT.bIdevarsOffset] ; The right controller? 78 jnz .done 79 push ax 80 call AH9h_InitializeDriveForUse ; Reset Master and Slave (Master will come first in DPT list) 81 pop ax 82 jc .done 83 or ah, (RET_HD_RESETFAIL << 1) | 1 ; OR in Reset Failed error code and CF, will SHR into position later 84 .done: 85 stc ; From IterateAllDPTs perspective, the DPT is never found 97 86 ret 87
Note:
See TracChangeset
for help on using the changeset viewer.