Update to support to produce Component Name and & Component Name 2 protocol based on Feature flag PcdComponentNameDisable & PcdComponentName2Disable.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4000 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2007-09-30 02:42:47 +00:00
parent 866e8172e7
commit f527bce3d0
9 changed files with 783 additions and 287 deletions

View File

@ -2393,14 +2393,13 @@ InitializeAtapiPassThru(
// //
// Install driver model protocol(s). // Install driver model protocol(s).
// //
Status = EfiLibInstallAllDriverProtocols ( Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gAtapiScsiPassThruDriverBinding, &gAtapiScsiPassThruDriverBinding,
ImageHandle, ImageHandle,
&gAtapiScsiPassThruComponentName, &gAtapiScsiPassThruComponentName,
NULL, &gAtapiScsiPassThruComponentName2
NULL
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -133,6 +133,7 @@ typedef struct {
// //
extern EFI_DRIVER_BINDING_PROTOCOL gAtapiScsiPassThruDriverBinding; extern EFI_DRIVER_BINDING_PROTOCOL gAtapiScsiPassThruDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gAtapiScsiPassThruComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gAtapiScsiPassThruComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gAtapiScsiPassThruComponentName2;
// //
// ATAPI Command op code // ATAPI Command op code
@ -301,6 +302,45 @@ AtapiScsiPassThruDriverBindingStop (
// //
// EFI Component Name Functions // EFI Component Name Functions
// //
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AtapiScsiPassThruComponentNameGetDriverName ( AtapiScsiPassThruComponentNameGetDriverName (
@ -309,6 +349,75 @@ AtapiScsiPassThruComponentNameGetDriverName (
OUT CHAR16 **DriverName OUT CHAR16 **DriverName
); );
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
AtapiScsiPassThruComponentNameGetControllerName ( AtapiScsiPassThruComponentNameGetControllerName (
@ -319,6 +428,7 @@ AtapiScsiPassThruComponentNameGetControllerName (
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
/** /**
AtapiScsiPassThruDriverEntryPoint AtapiScsiPassThruDriverEntryPoint

View File

@ -13,40 +13,67 @@
**/ **/
#include "AtapiPassThru.h" #include "AtapiPassThru.h"
/// //
/// EFI Component Name Protocol // EFI Component Name Protocol
/// //
EFI_COMPONENT_NAME_PROTOCOL gAtapiScsiPassThruComponentName = { EFI_COMPONENT_NAME_PROTOCOL gAtapiScsiPassThruComponentName = {
AtapiScsiPassThruComponentNameGetDriverName, AtapiScsiPassThruComponentNameGetDriverName,
AtapiScsiPassThruComponentNameGetControllerName, AtapiScsiPassThruComponentNameGetControllerName,
"eng" "eng"
}; };
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gAtapiScsiPassThruComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) AtapiScsiPassThruComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) AtapiScsiPassThruComponentNameGetControllerName,
"en"
};
static EFI_UNICODE_STRING_TABLE mAtapiScsiPassThruDriverNameTable[] = { static EFI_UNICODE_STRING_TABLE mAtapiScsiPassThruDriverNameTable[] = {
{ "eng", (CHAR16 *) L"ATAPI SCSI Pass Thru Driver" }, { "eng;en", (CHAR16 *) L"ATAPI SCSI Pass Thru Driver" },
{ NULL , NULL } { NULL , NULL }
}; };
/** /**
Retrieves a Unicode string that is the user readable name of the EFI Driver. Retrieves a Unicode string that is the user readable name of the driver.
@param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance. This function retrieves the user readable name of a driver in the form of a
@param Language A pointer to a three character ISO 639-2 language identifier. Unicode string. If the driver specified by This has a user readable name in
This is the language of the driver name that that the caller the language specified by Language, then a pointer to the driver name is
is requesting, and it must match one of the languages specified returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
in SupportedLanguages. The number of languages supported by a by This does not support the language specified by Language,
driver is up to the driver writer. then EFI_UNSUPPORTED is returned.
@param DriverName A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language. specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by This @retval EFI_SUCCESS The Unicode string for the Driver specified by
and the language specified by Language was returned This and the language specified by Language was
in DriverName. returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL. @retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL. @retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support the
language specified by Language. @retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/ **/
EFI_STATUS EFI_STATUS
@ -57,53 +84,81 @@ AtapiScsiPassThruComponentNameGetDriverName (
OUT CHAR16 **DriverName OUT CHAR16 **DriverName
) )
{ {
return LookupUnicodeString ( return LookupUnicodeString2 (
Language, Language,
gAtapiScsiPassThruComponentName.SupportedLanguages, This->SupportedLanguages,
mAtapiScsiPassThruDriverNameTable, mAtapiScsiPassThruDriverNameTable,
DriverName DriverName,
(BOOLEAN)(This == &gAtapiScsiPassThruComponentName)
); );
} }
/** /**
Retrieves a Unicode string that is the user readable name of the controller Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver. that is being managed by a driver.
@param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance. This function retrieves the user readable name of the controller specified by
@param ControllerHandle The handle of a controller that the driver specified by ControllerHandle and ChildHandle in the form of a Unicode string. If the
This is managing. This handle specifies the controller driver specified by This has a user readable name in the language specified by
whose name is to be returned. Language, then a pointer to the controller name is returned in ControllerName,
@param ChildHandle The handle of the child controller to retrieve the name and EFI_SUCCESS is returned. If the driver specified by This is not currently
of. This is an optional parameter that may be NULL. It managing the controller specified by ControllerHandle and ChildHandle,
will be NULL for device drivers. It will also be NULL then EFI_UNSUPPORTED is returned. If the driver specified by This does not
for a bus drivers that wish to retrieve the name of the support the language specified by Language, then EFI_UNSUPPORTED is returned.
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller. @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
@param Language A pointer to a three character ISO 639-2 language EFI_COMPONENT_NAME_PROTOCOL instance.
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one @param ControllerHandle[in] The handle of a controller that the driver
of the languages specified in SupportedLanguages. The specified by This is managing. This handle
number of languages supported by a driver is up to the specifies the controller whose name is to be
driver writer. returned.
@param ControllerName A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by @param ChildHandle[in] The handle of the child controller to retrieve
ControllerHandle and ChildHandle in the language the name of. This is an optional parameter that
specified by Language from the point of view of the may be NULL. It will be NULL for device
driver specified by This. drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_SUCCESS The Unicode string for the user readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE. EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL. @retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL. @retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently @retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by managing the controller specified by
ControllerHandle and ChildHandle. ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support the
language specified by Language. @retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/ **/
EFI_STATUS EFI_STATUS

View File

@ -25,6 +25,45 @@ Abstract:
// //
// EFI Component Name Functions // EFI Component Name Functions
// //
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
EhciComponentNameGetDriverName ( EhciComponentNameGetDriverName (
@ -33,16 +72,86 @@ EhciComponentNameGetDriverName (
OUT CHAR16 **DriverName OUT CHAR16 **DriverName
); );
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
EhciComponentNameGetControllerName ( EhciComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle, OPTIONAL IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
@ -50,13 +159,62 @@ EFI_COMPONENT_NAME_PROTOCOL gEhciComponentName = {
EhciComponentNameGetDriverName, EhciComponentNameGetDriverName,
EhciComponentNameGetControllerName, EhciComponentNameGetControllerName,
"eng" "eng"
}; };
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gEhciComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EhciComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EhciComponentNameGetControllerName,
"en"
};
static EFI_UNICODE_STRING_TABLE mEhciDriverNameTable[] = { static EFI_UNICODE_STRING_TABLE mEhciDriverNameTable[] = {
{ "eng", L"Usb Ehci Driver" }, { "eng;en", L"Usb Ehci Driver" },
{ NULL , NULL } { NULL , NULL }
}; };
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
EhciComponentNameGetDriverName ( EhciComponentNameGetDriverName (
@ -64,95 +222,93 @@ EhciComponentNameGetDriverName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName OUT CHAR16 **DriverName
) )
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language identifier.
This is the language of the driver name that that the caller
is requesting, and it must match one of the languages specified
in SupportedLanguages. The number of languages supported by a
driver is up to the driver writer.
DriverName - A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language
specified by Language.
Returns:
EFI_SUCCESS - The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - DriverName is NULL.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{ {
return LookupUnicodeString ( return LookupUnicodeString2 (
Language, Language,
gEhciComponentName.SupportedLanguages, This->SupportedLanguages,
mEhciDriverNameTable, mEhciDriverNameTable,
DriverName DriverName,
(BOOLEAN)(This == &gEhciComponentName)
); );
} }
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
EhciComponentNameGetControllerName ( EhciComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle, OPTIONAL IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
) )
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It
will be NULL for device drivers. It will also be NULL
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one
of the languages specified in SupportedLanguages. The
number of languages supported by a driver is up to the
driver writer.
ControllerName - A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language
specified by Language from the point of view of the
driver specified by This.
Returns:
EFI_SUCCESS - The Unicode string for the user readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
USB2_HC_DEV *EhciDev; USB2_HC_DEV *EhciDev;
@ -192,11 +348,12 @@ EhciComponentNameGetControllerName (
EhciDev = EHC_FROM_THIS (Usb2Hc); EhciDev = EHC_FROM_THIS (Usb2Hc);
return LookupUnicodeString ( return LookupUnicodeString2 (
Language, Language,
gEhciComponentName.SupportedLanguages, This->SupportedLanguages,
EhciDev->ControllerNameTable, EhciDev->ControllerNameTable,
ControllerName ControllerName,
(BOOLEAN)(This == &gEhciComponentName)
); );
} }

View File

@ -1295,14 +1295,13 @@ Returns:
--*/ --*/
{ {
return EfiLibInstallAllDriverProtocols ( return EfiLibInstallDriverBindingComponentName2 (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gEhciDriverBinding, &gEhciDriverBinding,
ImageHandle, ImageHandle,
&gEhciComponentName, &gEhciComponentName,
NULL, &gEhciComponentName2
NULL
); );
} }
@ -1565,12 +1564,21 @@ EhcDriverBindingStart (
// Install the component name protocol, don't fail the start // Install the component name protocol, don't fail the start
// because of something for display. // because of something for display.
// //
AddUnicodeString ( AddUnicodeString2 (
"eng", "eng",
gEhciComponentName.SupportedLanguages, gEhciComponentName.SupportedLanguages,
&Ehc->ControllerNameTable, &Ehc->ControllerNameTable,
L"Enhanced Host Controller (USB 2.0)" L"Enhanced Host Controller (USB 2.0)",
TRUE
); );
AddUnicodeString2 (
"en",
gEhciComponentName2.SupportedLanguages,
&Ehc->ControllerNameTable,
L"Enhanced Host Controller (USB 2.0)",
FALSE
);
EHC_DEBUG (("EhcDriverBindingStart: EHCI started for controller @ %x\n", Controller)); EHC_DEBUG (("EhcDriverBindingStart: EHCI started for controller @ %x\n", Controller));
return EFI_SUCCESS; return EFI_SUCCESS;

View File

@ -142,5 +142,6 @@ struct _USB2_HC_DEV {
extern EFI_DRIVER_BINDING_PROTOCOL gEhciDriverBinding; extern EFI_DRIVER_BINDING_PROTOCOL gEhciDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gEhciComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gEhciComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gEhciComponentName2;
#endif #endif

View File

@ -23,6 +23,45 @@ Abstract:
// //
// EFI Component Name Functions // EFI Component Name Functions
// //
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
UhciComponentNameGetDriverName ( UhciComponentNameGetDriverName (
@ -31,16 +70,86 @@ UhciComponentNameGetDriverName (
OUT CHAR16 **DriverName OUT CHAR16 **DriverName
); );
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
UhciComponentNameGetControllerName ( UhciComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle, OPTIONAL IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
@ -48,13 +157,62 @@ EFI_COMPONENT_NAME_PROTOCOL gUhciComponentName = {
UhciComponentNameGetDriverName, UhciComponentNameGetDriverName,
UhciComponentNameGetControllerName, UhciComponentNameGetControllerName,
"eng" "eng"
}; };
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gUhciComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) UhciComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) UhciComponentNameGetControllerName,
"en"
};
static EFI_UNICODE_STRING_TABLE mUhciDriverNameTable[] = { static EFI_UNICODE_STRING_TABLE mUhciDriverNameTable[] = {
{ "eng", L"Usb Uhci Driver" }, { "eng;en", L"Usb Uhci Driver" },
{ NULL, NULL } { NULL, NULL }
}; };
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
driver specified by This in the language
specified by Language.
@retval EFI_SUCCESS The Unicode string for the Driver specified by
This and the language specified by Language was
returned in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER DriverName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
UhciComponentNameGetDriverName ( UhciComponentNameGetDriverName (
@ -62,95 +220,93 @@ UhciComponentNameGetDriverName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName OUT CHAR16 **DriverName
) )
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language identifier.
This is the language of the driver name that that the caller
is requesting, and it must match one of the languages specified
in SupportedLanguages. The number of languages supported by a
driver is up to the driver writer.
DriverName - A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language
specified by Language.
Returns:
EFI_SUCCESS - The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - DriverName is NULL.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{ {
return LookupUnicodeString ( return LookupUnicodeString2 (
Language, Language,
gUhciComponentName.SupportedLanguages, This->SupportedLanguages,
mUhciDriverNameTable, mUhciDriverNameTable,
DriverName DriverName,
(BOOLEAN)(This == &gUhciComponentName)
); );
} }
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
@param ChildHandle[in] The handle of the child controller to retrieve
the name of. This is an optional parameter that
may be NULL. It will be NULL for device
drivers. It will also be NULL for a bus drivers
that wish to retrieve the name of the bus
controller. It will not be NULL for a bus
driver that wishes to retrieve the name of a
child controller.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name that the caller is
requesting, and it must match one of the
languages specified in SupportedLanguages. The
number of languages supported by a driver is up
to the driver writer. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] A pointer to the Unicode string to return.
This Unicode string is the name of the
controller specified by ControllerHandle and
ChildHandle in the language specified by
Language from the point of view of the driver
specified by This.
@retval EFI_SUCCESS The Unicode string for the user readable name in
the language specified by Language for the
driver specified by This was returned in
DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
@retval EFI_UNSUPPORTED The driver specified by This does not support
the language specified by Language.
**/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
UhciComponentNameGetControllerName ( UhciComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle, OPTIONAL IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
) )
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It
will be NULL for device drivers. It will also be NULL
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one
of the languages specified in SupportedLanguages. The
number of languages supported by a driver is up to the
driver writer.
ControllerName - A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language
specified by Language from the point of view of the
driver specified by This.
Returns:
EFI_SUCCESS - The Unicode string for the user readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{ {
EFI_STATUS Status; EFI_STATUS Status;
USB_HC_DEV *UhciDev; USB_HC_DEV *UhciDev;
@ -193,11 +349,12 @@ UhciComponentNameGetControllerName (
UhciDev = UHC_FROM_USB_HC_PROTO (UsbHc); UhciDev = UHC_FROM_USB_HC_PROTO (UsbHc);
return LookupUnicodeString ( return LookupUnicodeString2 (
Language, Language,
gUhciComponentName.SupportedLanguages, This->SupportedLanguages,
UhciDev->CtrlNameTable, UhciDev->CtrlNameTable,
ControllerName ControllerName,
(BOOLEAN)(This == &gUhciComponentName)
); );
} }

View File

@ -1852,14 +1852,13 @@ UhciDriverEntryPoint (
--*/ --*/
{ {
return EfiLibInstallAllDriverProtocols ( return EfiLibInstallDriverBindingComponentName2 (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gUhciDriverBinding, &gUhciDriverBinding,
ImageHandle, ImageHandle,
&gUhciComponentName, &gUhciComponentName,
NULL, &gUhciComponentName2
NULL
); );
} }
@ -2217,12 +2216,21 @@ UhciDriverBindingStart (
// //
Uhc->CtrlNameTable = NULL; Uhc->CtrlNameTable = NULL;
AddUnicodeString ( AddUnicodeString2 (
"eng", "eng",
gUhciComponentName.SupportedLanguages, gUhciComponentName.SupportedLanguages,
&Uhc->CtrlNameTable, &Uhc->CtrlNameTable,
L"Usb Universal Host Controller" L"Usb Universal Host Controller",
TRUE
); );
AddUnicodeString2 (
"en",
gUhciComponentName2.SupportedLanguages,
&Uhc->CtrlNameTable,
L"Usb Universal Host Controller",
FALSE
);
// //
// Start the UHCI hardware, also set its reclamation point to 64 bytes // Start the UHCI hardware, also set its reclamation point to 64 bytes

View File

@ -130,5 +130,6 @@ struct _USB_HC_DEV {
extern EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding; extern EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gUhciComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gUhciComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gUhciComponentName2;
#endif #endif