Changeset 480 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device


Ignore:
Timestamp:
Oct 27, 2012, 11:26:11 AM (12 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • XT-CF DMA transfers should now work.
Location:
trunk/XTIDE_Universal_BIOS/Src/Device
Files:
1 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm

    r473 r480  
    8484;       DX:     Autodetected port (for devices that support autodetection)
    8585;       DS:     Segment to RAMVARS
    86 ;       ES:SI:  Ptr to normalized buffer to receive 512-byte IDE Information
     86;       ES:SI:  Ptr to buffer to receive 512-byte IDE Information
    8787;       CS:BP:  Ptr to IDEVARS
    8888;   Returns:
     
    109109;       BH:     Default system timer ticks for timeout (can be ignored)
    110110;       BL:     IDE Status Register bit to poll after command
    111 ;       ES:SI:  Ptr to normalized buffer (for data transfer commands)
     111;       ES:SI:  Ptr to buffer (for data transfer commands)
    112112;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    113113;       SS:BP:  Ptr to IDEPACK
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm

    r474 r480  
    8888
    8989%ifdef MODULE_8BIT_IDE
    90     ; We set XT-CF to 8-bit PIO mode for Identify Device command.
    91     ; Correct XT-CF mode is later set on AH=09h (after all drives are detected).
    92     call    AccessDPT_IsThisDeviceXTCF
    93     jne     SHORT .SkipXTCFmodeChange
    94 
     90    ; Enable 8-bit PIO mode for 8-bit ATA and XT-CF
     91    push    si
     92    call    AH9h_Enable8bitModeForDevice8bitAta
    9593    xor     al, al                      ; XTCF_8BIT_PIO_MODE
    96     push    si
    97     call    AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL
     94    call    AH9h_SetModeFromALtoXTCF
    9895    pop     si
    99     jc      SHORT .FailedToSet8bitMode
    100 .SkipXTCFmodeChange:
    10196%endif ; MODULE_8BIT_IDE
    10297
     
    178173    jne     SHORT .WaitUntilNonTransferCommandCompletes
    179174%ifdef MODULE_8BIT_IDE
    180     cmp     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
    181     je      SHORT .StartDmaTransfer
    182     ja      SHORT JrIdeTransfer_StartWithCommandInAL    ; DEVICE_8BIT_XTCF_MEMMAP or DEVICE_8BIT_JRIDE_ISA
     175    cmp     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_MEMMAP
     176    jae     SHORT JrIdeTransfer_StartWithCommandInAL    ; DEVICE_8BIT_XTCF_MEMMAP or DEVICE_8BIT_JRIDE_ISA
     177%endif
    183178    jmp     IdeTransfer_StartWithCommandInAL
    184 .StartDmaTransfer:
    185     jmp     IdeDmaTransfer_StartWithCommandInAL
    186 %else
    187     jmp     IdeTransfer_StartWithCommandInAL
    188 %endif
    189179
    190180.WaitUntilNonTransferCommandCompletes:
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm

    r473 r480  
    215215;       AX, BX, CX
    216216;--------------------------------------------------------------------
    217 %ifdef USE_186  ; Also used by XTIDE rev 2 when 80186/80188 commands allowed
    218 ALIGN JUMP_ALIGN
     217ALIGN JUMP_ALIGN
     218%ifdef USE_186
    219219IdePioBlock_ReadFromXtideRev2:
     220%endif
    220221IdePioBlock_ReadFrom16bitDataPort:
    221222    xchg    cl, ch      ; Sectors to WORDs
    222     rep insw
    223     ret
    224 %endif
    225 
    226 ;--------------------------------------------------------------------
    227 %ifdef USE_AT
     223    rep
     224    db      6Dh         ; INSW
     225    ret
     226
     227;--------------------------------------------------------------------
    228228ALIGN JUMP_ALIGN
    229229IdePioBlock_ReadFrom32bitDataPort:
    230     shl     cx, 7       ; Sectors to DWORDs
     230    db      0C1h        ; SHL
     231    db      0E1h        ; CX
     232    db      7           ; 7 (Sectors to DWORDs)
    231233    rep
    232234    db      66h         ; Override operand size to 32-bit
    233235    db      6Dh         ; INSW/INSD
    234236    ret
    235 %endif
    236237
    237238
     
    248249;       AX, BX, CX, DX
    249250;--------------------------------------------------------------------
    250 %ifdef USE_AT
    251 
    252251ALIGN JUMP_ALIGN
    253252IdePioBlock_WriteTo16bitDataPort:
    254253    xchg    cl, ch      ; Sectors to WORDs
    255254    es                  ; Source is ES segment
    256     rep outsw
     255    rep
     256    db      6Fh         ; OUTSW
    257257    ret
    258258
     
    260260ALIGN JUMP_ALIGN
    261261IdePioBlock_WriteTo32bitDataPort:
    262     shl     cx, 7       ; Sectors to DWORDs
     262    db      0C1h        ; SHL
     263    db      0E1h        ; CX
     264    db      7           ; 7 (Sectors to DWORDs)
    263265    es                  ; Source is ES segment
    264266    rep
     
    266268    db      6Fh         ; OUTSW/OUTSD
    267269    ret
    268 
    269 %endif ; USE_AT
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r473 r480  
    3838;       AL:     IDE command that was used to start the transfer
    3939;               (all PIO read and write commands including Identify Device)
    40 ;       ES:SI:  Ptr to normalized data buffer
     40;       ES:SI:  Ptr to data buffer
    4141;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    4242;       SS:BP:  Ptr to IDEPACK
     
    6262;   Parameters:
    6363;       AH:     Number of sectors to transfer (1...128)
    64 ;       ES:SI:  Normalized ptr to buffer to receive data
     64;       ES:SI:  Ptr to buffer to receive data
    6565;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    6666;       SS:BP:  Ptr to PIOVARS
     
    139139;       AH:     Number of sectors to transfer (1...128)
    140140;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    141 ;       ES:SI:  Normalized ptr to buffer containing data
     141;       ES:SI:  Ptr to buffer containing data
    142142;       SS:BP:  Ptr to PIOVARS
    143143;   Returns:
     
    198198;       BX:     Offset to transfer function lookup table
    199199;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     200;       ES:SI:  Ptr to data buffer
    200201;       SS:BP:  Ptr to PIOVARS
    201202;   Returns:
     
    217218    xchg    ax, bx                              ; Lookup table offset to AX
    218219    mov     bl, [di+DPT_ATA.bDevice]
     220%ifdef MODULE_8BIT_IDE
     221    mov     dl, bl
     222%endif
    219223    add     bx, ax
    220224    mov     ax, [cs:bx]                         ; Load offset to transfer function
    221225    mov     [bp+PIOVARS.fnXfer], ax
    222     ret
    223 
     226
     227    ; Normalize pointer for PIO-transfers and convert to physical address for DMA transfers
     228%ifdef MODULE_8BIT_IDE
     229    cmp     dl, DEVICE_8BIT_XTCF_DMA
     230    jb      SHORT IdeTransfer_NormalizePointerInESSI
     231
     232    ; Convert ES:SI to physical address
     233    xor     dx, dx
     234    mov     ax, es
     235%rep 4
     236    shl     ax, 1
     237    rcl     dx, 1
     238%endrep
     239    add     si, ax
     240    adc     dl, dh
     241    mov     es, dx
     242    ret
     243%endif ; MODULE_8BIT_IDE
     244    ; Fall to IdeTransfer_NormalizePointerInESSI if no MODULE_8BIT_IDE
     245
     246
     247;--------------------------------------------------------------------
     248; IdeTransfer_NormalizePointerInESSI
     249;   Parameters:
     250;       ES:SI:  Ptr to be normalized
     251;   Returns:
     252;       ES:SI:  Normalized pointer (SI = 0...15)
     253;   Corrupts registers:
     254;       AX, DX
     255;--------------------------------------------------------------------
     256IdeTransfer_NormalizePointerInESSI:
     257    NORMALIZE_FAR_POINTER   es, si, ax, dx
     258    ret
    224259
    225260
     
    227262ALIGN WORD_ALIGN
    228263g_rgfnPioRead:
    229 %ifdef USE_AT
    230264        dw      IdePioBlock_ReadFrom16bitDataPort   ; 0, DEVICE_16BIT_ATA
    231265        dw      IdePioBlock_ReadFrom32bitDataPort   ; 1, DEVICE_32BIT_ATA
    232 %else
    233         dd      0
    234 %endif
    235 %ifdef MODULE_8BIT_IDE
    236         dw      IdePioBlock_ReadFromXtideRev1       ; 2, DEVICE_8BIT_XTIDE_REV1
    237     %ifndef USE_AT
    238         g_rgfnPioWrite:
    239     %endif
    240         dw      IdePioBlock_ReadFromXtideRev2       ; 3, DEVICE_8BIT_XTIDE_REV2
    241         dw      IdePioBlock_ReadFrom8bitDataPort    ; 4, DEVICE_8BIT_XTCF_PIO8
    242 %endif
    243 
    244 %ifdef USE_AT
     266%ifdef MODULE_8BIT_IDE
     267        dw      IdePioBlock_ReadFrom8bitDataPort    ; 2, DEVICE_8BIT_ATA
     268        dw      IdePioBlock_ReadFromXtideRev1       ; 3, DEVICE_8BIT_XTIDE_REV1     
     269        dw      IdePioBlock_ReadFromXtideRev2       ; 4, DEVICE_8BIT_XTIDE_REV2
     270        dw      IdePioBlock_ReadFrom8bitDataPort    ; 5, DEVICE_8BIT_XTCF_PIO8
     271        dw      IdeDmaBlock_ReadFromXTCF            ; 6, DEVICE_8BIT_XTCF_DMA
     272%endif
     273
     274
    245275g_rgfnPioWrite:
    246276        dw      IdePioBlock_WriteTo16bitDataPort    ; 0, DEVICE_16BIT_ATA
    247277        dw      IdePioBlock_WriteTo32bitDataPort    ; 1, DEVICE_32BIT_ATA
    248 %endif
    249 %ifdef MODULE_8BIT_IDE
    250         dw      IdePioBlock_WriteToXtideRev1        ; 2, DEVICE_8BIT_XTIDE_REV1
    251         dw      IdePioBlock_WriteToXtideRev2        ; 3, DEVICE_8BIT_XTIDE_REV2
    252         dw      IdePioBlock_WriteTo8bitDataPort     ; 4, DEVICE_8BIT_XTCF_PIO8
    253 %endif
     278%ifdef MODULE_8BIT_IDE
     279        dw      IdePioBlock_WriteTo8bitDataPort     ; 2, DEVICE_8BIT_ATA
     280        dw      IdePioBlock_WriteToXtideRev1        ; 3, DEVICE_8BIT_XTIDE_REV1
     281        dw      IdePioBlock_WriteToXtideRev2        ; 4, DEVICE_8BIT_XTIDE_REV2
     282        dw      IdePioBlock_WriteTo8bitDataPort     ; 5, DEVICE_8BIT_XTCF_PIO8
     283        dw      IdeDmaBlock_WriteToXTCF             ; 6, DEVICE_8BIT_XTCF_DMA
     284%endif
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/JrIdeTransfer.asm

    r476 r480  
    3939;       AL:     IDE command that was used to start the transfer
    4040;               (all PIO read and write commands including Identify Device)
    41 ;       ES:SI:  Ptr to normalized data buffer
     41;       ES:SI:  Ptr to data buffer
    4242;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    4343;       SS:BP:  Ptr to IDEPACK
     
    6161    mov     [bp+MEMPIOVARS.fpDPT], di
    6262    mov     [bp+MEMPIOVARS.fpDPT+2], ds
     63
     64    ; Normalize pointer
     65    call    IdeTransfer_NormalizePointerInESSI
    6366
    6467    ; Get far pointer to Sector Access Window
  • trunk/XTIDE_Universal_BIOS/Src/Device/Idepack.asm

    r477 r480  
    7474    mov     [bp+IDEPACK.bDrvAndHead], al
    7575
    76     ; Normalize data buffer pointer to ES:SI
    77 %ifdef MODULE_8BIT_IDE
    78     cmp     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
    79     jne     SHORT .NormalizeForSmallestPossibleOffset
    80 
    81     ; DMA transfers do not need to normalize pointer
    82     ; (it will be converted to physical address in IdeDmaTransfer.asm)
     76    ; Load data buffer pointer to ES:SI
    8377    les     si, [es:si+DAP.dwMemoryAddress]
    84     jmp     SHORT GetDeviceControlByteToIdepackAndStartTransfer
    85 %endif ; MODULE_8BIT_IDE
    86 
    87 .NormalizeForSmallestPossibleOffset:
    88     mov     ax, [es:si+DAP.wOffset]
    89     mov     cx, ax
    90     eSHR_IM ax, 4                               ; Divide offset by 16
    91     add     ax, [es:si+DAP.wSegment]            ; Add segment
    92     mov     es, ax                              ; Segment normalized
    93     mov     si, cx
    94     and     si, BYTE 0Fh                        ; Offset normalized
    9578    jmp     SHORT GetDeviceControlByteToIdepackAndStartTransfer
    9679%endif ; MODULE_EBIOS
  • trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm

    r376 r480  
    6161
    6262.readOrWrite:
     63        call    IdeTransfer_NormalizePointerInESSI
    6364        mov     [bp+IDEPACK.bFeatures],ah       ; store protocol command
    6465               
Note: See TracChangeset for help on using the changeset viewer.