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) 2006, 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: Legacy16.h
18 @par Revision Reference:
19 These definitions are from Compatibility Support Module Spec Version 0.96.
26 #define EFI_TO_LEGACY_MAJOR_VERSION 0x02
27 #define EFI_TO_LEGACY_MINOR_VERSION 0x00
31 // EFI Legacy to Legacy16 data
32 // EFI_COMPATIBILITY16_TABLE has been moved to LegacyBios protocol defn file.
36 // Memory map used to start up Legacy16 code
38 UINT32 BiosLessThan1MB
;
40 UINT32 PmmMemorySizeInBytes
;
42 UINT16 ReverseThunkCallSegment
;
43 UINT16 ReverseThunkCallOffset
;
44 UINT32 NumberE820Entries
;
45 UINT32 OsMemoryAbove1Mb
;
47 UINT32 ThunkSizeInBytes
;
49 UINT32 LowPmmMemorySizeInBytes
;
50 } EFI_TO_COMPATIBILITY16_INIT_TABLE
;
54 // Legacy16 Call types
57 Legacy16InitializeYourself
= 0x0000,
58 Legacy16UpdateBbs
= 0x0001,
59 Legacy16PrepareToBoot
= 0x0002,
60 Legacy16Boot
= 0x0003,
61 Legacy16RetrieveLastBootDevice
= 0x0004,
62 Legacy16DispatchOprom
= 0x0005,
63 Legacy16GetTableAddress
= 0x0006,
64 Legacy16SetKeyboardLeds
= 0x0007,
65 Legacy16InstallPciHandler
= 0x0008,
66 } EFI_COMPATIBILITY_FUNCTIONS
;
68 #define F0000Region 0x01
69 #define E0000Region 0x02
71 // Legacy16 call prototypes
72 // Input: AX = EFI_COMPATIBILITY16_FUNCTIONS for all functions.
73 // Output: AX = Return status for all functions. It follows EFI error
76 // Legacy16InitializeYourself
77 // Description: This is the first call to 16-bit code. It allows the
78 // 16-bit to perform any internal initialization.
79 // Input: ES:BX pointer to EFI_TO_LEGACY16_INIT_TABLE
82 // Description: The 16-bit code updates the BBS table for non-compliant
84 // Input: ES:BX pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE
86 // Legacy16PrepareToBoot
87 // Description: This is the last call to 16-bit code where 0xE0000 -0xFFFFF
88 // is read/write. 16-bit code does any final clean up.
89 // Input: ES:BX pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE
92 // Description: Do INT19.
95 // Legacy16RetrieveLastBootDevice
96 // Description: Return the priority number of the device that booted.
98 // Output: BX = priority number of the last attempted boot device.
99 // Legacy16DispatchOprom
100 // Description: Pass control to the specified OPROM. Allows the 16-bit
101 // code to rehook INT 13,18 and/or 19 from non-BBS
102 // compliant devices.
103 // Input: ES:DI = Segment:Offset of PnPInstallationCheck
104 // SI = OPROM segment. Offset assumed to be 3.
105 // BH = PCI bus number.
106 // BL = PCI device * 8 | PCI function.
107 // Output: BX = Number of BBS non-compliant drives detected. Return
108 // zero for BBS compliant devices.
109 // Legacy16GetTableAddress
110 // Description: Allocate an area in the 0xE0000-0xFFFFF region.
111 // Input: BX = Allocation region.
113 // Bit 0 = 0xF0000 region
114 // Bit 1 = 0xE0000 region
115 // Multiple bits can be set.
116 // CX = Length in bytes requested
117 // DX = Required address alignment
118 // Bit mapped. First non-zero bit from right to left is
120 // Output: DS:BX is assigned region.
121 // AX = EFI_OUT_OF_RESOURCES if request cannot be granted.
122 // Legacy16SetKeyboardLeds
123 // Description: Perform any special action when keyboard LEDS change.
124 // Other code performs the LED change and updates standard
125 // BDA locations. This is for non-standard operations.
126 // Input: CL = LED status. 1 = set.
127 // Bit 0 = Scroll lock
131 // Legacy16InstallPciHandler
132 // Description: Provides 16-bit code a hook to establish an interrupt
133 // handler for any PCI device requiring a PCI interrupt
134 // but having no OPROM. This is called before interrupt
135 // is assigned. 8259 will be disabled(even if sharded)
136 // and PCI Interrupt Line unprogrammed. Other code will
137 // program 8259 and PCI Interrupt Line.
138 // Input: ES:BX Pointer to EFI_LEGACY_INSTALL_PCI_HANDLER strcture
141 typedef UINT8 SERIAL_MODE
;
142 typedef UINT8 PARALLEL_MODE
;
146 #define DEVICE_SERIAL_MODE_NORMAL 0x00
147 #define DEVICE_SERIAL_MODE_IRDA 0x01
148 #define DEVICE_SERIAL_MODE_ASK_IR 0x02
149 #define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00
150 #define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10
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
161 } DEVICE_PRODUCER_SERIAL
;
168 } DEVICE_PRODUCER_PARALLEL
;
174 UINT8 NumberOfFloppy
;
175 } DEVICE_PRODUCER_FLOPPY
;
179 UINT32 A20Port90
: 1;
180 UINT32 Reserved
: 30;
181 } LEGACY_DEVICE_FLAGS
;
184 DEVICE_PRODUCER_SERIAL Serial
[4];
185 DEVICE_PRODUCER_PARALLEL Parallel
[3];
186 DEVICE_PRODUCER_FLOPPY Floppy
;
188 LEGACY_DEVICE_FLAGS Flags
;
189 } DEVICE_PRODUCER_DATA_HEADER
;
191 // SMM Table definitions
192 // SMM table has a header that provides the number of entries. Following
193 // the header is a variable length amount of data.
196 #define STANDARD_IO 0x00
197 #define STANDARD_MEMORY 0x01
199 #define PORT_SIZE_8 0x00
200 #define PORT_SIZE_16 0x01
201 #define PORT_SIZE_32 0x02
202 #define PORT_SIZE_64 0x03
204 #define DATA_SIZE_8 0x00
205 #define DATA_SIZE_16 0x01
206 #define DATA_SIZE_32 0x02
207 #define DATA_SIZE_64 0x03
211 UINT16 PortGranularity
: 3;
212 UINT16 DataGranularity
: 3;
216 #define INT15_D042 0x0000
217 #define GET_USB_BOOT_INFO 0x0001
218 #define DMI_PNP_50_57 0x0002
220 #define STANDARD_OWNER 0x0
221 #define OEM_OWNER 0x1
224 UINT16 Function
: 15;
229 SMM_ATTRIBUTES SmmAttributes
;
230 SMM_FUNCTION SmmFunction
;
232 // Data size depends upon SmmAttributes and ranges from 2 bytes to
235 // bugbug how to do variable length Data
242 UINT16 NumSmmEntries
;
247 // If MAX_IDE_CONTROLLER changes value 16-bit legacy code needs to change
249 #define MAX_IDE_CONTROLLER 8
255 UINT32 AcpiTable
; // 4 GB range
256 UINT32 SmbiosTable
; // 4 GB range
257 UINT32 SmbiosTableLength
;
262 DEVICE_PRODUCER_DATA_HEADER SioData
;
264 UINT16 DevicePathType
;
266 UINT32 NumberE820Entries
;
268 // Controller & Drive Identify[2] per controller information
270 HDD_INFO HddInfo
[MAX_IDE_CONTROLLER
];
271 UINT32 NumberBbsEntries
;
274 UINT32 OsMemoryAbove1Mb
;
275 UINT32 UnconventionalDeviceTable
;
276 } EFI_TO_COMPATIBILITY16_BOOT_TABLE
;
286 UINT8 PrimaryReserved
;
287 UINT16 PrimaryControl
;
289 UINT16 PrimaryBusMaster
;
291 UINT8 SecondaryReserved
;
292 UINT16 SecondaryControl
;
293 UINT16 SecondaryBase
;
294 UINT16 SecondaryBusMaster
;
295 } EFI_LEGACY_INSTALL_PCI_HANDLER
;
298 UINT16 PnPInstallationCheckSegment
;
299 UINT16 PnPInstallationCheckOffset
;
302 UINT8 PciDeviceFunction
;
303 UINT8 NumberBbsEntries
;
304 VOID
*BbsTablePointer
;
306 } EFI_DISPATCH_OPROM_TABLE
;