Changeset 262 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers
- Timestamp:
- Feb 24, 2012, 10:28:31 AM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Handlers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
r260 r262 26 26 27 27 call RamVars_GetSegmentToDS 28 28 29 call DriveXlate_ToOrBack 29 30 mov [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv], dl 30 call RamVars_IsFunctionHandledByThisBIOS 31 jc SHORT Int13h_DirectCallToAnotherBios 32 33 call FindDPT_ForDriveNumber ; DS:DI now points to DPT 34 31 32 call FindDPT_ForDriveNumberInDL ; DS:DI points to our DPT, or NULL if not our drive 33 jnc SHORT .OurFunction ; DPT found, this is one of our drives, and thus our function 34 35 cmp ah, 0 36 jz short .OurFunction ; we handle all function 0h requests (resets) 37 cmp ah, 8 38 %ifdef MODULE_SERIAL_FLOPPY 39 jnz SHORT Int13h_DirectCallToAnotherBios ; we handle all traffic for function 08h, 40 ; as we need to wrap both hard disk and floppy drive counts 41 %else 42 jz SHORT .WeHandleTheFunction ; we handle all *hard disk* (only) traffic for function 08h, 43 ; as we need to wrap the hard disk drive count 44 test dl, dl 45 jns SHORT Int13h_DirectCallToAnotherBios 46 %endif 47 48 .OurFunction: 35 49 ; Jump to correct BIOS function 36 50 eMOVZX bx, ah -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm
r259 r262 121 121 GetDriveNumberForForeignBiosesToDL: 122 122 mov dl, bl 123 call RamVars_IsDriveHandledByThisBIOS124 j cSHORT .Return ; Return what was in BL unmodified123 test di, di 124 jz SHORT .Return ; Return what was in BL unmodified 125 125 mov dl, 80h 126 126 .Return: … … 141 141 ALIGN JUMP_ALIGN 142 142 AH0h_ResetHardDisksHandledByOurBIOS: 143 mov dx, [RAMVARS.wDrvCntAndFirst] ; DL = drive number, DH = drive count 144 test dh, dh 145 jz SHORT .AllDrivesReset ; Return if no drives 146 add dh, dl ; DH = one past last drive to reset 147 ALIGN JUMP_ALIGN 148 .DriveResetLoop: 149 call AHDh_ResetDrive 150 call .BackupErrorCodeFromMasterOrSlaveToBH 151 inc dx 152 cmp dl, dh ; All done? 153 jb SHORT .DriveResetLoop ; If not, reset next drive 154 .AllDrivesReset: 143 mov bl, [di+DPT.bIdevarsOffset] ; replace drive number with Idevars pointer for comparisons 144 mov cl, [cs:ROMVARS.bIdeCnt] ; get count of ide controllers 145 mov ch, 0 146 mov dl, 0 ; starting Idevars offset 147 mov si, IterateFindFirstDPTforIdevars ; iteration routine 148 .loop: 149 call IterateAllDPTs ; look for the first drive on this controller, if any 150 jc .notFound 151 call AHDh_ResetDrive ; reset master and slave on that controller 152 call BackupErrorCodeFromTheRequestedDriveToBH ; save error code if same controller as initial request 153 .notFound: 154 add dl, IDEVARS_size ; move pointer forward 155 loop .loop ; and repeat 155 156 ret 156 157 157 158 158 ;-------------------------------------------------------------------- 159 ; .BackupErrorCodeFromMasterOrSlaveToBH 160 ; Parameters: 161 ; AH: Error code for drive DL reset 162 ; BL: Requested drive (DL when entering AH=00h) 163 ; DL: Drive just resetted 164 ; DS: RAMVARS segment 165 ; Returns: 166 ; BH: Backuped error code 167 ; DL: Incremented if next drive is slave drive 168 ; (=already resetted) 169 ; Corrupts registers: 170 ; CX, DI 159 ; Iteration routine for AH0h_ResetHardDisksHandledByOurBIOS, 160 ; for use with IterateAllDPTs 161 ; 162 ; Returns when DPT is found on the controller with Idevars offset in DL 171 163 ;-------------------------------------------------------------------- 172 ALIGN JUMP_ALIGN 173 .BackupErrorCodeFromMasterOrSlaveToBH: 174 call BackupErrorCodeFromTheRequestedDriveToBH 175 call GetBasePortToCX ; Load base port for resetted drive 176 push cx 177 inc dx ; DL to next drive 178 call GetBasePortToCX 179 pop di 180 cmp cx, di ; Next drive is from same controller? 181 je SHORT BackupErrorCodeFromTheRequestedDriveToBH 182 .NoMoreDrivesOrNoSlaveDrive: 183 dec dx 164 IterateFindFirstDPTforIdevars: 165 cmp dl, [di+DPT.bIdevarsOffset] ; Clears CF if matched 166 jz .done 167 stc ; Set CF for not found 168 .done: 184 169 ret 185 186 187 ;--------------------------------------------------------------------188 ; GetBasePortToCX189 ; Parameters:190 ; DL: Drive number191 ; DS: RAMVARS segment192 ; Returns:193 ; CX: Base port address194 ; CF: Set if valid drive number195 ; Cleared if invalid drive number196 ; Corrupts registers:197 ; DI198 ;--------------------------------------------------------------------199 ALIGN JUMP_ALIGN200 GetBasePortToCX:201 xchg cx, bx202 xor bx, bx203 call FindDPT_ForDriveNumber204 mov bl, [di+DPT.bIdevarsOffset]205 mov bx, [cs:bx+IDEVARS.wPort]206 xchg bx, cx207 ret208 209 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH8h_HParams.asm
r261 r262 25 25 ;-------------------------------------------------------------------- 26 26 AH8h_HandlerForReadDiskDriveParameters: 27 28 call RamVars_IsDriveHandledByThisBIOS 29 jnc SHORT .OurDrive 27 test di,di 28 jnz SHORT .OurDrive 30 29 31 30 call Int13h_CallPreviousInt13hHandler -
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.