]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/DebugPortDxe/ComponentName.c
321f57bf42922df021e078291494e06f65b6a87a
[mirror_edk2.git] / MdeModulePkg / Universal / DebugPortDxe / ComponentName.c
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13 ComponentName.c
14
15 Abstract:
16 Component name protocol member functions for DebugPort...
17
18 --*/
19
20 #include "DebugPort.h"
21
22 //
23 // EFI Component Name Protocol
24 //
25 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentName = {
26 DebugPortComponentNameGetDriverName,
27 DebugPortComponentNameGetControllerName,
28 "eng"
29 };
30
31 //
32 // EFI Component Name 2 Protocol
33 //
34 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDebugPortComponentName2 = {
35 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) DebugPortComponentNameGetDriverName,
36 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) DebugPortComponentNameGetControllerName,
37 "en"
38 };
39
40
41 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDebugPortDriverNameTable[] = {
42 {
43 "eng;en",
44 (CHAR16 *) L"DebugPort Driver"
45 },
46 {
47 NULL,
48 NULL
49 }
50 };
51
52 /**
53 Retrieves a Unicode string that is the user readable name of the driver.
54
55 This function retrieves the user readable name of a driver in the form of a
56 Unicode string. If the driver specified by This has a user readable name in
57 the language specified by Language, then a pointer to the driver name is
58 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
59 by This does not support the language specified by Language,
60 then EFI_UNSUPPORTED is returned.
61
62 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
63 EFI_COMPONENT_NAME_PROTOCOL instance.
64
65 @param Language[in] A pointer to a Null-terminated ASCII string
66 array indicating the language. This is the
67 language of the driver name that the caller is
68 requesting, and it must match one of the
69 languages specified in SupportedLanguages. The
70 number of languages supported by a driver is up
71 to the driver writer. Language is specified
72 in RFC 3066 or ISO 639-2 language code format.
73
74 @param DriverName[out] A pointer to the Unicode string to return.
75 This Unicode string is the name of the
76 driver specified by This in the language
77 specified by Language.
78
79 @retval EFI_SUCCESS The Unicode string for the Driver specified by
80 This and the language specified by Language was
81 returned in DriverName.
82
83 @retval EFI_INVALID_PARAMETER Language is NULL.
84
85 @retval EFI_INVALID_PARAMETER DriverName is NULL.
86
87 @retval EFI_UNSUPPORTED The driver specified by This does not support
88 the language specified by Language.
89
90 **/
91 EFI_STATUS
92 EFIAPI
93 DebugPortComponentNameGetDriverName (
94 IN EFI_COMPONENT_NAME_PROTOCOL *This,
95 IN CHAR8 *Language,
96 OUT CHAR16 **DriverName
97 )
98 {
99 return LookupUnicodeString2 (
100 Language,
101 This->SupportedLanguages,
102 mDebugPortDriverNameTable,
103 DriverName,
104 (BOOLEAN)(This == &gDebugPortComponentName)
105 );
106 }
107
108 /**
109 Retrieves a Unicode string that is the user readable name of the controller
110 that is being managed by a driver.
111
112 This function retrieves the user readable name of the controller specified by
113 ControllerHandle and ChildHandle in the form of a Unicode string. If the
114 driver specified by This has a user readable name in the language specified by
115 Language, then a pointer to the controller name is returned in ControllerName,
116 and EFI_SUCCESS is returned. If the driver specified by This is not currently
117 managing the controller specified by ControllerHandle and ChildHandle,
118 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
119 support the language specified by Language, then EFI_UNSUPPORTED is returned.
120
121 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
122 EFI_COMPONENT_NAME_PROTOCOL instance.
123
124 @param ControllerHandle[in] The handle of a controller that the driver
125 specified by This is managing. This handle
126 specifies the controller whose name is to be
127 returned.
128
129 @param ChildHandle[in] The handle of the child controller to retrieve
130 the name of. This is an optional parameter that
131 may be NULL. It will be NULL for device
132 drivers. It will also be NULL for a bus drivers
133 that wish to retrieve the name of the bus
134 controller. It will not be NULL for a bus
135 driver that wishes to retrieve the name of a
136 child controller.
137
138 @param Language[in] A pointer to a Null-terminated ASCII string
139 array indicating the language. This is the
140 language of the driver name that the caller is
141 requesting, and it must match one of the
142 languages specified in SupportedLanguages. The
143 number of languages supported by a driver is up
144 to the driver writer. Language is specified in
145 RFC 3066 or ISO 639-2 language code format.
146
147 @param ControllerName[out] A pointer to the Unicode string to return.
148 This Unicode string is the name of the
149 controller specified by ControllerHandle and
150 ChildHandle in the language specified by
151 Language from the point of view of the driver
152 specified by This.
153
154 @retval EFI_SUCCESS The Unicode string for the user readable name in
155 the language specified by Language for the
156 driver specified by This was returned in
157 DriverName.
158
159 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
160
161 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
162 EFI_HANDLE.
163
164 @retval EFI_INVALID_PARAMETER Language is NULL.
165
166 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
167
168 @retval EFI_UNSUPPORTED The driver specified by This is not currently
169 managing the controller specified by
170 ControllerHandle and ChildHandle.
171
172 @retval EFI_UNSUPPORTED The driver specified by This does not support
173 the language specified by Language.
174
175 **/
176 EFI_STATUS
177 EFIAPI
178 DebugPortComponentNameGetControllerName (
179 IN EFI_COMPONENT_NAME_PROTOCOL *This,
180 IN EFI_HANDLE ControllerHandle,
181 IN EFI_HANDLE ChildHandle OPTIONAL,
182 IN CHAR8 *Language,
183 OUT CHAR16 **ControllerName
184 )
185 {
186 return EFI_UNSUPPORTED;
187 }