]> git.proxmox.com Git - mirror_edk2.git/blame - OldMdePkg/Include/Common/Legacy16.h
Moved the MdePkg to OldMdePkg so that new code in MdePkg does not break existing...
[mirror_edk2.git] / OldMdePkg / Include / Common / Legacy16.h
CommitLineData
878ddf1f 1/** @file\r
2 API between 16-bit Legacy BIOS and EFI\r
3\r
4 We need to figure out what the 16-bit code is going to use to\r
5 represent these data structures. Is a pointer SEG:OFF or 32-bit...\r
6\r
7 Copyright (c) 2006, Intel Corporation \r
8 All rights reserved. This program and the accompanying materials \r
9 are licensed and made available under the terms and conditions of the BSD License \r
10 which accompanies this distribution. The full text of the license may be found at \r
11 http://opensource.org/licenses/bsd-license.php \r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
15\r
16 Module Name: Legacy16.h\r
17\r
18 @par Revision Reference:\r
19 These definitions are from Compatibility Support Module Spec Version 0.96.\r
20\r
21**/\r
22\r
23#ifndef LEGACY_16_H_\r
24#define LEGACY_16_H_\r
25\r
26#define EFI_TO_LEGACY_MAJOR_VERSION 0x02\r
27#define EFI_TO_LEGACY_MINOR_VERSION 0x00\r
28\r
29#pragma pack(1)\r
30//\r
31// EFI Legacy to Legacy16 data\r
32// EFI_COMPATIBILITY16_TABLE has been moved to LegacyBios protocol defn file.\r
33//\r
34typedef struct {\r
35 //\r
36 // Memory map used to start up Legacy16 code\r
37 //\r
38 UINT32 BiosLessThan1MB;\r
39 UINT32 HiPmmMemory;\r
e4a246f1 40 UINT32 HiPmmMemorySizeInBytes;\r
878ddf1f 41\r
42 UINT16 ReverseThunkCallSegment;\r
43 UINT16 ReverseThunkCallOffset;\r
44 UINT32 NumberE820Entries;\r
45 UINT32 OsMemoryAbove1Mb;\r
46 UINT32 ThunkStart;\r
47 UINT32 ThunkSizeInBytes;\r
48 UINT32 LowPmmMemory;\r
49 UINT32 LowPmmMemorySizeInBytes;\r
50} EFI_TO_COMPATIBILITY16_INIT_TABLE;\r
51\r
52#pragma pack()\r
53//\r
54// Legacy16 Call types\r
55//\r
56typedef enum {\r
57 Legacy16InitializeYourself = 0x0000,\r
58 Legacy16UpdateBbs = 0x0001,\r
59 Legacy16PrepareToBoot = 0x0002,\r
60 Legacy16Boot = 0x0003,\r
61 Legacy16RetrieveLastBootDevice= 0x0004,\r
62 Legacy16DispatchOprom = 0x0005,\r
63 Legacy16GetTableAddress = 0x0006,\r
64 Legacy16SetKeyboardLeds = 0x0007,\r
65 Legacy16InstallPciHandler = 0x0008,\r
66} EFI_COMPATIBILITY_FUNCTIONS;\r
67\r
68#define F0000Region 0x01\r
69#define E0000Region 0x02\r
70//\r
71// Legacy16 call prototypes\r
72// Input: AX = EFI_COMPATIBILITY16_FUNCTIONS for all functions.\r
73// Output: AX = Return status for all functions. It follows EFI error\r
74// codes.\r
75//\r
76// Legacy16InitializeYourself\r
77// Description: This is the first call to 16-bit code. It allows the\r
78// 16-bit to perform any internal initialization.\r
e4a246f1 79// Input: ES:BX pointer to EFI_TO_COMPATIBILITY16_INIT_TABLE\r
878ddf1f 80// Output:\r
81// Legacy16UpdateBbs\r
82// Description: The 16-bit code updates the BBS table for non-compliant\r
83// devices.\r
84// Input: ES:BX pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE\r
85// Output:\r
86// Legacy16PrepareToBoot\r
87// Description: This is the last call to 16-bit code where 0xE0000 -0xFFFFF\r
88// is read/write. 16-bit code does any final clean up.\r
89// Input: ES:BX pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE\r
90// Output:\r
91// Legacy16Boot\r
92// Description: Do INT19.\r
93// Input:\r
94// Output:\r
95// Legacy16RetrieveLastBootDevice\r
96// Description: Return the priority number of the device that booted.\r
97// Input:\r
98// Output: BX = priority number of the last attempted boot device.\r
99// Legacy16DispatchOprom\r
100// Description: Pass control to the specified OPROM. Allows the 16-bit\r
101// code to rehook INT 13,18 and/or 19 from non-BBS\r
102// compliant devices.\r
103// Input: ES:DI = Segment:Offset of PnPInstallationCheck\r
104// SI = OPROM segment. Offset assumed to be 3.\r
105// BH = PCI bus number.\r
106// BL = PCI device * 8 | PCI function.\r
107// Output: BX = Number of BBS non-compliant drives detected. Return\r
108// zero for BBS compliant devices.\r
109// Legacy16GetTableAddress\r
110// Description: Allocate an area in the 0xE0000-0xFFFFF region.\r
111// Input: BX = Allocation region.\r
112// 0x0 = Any region\r
113// Bit 0 = 0xF0000 region\r
114// Bit 1 = 0xE0000 region\r
115// Multiple bits can be set.\r
116// CX = Length in bytes requested\r
117// DX = Required address alignment\r
118// Bit mapped. First non-zero bit from right to left is\r
119// alignment.\r
120// Output: DS:BX is assigned region.\r
121// AX = EFI_OUT_OF_RESOURCES if request cannot be granted.\r
122// Legacy16SetKeyboardLeds\r
123// Description: Perform any special action when keyboard LEDS change.\r
124// Other code performs the LED change and updates standard\r
125// BDA locations. This is for non-standard operations.\r
126// Input: CL = LED status. 1 = set.\r
127// Bit 0 = Scroll lock\r
128// Bit 1 = Num lock\r
129// Bit 2 = Caps lock\r
130// Output:\r
131// Legacy16InstallPciHandler\r
132// Description: Provides 16-bit code a hook to establish an interrupt\r
133// handler for any PCI device requiring a PCI interrupt\r
134// but having no OPROM. This is called before interrupt\r
135// is assigned. 8259 will be disabled(even if sharded)\r
136// and PCI Interrupt Line unprogrammed. Other code will\r
137// program 8259 and PCI Interrupt Line.\r
138// Input: ES:BX Pointer to EFI_LEGACY_INSTALL_PCI_HANDLER strcture\r
139// Output:\r
140//\r
141typedef UINT8 SERIAL_MODE;\r
142typedef UINT8 PARALLEL_MODE;\r
143\r
144#pragma pack(1)\r
145\r
146#define DEVICE_SERIAL_MODE_NORMAL 0x00\r
147#define DEVICE_SERIAL_MODE_IRDA 0x01\r
148#define DEVICE_SERIAL_MODE_ASK_IR 0x02\r
149#define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00\r
150#define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10\r
151\r
152#define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00\r
153#define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01\r
154#define DEVICE_PARALLEL_MODE_MODE_EPP 0x02\r
155#define DEVICE_PARALLEL_MODE_MODE_ECP 0x03\r
156\r
157typedef struct {\r
158 UINT16 Address;\r
159 UINT8 Irq;\r
160 SERIAL_MODE Mode;\r
161} DEVICE_PRODUCER_SERIAL;\r
162\r
163typedef struct {\r
164 UINT16 Address;\r
165 UINT8 Irq;\r
166 UINT8 Dma;\r
167 PARALLEL_MODE Mode;\r
168} DEVICE_PRODUCER_PARALLEL;\r
169\r
170typedef struct {\r
171 UINT16 Address;\r
172 UINT8 Irq;\r
173 UINT8 Dma;\r
174 UINT8 NumberOfFloppy;\r
175} DEVICE_PRODUCER_FLOPPY;\r
176\r
177typedef struct {\r
178 UINT32 A20Kybd : 1;\r
179 UINT32 A20Port90 : 1;\r
180 UINT32 Reserved : 30;\r
181} LEGACY_DEVICE_FLAGS;\r
182\r
183typedef struct {\r
184 DEVICE_PRODUCER_SERIAL Serial[4];\r
185 DEVICE_PRODUCER_PARALLEL Parallel[3];\r
186 DEVICE_PRODUCER_FLOPPY Floppy;\r
187 UINT8 MousePresent;\r
188 LEGACY_DEVICE_FLAGS Flags;\r
189} DEVICE_PRODUCER_DATA_HEADER;\r
190//\r
191// SMM Table definitions\r
192// SMM table has a header that provides the number of entries. Following\r
193// the header is a variable length amount of data.\r
194//\r
195\r
196#define STANDARD_IO 0x00\r
197#define STANDARD_MEMORY 0x01\r
198\r
199#define PORT_SIZE_8 0x00\r
200#define PORT_SIZE_16 0x01\r
201#define PORT_SIZE_32 0x02\r
202#define PORT_SIZE_64 0x03\r
203\r
204#define DATA_SIZE_8 0x00\r
205#define DATA_SIZE_16 0x01\r
206#define DATA_SIZE_32 0x02\r
207#define DATA_SIZE_64 0x03\r
208\r
209typedef struct {\r
210 UINT16 Type : 3;\r
211 UINT16 PortGranularity : 3;\r
212 UINT16 DataGranularity : 3;\r
213 UINT16 Reserved : 7;\r
214} SMM_ATTRIBUTES;\r
215\r
216#define INT15_D042 0x0000\r
217#define GET_USB_BOOT_INFO 0x0001\r
218#define DMI_PNP_50_57 0x0002\r
219\r
220#define STANDARD_OWNER 0x0\r
221#define OEM_OWNER 0x1\r
222\r
223typedef struct {\r
224 UINT16 Function : 15;\r
225 UINT16 Owner : 1;\r
226} SMM_FUNCTION;\r
227\r
228typedef struct {\r
229 SMM_ATTRIBUTES SmmAttributes;\r
230 SMM_FUNCTION SmmFunction;\r
231 //\r
232 // Data size depends upon SmmAttributes and ranges from 2 bytes to\r
233 // 16 bytes\r
234 //\r
235 // bugbug how to do variable length Data\r
236 //\r
237 UINT8 SmmPort;\r
238 UINT8 SmmData;\r
239} SMM_ENTRY;\r
240\r
241typedef struct {\r
242 UINT16 NumSmmEntries;\r
243 SMM_ENTRY SmmEntry;\r
244} SMM_TABLE;\r
245\r
246//\r
247// If MAX_IDE_CONTROLLER changes value 16-bit legacy code needs to change\r
248//\r
249#define MAX_IDE_CONTROLLER 8\r
250\r
251typedef struct {\r
252 UINT16 MajorVersion;\r
253 UINT16 MinorVersion;\r
254\r
255 UINT32 AcpiTable; // 4 GB range\r
256 UINT32 SmbiosTable; // 4 GB range\r
257 UINT32 SmbiosTableLength;\r
258\r
259 //\r
260 // Legacy SIO state\r
261 //\r
262 DEVICE_PRODUCER_DATA_HEADER SioData;\r
263\r
264 UINT16 DevicePathType;\r
265 UINT16 PciIrqMask;\r
266 UINT32 NumberE820Entries;\r
267 //\r
268 // Controller & Drive Identify[2] per controller information\r
269 //\r
270 HDD_INFO HddInfo[MAX_IDE_CONTROLLER];\r
271 UINT32 NumberBbsEntries;\r
272 UINT32 BbsTable;\r
273 UINT32 SmmTable;\r
274 UINT32 OsMemoryAbove1Mb;\r
275 UINT32 UnconventionalDeviceTable;\r
276} EFI_TO_COMPATIBILITY16_BOOT_TABLE;\r
277\r
278typedef struct {\r
279 UINT8 PciBus;\r
280 UINT8 PciDeviceFun;\r
281 UINT8 PciSegment;\r
282 UINT8 PciClass;\r
283 UINT8 PciSubclass;\r
284 UINT8 PciInterface;\r
285 UINT8 PrimaryIrq;\r
286 UINT8 PrimaryReserved;\r
287 UINT16 PrimaryControl;\r
288 UINT16 PrimaryBase;\r
289 UINT16 PrimaryBusMaster;\r
290 UINT8 SecondaryIrq;\r
291 UINT8 SecondaryReserved;\r
292 UINT16 SecondaryControl;\r
293 UINT16 SecondaryBase;\r
294 UINT16 SecondaryBusMaster;\r
295} EFI_LEGACY_INSTALL_PCI_HANDLER;\r
296\r
297typedef struct {\r
298 UINT16 PnPInstallationCheckSegment;\r
299 UINT16 PnPInstallationCheckOffset;\r
300 UINT16 OpromSegment;\r
301 UINT8 PciBus;\r
302 UINT8 PciDeviceFunction;\r
303 UINT8 NumberBbsEntries;\r
304 VOID *BbsTablePointer;\r
305\r
306} EFI_DISPATCH_OPROM_TABLE;\r
307\r
308#pragma pack()\r
309\r
310#endif\r