2 API between 16-bit Legacy BIOS and EFI
4 We need to figure out what the 16-bit code is going to use to
5 represent these data structures. Is a pointer SEG:OFF or 32-bit...
7 Copyright (c) 2007-2009, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 @par Revision Reference:
17 These definitions are from Compatibility Support Module Spec
22 #ifndef _FRAMEWORK_LEGACY_16_H_
23 #define _FRAMEWORK_LEGACY_16_H_
29 typedef UINT8 SERIAL_MODE
;
30 typedef UINT8 PARALLEL_MODE
;
32 #define EFI_COMPATIBILITY16_TABLE_SIGNATURE SIGNATURE_32 ('I', 'F', 'E', '$')
35 /// EFI_COMPATIBILITY16_TABLE is located at a 16-byte boundary starting with the
42 UINT8 EfiMajorRevision
;
43 UINT8 EfiMinorRevision
;
44 UINT8 TableMajorRevision
;
45 UINT8 TableMinorRevision
;
47 UINT16 Compatibility16CallSegment
;
48 UINT16 Compatibility16CallOffset
;
49 UINT16 PnPInstallationCheckSegment
;
50 UINT16 PnPInstallationCheckOffset
;
51 UINT32 EfiSystemTable
; ///< The physical address of EFI_SYSTEM_TABLE
52 UINT32 OemIdStringPointer
;
53 UINT32 AcpiRsdPtrPointer
;
57 UINT32 IrqRoutingTablePointer
;
58 UINT32 IrqRoutingTableLength
;
70 UINT32 PciExpressBase
;
72 } EFI_COMPATIBILITY16_TABLE
;
75 /// Functions provided by the CSM binary
78 Legacy16InitializeYourself
= 0x0000,
79 Legacy16UpdateBbs
= 0x0001,
80 Legacy16PrepareToBoot
= 0x0002,
81 Legacy16Boot
= 0x0003,
82 Legacy16RetrieveLastBootDevice
= 0x0004,
83 Legacy16DispatchOprom
= 0x0005,
84 Legacy16GetTableAddress
= 0x0006,
85 Legacy16SetKeyboardLeds
= 0x0007,
86 Legacy16InstallPciHandler
= 0x0008
87 } EFI_COMPATIBILITY_FUNCTIONS
;
91 /// EFI_DISPATCH_OPROM_TABLE
94 UINT16 PnPInstallationCheckSegment
;
95 UINT16 PnPInstallationCheckOffset
;
98 UINT8 PciDeviceFunction
;
99 UINT8 NumberBbsEntries
;
100 VOID
*BbsTablePointer
; ///< @bug: variable size on 32/64-bit systems.
101 UINT16 RuntimeSegment
;
102 } EFI_DISPATCH_OPROM_TABLE
;
105 /// EFI_TO_COMPATIBILITY16_INIT_TABLE
108 UINT32 BiosLessThan1MB
;
110 UINT32 HiPmmMemorySizeInBytes
;
111 UINT16 ReverseThunkCallSegment
;
112 UINT16 ReverseThunkCallOffset
;
113 UINT32 NumberE820Entries
;
114 UINT32 OsMemoryAbove1Mb
;
116 UINT32 ThunkSizeInBytes
;
118 UINT32 LowPmmMemorySizeInBytes
;
119 } EFI_TO_COMPATIBILITY16_INIT_TABLE
;
122 /// DEVICE_PRODUCER_SERIAL & its modes
128 } DEVICE_PRODUCER_SERIAL
;
130 #define DEVICE_SERIAL_MODE_NORMAL 0x00
131 #define DEVICE_SERIAL_MODE_IRDA 0x01
132 #define DEVICE_SERIAL_MODE_ASK_IR 0x02
133 #define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00
134 #define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10
137 /// DEVICE_PRODUCER_PARALLEL & its modes
144 } DEVICE_PRODUCER_PARALLEL
;
146 #define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00
147 #define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01
148 #define DEVICE_PARALLEL_MODE_MODE_EPP 0x02
149 #define DEVICE_PARALLEL_MODE_MODE_ECP 0x03
152 /// DEVICE_PRODUCER_FLOPPY
158 UINT8 NumberOfFloppy
;
159 } DEVICE_PRODUCER_FLOPPY
;
162 /// LEGACY_DEVICE_FLAGS
166 UINT32 A20Port90
: 1;
167 UINT32 Reserved
: 30;
168 } LEGACY_DEVICE_FLAGS
;
171 /// DEVICE_PRODUCER_DATA_HEADER
174 DEVICE_PRODUCER_SERIAL Serial
[4];
175 DEVICE_PRODUCER_PARALLEL Parallel
[3];
176 DEVICE_PRODUCER_FLOPPY Floppy
;
178 LEGACY_DEVICE_FLAGS Flags
;
179 } DEVICE_PRODUCER_DATA_HEADER
;
189 /// HDD_INFO & its status
196 UINT16 CommandBaseAddress
;
197 UINT16 ControlBaseAddress
;
198 UINT16 BusMasterAddress
;
200 ATAPI_IDENTIFY IdentifyDrive
[2];
203 #define HDD_PRIMARY 0x01
204 #define HDD_SECONDARY 0x02
205 #define HDD_MASTER_ATAPI_CDROM 0x04
206 #define HDD_SLAVE_ATAPI_CDROM 0x08
207 #define HDD_MASTER_IDE 0x20
208 #define HDD_SLAVE_IDE 0x40
209 #define HDD_MASTER_ATAPI_ZIPDISK 0x10
210 #define HDD_SLAVE_ATAPI_ZIPDISK 0x80
216 UINT16 OldPosition
: 4;
217 UINT16 Reserved1
: 4;
220 UINT16 MediaPresent
: 2;
221 UINT16 Reserved2
: 4;
225 /// BBS_TABLE, device type values & boot priority values
234 UINT16 MfgStringOffset
;
235 UINT16 MfgStringSegment
;
237 BBS_STATUS_FLAGS StatusFlags
;
238 UINT16 BootHandlerOffset
;
239 UINT16 BootHandlerSegment
;
240 UINT16 DescStringOffset
;
241 UINT16 DescStringSegment
;
242 UINT32 InitPerReserved
;
243 UINT32 AdditionalIrq13Handler
;
244 UINT32 AdditionalIrq18Handler
;
245 UINT32 AdditionalIrq19Handler
;
246 UINT32 AdditionalIrq40Handler
;
247 UINT8 AssignedDriveNumber
;
248 UINT32 AdditionalIrq41Handler
;
249 UINT32 AdditionalIrq46Handler
;
254 #define BBS_FLOPPY 0x01
255 #define BBS_HARDDISK 0x02
256 #define BBS_CDROM 0x03
257 #define BBS_PCMCIA 0x04
259 #define BBS_EMBED_NETWORK 0x06
260 #define BBS_BEV_DEVICE 0x80
261 #define BBS_UNKNOWN 0xff
263 #define BBS_DO_NOT_BOOT_FROM 0xFFFC
264 #define BBS_LOWEST_PRIORITY 0xFFFD
265 #define BBS_UNPRIORITIZED_ENTRY 0xFFFE
266 #define BBS_IGNORE_ENTRY 0xFFFF
269 /// SMM_ATTRIBUTES & relating type, port and data size constants
273 UINT16 PortGranularity
: 3;
274 UINT16 DataGranularity
: 3;
278 #define STANDARD_IO 0x00
279 #define STANDARD_MEMORY 0x01
281 #define PORT_SIZE_8 0x00
282 #define PORT_SIZE_16 0x01
283 #define PORT_SIZE_32 0x02
284 #define PORT_SIZE_64 0x03
286 #define DATA_SIZE_8 0x00
287 #define DATA_SIZE_16 0x01
288 #define DATA_SIZE_32 0x02
289 #define DATA_SIZE_64 0x03
292 /// SMM_FUNCTION & relating constants
295 UINT16 Function
: 15;
299 #define INT15_D042 0x0000
300 #define GET_USB_BOOT_INFO 0x0001
301 #define DMI_PNP_50_57 0x0002
303 #define STANDARD_OWNER 0x0
304 #define OEM_OWNER 0x1
309 * This structure assumes both port and data sizes are 1. SmmAttribute must be
310 * properly to reflect that assumption.
313 SMM_ATTRIBUTES SmmAttributes
;
314 SMM_FUNCTION SmmFunction
;
323 UINT16 NumSmmEntries
;
331 UINT8 DirectoryServiceValidity
: 1;
332 UINT8 RabcaUsedFlag
: 1;
333 UINT8 ExecuteHddDiagnosticsFlag
: 1;
341 UDC_ATTRIBUTES Attributes
;
343 UINT8 BbsTableEntryNumberForParentDevice
;
344 UINT8 BbsTableEntryNumberForBoot
;
345 UINT8 BbsTableEntryNumberForHddDiag
;
347 UINT8 ServiceAreaData
[64];
350 #define EFI_TO_LEGACY_MAJOR_VERSION 0x02
351 #define EFI_TO_LEGACY_MINOR_VERSION 0x00
352 #define MAX_IDE_CONTROLLER 8
355 /// EFI_TO_COMPATIBILITY16_BOOT_TABLE
360 UINT32 AcpiTable
; ///< 4 GB range
361 UINT32 SmbiosTable
; ///< 4 GB range
362 UINT32 SmbiosTableLength
;
366 DEVICE_PRODUCER_DATA_HEADER SioData
;
367 UINT16 DevicePathType
;
369 UINT32 NumberE820Entries
;
371 // Controller & Drive Identify[2] per controller information
373 HDD_INFO HddInfo
[MAX_IDE_CONTROLLER
];
374 UINT32 NumberBbsEntries
;
377 UINT32 OsMemoryAbove1Mb
;
378 UINT32 UnconventionalDeviceTable
;
379 } EFI_TO_COMPATIBILITY16_BOOT_TABLE
;
382 /// EFI_LEGACY_INSTALL_PCI_HANDLER
395 UINT8 PrimaryReserved
;
396 UINT16 PrimaryControl
;
398 UINT16 PrimaryBusMaster
;
403 UINT8 SecondaryReserved
;
404 UINT16 SecondaryControl
;
405 UINT16 SecondaryBase
;
406 UINT16 SecondaryBusMaster
;
407 } EFI_LEGACY_INSTALL_PCI_HANDLER
;
410 // Restore default pack value
414 #endif /* _FRAMEWORK_LEGACY_16_H_ */