]> git.proxmox.com Git - mirror_edk2.git/blame - EdkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.c
Updated MSA by putting Specification element at the end of the header section
[mirror_edk2.git] / EdkModulePkg / Bus / Pci / IdeBus / Dxe / ComponentName.c
CommitLineData
878ddf1f 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
f0ec738d 20#include "idebus.h"\r
878ddf1f 21\r
22//\r
23// EFI Component Name Protocol\r
24//\r
25EFI_COMPONENT_NAME_PROTOCOL gIDEBusComponentName = {\r
26 IDEBusComponentNameGetDriverName,\r
27 IDEBusComponentNameGetControllerName,\r
28 "eng"\r
29};\r
30\r
31STATIC EFI_UNICODE_STRING_TABLE mIDEBusDriverNameTable[] = {\r
32 { "eng", (CHAR16 *) L"PCI IDE/ATAPI Bus Driver" },\r
33 { NULL , NULL }\r
34};\r
35\r
36STATIC EFI_UNICODE_STRING_TABLE mIDEBusControllerNameTable[] = {\r
37 { "eng", (CHAR16 *) L"PCI IDE/ATAPI Controller" },\r
38 { NULL , NULL }\r
39};\r
40\r
41EFI_STATUS\r
42EFIAPI\r
43IDEBusComponentNameGetDriverName (\r
44 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
45 IN CHAR8 *Language,\r
46 OUT CHAR16 **DriverName\r
47 )\r
48/*++\r
49\r
50 Routine Description:\r
51 Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
52\r
53 Arguments:\r
54 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
55 Language - A pointer to a three character ISO 639-2 language identifier.\r
56 This is the language of the driver name that that the caller \r
57 is requesting, and it must match one of the languages specified\r
58 in SupportedLanguages. The number of languages supported by a \r
59 driver is up to the driver writer.\r
60 DriverName - A pointer to the Unicode string to return. This Unicode string\r
61 is the name of the driver specified by This in the language \r
62 specified by Language.\r
63\r
64 Returns:\r
65 EFI_SUCCESS - The Unicode string for the Driver specified by This\r
66 and the language specified by Language was returned \r
67 in DriverName.\r
68 EFI_INVALID_PARAMETER - Language is NULL.\r
69 EFI_INVALID_PARAMETER - DriverName is NULL.\r
70 EFI_UNSUPPORTED - The driver specified by This does not support the \r
71 language specified by Language.\r
72\r
73--*/\r
74{\r
75 return LookupUnicodeString (\r
76 Language,\r
77 gIDEBusComponentName.SupportedLanguages,\r
78 mIDEBusDriverNameTable,\r
79 DriverName\r
80 );\r
81}\r
82\r
83EFI_STATUS\r
84EFIAPI\r
85IDEBusComponentNameGetControllerName (\r
86 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
87 IN EFI_HANDLE ControllerHandle,\r
88 IN EFI_HANDLE ChildHandle OPTIONAL,\r
89 IN CHAR8 *Language,\r
90 OUT CHAR16 **ControllerName\r
91 )\r
92/*++\r
93\r
94 Routine Description:\r
95 Retrieves a Unicode string that is the user readable name of the controller\r
96 that is being managed by an EFI Driver.\r
97\r
98 Arguments:\r
99 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
100 ControllerHandle - The handle of a controller that the driver specified by \r
101 This is managing. This handle specifies the controller \r
102 whose name is to be returned.\r
103 ChildHandle - The handle of the child controller to retrieve the name \r
104 of. This is an optional parameter that may be NULL. It \r
105 will be NULL for device drivers. It will also be NULL \r
106 for a bus drivers that wish to retrieve the name of the \r
107 bus controller. It will not be NULL for a bus driver \r
108 that wishes to retrieve the name of a child controller.\r
109 Language - A pointer to a three character ISO 639-2 language \r
110 identifier. This is the language of the controller name \r
111 that that the caller is requesting, and it must match one\r
112 of the languages specified in SupportedLanguages. The \r
113 number of languages supported by a driver is up to the \r
114 driver writer.\r
115 ControllerName - A pointer to the Unicode string to return. This Unicode\r
116 string is the name of the controller specified by \r
117 ControllerHandle and ChildHandle in the language \r
118 specified by Language from the point of view of the \r
119 driver specified by This. \r
120\r
121 Returns:\r
122 EFI_SUCCESS - The Unicode string for the user readable name in the \r
123 language specified by Language for the driver \r
124 specified by This was returned in DriverName.\r
125 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
126 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid \r
127 EFI_HANDLE.\r
128 EFI_INVALID_PARAMETER - Language is NULL.\r
129 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
130 EFI_UNSUPPORTED - The driver specified by This is not currently \r
131 managing the controller specified by \r
132 ControllerHandle and ChildHandle.\r
133 EFI_UNSUPPORTED - The driver specified by This does not support the \r
134 language specified by Language.\r
135\r
136--*/\r
137{\r
138 EFI_STATUS Status;\r
139 EFI_BLOCK_IO_PROTOCOL *BlockIo;\r
140 IDE_BLK_IO_DEV *IdeBlkIoDevice;\r
141\r
142 //\r
143 // Get the controller context\r
144 //\r
145 Status = gBS->OpenProtocol (\r
146 ControllerHandle,\r
147 &gEfiCallerIdGuid,\r
148 NULL,\r
149 gIDEBusDriverBinding.DriverBindingHandle,\r
150 ControllerHandle,\r
151 EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
152 );\r
153 if (EFI_ERROR (Status)) {\r
154 return Status;\r
155 }\r
156\r
157 if (ChildHandle == NULL) {\r
158 return LookupUnicodeString (\r
159 Language,\r
160 gIDEBusComponentName.SupportedLanguages,\r
161 mIDEBusControllerNameTable,\r
162 ControllerName\r
163 );\r
164 }\r
165\r
166 //\r
167 // Get the child context\r
168 //\r
169 Status = gBS->OpenProtocol (\r
170 ChildHandle,\r
171 &gEfiBlockIoProtocolGuid,\r
172 (VOID **) &BlockIo,\r
173 gIDEBusDriverBinding.DriverBindingHandle,\r
174 ChildHandle,\r
175 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
176 );\r
177 if (EFI_ERROR (Status)) {\r
178 return EFI_UNSUPPORTED;\r
179 }\r
180\r
181 IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_THIS (BlockIo);\r
182\r
183 return LookupUnicodeString (\r
184 Language,\r
185 gIDEBusComponentName.SupportedLanguages,\r
186 IdeBlkIoDevice->ControllerNameTable,\r
187 ControllerName\r
188 );\r
189}\r
190\r
191VOID\r
192AddName (\r
193 IN IDE_BLK_IO_DEV *IdeBlkIoDevicePtr\r
194 )\r
195/*++\r
196\r
197 Routine Description:\r
198 Add the component name for the IDE/ATAPI device\r
199\r
200 Arguments:\r
201 IdeBlkIoDevicePtr - A pointer to the IDE_BLK_IO_DEV instance.\r
202\r
203 Returns:\r
204\r
205--*/\r
206{\r
207 UINTN StringIndex;\r
208 CHAR16 ModelName[41];\r
209\r
210 //\r
211 // Add Component Name for the IDE/ATAPI device that was discovered.\r
212 //\r
213 IdeBlkIoDevicePtr->ControllerNameTable = NULL;\r
214 for (StringIndex = 0; StringIndex < 41; StringIndex++) {\r
215 ModelName[StringIndex] = IdeBlkIoDevicePtr->ModelName[StringIndex];\r
216 }\r
217\r
218 AddUnicodeString (\r
219 "eng",\r
220 gIDEBusComponentName.SupportedLanguages,\r
221 &IdeBlkIoDevicePtr->ControllerNameTable,\r
222 ModelName\r
223 );\r
224}\r