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 Version 0.96.
23 #ifndef _FRAMEWORK_LEGACY_16_H_
24 #define _FRAMEWORK_LEGACY_16_H_
29 // All structures defined in this header file are packed on byte boundary
33 ///////////////////////////////////////////////////////////////////////////////
34 // EFI_COMPATIBILITY16_TABLE is located at a 16-byte boundary starting with the
36 ///////////////////////////////////////////////////////////////////////////////
38 #define EFI_COMPATIBILITY16_TABLE_SIGNATURE EFI_SIGNATURE_32('$', 'E', 'F', 'I')
41 UINT32 Signature
; // "$EFI"
44 UINT8 EfiMajorRevision
;
45 UINT8 EfiMinorRevision
;
46 UINT8 TableMajorRevision
;
47 UINT8 TableMinorRevision
;
49 UINT16 Compatibility16CallSegment
;
50 UINT16 Compatibility16CallOffset
;
51 UINT16 PnPInstallationCheckSegment
;
52 UINT16 PnPInstallationCheckOffset
;
53 UINT32 EfiSystemTable
; // The physical address of EFI_SYSTEM_TABLE
54 UINT32 OemIdStringPointer
;
55 UINT32 AcpiRsdPtrPointer
;
59 UINT32 IrqRoutingTablePointer
;
60 UINT32 IrqRoutingTableLength
;
72 UINT32 PciExpressBase
;
74 } EFI_COMPATIBILITY16_TABLE
;
76 ///////////////////////////////////////////////////////////////////////////////
77 // Functions provided by the CSM binary
78 ///////////////////////////////////////////////////////////////////////////////
80 Legacy16InitializeYourself
= 0x0000,
81 Legacy16UpdateBbs
= 0x0001,
82 Legacy16PrepareToBoot
= 0x0002,
83 Legacy16Boot
= 0x0003,
84 Legacy16RetrieveLastBootDevice
= 0x0004,
85 Legacy16DispatchOprom
= 0x0005,
86 Legacy16GetTableAddress
= 0x0006,
87 Legacy16SetKeyboardLeds
= 0x0007,
88 Legacy16InstallPciHandler
= 0x0008
89 } EFI_COMPATIBILITY_FUNCTIONS
;
91 ///////////////////////////////////////////////////////////////////////////////
92 // EFI_TO_COMPATIBILITY16_INIT_TABLE
93 ///////////////////////////////////////////////////////////////////////////////
95 UINT32 BiosLessThan1MB
;
97 UINT32 HiPmmMemorySizeInBytes
;
98 UINT16 ReverseThunkCallSegment
;
99 UINT16 ReverseThunkCallOffset
;
100 UINT32 NumberE820Entries
;
101 UINT32 OsMemoryAbove1Mb
;
103 UINT32 ThunkSizeInBytes
;
105 UINT32 LowPmmMemorySizeInBytes
;
106 } EFI_TO_COMPATIBILITY16_INIT_TABLE
;
108 ///////////////////////////////////////////////////////////////////////////////
109 // EFI_TO_COMPATIBILITY16_BOOT_TABLE
110 ///////////////////////////////////////////////////////////////////////////////
113 // DEVICE_PRODUCER_SERIAL & its modes
119 } DEVICE_PRODUCER_SERIAL
;
121 #define DEVICE_SERIAL_MODE_NORMAL 0x00
122 #define DEVICE_SERIAL_MODE_IRDA 0x01
123 #define DEVICE_SERIAL_MODE_ASK_IR 0x02
124 #define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00
125 #define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10
128 // DEVICE_PRODUCER_PARALLEL & its modes
135 } DEVICE_PRODUCER_PARALLEL
;
137 #define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00
138 #define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01
139 #define DEVICE_PARALLEL_MODE_MODE_EPP 0x02
140 #define DEVICE_PARALLEL_MODE_MODE_ECP 0x03
143 // DEVICE_PRODUCER_FLOPPY
149 UINT8 NumberOfFloppy
;
150 } DEVICE_PRODUCER_FLOPPY
;
153 // LEGACY_DEVICE_FLAGS
157 UINT32 A20Port90
: 1;
158 UINT32 Reserved
: 30;
159 } LEGACY_DEVICE_FLAGS
;
162 // DEVICE_PRODUCER_DATA_HEADER
165 DEVICE_PRODUCER_SERIAL Serial
[4];
166 DEVICE_PRODUCER_PARALLEL Parallel
[3];
167 DEVICE_PRODUCER_FLOPPY Floppy
;
169 LEGACY_DEVICE_FLAGS Flags
;
170 } DEVICE_PRODUCER_DATA_HEADER
;
180 // HDD_INFO & its status
187 UINT16 CommandBaseAddress
;
188 UINT16 ControlBaseAddress
;
189 UINT16 BusMasterAddress
;
191 ATAPI_IDENTIFY IdentifyDrive
[2];
194 #define HDD_PRIMARY 0x01
195 #define HDD_SECONDARY 0x02
196 #define HDD_MASTER_ATAPI_CDROM 0x04
197 #define HDD_SLAVE_ATAPI_CDROM 0x08
198 #define HDD_MASTER_IDE 0x20
199 #define HDD_SLAVE_IDE 0x40
200 #define HDD_MASTER_ATAPI_ZIPDISK 0x10
201 #define HDD_SLAVE_ATAPI_ZIPDISK 0x80
207 UINT16 OldPosition
: 4;
208 UINT16 Reserved1
: 4;
211 UINT16 MediaPresent
: 2;
212 UINT16 Reserved2
: 4;
216 // BBS_TABLE, device type values & boot priority values
225 UINT16 MfgStringOffset
;
226 UINT16 MfgStringSegment
;
228 BBS_STATUS_FLAGS StatusFlags
;
229 UINT16 BootHandlerOffset
;
230 UINT16 BootHandlerSegment
;
231 UINT16 DescStringOffset
;
232 UINT16 DescStringSegment
;
233 UINT32 InitPerReserved
;
234 UINT32 AdditionalIrq13Handler
;
235 UINT32 AdditionalIrq18Handler
;
236 UINT32 AdditionalIrq19Handler
;
237 UINT32 AdditionalIrq40Handler
;
238 UINT8 AssignedDriveNumber
;
239 UINT32 AdditionalIrq41Handler
;
240 UINT32 AdditionalIrq46Handler
;
245 #define BBS_FLOPPY 0x01
246 #define BBS_HARDDISK 0x02
247 #define BBS_CDROM 0x03
248 #define BBS_PCMCIA 0x04
250 #define BBS_EMBED_NETWORK 0x06
251 #define BBS_BEV_DEVICE 0x80
252 #define BBS_UNKNOWN 0xff
254 #define BBS_DO_NOT_BOOT_FROM 0xFFFC
255 #define BBS_LOWEST_PRIORITY 0xFFFD
256 #define BBS_UNPRIORITIZED_ENTRY 0xFFFE
257 #define BBS_IGNORE_ENTRY 0xFFFF
260 // SMM_ATTRIBUTES & relating type, port and data size constants
264 UINT16 PortGranularity
: 3;
265 UINT16 DataGranularity
: 3;
269 #define STANDARD_IO 0x00
270 #define STANDARD_MEMORY 0x01
272 #define PORT_SIZE_8 0x00
273 #define PORT_SIZE_16 0x01
274 #define PORT_SIZE_32 0x02
275 #define PORT_SIZE_64 0x03
277 #define DATA_SIZE_8 0x00
278 #define DATA_SIZE_16 0x01
279 #define DATA_SIZE_32 0x02
280 #define DATA_SIZE_64 0x03
283 // SMM_FUNCTION & relating constants
286 UINT16 Function
: 15;
290 #define INT15_D042 0x0000
291 #define GET_USB_BOOT_INFO 0x0001
292 #define DMI_PNP_50_57 0x0002
294 #define STANDARD_OWNER 0x0
295 #define OEM_OWNER 0x1
300 // This structure assumes both port and data sizes are 1. SmmAttribute must be
301 // properly to reflect that assumption.
304 SMM_ATTRIBUTES SmmAttributes
;
305 SMM_FUNCTION SmmFunction
;
314 UINT16 NumSmmEntries
;
322 UINT8 DirectoryServiceValidity
: 1;
323 UINT8 RabcaUsedFlag
: 1;
324 UINT8 ExecuteHddDiagnosticsFlag
: 1;
332 UDC_ATTRIBUTES Attributes
;
334 UINT8 BbsTableEntryNumberForParentDevice
;
335 UINT8 BbsTableEntryNumberForBoot
;
336 UINT8 BbsTableEntryNumberForHddDiag
;
338 UINT8 ServiceAreaData
[64];
342 // EFI_TO_COMPATIBILITY16_BOOT_TABLE
344 #define EFI_TO_LEGACY_MAJOR_VERSION 0x02
345 #define EFI_TO_LEGACY_MINOR_VERSION 0x00
346 #define MAX_IDE_CONTROLLER 8
351 UINT32 AcpiTable
; // 4 GB range
352 UINT32 SmbiosTable
; // 4 GB range
353 UINT32 SmbiosTableLength
;
358 DEVICE_PRODUCER_DATA_HEADER SioData
;
360 UINT16 DevicePathType
;
362 UINT32 NumberE820Entries
;
365 // Controller & Drive Identify[2] per controller information
367 HDD_INFO HddInfo
[MAX_IDE_CONTROLLER
];
369 UINT32 NumberBbsEntries
;
372 UINT32 OsMemoryAbove1Mb
;
373 UINT32 UnconventionalDeviceTable
;
374 } EFI_TO_COMPATIBILITY16_BOOT_TABLE
;
376 ///////////////////////////////////////////////////////////////////////////////
377 // EFI_DISPATCH_OPROM_TABLE
378 ///////////////////////////////////////////////////////////////////////////////
381 UINT16 PnPInstallationCheckSegment
;
382 UINT16 PnPInstallationCheckOffset
;
385 UINT8 PciDeviceFunction
;
386 UINT8 NumberBbsEntries
;
387 VOID
*BbsTablePointer
; /// @bug: variable size on 32/64-bit systems.
388 } EFI_DISPATCH_OPROM_TABLE
;
390 ///////////////////////////////////////////////////////////////////////////////
391 // EFI_LEGACY_INSTALL_PCI_HANDLER
392 ///////////////////////////////////////////////////////////////////////////////
405 UINT8 PrimaryReserved
;
406 UINT16 PrimaryControl
;
408 UINT16 PrimaryBusMaster
;
414 UINT8 SecondaryReserved
;
415 UINT16 SecondaryControl
;
416 UINT16 SecondaryBase
;
417 UINT16 SecondaryBusMaster
;
418 } EFI_LEGACY_INSTALL_PCI_HANDLER
;
421 // Restore default pack value