Changeset 160 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device/IDE
- Timestamp:
- May 4, 2011, 5:49:22 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Device/IDE
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r158 r160 20 20 or al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN ; Set Reset bit 21 21 mov dl, DEVICE_CONTROL_REGISTER_out 22 call Device_OutputALtoIdeControlBlockRegisterInDL22 call IdeIO_OutputALtoIdeControlBlockRegisterInDL 23 23 mov ax, HSR0_RESET_WAIT_US 24 24 call Timer_DelayMicrosecondsFromAX … … 29 29 and al, ~FLG_DEVCONTROL_SRST ; Clear reset bit 30 30 mov dl, DEVICE_CONTROL_REGISTER_out 31 call Device_OutputALtoIdeControlBlockRegisterInDL31 call IdeIO_OutputALtoIdeControlBlockRegisterInDL 32 32 mov ax, HSR1_RESET_WAIT_US 33 33 call Timer_DelayMicrosecondsFromAX … … 55 55 call FindDPT_ForNewDriveToDSDI 56 56 eMOVZX ax, bh 57 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_WITH_REVERSED_A3_AND_A058 eCMOVE ah, FLGH_DPT_REVERSED_A0_AND_A359 57 mov [di+DPT.wFlags], ax 60 58 mov [di+DPT.bIdevarsOffset], bp 61 59 mov BYTE [di+DPT_ATA.bSetBlock], 1 ; Block = 1 sector 60 call IdeDPT_StoreReversedAddressLinesFlagIfNecessary 62 61 63 62 ; Wait until drive motors have reached max speed … … 121 120 .DoNotSetInterruptInServiceFlag: 122 121 mov dl, DEVICE_CONTROL_REGISTER_out 123 call Device_OutputALtoIdeControlBlockRegisterInDL122 call IdeIO_OutputALtoIdeControlBlockRegisterInDL 124 123 125 124 ; Output Feature Number 126 125 mov dl, FEATURES_REGISTER_out 127 126 mov al, [bp+IDEPACK.bFeatures] 128 call Device_OutputALtoIdeRegisterInDL127 call IdeIO_OutputALtoIdeRegisterInDL 129 128 130 129 ; Output Sector Address High (only used by LBA48) … … 141 140 mov dl, COMMAND_REGISTER_out 142 141 mov al, [bp+IDEPACK.bCommand] 143 call Device_OutputALtoIdeRegisterInDL142 call IdeIO_OutputALtoIdeRegisterInDL 144 143 145 144 ; Wait until command completed … … 184 183 mov dl, DRIVE_AND_HEAD_SELECT_REGISTER 185 184 mov al, [bp+IDEPACK.bDrvAndHead] 186 call Device_OutputALtoIdeRegisterInDL185 call IdeIO_OutputALtoIdeRegisterInDL 187 186 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY) 188 187 cmp BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE … … 207 206 OutputSectorCountAndAddress: 208 207 mov dl, SECTOR_COUNT_REGISTER 209 call Device_OutputALtoIdeRegisterInDL208 call IdeIO_OutputALtoIdeRegisterInDL 210 209 211 210 mov al, ah 212 211 mov dl, LBA_LOW_REGISTER 213 call Device_OutputALtoIdeRegisterInDL212 call IdeIO_OutputALtoIdeRegisterInDL 214 213 215 214 mov al, cl 216 215 mov dl, LBA_MIDDLE_REGISTER 217 call Device_OutputALtoIdeRegisterInDL216 call IdeIO_OutputALtoIdeRegisterInDL 218 217 219 218 mov al, ch 220 219 mov dl, LBA_HIGH_REGISTER 221 jmp Device_OutputALtoIdeRegisterInDL220 jmp IdeIO_OutputALtoIdeRegisterInDL -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm
r150 r160 10 10 ; DS:DI: Ptr to Disk Parameter Table 11 11 ; ES:SI: Ptr to 512-byte ATA information read from the drive 12 ; CS:BP: Ptr to IDEVARS for the controller 12 13 ; Returns: 13 14 ; Nothing … … 23 24 ; DS:DI: Ptr to Disk Parameter Table 24 25 ; ES:SI: Ptr to 512-byte ATA information read from the drive 26 ; CS:BP: Ptr to IDEVARS for the controller 25 27 ; Returns: 26 28 ; Nothing … … 32 34 mov ah, [es:si+ATA1.bBlckSize] ; Max block size in sectors 33 35 mov [di+DPT_ATA.wSetAndMaxBlock], ax 34 ; Fall to .EndDPT36 ; Fall to IdeDPT_StoreReversedAddressLinesFlagIfNecessary 35 37 38 ;-------------------------------------------------------------------- 39 ; IdeDPT_StoreReversedAddressLinesFlagIfNecessary 40 ; Parameters: 41 ; DS:DI: Ptr to Disk Parameter Table 42 ; CS:BP: Ptr to IDEVARS for the controller 43 ; Returns: 44 ; Nothing 45 ; Corrupts registers: 46 ; Nothing 47 ;-------------------------------------------------------------------- 48 IdeDPT_StoreReversedAddressLinesFlagIfNecessary: 49 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0 50 jne SHORT .EndDPT 51 or BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3 36 52 37 53 .EndDPT: -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeError.asm
r150 r160 21 21 mov ah, al ; IDE Status Register to AH 22 22 mov dl, ERROR_REGISTER_in 23 call Device_InputToALfromIdeRegisterInDL23 call IdeIO_InputToALfromIdeRegisterInDL 24 24 xchg al, ah ; Status Register now in AL, Error Register now in AH 25 25 -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm
r150 r160 6 6 7 7 ;-------------------------------------------------------------------- 8 ; IdeIO_OutputALtoIdeRegisterInD X8 ; IdeIO_OutputALtoIdeRegisterInDL 9 9 ; Parameters: 10 10 ; AL: Byte to output 11 ; D X: IDE Register12 ; CS:BX: Ptr to IDEVARS11 ; DL: IDE Register 12 ; DS:DI: Ptr to DPT (in RAMVARS segment) 13 13 ; Returns: 14 14 ; Nothing 15 15 ; Corrupts registers: 16 ; DX16 ; BX, DX 17 17 ;-------------------------------------------------------------------- 18 18 ALIGN JUMP_ALIGN 19 IdeIO_OutputALtoIdeRegisterInDX: 20 add dx, [cs:bx+IDEVARS.wPort] 19 IdeIO_OutputALtoIdeRegisterInDL: 20 mov bx, IDEVARS.wPort 21 call GetPortToDXandTranslateA0andA3ifNecessary 21 22 out dx, al 22 23 ret … … 24 25 25 26 ;-------------------------------------------------------------------- 26 ; IdeIO_OutputALtoIdeControlBlockRegisterInD X27 ; IdeIO_OutputALtoIdeControlBlockRegisterInDL 27 28 ; Parameters: 28 29 ; AL: Byte to output 29 ; D X: IDE Control Block Register30 ; CS:BX: Ptr to IDEVARS30 ; DL: IDE Control Block Register 31 ; DS:DI: Ptr to DPT (in RAMVARS segment) 31 32 ; Returns: 32 33 ; Nothing 33 34 ; Corrupts registers: 34 ; DX35 ; BX, DX 35 36 ;-------------------------------------------------------------------- 36 37 ALIGN JUMP_ALIGN 37 IdeIO_OutputALtoIdeControlBlockRegisterInDX: 38 add dx, [cs:bx+IDEVARS.wPortCtrl] 38 IdeIO_OutputALtoIdeControlBlockRegisterInDL: 39 mov bx, IDEVARS.wPortCtrl 40 call GetPortToDXandTranslateA0andA3ifNecessary 39 41 out dx, al 40 42 ret … … 42 44 43 45 ;-------------------------------------------------------------------- 44 ; IdeIO_InputToALfromIdeRegisterInD X46 ; IdeIO_InputToALfromIdeRegisterInDL 45 47 ; Parameters: 46 ; D X: IDE Register47 ; CS:BX: Ptr to IDEVARS48 ; DL: IDE Register 49 ; DS:DI: Ptr to DPT (in RAMVARS segment) 48 50 ; Returns: 49 51 ; AL: Inputted byte 50 52 ; Corrupts registers: 51 ; DX53 ; BX, DX 52 54 ;-------------------------------------------------------------------- 53 55 ALIGN JUMP_ALIGN 54 IdeIO_InputToALfromIdeRegisterInDX: 55 add dx, [cs:bx+IDEVARS.wPort] 56 IdeIO_InputToALfromIdeRegisterInDL: 57 mov bx, IDEVARS.wPort 58 call GetPortToDXandTranslateA0andA3ifNecessary 56 59 in al, dx 57 60 ret 61 62 63 ;-------------------------------------------------------------------- 64 ; GetPortToDXandTranslateA0andA3ifNecessary 65 ; Parameters: 66 ; BX: Offset to port in IDEVARS (IDEVARS.wPort or IDEVARS.wPortCtrl) 67 ; DL: IDE Register 68 ; DS:DI: Ptr to DPT (in RAMVARS segment) 69 ; Returns: 70 ; DX: Source/Destination Port 71 ; Corrupts registers: 72 ; BX 73 ;-------------------------------------------------------------------- 74 ALIGN JUMP_ALIGN 75 GetPortToDXandTranslateA0andA3ifNecessary: 76 xor dh, dh ; DX now has IDE register offset 77 add bl, [di+DPT.bIdevarsOffset] ; CS:BX now points port address 78 add dx, [cs:bx] 79 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3 80 jz SHORT .ReturnPortInDX 81 82 ; Exchange address lines A0 and A3 from DL 83 mov bl, dl 84 mov bh, MASK_A3_AND_A0_ADDRESS_LINES 85 and bh, bl ; BH = 0, 1, 8 or 9, we can ignore 0 and 9 86 jz SHORT .ReturnPortInDX ; Jump out since DH is 0 87 xor bh, MASK_A3_AND_A0_ADDRESS_LINES 88 jz SHORT .ReturnPortInDX ; Jump out since DH was 9 89 and dl, ~MASK_A3_AND_A0_ADDRESS_LINES 90 or dl, bh ; Address lines now reversed 91 .ReturnPortInDX: 92 ret -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm
r158 r160 111 111 call FindDPT_ToDSDIforInterruptInService 112 112 mov dl, STATUS_REGISTER_in 113 call Device_InputToALfromIdeRegisterInDL113 call IdeIO_InputToALfromIdeRegisterInDL 114 114 115 115 ; Clear Interrupt In-Service Flag from DPT -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm
r155 r160 127 127 ReadIdeStatusRegisterToAL: 128 128 mov dl, STATUS_REGISTER_in 129 jmp Device_InputToALfromIdeRegisterInDL129 jmp IdeIO_InputToALfromIdeRegisterInDL
Note:
See TracChangeset
for help on using the changeset viewer.