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