ComponentName.c 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /** @file
  2. Implementation of EFI_COMPONENT_NAME_PROTOCOL and
  3. EFI_COMPONENT_NAME2_PROTOCOL protocol.
  4. Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #include "HttpDriver.h"
  8. ///
  9. /// Component Name Protocol instance
  10. ///
  11. GLOBAL_REMOVE_IF_UNREFERENCED
  12. EFI_COMPONENT_NAME_PROTOCOL gHttpDxeComponentName = {
  13. (EFI_COMPONENT_NAME_GET_DRIVER_NAME)HttpDxeComponentNameGetDriverName,
  14. (EFI_COMPONENT_NAME_GET_CONTROLLER_NAME)HttpDxeComponentNameGetControllerName,
  15. "eng"
  16. };
  17. ///
  18. /// Component Name 2 Protocol instance
  19. ///
  20. GLOBAL_REMOVE_IF_UNREFERENCED
  21. EFI_COMPONENT_NAME2_PROTOCOL gHttpDxeComponentName2 = {
  22. HttpDxeComponentNameGetDriverName,
  23. HttpDxeComponentNameGetControllerName,
  24. "en"
  25. };
  26. ///
  27. /// Table of driver names
  28. ///
  29. GLOBAL_REMOVE_IF_UNREFERENCED
  30. EFI_UNICODE_STRING_TABLE mHttpDxeDriverNameTable[] = {
  31. { "eng;en", (CHAR16 *)L"HttpDxe" },
  32. { NULL, NULL }
  33. };
  34. /**
  35. Retrieves a Unicode string that is the user-readable name of the EFI Driver.
  36. @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
  37. @param Language A pointer to a three-character ISO 639-2 language identifier.
  38. This is the language of the driver name that that the caller
  39. is requesting, and it must match one of the languages specified
  40. in SupportedLanguages. The number of languages supported by a
  41. driver is up to the driver writer.
  42. @param DriverName A pointer to the Unicode string to return. This Unicode string
  43. is the name of the driver specified by This in the language
  44. specified by Language.
  45. @retval EFI_SUCCESS The Unicode string for the Driver specified by This
  46. and the language specified by Language was returned
  47. in DriverName.
  48. @retval EFI_INVALID_PARAMETER Language is NULL.
  49. @retval EFI_INVALID_PARAMETER DriverName is NULL.
  50. @retval EFI_UNSUPPORTED The driver specified by This does not support the
  51. language specified by Language.
  52. **/
  53. EFI_STATUS
  54. EFIAPI
  55. HttpDxeComponentNameGetDriverName (
  56. IN EFI_COMPONENT_NAME2_PROTOCOL *This,
  57. IN CHAR8 *Language,
  58. OUT CHAR16 **DriverName
  59. )
  60. {
  61. return LookupUnicodeString2 (
  62. Language,
  63. This->SupportedLanguages,
  64. mHttpDxeDriverNameTable,
  65. DriverName,
  66. (BOOLEAN)(This != &gHttpDxeComponentName2)
  67. );
  68. }
  69. /**
  70. Retrieves a Unicode string that is the user readable name of the controller
  71. that is being managed by an EFI Driver.
  72. @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
  73. @param ControllerHandle The handle of a controller that the driver specified by
  74. This is managing. This handle specifies the controller
  75. whose name is to be returned.
  76. @param ChildHandle The handle of the child controller to retrieve the name
  77. of. This is an optional parameter that may be NULL. It
  78. will be NULL for device drivers. It will also be NULL
  79. for a bus drivers that wish to retrieve the name of the
  80. bus controller. It will not be NULL for a bus driver
  81. that wishes to retrieve the name of a child controller.
  82. @param Language A pointer to a three character ISO 639-2 language
  83. identifier. This is the language of the controller name
  84. that the caller is requesting, and it must match one
  85. of the languages specified in SupportedLanguages. The
  86. number of languages supported by a driver is up to the
  87. driver writer.
  88. @param ControllerName A pointer to the Unicode string to return. This Unicode
  89. string is the name of the controller specified by
  90. ControllerHandle and ChildHandle in the language specified
  91. by Language, from the point of view of the driver specified
  92. by This.
  93. @retval EFI_SUCCESS The Unicode string for the user-readable name in the
  94. language specified by Language for the driver
  95. specified by This was returned in DriverName.
  96. @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
  97. @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
  98. @retval EFI_INVALID_PARAMETER Language is NULL.
  99. @retval EFI_INVALID_PARAMETER ControllerName is NULL.
  100. @retval EFI_UNSUPPORTED The driver specified by This is not currently managing
  101. the controller specified by ControllerHandle and
  102. ChildHandle.
  103. @retval EFI_UNSUPPORTED The driver specified by This does not support the
  104. language specified by Language.
  105. **/
  106. EFI_STATUS
  107. EFIAPI
  108. HttpDxeComponentNameGetControllerName (
  109. IN EFI_COMPONENT_NAME2_PROTOCOL *This,
  110. IN EFI_HANDLE ControllerHandle,
  111. IN EFI_HANDLE ChildHandle OPTIONAL,
  112. IN CHAR8 *Language,
  113. OUT CHAR16 **ControllerName
  114. )
  115. {
  116. return EFI_UNSUPPORTED;
  117. }