1 /** @file
2 Head file for front page.
3 
4 Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6 
7 **/
8 
9 #ifndef _FRONT_PAGE_H_
10 #define _FRONT_PAGE_H_
11 
12 #include "String.h"
13 #include "Ui.h"
14 
15 #include <Protocol/BootLogo.h>
16 //
17 // These is  the VFR compiler generated data representing our VFR data.
18 //
19 extern UINT8  FrontPageVfrBin[];
20 
21 extern EFI_FORM_BROWSER2_PROTOCOL      *gFormBrowser2;
22 
23 
24 #define SMBIOS_TYPE4_CPU_SOCKET_POPULATED BIT6
25 
26 //
27 // This is the VFR compiler generated header file which defines the
28 // string identifiers.
29 //
30 #define PRINTABLE_LANGUAGE_NAME_STRING_ID     0x0001
31 
32 //
33 // These are defined as the same with vfr file
34 //
35 #define FRONT_PAGE_FORM_ID             0x1000
36 
37 #define LABEL_FRANTPAGE_INFORMATION    0x1000
38 #define LABEL_END                      0xffff
39 
40 #define FRONT_PAGE_FORMSET_GUID \
41   { \
42     0x9e0c30bc, 0x3f06, 0x4ba6, {0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe} \
43   }
44 
45 #define FRONT_PAGE_CALLBACK_DATA_SIGNATURE  SIGNATURE_32 ('F', 'P', 'C', 'B')
46 
47 typedef struct {
48   UINTN                           Signature;
49 
50   //
51   // HII relative handles
52   //
53   EFI_HII_HANDLE                  HiiHandle;
54   EFI_HANDLE                      DriverHandle;
55   EFI_STRING_ID                   *LanguageToken;
56 
57   //
58   // Produced protocols
59   //
60   EFI_HII_CONFIG_ACCESS_PROTOCOL  ConfigAccess;
61 } FRONT_PAGE_CALLBACK_DATA;
62 
63 
64 #define EFI_FP_CALLBACK_DATA_FROM_THIS(a) \
65   CR (a, \
66       FRONT_PAGE_CALLBACK_DATA, \
67       ConfigAccess, \
68       FRONT_PAGE_CALLBACK_DATA_SIGNATURE \
69       )
70 
71 /**
72   This function allows a caller to extract the current configuration for one
73   or more named elements from the target driver.
74 
75 
76   @param This            - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
77   @param Request         - A null-terminated Unicode string in <ConfigRequest> format.
78   @param Progress        - On return, points to a character in the Request string.
79                          Points to the string's null terminator if request was successful.
80                          Points to the most recent '&' before the first failing name/value
81                          pair (or the beginning of the string if the failure is in the
82                          first name/value pair) if the request was not successful.
83   @param Results         - A null-terminated Unicode string in <ConfigAltResp> format which
84                          has all values filled in for the names in the Request string.
85                          String to be allocated by the called function.
86 
87   @retval  EFI_SUCCESS            The Results is filled with the requested values.
88   @retval  EFI_OUT_OF_RESOURCES   Not enough memory to store the results.
89   @retval  EFI_INVALID_PARAMETER  Request is NULL, illegal syntax, or unknown name.
90   @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.
91 
92 **/
93 EFI_STATUS
94 EFIAPI
95 FakeExtractConfig (
96   IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
97   IN  CONST EFI_STRING                       Request,
98   OUT EFI_STRING                             *Progress,
99   OUT EFI_STRING                             *Results
100   );
101 
102 /**
103   This function processes the results of changes in configuration.
104 
105 
106   @param This            - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
107   @param Configuration   - A null-terminated Unicode string in <ConfigResp> format.
108   @param Progress        - A pointer to a string filled in with the offset of the most
109                          recent '&' before the first failing name/value pair (or the
110                          beginning of the string if the failure is in the first
111                          name/value pair) or the terminating NULL if all was successful.
112 
113   @retval  EFI_SUCCESS            The Results is processed successfully.
114   @retval  EFI_INVALID_PARAMETER  Configuration is NULL.
115   @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.
116 
117 **/
118 EFI_STATUS
119 EFIAPI
120 FakeRouteConfig (
121   IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
122   IN  CONST EFI_STRING                       Configuration,
123   OUT EFI_STRING                             *Progress
124   );
125 
126 /**
127   This function processes the results of changes in configuration.
128 
129 
130   @param This            - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
131   @param Action          - Specifies the type of action taken by the browser.
132   @param QuestionId      - A unique value which is sent to the original exporting driver
133                          so that it can identify the type of data to expect.
134   @param Type            - The type of value for the question.
135   @param Value           - A pointer to the data being sent to the original exporting driver.
136   @param ActionRequest   - On return, points to the action requested by the callback function.
137 
138   @retval  EFI_SUCCESS           The callback successfully handled the action.
139   @retval  EFI_OUT_OF_RESOURCES  Not enough storage is available to hold the variable and its data.
140   @retval  EFI_DEVICE_ERROR      The variable could not be saved.
141   @retval  EFI_UNSUPPORTED       The specified Action is not supported by the callback.
142 
143 **/
144 EFI_STATUS
145 EFIAPI
146 FrontPageCallback (
147   IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
148   IN  EFI_BROWSER_ACTION                     Action,
149   IN  EFI_QUESTION_ID                        QuestionId,
150   IN  UINT8                                  Type,
151   IN  EFI_IFR_TYPE_VALUE                     *Value,
152   OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest
153   );
154 
155 /**
156   Initialize HII information for the FrontPage
157 
158   @retval  EFI_SUCCESS        The operation is successful.
159   @retval  EFI_DEVICE_ERROR   If the dynamic opcode creation failed.
160 
161 **/
162 EFI_STATUS
163 InitializeFrontPage (
164   VOID
165   );
166 
167 /**
168   Acquire the string associated with the ProducerGuid and return it.
169 
170 
171   @param ProducerGuid    - The Guid to search the HII database for
172   @param Token           - The token value of the string to extract
173   @param String          - The string that is extracted
174 
175   @retval  EFI_SUCCESS  The function returns EFI_SUCCESS always.
176 
177 **/
178 EFI_STATUS
179 GetProducerString (
180   IN      EFI_GUID                  *ProducerGuid,
181   IN      EFI_STRING_ID             Token,
182   OUT     CHAR16                    **String
183   );
184 
185 /**
186   This function is the main entry of the UI entry.
187   The function will present the main menu of the system UI.
188 
189   @param ConnectAllHappened Caller passes the value to UI to avoid unnecessary connect-all.
190 
191 **/
192 VOID
193 EFIAPI
194 UiEntry (
195   IN BOOLEAN                      ConnectAllHappened
196   );
197 
198 /**
199   Extract device path for given HII handle and class guid.
200 
201   @param Handle          The HII handle.
202 
203   @retval  NULL          Fail to get the device path string.
204   @return  PathString    Get the device path string.
205 
206 **/
207 CHAR16 *
208 ExtractDevicePathFromHiiHandle (
209   IN      EFI_HII_HANDLE      Handle
210   );
211 
212 #endif // _FRONT_PAGE_H_
213 
214