Changeset 444 in xtideuniversalbios


Ignore:
Timestamp:
Aug 28, 2012, 4:05:55 PM (12 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Added XT-CF transfer functions for 80188/80186 and later.
  • XT-CF drive detection timeouts are now the same as for other controllers.
Location:
trunk/XTIDE_Universal_BIOS
Files:
5 edited

Legend:

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

    r432 r444  
    2727; Polling timeout delays (system timer ticks, 1 tick = 54.9 ms)
    2828TIMEOUT_DRQ             EQU     255         ;   14 s (some CF cards occasionally have long write delays)
    29 TIMEOUT_IDENTIFY_DEVICE EQU     (500/55)    ;  500 ms
     29TIMEOUT_SELECT_DRIVE_DURING_DRIVE_DETECTION EQU (500/55)    ;  500 ms
    3030TIMEOUT_MOTOR_STARTUP   EQU     (10000/55)  ;   10 s
    3131TIMEOUT_MAXIMUM         EQU     255         ; We would actually want 31 seconds here but I don't think there are so slow drives
  • trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc

    r443 r444  
    3737    .wNewStackOffset    resb    2
    3838%endif
     39    .wDrvDetectSignature:           ; Signature when BIOS is in drive detection mode
    3940    .fpOldI13h          resb    4   ; Far pointer to old INT 13h handler
    40     .wSignature         resb    2   ; Sign for finding stolen 1 kiB
     41    .wSignature         resb    2   ; Sign for finding stolen 1...64 kiB
    4142    .bTimeoutTicksLeft  resb    1
    4243    .bLastTimeoutUpdate resb    1
     
    5354%endif
    5455endstruc
     56
     57; Note!!! .wDrvDetectSignature and .wSignature are intentionally in different locations.
     58RAMVARS_RAM_SIGNATURE           EQU "Xu"    ; RAMVARS signature for .wSignature
     59RAMVARS_DRV_DETECT_SIGNATURE    EQU 5A5Ah   ; Signature when BIOS is in drive detection mode
     60
    5561
    5662
     
    8389%endif
    8490
    85 RAMVARS_SIGNATURE       EQU "Xu"    ; RAMVARS signature for .wSignature
     91
    8692
    8793;
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm

    r443 r444  
    203203ALIGN JUMP_ALIGN
    204204IdeCommand_SelectDrive:
    205 %if 0
    206     ; Wait until neither Master or Slave Drive is busy
    207     mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY)
    208     cmp     BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE
    209     eCMOVE  bh, TIMEOUT_IDENTIFY_DEVICE
    210     call    IdeWait_PollStatusFlagInBLwithTimeoutInBH
    211 %endif
     205    ; We use different timeout value when detecting drives.
     206    ; This prevents unnecessary long delays when drive is not present.
     207    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
     208    cmp     WORD [RAMVARS.wDrvDetectSignature], RAMVARS_DRV_DETECT_SIGNATURE
     209    eCMOVE  bh, TIMEOUT_SELECT_DRIVE_DURING_DRIVE_DETECTION
    212210
    213211    ; Select Master or Slave Drive
    214212    mov     al, [bp+IDEPACK.bDrvAndHead]
    215213    OUTPUT_AL_TO_IDE_REGISTER   DRIVE_AND_HEAD_SELECT_REGISTER
    216     mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
    217     cmp     BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE
    218     eCMOVE  bh, TIMEOUT_IDENTIFY_DEVICE
    219214    call    IdeWait_PollStatusFlagInBLwithTimeoutInBH
    220215
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r442 r444  
    228228; ReadBlockFromXtideRev1        XTIDE rev 1
    229229; ReadBlockFromXtideRev2        XTIDE rev 2 or rev 1 with swapped A0 and A3 (chuck-mod)
     230; ReadBlockFrom8bitDataPort     CF-XT when using 8-bit PIO
    230231; ReadBlockFrom16bitDataPort    Normal 16-bit IDE
    231232; ReadBlockFrom32bitDataPort    VLB/PCI 32-bit IDE
     
    241242%ifdef MODULE_8BIT_IDE
    242243
    243 ALIGN JUMP_ALIGN
    244 ReadBlockFromXtideRev1:
    245     UNROLL_SECTORS_IN_CX_TO_QWORDS
    246     mov     bl, 8       ; Bit mask for toggling data low/high reg
    247 ALIGN JUMP_ALIGN
    248 .InswLoop:
    249     XTIDE_INSW
    250     XTIDE_INSW
    251     XTIDE_INSW
    252     XTIDE_INSW
    253     loop    .InswLoop
    254     ret
    255 
    256 ;--------------------------------------------------------------------
    257 %ifndef USE_186         ; 8086/8088 compatible WORD read
    258 ALIGN JUMP_ALIGN
    259 ReadBlockFromXtideRev2:
    260     UNROLL_SECTORS_IN_CX_TO_QWORDS
    261 ALIGN JUMP_ALIGN
    262 .ReadNextQword:
    263     in      ax, dx      ; Read 1st WORD
    264     stosw               ; Store 1st WORD to [ES:DI]
    265     in      ax, dx
    266     stosw               ; 2nd
    267     in      ax, dx
    268     stosw               ; 3rd
    269     in      ax, dx
    270     stosw               ; 4th
    271     loop    .ReadNextQword
    272     ret
    273 %endif
    274 
    275 ;--------------------------------------------------------------------
    276 ALIGN JUMP_ALIGN
    277 ReadBlockFromXTCF:
    278     UNROLL_SECTORS_IN_CX_TO_DWORDS
    279 ALIGN JUMP_ALIGN
    280 .ReadNextDword:
    281     in      al, dx      ; Read 1st BYTE
    282     stosb               ; Store 1st BYTE to [ES:DI]
    283     in      al, dx
    284     stosb
    285 
    286     in      al, dx
    287     stosb
    288     in      al, dx
    289     stosb
    290     loop    .ReadNextDword
    291     ret
    292 
     244    ALIGN JUMP_ALIGN
     245    ReadBlockFromXtideRev1:
     246        UNROLL_SECTORS_IN_CX_TO_QWORDS
     247        mov     bl, 8       ; Bit mask for toggling data low/high reg
     248    ALIGN JUMP_ALIGN
     249    .InswLoop:
     250        XTIDE_INSW
     251        XTIDE_INSW
     252        XTIDE_INSW
     253        XTIDE_INSW
     254        loop    .InswLoop
     255        ret
     256
     257    ;--------------------------------------------------------------------
     258    %ifndef USE_186         ; 8086/8088 compatible WORD read
     259        ALIGN JUMP_ALIGN
     260        ReadBlockFromXtideRev2:
     261            UNROLL_SECTORS_IN_CX_TO_QWORDS
     262        ALIGN JUMP_ALIGN
     263        .ReadNextQword:
     264            in      ax, dx      ; Read 1st WORD
     265            stosw               ; Store 1st WORD to [ES:DI]
     266            in      ax, dx
     267            stosw               ; 2nd
     268            in      ax, dx
     269            stosw               ; 3rd
     270            in      ax, dx
     271            stosw               ; 4th
     272            loop    .ReadNextQword
     273            ret
     274    %endif
     275
     276    ;--------------------------------------------------------------------
     277    %ifdef USE_186
     278        ALIGN JUMP_ALIGN
     279        ReadBlockFrom8bitDataPort:
     280            shl     cx, 9       ; Sectors to BYTEs
     281            rep insb
     282            ret
     283
     284    %else ; If 8088/8086
     285            ALIGN JUMP_ALIGN
     286        ReadBlockFrom8bitDataPort:
     287            UNROLL_SECTORS_IN_CX_TO_DWORDS
     288        ALIGN JUMP_ALIGN
     289        .ReadNextDword:
     290            in      al, dx      ; Read 1st BYTE
     291            stosb               ; Store 1st BYTE to [ES:DI]
     292            in      al, dx
     293            stosb
     294
     295            in      al, dx
     296            stosb
     297            in      al, dx
     298            stosb
     299            loop    .ReadNextDword
     300            ret
     301    %endif
    293302%endif  ; MODULE_8BIT_IDE
    294303
    295304;--------------------------------------------------------------------
    296305%ifdef USE_186
    297 ALIGN JUMP_ALIGN
    298 ReadBlockFrom16bitDataPort:
    299     xchg    cl, ch      ; Sectors to WORDs
    300     rep
    301     db      6Dh         ; INSW (we want this in XT build)
    302     ret
     306    ALIGN JUMP_ALIGN
     307    ReadBlockFrom16bitDataPort:
     308        xchg    cl, ch      ; Sectors to WORDs
     309        rep insw
     310        ret
    303311%endif
    304312
    305313;--------------------------------------------------------------------
    306314%ifdef USE_AT
    307 ALIGN JUMP_ALIGN
    308 ReadBlockFrom32bitDataPort:
    309     db      0C1h        ; SHL
    310     db      0E1h        ; CX
    311     db      7           ; 7 (Sectors to DWORDs)
    312     rep
    313     db      66h         ; Override operand size to 32-bit
    314     db      6Dh         ; INSW/INSD
    315     ret
     315    ALIGN JUMP_ALIGN
     316    ReadBlockFrom32bitDataPort:
     317        shl     cx, 7       ; Sectors to DWORDs
     318        rep
     319        db      66h         ; Override operand size to 32-bit
     320        db      6Dh         ; INSW/INSD
     321        ret
    316322%endif
    317323
     
    320326; WriteBlockToXtideRev1         XTIDE rev 1
    321327; WriteBlockToXtideRev2         XTIDE rev 2 or rev 1 with swapped A0 and A3 (chuck-mod)
    322 ; WriteBlockToFastXtide         Fast XTIDE (CPLD v2 project)
     328; WriteBlockTo8bitDataPort      XT-CF when using 8-bit PIO
    323329; WriteBlockTo16bitDataPort     Normal 16-bit IDE
    324330; WriteBlockTo32bitDataPort     VLB/PCI 32-bit IDE
     
    334340%ifdef MODULE_8BIT_IDE
    335341
    336 ALIGN JUMP_ALIGN
    337 WriteBlockToXtideRev1:
    338     push    ds
    339     UNROLL_SECTORS_IN_CX_TO_QWORDS
    340     mov     bl, 8       ; Bit mask for toggling data low/high reg
    341     push    es          ; Copy ES...
    342     pop     ds          ; ...to DS
    343 ALIGN JUMP_ALIGN
    344 .OutswLoop:
    345     XTIDE_OUTSW
    346     XTIDE_OUTSW
    347     XTIDE_OUTSW
    348     XTIDE_OUTSW
    349     loop    .OutswLoop
    350     pop     ds
    351     ret
    352 
    353 ;--------------------------------------------------------------------
    354 ALIGN JUMP_ALIGN
    355 WriteBlockToXtideRev2:
    356     UNROLL_SECTORS_IN_CX_TO_QWORDS
    357     push    ds
    358     push    es          ; Copy ES...
    359     pop     ds          ; ...to DS
    360 ALIGN JUMP_ALIGN
    361 .WriteNextQword:
    362     XTIDE_MOD_OUTSW
    363     XTIDE_MOD_OUTSW
    364     XTIDE_MOD_OUTSW
    365     XTIDE_MOD_OUTSW
    366     loop    .WriteNextQword
    367     pop     ds
    368     ret
    369 
    370 ;--------------------------------------------------------------------
    371 ALIGN JUMP_ALIGN
    372 WriteBlockToXTCF:
    373     UNROLL_SECTORS_IN_CX_TO_DWORDS
    374     push    ds
    375     push    es
    376     pop     ds
    377 ALIGN JUMP_ALIGN
    378 .WriteNextDword:
    379     lodsb               ; Load 1st BYTE from [DS:SI]
    380     out     dx, al      ; Write 1st BYTE
    381     lodsb
    382     out     dx, al
    383 
    384     lodsb
    385     out     dx, al
    386     lodsb
    387     out     dx, al
    388     loop    .WriteNextDword
    389     pop     ds
    390     ret
     342    ALIGN JUMP_ALIGN
     343    WriteBlockToXtideRev1:
     344        push    ds
     345        UNROLL_SECTORS_IN_CX_TO_QWORDS
     346        mov     bl, 8       ; Bit mask for toggling data low/high reg
     347        push    es          ; Copy ES...
     348        pop     ds          ; ...to DS
     349    ALIGN JUMP_ALIGN
     350    .OutswLoop:
     351        XTIDE_OUTSW
     352        XTIDE_OUTSW
     353        XTIDE_OUTSW
     354        XTIDE_OUTSW
     355        loop    .OutswLoop
     356        pop     ds
     357        ret
     358
     359    ;--------------------------------------------------------------------
     360    ALIGN JUMP_ALIGN
     361    WriteBlockToXtideRev2:
     362        UNROLL_SECTORS_IN_CX_TO_QWORDS
     363        push    ds
     364        push    es          ; Copy ES...
     365        pop     ds          ; ...to DS
     366    ALIGN JUMP_ALIGN
     367    .WriteNextQword:
     368        XTIDE_MOD_OUTSW
     369        XTIDE_MOD_OUTSW
     370        XTIDE_MOD_OUTSW
     371        XTIDE_MOD_OUTSW
     372        loop    .WriteNextQword
     373        pop     ds
     374        ret
     375
     376    ;--------------------------------------------------------------------
     377    %ifdef USE_186
     378        ALIGN JUMP_ALIGN
     379        WriteBlockTo8bitDataPort:
     380            shl     cx, 9       ; Sectors to BYTEs
     381            es                  ; Source is ES segment
     382            rep outsb
     383            ret
     384
     385    %else ; If 8088/8086
     386        ALIGN JUMP_ALIGN
     387        WriteBlockTo8bitDataPort:
     388            UNROLL_SECTORS_IN_CX_TO_DWORDS
     389            push    ds
     390            push    es
     391            pop     ds
     392        ALIGN JUMP_ALIGN
     393        .WriteNextDword:
     394            lodsb               ; Load 1st BYTE from [DS:SI]
     395            out     dx, al      ; Write 1st BYTE
     396            lodsb
     397            out     dx, al
     398
     399            lodsb
     400            out     dx, al
     401            lodsb
     402            out     dx, al
     403            loop    .WriteNextDword
     404            pop     ds
     405            ret
     406    %endif
    391407%endif  ; MODULE_8BIT_IDE
    392 
    393408
    394409;--------------------------------------------------------------------
     
    398413    xchg    cl, ch      ; Sectors to WORDs
    399414    es                  ; Source is ES segment
    400     rep
    401     db      6Fh         ; OUTSW (we want this in XT build)
     415    rep outsw
    402416    ret
    403417
     
    405419ALIGN JUMP_ALIGN
    406420WriteBlockTo32bitDataPort:
    407     db      0C1h        ; SHL
    408     db      0E1h        ; CX
    409     db      7           ; 7 (Sectors to DWORDs)
     421    shl     cx, 7       ; Sectors to DWORDs
    410422    es                  ; Source is ES segment
    411423    rep
     
    422434%ifdef MODULE_8BIT_IDE
    423435        dw      0                           ; 0, DEVICE_8BIT_JRIDE_ISA
    424         dw      ReadBlockFromXTCF           ; 1, DEVICE_8BIT_XTCF
     436        dw      ReadBlockFrom8bitDataPort   ; 1, DEVICE_8BIT_XTCF
    425437    %ifdef USE_186
    426438        dw      ReadBlockFrom16bitDataPort  ; 2, DEVICE_8BIT_XTIDE_REV2
     
    442454%ifdef MODULE_8BIT_IDE
    443455        dw      0                           ; 0, DEVICE_8BIT_JRIDE_ISA
    444         dw      WriteBlockToXTCF            ; 1, DEVICE_8BIT_XTCF
     456        dw      WriteBlockTo8bitDataPort    ; 1, DEVICE_8BIT_XTCF
    445457        dw      WriteBlockToXtideRev2       ; 2, DEVICE_XTIDE_REV2
    446458        dw      WriteBlockToXtideRev1       ; 3, DEVICE_XTIDE_REV1
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm

    r433 r444  
    7575    xor     di, di
    7676    call    Memory_ZeroESDIwithSizeInCX
    77     mov     WORD [RAMVARS.wSignature], RAMVARS_SIGNATURE
     77    mov     WORD [RAMVARS.wDrvDetectSignature], RAMVARS_DRV_DETECT_SIGNATURE
     78    mov     WORD [RAMVARS.wSignature], RAMVARS_RAM_SIGNATURE
    7879    ; Fall to .InitializeInt13hStackChangeVariables
    7980
     
    151152    mov     ds, di                  ; EBDA segment to DS
    152153    add     di, BYTE 64             ; DI to next stolen kB
    153     cmp     WORD [RAMVARS.wSignature], RAMVARS_SIGNATURE
     154    cmp     WORD [RAMVARS.wSignature], RAMVARS_RAM_SIGNATURE
    154155    jne     SHORT .LoopStolenKBs    ; Loop until sign found (always found eventually)
    155156    ret
Note: See TracChangeset for help on using the changeset viewer.