Changeset 480 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device
- Timestamp:
- Oct 27, 2012, 11:26:11 AM (12 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Device
- Files:
-
- 1 added
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm
r473 r480 84 84 ; DX: Autodetected port (for devices that support autodetection) 85 85 ; DS: Segment to RAMVARS 86 ; ES:SI: Ptr to normalizedbuffer to receive 512-byte IDE Information86 ; ES:SI: Ptr to buffer to receive 512-byte IDE Information 87 87 ; CS:BP: Ptr to IDEVARS 88 88 ; Returns: … … 109 109 ; BH: Default system timer ticks for timeout (can be ignored) 110 110 ; BL: IDE Status Register bit to poll after command 111 ; ES:SI: Ptr to normalizedbuffer (for data transfer commands)111 ; ES:SI: Ptr to buffer (for data transfer commands) 112 112 ; DS:DI: Ptr to DPT (in RAMVARS segment) 113 113 ; SS:BP: Ptr to IDEPACK -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r474 r480 88 88 89 89 %ifdef MODULE_8BIT_IDE 90 ; We set XT-CF to 8-bit PIO mode for Identify Device command. 91 ; Correct XT-CF mode is later set on AH=09h (after all drives are detected). 92 call AccessDPT_IsThisDeviceXTCF 93 jne SHORT .SkipXTCFmodeChange 94 90 ; Enable 8-bit PIO mode for 8-bit ATA and XT-CF 91 push si 92 call AH9h_Enable8bitModeForDevice8bitAta 95 93 xor al, al ; XTCF_8BIT_PIO_MODE 96 push si 97 call AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL 94 call AH9h_SetModeFromALtoXTCF 98 95 pop si 99 jc SHORT .FailedToSet8bitMode100 .SkipXTCFmodeChange:101 96 %endif ; MODULE_8BIT_IDE 102 97 … … 178 173 jne SHORT .WaitUntilNonTransferCommandCompletes 179 174 %ifdef MODULE_8BIT_IDE 180 cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_ DMA181 j e SHORT .StartDmaTransfer182 ja SHORT JrIdeTransfer_StartWithCommandInAL ; DEVICE_8BIT_XTCF_MEMMAP or DEVICE_8BIT_JRIDE_ISA 175 cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_MEMMAP 176 jae SHORT JrIdeTransfer_StartWithCommandInAL ; DEVICE_8BIT_XTCF_MEMMAP or DEVICE_8BIT_JRIDE_ISA 177 %endif 183 178 jmp IdeTransfer_StartWithCommandInAL 184 .StartDmaTransfer:185 jmp IdeDmaTransfer_StartWithCommandInAL186 %else187 jmp IdeTransfer_StartWithCommandInAL188 %endif189 179 190 180 .WaitUntilNonTransferCommandCompletes: -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm
r473 r480 215 215 ; AX, BX, CX 216 216 ;-------------------------------------------------------------------- 217 %ifdef USE_186 ; Also used by XTIDE rev 2 when 80186/80188 commands allowed 218 ALIGN JUMP_ALIGN 217 ALIGN JUMP_ALIGN 218 %ifdef USE_186 219 219 IdePioBlock_ReadFromXtideRev2: 220 %endif 220 221 IdePioBlock_ReadFrom16bitDataPort: 221 222 xchg cl, ch ; Sectors to WORDs 222 rep insw 223 ret 224 %endif 225 226 ;-------------------------------------------------------------------- 227 %ifdef USE_AT 223 rep 224 db 6Dh ; INSW 225 ret 226 227 ;-------------------------------------------------------------------- 228 228 ALIGN JUMP_ALIGN 229 229 IdePioBlock_ReadFrom32bitDataPort: 230 shl cx, 7 ; Sectors to DWORDs 230 db 0C1h ; SHL 231 db 0E1h ; CX 232 db 7 ; 7 (Sectors to DWORDs) 231 233 rep 232 234 db 66h ; Override operand size to 32-bit 233 235 db 6Dh ; INSW/INSD 234 236 ret 235 %endif236 237 237 238 … … 248 249 ; AX, BX, CX, DX 249 250 ;-------------------------------------------------------------------- 250 %ifdef USE_AT251 252 251 ALIGN JUMP_ALIGN 253 252 IdePioBlock_WriteTo16bitDataPort: 254 253 xchg cl, ch ; Sectors to WORDs 255 254 es ; Source is ES segment 256 rep outsw 255 rep 256 db 6Fh ; OUTSW 257 257 ret 258 258 … … 260 260 ALIGN JUMP_ALIGN 261 261 IdePioBlock_WriteTo32bitDataPort: 262 shl cx, 7 ; Sectors to DWORDs 262 db 0C1h ; SHL 263 db 0E1h ; CX 264 db 7 ; 7 (Sectors to DWORDs) 263 265 es ; Source is ES segment 264 266 rep … … 266 268 db 6Fh ; OUTSW/OUTSD 267 269 ret 268 269 %endif ; USE_AT -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r473 r480 38 38 ; AL: IDE command that was used to start the transfer 39 39 ; (all PIO read and write commands including Identify Device) 40 ; ES:SI: Ptr to normalizeddata buffer40 ; ES:SI: Ptr to data buffer 41 41 ; DS:DI: Ptr to DPT (in RAMVARS segment) 42 42 ; SS:BP: Ptr to IDEPACK … … 62 62 ; Parameters: 63 63 ; AH: Number of sectors to transfer (1...128) 64 ; ES:SI: Normalized ptr to buffer to receive data64 ; ES:SI: Ptr to buffer to receive data 65 65 ; DS:DI: Ptr to DPT (in RAMVARS segment) 66 66 ; SS:BP: Ptr to PIOVARS … … 139 139 ; AH: Number of sectors to transfer (1...128) 140 140 ; DS:DI: Ptr to DPT (in RAMVARS segment) 141 ; ES:SI: Normalized ptr to buffer containing data141 ; ES:SI: Ptr to buffer containing data 142 142 ; SS:BP: Ptr to PIOVARS 143 143 ; Returns: … … 198 198 ; BX: Offset to transfer function lookup table 199 199 ; DS:DI: Ptr to DPT (in RAMVARS segment) 200 ; ES:SI: Ptr to data buffer 200 201 ; SS:BP: Ptr to PIOVARS 201 202 ; Returns: … … 217 218 xchg ax, bx ; Lookup table offset to AX 218 219 mov bl, [di+DPT_ATA.bDevice] 220 %ifdef MODULE_8BIT_IDE 221 mov dl, bl 222 %endif 219 223 add bx, ax 220 224 mov ax, [cs:bx] ; Load offset to transfer function 221 225 mov [bp+PIOVARS.fnXfer], ax 222 ret 223 226 227 ; Normalize pointer for PIO-transfers and convert to physical address for DMA transfers 228 %ifdef MODULE_8BIT_IDE 229 cmp dl, DEVICE_8BIT_XTCF_DMA 230 jb SHORT IdeTransfer_NormalizePointerInESSI 231 232 ; Convert ES:SI to physical address 233 xor dx, dx 234 mov ax, es 235 %rep 4 236 shl ax, 1 237 rcl dx, 1 238 %endrep 239 add si, ax 240 adc dl, dh 241 mov es, dx 242 ret 243 %endif ; MODULE_8BIT_IDE 244 ; Fall to IdeTransfer_NormalizePointerInESSI if no MODULE_8BIT_IDE 245 246 247 ;-------------------------------------------------------------------- 248 ; IdeTransfer_NormalizePointerInESSI 249 ; Parameters: 250 ; ES:SI: Ptr to be normalized 251 ; Returns: 252 ; ES:SI: Normalized pointer (SI = 0...15) 253 ; Corrupts registers: 254 ; AX, DX 255 ;-------------------------------------------------------------------- 256 IdeTransfer_NormalizePointerInESSI: 257 NORMALIZE_FAR_POINTER es, si, ax, dx 258 ret 224 259 225 260 … … 227 262 ALIGN WORD_ALIGN 228 263 g_rgfnPioRead: 229 %ifdef USE_AT230 264 dw IdePioBlock_ReadFrom16bitDataPort ; 0, DEVICE_16BIT_ATA 231 265 dw IdePioBlock_ReadFrom32bitDataPort ; 1, DEVICE_32BIT_ATA 232 %else 233 dd 0 234 %endif 235 %ifdef MODULE_8BIT_IDE 236 dw IdePioBlock_ReadFromXtideRev1 ; 2, DEVICE_8BIT_XTIDE_REV1 237 %ifndef USE_AT 238 g_rgfnPioWrite: 239 %endif 240 dw IdePioBlock_ReadFromXtideRev2 ; 3, DEVICE_8BIT_XTIDE_REV2 241 dw IdePioBlock_ReadFrom8bitDataPort ; 4, DEVICE_8BIT_XTCF_PIO8 242 %endif 243 244 %ifdef USE_AT 266 %ifdef MODULE_8BIT_IDE 267 dw IdePioBlock_ReadFrom8bitDataPort ; 2, DEVICE_8BIT_ATA 268 dw IdePioBlock_ReadFromXtideRev1 ; 3, DEVICE_8BIT_XTIDE_REV1 269 dw IdePioBlock_ReadFromXtideRev2 ; 4, DEVICE_8BIT_XTIDE_REV2 270 dw IdePioBlock_ReadFrom8bitDataPort ; 5, DEVICE_8BIT_XTCF_PIO8 271 dw IdeDmaBlock_ReadFromXTCF ; 6, DEVICE_8BIT_XTCF_DMA 272 %endif 273 274 245 275 g_rgfnPioWrite: 246 276 dw IdePioBlock_WriteTo16bitDataPort ; 0, DEVICE_16BIT_ATA 247 277 dw IdePioBlock_WriteTo32bitDataPort ; 1, DEVICE_32BIT_ATA 248 %endif 249 %ifdef MODULE_8BIT_IDE 250 dw IdePioBlock_WriteToXtideRev1 ; 2, DEVICE_8BIT_XTIDE_REV1 251 dw IdePioBlock_WriteToXtideRev2 ; 3, DEVICE_8BIT_XTIDE_REV2 252 dw IdePioBlock_WriteTo8bitDataPort ; 4, DEVICE_8BIT_XTCF_PIO8 253 %endif 278 %ifdef MODULE_8BIT_IDE 279 dw IdePioBlock_WriteTo8bitDataPort ; 2, DEVICE_8BIT_ATA 280 dw IdePioBlock_WriteToXtideRev1 ; 3, DEVICE_8BIT_XTIDE_REV1 281 dw IdePioBlock_WriteToXtideRev2 ; 4, DEVICE_8BIT_XTIDE_REV2 282 dw IdePioBlock_WriteTo8bitDataPort ; 5, DEVICE_8BIT_XTCF_PIO8 283 dw IdeDmaBlock_WriteToXTCF ; 6, DEVICE_8BIT_XTCF_DMA 284 %endif -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/JrIdeTransfer.asm
r476 r480 39 39 ; AL: IDE command that was used to start the transfer 40 40 ; (all PIO read and write commands including Identify Device) 41 ; ES:SI: Ptr to normalizeddata buffer41 ; ES:SI: Ptr to data buffer 42 42 ; DS:DI: Ptr to DPT (in RAMVARS segment) 43 43 ; SS:BP: Ptr to IDEPACK … … 61 61 mov [bp+MEMPIOVARS.fpDPT], di 62 62 mov [bp+MEMPIOVARS.fpDPT+2], ds 63 64 ; Normalize pointer 65 call IdeTransfer_NormalizePointerInESSI 63 66 64 67 ; Get far pointer to Sector Access Window -
trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm
r477 r480 74 74 mov [bp+IDEPACK.bDrvAndHead], al 75 75 76 ; Normalize data buffer pointer to ES:SI 77 %ifdef MODULE_8BIT_IDE 78 cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA 79 jne SHORT .NormalizeForSmallestPossibleOffset 80 81 ; DMA transfers do not need to normalize pointer 82 ; (it will be converted to physical address in IdeDmaTransfer.asm) 76 ; Load data buffer pointer to ES:SI 83 77 les si, [es:si+DAP.dwMemoryAddress] 84 jmp SHORT GetDeviceControlByteToIdepackAndStartTransfer85 %endif ; MODULE_8BIT_IDE86 87 .NormalizeForSmallestPossibleOffset:88 mov ax, [es:si+DAP.wOffset]89 mov cx, ax90 eSHR_IM ax, 4 ; Divide offset by 1691 add ax, [es:si+DAP.wSegment] ; Add segment92 mov es, ax ; Segment normalized93 mov si, cx94 and si, BYTE 0Fh ; Offset normalized95 78 jmp SHORT GetDeviceControlByteToIdepackAndStartTransfer 96 79 %endif ; MODULE_EBIOS -
trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm
r376 r480 61 61 62 62 .readOrWrite: 63 call IdeTransfer_NormalizePointerInESSI 63 64 mov [bp+IDEPACK.bFeatures],ah ; store protocol command 64 65
Note:
See TracChangeset
for help on using the changeset viewer.