1 /** @file
2   Header file for Function and Macro defintions for to extract default values from UEFI Form package.
3 
4   Copyright (c) 2008 - 2010, 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 _HII_THUNK_UEFI_IFR_DEFAULT_
16 #define _HII_THUNK_UEFI_IFR_DEFAULT_
17 
18 #define UEFI_IFR_BUFFER_STORAGE_NODE_FROM_LIST(a) CR(a, UEFI_IFR_BUFFER_STORAGE_NODE, List, UEFI_IFR_BUFFER_STORAGE_NODE_SIGNATURE)
19 #define UEFI_IFR_BUFFER_STORAGE_NODE_SIGNATURE  SIGNATURE_32 ('I', 'b', 'S', 'n')
20 typedef struct {
21   LIST_ENTRY   List;
22   UINT32       Signature;
23 
24   EFI_GUID     Guid;
25   CHAR16       *Name;
26   UINT16       DefaultId;
27   UINT16       StoreId;
28   UINTN        Size;
29   UINT8        *Buffer;
30 
31 } UEFI_IFR_BUFFER_STORAGE_NODE;
32 
33 /**
34   Get the default value for Buffer Type storage from the FormSet in ThunkContext.
35 
36   The results can be multiple instances of UEFI_IFR_BUFFER_STORAGE_NODE.
37   They are inserted to the link list.
38 
39   @param  ThunkContext  Hii thunk context.
40   @param  UefiDefaults  The head of link list for the output.
41 
42   @retval   EFI_SUCCESS          Successful.
43 
44 **/
45 EFI_STATUS
46 UefiIfrGetBufferTypeDefaults (
47   IN  HII_THUNK_CONTEXT   *ThunkContext,
48   OUT LIST_ENTRY          **UefiDefaults
49   );
50 
51 /**
52   Convert the UEFI Buffer Type default values to a Framework HII default
53   values specified by a EFI_HII_VARIABLE_PACK_LIST structure.
54 
55   @param  ListHead             The link list of UEFI_IFR_BUFFER_STORAGE_NODE
56                                which contains the default values retrived from a UEFI form set.
57   @param  DefaultMask          The default mask.
58                                The valid values are EFI_IFR_FLAG_DEFAULT and EFI_IFR_FLAG_MANUFACTURING.
59                                UEFI spec only map EFI_IFR_FLAG_DEFAULT and EFI_IFR_FLAG_MANUFACTURING
60                                from specification to valid default class.
61   @param  UefiFormSetDefaultVarStoreId
62                                ID of the default varstore in FormSet.
63   @param  VariablePackList     The output default value in a format defined in Framework.
64 
65   @retval   EFI_SUCCESS                Successful.
66   @retval   EFI_INVALID_PARAMETER      The default mask is not EFI_IFR_FLAG_DEFAULT or
67                                        EFI_IFR_FLAG_MANUFACTURING.
68 **/
69 EFI_STATUS
70 UefiDefaultsToFwDefaults (
71   IN     LIST_ENTRY                  *ListHead,
72   IN     UINTN                       DefaultMask,
73   IN     EFI_VARSTORE_ID             UefiFormSetDefaultVarStoreId,
74   OUT    EFI_HII_VARIABLE_PACK_LIST  **VariablePackList
75   );
76 
77 /**
78   Free up all buffer allocated for the link list of UEFI_IFR_BUFFER_STORAGE_NODE.
79 
80   @param  ListHead                  The link list of UEFI_IFR_BUFFER_STORAGE_NODE
81                                     which contains the default values retrived from
82                                     a UEFI form set.
83 
84 **/
85 VOID
86 FreeDefaultList (
87   IN     LIST_ENTRY                  *ListHead
88   );
89 
90 #endif
91 
92 
93