Changeset 558 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h
- Timestamp:
- Jun 23, 2013, 3:52:31 PM (11 years ago)
- google:author:
- krille_n_@hotmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm
r545 r558 40 40 ; AH: Int 13h return status 41 41 ; CF: 0 if successful, 1 if error 42 ; DX: Command return values (see XTCF.inc) 42 43 ;-------------------------------------------------------------------- 43 44 AH1Eh_HandlerForXTCFfeatures: … … 46 47 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 47 48 %else 48 push 49 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 49 50 ; Fall to ProcessXTCFsubcommandFromAL 50 51 %endif … … 60 61 ; AH: Int 13h return status 61 62 ; CF: 0 if successful, 1 if error 62 ; DX Command return values (see XTCF.inc)63 63 ; Corrupts registers: 64 64 ; AL, BX, CX, DX, SI … … 68 68 call AccessDPT_IsThisDeviceXTCF 69 69 jne SHORT .XTCFnotFound 70 and ax, BYTE 7Fh; Subcommand now in AX (clears AH and CF)70 and ax, 0FFh ; Subcommand now in AX (clears AH and CF) 71 71 jz SHORT .XTCFfound ; Sub-function IS_THIS_DRIVE_XTCF (=0) 72 72 … … 75 75 76 76 dec ax ; Test subcommand for value 2 (GET_XTCF_TRANSFER_MODE) 77 jnz SHORT . XTCFnotFound ; Invalid subcommand77 jnz SHORT .AH1Eh_LoadInvalidCommandToAHandSetCF 78 78 79 79 ; GET_XTCF_TRANSFER_MODE 80 80 call AH1Eh_GetCurrentXTCFmodeToAX 81 mov dh, al 81 82 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... 83 mov [bp+IDEPACK.intpack+INTPACK.dx], dx ; Return mode value (DH) and block size (DL) via INTPACK 84 84 .XTCFfound: 85 ret ; ...with AH and CF cleared85 ret ; With AH and CF cleared 86 86 87 87 .XTCFnotFound: 88 88 .AH1Eh_LoadInvalidCommandToAHandSetCF: 89 stc ; set carry flag since XT-CF not found89 stc ; Set carry flag since XT-CF not found or invalid subcommand 90 90 mov ah, RET_HD_INVALID 91 ret ; and return91 ret 92 92 93 93 .SetXTCFtransferMode: 94 mov al, [bp+IDEPACK.intpack+INTPACK.dh] ; get specified mode (eg XTCF_DMA_MODE)95 ; and fall to AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL94 mov al, [bp+IDEPACK.intpack+INTPACK.dh] ; Get specified mode (eg XTCF_DMA_MODE) 95 ; Fall to AH1Eh_ChangeXTCFmodeBasedOnModeInAL 96 96 97 97 … … 102 102 ; DS:DI: Ptr to DPT (in RAMVARS segment) 103 103 ; SS:BP: Ptr to IDEPACK 104 ; Returns: 104 ; Returns: 105 105 ; AH: Int 13h return status 106 106 ; CF: 0 if successful, 1 if error … … 110 110 AH1Eh_ChangeXTCFmodeBasedOnModeInAL: 111 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.112 ; whose purpose is *only* to raise DRQ. The register cannot be read. 113 113 ; Selected transfer mode is stored in BIOS variable (DPT_ATA.bDevice). 114 114 115 ; We always need to enable 8-bit mode since 16-bit mode is restored116 ; when controller is reset (AH=00h or 0Dh)117 ;118 115 ; Note that when selecting 'DEVICE_8BIT_PIO_MODE_WITH_BIU_OFFLOAD' mode, 119 116 ; 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 instructions117 ; data will be transferred from its data register using 16-bit CPU instructions 121 118 ; like REP INSW. This works because XT-CF adapters are 8-bit cards, and 122 119 ; the BIU in the machine splits each WORD requested by the CPU into two 8-bit … … 125 122 ; the data for presentation to the CPU. 126 123 ; 127 ; Also note th ough that some machines, noteably AT&T PC6300, have hardware128 ; errors in the BIU logic, resulting in reversed byte ordering. Therefore,129 ; mode DEVICE_8BIT_PIO is the default transfer mode for best system130 ; compatibility.124 ; Also note that some machines, noteably the Olivetti M24 (also known as 125 ; the AT&T PC6300 and Xerox 6060), have hardware errors in the BIU logic, 126 ; resulting in reversed byte ordering. Therefore, mode DEVICE_8BIT_PIO is 127 ; the default transfer mode for best system compatibility. 131 128 129 ; We always need to enable 8-bit mode since 16-bit mode is restored 130 ; when controller is reset (AH=00h or 0Dh) 132 131 ePUSH_T bx, AH23h_Enable8bitPioMode 133 132 134 133 ; Convert mode to device type (see XTCF.inc for full details) 135 134 and ax, 3 136 jz SHORT .Set8bitPioMode ; XTCF_8BIT_PIO_MODE = 0137 dec ax ; XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD = 1138 jz SHORT .Set8bitPioModeWithBIUOffload135 jz SHORT .Set8bitPioMode ; XTCF_8BIT_PIO_MODE = 0 136 dec ax ; XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD = 1 137 jz SHORT .Set8bitPioModeWithBIUOffload 139 138 140 139 ; XTCF_DMA_MODE = 2 (allow 3 as well for more optimized code) 141 140 mov BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA 142 141 143 ; DMA transfers have limited block size e142 ; DMA transfers have limited block size 144 143 mov al, [di+DPT_ATA.bBlockSize] 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 144 cmp al, XTCF_DMA_MODE_MAX_BLOCK_SIZE 145 jbe SHORT AH24h_SetBlockSize 146 mov al, XTCF_DMA_MODE_MAX_BLOCK_SIZE 147 jmp SHORT AH24h_SetBlockSize 148 148 149 149 .Set8bitPioMode: 150 mov BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_PIO8151 ret ; through AH23h_Enable8bitPioMode150 mov al, DEVICE_8BIT_XTCF_PIO8 151 SKIP2B bx 152 152 153 153 .Set8bitPioModeWithBIUOffload: 154 mov BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD 155 ret ; through AH23h_Enable8bitPioMode 154 mov al, DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD 155 mov [di+DPT_ATA.bDevice], al 156 ret 156 157 157 158 … … 160 161 ; Parameters: 161 162 ; DS:DI: Ptr to DPT (in RAMVARS segment) 162 ; Returns: 163 ; Returns: 163 164 ; AX: XT-CF mode (XTCF_8BIT_PIO_MODE, XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD or XTCF_DMA_MODE) 164 165 ; CF: Clear … … 167 168 ;-------------------------------------------------------------------- 168 169 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 170 mov al, [di+DPT_ATA.bDevice] 171 shr al, 1 172 cbw 173 sub al, DEVICE_8BIT_XTCF_PIO8 >> 1 172 174 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm
r550 r558 84 84 pop bx ; Pop block size to BL 85 85 jc SHORT .DisableBlockMode 86 mov bh, bl ; BL and BH both have block size we tried to set 87 dec bh 88 jz SHORT .DisableBlockMode 86 87 ; All valid block sizes are powers of 2 which means BL have just one bit set (parity odd). 88 ; Incrementing BX will cause all block sizes except 1 to have two bits set (parity even). 89 ; Note that PF reflects only the lowest 8 bits of any register being modified. 90 inc bx ; 1 -> 2 ? 91 jpo SHORT .DisableBlockMode ; Jump if BL = 2 92 dec bx ; Restore block size (was larger than 1) 89 93 90 94 ; Enable block mode and store block size -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r550 r558 112 112 113 113 114 %ifdef MODULE_8BIT_IDE_ADVANCED 114 115 ;;; Set XT-CF mode 115 %ifdef MODULE_8BIT_IDE_ADVANCED116 116 call AH1Eh_GetCurrentXTCFmodeToAX 117 117 call AH9h_SetModeFromALtoXTCF 118 118 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_SET_XTCF_MODE 119 .DoNotSetXTCFmode:120 119 %endif ; MODULE_8BIT_IDE_ADVANCED 121 120 … … 124 123 call AH9h_Enable8bitModeForDevice8bitAta 125 124 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_SET_8BIT_MODE 126 .DoNotSet8bitMode:127 125 %endif ; MODULE_8BIT_IDE 128 126 … … 138 136 call Idepack_StoreNonExtParametersAndIssueCommandFromAL 139 137 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS 140 .SkipInitializeDeviceParameters:141 138 142 139 … … 302 299 jne SHORT IgnoreInvalidCommandError 303 300 jmp AH23h_Enable8bitPioMode 304 %endif 301 %endif ; MODULE_8BIT_IDE -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm
r550 r558 45 45 46 46 ; Make sure that sector count is valid 47 %ifdef USE_UNDOC_INTEL 48 eSALC ; Clear AL using CF (CF is cleared since JB above fell through) 49 or al, [es:si+DAP.wSectorCount] 50 %else 47 51 mov al, [es:si+DAP.wSectorCount] 48 52 test al, al 53 %endif 49 54 jz SHORT ZeroSectorsRequestedSoNoErrors 50 55 js SHORT InvalidNumberOfSectorsRequested … … 62 67 call Prepare_GetOldInt13hCommandIndexToBX 63 68 mov al, [di+DPT.bFlagsLow] 64 shlal, 1 ; Set CF if LBA48 supported69 eSHL_IM al, 1 ; Set CF if LBA48 supported 65 70 adc bl, bh ; LBA48 EXT commands 66 71 ret
Note:
See TracChangeset
for help on using the changeset viewer.