ComponentName.c 7.3 KB

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