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