source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc@ 591

Last change on this file since 591 was 589, checked in by Krister Nordvall, 9 years ago

Changes:

  • BIOS: Fixed a purely cosmetic bug from r542 where, in builds containing MODULE_EBIOS, the boot menu would display an incorrect drive size (0.4 kB with MODULE_STRINGS_COMPRESSED or 0.5 kB without) for old drives with no support for LBA.
  • Fixed a bug from r392 where Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent would return the ID in AL instead of AH (if DANGEROUS_DETECTION had been defined).
  • Fixed a bug from r587 in AdvAtaInit.asm that would prevent detection of QDI Vision controllers.
  • Also changed how the QDI Vision IDs are defined (removed the need for shifting) to avoid confusion. This fixed a potential bug from r587 in AdvAtaInit.asm where some IDs were not being shifted.
  • Fixed a bug in PDC20x30.asm from r587 where GetPdcIDtoAX would not return with the IDE base port in DX so DisablePdcProgrammingMode would fail.
  • Made some changes to ModuleDependency.inc and other files so that MODULE_ADVANCED_ATA now requires USE_386. Consequently it is no longer included in the regular AT-builds, only in the 386_8k-build.
  • Moved the UNROLL_SECTORS_IN_CX_TO_xWORDS macros from IDE_8bit.inc to IdeIO.inc which means it's now possible to build a BIOS without MODULE_8BIT_IDE.
  • XTIDECFG: Added a minimum DOS version check (since it needs DOS version 2+) to allow the program to quit gracefully in the unlikely scenario where someone tries to run it under DOS version 1.
  • Made some changes to Drive.asm to improve drive enumeration. The old method using GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE worked well in Windows XP but not in Windows 98 SE (in Windows or in DOS mode). The two problems were; 1) The function call would access the drives which on single floppy drive systems would cause Windows to swap between A: and B: (throwing a blue screen asking the user to insert a disk etc). 2) Only floppy drives and FAT16 drives would be available in the list of drives, no FAT32/optical/network drives.
  • Improved code in IdeControllerMenu.asm so that the default port addresses for all IDE interfaces are now restored when (re-)selecting the (same) type of IDE device.
  • Also made it impossible to select a device type unless the required module is included in the loaded BIOS.
  • The version check done when loading a BIOS now uses the FLASH_SIGNATURE definition from Version.inc. Any changes affecting RomVars now only requires updating that definition. This means that changes to RomVars must be implemented in both the BIOS and XTIDECFG before being committed to the repository.
  • Added a compatibility fix for 3Com 3C503 cards to the ROM checksumming code in Buffers.asm (Buffers_GenerateChecksum).
  • SerDrive: Made some minor changes to file names and paths to improve compatibility with case sensitive environments.
  • BIOSDRVS: Made a minor size optimization which as a side effect also makes it compatible with all DOS versions including DOS version 1.
  • Library: Renamed the WAIT_RETRACE_IF_NECESSARY_THEN macro to CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN and made a tail-call-optimized version of it (JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN).
  • A speed optimization to the eRCL_IM macro for 386 and higher. This change breaks emulation in the sense that the macro will fail when given a memory operand as the first parameter.
  • Other minor optimizations and fixes.
File size: 8.9 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Defines for ROMVARS struct containing variables stored
3; in BIOS ROM.
4
5;
6; XTIDE Universal BIOS and Associated Tools
7; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
8;
9; This program is free software; you can redistribute it and/or modify
10; it under the terms of the GNU General Public License as published by
11; the Free Software Foundation; either version 2 of the License, or
12; (at your option) any later version.
13;
14; This program is distributed in the hope that it will be useful,
15; but WITHOUT ANY WARRANTY; without even the implied warranty of
16; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17; GNU General Public License for more details.
18; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19;
20
21%ifndef ROMVARS_INC
22%define ROMVARS_INC
23
24; ROM Variables. Written to the ROM image before flashing.
25struc ROMVARS
26 .wRomSign resb 2 ; ROM Signature (AA55h)
27 .bRomSize resb 1 ; ROM size in 512 byte blocks
28 .rgbJump resb 3 ; First instruction to ROM init (jmp)
29
30 .rgbSign resb 8 ; Signature for XTIDE Configurator Program
31 .szTitle resb 31 ; BIOS title string
32 .szVersion resb 25 ; BIOS version string
33
34 .wFlags resb 2 ; Word for ROM flags
35 .wDisplayMode resb 2 ; Display mode for boot menu
36 .wBootTimeout resb 2 ; Boot Menu selection timeout in system timer ticks
37 .bIdeCnt resb 1 ; Number of available IDE controllers
38 .bBootDrv resb 1 ; Default drive to boot from
39 .bMinFddCnt resb 1 ; Minimum number of Floppy Drives
40 .bStealSize resb 1 ; Number of 1kB blocks stolen from 640kB base RAM
41 .bIdleTimeout resb 1 ; Standby timer value
42
43 .ideVarsBegin:
44 .ideVars0 resb IDEVARS_size
45 .ideVars1 resb IDEVARS_size
46 .ideVars2 resb IDEVARS_size
47 .ideVars3 resb IDEVARS_size
48
49%ifdef MODULE_SERIAL
50 .ideVarsSerialAuto resb IDEVARS_size
51%endif
52
53 .ideVarsEnd:
54endstruc
55
56%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
57 %if ROMVARS.ideVarsEnd & 0xff00 <> 0
58 %error ".ideVars structures must fit within the first 256 bytes of the ROM image"
59 %endif
60 %if (ROMVARS.ideVarsEnd - ROMVARS.ideVarsBegin) = 0
61 %error "there must be at least one .ideVars structure, it would be bizarre if this were not true, but it is assumed in the ah0h reset code."
62 %endif
63%endif
64
65NUMBER_OF_IDEVARS EQU ((ROMVARS.ideVarsEnd - ROMVARS.ideVarsBegin) / IDEVARS_size)
66
67; Bit defines for ROMVARS.wFlags
68FLG_ROMVARS_FULLMODE EQU (1<<0) ; Full operating mode (steals base RAM, supports EBIOS etc.)
69FLG_ROMVARS_SERIAL_SCANDETECT EQU (1<<3) ; Scan COM ports at the end of drive detection. Can also be invoked
70 ; by holding down the ALT key at the end of drive detection.
71 ; (Conveniently, this is 8, a fact we exploit when testing the bit)
72
73; Here in case the configuration needs to know functionality is present. Note! Changing the order/location of these flags
74; also requires changes elsewhere as they are usually tested using byte-accesses for efficiency.
75FLG_ROMVARS_MODULE_POWER_MANAGEMENT EQU (1<<5)
76FLG_ROMVARS_MODULE_8BIT_IDE EQU (1<<6)
77FLG_ROMVARS_MODULE_8BIT_IDE_ADVANCED EQU (1<<7)
78FLG_ROMVARS_MODULE_ADVANCED_ATA EQU (1<<8)
79FLG_ROMVARS_MODULE_BOOT_MENU EQU (1<<9)
80FLG_ROMVARS_MODULE_EBIOS EQU (1<<10)
81FLG_ROMVARS_MODULE_HOTKEYS EQU (1<<11)
82FLG_ROMVARS_MODULE_IRQ EQU (1<<12)
83FLG_ROMVARS_MODULE_SERIAL EQU (1<<13)
84FLG_ROMVARS_MODULE_SERIAL_FLOPPY EQU (1<<14)
85FLG_ROMVARS_MODULE_STRINGS_COMPRESSED EQU (1<<15)
86
87
88; Boot Menu Display Modes (see Assembly Library Display.inc for standard modes)
89DEFAULT_TEXT_MODE EQU 4
90
91
92; Controller specific variables
93struc IDEVARS
94;;; Word 0
95 .wSerialPortAndBaud: ; Serial connection port (low, divided by 4) and baud rate divisor (high)
96 .wBasePort: ; IDE Base Port for Command Block (usual) Registers
97 .bSerialPort resb 1
98 .bSerialBaud resb 1
99
100;;; Word 1
101 .wControlBlockPort:
102 .bSerialUnused resb 1 ; IDE Base Port for Control Block Registers
103
104 .wSerialCOMPortCharAndDevice: ; In DetectPrint, we grab the COM Port char and Device at the same time
105 .bSerialCOMPortChar resb 1 ; Serial connection COM port number/letter
106
107;;; Word 2
108 .bDevice resb 1 ; Device type
109 .bIRQ resb 1 ; Interrupt Request Number
110
111;;; And more...
112 .drvParamsMaster resb DRVPARAMS_size
113 .drvParamsSlave resb DRVPARAMS_size
114endstruc
115
116%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
117 %if IDEVARS.bSerialCOMPortChar+1 != IDEVARS.bDevice
118 %error "IDEVARS.bSerialCOMPortChar needs to come immediately before IDEVARS.bDevice so that both bytes can be fetched at the same time inside DetectPrint.asm"
119 %endif
120%endif
121
122STANDARD_CONTROL_BLOCK_OFFSET EQU 200h
123XTIDE_CONTROL_BLOCK_OFFSET EQU 8h ; for XTIDE, A3 is used to control selected register (CS0 vs CS1)...
124XTCF_CONTROL_BLOCK_OFFSET EQU 10h ; ...and for XT-CF (all variants), it's A4
125ADP50L_CONTROL_BLOCK_OFFSET EQU 10h
126
127; Default values for Port and PortCtrl, shared with the configurator
128;
129DEVICE_XTIDE_DEFAULT_PORT EQU 300h ; Also the default port for XT-CF
130DEVICE_XTIDE_DEFAULT_PORTCTRL EQU (DEVICE_XTIDE_DEFAULT_PORT + XTIDE_CONTROL_BLOCK_OFFSET)
131; Note XT-CF control port is SHL 1 relative to XTIDE, and coded that way hence no need for specific definition like...
132; DEVICE_XTCF_DEFAULT_PORTCTRL EQU (DEVICE_XTIDE_DEFAULT_PORT + XTCF_CONTROL_BLOCK_OFFSET)
133
134DEVICE_ATA_PRIMARY_PORT EQU 1F0h
135DEVICE_ATA_PRIMARY_PORTCTRL EQU (DEVICE_ATA_PRIMARY_PORT + STANDARD_CONTROL_BLOCK_OFFSET)
136
137DEVICE_ATA_SECONDARY_PORT EQU 170h
138DEVICE_ATA_SECONDARY_PORTCTRL EQU (DEVICE_ATA_SECONDARY_PORT + STANDARD_CONTROL_BLOCK_OFFSET)
139
140DEVICE_ATA_TERTIARY_PORT EQU 1E8h
141DEVICE_ATA_TERTIARY_PORTCTRL EQU (DEVICE_ATA_TERTIARY_PORT + STANDARD_CONTROL_BLOCK_OFFSET)
142
143DEVICE_ATA_QUATERNARY_PORT EQU 168h
144DEVICE_ATA_QUATERNARY_PORTCTRL EQU (DEVICE_ATA_QUATERNARY_PORT + STANDARD_CONTROL_BLOCK_OFFSET)
145
146
147; Device types for IDEVARS.bDevice
148; IDE Devices are grouped so device numbers cannot be changed without modifying code elsewhere!
149COUNT_OF_STANDARD_IDE_DEVICES EQU 2 ; 16- and 32-bit controllers
150COUNT_OF_8BIT_IDE_DEVICES EQU 9
151COUNT_OF_ALL_IDE_DEVICES EQU (COUNT_OF_8BIT_IDE_DEVICES + COUNT_OF_STANDARD_IDE_DEVICES)
152; Standard port mapped I/O
153DEVICE_16BIT_ATA EQU (0<<1)
154DEVICE_32BIT_ATA EQU (1<<1)
155DEVICE_8BIT_ATA EQU ((COUNT_OF_STANDARD_IDE_DEVICES+0)<<1) ; 16- or 32-bit controller in 8-bit mode
156DEVICE_8BIT_XTIDE_REV1 EQU ((COUNT_OF_STANDARD_IDE_DEVICES+1)<<1)
157; Address lines A0 and A3 are swapped
158DEVICE_8BIT_XTIDE_REV2 EQU ((COUNT_OF_STANDARD_IDE_DEVICES+2)<<1) ; Or rev 1 with swapped A0 and A3
159; IDE Register offsets are SHL 1
160DEVICE_8BIT_XTCF_PIO8 EQU ((COUNT_OF_STANDARD_IDE_DEVICES+3)<<1) ; XT-CF using 8-bit PIO mode
161DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD EQU ((COUNT_OF_STANDARD_IDE_DEVICES+4)<<1) ; XT-CF using 8-bit PIO mode, but with 16-bit instructions
162DEVICE_8BIT_XTCF_PIO16_WITH_BIU_OFFLOAD EQU ((COUNT_OF_STANDARD_IDE_DEVICES+5)<<1) ; Lo-tech 8-bit IDE Adapter
163DEVICE_8BIT_XTCF_DMA EQU ((COUNT_OF_STANDARD_IDE_DEVICES+6)<<1) ; XT-CFv3 using DMA
164; Memory Mapped I/O
165DEVICE_8BIT_JRIDE_ISA EQU ((COUNT_OF_STANDARD_IDE_DEVICES+7)<<1) ; JR-IDE/ISA (Memory Mapped I/O)
166DEVICE_8BIT_ADP50L EQU ((COUNT_OF_STANDARD_IDE_DEVICES+8)<<1) ; SVC ADP50L (Memory Mapped I/O)
167; Virtual devices
168DEVICE_SERIAL_PORT EQU (COUNT_OF_ALL_IDE_DEVICES<<1)
169
170FIRST_XTCF_DEVICE EQU DEVICE_8BIT_XTCF_PIO8
171LAST_XTCF_DEVICE EQU DEVICE_8BIT_XTCF_DMA
172XTCF_DEVICE_OFFSET EQU FIRST_XTCF_DEVICE ; Used for XT-CF device <--> mode conversion
173
174; Master/Slave drive specific parameters
175struc DRVPARAMS
176 .wFlags resb 2 ; Drive flags
177 .dwMaximumLBA: ; User specified maximum number of sectors
178 .wCylinders resb 2 ; User specified cylinders (1...16383)
179 .wHeadsAndSectors:
180 .bHeads resb 1 ; User specified Heads (1...16)
181 .bSect resb 1 ; User specified Sectors per track (1...63)
182endstruc
183
184; Bit defines for DRVPARAMS.wFlags
185MASK_DRVPARAMS_WRITECACHE EQU (3<<0) ; Bits 0...1, Drive internal write cache settings (must start at bit 0)
186 DEFAULT_WRITE_CACHE EQU 0 ; Must be 0
187 DISABLE_WRITE_CACHE EQU 1
188 ENABLE_WRITE_CACHE EQU 2
189MASK_DRVPARAMS_TRANSLATEMODE EQU (3<<TRANSLATEMODE_FIELD_POSITION) ; Bits 2...3, Position shared with DPT
190 TRANSLATEMODE_FIELD_POSITION EQU 2
191 TRANSLATEMODE_NORMAL EQU 0 ; Must be zero
192 TRANSLATEMODE_LARGE EQU 1
193 TRANSLATEMODE_ASSISTED_LBA EQU 2 ; 28-bit or 48-bit LBA
194 TRANSLATEMODE_AUTO EQU 3 ; Only available in ROMVARS, not in DPTs
195FLG_DRVPARAMS_BLOCKMODE EQU (1<<4) ; Enable Block mode transfers
196FLG_DRVPARAMS_USERCHS EQU (1<<5) ; User specified P-CHS values
197 MAX_PCHS_CYLINDERS EQU 16383
198 MAX_PCHS_HEADS EQU 16
199 MAX_PCHS_SECTORS_PER_TRACK EQU 63
200 MAX_PCHS_TOTAL_SECTOR_COUNT EQU (MAX_PCHS_CYLINDERS * MAX_PCHS_HEADS * MAX_PCHS_SECTORS_PER_TRACK) ; 16,514,064
201FLG_DRVPARAMS_USERLBA EQU (1<<6) ; User specified LBA value
202
203%endif ; ROMVARS_INC
Note: See TracBrowser for help on using the repository browser.