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