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