Changeset 545 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h
- Timestamp:
- Apr 19, 2013, 11:44:35 AM (12 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm
r526 r545 1 1 ; Project name : XTIDE Universal BIOS 2 ; Description : Int 13h function AH=1Eh, Lo-tech XT-CF features. 2 ; Description : Int 13h function AH=1Eh, Lo-tech XT-CF features 3 ; 4 ; More information at http://www.lo-tech.co.uk/XT-CF 3 5 4 6 ; … … 17 19 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 18 20 ; 21 22 ; Modified by JJP for XT-CFv3 support, Mar-13 19 23 20 24 ; Section containing code … … 42 46 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 43 47 %else 44 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH48 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 45 49 ; Fall to ProcessXTCFsubcommandFromAL 46 50 %endif … … 56 60 ; AH: Int 13h return status 57 61 ; CF: 0 if successful, 1 if error 62 ; DX Command return values (see XTCF.inc) 58 63 ; Corrupts registers: 59 64 ; AL, BX, CX, DX, SI … … 62 67 ; IS_THIS_DRIVE_XTCF. We check this for all commands. 63 68 call AccessDPT_IsThisDeviceXTCF 64 jne SHORT XTCFnotFound69 jne SHORT .XTCFnotFound 65 70 and ax, BYTE 7Fh ; Subcommand now in AX (clears AH and CF) 66 jz SHORT . ReturnWithSuccess ; IS_THIS_DRIVE_XTCF71 jz SHORT .XTCFfound ; Sub-function IS_THIS_DRIVE_XTCF (=0) 67 72 68 ; READ_XTCF_CONTROL_REGISTER_TO_DH 69 dec ax ; Subcommand 70 jnz SHORT .SkipReadXtcfControlRegisterToDH 71 mov dx, [di+DPT.wBasePort] 72 add dl, XTCF_CONTROL_REGISTER ; Will never overflow (keeps CF cleared) 73 in al, dx 74 mov [bp+IDEPACK.intpack+INTPACK.dh], al 75 .ReturnWithSuccess: 76 ret ; With AH and CF cleared 73 dec ax ; Test subcommand... 74 jz SHORT .SetXTCFtransferMode ; ...for value 1 (SET_XTCF_TRANSFER_MODE) 77 75 78 .SkipReadXtcfControlRegisterToDH: 79 ; WRITE_DH_TO_XTCF_CONTROL_REGISTER 80 dec ax ; Subcommand 81 jnz SHORT XTCFnotFound ; Invalid subcommand 82 mov al, [bp+IDEPACK.intpack+INTPACK.dh] 83 ; Fall to AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL 76 dec ax ; Test subcommand for value 2 (GET_XTCF_TRANSFER_MODE) 77 jnz SHORT .XTCFnotFound ; Invalid subcommand 78 79 ; GET_XTCF_TRANSFER_MODE 80 call AH1Eh_GetCurrentXTCFmodeToAX 81 mov dl, [di+DPT_ATA.bBlockSize] 82 mov [bp+IDEPACK.intpack+INTPACK.dh], al ; return mode value... 83 mov [bp+IDEPACK.intpack+INTPACK.dl], dl ; ...and block size, via INTPACK... 84 .XTCFfound: 85 ret ; ...with AH and CF cleared 86 87 .XTCFnotFound: 88 .AH1Eh_LoadInvalidCommandToAHandSetCF: 89 stc ; set carry flag since XT-CF not found 90 mov ah, RET_HD_INVALID 91 ret ; and return 92 93 .SetXTCFtransferMode: 94 mov al, [bp+IDEPACK.intpack+INTPACK.dh] ; get specified mode (eg XTCF_DMA_MODE) 95 ; and fall to AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL 84 96 85 97 86 98 ;-------------------------------------------------------------------- 87 ; AH1Eh_ChangeXTCFmodeBasedOn ControlRegisterInAL99 ; AH1Eh_ChangeXTCFmodeBasedOnModeInAL 88 100 ; Parameters: 89 ; AL: XT-CF Control Register101 ; AL: XT-CF Mode (see XTCF.inc) 90 102 ; DS:DI: Ptr to DPT (in RAMVARS segment) 91 103 ; SS:BP: Ptr to IDEPACK 92 ; Returns: 104 ; Returns: 93 105 ; AH: Int 13h return status 94 106 ; CF: 0 if successful, 1 if error … … 96 108 ; AL, BX, CX, DX, SI 97 109 ;-------------------------------------------------------------------- 98 AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL: 99 ; Output Control Register 100 mov dx, [di+DPT.wBasePort] 101 add dl, XTCF_CONTROL_REGISTER 102 out dx, al 110 AH1Eh_ChangeXTCFmodeBasedOnModeInAL: 111 ; Note: Control register (as of XT-CFv3) is now a write-only register, 112 ; whos purpose is *only* to raise DRQ. The register cannot be read. 113 ; Selected transfer mode is stored in BIOS variable (DPT_ATA.bDevice). 103 114 104 115 ; We always need to enable 8-bit mode since 16-bit mode is restored 105 116 ; when controller is reset (AH=00h or 0Dh) 117 ; 118 ; Note that when selecting 'DEVICE_8BIT_PIO_MODE_WITH_BIU_OFFLOAD' mode, 119 ; the ATA device (i.e. CompactFlash card) will operate in 8-bit mode, but 120 ; data will be transferred from it's data register using 16-bit CPU instructions 121 ; like REP INSW. This works because XT-CF adapters are 8-bit cards, and 122 ; the BIU in the machine splits each WORD requested by the CPU into two 8-bit 123 ; ISA cycles at base+0h and base+1h. The XT-CF cards do not decode A0, hence 124 ; both accesses appear the same to the card and the BIU then re-constructs 125 ; the data for presentation to the CPU. 126 ; 127 ; Also note though that some machines, noteably AT&T PC6300, have hardware 128 ; errors in the BIU logic, resulting in reversed byte ordering. Therefore, 129 ; mode DEVICE_8BIT_PIO is the default transfer mode for best system 130 ; compatibility. 131 106 132 ePUSH_T bx, AH23h_Enable8bitPioMode 107 133 108 ; Convert Control Register Contents to device code109 test al, al110 jz SHORT .Set8bitPioMode111 cmp al, XTCF_MEMORY_MAPPED_MODE112 j ae SHORT .SetMemoryMappedMode134 ; Convert mode to device type (see XTCF.inc for full details) 135 and ax, 3 136 jz SHORT .Set8bitPioMode ; XTCF_8BIT_PIO_MODE = 0 137 dec ax ; XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD = 1 138 jz SHORT .Set8bitPioModeWithBIUOffload 113 139 114 ; Set DMA Mode140 ; XTCF_DMA_MODE = 2 (allow 3 as well for more optimized code) 115 141 mov BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA 142 143 ; DMA transfers have limited block sizee 116 144 mov al, [di+DPT_ATA.bBlockSize] 117 cmp al, XTCF_DMA_MODE_MAX_BLOCK_SIZE 118 jbe SHORT AH24h_SetBlockSize 119 mov al, XTCF_DMA_MODE_MAX_BLOCK_SIZE 120 jmp SHORT AH24h_SetBlockSize 121 122 .SetMemoryMappedMode: 123 mov al, DEVICE_8BIT_XTCF_MEMMAP 124 SKIP2B bx 145 MIN_U al, XTCF_DMA_MODE_MAX_BLOCK_SIZE 146 jmp AH24h_SetBlockSize 147 ; exit via ret in AH24_SetBlockSize then through AH23h_Enable8bitPioMode 125 148 126 149 .Set8bitPioMode: 127 mov al, DEVICE_8BIT_XTCF_PIO8 128 mov [di+DPT_ATA.bDevice], al 129 ret ; Via AH23h_Enable8bitPioMode 150 mov BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_PIO8 151 ret ; through AH23h_Enable8bitPioMode 152 153 .Set8bitPioModeWithBIUOffload: 154 mov BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD 155 ret ; through AH23h_Enable8bitPioMode 130 156 131 157 132 158 ;-------------------------------------------------------------------- 133 ; AH1Eh_ DetectXTCFwithBasePortInDX159 ; AH1Eh_GetCurrentXTCFmodeToAX 134 160 ; Parameters: 135 ; DX: Base I/O port address to check 136 ; Returns: 137 ; AH: RET_HD_SUCCESS if XT-CF is found from port 138 ; RET_HD_INVALID if XT-CF is not found 139 ; CF: Cleared if XT-CF found 140 ; Set if XT-CF not found 161 ; DS:DI: Ptr to DPT (in RAMVARS segment) 162 ; Returns: 163 ; AX: XT-CF mode (XTCF_8BIT_PIO_MODE, XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD or XTCF_DMA_MODE) 164 ; CF: Clear 141 165 ; Corrupts registers: 142 ; AL166 ; Nothing 143 167 ;-------------------------------------------------------------------- 144 AH1Eh_DetectXTCFwithBasePortInDX: 145 push dx 146 add dl, XTCF_CONTROL_REGISTER_INVERTED_in ; set DX to XT-CF config register (inverted) 147 in al, dx ; get value 148 mov ah, al ; save in ah 149 inc dx ; set DX to XT-CF config register (non-inverted) 150 in al, dx ; get value 151 not al ; invert value 152 pop dx 153 sub ah, al ; do they match? (clear AH if they do) 154 jz SHORT XTCFfound 155 156 XTCFnotFound: 157 AH1Eh_LoadInvalidCommandToAHandSetCF: 158 stc ; set carry flag since XT-CF not found 159 mov ah, RET_HD_INVALID 160 XTCFfound: 161 ret ; and return 168 AH1Eh_GetCurrentXTCFmodeToAX: 169 eMOVZX ax, BYTE [di+DPT_ATA.bDevice] ; get current mode from DPT 170 sub al, DEVICE_8BIT_XTCF_PIO8 171 shr ax, 1 ; Device type to XT-CF mode 172 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm
r526 r545 63 63 cmp al, XTCF_DMA_MODE_MAX_BLOCK_SIZE 64 64 jbe SHORT .NoNeedToLimitBlockSize 65 66 ; Return error if we tried too large block for XT-CF. 67 ; Do not limit it to maximum supported since software calling AH=24h 68 ; must know what the actual block size is. 65 69 cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA 66 je SHORT AH1Eh_LoadInvalidCommandToAHandSetCF70 je SHORT ProcessXTCFsubcommandFromAL.AH1Eh_LoadInvalidCommandToAHandSetCF 67 71 .NoNeedToLimitBlockSize: 68 72 %endif ; MODULE_8BIT_IDE_ADVANCED … … 77 81 pop bx 78 82 jnc SHORT .StoreBlockSize 79 mov bl, 1 ; Block size 1 will always work 83 84 ; Drive disabled block mode since we tried unsupported block size. 85 ; We must adjust DPT accordingly. 86 mov bl, 1 ; Block size 1 will always work (=Block mode disabled) 80 87 .StoreBlockSize: ; Store new block size to DPT and return 81 88 mov [di+DPT_ATA.bBlockSize], bl -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH8h_HParams.asm
r543 r545 58 58 59 59 test byte [bp+IDEPACK.intpack+INTPACK.dl], 080h 60 jnz .Done60 jnz SHORT .CalledForHardDrive 61 61 62 62 mov [bp+IDEPACK.intpack+INTPACK.bl], bl … … 67 67 call FloppyDrive_GetCountToAX 68 68 69 . Done:69 .CalledForHardDrive: 70 70 mov ah, dh 71 71 … … 133 133 %ifdef MODULE_SERIAL_FLOPPY 134 134 mov bl, [di+DPT.bFlagsHigh] 135 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS ; not sure why this is needed for preprocessor-only136 135 eSHR_IM bl, FLGH_DPT_SERIAL_FLOPPY_TYPE_FIELD_POSITION 137 %endif138 136 %endif 139 137 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r542 r545 114 114 ;;; Set XT-CF mode 115 115 %ifdef MODULE_8BIT_IDE_ADVANCED 116 call AccessDPT_GetIdevarsToCSBX 117 mov al, [cs:bx+IDEVARS.bXTCFcontrolRegister] 116 call AH1Eh_GetCurrentXTCFmodeToAX 118 117 call AH9h_SetModeFromALtoXTCF 119 118 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_SET_XTCF_MODE … … 284 283 call AccessDPT_IsThisDeviceXTCF 285 284 jne SHORT IgnoreInvalidCommandError 286 jmp AH1Eh_ChangeXTCFmodeBasedOn ControlRegisterInAL285 jmp AH1Eh_ChangeXTCFmodeBasedOnModeInAL 287 286 %endif ; MODULE_8BIT_IDE_ADVANCED 288 287 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH48h_GetExtendedDriveParameters.asm
r544 r545 139 139 sbb dx, (MAX_SECTOR_COUNT_TO_RETURN_PCHS+1) >> 16 140 140 sbb bx, cx ; Zero 141 jnc SHORT . ReturnWithSuccess141 jnc SHORT .DoNotSetChsFlag 142 142 or BYTE [di+EDRIVE_INFO.wFlags], FLG_CHS_INFORMATION_IS_VALID 143 143 144 ; We store something to P-CHS anyway since some HW detection programs 145 ; ignore the CHS flag. And we should at least clear the variables anyway 146 ; since the same buffer is used for all drives so it contains parameters 147 ; from previously scanned drive. 148 .DoNotSetChsFlag: 144 149 eMOVZX dx, BYTE [es:si+DPT.bPchsHeads] 145 150 mov [di+EDRIVE_INFO.dwHeads], dx
Note:
See TracChangeset
for help on using the changeset viewer.