XHCI: The root hub address is always 1.

AllocateAddress() is the pre-USB3 way of doing things;
as we never use it anywhere else and it is specific to
each BusManager, we always just got 1, which is what
the root hub will always be anyway.

Additionally, clarify the logic in _InsertEndpointForPipe
that is special-casing the root hub.

No functional change intended.
This commit is contained in:
Augustin Cavalier
2021-09-15 18:58:46 -04:00
parent 05709fe3f7
commit f20f55692d
2 changed files with 7 additions and 7 deletions
+7 -6
View File
@@ -201,7 +201,6 @@ XHCI::XHCI(pci_info *info, Stack *stack)
fCmdCompSem(-1),
fStopThreads(false),
fRootHub(NULL),
fRootHubAddress(0),
fPortCount(0),
fSlotCount(0),
fScratchpadCount(0),
@@ -664,8 +663,7 @@ XHCI::Start()
TRACE_ERROR("HCH start up timeout\n");
}
fRootHubAddress = AllocateAddress();
fRootHub = new(std::nothrow) XHCIRootHub(RootObject(), fRootHubAddress);
fRootHub = new(std::nothrow) XHCIRootHub(RootObject(), 1);
if (!fRootHub) {
TRACE_ERROR("no memory to allocate root hub\n");
return B_NO_MEMORY;
@@ -693,7 +691,7 @@ status_t
XHCI::SubmitTransfer(Transfer *transfer)
{
// short circuit the root hub
if (transfer->TransferPipe()->DeviceAddress() == fRootHubAddress)
if (transfer->TransferPipe()->DeviceAddress() == 1)
return fRootHub->ProcessTransfer(this, transfer);
TRACE("SubmitTransfer(%p)\n", transfer);
@@ -1705,10 +1703,13 @@ XHCI::_InsertEndpointForPipe(Pipe *pipe)
}
Device* usbDevice = (Device *)pipe->Parent();
if (usbDevice->Parent() == RootObject()) {
// root hub needs no initialization
return B_OK;
}
struct xhci_device *device = (struct xhci_device *)
usbDevice->ControllerCookie();
if (usbDevice->Parent() == RootObject())
return B_OK;
if (device == NULL) {
panic("device is NULL\n");
return B_NO_INIT;
-1
View File
@@ -252,7 +252,6 @@ private:
// Root Hub
XHCIRootHub * fRootHub;
uint8 fRootHubAddress;
// Port management
uint8 fPortCount;