~serge-hallyn/ubuntu/oneiric/ipxe/link-kvm

« back to all changes in this revision

Viewing changes to src/include/ipxe/efi/efi_hii.h

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2011-07-31 20:57:02 UTC
  • mfrom: (2.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20110731205702-kffmzz6tnmgfw50f
Tags: 1.0.0+git-2.149b50-1
New snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 <ipxe/efi/Uefi/UefiInternalFormRepresentation.h>
 
12
#include <ipxe/efi/Guid/MdeModuleHii.h>
 
13
 
 
14
/**
 
15
 * Define an EFI IFR form set type
 
16
 *
 
17
 * @v num_class_guids   Number of class GUIDs
 
18
 * @ret type            Form set type
 
19
 */
 
20
#define EFI_IFR_FORM_SET_TYPE( num_class_guids )                           \
 
21
        struct {                                                           \
 
22
                EFI_IFR_FORM_SET FormSet;                                  \
 
23
                EFI_GUID ClassGuid[num_class_guids];                       \
 
24
        } __attribute__ (( packed ))
 
25
 
 
26
/**
 
27
 * Define an EFI IFR form set
 
28
 *
 
29
 * @v guid              GUID
 
30
 * @v title             Title string
 
31
 * @v help              Help string
 
32
 * @v type              Form set type (as returned by EFI_IFR_FORM_SET_TYPE())
 
33
 * @ret ifr             Form set
 
34
 *
 
35
 * This definition opens a new scope, which must be closed by an
 
36
 * EFI_IFR_END().
 
37
 */
 
38
#define EFI_IFR_FORM_SET( guid, title, help, type, ... ) {                 \
 
39
        .FormSet = {                                                       \
 
40
                .Header = {                                                \
 
41
                        .OpCode = EFI_IFR_FORM_SET_OP,                     \
 
42
                        .Length = sizeof ( type ),                         \
 
43
                        .Scope = 1,                                        \
 
44
                },                                                         \
 
45
                .Guid = guid,                                              \
 
46
                .FormSetTitle = title,                                     \
 
47
                .Help = help,                                              \
 
48
                .Flags = ( sizeof ( ( ( type * ) NULL )->ClassGuid ) /     \
 
49
                           sizeof ( ( ( type * ) NULL )->ClassGuid[0] ) ), \
 
50
        },                                                                 \
 
51
        .ClassGuid = {                                                     \
 
52
                __VA_ARGS__                                                \
 
53
        },                                                                 \
 
54
        }
 
55
 
 
56
/**
 
57
 * Define an EFI IFR GUID class
 
58
 *
 
59
 * @v class             Class
 
60
 * @ret ifr             GUID class
 
61
 */
 
62
#define EFI_IFR_GUID_CLASS( class ) {                                      \
 
63
        .Header = {                                                        \
 
64
                .OpCode = EFI_IFR_GUID_OP,                                 \
 
65
                .Length = sizeof ( EFI_IFR_GUID_CLASS ),                   \
 
66
        },                                                                 \
 
67
        .Guid = EFI_IFR_TIANO_GUID,                                        \
 
68
        .ExtendOpCode = EFI_IFR_EXTEND_OP_CLASS,                           \
 
69
        .Class = class,                                                    \
 
70
        }
 
71
 
 
72
/**
 
73
 * Define an EFI IFR GUID subclass
 
74
 *
 
75
 * @v subclass          Subclass
 
76
 * @ret ifr             GUID subclass
 
77
 */
 
78
#define EFI_IFR_GUID_SUBCLASS( subclass ) {                                \
 
79
        .Header = {                                                        \
 
80
                .OpCode = EFI_IFR_GUID_OP,                                 \
 
81
                .Length = sizeof ( EFI_IFR_GUID_SUBCLASS ),                \
 
82
        },                                                                 \
 
83
        .Guid = EFI_IFR_TIANO_GUID,                                        \
 
84
        .ExtendOpCode = EFI_IFR_EXTEND_OP_SUBCLASS,                        \
 
85
        .SubClass = subclass,                                              \
 
86
        }
 
87
 
 
88
/**
 
89
 * Define an EFI IFR form
 
90
 *
 
91
 * @v formid            Form ID
 
92
 * @v title             Title string
 
93
 * @ret ifr             Form
 
94
 *
 
95
 * This definition opens a new scope, which must be closed by an
 
96
 * EFI_IFR_END().
 
97
 */
 
98
#define EFI_IFR_FORM( formid, title ) {                                    \
 
99
        .Header = {                                                        \
 
100
                .OpCode = EFI_IFR_FORM_OP,                                 \
 
101
                .Length = sizeof ( EFI_IFR_FORM ),                         \
 
102
                .Scope = 1,                                                \
 
103
        },                                                                 \
 
104
        .FormId = formid,                                                  \
 
105
        .FormTitle = title,                                                \
 
106
        }
 
107
 
 
108
/**
 
109
 * Define an EFI IFR text widget
 
110
 *
 
111
 * @v prompt            Prompt string
 
112
 * @v help              Help string
 
113
 * @v text              Text string
 
114
 * @ret ifr             Text widget
 
115
 */
 
116
#define EFI_IFR_TEXT( prompt, help, text ) {                               \
 
117
        .Header = {                                                        \
 
118
                .OpCode = EFI_IFR_TEXT_OP,                                 \
 
119
                .Length = sizeof ( EFI_IFR_TEXT ),                         \
 
120
        },                                                                 \
 
121
        .Statement = {                                                     \
 
122
                .Prompt = prompt,                                          \
 
123
                .Help = help,                                              \
 
124
        },                                                                 \
 
125
        .TextTwo = text,                                                   \
 
126
        }
 
127
 
 
128
/**
 
129
 * Define an EFI IFR end marker
 
130
 *
 
131
 * @ret ifr             End marker
 
132
 */
 
133
#define EFI_IFR_END() {                                                    \
 
134
        .Header = {                                                        \
 
135
                .OpCode = EFI_IFR_END_OP,                                  \
 
136
                .Length = sizeof ( EFI_IFR_END ),                          \
 
137
        },                                                                 \
 
138
        }
 
139
 
 
140
#endif /* _IPXE_EFI_HII_H */