XHCI USB: some fixes.
* AllocateDevice(): don't include the root port in the route. * SubmitNormalRequest(): fail if we couldn't allocate the a descriptor.
This commit is contained in:
@@ -597,6 +597,8 @@ XHCI::SubmitNormalRequest(Transfer *transfer)
|
|||||||
bool directionIn = (pipe->Direction() == Pipe::In);
|
bool directionIn = (pipe->Direction() == Pipe::In);
|
||||||
|
|
||||||
xhci_td *descriptor = CreateDescriptorChain(transfer->DataLength());
|
xhci_td *descriptor = CreateDescriptorChain(transfer->DataLength());
|
||||||
|
if (descriptor == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
descriptor->trb_count = descriptor->buffer_count;
|
descriptor->trb_count = descriptor->buffer_count;
|
||||||
|
|
||||||
// set NormalStage
|
// set NormalStage
|
||||||
@@ -1004,12 +1006,16 @@ XHCI::AllocateDevice(Hub *parent, int8 hubAddress, uint8 hubPort,
|
|||||||
uint8 rhPort = 0;
|
uint8 rhPort = 0;
|
||||||
for (Device *hubDevice = parent; hubDevice != RootObject();
|
for (Device *hubDevice = parent; hubDevice != RootObject();
|
||||||
hubDevice = (Device *)hubDevice->Parent()) {
|
hubDevice = (Device *)hubDevice->Parent()) {
|
||||||
|
|
||||||
|
rhPort = routePort;
|
||||||
|
if (hubDevice->Parent() == RootObject())
|
||||||
|
break;
|
||||||
route *= 16;
|
route *= 16;
|
||||||
if (hubPort > 15)
|
if (hubPort > 15)
|
||||||
route += 15;
|
route += 15;
|
||||||
else
|
else
|
||||||
route += routePort;
|
route += routePort;
|
||||||
rhPort = routePort;
|
|
||||||
routePort = hubDevice->HubPort();
|
routePort = hubDevice->HubPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user