ComponentName.c 7.4 KB

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