Changeset 588 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h


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.
Location:
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h
Files:
3 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
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm

    r558 r588  
    6868    ; must know what the actual block size is.
    6969    cmp     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
    70     je      SHORT .DisableBlockMode
     70    je      SHORT ProcessXTCFsubcommandFromAL.AH1Eh_LoadInvalidCommandToAHandSetCF
    7171.NoNeedToLimitBlockSize:
    7272%endif ; MODULE_8BIT_IDE_ADVANCED
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r567 r588  
    234234
    235235
     236%ifdef MODULE_8BIT_IDE
     237;--------------------------------------------------------------------
     238; AH9h_Enable8bitModeForDevice8bitAta
     239;   Parameters:
     240;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     241;       SS:BP:  Ptr to IDEPACK
     242;   Returns:
     243;       AH:     Int 13h return status
     244;       CF:     Clear if successful or device is not DEVICE_8BIT_ATA
     245;               Set if failed to set 8-bit mode for DEVICE_8BIT_ATA
     246;   Corrupts registers:
     247;       AL, BX, CX, DX, SI
     248;--------------------------------------------------------------------
     249AH9h_Enable8bitModeForDevice8bitAta:
     250    cmp     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_ATA
     251%ifdef MODULE_8BIT_IDE_ADVANCED
     252    jne     SHORT IgnoreInvalidCommandError
     253    jmp     AH23h_Enable8bitPioMode
     254%else ; ~MODULE_8BIT_IDE_ADVANCED
     255    je      AH23h_Enable8bitPioMode
     256    ; Fall to IgnoreInvalidCommandError
     257%endif ; MODULE_8BIT_IDE_ADVANCED
     258%endif ; MODULE_8BIT_IDE
     259
     260
     261%ifdef MODULE_8BIT_IDE_ADVANCED
     262;--------------------------------------------------------------------
     263; AH9h_SetModeFromALtoXTCF
     264;   Parameters:
     265;       AL:     XT-CF Mode to set
     266;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     267;       SS:BP:  Ptr to IDEPACK
     268;   Returns:
     269;       AH:     Int 13h return status
     270;       CF:     Clear if successful or device is not XT-CF
     271;               Set if failed to set mode for XT-CF
     272;   Corrupts registers:
     273;       AL, BX, CX, DX, SI
     274;--------------------------------------------------------------------
     275AH9h_SetModeFromALtoXTCF:
     276    call    AccessDPT_IsThisDeviceXTCF
     277    jnc     AH1Eh_ChangeXTCFmodeBasedOnModeInAL
     278    ; Fall to IgnoreInvalidCommandError
     279%endif ; MODULE_8BIT_IDE_ADVANCED
     280
     281
    236282;--------------------------------------------------------------------
    237283; SetErrorFlagFromALwithErrorCodeInAH
     
    259305.NoErrorFlagToSet:
    260306    ret
    261 
    262 
    263 %ifdef MODULE_8BIT_IDE_ADVANCED
    264 ;--------------------------------------------------------------------
    265 ; AH9h_SetModeFromALtoXTCF
    266 ;   Parameters:
    267 ;       AL:     XT-CF Mode to set
    268 ;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    269 ;       SS:BP:  Ptr to IDEPACK
    270 ;   Returns:
    271 ;       AH:     Int 13h return status
    272 ;       CF:     Clear if successful or device is not XT-CF
    273 ;               Set if failed to set mode for XT-CF
    274 ;   Corrupts registers:
    275 ;       AL, BX, CX, DX, SI
    276 ;--------------------------------------------------------------------
    277 AH9h_SetModeFromALtoXTCF:
    278     call    AccessDPT_IsThisDeviceXTCF
    279     jne     SHORT IgnoreInvalidCommandError
    280     jmp     AH1Eh_ChangeXTCFmodeBasedOnModeInAL
    281 %endif ; MODULE_8BIT_IDE_ADVANCED
    282 
    283 
    284 %ifdef MODULE_8BIT_IDE
    285 ;--------------------------------------------------------------------
    286 ; AH9h_Enable8bitModeForDevice8bitAta
    287 ;   Parameters:
    288 ;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    289 ;       SS:BP:  Ptr to IDEPACK
    290 ;   Returns:
    291 ;       AH:     Int 13h return status
    292 ;       CF:     Clear if successful or device is not DEVICE_8BIT_ATA
    293 ;               Set if failed to set 8-bit mode for DEVICE_8BIT_ATA
    294 ;   Corrupts registers:
    295 ;       AL, BX, CX, DX, SI
    296 ;--------------------------------------------------------------------
    297 AH9h_Enable8bitModeForDevice8bitAta:
    298     cmp     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_ATA
    299     jne     SHORT IgnoreInvalidCommandError
    300     jmp     AH23h_Enable8bitPioMode
    301 %endif ; MODULE_8BIT_IDE
Note: See TracChangeset for help on using the changeset viewer.