Changeset 623 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device/IDE


Ignore:
Timestamp:
Jun 15, 2022, 2:48:59 PM (2 years ago)
Author:
Krister Nordvall
Message:

Changes:

  • Reversed the change to IdeDPT.asm in r622 as it didn't work as intended.
  • Reordered some procedures to reduce alignment padding.
  • Added two new defines (EXTRA_LOOP_UNROLLING_SMALL and EXTRA_LOOP_UNROLLING_LARGE) that should improve transfer speeds for some hardware combinations, specifically 808x CPUs with any IDE controller using port I/O and any CPU with XT-IDE controllers.
  • Added a new define (USE_086) for use with 8086 and V30 CPUs only. Unlike the other USE_x86 defines, this define will not change the instruction set used and is therefore compatible with all CPUs. However, it will apply padding to make jump destinations WORD aligned which should improve performance on 8086/V30 CPUs but on 8088/V20 CPUs there is no benefit and, in addition to wasting ROM space, it might in fact be slower on these machines. Since the vast majority of XT class machines are using 8088/V20 CPUs this define is not used in the official XT builds - it's primarily intended for custom BIOS builds.
  • XTIDECFG: The URL to the support forum has been updated.
Location:
trunk/XTIDE_Universal_BIOS/Src/Device/IDE
Files:
2 edited

Legend:

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

    r622 r623  
    133133    mov     [di+DPT_ADVANCED_ATA.wMinPioCycleTime], bx
    134134
    135     ; We have detected 32-bit controller so change Device Type since
    136     ; it might have been set to 16-bit on IDEVARS
    137     ;
    138     ; Change to 32-bit on 386 builds only. We leave AT builds unchanged for faster troubleshooting
    139     ; and for uncommon systems, like IBM 486SLC2 processors that can have VLB motherboard even though
    140     ; the IBM 486SLC2 is externally 16-bit CPU
     135    ; We have detected 32-bit controller so change Device Type
     136    ; since it might have been set to 16-bit on IDEVARS
    141137.ChangeTo32bitDevice:
    142 %ifdef USE_386
     138    ; *FIXME* We might need to add code to detect the IBM 486SLC2 CPU (and possibly other
     139    ; 386+ class CPUs with a 16-bit external bus?) to avoid changing to DEVICE_32BIT_ATA.
    143140    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_32BIT_ATA
    144 %endif
    145141.NoAdvancedControllerDetected:
    146142%endif  ; MODULE_ADVANCED_ATA
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm

    r601 r623  
    4343ALIGN JUMP_ALIGN
    4444IdePioBlock_ReadFromXtideRev1:
    45     UNROLL_SECTORS_IN_CX_TO_OWORDS
     45%ifdef EXTRA_LOOP_UNROLLING_LARGE
     46    UNROLL_SECTORS_IN_CX_TO_32WORDS
     47%elifdef EXTRA_LOOP_UNROLLING_SMALL
     48    UNROLL_SECTORS_IN_CX_TO_16WORDS
     49%else
     50    UNROLL_SECTORS_IN_CX_TO_OWORDS
     51%endif
    4652    mov     bl, 8       ; Bit mask for toggling data low/high reg
    4753ALIGN JUMP_ALIGN
    48 .InswLoop:
    49     %rep 8  ; WORDs
     54.NextIteration:
     55%ifdef EXTRA_LOOP_UNROLLING_LARGE
     56    %rep 32 ; WORDs
    5057        XTIDE_INSW
    5158    %endrep
    52     loop    .InswLoop
     59    dec     cx
     60%ifdef USE_386
     61    jnz     .NextIteration
     62%else
     63    jz      SHORT .BlockTransferred
     64    jmp     .NextIteration
     65
     66ALIGN JUMP_ALIGN
     67.BlockTransferred:
     68%endif
     69%elifdef EXTRA_LOOP_UNROLLING_SMALL
     70    %rep 16 ; WORDs
     71        XTIDE_INSW
     72    %endrep
     73%ifdef USE_186
     74    loop    .NextIteration
     75%else
     76    dec     cx
     77    jz      SHORT .BlockTransferred
     78    jmp     .NextIteration
     79
     80ALIGN JUMP_ALIGN
     81.BlockTransferred:
     82%endif
     83%else
     84    %rep 8  ; WORDs
     85        XTIDE_INSW
     86    %endrep
     87    loop    .NextIteration
     88%endif
    5389    ret
    5490
     
    67103ALIGN JUMP_ALIGN
    68104IdePioBlock_ReadFromXtideRev2_Olivetti:
    69     UNROLL_SECTORS_IN_CX_TO_OWORDS
    70 ALIGN JUMP_ALIGN
    71 .InswLoop:
    72     %rep 8  ; WORDs
     105%ifdef EXTRA_LOOP_UNROLLING_LARGE
     106    UNROLL_SECTORS_IN_CX_TO_32WORDS
     107%elifdef EXTRA_LOOP_UNROLLING_SMALL
     108    UNROLL_SECTORS_IN_CX_TO_16WORDS
     109%else
     110    UNROLL_SECTORS_IN_CX_TO_OWORDS
     111%endif
     112ALIGN JUMP_ALIGN
     113.NextIteration:
     114%ifdef EXTRA_LOOP_UNROLLING_LARGE
     115    %rep 32 ; WORDs
    73116        XTIDE_MOD_OLIVETTI_INSW
    74117    %endrep
    75     loop    .InswLoop
     118    dec     cx
     119%ifdef USE_386
     120    jnz     .NextIteration
     121%else
     122    jz      SHORT .BlockTransferred
     123    jmp     .NextIteration
     124
     125ALIGN JUMP_ALIGN
     126.BlockTransferred:
     127%endif
     128%elifdef EXTRA_LOOP_UNROLLING_SMALL
     129    %rep 16 ; WORDs
     130        XTIDE_MOD_OLIVETTI_INSW
     131    %endrep
     132    loop    .NextIteration
     133%else
     134    %rep 8  ; WORDs
     135        XTIDE_MOD_OLIVETTI_INSW
     136    %endrep
     137    loop    .NextIteration
     138%endif
    76139    ret
    77140
     
    96159    rep insb
    97160    ret
     161
    98162%else ; 808x
    99     UNROLL_SECTORS_IN_CX_TO_OWORDS
    100 ALIGN JUMP_ALIGN
    101 .ReadNextOword:
     163%ifdef EXTRA_LOOP_UNROLLING_LARGE
     164    UNROLL_SECTORS_IN_CX_TO_32WORDS
     165%elifdef EXTRA_LOOP_UNROLLING_SMALL
     166    UNROLL_SECTORS_IN_CX_TO_16WORDS
     167%else
     168    UNROLL_SECTORS_IN_CX_TO_OWORDS
     169%endif
     170ALIGN JUMP_ALIGN
     171.NextIteration:
     172%ifdef EXTRA_LOOP_UNROLLING_LARGE
     173    %rep 64 ; BYTEs
     174        in      al, dx  ; Read BYTE
     175        stosb           ; Store BYTE to [ES:DI]
     176    %endrep
     177    dec     cx
     178    jz      SHORT .BlockTransferred
     179    jmp     .NextIteration
     180
     181ALIGN JUMP_ALIGN
     182.BlockTransferred:
     183%elifdef EXTRA_LOOP_UNROLLING_SMALL
     184    %rep 32 ; BYTEs
     185        in      al, dx  ; Read BYTE
     186        stosb           ; Store BYTE to [ES:DI]
     187    %endrep
     188    loop    .NextIteration
     189%else
    102190    %rep 16 ; BYTEs
    103191        in      al, dx  ; Read BYTE
    104192        stosb           ; Store BYTE to [ES:DI]
    105193    %endrep
    106     loop    .ReadNextOword
     194    loop    .NextIteration
     195%endif
    107196    ret
    108197%endif
     
    132221
    133222%else ; 808x
    134     UNROLL_SECTORS_IN_CX_TO_OWORDS
    135 ALIGN JUMP_ALIGN
    136 .ReadNextOword:
    137     %rep 8  ; WORDs
     223%ifdef EXTRA_LOOP_UNROLLING_LARGE
     224    UNROLL_SECTORS_IN_CX_TO_32WORDS
     225%elifdef EXTRA_LOOP_UNROLLING_SMALL
     226    UNROLL_SECTORS_IN_CX_TO_16WORDS
     227%else
     228    UNROLL_SECTORS_IN_CX_TO_OWORDS
     229%endif
     230ALIGN JUMP_ALIGN
     231.NextIteration:
     232%ifdef EXTRA_LOOP_UNROLLING_LARGE
     233    %rep 32 ; WORDs
    138234        in      ax, dx  ; Read WORD
    139235        stosw           ; Store WORD to [ES:DI]
    140236    %endrep
    141     loop    .ReadNextOword
     237%elifdef EXTRA_LOOP_UNROLLING_SMALL
     238    %rep 16 ; WORDs
     239        in      ax, dx  ; Read WORD
     240        stosw           ; Store WORD to [ES:DI]
     241    %endrep
     242%else
     243    %rep 8  ; WORDs
     244        in      ax, dx  ; Read WORD
     245        stosw           ; Store WORD to [ES:DI]
     246    %endrep
     247%endif
     248    loop    .NextIteration
    142249    ret
    143250%endif
     
    174281ALIGN JUMP_ALIGN
    175282IdePioBlock_WriteToXtideRev1:
     283%ifdef EXTRA_LOOP_UNROLLING_LARGE
     284    UNROLL_SECTORS_IN_CX_TO_16WORDS
     285%elifdef EXTRA_LOOP_UNROLLING_SMALL
     286    UNROLL_SECTORS_IN_CX_TO_OWORDS
     287%else
    176288    UNROLL_SECTORS_IN_CX_TO_QWORDS
     289%endif
    177290    mov     bl, 8       ; Bit mask for toggling data low/high reg
    178291ALIGN JUMP_ALIGN
    179 .OutswLoop:
     292.NextIteration:
     293%ifdef EXTRA_LOOP_UNROLLING_LARGE
     294    %rep 16 ; WORDs
     295        XTIDE_OUTSW
     296    %endrep
     297%ifdef USE_186
     298    loop    .NextIteration
     299%else
     300    dec     cx
     301    jz      SHORT .BlockTransferred
     302    jmp     .NextIteration
     303
     304ALIGN JUMP_ALIGN
     305.BlockTransferred:
     306%endif
     307%elifdef EXTRA_LOOP_UNROLLING_SMALL
     308    %rep 8  ; WORDs
     309        XTIDE_OUTSW
     310    %endrep
     311    loop    .NextIteration
     312%else
    180313    %rep 4  ; WORDs
    181314        XTIDE_OUTSW
    182315    %endrep
    183     loop    .OutswLoop
     316    loop    .NextIteration
     317%endif
    184318    ret
    185319
     
    198332ALIGN JUMP_ALIGN
    199333IdePioBlock_WriteToXtideRev2:
     334%ifdef EXTRA_LOOP_UNROLLING_LARGE
     335    UNROLL_SECTORS_IN_CX_TO_16WORDS
     336%elifdef EXTRA_LOOP_UNROLLING_SMALL
     337    UNROLL_SECTORS_IN_CX_TO_OWORDS
     338%else
    200339    UNROLL_SECTORS_IN_CX_TO_QWORDS
    201 ALIGN JUMP_ALIGN
    202 .WriteNextQword:
     340%endif
     341ALIGN JUMP_ALIGN
     342.NextIteration:
     343%ifdef EXTRA_LOOP_UNROLLING_LARGE
     344    %rep 16 ; WORDs
     345        XTIDE_MOD_OUTSW
     346    %endrep
     347%ifdef USE_186
     348    loop    .NextIteration
     349%else
     350    dec     cx
     351    jz      SHORT .BlockTransferred
     352    jmp     .NextIteration
     353
     354ALIGN JUMP_ALIGN
     355.BlockTransferred:
     356%endif
     357%elifdef EXTRA_LOOP_UNROLLING_SMALL
     358    %rep 8  ; WORDs
     359        XTIDE_MOD_OUTSW
     360    %endrep
     361    loop    .NextIteration
     362%else
    203363    %rep 4  ; WORDs
    204364        XTIDE_MOD_OUTSW
    205365    %endrep
    206     loop    .WriteNextQword
     366    loop    .NextIteration
     367%endif
    207368    ret
    208369
     
    227388
    228389%else ; 808x
     390%ifdef EXTRA_LOOP_UNROLLING_LARGE
     391    UNROLL_SECTORS_IN_CX_TO_16WORDS
     392%elifdef EXTRA_LOOP_UNROLLING_SMALL
     393    UNROLL_SECTORS_IN_CX_TO_OWORDS
     394%else
    229395    UNROLL_SECTORS_IN_CX_TO_QWORDS
    230 ALIGN JUMP_ALIGN
    231 .WriteNextQword:
     396%endif
     397ALIGN JUMP_ALIGN
     398.NextIteration:
     399%ifdef EXTRA_LOOP_UNROLLING_LARGE
     400    %rep 32 ; BYTEs
     401        lodsb           ; Load BYTE from [DS:SI]
     402        out     dx, al  ; Write BYTE
     403    %endrep
     404%elifdef EXTRA_LOOP_UNROLLING_SMALL
     405    %rep 16 ; BYTEs
     406        lodsb           ; Load BYTE from [DS:SI]
     407        out     dx, al  ; Write BYTE
     408    %endrep
     409%else
    232410    %rep 8  ; BYTEs
    233411        lodsb           ; Load BYTE from [DS:SI]
    234412        out     dx, al  ; Write BYTE
    235413    %endrep
    236     loop    .WriteNextQword
     414%endif
     415    loop    .NextIteration
    237416    ret
    238417%endif
     
    260439
    261440%else ; 808x
     441%ifdef EXTRA_LOOP_UNROLLING_LARGE
     442    UNROLL_SECTORS_IN_CX_TO_16WORDS
     443%elifdef EXTRA_LOOP_UNROLLING_SMALL
     444    UNROLL_SECTORS_IN_CX_TO_OWORDS
     445%else
    262446    UNROLL_SECTORS_IN_CX_TO_QWORDS
    263 ALIGN JUMP_ALIGN
    264 .WriteNextQword:
     447%endif
     448ALIGN JUMP_ALIGN
     449.NextIteration:
     450%ifdef EXTRA_LOOP_UNROLLING_LARGE
     451    %rep 16 ; WORDs
     452        lodsw           ; Load WORD from [DS:SI]
     453        out     dx, ax  ; Write WORD
     454    %endrep
     455%elifdef EXTRA_LOOP_UNROLLING_SMALL
     456    %rep 8  ; WORDs
     457        lodsw           ; Load WORD from [DS:SI]
     458        out     dx, ax  ; Write WORD
     459    %endrep
     460%else
    265461    %rep 4  ; WORDs
    266462        lodsw           ; Load WORD from [DS:SI]
    267463        out     dx, ax  ; Write WORD
    268464    %endrep
    269     loop    .WriteNextQword
     465%endif
     466    loop    .NextIteration
    270467    ret
    271468%endif
Note: See TracChangeset for help on using the changeset viewer.