ComponentName.c 7.6 KB

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