none
Help! why could not my driver routine get the hardware device complete resource in IRP stack of IRP_MN_START_DEVICE request. RRS feed

  • Question

  • Using WDM frame, in my device driver routine(FDO), in order to get hardware resource,such as memory,io port,I post the IRP of IRP_MN_START_DEVICE to lower level driver(PDO),but when the IRP returned,I retrieve the IRP stack member (irpsp->Parameters.StartDevice.AllocatedResources->List[0].PartialResourceList.PartialDescriptors),the type member just had only one memory type,other type member was unknow,not has interrupt type or DMA type or others.please help me to solve.

    Monday, July 29, 2019 3:11 AM

All replies

  • How did you install your driver? Did you use devcon install? If so, you created a root enumerated device and did not install it on your PCI device.  You need to use devcon update

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, July 29, 2019 5:32 AM
  • thank u for reply, I use Device Manager to install my driver and use a .inf file of myself write. actually, I use the way of test my driver is update driver for a pcie network card.But I found the resource of I got in my driver is not same with windows Device Manager I see,just one bar memory same, other resource unknow,and not have interrupt information. here is my .inf file
    [Version]
    
    ;Signature="$CHICAGO$"
    ;4d36e972-e325-11ce-bfc1-08002be10318
    
    
    Signature="$WINDOWS NT$"
    ;Class=ScxrHardwareClass
    Class=Net
    ;ClassGUID={327DF1F5-AE3B-41CE-95CE-DEBF42FAA1DD} 
    ClassGUID={4d36e972-e325-11ce-bfc1-08002be10318} 
    DriverVer=7/16/2019,0.0.0.18
    Provider=ShenCXR
    
    [ClassInstall32]
    Addreg=Add_class
    
    
    [Add_class]
    HKR,,,,%DevClassName%
    HKR,,Icon,,"-5"
    
    
    [Manufacturer]
    "MySoft"=mfg,NTX86,NTAMD64
    
    
    [mfg.NTX86]
    ;"ScxrVirtualDev"=Scxr_Install,PCI\VEN_8888&DEV_8888
    "ScxrVirtualDev"=Scxr_Install,PCI\VEN_8086&DEV_10FB
    
    
    [mfg.NTAMD64]
    ;"ScxrVirtualDev"=Scxr_Install,PCI\VEN_8888&DEV_8888
    "ScxrVirtualDev"=Scxr_Install,PCI\VEN_8086&DEV_10FB
    
    [SourceDisksNames]
    1="sssss"
    
    
    [SourceDisksFiles]
    Wdm_test_2.sys=1
    ;SCXRINF=1
    
    
    [DestinationDirs]
    DefaultDestDir=12;\system32\drivers
    
    
    [Scxr_Install.NTX86]
    CopyFiles=SCXRINF
    Addreg=SCXRREG
    
    [Scxr_Install.NTX86.Services]
    AddService="scxr_service",0x2,scxr_seriver_node
    
    
    [Scxr_Install.NTAMD64]
    CopyFiles=SCXRINF
    Addreg=SCXRREG
    
    [Scxr_Install.NTAMD64.Services]
    AddService="scxr_service",0x2,scxr_seriver_node
    
    [scxr_seriver_node]
    DisplayName="scxr_self_service"
    ErrorControl=1
    ;ServiceBinary=C:\Windows\System32\drivers\Wdm_test_1.sys
    ServiceBinary=%12%\Wdm_test_2.sys
    StartType=3
    ServiceType=1
    
    
    [SCXRREG]
    ;HKLM,HARDWARE\ACPI\RSDT\ALASKA\A_M_I\01072009,"scxr3",0,"i am scxr"
    ;HKLM,HARDWARE\ACPI\RSDT\ALASKA\A_M_I\01072009,"scxr4",0x10001,1314
    
    [SCXRINF]
    Wdm_test_2.sys
    
    
    [Strings]
    DevClassName=ScxrHardwareClass

    Monday, July 29, 2019 7:05 AM
  • I have one more question,when I found I can't got complete device resource,i try to add directive of LogConfig in my .inf file to assign resource,then I only can get the resource information which assigned in .inf file.so,if the resource of device driver got need driver writer assigned in .inf file,how to know the resource of device used.
    Monday, July 29, 2019 7:28 AM
  • You can't use LogConfig for a PCI device, the system will assign the resources.  Use !pci in Windbg to verify your device is looking right.   Make sure your INF shows no warnings or errors with InfVerif.   If both of those look clean, post a dump of the resources you get in START_DEVICE here.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Monday, July 29, 2019 10:39 AM
  • Thank u very much,let me try to do it.
    Monday, July 29, 2019 10:48 AM
  • I verified the pcie card and INF file,except having no digital signature,not other error,the device is also right.the first screenshot is print by my driver,i think that the only one resource type is right,port type. the second screenshot is the device pci configuration space header which i make a IRP_MN_READ_CONFIG type IRP to read. Obviously, I not get the memory address of two bar register in the resource structure by PDO returned. the last screenshot is the resource of my test device be show in the windows device manager, i don't know how the relation should be between the device manager showing and the driver get by PDO returned. it's really complex.

    Thursday, August 1, 2019 9:27 AM
  • Why does a modern device have I/O space at all?

    You need to make sure your unused BAR (BAR1) is read-only and always returns 0.

    What, exactly, was the type number that you have diagnosed as "UNKNOW"?


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Thursday, August 1, 2019 7:04 PM
  • Thank u. The type less than or equal to 7 was recognized a certain type in my driver, such as CmTesourceType Port, Memory,Interrupt, Dma, BusNumber, Null, DeviceSpecific. Other type number is diagnsed as "UNKNOW". And how should i do to make sure the BAR register? There is a 64bit memory address is consist of BAR1 and BAR2 that BAR1 is higher 32bit address and BAR2 is lower 32bit address, i think.
    Thursday, August 1, 2019 11:42 PM
  • sorry, the BAR1 is unused, you are right. The BAR3 is the high 32bit address,not BAR1.
    Friday, August 2, 2019 3:02 AM
  • Your debug log says "Raw Resource".  Are you looking at the raw resource list, or the translated resource list?  You SHOULD be looking at the translated resource list.

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Friday, August 2, 2019 11:55 PM
  • Yes, the debug log following by "Raw Resource" is information in raw resource list. The translated resource list is same as the raw resource list, also not memory or dma type. And yesterday I found, if the device BAR0 register is a IO port type, I will get the IO port type information in resource list, if BAR0 is memory type, i wil get memory type information in resource, but just have BAR0, not see other BAR register. I don't know why. Could it be related to INF file?
    Saturday, August 3, 2019 12:34 AM
  • here is translated resource list

    • Marked as answer by Altman_Scxr Wednesday, August 7, 2019 12:52 AM
    • Unmarked as answer by Altman_Scxr Wednesday, August 7, 2019 12:52 AM
    Saturday, August 3, 2019 1:25 AM
  • As an experiment, can you add an additional small BAR in BAR1, or move BARs 2 through 5 up one position?  According to the PCI spec, it is valid to have an empty BAR in the middle of the list, but it seems suspicious that's where the parsing stops.

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    • Marked as answer by Altman_Scxr Monday, August 12, 2019 12:07 AM
    • Unmarked as answer by Altman_Scxr Monday, August 12, 2019 12:07 AM
    Monday, August 5, 2019 5:55 AM
  • I try to write 0xffffffff to BAR1 by WRITE_CONFIG IRP, but the result is that BAR1 still is zero all bit, so I think BAR1 is a read-only register and not used by device. I have a idea that if I read the PCI configuration space to get the memory or port resource in BAR register directly, and not get by "irpsp->Parameters.StartDevice.AllocatedResources->List[0].PartialResourceList.PartialDescriptors",Is normaly and right way?
    Wednesday, August 7, 2019 2:18 AM