Changeset 502 in xtideuniversalbios


Ignore:
Timestamp:
Feb 9, 2013, 5:25:53 PM (8 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to Configurator v2:

  • XT-CF port can be selected again.
  • Auto Configure should now detect Sound Blaster 16 Tertiary and Quaternary IDE.
  • Auto Configure now properly sets Slave Drive variables.
Location:
trunk/XTIDE_Universal_BIOS_Configurator_v2/Src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/AutoConfigure.asm

    r497 r502  
    7070    mov     ax, DISABLE_WRITE_CACHE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) | FLG_DRVPARAMS_BLOCKMODE
    7171    mov     [di+ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags], ax
     72    mov     [di+ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags], ax
     73
    7274    mov     [di+ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags], ax
     75    mov     [di+ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags], ax
     76
    7377    mov     [di+ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags], ax
     78    mov     [di+ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags], ax
     79
    7480    mov     [di+ROMVARS.ideVars3+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags], ax
     81    mov     [di+ROMVARS.ideVars3+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags], ax
    7582    ret
    7683
     
    95102    jz      SHORT .AllPortsAlreadyDetected
    96103    push    cx
    97     call    IdeAutodetect_DetectIdeDeviceFromPortDX
     104    call    IdeAutodetect_DetectIdeDeviceFromPortDXAndReturnControlBlockInCX
     105    mov     bx, cx
    98106    pop     cx
    99107    jc      SHORT .DetectFromNextPort
     
    101109    ; Device found from port DX, Device Type returned in AL
    102110    inc     cx  ; Increment number of controllers found
    103     call    GetControlBlockPortToBXfromDeviceTypeInALandBasePortInDX
    104111    mov     [si+IDEVARS.wBasePort], dx
    105112    mov     [si+IDEVARS.wControlBlockPort], bx
     
    112119    jmp     SHORT .DetectFromNextPort
    113120.AllPortsAlreadyDetected:
    114     ret
    115 
    116 
    117 ;--------------------------------------------------------------------
    118 ; GetControlBlockPortToBXfromDeviceTypeInALandBasePortInDX
    119 ;   Parameters:
    120 ;       AL:     Device Type
    121 ;       DX:     Base port
    122 ;   Returns:
    123 ;       BX:     Control Block Port
    124 ;   Corrupts registers:
    125 ;       Nothing
    126 ;--------------------------------------------------------------------
    127 ALIGN JUMP_ALIGN
    128 GetControlBlockPortToBXfromDeviceTypeInALandBasePortInDX:
    129     mov     bx, dx
    130     cmp     al, DEVICE_8BIT_XTIDE_REV1
    131     jae     SHORT .NonStandardControlBlockPortLocation
    132 
    133     ; Standard IDE Devices
    134     add     bx, STANDARD_CONTROL_BLOCK_OFFSET
    135     ret
    136 
    137 .NonStandardControlBlockPortLocation:
    138     cmp     al, DEVICE_8BIT_JRIDE_ISA
    139     je      SHORT .JrIdeIsaDoesNotNeedControlBlockAddress
    140 
    141     ; 8-bit Devices
    142     add     bx, BYTE XTIDE_CONTROL_BLOCK_OFFSET ; XT-CF also
    143 .JrIdeIsaDoesNotNeedControlBlockAddress:
    144121    ret
    145122
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/IdeAutodetect.asm

    r498 r502  
    2222
    2323;--------------------------------------------------------------------
    24 ; IdeAutodetect_DetectIdeDeviceFromPortDX
     24; IdeAutodetect_DetectIdeDeviceFromPortDXAndReturnControlBlockInCX
    2525;   Parameters:
    2626;       DX:     IDE Base Port
     
    2828;   Returns:
    2929;       AL:     Device Type
     30;       CX:     Control Block Base port (detected since there is no
     31;               standard address for Tetriary and Quaternary IDE controllers)
    3032;       CF:     Clear if IDE Device found
    3133;               Set if IDE Device not found
    3234;   Corrupts registers:
    33 ;       AH, BX, CX
    34 ;--------------------------------------------------------------------
    35 IdeAutodetect_DetectIdeDeviceFromPortDX:
     35;       AH, BX
     36;--------------------------------------------------------------------
     37IdeAutodetect_DetectIdeDeviceFromPortDXAndReturnControlBlockInCX:
    3638    cmp     dx, FIRST_MEMORY_SEGMENT_ADDRESS
    3739    jb      SHORT .DetectPortMappedDevices
    3840
    39     ; Try to detect JR-IDE/ISA (only if MODULE_8BIT_IDE_ADVANCED is present)
     41    ; *** Try to detect JR-IDE/ISA (only if MODULE_8BIT_IDE_ADVANCED is present) ***
    4042    test    WORD [di+ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE_ADVANCED
    4143    jz      SHORT .SkipRestOfDetection
     
    4345    push    ds
    4446    mov     ds, dx
    45     cli                         ; Disable Interrupts
     47    cli                                 ; Disable Interrupts
    4648    mov     ah, [JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET + STATUS_REGISTER_in]
    4749    mov     al, [JRIDE_CONTROL_BLOCK_REGISTER_WINDOW_OFFSET + ALTERNATE_STATUS_REGISTER_in]
    48     sti                         ; Enable Interrupts
     50    sti                                 ; Enable Interrupts
    4951    pop     ds
    5052    call    CompareIdeStatusRegistersFromALandAH
    51     mov     al, DEVICE_8BIT_JRIDE_ISA
    52     ret
     53    mov     al, DEVICE_8BIT_JRIDE_ISA   ; Assume CF was cleared
     54    ret                                 ; No need to return Control Block Port
    5355.DetectPortMappedDevices:
    5456
    5557
    56     ; Try to detect Standard 16- and 32-bit IDE Devices
     58    ; *** Try to detect Standard 16- and 32-bit IDE Devices ***
    5759    mov     bh, DEVICE_16BIT_ATA        ; Assume 16-bit ISA slot for AT builds
    5860    call    Buffers_IsXTbuildLoaded
    5961    eCMOVE  bh, DEVICE_8BIT_ATA         ; Assume 8-bit ISA slot for XT builds
     62
    6063    mov     bl, STATUS_REGISTER_in
    6164    mov     cx, STANDARD_CONTROL_BLOCK_OFFSET + ALTERNATE_STATUS_REGISTER_in
     65.RedetectTertiaryOrQuaternaryWithDifferentAlternativeStatusRegisterPort:
    6266    call    DetectIdeDeviceFromPortDXwithStatusRegOffsetsInBLandCX
    6367    mov     al, bh
    6468    jnc     SHORT .IdeDeviceFound
    6569
     70    ; 16- or 32-bit IDE Device was not found but we may have used wrong Control Block port if we were trying
     71    ; to detect Tertiary or Quaternary IDE controllers. Control Block port location is not standardized. For
     72    ; example Promise FloppyMAX has Control Block at STANDARD_CONTROL_BLOCK_OFFSET but Sound Blaster 16 (CT2290)
     73    ; use DEVICE_ATA_SECONDARY_PORTCTRL for Tertiary and Quaternary even though only Secondary should use that.
     74    cmp     cx, STANDARD_CONTROL_BLOCK_OFFSET + ALTERNATE_STATUS_REGISTER_in
     75    jne     SHORT .AlreadyTriedAlternativeControlBlock
     76    mov     cx, DEVICE_ATA_SECONDARY_PORTCTRL + ALTERNATE_STATUS_REGISTER_in
     77    sub     cx, dx                      ; Offset to add to DX
     78    cmp     dx, DEVICE_ATA_TERTIARY_PORT
     79    je      SHORT .RedetectTertiaryOrQuaternaryWithDifferentAlternativeStatusRegisterPort
     80    cmp     dx, DEVICE_ATA_QUATERNARY_PORT
     81    je      SHORT .RedetectTertiaryOrQuaternaryWithDifferentAlternativeStatusRegisterPort
     82.AlreadyTriedAlternativeControlBlock:
     83
    6684
    6785    ; Detect 8-bit devices only if MODULE_8BIT_IDE is available
     
    6987    jz      SHORT .SkipRestOfDetection
    7088
    71     ; Try to detect XT-CF
     89    ; *** Try to detect XT-CF ***
    7290    mov     bl, STATUS_REGISTER_in << 1
    7391    mov     cx, (XTIDE_CONTROL_BLOCK_OFFSET + ALTERNATE_STATUS_REGISTER_in) << 1
    7492    call    DetectIdeDeviceFromPortDXwithStatusRegOffsetsInBLandCX
     93    rcl     ax, 1                       ; Store CF
     94    shr     cx, 1                       ; XTIDE_CONTROL_BLOCK_OFFSET + ALTERNATE_STATUS_REGISTER_in
     95    rcr     ax, 1                       ; Restore CF
    7596    mov     al, DEVICE_8BIT_XTCF_PIO8
    7697    jnc     SHORT .IdeDeviceFound
    7798
    78     ; Try to detect 8-bit XT-IDE rev 1 or rev 2.
     99
     100    ; *** Try to detect 8-bit XT-IDE rev 1 or rev 2 ***
    79101    ; Note that A0<->A3 address swaps Status Register and Alternative
    80102    ; Status Register addresses. That is why we need another step
    81103    ; to check is this XT-IDE rev 1 or rev 2.
    82     shr     cx, 1
    83104    call    DetectIdeDeviceFromPortDXwithStatusRegOffsetsInBLandCX
    84105    jc      SHORT .SkipRestOfDetection  ; No XT-IDE rev 1 or rev 2 found
     
    99120    je      SHORT .IdeDeviceFound
    100121    mov     al, DEVICE_8BIT_XTIDE_REV1  ; We must have rev 1
    101     clc
    102122.IdeDeviceFound:
     123    sub     cl, ALTERNATE_STATUS_REGISTER_in    ; Clear CF
     124    add     cx, dx                              ; CX = Control Block address
    103125    ret
    104126.SkipRestOfDetection:
     
    156178
    157179    ; Bytes were the same but it is possible they were both FFh, for
    158     ; example. We must make sure bit are what is expected from valid
    159     ; IDE Status Register.
     180    ; example. We must make sure bits are what is expected from valid
     181    ; IDE Status Register. So far all drives I've tested return 50h
     182    ; (FLG_STATUS_DRDY and FLG_STATUS_DSC set) but I don't want to assume
     183    ; just yet that all drives report 50h.
    160184    test    al, FLG_STATUS_BSY | FLG_STATUS_DF | FLG_STATUS_DRQ | FLG_STATUS_ERR
    161185    jnz     SHORT .InvalidStatusRegister    ; Busy or Errors cannot be set
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm

    r491 r502  
    8383    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeCmdPort
    8484    at  MENUITEM.szHelp,            dw  g_szHelpIdeCmdPort
    85     at  MENUITEM.bFlags,            db  NULL
     85    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE
    8686    at  MENUITEM.bType,             db  TYPE_MENUITEM_HEX
    8787    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
     
    357357    push    cs
    358358    pop     ds
    359     call    .EnableOrDisableCommandBlockPort
    360359    call    .EnableOrDisableControlBlockPort
    361360    call    .DisableIRQchannelSelection
     
    368367
    369368;--------------------------------------------------------------------
    370 ; .EnableOrDisableCommandBlockPort
    371 ;   Parameters:
    372 ;       SS:BP:  Menu handle
    373 ;   Returns:
    374 ;       Nothing
    375 ;   Corrupts registers:
    376 ;       AX, BX
    377 ;--------------------------------------------------------------------
    378 ALIGN JUMP_ALIGN
    379 .EnableOrDisableCommandBlockPort:
    380     mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
    381     call    Buffers_GetRomvarsValueToAXfromOffsetInBX
    382     mov     bx, g_MenuitemIdeControllerCommandBlockAddress
    383     cmp     al, DEVICE_8BIT_XTCF_PIO8
    384     jb      SHORT .EnableMenuitemFromCSBX
    385     cmp     al, DEVICE_SERIAL_PORT
    386     je      SHORT .DisableMenuitemFromCSBX
    387     cmp     al, DEVICE_8BIT_XTCF_MEMMAP
    388     ja      SHORT .EnableMenuitemFromCSBX
    389     jmp     SHORT .DisableMenuitemFromCSBX
    390 
    391 
    392 ;--------------------------------------------------------------------
    393369; .EnableOrDisableControlBlockPort
    394370;   Parameters:
     
    405381    mov     bx, g_MenuitemIdeControllerControlBlockAddress
    406382    cmp     al, DEVICE_8BIT_XTCF_PIO8
    407     jb      SHORT .EnableMenuitemFromCSBX
     383    jb      SHORT .EnableMenuitemFromCSBX   ; Not needed for XT-CF and JR-IDE/ISA
    408384    jmp     SHORT .DisableMenuitemFromCSBX
    409385
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Strings.asm

    r497 r502  
    201201g_szItemIdeEnIRQ:       db  "Enable interrupt",NULL
    202202g_szItemIdeIRQ:         db  "IRQ",NULL
    203 g_szItemIdeXTCFwindow:  db  "XT-CF Sector Window",NULL
     203g_szItemIdeXTCFwindow:  db  "XT-CF v2 Sector Window",NULL
    204204g_szItemSerialCOM:      db  "COM Port",NULL
    205205g_szItemSerialBaud:     db  "Baud Rate",NULL
     
    213213g_szDlgIdeEnIRQ:        db  "Enable interrupt?",NULL
    214214g_szDlgIdeIRQ:          db  "Enter IRQ channel (2...7 for 8-bit controllers, 2...15 for any other controller).",NULL
    215 g_szDlgIdeXTCFwindow:   db  "XT-CF Sector Window segment (A000h...E800h).",NULL
     215g_szDlgIdeXTCFwindow:   db  "XT-CF v2 Sector Window segment (A000h...E800h).",NULL
    216216
    217217g_szNfoIdeBackToCfgMenu:db  "Back to XTIDE Universal BIOS Configuration Menu.",NULL
     
    223223g_szNfoIdeEnIRQ:        db  "Interrupt or polling mode.",NULL
    224224g_szNfoIdeIRQ:          db  "IRQ channel to use.",NULL
    225 g_szNfoIdeXTCFwindow:   db  "Segment Address for XT-CF 4 kiB Sector Access Window.",NULL
     225g_szNfoIdeXTCFwindow:   db  "Segment Address for XT-CF v2 4 kiB Sector Access Window.",NULL
    226226g_szNfoIdeSerialCOM:    db  "Select a COM port by number.",NULL
    227227g_szNfoIdeSerialBaud:   db  "Select the COM port's Baud Rate. The server must match this speed."
     
    250250                        db  "XTIDE rev 1",LF
    251251                        db  "XTIDE rev 2 or modded rev 1",LF
    252                         db  "Lo-tech XT-CF in PIO mode",LF
    253                         db  "Lo-tech XT-CF in DMA mode",LF
    254                         db  "Lo-tech XT-CF in memory mode",LF
     252                        db  "XT-CF v2/v3/Lite in PIO mode",LF
     253                        db  "XT-CF v2 in DMA mode",LF
     254                        db  "XT-CF v2 in memory mode",LF
    255255                        db  "JR-IDE/ISA",LF
    256256                        db  "Serial port virtual device",NULL
Note: See TracChangeset for help on using the changeset viewer.