Changeset 363 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS


Ignore:
Timestamp:
Mar 26, 2012, 4:20:43 PM (13 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Added Advanced ATA Module (MODULE_ADVANCED_ATA) with native support for QDI Vision QD6500 and QD6580 VLB IDE Controllers.
  • Hopefully optimized IDE transfer functions for 8088 (replaced some memory accesses from WORD to BYTE).
  • XT build does not fit in 8k at the moment!!!
Location:
trunk/XTIDE_Universal_BIOS
Files:
4 added
19 edited

Legend:

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

    r324 r363  
    33%ifndef ATA_ID_INC
    44%define ATA_ID_INC
     5
     6; PIO Minimum Cycle Times (t0)
     7; Timings for Advanced modes 3 and 4 can be read from ATA info WORDs 67 and 68
     8PIO_0_MIN_CYCLE_TIME_NS     EQU     600
     9PIO_1_MIN_CYCLE_TIME_NS     EQU     383
     10PIO_2_MIN_CYCLE_TIME_NS     EQU     240
     11PIO_3_MIN_CYCLE_TIME_NS     EQU     180
     12PIO_4_MIN_CYCLE_TIME_NS     EQU     120
     13
     14; PIO Minimum Address Valid Times (t1)
     15PIO_0_MIN_ADDRESS_VALID_NS  EQU     70
     16PIO_1_MIN_ADDRESS_VALID_NS  EQU     50
     17PIO_2_MIN_ADDRESS_VALID_NS  EQU     30
     18PIO_3_MIN_ADDRESS_VALID_NS  EQU     30
     19PIO_4_MIN_ADDRESS_VALID_NS  EQU     25
     20
     21; PIO Minimum Active Times (t2)
     22PIO_0_MIN_ACTIVE_TIME_NS    EQU     165
     23PIO_1_MIN_ACTIVE_TIME_NS    EQU     125
     24PIO_2_MIN_ACTIVE_TIME_NS    EQU     100
     25PIO_3_MIN_ACTIVE_TIME_NS    EQU     80
     26PIO_4_MIN_ACTIVE_TIME_NS    EQU     70
     27
     28; PIO Minimum Recovery Times or Inactive Times (t2i) can be calculated
     29; from Minimum Cycle Time (t0) - Minimum Active Time (t2) - Address Valid Time (t1).
     30; I'm not sure about this calculation so correct me if I'm wrong!
     31; Recovery time should be calculated at run time since Cycle Time t0 can be
     32; read from ATA information (ATA2+) but most drives just report the
     33; Min Cycle Times listed above.
     34
     35
    536
    637; ATA-1 Drive Information struct
     
    3263                resw 1  ; 50R
    3364                resb 1  ; 51[0-7]X
    34     .bPIOTiming resb 1  ; 51[8-15]F, PIO data transfer cycle timing mode
     65    .bPioMode   resb 1  ; 51[8-15]F, PIO data transfer cycle timing mode (0, 1 or 2)
    3566                resb 1  ; 52[0-7]X
    3667    .bDMATiming resb 1  ; 52[8-15]F, DMA data transfer cycle timing mode
     
    163194A2_bBlockFlgs_VALID     EQU (1<<0)  ; Multiple sector setting (bBlockSel) is valid
    164195
     196; ATA-2 Word 64, Advanced PIO transfer modes supported
     197A2_bPIOSupp_PIO3        EQU (1<<0)
     198A2_bPIOSupp_PIO4        EQU (1<<1)
     199
    165200
    166201;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  • trunk/XTIDE_Universal_BIOS/Inc/BootMenu.inc

    r294 r363  
    2424
    2525struc BOOTMENUINFO
    26     .szDrvName      resb    MAX_HARD_DISK_NAME_LENGTH
    27                     resb    2       ; Zero word (ensures string terminates)
    28                     resb    4       ; padding to make BOOTMENUINFO size an even multiple of DPT size
     26    .szDrvName              resb    MAX_HARD_DISK_NAME_LENGTH
     27                            resb    2   ; Zero word (ensures string terminates)
     28    .wInitErrorFlags        resb    2   ; Errors during initialization
     29
     30%ifdef MODULE_ADVANCED_ATA
     31    .wIdeBasePort           resb    2   ; IDE Base Port
     32    .wMinPioActiveTimeNs    resb    2   ; Minimum PIO Active Time in ns
     33    .wMinPioRecoveryTimeNs  resb    2   ; Minimum PIO Recovery Time in ns
     34    .wControllerID          resb    2   ; Controller specific ID WORD
     35    .wControllerBasePort    resb    2   ; Advanced Controller port (not IDE port)
     36                            resb    12  ; padding to make BOOTMENUINFO size an even multiple of DPT size
     37
     38%else
     39                            resb    2   ; padding to make BOOTMENUINFO size an even multiple of DPT size
     40%endif
    2941endstruc
     42
     43; Flags for BOOTMENUINFO.wInitErrorFlags
     44FLG_INIT_FAILED_TO_SELECT_DRIVE                 EQU     (1<<0)
     45FLG_INIT_FAILED_TO_INITIALIZE_CHS_PARAMETERS    EQU     (1<<1)
     46FLG_INIT_FAILED_TO_SET_WRITE_CACHE              EQU     (1<<2)
     47FLG_INIT_FAILED_TO_RECALIBRATE_DRIVE            EQU     (1<<3)
     48FLG_INIT_FAILED_TO_SET_BLOCK_MODE               EQU     (1<<4)
     49FLG_INIT_FAILED_TO_SET_PIO_MODE                 EQU     (1<<5)
    3050
    3151DPT_BOOTMENUINFO_SIZE_MULTIPLIER  equ   BOOTMENUINFO_size / LARGEST_DPT_SIZE
  • trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc

    r294 r363  
    1919    .rgbMnuStack:
    2020    .dwPostStack    resb    4       ; POST stack pointer when entering INT 19h
     21    .wMagicWord     resb    2       ; I wish we didn't need this
    2122    .rgBootNfo:                     ; Array containing BOOTNFO structs
    2223endstruc
     24
     25; Magic WORD to detect when BOOTVARS is available.
     26BOOTVARS_MAGIC_WORD         EQU     1110011001100111b
     27
    2328
    2429
  • trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc

    r358 r363  
    2525endstruc
    2626
    27 ; DPT for ATA devices
    28 struc DPT_ATA   ; 10 + 2 bytes = 12 bytes
    29     .dpt                        resb    DPT_size
    30 
    31     ; Block size is specified in sectors (1, 2, 4, 8, 16, 32, 64 or 128)
    32     .wSetAndMaxBlock:
    33     .bSetBlock                  resb    1   ; Current block size (at least 1)
    34     .bMaxBlock                  resb    1   ; Maximum block size, 0 = block mode not supported
    35 endstruc
    36 
    37 %ifdef MODULE_SERIAL
    38 ; DPT for Serial devices
    39 struc DPT_SERIAL
    40     .dpt                        resb    DPT_size
    41 
    42     .wSerialPortAndBaud:
    43     .bSerialPort                resb    1   ; Serial connection I/O port address, divided by 4
    44     .bSerialBaud                resb    1   ; Serial connection baud rate divisor
    45 endstruc
    46 %endif
    47 
    48 LARGEST_DPT_SIZE                EQU     DPT_ATA_size
    49 
    50 
    5127; Bit definitions for DPT.bFlagsLow
    5228MASKL_DPT_CHS_SHIFT_COUNT       EQU (7<<0)  ; Bits 0...3, P-CHS to L-CHS bit shift count (0...4)
     
    6238%endif
    6339FLGH_DPT_INTERRUPT_IN_SERVICE   EQU (1<<3)  ; Set when waiting for IRQ
    64 FLGH_DPT_RESET_nDRDY            EQU (1<<4)  ; Drive ready to accept commands
    65 FLGH_DPT_RESET_nINITPRMS        EQU (1<<5)  ; Initialize Device Parameters successful
    66 FLGH_DPT_RESET_nRECALIBRATE     EQU (1<<6)  ; Recalibrate successful
    67 FLGH_DPT_RESET_nSETBLOCK        EQU (1<<7)  ; Initialize Block Mode successful
    68 MASKH_DPT_RESET                 EQU 0F0h
    6940
     41; IDE device only
     42FLGH_DPT_INITERROR              EQU (1<<7)
     43
     44; Serial device only
    7045FLGH_DPT_SERIAL_FLOPPY                      EQU (1<<4)
    7146FLGH_DPT_SERIAL_FLOPPY_TYPE_MASK            EQU 0e0h
     
    7853ADDRESSING_MODE_LBA28           EQU     2   ; 28-bit LBA Addressing Mode
    7954ADDRESSING_MODE_LBA48           EQU     3   ; 48-bit LBA Addressing Mode
     55
     56
     57; DPT for ATA devices
     58struc DPT_ATA   ; 10 + 2 bytes = 12 bytes
     59    .dpt                        resb    DPT_size
     60
     61    ; Block size is specified in sectors (1, 2, 4, 8, 16, 32, 64 or 128)
     62    .wSetAndMaxBlock:
     63    .bSetBlock                  resb    1   ; Current block size (do not set to zero!)
     64    .bMaxBlock                  resb    1   ; Maximum block size, 0 = block mode not supported
     65
     66%ifdef MODULE_ADVANCED_ATA  ; +2 extra bytes = 14 bytes
     67    .bPioMode                   resb    1
     68    .bDevice                    resb    1
     69%endif
     70endstruc
     71
     72
     73%ifdef MODULE_ADVANCED_ATA
     74; Temporary extension for DPT_ATA. Contents will be copied to BOOTMENUINFO and
     75; then these variables will be overridden by next DPT.
     76struc DPT_ADVANCED_ATA
     77    .dpt_ata                resb    DPT_ATA_size
     78    .wIdeBasePort           resb    2   ; IDE Base Port
     79    .wMinPioActiveTimeNs    resb    2   ; Minimum PIO Active Time in ns
     80    .wMinPioRecoveryTimeNs  resb    2   ; Minimum PIO Recovery Time in ns
     81    .wControllerID          resb    2   ; Controller specific ID WORD
     82    .wControllerBasePort    resb    2   ; Advanced Controller port (not IDE port)
     83endstruc
     84%endif
     85
     86
     87%ifdef MODULE_SERIAL
     88; DPT for Serial devices
     89struc DPT_SERIAL
     90    .dpt                        resb    DPT_size
     91
     92    .wSerialPortAndBaud:
     93    .bSerialPort                resb    1   ; Serial connection I/O port address, divided by 4
     94    .bSerialBaud                resb    1   ; Serial connection baud rate divisor
     95endstruc
     96%endif
     97
     98
     99; This is the common size for all DPTs. All DPTs must be equal size.
     100LARGEST_DPT_SIZE                EQU     DPT_ATA_size
     101
    80102
    81103; Number of Sectors per Track is fixed to 63 for LBA assist calculation.
  • trunk/XTIDE_Universal_BIOS/Inc/IDE_8bit.inc

    r152 r363  
    44%ifndef IDE_8BIT_INC
    55%define IDE_8BIT_INC
     6
     7;--------------------------------------------------------------------
     8; UNROLL_SECTORS_IN_CX_TO_QWORDS
     9;   Parameters:
     10;       CX:     Number of sectors in block
     11;   Returns:
     12;       CX:     Number of QWORDs in block
     13;   Corrupts registers:
     14;       Nothing
     15;--------------------------------------------------------------------
     16%macro UNROLL_SECTORS_IN_CX_TO_QWORDS 0
     17%ifdef USE_186
     18    shl     cx, 6
     19%else
     20    xchg    cl, ch      ; Sectors to WORDs (SHL CX, 8)
     21    shr     cx, 1
     22    shr     cx, 1
     23%endif
     24%endmacro
     25
    626
    727;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Inc/IdeRegisters.inc

    r276 r363  
    8484FEATURE_ENABLE_WRITE_CACHE              EQU     02h
    8585FEATURE_DISABLE_WRITE_CACHE             EQU     82h     ; Can also be used to flush cache
     86FEATURE_SET_TRANSFER_MODE               EQU     03h     ; Transfe mode goes to the Sector Count Register
     87    PIO_DEFAULT_MODE                    EQU     0h
     88    PIO_DEFAULT_MODE_DISABLE_IORDY      EQU     1h
     89    PIO_FLOW_CONTROL_MODE_xxx           EQU     (1<<3)  ; Bits 2...0 hold the PIO mode
    8690
    8791
  • trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r361 r363  
    5252                                                ; by holding down the ALT key at the end of drive detection.
    5353                                                ; (Conveniently, this is 8, a fact we exploit when testing the bit)
     54FLG_ROMVARS_MODULE_ADVATA           EQU (1<<4)  ; Here in case the configuration needs to know functionality is present
    5455FLG_ROMVARS_MODULE_JRIDE            EQU (1<<5)  ; Here in case the configuration needs to know functionality is present
    5556FLG_ROMVARS_MODULE_SERIAL           EQU (1<<6)  ; Here in case the configuration needs to know functionality is present
     
    9798DEVICE_ATA_DEFAULT_PORT                 EQU     1F0h
    9899DEVICE_ATA_DEFAULT_PORTCTRL             EQU     3F0h
     100DEVICE_ATA_DEFAULT_SECONDARY_PORT       EQU     170h
     101DEVICE_ATA_DEFAULT_SECONDARY_PORTCTRL   EQU     370h
    99102
    100103; Device types for IDEVARS.bDevice
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuInfo.asm

    r269 r363  
    1717;       ES:BX:  Ptr to BOOTMENUINFO (if successful)
    1818;   Corrupts registers:
    19 ;       AX, BX, CX, DX, DI
     19;       AX, CX, DX, DI
    2020;--------------------------------------------------------------------
    2121BootMenuInfo_CreateForHardDisk:
    2222    call    BootMenuInfo_ConvertDPTtoBX         ; ES:BX now points to new BOOTMENUINFO
     23    push    ds                                  ; Preserve RAMVARS...
     24    push    si                                  ; ...and SI
     25
     26    push    es                                  ; ES to be copied to DS
     27
     28%ifdef MODULE_ADVANCED_ATA
     29    ; Copy DPT_ADVANCED_ATA to BOOTMENUINFO to keep DPTs small.
     30    ; DPT_ADVANCED_ATA has variables that are only needed during initialization.
     31    mov     ax, [di+DPT_ADVANCED_ATA.wIdeBasePort]
     32    mov     [es:bx+BOOTMENUINFO.wIdeBasePort], ax
     33    mov     dx, [di+DPT_ADVANCED_ATA.wMinPioActiveTimeNs]
     34    mov     [es:bx+BOOTMENUINFO.wMinPioActiveTimeNs], dx
     35
     36    mov     ax, [di+DPT_ADVANCED_ATA.wMinPioRecoveryTimeNs]
     37    mov     cx, [di+DPT_ADVANCED_ATA.wControllerID]
     38    mov     dx, [di+DPT_ADVANCED_ATA.wControllerBasePort]
     39    pop     ds                                  ; ES copied to DS
     40    mov     [bx+BOOTMENUINFO.wMinPioRecoveryTimeNs], ax
     41    mov     [bx+BOOTMENUINFO.wControllerID], cx
     42    mov     [bx+BOOTMENUINFO.wControllerBasePort], dx
     43
     44%else
     45    pop     ds                                  ; ES copied to DS
     46%endif
    2347
    2448    ; Store Drive Name
    25     push    ds                                  ; Preserve RAMVARS
    26     push    si
    27 
    28     push    es                                  ; ES copied to DS
    29     pop     ds
    30 
    3149    add     si, BYTE ATA1.strModel              ; DS:SI now points drive name
    3250    lea     di, [bx+BOOTMENUINFO.szDrvName]     ; ES:DI now points to name destination
     
    4260    pop     si
    4361    pop     ds
    44        
    4562    ret
    4663
     
    5572;       CX
    5673;--------------------------------------------------------------------
    57 ALIGN JUMP_ALIGN
    5874BootMenuInfo_GetTotalSectorCount:
    5975    test    BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA
     
    6278.ReturnFullCapacity:
    6379    jmp     AccessDPT_GetLbaSectorCountToBXDXAX
     80
     81
     82;--------------------------------------------------------------------
     83; BootMenuInfo_IsAvailable
     84;   Parameters:
     85;       Nothing
     86;   Returns:
     87;       ES:     Segment to BOOTVARS with BOOTMENUINFOs
     88;       ZF:     Set if BOOTVARS with BOOTMENUINFOs is available
     89;               Cleared if not available (no longer initializing)
     90;   Corrupts registers:
     91;       BX
     92;--------------------------------------------------------------------
     93BootMenuInfo_IsAvailable:
     94    LOAD_BDA_SEGMENT_TO es, bx
     95    cmp     WORD [es:BOOTVARS.wMagicWord], BOOTVARS_MAGIC_WORD
     96    ret
    6497
    6598
     
    73106;       BX:     Offset to BOOTMENUINFO struct
    74107;   Corrupts registers:
    75 ;       AX
     108;       Nothing
    76109;--------------------------------------------------------------------
    77 ALIGN JUMP_ALIGN
    78110BootMenuInfo_ConvertDPTtoBX:
     111    push    ax
    79112    mov     ax, di
    80     sub     ax, RAMVARS_size                        ; subtract off base of DPTs
     113    sub     ax, BYTE RAMVARS_size                   ; subtract off base of DPTs
    81114    mov     bl, DPT_BOOTMENUINFO_SIZE_MULTIPLIER    ; BOOTMENUINFO's are a whole number multiple of DPT size
    82115    mul     bl                             
    83116    add     ax, BOOTVARS.rgBootNfo                  ; add base of BOOTMENUINFO
    84117    xchg    ax, bx
     118    pop     ax
    85119    ret         
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm

    r294 r363  
    111111;       Nothing (falls to next push below)
    112112;   Corrupts registers:
    113 ;       AX
     113;       AX, BX, DX, ES
    114114;--------------------------------------------------------------------
    115115.PushResetStatus:
    116     mov     al, [di+DPT.bFlagsHigh]
    117     and     al, MASKH_DPT_RESET         ;  ah already zero from last push
    118     push    ax
     116    call    BootMenuInfo_IsAvailable    ; Load segment to ES
     117    call    BootMenuInfo_ConvertDPTtoBX
     118    push    WORD [es:bx+BOOTMENUINFO.wInitErrorFlags]
    119119
    120120;;; fall-out to BootMenuPrint_HardDiskRefreshInformation.
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm

    r294 r363  
    5656    mov     [di+DPT.bIdevarsOffset], bp
    5757    mov     BYTE [di+DPT_ATA.bSetBlock], 1  ; Block = 1 sector
     58%ifdef MODULE_ADVANCED_ATA
     59    call    IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
     60%endif
    5861%ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS
    5962    call    IdeDPT_StoreReversedAddressLinesFlagIfNecessary
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm

    r361 r363  
    1414;       CF:     Clear, IDE interface only supports hard disks
    1515;   Corrupts registers:
    16 ;       AX
     16;       AX, BX, CX, DX
    1717;--------------------------------------------------------------------
    1818IdeDPT_Finalize:
    19     ; Fall to .StoreBlockMode
    2019
    2120;--------------------------------------------------------------------
     
    3433    mov     ah, [es:si+ATA1.bBlckSize]      ; Max block size in sectors
    3534    mov     [di+DPT_ATA.wSetAndMaxBlock], ax
    36     ; Fall to IdeDPT_StoreReversedAddressLinesFlagIfNecessary
     35
     36%ifdef MODULE_ADVANCED_ATA
     37;--------------------------------------------------------------------
     38; .StoreDeviceType
     39;   Parameters:
     40;       DS:DI:  Ptr to Disk Parameter Table
     41;       ES:SI:  Ptr to 512-byte ATA information read from the drive
     42;       CS:BP:  Ptr to IDEVARS for the controller
     43;   Returns:
     44;       Nothing
     45;   Corrupts registers:
     46;       Nothing
     47;--------------------------------------------------------------------
     48.StoreDeviceType:
     49    call    IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
     50
     51;--------------------------------------------------------------------
     52; .StorePioModeAndTimings
     53;   Parameters:
     54;       DS:DI:  Ptr to Disk Parameter Table
     55;       ES:SI:  Ptr to 512-byte ATA information read from the drive
     56;       CS:BP:  Ptr to IDEVARS for the controller
     57;   Returns:
     58;       Nothing
     59;   Corrupts registers:
     60;       AX, CX, DX
     61;--------------------------------------------------------------------
     62.StorePioMode:
     63    call    AtaID_GetMaxPioModeToAXandMinCycleTimeToDX
     64    call    AtaID_ConvertPioModeFromAXandMinCycleTimeFromDXtoActiveAndRecoveryTime
     65    mov     [di+DPT_ATA.bPioMode], al
     66    mov     [di+DPT_ADVANCED_ATA.wMinPioActiveTimeNs], cx
     67    mov     [di+DPT_ADVANCED_ATA.wMinPioRecoveryTimeNs], dx
     68
     69;--------------------------------------------------------------------
     70; .DetectAdvancedIdeController
     71;   Parameters:
     72;       DS:DI:  Ptr to Disk Parameter Table
     73;       ES:SI:  Ptr to 512-byte ATA information read from the drive
     74;       CS:BP:  Ptr to IDEVARS for the controller
     75;   Returns:
     76;       Nothing
     77;   Corrupts registers:
     78;       AX, BX, CX, DX
     79;--------------------------------------------------------------------
     80.DetectAdvancedIdeController:
     81    mov     dx, [cs:bp+IDEVARS.wPort]
     82    mov     [di+DPT_ADVANCED_ATA.wIdeBasePort], dx
     83    call    AdvAtaInit_DetectControllerForIdeBaseInDX
     84    mov     [di+DPT_ADVANCED_ATA.wControllerID], ax ; Store zero if none detected
     85    mov     [di+DPT_ADVANCED_ATA.wControllerBasePort], cx
     86    jnc     SHORT .NoAdvancedControllerDetected
     87
     88    ; Use highest common PIO mode from controller and drive.
     89    ; Many VLB controllers support PIO modes up to 2.
     90    call    AdvAtaInit_GetControllerMaxPioModeToAL
     91    jnc     SHORT .ChangeTo32bitDevice
     92    MIN_U   [di+DPT_ATA.bPioMode], al
     93
     94    ; We have detected 32-bit controller so change Device Type since
     95    ; it might have been set to 16-bit on IDEVARS
     96.ChangeTo32bitDevice:
     97    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_32BIT_ATA
     98
     99.NoAdvancedControllerDetected:
     100
     101%endif ; MODULE_ADVANCED_ATA
    37102
    38103;--------------------------------------------------------------------
     
    42107;       CS:BP:  Ptr to IDEVARS for the controller
    43108;   Returns:
    44 ;       CF:     Always clear, we don't support floppies on the IDE inteface
     109;       CF:     Always clear
    45110;   Corrupts registers:
    46111;       Nothing
     
    53118.SetFlagForSwappedA0andA3:
    54119    or      BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3
    55 
    56120.EndDPT:
    57121    clc
    58122    ret
     123
     124
     125%ifdef MODULE_ADVANCED_ATA
     126;--------------------------------------------------------------------
     127; IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI
     128;   Parameters:
     129;       DS:DI:  Ptr to Disk Parameter Table
     130;       CS:BP:  Ptr to IDEVARS for the controller
     131;   Returns:
     132;       Nothing
     133;   Corrupts registers:
     134;       AL
     135;--------------------------------------------------------------------
     136IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI:
     137    mov     al, [cs:bp+IDEVARS.bDevice]
     138    mov     [di+DPT_ATA.bDevice], al
     139    ret
     140%endif
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r361 r363  
    55; This struct must not be larger than IDEPACK without INTPACK.
    66struc PIOVARS
    7     .wWordsInBlock          resb    2   ; 0, Block size in WORDs
    8     .wWordsLeft             resb    2   ; 2, WORDs left to transfer
    9     .wWordsDone             resb    2   ; 4, Number of sectors xferred
    10                             resb    1   ; 6,
     7    .wDataPort              resb    2   ; 0, IDE Data Port
     8    .fnXfer                 resb    2   ; 2, Offset to transfer function
     9    .wSectorsInBlock        resb    2   ; 4, Block size in sectors
     10    .bSectorsLeft           resb    1   ; 6, Sectors left to transfer
    1111                            resb    1   ; 7, IDEPACK.bDeviceControl
    12     .wDataPort              resb    2   ; 8, IDE Data Port
    13     .fnXfer                 resb    2   ; 10, Offset to transfer function
     12    .bSectorsDone           resb    1   ; 8, Number of sectors xferred
    1413endstruc
    1514
     
    6968    xchg    si, di                              ; ES:DI now points buffer
    7069
    71     mov     cx, [bp+PIOVARS.wWordsInBlock]
     70    mov     cx, [bp+PIOVARS.wSectorsInBlock]    ; Max 128
    7271
    7372ALIGN JUMP_ALIGN
    7473.ReadNextBlockFromDrive:
    7574    mov     dx, [bp+PIOVARS.wDataPort]
    76     cmp     [bp+PIOVARS.wWordsLeft], cx
     75    cmp     [bp+PIOVARS.bSectorsLeft], cl
    7776    jbe     SHORT .ReadLastBlockFromDrive
    7877    call    [bp+PIOVARS.fnXfer]
     
    8483    xchg    si, di                              ; ES:DI now points buffer
    8584
    86     ; Increment number of successfully read WORDs
    87     mov     cx, [bp+PIOVARS.wWordsInBlock]
    88     sub     [bp+PIOVARS.wWordsLeft], cx
    89     add     [bp+PIOVARS.wWordsDone], cx
     85    ; Increment number of successfully read sectors
     86    mov     cx, [bp+PIOVARS.wSectorsInBlock]
     87    sub     [bp+PIOVARS.bSectorsLeft], cl
     88    add     [bp+PIOVARS.bSectorsDone], cl
    9089    jmp     SHORT .ReadNextBlockFromDrive
    9190
    9291ALIGN JUMP_ALIGN
    9392.ReadLastBlockFromDrive:
    94     mov     cx, [bp+PIOVARS.wWordsLeft]
     93    mov     cl, [bp+PIOVARS.bSectorsLeft]       ; CH is already zero
    9594    call    [bp+PIOVARS.fnXfer]                 ; Transfer possibly partial block
    9695
     
    103102    ; Return number of successfully read sectors
    104103ReturnWithTransferErrorInAH:
    105     mov     cx, [bp+PIOVARS.wWordsDone]
    106     jc      SHORT .ConvertTransferredWordsInCXtoSectors
    107     add     cx, [bp+PIOVARS.wWordsLeft]         ; Never sets CF
    108 .ConvertTransferredWordsInCXtoSectors:
    109     xchg    cl, ch
     104    mov     cl, [bp+PIOVARS.bSectorsDone]
     105    mov     ch, 0                               ; Preserve CF
    110106    ret
    111107
     
    137133    jc      SHORT ReturnWithTransferErrorInAH
    138134
    139     mov     cx, [bp+PIOVARS.wWordsInBlock]
     135    mov     cx, [bp+PIOVARS.wSectorsInBlock]    ; Max 128
    140136
    141137ALIGN JUMP_ALIGN
    142138.WriteNextBlockToDrive:
    143139    mov     dx, [bp+PIOVARS.wDataPort]
    144     cmp     [bp+PIOVARS.wWordsLeft], cx
     140    cmp     [bp+PIOVARS.bSectorsLeft], cl
    145141    jbe     SHORT .WriteLastBlockToDrive
    146142    call    [bp+PIOVARS.fnXfer]
     
    150146    jc      SHORT ReturnWithTransferErrorInAH
    151147
    152     ; Increment number of successfully written WORDs
    153     mov     cx, [bp+PIOVARS.wWordsInBlock]
    154     sub     [bp+PIOVARS.wWordsLeft], cx
    155     add     [bp+PIOVARS.wWordsDone], cx
     148    ; Increment number of successfully written sectors
     149    mov     cx, [bp+PIOVARS.wSectorsInBlock]
     150    sub     [bp+PIOVARS.bSectorsLeft], cl
     151    add     [bp+PIOVARS.bSectorsDone], cl
    156152    jmp     SHORT .WriteNextBlockToDrive
    157153
    158154ALIGN JUMP_ALIGN
    159155.WriteLastBlockToDrive:
    160     mov     cx, [bp+PIOVARS.wWordsLeft]
     156    mov     cl, [bp+PIOVARS.bSectorsLeft]       ; CH is already zero
    161157%ifdef USE_186
    162158    push    CheckErrorsAfterTransferringLastBlock
     
    183179InitializePiovarsInSSBPwithSectorCountInAH:
    184180    ; Store sizes
    185     xor     al, al
    186     mov     [bp+PIOVARS.wWordsLeft], ax
    187     mov     ah, [di+DPT_ATA.bSetBlock]
    188     mov     [bp+PIOVARS.wWordsInBlock], ax
    189     cbw
    190     mov     [bp+PIOVARS.wWordsDone], ax         ; Zero
     181    mov     [bp+PIOVARS.bSectorsLeft], ah
     182    eMOVZX  ax, BYTE [di+DPT_ATA.bSetBlock]
     183    mov     [bp+PIOVARS.wSectorsInBlock], ax
     184    mov     [bp+PIOVARS.bSectorsDone], ah       ; Zero
    191185
    192186    ; Get transfer function based on bus type
     
    194188    mov     bl, [di+DPT.bIdevarsOffset]         ; CS:BX now points to IDEVARS
    195189    mov     dx, [cs:bx+IDEVARS.wPort]           ; Load IDE Data port address
     190%ifdef MODULE_ADVANCED_ATA
     191    mov     bl, [di+DPT_ATA.bDevice]
     192%else
    196193    mov     bl, [cs:bx+IDEVARS.bDevice]         ; Load device type to BX
     194%endif
    197195    add     bx, ax
     196
    198197    mov     [bp+PIOVARS.wDataPort], dx
    199198    mov     ax, [cs:bx]                         ; Load offset to transfer function
     
    208207; ReadBlockFrom32bitDataPort    VLB/PCI 32-bit IDE
    209208;   Parameters:
    210 ;       CX:     Block size in WORDs
     209;       CX:     Block size in 512 byte sectors
    211210;       DX:     IDE Data port address
    212211;       ES:DI:  Normalized ptr to buffer to receive data
     
    218217ALIGN JUMP_ALIGN
    219218ReadBlockFromXtideRev1:
    220     eSHR_IM cx, 2       ; Loop unrolling
     219    UNROLL_SECTORS_IN_CX_TO_QWORDS
    221220    mov     bx, 8       ; Bit mask for toggling data low/high reg
    222221ALIGN JUMP_ALIGN
     
    233232ALIGN JUMP_ALIGN
    234233ReadBlockFromXtideRev2:
    235     times 2 shr cx, 1   ; WORD count to QWORD count
     234    UNROLL_SECTORS_IN_CX_TO_QWORDS
    236235ALIGN JUMP_ALIGN
    237236.ReadNextQword:
     
    251250ALIGN JUMP_ALIGN
    252251ReadBlockFrom16bitDataPort:
     252    xchg    cl, ch      ; Sectors to WORDs
    253253    rep
    254254    db      6Dh         ; INSW (we want this in XT build)
     
    258258ALIGN JUMP_ALIGN
    259259ReadBlockFrom32bitDataPort:
    260     shr     cx, 1       ; WORD count to DWORD count
     260    db      0C1h        ; SHL
     261    db      0E1h        ; CX
     262    db      7           ; 7 (Sectors to DWORDs)
    261263    rep
    262264    db      66h         ; Override operand size to 32-bit
     
    272274; WriteBlockTo32bitDataPort     VLB/PCI 32-bit IDE
    273275;   Parameters:
    274 ;       CX:     Block size in WORDs
     276;       CX:     Block size in 512-byte sectors
    275277;       DX:     IDE Data port address
    276278;       ES:SI:  Normalized ptr to buffer containing data
     
    284286    push    ds
    285287    push    bx
    286     eSHR_IM cx, 2       ; Loop unrolling
     288    UNROLL_SECTORS_IN_CX_TO_QWORDS
    287289    mov     bx, 8       ; Bit mask for toggling data low/high reg
    288290    push    es          ; Copy ES...
     
    302304ALIGN JUMP_ALIGN
    303305WriteBlockToXtideRev2:
     306    UNROLL_SECTORS_IN_CX_TO_QWORDS
    304307    push    ds
    305     eSHR_IM cx, 2       ; Loop unrolling
    306308    push    es          ; Copy ES...
    307309    pop     ds          ; ...to DS
     
    320322ALIGN JUMP_ALIGN
    321323WriteBlockToFastXtide:
    322     times 2 shr cx, 1   ; WORD count to QWORD count
     324    UNROLL_SECTORS_IN_CX_TO_QWORDS
    323325    push    ds
    324326    push    es
     
    342344ALIGN JUMP_ALIGN
    343345WriteBlockTo16bitDataPort:
     346    xchg    cl, ch      ; Sectors to WORDs
    344347    es                  ; Source is ES segment
    345348    rep
     
    350353ALIGN JUMP_ALIGN
    351354WriteBlockTo32bitDataPort:
    352     shr     cx, 1       ; WORD count to DWORD count
     355    db      0C1h        ; SHL
     356    db      0E1h        ; CX
     357    db      7           ; 7 (Sectors to DWORDs)
    353358    es                  ; Source is ES segment
    354359    rep
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r294 r363  
    3838;       CF:     0 if successful, 1 if error
    3939;   Corrupts registers:
    40 ;       AL, BX, DX
     40;       AL, BX, CX, DX
    4141;--------------------------------------------------------------------
    4242AH9h_InitializeDriveForUse:
     43    push    es
    4344    push    si
    44     push    cx
     45    call    ClearErrorFlagFromBootMenuInfo  ; Do this for serial devices as well
    4546
    4647%ifdef MODULE_SERIAL
    47     ;
    48     ; no need to do this for serial devices, and we use the DPT_RESET flag bits
    49     ; to store the drive type for serial floppy drives (MODULE_SERIAL_FLOPPY)
    50     ;
     48    ; no need to do this for serial devices
    5149    xor     ah, ah
    5250    test    byte [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE    ; Clears CF
    53     jnz     .ReturnNotSuccessful
     51    jnz     .ReturnWithErrorCodeInAH
     52
     53%else
     54    ; Clear Initialization Error flag from DPT
     55    and     BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_INITERROR
    5456%endif
    5557
    5658    ; Try to select drive and wait until ready
    57     or      BYTE [di+DPT.bFlagsHigh], MASKH_DPT_RESET       ; Everything uninitialized
    5859    call    AccessDPT_GetDriveSelectByteToAL
    5960    mov     [bp+IDEPACK.bDrvAndHead], al
    6061    call    Device_SelectDrive
    61     jc      SHORT .ReturnNotSuccessful
    62     and     BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nDRDY ; Clear since success
     62    mov     al, FLG_INIT_FAILED_TO_SELECT_DRIVE
     63    call    SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo
     64    jc      SHORT .ReturnWithErrorCodeInAH
    6365
    6466    ; Initialize CHS parameters if LBA is not used
    6567    call    InitializeDeviceParameters
    66     jc      SHORT .SetWriteCache
    67     and     BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nINITPRMS
     68    mov     al, FLG_INIT_FAILED_TO_INITIALIZE_CHS_PARAMETERS
     69    call    SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo
    6870
    6971    ; Enable or Disable Write Cache
    70 .SetWriteCache:
    7172    call    SetWriteCache
     73    mov     al, FLG_INIT_FAILED_TO_SET_WRITE_CACHE
     74    call    SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo
    7275
    7376    ; Recalibrate drive by seeking to cylinder 0
    7477.RecalibrateDrive:
    7578    call    AH11h_RecalibrateDrive
    76     jc      SHORT .InitializeBlockMode
    77     and     BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nRECALIBRATE
     79    mov     al, FLG_INIT_FAILED_TO_RECALIBRATE_DRIVE
     80    call    SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo
    7881
    7982    ; Initialize block mode transfers
    8083.InitializeBlockMode:
    8184    call    InitializeBlockMode
    82     jc      SHORT .ReturnNotSuccessful
    83     and     BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_RESET_nSETBLOCK ; Keeps CF clear
    84 
    85 .ReturnNotSuccessful:
    86     pop     cx
     85    mov     al, FLG_INIT_FAILED_TO_SET_BLOCK_MODE
     86    call    SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo
     87
     88%ifdef MODULE_ADVANCED_ATA
     89; Initialize fastest supported PIO mode
     90.InitializePioMode:
     91    call    InitializePioMode
     92    mov     al, FLG_INIT_FAILED_TO_SET_PIO_MODE
     93    call    SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo
     94%endif
     95
     96    ; There might have been several errors so just return
     97    ; one error code for them all
     98    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INITERROR
     99    jz      SHORT .ReturnWithErrorCodeInAH
     100    mov     ah, RET_HD_RESETFAIL
     101    stc
     102
     103.ReturnWithErrorCodeInAH:
    87104    pop     si
     105    pop     es
    88106    ret
    89107
     
    140158
    141159
     160%ifdef MODULE_ADVANCED_ATA
     161;--------------------------------------------------------------------
     162; InitializePioMode
     163;   Parameters:
     164;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     165;   Returns:
     166;       AH:     BIOS Error code
     167;       CF:     Cleared if successful
     168;               Set if any error
     169;   Corrupts registers:
     170;       AL, BX, CX, DX
     171;--------------------------------------------------------------------
     172InitializePioMode:
     173    xor     dx, dx                      ; Parameter to Sector Count Register = 0 = PIO_DEFAULT_MODE
     174    mov     al, [di+DPT_ATA.bPioMode]
     175    cmp     al, 3                       ; PIO mode 3 and above require IORDY
     176    jb      SHORT .SetTransferMode
     177    or      dl, al
     178.SetTransferMode:
     179    mov     si, FEATURE_SET_TRANSFER_MODE
     180    jmp     AH23h_SetControllerFeatures
     181%endif
     182
     183
    142184;--------------------------------------------------------------------
    143185; InitializeBlockMode
     
    160202    eCMOVNZ al, [di+DPT_ATA.bMaxBlock]  ; Load max block size
    161203    jmp     AH24h_SetBlockSize
     204
     205
     206;--------------------------------------------------------------------
     207; ClearErrorFlagFromBootMenuInfo
     208;   Parameters:
     209;       DS:DI:  Ptr to DPT
     210;   Returns:
     211;       Nothing
     212;   Corrupts registers:
     213;       BX, ES
     214;--------------------------------------------------------------------
     215ClearErrorFlagFromBootMenuInfo:
     216    call    BootMenuInfo_IsAvailable    ; Load BOOTMENUINFO segment to ES
     217    jne     SHORT .DoNotStoreErrorFlags
     218    call    BootMenuInfo_ConvertDPTtoBX
     219    mov     WORD [es:bx+BOOTMENUINFO.wInitErrorFlags], 0    ; Must clear whole WORD!
     220.DoNotStoreErrorFlags:
     221    ret
     222
     223
     224;--------------------------------------------------------------------
     225; SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo
     226;   Parameters:
     227;       AH:     BIOS Error Code
     228;       AL:     Error flag to set
     229;       DS:DI:  Ptr to DPT
     230;   Returns:
     231;       CF:     Clear if no error
     232;               Set if error flag was set
     233;   Corrupts registers:
     234;       BX, ES
     235;--------------------------------------------------------------------
     236SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo:
     237    jnc     SHORT NoErrorFlagToSet
     238    cmp     ah, RET_HD_INVALID
     239    jbe     SHORT .IgnoreInvalidCommandError
     240
     241    call    BootMenuInfo_IsAvailable
     242    jne     SHORT .BootvarsNotAvailableSoDoNotSetErrorFlag
     243
     244    call    BootMenuInfo_ConvertDPTtoBX
     245    or      [es:bx+BOOTMENUINFO.wInitErrorFlags], al
     246.BootvarsNotAvailableSoDoNotSetErrorFlag:
     247    or      BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INITERROR
     248    stc
     249    ret
     250.IgnoreInvalidCommandError:
    162251ReturnSuccessSinceInitializationNotNeeded:
    163252    xor     ah, ah
    164     ret
     253NoErrorFlagToSet:
     254    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm

    r294 r363  
    5353
    5454    ; Initialize Master and Slave drives
    55     eMOVZX  ax, [di+DPT.bIdevarsOffset]         ; (AL) pointer to controller we are looking to reset
     55    eMOVZX  ax, BYTE [di+DPT.bIdevarsOffset]    ; (AL) pointer to controller we are looking to reset
    5656                                                ; (AH) initialize error code, assume success
    5757
    58     mov     si, IterateAndResetDrives
     58    mov     si, IterateAndResetDrives           ; Callback function for FindDPT_IterateAllDPTs
    5959    call    FindDPT_IterateAllDPTs
    6060
     
    7373; merged into overall error code for this controller.  Master will be reset
    7474; first.  Note that the iteration will go until the end of the DPT list.
     75;
     76;   Parameters:
     77;       AL:     Offset to IDEVARS for drives to initialize
     78;       AH:     Error status from previous initialization
     79;       DS:DI:  Ptr to DPT to examine
     80;   Returns:
     81;       AH:     Error status from initialization
     82;       CF:     Set to iterate all DPTs
     83;   Corrupts registers:
     84;       AL, BX, DX
    7585;--------------------------------------------------------------------
    7686IterateAndResetDrives:
     
    7888    jne     .done
    7989    push    ax
     90    push    cx
    8091    call    AH9h_InitializeDriveForUse          ; Reset Master and Slave (Master will come first in DPT list)
     92
     93%ifdef MODULE_ADVANCED_ATA
     94    jc      SHORT .SkipControllerInitSinceError
     95    call    InitializeAdvancedIdeControllers    ; Done after drive init so drives are first set to advanced PIO mode, then the controller
     96.SkipControllerInitSinceError:
     97%endif
     98
     99    pop     cx
    81100    pop     ax
    82101    jnc     .done
     
    85104    stc                                         ; From IterateAllDPTs perspective, the DPT is never found (continue iteration)
    86105    ret
     106
     107
     108%ifdef MODULE_ADVANCED_ATA
     109;--------------------------------------------------------------------
     110; Here we initialize the more advanced controllers (VLB and PCI)
     111; to get better performance for systems with 32-bit bus.
     112;
     113; This step is optional since the controllers use slowest possible
     114; settings by default if they are not initialized.
     115;
     116; InitializeAdvancedIdeController
     117;   Parameters:
     118;       DS:DI:  Ptr to DPT
     119;   Returns:
     120;       CF:     Cleared if success or no controller to initialize
     121;               Set if error
     122;   Corrupts registers:
     123;       AX, BX, CX, DX
     124;--------------------------------------------------------------------
     125InitializeAdvancedIdeControllers:
     126    ; We want to initialize the advanced controller only after both
     127    ; Master and Slave drive are initialized to correct PIO mode.
     128    ; We check if next DPT is for the same IDE controller. If it is,
     129    ; we skip the initialization.
     130    mov     al, [di+DPT.bIdevarsOffset]
     131    cmp     al, [di++LARGEST_DPT_SIZE+DPT.bIdevarsOffset]
     132    je      SHORT .SkipInitializationUntilNextDrive ; CF cleared
     133
     134    jmp     AdvAtaInit_InitializeControllerForDPTinDSDI
     135.SkipInitializationUntilNextDrive:
     136    clc
     137    ret
     138
     139%endif  ; MODULE_ADVANCED_ATA
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm

    r324 r363  
    7272    mul     WORD [di+ATA1.wCylCnt]  ; DX:AX=Sectors per track * number of heads * number of cylinders
    7373    ret
     74
     75
     76%ifdef MODULE_ADVANCED_ATA
     77;--------------------------------------------------------------------
     78; AtaID_GetMaxPioModeToAXandMinCycleTimeToDX
     79;   Parameters:
     80;       ES:SI:  Ptr to 512-byte ATA information read from the drive
     81;   Returns:
     82;       AX:     Max supported PIO mode
     83;       DX:     Minimum Cycle Time in nanosecs
     84;   Corrupts registers:
     85;       BX
     86;--------------------------------------------------------------------
     87AtaID_GetMaxPioModeToAXandMinCycleTimeToDX:
     88    ; Get PIO mode and cycle time for PIO 0...2
     89    mov     bx, [es:si+ATA1.bPioMode]
     90    shl     bx, 1                   ; Shift for WORD lookup
     91    mov     dx, [cs:bx+.rgwPio0to2CycleTimeInNanosecs]
     92    shr     bx, 1
     93    xchg    ax, bx                  ; AL = PIO mode 0, 1 or 2
     94
     95    ; Check if Advanced PIO modes are supported (3 and above)
     96    test    BYTE [es:si+ATA2.wFields], A2_wFields_64to70
     97    jz      SHORT .ReturnPioTimings
     98
     99    ; Get Advanced PIO mode
     100    ; (Hard Disks supports up to 4 but CF cards might support 5)
     101    mov     bx, [es:si+ATA2.bPIOSupp]
     102.CheckNextFlag:
     103    inc     ax
     104    shr     bx, 1
     105    jnz     SHORT .CheckNextFlag
     106    mov     dx, [es:si+ATA2.wPIOMinCyF] ; Advanced modes use IORDY
     107.ReturnPioTimings:
     108    ret
     109
     110
     111.rgwPio0to2CycleTimeInNanosecs:
     112    dw      PIO_0_MIN_CYCLE_TIME_NS
     113    dw      PIO_1_MIN_CYCLE_TIME_NS
     114    dw      PIO_2_MIN_CYCLE_TIME_NS
     115
     116
     117;--------------------------------------------------------------------
     118; AtaID_ConvertPioModeFromAXandMinCycleTimeFromDXtoActiveAndRecoveryTime
     119;   Parameters:
     120;       AX:     Max supported PIO mode
     121;       DX:     Minimum PIO Cycle Time in nanosecs
     122;   Returns:
     123;       CX:     Minimum Active time in nanosecs
     124;       DX:     Minimum Recovery time in nanosecs
     125;   Corrupts registers:
     126;       BX
     127;--------------------------------------------------------------------
     128AtaID_ConvertPioModeFromAXandMinCycleTimeFromDXtoActiveAndRecoveryTime:
     129    ; Subtract Address Valid Time (t1) from Cycle Time (t0)
     130    mov     bx, ax
     131    eMOVZX  cx, BYTE [cs:bx+.rgbPioModeToAddressValidTimeNs]
     132    sub     dx, cx
     133
     134    ; Subtract Active Time (t2) from previous result to get Recovery Time (t2i)
     135    shl     bx, 1           ; Shift PIO Mode for WORD lookup
     136    mov     cx, [cs:bx+.rgwPioModeToActiveTimeNs]
     137    sub     dx, cx
     138    ret
     139
     140
     141.rgbPioModeToAddressValidTimeNs:
     142    db      PIO_0_MIN_ADDRESS_VALID_NS
     143    db      PIO_1_MIN_ADDRESS_VALID_NS
     144    db      PIO_2_MIN_ADDRESS_VALID_NS
     145    db      PIO_3_MIN_ADDRESS_VALID_NS
     146    db      PIO_4_MIN_ADDRESS_VALID_NS
     147
     148.rgwPioModeToActiveTimeNs:
     149    dw      PIO_0_MIN_ACTIVE_TIME_NS
     150    dw      PIO_1_MIN_ACTIVE_TIME_NS
     151    dw      PIO_2_MIN_ACTIVE_TIME_NS
     152    dw      PIO_3_MIN_ACTIVE_TIME_NS
     153    dw      PIO_4_MIN_ACTIVE_TIME_NS
     154
     155%endif ; MODULE_ADVANCED_ATA
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r294 r363  
    204204    call    BootMenuInfo_CreateForHardDisk
    205205    jmp     short DetectPrint_DriveNameFromBootnfoInESBX
    206 
    207 
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm

    r271 r363  
    5353;--------------------------------------------------------------------
    5454Initialize_AndDetectDrives:
     55    mov     WORD [es:BOOTVARS.wMagicWord], BOOTVARS_MAGIC_WORD
    5556    call    BootMenuPrint_InitializeDisplayContext
    5657    call    DetectPrint_RomFoundAtSegment
     
    9899    call    AH0h_ResetAllOurHardDisksAtTheEndOfDriveInitialization
    99100    add     sp, BYTE EXTRA_BYTES_FOR_INTPACK
     101    mov     WORD [es:BOOTVARS.wMagicWord], 0
    100102    ret
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r361 r363  
    3434    %include "IDE_8bit.inc"         ; For IDE 8-bit data port macros
    3535    %include "DeviceIDE.inc"        ; For IDE device equates
     36    %include "Vision.inc"           ; For QDI Vision QD65xx VLB IDE Controllers
    3637
    3738
     
    6970%endif
    7071
     72%ifdef MODULE_ADVANCED_ATA
     73    MAIN_FLG_MODULE_ADVATA  equ FLG_ROMVARS_MODULE_ADVATA
     74%else
     75    MAIN_FLG_MODULE_ADVATA  equ 0
     76%endif
     77
    7178
    7279;---------------------------;
     
    7481;---------------------------;
    7582%ifdef USE_AT
    76     at  ROMVARS.wFlags,         dw  FLG_ROMVARS_FULLMODE | FLG_ROMVARS_DRVXLAT | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_JRIDE
     83    at  ROMVARS.wFlags,         dw  FLG_ROMVARS_FULLMODE | FLG_ROMVARS_DRVXLAT | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_JRIDE | MAIN_FLG_MODULE_ADVATA
    7784    at  ROMVARS.wDisplayMode,   dw  DEFAULT_TEXT_MODE
    7885    at  ROMVARS.wBootTimeout,   dw  BOOT_MENU_DEFAULT_TIMEOUT
     
    8996    at  ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE
    9097
    91     at  ROMVARS.ideVars1+IDEVARS.wPort,         dw  170h            ; Controller Command Block base port
    92     at  ROMVARS.ideVars1+IDEVARS.wPortCtrl,     dw  370h            ; Controller Control Block base port
     98    at  ROMVARS.ideVars1+IDEVARS.wPort,         dw  DEVICE_ATA_DEFAULT_SECONDARY_PORT
     99    at  ROMVARS.ideVars1+IDEVARS.wPortCtrl,     dw  DEVICE_ATA_DEFAULT_SECONDARY_PORTCTRL
    93100    at  ROMVARS.ideVars1+IDEVARS.bDevice,       db  DEVICE_16BIT_ATA
    94101    at  ROMVARS.ideVars1+IDEVARS.bIRQ,          db  0
     
    117124; XT and XT+ Build default settings ;
    118125;-----------------------------------;
    119     at  ROMVARS.wFlags,         dw  FLG_ROMVARS_DRVXLAT | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_JRIDE
     126    at  ROMVARS.wFlags,         dw  FLG_ROMVARS_DRVXLAT | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_JRIDE | MAIN_FLG_MODULE_ADVATA
    120127    at  ROMVARS.wDisplayMode,   dw  DEFAULT_TEXT_MODE
    121128    at  ROMVARS.wBootTimeout,   dw  BOOT_MENU_DEFAULT_TIMEOUT
     
    205212
    206213    ; IDE Device support
     214%ifdef MODULE_ADVANCED_ATA
     215    %include "AdvAtaInit.asm"       ; For initializing VLB and PCI controllers
     216    %include "Vision.asm"           ; QDI Vision QD6500 and QD6580 support
     217%endif
    207218%define IDEDEVICE Ide
    208219%define ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS
  • trunk/XTIDE_Universal_BIOS/makefile

    r322 r363  
    3535# Subdirectories where included files are:
    3636HEADERS = Inc/
     37HEADERS += Inc/Controllers/
    3738HEADERS += Src/
    3839HEADERS += Src/Boot/
     
    7172DEFINES_XT = ELIMINATE_CGA_SNOW MODULE_SERIAL MODULE_SERIAL_FLOPPY
    7273DEFINES_XTPLUS = ELIMINATE_CGA_SNOW USE_186 MODULE_SERIAL MODULE_SERIAL_FLOPPY
    73 DEFINES_AT = USE_286 USE_AT MODULE_SERIAL MODULE_SERIAL_FLOPPY
     74DEFINES_AT = USE_286 USE_AT MODULE_ADVANCED_ATA
    7475DEFINES_XT_LARGE = $(DEFINES_XT) MODULE_JRIDE
    7576DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) MODULE_JRIDE
Note: See TracChangeset for help on using the changeset viewer.