1 /** @file
2   This protocol is defined in UEFI spec.
3 
4   The EFI_FORM_BROWSER2_PROTOCOL is the interface to call for drivers to
5   leverage the EFI configuration driver interface.
6 
7 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials are licensed and made available under
9 the terms and conditions of the BSD License that accompanies this distribution.
10 The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php.
12 
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.
15 
16 **/
17 
18 #ifndef __EFI_FORM_BROWSER2_H__
19 #define __EFI_FORM_BROWSER2_H__
20 
21 #include <Guid/HiiPlatformSetupFormset.h>
22 
23 #define EFI_FORM_BROWSER2_PROTOCOL_GUID \
24   {0xb9d4c360, 0xbcfb, 0x4f9b, {0x92, 0x98, 0x53, 0xc1, 0x36, 0x98, 0x22, 0x58 }}
25 
26 
27 typedef struct _EFI_FORM_BROWSER2_PROTOCOL   EFI_FORM_BROWSER2_PROTOCOL;
28 
29 
30 
31 /**
32 
33   @param LeftColumn   The value that designates the text column
34                       where the browser window will begin from
35                       the left-hand side of the screen
36 
37   @param RightColumn  The value that designates the text
38                       column where the browser window will end
39                       on the right-hand side of the screen.
40 
41   @param TopRow       The value that designates the text row from the
42                       top of the screen where the browser window
43                       will start.
44 
45   @param BottomRow    The value that designates the text row from the
46                       bottom of the screen where the browser
47                       window will end.
48 **/
49 typedef struct {
50   UINTN   LeftColumn;
51   UINTN   RightColumn;
52   UINTN   TopRow;
53   UINTN   BottomRow;
54 } EFI_SCREEN_DESCRIPTOR;
55 
56 typedef UINTN EFI_BROWSER_ACTION_REQUEST;
57 
58 #define EFI_BROWSER_ACTION_REQUEST_NONE   0
59 #define EFI_BROWSER_ACTION_REQUEST_RESET  1
60 #define EFI_BROWSER_ACTION_REQUEST_SUBMIT 2
61 #define EFI_BROWSER_ACTION_REQUEST_EXIT   3
62 #define EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT  4
63 #define EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT 5
64 #define EFI_BROWSER_ACTION_REQUEST_FORM_APPLY        6
65 #define EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD      7
66 #define EFI_BROWSER_ACTION_REQUEST_RECONNECT         8
67 
68 
69 /**
70   Initialize the browser to display the specified configuration forms.
71 
72   This function is the primary interface to the internal forms-based browser.
73   The forms browser will display forms associated with the specified Handles.
74   The browser will select all forms in packages which have the specified Type
75   and (for EFI_HII_PACKAGE_TYPE_GUID) the specified PackageGuid.
76 
77   @param This            A pointer to the EFI_FORM_BROWSER2_PROTOCOL instance
78 
79   @param Handles         A pointer to an array of Handles. This value should correspond
80                          to the value of the HII form package that is required to be displayed.
81 
82   @param HandleCount     The number of Handles specified in Handle.
83 
84   @param FormSetGuid     This field points to the EFI_GUID which must match the Guid field or one of the
85                          elements of the ClassId field  in the EFI_IFR_FORM_SET op-code.  If
86                          FormsetGuid is NULL, then this function will display the form set class
87                          EFI_HII_PLATFORM_SETUP_FORMSET_GUID.
88 
89   @param FormId          This field specifies the identifier of the form within the form set to render as the first
90                          displayable page. If this field has a value of 0x0000, then the Forms Browser will
91                          render the first enabled form in the form set.
92 
93   @param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
94                           characters.
95 
96   @param ActionRequest   Points to the action recommended by the form.
97 
98   @retval EFI_SUCCESS           The function completed successfully
99 
100   @retval EFI_NOT_FOUND         The variable was not found.
101 
102   @retval EFI_INVALID_PARAMETER One of the parameters has an
103                                 invalid value.
104 **/
105 typedef
106 EFI_STATUS
107 (EFIAPI *EFI_SEND_FORM2)(
108   IN CONST  EFI_FORM_BROWSER2_PROTOCOL  *This,
109   IN        EFI_HII_HANDLE              *Handle,
110   IN        UINTN                      HandleCount,
111   IN        EFI_GUID                   *FormSetGuid, OPTIONAL
112   IN        EFI_FORM_ID                FormId, OPTIONAL
113   IN CONST  EFI_SCREEN_DESCRIPTOR      *ScreenDimensions, OPTIONAL
114   OUT       EFI_BROWSER_ACTION_REQUEST *ActionRequest  OPTIONAL
115 );
116 
117 
118 /**
119   This function is called by a callback handler to retrieve uncommitted state data from the browser.
120 
121   This routine is called by a routine which was called by the
122   browser. This routine called this service in the browser to
123   retrieve or set certain uncommitted state information.
124 
125   @param This           A pointer to the EFI_FORM_BROWSER2_PROTOCOL instance.
126 
127   @param ResultsDataSize  A pointer to the size of the buffer
128                           associated with ResultsData. On input, the size in
129                           bytes of ResultsData. On output, the size of data
130                           returned in ResultsData.
131 
132   @param ResultsData    A string returned from an IFR browser or
133                         equivalent. The results string will have
134                         no routing information in them.
135 
136   @param RetrieveData   A BOOLEAN field which allows an agent to
137                         retrieve (if RetrieveData = TRUE) data
138                         from the uncommitted browser state
139                         information or set (if RetrieveData =
140                         FALSE) data in the uncommitted browser
141                         state information.
142 
143   @param VariableGuid   An optional field to indicate the target
144                         variable GUID name to use.
145 
146   @param VariableName   An optional field to indicate the target
147                         human-readable variable name.
148 
149   @retval EFI_SUCCESS           The results have been distributed or are
150                                 awaiting distribution.
151 
152   @retval EFI_OUT_OF_RESOURCES  The ResultsDataSize specified
153                                 was too small to contain the
154                                 results data.
155 
156 **/
157 typedef
158 EFI_STATUS
159 (EFIAPI *EFI_BROWSER_CALLBACK2)(
160   IN CONST  EFI_FORM_BROWSER2_PROTOCOL *This,
161   IN OUT    UINTN                     *ResultsDataSize,
162   IN OUT    EFI_STRING                ResultsData,
163   IN CONST  BOOLEAN                   RetrieveData,
164   IN CONST  EFI_GUID                  *VariableGuid, OPTIONAL
165   IN CONST  CHAR16                    *VariableName OPTIONAL
166 );
167 
168 ///
169 /// This interface will allow the caller to direct the configuration
170 /// driver to use either the HII database or use the passed-in packet of data.
171 ///
172 struct _EFI_FORM_BROWSER2_PROTOCOL {
173   EFI_SEND_FORM2         SendForm;
174   EFI_BROWSER_CALLBACK2  BrowserCallback;
175 } ;
176 
177 extern EFI_GUID gEfiFormBrowser2ProtocolGuid;
178 
179 #endif
180 
181