Why UserInitializeTargetForID() not be invoked after UserCreateTargetForID() successfully?

Hello Everyone,

I am trying to create a Fake SCSI target based on SCSIControllerDriverKit.framework and inherent from IOUserSCSIParallelInterfaceController, here is the code

kern_return_t IMPL(DRV_MAIN_CLASS_NAME, Start)
{
...
    // Programmatically create a null SCSI Target
    SCSIDeviceIdentifier nullTargetID = 0; // Example target ID, adjust as needed
    ret = UserCreateTargetForID(nullTargetID, nullptr);
    if (ret != kIOReturnSuccess) {
        Log("Failed to create Null SCSI Target for ID %llu", nullTargetID);
        return ret;
    }
...
}

According the document UserCreateTargetForID, after creating a TargetID successfully, the framework will call the UserInitializeTargetForID()

The document said:

As part of the UserCreateTargetForID call, the kernel calls several APIs like UserInitializeTargetForID which run on the default dispatch queue of the dext.

But after UserCreateTargetForID created, why the UserInitializeTargetForID() not be invoked automatically? Here is the part of log show

init() - Start
init() - End
Start() - Start
Start() - try 1 times
UserCreateTargetForID() - Start
   Allocating resources for Target ID 0
UserCreateTargetForID() - End
Start() - Finished.
UserInitializeController() - Start
 - PCI vendorID: 0x14d6, deviceID: 0x626f.
 - BAR0: 0x1, BAR1: 0x200004.
 - GetBARInfo() - BAR1 - MemoryIndex: 0, Size: 262144, Type: 0.
UserInitializeController() - End
UserStartController() - Start
 - msiInterruptIndex : 0x00000000
 - interruptType info is 0x00010000
 - PCI Dext interrupt final value, return status info is 0x00000000
UserStartController() - End

Any assistance would be greatly appreciated! Thank you in advance for your support.

Best regards, Charles

Why UserInitializeTargetForID() not be invoked after UserCreateTargetForID() successfully?
 
 
Q