]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - Nt32Pkg/WinNtBusDriverDxe/ComponentName.c
Remove the EDK prefix from library instance folder's name
[mirror_edk2.git] / Nt32Pkg / WinNtBusDriverDxe / ComponentName.c
... / ...
CommitLineData
1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 ComponentName.c\r
15\r
16Abstract:\r
17\r
18--*/\r
19\r
20//\r
21// The package level header files this module uses\r
22//\r
23#include <Uefi.h>\r
24#include <WinNtDxe.h>\r
25//\r
26// The protocols, PPI and GUID defintions for this module\r
27//\r
28#include <Protocol/WinNtThunk.h>\r
29#include <Protocol/WinNtIo.h>\r
30#include <Protocol/ComponentName.h>\r
31#include <Protocol/DriverBinding.h>\r
32#include <Protocol/DevicePath.h>\r
33\r
34\r
35#include "WinNtBusDriver.h"\r
36\r
37//\r
38// EFI Component Name Functions\r
39//\r
40EFI_STATUS\r
41EFIAPI\r
42WinNtBusDriverComponentNameGetDriverName (\r
43 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
44 IN CHAR8 *Language,\r
45 OUT CHAR16 **DriverName\r
46 );\r
47\r
48EFI_STATUS\r
49EFIAPI\r
50WinNtBusDriverComponentNameGetControllerName (\r
51 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
52 IN EFI_HANDLE ControllerHandle,\r
53 IN EFI_HANDLE ChildHandle OPTIONAL,\r
54 IN CHAR8 *Language,\r
55 OUT CHAR16 **ControllerName\r
56 );\r
57\r
58//\r
59// EFI Component Name Protocol\r
60//\r
61EFI_COMPONENT_NAME_PROTOCOL gWinNtBusDriverComponentName = {\r
62 WinNtBusDriverComponentNameGetDriverName,\r
63 WinNtBusDriverComponentNameGetControllerName,\r
64 "eng"\r
65};\r
66\r
67static EFI_UNICODE_STRING_TABLE mWinNtBusDriverNameTable[] = {\r
68 { "eng", L"Windows Bus Driver" },\r
69 { NULL , NULL }\r
70};\r
71\r
72EFI_STATUS\r
73EFIAPI\r
74WinNtBusDriverComponentNameGetDriverName (\r
75 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
76 IN CHAR8 *Language,\r
77 OUT CHAR16 **DriverName\r
78 )\r
79/*++\r
80\r
81 Routine Description:\r
82 Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
83\r
84 Arguments:\r
85 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
86 Language - A pointer to a three character ISO 639-2 language identifier.\r
87 This is the language of the driver name that that the caller \r
88 is requesting, and it must match one of the languages specified\r
89 in SupportedLanguages. The number of languages supported by a \r
90 driver is up to the driver writer.\r
91 DriverName - A pointer to the Unicode string to return. This Unicode string\r
92 is the name of the driver specified by This in the language \r
93 specified by Language.\r
94\r
95 Returns:\r
96 EFI_SUCCESS - The Unicode string for the Driver specified by This\r
97 and the language specified by Language was returned \r
98 in DriverName.\r
99 EFI_INVALID_PARAMETER - Language is NULL.\r
100 EFI_INVALID_PARAMETER - DriverName is NULL.\r
101 EFI_UNSUPPORTED - The driver specified by This does not support the \r
102 language specified by Language.\r
103\r
104--*/\r
105{\r
106 return LookupUnicodeString (\r
107 Language,\r
108 gWinNtBusDriverComponentName.SupportedLanguages,\r
109 mWinNtBusDriverNameTable,\r
110 DriverName\r
111 );\r
112}\r
113\r
114EFI_STATUS\r
115EFIAPI\r
116WinNtBusDriverComponentNameGetControllerName (\r
117 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
118 IN EFI_HANDLE ControllerHandle,\r
119 IN EFI_HANDLE ChildHandle OPTIONAL,\r
120 IN CHAR8 *Language,\r
121 OUT CHAR16 **ControllerName\r
122 )\r
123/*++\r
124\r
125 Routine Description:\r
126 Retrieves a Unicode string that is the user readable name of the controller\r
127 that is being managed by an EFI Driver.\r
128\r
129 Arguments:\r
130 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
131 ControllerHandle - The handle of a controller that the driver specified by \r
132 This is managing. This handle specifies the controller \r
133 whose name is to be returned.\r
134 ChildHandle - The handle of the child controller to retrieve the name \r
135 of. This is an optional parameter that may be NULL. It \r
136 will be NULL for device drivers. It will also be NULL \r
137 for a bus drivers that wish to retrieve the name of the \r
138 bus controller. It will not be NULL for a bus driver \r
139 that wishes to retrieve the name of a child controller.\r
140 Language - A pointer to a three character ISO 639-2 language \r
141 identifier. This is the language of the controller name \r
142 that that the caller is requesting, and it must match one\r
143 of the languages specified in SupportedLanguages. The \r
144 number of languages supported by a driver is up to the \r
145 driver writer.\r
146 ControllerName - A pointer to the Unicode string to return. This Unicode\r
147 string is the name of the controller specified by \r
148 ControllerHandle and ChildHandle in the language specified\r
149 by Language from the point of view of the driver specified\r
150 by This. \r
151\r
152 Returns:\r
153 EFI_SUCCESS - The Unicode string for the user readable name in the \r
154 language specified by Language for the driver \r
155 specified by This was returned in DriverName.\r
156 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
157 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
158 EFI_INVALID_PARAMETER - Language is NULL.\r
159 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
160 EFI_UNSUPPORTED - The driver specified by This is not currently managing \r
161 the controller specified by ControllerHandle and \r
162 ChildHandle.\r
163 EFI_UNSUPPORTED - The driver specified by This does not support the \r
164 language specified by Language.\r
165\r
166--*/\r
167{\r
168 EFI_STATUS Status;\r
169 EFI_WIN_NT_IO_PROTOCOL *WinNtIo;\r
170 WIN_NT_IO_DEVICE *Private;\r
171\r
172 //\r
173 // Make sure this driver is currently managing ControllHandle\r
174 //\r
175 Status = EfiTestManagedDevice (\r
176 ControllerHandle,\r
177 gWinNtBusDriverBinding.DriverBindingHandle,\r
178 &gEfiWinNtThunkProtocolGuid\r
179 );\r
180 if (EFI_ERROR (Status)) {\r
181 return Status;\r
182 }\r
183\r
184 //\r
185 // This is a bus driver, so ChildHandle can not be NULL.\r
186 //\r
187 if (ChildHandle == NULL) {\r
188 return EFI_UNSUPPORTED;\r
189 }\r
190\r
191 Status = EfiTestChildHandle (\r
192 ControllerHandle,\r
193 ChildHandle,\r
194 &gEfiWinNtThunkProtocolGuid\r
195 );\r
196 if (EFI_ERROR (Status)) {\r
197 return Status;\r
198 }\r
199\r
200 //\r
201 // Get our context back\r
202 //\r
203 Status = gBS->OpenProtocol (\r
204 ChildHandle,\r
205 &gEfiWinNtIoProtocolGuid,\r
206 &WinNtIo,\r
207 gWinNtBusDriverBinding.DriverBindingHandle,\r
208 ChildHandle,\r
209 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
210 );\r
211 if (EFI_ERROR (Status)) {\r
212 return EFI_UNSUPPORTED;\r
213 }\r
214\r
215 Private = WIN_NT_IO_DEVICE_FROM_THIS (WinNtIo);\r
216\r
217 return LookupUnicodeString (\r
218 Language,\r
219 gWinNtBusDriverComponentName.SupportedLanguages,\r
220 Private->ControllerNameTable,\r
221 ControllerName\r
222 );\r
223}\r