ComponentName.c 7.6 KB

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