Changeset 150 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc


Ignore:
Timestamp:
Apr 29, 2011, 7:04:13 PM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to XTIDE Universal BIOS:

  • Redesigned Disk Parameter Tables.
  • Code generalizations for supporting non-IDE devices in the future.
File:
1 edited

Legend:

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

    r99 r150  
    55%define CUSTOMDPT_INC
    66
     7; Base DPT for all device types
     8struc DPT   ; 8 bytes
     9    ; General Disk Parameter Table related
     10    .wFlags                     resb    2
     11    .bIdevarsOffset             resb    1   ; Offset to IDEVARS for this drive
    712
    8 ; Base Disk Parameter Table for all hard disk drives.
    9 ; DPT might have extensions for specific functions.
    10 struc DPT
    11     ; General Disk Parameter Table related
    12     .bSize      resb    1   ; Size of DPT (with extensions) in bytes
    13     .wDrvNumAndFlags:
    14     .bDrvNum    resb    1   ; Drive number
    15     .bFlags     resb    1   ; DPT and Drive related flags
    16     .bReset     resb    1   ; Drive reset status (for debugging)
    17     .bIdeOff    resb    1   ; Offset to IDEVARS for this drive
     13    ; L-CHS to P-CHS and L-CHS to LBA28 conversion related
     14    .bLchsHeads                 resb    1   ; Number of L-CHS Heads (1...255)
    1815
    19     ; Lookup values for L-CHS to P-CHS and L-CHS to LBA28 conversions
    20     .bShLtoP    resb    1   ; Bit shift count for L-CHS to P-CHS conversion
    21     .wLHeads    resb    2   ; Number of L-CHS Heads (1...256)
    22 
    23     ; IDE related
    24     .wPCyls     resb    2   ; Number of P-CHS (IDE) Cylinders (1...16383)
    25     .wHeadsAndSectors:
    26     .bPHeads    resb    1   ; Number of P-CHS (IDE) Heads (1...16)
    27     .bPSect     resb    1   ; Number of P-CHS (IDE) Sectors per Track (1...63)
    28     .bDrvSel    resb    1   ; Drive Selection byte for Device/Head Register
    29     .bDrvCtrl   resb    1   ; Drive Control byte for Device Control Register
    30 
    31     ; Related to Block Mode transfers.
    32     ; Block size is specified in sectors (1, 2, 4, 8, 16, 32, 64 or 128).
    33     .wSetAndMaxBlock:
    34     .bSetBlock  resb    1   ; Currect block size (at least 1)
    35     .bMaxBlock  resb    1   ; Maximum block size, 0 = block mode not supported
     16    ; IDE Drive related
     17    .wPchsCylinders             resb    2   ; Number of P-CHS (IDE) Cylinders (1...16383)
     18    .wPchsHeadsAndSectors:
     19    .bPchsHeads                 resb    1   ; Number of P-CHS (IDE) Heads (1...16)
     20    .bPchsSectors               resb    1   ; Number of P-CHS (IDE) Sectors per Track (1...63)
    3621endstruc
    3722
    38 ; Bit definitions for DPT.bFlags
    39 MASK_DPT_ADDR       EQU     110b    ; Bits 1..2, Addressing Mode
    40 FLG_DPT_EBIOS       EQU     (1<<0)  ; EBIOS functions supported for this drive
    41 FLG_DPT_FIRSTPART   EQU     (1<<3)  ; First BIOS Partition of the drive (drive reset allowed)
    42 FLG_DPT_PARTITION   EQU     (1<<4)  ; BIOS Partition
    43 FLG_DPT_USERCHS     EQU     (1<<5)  ; User has specified P-CHS parameters
     23; DPT for ATA devices
     24struc DPT_ATA   ; 8 + 2 bytes = 10 bytes
     25    .dpt                        resb    DPT_size
    4426
    45 ; Values for different addressing modes (MASK_DPT_ADDR for DPT.bFlags)
    46 ADDR_DPT_LCHS       EQU     0       ; L-CHS Addressing Mode (NORMAL in many other BIOSes)
    47 ADDR_DPT_PCHS       EQU     1       ; P-CHS Addressing Mode (LARGE in many other BIOSes)
    48 ADDR_DPT_LBA28      EQU     2       ; 28-bit LBA Addressing Mode
    49 ADDR_DPT_LBA48      EQU     3       ; 48-bit LBA Addressing Mode
     27    ; Block size is specified in sectors (1, 2, 4, 8, 16, 32 or 64).
     28    ; 128 is not allowed to prevent offset overflow during data transfer.
     29    .wSetAndMaxBlock:
     30    .bSetBlock                  resb    1   ; Current block size (at least 1)
     31    .bMaxBlock                  resb    1   ; Maximum block size, 0 = block mode not supported
     32endstruc
    5033
    51 ; Bit definitions for DPT.bReset (inverted)
    52 FLG_RESET_nDRDY         EQU     (1<<0)  ; Drive ready to accept commands
    53 FLG_RESET_nINITPRMS     EQU     (1<<1)  ; Initialize Device Parameters successfull
    54 FLG_RESET_nRECALIBRATE  EQU     (1<<2)  ; Recalibrate successfull
    55 FLG_RESET_nSETBLOCK     EQU     (1<<3)  ; Initialize Block Mode successfull
    56 MASK_RESET_ALL          EQU     (FLG_RESET_nDRDY | FLG_RESET_nINITPRMS | FLG_RESET_nRECALIBRATE | FLG_RESET_nSETBLOCK)
     34LARGEST_DPT_SIZE                EQU     DPT_ATA_size
    5735
    5836
    59 ; Extended DPT for XTIDE Universal BIOS partitioned drive.
    60 ; This struct cannot exist with EDPT (EBIOS support).
    61 struc PART_DPT
    62     .dpt        resb    DPT_size
    63     .dwStartLBA:
    64     .twStartLBA resb    6   ; Starting 28- or 48-bit LBA for BIOS partition
    65 endstruc
     37; Bit definitions for DPT.wFlags
     38MASK_DPT_CHS_SHIFT_COUNT        EQU (7<<0)  ; Bits 0...3, P-CHS to L-CHS bit shift count (0...4)
     39FLG_DPT_SLAVE                   EQU FLG_DRVNHEAD_DRV    ; (1<<4), Drive is slave drive
     40MASK_DPT_ADDRESSING_MODE        EQU (3<<5)  ; Bits 5..6, Addressing Mode (bit 6 == FLG_DRVNHEAD_LBA)
     41FLG_DPT_ENABLE_IRQ              EQU (1<<7)
     42FLG_DPT_REVERSED_A0_AND_A3      EQU (1<<8)  ; XTIDE mod, Address lines 0 and 3 reversed
     43FLG_DPT_SERIAL_DEVICE           EQU (1<<9)  ; Serial Port Device
     44FLG_DPT_BLOCK_MODE_SUPPORTED    EQU (1<<10) ; Use block transfer commands
    6645
     46FLG_DPT_RESET_nDRDY             EQU (1<<12) ; Drive ready to accept commands
     47FLG_DPT_RESET_nINITPRMS         EQU (1<<13) ; Initialize Device Parameters successfull
     48FLG_DPT_RESET_nRECALIBRATE      EQU (1<<14) ; Recalibrate successfull
     49FLG_DPT_RESET_nSETBLOCK         EQU (1<<15) ; Initialize Block Mode successfull
     50MASK_DPT_RESET                  EQU 0F000h
    6751
    68 ; Extended DPT for EBIOS support.
    69 ; This struct cannot exist with PDPT (XTIDE Universal BIOS partitioned drive).
    70 struc EBDPT
    71     .dpt        resb    DPT_size
    72     .dwCapacity:
    73     .twCapacity resb    6   ; Total drive capacity in sectors
    74 endstruc
     52; Addressing modes for DPT.wFlags
     53ADDRESSING_MODE_FIELD_POSITION  EQU     5
     54ADDRESSING_MODE_LCHS            EQU     0   ; L-CHS Addressing Mode (NORMAL in many other BIOSes)
     55ADDRESSING_MODE_PCHS            EQU     1   ; P-CHS Addressing Mode (LARGE in many other BIOSes)
     56ADDRESSING_MODE_LBA28           EQU     2   ; 28-bit LBA Addressing Mode
     57ADDRESSING_MODE_LBA48           EQU     3   ; 48-bit LBA Addressing Mode
    7558
    7659
Note: See TracChangeset for help on using the changeset viewer.