mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Added detection of PCI Bus Master Controllers.
svn path=/trunk/; revision=3428
This commit is contained in:
parent
07c788111d
commit
5857837550
1 changed files with 46 additions and 9 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: atapi.c,v 1.26 2002/07/18 00:30:22 ekohl Exp $
|
/* $Id: atapi.c,v 1.27 2002/08/28 18:36:18 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS ATAPI miniport driver
|
* PROJECT: ReactOS ATAPI miniport driver
|
||||||
|
@ -79,6 +79,7 @@ typedef struct _ATAPI_MINIPORT_EXTENSION
|
||||||
|
|
||||||
ULONG CommandPortBase;
|
ULONG CommandPortBase;
|
||||||
ULONG ControlPortBase;
|
ULONG ControlPortBase;
|
||||||
|
ULONG BusMasterRegisterBase;
|
||||||
|
|
||||||
BOOLEAN ExpectingInterrupt;
|
BOOLEAN ExpectingInterrupt;
|
||||||
PSCSI_REQUEST_BLOCK CurrentSrb;
|
PSCSI_REQUEST_BLOCK CurrentSrb;
|
||||||
|
@ -274,7 +275,7 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
||||||
/* Search the PCI bus for compatibility mode ide controllers */
|
/* Search the PCI bus for compatibility mode ide controllers */
|
||||||
#ifdef ENABLE_PCI
|
#ifdef ENABLE_PCI
|
||||||
InitData.HwFindAdapter = AtapiFindCompatiblePciController;
|
InitData.HwFindAdapter = AtapiFindCompatiblePciController;
|
||||||
InitData.NumberOfAccessRanges = 2;
|
InitData.NumberOfAccessRanges = 3;
|
||||||
InitData.AdapterInterfaceType = PCIBus;
|
InitData.AdapterInterfaceType = PCIBus;
|
||||||
|
|
||||||
InitData.VendorId = NULL;
|
InitData.VendorId = NULL;
|
||||||
|
@ -328,7 +329,7 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
||||||
// statusToReturn = newStatus;
|
// statusToReturn = newStatus;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DPRINT( "Returning from DriverEntry\n" );
|
DPRINT("Returning from DriverEntry\n");
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
@ -365,8 +366,6 @@ AtapiFindCompatiblePciController(PVOID DeviceExtension,
|
||||||
SlotNumber.u.AsULONG = 0;
|
SlotNumber.u.AsULONG = 0;
|
||||||
for (FunctionNumber = 0 /*ConfigInfo->SlotNumber*/; FunctionNumber < 256; FunctionNumber++)
|
for (FunctionNumber = 0 /*ConfigInfo->SlotNumber*/; FunctionNumber < 256; FunctionNumber++)
|
||||||
{
|
{
|
||||||
// SlotNumber.u.bits.FunctionNumber = FunctionNumber;
|
|
||||||
// SlotNumber.u.AsULONG = (FunctionNumber & 0x07);
|
|
||||||
SlotNumber.u.AsULONG = FunctionNumber;
|
SlotNumber.u.AsULONG = FunctionNumber;
|
||||||
|
|
||||||
ChannelFound = FALSE;
|
ChannelFound = FALSE;
|
||||||
|
@ -408,6 +407,16 @@ AtapiFindCompatiblePciController(PVOID DeviceExtension,
|
||||||
ConfigInfo->MaximumNumberOfTargets = 2;
|
ConfigInfo->MaximumNumberOfTargets = 2;
|
||||||
ConfigInfo->MaximumTransferLength = 0x10000; /* max 64Kbyte */
|
ConfigInfo->MaximumTransferLength = 0x10000; /* max 64Kbyte */
|
||||||
|
|
||||||
|
if (PciConfig.ProgIf & 0x80)
|
||||||
|
{
|
||||||
|
DPRINT("Found IDE Bus Master controller!\n");
|
||||||
|
if (PciConfig.u.type0.BaseAddresses[4] & 0x00000001)
|
||||||
|
{
|
||||||
|
DPRINT(" IDE Bus Master Registers at IO %lx\n",
|
||||||
|
PciConfig.u.type0.BaseAddresses[4] & ~0x00000003);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ConfigInfo->AtdiskPrimaryClaimed == FALSE)
|
if (ConfigInfo->AtdiskPrimaryClaimed == FALSE)
|
||||||
{
|
{
|
||||||
/* Both channels unclaimed: Claim primary channel */
|
/* Both channels unclaimed: Claim primary channel */
|
||||||
|
@ -420,14 +429,28 @@ AtapiFindCompatiblePciController(PVOID DeviceExtension,
|
||||||
ConfigInfo->BusInterruptVector = 14;
|
ConfigInfo->BusInterruptVector = 14;
|
||||||
ConfigInfo->InterruptMode = LevelSensitive;
|
ConfigInfo->InterruptMode = LevelSensitive;
|
||||||
|
|
||||||
ConfigInfo->AccessRanges[0].RangeStart = ScsiPortConvertUlongToPhysicalAddress(0x01F0);
|
ConfigInfo->AccessRanges[0].RangeStart =
|
||||||
|
ScsiPortConvertUlongToPhysicalAddress(0x01F0);
|
||||||
ConfigInfo->AccessRanges[0].RangeLength = 8;
|
ConfigInfo->AccessRanges[0].RangeLength = 8;
|
||||||
ConfigInfo->AccessRanges[0].RangeInMemory = FALSE;
|
ConfigInfo->AccessRanges[0].RangeInMemory = FALSE;
|
||||||
|
|
||||||
ConfigInfo->AccessRanges[1].RangeStart = ScsiPortConvertUlongToPhysicalAddress(0x03F6);
|
ConfigInfo->AccessRanges[1].RangeStart =
|
||||||
|
ScsiPortConvertUlongToPhysicalAddress(0x03F6);
|
||||||
ConfigInfo->AccessRanges[1].RangeLength = 1;
|
ConfigInfo->AccessRanges[1].RangeLength = 1;
|
||||||
ConfigInfo->AccessRanges[1].RangeInMemory = FALSE;
|
ConfigInfo->AccessRanges[1].RangeInMemory = FALSE;
|
||||||
|
|
||||||
|
/* Claim bus master registers */
|
||||||
|
if (PciConfig.ProgIf & 0x80)
|
||||||
|
{
|
||||||
|
DevExt->BusMasterRegisterBase =
|
||||||
|
PciConfig.u.type0.BaseAddresses[4] & ~0x00000003;
|
||||||
|
|
||||||
|
ConfigInfo->AccessRanges[2].RangeStart =
|
||||||
|
ScsiPortConvertUlongToPhysicalAddress(DevExt->BusMasterRegisterBase);
|
||||||
|
ConfigInfo->AccessRanges[2].RangeLength = 8;
|
||||||
|
ConfigInfo->AccessRanges[2].RangeInMemory = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
ConfigInfo->AtdiskPrimaryClaimed = TRUE;
|
ConfigInfo->AtdiskPrimaryClaimed = TRUE;
|
||||||
ChannelFound = TRUE;
|
ChannelFound = TRUE;
|
||||||
*Again = TRUE;
|
*Again = TRUE;
|
||||||
|
@ -444,14 +467,28 @@ AtapiFindCompatiblePciController(PVOID DeviceExtension,
|
||||||
ConfigInfo->BusInterruptVector = 15;
|
ConfigInfo->BusInterruptVector = 15;
|
||||||
ConfigInfo->InterruptMode = LevelSensitive;
|
ConfigInfo->InterruptMode = LevelSensitive;
|
||||||
|
|
||||||
ConfigInfo->AccessRanges[0].RangeStart = ScsiPortConvertUlongToPhysicalAddress(0x0170);
|
ConfigInfo->AccessRanges[0].RangeStart =
|
||||||
|
ScsiPortConvertUlongToPhysicalAddress(0x0170);
|
||||||
ConfigInfo->AccessRanges[0].RangeLength = 8;
|
ConfigInfo->AccessRanges[0].RangeLength = 8;
|
||||||
ConfigInfo->AccessRanges[0].RangeInMemory = FALSE;
|
ConfigInfo->AccessRanges[0].RangeInMemory = FALSE;
|
||||||
|
|
||||||
ConfigInfo->AccessRanges[1].RangeStart = ScsiPortConvertUlongToPhysicalAddress(0x0376);
|
ConfigInfo->AccessRanges[1].RangeStart =
|
||||||
|
ScsiPortConvertUlongToPhysicalAddress(0x0376);
|
||||||
ConfigInfo->AccessRanges[1].RangeLength = 1;
|
ConfigInfo->AccessRanges[1].RangeLength = 1;
|
||||||
ConfigInfo->AccessRanges[1].RangeInMemory = FALSE;
|
ConfigInfo->AccessRanges[1].RangeInMemory = FALSE;
|
||||||
|
|
||||||
|
/* Claim bus master registers */
|
||||||
|
if (PciConfig.ProgIf & 0x80)
|
||||||
|
{
|
||||||
|
DevExt->BusMasterRegisterBase =
|
||||||
|
(PciConfig.u.type0.BaseAddresses[4] & ~0x00000003) + 8;
|
||||||
|
|
||||||
|
ConfigInfo->AccessRanges[2].RangeStart =
|
||||||
|
ScsiPortConvertUlongToPhysicalAddress(DevExt->BusMasterRegisterBase);
|
||||||
|
ConfigInfo->AccessRanges[2].RangeLength = 8;
|
||||||
|
ConfigInfo->AccessRanges[2].RangeInMemory = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
ConfigInfo->AtdiskSecondaryClaimed = TRUE;
|
ConfigInfo->AtdiskSecondaryClaimed = TRUE;
|
||||||
ChannelFound = TRUE;
|
ChannelFound = TRUE;
|
||||||
*Again = FALSE;
|
*Again = FALSE;
|
||||||
|
|
Loading…
Reference in a new issue