Changeset 533 in xtideuniversalbios


Ignore:
Timestamp:
Apr 3, 2013, 4:12:34 PM (10 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • P-Cylinders returned by AH=48h are now calculated from L-CHS capacity when RESERVE_DIAGNOSTIC_CYLINDER is defined.
  • Total sector count returned by AH=48h is now always P-Cylinders * P-Heads * P-Sectors per track for drives with less than or equal 15,482,880 LBA sectors.
Location:
trunk/XTIDE_Universal_BIOS/Src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm

    r526 r533  
    251251;   Parameters:
    252252;       AH:     BIOS Error code
    253 ;       DS:     RAMVARS segment
    254253;       SS:BP:  Ptr to IDEPACK
    255254;   Returns:
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH48h_GetExtendedDriveParameters.asm

    r530 r533  
    2323;--------------------------------------------------------------------
    2424; Int 13h function AH=48h, Get Extended Drive Parameters.
     25;
     26; It is not completely clear what this function should return as total sector count in some cases.
     27; What is certain is that:
     28; A) Phoenix Enhanced Disk Drive Specification v3.0 says that P-CHS values
     29;    are never returned for drives with more than 15,482,880 sectors (16384*15*63).
     30;    For those drives we can simply return total sector count from
     31;    ATA ID WORDs 60 and 61 (LBA28) or WORDs 100-103 (LBA48).
     32; B) IBM PC DOS 7.1 fdisk32 displays warning message if P-CHS values multiplied
     33;    together are different than total sector count. Therefore for drives with less
     34;    than or equal 15,482,880 sectors we MUST NOT return total sector count from
     35;    ATA ID WORDs 60 and 61.
     36;
     37;    Lets take an example. 6 GB Hitachi microdrive reports following values in ATA ID:
     38;    Sector count from WORDs 60 and 61  : 12,000,556
     39;    Cylinders                          : 11905
     40;    Heads                              :    16
     41;    Sectors per track                  :    63
     42;
     43;    When multiplying C*H*S we get      : 12,000,240
     44;    So the CHS size is a little bit less than LBA size. But we must use
     45;    the smaller value since C*H*S must equal total sector count!
     46;
     47; Now we get to the uncertain area where I could not find any information.
     48; Award BIOS from 1997 Pentium motherboard returns following values:
     49;    AH=08h L-CHS:   745, 255, 63 (exactly the same as what we return)
     50;    => Total Sector Count:       745*255*63 = 11,968,425
     51;    AH=48h P-CHS: 11873,  16, 63
     52;    AH=48h Total Sector Count: 11873* 16*63 = 11,967,984
     53;
     54; Notice how AH=48h returns lesser total sector count than AH=8h! The only
     55; way I could think of to get 11873 cylinders is to divide AH=08h sector
     56; count with P-CHS heads and sectors: (745*255*63) / (16*63) = 11873
     57;
     58; I have no idea what is the reasoning behind it but at least there is one
     59; BIOS that does just that.
     60;
     61; Since I don't have any better knowledge, I decided that when RESERVE_DIAGNOSTIC_CYLINDER
     62; is defined, we do what the Award BIOS does. When it is not defined, we multiply
     63; P-CHS values together and use that as total sector count.
     64;
    2565;
    2666; AH48h_GetExtendedDriveParameters
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm

    r526 r533  
    118118    mov     [di+DPT.bPchsHeads], bl
    119119%ifdef MODULE_EBIOS
     120    mov     [di+DPT.bPchsSectorsPerTrack], bh
     121
     122%ifdef RESERVE_DIAGNOSTIC_CYLINDER
     123    ; Do not store P-Cylinders, instead calculate it from L-CHS total sector count.
     124    ; Read AH=48h_GetExtendedDriveParameters.asm for more info.
     125    xchg    ax, bx
     126    mul     ah
     127    push    ax                          ; P-Heads * P-Sectors per track
     128    call    AH15h_GetSectorCountToBXDXAX
     129    pop     bx
     130    div     bx                          ; AX = Calculated cylinders
     131%endif ; RESERVE_DIAGNOSTIC_CYLINDER
     132
    120133    mov     [di+DPT.wPchsCylinders], ax
    121     mov     [di+DPT.bPchsSectorsPerTrack], bh
    122134    ; Fall to .StoreNumberOfLbaSectors
    123135
     
    141153    call    StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX
    142154
     155    ; If we have 15,482,880 or less sectors, we multiply P-CHS values
     156    ; and use that as total sector count.
     157    ; Read AH=48h_GetExtendedDriveParameters.asm for more info.
     158    sub     ax, 4001h
     159    sbb     dx, 0ECh
     160    sbb     bx, BYTE 0
     161    jnc     SHORT .NoNeedToUseCHSsectorCount    ; More than EC4000h
     162
     163    mov     al, [di+DPT.bPchsHeads]
     164    mul     BYTE [di+DPT.bPchsSectorsPerTrack]
     165    mul     WORD [di+DPT.wPchsCylinders]
     166    xor     bx, bx
     167    call    StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX
     168
    143169    ; Load user defined LBA
     170.NoNeedToUseCHSsectorCount:
    144171    call    GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS
    145172    test    cl, FLG_DRVPARAMS_USERLBA
Note: See TracChangeset for help on using the changeset viewer.