mirror of
https://github.com/reactos/reactos.git
synced 2025-06-06 01:40:36 +00:00
[STORPORT] Initialize the port configuration and pass it to the HwFindAdapter routine.
This commit is contained in:
parent
eb05356a26
commit
dd0027ba19
3 changed files with 110 additions and 6 deletions
|
@ -124,6 +124,28 @@ PortFdoQueryBusRelations(
|
|||
}
|
||||
|
||||
|
||||
static
|
||||
NTSTATUS
|
||||
PortFdoFilterRequirements(
|
||||
PFDO_DEVICE_EXTENSION DeviceExtension,
|
||||
PIRP Irp)
|
||||
{
|
||||
PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList;
|
||||
|
||||
DPRINT1("PortFdoFilterRequirements(%p %p)\n", DeviceExtension, Irp);
|
||||
|
||||
/* Get the bus number and the slot number */
|
||||
RequirementsList =(PIO_RESOURCE_REQUIREMENTS_LIST)Irp->IoStatus.Information;
|
||||
if (RequirementsList != NULL)
|
||||
{
|
||||
DeviceExtension->BusNumber = RequirementsList->BusNumber;
|
||||
DeviceExtension->SlotNumber = RequirementsList->SlotNumber;
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PortFdoPnp(
|
||||
|
@ -197,6 +219,7 @@ PortFdoPnp(
|
|||
|
||||
case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* 0x0d */
|
||||
DPRINT1("IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
|
||||
PortFdoFilterRequirements(DeviceExtension, Irp);
|
||||
return ForwardIrpAndForget(DeviceExtension->LowerDevice, Irp);
|
||||
|
||||
case IRP_MN_QUERY_PNP_DEVICE_STATE: /* 0x14 */
|
||||
|
|
|
@ -15,6 +15,80 @@
|
|||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
static
|
||||
NTSTATUS
|
||||
InitializeConfiguration(
|
||||
_In_ PPORT_CONFIGURATION_INFORMATION PortConfig,
|
||||
_In_ PHW_INITIALIZATION_DATA InitData,
|
||||
_In_ ULONG BusNumber,
|
||||
_In_ ULONG SlotNumber)
|
||||
{
|
||||
PCONFIGURATION_INFORMATION ConfigInfo;
|
||||
ULONG i;
|
||||
|
||||
DPRINT1("InitializeConfiguration(%p %p %lu %lu)\n",
|
||||
PortConfig, InitData, BusNumber, SlotNumber);
|
||||
|
||||
/* Get the configurration information */
|
||||
ConfigInfo = IoGetConfigurationInformation();
|
||||
|
||||
/* Initialize the port configuration */
|
||||
RtlZeroMemory(PortConfig,
|
||||
sizeof(PORT_CONFIGURATION_INFORMATION));
|
||||
|
||||
PortConfig->Length = sizeof(PORT_CONFIGURATION_INFORMATION);
|
||||
PortConfig->SystemIoBusNumber = BusNumber;
|
||||
PortConfig->SlotNumber = SlotNumber;
|
||||
PortConfig->AdapterInterfaceType = InitData->AdapterInterfaceType;
|
||||
|
||||
PortConfig->MaximumTransferLength = -1; //SP_UNINITIALIZED_VALUE;
|
||||
PortConfig->DmaChannel = -1; //SP_UNINITIALIZED_VALUE;
|
||||
PortConfig->DmaPort = -1; //SP_UNINITIALIZED_VALUE;
|
||||
|
||||
PortConfig->InterruptMode = LevelSensitive;
|
||||
|
||||
PortConfig->Master = TRUE;
|
||||
PortConfig->AtdiskPrimaryClaimed = ConfigInfo->AtDiskPrimaryAddressClaimed;
|
||||
PortConfig->AtdiskSecondaryClaimed = ConfigInfo->AtDiskSecondaryAddressClaimed;
|
||||
PortConfig->Dma32BitAddresses = TRUE;
|
||||
PortConfig->DemandMode = FALSE;
|
||||
PortConfig->MapBuffers = InitData->MapBuffers;
|
||||
|
||||
PortConfig->NeedPhysicalAddresses = TRUE;
|
||||
PortConfig->TaggedQueuing = TRUE;
|
||||
PortConfig->AutoRequestSense = TRUE;
|
||||
PortConfig->MultipleRequestPerLu = TRUE;
|
||||
PortConfig->ReceiveEvent = InitData->ReceiveEvent;
|
||||
PortConfig->RealModeInitialized = FALSE;
|
||||
PortConfig->BufferAccessScsiPortControlled = TRUE;
|
||||
PortConfig->MaximumNumberOfTargets = 128;
|
||||
|
||||
PortConfig->SpecificLuExtensionSize = InitData->SpecificLuExtensionSize;
|
||||
PortConfig->SrbExtensionSize = InitData->SrbExtensionSize;
|
||||
PortConfig->MaximumNumberOfLogicalUnits = 1;
|
||||
PortConfig->WmiDataProvider = TRUE;
|
||||
|
||||
PortConfig->NumberOfAccessRanges = InitData->NumberOfAccessRanges;
|
||||
DPRINT1("NumberOfAccessRanges: %lu\n", PortConfig->NumberOfAccessRanges);
|
||||
if (PortConfig->NumberOfAccessRanges != 0)
|
||||
{
|
||||
PortConfig->AccessRanges = ExAllocatePoolWithTag(NonPagedPool,
|
||||
PortConfig->NumberOfAccessRanges * sizeof(ACCESS_RANGE),
|
||||
TAG_ACCRESS_RANGE);
|
||||
if (PortConfig->AccessRanges == NULL)
|
||||
return STATUS_NO_MEMORY;
|
||||
|
||||
RtlZeroMemory(PortConfig->AccessRanges,
|
||||
PortConfig->NumberOfAccessRanges * sizeof(ACCESS_RANGE));
|
||||
}
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
PortConfig->InitiatorBusId[i] = 0xff;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
MiniportInitialize(
|
||||
_In_ PMINIPORT Miniport,
|
||||
|
@ -23,6 +97,7 @@ MiniportInitialize(
|
|||
{
|
||||
PMINIPORT_DEVICE_EXTENSION MiniportExtension;
|
||||
ULONG Size;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT1("MiniportInitialize(%p %p %p)\n",
|
||||
Miniport, DeviceExtension, InitData);
|
||||
|
@ -46,7 +121,13 @@ MiniportInitialize(
|
|||
MiniportExtension->Miniport = Miniport;
|
||||
Miniport->MiniportExtension = MiniportExtension;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
/* Initialize the port configuration */
|
||||
Status = InitializeConfiguration(&Miniport->PortConfig,
|
||||
InitData,
|
||||
DeviceExtension->BusNumber,
|
||||
DeviceExtension->SlotNumber);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,7 +146,7 @@ MiniportFindAdapter(
|
|||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&Miniport->PortConfig,
|
||||
&Reserved);
|
||||
DPRINT1("HwFindAdapter() returned %lu\n", Result);
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#define TAG_GLOBAL_DATA 'DGtS'
|
||||
#define TAG_INIT_DATA 'DItS'
|
||||
#define TAG_MINIPORT_DATA 'DMtS'
|
||||
#define TAG_ACCRESS_RANGE 'RAtS'
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -72,6 +73,7 @@ typedef struct _MINIPORT
|
|||
{
|
||||
struct _FDO_DEVICE_EXTENSION *DeviceExtension;
|
||||
PHW_INITIALIZATION_DATA InitData;
|
||||
PORT_CONFIGURATION_INFORMATION PortConfig;
|
||||
PMINIPORT_DEVICE_EXTENSION MiniportExtension;
|
||||
} MINIPORT, *PMINIPORT;
|
||||
|
||||
|
@ -82,14 +84,12 @@ typedef struct _FDO_DEVICE_EXTENSION
|
|||
PDEVICE_OBJECT Device;
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
PDEVICE_OBJECT PhysicalDevice;
|
||||
|
||||
PDRIVER_OBJECT_EXTENSION DriverExtension;
|
||||
|
||||
DEVICE_STATE PnpState;
|
||||
LIST_ENTRY AdapterListEntry;
|
||||
|
||||
MINIPORT Miniport;
|
||||
|
||||
ULONG BusNumber;
|
||||
ULONG SlotNumber;
|
||||
} FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue