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