mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
Disabled secondary channel by default
svn path=/trunk/; revision=2348
This commit is contained in:
parent
547896ce6f
commit
5db2a7d92d
1 changed files with 40 additions and 23 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: ide.c,v 1.48 2001/11/01 17:48:13 ekohl Exp $
|
/* $Id: ide.c,v 1.49 2001/11/03 16:34:58 ekohl Exp $
|
||||||
*
|
*
|
||||||
* IDE.C - IDE Disk driver
|
* IDE.C - IDE Disk driver
|
||||||
* written by Rex Jolliff
|
* written by Rex Jolliff
|
||||||
|
@ -77,6 +77,9 @@
|
||||||
|
|
||||||
#define VERSION "V0.1.5"
|
#define VERSION "V0.1.5"
|
||||||
|
|
||||||
|
/* uncomment the following line to enable the secondary ide channel */
|
||||||
|
//#define ENABLE_SECONDARY_IDE_CHANNEL
|
||||||
|
|
||||||
// ------------------------------------------------------- File Static Data
|
// ------------------------------------------------------- File Static Data
|
||||||
|
|
||||||
|
|
||||||
|
@ -345,6 +348,7 @@ IdeFindControllers(IN PDRIVER_OBJECT DriverObject)
|
||||||
DPRINT("Primary channel: not programmable\n");
|
DPRINT("Primary channel: not programmable\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_SECONDARY_IDE_CHANNEL
|
||||||
if (PciConfig.ProgIf & 0x04)
|
if (PciConfig.ProgIf & 0x04)
|
||||||
{
|
{
|
||||||
DPRINT("Secondary channel: PCI native mode\n");
|
DPRINT("Secondary channel: PCI native mode\n");
|
||||||
|
@ -395,6 +399,7 @@ IdeFindControllers(IN PDRIVER_OBJECT DriverObject)
|
||||||
{
|
{
|
||||||
DPRINT("BaseAddress: 0x%08X\n", PciConfig.u.type0.BaseAddresses[i]);
|
DPRINT("BaseAddress: 0x%08X\n", PciConfig.u.type0.BaseAddresses[i]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -423,6 +428,7 @@ IdeFindControllers(IN PDRIVER_OBJECT DriverObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for ISA IDE controller if no secondary controller was found */
|
/* Search for ISA IDE controller if no secondary controller was found */
|
||||||
|
#ifdef ENABLE_SECONDARY_IDE_CHANNEL
|
||||||
if (ConfigInfo->AtDiskSecondaryAddressClaimed == FALSE)
|
if (ConfigInfo->AtDiskSecondaryAddressClaimed == FALSE)
|
||||||
{
|
{
|
||||||
DPRINT("Searching for secondary ISA IDE controller!\n");
|
DPRINT("Searching for secondary ISA IDE controller!\n");
|
||||||
|
@ -443,6 +449,7 @@ IdeFindControllers(IN PDRIVER_OBJECT DriverObject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
DPRINT("IdeFindControllers() done!\n");
|
DPRINT("IdeFindControllers() done!\n");
|
||||||
|
|
||||||
|
@ -673,6 +680,10 @@ IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DbgPrint("Found ATA drive %d on controller %d...\n",
|
||||||
|
DriveIdx,
|
||||||
|
ControllerExtension->Number);
|
||||||
|
|
||||||
/* Create the harddisk device directory */
|
/* Create the harddisk device directory */
|
||||||
swprintf (NameBuffer,
|
swprintf (NameBuffer,
|
||||||
L"\\Device\\Harddisk%d",
|
L"\\Device\\Harddisk%d",
|
||||||
|
@ -734,7 +745,7 @@ IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
|
||||||
ControllerExtension);
|
ControllerExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("DrvParms.BytesPerSector %ld\n",DrvParms.BytesPerSector);
|
DPRINT1("DrvParms.BytesPerSector %ld\n",DrvParms.BytesPerSector);
|
||||||
|
|
||||||
/* Read partition table */
|
/* Read partition table */
|
||||||
Status = IoReadPartitionTable(DiskDeviceObject,
|
Status = IoReadPartitionTable(DiskDeviceObject,
|
||||||
|
@ -1011,7 +1022,7 @@ IDECreatePartitionDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
NTSTATUS RC;
|
NTSTATUS RC;
|
||||||
PIDE_DEVICE_EXTENSION DeviceExtension;
|
PIDE_DEVICE_EXTENSION DeviceExtension;
|
||||||
|
|
||||||
// Create a unicode device name
|
/* Create a unicode device name */
|
||||||
swprintf(NameBuffer,
|
swprintf(NameBuffer,
|
||||||
L"\\Device\\Harddisk%d\\Partition%d",
|
L"\\Device\\Harddisk%d\\Partition%d",
|
||||||
DiskNumber,
|
DiskNumber,
|
||||||
|
@ -1019,7 +1030,7 @@ IDECreatePartitionDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
RtlInitUnicodeString(&DeviceName,
|
RtlInitUnicodeString(&DeviceName,
|
||||||
NameBuffer);
|
NameBuffer);
|
||||||
|
|
||||||
// Create the device
|
/* Create the device */
|
||||||
RC = IoCreateDevice(DriverObject, sizeof(IDE_DEVICE_EXTENSION),
|
RC = IoCreateDevice(DriverObject, sizeof(IDE_DEVICE_EXTENSION),
|
||||||
&DeviceName, FILE_DEVICE_DISK, 0, TRUE, DeviceObject);
|
&DeviceName, FILE_DEVICE_DISK, 0, TRUE, DeviceObject);
|
||||||
if (!NT_SUCCESS(RC))
|
if (!NT_SUCCESS(RC))
|
||||||
|
@ -1028,12 +1039,12 @@ IDECreatePartitionDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
return RC;
|
return RC;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the buffering strategy here...
|
/* Set the buffering strategy here... */
|
||||||
(*DeviceObject)->Flags |= DO_DIRECT_IO;
|
(*DeviceObject)->Flags |= DO_DIRECT_IO;
|
||||||
(*DeviceObject)->AlignmentRequirement = FILE_WORD_ALIGNMENT;
|
(*DeviceObject)->AlignmentRequirement = FILE_WORD_ALIGNMENT;
|
||||||
|
|
||||||
// Fill out Device extension data
|
/* Fill out Device extension data */
|
||||||
DeviceExtension = (PIDE_DEVICE_EXTENSION) (*DeviceObject)->DeviceExtension;
|
DeviceExtension = (PIDE_DEVICE_EXTENSION)(*DeviceObject)->DeviceExtension;
|
||||||
DeviceExtension->DeviceObject = (*DeviceObject);
|
DeviceExtension->DeviceObject = (*DeviceObject);
|
||||||
DeviceExtension->ControllerObject = ControllerObject;
|
DeviceExtension->ControllerObject = ControllerObject;
|
||||||
DeviceExtension->DiskDeviceExtension = DiskDeviceExtension;
|
DeviceExtension->DiskDeviceExtension = DiskDeviceExtension;
|
||||||
|
@ -1042,19 +1053,16 @@ IDECreatePartitionDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
(DrvParms->Capabilities & IDE_DRID_LBA_SUPPORTED) ? 1 : 0;
|
(DrvParms->Capabilities & IDE_DRID_LBA_SUPPORTED) ? 1 : 0;
|
||||||
DeviceExtension->DMASupported =
|
DeviceExtension->DMASupported =
|
||||||
(DrvParms->Capabilities & IDE_DRID_DMA_SUPPORTED) ? 1 : 0;
|
(DrvParms->Capabilities & IDE_DRID_DMA_SUPPORTED) ? 1 : 0;
|
||||||
// FIXME: deal with bizarre sector sizes
|
DeviceExtension->BytesPerSector = DrvParms->BytesPerSector;
|
||||||
DeviceExtension->BytesPerSector = 512 /* DrvParms->BytesPerSector */;
|
|
||||||
DeviceExtension->SectorsPerLogCyl = DrvParms->LogicalHeads *
|
DeviceExtension->SectorsPerLogCyl = DrvParms->LogicalHeads *
|
||||||
DrvParms->SectorsPerTrack;
|
DrvParms->SectorsPerTrack;
|
||||||
DeviceExtension->SectorsPerLogTrk = DrvParms->SectorsPerTrack;
|
DeviceExtension->SectorsPerLogTrk = DrvParms->SectorsPerTrack;
|
||||||
DeviceExtension->LogicalHeads = DrvParms->LogicalHeads;
|
DeviceExtension->LogicalHeads = DrvParms->LogicalHeads;
|
||||||
DeviceExtension->LogicalCylinders =
|
DeviceExtension->LogicalCylinders =
|
||||||
(DrvParms->Capabilities & IDE_DRID_LBA_SUPPORTED) ? DrvParms->TMCylinders : DrvParms->LogicalCyls;
|
(DrvParms->Capabilities & IDE_DRID_LBA_SUPPORTED) ? DrvParms->TMCylinders : DrvParms->LogicalCyls;
|
||||||
// DeviceExtension->Offset = Offset;
|
|
||||||
// DeviceExtension->Size = Size;
|
|
||||||
|
|
||||||
DeviceExtension->Offset = PartitionInfo->StartingOffset.QuadPart / 512; /* DrvParms.BytesPerSector*/
|
DeviceExtension->Offset = PartitionInfo->StartingOffset.QuadPart / 512; /* DrvParms->BytesPerSector */
|
||||||
DeviceExtension->Size = PartitionInfo->PartitionLength.QuadPart / 512; /*DrvParms.BytesPerSector*/
|
DeviceExtension->Size = PartitionInfo->PartitionLength.QuadPart / 512; /* DrvParms->BytesPerSector */
|
||||||
|
|
||||||
DPRINT("%wZ: offset %lu size %lu \n",
|
DPRINT("%wZ: offset %lu size %lu \n",
|
||||||
&DeviceName,
|
&DeviceName,
|
||||||
|
@ -1196,7 +1204,11 @@ IDEPolledRead(IN WORD Address,
|
||||||
Status = IDEReadStatus(Address);
|
Status = IDEReadStatus(Address);
|
||||||
if (!(Status & IDE_SR_BUSY))
|
if (!(Status & IDE_SR_BUSY))
|
||||||
{
|
{
|
||||||
if (Status & IDE_SR_DRQ)
|
if (Status & IDE_SR_ERR)
|
||||||
|
{
|
||||||
|
DPRINT1("IDE_SR_ERR asserted!\n");
|
||||||
|
}
|
||||||
|
if ((Status & IDE_SR_DRQ) && !(Status & IDE_SR_ERR))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1222,6 +1234,10 @@ IDEPolledRead(IN WORD Address,
|
||||||
Status = IDEReadStatus(Address);
|
Status = IDEReadStatus(Address);
|
||||||
if (!(Status & IDE_SR_BUSY))
|
if (!(Status & IDE_SR_BUSY))
|
||||||
{
|
{
|
||||||
|
if (Status & IDE_SR_ERR)
|
||||||
|
{
|
||||||
|
DPRINT1("IDE_SR_ERR asserted!\n");
|
||||||
|
}
|
||||||
if (Status & IDE_SR_DRQ)
|
if (Status & IDE_SR_DRQ)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -1403,7 +1419,7 @@ IDEDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject,
|
||||||
DiskDeviceExtension->SectorsPerLogTrk;
|
DiskDeviceExtension->SectorsPerLogTrk;
|
||||||
Geometry->SectorsPerTrack = DiskDeviceExtension->SectorsPerLogTrk;
|
Geometry->SectorsPerTrack = DiskDeviceExtension->SectorsPerLogTrk;
|
||||||
Geometry->BytesPerSector = DiskDeviceExtension->BytesPerSector;
|
Geometry->BytesPerSector = DiskDeviceExtension->BytesPerSector;
|
||||||
|
DPRINT1("DiskDeviceExtension->BytesPerSector %lu\n", DiskDeviceExtension->BytesPerSector);
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
Irp->IoStatus.Information = sizeof(DISK_GEOMETRY);
|
Irp->IoStatus.Information = sizeof(DISK_GEOMETRY);
|
||||||
}
|
}
|
||||||
|
@ -1690,7 +1706,8 @@ IDEStartController(IN OUT PVOID Context)
|
||||||
for (Retries = 0; Retries < IDE_MAX_BUSY_RETRIES; Retries++)
|
for (Retries = 0; Retries < IDE_MAX_BUSY_RETRIES; Retries++)
|
||||||
{
|
{
|
||||||
Status = IDEReadStatus(ControllerExtension->CommandPortBase);
|
Status = IDEReadStatus(ControllerExtension->CommandPortBase);
|
||||||
if (!(Status & IDE_SR_BUSY) && (Status & IDE_SR_DRDY))
|
// if (!(Status & IDE_SR_BUSY) && (Status & IDE_SR_DRDY))
|
||||||
|
if (!(Status & IDE_SR_BUSY) && !(Status & IDE_SR_DRQ))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue