* Moved disable_interrupt right before resetting the controller
* Reworked on NotifyPipeChange * Added _RemoveEndpointForPipe (not implemented) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22934 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -249,8 +249,10 @@ OHCI::OHCI(pci_info *info, Stack *stack)
|
|||||||
// We now own the host controller and the bus has been reset
|
// We now own the host controller and the bus has been reset
|
||||||
uint32 frameInterval = _ReadReg(OHCI_FRAME_INTERVAL);
|
uint32 frameInterval = _ReadReg(OHCI_FRAME_INTERVAL);
|
||||||
uint32 intervalValue = OHCI_GET_INTERVAL_VALUE(frameInterval);
|
uint32 intervalValue = OHCI_GET_INTERVAL_VALUE(frameInterval);
|
||||||
_WriteReg(OHCI_COMMAND_STATUS, OHCI_HOST_CONTROLLER_RESET);
|
|
||||||
|
|
||||||
|
// Disable interrupts right before we reset
|
||||||
|
cpu_status former = disable_interrupts();
|
||||||
|
_WriteReg(OHCI_COMMAND_STATUS, OHCI_HOST_CONTROLLER_RESET);
|
||||||
for (uint32 i = 0; i < 10; i++) {
|
for (uint32 i = 0; i < 10; i++) {
|
||||||
snooze(10);
|
snooze(10);
|
||||||
if (!(_ReadReg(OHCI_COMMAND_STATUS) & OHCI_HOST_CONTROLLER_RESET))
|
if (!(_ReadReg(OHCI_COMMAND_STATUS) & OHCI_HOST_CONTROLLER_RESET))
|
||||||
@@ -259,13 +261,12 @@ OHCI::OHCI(pci_info *info, Stack *stack)
|
|||||||
|
|
||||||
if (_ReadReg(OHCI_COMMAND_STATUS) & OHCI_HOST_CONTROLLER_RESET) {
|
if (_ReadReg(OHCI_COMMAND_STATUS) & OHCI_HOST_CONTROLLER_RESET) {
|
||||||
TRACE_ERROR(("usb_ohci: Error resetting the host controller (timeout)\n"));
|
TRACE_ERROR(("usb_ohci: Error resetting the host controller (timeout)\n"));
|
||||||
|
restore_interrupts(former);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The controller is now in SUSPEND state, we have 2ms to go OPERATIONAL.
|
// The controller is now in SUSPEND state, we have 2ms to go OPERATIONAL.
|
||||||
// In order to do so we need to disable interrupts.
|
// Interrupts are disabled.
|
||||||
|
|
||||||
cpu_status former = disable_interrupts();
|
|
||||||
|
|
||||||
// Set up host controller register
|
// Set up host controller register
|
||||||
_WriteReg(OHCI_HCCA, (uint32)hccaPhysicalAddress);
|
_WriteReg(OHCI_HCCA, (uint32)hccaPhysicalAddress);
|
||||||
@@ -437,7 +438,7 @@ OHCI::SubmitTransfer(Transfer *transfer)
|
|||||||
return _SubmitPeriodicTransfer(transfer);
|
return _SubmitPeriodicTransfer(transfer);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE_ERROR(("usb_ohci: tried to submit transfer for unknow pipe"
|
TRACE_ERROR(("usb_ohci: tried to submit transfer for unknown pipe"
|
||||||
" type %lu\n", type));
|
" type %lu\n", type));
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -460,21 +461,26 @@ OHCI::_SubmitPeriodicTransfer(Transfer *transfer)
|
|||||||
status_t
|
status_t
|
||||||
OHCI::NotifyPipeChange(Pipe *pipe, usb_change change)
|
OHCI::NotifyPipeChange(Pipe *pipe, usb_change change)
|
||||||
{
|
{
|
||||||
TRACE(("usb_ohci::%s(%p, %d)\n", __FUNCTION__, pipe, (int)change));
|
TRACE(("usb_ohci: pipe change %d for pipe 0x%08lx\n", change, (uint32)pipe));
|
||||||
if (InitCheck())
|
|
||||||
return B_ERROR;
|
|
||||||
|
|
||||||
switch (change) {
|
switch (change) {
|
||||||
case USB_CHANGE_CREATED:
|
case USB_CHANGE_CREATED: {
|
||||||
return _InsertEndpointForPipe(pipe);
|
TRACE(("usb_ohci: inserting endpoint\n"));
|
||||||
case USB_CHANGE_DESTROYED:
|
return _InsertEndpointForPipe(pipe);
|
||||||
// Do something
|
}
|
||||||
return B_ERROR;
|
case USB_CHANGE_DESTROYED: {
|
||||||
case USB_CHANGE_PIPE_POLICY_CHANGED:
|
TRACE(("usb_ohci: removing endpoint\n"));
|
||||||
default:
|
return _RemoveEndpointForPipe(pipe);
|
||||||
break;
|
}
|
||||||
|
case USB_CHANGE_PIPE_POLICY_CHANGED: {
|
||||||
|
TRACE(("usb_ohci: pipe policy changing unhandled!\n"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
TRACE_ERROR(("usb_ohci: unknown pipe change!\n"));
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return B_ERROR; //We should never go here
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -706,7 +712,7 @@ OHCI::_FreeGeneralDescriptor(ohci_general_descriptor *descriptor)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
OHCI::_InsertEndpointForPipe(Pipe *p)
|
OHCI::_InsertEndpointForPipe(Pipe *pipe)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
TRACE(("OHCI: Inserting Endpoint for device %u function %u\n", p->DeviceAddress(), p->EndpointAddress()));
|
TRACE(("OHCI: Inserting Endpoint for device %u function %u\n", p->DeviceAddress(), p->EndpointAddress()));
|
||||||
@@ -800,6 +806,13 @@ OHCI::_InsertEndpointForPipe(Pipe *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
OHCI::_RemoveEndpointForPipe(Pipe *pipe)
|
||||||
|
{
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
OHCI::_WriteReg(uint32 reg, uint32 value)
|
OHCI::_WriteReg(uint32 reg, uint32 value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -87,12 +87,13 @@ static int32 _FinishThread(void *data);
|
|||||||
status_t _SubmitPeriodicTransfer(Transfer *transfer);
|
status_t _SubmitPeriodicTransfer(Transfer *transfer);
|
||||||
|
|
||||||
// Endpoint related methods
|
// Endpoint related methods
|
||||||
|
status_t _InsertEndpointForPipe(Pipe *pipe);
|
||||||
|
status_t _RemoveEndpointForPipe(Pipe *pipe);
|
||||||
status_t _CreateEndpoint(Pipe *pipe,
|
status_t _CreateEndpoint(Pipe *pipe,
|
||||||
bool isIsochronous);
|
bool isIsochronous);
|
||||||
ohci_endpoint_descriptor *_AllocateEndpoint();
|
ohci_endpoint_descriptor *_AllocateEndpoint();
|
||||||
void _FreeEndpoint(
|
void _FreeEndpoint(
|
||||||
ohci_endpoint_descriptor *endpoint);
|
ohci_endpoint_descriptor *endpoint);
|
||||||
status_t _InsertEndpointForPipe(Pipe *pipe);
|
|
||||||
|
|
||||||
// Transfer descriptor related methods
|
// Transfer descriptor related methods
|
||||||
ohci_general_descriptor *_CreateGeneralDescriptor();
|
ohci_general_descriptor *_CreateGeneralDescriptor();
|
||||||
|
|||||||
Reference in New Issue
Block a user