Changeset 613 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS


Ignore:
Timestamp:
May 27, 2021, 6:25:17 PM (3 years ago)
Author:
Tomi Tilli
Message:

Added more complex way to limit illegal P-CHS Cylinders. This way more modifications can be easily made later if necessary.
Updated biosdrvs to display unmodified and modified CHS.

Location:
trunk/XTIDE_Universal_BIOS
Files:
6 edited

Legend:

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

    r539 r613  
    2020%ifndef INT13H_INC
    2121%define INT13H_INC
     22
     23; Signature for XTIDE Universal BIOS specific functions
     24XUB_INT13h_SIGNATURE    EQU     RAMVARS_RAM_SIGNATURE
    2225
    2326; Hard Disk function (INT 13h) return status codes in AH
  • trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm

    r568 r613  
    8888;   Parameters:
    8989;       BH:     Drive Select byte for Drive and Head Select Register
     90;       CX:     XUB_INT13h_SIGNATURE to ignore illegal ATA-ID values, otherwise
     91;               correct them (only used if NOT build with NO_ATAID_CORRECTION)
    9092;       DX:     Autodetected port (for devices that support autodetection)
    9193;       DS:     Segment to RAMVARS
     
    98100;       AL, BX, CX, DX, SI, DI, ES
    99101;--------------------------------------------------------------------
     102Device_IdentifyToBufferInESSIwithDriveSelectByteInBH:
     103%ifndef NO_ATAID_CORRECTION
     104    cmp     cx, XUB_INT13h_SIGNATURE
     105    je      SHORT .DoNotFixAtaInformation
     106    push    es
     107    push    si
     108    ePUSH_T cx, AtaID_PopESSIandFixIllegalValuesFromESSI    ; Here we modify ATA information if necessary
     109.DoNotFixAtaInformation:
     110%endif
     111
    100112%ifdef MODULE_SERIAL    ; IDE + Serial
    101 Device_IdentifyToBufferInESSIwithDriveSelectByteInBH:
    102113    cmp     BYTE [cs:bp+IDEVARS.bDevice], DEVICE_SERIAL_PORT
    103114%ifdef USE_386
     
    112123
    113124%else                   ; IDE
    114     Device_IdentifyToBufferInESSIwithDriveSelectByteInBH    EQU     IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
     125    jmp     IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
    115126%endif
    116127
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm

    r526 r613  
    2626; AH25h_HandlerForGetDriveInformation
    2727;   Parameters:
    28 ;       ES:     Same as in INTPACK
     28;       CX, ES: Same as in INTPACK
    2929;       DL:     Translated Drive number
    3030;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    3131;       SS:BP:  Ptr to IDEPACK
    3232;   Parameters on INTPACK:
     33;       CX:     XUB_INT13h_SIGNATURE to ignore illegal ATA-ID values, otherwise
     34;               correct them (only used if NOT build with NO_ATAID_CORRECTION)
    3335;       ES:BX:  Ptr to buffer to receive 512-byte drive information
    3436;   Returns with INTPACK:
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm

    r593 r613  
    2222SECTION .text
    2323
     24;--------------------------------------------------------------------
     25; Adjust ATA information for compatibility, debug, etc purposes.
     26; We can also completely ignore the drive if necessary.
     27;
     28; AtaID_FixIllegalValuesFromESSI
     29;   Parameters:
     30;       AH:     INT 13h Error Code from reading ATA information
     31;       CF:     Cleared if successfully read ATA information,
     32;               Set if failed to read ATA information
     33;       ES:SI:  Ptr to 512-byte ATA information read from the drive
     34;   Returns:
     35;       ES:SI:  Ata information with possible corrections made
     36;       AH:     INT 13h Error Code from reading ATA information
     37;       CF      cleared if drive now accepted
     38;   Corrupts registers:
     39;       AL, BX, CX, DX, DI
     40;--------------------------------------------------------------------
     41%ifndef NO_ATAID_CORRECTION
     42%ifndef EXCLUDE_FROM_BIOSDRVS
     43AtaID_PopESSIandFixIllegalValuesFromESSI:
     44    pop     si
     45    pop     es
     46%endif
     47AtaID_FixIllegalValuesFromESSI:
     48    jc      SHORT .Return   ; Nothing to fix since failed to read ATA Info
     49
     50    ; Only correct cylinders since there are no reports that head or sectors could be wrong
     51    MIN_U   WORD [es:si+ATA1.wCylCnt], MAX_VALID_PCHS_CYLINDERS     ; Limit to max allowed value
     52   
     53    ; Note! There are ATA ID words 54-58 that also need to be modified! However,
     54    ; the drive itself should modify them when we do Initialize Device Parameters command at AH=9h.
     55    ; Verification from real drive needed before we fix them manually
     56   
     57    clc                     ; Return success
     58.Return:
     59    ret
     60%endif ; NO_ATAID_CORRECTION
     61
     62
     63%ifndef EXCLUDE_FROM_BIOSDRVS
    2464;--------------------------------------------------------------------
    2565; AtaID_VerifyFromESSI
     
    233273
    234274%endif ; MODULE_ADVANCED_ATA
     275
     276%endif ; EXCLUDE_FROM_BIOSDRVS
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AtaGeometry.asm

    r612 r613  
    239239    mov     bl, [es:si+ATA1.wHeadCnt]   ; Heads (1...16)
    240240    mov     bh, [es:si+ATA1.wSPT]       ; Sectors per Track (1...63)
    241 %ifndef EXCLUDE_FROM_BIOSDRVS   ; We want the true value in BIOSDRVS
    242     ; Some CF cards (for example Sandisk Ultra 16/32 GB) violates
    243     ; the ATA specification by reporting more than 16383 cylinders.
    244     MIN_U   ax, MAX_PCHS_CYLINDERS      ; Limit the count to avoid problems.
    245 %endif
    246241    ret
    247242
  • trunk/XTIDE_Universal_BIOS/makefile

    r606 r613  
    3737# RELOCATE_INT13H_STACK **    Relocates INT 13h stack to beginning of stolen conventional memory   #
    3838# 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    #
    3940# USE_186                     Use instructions supported by 80188/80186 and V20/V30 and later      #
    4041# USE_286                     Use instructions supported by 286 and later (defines USE_UNDOC_INTEL)#
     
    117118DEFINES_AT_LARGE = $(DEFINES_AT) $(DEFINES_COMMON_LARGE)
    118119
    119 DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE NO_ATAID_VALIDATION CLD_NEEDED
     120DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE NO_ATAID_VALIDATION NO_ATAID_CORRECTION CLD_NEEDED
    120121DEFINES_386 = $(DEFINES_AT) USE_386 MODULE_ADVANCED_ATA MODULE_WIN9X_CMOS_HACK
    121122DEFINES_386_LARGE = $(DEFINES_386) $(DEFINES_COMMON_LARGE)
Note: See TracChangeset for help on using the changeset viewer.