Ignore:
Timestamp:
Jun 3, 2015, 12:30:54 PM (9 years ago)
Author:
krille_n_@…
google:author:
krille_n_@hotmail.com
Message:

Changes:

  • Fixed a bug in AH24h_HSetBlocks.asm from r550. Trying to set a too large block size with an XT-CF card in DMA transfer mode would corrupt the stack.
  • Fixed a bug from r545 where the list of devices under g_szDeviceTypeValues in Strings.asm was no longer up to date causing the boot menu to display the wrong string for devices numbered higher than DEVICE_8BIT_XTCF_PIO8.
  • Made some fairly significant changes to the XT-CF code to reduce size. Two changes in functionality; 1) Added a simple check to validate the request for a change of the XT-CF transfer mode. 2) Changing transfer mode to use DMA no longer calls AH24h_SetBlockSize if the block size already is within the limits of DMA transfers. UNTESTED
  • XTIDECFG now clears IDEVARS.bIRQ when changing IDE controller to a serial device to keep the boot menu from displaying it since the serial device doesn't use IRQs at all.
  • Other minor optimizations.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm

    r584 r588  
    6565    ; IS_THIS_DRIVE_XTCF. We check this for all commands.
    6666    call    AccessDPT_IsThisDeviceXTCF
    67     jne     SHORT .XTCFnotFound
     67    jc      SHORT .XTCFnotFound
    6868    and     ax, 0FFh                    ; Subcommand now in AX (clears AH and CF)
    6969    jz      SHORT .XTCFfound            ; Sub-function IS_THIS_DRIVE_XTCF (=0)
     
    111111    ;       Selected transfer mode is stored in BIOS variable (DPT_ATA.bDevice).
    112112
    113     ; Note that when selecting 'DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD' mode,
     113    ; Note that when selecting 'XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD' mode,
    114114    ; the ATA device (i.e. CompactFlash card) will operate in 8-bit mode, but
    115115    ; data will be transferred from its data register using 16-bit CPU instructions
     
    122122    ; Also note that some machines, noteably the Olivetti M24 (also known as
    123123    ; the AT&T PC6300 and Xerox 6060), have hardware errors in the BIU logic,
    124     ; resulting in reversed byte ordering.  Therefore, mode DEVICE_8BIT_PIO is
     124    ; resulting in reversed byte ordering.  Therefore, XTCF_8BIT_PIO_MODE is
    125125    ; the default transfer mode for best system compatibility.
    126126
     127
     128    ; Is requested mode valid?
     129    cmp     al, 3                       ; Valid modes are 0...3
     130    ja      SHORT ProcessXTCFsubcommandFromAL.AH1Eh_LoadInvalidCommandToAHandSetCF
     131
     132    ; Convert mode to XT-CF device type (see RomVars.inc and XTCF.inc for full details)
     133    eSHL_IM al, 1                       ; Shift requested mode
     134    add     al, XTCF_DEVICE_OFFSET      ; Add the device offset (already shifted)
     135    mov     [di+DPT_ATA.bDevice], al    ; Set the new mode (or device actually)
     136
     137    cmp     al, DEVICE_8BIT_XTCF_PIO16_WITH_BIU_OFFLOAD
     138    je      SHORT AH23h_Disable8bitPioMode
     139
     140    ; We always need to enable 8-bit mode since 16-bit mode is restored
     141    ; when controller is reset (AH=00h or 0Dh)
     142
     143    cmp     al, DEVICE_8BIT_XTCF_DMA
     144    jne     SHORT AH23h_Enable8bitPioMode
     145
     146    ; DMA transfers have limited block size
     147    mov     al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
     148    cmp     [di+DPT_ATA.bBlockSize], al
     149    jbe     SHORT AH23h_Enable8bitPioMode   ; No need to limit block size
     150    call    AH24h_SetBlockSize
     151    jmp     SHORT AH23h_Enable8bitPioMode
     152
     153
     154%if 0
    127155    ; We always need to enable 8-bit mode since 16-bit mode is restored
    128156    ; when controller is reset (AH=00h or 0Dh)
     
    134162    dec     ax                      ; XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD = 1
    135163    jz      SHORT .Set8bitPioModeWithBIUOffload
    136     dec     ax
     164    dec     ax                      ; XTCF_16BIT_PIO_WITH_BIU_OFFLOAD = 2
    137165    jz      SHORT .Set16bitPioModeWithBIUOffload
    138166
    139     ; XTCF_DMA_MODE = 2 (allow 3 as well for more optimized code)
     167    ; XTCF_DMA_MODE = 3
    140168    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
    141169
     
    161189    mov     [di+DPT_ATA.bDevice], al
    162190    ret
     191%endif ; 0
    163192
    164193
     
    168197;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    169198;   Returns:
    170 ;       AX:     XT-CF mode (XTCF_8BIT_PIO_MODE, XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD or XTCF_DMA_MODE)
     199;       AX:     XT-CF mode (XTCF_8BIT_PIO_MODE, XTCF_8BIT_PIO_MODE_WITH_BIU_OFFLOAD, XTCF_16BIT_PIO_WITH_BIU_OFFLOAD or XTCF_DMA_MODE)
    171200;       CF:     Clear
    172201;   Corrupts registers:
     
    174203;--------------------------------------------------------------------
    175204AH1Eh_GetCurrentXTCFmodeToAX:
     205    mov     ax, -XTCF_DEVICE_OFFSET & 0FFh
     206    add     al, [di+DPT_ATA.bDevice]
     207    shr     al, 1
     208    ret
     209
     210%if 0
    176211    mov     al, [di+DPT_ATA.bDevice]
    177212    shr     al, 1
    178213    cbw
    179     sub     al, DEVICE_8BIT_XTCF_PIO8 >> 1
    180     ret
     214    sub     al, XTCF_DEVICE_OFFSET >> 1
     215    ret
     216%endif ; 0
Note: See TracChangeset for help on using the changeset viewer.