Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / efi / efi_hii.h
1 #ifndef _IPXE_EFI_HII_H
2 #define _IPXE_EFI_HII_H
3
4 /** @file
5  *
6  * EFI human interface infrastructure
7  */
8
9 FILE_LICENCE ( GPL2_OR_LATER );
10
11 #include <string.h>
12 #include <ipxe/efi/Uefi/UefiInternalFormRepresentation.h>
13 #include <ipxe/efi/Guid/MdeModuleHii.h>
14
15 /** GUID indicating formset compliance for IBM Unified Configuration Manager */
16 #define EFI_HII_IBM_UCM_COMPLIANT_FORMSET_GUID                             \
17         { 0x5c8e9746, 0xa5f7, 0x4593,                                      \
18           { 0xaf, 0x1f, 0x66, 0xa8, 0x2a, 0xa1, 0x9c, 0xb1 } }
19
20 /** An EFI IFR builder */
21 struct efi_ifr_builder {
22         /** IFR opcodes */
23         EFI_IFR_OP_HEADER *ops;
24         /** Length of IFR opcodes */
25         size_t ops_len;
26         /** Strings */
27         EFI_HII_STRING_BLOCK *strings;
28         /** Length of strings */
29         size_t strings_len;
30         /** Current string identifier */
31         unsigned int string_id;
32         /** Current variable store identifier */
33         unsigned int varstore_id;
34         /** Current form identifier */
35         unsigned int form_id;
36         /** An allocation has failed */
37         int failed;
38 };
39
40 /**
41  * Initialise IFR builder
42  *
43  * @v ifr               IFR builder
44  *
45  * The caller must eventually call efi_ifr_free() to free the dynamic
46  * storage associated with the IFR builder.
47  */
48 static inline void efi_ifr_init ( struct efi_ifr_builder *ifr ) {
49         memset ( ifr, 0, sizeof ( *ifr ) );
50 }
51
52 extern unsigned int efi_ifr_string ( struct efi_ifr_builder *ifr,
53                                      const char *fmt, ... );
54 extern void efi_ifr_end_op ( struct efi_ifr_builder *ifr );
55 extern void efi_ifr_false_op ( struct efi_ifr_builder *ifr );
56 extern unsigned int efi_ifr_form_op ( struct efi_ifr_builder *ifr,
57                                       unsigned int title_id );
58 extern void efi_ifr_form_set_op ( struct efi_ifr_builder *ifr,
59                                   const EFI_GUID *guid,
60                                   unsigned int title_id, unsigned int help_id,
61                                   ... );
62 void efi_ifr_get_op ( struct efi_ifr_builder *ifr, unsigned int varstore_id,
63                       unsigned int varstore_info, unsigned int varstore_type );
64 extern void efi_ifr_guid_class_op ( struct efi_ifr_builder *ifr,
65                                     unsigned int class );
66 extern void efi_ifr_guid_subclass_op ( struct efi_ifr_builder *ifr,
67                                        unsigned int subclass );
68 extern void efi_ifr_numeric_op ( struct efi_ifr_builder *ifr,
69                                  unsigned int prompt_id,
70                                  unsigned int help_id, unsigned int question_id,
71                                  unsigned int varstore_id,
72                                  unsigned int varstore_info,
73                                  unsigned int vflags, unsigned long min_value,
74                                  unsigned long max_value, unsigned int step,
75                                  unsigned int flags );
76 extern void efi_ifr_string_op ( struct efi_ifr_builder *ifr,
77                                 unsigned int prompt_id, unsigned int help_id,
78                                 unsigned int question_id,
79                                 unsigned int varstore_id,
80                                 unsigned int varstore_info, unsigned int vflags,
81                                 unsigned int min_size, unsigned int max_size,
82                                 unsigned int flags );
83 extern void efi_ifr_suppress_if_op ( struct efi_ifr_builder *ifr );
84 extern void efi_ifr_text_op ( struct efi_ifr_builder *ifr,
85                               unsigned int prompt_id, unsigned int help_id,
86                               unsigned int text_id );
87 extern void efi_ifr_true_op ( struct efi_ifr_builder *ifr );
88 extern unsigned int
89 efi_ifr_varstore_name_value_op ( struct efi_ifr_builder *ifr,
90                                  const EFI_GUID *guid );
91 extern void efi_ifr_free ( struct efi_ifr_builder *ifr );
92 extern EFI_HII_PACKAGE_LIST_HEADER *
93 efi_ifr_package ( struct efi_ifr_builder *ifr, const EFI_GUID *guid,
94                   const char *language, unsigned int language_id );
95
96 #endif /* _IPXE_EFI_HII_H */