Changeset 421 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h


Ignore:
Timestamp:
May 9, 2012, 7:12:53 PM (13 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Addressing modes are now NORMAL, LARGE and LBA.
  • L-CHS parameters are now generated differently for drives with 8192 or less cylinders.
Location:
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h
Files:
5 edited

Legend:

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

    r376 r421  
    101101AH8h_GetDriveParameters:
    102102    call    AccessDPT_GetLCHStoAXBLBH
     103%ifdef RESERVE_DIAGNOSTIC_CYLINDER
     104    dec     ax
     105%endif
     106    MIN_U   ax, MAX_LCHS_CYLINDERS
    103107    ; Fall to .PackReturnValues
    104108
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r410 r421  
    9999;;; SelectDrive
    100100    ; Try to select drive and wait until ready
    101     call    AccessDPT_GetDriveSelectByteToAL
     101    call    AccessDPT_GetDriveSelectByteForOldInt13hToAL
    102102    mov     [bp+IDEPACK.bDrvAndHead], al
    103103    call    Device_SelectDrive
     
    109109
    110110;;; InitializeDeviceParameters
    111     ; Initialize CHS parameters if LBA is not used
    112     test    BYTE [di+DPT.bFlagsLow], FLG_DRVNHEAD_LBA
     111    ; Initialize CHS parameters if LBA is not used and
     112    ; user has specified P-CHS parameters
     113    test    BYTE [di+DPT.bFlagsLow], FLGL_DPT_ASSISTED_LBA
    113114    jnz     SHORT .SkipInitializeDeviceParameters       ; No need to initialize CHS parameters if LBA mode enabled
     115    call    AccessDPT_GetPointerToDRVPARAMStoCSBX
     116    test    BYTE [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERCHS    ; User specified P-CHS?
     117    jz      SHORT .SkipInitializeDeviceParameters
    114118
    115119    ; Initialize Logical Sectors per Track and Max Head number
    116     mov     ah, [di+DPT.bPchsHeads]
    117     dec     ah                          ; Max Head number
    118     mov     dl, [di+DPT.bPchsSectors]   ; Sectors per Track
     120    mov     ax, [cs:bx+DRVPARAMS.wHeadsAndSectors]
     121    dec     ax                          ; Max Head number
     122    xchg    al, ah                      ; Heads now in AH
     123    mov     dx, ax                      ; Sectors per Track now in DL
    119124    mov     al, COMMAND_INITIALIZE_DEVICE_PARAMETERS
    120125    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY)
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH48h_GetExtendedDriveParameters.asm

    r376 r421  
    3838;--------------------------------------------------------------------
    3939AH48h_HandlerForGetExtendedDriveParameters:
    40     call    AccessDPT_GetPointerToDRVPARAMStoCSBX
    41     push    bx
    4240    call    AccessDPT_GetLbaSectorCountToBXDXAX
    43     pop     di          ; CS:DI now points to DRVPARAMS
    4441
    4542    ; Point DS:SI to Extended Drive Information Table to fill
     43    push    ds
     44    pop     es          ; DPT now in ES:DI
    4645    mov     ds, [bp+IDEPACK.intpack+INTPACK.ds]
    4746    mov     cx, MINIMUM_EDRIVEINFO_SIZE
     
    5150
    5251    ; We do not support EDD Configuration Parameters so set to FFFF:FFFFh
    53     mov     cx, -1      ; FFFFh
     52    sub     cx, BYTE MINIMUM_EDRIVEINFO_SIZE+1  ; CX => FFFFh
    5453    mov     [si+EDRIVE_INFO.fpEDDparams], cx
    5554    mov     [si+EDRIVE_INFO.fpEDDparams+2], cx
     
    5958.SkipEddConfigurationParameters:
    6059    mov     [si+EDRIVE_INFO.wSize], cx
    61     mov     WORD [si+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS
     60    mov     WORD [si+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS | FLG_CHS_INFORMATION_IS_VALID
    6261
    6362    ; Store total sector count
     
    6968    mov     WORD [si+EDRIVE_INFO.wSectorSize], 512
    7069
     70    ; Store P-CHS
     71    eMOVZX  dx, BYTE [es:di+DPT.bPchsHeads]
     72    xor     ax, ax                                  ; Also a return code
     73    mov     [si+EDRIVE_INFO.dwHeads], dx
     74    mov     [si+EDRIVE_INFO.dwHeads+2], ax
     75
     76    mov     dl, [es:di+DPT.bPchsSectorsPerTrack]
     77    mov     [si+EDRIVE_INFO.dwSectorsPerTrack], dx
     78    mov     [si+EDRIVE_INFO.dwSectorsPerTrack+2], ax
     79
     80    mov     dx, [es:di+DPT.wPchsCylinders]
     81    mov     [si+EDRIVE_INFO.dwCylinders], dx
     82    mov     [si+EDRIVE_INFO.dwCylinders+2], ax
     83
    7184.ReturnWithError:
    7285    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm

    r376 r421  
    4747
    4848;---------------------------------------------------------------------
    49 ; Converts LCHS parameters to IDE P-CHS parameters.
     49; Converts LARGE addressing mode LCHS parameters to IDE P-CHS parameters.
    5050; PCylinder = (LCylinder << n) + (LHead / PHeadCount)
    5151; PHead     = LHead % PHeadCount
    5252; PSector   = LSector
    5353;
    54 ; Address_ConvertLCHStoPCHS:
     54; ConvertLargeModeLCHStoPCHS:
    5555;   Parameters:
    5656;       BL:     Sector number (1...63)
    57 ;       BH:     Head number (0...255)
     57;       BH:     Head number (0...239)
    5858;       CX:     Cylinder number (0...1023)
    5959;       DS:DI:  Ptr to Disk Parameter Table
     
    6666;--------------------------------------------------------------------
    6767ALIGN JUMP_ALIGN
    68 ConvertLCHStoPCHS:
     68ConvertLargeModeLCHStoPCHS:
    6969    ; LHead / PHeadCount and LHead % PHeadCount
    7070    eMOVZX  ax, bh                  ; Copy L-CHS Head number to AX
     
    8282DoNotConvertLCHS:
    8383    ret
     84
    8485
    8586;--------------------------------------------------------------------
     
    102103Address_OldInt13hAddressToIdeAddress:
    103104        call    Address_ExtractLCHSparametersFromOldInt13hAddress
     105        ACCESSDPT__GET_UNSHIFTED_ADDRESS_MODE_TO_AXZF
    104106
    105         AccessDPT_GetUnshiftedAddressModeToALZF
     107;;; 0: ADDRESSING_MODE_NORMAL
     108        jz      SHORT DoNotConvertLCHS
    106109
    107 ;;; 0: ADDR_DPT_LCHS
    108         jz      DoNotConvertLCHS
     110;;; 1: ADDRESSING_MODE_LARGE
     111        test    al, FLGL_DPT_ASSISTED_LBA
     112        jz      SHORT ConvertLargeModeLCHStoPCHS
    109113
    110 ;;; 1: ADDR_DPT_PCHS
    111         ;
    112         ; Since we are only checking for zero, we can do our math in the high order bits,
    113         ; in this case effectively subtracting 1 from the address mode.
    114         ;
    115         sub     al,(1<<ADDRESSING_MODE_FIELD_POSITION)
    116         jz      ConvertLCHStoPCHS
     114;;; 2: ADDRESSING_MODE_ASSISTED_LBA
     115        ; Fall through to ConvertAssistedLBAModeLCHStoLBARegisterValues
    117116
    118 ;;; 2: ADDR_DPT_LBA28 and 3: ADDR_DPT_LBA48
    119         ; Fall through to ConvertLCHStoLBARegisterValues
    120117
    121118;---------------------------------------------------------------------
     
    125122;
    126123; Returned address is in same registers that
    127 ; Address_DoNotConvertLCHS and Address_ConvertLCHStoPCHS returns.
     124; DoNotConvertLCHS and ConvertLargeModeLCHStoPCHS returns.
    128125;
    129 ; ConvertLCHStoLBARegisterValues:
     126; ConvertAssistedLBAModeLCHStoLBARegisterValues:
    130127;   Parameters:
    131128;       BL:     Sector number (1...63)
    132 ;       BH:     Head number (0...255)
     129;       BH:     Head number (0...254)
    133130;       CX:     Cylinder number (0...1023)
    134131;       DS:DI:  Ptr to Disk Parameter Table
     
    141138;       AX, DX
    142139;--------------------------------------------------------------------
    143 ALIGN JUMP_ALIGN
    144 ConvertLCHStoLBARegisterValues:
     140ConvertAssistedLBAModeLCHStoLBARegisterValues:
    145141    ; cylToSeek*headsPerCyl (18-bit result)
     142    ; Max = 1023 * 255 = 260,865 = 3FB01h
    146143    mov     ax, LBA_ASSIST_SPT      ; Load Sectors per Track
    147144    xchg    cx, ax                  ; Cylinder number to AX, Sectors per Track to CX
    148 
    149145%ifdef USE_386
    150     movzx   dx, [di+DPT.bLbaHeads]
     146    movzx   dx, [di+DPT.bLchsHeads]
    151147%else
    152148    cwd
    153     mov     dl, [di+DPT.bLbaHeads]
     149    mov     dl, [di+DPT.bLchsHeads]
    154150%endif
    155151    mul     dx                      ; DX:AX = cylToSeek*headsPerCyl
    156152
    157153    ; +=headToSeek (18-bit result)
     154    ; Max = 260,865 + 254 = 261,119 = 3FBFFh
    158155    add     al, bh                  ; Add Head number to DX:AX
    159156    adc     ah, dh                  ; DH = Zero after previous multiplication
     
    161158
    162159    ; *=sectPerTrack (18-bit by 6-bit multiplication with 24-bit result)
     160    ; Max = 261,119 * 63 = 16,450,497 = FB03C1h
    163161    xchg    ax, dx                  ; Hiword to AX, loword to DX
    164162    mul     cl                      ; AX = hiword * Sectors per Track
     
    169167
    170168    ; +=sectToSeek-1 (24-bit result)
     169    ; Max = 16,450,497 + 63 - 1 = 16,450,559 = FB03FFh
    171170    xor     bh, bh                  ; Sector number now in BX
    172171    dec     bx                      ; sectToSeek-=1
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm

    r413 r421  
    5353    ; Get EBIOS command index to BX
    5454    ; LBA28 or LBA48 command
    55     cwd
    56     mov     al, [es:si+DAP.qwLBA+3] ; Load LBA48 byte 3 (bits 24...31)
    57     and     al, 0F0h                ; Clear LBA28 bits 24...27
    58     or      ax, [es:si+DAP.qwLBA+4] ; Set bits from LBA bytes 4 and 5
    59     cmp     dx, ax                  ; Set CF if any of bits 28...47 set
    60     rcl     dx, 1                   ; DX = 0 for LBA28, DX = 1 for LBA48
    6155    call    Prepare_GetOldInt13hCommandIndexToBX
    62     or      bx, dx                  ; Set block mode / single sector bit
     56    mov     al, [di+DPT.bFlagsLow]
     57    shl     al, 1                   ; Set CF if LBA48 supported
     58    adc     bl, bh                  ; LBA48 EXT commands
    6359    ret
    64 %endif
     60%endif ; MODULE_EBIOS
    6561
    6662
     
    116112;       Nothing
    117113;--------------------------------------------------------------------
    118 ALIGN JUMP_ALIGN
    119114Prepare_ByValidatingSectorsInALforOldInt13h:
    120115    test    al, al
Note: See TracChangeset for help on using the changeset viewer.