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