public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 0/5] fixes for 2.6.13-rc5
@ 2005-08-05  1:05 ` Greg KH
  2005-08-05  1:06   ` [patch 1/5] PCI: restore BAR values after D3hot->D0 for devices that need it Greg KH
                     ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Greg KH @ 2005-08-05  1:05 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel

Here are a series of patches against 2.6.13-rc5 that fix a few
different bugs in the USB and PCI subsystems.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 1/5] PCI: restore BAR values after D3hot->D0 for devices that need it
  2005-08-05  1:05 ` [patch 0/5] fixes for 2.6.13-rc5 Greg KH
@ 2005-08-05  1:06   ` Greg KH
  2005-08-05  1:06   ` [patch 2/5] pci and yenta: pcibios_bus_to_resource Greg KH
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2005-08-05  1:06 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel, linville

[-- Attachment #1: pci-restore-bar-values.patch --]
[-- Type: text/plain, Size: 6523 bytes --]

From: "John W. Linville" <linville@tuxdriver.com>

Some PCI devices (e.g. 3c905B, 3c556B) lose all configuration
(including BARs) when transitioning from D3hot->D0.  This leaves such
a device in an inaccessible state.  The patch below causes the BARs
to be restored when enabling such a device, so that its driver will
be able to access it.

The patch also adds pci_restore_bars as a new global symbol, and adds a
correpsonding EXPORT_SYMBOL_GPL for that.

Some firmware (e.g. Thinkpad T21) leaves devices in D3hot after a
(re)boot.  Most drivers call pci_enable_device very early, so devices
left in D3hot that lose configuration during the D3hot->D0 transition
will be inaccessible to their drivers.

Drivers could be modified to account for this, but it would
be difficult to know which drivers need modification.  This is
especially true since often many devices are covered by the same
driver.  It likely would be necessary to replicate code across dozens
of drivers.

The patch below should trigger only when transitioning from D3hot->D0
(or at boot), and only for devices that have the "no soft reset" bit
cleared in the PM control register.  I believe it is safe to include
this patch as part of the PCI infrastructure.

The cleanest implementation of pci_restore_bars was to call
pci_update_resource.  Unfortunately, that does not currently exist
for the sparc64 architecture.  The patch below includes a null
implemenation of pci_update_resource for sparc64.

Some have expressed interest in making general use of the the
pci_restore_bars function, so that has been exported to GPL licensed
modules.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/sparc64/kernel/pci.c |    6 ++++
 drivers/pci/pci.c         |   59 ++++++++++++++++++++++++++++++++++++++++++----
 drivers/pci/setup-res.c   |    2 -
 include/linux/pci.h       |    3 ++
 4 files changed, 65 insertions(+), 5 deletions(-)

--- gregkh-2.6.orig/arch/sparc64/kernel/pci.c	2005-08-04 17:37:26.000000000 -0700
+++ gregkh-2.6/arch/sparc64/kernel/pci.c	2005-08-04 17:46:13.000000000 -0700
@@ -413,6 +413,12 @@
 	return -EBUSY;
 }
 
+void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
+{
+	/* Not implemented for sparc64... */
+	BUG();
+}
+
 int pci_assign_resource(struct pci_dev *pdev, int resource)
 {
 	struct pcidev_cookie *pcp = pdev->sysdata;
--- gregkh-2.6.orig/drivers/pci/pci.c	2005-08-04 17:37:26.000000000 -0700
+++ gregkh-2.6/drivers/pci/pci.c	2005-08-04 17:46:13.000000000 -0700
@@ -222,6 +222,37 @@
 }
 
 /**
+ * pci_restore_bars - restore a devices BAR values (e.g. after wake-up)
+ * @dev: PCI device to have its BARs restored
+ *
+ * Restore the BAR values for a given device, so as to make it
+ * accessible by its driver.
+ */
+void
+pci_restore_bars(struct pci_dev *dev)
+{
+	int i, numres;
+
+	switch (dev->hdr_type) {
+	case PCI_HEADER_TYPE_NORMAL:
+		numres = 6;
+		break;
+	case PCI_HEADER_TYPE_BRIDGE:
+		numres = 2;
+		break;
+	case PCI_HEADER_TYPE_CARDBUS:
+		numres = 1;
+		break;
+	default:
+		/* Should never get here, but just in case... */
+		return;
+	}
+
+	for (i = 0; i < numres; i ++)
+		pci_update_resource(dev, &dev->resource[i], i);
+}
+
+/**
  * pci_set_power_state - Set the power state of a PCI device
  * @dev: PCI device to be suspended
  * @state: PCI power state (D0, D1, D2, D3hot, D3cold) we're entering
@@ -239,7 +270,7 @@
 int
 pci_set_power_state(struct pci_dev *dev, pci_power_t state)
 {
-	int pm;
+	int pm, need_restore = 0;
 	u16 pmcsr, pmc;
 
 	/* bound the state we're entering */
@@ -278,14 +309,17 @@
 			return -EIO;
 	}
 
+	pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
+
 	/* If we're in D3, force entire word to 0.
 	 * This doesn't affect PME_Status, disables PME_En, and
 	 * sets PowerState to 0.
 	 */
-	if (dev->current_state >= PCI_D3hot)
+	if (dev->current_state >= PCI_D3hot) {
+		if (!(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET))
+			need_restore = 1;
 		pmcsr = 0;
-	else {
-		pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
+	} else {
 		pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
 		pmcsr |= state;
 	}
@@ -308,6 +342,22 @@
 		platform_pci_set_power_state(dev, state);
 
 	dev->current_state = state;
+
+	/* According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT
+	 * INTERFACE SPECIFICATION, REV. 1.2", a device transitioning
+	 * from D3hot to D0 _may_ perform an internal reset, thereby
+	 * going to "D0 Uninitialized" rather than "D0 Initialized".
+	 * For example, at least some versions of the 3c905B and the
+	 * 3c556B exhibit this behaviour.
+	 *
+	 * At least some laptop BIOSen (e.g. the Thinkpad T21) leave
+	 * devices in a D3hot state at boot.  Consequently, we need to
+	 * restore at least the BARs so that the device will be
+	 * accessible to its driver.
+	 */
+	if (need_restore)
+		pci_restore_bars(dev);
+
 	return 0;
 }
 
@@ -805,6 +855,7 @@
 EXPORT_SYMBOL(isa_bridge);
 #endif
 
+EXPORT_SYMBOL_GPL(pci_restore_bars);
 EXPORT_SYMBOL(pci_enable_device_bars);
 EXPORT_SYMBOL(pci_enable_device);
 EXPORT_SYMBOL(pci_disable_device);
--- gregkh-2.6.orig/drivers/pci/setup-res.c	2005-08-04 17:37:26.000000000 -0700
+++ gregkh-2.6/drivers/pci/setup-res.c	2005-08-04 17:46:13.000000000 -0700
@@ -26,7 +26,7 @@
 #include "pci.h"
 
 
-static void
+void
 pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
 {
 	struct pci_bus_region region;
--- gregkh-2.6.orig/include/linux/pci.h	2005-08-04 17:37:27.000000000 -0700
+++ gregkh-2.6/include/linux/pci.h	2005-08-04 17:46:13.000000000 -0700
@@ -225,6 +225,7 @@
 #define  PCI_PM_CAP_PME_D3cold  0x8000  /* PME# from D3 (cold) */
 #define PCI_PM_CTRL		4	/* PM control and status register */
 #define  PCI_PM_CTRL_STATE_MASK	0x0003	/* Current power state (D0 to D3) */
+#define  PCI_PM_CTRL_NO_SOFT_RESET	0x0004	/* No reset for D3hot->D0 */
 #define  PCI_PM_CTRL_PME_ENABLE	0x0100	/* PME pin enable */
 #define  PCI_PM_CTRL_DATA_SEL_MASK	0x1e00	/* Data select (??) */
 #define  PCI_PM_CTRL_DATA_SCALE_MASK	0x6000	/* Data scale (??) */
@@ -816,7 +817,9 @@
 void pci_clear_mwi(struct pci_dev *dev);
 int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
 int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
+void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
 int pci_assign_resource(struct pci_dev *dev, int i);
+void pci_restore_bars(struct pci_dev *dev);
 
 /* ROM control related routines */
 void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size);

--

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 2/5] pci and yenta: pcibios_bus_to_resource
  2005-08-05  1:05 ` [patch 0/5] fixes for 2.6.13-rc5 Greg KH
  2005-08-05  1:06   ` [patch 1/5] PCI: restore BAR values after D3hot->D0 for devices that need it Greg KH
@ 2005-08-05  1:06   ` Greg KH
  2005-08-05  1:06   ` [patch 3/5] USB: ub documentation update Greg KH
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2005-08-05  1:06 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel, linux

[-- Attachment #1: pci-pcibios_bus_to_resource.patch --]
[-- Type: text/plain, Size: 8651 bytes --]

From: Dominik Brodowski <linux@dominikbrodowski.net>

In yenta_socket, we default to using the resource setting of the CardBus
bridge.  However, this is a PCI-bus-centric view of resources and thus needs
to be converted to generic resources first.  Therefore, add a call to
pcibios_bus_to_resource() call in between.  This function is a mere wrapper on
x86 and friends, however on some others it already exists, is added in this
patch (alpha, arm, ppc, ppc64) or still needs to be provided (parisc -- where
is its pcibios_resource_to_bus() ?).

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/alpha/kernel/pci.c       |   16 ++++++++++++++++
 arch/arm/kernel/bios32.c      |   17 +++++++++++++++++
 arch/ppc/kernel/pci.c         |   15 +++++++++++++++
 arch/ppc64/kernel/pci.c       |   20 ++++++++++++++++++++
 drivers/pcmcia/yenta_socket.c |   15 ++++++---------
 include/asm-alpha/pci.h       |    3 +++
 include/asm-arm/pci.h         |    4 ++++
 include/asm-generic/pci.h     |    8 ++++++++
 include/asm-parisc/pci.h      |    4 ++++
 include/asm-ppc/pci.h         |    4 ++++
 include/asm-ppc64/pci.h       |    4 ++++
 11 files changed, 101 insertions(+), 9 deletions(-)

--- gregkh-2.6.orig/arch/alpha/kernel/pci.c	2005-08-04 17:46:04.000000000 -0700
+++ gregkh-2.6/arch/alpha/kernel/pci.c	2005-08-04 17:46:16.000000000 -0700
@@ -350,8 +350,24 @@
 	region->end = res->end - offset;
 }
 
+void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+			     struct pci_bus_region *region)
+{
+	struct pci_controller *hose = (struct pci_controller *)dev->sysdata;
+	unsigned long offset = 0;
+
+	if (res->flags & IORESOURCE_IO)
+		offset = hose->io_space->start;
+	else if (res->flags & IORESOURCE_MEM)
+		offset = hose->mem_space->start;
+
+	res->start = region->start + offset;
+	res->end = region->end + offset;
+}
+
 #ifdef CONFIG_HOTPLUG
 EXPORT_SYMBOL(pcibios_resource_to_bus);
+EXPORT_SYMBOL(pcibios_bus_to_resource);
 #endif
 
 int
--- gregkh-2.6.orig/arch/arm/kernel/bios32.c	2005-08-04 17:46:04.000000000 -0700
+++ gregkh-2.6/arch/arm/kernel/bios32.c	2005-08-04 17:46:16.000000000 -0700
@@ -447,9 +447,26 @@
 	region->end   = res->end - offset;
 }
 
+void __devinit
+pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+			struct pci_bus_region *region)
+{
+	struct pci_sys_data *root = dev->sysdata;
+	unsigned long offset = 0;
+
+	if (res->flags & IORESOURCE_IO)
+		offset = root->io_offset;
+	if (res->flags & IORESOURCE_MEM)
+		offset = root->mem_offset;
+
+	res->start = region->start + offset;
+	res->end   = region->end + offset;
+}
+
 #ifdef CONFIG_HOTPLUG
 EXPORT_SYMBOL(pcibios_fixup_bus);
 EXPORT_SYMBOL(pcibios_resource_to_bus);
+EXPORT_SYMBOL(pcibios_bus_to_resource);
 #endif
 
 /*
--- gregkh-2.6.orig/arch/ppc64/kernel/pci.c	2005-08-04 17:46:04.000000000 -0700
+++ gregkh-2.6/arch/ppc64/kernel/pci.c	2005-08-04 17:46:16.000000000 -0700
@@ -108,8 +108,28 @@
 	region->end = res->end - offset;
 }
 
+void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+			      struct pci_bus_region *region)
+{
+	unsigned long offset = 0;
+	struct pci_controller *hose = pci_bus_to_host(dev->bus);
+
+	if (!hose)
+		return;
+
+	if (res->flags & IORESOURCE_IO)
+	        offset = (unsigned long)hose->io_base_virt - pci_io_base;
+
+	if (res->flags & IORESOURCE_MEM)
+		offset = hose->pci_mem_offset;
+
+	res->start = region->start + offset;
+	res->end = region->end + offset;
+}
+
 #ifdef CONFIG_HOTPLUG
 EXPORT_SYMBOL(pcibios_resource_to_bus);
+EXPORT_SYMBOL(pcibios_bus_to_resource);
 #endif
 
 /*
--- gregkh-2.6.orig/arch/ppc/kernel/pci.c	2005-08-04 17:46:04.000000000 -0700
+++ gregkh-2.6/arch/ppc/kernel/pci.c	2005-08-04 17:46:16.000000000 -0700
@@ -160,6 +160,21 @@
 }
 EXPORT_SYMBOL(pcibios_resource_to_bus);
 
+void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+			     struct pci_bus_region *region)
+{
+	unsigned long offset = 0;
+	struct pci_controller *hose = dev->sysdata;
+
+	if (hose && res->flags & IORESOURCE_IO)
+		offset = (unsigned long)hose->io_base_virt - isa_io_base;
+	else if (hose && res->flags & IORESOURCE_MEM)
+		offset = hose->pci_mem_offset;
+	res->start = region->start + offset;
+	res->end = region->end + offset;
+}
+EXPORT_SYMBOL(pcibios_bus_to_resource);
+
 /*
  * We need to avoid collisions with `mirrored' VGA ports
  * and other strange ISA hardware, so we always want the
--- gregkh-2.6.orig/drivers/pcmcia/yenta_socket.c	2005-08-04 17:46:04.000000000 -0700
+++ gregkh-2.6/drivers/pcmcia/yenta_socket.c	2005-08-04 17:46:16.000000000 -0700
@@ -605,9 +605,8 @@
 
 static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end)
 {
-	struct pci_bus *bus;
 	struct resource *root, *res;
-	u32 start, end;
+	struct pci_bus_region region;
 	unsigned mask;
 
 	res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr;
@@ -620,15 +619,13 @@
 	if (type & IORESOURCE_IO)
 		mask = ~3;
 
-	bus = socket->dev->subordinate;
-	res->name = bus->name;
+	res->name = socket->dev->subordinate->name;
 	res->flags = type;
 
-	start = config_readl(socket, addr_start) & mask;
-	end = config_readl(socket, addr_end) | ~mask;
-	if (start && end > start && !override_bios) {
-		res->start = start;
-		res->end = end;
+	region.start = config_readl(socket, addr_start) & mask;
+	region.end = config_readl(socket, addr_end) | ~mask;
+	if (region.start && region.end > region.start && !override_bios) {
+		pcibios_bus_to_resource(socket->dev, res, &region);
 		root = pci_find_parent_resource(socket->dev, res);
 		if (root && (request_resource(root, res) == 0))
 			return;
--- gregkh-2.6.orig/include/asm-alpha/pci.h	2005-08-04 17:46:04.000000000 -0700
+++ gregkh-2.6/include/asm-alpha/pci.h	2005-08-04 17:46:16.000000000 -0700
@@ -251,6 +251,9 @@
 extern void pcibios_resource_to_bus(struct pci_dev *, struct pci_bus_region *,
 				    struct resource *);
 
+extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+				    struct pci_bus_region *region);
+
 #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
 
 static inline int pci_proc_domain(struct pci_bus *bus)
--- gregkh-2.6.orig/include/asm-arm/pci.h	2005-08-04 17:46:04.000000000 -0700
+++ gregkh-2.6/include/asm-arm/pci.h	2005-08-04 17:46:16.000000000 -0700
@@ -60,6 +60,10 @@
 pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
 			 struct resource *res);
 
+extern void
+pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+			struct pci_bus_region *region);
+
 static inline void pcibios_add_platform_entries(struct pci_dev *dev)
 {
 }
--- gregkh-2.6.orig/include/asm-generic/pci.h	2005-08-04 17:46:04.000000000 -0700
+++ gregkh-2.6/include/asm-generic/pci.h	2005-08-04 17:46:16.000000000 -0700
@@ -22,6 +22,14 @@
 	region->end = res->end;
 }
 
+static inline void
+pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+			struct pci_bus_region *region)
+{
+	res->start = region->start;
+	res->end = region->end;
+}
+
 #define pcibios_scan_all_fns(a, b)	0
 
 #ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
--- gregkh-2.6.orig/include/asm-parisc/pci.h	2005-08-04 17:46:04.000000000 -0700
+++ gregkh-2.6/include/asm-parisc/pci.h	2005-08-04 17:46:16.000000000 -0700
@@ -253,6 +253,10 @@
 pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
 			 struct resource *res);
 
+extern void
+pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+			struct pci_bus_region *region);
+
 static inline void pcibios_add_platform_entries(struct pci_dev *dev)
 {
 }
--- gregkh-2.6.orig/include/asm-ppc64/pci.h	2005-08-04 17:46:04.000000000 -0700
+++ gregkh-2.6/include/asm-ppc64/pci.h	2005-08-04 17:46:16.000000000 -0700
@@ -134,6 +134,10 @@
 pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
 			struct resource *res);
 
+extern void
+pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+			struct pci_bus_region *region);
+
 extern int
 unmap_bus_range(struct pci_bus *bus);
 
--- gregkh-2.6.orig/include/asm-ppc/pci.h	2005-08-04 17:46:04.000000000 -0700
+++ gregkh-2.6/include/asm-ppc/pci.h	2005-08-04 17:46:16.000000000 -0700
@@ -105,6 +105,10 @@
 pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
 			struct resource *res);
 
+extern void
+pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+			struct pci_bus_region *region);
+
 extern void pcibios_add_platform_entries(struct pci_dev *dev);
 
 struct file;

--

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 3/5] USB: ub documentation update
  2005-08-05  1:05 ` [patch 0/5] fixes for 2.6.13-rc5 Greg KH
  2005-08-05  1:06   ` [patch 1/5] PCI: restore BAR values after D3hot->D0 for devices that need it Greg KH
  2005-08-05  1:06   ` [patch 2/5] pci and yenta: pcibios_bus_to_resource Greg KH
@ 2005-08-05  1:06   ` Greg KH
  2005-08-05  1:06   ` [patch 4/5] USB: ehci: microframe handling fix Greg KH
  2005-08-05  1:06   ` [patch 5/5] USB: Fix setup packet initialization in isp116x-hcd Greg KH
  4 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2005-08-05  1:06 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel, zaitcev

[-- Attachment #1: usb-ub-documentation-update.patch --]
[-- Type: text/plain, Size: 2413 bytes --]

From: Pete Zaitcev <zaitcev@redhat.com>

The patch which went in was correct, but not quite what I had in mind.
Here is a patch to update that a little bit. Original patch is at:
 http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4749f32da939d4e4160541b2cadc22492bb507ec

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 Documentation/usb/usbmon.txt |    2 +-
 drivers/usb/mon/Kconfig      |    9 ++++-----
 drivers/usb/mon/Makefile     |    1 +
 3 files changed, 6 insertions(+), 6 deletions(-)

--- gregkh-2.6.orig/Documentation/usb/usbmon.txt	2005-08-04 17:37:11.000000000 -0700
+++ gregkh-2.6/Documentation/usb/usbmon.txt	2005-08-04 17:40:06.000000000 -0700
@@ -102,7 +102,7 @@
 - URB Status. This field makes no sense for submissions, but is present
   to help scripts with parsing. In error case, it contains the error code.
   In case of a setup packet, it contains a Setup Tag. If scripts read a number
-  in this field, the proceed to read Data Length. Otherwise, they read
+  in this field, they proceed to read Data Length. Otherwise, they read
   the setup packet before reading the Data Length.
 - Setup packet, if present, consists of 5 words: one of each for bmRequestType,
   bRequest, wValue, wIndex, wLength, as specified by the USB Specification 2.0.
--- gregkh-2.6.orig/drivers/usb/mon/Kconfig	2005-08-04 17:37:11.000000000 -0700
+++ gregkh-2.6/drivers/usb/mon/Kconfig	2005-08-04 17:40:06.000000000 -0700
@@ -9,9 +9,8 @@
 	help
 	  If you say Y here, a component which captures the USB traffic
 	  between peripheral-specific drivers and HC drivers will be built.
-	  The USB_MON is similar in spirit and may be compatible with Dave
-	  Harding's USBMon.
+	  For more information, see <file:Documentation/usb/usbmon.txt>.
 
-	  This is somewhat experimental at this time, but it should be safe,
-	  as long as you aren't using modular USB and try to remove this
-	  module.
+	  This is somewhat experimental at this time, but it should be safe.
+
+	  If unsure, say Y.
--- gregkh-2.6.orig/drivers/usb/mon/Makefile	2005-08-04 17:37:11.000000000 -0700
+++ gregkh-2.6/drivers/usb/mon/Makefile	2005-08-04 17:40:06.000000000 -0700
@@ -4,4 +4,5 @@
 
 usbmon-objs	:= mon_main.o mon_stat.o mon_text.o
 
+# This does not use CONFIG_USB_MON because we want this to use a tristate.
 obj-$(CONFIG_USB)	+= usbmon.o

--

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 4/5] USB: ehci: microframe handling fix
  2005-08-05  1:05 ` [patch 0/5] fixes for 2.6.13-rc5 Greg KH
                     ` (2 preceding siblings ...)
  2005-08-05  1:06   ` [patch 3/5] USB: ub documentation update Greg KH
@ 2005-08-05  1:06   ` Greg KH
  2005-08-05  1:06   ` [patch 5/5] USB: Fix setup packet initialization in isp116x-hcd Greg KH
  4 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2005-08-05  1:06 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel, david-b

[-- Attachment #1: usb-ehci-microframe-handlin-fix.patch --]
[-- Type: text/plain, Size: 4717 bytes --]

From: David Brownell <david-b@pacbell.net>

This patch has a one line oops fix, plus related cleanups.

 - The bugfix uses microframe scheduling data given to the hardware to
   test "is this a periodic QH", rather than testing for nonzero period.
   (Prevents an oops by providing the correct answer.)

 - The cleanup going along with the patch should make it clearer what's
   going on whenever those bitfields are accessed.

The bug came about when, around January, two new kinds of EHCI interrupt
scheduling operation were added, involving both the high speed (24 KBytes
per millisec) and low/full speed (1-64 bytes per millisec) microframe
scheduling.  A driver for the Edirol UA-1000 Audio Capture Unit ran into
the oops; it used one of the newly supported high speed modes.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/usb/host/ehci-dbg.c   |    2 +-
 drivers/usb/host/ehci-q.c     |    5 +++--
 drivers/usb/host/ehci-sched.c |   13 +++++++------
 drivers/usb/host/ehci.h       |    5 +++++
 4 files changed, 16 insertions(+), 9 deletions(-)

--- gregkh-2.6.orig/drivers/usb/host/ehci-dbg.c	2005-08-04 17:37:11.000000000 -0700
+++ gregkh-2.6/drivers/usb/host/ehci-dbg.c	2005-08-04 17:40:08.000000000 -0700
@@ -527,7 +527,7 @@
 						p.qh->period,
 						le32_to_cpup (&p.qh->hw_info2)
 							/* uframe masks */
-							& 0xffff,
+							& (QH_CMASK | QH_SMASK),
 						p.qh);
 				size -= temp;
 				next += temp;
--- gregkh-2.6.orig/drivers/usb/host/ehci.h	2005-08-04 17:37:11.000000000 -0700
+++ gregkh-2.6/drivers/usb/host/ehci.h	2005-08-04 17:40:08.000000000 -0700
@@ -385,6 +385,11 @@
 	__le32			hw_info1;        /* see EHCI 3.6.2 */
 #define	QH_HEAD		0x00008000
 	__le32			hw_info2;        /* see EHCI 3.6.2 */
+#define	QH_SMASK	0x000000ff
+#define	QH_CMASK	0x0000ff00
+#define	QH_HUBADDR	0x007f0000
+#define	QH_HUBPORT	0x3f800000
+#define	QH_MULT		0xc0000000
 	__le32			hw_current;	 /* qtd list - see EHCI 3.6.4 */
 	
 	/* qtd overlay (hardware parts of a struct ehci_qtd) */
--- gregkh-2.6.orig/drivers/usb/host/ehci-q.c	2005-08-04 17:37:11.000000000 -0700
+++ gregkh-2.6/drivers/usb/host/ehci-q.c	2005-08-04 17:40:08.000000000 -0700
@@ -222,7 +222,7 @@
 		struct ehci_qh	*qh = (struct ehci_qh *) urb->hcpriv;
 
 		/* S-mask in a QH means it's an interrupt urb */
-		if ((qh->hw_info2 & __constant_cpu_to_le32 (0x00ff)) != 0) {
+		if ((qh->hw_info2 & __constant_cpu_to_le32 (QH_SMASK)) != 0) {
 
 			/* ... update hc-wide periodic stats (for usbfs) */
 			ehci_to_hcd(ehci)->self.bandwidth_int_reqs--;
@@ -428,7 +428,8 @@
 			/* should be rare for periodic transfers,
 			 * except maybe high bandwidth ...
 			 */
-			if (qh->period) {
+			if ((__constant_cpu_to_le32 (QH_SMASK)
+					& qh->hw_info2) != 0) {
 				intr_deschedule (ehci, qh);
 				(void) qh_schedule (ehci, qh);
 			} else
--- gregkh-2.6.orig/drivers/usb/host/ehci-sched.c	2005-08-04 17:37:11.000000000 -0700
+++ gregkh-2.6/drivers/usb/host/ehci-sched.c	2005-08-04 17:40:08.000000000 -0700
@@ -301,7 +301,7 @@
 
 	dev_dbg (&qh->dev->dev,
 		"link qh%d-%04x/%p start %d [%d/%d us]\n",
-		period, le32_to_cpup (&qh->hw_info2) & 0xffff,
+		period, le32_to_cpup (&qh->hw_info2) & (QH_CMASK | QH_SMASK),
 		qh, qh->start, qh->usecs, qh->c_usecs);
 
 	/* high bandwidth, or otherwise every microframe */
@@ -385,7 +385,8 @@
 
 	dev_dbg (&qh->dev->dev,
 		"unlink qh%d-%04x/%p start %d [%d/%d us]\n",
-		qh->period, le32_to_cpup (&qh->hw_info2) & 0xffff,
+		qh->period,
+		le32_to_cpup (&qh->hw_info2) & (QH_CMASK | QH_SMASK),
 		qh, qh->start, qh->usecs, qh->c_usecs);
 
 	/* qh->qh_next still "live" to HC */
@@ -411,7 +412,7 @@
 	 * active high speed queues may need bigger delays...
 	 */
 	if (list_empty (&qh->qtd_list)
-			|| (__constant_cpu_to_le32 (0x0ff << 8)
+			|| (__constant_cpu_to_le32 (QH_CMASK)
 					& qh->hw_info2) != 0)
 		wait = 2;
 	else
@@ -533,7 +534,7 @@
 
 	/* reuse the previous schedule slots, if we can */
 	if (frame < qh->period) {
-		uframe = ffs (le32_to_cpup (&qh->hw_info2) & 0x00ff);
+		uframe = ffs (le32_to_cpup (&qh->hw_info2) & QH_SMASK);
 		status = check_intr_schedule (ehci, frame, --uframe,
 				qh, &c_mask);
 	} else {
@@ -569,10 +570,10 @@
 		qh->start = frame;
 
 		/* reset S-frame and (maybe) C-frame masks */
-		qh->hw_info2 &= __constant_cpu_to_le32 (~0xffff);
+		qh->hw_info2 &= __constant_cpu_to_le32(~(QH_CMASK | QH_SMASK));
 		qh->hw_info2 |= qh->period
 			? cpu_to_le32 (1 << uframe)
-			: __constant_cpu_to_le32 (0xff);
+			: __constant_cpu_to_le32 (QH_SMASK);
 		qh->hw_info2 |= c_mask;
 	} else
 		ehci_dbg (ehci, "reused qh %p schedule\n", qh);

--

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 5/5] USB: Fix setup packet initialization in isp116x-hcd
  2005-08-05  1:05 ` [patch 0/5] fixes for 2.6.13-rc5 Greg KH
                     ` (3 preceding siblings ...)
  2005-08-05  1:06   ` [patch 4/5] USB: ehci: microframe handling fix Greg KH
@ 2005-08-05  1:06   ` Greg KH
  4 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2005-08-05  1:06 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel, ok

[-- Attachment #1: usb-fix-setup-packet-init-in-isp116x-hcd.patch --]
[-- Type: text/plain, Size: 922 bytes --]

From: Olav Kongas <ok@artecdesign.ee>


When recently addressing remarks by Alexey Dobriyan about
the isp116x-hcd, I introduced a bug in the driver. Please
apply the attached patch to fix it.

Signed-off-by: Olav Kongas <ok@artecdesign.ee>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/usb/host/isp116x-hcd.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

--- gregkh-2.6.orig/drivers/usb/host/isp116x-hcd.c	2005-08-04 17:37:11.000000000 -0700
+++ gregkh-2.6/drivers/usb/host/isp116x-hcd.c	2005-08-04 17:40:10.000000000 -0700
@@ -229,9 +229,11 @@
 	struct isp116x_ep *ep;
 	struct urb *urb;
 	struct ptd *ptd;
-	u16 toggle = 0, dir = PTD_DIR_SETUP, len;
+	u16 len;
 
 	for (ep = isp116x->atl_active; ep; ep = ep->active) {
+		u16 toggle = 0, dir = PTD_DIR_SETUP;
+
 		BUG_ON(list_empty(&ep->hep->urb_list));
 		urb = container_of(ep->hep->urb_list.next,
 				   struct urb, urb_list);

--

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-08-05  1:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20050805010206.711658000@press.kroah.org>
2005-08-05  1:05 ` [patch 0/5] fixes for 2.6.13-rc5 Greg KH
2005-08-05  1:06   ` [patch 1/5] PCI: restore BAR values after D3hot->D0 for devices that need it Greg KH
2005-08-05  1:06   ` [patch 2/5] pci and yenta: pcibios_bus_to_resource Greg KH
2005-08-05  1:06   ` [patch 3/5] USB: ub documentation update Greg KH
2005-08-05  1:06   ` [patch 4/5] USB: ehci: microframe handling fix Greg KH
2005-08-05  1:06   ` [patch 5/5] USB: Fix setup packet initialization in isp116x-hcd Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox