You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HiiDatabase.h 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. /** @file
  2. The file provides Database manager for HII-related data
  3. structures.
  4. Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
  5. This program and the accompanying materials are licensed and made available under
  6. the terms and conditions of the BSD License that accompanies this distribution.
  7. The full text of the license may be found at
  8. http://opensource.org/licenses/bsd-license.php.
  9. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  11. **/
  12. #ifndef __HII_DATABASE_H__
  13. #define __HII_DATABASE_H__
  14. FILE_LICENCE ( BSD3 );
  15. #define EFI_HII_DATABASE_PROTOCOL_GUID \
  16. { 0xef9fc172, 0xa1b2, 0x4693, { 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 } }
  17. typedef struct _EFI_HII_DATABASE_PROTOCOL EFI_HII_DATABASE_PROTOCOL;
  18. ///
  19. /// EFI_HII_DATABASE_NOTIFY_TYPE.
  20. ///
  21. typedef UINTN EFI_HII_DATABASE_NOTIFY_TYPE;
  22. #define EFI_HII_DATABASE_NOTIFY_NEW_PACK 0x00000001
  23. #define EFI_HII_DATABASE_NOTIFY_REMOVE_PACK 0x00000002
  24. #define EFI_HII_DATABASE_NOTIFY_EXPORT_PACK 0x00000004
  25. #define EFI_HII_DATABASE_NOTIFY_ADD_PACK 0x00000008
  26. /**
  27. Functions which are registered to receive notification of
  28. database events have this prototype. The actual event is encoded
  29. in NotifyType. The following table describes how PackageType,
  30. PackageGuid, Handle, and Package are used for each of the
  31. notification types.
  32. @param PackageType Package type of the notification.
  33. @param PackageGuid If PackageType is
  34. EFI_HII_PACKAGE_TYPE_GUID, then this is
  35. the pointer to the GUID from the Guid
  36. field of EFI_HII_PACKAGE_GUID_HEADER.
  37. Otherwise, it must be NULL.
  38. @param Package Points to the package referred to by the notification.
  39. @param Handle The handle of the package
  40. list which contains the specified package.
  41. @param NotifyType The type of change concerning the
  42. database. See
  43. EFI_HII_DATABASE_NOTIFY_TYPE.
  44. **/
  45. typedef
  46. EFI_STATUS
  47. (EFIAPI *EFI_HII_DATABASE_NOTIFY)(
  48. IN UINT8 PackageType,
  49. IN CONST EFI_GUID *PackageGuid,
  50. IN CONST EFI_HII_PACKAGE_HEADER *Package,
  51. IN EFI_HII_HANDLE Handle,
  52. IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType
  53. );
  54. /**
  55. This function adds the packages in the package list to the
  56. database and returns a handle. If there is a
  57. EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then
  58. this function will create a package of type
  59. EFI_PACKAGE_TYPE_DEVICE_PATH and add it to the package list. For
  60. each package in the package list, registered functions with the
  61. notification type NEW_PACK and having the same package type will
  62. be called. For each call to NewPackageList(), there should be a
  63. corresponding call to
  64. EFI_HII_DATABASE_PROTOCOL.RemovePackageList().
  65. @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
  66. @param PackageList A pointer to an EFI_HII_PACKAGE_LIST_HEADER structure.
  67. @param DriverHandle Associate the package list with this EFI handle.
  68. If a NULL is specified, this data will not be associate
  69. with any drivers and cannot have a callback induced.
  70. @param Handle A pointer to the EFI_HII_HANDLE instance.
  71. @retval EFI_SUCCESS The package list associated with the
  72. Handle was added to the HII database.
  73. @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
  74. resources for the new database
  75. contents.
  76. @retval EFI_INVALID_PARAMETER PackageList is NULL, or Handle is NULL.
  77. **/
  78. typedef
  79. EFI_STATUS
  80. (EFIAPI *EFI_HII_DATABASE_NEW_PACK)(
  81. IN CONST EFI_HII_DATABASE_PROTOCOL *This,
  82. IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList,
  83. IN EFI_HANDLE DriverHandle, OPTIONAL
  84. OUT EFI_HII_HANDLE *Handle
  85. );
  86. /**
  87. This function removes the package list that is associated with a
  88. handle Handle from the HII database. Before removing the
  89. package, any registered functions with the notification type
  90. REMOVE_PACK and the same package type will be called. For each
  91. call to EFI_HII_DATABASE_PROTOCOL.NewPackageList(), there should
  92. be a corresponding call to RemovePackageList.
  93. @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
  94. @param Handle The handle that was registered to the data
  95. that is requested for removal.
  96. @retval EFI_SUCCESS The data associated with the Handle was
  97. removed from the HII database.
  98. @retval EFI_NOT_FOUND The specified Handle is not in database.
  99. **/
  100. typedef
  101. EFI_STATUS
  102. (EFIAPI *EFI_HII_DATABASE_REMOVE_PACK)(
  103. IN CONST EFI_HII_DATABASE_PROTOCOL *This,
  104. IN EFI_HII_HANDLE Handle
  105. );
  106. /**
  107. This function updates the existing package list (which has the
  108. specified Handle) in the HII databases, using the new package
  109. list specified by PackageList. The update process has the
  110. following steps: Collect all the package types in the package
  111. list specified by PackageList. A package type consists of the
  112. Type field of EFI_HII_PACKAGE_HEADER and, if the Type is
  113. EFI_HII_PACKAGE_TYPE_GUID, the Guid field, as defined in
  114. EFI_HII_PACKAGE_GUID_HEADER. Iterate through the packages within
  115. the existing package list in the HII database specified by
  116. Handle. If a package's type matches one of the collected types collected
  117. in step 1, then perform the following steps:
  118. - Call any functions registered with the notification type
  119. REMOVE_PACK.
  120. - Remove the package from the package list and the HII
  121. database.
  122. Add all of the packages within the new package list specified
  123. by PackageList, using the following steps:
  124. - Add the package to the package list and the HII database.
  125. - Call any functions registered with the notification type
  126. ADD_PACK.
  127. @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
  128. @param Handle The handle that was registered to the data
  129. that is requested for removal.
  130. @param PackageList A pointer to an EFI_HII_PACKAGE_LIST
  131. package.
  132. @retval EFI_SUCCESS The HII database was successfully updated.
  133. @retval EFI_OUT_OF_RESOURCES Unable to allocate enough memory
  134. for the updated database.
  135. @retval EFI_INVALID_PARAMETER PackageList was NULL.
  136. @retval EFI_NOT_FOUND The specified Handle is not in database.
  137. **/
  138. typedef
  139. EFI_STATUS
  140. (EFIAPI *EFI_HII_DATABASE_UPDATE_PACK)(
  141. IN CONST EFI_HII_DATABASE_PROTOCOL *This,
  142. IN EFI_HII_HANDLE Handle,
  143. IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList
  144. );
  145. /**
  146. This function returns a list of the package handles of the
  147. specified type that are currently active in the database. The
  148. pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package
  149. handles to be listed.
  150. @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
  151. @param PackageType Specifies the package type of the packages
  152. to list or EFI_HII_PACKAGE_TYPE_ALL for
  153. all packages to be listed.
  154. @param PackageGuid If PackageType is
  155. EFI_HII_PACKAGE_TYPE_GUID, then this is
  156. the pointer to the GUID which must match
  157. the Guid field of
  158. EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
  159. must be NULL.
  160. @param HandleBufferLength On input, a pointer to the length
  161. of the handle buffer. On output,
  162. the length of the handle buffer
  163. that is required for the handles found.
  164. @param Handle An array of EFI_HII_HANDLE instances returned.
  165. @retval EFI_SUCCESS The matching handles are outputted successfully.
  166. HandleBufferLength is updated with the actual length.
  167. @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter
  168. indicates that Handle is too
  169. small to support the number of
  170. handles. HandleBufferLength is
  171. updated with a value that will
  172. enable the data to fit.
  173. @retval EFI_NOT_FOUND No matching handle could be found in database.
  174. @retval EFI_INVALID_PARAMETER HandleBufferLength was NULL.
  175. @retval EFI_INVALID_PARAMETER The value referenced by HandleBufferLength was not
  176. zero and Handle was NULL.
  177. @retval EFI_INVALID_PARAMETER PackageType is not a EFI_HII_PACKAGE_TYPE_GUID but
  178. PackageGuid is not NULL, PackageType is a EFI_HII_
  179. PACKAGE_TYPE_GUID but PackageGuid is NULL.
  180. **/
  181. typedef
  182. EFI_STATUS
  183. (EFIAPI *EFI_HII_DATABASE_LIST_PACKS)(
  184. IN CONST EFI_HII_DATABASE_PROTOCOL *This,
  185. IN UINT8 PackageType,
  186. IN CONST EFI_GUID *PackageGuid,
  187. IN OUT UINTN *HandleBufferLength,
  188. OUT EFI_HII_HANDLE *Handle
  189. );
  190. /**
  191. This function will export one or all package lists in the
  192. database to a buffer. For each package list exported, this
  193. function will call functions registered with EXPORT_PACK and
  194. then copy the package list to the buffer. The registered
  195. functions may call EFI_HII_DATABASE_PROTOCOL.UpdatePackageList()
  196. to modify the package list before it is copied to the buffer. If
  197. the specified BufferSize is too small, then the status
  198. EFI_OUT_OF_RESOURCES will be returned and the actual package
  199. size will be returned in BufferSize.
  200. @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
  201. @param Handle An EFI_HII_HANDLE that corresponds to the
  202. desired package list in the HII database to
  203. export or NULL to indicate all package lists
  204. should be exported.
  205. @param BufferSize On input, a pointer to the length of the
  206. buffer. On output, the length of the
  207. buffer that is required for the exported
  208. data.
  209. @param Buffer A pointer to a buffer that will contain the
  210. results of the export function.
  211. @retval EFI_SUCCESS Package exported.
  212. @retval EFI_OUT_OF_RESOURCES BufferSize is too small to hold the package.
  213. @retval EFI_NOT_FOUND The specified Handle could not be found in the
  214. current database.
  215. @retval EFI_INVALID_PARAMETER BufferSize was NULL.
  216. @retval EFI_INVALID_PARAMETER The value referenced by BufferSize was not zero
  217. and Buffer was NULL.
  218. **/
  219. typedef
  220. EFI_STATUS
  221. (EFIAPI *EFI_HII_DATABASE_EXPORT_PACKS)(
  222. IN CONST EFI_HII_DATABASE_PROTOCOL *This,
  223. IN EFI_HII_HANDLE Handle,
  224. IN OUT UINTN *BufferSize,
  225. OUT EFI_HII_PACKAGE_LIST_HEADER *Buffer
  226. );
  227. /**
  228. This function registers a function which will be called when
  229. specified actions related to packages of the specified type
  230. occur in the HII database. By registering a function, other
  231. HII-related drivers are notified when specific package types
  232. are added, removed or updated in the HII database. Each driver
  233. or application which registers a notification should use
  234. EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify() before
  235. exiting.
  236. @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
  237. @param PackageType The package type. See
  238. EFI_HII_PACKAGE_TYPE_x in EFI_HII_PACKAGE_HEADER.
  239. @param PackageGuid If PackageType is
  240. EFI_HII_PACKAGE_TYPE_GUID, then this is
  241. the pointer to the GUID which must match
  242. the Guid field of
  243. EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
  244. must be NULL.
  245. @param PackageNotifyFn Points to the function to be called
  246. when the event specified by
  247. NotificationType occurs. See
  248. EFI_HII_DATABASE_NOTIFY.
  249. @param NotifyType Describes the types of notification which
  250. this function will be receiving. See
  251. EFI_HII_DATABASE_NOTIFY_TYPE for a
  252. list of types.
  253. @param NotifyHandle Points to the unique handle assigned to
  254. the registered notification. Can be used
  255. in EFI_HII_DATABASE_PROTOCOL.UnregisterPack
  256. to stop notifications.
  257. @retval EFI_SUCCESS Notification registered successfully.
  258. @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
  259. data structures.
  260. @retval EFI_INVALID_PARAMETER PackageGuid is not NULL when
  261. PackageType is not
  262. EFI_HII_PACKAGE_TYPE_GUID.
  263. **/
  264. typedef
  265. EFI_STATUS
  266. (EFIAPI *EFI_HII_DATABASE_REGISTER_NOTIFY)(
  267. IN CONST EFI_HII_DATABASE_PROTOCOL *This,
  268. IN UINT8 PackageType,
  269. IN CONST EFI_GUID *PackageGuid,
  270. IN EFI_HII_DATABASE_NOTIFY PackageNotifyFn,
  271. IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType,
  272. OUT EFI_HANDLE *NotifyHandle
  273. );
  274. /**
  275. Removes the specified HII database package-related notification.
  276. @param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
  277. @param NotificationHandle The handle of the notification
  278. function being unregistered.
  279. @retval EFI_SUCCESS Successsfully unregistered the notification.
  280. @retval EFI_NOT_FOUND The incoming notification handle does not exist
  281. in the current hii database.
  282. **/
  283. typedef
  284. EFI_STATUS
  285. (EFIAPI *EFI_HII_DATABASE_UNREGISTER_NOTIFY)(
  286. IN CONST EFI_HII_DATABASE_PROTOCOL *This,
  287. IN EFI_HANDLE NotificationHandle
  288. );
  289. /**
  290. This routine retrieves an array of GUID values for each keyboard
  291. layout that was previously registered in the system.
  292. @param This A pointer to the EFI_HII_PROTOCOL instance.
  293. @param KeyGuidBufferLength On input, a pointer to the length
  294. of the keyboard GUID buffer. On
  295. output, the length of the handle
  296. buffer that is required for the
  297. handles found.
  298. @param KeyGuidBuffer An array of keyboard layout GUID
  299. instances returned.
  300. @retval EFI_SUCCESS KeyGuidBuffer was updated successfully.
  301. @retval EFI_BUFFER_TOO_SMALL The KeyGuidBufferLength
  302. parameter indicates that
  303. KeyGuidBuffer is too small to
  304. support the number of GUIDs.
  305. KeyGuidBufferLength is updated
  306. with a value that will enable
  307. the data to fit.
  308. @retval EFI_INVALID_PARAMETER The KeyGuidBufferLength is NULL.
  309. @retval EFI_INVALID_PARAMETER The value referenced by
  310. KeyGuidBufferLength is not
  311. zero and KeyGuidBuffer is NULL.
  312. @retval EFI_NOT_FOUND There was no keyboard layout.
  313. **/
  314. typedef
  315. EFI_STATUS
  316. (EFIAPI *EFI_HII_FIND_KEYBOARD_LAYOUTS)(
  317. IN CONST EFI_HII_DATABASE_PROTOCOL *This,
  318. IN OUT UINT16 *KeyGuidBufferLength,
  319. OUT EFI_GUID *KeyGuidBuffer
  320. );
  321. /**
  322. This routine retrieves the requested keyboard layout. The layout
  323. is a physical description of the keys on a keyboard, and the
  324. character(s) that are associated with a particular set of key
  325. strokes.
  326. @param This A pointer to the EFI_HII_PROTOCOL instance.
  327. @param KeyGuid A pointer to the unique ID associated with a
  328. given keyboard layout. If KeyGuid is NULL then
  329. the current layout will be retrieved.
  330. @param KeyboardLayoutLength On input, a pointer to the length of the
  331. KeyboardLayout buffer. On output, the length of
  332. the data placed into KeyboardLayout.
  333. @param KeyboardLayout A pointer to a buffer containing the
  334. retrieved keyboard layout.
  335. @retval EFI_SUCCESS The keyboard layout was retrieved
  336. successfully.
  337. @retval EFI_NOT_FOUND The requested keyboard layout was not found.
  338. **/
  339. typedef
  340. EFI_STATUS
  341. (EFIAPI *EFI_HII_GET_KEYBOARD_LAYOUT)(
  342. IN CONST EFI_HII_DATABASE_PROTOCOL *This,
  343. IN CONST EFI_GUID *KeyGuid,
  344. IN OUT UINT16 *KeyboardLayoutLength,
  345. OUT EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout
  346. );
  347. /**
  348. This routine sets the default keyboard layout to the one
  349. referenced by KeyGuid. When this routine is called, an event
  350. will be signaled of the EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID
  351. group type. This is so that agents which are sensitive to the
  352. current keyboard layout being changed can be notified of this
  353. change.
  354. @param This A pointer to the EFI_HII_PROTOCOL instance.
  355. @param KeyGuid A pointer to the unique ID associated with a
  356. given keyboard layout.
  357. @retval EFI_SUCCESS The current keyboard layout was successfully set.
  358. @retval EFI_NOT_FOUND The referenced keyboard layout was not
  359. found, so action was taken.
  360. **/
  361. typedef
  362. EFI_STATUS
  363. (EFIAPI *EFI_HII_SET_KEYBOARD_LAYOUT)(
  364. IN CONST EFI_HII_DATABASE_PROTOCOL *This,
  365. IN CONST EFI_GUID *KeyGuid
  366. );
  367. /**
  368. Return the EFI handle associated with a package list.
  369. @param This A pointer to the EFI_HII_PROTOCOL instance.
  370. @param PackageListHandle An EFI_HII_HANDLE that corresponds
  371. to the desired package list in the
  372. HIIdatabase.
  373. @param DriverHandle On return, contains the EFI_HANDLE which
  374. was registered with the package list in
  375. NewPackageList().
  376. @retval EFI_SUCCESS The DriverHandle was returned successfully.
  377. @retval EFI_INVALID_PARAMETER The PackageListHandle was not valid.
  378. **/
  379. typedef
  380. EFI_STATUS
  381. (EFIAPI *EFI_HII_DATABASE_GET_PACK_HANDLE)(
  382. IN CONST EFI_HII_DATABASE_PROTOCOL *This,
  383. IN EFI_HII_HANDLE PackageListHandle,
  384. OUT EFI_HANDLE *DriverHandle
  385. );
  386. ///
  387. /// Database manager for HII-related data structures.
  388. ///
  389. struct _EFI_HII_DATABASE_PROTOCOL {
  390. EFI_HII_DATABASE_NEW_PACK NewPackageList;
  391. EFI_HII_DATABASE_REMOVE_PACK RemovePackageList;
  392. EFI_HII_DATABASE_UPDATE_PACK UpdatePackageList;
  393. EFI_HII_DATABASE_LIST_PACKS ListPackageLists;
  394. EFI_HII_DATABASE_EXPORT_PACKS ExportPackageLists;
  395. EFI_HII_DATABASE_REGISTER_NOTIFY RegisterPackageNotify;
  396. EFI_HII_DATABASE_UNREGISTER_NOTIFY UnregisterPackageNotify;
  397. EFI_HII_FIND_KEYBOARD_LAYOUTS FindKeyboardLayouts;
  398. EFI_HII_GET_KEYBOARD_LAYOUT GetKeyboardLayout;
  399. EFI_HII_SET_KEYBOARD_LAYOUT SetKeyboardLayout;
  400. EFI_HII_DATABASE_GET_PACK_HANDLE GetPackageListHandle;
  401. };
  402. extern EFI_GUID gEfiHiiDatabaseProtocolGuid;
  403. #endif