#ifndef __UEFI_LIB_H__\r
#define __UEFI_LIB_H__\r
\r
-//\r
-// Unicode String Table\r
-//\r
+#include <Protocol/DriverBinding.h>\r
+#include <Protocol/DriverConfiguration.h>\r
+#include <Protocol/ComponentName.h>\r
+#include <Protocol/ComponentName2.h>\r
+#include <Protocol/DriverDiagnostics.h>\r
+#include <Protocol/DriverDiagnostics2.h>\r
+\r
+///\r
+/// Unicode String Table\r
+///\r
typedef struct {\r
CHAR8 *Language;\r
CHAR16 *UnicodeString;\r
} EFI_UNICODE_STRING_TABLE;\r
\r
-//\r
-// EFI Lock Status\r
-//\r
+///\r
+/// EFI Lock Status\r
+///\r
typedef enum {\r
EfiLockUninitialized = 0,\r
EfiLockReleased = 1,\r
EfiLockAcquired = 2\r
} EFI_LOCK_STATE;\r
\r
-//\r
-// EFI Lock \r
-//\r
+///\r
+/// EFI Lock \r
+///\r
typedef struct {\r
EFI_TPL Tpl;\r
EFI_TPL OwnerTpl;\r
can then immediately be restored back to the current TPL level with a call \r
to RestoreTPL().\r
\r
- @param VOID\r
-\r
- @retvale EFI_TPL The current TPL.\r
+ @return The current TPL.\r
\r
**/\r
EFI_TPL\r
priority level. Since there is no preemption or multiprocessor support in EFI,\r
acquiring the lock only consists of raising to the locks TPL.\r
\r
- @param Lock A pointer to the lock data structure to initialize.\r
@param Priority The task priority level of the lock.\r
\r
@return The lock.\r
\r
**/\r
#define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \\r
- {Priority, EFI_TPL_APPLICATION, EfiLockReleased }\r
+ {Priority, TPL_APPLICATION, EfiLockReleased }\r
\r
\r
/**\r
priority level of the mutual exclusion lock. Then, it places the lock in the \r
acquired state.\r
\r
- @param Priority The task priority level of the lock.\r
+ @param Lock A pointer to the lock to acquire.\r
\r
**/\r
VOID\r
IN EFI_LOCK *Lock\r
);\r
\r
-/**
- Tests whether a controller handle is being managed by a specific driver.
-
+/**\r
+ Tests whether a controller handle is being managed by a specific driver.\r
+\r
This function tests whether the driver specified by DriverBindingHandle is\r
currently managing the controller specified by ControllerHandle. This test\r
is performed by evaluating if the the protocol specified by ProtocolGuid is\r
present on ControllerHandle and is was opened by DriverBindingHandle with an\r
attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. \r
If ProtocolGuid is NULL, then ASSERT().\r
-
- @param ControllerHandle A handle for a controller to test.
- @param DriverBindingHandle Specifies the driver binding handle for the
- driver.
- @param ProtocolGuid Specifies the protocol that the driver specified
- by DriverBindingHandle opens in its Start()
- function.
-
- @retval EFI_SUCCESS ControllerHandle is managed by the driver
- specifed by DriverBindingHandle.
- @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
- specifed by DriverBindingHandle.
-
+\r
+ @param ControllerHandle A handle for a controller to test.\r
+ @param DriverBindingHandle Specifies the driver binding handle for the\r
+ driver.\r
+ @param ProtocolGuid Specifies the protocol that the driver specified\r
+ by DriverBindingHandle opens in its Start()\r
+ function.\r
+\r
+ @retval EFI_SUCCESS ControllerHandle is managed by the driver\r
+ specifed by DriverBindingHandle.\r
+ @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver\r
+ specifed by DriverBindingHandle.\r
+\r
**/\r
EFI_STATUS\r
EFIAPI\r
IN CONST EFI_GUID *ProtocolGuid\r
);\r
\r
-/**
- Tests whether a child handle is a child device of the controller.
-
+/**\r
+ Tests whether a child handle is a child device of the controller.\r
+\r
This function tests whether ChildHandle is one of the children of\r
ControllerHandle. This test is performed by checking to see if the protocol\r
specified by ProtocolGuid is present on ControllerHandle and opened by\r
ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
If ProtocolGuid is NULL, then ASSERT().\r
-
- @param ControllerHandle A handle for a (parent) controller to test.
- @param ChildHandle A child handle to test.
- @param ConsumsedGuid Supplies the protocol that the child controller
- opens on its parent controller.
-
- @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.
- @retval EFI_UNSUPPORTED ChildHandle is not a child of the
- ControllerHandle.
-
+\r
+ @param ControllerHandle A handle for a (parent) controller to test. \r
+ @param ChildHandle A child handle to test.\r
+ @param ProtocolGuid Supplies the protocol that the child controller\r
+ opens on its parent controller. \r
+\r
+ @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.\r
+ @retval EFI_UNSUPPORTED ChildHandle is not a child of the\r
+ ControllerHandle.\r
+\r
**/\r
EFI_STATUS\r
EFIAPI\r
OUT CHAR16 **UnicodeString\r
);\r
\r
+/**\r
+ This function looks up a Unicode string in UnicodeStringTable.\r
+ If Language is a member of SupportedLanguages and a Unicode\r
+ string is found in UnicodeStringTable that matches the\r
+ language code specified by Language, then it is returned in\r
+ UnicodeString.\r
+\r
+ @param Language A pointer to the ISO 639-2 or\r
+ RFC 3066 language code for the\r
+ Unicode string to look up and\r
+ return.\r
+ \r
+ @param SupportedLanguages A pointer to the set of ISO\r
+ 639-2 or RFC 3066 language\r
+ codes that the Unicode string\r
+ table supports. Language must\r
+ be a member of this set.\r
+ \r
+ @param UnicodeStringTable A pointer to the table of\r
+ Unicode strings.\r
+ \r
+ @param UnicodeString A pointer to the Unicode\r
+ string from UnicodeStringTable\r
+ that matches the language\r
+ specified by Language.\r
+\r
+ @param Iso639Language Specify the language code\r
+ format supported. If true,\r
+ then the format follow ISO\r
+ 639-2. If false, then it\r
+ follows RFC3066.\r
+\r
+ @retval EFI_SUCCESS The Unicode string that\r
+ matches the language specified\r
+ by Language was found in the\r
+ table of Unicoide strings\r
+ UnicodeStringTable, and it was\r
+ returned in UnicodeString.\r
+ \r
+ @retval EFI_INVALID_PARAMETER Language is NULL.\r
+ \r
+ @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
+ \r
+ @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
+ \r
+ @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.\r
+ \r
+ @retval EFI_UNSUPPORTED The language specified by\r
+ Language is not a member\r
+ ofSupportedLanguages.\r
+ \r
+ @retval EFI_UNSUPPORTED The language specified by\r
+ Language is not supported by\r
+ UnicodeStringTable.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+LookupUnicodeString2 (\r
+ IN CONST CHAR8 *Language,\r
+ IN CONST CHAR8 *SupportedLanguages,\r
+ IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,\r
+ OUT CHAR16 **UnicodeString,\r
+ IN BOOLEAN Iso639Language\r
+ )\r
+;\r
+\r
/**\r
This function adds a Unicode string to UnicodeStringTable.\r
If Language is a member of SupportedLanguages then UnicodeString is added to \r
IN CONST CHAR16 *UnicodeString\r
);\r
\r
+/**\r
+ \r
+ This function adds a Unicode string to UnicodeStringTable.\r
+ If Language is a member of SupportedLanguages then\r
+ UnicodeString is added to UnicodeStringTable. New buffers are\r
+ allocated for both Language and UnicodeString. The contents\r
+ of Language and UnicodeString are copied into these new\r
+ buffers. These buffers are automatically freed when\r
+ FreeUnicodeStringTable() is called.\r
+\r
+ @param Language A pointer to the ISO 639-2 or\r
+ RFC 3066 language code for the\r
+ Unicode string to add.\r
+ \r
+ @param SupportedLanguages A pointer to the set of ISO\r
+ 639-2 or RFC 3066 language\r
+ codes that the Unicode string\r
+ table supports. Language must\r
+ be a member of this set.\r
+ \r
+ @param UnicodeStringTable A pointer to the table of\r
+ Unicode strings.\r
+ \r
+ @param UnicodeString A pointer to the Unicode\r
+ string to add.\r
+ \r
+ @param Iso639Language Specify the language code\r
+ format supported. If true,\r
+ then the format follow ISO\r
+ 639-2. If false, then it\r
+ follows RFC3066.\r
+\r
+ @retval EFI_SUCCESS The Unicode string that\r
+ matches the language specified\r
+ by Language was found in the\r
+ table of Unicode strings\r
+ UnicodeStringTable, and it was\r
+ returned in UnicodeString.\r
+ \r
+ @retval EFI_INVALID_PARAMETER Language is NULL.\r
+ \r
+ @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
+ \r
+ @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.\r
+ \r
+ @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
+ \r
+ @retval EFI_ALREADY_STARTED A Unicode string with language\r
+ Language is already present in\r
+ UnicodeStringTable.\r
+ \r
+ @retval EFI_OUT_OF_RESOURCES There is not enough memory to\r
+ add another Unicode string to\r
+ UnicodeStringTable.\r
+ \r
+ @retval EFI_UNSUPPORTED The language specified by\r
+ Language is not a member of\r
+ SupportedLanguages.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AddUnicodeString2 (\r
+ IN CONST CHAR8 *Language,\r
+ IN CONST CHAR8 *SupportedLanguages,\r
+ IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,\r
+ IN CONST CHAR16 *UnicodeString,\r
+ IN BOOLEAN Iso639Language\r
+ )\r
+;\r
+\r
/**\r
This function frees the table of Unicode strings in UnicodeStringTable.\r
If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.\r
the EDK/EFI 1.10 form and EDKII/UEFI 2.0 form and allows common code to \r
work both ways.\r
\r
- @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
+ @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
\r
@retval EFI_SUCCESS Event was created.\r
@retval Other Event was not created.\r
@param NotifyTpl The task priority level of the event.\r
@param NotifyFunction The notification function to call when the event is signaled.\r
@param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r
- @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
+ @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
\r
@retval EFI_SUCCESS Event was created.\r
@retval Other Event was not created.\r
@param ... VARARG list consumed to process Format.\r
If Format is NULL, then ASSERT().\r
If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+ \r
+ @return Number of Unicode characters printed to ConOut.\r
\r
**/\r
UINTN\r
@param ... VARARG list consumed to process Format.\r
If Format is NULL, then ASSERT().\r
If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+ \r
+ @return Number of Unicode characters printed to StdErr.\r
\r
**/\r
UINTN\r
@param ... VARARG list consumed to process Format.\r
If Format is NULL, then ASSERT().\r
If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+ \r
+ @return Number of ASCII characters printed to ConOut.\r
\r
**/\r
UINTN\r
@param ... VARARG list consumed to process Format.\r
If Format is NULL, then ASSERT().\r
If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+ \r
+ @return Number of ASCII characters printed to ConErr.\r
\r
**/\r
UINTN\r
...\r
);\r
\r
+/**\r
+ Initializes a driver by installing the Driver Binding Protocol onto the driver's\r
+ DriverBindingHandle. This is typically the same as the driver's ImageHandle, but\r
+ it can be different if the driver produces multiple DriverBinding Protocols. \r
+ If the Driver Binding Protocol interface is NULL, then ASSERT (). \r
+ If the installation fails, then ASSERT ().\r
+\r
+ @param ImageHandle The image handle of the driver.\r
+ @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
+ @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
+ @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
+ parameter is NULL, then a new handle is created.\r
+\r
+ @retval EFI_SUCCESS The protocol installation is completed successfully.\r
+ @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiLibInstallDriverBinding (\r
+ IN CONST EFI_HANDLE ImageHandle,\r
+ IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
+ IN EFI_HANDLE DriverBindingHandle\r
+ );\r
+\r
+\r
+/**\r
+ Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
+ Driver Configure and Driver Diagnostic Protocols onto the driver's DriverBindingHandle. This is\r
+ typically the same as the driver's ImageHandle, but it can be different if the driver produces multiple\r
+ DriverBinding Protocols. \r
+ If the Driver Binding Protocol interface is NULL, then ASSERT (). \r
+ If the installation fails, then ASSERT ().\r
+\r
+ @param ImageHandle The image handle of the driver.\r
+ @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
+ @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
+ @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
+ parameter is NULL, then a new handle is created.\r
+ @param ComponentName A Component Name Protocol instance that this driver is producing.\r
+ @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r
+ @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r
+\r
+ @retval EFI_SUCCESS The protocol installation is completed successfully.\r
+ @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiLibInstallAllDriverProtocols (\r
+ IN CONST EFI_HANDLE ImageHandle,\r
+ IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
+ IN EFI_HANDLE DriverBindingHandle,\r
+ IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
+ IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
+ IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL\r
+ );\r
+\r
+\r
+\r
+/**\r
+ Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
+ Component Name 2 onto the driver's DriverBindingHandle. This is typically the same as the driver's\r
+ ImageHandle, but it can be different if the driver produces multiple DriverBinding Protocols. \r
+ If the Driver Binding Protocol interface is NULL, then ASSERT (). \r
+ If the installation fails, then ASSERT ().\r
+\r
+ @param ImageHandle The image handle of the driver.\r
+ @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
+ @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
+ @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
+ parameter is NULL, then a new handle is created.\r
+ @param ComponentName A Component Name Protocol instance that this driver is producing.\r
+ @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r
+\r
+ @retval EFI_SUCCESS The protocol installation is completed successfully.\r
+ @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiLibInstallDriverBindingComponentName2 (\r
+ IN CONST EFI_HANDLE ImageHandle,\r
+ IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
+ IN EFI_HANDLE DriverBindingHandle,\r
+ IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
+ IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL\r
+ );\r
+\r
+\r
+/**\r
+ Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
+ Component Name 2, Driver Configure, Driver Diagnostic and Driver Diagnostic 2 Protocols onto the driver's\r
+ DriverBindingHandle. This is typically the same as the driver's ImageHandle, but it can be different if\r
+ the driver produces multiple DriverBinding Protocols. \r
+ If the Driver Binding Protocol interface is NULL, then ASSERT (). \r
+ If the installation fails, then ASSERT ().\r
+\r
+ @param ImageHandle The image handle of the driver.\r
+ @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
+ @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
+ @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
+ parameter is NULL, then a new handle is created.\r
+ @param ComponentName A Component Name Protocol instance that this driver is producing.\r
+ @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r
+ @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r
+ @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r
+ @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.\r
+\r
+ @retval EFI_SUCCESS The protocol installation is completed successfully.\r
+ @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiLibInstallAllDriverProtocols2 (\r
+ IN CONST EFI_HANDLE ImageHandle,\r
+ IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
+ IN EFI_HANDLE DriverBindingHandle,\r
+ IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
+ IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL\r
+ IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
+ IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL\r
+ IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL\r
+ );\r
+\r
#endif\r