1 /** @file 2 UEFI Component Name(2) protocol implementation for the generic GOP driver. 3 4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> 5 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 16 #include <PiDxe.h> 17 #include <Library/UefiLib.h> 18 19 extern EFI_COMPONENT_NAME_PROTOCOL mGraphicsOutputComponentName; 20 extern EFI_COMPONENT_NAME2_PROTOCOL mGraphicsOutputComponentName2; 21 22 // 23 // Driver name table for GraphicsOutput module. 24 // It is shared by the implementation of ComponentName & ComponentName2 Protocol. 25 // 26 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mGraphicsOutputDriverNameTable[] = { 27 { 28 "eng;en", 29 L"Generic Graphics Output Driver" 30 }, 31 { 32 NULL, 33 NULL 34 } 35 }; 36 37 /** 38 Retrieves a Unicode string that is the user readable name of the driver. 39 40 This function retrieves the user readable name of a driver in the form of a 41 Unicode string. If the driver specified by This has a user readable name in 42 the language specified by Language, then a pointer to the driver name is 43 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified 44 by This does not support the language specified by Language, 45 then EFI_UNSUPPORTED is returned. 46 47 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or 48 EFI_COMPONENT_NAME_PROTOCOL instance. 49 50 @param Language[in] A pointer to a Null-terminated ASCII string 51 array indicating the language. This is the 52 language of the driver name that the caller is 53 requesting, and it must match one of the 54 languages specified in SupportedLanguages. The 55 number of languages supported by a driver is up 56 to the driver writer. Language is specified 57 in RFC 4646 or ISO 639-2 language code format. 58 59 @param DriverName[out] A pointer to the Unicode string to return. 60 This Unicode string is the name of the 61 driver specified by This in the language 62 specified by Language. 63 64 @retval EFI_SUCCESS The Unicode string for the Driver specified by 65 This and the language specified by Language was 66 returned in DriverName. 67 68 @retval EFI_INVALID_PARAMETER Language is NULL. 69 70 @retval EFI_INVALID_PARAMETER DriverName is NULL. 71 72 @retval EFI_UNSUPPORTED The driver specified by This does not support 73 the language specified by Language. 74 75 **/ 76 EFI_STATUS 77 EFIAPI 78 GraphicsOutputComponentNameGetDriverName ( 79 IN EFI_COMPONENT_NAME_PROTOCOL *This, 80 IN CHAR8 *Language, 81 OUT CHAR16 **DriverName 82 ) 83 { 84 return LookupUnicodeString2 ( 85 Language, 86 This->SupportedLanguages, 87 mGraphicsOutputDriverNameTable, 88 DriverName, 89 (BOOLEAN) (This == &mGraphicsOutputComponentName) 90 ); 91 } 92 93 /** 94 Retrieves a Unicode string that is the user readable name of the controller 95 that is being managed by a driver. 96 97 This function retrieves the user readable name of the controller specified by 98 ControllerHandle and ChildHandle in the form of a Unicode string. If the 99 driver specified by This has a user readable name in the language specified by 100 Language, then a pointer to the controller name is returned in ControllerName, 101 and EFI_SUCCESS is returned. If the driver specified by This is not currently 102 managing the controller specified by ControllerHandle and ChildHandle, 103 then EFI_UNSUPPORTED is returned. If the driver specified by This does not 104 support the language specified by Language, then EFI_UNSUPPORTED is returned. 105 106 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or 107 EFI_COMPONENT_NAME_PROTOCOL instance. 108 109 @param ControllerHandle[in] The handle of a controller that the driver 110 specified by This is managing. This handle 111 specifies the controller whose name is to be 112 returned. 113 114 @param ChildHandle[in] The handle of the child controller to retrieve 115 the name of. This is an optional parameter that 116 may be NULL. It will be NULL for device 117 drivers. It will also be NULL for a bus drivers 118 that wish to retrieve the name of the bus 119 controller. It will not be NULL for a bus 120 driver that wishes to retrieve the name of a 121 child controller. 122 123 @param Language[in] A pointer to a Null-terminated ASCII string 124 array indicating the language. This is the 125 language of the driver name that the caller is 126 requesting, and it must match one of the 127 languages specified in SupportedLanguages. The 128 number of languages supported by a driver is up 129 to the driver writer. Language is specified in 130 RFC 4646 or ISO 639-2 language code format. 131 132 @param ControllerName[out] A pointer to the Unicode string to return. 133 This Unicode string is the name of the 134 controller specified by ControllerHandle and 135 ChildHandle in the language specified by 136 Language from the point of view of the driver 137 specified by This. 138 139 @retval EFI_SUCCESS The Unicode string for the user readable name in 140 the language specified by Language for the 141 driver specified by This was returned in 142 DriverName. 143 144 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL. 145 146 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid 147 EFI_HANDLE. 148 149 @retval EFI_INVALID_PARAMETER Language is NULL. 150 151 @retval EFI_INVALID_PARAMETER ControllerName is NULL. 152 153 @retval EFI_UNSUPPORTED The driver specified by This is not currently 154 managing the controller specified by 155 ControllerHandle and ChildHandle. 156 157 @retval EFI_UNSUPPORTED The driver specified by This does not support 158 the language specified by Language. 159 160 **/ 161 EFI_STATUS 162 EFIAPI 163 GraphicsOutputComponentNameGetControllerName ( 164 IN EFI_COMPONENT_NAME_PROTOCOL *This, 165 IN EFI_HANDLE ControllerHandle, 166 IN EFI_HANDLE ChildHandle OPTIONAL, 167 IN CHAR8 *Language, 168 OUT CHAR16 **ControllerName 169 ) 170 { 171 return EFI_UNSUPPORTED; 172 } 173 174 // 175 // EFI Component Name Protocol 176 // 177 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL mGraphicsOutputComponentName = { 178 GraphicsOutputComponentNameGetDriverName, 179 GraphicsOutputComponentNameGetControllerName, 180 "eng" 181 }; 182 183 // 184 // EFI Component Name 2 Protocol 185 // 186 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL mGraphicsOutputComponentName2 = { 187 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) GraphicsOutputComponentNameGetDriverName, 188 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) GraphicsOutputComponentNameGetControllerName, 189 "en" 190 }; 191