1772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff/** @file 23e8c18da0441069591e5aa218f378001b29512ddjgong 3216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfuCopyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR> 4e5eed7d3641d71d7ea539e5379ea9c6a5cd97004hhtianThis program and the accompanying materials 5772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffare licensed and made available under the terms and conditions of the BSD License 63e8c18da0441069591e5aa218f378001b29512ddjgongwhich accompanies this distribution. The full text of the license may be found at<BR> 7772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffhttp://opensource.org/licenses/bsd-license.php 8772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff 9772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff 12772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff**/ 13772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff 14772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff#include "Ip4Impl.h" 15772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff 16772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff// 17772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff// EFI Component Name Functions 18772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff// 1983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang/** 2083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang Retrieves a Unicode string that is the user readable name of the driver. 2183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 2283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang This function retrieves the user readable name of a driver in the form of a 2383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang Unicode string. If the driver specified by This has a user readable name in 2483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang the language specified by Language, then a pointer to the driver name is 2583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang returned in DriverName, and EFI_SUCCESS is returned. If the driver specified 2683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang by This does not support the language specified by Language, 2783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang then EFI_UNSUPPORTED is returned. 2883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 293e8c18da0441069591e5aa218f378001b29512ddjgong @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or 3083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang EFI_COMPONENT_NAME_PROTOCOL instance. 3183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 323e8c18da0441069591e5aa218f378001b29512ddjgong @param[in] Language A pointer to a Null-terminated ASCII string 3383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang array indicating the language. This is the 3483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang language of the driver name that the caller is 3583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang requesting, and it must match one of the 3683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang languages specified in SupportedLanguages. The 3783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang number of languages supported by a driver is up 3883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang to the driver writer. Language is specified 390254efc01e461445240512ae1a1c2fc48ed2f70egikidy in RFC 4646 or ISO 639-2 language code format. 4083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 413e8c18da0441069591e5aa218f378001b29512ddjgong @param[out] DriverName A pointer to the Unicode string to return. 4283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang This Unicode string is the name of the 4383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang driver specified by This in the language 4483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang specified by Language. 4583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 4683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_SUCCESS The Unicode string for the Driver specified by 4783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang This and the language specified by Language was 4883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang returned in DriverName. 4983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 5083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_INVALID_PARAMETER Language is NULL. 5183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 5283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_INVALID_PARAMETER DriverName is NULL. 5383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 5483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_UNSUPPORTED The driver specified by This does not support 5583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang the language specified by Language. 5683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 5783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang**/ 58772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffEFI_STATUS 59772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffEFIAPI 60772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffIp4ComponentNameGetDriverName ( 61772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff IN EFI_COMPONENT_NAME_PROTOCOL *This, 62772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff IN CHAR8 *Language, 63772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff OUT CHAR16 **DriverName 64772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff ); 65772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff 6683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 6783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang/** 6883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang Retrieves a Unicode string that is the user readable name of the controller 6983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang that is being managed by a driver. 7083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 7183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang This function retrieves the user readable name of the controller specified by 7283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang ControllerHandle and ChildHandle in the form of a Unicode string. If the 7383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang driver specified by This has a user readable name in the language specified by 7483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang Language, then a pointer to the controller name is returned in ControllerName, 7583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang and EFI_SUCCESS is returned. If the driver specified by This is not currently 7683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang managing the controller specified by ControllerHandle and ChildHandle, 7783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang then EFI_UNSUPPORTED is returned. If the driver specified by This does not 7883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang support the language specified by Language, then EFI_UNSUPPORTED is returned. 7983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 803e8c18da0441069591e5aa218f378001b29512ddjgong @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or 8183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang EFI_COMPONENT_NAME_PROTOCOL instance. 8283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 833e8c18da0441069591e5aa218f378001b29512ddjgong @param[in] ControllerHandle The handle of a controller that the driver 8483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang specified by This is managing. This handle 8583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang specifies the controller whose name is to be 8683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang returned. 8783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 883e8c18da0441069591e5aa218f378001b29512ddjgong @param[in] ChildHandle The handle of the child controller to retrieve 8983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang the name of. This is an optional parameter that 9083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang may be NULL. It will be NULL for device 9183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang drivers. It will also be NULL for a bus drivers 9283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang that wish to retrieve the name of the bus 9383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang controller. It will not be NULL for a bus 9483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang driver that wishes to retrieve the name of a 9583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang child controller. 9683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 973e8c18da0441069591e5aa218f378001b29512ddjgong @param[in] Language A pointer to a Null-terminated ASCII string 9883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang array indicating the language. This is the 9983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang language of the driver name that the caller is 10083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang requesting, and it must match one of the 10183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang languages specified in SupportedLanguages. The 10283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang number of languages supported by a driver is up 10383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang to the driver writer. Language is specified in 1040254efc01e461445240512ae1a1c2fc48ed2f70egikidy RFC 4646 or ISO 639-2 language code format. 10583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 1063e8c18da0441069591e5aa218f378001b29512ddjgong @param[out] ControllerName A pointer to the Unicode string to return. 10783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang This Unicode string is the name of the 10883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang controller specified by ControllerHandle and 10983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang ChildHandle in the language specified by 11083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang Language from the point of view of the driver 11183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang specified by This. 11283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 11383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_SUCCESS The Unicode string for the user readable name in 11483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang the language specified by Language for the 11583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang driver specified by This was returned in 11683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang DriverName. 11783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 118284ee2e829ab2453293b7dc4539727ad6c047163niruiyu @retval EFI_INVALID_PARAMETER ControllerHandle is NULL. 11983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 12083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid 12183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang EFI_HANDLE. 12283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 12383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_INVALID_PARAMETER Language is NULL. 12483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 12583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_INVALID_PARAMETER ControllerName is NULL. 12683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 12783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_UNSUPPORTED The driver specified by This is not currently 12883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang managing the controller specified by 12983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang ControllerHandle and ChildHandle. 13083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 13183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_UNSUPPORTED The driver specified by This does not support 13283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang the language specified by Language. 13383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 13483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang**/ 135772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffEFI_STATUS 136772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffEFIAPI 137772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffIp4ComponentNameGetControllerName ( 138772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff IN EFI_COMPONENT_NAME_PROTOCOL *This, 139772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff IN EFI_HANDLE ControllerHandle, 140772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff IN EFI_HANDLE ChildHandle OPTIONAL, 141772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff IN CHAR8 *Language, 142772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff OUT CHAR16 **ControllerName 143772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff ); 144772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff 14583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 146772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff// 147772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff// EFI Component Name Protocol 148772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff// 1491307dcd745881377355a2e7fba53ff9184e92657qhuangGLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gIp4ComponentName = { 150772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff Ip4ComponentNameGetDriverName, 151772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff Ip4ComponentNameGetControllerName, 152772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff "eng" 1531307dcd745881377355a2e7fba53ff9184e92657qhuang}; 15483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 15583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang// 15683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang// EFI Component Name 2 Protocol 15783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang// 1581307dcd745881377355a2e7fba53ff9184e92657qhuangGLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gIp4ComponentName2 = { 15983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Ip4ComponentNameGetDriverName, 16083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Ip4ComponentNameGetControllerName, 16183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang "en" 1621307dcd745881377355a2e7fba53ff9184e92657qhuang}; 16383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 164772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff 165d1aeb0bdc36f6bece71a2b0fd3684857d11a867bqhuangGLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIp4DriverNameTable[] = { 166772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff { 16783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang "eng;en", 168772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff L"IP4 Network Service Driver" 169772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff }, 170772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff { 171772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff NULL, 172772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff NULL 173772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff } 174772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff}; 175772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff 176216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfuGLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gIp4ControllerNameTable = NULL; 177216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 17883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang/** 17983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang Retrieves a Unicode string that is the user readable name of the driver. 18083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 18183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang This function retrieves the user readable name of a driver in the form of a 18283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang Unicode string. If the driver specified by This has a user readable name in 18383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang the language specified by Language, then a pointer to the driver name is 18483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang returned in DriverName, and EFI_SUCCESS is returned. If the driver specified 18583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang by This does not support the language specified by Language, 18683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang then EFI_UNSUPPORTED is returned. 18783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 1883e8c18da0441069591e5aa218f378001b29512ddjgong @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or 18983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang EFI_COMPONENT_NAME_PROTOCOL instance. 19083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 1913e8c18da0441069591e5aa218f378001b29512ddjgong @param[in] Language A pointer to a Null-terminated ASCII string 19283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang array indicating the language. This is the 19383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang language of the driver name that the caller is 19483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang requesting, and it must match one of the 19583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang languages specified in SupportedLanguages. The 19683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang number of languages supported by a driver is up 19783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang to the driver writer. Language is specified 1980254efc01e461445240512ae1a1c2fc48ed2f70egikidy in RFC 4646 or ISO 639-2 language code format. 19983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 2003e8c18da0441069591e5aa218f378001b29512ddjgong @param[out] DriverName A pointer to the Unicode string to return. 20183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang This Unicode string is the name of the 20283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang driver specified by This in the language 20383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang specified by Language. 20483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 20583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_SUCCESS The Unicode string for the Driver specified by 20683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang This and the language specified by Language was 20783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang returned in DriverName. 20883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 20983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_INVALID_PARAMETER Language is NULL. 21083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 21183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_INVALID_PARAMETER DriverName is NULL. 21283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 21383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_UNSUPPORTED The driver specified by This does not support 21483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang the language specified by Language. 21583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 21683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang**/ 217772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffEFI_STATUS 218772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffEFIAPI 219772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffIp4ComponentNameGetDriverName ( 220772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff IN EFI_COMPONENT_NAME_PROTOCOL *This, 221772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff IN CHAR8 *Language, 222772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff OUT CHAR16 **DriverName 223772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff ) 224772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff{ 22583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang return LookupUnicodeString2 ( 22683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang Language, 22783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang This->SupportedLanguages, 22883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang mIp4DriverNameTable, 22983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang DriverName, 23083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang (BOOLEAN)(This == &gIp4ComponentName) 23183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang ); 232772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff 233772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff} 234772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff 23583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang/** 236216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu Update the component name for the IP4 child handle. 237216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 238216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu @param Ip4[in] A pointer to the EFI_IP4_PROTOCOL. 239216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 240216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 241216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu @retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully. 242216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu @retval EFI_INVALID_PARAMETER The input parameter is invalid. 243216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 244216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu**/ 245216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfuEFI_STATUS 246216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfuUpdateName ( 247216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu IN EFI_IP4_PROTOCOL *Ip4 248216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu ) 249216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu{ 250216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu EFI_STATUS Status; 251216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu CHAR16 HandleName[80]; 252216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu EFI_IP4_MODE_DATA Ip4ModeData; 253216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 254216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu if (Ip4 == NULL) { 255216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu return EFI_INVALID_PARAMETER; 256216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu } 257216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 258216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // 259216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // Format the child name into the string buffer as: 260216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // IPv4 (SrcIP=127.0.0.1, DestIP=127.0.0.1) 261216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // 262216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu Status = Ip4->GetModeData (Ip4, &Ip4ModeData, NULL, NULL); 263216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu if (EFI_ERROR (Status)) { 264216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu return Status; 265216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu } 266216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 267216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu if (!Ip4ModeData.IsStarted || !Ip4ModeData.IsConfigured) { 268216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu UnicodeSPrint (HandleName, sizeof (HandleName), L"IPv4 (Not started)"); 269216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu } else { 270216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu UnicodeSPrint (HandleName, sizeof (HandleName), 271216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu L"IPv4 (SrcIP=%d.%d.%d.%d)", 272216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu Ip4ModeData.ConfigData.StationAddress.Addr[0], 273216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu Ip4ModeData.ConfigData.StationAddress.Addr[1], 274216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu Ip4ModeData.ConfigData.StationAddress.Addr[2], 275216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu Ip4ModeData.ConfigData.StationAddress.Addr[3] 276216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu ); 277216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu } 278216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 279216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu if (gIp4ControllerNameTable != NULL) { 280216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu FreeUnicodeStringTable (gIp4ControllerNameTable); 281216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu gIp4ControllerNameTable = NULL; 282216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu } 283216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu Status = AddUnicodeString2 ( 284216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu "eng", 285216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu gIp4ComponentName.SupportedLanguages, 286216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu &gIp4ControllerNameTable, 287216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu HandleName, 288216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu TRUE 289216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu ); 290216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu if (EFI_ERROR (Status)) { 291216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu return Status; 292216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu } 293216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 294216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu return AddUnicodeString2 ( 295216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu "en", 296216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu gIp4ComponentName2.SupportedLanguages, 297216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu &gIp4ControllerNameTable, 298216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu HandleName, 299216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu FALSE 300216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu ); 301216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu} 302216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 303216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu/** 30483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang Retrieves a Unicode string that is the user readable name of the controller 30583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang that is being managed by a driver. 30683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 30783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang This function retrieves the user readable name of the controller specified by 30883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang ControllerHandle and ChildHandle in the form of a Unicode string. If the 30983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang driver specified by This has a user readable name in the language specified by 31083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang Language, then a pointer to the controller name is returned in ControllerName, 31183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang and EFI_SUCCESS is returned. If the driver specified by This is not currently 31283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang managing the controller specified by ControllerHandle and ChildHandle, 31383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang then EFI_UNSUPPORTED is returned. If the driver specified by This does not 31483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang support the language specified by Language, then EFI_UNSUPPORTED is returned. 31583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 3163e8c18da0441069591e5aa218f378001b29512ddjgong @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or 31783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang EFI_COMPONENT_NAME_PROTOCOL instance. 31883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 3193e8c18da0441069591e5aa218f378001b29512ddjgong @param[in] ControllerHandle The handle of a controller that the driver 32083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang specified by This is managing. This handle 32183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang specifies the controller whose name is to be 32283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang returned. 32383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 3243e8c18da0441069591e5aa218f378001b29512ddjgong @param[in] ChildHandle The handle of the child controller to retrieve 32583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang the name of. This is an optional parameter that 32683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang may be NULL. It will be NULL for device 32783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang drivers. It will also be NULL for a bus drivers 32883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang that wish to retrieve the name of the bus 32983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang controller. It will not be NULL for a bus 33083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang driver that wishes to retrieve the name of a 33183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang child controller. 33283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 3333e8c18da0441069591e5aa218f378001b29512ddjgong @param[in] Language A pointer to a Null-terminated ASCII string 33483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang array indicating the language. This is the 33583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang language of the driver name that the caller is 33683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang requesting, and it must match one of the 33783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang languages specified in SupportedLanguages. The 33883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang number of languages supported by a driver is up 33983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang to the driver writer. Language is specified in 3400254efc01e461445240512ae1a1c2fc48ed2f70egikidy RFC 4646 or ISO 639-2 language code format. 34183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 3423e8c18da0441069591e5aa218f378001b29512ddjgong @param[out] ControllerName A pointer to the Unicode string to return. 34383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang This Unicode string is the name of the 34483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang controller specified by ControllerHandle and 34583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang ChildHandle in the language specified by 34683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang Language from the point of view of the driver 34783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang specified by This. 34883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 34983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_SUCCESS The Unicode string for the user readable name in 35083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang the language specified by Language for the 35183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang driver specified by This was returned in 35283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang DriverName. 35383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 354284ee2e829ab2453293b7dc4539727ad6c047163niruiyu @retval EFI_INVALID_PARAMETER ControllerHandle is NULL. 35583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 35683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid 35783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang EFI_HANDLE. 35883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 35983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_INVALID_PARAMETER Language is NULL. 36083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 36183cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_INVALID_PARAMETER ControllerName is NULL. 36283cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 36383cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_UNSUPPORTED The driver specified by This is not currently 36483cbd279b64f3081af5c06d50fa26e15a99fc066qhuang managing the controller specified by 36583cbd279b64f3081af5c06d50fa26e15a99fc066qhuang ControllerHandle and ChildHandle. 36683cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 36783cbd279b64f3081af5c06d50fa26e15a99fc066qhuang @retval EFI_UNSUPPORTED The driver specified by This does not support 36883cbd279b64f3081af5c06d50fa26e15a99fc066qhuang the language specified by Language. 36983cbd279b64f3081af5c06d50fa26e15a99fc066qhuang 37083cbd279b64f3081af5c06d50fa26e15a99fc066qhuang**/ 371772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffEFI_STATUS 372772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffEFIAPI 373772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeffIp4ComponentNameGetControllerName ( 374772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff IN EFI_COMPONENT_NAME_PROTOCOL *This, 375772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff IN EFI_HANDLE ControllerHandle, 376772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff IN EFI_HANDLE ChildHandle OPTIONAL, 377772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff IN CHAR8 *Language, 378772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff OUT CHAR16 **ControllerName 379772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff ) 380772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff{ 381216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu EFI_STATUS Status; 382216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu EFI_IP4_PROTOCOL *Ip4; 383216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 384216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // 385216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // Only provide names for child handles. 386216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // 387216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu if (ChildHandle == NULL) { 388216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu return EFI_UNSUPPORTED; 389216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu } 390216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 391216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // 392216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // Make sure this driver produced ChildHandle 393216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // 394216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu Status = EfiTestChildHandle ( 395216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu ControllerHandle, 396216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu ChildHandle, 397216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu &gEfiManagedNetworkProtocolGuid 398216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu ); 399216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu if (EFI_ERROR (Status)) { 400216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu return Status; 401216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu } 402216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 403216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // 404216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // Retrieve an instance of a produced protocol from ChildHandle 405216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // 406216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu Status = gBS->OpenProtocol ( 407216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu ChildHandle, 408216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu &gEfiIp4ProtocolGuid, 409216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu (VOID **)&Ip4, 410216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu NULL, 411216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu NULL, 412216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu EFI_OPEN_PROTOCOL_GET_PROTOCOL 413216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu ); 414216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu if (EFI_ERROR (Status)) { 415216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu return Status; 416216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu } 417216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 418216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // 419216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // Update the component name for this child handle. 420216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu // 421216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu Status = UpdateName (Ip4); 422216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu if (EFI_ERROR (Status)) { 423216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu return Status; 424216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu } 425216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 426216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu return LookupUnicodeString2 ( 427216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu Language, 428216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu This->SupportedLanguages, 429216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu gIp4ControllerNameTable, 430216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu ControllerName, 431216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu (BOOLEAN)(This == &gIp4ComponentName) 432216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu ); 433772db4bb33ae66fa20e39f786b5f80d107d450a5vanjeff} 434216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8sfu 435