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 // EFI_TO_COMPATIBILITY16_INIT_TABLE
94 UINT32 BiosLessThan1MB
;
96 UINT32 HiPmmMemorySizeInBytes
;
97 UINT16 ReverseThunkCallSegment
;
98 UINT16 ReverseThunkCallOffset
;
99 UINT32 NumberE820Entries
;
100 UINT32 OsMemoryAbove1Mb
;
102 UINT32 ThunkSizeInBytes
;
104 UINT32 LowPmmMemorySizeInBytes
;
105 } EFI_TO_COMPATIBILITY16_INIT_TABLE
;
108 // EFI_TO_COMPATIBILITY16_BOOT_TABLE
112 // DEVICE_PRODUCER_SERIAL & its modes
118 } DEVICE_PRODUCER_SERIAL
;
120 #define DEVICE_SERIAL_MODE_NORMAL 0x00
121 #define DEVICE_SERIAL_MODE_IRDA 0x01
122 #define DEVICE_SERIAL_MODE_ASK_IR 0x02
123 #define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00
124 #define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10
127 // DEVICE_PRODUCER_PARALLEL & its modes
134 } DEVICE_PRODUCER_PARALLEL
;
136 #define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00
137 #define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01
138 #define DEVICE_PARALLEL_MODE_MODE_EPP 0x02
139 #define DEVICE_PARALLEL_MODE_MODE_ECP 0x03
142 // DEVICE_PRODUCER_FLOPPY
148 UINT8 NumberOfFloppy
;
149 } DEVICE_PRODUCER_FLOPPY
;
152 // LEGACY_DEVICE_FLAGS
156 UINT32 A20Port90
: 1;
157 UINT32 Reserved
: 30;
158 } LEGACY_DEVICE_FLAGS
;
161 // DEVICE_PRODUCER_DATA_HEADER
164 DEVICE_PRODUCER_SERIAL Serial
[4];
165 DEVICE_PRODUCER_PARALLEL Parallel
[3];
166 DEVICE_PRODUCER_FLOPPY Floppy
;
168 LEGACY_DEVICE_FLAGS Flags
;
169 } DEVICE_PRODUCER_DATA_HEADER
;
179 // HDD_INFO & its status
186 UINT16 CommandBaseAddress
;
187 UINT16 ControlBaseAddress
;
188 UINT16 BusMasterAddress
;
190 ATAPI_IDENTIFY IdentifyDrive
[2];
193 #define HDD_PRIMARY 0x01
194 #define HDD_SECONDARY 0x02
195 #define HDD_MASTER_ATAPI_CDROM 0x04
196 #define HDD_SLAVE_ATAPI_CDROM 0x08
197 #define HDD_MASTER_IDE 0x20
198 #define HDD_SLAVE_IDE 0x40
199 #define HDD_MASTER_ATAPI_ZIPDISK 0x10
200 #define HDD_SLAVE_ATAPI_ZIPDISK 0x80
206 UINT16 OldPosition
: 4;
207 UINT16 Reserved1
: 4;
210 UINT16 MediaPresent
: 2;
211 UINT16 Reserved2
: 4;
215 // BBS_TABLE, device type values & boot priority values
224 UINT16 MfgStringOffset
;
225 UINT16 MfgStringSegment
;
227 BBS_STATUS_FLAGS StatusFlags
;
228 UINT16 BootHandlerOffset
;
229 UINT16 BootHandlerSegment
;
230 UINT16 DescStringOffset
;
231 UINT16 DescStringSegment
;
232 UINT32 InitPerReserved
;
233 UINT32 AdditionalIrq13Handler
;
234 UINT32 AdditionalIrq18Handler
;
235 UINT32 AdditionalIrq19Handler
;
236 UINT32 AdditionalIrq40Handler
;
237 UINT8 AssignedDriveNumber
;
238 UINT32 AdditionalIrq41Handler
;
239 UINT32 AdditionalIrq46Handler
;
244 #define BBS_FLOPPY 0x01
245 #define BBS_HARDDISK 0x02
246 #define BBS_CDROM 0x03
247 #define BBS_PCMCIA 0x04
249 #define BBS_EMBED_NETWORK 0x06
250 #define BBS_BEV_DEVICE 0x80
251 #define BBS_UNKNOWN 0xff
253 #define BBS_DO_NOT_BOOT_FROM 0xFFFC
254 #define BBS_LOWEST_PRIORITY 0xFFFD
255 #define BBS_UNPRIORITIZED_ENTRY 0xFFFE
256 #define BBS_IGNORE_ENTRY 0xFFFF
259 // SMM_ATTRIBUTES & relating type, port and data size constants
263 UINT16 PortGranularity
: 3;
264 UINT16 DataGranularity
: 3;
268 #define STANDARD_IO 0x00
269 #define STANDARD_MEMORY 0x01
271 #define PORT_SIZE_8 0x00
272 #define PORT_SIZE_16 0x01
273 #define PORT_SIZE_32 0x02
274 #define PORT_SIZE_64 0x03
276 #define DATA_SIZE_8 0x00
277 #define DATA_SIZE_16 0x01
278 #define DATA_SIZE_32 0x02
279 #define DATA_SIZE_64 0x03
282 // SMM_FUNCTION & relating constants
285 UINT16 Function
: 15;
289 #define INT15_D042 0x0000
290 #define GET_USB_BOOT_INFO 0x0001
291 #define DMI_PNP_50_57 0x0002
293 #define STANDARD_OWNER 0x0
294 #define OEM_OWNER 0x1
299 // This structure assumes both port and data sizes are 1. SmmAttribute must be
300 // properly to reflect that assumption.
303 SMM_ATTRIBUTES SmmAttributes
;
304 SMM_FUNCTION SmmFunction
;
313 UINT16 NumSmmEntries
;
321 UINT8 DirectoryServiceValidity
: 1;
322 UINT8 RabcaUsedFlag
: 1;
323 UINT8 ExecuteHddDiagnosticsFlag
: 1;
331 UDC_ATTRIBUTES Attributes
;
333 UINT8 BbsTableEntryNumberForParentDevice
;
334 UINT8 BbsTableEntryNumberForBoot
;
335 UINT8 BbsTableEntryNumberForHddDiag
;
337 UINT8 ServiceAreaData
[64];
341 // EFI_TO_COMPATIBILITY16_BOOT_TABLE
343 #define EFI_TO_LEGACY_MAJOR_VERSION 0x02
344 #define EFI_TO_LEGACY_MINOR_VERSION 0x00
345 #define MAX_IDE_CONTROLLER 8
350 UINT32 AcpiTable
; // 4 GB range
351 UINT32 SmbiosTable
; // 4 GB range
352 UINT32 SmbiosTableLength
;
356 DEVICE_PRODUCER_DATA_HEADER SioData
;
357 UINT16 DevicePathType
;
359 UINT32 NumberE820Entries
;
361 // Controller & Drive Identify[2] per controller information
363 HDD_INFO HddInfo
[MAX_IDE_CONTROLLER
];
364 UINT32 NumberBbsEntries
;
367 UINT32 OsMemoryAbove1Mb
;
368 UINT32 UnconventionalDeviceTable
;
369 } EFI_TO_COMPATIBILITY16_BOOT_TABLE
;
372 // EFI_LEGACY_INSTALL_PCI_HANDLER
385 UINT8 PrimaryReserved
;
386 UINT16 PrimaryControl
;
388 UINT16 PrimaryBusMaster
;
393 UINT8 SecondaryReserved
;
394 UINT16 SecondaryControl
;
395 UINT16 SecondaryBase
;
396 UINT16 SecondaryBusMaster
;
397 } EFI_LEGACY_INSTALL_PCI_HANDLER
;
400 // Restore default pack value