From f3d08ccf1aa90ca9185ccd9d2d8a7f35b9472e00 Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Sun, 30 Sep 2007 02:30:46 +0000 Subject: [PATCH] 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 --- .../Bus/Isa/IsaBusDxe/ComponentName.c | 207 +++++++----- .../Bus/Isa/IsaBusDxe/ComponentName.h | 150 ++++++--- .../Bus/Isa/IsaBusDxe/IsaBus.c | 5 +- .../Bus/Isa/IsaFloppyDxe/ComponentName.c | 227 ++++++++----- .../Bus/Isa/IsaFloppyDxe/ComponentName.h | 150 ++++++--- .../Bus/Isa/IsaFloppyDxe/IsaFloppy.c | 5 +- .../Bus/Isa/IsaFloppyDxe/IsaFloppy.h | 7 +- .../Bus/Isa/IsaSerialDxe/ComponentName.c | 227 ++++++++----- .../Bus/Isa/IsaSerialDxe/ComponentName.h | 191 ++++++----- .../Bus/Isa/IsaSerialDxe/Serial.c | 5 +- .../Bus/Isa/IsaSerialDxe/Serial.h | 7 +- .../Bus/Isa/Ps2KeyboardDxe/ComponentName.c | 318 +++++++++++++----- .../Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.c | 18 +- .../Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h | 5 +- .../Bus/Isa/Ps2MouseDxe/ComponentName.c | 213 +++++++----- .../Bus/Isa/Ps2MouseDxe/Ps2Mouse.c | 18 +- .../Bus/Isa/Ps2MouseDxe/Ps2Mouse.h | 114 ++++++- 17 files changed, 1256 insertions(+), 611 deletions(-) diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/ComponentName.c b/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/ComponentName.c index 3d00e70d56..f4d5562a99 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/ComponentName.c +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/ComponentName.c @@ -16,15 +16,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // // EFI Component Name Protocol // -EFI_COMPONENT_NAME_PROTOCOL gIsaBusComponentName = { +EFI_COMPONENT_NAME_PROTOCOL gIsaBusComponentName = { IsaBusComponentNameGetDriverName, IsaBusComponentNameGetControllerName, "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[] = { { - "eng", + "eng;en", 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 EFIAPI IsaBusComponentNameGetDriverName ( @@ -40,41 +89,84 @@ IsaBusComponentNameGetDriverName ( IN CHAR8 *Language, 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 ( - Language, - gIsaBusComponentName.SupportedLanguages, - mIsaBusDriverNameTable, - DriverName - ); + return LookupUnicodeString2 ( + Language, + This->SupportedLanguages, + mIsaBusDriverNameTable, + 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 EFIAPI IsaBusComponentNameGetControllerName ( @@ -84,51 +176,6 @@ IsaBusComponentNameGetControllerName ( IN CHAR8 *Language, 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; } diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/ComponentName.h b/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/ComponentName.h index dc11c11a24..49fd518ed9 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/ComponentName.h +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/ComponentName.h @@ -19,37 +19,128 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // #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_STATUS -EFIAPI -IsaBusComponentNameGetDriverName ( - IN EFI_COMPONENT_NAME_PROTOCOL *This, - IN CHAR8 *Language, - OUT CHAR16 **DriverName - ) -/*++ +/** + Retrieves a Unicode string that is the user readable name of the driver. -Routine Description: + 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. - GC_TODO: Add function description + @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + EFI_COMPONENT_NAME_PROTOCOL instance. -Arguments: + @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. - This - GC_TODO: add argument description - Language - GC_TODO: add argument description - DriverName - GC_TODO: add argument description + @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. -Returns: + @retval EFI_SUCCESS The Unicode string for the Driver specified by + This and the language specified by Language was + returned in DriverName. - GC_TODO: add return values + @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 +EFIAPI +IsaBusComponentNameGetDriverName ( + IN EFI_COMPONENT_NAME_PROTOCOL *This, + IN CHAR8 *Language, + 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 EFIAPI IsaBusComponentNameGetControllerName ( @@ -58,26 +149,7 @@ IsaBusComponentNameGetControllerName ( IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, 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 diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBus.c b/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBus.c index 28ba699044..8e28db2ceb 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBus.c +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBus.c @@ -55,14 +55,13 @@ InitializeIsaBus( // // Install driver model protocol(s). // - Status = EfiLibInstallAllDriverProtocols ( + Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gIsaBusControllerDriver, ImageHandle, &gIsaBusComponentName, - NULL, - NULL + &gIsaBusComponentName2 ); ASSERT_EFI_ERROR (Status); diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/ComponentName.c b/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/ComponentName.c index 0e3e055ae7..961c764d72 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/ComponentName.c +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/ComponentName.c @@ -17,15 +17,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // // EFI Component Name Protocol // -EFI_COMPONENT_NAME_PROTOCOL gIsaFloppyComponentName = { +EFI_COMPONENT_NAME_PROTOCOL gIsaFloppyComponentName = { IsaFloppyComponentNameGetDriverName, IsaFloppyComponentNameGetControllerName, "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[] = { { - "eng", + "eng;en", 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 EFIAPI IsaFloppyComponentNameGetDriverName ( @@ -41,44 +90,84 @@ IsaFloppyComponentNameGetDriverName ( IN CHAR8 *Language, 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, - gIsaFloppyComponentName.SupportedLanguages, + This->SupportedLanguages, 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 EFIAPI IsaFloppyComponentNameGetControllerName ( @@ -88,54 +177,6 @@ IsaFloppyComponentNameGetControllerName ( IN CHAR8 *Language, 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_BLOCK_IO_PROTOCOL *BlkIo; @@ -192,11 +233,12 @@ IsaFloppyComponentNameGetControllerName ( // FdcDev = FDD_BLK_IO_FROM_THIS (BlkIo); - return LookupUnicodeString ( + return LookupUnicodeString2 ( Language, - gIsaFloppyComponentName.SupportedLanguages, + This->SupportedLanguages, FdcDev->ControllerNameTable, - ControllerName + ControllerName, + (BOOLEAN)(This == &gIsaFloppyComponentName) ); } @@ -224,10 +266,19 @@ AddName ( StrCpy (FloppyDriveName, FLOPPY_DRIVE_NAME); FloppyDriveName[FLOPPY_DRIVE_NAME_ASCII_LEN - 1] = (CHAR16) (L'0' + FdcDev->Disk); - AddUnicodeString ( + AddUnicodeString2 ( "eng", gIsaFloppyComponentName.SupportedLanguages, &FdcDev->ControllerNameTable, - FloppyDriveName + FloppyDriveName, + TRUE ); + AddUnicodeString2 ( + "en", + gIsaFloppyComponentName2.SupportedLanguages, + &FdcDev->ControllerNameTable, + FloppyDriveName, + FALSE + ); + } diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/ComponentName.h b/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/ComponentName.h index e80a974463..1d0c27f4b2 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/ComponentName.h +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/ComponentName.h @@ -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 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_STATUS -EFIAPI -IsaFloppyComponentNameGetDriverName ( - IN EFI_COMPONENT_NAME_PROTOCOL *This, - IN CHAR8 *Language, - OUT CHAR16 **DriverName - ) -/*++ +/** + Retrieves a Unicode string that is the user readable name of the driver. -Routine Description: + 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. - GC_TODO: Add function description + @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + EFI_COMPONENT_NAME_PROTOCOL instance. -Arguments: + @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. - This - GC_TODO: add argument description - Language - GC_TODO: add argument description - DriverName - GC_TODO: add argument description + @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. -Returns: + @retval EFI_SUCCESS The Unicode string for the Driver specified by + This and the language specified by Language was + returned in DriverName. - GC_TODO: add return values + @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 +EFIAPI +IsaFloppyComponentNameGetDriverName ( + IN EFI_COMPONENT_NAME_PROTOCOL *This, + IN CHAR8 *Language, + 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 EFIAPI IsaFloppyComponentNameGetControllerName ( @@ -58,27 +149,8 @@ IsaFloppyComponentNameGetControllerName ( IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, 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 AddName ( diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppy.c b/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppy.c index 9b04af057c..26c0e63316 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppy.c +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppy.c @@ -59,14 +59,13 @@ InitializeIsaFloppy( // // Install driver model protocol(s). // - Status = EfiLibInstallAllDriverProtocols ( + Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gFdcControllerDriver, ImageHandle, &gIsaFloppyComponentName, - NULL, - NULL + &gIsaFloppyComponentName2 ); ASSERT_EFI_ERROR (Status); diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppy.h b/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppy.h index 207b21ce6d..7e2af8e06b 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppy.h +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppy.h @@ -35,8 +35,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // // Driver Binding Externs // -extern EFI_DRIVER_BINDING_PROTOCOL gFdcControllerDriver; -extern EFI_COMPONENT_NAME_PROTOCOL gIsaFloppyComponentName; +extern EFI_DRIVER_BINDING_PROTOCOL gFdcControllerDriver; +extern EFI_COMPONENT_NAME_PROTOCOL gIsaFloppyComponentName; +extern EFI_COMPONENT_NAME2_PROTOCOL gIsaFloppyComponentName2; // // define some value @@ -486,7 +487,7 @@ typedef struct { // // Global Variables // -extern EFI_DRIVER_BINDING_PROTOCOL gFdcControllerDriver; +extern EFI_DRIVER_BINDING_PROTOCOL gFdcControllerDriver; // // EFI Driver Binding Protocol Functions diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/ComponentName.c b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/ComponentName.c index 84423a8ba4..4534b53729 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/ComponentName.c +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/ComponentName.c @@ -17,15 +17,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // // EFI Component Name Protocol // -EFI_COMPONENT_NAME_PROTOCOL gIsaSerialComponentName = { +EFI_COMPONENT_NAME_PROTOCOL gIsaSerialComponentName = { IsaSerialComponentNameGetDriverName, IsaSerialComponentNameGetControllerName, "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[] = { { - "eng", + "eng;en", 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 EFIAPI IsaSerialComponentNameGetDriverName ( @@ -41,44 +90,84 @@ IsaSerialComponentNameGetDriverName ( IN CHAR8 *Language, 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, - gIsaSerialComponentName.SupportedLanguages, + This->SupportedLanguages, 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 EFIAPI IsaSerialComponentNameGetControllerName ( @@ -88,54 +177,6 @@ IsaSerialComponentNameGetControllerName ( IN CHAR8 *Language, 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_SERIAL_IO_PROTOCOL *SerialIo; @@ -177,11 +218,12 @@ IsaSerialComponentNameGetControllerName ( // SerialDevice = SERIAL_DEV_FROM_THIS (SerialIo); - return LookupUnicodeString ( + return LookupUnicodeString2 ( Language, - gIsaSerialComponentName.SupportedLanguages, + This->SupportedLanguages, SerialDevice->ControllerNameTable, - ControllerName + ControllerName, + (BOOLEAN)(This == &gIsaSerialComponentName) ); } @@ -211,10 +253,19 @@ AddName ( StrCpy (SerialPortName, L"ISA Serial Port # "); SerialPortName[sizeof (SERIAL_PORT_NAME) - 2] = (CHAR16) (L'0' + (UINT8) IsaIo->ResourceList->Device.UID); - AddUnicodeString ( + AddUnicodeString2 ( "eng", gIsaSerialComponentName.SupportedLanguages, &SerialDevice->ControllerNameTable, - (CHAR16 *) SerialPortName + (CHAR16 *) SerialPortName, + TRUE ); + AddUnicodeString2 ( + "en", + gIsaSerialComponentName2.SupportedLanguages, + &SerialDevice->ControllerNameTable, + (CHAR16 *) SerialPortName, + FALSE + ); + } diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/ComponentName.h b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/ComponentName.h index 51c928ed20..cd81921687 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/ComponentName.h +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/ComponentName.h @@ -18,49 +18,128 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define SERIAL_PORT_NAME "ISA Serial Port # " #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_STATUS -EFIAPI -IsaSerialComponentNameGetDriverName ( - IN EFI_COMPONENT_NAME_PROTOCOL *This, - IN CHAR8 *Language, - OUT CHAR16 **DriverName - ) -/*++ +/** + Retrieves a Unicode string that is the user readable name of the driver. - Routine Description: + 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. - Retrieves a Unicode string that is the user readable name of the EFI Driver. + @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + EFI_COMPONENT_NAME_PROTOCOL instance. - Arguments: + @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. - 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. + @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. - Returns: + @retval EFI_SUCCESS The Unicode string for the Driver specified by + This and the language specified by Language was + returned in DriverName. - 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. + @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 +EFIAPI +IsaSerialComponentNameGetDriverName ( + IN EFI_COMPONENT_NAME_PROTOCOL *This, + IN CHAR8 *Language, + 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 EFIAPI IsaSerialComponentNameGetControllerName ( @@ -69,56 +148,8 @@ IsaSerialComponentNameGetControllerName ( IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, 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 AddName ( diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c index 846d863c30..134b0fd8a8 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c @@ -108,14 +108,13 @@ InitializeIsaSerial ( // // Install driver model protocol(s). // - Status = EfiLibInstallAllDriverProtocols ( + Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gSerialControllerDriver, ImageHandle, &gIsaSerialComponentName, - NULL, - NULL + &gIsaSerialComponentName2 ); ASSERT_EFI_ERROR (Status); diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.h b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.h index 0fcc4f3fb0..980e0d17c2 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.h +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.h @@ -36,8 +36,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // // Driver Binding Externs // -extern EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver; -extern EFI_COMPONENT_NAME_PROTOCOL gIsaSerialComponentName; +extern EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver; +extern EFI_COMPONENT_NAME_PROTOCOL gIsaSerialComponentName; +extern EFI_COMPONENT_NAME2_PROTOCOL gIsaSerialComponentName2; // // Internal Data Structures @@ -116,7 +117,7 @@ typedef struct { // // Globale Variables // -extern EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver; +extern EFI_DRIVER_BINDING_PROTOCOL gSerialControllerDriver; // // Serial Driver Defaults diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/ComponentName.c b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/ComponentName.c index 523420bdaf..8168665321 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/ComponentName.c +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/ComponentName.c @@ -16,6 +16,45 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // // 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 EFIAPI Ps2KeyboardComponentNameGetDriverName ( @@ -24,6 +63,75 @@ Ps2KeyboardComponentNameGetDriverName ( 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 EFIAPI Ps2KeyboardComponentNameGetControllerName ( @@ -34,18 +142,29 @@ Ps2KeyboardComponentNameGetControllerName ( OUT CHAR16 **ControllerName ); + // // EFI Component Name Protocol // -EFI_COMPONENT_NAME_PROTOCOL gPs2KeyboardComponentName = { +EFI_COMPONENT_NAME_PROTOCOL gPs2KeyboardComponentName = { Ps2KeyboardComponentNameGetDriverName, Ps2KeyboardComponentNameGetControllerName, "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[] = { { - "eng", + "eng;en", 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 EFIAPI Ps2KeyboardComponentNameGetDriverName ( @@ -61,44 +219,84 @@ Ps2KeyboardComponentNameGetDriverName ( IN CHAR8 *Language, OUT CHAR16 **DriverName ) -/*++ +{ + return LookupUnicodeString2 ( + Language, + This->SupportedLanguages, + mPs2KeyboardDriverNameTable, + DriverName, + (BOOLEAN)(This == &gPs2KeyboardComponentName) + ); +} - Routine Description: +/** + Retrieves a Unicode string that is the user readable name of the controller + that is being managed by a driver. - Retrieves a Unicode string that is the user readable name of the EFI 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. - Arguments: + @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + EFI_COMPONENT_NAME_PROTOCOL instance. - 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. + @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. - Returns: + @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. - 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. + @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. ---*/ -{ - return LookupUnicodeString ( - Language, - gPs2KeyboardComponentName.SupportedLanguages, - mPs2KeyboardDriverNameTable, - DriverName - ); -} + @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 EFIAPI Ps2KeyboardComponentNameGetControllerName ( @@ -108,53 +306,6 @@ Ps2KeyboardComponentNameGetControllerName ( IN CHAR8 *Language, 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_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn; @@ -210,10 +361,11 @@ Ps2KeyboardComponentNameGetControllerName ( ConsoleIn = KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (ConIn); - return LookupUnicodeString ( + return LookupUnicodeString2 ( Language, - gPs2KeyboardComponentName.SupportedLanguages, + This->SupportedLanguages, ConsoleIn->ControllerNameTable, - ControllerName + ControllerName, + (BOOLEAN)(This == &gPs2KeyboardComponentName) ); } diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.c b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.c index ab240acf70..4e39fa06d6 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.c +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.c @@ -274,12 +274,21 @@ Returns: } ConsoleIn->ControllerNameTable = NULL; - AddUnicodeString ( + AddUnicodeString2 ( "eng", gPs2KeyboardComponentName.SupportedLanguages, &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. @@ -484,14 +493,13 @@ InitializePs2Keyboard( // // Install driver model protocol(s). // - Status = EfiLibInstallAllDriverProtocols ( + Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gKeyboardControllerDriver, ImageHandle, &gPs2KeyboardComponentName, - NULL, - NULL + &gPs2KeyboardComponentName2 ); ASSERT_EFI_ERROR (Status); diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h index 2368841d81..4f1080fe1b 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h @@ -90,8 +90,9 @@ typedef struct { // // Global Variables // -extern EFI_DRIVER_BINDING_PROTOCOL gKeyboardControllerDriver; -extern EFI_COMPONENT_NAME_PROTOCOL gPs2KeyboardComponentName; +extern EFI_DRIVER_BINDING_PROTOCOL gKeyboardControllerDriver; +extern EFI_COMPONENT_NAME_PROTOCOL gPs2KeyboardComponentName; +extern EFI_COMPONENT_NAME2_PROTOCOL gPs2KeyboardComponentName2; // // Driver entry point diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/ComponentName.c b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/ComponentName.c index 0180879923..57d8fe23f8 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/ComponentName.c +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/ComponentName.c @@ -16,15 +16,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // // EFI Component Name Protocol // -EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName = { +EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName = { Ps2MouseComponentNameGetDriverName, Ps2MouseComponentNameGetControllerName, "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[] = { { - "eng", + "eng;en", 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 EFIAPI Ps2MouseComponentNameGetDriverName ( @@ -40,44 +89,84 @@ Ps2MouseComponentNameGetDriverName ( IN CHAR8 *Language, 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, - gPs2MouseComponentName.SupportedLanguages, + This->SupportedLanguages, 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 EFIAPI Ps2MouseComponentNameGetControllerName ( @@ -87,53 +176,6 @@ Ps2MouseComponentNameGetControllerName ( IN CHAR8 *Language, 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_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol; @@ -188,10 +230,11 @@ Ps2MouseComponentNameGetControllerName ( MouseDev = PS2_MOUSE_DEV_FROM_THIS (SimplePointerProtocol); - return LookupUnicodeString ( + return LookupUnicodeString2 ( Language, - gPs2MouseComponentName.SupportedLanguages, + This->SupportedLanguages, MouseDev->ControllerNameTable, - ControllerName + ControllerName, + (BOOLEAN)(This == &gPs2MouseComponentName) ); } diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.c b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.c index bd4f7eb114..e500180597 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.c +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.c @@ -294,12 +294,21 @@ Returns: } MouseDev->ControllerNameTable = NULL; - AddUnicodeString ( + AddUnicodeString2 ( "eng", gPs2MouseComponentName.SupportedLanguages, &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. @@ -771,14 +780,13 @@ InitializePs2Mouse( // // Install driver model protocol(s). // - Status = EfiLibInstallAllDriverProtocols ( + Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gPS2MouseDriver, ImageHandle, &gPs2MouseComponentName, - NULL, - NULL + &gPs2MouseComponentName2 ); ASSERT_EFI_ERROR (Status); diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.h b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.h index b1932fe9eb..9a1a3040aa 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.h +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.h @@ -98,8 +98,9 @@ typedef struct { // // Global Variables // -extern EFI_DRIVER_BINDING_PROTOCOL gPS2MouseDriver; -extern EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName; +extern EFI_DRIVER_BINDING_PROTOCOL gPS2MouseDriver; +extern EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName; +extern EFI_COMPONENT_NAME2_PROTOCOL gPs2MouseComponentName2; // // Function prototypes @@ -132,6 +133,45 @@ PS2MouseDriverStop ( // // 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 EFIAPI Ps2MouseComponentNameGetDriverName ( @@ -140,6 +180,75 @@ Ps2MouseComponentNameGetDriverName ( 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 EFIAPI Ps2MouseComponentNameGetControllerName ( @@ -150,6 +259,7 @@ Ps2MouseComponentNameGetControllerName ( OUT CHAR16 **ControllerName ); + EFI_STATUS EFIAPI MouseReset ( -- 2.39.2