iPXE
HiiDatabase.h
Go to the documentation of this file.
1 /** @file
2  The file provides Database manager for HII-related data
3  structures.
4 
5 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7 
8  @par Revision Reference:
9  This Protocol was introduced in UEFI Specification 2.1.
10 
11 **/
12 
13 #ifndef __HII_DATABASE_H__
14 #define __HII_DATABASE_H__
15 
16 FILE_LICENCE ( BSD2_PATENT );
17 
18 #define EFI_HII_DATABASE_PROTOCOL_GUID \
19  { 0xef9fc172, 0xa1b2, 0x4693, { 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 } }
20 
22 
23 ///
24 /// EFI_HII_DATABASE_NOTIFY_TYPE.
25 ///
27 
28 #define EFI_HII_DATABASE_NOTIFY_NEW_PACK 0x00000001
29 #define EFI_HII_DATABASE_NOTIFY_REMOVE_PACK 0x00000002
30 #define EFI_HII_DATABASE_NOTIFY_EXPORT_PACK 0x00000004
31 #define EFI_HII_DATABASE_NOTIFY_ADD_PACK 0x00000008
32 
33 /**
34 
35  Functions which are registered to receive notification of
36  database events have this prototype. The actual event is encoded
37  in NotifyType. The following table describes how PackageType,
38  PackageGuid, Handle, and Package are used for each of the
39  notification types.
40 
41  @param PackageType Package type of the notification.
42 
43  @param PackageGuid If PackageType is
44  EFI_HII_PACKAGE_TYPE_GUID, then this is
45  the pointer to the GUID from the Guid
46  field of EFI_HII_PACKAGE_GUID_HEADER.
47  Otherwise, it must be NULL.
48 
49  @param Package Points to the package referred to by the notification.
50 
51  @param Handle The handle of the package
52  list which contains the specified package.
53 
54  @param NotifyType The type of change concerning the
55  database. See
56  EFI_HII_DATABASE_NOTIFY_TYPE.
57 
58 **/
59 typedef
62  IN UINT8 PackageType,
63  IN CONST EFI_GUID *PackageGuid,
65  IN EFI_HII_HANDLE Handle,
67  );
68 
69 /**
70 
71  This function adds the packages in the package list to the
72  database and returns a handle. If there is a
73  EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then
74  this function will create a package of type
75  EFI_PACKAGE_TYPE_DEVICE_PATH and add it to the package list. For
76  each package in the package list, registered functions with the
77  notification type NEW_PACK and having the same package type will
78  be called. For each call to NewPackageList(), there should be a
79  corresponding call to
80  EFI_HII_DATABASE_PROTOCOL.RemovePackageList().
81 
82  @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
83 
84  @param PackageList A pointer to an EFI_HII_PACKAGE_LIST_HEADER structure.
85 
86  @param DriverHandle Associate the package list with this EFI handle.
87  If a NULL is specified, this data will not be associate
88  with any drivers and cannot have a callback induced.
89 
90  @param Handle A pointer to the EFI_HII_HANDLE instance.
91 
92  @retval EFI_SUCCESS The package list associated with the
93  Handle was added to the HII database.
94 
95  @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
96  resources for the new database
97  contents.
98 
99  @retval EFI_INVALID_PARAMETER PackageList is NULL, or Handle is NULL.
100 
101 **/
102 typedef
106  IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList,
107  IN EFI_HANDLE DriverHandle OPTIONAL,
108  OUT EFI_HII_HANDLE *Handle
109  );
110 
111 /**
112 
113  This function removes the package list that is associated with a
114  handle Handle from the HII database. Before removing the
115  package, any registered functions with the notification type
116  REMOVE_PACK and the same package type will be called. For each
117  call to EFI_HII_DATABASE_PROTOCOL.NewPackageList(), there should
118  be a corresponding call to RemovePackageList.
119 
120  @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
121 
122  @param Handle The handle that was registered to the data
123  that is requested for removal.
124 
125  @retval EFI_SUCCESS The data associated with the Handle was
126  removed from the HII database.
127  @retval EFI_NOT_FOUND The specified Handle is not in database.
128 
129 **/
130 typedef
134  IN EFI_HII_HANDLE Handle
135  );
136 
137 /**
138 
139  This function updates the existing package list (which has the
140  specified Handle) in the HII databases, using the new package
141  list specified by PackageList. The update process has the
142  following steps: Collect all the package types in the package
143  list specified by PackageList. A package type consists of the
144  Type field of EFI_HII_PACKAGE_HEADER and, if the Type is
145  EFI_HII_PACKAGE_TYPE_GUID, the Guid field, as defined in
146  EFI_HII_PACKAGE_GUID_HEADER. Iterate through the packages within
147  the existing package list in the HII database specified by
148  Handle. If a package's type matches one of the collected types collected
149  in step 1, then perform the following steps:
150  - Call any functions registered with the notification type
151  REMOVE_PACK.
152  - Remove the package from the package list and the HII
153  database.
154  Add all of the packages within the new package list specified
155  by PackageList, using the following steps:
156  - Add the package to the package list and the HII database.
157  - Call any functions registered with the notification type
158  ADD_PACK.
159 
160  @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
161 
162  @param Handle The handle that was registered to the data
163  that is requested for removal.
164 
165  @param PackageList A pointer to an EFI_HII_PACKAGE_LIST
166  package.
167 
168  @retval EFI_SUCCESS The HII database was successfully updated.
169 
170  @retval EFI_OUT_OF_RESOURCES Unable to allocate enough memory
171  for the updated database.
172 
173  @retval EFI_INVALID_PARAMETER PackageList was NULL.
174  @retval EFI_NOT_FOUND The specified Handle is not in database.
175 
176 **/
177 typedef
181  IN EFI_HII_HANDLE Handle,
183  );
184 
185 /**
186 
187  This function returns a list of the package handles of the
188  specified type that are currently active in the database. The
189  pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package
190  handles to be listed.
191 
192  @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
193 
194  @param PackageType Specifies the package type of the packages
195  to list or EFI_HII_PACKAGE_TYPE_ALL for
196  all packages to be listed.
197 
198  @param PackageGuid If PackageType is
199  EFI_HII_PACKAGE_TYPE_GUID, then this is
200  the pointer to the GUID which must match
201  the Guid field of
202  EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
203  must be NULL.
204 
205  @param HandleBufferLength On input, a pointer to the length
206  of the handle buffer. On output,
207  the length of the handle buffer
208  that is required for the handles found.
209 
210  @param Handle An array of EFI_HII_HANDLE instances returned.
211 
212  @retval EFI_SUCCESS The matching handles are outputted successfully.
213  HandleBufferLength is updated with the actual length.
214  @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter
215  indicates that Handle is too
216  small to support the number of
217  handles. HandleBufferLength is
218  updated with a value that will
219  enable the data to fit.
220  @retval EFI_NOT_FOUND No matching handle could be found in database.
221  @retval EFI_INVALID_PARAMETER HandleBufferLength was NULL.
222  @retval EFI_INVALID_PARAMETER The value referenced by HandleBufferLength was not
223  zero and Handle was NULL.
224  @retval EFI_INVALID_PARAMETER PackageType is not a EFI_HII_PACKAGE_TYPE_GUID but
225  PackageGuid is not NULL, PackageType is a EFI_HII_
226  PACKAGE_TYPE_GUID but PackageGuid is NULL.
227 **/
228 typedef
232  IN UINT8 PackageType,
233  IN CONST EFI_GUID *PackageGuid,
234  IN OUT UINTN *HandleBufferLength,
235  OUT EFI_HII_HANDLE *Handle
236  );
237 
238 /**
239 
240  This function will export one or all package lists in the
241  database to a buffer. For each package list exported, this
242  function will call functions registered with EXPORT_PACK and
243  then copy the package list to the buffer. The registered
244  functions may call EFI_HII_DATABASE_PROTOCOL.UpdatePackageList()
245  to modify the package list before it is copied to the buffer. If
246  the specified BufferSize is too small, then the status
247  EFI_OUT_OF_RESOURCES will be returned and the actual package
248  size will be returned in BufferSize.
249 
250  @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
251 
252 
253  @param Handle An EFI_HII_HANDLE that corresponds to the
254  desired package list in the HII database to
255  export or NULL to indicate all package lists
256  should be exported.
257 
258  @param BufferSize On input, a pointer to the length of the
259  buffer. On output, the length of the
260  buffer that is required for the exported
261  data.
262 
263  @param Buffer A pointer to a buffer that will contain the
264  results of the export function.
265 
266 
267  @retval EFI_SUCCESS Package exported.
268 
269  @retval EFI_OUT_OF_RESOURCES BufferSize is too small to hold the package.
270 
271  @retval EFI_NOT_FOUND The specified Handle could not be found in the
272  current database.
273 
274  @retval EFI_INVALID_PARAMETER BufferSize was NULL.
275 
276  @retval EFI_INVALID_PARAMETER The value referenced by BufferSize was not zero
277  and Buffer was NULL.
278 **/
279 typedef
283  IN EFI_HII_HANDLE Handle,
286  );
287 
288 /**
289 
290 
291  This function registers a function which will be called when
292  specified actions related to packages of the specified type
293  occur in the HII database. By registering a function, other
294  HII-related drivers are notified when specific package types
295  are added, removed or updated in the HII database. Each driver
296  or application which registers a notification should use
297  EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify() before
298  exiting.
299 
300 
301  @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
302 
303  @param PackageType The package type. See
304  EFI_HII_PACKAGE_TYPE_x in EFI_HII_PACKAGE_HEADER.
305 
306  @param PackageGuid If PackageType is
307  EFI_HII_PACKAGE_TYPE_GUID, then this is
308  the pointer to the GUID which must match
309  the Guid field of
310  EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
311  must be NULL.
312 
313  @param PackageNotifyFn Points to the function to be called
314  when the event specified by
315  NotificationType occurs. See
316  EFI_HII_DATABASE_NOTIFY.
317 
318  @param NotifyType Describes the types of notification which
319  this function will be receiving. See
320  EFI_HII_DATABASE_NOTIFY_TYPE for a
321  list of types.
322 
323  @param NotifyHandle Points to the unique handle assigned to
324  the registered notification. Can be used
325  in EFI_HII_DATABASE_PROTOCOL.UnregisterPack
326  to stop notifications.
327 
328 
329  @retval EFI_SUCCESS Notification registered successfully.
330 
331  @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
332  data structures.
333 
334  @retval EFI_INVALID_PARAMETER PackageGuid is not NULL when
335  PackageType is not
336  EFI_HII_PACKAGE_TYPE_GUID.
337 
338 **/
339 typedef
343  IN UINT8 PackageType,
344  IN CONST EFI_GUID *PackageGuid,
345  IN EFI_HII_DATABASE_NOTIFY PackageNotifyFn,
346  IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType,
347  OUT EFI_HANDLE *NotifyHandle
348  );
349 
350 /**
351 
352  Removes the specified HII database package-related notification.
353 
354  @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
355 
356  @param NotificationHandle The handle of the notification
357  function being unregistered.
358 
359  @retval EFI_SUCCESS Successsfully unregistered the notification.
360 
361  @retval EFI_NOT_FOUND The incoming notification handle does not exist
362  in the current hii database.
363 
364 **/
365 typedef
369  IN EFI_HANDLE NotificationHandle
370  );
371 
372 /**
373 
374  This routine retrieves an array of GUID values for each keyboard
375  layout that was previously registered in the system.
376 
377  @param This A pointer to the EFI_HII_PROTOCOL instance.
378 
379  @param KeyGuidBufferLength On input, a pointer to the length
380  of the keyboard GUID buffer. On
381  output, the length of the handle
382  buffer that is required for the
383  handles found.
384 
385  @param KeyGuidBuffer An array of keyboard layout GUID
386  instances returned.
387 
388  @retval EFI_SUCCESS KeyGuidBuffer was updated successfully.
389 
390  @retval EFI_BUFFER_TOO_SMALL The KeyGuidBufferLength
391  parameter indicates that
392  KeyGuidBuffer is too small to
393  support the number of GUIDs.
394  KeyGuidBufferLength is updated
395  with a value that will enable
396  the data to fit.
397  @retval EFI_INVALID_PARAMETER The KeyGuidBufferLength is NULL.
398  @retval EFI_INVALID_PARAMETER The value referenced by
399  KeyGuidBufferLength is not
400  zero and KeyGuidBuffer is NULL.
401  @retval EFI_NOT_FOUND There was no keyboard layout.
402 
403 **/
404 typedef
408  IN OUT UINT16 *KeyGuidBufferLength,
409  OUT EFI_GUID *KeyGuidBuffer
410  );
411 
412 /**
413 
414  This routine retrieves the requested keyboard layout. The layout
415  is a physical description of the keys on a keyboard, and the
416  character(s) that are associated with a particular set of key
417  strokes.
418 
419  @param This A pointer to the EFI_HII_PROTOCOL instance.
420 
421  @param KeyGuid A pointer to the unique ID associated with a
422  given keyboard layout. If KeyGuid is NULL then
423  the current layout will be retrieved.
424 
425  @param KeyboardLayoutLength On input, a pointer to the length of the
426  KeyboardLayout buffer. On output, the length of
427  the data placed into KeyboardLayout.
428 
429  @param KeyboardLayout A pointer to a buffer containing the
430  retrieved keyboard layout.
431 
432  @retval EFI_SUCCESS The keyboard layout was retrieved
433  successfully.
434 
435  @retval EFI_NOT_FOUND The requested keyboard layout was not found.
436 
437 **/
438 typedef
442  IN CONST EFI_GUID *KeyGuid,
443  IN OUT UINT16 *KeyboardLayoutLength,
444  OUT EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout
445  );
446 
447 /**
448 
449  This routine sets the default keyboard layout to the one
450  referenced by KeyGuid. When this routine is called, an event
451  will be signaled of the EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID
452  group type. This is so that agents which are sensitive to the
453  current keyboard layout being changed can be notified of this
454  change.
455 
456  @param This A pointer to the EFI_HII_PROTOCOL instance.
457 
458  @param KeyGuid A pointer to the unique ID associated with a
459  given keyboard layout.
460 
461  @retval EFI_SUCCESS The current keyboard layout was successfully set.
462 
463  @retval EFI_NOT_FOUND The referenced keyboard layout was not
464  found, so action was taken.
465 
466 **/
467 typedef
471  IN CONST EFI_GUID *KeyGuid
472  );
473 
474 /**
475 
476  Return the EFI handle associated with a package list.
477 
478  @param This A pointer to the EFI_HII_PROTOCOL instance.
479 
480  @param PackageListHandle An EFI_HII_HANDLE that corresponds
481  to the desired package list in the
482  HIIdatabase.
483 
484  @param DriverHandle On return, contains the EFI_HANDLE which
485  was registered with the package list in
486  NewPackageList().
487 
488  @retval EFI_SUCCESS The DriverHandle was returned successfully.
489 
490  @retval EFI_INVALID_PARAMETER The PackageListHandle was not valid.
491 
492 **/
493 typedef
497  IN EFI_HII_HANDLE PackageListHandle,
498  OUT EFI_HANDLE *DriverHandle
499  );
500 
501 ///
502 /// Database manager for HII-related data structures.
503 ///
516 };
517 
519 
520 #endif
UINTN EFI_HII_DATABASE_NOTIFY_TYPE
EFI_HII_DATABASE_NOTIFY_TYPE.
Definition: HiiDatabase.h:26
#define OPTIONAL
Passing the datum to the function is optional, and a NULL is passed if the value is not supplied.
Definition: Base.h:292
EFI_GUID gEfiHiiDatabaseProtocolGuid
EFI_STATUS(EFIAPI * EFI_HII_DATABASE_UPDATE_PACK)(IN CONST EFI_HII_DATABASE_PROTOCOL *This, IN EFI_HII_HANDLE Handle, IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList)
This function updates the existing package list (which has the specified Handle) in the HII databases...
Definition: HiiDatabase.h:179
EFI_HII_DATABASE_UPDATE_PACK UpdatePackageList
Definition: HiiDatabase.h:507
EFI_STATUS(EFIAPI * EFI_HII_DATABASE_NEW_PACK)(IN CONST EFI_HII_DATABASE_PROTOCOL *This, IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList, IN EFI_HANDLE DriverHandle OPTIONAL, OUT EFI_HII_HANDLE *Handle)
This function adds the packages in the package list to the database and returns a handle.
Definition: HiiDatabase.h:104
128 bit buffer containing a unique identifier value.
Definition: Base.h:215
EFI_HII_SET_KEYBOARD_LAYOUT SetKeyboardLayout
Definition: HiiDatabase.h:514
EFI_HII_DATABASE_REMOVE_PACK RemovePackageList
Definition: HiiDatabase.h:506
EFI_HII_DATABASE_GET_PACK_HANDLE GetPackageListHandle
Definition: HiiDatabase.h:515
EFI_STATUS(EFIAPI * EFI_HII_DATABASE_REMOVE_PACK)(IN CONST EFI_HII_DATABASE_PROTOCOL *This, IN EFI_HII_HANDLE Handle)
This function removes the package list that is associated with a handle Handle from the HII database.
Definition: HiiDatabase.h:132
FILE_LICENCE(BSD2_PATENT)
UINT16_t BufferSize
Buffer size.
Definition: pxe_api.h:64
EFI_STATUS(EFIAPI * EFI_HII_FIND_KEYBOARD_LAYOUTS)(IN CONST EFI_HII_DATABASE_PROTOCOL *This, IN OUT UINT16 *KeyGuidBufferLength, OUT EFI_GUID *KeyGuidBuffer)
This routine retrieves an array of GUID values for each keyboard layout that was previously registere...
Definition: HiiDatabase.h:406
unsigned char UINT8
EFI_HII_GET_KEYBOARD_LAYOUT GetKeyboardLayout
Definition: HiiDatabase.h:513
Database manager for HII-related data structures.
Definition: HiiDatabase.h:504
#define OUT
Definition: mlx_utils.h:29
EFI_HII_DATABASE_REGISTER_NOTIFY RegisterPackageNotify
Definition: HiiDatabase.h:510
EFI_STATUS(EFIAPI * EFI_HII_DATABASE_LIST_PACKS)(IN CONST EFI_HII_DATABASE_PROTOCOL *This, IN UINT8 PackageType, IN CONST EFI_GUID *PackageGuid, IN OUT UINTN *HandleBufferLength, OUT EFI_HII_HANDLE *Handle)
This function returns a list of the package handles of the specified type that are currently active i...
Definition: HiiDatabase.h:230
unsigned short UINT16
EFI_STATUS(EFIAPI * EFI_HII_DATABASE_EXPORT_PACKS)(IN CONST EFI_HII_DATABASE_PROTOCOL *This, IN EFI_HII_HANDLE Handle, IN OUT UINTN *BufferSize, OUT EFI_HII_PACKAGE_LIST_HEADER *Buffer)
This function will export one or all package lists in the database to a buffer.
Definition: HiiDatabase.h:281
#define EFIAPI
EFI_HII_DATABASE_UNREGISTER_NOTIFY UnregisterPackageNotify
Definition: HiiDatabase.h:511
SEGOFF16_t Buffer
Buffer address.
Definition: pxe_api.h:65
UINT64 UINTN
Unsigned value of native width.
#define IN
Definition: mlx_utils.h:28
EFI_STATUS(EFIAPI * EFI_HII_DATABASE_REGISTER_NOTIFY)(IN CONST EFI_HII_DATABASE_PROTOCOL *This, IN UINT8 PackageType, IN CONST EFI_GUID *PackageGuid, IN EFI_HII_DATABASE_NOTIFY PackageNotifyFn, IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType, OUT EFI_HANDLE *NotifyHandle)
This function registers a function which will be called when specified actions related to packages of...
Definition: HiiDatabase.h:341
EFI_STATUS(EFIAPI * EFI_HII_DATABASE_GET_PACK_HANDLE)(IN CONST EFI_HII_DATABASE_PROTOCOL *This, IN EFI_HII_HANDLE PackageListHandle, OUT EFI_HANDLE *DriverHandle)
Return the EFI handle associated with a package list.
Definition: HiiDatabase.h:495
#define CONST
Datum is read-only.
Definition: Base.h:261
The header found at the start of each package.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_STATUS(EFIAPI * EFI_HII_DATABASE_UNREGISTER_NOTIFY)(IN CONST EFI_HII_DATABASE_PROTOCOL *This, IN EFI_HANDLE NotificationHandle)
Removes the specified HII database package-related notification.
Definition: HiiDatabase.h:367
EFI_HII_FIND_KEYBOARD_LAYOUTS FindKeyboardLayouts
Definition: HiiDatabase.h:512
EFI_HII_DATABASE_NEW_PACK NewPackageList
Definition: HiiDatabase.h:505
EFI_HII_DATABASE_LIST_PACKS ListPackageLists
Definition: HiiDatabase.h:508
EFI_STATUS(EFIAPI * EFI_HII_GET_KEYBOARD_LAYOUT)(IN CONST EFI_HII_DATABASE_PROTOCOL *This, IN CONST EFI_GUID *KeyGuid, IN OUT UINT16 *KeyboardLayoutLength, OUT EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout)
This routine retrieves the requested keyboard layout.
Definition: HiiDatabase.h:440
EFI_HII_DATABASE_EXPORT_PACKS ExportPackageLists
Definition: HiiDatabase.h:509
The header found at the start of each package list.
EFI_STATUS(EFIAPI * EFI_HII_SET_KEYBOARD_LAYOUT)(IN CONST EFI_HII_DATABASE_PROTOCOL *This, IN CONST EFI_GUID *KeyGuid)
This routine sets the default keyboard layout to the one referenced by KeyGuid.
Definition: HiiDatabase.h:469
Definition: efi.h:59
VOID * EFI_HII_HANDLE
The following types are currently defined:
EFI_STATUS(EFIAPI * EFI_HII_DATABASE_NOTIFY)(IN UINT8 PackageType, IN CONST EFI_GUID *PackageGuid, IN CONST EFI_HII_PACKAGE_HEADER *Package, IN EFI_HII_HANDLE Handle, IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType)
Functions which are registered to receive notification of database events have this prototype.
Definition: HiiDatabase.h:61