1 /** @file 2 UEFI Component Name(2) protocol implementation. 3 4 Copyright (c) 2011, Intel Corporation 5 All rights reserved. This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 **/ 14 15 #include "Ax88772.h" 16 17 /** 18 EFI Component Name Protocol declaration 19 **/ 20 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gComponentName = { 21 GetDriverName, 22 GetControllerName, 23 "eng" 24 }; 25 26 /** 27 EFI Component Name 2 Protocol declaration 28 **/ 29 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 = { 30 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) GetDriverName, 31 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) GetControllerName, 32 "en" 33 }; 34 35 36 /** 37 Driver name table declaration 38 **/ 39 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE 40 mDriverNameTable[] = { 41 {"eng;en", L"ASIX AX88772B Ethernet Driver 1.0"}, 42 {NULL, NULL} 43 }; 44 45 /** 46 Retrieves a Unicode string that is the user readable name of the driver. 47 48 This function retrieves the user readable name of a driver in the form of a 49 Unicode string. If the driver specified by This has a user readable name in 50 the language specified by Language, then a pointer to the driver name is 51 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified 52 by This does not support the language specified by Language, 53 then EFI_UNSUPPORTED is returned. 54 55 @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or 56 EFI_COMPONENT_NAME_PROTOCOL instance. 57 @param [in] pLanguage A pointer to a Null-terminated ASCII string 58 array indicating the language. This is the 59 language of the driver name that the caller is 60 requesting, and it must match one of the 61 languages specified in SupportedLanguages. The 62 number of languages supported by a driver is up 63 to the driver writer. Language is specified 64 in RFC 3066 or ISO 639-2 language code format. 65 @param [out] ppDriverName A pointer to the Unicode string to return. 66 This Unicode string is the name of the 67 driver specified by This in the language 68 specified by Language. 69 70 @retval EFI_SUCCESS The Unicode string for the Driver specified by 71 This and the language specified by Language was 72 returned in DriverName. 73 @retval EFI_INVALID_PARAMETER Language is NULL. 74 @retval EFI_INVALID_PARAMETER DriverName is NULL. 75 @retval EFI_UNSUPPORTED The driver specified by This does not support 76 the language specified by Language. 77 78 **/ 79 EFI_STATUS 80 EFIAPI 81 GetDriverName ( 82 IN EFI_COMPONENT_NAME_PROTOCOL * pThis, 83 IN CHAR8 * pLanguage, 84 OUT CHAR16 ** ppDriverName 85 ) 86 { 87 EFI_STATUS Status; 88 89 Status = LookupUnicodeString2 ( 90 pLanguage, 91 pThis->SupportedLanguages, 92 mDriverNameTable, 93 ppDriverName, 94 (BOOLEAN)(pThis == &gComponentName) 95 ); 96 97 return Status; 98 } 99 100 /** 101 Retrieves a Unicode string that is the user readable name of the controller 102 that is being managed by a driver. 103 104 This function retrieves the user readable name of the controller specified by 105 ControllerHandle and ChildHandle in the form of a Unicode string. If the 106 driver specified by This has a user readable name in the language specified by 107 Language, then a pointer to the controller name is returned in ControllerName, 108 and EFI_SUCCESS is returned. If the driver specified by This is not currently 109 managing the controller specified by ControllerHandle and ChildHandle, 110 then EFI_UNSUPPORTED is returned. If the driver specified by This does not 111 support the language specified by Language, then EFI_UNSUPPORTED is returned. 112 113 @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or 114 EFI_COMPONENT_NAME_PROTOCOL instance. 115 @param [in] ControllerHandle The handle of a controller that the driver 116 specified by This is managing. This handle 117 specifies the controller whose name is to be 118 returned. 119 @param [in] ChildHandle The handle of the child controller to retrieve 120 the name of. This is an optional parameter that 121 may be NULL. It will be NULL for device 122 drivers. It will also be NULL for a bus drivers 123 that wish to retrieve the name of the bus 124 controller. It will not be NULL for a bus 125 driver that wishes to retrieve the name of a 126 child controller. 127 @param [in] pLanguage A pointer to a Null-terminated ASCII string 128 array indicating the language. This is the 129 language of the driver name that the caller is 130 requesting, and it must match one of the 131 languages specified in SupportedLanguages. The 132 number of languages supported by a driver is up 133 to the driver writer. Language is specified in 134 RFC 3066 or ISO 639-2 language code format. 135 @param [out] ppControllerName A pointer to the Unicode string to return. 136 This Unicode string is the name of the 137 controller specified by ControllerHandle and 138 ChildHandle in the language specified by 139 Language from the point of view of the driver 140 specified by This. 141 142 @retval EFI_SUCCESS The Unicode string for the user readable name in 143 the language specified by Language for the 144 driver specified by This was returned in 145 DriverName. 146 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. 147 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid 148 EFI_HANDLE. 149 @retval EFI_INVALID_PARAMETER Language is NULL. 150 @retval EFI_INVALID_PARAMETER ControllerName is NULL. 151 @retval EFI_UNSUPPORTED The driver specified by This is not currently 152 managing the controller specified by 153 ControllerHandle and ChildHandle. 154 @retval EFI_UNSUPPORTED The driver specified by This does not support 155 the language specified by Language. 156 157 **/ 158 EFI_STATUS 159 EFIAPI 160 GetControllerName ( 161 IN EFI_COMPONENT_NAME_PROTOCOL * pThis, 162 IN EFI_HANDLE ControllerHandle, 163 IN OPTIONAL EFI_HANDLE ChildHandle, 164 IN CHAR8 * pLanguage, 165 OUT CHAR16 ** ppControllerName 166 ) 167 { 168 EFI_STATUS Status; 169 170 // 171 // Set the controller name 172 // 173 *ppControllerName = L"ASIX AX88772B USB Fast Ethernet Controller"; 174 Status = EFI_SUCCESS; 175 176 // 177 // Return the operation status 178 // 179 180 return Status; 181 } 182