Abstract:\r
\r
ISA Floppy Driver\r
- 1. Support two types diskette drive \r
+ 1. Support two types diskette drive\r
1.44M drive and 2.88M drive (and now only support 1.44M)\r
2. Support two diskette drives\r
3. Use DMA channel 2 to transfer data\r
4. Do not use interrupt\r
5. Support diskette change line signal and write protect\r
- \r
+\r
The internal function for the floppy driver\r
\r
Revision History:\r
)\r
/*++\r
\r
- Routine Description: Detect the floppy drive is presented or not \r
+ Routine Description: Detect the floppy drive is presented or not\r
Parameters:\r
- FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV \r
+ FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV\r
Returns:\r
- EFI_SUCCESS Drive is presented \r
+ EFI_SUCCESS Drive is presented\r
EFI_NOT_FOUND Drive is not presented\r
\r
--*/\r
Routine Description: Do recalibrate and see the drive is presented or not\r
Set the media parameters\r
Parameters:\r
- FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV \r
+ FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV\r
Returns:\r
- EFI_SUCCESS: \r
- EFI_DEVICE_ERROR: \r
+ EFI_SUCCESS:\r
+ EFI_DEVICE_ERROR:\r
\r
--*/\r
// GC_TODO: function comment is missing 'Arguments:'\r
// Check Media\r
//\r
Status = DisketChanged (FdcDev);\r
- switch (Status) {\r
- case EFI_NO_MEDIA:\r
- FdcDev->BlkIo.Media->MediaPresent = FALSE;\r
- break;\r
-\r
- case EFI_MEDIA_CHANGED:\r
- case EFI_SUCCESS:\r
- break;\r
\r
- default:\r
+ if (Status == EFI_NO_MEDIA) {\r
+ FdcDev->BlkIo.Media->MediaPresent = FALSE;\r
+ } else if (Status != EFI_MEDIA_CHANGED) {\r
MotorOff (FdcDev);\r
return Status;\r
}\r
+\r
//\r
// Check Disk Write Protected\r
//\r
Status = SenseDrvStatus (FdcDev, 0);\r
- switch (Status) {\r
- case EFI_WRITE_PROTECTED:\r
- FdcDev->BlkIo.Media->ReadOnly = TRUE;\r
- break;\r
\r
- case EFI_SUCCESS:\r
+ if (Status == EFI_WRITE_PROTECTED) {\r
+ FdcDev->BlkIo.Media->ReadOnly = TRUE;\r
+ } else if (Status == EFI_SUCCESS) {\r
FdcDev->BlkIo.Media->ReadOnly = FALSE;\r
- break;\r
-\r
- default:\r
+ } else {\r
return EFI_DEVICE_ERROR;\r
- break;\r
}\r
\r
MotorOff (FdcDev);\r
)\r
/*++\r
\r
- Routine Description: Reset the Floppy Logic Drive \r
+ Routine Description: Reset the Floppy Logic Drive\r
Parameters:\r
- FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV \r
+ FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV\r
Returns:\r
EFI_SUCCESS: The Floppy Logic Drive is reset\r
- EFI_DEVICE_ERROR: The Floppy Logic Drive is not functioning correctly and \r
+ EFI_DEVICE_ERROR: The Floppy Logic Drive is not functioning correctly and\r
can not be reset\r
\r
--*/\r
/*++\r
\r
Routine Description: Turn the drive's motor on\r
- The drive's motor must be on before any command can be executed \r
+ The drive's motor must be on before any command can be executed\r
Parameters:\r
- FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV \r
+ FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV\r
Returns:\r
EFI_SUCCESS: Turn the drive's motor on successfully\r
- EFI_DEVICE_ERROR: The drive is busy, so can not turn motor on \r
- EFI_INVALID_PARAMETER: Fail to Set timer(Cancel timer) \r
+ EFI_DEVICE_ERROR: The drive is busy, so can not turn motor on\r
+ EFI_INVALID_PARAMETER: Fail to Set timer(Cancel timer)\r
\r
--*/\r
// GC_TODO: function comment is missing 'Arguments:'\r
\r
Routine Description: Set a Timer and when Timer goes off, turn the motor off\r
Parameters:\r
- FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV \r
+ FdcDev FDC_BLK_IO_DEV * : A pointer to the Data Structure FDC_BLK_IO_DEV\r
Returns:\r
EFI_SUCCESS: Set the Timer successfully\r
- EFI_INVALID_PARAMETER: Fail to Set the timer \r
+ EFI_INVALID_PARAMETER: Fail to Set the timer\r
\r
--*/\r
// GC_TODO: function comment is missing 'Arguments:'\r
\r
Routine Description: Detect the disk in the drive is changed or not\r
Parameters:\r
- FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV \r
+ FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV\r
Returns:\r
EFI_SUCCESS: No disk media change\r
EFI_DEVICE_ERROR: Fail to do the recalibrate or seek operation\r
/*++\r
\r
Routine Description: Do the Specify command, this command sets DMA operation\r
- and the initial values for each of the three internal \r
+ and the initial values for each of the three internal\r
times: HUT, SRT and HLT\r
Parameters:\r
None\r
)\r
/*++\r
\r
- Routine Description: Do the Sense Interrupt Status command, this command \r
+ Routine Description: Do the Sense Interrupt Status command, this command\r
resets the interrupt signal\r
Parameters:\r
- StatusRegister0 UINT8 *: Be used to save Status Register 0 read from FDC \r
- PresentCylinderNumber UINT8 *: Be used to save present cylinder number \r
+ StatusRegister0 UINT8 *: Be used to save Status Register 0 read from FDC\r
+ PresentCylinderNumber UINT8 *: Be used to save present cylinder number\r
read from FDC\r
Returns:\r
EFI_SUCCESS: Execute the Sense Interrupt Status command successfully\r
\r
Routine Description: Do the Sense Drive Status command\r
Parameters:\r
- FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV \r
+ FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV\r
Lba EFI_LBA : Logic block address\r
Returns:\r
EFI_SUCCESS: Execute the Sense Drive Status command successfully\r
EFI_DEVICE_ERROR: Fail to execute the command\r
- EFI_WRITE_PROTECTED:The disk is write protected \r
+ EFI_WRITE_PROTECTED:The disk is write protected\r
\r
--*/\r
// GC_TODO: function comment is missing 'Arguments:'\r
)\r
/*++\r
\r
- Routine Description: Update the disk media properties and if necessary \r
+ Routine Description: Update the disk media properties and if necessary\r
reinstall Block I/O interface\r
Parameters:\r
- FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV \r
+ FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV\r
Returns:\r
EFI_SUCCESS: Do the operation successfully\r
EFI_DEVICE_ERROR: Fail to the operation\r
// Check disk change\r
//\r
Status = DisketChanged (FdcDev);\r
- switch (Status) {\r
- case EFI_MEDIA_CHANGED:\r
+\r
+ if (Status == EFI_MEDIA_CHANGED) {\r
FdcDev->BlkIo.Media->MediaId++;\r
FdcDev->BlkIo.Media->MediaPresent = TRUE;\r
bReset = TRUE;\r
- break;\r
-\r
- case EFI_NO_MEDIA:\r
+ } else if (Status == EFI_NO_MEDIA) {\r
FdcDev->BlkIo.Media->MediaPresent = FALSE;\r
- break;\r
-\r
- case EFI_SUCCESS:\r
- break;\r
-\r
- default:\r
+ } else if (Status != EFI_SUCCESS) {\r
MotorOff (FdcDev);\r
return Status;\r
//\r
\r
Routine Description: Set the data rate and so on\r
Parameters:\r
- None \r
+ None\r
Returns:\r
- EFI_SUCCESS: \r
+ EFI_SUCCESS:\r
\r
--*/\r
// GC_TODO: function comment is missing 'Arguments:'\r
Buffer VOID *:\r
Lba EFI_LBA:\r
NumberOfBlocks UINTN:\r
- Read BOOLEAN: \r
+ Read BOOLEAN:\r
Returns:\r
- EFI_SUCCESS: \r
+ EFI_SUCCESS:\r
\r
--*/\r
// GC_TODO: function comment is missing 'Arguments:'\r
Routine Description: Fill in Parameter\r
Parameters:\r
Returns:\r
- \r
+\r
--*/\r
// GC_TODO: function comment is missing 'Arguments:'\r
// GC_TODO: FdcDev - add argument and description to function comment\r
\r
Routine Description: Read result byte from Data Register of FDC\r
Parameters:\r
- Pointer UINT8 *: Be used to save result byte read from FDC \r
+ Pointer UINT8 *: Be used to save result byte read from FDC\r
Returns:\r
EFI_SUCCESS: Read result byte from FDC successfully\r
EFI_DEVICE_ERROR: The FDC is not ready to be read\r
\r
Routine Description: Write command byte to Data Register of FDC\r
Parameters:\r
- Pointer UINT8 *: Be used to save command byte written to FDC \r
+ Pointer UINT8 *: Be used to save command byte written to FDC\r
Returns:\r
EFI_SUCCESS: Write command byte to FDC successfully\r
EFI_DEVICE_ERROR: The FDC is not ready to be written\r
)\r
/*++\r
\r
- Routine Description: Detect the specified floppy logic drive is busy or \r
+ Routine Description: Detect the specified floppy logic drive is busy or\r
not within a period of time\r
Parameters:\r
Disk EFI_FDC_DISK: Indicate it is drive A or drive B\r
- TimeoutInSeconds UINTN: the time period for waiting \r
+ TimeoutInSeconds UINTN: the time period for waiting\r
Returns:\r
EFI_SUCCESS: The drive and command are not busy\r
- EFI_TIMEOUT: The drive or command is still busy after a period time that \r
+ EFI_TIMEOUT: The drive or command is still busy after a period time that\r
set by TimeoutInSeconds\r
\r
--*/\r
Routine Description: Determine whether FDC is ready to write or read\r
Parameters:\r
Dio BOOLEAN: Indicate the FDC is waiting to write or read\r
- TimeoutInSeconds UINTN: The time period for waiting \r
+ TimeoutInSeconds UINTN: The time period for waiting\r
Returns:\r
EFI_SUCCESS: FDC is ready to write or read\r
EFI_NOT_READY: FDC is not ready within the specified time period\r
\r
Routine Description: Check the drive status information\r
Parameters:\r
- StatusRegister3 UINT8: the value of Status Register 3 \r
+ StatusRegister3 UINT8: the value of Status Register 3\r
Returns:\r
- EFI_SUCCESS: \r
+ EFI_SUCCESS:\r
EFI_WRITE_PROTECTED: The disk is write protected\r
\r
--*/\r
)\r
/*++\r
\r
- Routine Description: Calculate the number of block in the same cylinder \r
+ Routine Description: Calculate the number of block in the same cylinder\r
according to LBA\r
Parameters:\r
FdcDev FDC_BLK_IO_DEV *: A pointer to Data Structure FDC_BLK_IO_DEV\r
- LBA EFI_LBA: The starting logic block address \r
+ LBA EFI_LBA: The starting logic block address\r
NumberOfBlocks UINTN: The number of blocks\r
Returns:\r
- UINTN : The number of blocks in the same cylinder which the starting \r
+ UINTN : The number of blocks in the same cylinder which the starting\r
logic block address is LBA\r
\r
--*/\r
\r
Routine Description: When the Timer(2s) off, turn the drive's motor off\r
Parameters:\r
- Event EFI_EVENT: Event(the timer) whose notification function is being \r
+ Event EFI_EVENT: Event(the timer) whose notification function is being\r
invoked\r
- Context VOID *: Pointer to the notification function's context \r
+ Context VOID *: Pointer to the notification function's context\r
Returns:\r
VOID\r
\r
)\r
/*++\r
\r
- Routine Description: Read I/O port for FDC \r
+ Routine Description: Read I/O port for FDC\r
Parameters:\r
Returns:\r
- \r
+\r
--*/\r
// GC_TODO: function comment is missing 'Arguments:'\r
// GC_TODO: FdcDev - add argument and description to function comment\r
)\r
/*++\r
\r
- Routine Description: Write I/O port for FDC \r
+ Routine Description: Write I/O port for FDC\r
Parameters:\r
Returns:\r
- \r
+\r
--*/\r
// GC_TODO: function comment is missing 'Arguments:'\r
// GC_TODO: FdcDev - add argument and description to function comment\r