]>
Commit | Line | Data |
---|---|---|
d6321d6e | 1 | /** @file\r |
2 | Include file for ISA Floppy Driver\r | |
0a6f4824 LG |
3 | \r |
4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
c0a00b14 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
11f43dfd | 6 | \r |
f8cd287b | 7 | **/\r |
11f43dfd | 8 | \r |
d6321d6e | 9 | #ifndef _ISA_FLOPPY_H_\r |
10 | #define _ISA_FLOPPY_H_\r | |
11f43dfd | 11 | \r |
d6321d6e | 12 | #include <Uefi.h>\r |
ed7748fe | 13 | \r |
11f43dfd | 14 | #include <Protocol/BlockIo.h>\r |
15 | #include <Protocol/IsaIo.h>\r | |
16 | #include <Protocol/DevicePath.h>\r | |
d6321d6e | 17 | #include <Guid/StatusCodeDataTypeId.h>\r |
ed7748fe | 18 | \r |
11f43dfd | 19 | #include <Library/TimerLib.h>\r |
20 | #include <Library/DebugLib.h>\r | |
21 | #include <Library/UefiDriverEntryPoint.h>\r | |
22 | #include <Library/BaseLib.h>\r | |
23 | #include <Library/UefiLib.h>\r | |
24 | #include <Library/BaseMemoryLib.h>\r | |
25 | #include <Library/MemoryAllocationLib.h>\r | |
26 | #include <Library/UefiBootServicesTableLib.h>\r | |
27 | #include <Library/ReportStatusCodeLib.h>\r | |
d6321d6e | 28 | #include <Library/PcdLib.h>\r |
29 | \r | |
f3d08ccf | 30 | extern EFI_DRIVER_BINDING_PROTOCOL gFdcControllerDriver;\r |
11f43dfd | 31 | \r |
11f43dfd | 32 | #define STALL_1_SECOND 1000000\r |
33 | #define STALL_1_MSECOND 1000\r | |
34 | \r | |
35 | #define DATA_IN 1\r | |
36 | #define DATA_OUT 0\r | |
37 | #define READ 0\r | |
38 | #define WRITE 1\r | |
39 | \r | |
40 | //\r | |
41 | // Internal Data Structures\r | |
42 | //\r | |
f02bd376 | 43 | #define FDC_BLK_IO_DEV_SIGNATURE SIGNATURE_32 ('F', 'B', 'I', 'O')\r |
44 | #define FLOPPY_CONTROLLER_CONTEXT_SIGNATURE SIGNATURE_32 ('F', 'D', 'C', 'C')\r | |
11f43dfd | 45 | \r |
46 | typedef enum {\r | |
d6321d6e | 47 | FdcDisk0 = 0,\r |
48 | FdcDisk1 = 1,\r | |
49 | FdcMaxDisk = 2\r | |
11f43dfd | 50 | } EFI_FDC_DISK;\r |
51 | \r | |
52 | typedef struct {\r | |
53 | UINT32 Signature;\r | |
d6321d6e | 54 | LIST_ENTRY Link;\r |
11f43dfd | 55 | BOOLEAN FddResetPerformed;\r |
56 | EFI_STATUS FddResetStatus;\r | |
57 | BOOLEAN NeedRecalibrate;\r | |
58 | UINT8 NumberOfDrive;\r | |
59 | UINT16 BaseAddress;\r | |
60 | } FLOPPY_CONTROLLER_CONTEXT;\r | |
61 | \r | |
62 | typedef struct {\r | |
63 | UINTN Signature;\r | |
64 | EFI_HANDLE Handle;\r | |
65 | EFI_BLOCK_IO_PROTOCOL BlkIo;\r | |
66 | EFI_BLOCK_IO_MEDIA BlkMedia;\r | |
67 | \r | |
68 | EFI_ISA_IO_PROTOCOL *IsaIo;\r | |
69 | \r | |
70 | UINT16 BaseAddress;\r | |
71 | \r | |
72 | EFI_FDC_DISK Disk;\r | |
73 | UINT8 PresentCylinderNumber;\r | |
74 | UINT8 *Cache;\r | |
75 | \r | |
76 | EFI_EVENT Event;\r | |
77 | EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r | |
78 | FLOPPY_CONTROLLER_CONTEXT *ControllerState;\r | |
79 | \r | |
80 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
81 | } FDC_BLK_IO_DEV;\r | |
82 | \r | |
83 | #include "ComponentName.h"\r | |
84 | \r | |
85 | #define FDD_BLK_IO_FROM_THIS(a) CR (a, FDC_BLK_IO_DEV, BlkIo, FDC_BLK_IO_DEV_SIGNATURE)\r | |
86 | #define FLOPPY_CONTROLLER_FROM_LIST_ENTRY(a) \\r | |
d6321d6e | 87 | CR (a, \\r |
88 | FLOPPY_CONTROLLER_CONTEXT, \\r | |
89 | Link, \\r | |
90 | FLOPPY_CONTROLLER_CONTEXT_SIGNATURE \\r | |
91 | )\r | |
11f43dfd | 92 | \r |
93 | #define DISK_1440K_EOT 0x12\r | |
94 | #define DISK_1440K_GPL 0x1b\r | |
95 | #define DISK_1440K_DTL 0xff\r | |
96 | #define DISK_1440K_NUMBER 0x02\r | |
97 | #define DISK_1440K_MAXTRACKNUM 0x4f\r | |
98 | #define DISK_1440K_BYTEPERSECTOR 512\r | |
99 | \r | |
100 | typedef struct {\r | |
101 | UINT8 CommandCode;\r | |
102 | UINT8 DiskHeadSel;\r | |
103 | UINT8 Cylinder;\r | |
104 | UINT8 Head;\r | |
105 | UINT8 Sector;\r | |
106 | UINT8 Number;\r | |
107 | UINT8 EndOfTrack;\r | |
108 | UINT8 GapLength;\r | |
109 | UINT8 DataLength;\r | |
110 | } FDD_COMMAND_PACKET1;\r | |
111 | \r | |
112 | typedef struct {\r | |
113 | UINT8 CommandCode;\r | |
114 | UINT8 DiskHeadSel;\r | |
115 | } FDD_COMMAND_PACKET2;\r | |
116 | \r | |
117 | typedef struct {\r | |
118 | UINT8 CommandCode;\r | |
119 | UINT8 SrtHut;\r | |
120 | UINT8 HltNd;\r | |
121 | } FDD_SPECIFY_CMD;\r | |
122 | \r | |
123 | typedef struct {\r | |
124 | UINT8 CommandCode;\r | |
125 | UINT8 DiskHeadSel;\r | |
126 | UINT8 NewCylinder;\r | |
127 | } FDD_SEEK_CMD;\r | |
128 | \r | |
129 | typedef struct {\r | |
130 | UINT8 CommandCode;\r | |
131 | UINT8 DiskHeadSel;\r | |
132 | UINT8 Cylinder;\r | |
133 | UINT8 Head;\r | |
134 | UINT8 Sector;\r | |
135 | UINT8 EndOfTrack;\r | |
136 | UINT8 GapLength;\r | |
137 | UINT8 ScanTestPause;\r | |
138 | } FDD_SCAN_CMD;\r | |
139 | \r | |
140 | typedef struct {\r | |
141 | UINT8 Status0;\r | |
142 | UINT8 Status1;\r | |
143 | UINT8 Status2;\r | |
d6321d6e | 144 | UINT8 Cylinder;\r |
145 | UINT8 Head;\r | |
146 | UINT8 Sector;\r | |
11f43dfd | 147 | UINT8 Number;\r |
148 | } FDD_RESULT_PACKET;\r | |
149 | \r | |
150 | //\r | |
151 | // FDC Registers\r | |
152 | //\r | |
153 | //\r | |
d6321d6e | 154 | // Digital Output Register address offset\r |
11f43dfd | 155 | //\r |
156 | #define FDC_REGISTER_DOR 2\r | |
157 | \r | |
158 | //\r | |
d6321d6e | 159 | // Main Status Register address offset\r |
11f43dfd | 160 | //\r |
161 | #define FDC_REGISTER_MSR 4\r | |
162 | \r | |
163 | //\r | |
d6321d6e | 164 | // Data Register address offset\r |
11f43dfd | 165 | //\r |
166 | #define FDC_REGISTER_DTR 5\r | |
167 | \r | |
168 | //\r | |
d6321d6e | 169 | // Configuration Control Register(data rate select) address offset\r |
11f43dfd | 170 | //\r |
171 | #define FDC_REGISTER_CCR 7\r | |
172 | \r | |
173 | //\r | |
d6321d6e | 174 | // Digital Input Register(diskchange) address offset\r |
11f43dfd | 175 | //\r |
176 | #define FDC_REGISTER_DIR 7\r | |
177 | \r | |
178 | \r | |
11f43dfd | 179 | //\r |
180 | // FDC Register Bit Definitions\r | |
181 | //\r | |
182 | //\r | |
183 | // Digital Out Register(WO)\r | |
184 | //\r | |
185 | //\r | |
186 | // Select Drive: 0=A 1=B\r | |
187 | //\r | |
188 | #define SELECT_DRV BIT0\r | |
189 | \r | |
190 | //\r | |
191 | // Reset FDC\r | |
192 | //\r | |
193 | #define RESET_FDC BIT2\r | |
194 | \r | |
195 | //\r | |
196 | // Enable Int & DMA\r | |
197 | //\r | |
198 | #define INT_DMA_ENABLE BIT3\r | |
199 | \r | |
200 | //\r | |
201 | // Turn On Drive A Motor\r | |
202 | //\r | |
203 | #define DRVA_MOTOR_ON BIT4\r | |
204 | \r | |
205 | //\r | |
206 | // Turn On Drive B Motor\r | |
207 | //\r | |
208 | #define DRVB_MOTOR_ON BIT5\r | |
209 | \r | |
210 | //\r | |
211 | // Main Status Register(RO)\r | |
212 | //\r | |
213 | //\r | |
214 | // Drive A Busy\r | |
215 | //\r | |
216 | #define MSR_DAB BIT0\r | |
217 | \r | |
218 | //\r | |
219 | // Drive B Busy\r | |
220 | //\r | |
221 | #define MSR_DBB BIT1\r | |
222 | \r | |
223 | //\r | |
224 | // FDC Busy\r | |
225 | //\r | |
226 | #define MSR_CB BIT4\r | |
227 | \r | |
228 | //\r | |
229 | // Non-DMA Mode\r | |
230 | //\r | |
231 | #define MSR_NDM BIT5\r | |
232 | \r | |
233 | //\r | |
234 | // Data Input/Output\r | |
235 | //\r | |
236 | #define MSR_DIO BIT6\r | |
237 | \r | |
238 | //\r | |
239 | // Request For Master\r | |
240 | //\r | |
241 | #define MSR_RQM BIT7\r | |
242 | \r | |
243 | //\r | |
244 | // Configuration Control Register(WO)\r | |
245 | //\r | |
246 | //\r | |
247 | // Data Rate select\r | |
248 | //\r | |
249 | #define CCR_DRC (BIT0 | BIT1)\r | |
250 | \r | |
251 | //\r | |
252 | // Digital Input Register(RO)\r | |
253 | //\r | |
254 | //\r | |
255 | // Disk change line\r | |
256 | //\r | |
257 | #define DIR_DCL BIT7\r | |
258 | //\r | |
259 | // #define CCR_DCL BIT7 // Diskette change\r | |
260 | //\r | |
261 | // 500K\r | |
262 | //\r | |
263 | #define DRC_500KBS 0x0\r | |
264 | \r | |
265 | //\r | |
266 | // 300K\r | |
267 | //\r | |
268 | #define DRC_300KBS 0x01\r | |
269 | \r | |
270 | //\r | |
271 | // 250K\r | |
272 | //\r | |
273 | #define DRC_250KBS 0x02\r | |
274 | \r | |
275 | //\r | |
276 | // FDC Command Code\r | |
277 | //\r | |
278 | #define READ_DATA_CMD 0x06\r | |
279 | #define WRITE_DATA_CMD 0x05\r | |
280 | #define WRITE_DEL_DATA_CMD 0x09\r | |
281 | #define READ_DEL_DATA_CMD 0x0C\r | |
282 | #define READ_TRACK_CMD 0x02\r | |
283 | #define READ_ID_CMD 0x0A\r | |
284 | #define FORMAT_TRACK_CMD 0x0D\r | |
285 | #define SCAN_EQU_CMD 0x11\r | |
286 | #define SCAN_LOW_EQU_CMD 0x19\r | |
287 | #define SCAN_HIGH_EQU_CMD 0x1D\r | |
288 | #define SEEK_CMD 0x0F\r | |
289 | #define RECALIBRATE_CMD 0x07\r | |
290 | #define SENSE_INT_STATUS_CMD 0x08\r | |
291 | #define SPECIFY_CMD 0x03\r | |
292 | #define SENSE_DRV_STATUS_CMD 0x04\r | |
293 | \r | |
294 | //\r | |
295 | // CMD_MT: Multi_Track Selector\r | |
296 | // when set , this flag selects the multi-track operating mode.\r | |
297 | // In this mode, the FDC treats a complete cylinder under head0 and 1\r | |
298 | // as a single track\r | |
299 | //\r | |
300 | #define CMD_MT BIT7\r | |
301 | \r | |
302 | //\r | |
303 | // CMD_MFM: MFM/FM Mode Selector\r | |
304 | // A one selects the double density(MFM) mode\r | |
305 | // A zero selects single density (FM) mode\r | |
306 | //\r | |
307 | #define CMD_MFM BIT6\r | |
308 | \r | |
309 | //\r | |
310 | // CMD_SK: Skip Flag\r | |
311 | // When set to 1, sectors containing a deleted data address mark will\r | |
312 | // automatically be skipped during the execution of Read Data.\r | |
313 | // When set to 0, the sector is read or written the same as the read and\r | |
314 | // write commands.\r | |
315 | //\r | |
316 | #define CMD_SK BIT5\r | |
317 | \r | |
318 | //\r | |
319 | // FDC Status Register Bit Definitions\r | |
320 | //\r | |
321 | //\r | |
322 | // Status Register 0\r | |
323 | //\r | |
324 | //\r | |
325 | // Interrupt Code\r | |
326 | //\r | |
327 | #define STS0_IC (BIT7 | BIT6)\r | |
328 | \r | |
329 | //\r | |
330 | // Seek End: the FDC completed a seek or recalibrate command\r | |
331 | //\r | |
332 | #define STS0_SE BIT5\r | |
333 | \r | |
334 | //\r | |
335 | // Equipment Check\r | |
336 | //\r | |
337 | #define STS0_EC BIT4\r | |
338 | \r | |
339 | //\r | |
340 | // Not Ready(unused), this bit is always 0\r | |
341 | //\r | |
342 | #define STS0_NR BIT3\r | |
343 | \r | |
344 | //\r | |
345 | // Head Address: the current head address\r | |
346 | //\r | |
347 | #define STS0_HA BIT2\r | |
348 | \r | |
349 | //\r | |
350 | // STS0_US1 & STS0_US0: Drive Select(the current selected drive)\r | |
351 | //\r | |
352 | //\r | |
353 | // Unit Select1\r | |
354 | //\r | |
355 | #define STS0_US1 BIT1\r | |
356 | \r | |
357 | //\r | |
358 | // Unit Select0\r | |
359 | //\r | |
360 | #define STS0_US0 BIT0\r | |
361 | \r | |
362 | //\r | |
363 | // Status Register 1\r | |
364 | //\r | |
365 | //\r | |
366 | // End of Cylinder\r | |
367 | //\r | |
368 | #define STS1_EN BIT7\r | |
369 | \r | |
370 | //\r | |
371 | // BIT6 is unused\r | |
372 | //\r | |
373 | //\r | |
374 | // Data Error: The FDC detected a CRC error in either the ID field or\r | |
375 | // data field of a sector\r | |
376 | //\r | |
377 | #define STS1_DE BIT5\r | |
378 | \r | |
379 | //\r | |
380 | // Overrun/Underrun: Becomes set if FDC does not receive CPU or DMA service\r | |
381 | // within the required time interval\r | |
382 | //\r | |
383 | #define STS1_OR BIT4\r | |
384 | \r | |
385 | //\r | |
386 | // BIT3 is unused\r | |
387 | //\r | |
388 | //\r | |
389 | // No data\r | |
390 | //\r | |
391 | #define STS1_ND BIT2\r | |
392 | \r | |
393 | //\r | |
394 | // Not Writable\r | |
395 | //\r | |
396 | #define STS1_NW BIT1\r | |
397 | \r | |
398 | //\r | |
399 | // Missing Address Mark\r | |
400 | //\r | |
401 | #define STS1_MA BIT0\r | |
402 | \r | |
403 | //\r | |
404 | // Control Mark\r | |
405 | //\r | |
406 | #define STS2_CM BIT6\r | |
407 | \r | |
408 | //\r | |
409 | // Data Error in Data Field: The FDC detected a CRC error in the data field\r | |
410 | //\r | |
411 | #define STS2_DD BIT5\r | |
412 | \r | |
413 | //\r | |
414 | // Wrong Cylinder: The track address from sector ID field is different from\r | |
415 | // the track address maintained inside FDC\r | |
416 | //\r | |
417 | #define STS2_WC BIT4\r | |
418 | \r | |
419 | //\r | |
420 | // Bad Cylinder\r | |
421 | //\r | |
422 | #define STS2_BC BIT1\r | |
423 | \r | |
424 | //\r | |
425 | // Missing Address Mark in Data Field\r | |
426 | //\r | |
427 | #define STS2_MD BIT0\r | |
428 | \r | |
429 | //\r | |
430 | // Write Protected\r | |
431 | //\r | |
432 | #define STS3_WP BIT6\r | |
433 | \r | |
434 | //\r | |
435 | // Track 0\r | |
436 | //\r | |
437 | #define STS3_T0 BIT4\r | |
438 | \r | |
439 | //\r | |
440 | // Head Address\r | |
441 | //\r | |
442 | #define STS3_HD BIT2\r | |
443 | \r | |
444 | //\r | |
445 | // STS3_US1 & STS3_US0 : Drive Select\r | |
446 | //\r | |
447 | #define STS3_US1 BIT1\r | |
448 | #define STS3_US0 BIT0\r | |
449 | \r | |
450 | //\r | |
451 | // Status Register 0 Interrupt Code Description\r | |
452 | //\r | |
453 | //\r | |
454 | // Normal Termination of Command\r | |
455 | //\r | |
456 | #define IC_NT 0x0\r | |
457 | \r | |
458 | //\r | |
459 | // Abnormal Termination of Command\r | |
460 | //\r | |
461 | #define IC_AT 0x40\r | |
462 | \r | |
463 | //\r | |
464 | // Invalid Command\r | |
465 | //\r | |
466 | #define IC_IC 0x80\r | |
467 | \r | |
468 | //\r | |
469 | // Abnormal Termination caused by Polling\r | |
470 | //\r | |
471 | #define IC_ATRC 0xC0\r | |
472 | \r | |
11f43dfd | 473 | //\r |
474 | // EFI Driver Binding Protocol Functions\r | |
475 | //\r | |
d6321d6e | 476 | \r |
bcd70414 | 477 | /**\r |
d6321d6e | 478 | Test controller is a floppy disk drive device\r |
0a6f4824 LG |
479 | \r |
480 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
d6321d6e | 481 | @param[in] Controller The handle of the controller to test.\r |
482 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path.\r | |
0a6f4824 | 483 | \r |
d6321d6e | 484 | @retval EFI_SUCCESS The device is supported by this driver.\r |
485 | @retval EFI_ALREADY_STARTED The device is already being managed by this driver.\r | |
0a6f4824 | 486 | @retval EFI_ACCESS_DENIED The device is already being managed by a different driver\r |
d6321d6e | 487 | or an application that requires exclusive access.\r |
bcd70414 | 488 | **/\r |
11f43dfd | 489 | EFI_STATUS\r |
490 | EFIAPI\r | |
491 | FdcControllerDriverSupported (\r | |
492 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
493 | IN EFI_HANDLE Controller,\r | |
494 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
ed66e1bc | 495 | );\r |
11f43dfd | 496 | \r |
bcd70414 | 497 | /**\r |
d6321d6e | 498 | Start this driver on Controller.\r |
499 | \r | |
500 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
0a6f4824 LG |
501 | @param[in] ControllerHandle The handle of the controller to start. This handle\r |
502 | must support a protocol interface that supplies\r | |
d6321d6e | 503 | an I/O abstraction to the driver.\r |
0a6f4824 | 504 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path.\r |
d6321d6e | 505 | This parameter is ignored by device drivers, and is optional for bus drivers.\r |
506 | \r | |
507 | @retval EFI_SUCCESS The device was started.\r | |
508 | @retval EFI_DEVICE_ERROR The device could not be started due to a device error.\r | |
509 | Currently not implemented.\r | |
510 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
511 | @retval Others The driver failded to start the device.\r | |
bcd70414 | 512 | **/\r |
11f43dfd | 513 | EFI_STATUS\r |
514 | EFIAPI\r | |
515 | FdcControllerDriverStart (\r | |
516 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
517 | IN EFI_HANDLE Controller,\r | |
518 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
ed66e1bc | 519 | );\r |
11f43dfd | 520 | \r |
bcd70414 | 521 | /**\r |
d6321d6e | 522 | Stop this driver on ControllerHandle.\r |
523 | \r | |
524 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
0a6f4824 LG |
525 | @param[in] ControllerHandle A handle to the device being stopped. The handle must\r |
526 | support a bus specific I/O protocol for the driver\r | |
d6321d6e | 527 | to use to stop the device.\r |
528 | @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r | |
0a6f4824 | 529 | @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r |
d6321d6e | 530 | if NumberOfChildren is 0.\r |
531 | \r | |
532 | @retval EFI_SUCCESS The device was stopped.\r | |
533 | @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r | |
bcd70414 | 534 | **/\r |
11f43dfd | 535 | EFI_STATUS\r |
536 | EFIAPI\r | |
537 | FdcControllerDriverStop (\r | |
538 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
539 | IN EFI_HANDLE Controller,\r | |
540 | IN UINTN NumberOfChildren,\r | |
541 | IN EFI_HANDLE *ChildHandleBuffer\r | |
ed66e1bc | 542 | );\r |
11f43dfd | 543 | \r |
544 | //\r | |
545 | // EFI Block I/O Protocol Functions\r | |
546 | //\r | |
d6321d6e | 547 | \r |
bcd70414 | 548 | /**\r |
0a6f4824 LG |
549 | Reset the Floppy Logic Drive, call the FddReset function.\r |
550 | \r | |
bcd70414 | 551 | @param This EFI_BLOCK_IO *: A pointer to the Block I/O protocol interface\r |
0a6f4824 LG |
552 | @param ExtendedVerification BOOLEAN: Indicate that the driver may perform a more\r |
553 | exhaustive verification operation of the device during\r | |
554 | reset, now this par is ignored in this driver\r | |
bcd70414 | 555 | @retval EFI_SUCCESS: The Floppy Logic Drive is reset\r |
0a6f4824 | 556 | @retval EFI_DEVICE_ERROR: The Floppy Logic Drive is not functioning correctly\r |
bcd70414 | 557 | and can not be reset\r |
558 | \r | |
559 | **/\r | |
11f43dfd | 560 | EFI_STATUS\r |
561 | EFIAPI\r | |
562 | FdcReset (\r | |
563 | IN EFI_BLOCK_IO_PROTOCOL *This,\r | |
564 | IN BOOLEAN ExtendedVerification\r | |
ed66e1bc | 565 | );\r |
11f43dfd | 566 | \r |
bcd70414 | 567 | /**\r |
d6321d6e | 568 | Flush block via fdd controller.\r |
0a6f4824 | 569 | \r |
bcd70414 | 570 | @param This EFI_BLOCK_IO *: A pointer to the Block I/O protocol interface\r |
571 | @return EFI_SUCCESS\r | |
572 | \r | |
573 | **/\r | |
11f43dfd | 574 | EFI_STATUS\r |
575 | EFIAPI\r | |
576 | FddFlushBlocks (\r | |
577 | IN EFI_BLOCK_IO_PROTOCOL *This\r | |
ed66e1bc | 578 | );\r |
11f43dfd | 579 | \r |
bcd70414 | 580 | /**\r |
0a6f4824 LG |
581 | Read the requested number of blocks from the device.\r |
582 | \r | |
bcd70414 | 583 | @param This EFI_BLOCK_IO *: A pointer to the Block I/O protocol interface\r |
0a6f4824 | 584 | @param MediaId UINT32: The media id that the read request is for\r |
d6321d6e | 585 | @param Lba EFI_LBA: The starting logic block address to read from on the device\r |
bcd70414 | 586 | @param BufferSize UINTN: The size of the Buffer in bytes\r |
587 | @param Buffer VOID *: A pointer to the destination buffer for the data\r | |
0a6f4824 | 588 | \r |
bcd70414 | 589 | @retval EFI_SUCCESS: The data was read correctly from the device\r |
590 | @retval EFI_DEVICE_ERROR:The device reported an error while attempting to perform\r | |
591 | the read operation\r | |
592 | @retval EFI_NO_MEDIA: There is no media in the device\r | |
593 | @retval EFI_MEDIA_CHANGED: The MediaId is not for the current media\r | |
0a6f4824 | 594 | @retval EFI_BAD_BUFFER_SIZE: The BufferSize parameter is not a multiple of the\r |
bcd70414 | 595 | intrinsic block size of the device\r |
0a6f4824 LG |
596 | @retval EFI_INVALID_PARAMETER:The read request contains LBAs that are not valid,\r |
597 | or the buffer is not on proper alignment\r | |
bcd70414 | 598 | \r |
599 | **/\r | |
11f43dfd | 600 | EFI_STATUS\r |
601 | EFIAPI\r | |
602 | FddReadBlocks (\r | |
603 | IN EFI_BLOCK_IO_PROTOCOL *This,\r | |
604 | IN UINT32 MediaId,\r | |
d6321d6e | 605 | IN EFI_LBA Lba,\r |
11f43dfd | 606 | IN UINTN BufferSize,\r |
607 | OUT VOID *Buffer\r | |
ed66e1bc | 608 | );\r |
11f43dfd | 609 | \r |
bcd70414 | 610 | /**\r |
0a6f4824 LG |
611 | Write a specified number of blocks to the device.\r |
612 | \r | |
bcd70414 | 613 | @param This EFI_BLOCK_IO *: A pointer to the Block I/O protocol interface\r |
0a6f4824 | 614 | @param MediaId UINT32: The media id that the write request is for\r |
d6321d6e | 615 | @param Lba EFI_LBA: The starting logic block address to be written\r |
bcd70414 | 616 | @param BufferSize UINTN: The size in bytes in Buffer\r |
617 | @param Buffer VOID *: A pointer to the source buffer for the data\r | |
0a6f4824 | 618 | \r |
bcd70414 | 619 | @retval EFI_SUCCESS: The data were written correctly to the device\r |
0a6f4824 | 620 | @retval EFI_WRITE_PROTECTED: The device can not be written to\r |
bcd70414 | 621 | @retval EFI_NO_MEDIA: There is no media in the device\r |
622 | @retval EFI_MEDIA_CHANGED: The MediaId is not for the current media\r | |
0a6f4824 LG |
623 | @retval EFI_DEVICE_ERROR: The device reported an error while attempting to perform\r |
624 | the write operation\r | |
625 | @retval EFI_BAD_BUFFER_SIZE: The BufferSize parameter is not a multiple of the\r | |
bcd70414 | 626 | intrinsic block size of the device\r |
0a6f4824 LG |
627 | @retval EFI_INVALID_PARAMETER:The write request contains LBAs that are not valid,\r |
628 | or the buffer is not on proper alignment\r | |
bcd70414 | 629 | **/\r |
11f43dfd | 630 | EFI_STATUS\r |
631 | EFIAPI\r | |
632 | FddWriteBlocks (\r | |
633 | IN EFI_BLOCK_IO_PROTOCOL *This,\r | |
634 | IN UINT32 MediaId,\r | |
d6321d6e | 635 | IN EFI_LBA Lba,\r |
11f43dfd | 636 | IN UINTN BufferSize,\r |
637 | IN VOID *Buffer\r | |
ed66e1bc | 638 | );\r |
11f43dfd | 639 | \r |
640 | //\r | |
641 | // Prototypes of internal functions\r | |
642 | //\r | |
bcd70414 | 643 | /**\r |
644 | \r | |
d6321d6e | 645 | Detect the floppy drive is presented or not.\r |
0a6f4824 | 646 | \r |
bcd70414 | 647 | @param FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV\r |
648 | @retval EFI_SUCCESS Drive is presented\r | |
649 | @retval EFI_NOT_FOUND Drive is not presented\r | |
650 | \r | |
651 | **/\r | |
11f43dfd | 652 | EFI_STATUS\r |
653 | DiscoverFddDevice (\r | |
654 | IN FDC_BLK_IO_DEV *FdcDev\r | |
ed66e1bc | 655 | );\r |
11f43dfd | 656 | \r |
bcd70414 | 657 | /**\r |
11f43dfd | 658 | \r |
d6321d6e | 659 | Do recalibrate and see the drive is presented or not.\r |
660 | Set the media parameters.\r | |
0a6f4824 | 661 | \r |
bcd70414 | 662 | @param FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV\r |
663 | @return the drive is presented or not\r | |
11f43dfd | 664 | \r |
bcd70414 | 665 | **/\r |
11f43dfd | 666 | EFI_STATUS\r |
667 | FddIdentify (\r | |
668 | IN FDC_BLK_IO_DEV *FdcDev\r | |
ed66e1bc | 669 | );\r |
11f43dfd | 670 | \r |
bcd70414 | 671 | /**\r |
11f43dfd | 672 | \r |
d6321d6e | 673 | Reset the Floppy Logic Drive.\r |
0a6f4824 | 674 | \r |
bcd70414 | 675 | @param FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV\r |
0a6f4824 | 676 | \r |
bcd70414 | 677 | @retval EFI_SUCCESS: The Floppy Logic Drive is reset\r |
678 | @retval EFI_DEVICE_ERROR: The Floppy Logic Drive is not functioning correctly and\r | |
679 | can not be reset\r | |
11f43dfd | 680 | \r |
bcd70414 | 681 | **/\r |
11f43dfd | 682 | EFI_STATUS\r |
683 | FddReset (\r | |
684 | IN FDC_BLK_IO_DEV *FdcDev\r | |
ed66e1bc | 685 | );\r |
11f43dfd | 686 | \r |
bcd70414 | 687 | /**\r |
11f43dfd | 688 | \r |
d6321d6e | 689 | Turn the drive's motor on.\r |
690 | The drive's motor must be on before any command can be executed.\r | |
0a6f4824 | 691 | \r |
bcd70414 | 692 | @param FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV\r |
0a6f4824 | 693 | \r |
bcd70414 | 694 | @retval EFI_SUCCESS: Turn the drive's motor on successfully\r |
695 | @retval EFI_DEVICE_ERROR: The drive is busy, so can not turn motor on\r | |
696 | @retval EFI_INVALID_PARAMETER: Fail to Set timer(Cancel timer)\r | |
11f43dfd | 697 | \r |
bcd70414 | 698 | **/\r |
11f43dfd | 699 | EFI_STATUS\r |
700 | MotorOn (\r | |
701 | IN FDC_BLK_IO_DEV *FdcDev\r | |
ed66e1bc | 702 | );\r |
11f43dfd | 703 | \r |
bcd70414 | 704 | /**\r |
11f43dfd | 705 | \r |
d6321d6e | 706 | Set a Timer and when Timer goes off, turn the motor off.\r |
0a6f4824 LG |
707 | \r |
708 | \r | |
bcd70414 | 709 | @param FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV\r |
0a6f4824 | 710 | \r |
bcd70414 | 711 | @retval EFI_SUCCESS: Set the Timer successfully\r |
712 | @retval EFI_INVALID_PARAMETER: Fail to Set the timer\r | |
11f43dfd | 713 | \r |
bcd70414 | 714 | **/\r |
11f43dfd | 715 | EFI_STATUS\r |
716 | MotorOff (\r | |
717 | IN FDC_BLK_IO_DEV *FdcDev\r | |
ed66e1bc | 718 | );\r |
11f43dfd | 719 | \r |
bcd70414 | 720 | /**\r |
d6321d6e | 721 | Detect the disk in the drive is changed or not.\r |
0a6f4824 LG |
722 | \r |
723 | \r | |
bcd70414 | 724 | @param FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV\r |
0a6f4824 | 725 | \r |
bcd70414 | 726 | @retval EFI_SUCCESS: No disk media change\r |
727 | @retval EFI_DEVICE_ERROR: Fail to do the recalibrate or seek operation\r | |
728 | @retval EFI_NO_MEDIA: No disk in the drive\r | |
729 | @retval EFI_MEDIA_CHANGED: There is a new disk in the drive\r | |
730 | **/\r | |
11f43dfd | 731 | EFI_STATUS\r |
732 | DisketChanged (\r | |
733 | IN FDC_BLK_IO_DEV *FdcDev\r | |
ed66e1bc | 734 | );\r |
11f43dfd | 735 | \r |
bcd70414 | 736 | /**\r |
737 | Do the Specify command, this command sets DMA operation\r | |
738 | and the initial values for each of the three internal\r | |
d6321d6e | 739 | times: HUT, SRT and HLT.\r |
0a6f4824 | 740 | \r |
fdb05fa3 | 741 | @param FdcDev Pointer to instance of FDC_BLK_IO_DEV\r |
0a6f4824 | 742 | \r |
bcd70414 | 743 | @retval EFI_SUCCESS: Execute the Specify command successfully\r |
744 | @retval EFI_DEVICE_ERROR: Fail to execute the command\r | |
745 | \r | |
746 | **/\r | |
11f43dfd | 747 | EFI_STATUS\r |
748 | Specify (\r | |
749 | IN FDC_BLK_IO_DEV *FdcDev\r | |
ed66e1bc | 750 | );\r |
11f43dfd | 751 | \r |
bcd70414 | 752 | /**\r |
d6321d6e | 753 | Set the head of floppy drive to track 0.\r |
0a6f4824 | 754 | \r |
bcd70414 | 755 | @param FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV\r |
756 | @retval EFI_SUCCESS: Execute the Recalibrate operation successfully\r | |
757 | @retval EFI_DEVICE_ERROR: Fail to execute the Recalibrate operation\r | |
758 | \r | |
759 | **/\r | |
11f43dfd | 760 | EFI_STATUS\r |
761 | Recalibrate (\r | |
762 | IN FDC_BLK_IO_DEV *FdcDev\r | |
ed66e1bc | 763 | );\r |
11f43dfd | 764 | \r |
bcd70414 | 765 | /**\r |
d6321d6e | 766 | Set the head of floppy drive to the new cylinder.\r |
0a6f4824 | 767 | \r |
bcd70414 | 768 | @param FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV\r |
769 | @param Lba EFI_LBA : The logic block address want to seek\r | |
0a6f4824 | 770 | \r |
bcd70414 | 771 | @retval EFI_SUCCESS: Execute the Seek operation successfully\r |
772 | @retval EFI_DEVICE_ERROR: Fail to execute the Seek operation\r | |
773 | \r | |
774 | **/\r | |
11f43dfd | 775 | EFI_STATUS\r |
776 | Seek (\r | |
777 | IN FDC_BLK_IO_DEV *FdcDev,\r | |
778 | IN EFI_LBA Lba\r | |
ed66e1bc | 779 | );\r |
11f43dfd | 780 | \r |
bcd70414 | 781 | /**\r |
d6321d6e | 782 | Do the Sense Interrupt Status command, this command resets the interrupt signal.\r |
0a6f4824 | 783 | \r |
fdb05fa3 | 784 | @param FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV\r |
bcd70414 | 785 | @param StatusRegister0 UINT8 *: Be used to save Status Register 0 read from FDC\r |
786 | @param PresentCylinderNumber UINT8 *: Be used to save present cylinder number\r | |
787 | read from FDC\r | |
0a6f4824 | 788 | \r |
bcd70414 | 789 | @retval EFI_SUCCESS: Execute the Sense Interrupt Status command successfully\r |
790 | @retval EFI_DEVICE_ERROR: Fail to execute the command\r | |
791 | \r | |
792 | **/\r | |
11f43dfd | 793 | EFI_STATUS\r |
794 | SenseIntStatus (\r | |
795 | IN FDC_BLK_IO_DEV *FdcDev,\r | |
796 | IN OUT UINT8 *StatusRegister0,\r | |
797 | IN OUT UINT8 *PresentCylinderNumber\r | |
ed66e1bc | 798 | );\r |
11f43dfd | 799 | \r |
bcd70414 | 800 | /**\r |
d6321d6e | 801 | Do the Sense Drive Status command.\r |
0a6f4824 | 802 | \r |
bcd70414 | 803 | @param FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV\r |
804 | @param Lba EFI_LBA : Logic block address\r | |
0a6f4824 | 805 | \r |
bcd70414 | 806 | @retval EFI_SUCCESS: Execute the Sense Drive Status command successfully\r |
807 | @retval EFI_DEVICE_ERROR: Fail to execute the command\r | |
808 | @retval EFI_WRITE_PROTECTED:The disk is write protected\r | |
809 | \r | |
810 | **/\r | |
11f43dfd | 811 | EFI_STATUS\r |
812 | SenseDrvStatus (\r | |
813 | IN FDC_BLK_IO_DEV *FdcDev,\r | |
814 | IN EFI_LBA Lba\r | |
ed66e1bc | 815 | );\r |
11f43dfd | 816 | \r |
bcd70414 | 817 | /**\r |
d6321d6e | 818 | Update the disk media properties and if necessary reinstall Block I/O interface.\r |
0a6f4824 | 819 | \r |
bcd70414 | 820 | @param FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV\r |
0a6f4824 | 821 | \r |
bcd70414 | 822 | @retval EFI_SUCCESS: Do the operation successfully\r |
823 | @retval EFI_DEVICE_ERROR: Fail to the operation\r | |
824 | \r | |
825 | **/\r | |
11f43dfd | 826 | EFI_STATUS\r |
827 | DetectMedia (\r | |
828 | IN FDC_BLK_IO_DEV *FdcDev\r | |
ed66e1bc | 829 | );\r |
11f43dfd | 830 | \r |
bcd70414 | 831 | /**\r |
d6321d6e | 832 | Set the data rate and so on.\r |
0a6f4824 | 833 | \r |
bcd70414 | 834 | @param FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV\r |
835 | \r | |
836 | @retval EFI_SUCCESS success to set the data rate\r | |
837 | **/\r | |
11f43dfd | 838 | EFI_STATUS\r |
839 | Setup (\r | |
840 | IN FDC_BLK_IO_DEV *FdcDev\r | |
ed66e1bc | 841 | );\r |
11f43dfd | 842 | \r |
bcd70414 | 843 | /**\r |
d6321d6e | 844 | Read or Write a number of blocks in the same cylinder.\r |
0a6f4824 | 845 | \r |
bcd70414 | 846 | @param FdcDev A pointer to Data Structure FDC_BLK_IO_DEV\r |
0a6f4824 | 847 | @param HostAddress device address\r |
bcd70414 | 848 | @param Lba The starting logic block address to read from on the device\r |
849 | @param NumberOfBlocks The number of block wanted to be read or write\r | |
850 | @param Read Operation type: read or write\r | |
0a6f4824 | 851 | \r |
bcd70414 | 852 | @retval EFI_SUCCESS Success operate\r |
853 | \r | |
854 | **/\r | |
11f43dfd | 855 | EFI_STATUS\r |
856 | ReadWriteDataSector (\r | |
857 | IN FDC_BLK_IO_DEV *FdcDev,\r | |
858 | IN VOID *HostAddress,\r | |
859 | IN EFI_LBA Lba,\r | |
860 | IN UINTN NumberOfBlocks,\r | |
861 | IN BOOLEAN Read\r | |
ed66e1bc | 862 | );\r |
11f43dfd | 863 | \r |
bcd70414 | 864 | /**\r |
d6321d6e | 865 | Fill in FDD command's parameter.\r |
0a6f4824 | 866 | \r |
bcd70414 | 867 | @param FdcDev Pointer to instance of FDC_BLK_IO_DEV\r |
868 | @param Lba The starting logic block address to read from on the device\r | |
869 | @param Command FDD command\r | |
870 | \r | |
871 | **/\r | |
11f43dfd | 872 | VOID\r |
873 | FillPara (\r | |
874 | IN FDC_BLK_IO_DEV *FdcDev,\r | |
875 | IN EFI_LBA Lba,\r | |
876 | IN FDD_COMMAND_PACKET1 *Command\r | |
ed66e1bc | 877 | );\r |
11f43dfd | 878 | \r |
bcd70414 | 879 | /**\r |
d6321d6e | 880 | Read result byte from Data Register of FDC.\r |
0a6f4824 | 881 | \r |
d6321d6e | 882 | @param FdcDev Pointer to instance of FDC_BLK_IO_DEV\r |
883 | @param Pointer Buffer to store the byte read from FDC\r | |
0a6f4824 | 884 | \r |
d6321d6e | 885 | @retval EFI_SUCCESS Read result byte from FDC successfully\r |
886 | @retval EFI_DEVICE_ERROR The FDC is not ready to be read\r | |
bcd70414 | 887 | \r |
888 | **/\r | |
11f43dfd | 889 | EFI_STATUS\r |
890 | DataInByte (\r | |
d6321d6e | 891 | IN FDC_BLK_IO_DEV *FdcDev,\r |
892 | OUT UINT8 *Pointer\r | |
ed66e1bc | 893 | );\r |
11f43dfd | 894 | \r |
bcd70414 | 895 | /**\r |
d6321d6e | 896 | Write command byte to Data Register of FDC.\r |
0a6f4824 | 897 | \r |
bcd70414 | 898 | @param FdcDev Pointer to instance of FDC_BLK_IO_DEV\r |
899 | @param Pointer Be used to save command byte written to FDC\r | |
0a6f4824 | 900 | \r |
bcd70414 | 901 | @retval EFI_SUCCESS: Write command byte to FDC successfully\r |
902 | @retval EFI_DEVICE_ERROR: The FDC is not ready to be written\r | |
903 | \r | |
904 | **/\r | |
11f43dfd | 905 | EFI_STATUS\r |
906 | DataOutByte (\r | |
907 | IN FDC_BLK_IO_DEV *FdcDev,\r | |
908 | IN UINT8 *Pointer\r | |
ed66e1bc | 909 | );\r |
11f43dfd | 910 | \r |
bcd70414 | 911 | /**\r |
d6321d6e | 912 | Detect the specified floppy logic drive is busy or not within a period of time.\r |
0a6f4824 | 913 | \r |
e9bf5b1d JF |
914 | @param FdcDev Indicate it is drive A or drive B\r |
915 | @param Timeout The time period for waiting\r | |
0a6f4824 | 916 | \r |
bcd70414 | 917 | @retval EFI_SUCCESS: The drive and command are not busy\r |
918 | @retval EFI_TIMEOUT: The drive or command is still busy after a period time that\r | |
e9bf5b1d | 919 | set by Timeout\r |
bcd70414 | 920 | \r |
921 | **/\r | |
11f43dfd | 922 | EFI_STATUS\r |
923 | FddWaitForBSYClear (\r | |
924 | IN FDC_BLK_IO_DEV *FdcDev,\r | |
e9bf5b1d | 925 | IN UINTN Timeout\r |
ed66e1bc | 926 | );\r |
11f43dfd | 927 | \r |
bcd70414 | 928 | /**\r |
d6321d6e | 929 | Determine whether FDC is ready to write or read.\r |
0a6f4824 | 930 | \r |
bcd70414 | 931 | @param FdcDev Pointer to instance of FDC_BLK_IO_DEV\r |
932 | @param Dio BOOLEAN: Indicate the FDC is waiting to write or read\r | |
e9bf5b1d | 933 | @param Timeout The time period for waiting\r |
0a6f4824 | 934 | \r |
bcd70414 | 935 | @retval EFI_SUCCESS: FDC is ready to write or read\r |
936 | @retval EFI_NOT_READY: FDC is not ready within the specified time period\r | |
11f43dfd | 937 | \r |
bcd70414 | 938 | **/\r |
11f43dfd | 939 | EFI_STATUS\r |
940 | FddDRQReady (\r | |
941 | IN FDC_BLK_IO_DEV *FdcDev,\r | |
942 | IN BOOLEAN Dio,\r | |
e9bf5b1d | 943 | IN UINTN Timeout\r |
ed66e1bc | 944 | );\r |
11f43dfd | 945 | \r |
bcd70414 | 946 | /**\r |
d6321d6e | 947 | Set FDC control structure's attribute according to result.\r |
11f43dfd | 948 | \r |
bcd70414 | 949 | @param Result Point to result structure\r |
950 | @param FdcDev FDC control structure\r | |
11f43dfd | 951 | \r |
fdb05fa3 | 952 | @retval EFI_DEVICE_ERROR - GC_TODO: Add description for return value\r |
953 | @retval EFI_DEVICE_ERROR - GC_TODO: Add description for return value\r | |
954 | @retval EFI_DEVICE_ERROR - GC_TODO: Add description for return value\r | |
955 | @retval EFI_SUCCESS - GC_TODO: Add description for return value\r | |
11f43dfd | 956 | \r |
bcd70414 | 957 | **/\r |
11f43dfd | 958 | EFI_STATUS\r |
959 | CheckResult (\r | |
960 | IN FDD_RESULT_PACKET *Result,\r | |
961 | IN OUT FDC_BLK_IO_DEV *FdcDev\r | |
ed66e1bc | 962 | );\r |
11f43dfd | 963 | \r |
bcd70414 | 964 | /**\r |
d6321d6e | 965 | Check the drive status information.\r |
0a6f4824 | 966 | \r |
bcd70414 | 967 | @param StatusRegister3 the value of Status Register 3\r |
0a6f4824 | 968 | \r |
bcd70414 | 969 | @retval EFI_SUCCESS The disk is not write protected\r |
970 | @retval EFI_WRITE_PROTECTED: The disk is write protected\r | |
971 | \r | |
972 | **/\r | |
11f43dfd | 973 | EFI_STATUS\r |
974 | CheckStatus3 (\r | |
975 | IN UINT8 StatusRegister3\r | |
ed66e1bc | 976 | );\r |
11f43dfd | 977 | \r |
bcd70414 | 978 | /**\r |
d6321d6e | 979 | Calculate the number of block in the same cylinder according to Lba.\r |
0a6f4824 | 980 | \r |
bcd70414 | 981 | @param FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV\r |
d6321d6e | 982 | @param Lba EFI_LBA: The starting logic block address\r |
bcd70414 | 983 | @param NumberOfBlocks UINTN: The number of blocks\r |
0a6f4824 | 984 | \r |
bcd70414 | 985 | @return The number of blocks in the same cylinder which the starting\r |
d6321d6e | 986 | logic block address is Lba\r |
bcd70414 | 987 | \r |
988 | **/\r | |
11f43dfd | 989 | UINTN\r |
990 | GetTransferBlockCount (\r | |
991 | IN FDC_BLK_IO_DEV *FdcDev,\r | |
d6321d6e | 992 | IN EFI_LBA Lba,\r |
11f43dfd | 993 | IN UINTN NumberOfBlocks\r |
ed66e1bc | 994 | );\r |
11f43dfd | 995 | \r |
bcd70414 | 996 | /**\r |
d6321d6e | 997 | When the Timer(2s) off, turn the drive's motor off.\r |
0a6f4824 | 998 | \r |
bcd70414 | 999 | @param Event EFI_EVENT: Event(the timer) whose notification function is being\r |
1000 | invoked\r | |
1001 | @param Context VOID *: Pointer to the notification function's context\r | |
1002 | \r | |
1003 | **/\r | |
11f43dfd | 1004 | VOID\r |
1005 | EFIAPI\r | |
1006 | FddTimerProc (\r | |
1007 | IN EFI_EVENT Event,\r | |
1008 | IN VOID *Context\r | |
ed66e1bc | 1009 | );\r |
11f43dfd | 1010 | \r |
bcd70414 | 1011 | /**\r |
d6321d6e | 1012 | Read I/O port for FDC.\r |
0a6f4824 | 1013 | \r |
bcd70414 | 1014 | @param FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV\r |
1015 | @param Offset The offset address of port\r | |
1016 | \r | |
1017 | **/\r | |
11f43dfd | 1018 | UINT8\r |
1019 | FdcReadPort (\r | |
1020 | IN FDC_BLK_IO_DEV *FdcDev,\r | |
1021 | IN UINT32 Offset\r | |
ed66e1bc | 1022 | );\r |
11f43dfd | 1023 | \r |
bcd70414 | 1024 | /**\r |
d6321d6e | 1025 | Write I/O port for FDC.\r |
0a6f4824 | 1026 | \r |
bcd70414 | 1027 | @param FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV\r |
1028 | @param Offset The offset address of port\r | |
fdb05fa3 | 1029 | @param Data Value written to port\r |
0a6f4824 | 1030 | \r |
bcd70414 | 1031 | **/\r |
11f43dfd | 1032 | VOID\r |
1033 | FdcWritePort (\r | |
1034 | IN FDC_BLK_IO_DEV *FdcDev,\r | |
1035 | IN UINT32 Offset,\r | |
1036 | IN UINT8 Data\r | |
ed66e1bc | 1037 | );\r |
11f43dfd | 1038 | \r |
bcd70414 | 1039 | /**\r |
d6321d6e | 1040 | Read or Write a number of blocks to floppy device.\r |
11f43dfd | 1041 | \r |
bcd70414 | 1042 | @param This Pointer to instance of EFI_BLOCK_IO_PROTOCOL\r |
1043 | @param MediaId The media id of read/write request\r | |
d6321d6e | 1044 | @param Lba The starting logic block address to read from on the device\r |
bcd70414 | 1045 | @param BufferSize The size of the Buffer in bytes\r |
1046 | @param Operation - GC_TODO: add argument description\r | |
fdb05fa3 | 1047 | @param Buffer - GC_TODO: add argument description\r |
11f43dfd | 1048 | \r |
bcd70414 | 1049 | @retval EFI_INVALID_PARAMETER - GC_TODO: Add description for return value\r |
1050 | @retval EFI_SUCCESS - GC_TODO: Add description for return value\r | |
1051 | @retval EFI_DEVICE_ERROR - GC_TODO: Add description for return value\r | |
1052 | @retval EFI_DEVICE_ERROR - GC_TODO: Add description for return value\r | |
1053 | @retval EFI_NO_MEDIA - GC_TODO: Add description for return value\r | |
1054 | @retval EFI_MEDIA_CHANGED - GC_TODO: Add description for return value\r | |
1055 | @retval EFI_WRITE_PROTECTED - GC_TODO: Add description for return value\r | |
1056 | @retval EFI_BAD_BUFFER_SIZE - GC_TODO: Add description for return value\r | |
1057 | @retval EFI_INVALID_PARAMETER - GC_TODO: Add description for return value\r | |
1058 | @retval EFI_INVALID_PARAMETER - GC_TODO: Add description for return value\r | |
1059 | @retval EFI_SUCCESS - GC_TODO: Add description for return value\r | |
1060 | @retval EFI_DEVICE_ERROR - GC_TODO: Add description for return value\r | |
1061 | @retval EFI_DEVICE_ERROR - GC_TODO: Add description for return value\r | |
1062 | @retval EFI_SUCCESS - GC_TODO: Add description for return value\r | |
11f43dfd | 1063 | \r |
bcd70414 | 1064 | **/\r |
11f43dfd | 1065 | EFI_STATUS\r |
1066 | FddReadWriteBlocks (\r | |
1067 | IN EFI_BLOCK_IO_PROTOCOL *This,\r | |
1068 | IN UINT32 MediaId,\r | |
d6321d6e | 1069 | IN EFI_LBA Lba,\r |
11f43dfd | 1070 | IN UINTN BufferSize,\r |
1071 | IN BOOLEAN Operation,\r | |
1072 | OUT VOID *Buffer\r | |
ed66e1bc | 1073 | );\r |
11f43dfd | 1074 | \r |
bcd70414 | 1075 | /**\r |
0a6f4824 LG |
1076 | Common interface for free cache.\r |
1077 | \r | |
fdb05fa3 | 1078 | @param FdcDev Pointer of FDC_BLK_IO_DEV instance\r |
0a6f4824 | 1079 | \r |
bcd70414 | 1080 | **/\r |
11f43dfd | 1081 | VOID\r |
1082 | FdcFreeCache (\r | |
1083 | IN FDC_BLK_IO_DEV *FdcDev\r | |
ed66e1bc | 1084 | );\r |
11f43dfd | 1085 | \r |
1086 | #endif\r | |
bcd70414 | 1087 | \r |