Page 1 of 1

Possible IPCI error or is it my code?

Posted: Mon May 18, 2020 4:51 am
by Belxjander
Within the following code...

Code: Select all

/*
**
*/
uint8 OpenUnit(struct DEVICE_CLASS *Base, struct USBIOReqHCD *iovec, uint32 unitn, uint32 flags)
{
	uint8 rc=0L;
	struct DEVICE_UNIT_CLASS *Unit=NULL;

	if(Base)
	{
		Unit=Base->DevUnit[unitn];
		if(Unit==NULL)
			Unit=Base->IExec->AllocVecTags(DEVICE_UNIT_SIZE,AVT_Type,MEMF_SHARED,AVT_ClearWithValue,0L,TAG_DONE,TAG_DONE);
	}
	if(Unit)
	{
		Base->DevUnit[unitn]=(APTR)Unit;
		Base->IExec->InitSemaphore((APTR)Unit);

		Unit->InterruptService.is_Node.ln_Name=(APTR)InterruptName;
		Unit->InterruptService.is_Data=(APTR)Unit;
		Unit->InterruptService.is_Code=(APTR)&InterruptExec;

		if(Base->IPCI)
		{
			Unit->ICard=NULL;
			Unit->ICard=(APTR)Base->IPCI->FindDeviceTags(
				FDT_Index,		unitn,
				FDT_Class,		0x000C0300,
				FDT_ClassMask,	0x000F0F00,
				TAG_DONE,		TAG_DONE);
		}
		if(Unit->ICard)
		{
			KDEBUG("XHCI::OpenUnit() ** Card Found!!! **\n");
			Unit->ICard->Lock(PCI_LOCK_EXCLUSIVE);
			Unit->MMIOspace=NULL;
			Unit->MMIOspace=(APTR)Unit->ICard->GetResourceRange(0);
			if(Unit->MMIOspace)
				KDEBUG("XHCI::OpenUnit() ** ResourceRange(0) == [%lx,%lx,%lx,%lx] **\n",
					Unit->MMIOspace->BaseAddress,
					Unit->MMIOspace->Physical,
					Unit->MMIOspace->Size,
					Unit->MMIOspace->Flags);
		}
	}
	return(rc);
};
I get the output of ...

Code: Select all

XHCI::OpenUnit() ** Card Found!!! **
XHCI::OpenUnit() ** ResourceRange(0) == [a0020000,a0020000,1000,2] ** << [ Base Address, Hard Address, Size, Type ]
XHCI::OpenDevice(0,0)
XHCI::USBHCGetAttrsA(4e210890,5767eeb8)
XHCI::USBHCInitRootHubA(0)
XHCI::USBHCGetAttrsA(4e210890,5767ee44)
XHCI::GetAttrsA( USBA_SignalsRunning )
XHCI::USBHCInitRootHubA(N)
However this is a different resource range value to what is shown in Ranger for exactly the same card *before* and *after* the skeleton driver attempts to bind to the hardware

Ranger displays a ResourceRange(0) == [ HardAddress=0xA0100000,size=8192, type= Memory ]

Am I doing anything particularly wrong here?