From 77a5b5a508bdf93e427ba4f61378063dd7c9131d Mon Sep 17 00:00:00 2001 From: Andrew Munger Date: Thu, 6 Sep 2007 12:36:05 +0000 Subject: [PATCH] Gracefully handle the case where the BIOS insists there is a floppy drive, but there is no controller. Patch by Cameron Gutman (aicommander at gmail dot com) from Bug 1508. svn path=/trunk/; revision=28899 --- reactos/drivers/storage/floppy/floppy.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/reactos/drivers/storage/floppy/floppy.c b/reactos/drivers/storage/floppy/floppy.c index caba485eb4a..19c778acb01 100644 --- a/reactos/drivers/storage/floppy/floppy.c +++ b/reactos/drivers/storage/floppy/floppy.c @@ -687,6 +687,22 @@ static NTSTATUS NTAPI InitController(PCONTROLLER_INFO ControllerInfo) return STATUS_IO_DEVICE_ERROR; } +/* Check if floppy drive exists */ + if(HwSenseInterruptStatus(ControllerInfo) != STATUS_SUCCESS) + { + DPRINT("floppy: Floppy drive not detected! Returning STATUS_IO_DEVICE_ERROR\n"); + return STATUS_IO_DEVICE_ERROR; + } + +DPRINT("floppy: InitController: resetting the controller after floppy detection\n"); + + /* Reset the controller */ + if(HwReset(ControllerInfo) != STATUS_SUCCESS) + { + DPRINT("floppy: InitController: unable to reset controller\n"); + return STATUS_IO_DEVICE_ERROR; + } + DPRINT("floppy: InitController: setting data rate\n"); /* Set data rate */