Necessary Changes to DriverEntry for PCI SCSI Miniport DriverID: Q137383
|
Minimal changes are necessary to modify a SCSI miniport's DriverEntry routine to support a PCI adapter because the SCSIPORT driver is responsible for locating and configuring the PCI device specified. This article describes the changes that do need to be made.
For each PCI device that matches the specified Vendor and Device ID, the
SCSIPORT driver calls the miniport's HwScsiFindAdapter routine. If there
are four devices that match the Vendor and Device ID, the HwScsiFindAdapter
routine is called four times.
The following sample SCSI miniport DriverEntry routine shows how to set up
and call ScsiPortInitialize assuming the Vendor ID is 0x1999 and the Device
ID is 0x0000. Note that this driver expect two access ranges - one for a
memory range and one for an I/O range. When the HwScsiFindAdapter is
called, these access ranges are already filled in and should be mapped by
calling ScsiPortGetDeviceBase. Usually, no other PCI-specific configuration
needs to be done.
ULONG
DriverEntry(
IN PVOID DriverObject,
IN PVOID Argument2
)
/*++
Installable driver initialization entry point for system.Arguments:
Driver ObjectReturn Value:
Status from ScsiPortInitialize()--*/
{
HW_INITIALIZATION_DATA hwInitData;
UCHAR vendorId[4] = {'1', '9', '9', '9'};
UCHAR deviceId[4] = {'0', '0', '0', '0'};
//
// Initialize the hardware initialization data structure.
//
for ( i = 0; i < sizeof( HW_INITIALIZATION_DATA); i++) {
((PUCHAR)&hwInitData)[i] = 0;
}
//
// Set size of hardware initialization structure.
//
hwInitData.HwInitializationDataSize = sizeof(HW_INITIALIZATION_DATA);
//
// Identify required miniport entry point routines.
//
hwInitData.HwInitialize = XyzInitialize;
hwInitData.HwStartIo = XyzStartIo;
hwInitData.HwInterrupt = XyzISR;
hwInitData.HwFindAdapter = XyzFindAdapter;
hwInitData.HwResetBus = XyzReset;
hwInitData.HwAdapterState = XyzAdapterState;
//
// Specify adapter specific information.
//
hwInitData.NeedPhysicalAddresses = TRUE;
//
// Indicate how many I/O or memory ranges will be used.
//
hwInitData.NumberOfAccessRanges = 2;
//
// Set up PCI-specific information.
//
hwInitData.AdapterInterfaceType = PCIBus;
hwInitData.VendorId = &vendorId;
hwInitData.VendorIdLength = 4;
hwInitData.DeviceId = &deviceId;
hwInitData.DeviceIdLength = 4;
//
// Set required extension sizes.
//
hwInitData.DeviceExtensionSize = sizeof(HW_DEVICE_EXTENSION);
hwInitData.SrbExtensionSize = sizeof(SRB_EXTENSION);
hwInitData.SpecificLuExtensionSize =
sizeof(SPECIFIC_LOGICAL_UNIT_EXTENSION);
return ( ScsiPortInitialize(DriverObject,
Argument2,
&hwInitializationData,
NULL
) );
} // end DriverEntry()
Additional query words: 3.50
Keywords :
Version :
Platform :
Issue type :
Last Reviewed: March 2, 1999