ComponentName.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. /** @file
  2. UEFI Component Name(2) protocol implementation for IsaAcpi driver.
  3. Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #include "PcatIsaAcpi.h"
  7. //
  8. // EFI Component Name Functions
  9. //
  10. /**
  11. Retrieves a Unicode string that is the user readable name of the driver.
  12. This function retrieves the user readable name of a driver in the form of a
  13. Unicode string. If the driver specified by This has a user readable name in
  14. the language specified by Language, then a pointer to the driver name is
  15. returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
  16. by This does not support the language specified by Language,
  17. then EFI_UNSUPPORTED is returned.
  18. @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
  19. EFI_COMPONENT_NAME_PROTOCOL instance.
  20. @param Language[in] A pointer to a Null-terminated ASCII string
  21. array indicating the language. This is the
  22. language of the driver name that the caller is
  23. requesting, and it must match one of the
  24. languages specified in SupportedLanguages. The
  25. number of languages supported by a driver is up
  26. to the driver writer. Language is specified
  27. in RFC 4646 or ISO 639-2 language code format.
  28. @param DriverName[out] A pointer to the Unicode string to return.
  29. This Unicode string is the name of the
  30. driver specified by This in the language
  31. specified by Language.
  32. @retval EFI_SUCCESS The Unicode string for the Driver specified by
  33. This and the language specified by Language was
  34. returned in DriverName.
  35. @retval EFI_INVALID_PARAMETER Language is NULL.
  36. @retval EFI_INVALID_PARAMETER DriverName is NULL.
  37. @retval EFI_UNSUPPORTED The driver specified by This does not support
  38. the language specified by Language.
  39. **/
  40. EFI_STATUS
  41. EFIAPI
  42. PcatIsaAcpiComponentNameGetDriverName (
  43. IN EFI_COMPONENT_NAME_PROTOCOL *This,
  44. IN CHAR8 *Language,
  45. OUT CHAR16 **DriverName
  46. );
  47. /**
  48. Retrieves a Unicode string that is the user readable name of the controller
  49. that is being managed by a driver.
  50. This function retrieves the user readable name of the controller specified by
  51. ControllerHandle and ChildHandle in the form of a Unicode string. If the
  52. driver specified by This has a user readable name in the language specified by
  53. Language, then a pointer to the controller name is returned in ControllerName,
  54. and EFI_SUCCESS is returned. If the driver specified by This is not currently
  55. managing the controller specified by ControllerHandle and ChildHandle,
  56. then EFI_UNSUPPORTED is returned. If the driver specified by This does not
  57. support the language specified by Language, then EFI_UNSUPPORTED is returned.
  58. @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
  59. EFI_COMPONENT_NAME_PROTOCOL instance.
  60. @param ControllerHandle[in] The handle of a controller that the driver
  61. specified by This is managing. This handle
  62. specifies the controller whose name is to be
  63. returned.
  64. @param ChildHandle[in] The handle of the child controller to retrieve
  65. the name of. This is an optional parameter that
  66. may be NULL. It will be NULL for device
  67. drivers. It will also be NULL for a bus drivers
  68. that wish to retrieve the name of the bus
  69. controller. It will not be NULL for a bus
  70. driver that wishes to retrieve the name of a
  71. child controller.
  72. @param Language[in] A pointer to a Null-terminated ASCII string
  73. array indicating the language. This is the
  74. language of the driver name that the caller is
  75. requesting, and it must match one of the
  76. languages specified in SupportedLanguages. The
  77. number of languages supported by a driver is up
  78. to the driver writer. Language is specified in
  79. RFC 4646 or ISO 639-2 language code format.
  80. @param ControllerName[out] A pointer to the Unicode string to return.
  81. This Unicode string is the name of the
  82. controller specified by ControllerHandle and
  83. ChildHandle in the language specified by
  84. Language from the point of view of the driver
  85. specified by This.
  86. @retval EFI_SUCCESS The Unicode string for the user readable name in
  87. the language specified by Language for the
  88. driver specified by This was returned in
  89. DriverName.
  90. @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
  91. @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
  92. EFI_HANDLE.
  93. @retval EFI_INVALID_PARAMETER Language is NULL.
  94. @retval EFI_INVALID_PARAMETER ControllerName is NULL.
  95. @retval EFI_UNSUPPORTED The driver specified by This is not currently
  96. managing the controller specified by
  97. ControllerHandle and ChildHandle.
  98. @retval EFI_UNSUPPORTED The driver specified by This does not support
  99. the language specified by Language.
  100. **/
  101. EFI_STATUS
  102. EFIAPI
  103. PcatIsaAcpiComponentNameGetControllerName (
  104. IN EFI_COMPONENT_NAME_PROTOCOL *This,
  105. IN EFI_HANDLE ControllerHandle,
  106. IN EFI_HANDLE ChildHandle OPTIONAL,
  107. IN CHAR8 *Language,
  108. OUT CHAR16 **ControllerName
  109. );
  110. //
  111. // EFI Component Name Protocol
  112. //
  113. EFI_COMPONENT_NAME2_PROTOCOL gPcatIsaAcpiComponentName2 = {
  114. (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PcatIsaAcpiComponentNameGetDriverName,
  115. (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PcatIsaAcpiComponentNameGetControllerName,
  116. "en"
  117. };
  118. EFI_COMPONENT_NAME_PROTOCOL gPcatIsaAcpiComponentName = {
  119. PcatIsaAcpiComponentNameGetDriverName,
  120. PcatIsaAcpiComponentNameGetControllerName,
  121. "eng"
  122. };
  123. EFI_UNICODE_STRING_TABLE mPcatIsaAcpiDriverNameTable[] = {
  124. {
  125. "eng;en",
  126. L"PC-AT ISA Device Enumeration Driver"
  127. },
  128. {
  129. NULL,
  130. NULL
  131. }
  132. };
  133. /**
  134. Retrieves a Unicode string that is the user readable name of the driver.
  135. This function retrieves the user readable name of a driver in the form of a
  136. Unicode string. If the driver specified by This has a user readable name in
  137. the language specified by Language, then a pointer to the driver name is
  138. returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
  139. by This does not support the language specified by Language,
  140. then EFI_UNSUPPORTED is returned.
  141. @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
  142. EFI_COMPONENT_NAME_PROTOCOL instance.
  143. @param Language[in] A pointer to a Null-terminated ASCII string
  144. array indicating the language. This is the
  145. language of the driver name that the caller is
  146. requesting, and it must match one of the
  147. languages specified in SupportedLanguages. The
  148. number of languages supported by a driver is up
  149. to the driver writer. Language is specified
  150. in RFC 4646 or ISO 639-2 language code format.
  151. @param DriverName[out] A pointer to the Unicode string to return.
  152. This Unicode string is the name of the
  153. driver specified by This in the language
  154. specified by Language.
  155. @retval EFI_SUCCESS The Unicode string for the Driver specified by
  156. This and the language specified by Language was
  157. returned in DriverName.
  158. @retval EFI_INVALID_PARAMETER Language is NULL.
  159. @retval EFI_INVALID_PARAMETER DriverName is NULL.
  160. @retval EFI_UNSUPPORTED The driver specified by This does not support
  161. the language specified by Language.
  162. **/
  163. EFI_STATUS
  164. EFIAPI
  165. PcatIsaAcpiComponentNameGetDriverName (
  166. IN EFI_COMPONENT_NAME_PROTOCOL *This,
  167. IN CHAR8 *Language,
  168. OUT CHAR16 **DriverName
  169. )
  170. {
  171. return LookupUnicodeString2 (
  172. Language,
  173. This->SupportedLanguages,
  174. mPcatIsaAcpiDriverNameTable,
  175. DriverName,
  176. (BOOLEAN)(This == &gPcatIsaAcpiComponentName)
  177. );
  178. }
  179. /**
  180. Retrieves a Unicode string that is the user readable name of the controller
  181. that is being managed by a driver.
  182. This function retrieves the user readable name of the controller specified by
  183. ControllerHandle and ChildHandle in the form of a Unicode string. If the
  184. driver specified by This has a user readable name in the language specified by
  185. Language, then a pointer to the controller name is returned in ControllerName,
  186. and EFI_SUCCESS is returned. If the driver specified by This is not currently
  187. managing the controller specified by ControllerHandle and ChildHandle,
  188. then EFI_UNSUPPORTED is returned. If the driver specified by This does not
  189. support the language specified by Language, then EFI_UNSUPPORTED is returned.
  190. @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
  191. EFI_COMPONENT_NAME_PROTOCOL instance.
  192. @param ControllerHandle[in] The handle of a controller that the driver
  193. specified by This is managing. This handle
  194. specifies the controller whose name is to be
  195. returned.
  196. @param ChildHandle[in] The handle of the child controller to retrieve
  197. the name of. This is an optional parameter that
  198. may be NULL. It will be NULL for device
  199. drivers. It will also be NULL for a bus drivers
  200. that wish to retrieve the name of the bus
  201. controller. It will not be NULL for a bus
  202. driver that wishes to retrieve the name of a
  203. child controller.
  204. @param Language[in] A pointer to a Null-terminated ASCII string
  205. array indicating the language. This is the
  206. language of the driver name that the caller is
  207. requesting, and it must match one of the
  208. languages specified in SupportedLanguages. The
  209. number of languages supported by a driver is up
  210. to the driver writer. Language is specified in
  211. RFC 4646 or ISO 639-2 language code format.
  212. @param ControllerName[out] A pointer to the Unicode string to return.
  213. This Unicode string is the name of the
  214. controller specified by ControllerHandle and
  215. ChildHandle in the language specified by
  216. Language from the point of view of the driver
  217. specified by This.
  218. @retval EFI_SUCCESS The Unicode string for the user readable name in
  219. the language specified by Language for the
  220. driver specified by This was returned in
  221. DriverName.
  222. @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
  223. @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
  224. EFI_HANDLE.
  225. @retval EFI_INVALID_PARAMETER Language is NULL.
  226. @retval EFI_INVALID_PARAMETER ControllerName is NULL.
  227. @retval EFI_UNSUPPORTED The driver specified by This is not currently
  228. managing the controller specified by
  229. ControllerHandle and ChildHandle.
  230. @retval EFI_UNSUPPORTED The driver specified by This does not support
  231. the language specified by Language.
  232. **/
  233. EFI_STATUS
  234. EFIAPI
  235. PcatIsaAcpiComponentNameGetControllerName (
  236. IN EFI_COMPONENT_NAME_PROTOCOL *This,
  237. IN EFI_HANDLE ControllerHandle,
  238. IN EFI_HANDLE ChildHandle OPTIONAL,
  239. IN CHAR8 *Language,
  240. OUT CHAR16 **ControllerName
  241. )
  242. {
  243. return EFI_UNSUPPORTED;
  244. }