Changeset 541 in xtideuniversalbios


Ignore:
Timestamp:
Apr 14, 2013, 5:04:32 PM (12 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Brought back compatible DPTs.
Location:
trunk/XTIDE_Universal_BIOS
Files:
2 added
8 edited

Legend:

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

    r536 r541  
    5757
    5858
    59 ; Device Parameter Table Extension
    60 struc DPTE
    61     .wBasePort              resb    2   ; 0, Command Block Base Port Address
    62     .wControlBlockPort      resb    2   ; 2, Control Block Base Port Address
    63     .bDrvnhead              resb    1   ; 4, Drive and Head Select Register upper nibble
    64     .bBiosVendor            resb    1   ; 5, BIOS Vendor Specific
    65     .bIRQ                   resb    1   ; 6, IRQ for this device
    66     .bBlockSize             resb    1   ; 7, Current block size in sectors
    67     .bDmaChannelAndType     resb    1   ; 8, DMA information
    68     .bPioMode               resb    1   ; 9, PIO mode
    69     .wFlags                 resb    2   ; 10, BIOS selected hardware specific option flags
    70     .wReserved              resb    2   ; 12, Reserved. Must be zero.
    71     .bRevision              resb    1   ; 14, Revision level of this table (11h)
    72     .bChecksum              resb    1   ; 15, Checksum, 2's complement of the sum of bytes 0-14
    73 endstruc
    74 
    75 ; Flags for DPTE.wFlags
    76 FLG_FAST_PIO_ENABLED        EQU (1<<0)  ; Set if using PIO mode 1 or above (DPTE.bPioMode is valid when set)
    77 FLG_DMA_ENABLED             EQU (1<<1)  ; Set if DMA enabled (DPTE.bDmaChannelAndType is valid when set)
    78 FLG_BLOCK_MODE_ENABLED      EQU (1<<2)  ; Set if Block Mode transfers are enabled (DPTE.bBlockSize is valid when set)
    79 FLG_CHS_TRANSLATION_ENABLED EQU (1<<3)  ; Set for drives with more than 1024 cylinders
    80 FLG_LBA_TRANSLATION_ENABLED EQU (1<<4)  ; Set when LBA addresses from DAP are passed directly to the drive
    81 FLG_REMOVABLE_MEDIA         EQU (1<<5)
    82 FLG_ATAPI_DEVICE            EQU (1<<6)
    83 FLG_32BIT_XFER_MODE         EQU (1<<7)  ; Set when using 32-bit data transfers
    84 FLG_ATAPI_USES_IRQ          EQU (1<<8)  ; ATAPI Device uses IRQ for data transfers
    85 ; L-CHS translation type for old INT 13h (when FLG_CHS_TRANSLATION_ENABLED is set)
    86 MASK_CHS_TRANSLATION_TYPE   EQU (3<<TRANSLATION_TYPE_FIELD_POSITION)
    87     TRANSLATION_TYPE_FIELD_POSITION EQU 9
    88     BIT_SHIFT_TRANSLATION           EQU 0   ; LARGE
    89     LBA_ASSISTED_TRANSLATION        EQU 1   ; Assisted LBA
    90                                         ; 2 = reserved
    91     VENDOR_SPECIFIC_TRANSLATION     EQU 3
    92 
    93 
    94 DPTE_REVISION               EQU     11h
    95 
    96 
    9759; Disk Address Packet for read, write and verify functions
    9860struc DAP
  • trunk/XTIDE_Universal_BIOS/Inc/IdeRegisters.inc

    r526 r541  
    7676; Bit 0 must be zero, unlisted bits are reserved.
    7777;FLG_DEVCONTROL_HOB     EQU     (1<<7)  ; High Order Byte (ATA6+)
    78 ;FLG_DEVCONTROL_O8H     EQU     (1<<3)  ; Drive has more than 8 heads (pre-ATA only, 1 on ATA1, reserved on ATA2+)
     78FLG_DEVCONTROL_O8H      EQU     (1<<3)  ; Drive has more than 8 heads (pre-ATA only, 1 on ATA1, reserved on ATA2+)
    7979FLG_DEVCONTROL_SRST     EQU     (1<<2)  ; Software Reset
    8080FLG_DEVCONTROL_nIEN     EQU     (1<<1)  ; Negated Interrupt Enable (IRQ disabled when set)
  • trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc

    r536 r541  
    5252%ifdef MODULE_EBIOS
    5353    %include "EBIOS.inc"            ; Equates for EBIOS functions
     54    %ifdef CREATE_COMPATIBLE_DPT
     55        %include "CompatibleDPT.inc"
     56    %endif
    5457%endif
    5558
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH41h_CheckIfExtensionsPresent.asm

    r535 r541  
    4444    mov     WORD [bp+IDEPACK.intpack+INTPACK.bx], 0AA55h
    4545
    46 %ifdef RETURN_DPTE_ON_AH48H
     46%ifdef CREATE_COMPATIBLE_DPT
    4747    call    AH41h_GetSupportBitsToCX
    4848    mov     [bp+IDEPACK.intpack+INTPACK.cx], cx
     
    5757
    5858
    59 %ifdef RETURN_DPTE_ON_AH48H
     59%ifdef CREATE_COMPATIBLE_DPT
    6060;--------------------------------------------------------------------
    6161; AH41h_GetSupportBitsToCX
     
    8787    ret
    8888
    89 %endif ; RETURN_DPTE_ON_AH48H
     89%endif ; CREATE_COMPATIBLE_DPT
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH48h_GetExtendedDriveParameters.asm

    r535 r541  
    8484
    8585    ; Create DPTE (hardware information for device drivers)
    86 %ifdef RETURN_DPTE_ON_AH48H
     86%ifdef CREATE_COMPATIBLE_DPT
    8787    call    AH41h_GetSupportBitsToCX
    8888    test    cl, ENHANCED_DISK_DRIVE_SUPPORT
    8989    jz      SHORT .DoNotCreateDPTE
    90     call    CreateDeviceParameterTableExtensionToESBXfromDPTinDSSI
     90    call    CompatibleDPT_CreateDeviceParameterTableExtensionToESBXfromDPTinDSSI
    9191.DoNotCreateDPTE:
    9292%endif
     
    110110    ; Store DPTE for standard controllers only,
    111111    ; FFFF:FFFF for non standard controllers
    112 %ifdef RETURN_DPTE_ON_AH48H
     112%ifdef CREATE_COMPATIBLE_DPT
    113113    mov     [di+EDRIVE_INFO.fpDPTE], bx
    114114    mov     [di+EDRIVE_INFO.fpDPTE+2], es
     
    161161.ReturnWithError:
    162162    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    163 
    164 
    165 %ifdef RETURN_DPTE_ON_AH48H
    166 ;--------------------------------------------------------------------
    167 ; CreateDeviceParameterTableExtensionToESBXfromDPTinDSSI
    168 ;   Parameters:
    169 ;       DS:SI:  Ptr to DPT (in RAMVARS segment)
    170 ;       ES:     RAMVARS segment
    171 ;   Returns:
    172 ;       ES:BX:  Ptr to Device Parameter Table Extension (DPTE)
    173 ;   Corrupts registers:
    174 ;       AX, CX, DX, DI
    175 ;--------------------------------------------------------------------
    176 CreateDeviceParameterTableExtensionToESBXfromDPTinDSSI:
    177     ; Point ES:DI to DPTE buffer (valid until next AH=48h call)
    178     mov     di, [cs:ROMVARS.bStealSize]
    179     eSHL_IM di, 10                          ; DI = RAMVARS size in bytes
    180     sub     di, BYTE DPTE_size              ; DI = Offset to DPTE
    181     xor     dx, dx                          ; Clear for checksum
    182 
    183     ; Set 32-bit flag for 32-bit controllers
    184     mov     cx, FLG_LBA_TRANSLATION_ENABLED ; DPTE.wFlags
    185     cmp     BYTE [si+DPT_ATA.bDevice], DEVICE_32BIT_ATA
    186     eCMOVE  cl, FLG_LBA_TRANSLATION_ENABLED | FLG_32BIT_XFER_MODE
    187 
    188     ; DPTE.wBasePort
    189     mov     ax, [si+DPT.wBasePort]
    190     call    StoswThenAddALandAHtoDL         ; Bytes 0 and 1
    191 
    192     ; DPTE.wControlBlockPort
    193     eMOVZX  bx, BYTE [si+DPT.bIdevarsOffset]
    194     mov     ax, [cs:bx+IDEVARS.wControlBlockPort]
    195     call    StoswThenAddALandAHtoDL         ; Bytes 2 and 3
    196 
    197     ; DPTE.bDrvnhead and DPTE.bBiosVendor
    198     xchg    di, si
    199     call    AccessDPT_GetDriveSelectByteForEbiosToAL
    200     xchg    si, di
    201     call    StoswThenAddALandAHtoDL         ; Bytes 4 and 5
    202 
    203     ; DPTE.bIRQ and DPTE.bBlockSize
    204     mov     al, [cs:bx+IDEVARS.bIRQ]        ; No way to define that we might not use IRQ
    205     mov     ah, [si+DPT_ATA.bBlockSize]
    206     cmp     ah, 1
    207     jbe     SHORT .DoNotSetBlockModeFlag
    208     or      cl, FLG_BLOCK_MODE_ENABLED
    209 .DoNotSetBlockModeFlag:
    210     call    StoswThenAddALandAHtoDL         ; Bytes 6 and 7
    211 
    212     ; DPTE.bDmaChannelAndType and DPTE.bPioMode
    213     xor     ax, ax
    214 %ifdef MODULE_ADVANCED_ATA
    215     or      ah, [si+DPT_ADVANCED_ATA.bPioMode]
    216     jz      SHORT .NoDotSetFastPioFlag
    217     cmp     WORD [si+DPT_ADVANCED_ATA.wControllerID], BYTE 0
    218     je      SHORT .NoDotSetFastPioFlag
    219     inc     cx      ; FLG_FAST_PIO_ENABLED
    220 .NoDotSetFastPioFlag:
    221 %endif
    222     call    StoswThenAddALandAHtoDL         ; Bytes 8 and 9
    223 
    224     ; Set CHS translation flags and store DPTE.wFlags
    225     mov     al, [si+DPT.bFlagsLow]
    226     and     al, MASKL_DPT_TRANSLATEMODE
    227     jz      SHORT .NoChsTranslationOrBitShiftTranslationSet
    228     or      cl, FLG_CHS_TRANSLATION_ENABLED
    229     test    al, FLGL_DPT_ASSISTED_LBA
    230     jz      SHORT .NoChsTranslationOrBitShiftTranslationSet
    231     or      cx, LBA_ASSISTED_TRANSLATION << TRANSLATION_TYPE_FIELD_POSITION
    232 .NoChsTranslationOrBitShiftTranslationSet:
    233     xchg    ax, cx
    234     call    StoswThenAddALandAHtoDL         ; Bytes 10 and 11
    235 
    236     ; DPTE.wReserved (must be zero)
    237     xor     ax, ax
    238     call    StoswThenAddALandAHtoDL         ; Bytes 12 and 13
    239 
    240     ; DPTE.bRevision and DPTE.bChecksum
    241     mov     ax, DPTE_REVISION | (DPTE_REVISION<<8)
    242     add     ah, dl
    243     neg     ah
    244     stosw
    245     lea     bx, [di-DPTE_size]
    246     ret
    247 
    248 
    249 ;--------------------------------------------------------------------
    250 ; StoswThenAddALandAHtoDL
    251 ;   Parameters:
    252 ;       AX:     WORD to store
    253 ;       ES:DI:  Ptr to where to store AX
    254 ;       DL:     Checksum byte
    255 ;   Returns:
    256 ;       DL:     Checksum byte
    257 ;       DI:     Incremented by 2
    258 ;   Corrupts registers:
    259 ;       Nothing
    260 ;--------------------------------------------------------------------
    261 StoswThenAddALandAHtoDL:
    262     stosw
    263     add     dl, al
    264     add     dl, ah
    265     ret
    266 
    267 %endif ; RETURN_DPTE_ON_AH48H
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm

    r526 r541  
    8080    call    DetectDrives_FromAllIDEControllers
    8181    call    Interrupts_InitializeInterruptVectors
     82    ; Fall to .StoreDptPointersToIntVectors
     83
     84
     85%ifdef CREATE_COMPATIBLE_DPT
     86;--------------------------------------------------------------------
     87; .StoreDptPointersToIntVectors
     88;   Parameters:
     89;       DS:     RAMVARS segment
     90;       ES:     BDA and interrupt vector segment (zero)
     91;   Returns:
     92;       Nothing
     93;   Corrupts registers:
     94;       AX, CX, DX, SI, DI
     95;--------------------------------------------------------------------
     96.StoreDptPointersToIntVectors:
     97    mov     dl, 80h
     98    call    FindDPT_ForDriveNumberInDL  ; DPT to DS:DI
     99    jc      SHORT .FindForDrive81h      ; Store nothing if not our drive
     100
     101    call    CompatibleDPT_CreateToAXSIforDriveDL
     102    mov     [es:HD0_DPT_POINTER_41h*4], si
     103    mov     [es:HD0_DPT_POINTER_41h*4+2], ax
     104
     105.FindForDrive81h:
     106    mov     dl, 81h
     107    call    FindDPT_ForDriveNumberInDL
     108    jc      SHORT .CompatibleDPTsCreated
     109
     110    call    CompatibleDPT_CreateToAXSIforDriveDL
     111    mov     [es:HD1_DPT_POINTER_46h*4], si
     112    mov     [es:HD1_DPT_POINTER_46h*4+2], ax
     113.CompatibleDPTsCreated:
    82114    ; Fall to .ResetDetectedDrives
     115%endif ; CREATE_COMPATIBLE_DPT
     116
    83117
    84118;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r536 r541  
    282282    %include "AH48h_GetExtendedDriveParameters.asm"
    283283    %include "AH41h_CheckIfExtensionsPresent.asm"
    284 %endif
     284%ifdef CREATE_COMPATIBLE_DPT
     285    %include "CompatibleDPT.asm"
     286%endif
     287%endif
  • trunk/XTIDE_Universal_BIOS/makefile

    r535 r541  
    3232# RELOCATE_INT13H_STACK **    Relocates INT 13h stack to beginning of stolen conventional memory   #
    3333# RESERVE_DIAGNOSTIC_CYLINDER Reserve one L-CHS cylinder for compatibility with old BIOSes         #
    34 # RETURN_DPTE_ON_AH48H        Returns extra hardware related information on AH=48h for OS drivers  #
     34# CREATE_COMPATIBLE_DPT       Presents compatible DPTs for ill behaving applications               #
    3535# USE_186                     Use instructions supported by 80188/80186 and V20/V30 and later      #
    3636# USE_286                     Use instructions supported by 286 and later (defines USE_UNDOC_INTEL)#
     
    100100#################################################################
    101101DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_EBIOS MODULE_FEATURE_SETS RESERVE_DIAGNOSTIC_CYLINDER
    102 DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED
     102DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED CREATE_COMPATIBLE_DPT
    103103
    104104DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED
     
    111111
    112112DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE
    113 DEFINES_386_8K = $(DEFINES_AT) USE_386 RETURN_DPTE_ON_AH48H
     113DEFINES_386_8K = $(DEFINES_AT) USE_386 CREATE_COMPATIBLE_DPT
    114114
    115115DEFINES_ALL_FEATURES = MODULE_8BIT_IDE MODULE_8BIT_IDE_ADVANCED MODULE_ADVANCED_ATA MODULE_EBIOS MODULE_BOOT_MENU MODULE_HOTKEYS MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_STRINGS_COMPRESSED MODULE_FEATURE_SETS
Note: See TracChangeset for help on using the changeset viewer.