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, 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 Module Name: FrameworkLegacy16.h
18 @par Revision Reference:
19 These definitions are from Compatibility Support Module Spec
24 #ifndef _FRAMEWORK_LEGACY_16_H_
25 #define _FRAMEWORK_LEGACY_16_H_
31 typedef UINT8 SERIAL_MODE
;
32 typedef UINT8 PARALLEL_MODE
;
35 // EFI_COMPATIBILITY16_TABLE is located at a 16-byte boundary starting with the
38 #define EFI_COMPATIBILITY16_TABLE_SIGNATURE SIGNATURE_32 ('I', 'F', 'E', '$')
43 UINT8 EfiMajorRevision
;
44 UINT8 EfiMinorRevision
;
45 UINT8 TableMajorRevision
;
46 UINT8 TableMinorRevision
;
48 UINT16 Compatibility16CallSegment
;
49 UINT16 Compatibility16CallOffset
;
50 UINT16 PnPInstallationCheckSegment
;
51 UINT16 PnPInstallationCheckOffset
;
52 UINT32 EfiSystemTable
; // The physical address of EFI_SYSTEM_TABLE
53 UINT32 OemIdStringPointer
;
54 UINT32 AcpiRsdPtrPointer
;
58 UINT32 IrqRoutingTablePointer
;
59 UINT32 IrqRoutingTableLength
;
71 UINT32 PciExpressBase
;
73 } EFI_COMPATIBILITY16_TABLE
;
76 // Functions provided by the CSM binary
79 Legacy16InitializeYourself
= 0x0000,
80 Legacy16UpdateBbs
= 0x0001,
81 Legacy16PrepareToBoot
= 0x0002,
82 Legacy16Boot
= 0x0003,
83 Legacy16RetrieveLastBootDevice
= 0x0004,
84 Legacy16DispatchOprom
= 0x0005,
85 Legacy16GetTableAddress
= 0x0006,
86 Legacy16SetKeyboardLeds
= 0x0007,
87 Legacy16InstallPciHandler
= 0x0008
88 } EFI_COMPATIBILITY_FUNCTIONS
;
91 ///////////////////////////////////////////////////////////////////////////////
92 // EFI_DISPATCH_OPROM_TABLE
93 ///////////////////////////////////////////////////////////////////////////////
96 UINT16 PnPInstallationCheckSegment
;
97 UINT16 PnPInstallationCheckOffset
;
100 UINT8 PciDeviceFunction
;
101 UINT8 NumberBbsEntries
;
102 VOID
*BbsTablePointer
; /// @bug: variable size on 32/64-bit systems.
103 UINT16 RuntimeSegment
;
104 } EFI_DISPATCH_OPROM_TABLE
;
107 // EFI_TO_COMPATIBILITY16_INIT_TABLE
110 UINT32 BiosLessThan1MB
;
112 UINT32 HiPmmMemorySizeInBytes
;
113 UINT16 ReverseThunkCallSegment
;
114 UINT16 ReverseThunkCallOffset
;
115 UINT32 NumberE820Entries
;
116 UINT32 OsMemoryAbove1Mb
;
118 UINT32 ThunkSizeInBytes
;
120 UINT32 LowPmmMemorySizeInBytes
;
121 } EFI_TO_COMPATIBILITY16_INIT_TABLE
;
124 // EFI_TO_COMPATIBILITY16_BOOT_TABLE
128 // DEVICE_PRODUCER_SERIAL & its modes
134 } DEVICE_PRODUCER_SERIAL
;
136 #define DEVICE_SERIAL_MODE_NORMAL 0x00
137 #define DEVICE_SERIAL_MODE_IRDA 0x01
138 #define DEVICE_SERIAL_MODE_ASK_IR 0x02
139 #define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00
140 #define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10
143 // DEVICE_PRODUCER_PARALLEL & its modes
150 } DEVICE_PRODUCER_PARALLEL
;
152 #define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00
153 #define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01
154 #define DEVICE_PARALLEL_MODE_MODE_EPP 0x02
155 #define DEVICE_PARALLEL_MODE_MODE_ECP 0x03
158 // DEVICE_PRODUCER_FLOPPY
164 UINT8 NumberOfFloppy
;
165 } DEVICE_PRODUCER_FLOPPY
;
168 // LEGACY_DEVICE_FLAGS
172 UINT32 A20Port90
: 1;
173 UINT32 Reserved
: 30;
174 } LEGACY_DEVICE_FLAGS
;
177 // DEVICE_PRODUCER_DATA_HEADER
180 DEVICE_PRODUCER_SERIAL Serial
[4];
181 DEVICE_PRODUCER_PARALLEL Parallel
[3];
182 DEVICE_PRODUCER_FLOPPY Floppy
;
184 LEGACY_DEVICE_FLAGS Flags
;
185 } DEVICE_PRODUCER_DATA_HEADER
;
195 // HDD_INFO & its status
202 UINT16 CommandBaseAddress
;
203 UINT16 ControlBaseAddress
;
204 UINT16 BusMasterAddress
;
206 ATAPI_IDENTIFY IdentifyDrive
[2];
209 #define HDD_PRIMARY 0x01
210 #define HDD_SECONDARY 0x02
211 #define HDD_MASTER_ATAPI_CDROM 0x04
212 #define HDD_SLAVE_ATAPI_CDROM 0x08
213 #define HDD_MASTER_IDE 0x20
214 #define HDD_SLAVE_IDE 0x40
215 #define HDD_MASTER_ATAPI_ZIPDISK 0x10
216 #define HDD_SLAVE_ATAPI_ZIPDISK 0x80
222 UINT16 OldPosition
: 4;
223 UINT16 Reserved1
: 4;
226 UINT16 MediaPresent
: 2;
227 UINT16 Reserved2
: 4;
231 // BBS_TABLE, device type values & boot priority values
240 UINT16 MfgStringOffset
;
241 UINT16 MfgStringSegment
;
243 BBS_STATUS_FLAGS StatusFlags
;
244 UINT16 BootHandlerOffset
;
245 UINT16 BootHandlerSegment
;
246 UINT16 DescStringOffset
;
247 UINT16 DescStringSegment
;
248 UINT32 InitPerReserved
;
249 UINT32 AdditionalIrq13Handler
;
250 UINT32 AdditionalIrq18Handler
;
251 UINT32 AdditionalIrq19Handler
;
252 UINT32 AdditionalIrq40Handler
;
253 UINT8 AssignedDriveNumber
;
254 UINT32 AdditionalIrq41Handler
;
255 UINT32 AdditionalIrq46Handler
;
260 #define BBS_FLOPPY 0x01
261 #define BBS_HARDDISK 0x02
262 #define BBS_CDROM 0x03
263 #define BBS_PCMCIA 0x04
265 #define BBS_EMBED_NETWORK 0x06
266 #define BBS_BEV_DEVICE 0x80
267 #define BBS_UNKNOWN 0xff
269 #define BBS_DO_NOT_BOOT_FROM 0xFFFC
270 #define BBS_LOWEST_PRIORITY 0xFFFD
271 #define BBS_UNPRIORITIZED_ENTRY 0xFFFE
272 #define BBS_IGNORE_ENTRY 0xFFFF
275 // SMM_ATTRIBUTES & relating type, port and data size constants
279 UINT16 PortGranularity
: 3;
280 UINT16 DataGranularity
: 3;
284 #define STANDARD_IO 0x00
285 #define STANDARD_MEMORY 0x01
287 #define PORT_SIZE_8 0x00
288 #define PORT_SIZE_16 0x01
289 #define PORT_SIZE_32 0x02
290 #define PORT_SIZE_64 0x03
292 #define DATA_SIZE_8 0x00
293 #define DATA_SIZE_16 0x01
294 #define DATA_SIZE_32 0x02
295 #define DATA_SIZE_64 0x03
298 // SMM_FUNCTION & relating constants
301 UINT16 Function
: 15;
305 #define INT15_D042 0x0000
306 #define GET_USB_BOOT_INFO 0x0001
307 #define DMI_PNP_50_57 0x0002
309 #define STANDARD_OWNER 0x0
310 #define OEM_OWNER 0x1
315 // This structure assumes both port and data sizes are 1. SmmAttribute must be
316 // properly to reflect that assumption.
319 SMM_ATTRIBUTES SmmAttributes
;
320 SMM_FUNCTION SmmFunction
;
329 UINT16 NumSmmEntries
;
337 UINT8 DirectoryServiceValidity
: 1;
338 UINT8 RabcaUsedFlag
: 1;
339 UINT8 ExecuteHddDiagnosticsFlag
: 1;
347 UDC_ATTRIBUTES Attributes
;
349 UINT8 BbsTableEntryNumberForParentDevice
;
350 UINT8 BbsTableEntryNumberForBoot
;
351 UINT8 BbsTableEntryNumberForHddDiag
;
353 UINT8 ServiceAreaData
[64];
357 // EFI_TO_COMPATIBILITY16_BOOT_TABLE
359 #define EFI_TO_LEGACY_MAJOR_VERSION 0x02
360 #define EFI_TO_LEGACY_MINOR_VERSION 0x00
361 #define MAX_IDE_CONTROLLER 8
366 UINT32 AcpiTable
; // 4 GB range
367 UINT32 SmbiosTable
; // 4 GB range
368 UINT32 SmbiosTableLength
;
372 DEVICE_PRODUCER_DATA_HEADER SioData
;
373 UINT16 DevicePathType
;
375 UINT32 NumberE820Entries
;
377 // Controller & Drive Identify[2] per controller information
379 HDD_INFO HddInfo
[MAX_IDE_CONTROLLER
];
380 UINT32 NumberBbsEntries
;
383 UINT32 OsMemoryAbove1Mb
;
384 UINT32 UnconventionalDeviceTable
;
385 } EFI_TO_COMPATIBILITY16_BOOT_TABLE
;
388 // EFI_LEGACY_INSTALL_PCI_HANDLER
401 UINT8 PrimaryReserved
;
402 UINT16 PrimaryControl
;
404 UINT16 PrimaryBusMaster
;
409 UINT8 SecondaryReserved
;
410 UINT16 SecondaryControl
;
411 UINT16 SecondaryBase
;
412 UINT16 SecondaryBusMaster
;
413 } EFI_LEGACY_INSTALL_PCI_HANDLER
;
416 // Restore default pack value