Storport driver HwFindAdapter.

Hello All,
Hi All,
I am modifying the Virtual miniport driver code into a storport miniport driver for a commerically available SAS HBA.

The following two steps work as expected:

  1. INF file modification according to the hardware details - the driver files get installed on Win 7 and Windows registry reflects the correct details.
  2. Driver entry routine is called and returns success.

Issues and questions:

  1. For HwFindAdapter(), function has been modified to look like below:-
    HwFindAdapter(IN PVOID PDevExt,
    IN PVOID PHwContext,
    IN PVOID PBusInformation,
    IN PCHAR PArgumentString,
    IN OUT PPORT_CONFIGURATION_INFORMATION PConfigInfo,
    IN PBOOLEAN PBAgain)

Values filled in as reported by WinDbg is shown below:
HwFindAdapter(void * PDevExt = 0x8d19b00c,
void * PHwContext = 0x00000000,
void * PBusInformation = 0x00000000,
char * PArgumentString = 0x8d19bd28 “PlaceHolder=0;”,
struct _PORT_CONFIGURATION_INFORMATION * PConfigInfo = 0x8d193a88,
unsigned char * PBAgain = 0x80786683 “”)

Questions:

  1. What can cause PHwContext, PBusInformation values to be 0x00000? How can I fix it?

  2. IoRegisterdeviceInterface() at the end of HwFindAdapter function is failing since. PHwContext is 0x00000
    The call is modified to be :
    status = IoRegisterDeviceInterface((PDEVICE_OBJECT) PHwContext, &GUID_DEVCLASS_SCSIADAPTER,NULL,&pDevExt->DeviceInterface);

  3. Since it is a commecial HBA, how do I get the memory map and capabilities values from the BAR.
    I am getting BAR as follows:
    pDevExt->RegisterBase =
    (unsigned int *)StorPortGetDeviceBase(pDevExt,
    PConfigInfo->AdapterInterfaceType,
    PConfigInfo->SystemIoBusNumber,
    AccessRange->RangeStart,
    AccessRange->RangeLength,
    (BOOLEAN)!AccessRange->RangeInMemory);
    pDevExt->RegisterBasePhys = AccessRange->RangeStart.LowPart;

How can I get HBA capabilities from this?

Thanks for your help.