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