1 /** @file
2   The EFI_FORM_BROWSER_PROTOCOL is the interface to the EFI
3   Configuration Driver.  This interface enables the caller to direct the
4   configuration driver to use either the HII database or the passed-in
5   packet of data.  This will also allow the caller to post messages
6   into the configuration drivers internal mailbox.
7 
8 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
9 This program and the accompanying materials are licensed and made available under
10 the terms and conditions of the BSD License that accompanies this distribution.
11 The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php.
13 
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 
17   Module Name:  FrameworkFormBrowser.h
18 
19   @par Revision Reference:
20   This protocol is defined in HII spec 0.92.
21 
22 **/
23 
24 #ifndef __FRAMEWORK_FORM_BROWSER_H__
25 #define __FRAMEWORK_FORM_BROWSER_H__
26 
27 #include <Protocol/FrameworkHii.h>
28 
29 
30 #define EFI_FORM_BROWSER_PROTOCOL_GUID \
31   { \
32     0xe5a1333e, 0xe1b4, 0x4d55, {0xce, 0xeb, 0x35, 0xc3, 0xef, 0x13, 0x34, 0x43 } \
33   }
34 
35 #define EFI_FORM_BROWSER_COMPATIBILITY_PROTOCOL_GUID \
36   { \
37     0xfb7c852, 0xadca, 0x4853, { 0x8d, 0xf, 0xfb, 0xa7, 0x1b, 0x1c, 0xe1, 0x1a } \
38   }
39 
40 typedef struct _EFI_FORM_BROWSER_PROTOCOL EFI_FORM_BROWSER_PROTOCOL;
41 
42 typedef struct {
43   UINT32  Length;
44   UINT16  Type;
45   UINT8   Data[1];
46 } EFI_HII_PACKET;
47 
48 typedef struct {
49   EFI_HII_IFR_PACK    *IfrData;
50   EFI_HII_STRING_PACK *StringData;
51 } EFI_IFR_PACKET;
52 
53 typedef struct {
54   UINTN LeftColumn;
55   UINTN RightColumn;
56   UINTN TopRow;
57   UINTN BottomRow;
58 } FRAMEWORK_EFI_SCREEN_DESCRIPTOR;
59 
60 /**
61   Provides direction to the configuration driver whether to use the HII
62   database or a passed-in set of data. This function also establishes a
63   pointer to the calling driver's callback interface.
64 
65   @param  This                  A pointer to the EFI_FORM_BROWSER_PROTOCOL instance.
66   @param  UseDatabase           Determines whether the HII database is to be
67                                 used to gather information. If the value is FALSE,
68                                 the configuration driver will get the information
69                                 provided in the passed-in Packet parameters.
70   @param  Handle                A pointer to an array of HII handles to display.
71                                 This value should correspond to the value of the
72                                 HII form package that is required to be displayed.
73   @param  HandleCount           The number of handles in the array specified by Handle.
74   @param  Packet                A pointer to a set of data containing pointers to IFR
75                                 and/or string data.
76   @param  CallbackHandle        The handle to the driver's callback interface.
77                                 This parameter is used only when the UseDatabase
78                                 parameter is FALSE and an application wants to
79                                 register a callback with the browser.
80   @param  NvMapOverride         This buffer is used only when there is no NV variable
81                                 to define the current settings and the caller needs
82                                 to provide to the browser the current settings for
83                                 the "fake" NV variable.
84   @param  ScreenDimensions      Allows the browser to be called so that it occupies
85                                 a portion of the physical screen instead of dynamically
86                                 determining the screen dimensions.
87   @param  ResetRequired         This BOOLEAN value denotes whether a reset is required
88                                 based on the data that might have been changed.
89                                 The ResetRequired parameter is primarily applicable
90                                 for configuration applications, and is an
91                                 optional parameter.
92 
93   @retval EFI_SUCCESS           The function completed successfully.
94   @retval EFI_NOT_FOUND         The variable was not found.
95   @retval EFI_BUFFER_TOO_SMALL  The DataSize is too small for the result.
96                                 DataSize has been updated with the size needed to
97                                 complete the request.
98   @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
99   @retval EFI_DEVICE_ERROR      The variable could not be saved due to a hardware failure.
100 
101 **/
102 typedef
103 EFI_STATUS
104 (EFIAPI *EFI_SEND_FORM)(
105   IN  EFI_FORM_BROWSER_PROTOCOL       *This,
106   IN  BOOLEAN                         UseDatabase,
107   IN  FRAMEWORK_EFI_HII_HANDLE        *Handle,
108   IN  UINTN                           HandleCount,
109   IN  EFI_IFR_PACKET                  *Packet, OPTIONAL
110   IN  EFI_HANDLE                      CallbackHandle, OPTIONAL
111   IN  UINT8                           *NvMapOverride, OPTIONAL
112   IN  FRAMEWORK_EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL
113   OUT BOOLEAN                         *ResetRequired OPTIONAL
114   );
115 
116 /**
117   Routine used to abstract a generic dialog interface and return the selected
118   key or string.
119 
120   @param  NumberOfLines         The number of lines for the dialog box.
121   @param  HotKey                Defines whether a single character is parsed (TRUE)
122                                 and returned in KeyValue, or if a string is returned
123                                 in StringBuffer.
124   @param  MaximumStringSize     The maximum size in bytes of a typed-in string.
125                                 Because each character is a CHAR16, the minimum
126                                 string returned is two bytes.
127   @param  StringBuffer          The passed-in pointer to the buffer that will hold
128                                 the typed in string if HotKey is FALSE.
129   @param  KeyValue              The EFI_INPUT_KEY value returned if HotKey is TRUE.
130   @param  String                The pointer to the first string in the list of strings
131                                 that comprise the dialog box.
132   @param  ...                   A series of NumberOfLines text strings that will be used
133                                 to construct the dialog box.
134 
135   @retval EFI_SUCCESS           The dialog was displayed and user interaction was received.
136   @retval EFI_DEVICE_ERROR      The user typed in an ESC character to exit the routine.
137   @retval EFI_INVALID_PARAMETER One of the parameters was invalid
138 
139 **/
140 typedef
141 EFI_STATUS
142 (EFIAPI *EFI_CREATE_POP_UP)(
143   IN  UINTN                           NumberOfLines,
144   IN  BOOLEAN                         HotKey,
145   IN  UINTN                           MaximumStringSize,
146   OUT CHAR16                          *StringBuffer,
147   OUT EFI_INPUT_KEY                   *KeyValue,
148   IN  CHAR16                          *String,
149   ...
150   );
151 
152 /**
153   The EFI_FORM_BROWSER_PROTOCOL is the interface to call for drivers to
154   leverage the EFI configuration driver interface.
155 **/
156 struct _EFI_FORM_BROWSER_PROTOCOL {
157   ///
158   /// Provides direction to the configuration driver whether to use the HII
159   /// database or to use a passed-in set of data. This function also establishes
160   /// a pointer to the calling driver's callback interface.
161   ///
162   EFI_SEND_FORM     SendForm;
163 
164   ///
165   /// Routine used to abstract a generic dialog interface and return the
166   /// selected key or string.
167   ///
168   EFI_CREATE_POP_UP CreatePopUp;
169 };
170 
171 extern EFI_GUID gEfiFormBrowserProtocolGuid;
172 extern EFI_GUID gEfiFormBrowserCompatibilityProtocolGuid;
173 
174 
175 #endif
176