Changeset 473 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Inc


Ignore:
Timestamp:
Oct 10, 2012, 6:22:23 PM (12 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Large changes to prepare full XT-CF support (DMA not yet implemented and memory mapped transfers are not working).
Location:
trunk/XTIDE_Universal_BIOS/Inc
Files:
1 added
9 edited

Legend:

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

    r422 r473  
    3737    .dwPostStack        resb    4       ; POST stack pointer when entering INT 19h
    3838
     39%ifdef MODULE_8BIT_IDE
     40    .wNextXTCFportToScan    resb    2   ; Needed for XT-CF port autodetection
     41%endif
     42
    3943    .clearToZeroFromThisPoint:
    4044%ifdef MODULE_HOTKEYS
    4145    .hotkeyVars         resb    HOTKEYVARS_size
    4246%endif
    43    
     47
    4448    .rgDrvDetectInfo:                   ; Array containing DRVDETECTINFO structs
    4549endstruc
  • trunk/XTIDE_Universal_BIOS/Inc/Controllers/XTCF.inc

    r472 r473  
    2323%define XTCF_INC
    2424
     25XTCF_DMA_MODE_MAX_BLOCK_SIZE        EQU     64      ; Sectors
     26OFFSET_TO_CONTROL_BLOCK_REGISTERS   EQU     8
     27
    2528; Possible base addresses. Note that all XT-CF IDE registers are SHL 1 compared
    2629; to standard IDE registers.
     
    4245; 8-bit PIO transfers (port I/O) are used if Control Register is zero.
    4346; Any other value means DMA transfers (using DMA channel 3).
     47XTCF_8BIT_PIO_MODE                  EQU     0
     48XTCF_MEMORY_MAPPED_MODE             EQU     0A0h
     49
    4450
    4551
  • trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc

    r472 r473  
    2424; Base DPT for all device types
    2525struc DPT
    26     ; General Disk Parameter Table related (Bytes 0...3)
     26    ; General Disk Parameter Table related
    2727    .wFlags:
    2828    .bFlagsLow              resb    1
     
    3030    .bIdevarsOffset         resb    1   ; Offset to IDEVARS for this drive
    3131    .bInitError             resb    1   ; Flags for AH=09h initialization errors
     32    .wBasePort              resb    2   ; Segment for JR-IDE/ISA
    3233
    33     ; CHS variables (Bytes 4...8)
     34    ; CHS variables
    3435    .wLchsCylinders         resb    2   ; (1...1027, yes 1027)
    3536    .wLchsHeadsAndSectors:
     
    4344    .wPchsCylinders         resb    2
    4445    .twLbaSectors           resb    6   ; 48-bit sector count for LBA addressing
    45 %endif
    46 
    47 %ifdef MODULE_8BIT_IDE
    48     .wXTCFport              resb    2   ; Autodetected XT-CF port
    4946%endif
    5047                            alignb  2   ; WORD alignent for DPT_SERIAL or DPT_ATA
     
    9693    FLG_INITERROR_FAILED_TO_SET_PIO_MODE                EQU (1<<5)
    9794    FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER    EQU (1<<6)
    98     FLG_INITERROR_FAILED_TO_ENABLE_8BIT_PIO_MODE        EQU (1<<7)
     95    FLG_INITERROR_FAILED_TO_SET_XTCF_MODE               EQU (1<<7)
    9996
    10097
    10198
    10299; DPT for ATA devices
    103 struc DPT_ATA   ; 10/18 bytes + 2 bytes = 12/20 bytes
     100struc DPT_ATA
    104101    .dpt                    resb    DPT_size
     102    .bDevice                resb    1   ; Device Type from IDEVARS (overrided when 32-bit controller detected)
    105103    .bBlockSize             resb    1   ; Current block size in sectors (do not set to zero!)
    106     .bDevice                resb    1   ; Device Type from IDEVARS (overrided when 32-bit controller detected)
    107104endstruc
    108105
     
    112109; EBDA must be reserved for DPTs when using these!
    113110%ifdef MODULE_ADVANCED_ATA
    114 struc DPT_ADVANCED_ATA  ; 12/20 bytes + 8 bytes = 20/28 bytes
     111struc DPT_ADVANCED_ATA
    115112    .dpt_ata                resb    DPT_ATA_size
    116113    .wControllerID          resb    2   ; Controller specific ID WORD (from Advanced Controller detection)
     
    125122; DPT for Serial devices
    126123%ifdef MODULE_SERIAL
    127 struc DPT_SERIAL    ; 8/18 bytes + 2 bytes = 10/20 bytes
     124struc DPT_SERIAL
    128125    .dpt                    resb    DPT_size
    129126    .wSerialPortAndBaud:
  • trunk/XTIDE_Universal_BIOS/Inc/DeviceIDE.inc

    r444 r473  
    3232
    3333%ifdef MODULE_FEATURE_SETS
    34 TIMEOUT_BSY             EQU     TIMEOUT_MOTOR_STARTUP
    35 TIMEOUT_DRDY            EQU     TIMEOUT_MOTOR_STARTUP
     34    TIMEOUT_BSY         EQU     TIMEOUT_MOTOR_STARTUP
     35    TIMEOUT_DRDY        EQU     TIMEOUT_MOTOR_STARTUP
    3636%else
    37 TIMEOUT_BSY             EQU     (2600/55)   ; 2600 ms
    38 TIMEOUT_DRDY            EQU     (2600/55)   ; 2600 ms
     37    TIMEOUT_BSY         EQU     (2600/55)   ; 2600 ms
     38    TIMEOUT_DRDY        EQU     (2600/55)   ; 2600 ms
    3939%endif
    4040
  • trunk/XTIDE_Universal_BIOS/Inc/IdeIO.inc

    r400 r473  
    2121%define IDE_IO_INC
    2222
    23 JRIDE_SECTOR_ACCESS_WINDOW_OFFSET           EQU 3C00h   ; 512 byte IDE Sector Access Window
    24 JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET  EQU 3E00h   ; 8 byte CS0 IDE Register Window
    25 JRIDE_CONTROL_BLOCK_REGISTER_WINDOW_OFFSET  EQU 3E08h   ; 8 byte CS1 IDE Register Window
    26 JRIDE_SECTOR_ACCESS_WINDOW_SIZE             EQU 512     ; 512 bytes
    27 
    28 
    2923;--------------------------------------------------------------------
    30 ; OUTPUT_AL_TO_IDE_REGISTER_IN_DL
    31 ; JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER_IN_DL
    32 ; OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER_IN_DL
     24; OUTPUT_AL_TO_IDE_REGISTER
     25; OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER
    3326;   Parameters:
    3427;       AL:     Byte to output
     
    4235;--------------------------------------------------------------------
    4336%macro OUTPUT_AL_TO_IDE_REGISTER 1
    44 %ifnidni %1, dl
    45     mov     dl, %1
     37%ifndef MODULE_8BIT_IDE ; Standard IDE controllers only
     38
     39    %ifnidni %1, dx
     40        mov     dx, %1
     41    %endif
     42    add     dx, [di+DPT.wBasePort]
     43    out     dx, al
     44
     45%else   ; Register translations required
     46
     47    %ifnidni %1, dl
     48        mov     dl, %1
     49    %endif
     50    call    IdeIO_OutputALtoIdeRegisterInDL
     51
    4652%endif
    47     call    IdeIO_OutputALtoIdeRegisterInDL
    4853%endmacro
    4954
    50 %macro JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER 1
    51 %ifnidni %1, dl
    52     mov     dl, %1
    53 %endif
    54     jmp     IdeIO_OutputALtoIdeRegisterInDL
    55 %endmacro
    5655
    5756%macro OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER 1
    58 %ifnidni %1, dl
    59     mov     dl, %1
     57%ifndef MODULE_8BIT_IDE ; Standard IDE controllers only
     58
     59    %ifnidni %1, dx
     60        mov     dx, %1
     61    %endif
     62    eMOVZX  bx, BYTE [di+DPT.bIdevarsOffset]
     63    add     dx, [cs:bx+IDEVARS.wControlBlockPort]
     64    out     dx, al
     65
     66%else   ; Register translations required
     67
     68    %ifnidni %1, dl
     69        mov     dl, %1
     70    %endif
     71    call    IdeIO_OutputALtoIdeControlBlockRegisterInDL
     72
    6073%endif
    61     call    IdeIO_OutputALtoIdeControlBlockRegisterInDL
    6274%endmacro
    6375
     
    7486;--------------------------------------------------------------------
    7587%macro INPUT_TO_AL_FROM_IDE_REGISTER 1
    76 %ifnidni %1, dl
    77     mov     dl, %1
     88%ifndef MODULE_8BIT_IDE ; Standard IDE controllers only
     89
     90    %ifnidni %1, dx
     91        mov     dx, %1
     92    %endif
     93    add     dx, [di+DPT.wBasePort]
     94    in      al, dx
     95
     96%else   ; Register translations required
     97
     98    %ifnidni %1, dl
     99        mov     dl, %1
     100    %endif
     101        call    IdeIO_InputToALfromIdeRegisterInDL
     102
    78103%endif
    79     call    IdeIO_InputToALfromIdeRegisterInDL
    80104%endmacro
    81105
  • trunk/XTIDE_Universal_BIOS/Inc/IdeRegisters.inc

    r437 r473  
    103103FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE   EQU     01h     ; CFA feature set only
    104104FEATURE_ENABLE_WRITE_CACHE              EQU     02h
     105FEATURE_DISABLE_8BIT_PIO_TRANSFER_MODE  EQU     81h     ; CFA feature set only
    105106FEATURE_DISABLE_WRITE_CACHE             EQU     82h     ; Can also be used to flush cache
    106107FEATURE_SET_TRANSFER_MODE               EQU     03h     ; Transfer mode goes to the Sector Count Register
  • trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc

    r471 r473  
    3232%endif
    3333
    34 %ifdef MODULE_JRIDE
    35     %ifndef MODULE_8BIT_IDE
    36         %define MODULE_8BIT_IDE
    37     %endif
    38 %endif
    39 
    4034
    4135
     
    4438    %include "IDE_8bit.inc"         ; For IDE 8-bit data port macros
    4539    %include "XTCF.inc"             ; For Lo-tech XT-CF
     40    %include "JRIDE_ISA.inc"        ; For JR-IDE/ISA
    4641%endif
    4742
     
    10499%endif
    105100
    106 %ifdef MODULE_JRIDE
    107     MAIN_FLG_MODULE_JRIDE   EQU FLG_ROMVARS_MODULE_JRIDE
    108 %else
    109     MAIN_FLG_MODULE_JRIDE   EQU 0
    110 %endif
    111 
    112101%ifdef MODULE_SERIAL
    113102    MAIN_FLG_MODULE_SERIAL  EQU FLG_ROMVARS_MODULE_SERIAL
     
    134123%endif
    135124
    136 MASK_ROMVARS_INCLUDED_MODULES   EQU MAIN_FLG_MODULE_8BIT_IDE | MAIN_FLG_MODULE_ADVANCED_ATA | MAIN_FLG_MODULE_BOOT_MENU | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_HOTKEYS | MAIN_FLG_MODULE_IRQ | MAIN_FLG_MODULE_JRIDE | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_SERIAL_FLOPPY | MAIN_FLG_MODULE_STRINGS_COMPRESSED | MAIN_FLG_MODULE_FEATURE_SETS
     125MASK_ROMVARS_INCLUDED_MODULES   EQU MAIN_FLG_MODULE_8BIT_IDE | MAIN_FLG_MODULE_ADVANCED_ATA | MAIN_FLG_MODULE_BOOT_MENU | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_HOTKEYS | MAIN_FLG_MODULE_IRQ | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_SERIAL_FLOPPY | MAIN_FLG_MODULE_STRINGS_COMPRESSED | MAIN_FLG_MODULE_FEATURE_SETS
  • trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r437 r473  
    7272FLG_ROMVARS_MODULE_FEATURE_SETS         EQU (1<<5)
    7373FLG_ROMVARS_MODULE_8BIT_IDE             EQU (1<<6)
    74 FLG_ROMVARS_MODULE_JRIDE                EQU (1<<7)
     74
    7575FLG_ROMVARS_MODULE_ADVANCED_ATA         EQU (1<<8)
    7676FLG_ROMVARS_MODULE_BOOT_MENU            EQU (1<<9)
     
    9191;;; Word 0
    9292    .wSerialPortAndBaud:                    ; Serial connection port (low, divided by 4) and baud rate divisor (high)
    93     .wPort:                                 ; IDE Base Port for Command Block (usual) Registers
     93    .wBasePort:                             ; IDE Base Port for Command Block (usual) Registers
    9494    .bSerialPort                resb    1
    9595    .bSerialBaud                resb    1
    9696
    9797;;; Word 1
    98     .wPortCtrl:
     98    .wControlBlockPort:
     99    .bXTCFcontrolRegister:                  ; XT-CF autodetects ports
    99100    .bSerialUnused              resb    1   ; IDE Base Port for Control Block Registers
    100101
     
    104105;;; Word 2
    105106    .bDevice                    resb    1   ; Device type
    106 
    107107    .bIRQ                       resb    1   ; Interrupt Request Number
    108108
     
    137137
    138138; Device types for IDEVARS.bDevice
     139; IDE Devices are grouped so device numbers cannot be changed without modifying code elsewhere!
    139140;
    140 DEVICE_8BIT_JRIDE_ISA                   EQU (0<<1)  ; JR-IDE/ISA (must be 0)
    141 DEVICE_8BIT_XTCF                        EQU (1<<1)  ; Lo-tech XT-CF
    142 DEVICE_8BIT_XTIDE_REV2                  EQU (2<<1)  ; Or rev 1 with swapped A0 and A3 (must be 1 or 2)
    143 DEVICE_8BIT_XTIDE_REV1                  EQU (3<<1)  ; Must be 4
    144 COUNT_OF_8BIT_IDE_DEVICES               EQU 4
    145 
    146 DEVICE_16BIT_ATA                        EQU (COUNT_OF_8BIT_IDE_DEVICES<<1)
    147 DEVICE_32BIT_ATA                        EQU ((COUNT_OF_8BIT_IDE_DEVICES+1)<<1)
    148 COUNT_OF_16BIT_IDE_DEVICES              EQU 2
    149 COUNT_OF_ALL_IDE_DEVICES                EQU (COUNT_OF_8BIT_IDE_DEVICES + COUNT_OF_16BIT_IDE_DEVICES)
    150 
     141COUNT_OF_STANDARD_IDE_DEVICES           EQU 2
     142COUNT_OF_8BIT_IDE_DEVICES               EQU 6
     143COUNT_OF_ALL_IDE_DEVICES                EQU (COUNT_OF_8BIT_IDE_DEVICES + COUNT_OF_STANDARD_IDE_DEVICES)
     144; Standard port mapped I/O
     145DEVICE_16BIT_ATA                        EQU (0<<1)
     146DEVICE_32BIT_ATA                        EQU (1<<1)
     147DEVICE_8BIT_XTIDE_REV1                  EQU (COUNT_OF_STANDARD_IDE_DEVICES<<1)
     148; Address lines A0 and A3 are swapped
     149DEVICE_8BIT_XTIDE_REV2                  EQU ((COUNT_OF_STANDARD_IDE_DEVICES+1)<<1)  ; Or rev 1 with swapped A0 and A3
     150; IDE Register offsets are SHL 1
     151DEVICE_8BIT_XTCF_PIO8                   EQU ((COUNT_OF_STANDARD_IDE_DEVICES+2)<<1)  ; XT-CF using 8-bit PIO mode
     152DEVICE_8BIT_XTCF_DMA                    EQU ((COUNT_OF_STANDARD_IDE_DEVICES+3)<<1)  ; XT-CF using DMA
     153DEVICE_8BIT_XTCF_MEMMAP                 EQU ((COUNT_OF_STANDARD_IDE_DEVICES+4)<<1)  ; XT-CF using Memory Mapped transfers (not I/O)
     154; Memory Mapped I/O
     155DEVICE_8BIT_JRIDE_ISA                   EQU ((COUNT_OF_STANDARD_IDE_DEVICES+5)<<1)  ; JR-IDE/ISA (Memory Mapped I/O)
     156; Virtual devices
    151157DEVICE_SERIAL_PORT                      EQU (COUNT_OF_ALL_IDE_DEVICES<<1)
    152158
  • trunk/XTIDE_Universal_BIOS/Inc/Version.inc

    r461 r473  
    4242
    4343%define TITLE_STRING            TITLE_STRING_START, TITLE_STRING_END
    44 %define ROM_VERSION_STRING      "v2.0.0",BETA,"2 (",__DATE__,")",NULL
    45 %define FLASH_SIGNATURE         "XTIDE201"  ; Do not terminate with NULL
     44%define ROM_VERSION_STRING      "v2.0.0",BETA,"2+ (",__DATE__,")",NULL
     45%define FLASH_SIGNATURE         "XTIDE203"  ; Do not terminate with NULL
    4646
    4747
Note: See TracChangeset for help on using the changeset viewer.