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
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.
20 // The package level header files this module uses
25 // The protocols, PPI and GUID defintions for this module
27 #include <Guid/FileSystemVolumeLabelInfo.h>
28 #include <Protocol/WinNtIo.h>
29 #include <Protocol/ComponentName.h>
30 #include <Guid/FileInfo.h>
31 #include <Protocol/DriverBinding.h>
32 #include <Guid/FileSystemInfo.h>
33 #include <Protocol/SimpleFileSystem.h>
35 // The Library classes this module consumes
37 #include <Library/DebugLib.h>
38 #include <Library/BaseLib.h>
39 #include <Library/UefiDriverEntryPoint.h>
40 #include <Library/UefiLib.h>
41 #include <Library/BaseMemoryLib.h>
42 #include <Library/UefiBootServicesTableLib.h>
43 #include <Library/MemoryAllocationLib.h>
45 #include "WinNtSimpleFileSystem.h"
48 // EFI Component Name Functions
52 WinNtSimpleFileSystemComponentNameGetDriverName (
53 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
55 OUT CHAR16
**DriverName
60 WinNtSimpleFileSystemComponentNameGetControllerName (
61 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
62 IN EFI_HANDLE ControllerHandle
,
63 IN EFI_HANDLE ChildHandle OPTIONAL
,
65 OUT CHAR16
**ControllerName
69 // EFI Component Name Protocol
71 EFI_COMPONENT_NAME_PROTOCOL gWinNtSimpleFileSystemComponentName
= {
72 WinNtSimpleFileSystemComponentNameGetDriverName
,
73 WinNtSimpleFileSystemComponentNameGetControllerName
,
77 static EFI_UNICODE_STRING_TABLE mWinNtSimpleFileSystemDriverNameTable
[] = {
80 L
"Windows Simple File System Driver"
90 WinNtSimpleFileSystemComponentNameGetDriverName (
91 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
93 OUT CHAR16
**DriverName
98 Retrieves a Unicode string that is the user readable name of the EFI Driver.
101 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
102 Language - A pointer to a three character ISO 639-2 language identifier.
103 This is the language of the driver name that that the caller
104 is requesting, and it must match one of the languages specified
105 in SupportedLanguages. The number of languages supported by a
106 driver is up to the driver writer.
107 DriverName - A pointer to the Unicode string to return. This Unicode string
108 is the name of the driver specified by This in the language
109 specified by Language.
112 EFI_SUCCESS - The Unicode string for the Driver specified by This
113 and the language specified by Language was returned
115 EFI_INVALID_PARAMETER - Language is NULL.
116 EFI_INVALID_PARAMETER - DriverName is NULL.
117 EFI_UNSUPPORTED - The driver specified by This does not support the
118 language specified by Language.
122 return LookupUnicodeString (
124 gWinNtSimpleFileSystemComponentName
.SupportedLanguages
,
125 mWinNtSimpleFileSystemDriverNameTable
,
132 WinNtSimpleFileSystemComponentNameGetControllerName (
133 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
134 IN EFI_HANDLE ControllerHandle
,
135 IN EFI_HANDLE ChildHandle OPTIONAL
,
137 OUT CHAR16
**ControllerName
142 Retrieves a Unicode string that is the user readable name of the controller
143 that is being managed by an EFI Driver.
146 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
147 ControllerHandle - The handle of a controller that the driver specified by
148 This is managing. This handle specifies the controller
149 whose name is to be returned.
150 ChildHandle - The handle of the child controller to retrieve the name
151 of. This is an optional parameter that may be NULL. It
152 will be NULL for device drivers. It will also be NULL
153 for a bus drivers that wish to retrieve the name of the
154 bus controller. It will not be NULL for a bus driver
155 that wishes to retrieve the name of a child controller.
156 Language - A pointer to a three character ISO 639-2 language
157 identifier. This is the language of the controller name
158 that that the caller is requesting, and it must match one
159 of the languages specified in SupportedLanguages. The
160 number of languages supported by a driver is up to the
162 ControllerName - A pointer to the Unicode string to return. This Unicode
163 string is the name of the controller specified by
164 ControllerHandle and ChildHandle in the language specified
165 by Language from the point of view of the driver specified
169 EFI_SUCCESS - The Unicode string for the user readable name in the
170 language specified by Language for the driver
171 specified by This was returned in DriverName.
172 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
173 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
174 EFI_INVALID_PARAMETER - Language is NULL.
175 EFI_INVALID_PARAMETER - ControllerName is NULL.
176 EFI_UNSUPPORTED - The driver specified by This is not currently managing
177 the controller specified by ControllerHandle and
179 EFI_UNSUPPORTED - The driver specified by This does not support the
180 language specified by Language.
185 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
*SimpleFileSystem
;
186 WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE
*Private
;
189 // This is a device driver, so ChildHandle must be NULL.
191 if (ChildHandle
!= NULL
) {
192 return EFI_UNSUPPORTED
;
196 // Make sure this driver is currently managing ControllerHandle
198 Status
= EfiTestManagedDevice (
200 gWinNtSimpleFileSystemDriverBinding
.DriverBindingHandle
,
201 &gEfiWinNtIoProtocolGuid
203 if (EFI_ERROR (Status
)) {
204 return EFI_UNSUPPORTED
;
207 // Get our context back
209 Status
= gBS
->OpenProtocol (
211 &gEfiSimpleFileSystemProtocolGuid
,
213 gWinNtSimpleFileSystemDriverBinding
.DriverBindingHandle
,
215 EFI_OPEN_PROTOCOL_GET_PROTOCOL
217 if (EFI_ERROR (Status
)) {
218 return EFI_UNSUPPORTED
;
221 Private
= WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (SimpleFileSystem
);
223 return LookupUnicodeString (
225 gWinNtSimpleFileSystemComponentName
.SupportedLanguages
,
226 Private
->ControllerNameTable
,