From 3d5bdb86881b8cf275576b1c11fcc92c0cfeae8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Thu, 24 May 2007 21:45:11 +0000 Subject: [PATCH] Added a keep_port_ownership driver setting for EHCI, to allow keeping devices on EHCI instead of giving them up to the 1.0 controller. Hopefully this will get things working here until OHCI is implemented. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21231 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/busses/usb/ehci.cpp | 12 ++++++++++-- src/add-ons/kernel/busses/usb/ehci.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/busses/usb/ehci.cpp b/src/add-ons/kernel/busses/usb/ehci.cpp index 875d3e4134..42a8a3a33a 100644 --- a/src/add-ons/kernel/busses/usb/ehci.cpp +++ b/src/add-ons/kernel/busses/usb/ehci.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include "ehci.h" @@ -110,6 +111,7 @@ EHCI::EHCI(pci_info *info, Stack *stack) fFreeListHead(NULL), fRootHub(NULL), fRootHubAddress(0), + fKeepPortOwnership(false), fPortCount(0), fPortResetChange(0), fPortSuspendChange(0) @@ -122,6 +124,12 @@ EHCI::EHCI(pci_info *info, Stack *stack) TRACE(("usb_ehci: constructing new EHCI Host Controller Driver\n")); fInitOK = false; + void *handle = load_driver_settings("ehci"); + if (handle) { + fKeepPortOwnership = get_driver_boolean_parameter(handle, "keep_port_ownership", false, true); + unload_driver_settings(handle); + } + // enable busmaster and memory mapped access uint16 command = sPCIModule->read_pci_config(fPCIInfo->bus, fPCIInfo->device, fPCIInfo->function, PCI_command, 2); @@ -677,7 +685,7 @@ EHCI::ResetPort(uint8 index) uint32 portRegister = EHCI_PORTSC + index * sizeof(uint32); uint32 portStatus = ReadOpReg(portRegister) & EHCI_PORTSC_DATAMASK; - if (portStatus & EHCI_PORTSC_DMINUS) { + if (!fKeepPortOwnership && (portStatus & EHCI_PORTSC_DMINUS)) { TRACE(("usb_ehci: lowspeed device connected, giving up port ownership\n")); // there is a lowspeed device connected. // we give the ownership to a companion controller. @@ -701,7 +709,7 @@ EHCI::ResetPort(uint8 index) return B_ERROR; } - if ((portStatus & EHCI_PORTSC_ENABLE) == 0) { + if (!fKeepPortOwnership && (portStatus & EHCI_PORTSC_ENABLE) == 0) { TRACE(("usb_ehci: fullspeed device connected, giving up port ownership\n")); // the port was not enabled, this means that no high speed device is // attached to this port. we give up ownership to a companion controler diff --git a/src/add-ons/kernel/busses/usb/ehci.h b/src/add-ons/kernel/busses/usb/ehci.h index b4a789c788..c90a4284bf 100644 --- a/src/add-ons/kernel/busses/usb/ehci.h +++ b/src/add-ons/kernel/busses/usb/ehci.h @@ -156,6 +156,7 @@ static pci_module_info *sPCIModule; uint8 fRootHubAddress; // Port management + bool fKeepPortOwnership; uint8 fPortCount; uint16 fPortResetChange; uint16 fPortSuspendChange;