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 typedef UINT8 SERIAL_MODE
;
34 typedef UINT8 PARALLEL_MODE
;
36 ///////////////////////////////////////////////////////////////////////////////
37 // EFI_COMPATIBILITY16_TABLE is located at a 16-byte boundary starting with the
39 ///////////////////////////////////////////////////////////////////////////////
41 #define EFI_COMPATIBILITY16_TABLE_SIGNATURE SIGNATURE_32 ('I', 'F', 'E', '$')
44 UINT32 Signature
; // "$EFI"
47 UINT8 EfiMajorRevision
;
48 UINT8 EfiMinorRevision
;
49 UINT8 TableMajorRevision
;
50 UINT8 TableMinorRevision
;
52 UINT16 Compatibility16CallSegment
;
53 UINT16 Compatibility16CallOffset
;
54 UINT16 PnPInstallationCheckSegment
;
55 UINT16 PnPInstallationCheckOffset
;
56 UINT32 EfiSystemTable
; // The physical address of EFI_SYSTEM_TABLE
57 UINT32 OemIdStringPointer
;
58 UINT32 AcpiRsdPtrPointer
;
62 UINT32 IrqRoutingTablePointer
;
63 UINT32 IrqRoutingTableLength
;
75 UINT32 PciExpressBase
;
77 } EFI_COMPATIBILITY16_TABLE
;
79 ///////////////////////////////////////////////////////////////////////////////
80 // Functions provided by the CSM binary
81 ///////////////////////////////////////////////////////////////////////////////
83 Legacy16InitializeYourself
= 0x0000,
84 Legacy16UpdateBbs
= 0x0001,
85 Legacy16PrepareToBoot
= 0x0002,
86 Legacy16Boot
= 0x0003,
87 Legacy16RetrieveLastBootDevice
= 0x0004,
88 Legacy16DispatchOprom
= 0x0005,
89 Legacy16GetTableAddress
= 0x0006,
90 Legacy16SetKeyboardLeds
= 0x0007,
91 Legacy16InstallPciHandler
= 0x0008
92 } EFI_COMPATIBILITY_FUNCTIONS
;
94 ///////////////////////////////////////////////////////////////////////////////
95 // EFI_TO_COMPATIBILITY16_INIT_TABLE
96 ///////////////////////////////////////////////////////////////////////////////
98 UINT32 BiosLessThan1MB
;
100 UINT32 HiPmmMemorySizeInBytes
;
101 UINT16 ReverseThunkCallSegment
;
102 UINT16 ReverseThunkCallOffset
;
103 UINT32 NumberE820Entries
;
104 UINT32 OsMemoryAbove1Mb
;
106 UINT32 ThunkSizeInBytes
;
108 UINT32 LowPmmMemorySizeInBytes
;
109 } EFI_TO_COMPATIBILITY16_INIT_TABLE
;
111 ///////////////////////////////////////////////////////////////////////////////
112 // EFI_TO_COMPATIBILITY16_BOOT_TABLE
113 ///////////////////////////////////////////////////////////////////////////////
116 // DEVICE_PRODUCER_SERIAL & its modes
122 } DEVICE_PRODUCER_SERIAL
;
124 #define DEVICE_SERIAL_MODE_NORMAL 0x00
125 #define DEVICE_SERIAL_MODE_IRDA 0x01
126 #define DEVICE_SERIAL_MODE_ASK_IR 0x02
127 #define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00
128 #define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10
131 // DEVICE_PRODUCER_PARALLEL & its modes
138 } DEVICE_PRODUCER_PARALLEL
;
140 #define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00
141 #define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01
142 #define DEVICE_PARALLEL_MODE_MODE_EPP 0x02
143 #define DEVICE_PARALLEL_MODE_MODE_ECP 0x03
146 // DEVICE_PRODUCER_FLOPPY
152 UINT8 NumberOfFloppy
;
153 } DEVICE_PRODUCER_FLOPPY
;
156 // LEGACY_DEVICE_FLAGS
160 UINT32 A20Port90
: 1;
161 UINT32 Reserved
: 30;
162 } LEGACY_DEVICE_FLAGS
;
165 // DEVICE_PRODUCER_DATA_HEADER
168 DEVICE_PRODUCER_SERIAL Serial
[4];
169 DEVICE_PRODUCER_PARALLEL Parallel
[3];
170 DEVICE_PRODUCER_FLOPPY Floppy
;
172 LEGACY_DEVICE_FLAGS Flags
;
173 } DEVICE_PRODUCER_DATA_HEADER
;
183 // HDD_INFO & its status
190 UINT16 CommandBaseAddress
;
191 UINT16 ControlBaseAddress
;
192 UINT16 BusMasterAddress
;
194 ATAPI_IDENTIFY IdentifyDrive
[2];
197 #define HDD_PRIMARY 0x01
198 #define HDD_SECONDARY 0x02
199 #define HDD_MASTER_ATAPI_CDROM 0x04
200 #define HDD_SLAVE_ATAPI_CDROM 0x08
201 #define HDD_MASTER_IDE 0x20
202 #define HDD_SLAVE_IDE 0x40
203 #define HDD_MASTER_ATAPI_ZIPDISK 0x10
204 #define HDD_SLAVE_ATAPI_ZIPDISK 0x80
210 UINT16 OldPosition
: 4;
211 UINT16 Reserved1
: 4;
214 UINT16 MediaPresent
: 2;
215 UINT16 Reserved2
: 4;
219 // BBS_TABLE, device type values & boot priority values
228 UINT16 MfgStringOffset
;
229 UINT16 MfgStringSegment
;
231 BBS_STATUS_FLAGS StatusFlags
;
232 UINT16 BootHandlerOffset
;
233 UINT16 BootHandlerSegment
;
234 UINT16 DescStringOffset
;
235 UINT16 DescStringSegment
;
236 UINT32 InitPerReserved
;
237 UINT32 AdditionalIrq13Handler
;
238 UINT32 AdditionalIrq18Handler
;
239 UINT32 AdditionalIrq19Handler
;
240 UINT32 AdditionalIrq40Handler
;
241 UINT8 AssignedDriveNumber
;
242 UINT32 AdditionalIrq41Handler
;
243 UINT32 AdditionalIrq46Handler
;
248 #define BBS_FLOPPY 0x01
249 #define BBS_HARDDISK 0x02
250 #define BBS_CDROM 0x03
251 #define BBS_PCMCIA 0x04
253 #define BBS_EMBED_NETWORK 0x06
254 #define BBS_BEV_DEVICE 0x80
255 #define BBS_UNKNOWN 0xff
257 #define BBS_DO_NOT_BOOT_FROM 0xFFFC
258 #define BBS_LOWEST_PRIORITY 0xFFFD
259 #define BBS_UNPRIORITIZED_ENTRY 0xFFFE
260 #define BBS_IGNORE_ENTRY 0xFFFF
263 // SMM_ATTRIBUTES & relating type, port and data size constants
267 UINT16 PortGranularity
: 3;
268 UINT16 DataGranularity
: 3;
272 #define STANDARD_IO 0x00
273 #define STANDARD_MEMORY 0x01
275 #define PORT_SIZE_8 0x00
276 #define PORT_SIZE_16 0x01
277 #define PORT_SIZE_32 0x02
278 #define PORT_SIZE_64 0x03
280 #define DATA_SIZE_8 0x00
281 #define DATA_SIZE_16 0x01
282 #define DATA_SIZE_32 0x02
283 #define DATA_SIZE_64 0x03
286 // SMM_FUNCTION & relating constants
289 UINT16 Function
: 15;
293 #define INT15_D042 0x0000
294 #define GET_USB_BOOT_INFO 0x0001
295 #define DMI_PNP_50_57 0x0002
297 #define STANDARD_OWNER 0x0
298 #define OEM_OWNER 0x1
303 // This structure assumes both port and data sizes are 1. SmmAttribute must be
304 // properly to reflect that assumption.
307 SMM_ATTRIBUTES SmmAttributes
;
308 SMM_FUNCTION SmmFunction
;
317 UINT16 NumSmmEntries
;
325 UINT8 DirectoryServiceValidity
: 1;
326 UINT8 RabcaUsedFlag
: 1;
327 UINT8 ExecuteHddDiagnosticsFlag
: 1;
335 UDC_ATTRIBUTES Attributes
;
337 UINT8 BbsTableEntryNumberForParentDevice
;
338 UINT8 BbsTableEntryNumberForBoot
;
339 UINT8 BbsTableEntryNumberForHddDiag
;
341 UINT8 ServiceAreaData
[64];
345 // EFI_TO_COMPATIBILITY16_BOOT_TABLE
347 #define EFI_TO_LEGACY_MAJOR_VERSION 0x02
348 #define EFI_TO_LEGACY_MINOR_VERSION 0x00
349 #define MAX_IDE_CONTROLLER 8
354 UINT32 AcpiTable
; // 4 GB range
355 UINT32 SmbiosTable
; // 4 GB range
356 UINT32 SmbiosTableLength
;
361 DEVICE_PRODUCER_DATA_HEADER SioData
;
363 UINT16 DevicePathType
;
365 UINT32 NumberE820Entries
;
368 // Controller & Drive Identify[2] per controller information
370 HDD_INFO HddInfo
[MAX_IDE_CONTROLLER
];
372 UINT32 NumberBbsEntries
;
375 UINT32 OsMemoryAbove1Mb
;
376 UINT32 UnconventionalDeviceTable
;
377 } EFI_TO_COMPATIBILITY16_BOOT_TABLE
;
379 ///////////////////////////////////////////////////////////////////////////////
380 // EFI_LEGACY_INSTALL_PCI_HANDLER
381 ///////////////////////////////////////////////////////////////////////////////
394 UINT8 PrimaryReserved
;
395 UINT16 PrimaryControl
;
397 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