Changeset 618 in xtideuniversalbios for trunk


Ignore:
Timestamp:
Aug 31, 2021, 2:17:47 PM (3 years ago)
Author:
Krister Nordvall
Message:

Changes:

  • Updated the BIOS makefile. Added the NO_ATAID_CORRECTION define back to the Tiny build as I've realized that the correction code should not be needed for builds without MODULE_EBIOS. Also added a new makefile target 'custom' to make it easier for people to make custom builds.
  • Fixed a bug where calling INT 13h/AH=15h for drives not handled by XUB (floppy drives for example) would return an error due to the fact that any non-zero return value in AH from the other BIOS would cause the CF to be set in Int13h_SetErrorCodeToIntpackInSSBPfromAH. The return path is now via Int13h_ReturnFromHandlerWithoutStoringErrorCode which means that no status/error code will be returned in the BDA but that should not be a problem as the other BIOS should do that anyway. This change also fixed another potential problem where return values in DL from the other BIOS were assumed to be drive numbers when MODULE_SERIAL_FLOPPY is included in the build.
  • Minor optimizations and fixes.
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Assembly_Library/Inc/CMOS.inc

    r605 r618  
    3030
    3131; Almost all of the CMOS locations are vendor specific and
    32 ; there is very little standardation
     32; there is very little standardization.
    3333HARD_DISK_TYPES                 EQU     12h     ; Windows 9x reads this to check if IDE drives
    3434                                                ; are present so it should be safe to access this.
  • trunk/XTIDE_Universal_BIOS/Inc/IdeIO.inc

    r592 r618  
    9999        mov     dl, %1
    100100    %endif
    101         call    IdeIO_InputToALfromIdeRegisterInDL
     101    call    IdeIO_InputToALfromIdeRegisterInDL
    102102
    103103%endif
  • trunk/XTIDE_Universal_BIOS/Inc/IdeRegisters.inc

    r615 r618  
    102102
    103103; Subcommands for COMMAND_SET_FEATURES
    104 FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE   EQU     01h     ; CFA feature set only
    105 FEATURE_ENABLE_WRITE_CACHE              EQU     02h
    106 FEATURE_ENABLE_ADVANCED_POWER_MANAGEMENT    EQU 05h
    107 FEATURE_DISABLE_8BIT_PIO_TRANSFER_MODE  EQU     81h     ; CFA feature set only
    108 FEATURE_DISABLE_WRITE_CACHE             EQU     82h     ; Can also be used to flush cache
    109 FEATURE_DISABLE_ADVANCED_POWER_MANAGEMENT   EQU 85h     ; Might not be supported even if FEATURE_ENABLE_ADVANCED_POWER_MANAGEMENT is
    110 FEATURE_SET_TRANSFER_MODE               EQU     03h     ; Transfer mode goes to the Sector Count Register
    111     PIO_DEFAULT_MODE                    EQU     0h
    112     PIO_DEFAULT_MODE_DISABLE_IORDY      EQU     1h
    113     PIO_FLOW_CONTROL_MODE_xxx           EQU     (1<<3)  ; Bits 2...0 hold the PIO mode
     104FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE       EQU     01h     ; CFA feature set only
     105FEATURE_ENABLE_WRITE_CACHE                  EQU     02h
     106FEATURE_ENABLE_ADVANCED_POWER_MANAGEMENT    EQU     05h
     107FEATURE_DISABLE_8BIT_PIO_TRANSFER_MODE      EQU     81h     ; CFA feature set only
     108FEATURE_DISABLE_WRITE_CACHE                 EQU     82h     ; Can also be used to flush cache
     109FEATURE_DISABLE_ADVANCED_POWER_MANAGEMENT   EQU     85h     ; Might not be supported even if FEATURE_ENABLE_ADVANCED_POWER_MANAGEMENT is
     110FEATURE_SET_TRANSFER_MODE                   EQU     03h     ; Transfer mode goes to the Sector Count Register
     111    PIO_DEFAULT_MODE                        EQU     0h
     112    PIO_DEFAULT_MODE_DISABLE_IORDY          EQU     1h
     113    PIO_FLOW_CONTROL_MODE_xxx               EQU     (1<<3)  ; Bits 2...0 hold the PIO mode
    114114
    115115
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm

    r616 r618  
    4343;       Nothing
    4444;   Corrupts registers:
    45 ;       AL
     45;       AX
    4646;--------------------------------------------------------------------
    4747.DetectPowerManagementSupport:
    48     mov     al, [es:si+ATA6.wSetSup82]
    49     mov     ah, [es:si+ATA6.wSetSup83]
    50     and     ah, A6_wSetSup83_APM
    51     shl     ah, 1                       ; APM bit 3 to bit 4
    52     and     al, A6_wSetSup82_POWERMAN   ; A6_wSetSup82_POWERMAN (bit 3) is the same
     48    mov     ax, A6_wSetSup83_APM << 8 | A6_wSetSup82_POWERMAN   ; Both of these flags are bit 3
     49    and     ah, [es:si+ATA6.wSetSup83]
     50    and     al, [es:si+ATA6.wSetSup82]
     51    eSHL_IM ah, 1                       ; APM bit 3 to bit 4 (same as FLGH_DPT_APM_SUPPORTED)
    5352    or      al, ah
    54     or      [di+DPT.bFlagsHigh], al     ; bit as FLGH_DPT_POWER_MANAGEMENT_SUPPORTED and FLGH_DPT_APM_SUPPORTED
     53    or      [di+DPT.bFlagsHigh], al     ; FLGH_DPT_POWER_MANAGEMENT_SUPPORTED and FLGH_DPT_APM_SUPPORTED
    5554%endif ; MODULE_POWER_MANAGEMENT
    5655
     
    118117    cmp     BYTE [di+DPT_ATA.bDevice], DEVICE_32BIT_ATA
    119118    ja      SHORT .NoAdvancedControllerDetected
    120    
     119
    121120    mov     bx, [di+DPT.wBasePort]
    122121    call    AdvAtaInit_DetectControllerForIdeBaseInBX
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm

    r596 r618  
    250250    pop     WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap]
    251251    cmp     dl, [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv]    ; DL is still drive number?
    252     je      SHORT Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     252    je      SHORT Int13h_ReturnFromHandlerWithoutStoringErrorCode
    253253    mov     [bp+IDEPACK.intpack+INTPACK.dl], dl ; Something is returned in DL
    254254%endif
    255     jmp     SHORT Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     255    jmp     SHORT Int13h_ReturnFromHandlerWithoutStoringErrorCode
     256    ; We cannot return via Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH!
     257    ; 1. If the other BIOS returns something in DL then that is assumed to be a drive number
     258    ;    (if MODULE_SERIAL_FLOPPY is included) even though it could be anything.
     259    ; 2. Any non-zero value in AH will cause the CF to be set on return from the handler.
     260    ;    This breaks INT 13h/AH=15h for drives handled by the other BIOS.
    256261
    257262
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH23h_HFeatures.asm

    r615 r618  
    106106; Enable/disable advanced power management command can be used to scale
    107107; power consumption and performance. Drive supporting Enable APM might not
    108 ; support Disable AMP so we set the drive to max performance if stand by
     108; support Disable APM so we set the drive to max performance if stand by
    109109; timer value is 0 (idle/standby disabled)
    110110;
     
    126126    test    dl, dl
    127127    jnz     SHORT .EnablePowerSave
    128     dec     dx
    129     dec     dx      ; DL = FEh = Maximum performance
    130     jmp     AH23h_SetControllerFeatures
    131    
     128    mov     dl, 0FEh    ; Maximum performance
     129    SKIP2B  f
     130
    132131; TODO: We should add power management level to IDEVARS to be adjustable with xtidecfg
    133132.EnablePowerSave:
    134133    mov     dl, 0BFh    ; For Toshiba 1.8" HDD: 80h...BFh = Mode 1
    135     jmp     AH23h_SetControllerFeatures
    136 %endif ; %ifdef MODULE_POWER_MANAGEMENT
     134    jmp     SHORT AH23h_SetControllerFeatures
     135%endif ; MODULE_POWER_MANAGEMENT
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm

    r617 r618  
    6565;   Parameters:
    6666;       AH:     INT 13h error code
    67 ;       CX:     Number of sectors that was meant to we verified
     67;       CX:     Number of sectors that was meant to be verified
    6868;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    6969;       SS:BP:  Ptr to IDEPACK
     
    7474ALIGN JUMP_ALIGN
    7575AH4h_CalculateNumberOfSuccessfullyVerifiedSectors:
    76     xchg    cx, ax          ; Store error code to CL
     76    xchg    cx, ax                      ; Store error code to CH
    7777    call    Device_ReadLBAlowRegisterToAL
    78     mov     ah, [bp+IDEPACK.bLbaLow]
    79     sub     al, ah          ; AL = sector address with verify failure - starting sector address
     78    sub     al, [bp+IDEPACK.bLbaLow]    ; AL = sector address with verify failure - starting sector address
    8079    xor     ah, ah
    81     xchg    cx, ax          ; Number of successfully verified sectors in CX, error code in AH
     80    xchg    cx, ax                      ; Number of successfully verified sectors in CX, error code in AH
    8281    stc
    8382    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r616 r618  
    204204    mov     dl, [cs:ROMVARS.bIdleTimeout]
    205205    push    dx
    206     push    dx
    207206    test    dh, FLGH_DPT_APM_SUPPORTED
    208207    jz      SHORT .NoAdvancedPowerManagementSupport
     
    213212    ; COMMAND_STAND_BY seemed to do the trick
    214213    pop     dx
     214    push    dx
    215215    mov     al, COMMAND_STAND_BY
    216216    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY)
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH44h_ExtendedVerifySectors.asm

    r617 r618  
    4141AH44h_HandlerForExtendedVerifySectors:
    4242    call    Prepare_ByLoadingDapToESSIandVerifyingForTransfer
    43     push    WORD [es:si+DAP.wSectorCount]               ; Store for successfull number of sectors transferred
     43    push    WORD [es:si+DAP.wSectorCount]               ; Store for successful number of sectors transferred
    4444    mov     ah, [cs:bx+g_rgbVerifyCommandLookup]
    4545    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY)
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm

    r592 r618  
    3939    mov     bl, 3Fh             ; Load sector number mask
    4040    and     bl, cl              ; Sector number now in BL
     41%ifndef USE_186
    4142    sub     cl, bl              ; Remove from cylinder number high
    42     eROL_IM cl, 2               ; High bits to beginning
     43    rol     cl, 1               ; High bits to beginning
     44    rol     cl, 1
     45%else
     46    shr     cl, 6
     47%endif
    4348    mov     bh, dh              ; Copy Head number
    4449    xchg    cl, ch              ; Cylinder number now in CX
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm

    r614 r618  
    4949
    5050    ; Only correct cylinders since there are no reports that head or sectors could be wrong
    51     MIN_U   WORD [es:si+ATA1.wCylCnt], MAX_PCHS_CYLINDERS       ; Limit to max allowed value
     51    mov     cx, MAX_PCHS_CYLINDERS
     52    MIN_U   [es:si+ATA1.wCylCnt], cx    ; Limit to max allowed value
    5253
    5354    ; Note! There are ATA ID words 54-58 that also need to be modified! However,
  • trunk/XTIDE_Universal_BIOS/makefile

    r614 r618  
    33#                                                                                                  #
    44# Valid makefile targets are:                                                                      #
    5 # all       Removes existing files and builds binary files in \Build                               #
    6 # small     Builds 8 kiB binaries only (without checksum)                                          #
    7 # large     Builds 12 kiB binaries only (without checksum)                                         #
     5# all       Removes existing files and builds binary files in \Build (without checksums)           #
     6# small     Builds only binaries smaller than or equal to 8 kiB (without checksums)                #
     7# large     Builds only binaries larger than 8 kiB (without checksums)                             #
     8# custom    Builds custom binary without checksum (change DEFINES_CUSTOM / BIOS_SIZE_CUSTOM first) #
    89# clean     Removes all files from \Build                                                          #
    9 # checksum* Builds all and then generates checksum byte to all binary files                        #
     10# checksum* Same as 'all' but also applies checksums to the binaries                               #
    1011# strings*  Compress src\Strings.asm to src\StringsCompressed.asm                                  #
    1112# unused*   Checks if there are any unused functions that can be removed to save space             #
     
    3738# RELOCATE_INT13H_STACK **    Relocates INT 13h stack to beginning of stolen conventional memory   #
    3839# NO_ATAID_VALIDATION ***     Excludes code that tries to ensure proper communication with drives  #
    39 # NO_ATAID_CORRECTION         Excludes code that corrects illegal CHS values from some CF cards    #
     40# NO_ATAID_CORRECTION         Excludes code that corrects illegal CHS values from some CF cards    #
    4041# USE_186                     Use instructions supported by 80188/80186 and V20/V30 and later      #
    4142# USE_286                     Use instructions supported by 286 and later (defines USE_UNDOC_INTEL)#
     
    104105
    105106
    106 #################################################################
    107 # Assembler preprocessor defines.                              #
    108 #################################################################
     107##################################
     108# Assembler preprocessor defines #
     109##################################
    109110DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_EBIOS MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_POWER_MANAGEMENT NO_ATAID_VALIDATION CLD_NEEDED
    110111DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED MODULE_COMPATIBLE_TABLES
     
    113114DEFINES_XTPLUS = $(DEFINES_XT) USE_186
    114115DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_COMPATIBLE_TABLES
     116DEFINES_386 = $(DEFINES_AT) USE_386 MODULE_ADVANCED_ATA MODULE_WIN9X_CMOS_HACK
    115117
    116118DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
    117119DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) $(DEFINES_COMMON_LARGE)
    118120DEFINES_AT_LARGE = $(DEFINES_AT) $(DEFINES_COMMON_LARGE)
    119 
    120 DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE NO_ATAID_VALIDATION CLD_NEEDED
    121 DEFINES_386 = $(DEFINES_AT) USE_386 MODULE_ADVANCED_ATA MODULE_WIN9X_CMOS_HACK
    122121DEFINES_386_LARGE = $(DEFINES_386) $(DEFINES_COMMON_LARGE)
     122
     123DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE NO_ATAID_VALIDATION NO_ATAID_CORRECTION CLD_NEEDED
     124
     125DEFINES_CUSTOM = ?
    123126
    124127
     
    132135BIOS_SIZE_SMALL = 8192
    133136BIOS_SIZE_LARGE = 10240
     137BIOS_SIZE_CUSTOM = ?
    134138
    135139# Add -D in front of every preprocessor define declaration
     
    143147DEFS_386 = $(DEFINES_386:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_SMALL)
    144148DEFS_386_LARGE = $(DEFINES_386_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
     149DEFS_CUSTOM = $(DEFINES_CUSTOM:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_CUSTOM)
    145150
    146151# Add -I in front of all header directories
     
    149154# Path + target file to be built
    150155TARGET = $(BUILD_DIR)/$(PROG)
     156
    151157
    152158#########################
     
    223229    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_LARGE) -l"$(TARGET)_386l.lst" -o"$(TARGET)_386l.bin"
    224230    @echo * Large 386 version "$(TARGET)_386l.bin" built.
     231
     232custom:
     233    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_CUSTOM) -l"$(TARGET)_custom.lst" -o"$(TARGET)_custom.bin"
     234    @echo * Custom version "$(TARGET)_custom.bin" built.
    225235
    226236strings: src\Strings.asm
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/IdeAutodetect.asm

    r614 r618  
    144144    jne     SHORT .IdeDeviceFound
    145145    mov     al, DEVICE_8BIT_XTCF_PIO8
    146     jmp     SHORT .IdeDeviceFound
     146    ret     ; With CF cleared
    147147.ContinueDetection:
    148148    shr     bx, 1
     
    331331    dw      320h
    332332    dw      340h
    333     dw      360h
     333    dw      360h    ; Acculogic sIDE-1/16 (same controller type as XT-IDE rev 1)
    334334    dw      380h
    335335    dw      3A0h
Note: See TracChangeset for help on using the changeset viewer.