1 /*	$NetBSD: legacyboot.h,v 1.1.1.1 2014/04/01 16:16:07 jakllsch Exp $	*/
2 
3 /*++
4 
5 Copyright (c) 1999 Intel Corporation
6 
7 Module Name:
8 
9     legacyboot
10 
11 Abstract:
12 
13     EFI support for legacy boot
14 
15 
16 
17 Revision History
18 
19 --*/
20 
21 #ifndef _LEGACY_BOOT_INCLUDE_
22 #define _LEGACY_BOOT_INCLUDE_
23 
24 #define LEGACY_BOOT_PROTOCOL \
25     { 0x376e5eb2, 0x30e4, 0x11d3, { 0xba, 0xe5, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
26 
27 #pragma pack(1)
28 
29 //
30 // BBS 1.01 (See Appendix A) IPL and BCV Table Entry Data structure.
31 //  Seg:Off pointers have been converted to EFI pointers in this data structure
32 //  This is the structure that also maps to the EFI device path for the boot selection
33 //
34 typedef struct {
35     UINT16  DeviceType;
36     UINT16  StatusFlag;
37     UINT32  Reserved;
38     VOID    *BootHandler;   // Not an EFI entry point
39     CHAR8   *DescString;
40 } BBS_TABLE_ENTRY;
41 #pragma pack()
42 
43 typedef
44 EFI_STATUS
45 (EFIAPI *LEGACY_BOOT_CALL) (
46     IN EFI_DEVICE_PATH      *DevicePath
47     );
48 
49 
50 //
51 // BBS support functions
52 //  PnP Call numbers and BiosSelector hidden in implementation
53 //
54 
55 typedef enum {
56     IplRelative,
57     BcvRelative
58 } BBS_TYPE;
59 
60 INTERFACE_DECL(_LEGACY_BOOT_INTERFACE);
61 
62 //
63 // == PnP Function 0x60 then BbsVersion == 0x0101 if this call fails then BbsVersion == 0x0000
64 //
65 
66 //
67 // == PnP Function 0x61
68 //
69 typedef
70 EFI_STATUS
71 (EFIAPI *GET_DEVICE_COUNT) (
72     IN  struct _LEGACY_BOOT_INTERFACE   *This,
73     IN  BBS_TYPE        *TableType,
74     OUT UINTN           *DeviceCount,
75     OUT UINTN           *MaxCount
76     );
77 
78 //
79 // == PnP Function 0x62
80 //
81 typedef
82 EFI_STATUS
83 (EFIAPI *GET_PRIORITY_AND_TABLE) (
84     IN  struct _LEGACY_BOOT_INTERFACE   *This,
85     IN  BBS_TYPE        *TableType,
86     IN OUT  UINTN       *PrioritySize, // MaxCount * sizeof(UINT8)
87     OUT     UINTN       *Priority,
88     IN OUT  UINTN       *TableSize,    // MaxCount * sizeof(BBS_TABLE_ENTRY)
89     OUT BBS_TABLE_ENTRY *TableEntrySize
90     );
91 
92 //
93 // == PnP Function 0x63
94 //
95 typedef
96 EFI_STATUS
97 (EFIAPI *SET_PRIORITY) (
98     IN  struct _LEGACY_BOOT_INTERFACE   *This,
99     IN  BBS_TYPE        *TableType,
100     IN OUT  UINTN       *PrioritySize,
101     OUT     UINTN       *Priority
102     );
103 
104 typedef struct _LEGACY_BOOT_INTERFACE {
105     LEGACY_BOOT_CALL    BootIt;
106 
107     //
108     // New functions to allow BBS booting to be configured from EFI
109     //
110     UINTN                   BbsVersion;     // Currently 0x0101
111     GET_DEVICE_COUNT        GetDeviceCount;
112     GET_PRIORITY_AND_TABLE  GetPriorityAndTable;
113     SET_PRIORITY            SetPriority;
114 } LEGACY_BOOT_INTERFACE;
115 
116 EFI_STATUS
117 PlInitializeLegacyBoot (
118     VOID
119     );
120 
121 #endif
122