iPXE
efi_hii.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Michael Brown <mbrown@fensystems.co.uk>.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301, USA.
18  *
19  * You can also choose to distribute this program under the terms of
20  * the Unmodified Binary Distribution Licence (as given in the file
21  * COPYING.UBDL), provided that you have satisfied its requirements.
22  */
23 
24 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25 FILE_SECBOOT ( PERMITTED );
26 
27 #include <stdlib.h>
28 #include <stddef.h>
29 #include <stdarg.h>
30 #include <string.h>
31 #include <ipxe/efi/efi.h>
32 #include <ipxe/efi/efi_strings.h>
33 #include <ipxe/efi/efi_hii.h>
34 
35 /** Tiano GUID */
37 
38 /**
39  * Add string to IFR builder
40  *
41  * @v ifr IFR builder
42  * @v fmt Format string
43  * @v ... Arguments
44  * @ret string_id String identifier, or zero on failure
45  */
46 unsigned int efi_ifr_string ( struct efi_ifr_builder *ifr, const char *fmt,
47  ... ) {
48  EFI_HII_STRING_BLOCK *new_strings;
50  size_t new_strings_len;
51  va_list args;
52  size_t len;
53  unsigned int string_id;
54 
55  /* Do nothing if a previous allocation has failed */
56  if ( ifr->failed )
57  return 0;
58 
59  /* Calculate string length */
60  va_start ( args, fmt );
61  len = ( efi_vsnprintf ( NULL, 0, fmt, args ) + 1 /* wNUL */ );
62  va_end ( args );
63 
64  /* Reallocate strings */
65  new_strings_len = ( ifr->strings_len +
66  offsetof ( typeof ( *ucs2 ), StringText ) +
67  ( len * sizeof ( ucs2->StringText[0] ) ) );
68  new_strings = realloc ( ifr->strings, new_strings_len );
69  if ( ! new_strings ) {
70  ifr->failed = 1;
71  return 0;
72  }
73  ucs2 = ( ( ( void * ) new_strings ) + ifr->strings_len );
74  ifr->strings = new_strings;
75  ifr->strings_len = new_strings_len;
76 
77  /* Fill in string */
79  va_start ( args, fmt );
80  efi_vsnprintf ( ucs2->StringText, len, fmt, args );
81  va_end ( args );
82 
83  /* Allocate string ID */
84  string_id = ++(ifr->string_id);
85 
86  DBGC ( ifr, "IFR %p string %#04x is \"%ls\"\n",
87  ifr, string_id, ucs2->StringText );
88  return string_id;
89 }
90 
91 /**
92  * Add IFR opcode to IFR builder
93  *
94  * @v ifr IFR builder
95  * @v opcode Opcode
96  * @v len Opcode length
97  * @ret op Opcode, or NULL
98  */
99 static void * efi_ifr_op ( struct efi_ifr_builder *ifr, unsigned int opcode,
100  size_t len ) {
101  EFI_IFR_OP_HEADER *new_ops;
103  size_t new_ops_len;
104 
105  /* Do nothing if a previous allocation has failed */
106  if ( ifr->failed )
107  return NULL;
108 
109  /* Reallocate opcodes */
110  new_ops_len = ( ifr->ops_len + len );
111  new_ops = realloc ( ifr->ops, new_ops_len );
112  if ( ! new_ops ) {
113  ifr->failed = 1;
114  return NULL;
115  }
116  op = ( ( ( void * ) new_ops ) + ifr->ops_len );
117  ifr->ops = new_ops;
118  ifr->ops_len = new_ops_len;
119 
120  /* Fill in opcode header */
121  memset ( op, 0, len );
122  op->OpCode = opcode;
123  op->Length = len;
124 
125  return op;
126 }
127 
128 /**
129  * Add end opcode to IFR builder
130  *
131  * @v ifr IFR builder
132  */
133 void efi_ifr_end_op ( struct efi_ifr_builder *ifr ) {
134  size_t dispaddr = ifr->ops_len;
135  EFI_IFR_END *end;
136 
137  /* Add opcode */
138  end = efi_ifr_op ( ifr, EFI_IFR_END_OP, sizeof ( *end ) );
139 
140  DBGC ( ifr, "IFR %p end\n", ifr );
141  DBGC2_HDA ( ifr, dispaddr, end, sizeof ( *end ) );
142 }
143 
144 /**
145  * Add false opcode to IFR builder
146  *
147  * @v ifr IFR builder
148  */
149 void efi_ifr_false_op ( struct efi_ifr_builder *ifr ) {
150  size_t dispaddr = ifr->ops_len;
151  EFI_IFR_FALSE *op;
152 
153  /* Add opcode */
154  op = efi_ifr_op ( ifr, EFI_IFR_FALSE_OP, sizeof ( *op ) );
155 
156  DBGC ( ifr, "IFR %p false\n", ifr );
157  DBGC2_HDA ( ifr, dispaddr, op, sizeof ( *op ) );
158 }
159 
160 /**
161  * Add form opcode to IFR builder
162  *
163  * @v ifr IFR builder
164  * @v title_id Title string identifier
165  * @ret form_id Form identifier
166  */
167 unsigned int efi_ifr_form_op ( struct efi_ifr_builder *ifr,
168  unsigned int title_id ) {
169  size_t dispaddr = ifr->ops_len;
171 
172  /* Add opcode */
173  form = efi_ifr_op ( ifr, EFI_IFR_FORM_OP, sizeof ( *form ) );
174  if ( ! form )
175  return 0;
176  form->Header.Scope = 1;
177  form->FormId = ++(ifr->form_id);
178  form->FormTitle = title_id;
179 
180  DBGC ( ifr, "IFR %p name/value store %#04x title %#04x\n",
181  ifr, form->FormId, title_id );
182  DBGC2_HDA ( ifr, dispaddr, form, sizeof ( *form ) );
183  return form->FormId;
184 }
185 
186 /**
187  * Add formset opcode to IFR builder
188  *
189  * @v ifr IFR builder
190  * @v guid GUID
191  * @v title_id Title string identifier
192  * @v help_id Help string identifier
193  * @v ... Class GUIDs (terminated by NULL)
194  */
196  unsigned int title_id, unsigned int help_id, ... ) {
197  size_t dispaddr = ifr->ops_len;
198  EFI_IFR_FORM_SET *formset;
199  EFI_GUID *class_guid;
200  unsigned int num_class_guids = 0;
201  size_t len;
202  va_list args;
203 
204  /* Count number of class GUIDs */
205  va_start ( args, help_id );
206  while ( va_arg ( args, const EFI_GUID * ) != NULL )
207  num_class_guids++;
208  va_end ( args );
209 
210  /* Add opcode */
211  len = ( sizeof ( *formset ) +
212  ( num_class_guids * sizeof ( *class_guid ) ) );
213  formset = efi_ifr_op ( ifr, EFI_IFR_FORM_SET_OP, len );
214  if ( ! formset )
215  return;
216  formset->Header.Scope = 1;
217  memcpy ( &formset->Guid, guid, sizeof ( formset->Guid ) );
218  formset->FormSetTitle = title_id;
219  formset->Help = help_id;
220  formset->Flags = num_class_guids;
221 
222  /* Add class GUIDs */
223  class_guid = ( ( ( void * ) formset ) + sizeof ( *formset ) );
224  va_start ( args, help_id );
225  while ( num_class_guids-- ) {
226  memcpy ( class_guid++, va_arg ( args, const EFI_GUID * ),
227  sizeof ( *class_guid ) );
228  }
229  va_end ( args );
230 
231  DBGC ( ifr, "IFR %p formset title %#04x help %#04x\n",
232  ifr, title_id, help_id );
233  DBGC2_HDA ( ifr, dispaddr, formset, len );
234 }
235 
236 /**
237  * Add get opcode to IFR builder
238  *
239  * @v ifr IFR builder
240  * @v varstore_id Variable store identifier
241  * @v varstore_info Variable string identifier or offset
242  * @v varstore_type Variable type
243  */
244 void efi_ifr_get_op ( struct efi_ifr_builder *ifr, unsigned int varstore_id,
245  unsigned int varstore_info, unsigned int varstore_type ) {
246  size_t dispaddr = ifr->ops_len;
247  EFI_IFR_GET *get;
248 
249  /* Add opcode */
250  get = efi_ifr_op ( ifr, EFI_IFR_GET_OP, sizeof ( *get ) );
251  get->VarStoreId = varstore_id;
252  get->VarStoreInfo.VarName = varstore_info;
253  get->VarStoreType = varstore_type;
254 
255  DBGC ( ifr, "IFR %p get varstore %#04x:%#04x type %#02x\n",
256  ifr, varstore_id, varstore_info, varstore_type );
257  DBGC2_HDA ( ifr, dispaddr, get, sizeof ( *get ) );
258 }
259 
260 /**
261  * Add GUID class opcode to IFR builder
262  *
263  * @v ifr IFR builder
264  * @v class Class
265  */
266 void efi_ifr_guid_class_op ( struct efi_ifr_builder *ifr, unsigned int class ) {
267  size_t dispaddr = ifr->ops_len;
268  EFI_IFR_GUID_CLASS *guid_class;
269 
270  /* Add opcode */
271  guid_class = efi_ifr_op ( ifr, EFI_IFR_GUID_OP,
272  sizeof ( *guid_class ) );
273  if ( ! guid_class )
274  return;
275  memcpy ( &guid_class->Guid, &tiano_guid, sizeof ( guid_class->Guid ) );
277  guid_class->Class = class;
278 
279  DBGC ( ifr, "IFR %p GUID class %#02x\n", ifr, class );
280  DBGC2_HDA ( ifr, dispaddr, guid_class, sizeof ( *guid_class ) );
281 }
282 
283 /**
284  * Add GUID subclass opcode to IFR builder
285  *
286  * @v ifr IFR builder
287  * @v subclass Subclass
288  */
290  unsigned int subclass ) {
291  size_t dispaddr = ifr->ops_len;
292  EFI_IFR_GUID_SUBCLASS *guid_subclass;
293 
294  /* Add opcode */
295  guid_subclass = efi_ifr_op ( ifr, EFI_IFR_GUID_OP,
296  sizeof ( *guid_subclass ) );
297  if ( ! guid_subclass )
298  return;
299  memcpy ( &guid_subclass->Guid, &tiano_guid,
300  sizeof ( guid_subclass->Guid ) );
301  guid_subclass->ExtendOpCode = EFI_IFR_EXTEND_OP_SUBCLASS;
302  guid_subclass->SubClass = subclass;
303 
304  DBGC ( ifr, "IFR %p GUID subclass %#02x\n", ifr, subclass );
305  DBGC2_HDA ( ifr, dispaddr, guid_subclass, sizeof ( *guid_subclass ) );
306 }
307 
308 /**
309  * Add numeric opcode to IFR builder
310  *
311  * @v ifr IFR builder
312  * @v prompt_id Prompt string identifier
313  * @v help_id Help string identifier
314  * @v question_id Question identifier
315  * @v varstore_id Variable store identifier
316  * @v varstore_info Variable string identifier or offset
317  * @v vflags Variable flags
318  * @v min_value Minimum value
319  * @v max_value Maximum value
320  * @v step Step
321  * @v flags Flags
322  */
323 void efi_ifr_numeric_op ( struct efi_ifr_builder *ifr, unsigned int prompt_id,
324  unsigned int help_id, unsigned int question_id,
325  unsigned int varstore_id, unsigned int varstore_info,
326  unsigned int vflags, unsigned long min_value,
327  unsigned long max_value, unsigned int step,
328  unsigned int flags ) {
329  size_t dispaddr = ifr->ops_len;
330  EFI_IFR_NUMERIC *numeric;
331  unsigned int size;
332 
333  /* Add opcode */
334  numeric = efi_ifr_op ( ifr, EFI_IFR_NUMERIC_OP, sizeof ( *numeric ) );
335  if ( ! numeric )
336  return;
337  numeric->Question.Header.Prompt = prompt_id;
338  numeric->Question.Header.Help = help_id;
339  numeric->Question.QuestionId = question_id;
340  numeric->Question.VarStoreId = varstore_id;
341  numeric->Question.VarStoreInfo.VarName = varstore_info;
342  numeric->Question.Flags = vflags;
344  switch ( size ) {
346  numeric->data.u8.MinValue = min_value;
347  numeric->data.u8.MaxValue = max_value;
348  numeric->data.u8.Step = step;
349  break;
351  numeric->data.u16.MinValue = min_value;
352  numeric->data.u16.MaxValue = max_value;
353  numeric->data.u16.Step = step;
354  break;
356  numeric->data.u32.MinValue = min_value;
357  numeric->data.u32.MaxValue = max_value;
358  numeric->data.u32.Step = step;
359  break;
361  numeric->data.u64.MinValue = min_value;
362  numeric->data.u64.MaxValue = max_value;
363  numeric->data.u64.Step = step;
364  break;
365  }
366 
367  DBGC ( ifr, "IFR %p numeric prompt %#04x help %#04x question %#04x "
368  "varstore %#04x:%#04x\n", ifr, prompt_id, help_id, question_id,
369  varstore_id, varstore_info );
370  DBGC2_HDA ( ifr, dispaddr, numeric, sizeof ( *numeric ) );
371 }
372 
373 /**
374  * Add string opcode to IFR builder
375  *
376  * @v ifr IFR builder
377  * @v prompt_id Prompt string identifier
378  * @v help_id Help string identifier
379  * @v question_id Question identifier
380  * @v varstore_id Variable store identifier
381  * @v varstore_info Variable string identifier or offset
382  * @v vflags Variable flags
383  * @v min_size Minimum size
384  * @v max_size Maximum size
385  * @v flags Flags
386  */
387 void efi_ifr_string_op ( struct efi_ifr_builder *ifr, unsigned int prompt_id,
388  unsigned int help_id, unsigned int question_id,
389  unsigned int varstore_id, unsigned int varstore_info,
390  unsigned int vflags, unsigned int min_size,
391  unsigned int max_size, unsigned int flags ) {
392  size_t dispaddr = ifr->ops_len;
394 
395  /* Add opcode */
396  string = efi_ifr_op ( ifr, EFI_IFR_STRING_OP, sizeof ( *string ) );
397  if ( ! string )
398  return;
399  string->Question.Header.Prompt = prompt_id;
400  string->Question.Header.Help = help_id;
401  string->Question.QuestionId = question_id;
402  string->Question.VarStoreId = varstore_id;
403  string->Question.VarStoreInfo.VarName = varstore_info;
404  string->Question.Flags = vflags;
405  string->MinSize = min_size;
406  string->MaxSize = max_size;
407  string->Flags = flags;
408 
409  DBGC ( ifr, "IFR %p string prompt %#04x help %#04x question %#04x "
410  "varstore %#04x:%#04x\n", ifr, prompt_id, help_id, question_id,
411  varstore_id, varstore_info );
412  DBGC2_HDA ( ifr, dispaddr, string, sizeof ( *string ) );
413 }
414 
415 /**
416  * Add suppress-if opcode to IFR builder
417  *
418  * @v ifr IFR builder
419  */
421  size_t dispaddr = ifr->ops_len;
422  EFI_IFR_SUPPRESS_IF *suppress_if;
423 
424  /* Add opcode */
425  suppress_if = efi_ifr_op ( ifr, EFI_IFR_SUPPRESS_IF_OP,
426  sizeof ( *suppress_if ) );
427  suppress_if->Header.Scope = 1;
428 
429  DBGC ( ifr, "IFR %p suppress-if\n", ifr );
430  DBGC2_HDA ( ifr, dispaddr, suppress_if, sizeof ( *suppress_if ) );
431 }
432 
433 /**
434  * Add text opcode to IFR builder
435  *
436  * @v ifr IFR builder
437  * @v prompt_id Prompt string identifier
438  * @v help_id Help string identifier
439  * @v text_id Text string identifier
440  */
441 void efi_ifr_text_op ( struct efi_ifr_builder *ifr, unsigned int prompt_id,
442  unsigned int help_id, unsigned int text_id ) {
443  size_t dispaddr = ifr->ops_len;
444  EFI_IFR_TEXT *text;
445 
446  /* Add opcode */
447  text = efi_ifr_op ( ifr, EFI_IFR_TEXT_OP, sizeof ( *text ) );
448  if ( ! text )
449  return;
450  text->Statement.Prompt = prompt_id;
451  text->Statement.Help = help_id;
452  text->TextTwo = text_id;
453 
454  DBGC ( ifr, "IFR %p text prompt %#04x help %#04x text %#04x\n",
455  ifr, prompt_id, help_id, text_id );
456  DBGC2_HDA ( ifr, dispaddr, text, sizeof ( *text ) );
457 }
458 
459 /**
460  * Add true opcode to IFR builder
461  *
462  * @v ifr IFR builder
463  */
464 void efi_ifr_true_op ( struct efi_ifr_builder *ifr ) {
465  size_t dispaddr = ifr->ops_len;
466  EFI_IFR_TRUE *op;
467 
468  /* Add opcode */
469  op = efi_ifr_op ( ifr, EFI_IFR_TRUE_OP, sizeof ( *op ) );
470 
471  DBGC ( ifr, "IFR %p true\n", ifr );
472  DBGC2_HDA ( ifr, dispaddr, op, sizeof ( *op ) );
473 }
474 
475 /**
476  * Add name/value store opcode to IFR builder
477  *
478  * @v ifr IFR builder
479  * @v guid GUID
480  * @ret varstore_id Variable store identifier, or 0 on failure
481  */
483  const EFI_GUID *guid ) {
484  size_t dispaddr = ifr->ops_len;
485  EFI_IFR_VARSTORE_NAME_VALUE *varstore;
486 
487  /* Add opcode */
488  varstore = efi_ifr_op ( ifr, EFI_IFR_VARSTORE_NAME_VALUE_OP,
489  sizeof ( *varstore ) );
490  if ( ! varstore )
491  return 0;
492  varstore->VarStoreId = ++(ifr->varstore_id);
493  memcpy ( &varstore->Guid, guid, sizeof ( varstore->Guid ) );
494 
495  DBGC ( ifr, "IFR %p name/value store %#04x\n",
496  ifr, varstore->VarStoreId );
497  DBGC2_HDA ( ifr, dispaddr, varstore, sizeof ( *varstore ) );
498  return varstore->VarStoreId;
499 }
500 
501 /**
502  * Free memory used by IFR builder
503  *
504  * @v ifr IFR builder
505  */
506 void efi_ifr_free ( struct efi_ifr_builder *ifr ) {
507 
508  free ( ifr->ops );
509  free ( ifr->strings );
510  memset ( ifr, 0, sizeof ( *ifr ) );
511 }
512 
513 /**
514  * Construct package list from IFR builder
515  *
516  * @v ifr IFR builder
517  * @v guid Package GUID
518  * @v language Language
519  * @v language_id Language string ID
520  * @ret package Package list, or NULL
521  *
522  * The package list is allocated using malloc(), and must eventually
523  * be freed by the caller. (The caller must also call efi_ifr_free()
524  * to free the temporary storage used during construction.)
525  */
527  const EFI_GUID *guid,
528  const char *language,
529  unsigned int language_id ) {
530  struct {
532  struct {
534  uint8_t data[ifr->ops_len];
535  } __attribute__ (( packed )) ops;
536  struct {
537  union {
540  Language) +
541  strlen ( language ) + 1 /* NUL */ ];
542  } __attribute__ (( packed )) header;
543  uint8_t data[ifr->strings_len];
545  } __attribute__ (( packed )) strings;
547  } __attribute__ (( packed )) *package;
548 
549  /* Fail if any previous allocation failed */
550  if ( ifr->failed )
551  return NULL;
552 
553  /* Allocate package list */
554  package = zalloc ( sizeof ( *package ) );
555  if ( ! package )
556  return NULL;
557 
558  /* Populate package list */
559  package->header.PackageLength = sizeof ( *package );
560  memcpy ( &package->header.PackageListGuid, guid,
561  sizeof ( package->header.PackageListGuid ) );
562  package->ops.header.Length = sizeof ( package->ops );
563  package->ops.header.Type = EFI_HII_PACKAGE_FORMS;
564  memcpy ( package->ops.data, ifr->ops, sizeof ( package->ops.data ) );
565  package->strings.header.header.Header.Length =
566  sizeof ( package->strings );
567  package->strings.header.header.Header.Type =
569  package->strings.header.header.HdrSize =
570  sizeof ( package->strings.header );
571  package->strings.header.header.StringInfoOffset =
572  sizeof ( package->strings.header );
573  package->strings.header.header.LanguageName = language_id;
574  strcpy ( package->strings.header.header.Language, language );
575  memcpy ( package->strings.data, ifr->strings,
576  sizeof ( package->strings.data ) );
577  package->strings.end.BlockType = EFI_HII_SIBT_END;
578  package->end.Type = EFI_HII_PACKAGE_END;
579  package->end.Length = sizeof ( package->end );
580 
581  return &package->header;
582 }
583 
#define EFI_IFR_NUMERIC_SIZE_8
EFI human interface infrastructure.
UINT16 SubClass
Sub Class type from the above.
Definition: MdeModuleHii.h:141
#define EFI_IFR_NUMERIC_OP
#define __attribute__(x)
Definition: compiler.h:10
void efi_ifr_true_op(struct efi_ifr_builder *ifr)
Add true opcode to IFR builder.
Definition: efi_hii.c:464
#define EFI_IFR_NUMERIC_SIZE_4
#define EFI_IFR_FALSE_OP
void efi_ifr_form_set_op(struct efi_ifr_builder *ifr, const EFI_GUID *guid, unsigned int title_id, unsigned int help_id,...)
Add formset opcode to IFR builder.
Definition: efi_hii.c:195
#define va_end(ap)
Definition: stdarg.h:10
#define EFI_IFR_END_OP
void efi_ifr_end_op(struct efi_ifr_builder *ifr)
Add end opcode to IFR builder.
Definition: efi_hii.c:133
static const EFI_GUID tiano_guid
Tiano GUID.
Definition: efi_hii.c:36
unsigned int efi_ifr_varstore_name_value_op(struct efi_ifr_builder *ifr, const EFI_GUID *guid)
Add name/value store opcode to IFR builder.
Definition: efi_hii.c:482
uint8_t opcode
Opcode.
Definition: ena.h:16
#define EFI_IFR_STRING_OP
128 bit buffer containing a unique identifier value.
Definition: Base.h:216
#define EFI_HII_SIBT_END
int efi_vsnprintf(wchar_t *wbuf, size_t wsize, const char *fmt, va_list args)
Write a formatted string to a wide-character buffer.
Definition: efi_strings.c:75
EFI strings.
UINT8 ExtendOpCode
EFI_IFR_EXTEND_OP_SUBCLASS.
Definition: MdeModuleHii.h:140
uint16_t size
Buffer size.
Definition: dwmac.h:14
#define DBGC(...)
Definition: compiler.h:505
UINT16 Class
Device Class from the above.
Definition: MdeModuleHii.h:120
EFI_STRING_ID VarName
A 16-bit Buffer Storage offset.
uint32_t string
Definition: multiboot.h:14
void efi_ifr_suppress_if_op(struct efi_ifr_builder *ifr)
Add suppress-if opcode to IFR builder.
Definition: efi_hii.c:420
UINT8 ExtendOpCode
EFI_IFR_EXTEND_OP_CLASS.
Definition: MdeModuleHii.h:119
u32 pad[9]
Padding.
Definition: ar9003_mac.h:47
#define offsetof(type, field)
Get offset of a field within a structure.
Definition: stddef.h:25
EFI_GUID Guid
EFI_IFR_TIANO_GUID.
Definition: MdeModuleHii.h:115
EFI_HII_PACKAGE_LIST_HEADER * efi_ifr_package(struct efi_ifr_builder *ifr, const EFI_GUID *guid, const char *language, unsigned int language_id)
Construct package list from IFR builder.
Definition: efi_hii.c:526
FILE_SECBOOT(PERMITTED)
#define EFI_IFR_TRUE_OP
void efi_ifr_false_op(struct efi_ifr_builder *ifr)
Add false opcode to IFR builder.
Definition: efi_hii.c:149
EFI_HII_STRING_BLOCK * strings
Strings.
Definition: efi_hii.h:28
static void * efi_ifr_op(struct efi_ifr_builder *ifr, unsigned int opcode, size_t len)
Add IFR opcode to IFR builder.
Definition: efi_hii.c:99
void efi_ifr_string_op(struct efi_ifr_builder *ifr, unsigned int prompt_id, unsigned int help_id, unsigned int question_id, unsigned int varstore_id, unsigned int varstore_info, unsigned int vflags, unsigned int min_size, unsigned int max_size, unsigned int flags)
Add string opcode to IFR builder.
Definition: efi_hii.c:387
#define EFI_IFR_FORM_SET_OP
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define va_arg(ap, type)
Definition: stdarg.h:9
A form.
Definition: form_ui.c:65
Device Class opcode.
Definition: MdeModuleHii.h:110
#define EFI_IFR_EXTEND_OP_SUBCLASS
Definition: MdeModuleHii.h:40
struct MINMAXSTEP_DATA::@596 u16
EFI_IFR_QUESTION_HEADER Question
#define EFI_HII_PACKAGE_FORMS
void efi_ifr_guid_subclass_op(struct efi_ifr_builder *ifr, unsigned int subclass)
Add GUID subclass opcode to IFR builder.
Definition: efi_hii.c:289
ring len
Length.
Definition: dwmac.h:231
#define EFI_IFR_SUPPRESS_IF_OP
#define EFI_HII_PACKAGE_STRINGS
char * strcpy(char *dest, const char *src)
Copy string.
Definition: string.c:347
void efi_ifr_text_op(struct efi_ifr_builder *ifr, unsigned int prompt_id, unsigned int help_id, unsigned int text_id)
Add text opcode to IFR builder.
Definition: efi_hii.c:441
void efi_ifr_get_op(struct efi_ifr_builder *ifr, unsigned int varstore_id, unsigned int varstore_info, unsigned int varstore_type)
Add get opcode to IFR builder.
Definition: efi_hii.c:244
unsigned int efi_ifr_form_op(struct efi_ifr_builder *ifr, unsigned int title_id)
Add form opcode to IFR builder.
Definition: efi_hii.c:167
The fixed header consists of a standard record header and then the string identifiers contained in th...
#define EFI_HII_PACKAGE_END
#define EFI_IFR_NUMERIC_SIZE_2
unsigned int varstore_id
Current variable store identifier.
Definition: efi_hii.h:34
unsigned int string_id
Current string identifier.
Definition: efi_hii.h:32
#define DBGC2_HDA(...)
Definition: compiler.h:523
size_t strings_len
Length of strings.
Definition: efi_hii.h:30
uint8_t flags
Flags.
Definition: ena.h:18
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:55
EFI_IFR_STATEMENT_HEADER Statement
size_t ops_len
Length of IFR opcodes.
Definition: efi_hii.h:26
SubClass opcode.
Definition: MdeModuleHii.h:131
#define EFI_IFR_GUID_OP
size_t strlen(const char *src)
Get length of string.
Definition: string.c:244
unsigned char uint8_t
Definition: stdint.h:10
int failed
An allocation has failed.
Definition: efi_hii.h:38
#define EFI_IFR_VARSTORE_NAME_VALUE_OP
#define EFI_IFR_EXTEND_OP_CLASS
Definition: MdeModuleHii.h:39
EFI_IFR_OP_HEADER * ops
IFR opcodes.
Definition: efi_hii.h:24
#define EFI_IFR_TIANO_GUID
GUIDed opcodes defined for EDKII implementation.
Definition: MdeModuleHii.h:28
void efi_ifr_free(struct efi_ifr_builder *ifr)
Free memory used by IFR builder.
Definition: efi_hii.c:506
void efi_ifr_guid_class_op(struct efi_ifr_builder *ifr, unsigned int class)
Add GUID class opcode to IFR builder.
Definition: efi_hii.c:266
EFI API.
uint64_t guid
GUID.
Definition: edd.h:31
union _EFI_IFR_QUESTION_HEADER::@594 VarStoreInfo
static uint16_t struct vmbus_xfer_pages_operations * op
Definition: netvsc.h:327
#define EFI_IFR_NUMERIC_SIZE
__builtin_va_list va_list
Definition: stdarg.h:7
UINT8 VarStoreType
Specifies the type used for storage.
unsigned int efi_ifr_string(struct efi_ifr_builder *ifr, const char *fmt,...)
Add string to IFR builder.
Definition: efi_hii.c:46
#define EFI_IFR_NUMERIC_SIZE_1
The header found at the start of each package.
#define EFI_HII_SIBT_STRING_UCS2
void step(void)
Single-step a single process.
Definition: process.c:99
union _EFI_IFR_GET::@600 VarStoreInfo
struct ena_llq_option header
Header locations.
Definition: ena.h:16
unsigned int form_id
Current form identifier.
Definition: efi_hii.h:36
uint32_t end
Ending offset.
Definition: netvsc.h:18
struct MINMAXSTEP_DATA::@597 u32
uint8_t data[48]
Additional event data.
Definition: ena.h:22
int ssize_t const char * fmt
Definition: vsprintf.h:73
void * realloc(void *old_ptr, size_t new_size)
Reallocate memory.
Definition: malloc.c:607
#define EFI_IFR_TEXT_OP
struct MINMAXSTEP_DATA::@598 u64
An EFI IFR builder.
Definition: efi_hii.h:22
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition: acpi.c:48
#define va_start(ap, last)
Definition: stdarg.h:8
void efi_ifr_numeric_op(struct efi_ifr_builder *ifr, unsigned int prompt_id, unsigned int help_id, unsigned int question_id, unsigned int varstore_id, unsigned int varstore_info, unsigned int vflags, unsigned long min_value, unsigned long max_value, unsigned int step, unsigned int flags)
Add numeric opcode to IFR builder.
Definition: efi_hii.c:323
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define EFI_IFR_FORM_OP
EFI_VARSTORE_ID VarStoreId
Specifies the identifier of a previously declared variable store to use when retrieving the value.
The header found at the start of each package list.
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
String functions.
struct MINMAXSTEP_DATA::@595 u8
EFI_GUID Guid
EFI_IFR_TIANO_GUID.
Definition: MdeModuleHii.h:136
#define EFI_IFR_GET_OP
void * memset(void *dest, int character, size_t len) __nonnull