Changeset 158 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device
- Timestamp:
- May 2, 2011, 9:41:51 AM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Device
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm
r152 r158 16 16 ;-------------------------------------------------------------------- 17 17 Device_FinalizeDPT: 18 test WORD [di+DPT.wFlags], FLG_DPT_SERIAL_DEVICE18 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 19 19 jnz SHORT ReturnSuccessForSerialPort 20 20 jmp IdeDPT_Finalize … … 34 34 ;-------------------------------------------------------------------- 35 35 Device_ResetMasterAndSlaveController: 36 test WORD [di+DPT.wFlags], FLG_DPT_SERIAL_DEVICE36 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 37 37 jnz SHORT ReturnSuccessForSerialPort 38 38 jmp IdeCommand_ResetMasterAndSlaveController … … 76 76 ALIGN JUMP_ALIGN 77 77 Device_OutputCommandWithParameters: 78 test WORD [di+DPT.wFlags], FLG_DPT_SERIAL_DEVICE78 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 79 79 jnz SHORT .OutputCommandToSerialPort 80 80 jmp IdeCommand_OutputWithParameters … … 97 97 ALIGN JUMP_ALIGN 98 98 Device_SelectDrive: 99 test WORD [di+DPT.wFlags], FLG_DPT_SERIAL_DEVICE99 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 100 100 jnz SHORT ReturnSuccessForSerialPort 101 101 jmp IdeCommand_SelectDrive … … 168 168 ;-------------------------------------------------------------------- 169 169 TranslateRegisterAddressInDLifNecessaryThenJumpToBX: 170 test WORD [di+DPT.wFlags], FLG_DPT_REVERSED_A0_AND_A3170 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3 171 171 jz SHORT .JumpToIoFunctionInSI 172 172 -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r157 r158 54 54 ; Create fake DPT to be able to use Device.asm functions 55 55 call FindDPT_ForNewDriveToDSDI 56 xor ax, ax56 eMOVZX ax, bh 57 57 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0 58 eCMOVE ax, FLG_DPT_REVERSED_A0_AND_A3 59 or al, bh 58 eCMOVE ah, FLGH_DPT_REVERSED_A0_AND_A3 60 59 mov [di+DPT.wFlags], ax 61 60 mov [di+DPT.bIdevarsOffset], bp … … 65 64 cmp bp, BYTE ROMVARS.ideVars0 66 65 jne SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster 67 test bh, FLG_DRVNHEAD_DRV66 test al, FLG_DRVNHEAD_DRV 68 67 jnz SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster 69 68 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_MOTOR_STARTUP, FLG_STATUS_BSY) … … 82 81 83 82 ; Clean stack and return 84 lea sp, [bp+ SIZE_OF_FAKE_IDEPACK] ; This assumes BP hasn't changed between Idepack_FakeToSSBP and here83 lea sp, [bp+EXTRA_BYTES_FOR_INTPACK] ; This assumes BP hasn't changed between Idepack_FakeToSSBP and here 85 84 pop bp 86 85 ret … … 103 102 ALIGN JUMP_ALIGN 104 103 IdeCommand_OutputWithParameters: 105 push bx 104 push bx ; Store status register bits to poll 106 105 107 106 ; Select Master or Slave drive and output head number or LBA28 top bits … … 110 109 111 110 ; Output Device Control Byte to enable or disable interrupts 112 mov dl, DEVICE_CONTROL_REGISTER_out113 111 mov al, [bp+IDEPACK.bDeviceControl] 114 test al, FLG_DEVCONTROL_nIEN 112 test al, FLG_DEVCONTROL_nIEN ; Interrupts disabled? 115 113 jnz SHORT .DoNotSetInterruptInServiceFlag 116 or WORD [di+DPT.wFlags], FLG_DPT_INTERRUPT_IN_SERVICE 114 115 ; Clear Task Flag and set Interrupt In-Service Flag 116 or BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INTERRUPT_IN_SERVICE 117 117 push ds 118 LOAD_BDA_SEGMENT_TO ds, cx, ! ; Also zero CX119 mov [BDA.bHDTaskFlg], al118 LOAD_BDA_SEGMENT_TO ds, dx, ! ; Also zero DX 119 mov [BDA.bHDTaskFlg], dl 120 120 pop ds 121 121 .DoNotSetInterruptInServiceFlag: 122 mov dl, DEVICE_CONTROL_REGISTER_out 122 123 call Device_OutputALtoIdeControlBlockRegisterInDL 123 124 … … 143 144 144 145 ; Wait until command completed 145 pop bx 146 cmp bl, FLG_STATUS_DRQ 147 je SHORT .StartDataTransfer146 pop bx ; Pop status and timeout for polling 147 cmp bl, FLG_STATUS_DRQ ; Data transfer started? 148 je SHORT IdeTransfer_StartWithCommandInAL 148 149 test BYTE [bp+IDEPACK.bDeviceControl], FLG_DEVCONTROL_nIEN 149 150 jz SHORT .WaitForIrqOrRdy … … 153 154 .WaitForIrqOrRdy: 154 155 jmp IdeWait_IRQorStatusFlagInBLwithTimeoutInBH 155 ALIGN JUMP_ALIGN156 .StartDataTransfer:157 jmp IdeTransfer_StartWithCommandInAL158 156 159 157 .DriveNotReady: … … 179 177 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY) 180 178 cmp BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE 181 eCMOVE b x, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_IDENTIFY_DEVICE, FLG_STATUS_BSY)179 eCMOVE bh, TIMEOUT_IDENTIFY_DEVICE 182 180 call IdeWait_PollStatusFlagInBLwithTimeoutInBH 183 181 jc SHORT ReturnSinceTimeoutWhenPollingBusy … … 189 187 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY) 190 188 cmp BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE 191 eCMOVE b x, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_IDENTIFY_DEVICE, FLG_STATUS_DRDY)189 eCMOVE bh, TIMEOUT_IDENTIFY_DEVICE 192 190 jmp IdeWait_PollStatusFlagInBLwithTimeoutInBH 193 191 -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm
r152 r158 114 114 115 115 ; Clear Interrupt In-Service Flag from DPT 116 and WORD [di+DPT.wFlags], ~FLG_DPT_INTERRUPT_IN_SERVICE116 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_INTERRUPT_IN_SERVICE 117 117 118 118 ; Set Task Flag -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r157 r158 166 166 ; InitializePiovarsInSSBPwithSectorCountInAX 167 167 ; Parameters: 168 ; AX: Number of sectors to transfer ( 0=65536)168 ; AX: Number of sectors to transfer (1...65535) 169 169 ; BX: Offset to transfer function lookup table 170 170 ; DS:DI: Ptr to DPT (in RAMVARS segment) … … 179 179 ; Store number of blocks to transfer 180 180 eMOVZX cx, BYTE [di+DPT_ATA.bSetBlock] ; Block size in sectors 181 xor dx, dx 182 test ax, ax 183 eCMOVZ dl, 1 ; DX:AX = Sectors to transfer (1...65536) 181 xor dx, dx ; DX:AX = Sectors to transfer (1...65535) 184 182 div cx ; AX = Full blocks to transfer 185 183 test dx, dx … … 197 195 198 196 ; Get transfer function based on bus type 199 xchg ax, bx 197 xchg ax, bx ; Lookup table offset to AX 200 198 eMOVZX bx, BYTE [di+DPT.bIdevarsOffset] ; CS:BX now points to IDEVARS 201 199 mov dx, [cs:bx+IDEVARS.wPort] ; Load IDE Data port address -
trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm
r155 r158 1 1 ; Project name : XTIDE Universal BIOS 2 2 ; Description : Functions for managing IDEPACK struct. 3 4 SIZE_OF_FAKE_IDEPACK EQU (IDEPACK_size - INTPACK_size)5 3 6 4 ; Section containing code … … 18 16 Idepack_FakeToSSBP: 19 17 pop ax 20 sub sp, BYTE SIZE_OF_FAKE_IDEPACK18 sub sp, BYTE EXTRA_BYTES_FOR_INTPACK 21 19 mov bp, sp 22 20 jmp ax
Note:
See TracChangeset
for help on using the changeset viewer.