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_
30 typedef UINT8 SERIAL_MODE
;
31 typedef UINT8 PARALLEL_MODE
;
34 // EFI_COMPATIBILITY16_TABLE is located at a 16-byte boundary starting with the
37 #define EFI_COMPATIBILITY16_TABLE_SIGNATURE SIGNATURE_32 ('I', 'F', 'E', '$')
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
;
90 // EFI_TO_COMPATIBILITY16_INIT_TABLE
93 UINT32 BiosLessThan1MB
;
95 UINT32 HiPmmMemorySizeInBytes
;
96 UINT16 ReverseThunkCallSegment
;
97 UINT16 ReverseThunkCallOffset
;
98 UINT32 NumberE820Entries
;
99 UINT32 OsMemoryAbove1Mb
;
101 UINT32 ThunkSizeInBytes
;
103 UINT32 LowPmmMemorySizeInBytes
;
104 } EFI_TO_COMPATIBILITY16_INIT_TABLE
;
107 // EFI_TO_COMPATIBILITY16_BOOT_TABLE
111 // DEVICE_PRODUCER_SERIAL & its modes
117 } DEVICE_PRODUCER_SERIAL
;
119 #define DEVICE_SERIAL_MODE_NORMAL 0x00
120 #define DEVICE_SERIAL_MODE_IRDA 0x01
121 #define DEVICE_SERIAL_MODE_ASK_IR 0x02
122 #define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00
123 #define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10
126 // DEVICE_PRODUCER_PARALLEL & its modes
133 } DEVICE_PRODUCER_PARALLEL
;
135 #define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00
136 #define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01
137 #define DEVICE_PARALLEL_MODE_MODE_EPP 0x02
138 #define DEVICE_PARALLEL_MODE_MODE_ECP 0x03
141 // DEVICE_PRODUCER_FLOPPY
147 UINT8 NumberOfFloppy
;
148 } DEVICE_PRODUCER_FLOPPY
;
151 // LEGACY_DEVICE_FLAGS
155 UINT32 A20Port90
: 1;
156 UINT32 Reserved
: 30;
157 } LEGACY_DEVICE_FLAGS
;
160 // DEVICE_PRODUCER_DATA_HEADER
163 DEVICE_PRODUCER_SERIAL Serial
[4];
164 DEVICE_PRODUCER_PARALLEL Parallel
[3];
165 DEVICE_PRODUCER_FLOPPY Floppy
;
167 LEGACY_DEVICE_FLAGS Flags
;
168 } DEVICE_PRODUCER_DATA_HEADER
;
178 // HDD_INFO & its status
185 UINT16 CommandBaseAddress
;
186 UINT16 ControlBaseAddress
;
187 UINT16 BusMasterAddress
;
189 ATAPI_IDENTIFY IdentifyDrive
[2];
192 #define HDD_PRIMARY 0x01
193 #define HDD_SECONDARY 0x02
194 #define HDD_MASTER_ATAPI_CDROM 0x04
195 #define HDD_SLAVE_ATAPI_CDROM 0x08
196 #define HDD_MASTER_IDE 0x20
197 #define HDD_SLAVE_IDE 0x40
198 #define HDD_MASTER_ATAPI_ZIPDISK 0x10
199 #define HDD_SLAVE_ATAPI_ZIPDISK 0x80
205 UINT16 OldPosition
: 4;
206 UINT16 Reserved1
: 4;
209 UINT16 MediaPresent
: 2;
210 UINT16 Reserved2
: 4;
214 // BBS_TABLE, device type values & boot priority values
223 UINT16 MfgStringOffset
;
224 UINT16 MfgStringSegment
;
226 BBS_STATUS_FLAGS StatusFlags
;
227 UINT16 BootHandlerOffset
;
228 UINT16 BootHandlerSegment
;
229 UINT16 DescStringOffset
;
230 UINT16 DescStringSegment
;
231 UINT32 InitPerReserved
;
232 UINT32 AdditionalIrq13Handler
;
233 UINT32 AdditionalIrq18Handler
;
234 UINT32 AdditionalIrq19Handler
;
235 UINT32 AdditionalIrq40Handler
;
236 UINT8 AssignedDriveNumber
;
237 UINT32 AdditionalIrq41Handler
;
238 UINT32 AdditionalIrq46Handler
;
243 #define BBS_FLOPPY 0x01
244 #define BBS_HARDDISK 0x02
245 #define BBS_CDROM 0x03
246 #define BBS_PCMCIA 0x04
248 #define BBS_EMBED_NETWORK 0x06
249 #define BBS_BEV_DEVICE 0x80
250 #define BBS_UNKNOWN 0xff
252 #define BBS_DO_NOT_BOOT_FROM 0xFFFC
253 #define BBS_LOWEST_PRIORITY 0xFFFD
254 #define BBS_UNPRIORITIZED_ENTRY 0xFFFE
255 #define BBS_IGNORE_ENTRY 0xFFFF
258 // SMM_ATTRIBUTES & relating type, port and data size constants
262 UINT16 PortGranularity
: 3;
263 UINT16 DataGranularity
: 3;
267 #define STANDARD_IO 0x00
268 #define STANDARD_MEMORY 0x01
270 #define PORT_SIZE_8 0x00
271 #define PORT_SIZE_16 0x01
272 #define PORT_SIZE_32 0x02
273 #define PORT_SIZE_64 0x03
275 #define DATA_SIZE_8 0x00
276 #define DATA_SIZE_16 0x01
277 #define DATA_SIZE_32 0x02
278 #define DATA_SIZE_64 0x03
281 // SMM_FUNCTION & relating constants
284 UINT16 Function
: 15;
288 #define INT15_D042 0x0000
289 #define GET_USB_BOOT_INFO 0x0001
290 #define DMI_PNP_50_57 0x0002
292 #define STANDARD_OWNER 0x0
293 #define OEM_OWNER 0x1
298 // This structure assumes both port and data sizes are 1. SmmAttribute must be
299 // properly to reflect that assumption.
302 SMM_ATTRIBUTES SmmAttributes
;
303 SMM_FUNCTION SmmFunction
;
312 UINT16 NumSmmEntries
;
320 UINT8 DirectoryServiceValidity
: 1;
321 UINT8 RabcaUsedFlag
: 1;
322 UINT8 ExecuteHddDiagnosticsFlag
: 1;
330 UDC_ATTRIBUTES Attributes
;
332 UINT8 BbsTableEntryNumberForParentDevice
;
333 UINT8 BbsTableEntryNumberForBoot
;
334 UINT8 BbsTableEntryNumberForHddDiag
;
336 UINT8 ServiceAreaData
[64];
340 // EFI_TO_COMPATIBILITY16_BOOT_TABLE
342 #define EFI_TO_LEGACY_MAJOR_VERSION 0x02
343 #define EFI_TO_LEGACY_MINOR_VERSION 0x00
344 #define MAX_IDE_CONTROLLER 8
349 UINT32 AcpiTable
; // 4 GB range
350 UINT32 SmbiosTable
; // 4 GB range
351 UINT32 SmbiosTableLength
;
355 DEVICE_PRODUCER_DATA_HEADER SioData
;
356 UINT16 DevicePathType
;
358 UINT32 NumberE820Entries
;
360 // Controller & Drive Identify[2] per controller information
362 HDD_INFO HddInfo
[MAX_IDE_CONTROLLER
];
363 UINT32 NumberBbsEntries
;
366 UINT32 OsMemoryAbove1Mb
;
367 UINT32 UnconventionalDeviceTable
;
368 } EFI_TO_COMPATIBILITY16_BOOT_TABLE
;
371 // EFI_LEGACY_INSTALL_PCI_HANDLER
384 UINT8 PrimaryReserved
;
385 UINT16 PrimaryControl
;
387 UINT16 PrimaryBusMaster
;
392 UINT8 SecondaryReserved
;
393 UINT16 SecondaryControl
;
394 UINT16 SecondaryBase
;
395 UINT16 SecondaryBusMaster
;
396 } EFI_LEGACY_INSTALL_PCI_HANDLER
;
399 // Restore default pack value