ComponentName.c 7.8 KB

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