]> git.proxmox.com Git - mirror_edk2.git/blame - DuetPkg/IdeControllerDxe/IdeControllerName.c
Add PcdVerifyNoteInList for judge whether do verification of node in list in debug...
[mirror_edk2.git] / DuetPkg / IdeControllerDxe / IdeControllerName.c
CommitLineData
93d4ce91 1/*++\r
2\r
3Copyright (c) 2006 - 2007 Intel Corporation. All rights reserved\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
12\r
13Module Name:\r
14 \r
15 IdeControllerName.c\r
16\r
17Abstract: \r
18\r
19 This portion is to register the IDE Controller Driver name:\r
20 "IDE Controller Init Driver"\r
21\r
22Revision History\r
23--*/\r
24\r
25#include "IdeController.h"\r
26\r
27EFI_STATUS\r
28EFIAPI\r
29IdeControllerGetDriverName (\r
30 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
31 IN CHAR8 *Language,\r
32 OUT CHAR16 **DriverName\r
33 );\r
34 \r
35EFI_STATUS\r
36EFIAPI\r
37IdeControllerGetControllerName (\r
38 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
39 IN EFI_HANDLE ControllerHandle,\r
40 IN EFI_HANDLE ChildHandle OPTIONAL,\r
41 IN CHAR8 *Language,\r
42 OUT CHAR16 **ControllerName\r
43 );\r
44 \r
45//\r
46// EFI Component Name Protocol\r
47// This portion declares a gloabl variable of EFI_COMPONENT_NAME_PROTOCOL type.\r
48// It initializes the followings:\r
49// .GetDriverName() to PlatformIdeGetDriverName() and\r
50// SupportedLanguages to LANGUAGE_CODE_ENGLISH (3 char ISO639-2 language indetifier)\r
51//\r
52GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gIdeControllerName = {\r
53 IdeControllerGetDriverName,\r
54 IdeControllerGetControllerName,\r
55 "eng" // Egnlish\r
56};\r
57\r
58GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gIdeControllerName2 = {\r
59 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) IdeControllerGetDriverName,\r
60 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) IdeControllerGetControllerName,\r
61 "en" // Egnlish\r
62};\r
63\r
64//\r
65// Define the Driver's unicode name string\r
66// IDE controller Driver name string and IDE Controller Name string\r
67//\r
68static EFI_UNICODE_STRING_TABLE mIdeControllerDriverNameTable[] = {\r
69 {\r
70 "eng;en",\r
71 L"IDE Controller Init Driver"\r
72 },\r
73 {\r
74 NULL,\r
75 NULL\r
76 }\r
77};\r
78\r
79static EFI_UNICODE_STRING_TABLE mIdeControllerControllerNameTable[] = {\r
80 {\r
81 "eng;en",\r
82 L"ICH IDE Controller"\r
83 },\r
84 {\r
85 NULL,\r
86 NULL\r
87 }\r
88};\r
89\r
90\r
91EFI_STATUS\r
92EFIAPI\r
93IdeControllerGetDriverName (\r
94 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
95 IN CHAR8 *Language,\r
96 OUT CHAR16 **DriverName\r
97 )\r
98/*++\r
99\r
100 Routine Description:\r
101 Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
102\r
103 Arguments:\r
104 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
105 Language - A pointer to a three character ISO 639-2 language identifier.\r
106 This is the language of the driver name that that the caller \r
107 is requesting, and it must match one of the languages specified\r
108 in SupportedLanguages. The number of languages supported by a \r
109 driver is up to the driver writer.\r
110 DriverName - A pointer to the Unicode string to return. This Unicode string\r
111 is the name of the driver specified by This in the language \r
112 specified by Language.\r
113\r
114 Returns:\r
115 EFI_SUCCESS - The Unicode string for the Driver specified by This\r
116 and the language specified by Language was returned \r
117 in DriverName.\r
118 EFI_INVALID_PARAMETER - Language is NULL.\r
119 EFI_INVALID_PARAMETER - DriverName is NULL.\r
120 EFI_UNSUPPORTED - The driver specified by This does not support the \r
121 language specified by Language.\r
122\r
123--*/\r
124{\r
125\r
126 return LookupUnicodeString2 (\r
127 Language,\r
128 This->SupportedLanguages,\r
129 mIdeControllerDriverNameTable,\r
130 DriverName,\r
131 (BOOLEAN)(This == &gIdeControllerName)\r
132 );\r
133}\r
134\r
135EFI_STATUS\r
136EFIAPI\r
137IdeControllerGetControllerName (\r
138 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
139 IN EFI_HANDLE ControllerHandle,\r
140 IN EFI_HANDLE ChildHandle OPTIONAL,\r
141 IN CHAR8 *Language,\r
142 OUT CHAR16 **ControllerName\r
143 )\r
144/*++\r
145\r
146 Routine Description:\r
147 Retrieves a Unicode string that is the user readable name of the controller\r
148 that is being managed by an EFI Driver.\r
149\r
150 Arguments:\r
151 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
152 ControllerHandle - The handle of a controller that the driver specified by \r
153 This is managing. This handle specifies the controller \r
154 whose name is to be returned.\r
155 ChildHandle - The handle of the child controller to retrieve the name \r
156 of. This is an optional parameter that may be NULL. It \r
157 will be NULL for device drivers. It will also be NULL \r
158 for a bus drivers that wish to retrieve the name of the \r
159 bus controller. It will not be NULL for a bus driver \r
160 that wishes to retrieve the name of a child controller.\r
161 Language - A pointer to a three character ISO 639-2 language \r
162 identifier. This is the language of the controller name \r
163 that that the caller is requesting, and it must match one\r
164 of the languages specified in SupportedLanguages. The \r
165 number of languages supported by a driver is up to the \r
166 driver writer.\r
167 ControllerName - A pointer to the Unicode string to return. This Unicode\r
168 string is the name of the controller specified by \r
169 ControllerHandle and ChildHandle in the language \r
170 specified by Language from the point of view of the \r
171 driver specified by This. \r
172\r
173 Returns:\r
174 EFI_SUCCESS - The Unicode string for the user readable name in the \r
175 language specified by Language for the driver \r
176 specified by This was returned in DriverName.\r
177 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
178 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid \r
179 EFI_HANDLE.\r
180 EFI_INVALID_PARAMETER - Language is NULL.\r
181 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
182 EFI_UNSUPPORTED - The driver specified by This is not currently \r
183 managing the controller specified by \r
184 ControllerHandle and ChildHandle.\r
185 EFI_UNSUPPORTED - The driver specified by This does not support the \r
186 language specified by Language.\r
187\r
188--*/\r
189{\r
190 EFI_STATUS Status;\r
191\r
192 if (ChildHandle != NULL) {\r
193 return EFI_UNSUPPORTED;\r
194 }\r
195\r
196 //\r
197 // Make sure this driver is currently managing ControllHandle\r
198 //\r
199 Status = EfiTestManagedDevice (\r
200 ControllerHandle,\r
201 gIdeControllerDriverBinding.DriverBindingHandle,\r
202 &gEfiPciIoProtocolGuid\r
203 );\r
204 if (EFI_ERROR (Status)) {\r
205 return Status;\r
206 }\r
207\r
208 return LookupUnicodeString2 (\r
209 Language,\r
210 This->SupportedLanguages,\r
211 mIdeControllerControllerNameTable,\r
212 ControllerName,\r
213 (BOOLEAN)(This == &gIdeControllerName)\r
214 );\r
215}\r