]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Framework/Legacy16.h
ba7b6ca5a2abae223a4990ed2f7af93726e6a2eb
[mirror_edk2.git] / IntelFrameworkPkg / Include / Framework / Legacy16.h
1 /** @file
2 The header file provides interface definitions exposed by CSM (Compatible Support Module).
3
4 The CSM provides compatibility support between the Framework and traditional, legacy BIOS code
5 and allows booting a traditional OS or booting an EFI OS off a device that requires a traditional
6 option ROM (OpROM).
7
8 These definitions are from Compatibility Support Module Spec Version 0.97.
9
10 Copyright (c) 2007-2009, Intel Corporation
11 All rights reserved. This program and the accompanying materials
12 are licensed and made available under the terms and conditions of the BSD License
13 which accompanies this distribution. The full text of the license may be found at
14 http://opensource.org/licenses/bsd-license.php
15
16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18
19 **/
20
21 #ifndef _FRAMEWORK_LEGACY_16_H_
22 #define _FRAMEWORK_LEGACY_16_H_
23
24 #include <Base.h>
25
26 #pragma pack(1)
27
28 typedef UINT8 SERIAL_MODE;
29 typedef UINT8 PARALLEL_MODE;
30
31 #define EFI_COMPATIBILITY16_TABLE_SIGNATURE SIGNATURE_32 ('I', 'F', 'E', '$')
32
33 ///
34 /// There is a table located within the traditional BIOS in either the 0xF000:xxxx or 0xE000:xxxx
35 /// physical address range. It is located on a 16-byte boundary and provides the physical address of the
36 /// entry point for the Compatibility16 functions. These functions provide the platform-specific
37 /// information that is required by the generic EfiCompatibility code. The functions are invoked via
38 /// thunking by using EFI_LEGACY_BIOS_PROTOCOL.FarCall86() with the 32-bit physical
39 /// entry point.
40 ///
41 typedef struct {
42 ///
43 /// The string "$EFI" denotes the start of the EfiCompatibility table. Byte 0 is "I," byte
44 /// 1 is "F," byte 2 is "E," and byte 3 is "$" and is normally accessed as a DWORD or UINT32.
45 ///
46 UINT32 Signature;
47
48 ///
49 /// The value required such that byte checksum of TableLength equals zero.
50 ///
51 UINT8 TableChecksum;
52
53 ///
54 /// The length of this table.
55 ///
56 UINT8 TableLength;
57
58 ///
59 /// The major EFI revision for which this table was generated.
60 ///
61 UINT8 EfiMajorRevision;
62
63 ///
64 /// The minor EFI revision for which this table was generated.
65 ///
66 UINT8 EfiMinorRevision;
67
68 ///
69 /// The major revision of this table.
70 ///
71 UINT8 TableMajorRevision;
72
73 ///
74 /// The minor revision of this table.
75 ///
76 UINT8 TableMinorRevision;
77
78 ///
79 /// Reserved for future usage.
80 ///
81 UINT16 Reserved;
82
83 ///
84 /// The segment of the entry point within the traditional BIOS for Compatibility16 functions.
85 ///
86 UINT16 Compatibility16CallSegment;
87
88 ///
89 /// The offset of the entry point within the traditional BIOS for Compatibility16 functions.
90 ///
91 UINT16 Compatibility16CallOffset;
92
93 ///
94 /// The segment of the entry point within the traditional BIOS for EfiCompatibility to invoke the PnP installation check.
95 ///
96 UINT16 PnPInstallationCheckSegment;
97
98 ///
99 /// The Offset of the entry point within the traditional BIOS for EfiCompatibility to invoke the PnP installation check.
100 ///
101 UINT16 PnPInstallationCheckOffset;
102
103 ///
104 /// EFI system resources table. Type EFI_SYSTEM_TABLE is defined in the IntelPlatform Innovation Framework for EFI
105 /// Driver Execution Environment Core Interface Specification (DXE CIS).
106 ///
107 UINT32 EfiSystemTable;
108
109 ///
110 /// The address of an OEM-provided identifier string. The string is null terminated.
111 ///
112 UINT32 OemIdStringPointer;
113
114 ///
115 /// The 32-bit physical address where ACPI RSD PTR is stored within the traditional
116 /// BIOS. The remained of the ACPI tables are located at their EFI addresses. The size
117 /// reserved is the maximum for ACPI 2.0. The EfiCompatibility will fill in the ACPI
118 /// RSD PTR with either the ACPI 1.0b or 2.0 values.
119 ///
120 UINT32 AcpiRsdPtrPointer;
121
122 ///
123 /// The OEM revision number. Usage is undefined but provided for OEM module usage.
124 ///
125 UINT16 OemRevision;
126
127 ///
128 /// The 32-bit physical address where INT15 E820 data is stored within the traditional
129 /// BIOS. The EfiCompatibility code will fill in the E820Pointer value and copy the
130 /// data to the indicated area.
131 ///
132 UINT32 E820Pointer;
133
134 ///
135 /// The length of the E820 data and is filled in by the EfiCompatibility code.
136 ///
137 UINT32 E820Length;
138
139 ///
140 /// The 32-bit physical address where the $PIR table is stored in the traditional BIOS.
141 /// The EfiCompatibility code will fill in the IrqRoutingTablePointer value and
142 /// copy the data to the indicated area.
143 ///
144 UINT32 IrqRoutingTablePointer;
145
146 ///
147 /// The length of the $PIR table and is filled in by the EfiCompatibility code.
148 ///
149 UINT32 IrqRoutingTableLength;
150
151 ///
152 /// The 32-bit physical address where the MP table is stored in the traditional BIOS.
153 /// The EfiCompatibility code will fill in the MpTablePtr value and copy the data to the indicated area.
154 ///
155 UINT32 MpTablePtr;
156
157 ///
158 /// The length of the MP table and is filled in by the EfiCompatibility code.
159 ///
160 UINT32 MpTableLength;
161
162 ///
163 /// The segment of the OEM-specific INT table/code.
164 ///
165 UINT16 OemIntSegment;
166
167 ///
168 /// The offset of the OEM-specific INT table/code.
169 ///
170 UINT16 OemIntOffset;
171
172 ///
173 /// The segment of the OEM-specific 32-bit table/code.
174 ///
175 UINT16 Oem32Segment;
176
177 ///
178 /// The offset of the OEM-specific 32-bit table/code.
179 ///
180 UINT16 Oem32Offset;
181
182 ///
183 /// The segment of the OEM-specific 16-bit table/code.
184 ///
185 UINT16 Oem16Segment;
186
187 ///
188 /// The offset of the OEM-specific 16-bit table/code.
189 ///
190 UINT16 Oem16Offset;
191
192 ///
193 /// The segment of the TPM binary passed to 16-bit CSM.
194 ///
195 UINT16 TpmSegment;
196
197 ///
198 /// The offset of the TPM binary passed to 16-bit CSM.
199 ///
200 UINT16 TpmOffset;
201
202 ///
203 /// A pointer to a string identifying the independent BIOS vendor.
204 ///
205 UINT32 IbvPointer;
206
207 ///
208 /// This field is NULL for all systems not supporting PCI Express. This field is the base
209 /// value of the start of the PCI Express memory-mapped configuration registers and
210 /// must be filled in prior to EfiCompatibility code issuing the Compatibility16 function
211 /// Compatibility16InitializeYourself().
212 /// Compatibility16InitializeYourself() is defined in Compatability16
213 /// Functions.
214 ///
215 UINT32 PciExpressBase;
216
217 ///
218 /// Maximum PCI bus number assigned.
219 ///
220 UINT8 LastPciBus;
221 } EFI_COMPATIBILITY16_TABLE;
222
223 ///
224 /// Functions provided by the CSM binary which communicate between the EfiCompatibility
225 /// and Compatability16 code.
226 ///
227 typedef enum {
228 ///
229 /// Causes the Compatibility16 code to do any internal initialization required.
230 /// Input:
231 /// AX = Compatibility16InitializeYourself
232 /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_INIT_TABLE
233 /// Return:
234 /// AX = Return Status codes
235 ///
236 Compatibility16InitializeYourself = 0x0000,
237
238 ///
239 /// Causes the Compatibility16 BIOS to perform any drive number translations to match the boot sequence.
240 /// Input:
241 /// AX = Compatibility16UpdateBbs
242 /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE
243 /// Return:
244 /// AX = Returned status codes
245 ///
246 Compatibility16UpdateBbs = 0x0001,
247
248 ///
249 /// Allows the Compatibility16 code to perform any final actions before booting. The Compatibility16
250 /// code is read/write.
251 /// Input:
252 /// AX = Compatibility16PrepareToBoot
253 /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE structure
254 /// Return:
255 /// AX = Returned status codes
256 ///
257 Compatibility16PrepareToBoot = 0x0002,
258
259 ///
260 /// Causes the Compatibility16 BIOS to boot. The Compatibility16 code is Read/Only.
261 /// Input:
262 /// AX = Compatibility16Boot
263 /// Output:
264 /// AX = Returned status codes
265 ///
266 Compatibility16Boot = 0x0003,
267
268 ///
269 /// Allows the Compatibility16 code to get the last device from which a boot was attempted. This is
270 /// stored in CMOS and is the priority number of the last attempted boot device.
271 /// Input:
272 /// AX = Compatibility16RetrieveLastBootDevice
273 /// Output:
274 /// AX = Returned status codes
275 /// BX = Priority number of the boot device.
276 ///
277 Compatibility16RetrieveLastBootDevice= 0x0004,
278
279 ///
280 /// Allows the Compatibility16 code rehook INT13, INT18, and/or INT19 after dispatching a legacy OpROM.
281 /// Input:
282 /// AX = Compatibility16DispatchOprom
283 /// ES:BX = Pointer to EFI_DISPATCH_OPROM_TABLE
284 /// Output:
285 /// AX = Returned status codes
286 /// BX = Number of non-BBS-compliant devices found. Equals 0 if BBS compliant.
287 ///
288 Compatibility16DispatchOprom = 0x0005,
289
290 ///
291 /// Finds a free area in the 0xFxxxx or 0xExxxx region of the specified length and returns the address
292 /// of that region.
293 /// Input:
294 /// AX = Compatibility16GetTableAddress
295 /// BX = Allocation region
296 /// 00 = Allocate from either 0xE0000 or 0xF0000 64 KB blocks.
297 /// Bit 0 = 1 Allocate from 0xF0000 64 KB block
298 /// Bit 1 = 1 Allocate from 0xE0000 64 KB block
299 /// CX = Requested length in bytes.
300 /// DX = Required address alignment. Bit mapped. First non-zero bit from the right is the alignment.
301 /// Output:
302 /// AX = Returned status codes
303 /// DS:BX = Address of the region
304 ///
305 Compatibility16GetTableAddress = 0x0006,
306
307 ///
308 /// Enables the EfiCompatibility module to do any nonstandard processing of keyboard LEDs or state.
309 /// Input:
310 /// AX = Compatibility16SetKeyboardLeds
311 /// CL = LED status.
312 /// Bit 0 – Scroll Lock 0 = Off
313 /// Bit 1 – NumLock
314 /// Bit 2 – Caps Lock
315 /// Output:
316 /// AX = Returned status codes
317 ///
318 Compatibility16SetKeyboardLeds = 0x0007,
319
320 ///
321 /// Enables the EfiCompatibility module to install an interrupt handler for PCI mass media devices that
322 /// do not have an OpROM associated with them. An example is SATA.
323 /// Input:
324 /// AX = Compatibility16InstallPciHandler
325 /// ES:BX = Pointer to EFI_LEGACY_INSTALL_PCI_HANDLER structure
326 /// Output:
327 /// AX = Returned status codes
328 ///
329 Compatibility16InstallPciHandler = 0x0008
330 } EFI_COMPATIBILITY_FUNCTIONS;
331
332
333 ///
334 /// EFI_DISPATCH_OPROM_TABLE
335 ///
336 typedef struct {
337 UINT16 PnPInstallationCheckSegment; ///< Pointer to the PnpInstallationCheck data structure.
338 UINT16 PnPInstallationCheckOffset; ///< Pointer to the PnpInstallationCheck data structure.
339 UINT16 OpromSegment; ///< The segment where the OpROM was placed. Offset is assumed to be 3.
340 UINT8 PciBus; ///< The PCI bus.
341 UINT8 PciDeviceFunction; ///< The PCI device * 0x08 | PCI function.
342 UINT8 NumberBbsEntries; ///< The number of valid BBS table entries upon entry and exit. The IBV code may
343 ///< increase this number, if BBS-compliant devices also hook INTs in order to force the
344 ///< OpROM BIOS Setup to be executed.
345 VOID *BbsTablePointer; ///< Pointer to the BBS table.
346 UINT16 OpromDestinationSegment; ///< The segment where the OpROM can be relocated to. If this value is 0x0000, this
347 ///< means that the relocation of this run time code is not supported.
348 } EFI_DISPATCH_OPROM_TABLE;
349
350 ///
351 /// EFI_TO_COMPATIBILITY16_INIT_TABLE
352 ///
353 typedef struct {
354 ///
355 /// Starting address of memory under 1 MB. The ending address is assumed to be 640 KB or 0x9FFFF.
356 ///
357 UINT32 BiosLessThan1MB;
358
359 ///
360 /// Starting address of the high memory block.
361 ///
362 UINT32 HiPmmMemory;
363
364 ///
365 /// Length of high memory block.
366 ///
367 UINT32 HiPmmMemorySizeInBytes;
368
369 ///
370 /// The segment of the reverse thunk call code.
371 ///
372 UINT16 ReverseThunkCallSegment;
373
374 ///
375 /// The offset of the reverse thunk call code.
376 ///
377 UINT16 ReverseThunkCallOffset;
378
379 ///
380 /// The number of E820 entries copied to the Compatibility16 BIOS.
381 ///
382 UINT32 NumberE820Entries;
383
384 ///
385 /// The amount of usable memory above 1 MB, e.g., E820 type 1 memory.
386 ///
387 UINT32 OsMemoryAbove1Mb;
388
389 ///
390 /// The start of thunk code in main memory. Memory cannot be used by BIOS or PMM.
391 ///
392 UINT32 ThunkStart;
393
394 ///
395 /// The size of the thunk code.
396 ///
397 UINT32 ThunkSizeInBytes;
398
399 ///
400 /// Starting address of memory under 1 MB.
401 ///
402 UINT32 LowPmmMemory;
403
404 ///
405 /// Length of low Memory block.
406 ///
407 UINT32 LowPmmMemorySizeInBytes;
408 } EFI_TO_COMPATIBILITY16_INIT_TABLE;
409
410 ///
411 /// DEVICE_PRODUCER_SERIAL & its modes
412 ///
413 typedef struct {
414 UINT16 Address; ///< I/O address assigned to the serial port
415 UINT8 Irq; ///< IRQ assigned to the serial port.
416 SERIAL_MODE Mode; ///< Mode of serial port. Values are defined below.
417 } DEVICE_PRODUCER_SERIAL;
418
419 #define DEVICE_SERIAL_MODE_NORMAL 0x00
420 #define DEVICE_SERIAL_MODE_IRDA 0x01
421 #define DEVICE_SERIAL_MODE_ASK_IR 0x02
422 #define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00
423 #define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10
424
425 ///
426 /// DEVICE_PRODUCER_PARALLEL & its modes
427 ///
428 typedef struct {
429 UINT16 Address; ///< I/O address assigned to the parallel port
430 UINT8 Irq; ///< IRQ assigned to the parallel port.
431 UINT8 Dma; ///< DMA assigned to the parallel port.
432 PARALLEL_MODE Mode; ///< Mode of the parallel port. Values are defined below.
433 } DEVICE_PRODUCER_PARALLEL;
434
435 #define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00
436 #define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01
437 #define DEVICE_PARALLEL_MODE_MODE_EPP 0x02
438 #define DEVICE_PARALLEL_MODE_MODE_ECP 0x03
439
440 ///
441 /// DEVICE_PRODUCER_FLOPPY
442 ///
443 typedef struct {
444 UINT16 Address; ///< I/O address assigned to the floppy
445 UINT8 Irq; ///< IRQ assigned to the floppy.
446 UINT8 Dma; ///< DMA assigned to the floppy.
447 UINT8 NumberOfFloppy; ///< Number of floppies in the system.
448 } DEVICE_PRODUCER_FLOPPY;
449
450 ///
451 /// LEGACY_DEVICE_FLAGS
452 ///
453 typedef struct {
454 UINT32 A20Kybd : 1; ///< A20 controller by keyboard controller.
455 UINT32 A20Port90 : 1; ///< A20 controlled by port 0x92.
456 UINT32 Reserved : 30; ///< Reserved for future usage.
457 } LEGACY_DEVICE_FLAGS;
458
459 ///
460 /// DEVICE_PRODUCER_DATA_HEADER
461 ///
462 typedef struct {
463 DEVICE_PRODUCER_SERIAL Serial[4]; ///< Data for serial port x. Type DEVICE_PRODUCER_SERIAL is defined below.
464 DEVICE_PRODUCER_PARALLEL Parallel[3]; ///< Data for parallel port x. Type DEVICE_PRODUCER_PARALLEL is defined below.
465 DEVICE_PRODUCER_FLOPPY Floppy; ///< Data for floppy. Type DEVICE_PRODUCER_FLOPPY is defined below.
466 UINT8 MousePresent; ///< Flag to indicate if mouse is present.
467 LEGACY_DEVICE_FLAGS Flags; ///< Miscellaneous Boolean state information passed to CSM.
468 } DEVICE_PRODUCER_DATA_HEADER;
469
470 ///
471 /// ATAPI_IDENTIFY
472 ///
473 typedef struct {
474 UINT16 Raw[256]; ///< Raw data from the IDE IdentifyDrive command.
475 } ATAPI_IDENTIFY;
476
477 ///
478 /// HDD_INFO & its status
479 ///
480 typedef struct {
481 ///
482 /// Status of IDE device. Values are defined below. There is one HDD_INFO structure
483 /// per IDE controller. The IdentifyDrive is per drive. Index 0 is master and index
484 /// 1 is slave.
485 ///
486 UINT16 Status;
487
488 ///
489 /// PCI bus of IDE controller.
490 ///
491 UINT32 Bus;
492
493 ///
494 /// PCI device of IDE controller.
495 ///
496 UINT32 Device;
497
498 ///
499 /// PCI function of IDE controller.
500 ///
501 UINT32 Function;
502
503 ///
504 /// Command ports base address.
505 ///
506 UINT16 CommandBaseAddress;
507
508 ///
509 /// Control ports base address.
510 ///
511 UINT16 ControlBaseAddress;
512
513 ///
514 /// Bus master address
515 ///
516 UINT16 BusMasterAddress;
517
518 UINT8 HddIrq;
519
520 ///
521 /// Data that identifies the drive data, one per possible attached drive
522 ///
523 ATAPI_IDENTIFY IdentifyDrive[2];
524 } HDD_INFO;
525
526 #define HDD_PRIMARY 0x01
527 #define HDD_SECONDARY 0x02
528 #define HDD_MASTER_ATAPI_CDROM 0x04
529 #define HDD_SLAVE_ATAPI_CDROM 0x08
530 #define HDD_MASTER_IDE 0x20
531 #define HDD_SLAVE_IDE 0x40
532 #define HDD_MASTER_ATAPI_ZIPDISK 0x10
533 #define HDD_SLAVE_ATAPI_ZIPDISK 0x80
534
535 ///
536 /// BBS_STATUS_FLAGS
537 ///
538 typedef struct {
539 UINT16 OldPosition : 4; ///< Prior priority.
540 UINT16 Reserved1 : 4; ///< Reserved for future use.
541 UINT16 Enabled : 1; ///< If 0, ignore this entry.
542 UINT16 Failed : 1; ///< 0 = Not known if boot failure occurred.
543 ///< 1 = Boot attempted failed.
544
545 ///
546 /// State of media present.
547 /// 00 = No bootable media is present in the device.
548 /// 01 = Unknown if a bootable media present.
549 /// 10 = Media is present and appears bootable.
550 /// 11 = Reserved.
551 ///
552 UINT16 MediaPresent : 2;
553 UINT16 Reserved2 : 4; ///< Reserved for future use.
554 } BBS_STATUS_FLAGS;
555
556 ///
557 /// BBS_TABLE, device type values & boot priority values
558 ///
559 typedef struct {
560 ///
561 /// The boot priority for this boot device. Values are defined below.
562 ///
563 UINT16 BootPriority;
564
565 ///
566 /// The PCI bus for this boot device.
567 ///
568 UINT32 Bus;
569
570 ///
571 /// The PCI device for this boot device.
572 ///
573 UINT32 Device;
574
575 ///
576 /// The PCI function for the boot device.
577 ///
578 UINT32 Function;
579
580 ///
581 /// The PCI class for this boot device.
582 ///
583 UINT8 Class;
584
585 ///
586 /// The PCI Subclass for this boot device.
587 ///
588 UINT8 SubClass;
589
590 ///
591 /// Segment:offset address of an ASCIIZ description string describing the manufacturer.
592 ///
593 UINT16 MfgStringOffset;
594
595 ///
596 /// Segment:offset address of an ASCIIZ description string describing the manufacturer.
597 ///
598 UINT16 MfgStringSegment;
599
600 ///
601 /// BBS device type. BBS device types are defined below.
602 ///
603 UINT16 DeviceType;
604
605 ///
606 /// Status of this boot device. Type BBS_STATUS_FLAGS is defined below.
607 ///
608 BBS_STATUS_FLAGS StatusFlags;
609
610 ///
611 /// Segment:Offset address of boot loader for IPL devices or install INT13 handler for
612 /// BCV devices.
613 ///
614 UINT16 BootHandlerOffset;
615
616 ///
617 /// Segment:Offset address of boot loader for IPL devices or install INT13 handler for
618 /// BCV devices.
619 ///
620 UINT16 BootHandlerSegment;
621
622 ///
623 /// Segment:offset address of an ASCIIZ description string describing this device.
624 ///
625 UINT16 DescStringOffset;
626
627 ///
628 /// Segment:offset address of an ASCIIZ description string describing this device.
629 ///
630 UINT16 DescStringSegment;
631
632 ///
633 /// Reserved.
634 ///
635 UINT32 InitPerReserved;
636
637 ///
638 /// The use of these fields is IBV dependent. They can be used to flag that an OpROM
639 /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
640 /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
641 ///
642 UINT32 AdditionalIrq13Handler;
643
644 ///
645 /// The use of these fields is IBV dependent. They can be used to flag that an OpROM
646 /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
647 /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
648 ///
649 UINT32 AdditionalIrq18Handler;
650
651 ///
652 /// The use of these fields is IBV dependent. They can be used to flag that an OpROM
653 /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
654 /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
655 ///
656 UINT32 AdditionalIrq19Handler;
657
658 ///
659 /// The use of these fields is IBV dependent. They can be used to flag that an OpROM
660 /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
661 /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
662 ///
663 UINT32 AdditionalIrq40Handler;
664 UINT8 AssignedDriveNumber;
665 UINT32 AdditionalIrq41Handler;
666 UINT32 AdditionalIrq46Handler;
667 UINT32 IBV1;
668 UINT32 IBV2;
669 } BBS_TABLE;
670
671 #define BBS_FLOPPY 0x01
672 #define BBS_HARDDISK 0x02
673 #define BBS_CDROM 0x03
674 #define BBS_PCMCIA 0x04
675 #define BBS_USB 0x05
676 #define BBS_EMBED_NETWORK 0x06
677 #define BBS_BEV_DEVICE 0x80
678 #define BBS_UNKNOWN 0xff
679
680 #define BBS_DO_NOT_BOOT_FROM 0xFFFC
681 #define BBS_LOWEST_PRIORITY 0xFFFD
682 #define BBS_UNPRIORITIZED_ENTRY 0xFFFE
683 #define BBS_IGNORE_ENTRY 0xFFFF
684
685 ///
686 /// SMM_ATTRIBUTES & relating type, port and data size constants
687 ///
688 typedef struct {
689 ///
690 /// Access mechanism used to generate the soft SMI. Defined types are below. The other
691 /// values are reserved for future usage.
692 ///
693 UINT16 Type : 3;
694
695 ///
696 /// Size of "port" in bits. Defined values are below.
697 ///
698 UINT16 PortGranularity : 3;
699
700 ///
701 /// Size of data in bits. Defined values are below.
702 ///
703 UINT16 DataGranularity : 3;
704
705 ///
706 /// Reserved for future use.
707 ///
708 UINT16 Reserved : 7;
709 } SMM_ATTRIBUTES;
710
711 #define STANDARD_IO 0x00
712 #define STANDARD_MEMORY 0x01
713
714 #define PORT_SIZE_8 0x00
715 #define PORT_SIZE_16 0x01
716 #define PORT_SIZE_32 0x02
717 #define PORT_SIZE_64 0x03
718
719 #define DATA_SIZE_8 0x00
720 #define DATA_SIZE_16 0x01
721 #define DATA_SIZE_32 0x02
722 #define DATA_SIZE_64 0x03
723
724 ///
725 /// SMM_FUNCTION & relating constants
726 ///
727 typedef struct {
728 UINT16 Function : 15;
729 UINT16 Owner : 1;
730 } SMM_FUNCTION;
731
732 #define INT15_D042 0x0000
733 #define GET_USB_BOOT_INFO 0x0001
734 #define DMI_PNP_50_57 0x0002
735
736 #define STANDARD_OWNER 0x0
737 #define OEM_OWNER 0x1
738
739 /**
740 * SMM_ENTRY
741 *
742 * This structure assumes both port and data sizes are 1. SmmAttribute must be
743 * properly to reflect that assumption.
744 **/
745 typedef struct {
746 ///
747 /// Describes the access mechanism, SmmPort, and SmmData sizes. Type
748 /// SMM_ATTRIBUTES is defined below.
749 ///
750 SMM_ATTRIBUTES SmmAttributes;
751
752 ///
753 /// Function Soft SMI is to perform. Type SMM_FUNCTION is defined below.
754 ///
755 SMM_FUNCTION SmmFunction;
756
757 ///
758 /// SmmPort size depends upon SmmAttributes and ranges from2 bytes to 16 bytes
759 ///
760 UINT8 SmmPort;
761
762 ///
763 /// SmmData size depends upon SmmAttributes and ranges from2 bytes to 16 bytes
764 ///
765 UINT8 SmmData;
766 } SMM_ENTRY;
767
768 ///
769 /// SMM_TABLE
770 ///
771 typedef struct {
772 UINT16 NumSmmEntries; ///< Number of entries represented by SmmEntry.
773 SMM_ENTRY SmmEntry; ///< One entry per function. Type SMM_ENTRY is defined below.
774 } SMM_TABLE;
775
776 ///
777 /// UDC_ATTRIBUTES
778 ///
779 typedef struct {
780 ///
781 /// This bit set indicates that the ServiceAreaData is valid.
782 ///
783 UINT8 DirectoryServiceValidity : 1;
784
785 ///
786 /// This bit set indicates to use the Reserve Area Boot Code Address (RACBA) only if
787 /// DirectoryServiceValidity is 0.
788 ///
789 UINT8 RabcaUsedFlag : 1;
790
791 ///
792 /// This bit set indicates to execute hard disk diagnostics.
793 ///
794 UINT8 ExecuteHddDiagnosticsFlag : 1;
795
796 ///
797 /// Reserved for future use. Set to 0.
798 ///
799 UINT8 Reserved : 5;
800 } UDC_ATTRIBUTES;
801
802 ///
803 /// UD_TABLE
804 ///
805 typedef struct {
806 ///
807 /// This field contains the bit-mapped attributes of the PARTIES information. Type
808 /// UDC_ATTRIBUTES is defined below.
809 ///
810 UDC_ATTRIBUTES Attributes;
811
812 ///
813 /// This field contains the zero-based device on which the selected
814 /// ServiceDataArea is present. It is 0 for master and 1 for the slave device.
815 ///
816 UINT8 DeviceNumber;
817
818 ///
819 /// This field contains the zero-based index into the BbsTable for the parent device.
820 /// This index allows the user to reference the parent device information such as PCI
821 /// bus, device function.
822 ///
823 UINT8 BbsTableEntryNumberForParentDevice;
824
825 ///
826 /// This field contains the zero-based index into the BbsTable for the boot entry.
827 ///
828 UINT8 BbsTableEntryNumberForBoot;
829
830 ///
831 /// This field contains the zero-based index into the BbsTable for the HDD diagnostics entry.
832 ///
833 UINT8 BbsTableEntryNumberForHddDiag;
834
835 ///
836 /// The raw Beer data.
837 ///
838 UINT8 BeerData[128];
839
840 ///
841 /// The raw data of selected service area.
842 ///
843 UINT8 ServiceAreaData[64];
844 } UD_TABLE;
845
846 #define EFI_TO_LEGACY_MAJOR_VERSION 0x02
847 #define EFI_TO_LEGACY_MINOR_VERSION 0x00
848 #define MAX_IDE_CONTROLLER 8
849
850 ///
851 /// EFI_TO_COMPATIBILITY16_BOOT_TABLE
852 ///
853 typedef struct {
854 UINT16 MajorVersion; ///< The EfiCompatibility major version number.
855 UINT16 MinorVersion; ///< The EfiCompatibility minor version number.
856 UINT32 AcpiTable; ///< Location of the RSDT ACPI table. < 4G range
857 UINT32 SmbiosTable; ///< Location of the SMBIOS table in EFI memory. < 4G range
858 UINT32 SmbiosTableLength;
859 //
860 // Legacy SIO state
861 //
862 DEVICE_PRODUCER_DATA_HEADER SioData; ///< Standard traditional device information.
863 UINT16 DevicePathType; ///< The default boot type.
864 UINT16 PciIrqMask; ///< Mask of which IRQs have been assigned to PCI.
865 UINT32 NumberE820Entries; ///< Number of E820 entries. The number can change from the
866 ///< Compatibility16InitializeYourself() function.
867 //
868 // Controller & Drive Identify[2] per controller information
869 //
870 HDD_INFO HddInfo[MAX_IDE_CONTROLLER]; ///< Hard disk drive information, including raw Identify Drive data.
871 UINT32 NumberBbsEntries; ///< Number of entries in the BBS table
872 UINT32 BbsTable; ///< Pointer to the BBS table. Type BBS_TABLE is defined below.
873 UINT32 SmmTable; ///< Pointer to the SMM table. Type SMM_TABLE is defined below.
874 UINT32 OsMemoryAbove1Mb; ///< The amount of usable memory above 1 MB, i.e. E820 type 1 memory. This value can
875 ///< differ from the value in EFI_TO_COMPATIBILITY16_INIT_TABLE as more
876 ///< memory may have been discovered.
877 UINT32 UnconventionalDeviceTable; ///< Information to boot off an unconventional device like a PARTIES partition. Type
878 ///< UD_TABLE is defined below.
879 } EFI_TO_COMPATIBILITY16_BOOT_TABLE;
880
881 ///
882 /// EFI_LEGACY_INSTALL_PCI_HANDLER
883 ///
884 typedef struct {
885 UINT8 PciBus; ///< The PCI bus of the device.
886 UINT8 PciDeviceFun; ///< The PCI device in bits 7:3 and function in bits 2:0.
887 UINT8 PciSegment; ///< The PCI segment of the device.
888 UINT8 PciClass; ///< The PCI class code of the device.
889 UINT8 PciSubclass; ///< The PCI subclass code of the device.
890 UINT8 PciInterface; ///< The PCI interface code of the device.
891 //
892 // Primary section
893 //
894 UINT8 PrimaryIrq; ///< The primary device IRQ.
895 UINT8 PrimaryReserved; ///< Reserved.
896 UINT16 PrimaryControl; ///< The primary device control I/O base.
897 UINT16 PrimaryBase; ///< The primary device I/O base.
898 UINT16 PrimaryBusMaster; ///< The primary device bus master I/O base.
899 //
900 // Secondary Section
901 //
902 UINT8 SecondaryIrq; ///< The secondary device IRQ.
903 UINT8 SecondaryReserved; ///< Reserved.
904 UINT16 SecondaryControl; ///< The secondary device control I/O base.
905 UINT16 SecondaryBase; ///< The secondary device I/O base.
906 UINT16 SecondaryBusMaster; ///< The secondary device bus master I/O base.
907 } EFI_LEGACY_INSTALL_PCI_HANDLER;
908
909 //
910 // Restore default pack value
911 //
912 #pragma pack()
913
914 #endif /* _FRAMEWORK_LEGACY_16_H_ */