ComponentName.c 8.0 KB

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