]> git.proxmox.com Git - mirror_edk2.git/blame - Nt32Pkg/WinNtSimpleFileSystemDxe/ComponentName.c
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2920 6f19259b...
[mirror_edk2.git] / Nt32Pkg / WinNtSimpleFileSystemDxe / ComponentName.c
CommitLineData
068eac81 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// The package level header files this module uses\r
21//\r
22#include <Uefi.h>\r
23#include <WinNtDxe.h>\r
24//\r
25// The protocols, PPI and GUID defintions for this module\r
26//\r
27#include <Guid/FileSystemVolumeLabelInfo.h>\r
28#include <Protocol/WinNtIo.h>\r
29#include <Protocol/ComponentName.h>\r
30#include <Guid/FileInfo.h>\r
31#include <Protocol/DriverBinding.h>\r
32#include <Guid/FileSystemInfo.h>\r
33#include <Protocol/SimpleFileSystem.h>\r
34//\r
35// The Library classes this module consumes\r
36//\r
37#include <Library/DebugLib.h>\r
38#include <Library/BaseLib.h>\r
39#include <Library/UefiDriverEntryPoint.h>\r
40#include <Library/UefiLib.h>\r
41#include <Library/BaseMemoryLib.h>\r
42#include <Library/UefiBootServicesTableLib.h>\r
43#include <Library/MemoryAllocationLib.h>\r
44\r
45#include "WinNtSimpleFileSystem.h"\r
46\r
47//\r
48// EFI Component Name Functions\r
49//\r
50EFI_STATUS\r
51EFIAPI\r
52WinNtSimpleFileSystemComponentNameGetDriverName (\r
53 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
54 IN CHAR8 *Language,\r
55 OUT CHAR16 **DriverName\r
56 );\r
57\r
58EFI_STATUS\r
59EFIAPI\r
60WinNtSimpleFileSystemComponentNameGetControllerName (\r
61 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
62 IN EFI_HANDLE ControllerHandle,\r
63 IN EFI_HANDLE ChildHandle OPTIONAL,\r
64 IN CHAR8 *Language,\r
65 OUT CHAR16 **ControllerName\r
66 );\r
67\r
68//\r
69// EFI Component Name Protocol\r
70//\r
71EFI_COMPONENT_NAME_PROTOCOL gWinNtSimpleFileSystemComponentName = {\r
72 WinNtSimpleFileSystemComponentNameGetDriverName,\r
73 WinNtSimpleFileSystemComponentNameGetControllerName,\r
74 "eng"\r
75};\r
76\r
77static EFI_UNICODE_STRING_TABLE mWinNtSimpleFileSystemDriverNameTable[] = {\r
78 {\r
79 "eng",\r
80 L"Windows Simple File System Driver"\r
81 },\r
82 {\r
83 NULL,\r
84 NULL\r
85 }\r
86};\r
87\r
88EFI_STATUS\r
89EFIAPI\r
90WinNtSimpleFileSystemComponentNameGetDriverName (\r
91 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
92 IN CHAR8 *Language,\r
93 OUT CHAR16 **DriverName\r
94 )\r
95/*++\r
96\r
97 Routine Description:\r
98 Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
99\r
100 Arguments:\r
101 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
102 Language - A pointer to a three character ISO 639-2 language identifier.\r
103 This is the language of the driver name that that the caller \r
104 is requesting, and it must match one of the languages specified\r
105 in SupportedLanguages. The number of languages supported by a \r
106 driver is up to the driver writer.\r
107 DriverName - A pointer to the Unicode string to return. This Unicode string\r
108 is the name of the driver specified by This in the language \r
109 specified by Language.\r
110\r
111 Returns:\r
112 EFI_SUCCESS - The Unicode string for the Driver specified by This\r
113 and the language specified by Language was returned \r
114 in DriverName.\r
115 EFI_INVALID_PARAMETER - Language is NULL.\r
116 EFI_INVALID_PARAMETER - DriverName is NULL.\r
117 EFI_UNSUPPORTED - The driver specified by This does not support the \r
118 language specified by Language.\r
119\r
120--*/\r
121{\r
122 return LookupUnicodeString (\r
123 Language,\r
124 gWinNtSimpleFileSystemComponentName.SupportedLanguages,\r
125 mWinNtSimpleFileSystemDriverNameTable,\r
126 DriverName\r
127 );\r
128}\r
129\r
130EFI_STATUS\r
131EFIAPI\r
132WinNtSimpleFileSystemComponentNameGetControllerName (\r
133 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
134 IN EFI_HANDLE ControllerHandle,\r
135 IN EFI_HANDLE ChildHandle OPTIONAL,\r
136 IN CHAR8 *Language,\r
137 OUT CHAR16 **ControllerName\r
138 )\r
139/*++\r
140\r
141 Routine Description:\r
142 Retrieves a Unicode string that is the user readable name of the controller\r
143 that is being managed by an EFI Driver.\r
144\r
145 Arguments:\r
146 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
147 ControllerHandle - The handle of a controller that the driver specified by \r
148 This is managing. This handle specifies the controller \r
149 whose name is to be returned.\r
150 ChildHandle - The handle of the child controller to retrieve the name \r
151 of. This is an optional parameter that may be NULL. It \r
152 will be NULL for device drivers. It will also be NULL \r
153 for a bus drivers that wish to retrieve the name of the \r
154 bus controller. It will not be NULL for a bus driver \r
155 that wishes to retrieve the name of a child controller.\r
156 Language - A pointer to a three character ISO 639-2 language \r
157 identifier. This is the language of the controller name \r
158 that that the caller is requesting, and it must match one\r
159 of the languages specified in SupportedLanguages. The \r
160 number of languages supported by a driver is up to the \r
161 driver writer.\r
162 ControllerName - A pointer to the Unicode string to return. This Unicode\r
163 string is the name of the controller specified by \r
164 ControllerHandle and ChildHandle in the language specified\r
165 by Language from the point of view of the driver specified\r
166 by This. \r
167\r
168 Returns:\r
169 EFI_SUCCESS - The Unicode string for the user readable name in the \r
170 language specified by Language for the driver \r
171 specified by This was returned in DriverName.\r
172 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
173 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
174 EFI_INVALID_PARAMETER - Language is NULL.\r
175 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
176 EFI_UNSUPPORTED - The driver specified by This is not currently managing \r
177 the controller specified by ControllerHandle and \r
178 ChildHandle.\r
179 EFI_UNSUPPORTED - The driver specified by This does not support the \r
180 language specified by Language.\r
181\r
182--*/\r
183{\r
184 EFI_STATUS Status;\r
185 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;\r
186 WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *Private;\r
187\r
188 //\r
189 // This is a device driver, so ChildHandle must be NULL.\r
190 //\r
191 if (ChildHandle != NULL) {\r
192 return EFI_UNSUPPORTED;\r
193 }\r
194\r
195 //\r
196 // Make sure this driver is currently managing ControllerHandle\r
197 //\r
198 Status = EfiTestManagedDevice (\r
199 ControllerHandle,\r
200 gWinNtSimpleFileSystemDriverBinding.DriverBindingHandle,\r
201 &gEfiWinNtIoProtocolGuid\r
202 );\r
203 if (EFI_ERROR (Status)) {\r
204 return EFI_UNSUPPORTED;\r
205 }\r
206 //\r
207 // Get our context back\r
208 //\r
209 Status = gBS->OpenProtocol (\r
210 ControllerHandle,\r
211 &gEfiSimpleFileSystemProtocolGuid,\r
212 &SimpleFileSystem,\r
213 gWinNtSimpleFileSystemDriverBinding.DriverBindingHandle,\r
214 ControllerHandle,\r
215 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
216 );\r
217 if (EFI_ERROR (Status)) {\r
218 return EFI_UNSUPPORTED;\r
219 }\r
220\r
221 Private = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (SimpleFileSystem);\r
222\r
223 return LookupUnicodeString (\r
224 Language,\r
225 gWinNtSimpleFileSystemComponentName.SupportedLanguages,\r
226 Private->ControllerNameTable,\r
227 ControllerName\r
228 );\r
229}\r