From 2d9911518151275c5c32fc2dd2c99cf86d672a26 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Fri, 3 Sep 2004 02:55:50 +0000 Subject: [PATCH] Issue soft reset command for identification and not ATAPI reset command which works only for packet based devices like CD-ROM drives and it's use on ATA devices is prohibited by the standard. If an ATAPI device is detected then and only then issue the ATAPI reset command. Also fix the addresses in AtapiClaimHwResources. This might fix bug #406. svn path=/trunk/; revision=10776 --- reactos/drivers/storage/atapi/atapi.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/reactos/drivers/storage/atapi/atapi.c b/reactos/drivers/storage/atapi/atapi.c index bef1f976b66..9dcee9cc237 100644 --- a/reactos/drivers/storage/atapi/atapi.c +++ b/reactos/drivers/storage/atapi/atapi.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: atapi.c,v 1.48 2004/03/07 19:48:45 hbirr Exp $ +/* $Id: atapi.c,v 1.49 2004/09/03 02:55:50 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS ATAPI miniport driver @@ -525,11 +525,11 @@ AtapiClaimHwResources(PATAPI_MINIPORT_EXTENSION DevExt, ConfigInfo->BusInterruptVector = InterruptVector; ConfigInfo->InterruptMode = (InterfaceType == Isa) ? Latched : LevelSensitive; - if ((CommandPortBase == 0x1F0 || ControlPortBase == 0x3F4) && !ConfigInfo->AtdiskPrimaryClaimed) + if ((CommandPortBase == 0x1F0 || ControlPortBase == 0x3F6) && !ConfigInfo->AtdiskPrimaryClaimed) { ConfigInfo->AtdiskPrimaryClaimed = TRUE; } - if ((CommandPortBase == 0x170 || ControlPortBase == 0x374) && !ConfigInfo->AtdiskSecondaryClaimed) + if ((CommandPortBase == 0x170 || ControlPortBase == 0x376) && !ConfigInfo->AtdiskSecondaryClaimed) { ConfigInfo->AtdiskSecondaryClaimed = TRUE; } @@ -1128,7 +1128,11 @@ AtapiFindDevices(PATAPI_MINIPORT_EXTENSION DeviceExtension, continue; } - AtapiExecuteCommand(DeviceExtension, IDE_CMD_RESET, NULL); + /* Soft reset */ + IDEWriteDriveControl(ControlPortBase, IDE_DC_nIEN | IDE_DC_SRST); + ScsiPortStallExecution(500); + IDEWriteDriveControl(ControlPortBase, IDE_DC_nIEN); + ScsiPortStallExecution(500); for (Retries = 0; Retries < 20000; Retries++) { @@ -1172,6 +1176,8 @@ AtapiFindDevices(PATAPI_MINIPORT_EXTENSION DeviceExtension, DeviceExtension->DeviceFlags[UnitNumber] |= DEVICE_DMA_CMD; } #endif + AtapiExecuteCommand(DeviceExtension, IDE_CMD_RESET, NULL); + ScsiPortStallExecution(500); DeviceFound = TRUE; } else