ComponentName.c 7.5 KB

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