Tue Dec 6 05:40:03 2011 UTC ()
don't take the sc_lock in uhci_device_request() since it is already
taken (as verified by the assert at the top of this function.)


(mrg)
diff -r1.240.6.3 -r1.240.6.4 src/sys/dev/usb/uhci.c

cvs diff -r1.240.6.3 -r1.240.6.4 src/sys/dev/usb/uhci.c (expand / switch to unified diff)

--- src/sys/dev/usb/uhci.c 2011/12/06 05:26:26 1.240.6.3
+++ src/sys/dev/usb/uhci.c 2011/12/06 05:40:02 1.240.6.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uhci.c,v 1.240.6.3 2011/12/06 05:26:26 mrg Exp $ */ 1/* $NetBSD: uhci.c,v 1.240.6.4 2011/12/06 05:40:02 mrg Exp $ */
2/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */ 2/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1998, 2004, 2011 The NetBSD Foundation, Inc. 5 * Copyright (c) 1998, 2004, 2011 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Lennart Augustsson (lennart@augustsson.net) at 9 * by Lennart Augustsson (lennart@augustsson.net) at
10 * Carlstedt Research & Technology, Jared D. McNeill (jmcneill@invisible.ca) 10 * Carlstedt Research & Technology, Jared D. McNeill (jmcneill@invisible.ca)
11 * and Matthew R. Green. 11 * and Matthew R. Green.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions 14 * modification, are permitted provided that the following conditions
@@ -33,27 +33,27 @@ @@ -33,27 +33,27 @@
33 */ 33 */
34 34
35/* 35/*
36 * USB Universal Host Controller driver. 36 * USB Universal Host Controller driver.
37 * Handles e.g. PIIX3 and PIIX4. 37 * Handles e.g. PIIX3 and PIIX4.
38 * 38 *
39 * UHCI spec: http://www.intel.com/technology/usb/spec.htm 39 * UHCI spec: http://www.intel.com/technology/usb/spec.htm
40 * USB spec: http://www.usb.org/developers/docs/ 40 * USB spec: http://www.usb.org/developers/docs/
41 * PIIXn spec: ftp://download.intel.com/design/intarch/datashts/29055002.pdf 41 * PIIXn spec: ftp://download.intel.com/design/intarch/datashts/29055002.pdf
42 * ftp://download.intel.com/design/intarch/datashts/29056201.pdf 42 * ftp://download.intel.com/design/intarch/datashts/29056201.pdf
43 */ 43 */
44 44
45#include <sys/cdefs.h> 45#include <sys/cdefs.h>
46__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.3 2011/12/06 05:26:26 mrg Exp $"); 46__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.4 2011/12/06 05:40:02 mrg Exp $");
47 47
48#include "opt_usb.h" 48#include "opt_usb.h"
49 49
50#include <sys/param.h> 50#include <sys/param.h>
51#include <sys/systm.h> 51#include <sys/systm.h>
52#include <sys/kernel.h> 52#include <sys/kernel.h>
53#include <sys/kmem.h> 53#include <sys/kmem.h>
54#include <sys/device.h> 54#include <sys/device.h>
55#include <sys/select.h> 55#include <sys/select.h>
56#include <sys/extent.h> 56#include <sys/extent.h>
57#include <sys/proc.h> 57#include <sys/proc.h>
58#include <sys/queue.h> 58#include <sys/queue.h>
59#include <sys/bus.h> 59#include <sys/bus.h>
@@ -2514,27 +2514,26 @@ uhci_device_request(usbd_xfer_handle xfe @@ -2514,27 +2514,26 @@ uhci_device_request(usbd_xfer_handle xfe
2514 ii->stdstart = setup; 2514 ii->stdstart = setup;
2515 ii->stdend = stat; 2515 ii->stdend = stat;
2516#ifdef DIAGNOSTIC 2516#ifdef DIAGNOSTIC
2517 if (!ii->isdone) { 2517 if (!ii->isdone) {
2518 printf("uhci_device_request: not done, ii=%p\n", ii); 2518 printf("uhci_device_request: not done, ii=%p\n", ii);
2519 } 2519 }
2520 ii->isdone = 0; 2520 ii->isdone = 0;
2521#endif 2521#endif
2522 2522
2523 sqh->elink = setup; 2523 sqh->elink = setup;
2524 sqh->qh.qh_elink = htole32(setup->physaddr | UHCI_PTR_TD); 2524 sqh->qh.qh_elink = htole32(setup->physaddr | UHCI_PTR_TD);
2525 /* uhci_add_?s_ctrl() will do usb_syncmem(sqh) */ 2525 /* uhci_add_?s_ctrl() will do usb_syncmem(sqh) */
2526 2526
2527 mutex_enter(&sc->sc_lock); 
2528 if (dev->speed == USB_SPEED_LOW) 2527 if (dev->speed == USB_SPEED_LOW)
2529 uhci_add_ls_ctrl(sc, sqh); 2528 uhci_add_ls_ctrl(sc, sqh);
2530 else 2529 else
2531 uhci_add_hs_ctrl(sc, sqh); 2530 uhci_add_hs_ctrl(sc, sqh);
2532 uhci_add_intr_info(sc, ii); 2531 uhci_add_intr_info(sc, ii);
2533#ifdef UHCI_DEBUG 2532#ifdef UHCI_DEBUG
2534 if (uhcidebug > 12) { 2533 if (uhcidebug > 12) {
2535 uhci_soft_td_t *std; 2534 uhci_soft_td_t *std;
2536 uhci_soft_qh_t *xqh; 2535 uhci_soft_qh_t *xqh;
2537 uhci_soft_qh_t *sxqh; 2536 uhci_soft_qh_t *sxqh;
2538 int maxqh = 0; 2537 int maxqh = 0;
2539 uhci_physaddr_t link; 2538 uhci_physaddr_t link;
2540 DPRINTF(("uhci_enter_ctl_q: follow from [0]\n")); 2539 DPRINTF(("uhci_enter_ctl_q: follow from [0]\n"));
@@ -2552,27 +2551,26 @@ uhci_device_request(usbd_xfer_handle xfe @@ -2552,27 +2551,26 @@ uhci_device_request(usbd_xfer_handle xfe
2552 xqh->hlink == xqh ? NULL : xqh->hlink)) { 2551 xqh->hlink == xqh ? NULL : xqh->hlink)) {
2553 uhci_dump_qh(xqh); 2552 uhci_dump_qh(xqh);
2554 } 2553 }
2555 DPRINTF(("Enqueued QH:\n")); 2554 DPRINTF(("Enqueued QH:\n"));
2556 uhci_dump_qh(sqh); 2555 uhci_dump_qh(sqh);
2557 uhci_dump_tds(sqh->elink); 2556 uhci_dump_tds(sqh->elink);
2558 } 2557 }
2559#endif 2558#endif
2560 if (xfer->timeout && !sc->sc_bus.use_polling) { 2559 if (xfer->timeout && !sc->sc_bus.use_polling) {
2561 callout_reset(&xfer->timeout_handle, mstohz(xfer->timeout), 2560 callout_reset(&xfer->timeout_handle, mstohz(xfer->timeout),
2562 uhci_timeout, ii); 2561 uhci_timeout, ii);
2563 } 2562 }
2564 xfer->status = USBD_IN_PROGRESS; 2563 xfer->status = USBD_IN_PROGRESS;
2565 mutex_exit(&sc->sc_lock); 
2566 2564
2567 return (USBD_NORMAL_COMPLETION); 2565 return (USBD_NORMAL_COMPLETION);
2568} 2566}
2569 2567
2570usbd_status 2568usbd_status
2571uhci_device_isoc_transfer(usbd_xfer_handle xfer) 2569uhci_device_isoc_transfer(usbd_xfer_handle xfer)
2572{ 2570{
2573 uhci_softc_t *sc = xfer->pipe->device->bus->hci_private; 2571 uhci_softc_t *sc = xfer->pipe->device->bus->hci_private;
2574 usbd_status err; 2572 usbd_status err;
2575 2573
2576 DPRINTFN(5,("uhci_device_isoc_transfer: xfer=%p\n", xfer)); 2574 DPRINTFN(5,("uhci_device_isoc_transfer: xfer=%p\n", xfer));
2577 2575
2578 /* Put it on our queue, */ 2576 /* Put it on our queue, */