Changeset 400 in xtideuniversalbios


Ignore:
Timestamp:
Apr 20, 2012, 2:30:16 PM (13 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Moved 8-bit device support to MODULE_8BIT_IDE.
  • JR-IDE/ISA support requires a lot less bytes.
  • AT builds now always use full operating mode.
Location:
trunk/XTIDE_Universal_BIOS
Files:
2 added
3 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc

    r399 r400  
    4949
    5050    ; Bit definitions for DPT.bFlagsHigh
    51     FLGH_DPT_REVERSED_A0_AND_A3                 EQU (1<<0)  ; XTIDE mod, Address lines 0 and 3 reversed
    5251    FLGH_DPT_BLOCK_MODE_SUPPORTED               EQU (1<<1)  ; Use block transfer commands (must be bit 1!)
    5352    FLGH_DPT_SERIAL_DEVICE                      EQU (1<<2)  ; Serial Port Device
     
    7574    .dpt                    resb    DPT_size
    7675    .bBlockSize             resb    1   ; Current block size in sectors (do not set to zero!)
    77     .bInitError             resb    1
     76    .bDevice                resb    1   ; Device Type from IDEVARS (overrided when 32-bit controller detected)
    7877endstruc
    7978
    80 
    81     ; Flags for DPT_ATA.bInitError
    82     FLG_INITERROR_FAILED_TO_SELECT_DRIVE                EQU (1<<0)
    83     FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS   EQU (1<<1)
    84     FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE             EQU (1<<2)
    85     FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE           EQU (1<<3)
    86     FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE              EQU (1<<4)
    87     FLG_INITERROR_FAILED_TO_SET_PIO_MODE                EQU (1<<5)
    88     FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER    EQU (1<<6)
    8979
    9080; Additional variables needed to initialize and reset Advanced IDE Controllers.
     
    9787    .wMinPioCycleTime       resb    2   ; Minimum PIO Cycle Time in ns
    9888    .bPioMode               resb    1   ; Best supported PIO mode
    99     .bDevice                resb    1   ; Device Type from IDEVARS (overrided when 32-bit controller detected)
     89    .bInitError             resb    1   ; Flags for initialization errors
    10090endstruc
    10191%endif
     92
     93    ; Flags for DPT_ADVANCED_ATA.bInitError
     94    FLG_INITERROR_FAILED_TO_SELECT_DRIVE                EQU (1<<0)
     95    FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS   EQU (1<<1)
     96    FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE             EQU (1<<2)
     97    FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE           EQU (1<<3)
     98    FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE              EQU (1<<4)
     99    FLG_INITERROR_FAILED_TO_SET_PIO_MODE                EQU (1<<5)
     100    FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER    EQU (1<<6)
    102101
    103102
  • trunk/XTIDE_Universal_BIOS/Inc/DeviceIDE.inc

    r376 r400  
    2626
    2727; Polling timeout delays (system timer ticks, 1 tick = 54.9 ms)
    28 TIMEOUT_BSY             EQU     (2000/55)   ; 2000 ms
    29 TIMEOUT_DRDY            EQU     (2000/55)   ; 2000 ms
    3028TIMEOUT_DRQ             EQU     255         ;   14 s (some CF cards occasionally have long write delays)
    3129TIMEOUT_IDENTIFY_DEVICE EQU     (500/55)    ;  500 ms
    3230TIMEOUT_MOTOR_STARTUP   EQU     (10000/55)  ;   10 s
    3331
     32%ifdef MODULE_FEATURE_SETS
     33TIMEOUT_BSY             EQU     TIMEOUT_MOTOR_STARTUP
     34TIMEOUT_DRDY            EQU     TIMEOUT_MOTOR_STARTUP
     35%else
     36TIMEOUT_BSY             EQU     (2000/55)   ; 2000 ms
     37TIMEOUT_DRDY            EQU     (2000/55)   ; 2000 ms
     38%endif
    3439
    3540%endif ; DEVICEIDE_INC
  • trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc

    r398 r400  
    3232%endif
    3333
     34%ifdef MODULE_JRIDE
     35    %ifndef MODULE_8BIT_IDE
     36        %define MODULE_8BIT_IDE
     37    %endif
     38%endif
     39
    3440
    3541
    3642; Include module specific .INC files
     43%ifdef MODULE_8BIT_IDE
     44    %include "IDE_8bit.inc"         ; For IDE 8-bit data port macros
     45%endif
     46
    3747%ifdef MODULE_ADVANCED_ATA
    3848    %include "Vision.inc"           ; For QDI Vision QD65xx VLB IDE Controllers
     
    5767
    5868; Included modules for ROMVARS.wFlags
     69%ifdef MODULE_8BIT_IDE
     70    MAIN_FLG_MODULE_8BIT_IDE    EQU FLG_ROMVARS_MODULE_8BIT_IDE
     71%else
     72    MAIN_FLG_MODULE_8BIT_IDE    EQU 0
     73%endif
     74
    5975%ifdef MODULE_ADVANCED_ATA
    6076    MAIN_FLG_MODULE_ADVANCED_ATA    EQU FLG_ROMVARS_MODULE_ADVANCED_ATA
     
    111127%endif
    112128
    113 MASK_ROMVARS_INCLUDED_MODULES   EQU MAIN_FLG_MODULE_ADVANCED_ATA | MAIN_FLG_MODULE_BOOT_MENU | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_HOTKEYS | MAIN_FLG_MODULE_IRQ | MAIN_FLG_MODULE_JRIDE | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_SERIAL_FLOPPY | MAIN_FLG_MODULE_STRINGS_COMPRESSED
     129%ifdef MODULE_FEATURE_SETS
     130    MAIN_FLG_MODULE_FEATURE_SETS    EQU FLG_ROMVARS_MODULE_FEATURE_SETS
     131%else
     132    MAIN_FLG_MODULE_FEATURE_SETS    EQU 0
     133%endif
     134
     135MASK_ROMVARS_INCLUDED_MODULES   EQU MAIN_FLG_MODULE_8BIT_IDE | MAIN_FLG_MODULE_ADVANCED_ATA | MAIN_FLG_MODULE_BOOT_MENU | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_HOTKEYS | MAIN_FLG_MODULE_IRQ | MAIN_FLG_MODULE_JRIDE | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_SERIAL_FLOPPY | MAIN_FLG_MODULE_STRINGS_COMPRESSED | MAIN_FLG_MODULE_FEATURE_SETS
  • trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc

    r376 r400  
    2222
    2323; Segment when RAMVARS is stored to top of interrupt vectors.
     24%ifndef USE_AT
    2425LITE_MODE_RAMVARS_SEGMENT   EQU     30h
     26%endif
    2527
    2628
  • trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r398 r400  
    7070                                                ; (Conveniently, this is 8, a fact we exploit when testing the bit)
    7171
    72 FLG_ROMVARS_MODULE_ADVANCED_ATA         EQU (1<<7)  ; Here in case the configuration needs to know functionality is present
    73 FLG_ROMVARS_MODULE_BOOT_MENU            EQU (1<<8)  ; Here in case the configuration needs to know functionality is present
    74 FLG_ROMVARS_MODULE_EBIOS                EQU (1<<9)  ; Here in case the configuration needs to know functionality is present
    75 FLG_ROMVARS_MODULE_HOTKEYS              EQU (1<<10) ; Here in case the configuration needs to know functionality is present
    76 FLG_ROMVARS_MODULE_IRQ                  EQU (1<<11) ; Here in case the configuration needs to know functionality is present
    77 FLG_ROMVARS_MODULE_JRIDE                EQU (1<<12) ; Here in case the configuration needs to know functionality is present
    78 FLG_ROMVARS_MODULE_SERIAL               EQU (1<<13) ; Here in case the configuration needs to know functionality is present
    79 FLG_ROMVARS_MODULE_SERIAL_FLOPPY        EQU (1<<14) ; Here in case the configuration needs to know functionality is present
    80 FLG_ROMVARS_MODULE_STRINGS_COMPRESSED   EQU (1<<15) ; Here in case the configuration needs to know functionality is present
     72; Here in case the configuration needs to know functionality is present
     73FLG_ROMVARS_MODULE_FEATURE_SETS         EQU (1<<5)
     74FLG_ROMVARS_MODULE_8BIT_IDE             EQU (1<<6)
     75FLG_ROMVARS_MODULE_JRIDE                EQU (1<<7)
     76FLG_ROMVARS_MODULE_ADVANCED_ATA         EQU (1<<8)
     77FLG_ROMVARS_MODULE_BOOT_MENU            EQU (1<<9)
     78FLG_ROMVARS_MODULE_EBIOS                EQU (1<<10)
     79FLG_ROMVARS_MODULE_HOTKEYS              EQU (1<<11)
     80FLG_ROMVARS_MODULE_IRQ                  EQU (1<<12)
     81FLG_ROMVARS_MODULE_SERIAL               EQU (1<<13)
     82FLG_ROMVARS_MODULE_SERIAL_FLOPPY        EQU (1<<14)
     83FLG_ROMVARS_MODULE_STRINGS_COMPRESSED   EQU (1<<15)
    8184
    8285
     
    119122;
    120123DEVICE_XTIDE_DEFAULT_PORT               EQU     300h
    121 DEVICE_XTIDE_DEFAULT_PORTCTRL           EQU     DEVICE_XTIDE_DEFAULT_PORT + 8h
     124DEVICE_XTIDE_DEFAULT_PORTCTRL           EQU     (DEVICE_XTIDE_DEFAULT_PORT + 8h)
    122125
    123126DEVICE_ATA_PRIMARY_PORT                 EQU     1F0h
    124 DEVICE_ATA_PRIMARY_PORTCTRL             EQU     DEVICE_ATA_PRIMARY_PORT + 200h
     127DEVICE_ATA_PRIMARY_PORTCTRL             EQU     (DEVICE_ATA_PRIMARY_PORT + 200h)
    125128
    126129DEVICE_ATA_SECONDARY_PORT               EQU     170h
    127 DEVICE_ATA_SECONDARY_PORTCTRL           EQU     DEVICE_ATA_SECONDARY_PORT + 200h
     130DEVICE_ATA_SECONDARY_PORTCTRL           EQU     (DEVICE_ATA_SECONDARY_PORT + 200h)
    128131
    129132DEVICE_ATA_TERTIARY_PORT                EQU     1E8h
    130 DEVICE_ATA_TERTIARY_PORTCTRL            EQU     DEVICE_ATA_TERTIARY_PORT + 200h
     133DEVICE_ATA_TERTIARY_PORTCTRL            EQU     (DEVICE_ATA_TERTIARY_PORT + 200h)
    131134
    132135DEVICE_ATA_QUATERNARY_PORT              EQU     168h
    133 DEVICE_ATA_QUATERNARY_PORTCTRL          EQU     DEVICE_ATA_QUATERNARY_PORT + 200h
     136DEVICE_ATA_QUATERNARY_PORTCTRL          EQU     (DEVICE_ATA_QUATERNARY_PORT + 200h)
    134137
    135138
    136139; Device types for IDEVARS.bDevice
    137140;
    138 DEVICE_XTIDE_REV1                       EQU (0<<1)
    139 DEVICE_XTIDE_REV2                       EQU (1<<1)  ; Or rev 1 with swapped A0 and A3 (chuck mod)
    140 DEVICE_FAST_XTIDE                       EQU (2<<1)  ; (CPLD v2 project)
    141 DEVICE_16BIT_ATA                        EQU (3<<1)
    142 DEVICE_32BIT_ATA                        EQU (4<<1)
    143 DEVICE_SERIAL_PORT                      EQU (5<<1)
    144 DEVICE_JRIDE_ISA                        EQU (6<<1)
     141DEVICE_8BIT_JRIDE_ISA                   EQU (0<<1)  ; JR-IDE/ISA (must be 0)
     142DEVICE_8BIT_FAST_XTIDE                  EQU (1<<1)  ; CPLD v2 project (must be 1 or 2)
     143DEVICE_8BIT_XTIDE_REV2                  EQU (2<<1)  ; Or rev 1 with swapped A0 and A3 (must be 1 or 2)
     144DEVICE_8BIT_XTIDE_REV1                  EQU (3<<1)  ; Must be 4
     145COUNT_OF_8BIT_IDE_DEVICES               EQU 4
     146
     147DEVICE_16BIT_ATA                        EQU (COUNT_OF_8BIT_IDE_DEVICES<<1)
     148DEVICE_32BIT_ATA                        EQU ((COUNT_OF_8BIT_IDE_DEVICES+1)<<1)
     149COUNT_OF_16BIT_IDE_DEVICES              EQU 2
     150COUNT_OF_ALL_IDE_DEVICES                EQU (COUNT_OF_8BIT_IDE_DEVICES + COUNT_OF_16BIT_IDE_DEVICES)
     151
     152DEVICE_SERIAL_PORT                      EQU (COUNT_OF_ALL_IDE_DEVICES<<1)
     153
    145154
    146155
  • trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm

    r376 r400  
    2727%endmacro
    2828
    29 %macro CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE 1
    30     xchg    ax, bx
    31     eMOVZX  bx, [di+DPT.bIdevarsOffset]
    32     cmp     BYTE [cs:bx+IDEVARS.bDevice], DEVICE_JRIDE_ISA
    33     xchg    bx, ax              ; Restore BX
    34     je      SHORT %1
    35 %endmacro
    36 
    3729%macro CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF 2
    3830    cmp     BYTE [cs:bp+IDEVARS.bDevice], %1
     
    5345;       AX, BX, CX, DX
    5446;--------------------------------------------------------------------
    55 %ifdef MODULE_SERIAL
     47%ifdef MODULE_SERIAL    ; IDE + Serial
    5648Device_FinalizeDPT:
    5749    ; needs to check IDEVARS vs. checking the DPT as the serial bit in the DPT is set in the Finalize routine
    58     CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_SERIAL_PORT, .FinalizeDptForSerialPortDevice
     50    CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF   DEVICE_SERIAL_PORT, .FinalizeDptForSerialPortDevice
    5951    jmp     IdeDPT_Finalize
    6052.FinalizeDptForSerialPortDevice:
    6153    jmp     SerialDPT_Finalize
    6254
    63 %else   ; IDE or JR-IDE/ISA
    64     Device_FinalizeDPT EQU IdeDPT_Finalize
     55%else                   ; IDE
     56    Device_FinalizeDPT      EQU     IdeDPT_Finalize
    6557%endif
    6658
     
    7668;       AL, BX, CX, DX
    7769;--------------------------------------------------------------------
    78 %ifdef MODULE_JRIDE
    79     %ifdef MODULE_SERIAL                ; IDE + JR-IDE/ISA + Serial
    80     Device_ResetMasterAndSlaveController:
    81         TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
    82         CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .ResetJrIDE
    83         jmp     IdeCommand_ResetMasterAndSlaveController
    84 
    85     %else                               ; IDE + JR-IDE/ISA
    86     Device_ResetMasterAndSlaveController:
    87         CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .ResetJrIDE
    88         jmp     IdeCommand_ResetMasterAndSlaveController
    89     %endif
    90 
    91 %elifdef MODULE_SERIAL                  ; IDE + Serial
     70%ifdef MODULE_SERIAL    ; IDE + Serial
    9271Device_ResetMasterAndSlaveController:
    93     TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
     72    TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE    ReturnSuccessForSerialPort
    9473    jmp     IdeCommand_ResetMasterAndSlaveController
    9574
    96 %else                                   ; IDE
    97     Device_ResetMasterAndSlaveController EQU IdeCommand_ResetMasterAndSlaveController
    98 %endif
    99 
    100 %ifdef MODULE_JRIDE
    101 .ResetJrIDE:
    102     jmp     MemIdeCommand_ResetMasterAndSlaveController
     75%else                   ; IDE
     76    Device_ResetMasterAndSlaveController    EQU     IdeCommand_ResetMasterAndSlaveController
    10377%endif
    10478
     
    11791;       AL, BL, CX, DX, SI, DI, ES
    11892;--------------------------------------------------------------------
    119 %ifdef MODULE_JRIDE
    120     %ifdef MODULE_SERIAL                ; IDE + JR-IDE/ISA + Serial
    121     Device_IdentifyToBufferInESSIwithDriveSelectByteInBH:
    122         CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_SERIAL_PORT, .IdentifyDriveFromSerialPort
    123         CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_JRIDE_ISA, .IdentifyDriveFromJrIde
    124         jmp     IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
    125 
    126     %else                               ; IDE + JR-IDE/ISA
    127     Device_IdentifyToBufferInESSIwithDriveSelectByteInBH:
    128         CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_JRIDE_ISA, .IdentifyDriveFromJrIde
    129         jmp     IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
    130     %endif
    131 
    132 %elifdef MODULE_SERIAL                  ; IDE + Serial
     93%ifdef MODULE_SERIAL    ; IDE + Serial
    13394Device_IdentifyToBufferInESSIwithDriveSelectByteInBH:
    134     CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_SERIAL_PORT, .IdentifyDriveFromSerialPort
     95    CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF   DEVICE_SERIAL_PORT, .IdentifyDriveFromSerialPort
    13596    jmp     IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
    136 
    137 %else                                   ; IDE
    138     Device_IdentifyToBufferInESSIwithDriveSelectByteInBH EQU IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
    139 %endif
    140 
    141 %ifdef MODULE_JRIDE
    142 .IdentifyDriveFromJrIde:
    143     jmp     MemIdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
    144 %endif
    145 
    146 %ifdef MODULE_SERIAL
    14797.IdentifyDriveFromSerialPort:
    14898    jmp     SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
     99
     100%else                   ; IDE
     101    Device_IdentifyToBufferInESSIwithDriveSelectByteInBH    EQU     IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
    149102%endif
    150103
     
    165118;       AL, BX, (CX), DX, (ES:SI for data transfer commands)
    166119;--------------------------------------------------------------------
    167 %ifdef MODULE_JRIDE
    168     %ifdef MODULE_SERIAL                ; IDE + JR-IDE/ISA + Serial
    169     Device_OutputCommandWithParameters:
    170         TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort
    171         CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .OutputCommandToJrIDE
    172         jmp     IdeCommand_OutputWithParameters
    173 
    174     %else                               ; IDE + JR-IDE/ISA
    175     Device_OutputCommandWithParameters:
    176         CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .OutputCommandToJrIDE
    177         jmp     IdeCommand_OutputWithParameters
    178     %endif
    179 
    180 %elifdef MODULE_SERIAL                  ; IDE + Serial
     120%ifdef MODULE_SERIAL    ; IDE + Serial
     121ALIGN JUMP_ALIGN
    181122Device_OutputCommandWithParameters:
    182123    TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort
    183124    jmp     IdeCommand_OutputWithParameters
    184125
    185 %else                                   ; IDE
    186     Device_OutputCommandWithParameters EQU IdeCommand_OutputWithParameters
    187 %endif
    188 
    189 %ifdef MODULE_JRIDE
    190 ALIGN JUMP_ALIGN
    191 .OutputCommandToJrIDE:
    192     jmp     MemIdeCommand_OutputWithParameters
    193 %endif
    194 
    195 %ifdef MODULE_SERIAL
    196126ALIGN JUMP_ALIGN
    197127.OutputCommandToSerialPort:
    198128    jmp     SerialCommand_OutputWithParameters
     129
     130%else                   ; IDE
     131    Device_OutputCommandWithParameters      EQU     IdeCommand_OutputWithParameters
    199132%endif
    200133
     
    211144;       AL, BX, CX, DX
    212145;--------------------------------------------------------------------
    213 %ifdef MODULE_JRIDE
    214     %ifdef MODULE_SERIAL                ; IDE + JR-IDE/ISA + Serial
    215     Device_SelectDrive:
    216         TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
    217         CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .SelectJrIdeDrive
    218         jmp     IdeCommand_SelectDrive
    219 
    220     %else                               ; IDE + JR-IDE/ISA
    221     Device_SelectDrive:
    222         CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .SelectJrIdeDrive
    223         jmp     IdeCommand_SelectDrive
    224     %endif
    225 
    226 %elifdef MODULE_SERIAL                  ; IDE + Serial
     146%ifdef MODULE_SERIAL    ; IDE + Serial
    227147Device_SelectDrive:
    228     TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort
     148    TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE    ReturnSuccessForSerialPort
    229149    jmp     IdeCommand_SelectDrive
    230150
    231 %else                                   ; IDE
    232     Device_SelectDrive EQU IdeCommand_SelectDrive
     151%else                   ; IDE
     152    Device_SelectDrive      EQU     IdeCommand_SelectDrive
    233153%endif
    234154
    235 %ifdef MODULE_JRIDE
    236 ALIGN JUMP_ALIGN
    237 .SelectJrIdeDrive:
    238     jmp     MemIdeCommand_SelectDrive
    239 %endif
    240155
    241156%ifdef MODULE_SERIAL
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm

    r376 r400  
    3131;       AL, BX, CX, DX
    3232;--------------------------------------------------------------------
    33 IDEDEVICE%+Command_ResetMasterAndSlaveController:
     33IdeCommand_ResetMasterAndSlaveController:
    3434    ; HSR0: Set_SRST
    3535    call    AccessDPT_GetDeviceControlByteToAL
     
    4949    ; HSR2: Check_status
    5050    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_MOTOR_STARTUP, FLG_STATUS_BSY)
    51     jmp     IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH
     51    jmp     IdeWait_PollStatusFlagInBLwithTimeoutInBH
    5252
    5353
     
    6565;       AL, BL, CX, DX, SI, DI, ES
    6666;--------------------------------------------------------------------
    67 IDEDEVICE%+Command_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH:
     67IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH:
    6868    ; Create fake DPT to be able to use Device.asm functions
    6969    call    FindDPT_ForNewDriveToDSDI
     
    7272    mov     [di+DPT.bIdevarsOffset], bp
    7373    mov     BYTE [di+DPT_ATA.bBlockSize], 1 ; Block = 1 sector
    74 %ifdef MODULE_ADVANCED_ATA
    7574    call    IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
    76 %endif
    77 %ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS
    78     call    IdeDPT_StoreReversedAddressLinesFlagIfNecessary
    79 %endif
    8075
    8176    ; Wait until drive motors have reached max speed
    8277    cmp     bp, BYTE ROMVARS.ideVars0
    8378    jne     SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster
    84     test    al, FLG_DRVNHEAD_DRV
     79    test    bh, FLG_DRVNHEAD_DRV
    8580    jnz     SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster
    8681    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_MOTOR_STARTUP, FLG_STATUS_BSY)
    87     call    IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH
     82    call    IdeWait_PollStatusFlagInBLwithTimeoutInBH
    8883.SkipLongWaitSinceDriveIsNotPrimaryMaster:
    8984
     
    120115;--------------------------------------------------------------------
    121116ALIGN JUMP_ALIGN
    122 IDEDEVICE%+Command_OutputWithParameters:
     117IdeCommand_OutputWithParameters:
    123118    push    bx                      ; Store status register bits to poll
    124119
    125120    ; Select Master or Slave drive and output head number or LBA28 top bits
    126     call    IDEDEVICE%+Command_SelectDrive
     121    call    IdeCommand_SelectDrive
    127122    jc      SHORT .DriveNotReady
    128123
    129124    ; Output Device Control Byte to enable or disable interrupts
    130125    mov     al, [bp+IDEPACK.bDeviceControl]
    131 %ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS ; JR-IDE/ISA
     126%ifdef MODULE_IRQ
    132127    test    al, FLG_DEVCONTROL_nIEN ; Interrupts disabled?
    133128    jnz     SHORT .DoNotSetInterruptInServiceFlag
     
    151146    eMOVZX  ax, [bp+IDEPACK.bLbaLowExt]     ; Zero sector count
    152147    mov     cx, [bp+IDEPACK.wLbaMiddleAndHighExt]
    153     call    IDEDEVICE%+OutputSectorCountAndAddress
     148    call    OutputSectorCountAndAddress
    154149%endif
    155150
     
    157152    mov     ax, [bp+IDEPACK.wSectorCountAndLbaLow]
    158153    mov     cx, [bp+IDEPACK.wLbaMiddleAndHigh]
    159     call    IDEDEVICE%+OutputSectorCountAndAddress
     154    call    OutputSectorCountAndAddress
    160155
    161156    ; Output command
     
    164159
    165160    ; Wait until command completed
    166     pop     bx                      ; Pop status and timeout for polling
    167     cmp     bl, FLG_STATUS_DRQ      ; Data transfer started?
    168     je      SHORT IDEDEVICE%+Transfer_StartWithCommandInAL
     161    pop     bx                              ; Pop status and timeout for polling
     162    cmp     bl, FLG_STATUS_DRQ              ; Data transfer started?
     163    jne     SHORT .WaitUntilNonTransferCommandCompletes
     164%ifdef MODULE_JRIDE
     165    cmp     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_JRIDE_ISA
     166    je      SHORT JrIdeTransfer_StartWithCommandInAL
     167%endif
     168    jmp     IdeTransfer_StartWithCommandInAL
     169
     170.WaitUntilNonTransferCommandCompletes:
     171%ifdef MODULE_IRQ
    169172    test    BYTE [bp+IDEPACK.bDeviceControl], FLG_DEVCONTROL_nIEN
    170     jz      SHORT .WaitForIrqOrRdy
    171     jmp     IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH
    172 
    173 ALIGN JUMP_ALIGN
    174 .WaitForIrqOrRdy:
    175     jmp     IDEDEVICE%+Wait_IRQorStatusFlagInBLwithTimeoutInBH
     173    jz      SHORT .PollStatusFlagInsteadOfWaitIrq
     174    jmp     IdeWait_IRQorStatusFlagInBLwithTimeoutInBH
     175.PollStatusFlagInsteadOfWaitIrq:
     176%endif
     177    jmp     IdeWait_PollStatusFlagInBLwithTimeoutInBH
    176178
    177179.DriveNotReady:
     
    192194;--------------------------------------------------------------------
    193195ALIGN JUMP_ALIGN
    194 IDEDEVICE%+Command_SelectDrive:
    195     ; Wait until neither Master or Slave Drive is busy.
    196     ; I don't think this wait is necessary.
    197     ;mov        bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY)
    198     ;cmp        BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE
    199     ;eCMOVE bh, TIMEOUT_IDENTIFY_DEVICE
    200     ;call   IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH
    201 
     196IdeCommand_SelectDrive:
    202197    ; Select Master or Slave Drive
    203198    mov     al, [bp+IDEPACK.bDrvAndHead]
     
    206201    cmp     BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE
    207202    eCMOVE  bh, TIMEOUT_IDENTIFY_DEVICE
    208     call    IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH
     203    call    IdeWait_PollStatusFlagInBLwithTimeoutInBH
    209204
    210205    ; Ignore errors from IDE Error Register (set by previous command)
     
    232227;--------------------------------------------------------------------
    233228ALIGN JUMP_ALIGN
    234 IDEDEVICE%+OutputSectorCountAndAddress:
     229OutputSectorCountAndAddress:
    235230    OUTPUT_AL_TO_IDE_REGISTER   SECTOR_COUNT_REGISTER
    236231
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm

    r399 r400  
    6666%ifdef MODULE_ADVANCED_ATA
    6767;--------------------------------------------------------------------
    68 ; .StoreDeviceType
    69 ;   Parameters:
    70 ;       DS:DI:  Ptr to Disk Parameter Table
    71 ;       ES:SI:  Ptr to 512-byte ATA information read from the drive
    72 ;       CS:BP:  Ptr to IDEVARS for the controller
    73 ;   Returns:
    74 ;       Nothing
    75 ;   Corrupts registers:
    76 ;       Nothing
    77 ;--------------------------------------------------------------------
    78 .StoreDeviceType:
    79     call    IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
    80 
    81 ;--------------------------------------------------------------------
    8268; .StorePioModeAndTimings
    8369;   Parameters:
     
    124110    ; it might have been set to 16-bit on IDEVARS
    125111.ChangeTo32bitDevice:
    126     mov     BYTE [di+DPT_ADVANCED_ATA.bDevice], DEVICE_32BIT_ATA
     112    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_32BIT_ATA
    127113
    128114.NoAdvancedControllerDetected:
     115    ; Fall to IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
    129116
    130 %endif ; MODULE_ADVANCED_ATA
    131 
    132 ;--------------------------------------------------------------------
    133 ; IdeDPT_StoreReversedAddressLinesFlagIfNecessary
    134 ;   Parameters:
    135 ;       DS:DI:  Ptr to Disk Parameter Table
    136 ;       CS:BP:  Ptr to IDEVARS for the controller
    137 ;   Returns:
    138 ;       CF:     Always clear
    139 ;   Corrupts registers:
    140 ;       Nothing
    141 ;--------------------------------------------------------------------
    142 IdeDPT_StoreReversedAddressLinesFlagIfNecessary:
    143     cmp     BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_REV2
    144     je      SHORT .SetFlagForSwappedA0andA3
    145     cmp     BYTE [cs:bp+IDEVARS.bDevice], DEVICE_FAST_XTIDE
    146     jne     SHORT .EndDPT
    147 .SetFlagForSwappedA0andA3:
    148     or      BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3
    149 .EndDPT:
    150     clc
    151     ret
     117%endif  ; MODULE_ADVANCED_ATA
    152118
    153119
    154 %ifdef MODULE_ADVANCED_ATA
    155120;--------------------------------------------------------------------
    156121; IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
     
    165130IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI:
    166131    mov     al, [cs:bp+IDEVARS.bDevice]
    167     mov     [di+DPT_ADVANCED_ATA.bDevice], al
     132    mov     [di+DPT_ATA.bDevice], al
     133; End DPT
     134    clc
    168135    ret
    169 
    170 %endif
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeError.asm

    r376 r400  
    3434;--------------------------------------------------------------------
    3535ALIGN JUMP_ALIGN
    36 IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL:
     36IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL:
    3737    mov     ah, al          ; IDE Status Register to AH
    3838    INPUT_TO_AL_FROM_IDE_REGISTER   ERROR_REGISTER_in
    39 
    40 %ifndef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS    ; JR-IDE/ISA
    41     jmp     ContinueFromMemIdeError
    42 %else
    43 ContinueFromMemIdeError:
    4439    xchg    al, ah          ; Status Register now in AL, Error Register now in AH
    45 
    46     ; I don't think anything actually reads these from BDA
    47     ;push   ds
    48     ;LOAD_BDA_SEGMENT_TO    ds, dx
    49     ;mov        [HDBDA.wHDStAndErr], ax
    50     ;pop        ds
    51 
    5240    ; Fall to GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX
    5341
     
    112100    db  RET_HD_BADSECTOR    ; Bit7=BBK, Bad Block Detected
    113101    db  RET_HD_STATUSERR    ; When Error Register is zero
    114 %endif
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm

    r376 r400  
    2323;--------------------------------------------------------------------
    2424; IdeIO_OutputALtoIdeControlBlockRegisterInDL
     25;   Parameters:
     26;       AL:     Byte to output
     27;       DL:     IDE Control Block Register
     28;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     29;   Returns:
     30;       Nothing
     31;   Corrupts registers:
     32;       BX, DX
     33;--------------------------------------------------------------------
     34IdeIO_OutputALtoIdeControlBlockRegisterInDL:
     35%ifdef MODULE_8BIT_IDE
     36    mov     dh, [di+DPT_ATA.bDevice]
     37%ifdef MODULE_JRIDE
     38    test    dh, dh
     39    jnz     SHORT .OutputToIoMappedIde
     40
     41    add     dx, JRIDE_CONTROL_BLOCK_REGISTER_WINDOW_OFFSET
     42    jmp     SHORT OutputToJrIdeRegister
     43.OutputToIoMappedIde:
     44%endif
     45%endif
     46
     47    mov     bl, IDEVARS.wPortCtrl
     48    jmp     SHORT OutputALtoIdeRegisterInDLwithIdevarsOffsetToBasePortInBL
     49
     50
     51;--------------------------------------------------------------------
    2552; IdeIO_OutputALtoIdeRegisterInDL
    2653;   Parameters:
    2754;       AL:     Byte to output
    28 ;       DL:     IDE Control Block Register  (IdeIO_OutputALtoIdeControlBlockRegisterInDL)
    29 ;               IDE Register                (IdeIO_OutputALtoIdeRegisterInDL)
     55;       DL:     IDE Command Block Register
    3056;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    3157;   Returns:
     
    3561;--------------------------------------------------------------------
    3662ALIGN JUMP_ALIGN
    37 IdeIO_OutputALtoIdeControlBlockRegisterInDL:
    38     mov     bl, IDEVARS.wPortCtrl
    39     SKIP2B  f   ; cmp ax, <next instruction>
    40     ; Fall to IdeIO_OutputALtoIdeRegisterInDL
     63IdeIO_OutputALtoIdeRegisterInDL:
     64%ifdef MODULE_8BIT_IDE
     65    mov     dh, [di+DPT_ATA.bDevice]
     66%ifdef MODULE_JRIDE
     67    test    dh, dh
     68    jnz     SHORT OutputALtoIOmappedIdeRegisterInDL
    4169
    42 IdeIO_OutputALtoIdeRegisterInDL:
     70    add     dx, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET
     71OutputToJrIdeRegister:
     72    mov     bx, dx
     73    mov     [cs:bx], al
     74    ret
     75ALIGN JUMP_ALIGN
     76OutputALtoIOmappedIdeRegisterInDL:
     77%endif
     78%endif
     79
    4380    mov     bl, IDEVARS.wPort
    44     call    GetPortToDXandTranslateA0andA3ifNecessary
     81OutputALtoIdeRegisterInDLwithIdevarsOffsetToBasePortInBL:
     82    call    GetIdePortToDX
    4583    out     dx, al
    4684    ret
    4785
     86
     87;--------------------------------------------------------------------
     88; IdeIO_InputStatusRegisterToAL
     89;   Parameters:
     90;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     91;   Returns:
     92;       AL:     IDE Status Register contents
     93;   Corrupts registers:
     94;       BX, DX
     95;--------------------------------------------------------------------
     96ALIGN JUMP_ALIGN
     97IdeIO_InputStatusRegisterToAL:
     98    mov     dl, STATUS_REGISTER_in
     99    ; Fall to IdeIO_InputToALfromIdeRegisterInDL
    48100
    49101;--------------------------------------------------------------------
     
    57109;       BX, DX
    58110;--------------------------------------------------------------------
    59 ALIGN JUMP_ALIGN
    60111IdeIO_InputToALfromIdeRegisterInDL:
     112%ifdef MODULE_8BIT_IDE
     113    mov     dh, [di+DPT_ATA.bDevice]
     114%ifdef MODULE_JRIDE
     115    test    dh, dh
     116    jnz     SHORT .InputToALfromIOmappedIdeRegisterInDL
     117
     118    add     dx, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET
     119    mov     bx, dx
     120    mov     al, [cs:bx]
     121    ret
     122.InputToALfromIOmappedIdeRegisterInDL:
     123%endif
     124%endif
    61125    mov     bl, IDEVARS.wPort
    62     call    GetPortToDXandTranslateA0andA3ifNecessary
     126    call    GetIdePortToDX
    63127    in      al, dx
    64128    ret
     
    66130
    67131;--------------------------------------------------------------------
    68 ; GetPortToDXandTranslateA0andA3ifNecessary
     132; GetIdePortToDX
    69133;   Parameters:
    70134;       BL:     Offset to port in IDEVARS (IDEVARS.wPort or IDEVARS.wPortCtrl)
     135;       DH:     Device Type (IDEVARS.bDevice)
    71136;       DL:     IDE Register
    72137;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     
    77142;--------------------------------------------------------------------
    78143ALIGN JUMP_ALIGN
    79 GetPortToDXandTranslateA0andA3ifNecessary:
     144GetIdePortToDX:
     145%ifdef MODULE_8BIT_IDE
     146    ; Point CS:BX to IDEVARS
    80147    xor     bh, bh
    81     add     bl, [di+DPT.bIdevarsOffset]     ; CS:BX now points port address
    82     xor     dh, dh                          ; DX now has IDE register offset
    83     add     dx, [cs:bx]
    84     test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3
    85     jz      SHORT .ReturnPortInDX
     148    add     bl, [di+DPT.bIdevarsOffset]         ; CS:BX now points port address
     149
     150    ; Load port address and check if A0 and A3 address lines need to be reversed
     151    cmp     dh, DEVICE_8BIT_XTIDE_REV1
     152    mov     dh, bh                              ; DX now has IDE register offset
     153    jae     SHORT .ReturnUntranslatedPortInDX   ; No need to swap address lines
    86154
    87155    ; Exchange address lines A0 and A3 from DL
     156    add     dx, [cs:bx]                         ; DX now has port address
    88157    mov     bl, dl
    89158    mov     bh, MASK_A3_AND_A0_ADDRESS_LINES
    90     and     bh, bl                          ; BH = 0, 1, 8 or 9, we can ignore 0 and 9
    91     jz      SHORT .ReturnPortInDX           ; Jump out since DH is 0
     159    and     bh, bl                              ; BH = 0, 1, 8 or 9, we can ignore 0 and 9
     160    jz      SHORT .ReturnTranslatedPortInDX     ; Jump out since DH is 0
    92161    xor     bh, MASK_A3_AND_A0_ADDRESS_LINES
    93     jz      SHORT .ReturnPortInDX           ; Jump out since DH was 9
     162    jz      SHORT .ReturnTranslatedPortInDX     ; Jump out since DH was 9
    94163    and     dl, ~MASK_A3_AND_A0_ADDRESS_LINES
    95     or      dl, bh                          ; Address lines now reversed
    96 .ReturnPortInDX:
     164    or      dl, bh                              ; Address lines now reversed
     165.ReturnTranslatedPortInDX:
    97166    ret
     167
     168.ReturnUntranslatedPortInDX:
     169    add     dx, [cs:bx]
     170    ret
     171
     172%else   ; Only standard IDE devices
     173    xor     bh, bh
     174    xor     dh, dh
     175    add     bl, [di+DPT.bIdevarsOffset]     ; CS:BX now points port address
     176    add     dx, [cs:bx]                     ; DX now has port address
     177    ret
     178%endif
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r376 r400  
    208208    mov     bl, [di+DPT.bIdevarsOffset]         ; CS:BX now points to IDEVARS
    209209    mov     dx, [cs:bx+IDEVARS.wPort]           ; Load IDE Data port address
    210 %ifdef MODULE_ADVANCED_ATA
    211     mov     bl, [di+DPT_ADVANCED_ATA.bDevice]
    212 %else
    213     mov     bl, [cs:bx+IDEVARS.bDevice]         ; Load device type to BX
    214 %endif
     210    mov     bl, [di+DPT_ATA.bDevice]
    215211    add     bx, ax
    216212
     
    235231;       AX, BX, CX
    236232;--------------------------------------------------------------------
     233%ifdef MODULE_8BIT_IDE
     234
    237235ALIGN JUMP_ALIGN
    238236ReadBlockFromXtideRev1:
     
    267265%endif
    268266
     267%endif  ; MODULE_8BIT_IDE
     268
    269269;--------------------------------------------------------------------
    270270ALIGN JUMP_ALIGN
     
    302302;       AX, CX
    303303;--------------------------------------------------------------------
     304%ifdef MODULE_8BIT_IDE
     305
    304306ALIGN JUMP_ALIGN
    305307WriteBlockToXtideRev1:
     
    361363%endif
    362364
     365%endif  ; MODULE_8BIT_IDE
     366
    363367;--------------------------------------------------------------------
    364368ALIGN JUMP_ALIGN
     
    387391ALIGN WORD_ALIGN
    388392g_rgfnPioRead:
    389     dw      ReadBlockFromXtideRev1      ; DEVICE_XTIDE_REV1
    390 %ifdef USE_186
    391     dw      ReadBlockFrom16bitDataPort  ; DEVICE_XTIDE_REV2
    392     dw      ReadBlockFrom16bitDataPort  ; DEVICE_FAST_XTIDE
     393%ifdef MODULE_8BIT_IDE
     394        dw      ReadBlockFromXtideRev1      ; DEVICE_XTIDE_REV1
     395    %ifdef USE_186
     396        dw      ReadBlockFrom16bitDataPort  ; DEVICE_XTIDE_REV2
     397        dw      ReadBlockFrom16bitDataPort  ; DEVICE_FAST_XTIDE
     398    %else
     399        dw      ReadBlockFromXtideRev2      ; DEVICE_XTIDE_REV2
     400        dw      ReadBlockFromXtideRev2      ; DEVICE_FAST_XTIDE
     401    %endif
     402
    393403%else
    394     dw      ReadBlockFromXtideRev2      ; DEVICE_XTIDE_REV2
    395     dw      ReadBlockFromXtideRev2      ; DEVICE_FAST_XTIDE
    396 %endif
    397     dw      ReadBlockFrom16bitDataPort  ; DEVICE_16BIT_ATA
    398     dw      ReadBlockFrom32bitDataPort  ; DEVICE_32BIT_ATA
     404        times   COUNT_OF_8BIT_IDE_DEVICES   dw  0
     405%endif
     406        dw      ReadBlockFrom16bitDataPort  ; DEVICE_16BIT_ATA
     407        dw      ReadBlockFrom32bitDataPort  ; DEVICE_32BIT_ATA
     408
    399409
    400410g_rgfnPioWrite:
    401     dw      WriteBlockToXtideRev1       ; DEVICE_XTIDE_REV1
    402     dw      WriteBlockToXtideRev2       ; DEVICE_XTIDE_REV2
    403 %ifdef USE_186
    404     dw      WriteBlockTo16bitDataPort   ; DEVICE_FAST_XTIDE
     411%ifdef MODULE_8BIT_IDE
     412        dw      WriteBlockToXtideRev1       ; DEVICE_XTIDE_REV1
     413        dw      WriteBlockToXtideRev2       ; DEVICE_XTIDE_REV2
     414    %ifdef USE_186
     415        dw      WriteBlockTo16bitDataPort   ; DEVICE_FAST_XTIDE
     416    %else
     417        dw      WriteBlockToFastXtide       ; DEVICE_FAST_XTIDE
     418    %endif
     419
    405420%else
    406     dw      WriteBlockToFastXtide       ; DEVICE_FAST_XTIDE
    407 %endif
    408     dw      WriteBlockTo16bitDataPort   ; DEVICE_16BIT_ATA
    409     dw      WriteBlockTo32bitDataPort   ; DEVICE_32BIT_ATA
     421        times   COUNT_OF_8BIT_IDE_DEVICES   dw  0
     422%endif
     423        dw      WriteBlockTo16bitDataPort   ; DEVICE_16BIT_ATA
     424        dw      WriteBlockTo32bitDataPort   ; DEVICE_32BIT_ATA
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm

    r398 r400  
    3232;       AL, BX, CX, DX
    3333;--------------------------------------------------------------------
    34 IDEDEVICE%+Wait_IRQorDRQ:
     34IdeWait_IRQorDRQ:
    3535    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ)
    36 %ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS     ; JR-IDE/ISA does not support IRQ
     36
     37%ifdef MODULE_IRQ
    3738    test    BYTE [bp+IDEPACK.bDeviceControl], FLG_DEVCONTROL_nIEN
    38     jnz     SHORT IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH ; Interrupt disabled
     39    jnz     SHORT IdeWait_PollStatusFlagInBLwithTimeoutInBH ; Interrupt disabled
    3940%endif
    4041    ; Fall to IdeWait_IRQorStatusFlagInBLwithTimeoutInBH
     
    5354;       AL, BX, CX, DX
    5455;--------------------------------------------------------------------
    55 IDEDEVICE%+Wait_IRQorStatusFlagInBLwithTimeoutInBH:
    56 %ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS     ; JR-IDE/ISA does not support IRQ
    57     %ifdef MODULE_IRQ
    58         call    IdeIrq_WaitForIRQ
    59     %endif
     56IdeWait_IRQorStatusFlagInBLwithTimeoutInBH:
     57%ifdef MODULE_IRQ
     58    call    IdeIrq_WaitForIRQ
    6059%endif
    6160    ; Always fall to IdeWait_PollStatusFlagInBLwithTimeoutInBH for error processing
     
    7473;       AL, BX, CX, DX
    7574;--------------------------------------------------------------------
    76 IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH:
     75IdeWait_PollStatusFlagInBLwithTimeoutInBH:
    7776    mov     ah, bl
    7877    mov     cl, bh
    7978    call    Timer_InitializeTimeoutWithTicksInCL
    8079    and     ah, ~FLG_STATUS_BSY
    81     jz      SHORT IDEDEVICE%+PollBsyOnly
     80    jz      SHORT PollBsyOnly
    8281    ; Fall to PollBsyAndFlgInAH
    8382
     
    9493;       AL, BX, CX, DX
    9594;--------------------------------------------------------------------
    96 IDEDEVICE%+PollBsyAndFlgInAH:
    97     INPUT_TO_AL_FROM_IDE_REGISTER   STATUS_REGISTER_in  ; Discard contents for first read
    98 ALIGN JUMP_ALIGN
     95IdePollBsyAndFlgInAH:
     96    call    IdeIO_InputStatusRegisterToAL       ; Discard contents of first read
     97
    9998.PollLoop:
    100     INPUT_TO_AL_FROM_IDE_REGISTER   STATUS_REGISTER_in
     99    call    IdeIO_InputStatusRegisterToAL
    101100    test    al, FLG_STATUS_BSY                  ; Controller busy?
    102101    jnz     SHORT .UpdateTimeout                ;  If so, jump to timeout update
    103102    test    al, ah                              ; Test secondary flag
    104     jnz     SHORT IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
     103    jnz     SHORT IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
    105104.UpdateTimeout:
    106105    call    Timer_SetCFifTimeout
    107106    jnc     SHORT .PollLoop                     ; Loop if time left
    108     call    IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
     107    call    IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
    109108    jc      SHORT .ReturnErrorCodeInAH
    110109    mov     ah, RET_HD_TIMEOUT                  ; Expected bit never got set
     
    125124;       AL, BX, CX, DX
    126125;--------------------------------------------------------------------
    127 IDEDEVICE%+PollBsyOnly:
    128     INPUT_TO_AL_FROM_IDE_REGISTER   STATUS_REGISTER_in  ; Discard contents for first read
    129 ALIGN JUMP_ALIGN
     126PollBsyOnly:
     127    call    IdeIO_InputStatusRegisterToAL       ; Discard contents of first read
     128
    130129.PollLoop:
    131     INPUT_TO_AL_FROM_IDE_REGISTER   STATUS_REGISTER_in
     130    call    IdeIO_InputStatusRegisterToAL
    132131    test    al, FLG_STATUS_BSY                  ; Controller busy?
    133     jz      SHORT IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
     132    jz      SHORT IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
    134133    call    Timer_SetCFifTimeout                ; Update timeout counter
    135134    jnc     SHORT .PollLoop                     ; Loop if time left (sets CF on timeout)
    136     jmp     SHORT IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
     135    jmp     SHORT IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r399 r400  
    5959    xor     ax, ax
    6060
     61%ifdef MODULE_ADVANCED_ATA
    6162    ; Clear Initialization Error flags from DPT
    62     mov     [di+DPT_ATA.bInitError], al
     63    mov     [di+DPT_ADVANCED_ATA.bInitError], al
     64%endif
    6365
    6466%ifdef MODULE_SERIAL
     
    7981    call    Device_SelectDrive
    8082
     83%ifdef MODULE_ADVANCED_ATA
    8184    mov     al, FLG_INITERROR_FAILED_TO_SELECT_DRIVE
    8285    call    .SetErrorFlagFromALwithErrorCodeInAH
     86%endif
    8387    jc      .ReturnWithErrorCodeInAH
    8488
     
    96100    call    Idepack_StoreNonExtParametersAndIssueCommandFromAL
    97101
     102%ifdef MODULE_ADVANCED_ATA
    98103    mov     al, FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS
    99104    call    .SetErrorFlagFromALwithErrorCodeInAH
     105%endif
    100106.SkipInitializeDeviceParameters:
    101107
     
    110116    call    AH23h_SetControllerFeatures
    111117
     118%ifdef MODULE_ADVANCED_ATA
    112119    mov     al, FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE
    113120    call    .SetErrorFlagFromALwithErrorCodeInAH
     121%endif
    114122.SkipSetWriteCache:
    115123
     
    118126    call    AH11h_RecalibrateDrive
    119127
     128%ifdef MODULE_ADVANCED_ATA
    120129    mov     al, FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE
    121130    call    .SetErrorFlagFromALwithErrorCodeInAH
     131%endif
    122132
    123133;;; InitializeBlockMode
     
    138148    jnc     SHORT .TryNextBlockSize
    139149
     150%ifdef MODULE_ADVANCED_ATA
    140151    mov     al, FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE
    141152    call    .SetErrorFlagFromALwithErrorCodeInAH
     153%endif
    142154.BlockModeNotSupportedOrDisabled:
    143155.SupportedBlockSizeFound:
     
    173185    call    Idepack_StoreNonExtParametersAndIssueCommandFromAL
    174186
     187%ifdef MODULE_ADVANCED_ATA
    175188    mov     al, FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER
    176189    call    .SetErrorFlagFromALwithErrorCodeInAH
     190%endif
    177191.NoPowerManagementSupport:
    178192%endif ; MODULE_FEATURE_SETS
    179193
    180194    ; There might have been several errors so just return one error code for them all
    181     mov     ah, [di+DPT_ATA.bInitError]
     195%ifdef MODULE_ADVANCED_ATA
     196    mov     ah, [di+DPT_ADVANCED_ATA.bInitError]
    182197    test    ah, ah  ; Clears CF
    183198    jz      SHORT .ReturnWithErrorCodeInAH
    184199    mov     ah, RET_HD_RESETFAIL
    185200    stc
     201%endif
    186202
    187203.ReturnWithErrorCodeInAH:
     
    191207
    192208
     209%ifdef MODULE_ADVANCED_ATA
    193210;--------------------------------------------------------------------
    194211; .SetErrorFlagFromALwithErrorCodeInAH
     
    211228    jbe     SHORT .IgnoreInvalidCommandError
    212229
    213     or      [di+DPT_ATA.bInitError], al
     230    or      [di+DPT_ADVANCED_ATA.bInitError], al
    214231    stc
    215232.NoErrorFlagToSet:
    216233    ret
     234
     235%endif
    217236
    218237
     
    221240    db      FEATURE_DISABLE_WRITE_CACHE     ; DISABLE_WRITE_CACHE
    222241    db      FEATURE_ENABLE_WRITE_CACHE      ; ENABLE_WRITE_CACHE
    223 
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm

    r397 r400  
    8686                                            ;             DL=COM number character, DH=.bDevice
    8787%ifdef MODULE_JRIDE
    88     cmp     dh, DEVICE_JRIDE_ISA
     88    cmp     dh, DEVICE_8BIT_JRIDE_ISA
    8989    eCMOVE  ax, cs                          ; Use segment address for JR-IDE/ISA
    9090%endif
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r399 r400  
    5555    %include "RamVars.inc"          ; For RAMVARS struct
    5656    %include "BootVars.inc"         ; For BOOTVARS struct
    57     %include "IDE_8bit.inc"         ; For IDE 8-bit data port macros
     57    %include "IdeIO.inc"            ; Macros for IDE port I/O
    5858    %include "DeviceIDE.inc"        ; For IDE device equates
    5959
     
    136136    at  ROMVARS.ideVars0+IDEVARS.wPort,         dw  DEVICE_XTIDE_DEFAULT_PORT           ; Controller Command Block base port
    137137    at  ROMVARS.ideVars0+IDEVARS.wPortCtrl,     dw  DEVICE_XTIDE_DEFAULT_PORTCTRL       ; Controller Control Block base port
    138     at  ROMVARS.ideVars0+IDEVARS.bDevice,       db  DEVICE_XTIDE_REV1
     138    at  ROMVARS.ideVars0+IDEVARS.bDevice,       db  DEVICE_8BIT_XTIDE_REV1
    139139    at  ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags,  db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE
    140140    at  ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE
     
    222222    %include "Vision.asm"           ; QDI Vision QD6500 and QD6580 support
    223223%endif
    224 %define IDEDEVICE Ide
    225 %define ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS
    226     %include "IOMappedIDE.inc"      ; Assembly IDE support for normal I/O mapped controllers
    227224    %include "IdeCommand.asm"
    228     %include "IdeTransfer.asm"      ; Must be included after IdeCommand.asm
     225%ifdef MODULE_JRIDE
     226    %include "JrIdeTransfer.asm"    ; Must be included after IdeCommand.asm
     227%endif
     228    %include "IdeTransfer.asm"
    229229    %include "IdeWait.asm"
    230230    %include "IdeError.asm"         ; Must be included after IdeWait.asm
     
    234234    %include "IdeIrq.asm"
    235235%endif
    236 %undef IDEDEVICE
    237 %undef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS
    238 
    239     ; JR-IDE support
    240 %ifdef MODULE_JRIDE
    241 %define IDEDEVICE MemIde
    242     %include "MemMappedIDE.inc"     ; Assembly IDE support for memory mapped controllers
    243     %include "IdeCommand.asm"
    244     %include "MemIdeTransfer.asm"   ; Must be included after IdeCommand.asm
    245     %include "IdeWait.asm"
    246     %include "IdeError.asm"         ; Must be included after IdeWait.asm
    247 %undef IDEDEVICE
    248 %endif
    249 
    250 
     236
     237    ; Serial Device support
    251238%ifdef MODULE_SERIAL                ; Serial Port Device support
    252239    %include "SerialCommand.asm"
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrintCfg.asm

    r399 r400  
    131131;--------------------------------------------------------------------
    132132.PushResetStatus:
    133     mov     al, [di+DPT_ATA.bInitError]
     133%ifdef MODULE_ADVANCED_ATA
     134    mov     al, [di+DPT_ADVANCED_ATA.bInitError]
    134135    push    ax
     136%else
     137    ePUSH_T ax, 0
     138%endif
    135139
    136140;;; fall-out to BootMenuPrint_HardDiskRefreshInformation.
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm

    r395 r400  
    4747;--------------------------------------------------------------------
    4848.StealMemoryForRAMVARS:
    49     ; Always steal memory when using Advanced ATA module since it
    50     ; uses larger DPTs
    51 %ifndef MODULE_ADVANCED_ATA
     49%ifndef USE_AT
    5250    mov     ax, LITE_MODE_RAMVARS_SEGMENT
    5351    test    BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
     
    114112RamVars_GetSegmentToDS:
    115113
    116 %ifndef MODULE_ADVANCED_ATA ; Always in Full Mode when using Advanced ATA Module
     114%ifndef USE_AT  ; Always in Full Mode for AT builds
    117115    test    BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
    118116    jnz     SHORT .GetStolenSegmentToDS
    119 %ifndef USE_186
    120     mov     di, LITE_MODE_RAMVARS_SEGMENT
    121     mov     ds, di
    122 %else
    123     push    LITE_MODE_RAMVARS_SEGMENT
    124     pop     ds
    125 %endif
    126     ret
    127 %endif ; MODULE_ADVANCED_ATA
     117    %ifndef USE_186
     118        mov     di, LITE_MODE_RAMVARS_SEGMENT
     119        mov     ds, di
     120    %else
     121        push    LITE_MODE_RAMVARS_SEGMENT
     122        pop     ds
     123    %endif
     124    ret
     125%endif
    128126
    129127ALIGN JUMP_ALIGN
  • trunk/XTIDE_Universal_BIOS/makefile

    r399 r400  
    1515#                                                                                                #
    1616# Following modules can be included or excluded:                                                 #
     17# MODULE_8BIT_IDE           Support for 8-BIT IDE cards like XTIDE                               #
     18# MODULE_JRIDE              Support for JR-IDE/ISA                                               #
    1719# MODULE_ADVANCED_ATA       Native support for some VLB IDE controllers                          #
    1820# MODULE_BOOT_MENU          Boot Menu for selection of drive to boot from                        #
     
    2022# MODULE_HOTKEYS            Hotkey Bar to boot from any drive                                    #
    2123# MODULE_IRQ                IDE IRQ support                                                      #
    22 # MODULE_JRIDE              Support for JR-IDE/ISA                                               #
    2324# MODULE_SERIAL             Virtual hard disks using serial port                                 #
    2425# MODULE_SERIAL_FLOPPY      Virtual floppy drives using serial port (requires MODULE_SERIAL)     #
     
    9394#################################################################
    9495DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_EBIOS MODULE_FEATURE_SETS
    95 DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_JRIDE MODULE_SERIAL MODULE_SERIAL_FLOPPY
    96 
    97 DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_JRIDE MODULE_SERIAL MODULE_SERIAL_FLOPPY
     96DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_SERIAL MODULE_SERIAL_FLOPPY
     97
     98DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE MODULE_JRIDE MODULE_SERIAL MODULE_SERIAL_FLOPPY
    9899DEFINES_XTPLUS = $(DEFINES_COMMON) $(DEFINES_XT) USE_186
    99100DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_ADVANCED_ATA
     
    103104DEFINES_AT_LARGE = $(DEFINES_AT) $(DEFINES_COMMON_LARGE)
    104105
    105 DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED
     106DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE
    106107DEFINES_386_8K = $(DEFINES_AT) USE_386
    107108
Note: See TracChangeset for help on using the changeset viewer.