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@3996 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2007-09-30 02:30:46 +00:00
parent ac94ab631f
commit f3d08ccf1a
17 changed files with 1240 additions and 595 deletions

View File

@ -16,15 +16,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gIsaBusComponentName = { EFI_COMPONENT_NAME_PROTOCOL gIsaBusComponentName = {
IsaBusComponentNameGetDriverName, IsaBusComponentNameGetDriverName,
IsaBusComponentNameGetControllerName, IsaBusComponentNameGetControllerName,
"eng" "eng"
}; };
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gIsaBusComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) IsaBusComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) IsaBusComponentNameGetControllerName,
"en"
};
STATIC EFI_UNICODE_STRING_TABLE mIsaBusDriverNameTable[] = { STATIC EFI_UNICODE_STRING_TABLE mIsaBusDriverNameTable[] = {
{ {
"eng", "eng;en",
L"ISA Bus Driver" L"ISA Bus Driver"
}, },
{ {
@ -33,6 +43,45 @@ STATIC EFI_UNICODE_STRING_TABLE mIsaBusDriverNameTable[] = {
} }
}; };
/**
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
IsaBusComponentNameGetDriverName ( IsaBusComponentNameGetDriverName (
@ -40,41 +89,84 @@ IsaBusComponentNameGetDriverName (
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,
gIsaBusComponentName.SupportedLanguages, This->SupportedLanguages,
mIsaBusDriverNameTable, mIsaBusDriverNameTable,
DriverName DriverName,
); (BOOLEAN)(This == &gIsaBusComponentName)
);
} }
/**
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
IsaBusComponentNameGetControllerName ( IsaBusComponentNameGetControllerName (
@ -84,51 +176,6 @@ IsaBusComponentNameGetControllerName (
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.
--*/
{ {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }

View File

@ -19,37 +19,128 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// //
#include "InternalIsaBus.h" #include "InternalIsaBus.h"
extern EFI_COMPONENT_NAME_PROTOCOL gIsaBusComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gIsaBusComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gIsaBusComponentName2;
// //
// 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
IsaBusComponentNameGetDriverName ( IsaBusComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName OUT CHAR16 **DriverName
) );
/*++
Routine Description:
GC_TODO: Add function description /**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
Arguments: 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.
This - GC_TODO: add argument description @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
Language - GC_TODO: add argument description EFI_COMPONENT_NAME_PROTOCOL instance.
DriverName - GC_TODO: add argument description
Returns: @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.
GC_TODO: add return values @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
IsaBusComponentNameGetControllerName ( IsaBusComponentNameGetControllerName (
@ -58,26 +149,7 @@ IsaBusComponentNameGetControllerName (
IN EFI_HANDLE ChildHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
) );
/*++
Routine Description:
GC_TODO: Add function description
Arguments:
This - GC_TODO: add argument description
ControllerHandle - GC_TODO: add argument description
ChildHandle - GC_TODO: add argument description
Language - GC_TODO: add argument description
ControllerName - GC_TODO: add argument description
Returns:
GC_TODO: add return values
--*/
;
#endif #endif

View File

@ -55,14 +55,13 @@ InitializeIsaBus(
// //
// Install driver model protocol(s). // Install driver model protocol(s).
// //
Status = EfiLibInstallAllDriverProtocols ( Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gIsaBusControllerDriver, &gIsaBusControllerDriver,
ImageHandle, ImageHandle,
&gIsaBusComponentName, &gIsaBusComponentName,
NULL, &gIsaBusComponentName2
NULL
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -17,15 +17,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gIsaFloppyComponentName = { EFI_COMPONENT_NAME_PROTOCOL gIsaFloppyComponentName = {
IsaFloppyComponentNameGetDriverName, IsaFloppyComponentNameGetDriverName,
IsaFloppyComponentNameGetControllerName, IsaFloppyComponentNameGetControllerName,
"eng" "eng"
}; };
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gIsaFloppyComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) IsaFloppyComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) IsaFloppyComponentNameGetControllerName,
"en"
};
STATIC EFI_UNICODE_STRING_TABLE mIsaFloppyDriverNameTable[] = { STATIC EFI_UNICODE_STRING_TABLE mIsaFloppyDriverNameTable[] = {
{ {
"eng", "eng;en",
L"ISA Floppy Driver" L"ISA Floppy Driver"
}, },
{ {
@ -34,6 +44,45 @@ STATIC EFI_UNICODE_STRING_TABLE mIsaFloppyDriverNameTable[] = {
} }
}; };
/**
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
IsaFloppyComponentNameGetDriverName ( IsaFloppyComponentNameGetDriverName (
@ -41,44 +90,84 @@ IsaFloppyComponentNameGetDriverName (
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,
gIsaFloppyComponentName.SupportedLanguages, This->SupportedLanguages,
mIsaFloppyDriverNameTable, mIsaFloppyDriverNameTable,
DriverName DriverName,
(BOOLEAN)(This == &gIsaFloppyComponentName)
); );
} }
/**
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
IsaFloppyComponentNameGetControllerName ( IsaFloppyComponentNameGetControllerName (
@ -88,54 +177,6 @@ IsaFloppyComponentNameGetControllerName (
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;
EFI_BLOCK_IO_PROTOCOL *BlkIo; EFI_BLOCK_IO_PROTOCOL *BlkIo;
@ -192,11 +233,12 @@ IsaFloppyComponentNameGetControllerName (
// //
FdcDev = FDD_BLK_IO_FROM_THIS (BlkIo); FdcDev = FDD_BLK_IO_FROM_THIS (BlkIo);
return LookupUnicodeString ( return LookupUnicodeString2 (
Language, Language,
gIsaFloppyComponentName.SupportedLanguages, This->SupportedLanguages,
FdcDev->ControllerNameTable, FdcDev->ControllerNameTable,
ControllerName ControllerName,
(BOOLEAN)(This == &gIsaFloppyComponentName)
); );
} }
@ -224,10 +266,19 @@ AddName (
StrCpy (FloppyDriveName, FLOPPY_DRIVE_NAME); StrCpy (FloppyDriveName, FLOPPY_DRIVE_NAME);
FloppyDriveName[FLOPPY_DRIVE_NAME_ASCII_LEN - 1] = (CHAR16) (L'0' + FdcDev->Disk); FloppyDriveName[FLOPPY_DRIVE_NAME_ASCII_LEN - 1] = (CHAR16) (L'0' + FdcDev->Disk);
AddUnicodeString ( AddUnicodeString2 (
"eng", "eng",
gIsaFloppyComponentName.SupportedLanguages, gIsaFloppyComponentName.SupportedLanguages,
&FdcDev->ControllerNameTable, &FdcDev->ControllerNameTable,
FloppyDriveName FloppyDriveName,
TRUE
); );
AddUnicodeString2 (
"en",
gIsaFloppyComponentName2.SupportedLanguages,
&FdcDev->ControllerNameTable,
FloppyDriveName,
FALSE
);
} }

View File

@ -19,37 +19,128 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define FLOPPY_DRIVE_NAME_ASCII_LEN (sizeof ("ISA Floppy Drive # ") - 1) #define FLOPPY_DRIVE_NAME_ASCII_LEN (sizeof ("ISA Floppy Drive # ") - 1)
#define ADD_FLOPPY_NAME(x) AddName ((x)) #define ADD_FLOPPY_NAME(x) AddName ((x))
extern EFI_COMPONENT_NAME_PROTOCOL gIsaFloppyComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gIsaFloppyComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gIsaFloppyComponentName2;
// //
// 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
IsaFloppyComponentNameGetDriverName ( IsaFloppyComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName OUT CHAR16 **DriverName
) );
/*++
Routine Description:
GC_TODO: Add function description /**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
Arguments: 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.
This - GC_TODO: add argument description @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
Language - GC_TODO: add argument description EFI_COMPONENT_NAME_PROTOCOL instance.
DriverName - GC_TODO: add argument description
Returns: @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.
GC_TODO: add return values @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
IsaFloppyComponentNameGetControllerName ( IsaFloppyComponentNameGetControllerName (
@ -58,27 +149,8 @@ IsaFloppyComponentNameGetControllerName (
IN EFI_HANDLE ChildHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
) );
/*++
Routine Description:
GC_TODO: Add function description
Arguments:
This - GC_TODO: add argument description
ControllerHandle - GC_TODO: add argument description
ChildHandle - GC_TODO: add argument description
Language - GC_TODO: add argument description
ControllerName - GC_TODO: add argument description
Returns:
GC_TODO: add return values
--*/
;
VOID VOID
AddName ( AddName (

View File

@ -59,14 +59,13 @@ InitializeIsaFloppy(
// //
// Install driver model protocol(s). // Install driver model protocol(s).
// //
Status = EfiLibInstallAllDriverProtocols ( Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gFdcControllerDriver, &gFdcControllerDriver,
ImageHandle, ImageHandle,
&gIsaFloppyComponentName, &gIsaFloppyComponentName,
NULL, &gIsaFloppyComponentName2
NULL
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -35,8 +35,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// //
// Driver Binding Externs // Driver Binding Externs
// //
extern EFI_DRIVER_BINDING_PROTOCOL gFdcControllerDriver; extern EFI_DRIVER_BINDING_PROTOCOL gFdcControllerDriver;
extern EFI_COMPONENT_NAME_PROTOCOL gIsaFloppyComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gIsaFloppyComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gIsaFloppyComponentName2;
// //
// define some value // define some value
@ -486,7 +487,7 @@ typedef struct {
// //
// Global Variables // Global Variables
// //
extern EFI_DRIVER_BINDING_PROTOCOL gFdcControllerDriver; extern EFI_DRIVER_BINDING_PROTOCOL gFdcControllerDriver;
// //
// EFI Driver Binding Protocol Functions // EFI Driver Binding Protocol Functions

View File

@ -17,15 +17,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gIsaSerialComponentName = { EFI_COMPONENT_NAME_PROTOCOL gIsaSerialComponentName = {
IsaSerialComponentNameGetDriverName, IsaSerialComponentNameGetDriverName,
IsaSerialComponentNameGetControllerName, IsaSerialComponentNameGetControllerName,
"eng" "eng"
}; };
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gIsaSerialComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) IsaSerialComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) IsaSerialComponentNameGetControllerName,
"en"
};
STATIC EFI_UNICODE_STRING_TABLE mIsaSerialDriverNameTable[] = { STATIC EFI_UNICODE_STRING_TABLE mIsaSerialDriverNameTable[] = {
{ {
"eng", "eng;en",
L"ISA Serial Driver" L"ISA Serial Driver"
}, },
{ {
@ -34,6 +44,45 @@ STATIC EFI_UNICODE_STRING_TABLE mIsaSerialDriverNameTable[] = {
} }
}; };
/**
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
IsaSerialComponentNameGetDriverName ( IsaSerialComponentNameGetDriverName (
@ -41,44 +90,84 @@ IsaSerialComponentNameGetDriverName (
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,
gIsaSerialComponentName.SupportedLanguages, This->SupportedLanguages,
mIsaSerialDriverNameTable, mIsaSerialDriverNameTable,
DriverName DriverName,
(BOOLEAN)(This == &gIsaSerialComponentName)
); );
} }
/**
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
IsaSerialComponentNameGetControllerName ( IsaSerialComponentNameGetControllerName (
@ -88,54 +177,6 @@ IsaSerialComponentNameGetControllerName (
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;
EFI_SERIAL_IO_PROTOCOL *SerialIo; EFI_SERIAL_IO_PROTOCOL *SerialIo;
@ -177,11 +218,12 @@ IsaSerialComponentNameGetControllerName (
// //
SerialDevice = SERIAL_DEV_FROM_THIS (SerialIo); SerialDevice = SERIAL_DEV_FROM_THIS (SerialIo);
return LookupUnicodeString ( return LookupUnicodeString2 (
Language, Language,
gIsaSerialComponentName.SupportedLanguages, This->SupportedLanguages,
SerialDevice->ControllerNameTable, SerialDevice->ControllerNameTable,
ControllerName ControllerName,
(BOOLEAN)(This == &gIsaSerialComponentName)
); );
} }
@ -211,10 +253,19 @@ AddName (
StrCpy (SerialPortName, L"ISA Serial Port # "); StrCpy (SerialPortName, L"ISA Serial Port # ");
SerialPortName[sizeof (SERIAL_PORT_NAME) - 2] = (CHAR16) (L'0' + (UINT8) IsaIo->ResourceList->Device.UID); SerialPortName[sizeof (SERIAL_PORT_NAME) - 2] = (CHAR16) (L'0' + (UINT8) IsaIo->ResourceList->Device.UID);
AddUnicodeString ( AddUnicodeString2 (
"eng", "eng",
gIsaSerialComponentName.SupportedLanguages, gIsaSerialComponentName.SupportedLanguages,
&SerialDevice->ControllerNameTable, &SerialDevice->ControllerNameTable,
(CHAR16 *) SerialPortName (CHAR16 *) SerialPortName,
TRUE
); );
AddUnicodeString2 (
"en",
gIsaSerialComponentName2.SupportedLanguages,
&SerialDevice->ControllerNameTable,
(CHAR16 *) SerialPortName,
FALSE
);
} }

View File

@ -18,49 +18,128 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define SERIAL_PORT_NAME "ISA Serial Port # " #define SERIAL_PORT_NAME "ISA Serial Port # "
#define ADD_SERIAL_NAME(x, y) AddName ((x), (y)) #define ADD_SERIAL_NAME(x, y) AddName ((x), (y))
extern EFI_COMPONENT_NAME_PROTOCOL gIsaSerialComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gIsaSerialComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gIsaSerialComponentName2;
// //
// 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
IsaSerialComponentNameGetDriverName ( IsaSerialComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
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. /**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
Arguments: 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.
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance. @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
Language - A pointer to a three character ISO 639-2 language identifier. EFI_COMPONENT_NAME_PROTOCOL instance.
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: @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.
EFI_SUCCESS - The Unicode string for the Driver specified by This @param ChildHandle[in] The handle of the child controller to retrieve
and the language specified by Language was returned the name of. This is an optional parameter that
in DriverName. may be NULL. It will be NULL for device
EFI_INVALID_PARAMETER - Language is NULL. drivers. It will also be NULL for a bus drivers
EFI_INVALID_PARAMETER - DriverName is NULL. that wish to retrieve the name of the bus
EFI_UNSUPPORTED - The driver specified by This does not support the controller. It will not be NULL for a bus
language specified by Language. 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
IsaSerialComponentNameGetControllerName ( IsaSerialComponentNameGetControllerName (
@ -69,56 +148,8 @@ IsaSerialComponentNameGetControllerName (
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.
--*/
;
VOID VOID
AddName ( AddName (

View File

@ -108,14 +108,13 @@ InitializeIsaSerial (
// //
// Install driver model protocol(s). // Install driver model protocol(s).
// //
Status = EfiLibInstallAllDriverProtocols ( Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gSerialControllerDriver, &gSerialControllerDriver,
ImageHandle, ImageHandle,
&gIsaSerialComponentName, &gIsaSerialComponentName,
NULL, &gIsaSerialComponentName2
NULL
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -36,8 +36,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// //
// Driver Binding Externs // Driver Binding Externs
// //
extern EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver; extern EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver;
extern EFI_COMPONENT_NAME_PROTOCOL gIsaSerialComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gIsaSerialComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gIsaSerialComponentName2;
// //
// Internal Data Structures // Internal Data Structures
@ -116,7 +117,7 @@ typedef struct {
// //
// Globale Variables // Globale Variables
// //
extern EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver; extern EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver;
// //
// Serial Driver Defaults // Serial Driver Defaults

View File

@ -16,6 +16,45 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// //
// 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
Ps2KeyboardComponentNameGetDriverName ( Ps2KeyboardComponentNameGetDriverName (
@ -24,6 +63,75 @@ Ps2KeyboardComponentNameGetDriverName (
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
Ps2KeyboardComponentNameGetControllerName ( Ps2KeyboardComponentNameGetControllerName (
@ -34,18 +142,29 @@ Ps2KeyboardComponentNameGetControllerName (
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gPs2KeyboardComponentName = { EFI_COMPONENT_NAME_PROTOCOL gPs2KeyboardComponentName = {
Ps2KeyboardComponentNameGetDriverName, Ps2KeyboardComponentNameGetDriverName,
Ps2KeyboardComponentNameGetControllerName, Ps2KeyboardComponentNameGetControllerName,
"eng" "eng"
}; };
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gPs2KeyboardComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ps2KeyboardComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ps2KeyboardComponentNameGetControllerName,
"en"
};
static EFI_UNICODE_STRING_TABLE mPs2KeyboardDriverNameTable[] = { static EFI_UNICODE_STRING_TABLE mPs2KeyboardDriverNameTable[] = {
{ {
"eng", "eng;en",
L"PS/2 Keyboard Driver" L"PS/2 Keyboard Driver"
}, },
{ {
@ -54,6 +173,45 @@ static EFI_UNICODE_STRING_TABLE mPs2KeyboardDriverNameTable[] = {
} }
}; };
/**
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
Ps2KeyboardComponentNameGetDriverName ( Ps2KeyboardComponentNameGetDriverName (
@ -61,44 +219,84 @@ Ps2KeyboardComponentNameGetDriverName (
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,
gPs2KeyboardComponentName.SupportedLanguages, This->SupportedLanguages,
mPs2KeyboardDriverNameTable, mPs2KeyboardDriverNameTable,
DriverName DriverName,
(BOOLEAN)(This == &gPs2KeyboardComponentName)
); );
} }
/**
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
Ps2KeyboardComponentNameGetControllerName ( Ps2KeyboardComponentNameGetControllerName (
@ -108,53 +306,6 @@ Ps2KeyboardComponentNameGetControllerName (
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;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn; EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn;
@ -210,10 +361,11 @@ Ps2KeyboardComponentNameGetControllerName (
ConsoleIn = KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (ConIn); ConsoleIn = KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (ConIn);
return LookupUnicodeString ( return LookupUnicodeString2 (
Language, Language,
gPs2KeyboardComponentName.SupportedLanguages, This->SupportedLanguages,
ConsoleIn->ControllerNameTable, ConsoleIn->ControllerNameTable,
ControllerName ControllerName,
(BOOLEAN)(This == &gPs2KeyboardComponentName)
); );
} }

View File

@ -274,12 +274,21 @@ Returns:
} }
ConsoleIn->ControllerNameTable = NULL; ConsoleIn->ControllerNameTable = NULL;
AddUnicodeString ( AddUnicodeString2 (
"eng", "eng",
gPs2KeyboardComponentName.SupportedLanguages, gPs2KeyboardComponentName.SupportedLanguages,
&ConsoleIn->ControllerNameTable, &ConsoleIn->ControllerNameTable,
L"PS/2 Keyboard Device" L"PS/2 Keyboard Device",
TRUE
); );
AddUnicodeString2 (
"en",
gPs2KeyboardComponentName2.SupportedLanguages,
&ConsoleIn->ControllerNameTable,
L"PS/2 Keyboard Device",
FALSE
);
// //
// Install protocol interfaces for the keyboard device. // Install protocol interfaces for the keyboard device.
@ -484,14 +493,13 @@ InitializePs2Keyboard(
// //
// Install driver model protocol(s). // Install driver model protocol(s).
// //
Status = EfiLibInstallAllDriverProtocols ( Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gKeyboardControllerDriver, &gKeyboardControllerDriver,
ImageHandle, ImageHandle,
&gPs2KeyboardComponentName, &gPs2KeyboardComponentName,
NULL, &gPs2KeyboardComponentName2
NULL
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -90,8 +90,9 @@ typedef struct {
// //
// Global Variables // Global Variables
// //
extern EFI_DRIVER_BINDING_PROTOCOL gKeyboardControllerDriver; extern EFI_DRIVER_BINDING_PROTOCOL gKeyboardControllerDriver;
extern EFI_COMPONENT_NAME_PROTOCOL gPs2KeyboardComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gPs2KeyboardComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gPs2KeyboardComponentName2;
// //
// Driver entry point // Driver entry point

View File

@ -16,15 +16,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName = { EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName = {
Ps2MouseComponentNameGetDriverName, Ps2MouseComponentNameGetDriverName,
Ps2MouseComponentNameGetControllerName, Ps2MouseComponentNameGetControllerName,
"eng" "eng"
}; };
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gPs2MouseComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ps2MouseComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ps2MouseComponentNameGetControllerName,
"en"
};
static EFI_UNICODE_STRING_TABLE mPs2MouseDriverNameTable[] = { static EFI_UNICODE_STRING_TABLE mPs2MouseDriverNameTable[] = {
{ {
"eng", "eng;en",
L"PS/2 Mouse Driver" L"PS/2 Mouse Driver"
}, },
{ {
@ -33,6 +43,45 @@ static EFI_UNICODE_STRING_TABLE mPs2MouseDriverNameTable[] = {
} }
}; };
/**
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
Ps2MouseComponentNameGetDriverName ( Ps2MouseComponentNameGetDriverName (
@ -40,44 +89,84 @@ Ps2MouseComponentNameGetDriverName (
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,
gPs2MouseComponentName.SupportedLanguages, This->SupportedLanguages,
mPs2MouseDriverNameTable, mPs2MouseDriverNameTable,
DriverName DriverName,
(BOOLEAN)(This == &gPs2MouseComponentName)
); );
} }
/**
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
Ps2MouseComponentNameGetControllerName ( Ps2MouseComponentNameGetControllerName (
@ -87,53 +176,6 @@ Ps2MouseComponentNameGetControllerName (
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;
EFI_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol; EFI_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol;
@ -188,10 +230,11 @@ Ps2MouseComponentNameGetControllerName (
MouseDev = PS2_MOUSE_DEV_FROM_THIS (SimplePointerProtocol); MouseDev = PS2_MOUSE_DEV_FROM_THIS (SimplePointerProtocol);
return LookupUnicodeString ( return LookupUnicodeString2 (
Language, Language,
gPs2MouseComponentName.SupportedLanguages, This->SupportedLanguages,
MouseDev->ControllerNameTable, MouseDev->ControllerNameTable,
ControllerName ControllerName,
(BOOLEAN)(This == &gPs2MouseComponentName)
); );
} }

View File

@ -294,12 +294,21 @@ Returns:
} }
MouseDev->ControllerNameTable = NULL; MouseDev->ControllerNameTable = NULL;
AddUnicodeString ( AddUnicodeString2 (
"eng", "eng",
gPs2MouseComponentName.SupportedLanguages, gPs2MouseComponentName.SupportedLanguages,
&MouseDev->ControllerNameTable, &MouseDev->ControllerNameTable,
L"PS/2 Mouse Device" L"PS/2 Mouse Device",
TRUE
); );
AddUnicodeString2 (
"en",
gPs2MouseComponentName2.SupportedLanguages,
&MouseDev->ControllerNameTable,
L"PS/2 Mouse Device",
FALSE
);
// //
// Install protocol interfaces for the mouse device. // Install protocol interfaces for the mouse device.
@ -771,14 +780,13 @@ InitializePs2Mouse(
// //
// Install driver model protocol(s). // Install driver model protocol(s).
// //
Status = EfiLibInstallAllDriverProtocols ( Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gPS2MouseDriver, &gPS2MouseDriver,
ImageHandle, ImageHandle,
&gPs2MouseComponentName, &gPs2MouseComponentName,
NULL, &gPs2MouseComponentName2
NULL
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@ -98,8 +98,9 @@ typedef struct {
// //
// Global Variables // Global Variables
// //
extern EFI_DRIVER_BINDING_PROTOCOL gPS2MouseDriver; extern EFI_DRIVER_BINDING_PROTOCOL gPS2MouseDriver;
extern EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gPs2MouseComponentName2;
// //
// Function prototypes // Function prototypes
@ -132,6 +133,45 @@ PS2MouseDriverStop (
// //
// 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
Ps2MouseComponentNameGetDriverName ( Ps2MouseComponentNameGetDriverName (
@ -140,6 +180,75 @@ Ps2MouseComponentNameGetDriverName (
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
Ps2MouseComponentNameGetControllerName ( Ps2MouseComponentNameGetControllerName (
@ -150,6 +259,7 @@ Ps2MouseComponentNameGetControllerName (
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
); );
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
MouseReset ( MouseReset (