]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/ComponentName.c
Cleanup the license header
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / IsaFloppyDxe / ComponentName.c
CommitLineData
f8cd287b 1/**@file\r
11f43dfd 2\r
f8cd287b 3 \r
4Copyright (c) 2006 - 2007, Intel Corporation.<BR>\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
6db49ee6 9\r
f8cd287b 10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11f43dfd 12\r
f8cd287b 13**/\r
11f43dfd 14\r
15#include "IsaFloppy.h"\r
16\r
17//\r
18// EFI Component Name Protocol\r
19//\r
20EFI_COMPONENT_NAME_PROTOCOL gIsaFloppyComponentName = {\r
21 IsaFloppyComponentNameGetDriverName,\r
22 IsaFloppyComponentNameGetControllerName,\r
23 "eng"\r
24};\r
25\r
26STATIC EFI_UNICODE_STRING_TABLE mIsaFloppyDriverNameTable[] = {\r
27 {\r
28 "eng",\r
29 L"ISA Floppy Driver"\r
30 },\r
31 {\r
32 NULL,\r
33 NULL\r
34 }\r
35};\r
36\r
37EFI_STATUS\r
38EFIAPI\r
39IsaFloppyComponentNameGetDriverName (\r
40 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
41 IN CHAR8 *Language,\r
42 OUT CHAR16 **DriverName\r
43 )\r
44/*++\r
45\r
46 Routine Description:\r
47 \r
48 Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
49\r
50 Arguments:\r
51 \r
52 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
53 Language - A pointer to a three character ISO 639-2 language identifier.\r
54 This is the language of the driver name that that the caller \r
55 is requesting, and it must match one of the languages specified\r
56 in SupportedLanguages. The number of languages supported by a \r
57 driver is up to the driver writer.\r
58 DriverName - A pointer to the Unicode string to return. This Unicode string\r
59 is the name of the driver specified by This in the language \r
60 specified by Language.\r
61\r
62 Returns:\r
63 \r
64 EFI_SUCCESS - The Unicode string for the Driver specified by This\r
65 and the language specified by Language was returned \r
66 in DriverName.\r
67 EFI_INVALID_PARAMETER - Language is NULL.\r
68 EFI_INVALID_PARAMETER - DriverName is NULL.\r
69 EFI_UNSUPPORTED - The driver specified by This does not support the \r
70 language specified by Language.\r
71\r
72--*/\r
73{\r
74 return LookupUnicodeString (\r
75 Language,\r
76 gIsaFloppyComponentName.SupportedLanguages,\r
77 mIsaFloppyDriverNameTable,\r
78 DriverName\r
79 );\r
80}\r
81\r
82EFI_STATUS\r
83EFIAPI\r
84IsaFloppyComponentNameGetControllerName (\r
85 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
86 IN EFI_HANDLE ControllerHandle,\r
87 IN EFI_HANDLE ChildHandle OPTIONAL,\r
88 IN CHAR8 *Language,\r
89 OUT CHAR16 **ControllerName\r
90 )\r
91/*++\r
92\r
93 Routine Description:\r
94 \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 \r
100 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
101 ControllerHandle - The handle of a controller that the driver specified by \r
102 This is managing. This handle specifies the controller \r
103 whose name is to be returned.\r
104 ChildHandle - The handle of the child controller to retrieve the name \r
105 of. This is an optional parameter that may be NULL. It \r
106 will be NULL for device drivers. It will also be NULL \r
107 for a bus drivers that wish to retrieve the name of the \r
108 bus controller. It will not be NULL for a bus driver \r
109 that wishes to retrieve the name of a child controller.\r
110 Language - A pointer to a three character ISO 639-2 language \r
111 identifier. This is the language of the controller name \r
112 that that the caller is requesting, and it must match one\r
113 of the languages specified in SupportedLanguages. The \r
114 number of languages supported by a driver is up to the \r
115 driver writer.\r
116 ControllerName - A pointer to the Unicode string to return. This Unicode\r
117 string is the name of the controller specified by \r
118 ControllerHandle and ChildHandle in the language \r
119 specified by Language from the point of view of the \r
120 driver specified by This. \r
121\r
122 Returns:\r
123 \r
124 EFI_SUCCESS - The Unicode string for the user readable name in the \r
125 language specified by Language for the driver \r
126 specified by This was returned in DriverName.\r
127 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
128 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid \r
129 EFI_HANDLE.\r
130 EFI_INVALID_PARAMETER - Language is NULL.\r
131 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
132 EFI_UNSUPPORTED - The driver specified by This is not currently \r
133 managing the controller specified by \r
134 ControllerHandle and ChildHandle.\r
135 EFI_UNSUPPORTED - The driver specified by This does not support the \r
136 language specified by Language.\r
137\r
138--*/\r
139{\r
140 EFI_STATUS Status;\r
141 EFI_BLOCK_IO_PROTOCOL *BlkIo;\r
142 FDC_BLK_IO_DEV *FdcDev;\r
143 EFI_ISA_IO_PROTOCOL *IsaIoProtocol;\r
144\r
145 //\r
146 // This is a device driver, so ChildHandle must be NULL.\r
147 //\r
148 if (ChildHandle != NULL) {\r
149 return EFI_UNSUPPORTED;\r
150 }\r
151 //\r
152 // Check Controller's handle\r
153 //\r
154 Status = gBS->OpenProtocol (\r
155 ControllerHandle,\r
156 &gEfiIsaIoProtocolGuid,\r
157 (VOID **) &IsaIoProtocol,\r
158 gFdcControllerDriver.DriverBindingHandle,\r
159 ControllerHandle,\r
160 EFI_OPEN_PROTOCOL_BY_DRIVER\r
161 );\r
162 if (!EFI_ERROR (Status)) {\r
163 gBS->CloseProtocol (\r
164 ControllerHandle,\r
165 &gEfiIsaIoProtocolGuid,\r
166 gFdcControllerDriver.DriverBindingHandle,\r
167 ControllerHandle\r
168 );\r
169\r
170 return EFI_UNSUPPORTED;\r
171 }\r
172\r
173 if (Status != EFI_ALREADY_STARTED) {\r
174 return EFI_UNSUPPORTED;\r
175 }\r
176 //\r
177 // Get the Block I/O Protocol on Controller\r
178 //\r
179 Status = gBS->OpenProtocol (\r
180 ControllerHandle,\r
181 &gEfiBlockIoProtocolGuid,\r
182 (VOID **) &BlkIo,\r
183 gFdcControllerDriver.DriverBindingHandle,\r
184 ControllerHandle,\r
185 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
186 );\r
187 if (EFI_ERROR (Status)) {\r
188 return Status;\r
189 }\r
190 //\r
191 // Get the Floppy Disk Controller's Device structure\r
192 //\r
193 FdcDev = FDD_BLK_IO_FROM_THIS (BlkIo);\r
194\r
195 return LookupUnicodeString (\r
196 Language,\r
197 gIsaFloppyComponentName.SupportedLanguages,\r
198 FdcDev->ControllerNameTable,\r
199 ControllerName\r
200 );\r
201}\r
202\r
203VOID\r
204AddName (\r
205 IN FDC_BLK_IO_DEV *FdcDev\r
206 )\r
207/*++\r
208\r
209 Routine Description:\r
210 \r
211 Add the component name for the floppy device\r
212\r
213 Arguments:\r
214 \r
215 FdcDev - A pointer to the FDC_BLK_IO_DEV instance.\r
216\r
217 Returns:\r
218\r
219 None\r
220 \r
221--*/\r
222{\r
223 CHAR16 FloppyDriveName[FLOPPY_DRIVE_NAME_ASCII_LEN + 1];\r
224\r
225 StrCpy (FloppyDriveName, FLOPPY_DRIVE_NAME);\r
226 FloppyDriveName[FLOPPY_DRIVE_NAME_ASCII_LEN - 1] = (CHAR16) (L'0' + FdcDev->Disk);\r
227 AddUnicodeString (\r
228 "eng",\r
229 gIsaFloppyComponentName.SupportedLanguages,\r
230 &FdcDev->ControllerNameTable,\r
231 FloppyDriveName\r
232 );\r
233}\r