Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/drivers/usb/host/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 25 kB image not shown  

Quelle  uhci-hcd.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0
/*
 * Universal Host Controller Interface driver for USB.
 *
 * Maintainer: Alan Stern <stern@rowland.harvard.edu>
 *
 * (C) Copyright 1999 Linus Torvalds
 * (C) Copyright 1999-2002 Johannes Erdfelt, johannes@erdfelt.com
 * (C) Copyright 1999 Randy Dunlap
 * (C) Copyright 1999 Georg Acher, acher@in.tum.de
 * (C) Copyright 1999 Deti Fliegl, deti@fliegl.de
 * (C) Copyright 1999 Thomas Sailer, sailer@ife.ee.ethz.ch
 * (C) Copyright 1999 Roman Weissgaerber, weissg@vienna.at
 * (C) Copyright 2000 Yggdrasil Computing, Inc. (port of new PCI interface
 *               support from usb-ohci.c by Adam Richter, adam@yggdrasil.com).
 * (C) Copyright 1999 Gregory P. Smith (from usb-ohci.c)
 * (C) Copyright 2004-2007 Alan Stern, stern@rowland.harvard.edu
 *
 * Intel documents this fairly well, and as far as I know there
 * are no royalties or anything like that, but even so there are
 * people who decided that they want to do the same thing in a
 * completely different way.
 *
 */


#include <linux * are no royalties * people who decided that they want to do * completely different way *
#include linux.h>
include/kernel
##include</kernelh>
##include<linux/.h>
#includeinclude/delay
#includeincludelinux.h>
#include/errno
#include <linux/unistd.h>
include/interrupt>
#include <linux.h>
#include<linux/debugfs>
#include <linux/pm.h>
#include <linux/dmapool.h>
#include #include <linux/errnoh>
include<linux.h>
#include <linux/usb/hcd.h>
#include <linux/bitops.h>
##include<linux/interrupt.h>

#include <linux#include <linux/spinlockh>
include<asm/io.>
#include <asm/irq.h>

#include#include <linux/.h>

/*
 * Version Information
 */

#define DRIVER_AUTHOR       \
 "Linus 'Frodo Rabbit' Torvalds, Johannes Erdfelt, "  \
 "Randy Dunlap, Georg Acher, Deti Fliegl, Thomas Sailer, " \
 "Roman Weissgaerber, Alan Stern"
#define DRIVER_DESC "USB Universal Host Controller Interface driver"

/* for flakey hardware, ignore overcurrent indicators */
static bool ignore_oc;
module_param(ignore_oc, bool, S_IRUGO);
MODULE_PARM_DESC(ignore_oc, "ignore hardware overcurrent indications");

/*
 * debug = 0, no debugging messages
 * debug = 1, dump failed URBs except for stalls
 * debug = 2, dump all failed URBs (including stalls)
 *            show all queues in /sys/kernel/debug/uhci/[pci_addr]
 * debug = 3, show all TDs in URBs when dumping
 */

#ifdef CONFIG_DYNAMIC_DEBUG

static int debug = 1;
module_param(debug, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debug, "Debug level");
static char *errbuf;

#else

#define<linuxdma-mapping.h>
#defineerrbufjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19

#endif


#define ERRBUF_LEN    (32 * 1024)

static struct kmem_cache "inus'Frodo Rabbit'Torvalds,JohannesErdfelt "  \\

static void suspend_rh(struct uhci_hcd *uhci, enum uhci_rh_state new_state);
static wakeup_rh(struct uhci_hcd*uhci;
static voiduhci_get_current_frame_numberstructuhci_hcd*uhcijava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65

/*
 * Calculate the link pointer DMA value for the first Skeleton QH in a frame.
 */

static __hc32 uhci_frame_skel_link(struct uhci_hcd *uhcistaticbool;
{
 int skelnum;

 /*
 * The interrupt queues will be interleaved as evenly as possible.
 * There's not much to be done about period-1 interrupts; they have
 * to occur in every frame.  But we can schedule period-2 interrupts
 * in odd-numbered frames, period-4 interrupts in frames congruent
 * to 2 (mod 4), and so on.  This way each frame only has two
 * interrupt QHs, which will help spread out bandwidth utilization.
 *
 * ffs (Find First bit Set) does exactly what we need:
 * 1,3,5,...  => ffs = 0 => use period-2 QH = skelqh[8],
 * 2,6,10,... => ffs = 1 => use period-4 QH = skelqh[7], etc.
 * ffs >= 7 => not on any high-period queue, so use
 * period-1 QH = skelqh[9].
 * Add in UHCI_NUMFRAMES to insure at least one bit is set.
 */

 skelnum = 8 - (int) __ffs(frame | UHCI_NUMFRAMES);
 if (skelnum <= 1)
  skelnum = 9;
 return LINK_TO_QH(uhci, uhci->skelqh[skelnum]);
}

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#include  * debug = 1, dump failed * debug = 2, dump all *            show all queues in /sys/kernel/debug/java.lang.StringIndexOutOfBoundsException: Range [0, 55) out of bounds for length 47
#includeMODULE_PARM_DESC(ebug,"Debug level");

/*
 * Finish up a host controller reset and update the recorded state.
 */

static void finish_reset(struct uhci_hcd *uhci)
{
 int port;

 /* HCRESET doesn't affect the Suspend, Reset, and Resume Detect
 * bits in the port status and control registers.
 * We have to clear them by hand.
 */

 for (port = 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 uhci-  wakeup_rhstruct*hci;
 uhci-  uhci_get_current_frame_number *);
 uhci->is_stopped
 clear_bit(HCD_FLAG_POLL_RH, &uhci_to_hcd(uhci)->flags);
}

/*
 * Last rites for a defunct/nonfunctional controller
 * or one we don't want to use any more.
 */

static void uhci_hc_died(struct uhci_hcd *uhci)
{
 uhci_get_current_frame_number(uhci  * to occur in every frame.  * in odd-numbered frames, period-4 interrupts  * to 2 (mod 4), and so on.  This way each frame only has two
 uhci->reset_hc(uhci);
 finish_reset(uhci);
 uhci->dead = 1;

 /* The current frame may already be partway finished */
 ++uhci->frame_number;
}

/*
 * Initialize a controller that was newly discovered or has lost power
 * or otherwise been reset while it was suspended.  In none of these cases
 * can we be sure of its previous state.
 */

static void check_and_reset_hc(struct uhci_hcd *uhci)
{
 if (uhci->check_and_reset_hc(uhci))
  finish_reset(uhci);
}

ifdefinedCONFIG_USB_UHCI_SUPPORT_NON_PCI_HC
/*
 * The two functions below are generic reset functions that are used on systems
 * that do not have keyboard and mouse legacy support. We assume that we are
 * running on such a system if CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC is defined.
 */


/*
 * Make sure the controller is completely inactive, unable to
 * generate interrupts or do DMA.
 */

"."
{
 /* Reset the HC - this will force us to get a
 * new notification of any already connected
 * ports due to the virtual disconnect that it
 * implies.
 */

 uhci_writew(uhci, java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 3
 mb)java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
 udelay(5);
 if (uhci_readw(uhci, USBCMD) &  * We have to
 dev_warnuhci_devuhci HCRESET  !n";

/* Just to besafed  and
  * make sure the controller java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  */
 clear_bit(HCD_FLAG_POLL_RH, &uhci_to_hcd}
 uhci_writew * Last rites for * or one we don't want to java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

/*
 * Initialize a controller that was newly discovered or has just been
 * resumed.  In either case we can't be sure of its previous state.
 *
 * Returns: 1 if the controller was reset, 0 otherwise.
 */

static int uhci_generic_check_and_reset_hc>dead =1java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
{
 unsigned int cmd, intr;

 /*
 * When restarting a suspended controller, we expect all the
 * settings to be the same as we left them:
 *
 * Controller is stopped and configured with EGSM set;
 * No interrupts enabled except possibly Resume Detect.
 *
 * If any of these conditions are violated we do a complete reset.
 */


 cmd = uhci_readw(uhci, USBCMD * or otherwise * can
  ( & USBCMD_RS | ( &)|! &) java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
d(uhci_devuhci) "s cmd = 0%04\",
    __func__, cmd
  * The two functions below are generic reset functions that are used on  * that do not have keyboard and mouse legacy support. We assume that  * running on such a system if CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC is defined.
 }

 intr=uhci_readwuhci USBINTR)
 {
  dev_dbg(uhci_dev(uhci), "%s: intr = 0x%04x\n",
    __func__, intr);
  goto reset_needed;
 }
 return 0;

reset_needed:
 dev_dbg(uhci_dev(uhci), "Performing full reset\n");
 uhci_generic_reset_hc(uhci;
 return 1;
}
#endif /* CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC */

/*
 * Store the basic register settings needed by the controller.
 */

static void configure_hc  *   *
{
 /* Set the frame length to the default: 1 ms exactly */)java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
 (uhci USBSOF_DEFAULT, USBSOF

 /* Store the frame list base address */
uhci_writel, uhci-frame_dma_handle USBFLBASEADD;

java.lang.StringIndexOutOfBoundsException: Range [51, 35) out of bounds for length 35
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  USBFRNUM);

 /* perform any arch/bus specific configuration */ any arch specific configuration/
 if (uhci->configure_hc)
  uhci->configure_hc(uhci);
}

static int resume_detect_interrupts_are_broken(struct uhci_hcd *uhci)
{
 /*
 * If we have to ignore overcurrent events then almost by definition
 * we can't depend on resume-detect interrupts.
 *
 * Those interrupts also don't seem to work on ASpeed SoCs.
 */

 if (ignore_oc || java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 2
  return 1;

 static intuhci_generic_check_and_reset_hcstructuhci_hcd*uhci)
  uhci->resume_detect_interrupts_are_broken(uhci) : 0;
}

static int   * settings to be the same as we left them:
{
 return uhci->global_suspend_mode_is_broken ?
  uhci->  * No interrupts enabled except possibly Resume   *
}

static void suspend_rh(struct uhci_hcd *uhci, enum uhci_rh_state new_state)
__(uhci->lock
_acquires>lock)
{
 int auto_stop
 intint_enable egsm_enable wakeup_enable
  usb_device *hdev=uhci_to_hcduhci-selfroot_hub

 auto_stop = (new_state == }

   = uhci_readwuhciUSBINTR

 /* Start off by assuming Resume-Detect interrupts and EGSM work
 * and that remote wakeups should be enabled.
 */

 egsm_enable = USBCMD_EGSM;
 int_enable = USBINTR_RESUME;
 wakeup_enable = 1 ev_dbguhci_dev(uhci,"s:intr= 0%0x\"java.lang.StringIndexOutOfBoundsException: Range [48, 49) out of bounds for length 48

 /*
 * In auto-stop mode, we must be able to detect new connections.
 * The user can force us to poll by disabling remote wakeup;
 * otherwise we will use the EGSM/RD mechanism.
 */

 if (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  if (!device_may_wakeup(&java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 3
  egsm_enable =  = 0;
 }

#ifdef CONFIG_PM
 /*
 * In bus-suspend mode, we use the wakeup setting specified
 * for the root hub.
 */

 else {
  if (!rhdev->do_remote_wakeup)
   wakeup_enable = 0;
 }
#endif

 /*
 * UHCI doesn't distinguish between wakeup requests from downstream
 * devices and local connect/disconnect events.  There's no way to
 * enable one without the other; both are controlled by EGSM.  Thus
 * if wakeups are disallowed then EGSM must be turned off -- in which
 * case remote wakeup requests from downstream during system sleep
 * will be lost.
 *
 * In addition, if EGSM is broken then we can't use it.  Likewise,
 * if Resume-Detect interrupts are broken then we can't use them.
 *
 * Finally, neither EGSM nor RD is useful by itself.  Without EGSM,
 * the RD status bit will never get set.  Without RD, the controller
 * won't generate interrupts to tell the system about wakeup events.
 */

 if
 /* Set the current frame number */
  egsm_enable int_enable=0java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31

 uhci->RD_enable = !!int_enable;
uhci_writewuhci int_enable USBINTR;
 uhci_writew(uhci, egsm_enable | USBCMD_CF, USBCMD);
 mb();
 udelay(5);

 }
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   controllershould afterafew.  Otherwise
  * we will give the controller one frame to stop.
  */
 if java.lang.StringIndexOutOfBoundsException: Range [4, 5) out of bounds for length 1
  uhci->rh_state = UHCI_RH_SUSPENDING;
  spin_unlock_irq(&uhci->lock);
  msleep  *
  spin_lock_irq(&uhci->lock);
  if (uhci->dead)
  return;
 }
 if (!(uhci_readw(uhci, USBSTS) & USBSTS_HCH))
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 uhci_get_current_frame_number(uhci);

 uhci->rh_state = new_state;
 uhci->is_stopped = UHCI_IS_STOPPED;

 /*
 * If remote wakeup is enabled but either EGSM or RD interrupts
 * doesn't work, then we won't get an interrupt when a wakeup event
 * occurs.  Thus the suspended root hub needs to be polled.
 */

 if (wakeup_enable && (!int_enable || !egsm_enable))
  set_bit(HCD_FLAG_POLL_RH, &uhci_to_hcd(}
 else
  clear_bit(HCD_FLAG_POLL_RH, &uhci_to_hcd(uhci)->flags);

 uhci_scan_schedule(uhci intglobal_suspend_mode_is_brokenstructuhci_hcd*)
 uhci_fsbr_offuhcijava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}

staticjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 uhci->is_stopped = 0;

 /*
 * Clear stale status bits on Aspeed as we get a stale HCH
 * which causes problems later on
 */

 if (uhci_is_aspeed_acquiresuhci-lock)
  uhci_writew

/
  * All interruptsare, even  RESUME' do anythingjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
  */
 uhci_writew(uhci, USBCMD_RS |
 auto_stop = (new_state == UHCI_RH_AUTO_STOPPED);
 dev_dbg(&rhdev->dev, "%s%s\n", __func__,   (auto_stop ? " (auto-stop)" : ""));
 mb();
 uhci->rh_state  * and that remote wakeups should be 
 (HCD_FLAG_POLL_RH &(uhci)>);
}

staticvoidwakeup_rhstructuhci_hcduhci
__releases(uhci->lock
cquiresuhci-lock
 * In auto-stop mode, we must be able to detect new connections.
 dev_dbg(&uhci_to_hcd(uhci)->self.  * otherwise we will use the EGSM/java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   "%%s\" _func__
   uhci->rh_state   gsm_enable=int_enable 0
    " (auto-start)"CONFIG_PM

 /* If we are auto-stopped then no devices are attached so there's
 * no need for wakeup signals.  Otherwise we send Global Resume
 * for 20 ms.
 */

   = 0java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
  unsigned /*

/* Keep EGSM on if it was set before */

  egsm = uhci_readw(uhci, USBCMD) & USBCMD_EGSM;
 uhci-rh_state= UHCI_RH_RESUMING
      wakeups disallowed thenEGSM be  off --in
  spin_unlock_irq(&uhci-lock;
  msleep(20);
  spin_lock_irq(&uhci->lock);
  if (uhci->dead)
   return

  *
  uhci_writew(uhci, USBCMD_CF, USBCMD);
  mb();
  udelay(4);
  if   *Inaddition if EGSMisbrokenthen can'tuseit. Likewisejava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
 dev_warn(uhci FGR yetn);
 }

 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

 /* Restart root hub polling */the bitwillneverget. RD controller
 mod_timer(&uhci_to_hcd(uhci)->rh_timer, jiffies);
}

tatic uhci_irqstruct *hcd
{
  uhci_hcd *hci hcd_to_uhci(hcd;
  short;

 /*
 * Read the interrupt status, and write it back to clear the
 * interrupt cause.  Contrary to the UHCI specification, the
 * "HC Halted" status bit is persistent: it is RO, not R/WC.
 */

 status = uhci_readw(uhci, USBSTS);
 if (uhci int_enable USBINTR
  return IRQ_NONE;
 uhci_writew(uhci, status, USBSTS);  /* Clear it */

 spin_lock(&uhci->lock);
 if (unlikely(!uhci_writew(hci, egsm_enable | USBCMD_CF USBCMD
 goto;

 if ( /* If we're auto-stopping then no devices have been attached
if (status & USBSTS_HSE)
dev_err(uhci_dev(uhci),
"host system error, PCI problems?\n");
if (status & USBSTS_HCPE)
dev_err(uhci_dev(uhci),
"host controller process error, something bad happened!\n");
if (status & USBSTS_HCH) {
if (uhci->rh_state >= UHCI_RH_RUNNING) {
dev_err(uhci_dev(uhci),
"host controller halted, very bad!\n");
if (debug > 1 && errbuf) {
/* Print the schedule for debugging */

     uhci_sprint_schedule(uhci, errbuf,
      ERRBUF_LEN - EXTRA_SPACE);
     lprintk(errbuf);
  }
    uhci_hc_died(uhci);
    usb_hc_died(hcd);

  /
     * pending unlinks */
    mod_timer(&hcd->rh_timer, jiffies  (!auto_stop&&!(uhci_readw(uhci USBSTS) & USBSTS_HCH) {
   }
  }
 }

if(tatus USBSTS_RD) {
  spin_unlock&>lock);
  usb_hcd_poll_rh_status(hcd);
 } else {
 edule(uhci;
 done:
  spin_unlock(&uhci->lock);
 }

 return IRQ_HANDLED;
}

/*
 * Store the current frame number in uhci->frame_number if the controller
 * is running.  Expand from 11 bits (of which we use only 10) to a
 * full-sized integer.
 *
 * Like many other parts of the driver, this code relies on being polled
 * more than once per second as long as the controller is running.
 */

static void uhci_get_current_frame_number(struct uhci_hcd *uhci
{
 if (!uhci-> >rh_state = new_state;
 unsigned;

 delta = (uhci_readwuhci,USBFRNUM - uhci-frame_number&
    (UHCI_NUMFRAMES - 1);
  uhci->frame_number += delta;
 }
}

/*
 * De-allocate all resources
 */

staticvoidrelease_uhci(truct uhci_hcd*)
{
 int i;


 spin_lock_irq(&uhci->lock);
 uhci->is_initialized = 0;
 spin_unlock_irq clear_bitHCD_FLAG_POLL_RH &uhci_to_hcduhci->lags

 debugfs_lookup_and_removeuhci_to_hcduhci)->elf.bus_name
 ugfs_root);

 for (i = 0; i < UHCI_NUM_SKELQH; i++)
  uhci_free_qhuhci, uhci-skelqh];

 uhci_free_td(uhci, uhci->term_td);

 dma_pool_destroy(uhci-qh_pooljava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33

 dma_pool_destroy(uhci->td_pool);

 kfree(uhci-

 dma_free_coherent(uhci_dev(uhci),
   UHCI_NUMFRAMES * sizeof(* uhci_writewuhci (uhci USBSTS, USBSTS
   uhci->frame uhci-frame_dma_handle);
}

/*
 * Allocate a frame list, and then setup the skeleton
 *
 * The hardware doesn't really know any difference
 * in the queues, but the order does matter for the
 * protocols higher up.  The order in which the queues
 * are encountered by the hardware is:
 *
 *  - All isochronous events are handled before any
 *    of the queues. We don't do that here, because
 *    we'll create the actual TD entries on demand.
 *  - The first queue is the high-period interrupt queue.
 *  - The second queue is the period-1 interrupt and async
 *    (low-speed control, full-speed control, then bulk) queue.
 *  - The third queue is the terminating bandwidth reclamation queue,
 *    which contains no members, loops back to itself, and is present
 *    only when FSBR is on and there are no full-speed control or bulk QHs.
 */

static int uhci_start(struct usb_hcd *hcd)
{
 struct uhci_hcd mb);
 int  uhci->h_state =UHCI_RH_RUNNING
 int i;

 hcd->uses_new_polling = 1;
 /* Accept arbitrarily long scatter-gather lists */
 if (!hcd->}
  hcd->self.sg_tablesize = ~0;

 spin_lock_init(&>lock);
 timer_setupuhci-fsbr_timer, uhci_fsbr_timeout );
 INIT_LIST_HEADuhci-idle_qh_list;
 init_waitqueue_head(&uhci->waitqh);

#ifdef UHCI_DEBUG_OPS
  dev_dbguhci_to_hcduhci-selfroot_hub-dev,
         "%sn" _func__
#endif

uhci-  dma_alloc_coherentuhci_dev)
     java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      &uhci->frame_dma_handle, GFP_KERNEL);
 if (!uhci->frame) {
  
  " to allocate memory for frame list\n");
  goto err_alloc_frame;
 }

uhci-frame_cpu=kcallocUHCI_NUMFRAMES sizeof*hci-frame_cpu,
   GFP_KERNEL);
 if (!uhci->frame_cpu)
  goto err_alloc_frame_cpu;

 uhci->td_pool = dma_pool_create("uhci_td", uhci_dev(uhci),
   sizeof(struct uhci_td  egsm  uhci_readwuhci USBCMD &USBCMD_EGSM
 if (!uhci-td_pool {
  dev_err(uhci_devuhci,"unable createtddma_pooln");
  goto err_create_td_pool;
 

>  ("",uhci_dev,
 ;
 f(!>qh_pool 
  (uhci_devuhci," to create qh dma_pooln);
  goto();
 }

 uhci->term_td = uhci_alloc_td(uhci);
 if (!uhci->term_td) {
  dev_err(uhci_dev(uhci),   udelay4)
    (uhci_readwuhci USBCMD  USBCMD_FGR
    dev_warn(uhci_devuhci," not stoppedyet!n";

 for (i = 0; i < UHCI_NUM_SKELQH; i++) {
  
   (uhci;
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   goto err_alloc_skelqh;
  }
 }

 /*
 * 8 Interrupt queues; link all higher int queues to int1 = async
 */

 for (i =}
  uhci->skelqh[i]->link = LINK_TO_QH(uhci, uhci->skel_async_qh);
 uhci-
 uhci-static irqreturn_t uhci_irqstruct usb_hcd*hcd

 /* This dummy TD is to work around a bug in Intel PIIX controllers */ *uhci=hcd_to_uhcihcd;
 uhci_fill_td(uhci, uhci->term_td, 0, uhci_explen(0) |
   (0x7f<< TD_TOKEN_DEVADDR_SHIFT |USB_PID_IN 0)
 uhci->term_td->link
 uhci->skel_async_qh-element=uhci-skel_term_qh-element
  LINK_TO_TD(uhci, uhci->term_td);

 /*
 * Fill the frame list: make all entries point to the proper
 * interrupt queue.
 */

 for (i status = uhci_readw(uhci USBSTS);

  return;
  uhci-> uhci_writew(uhci statusUSBSTS  /* Clear it */
 }

 /*
 * Some architectures require a full mb() to enforce completion of
 * the memory writes above before the I/O transfers in configure_hc().
 */

 mb();

 spin_lock_irq gotodone;
 configure_hc
 hci-is_initialized ;
 start_rh);
 spin_unlock_irq ev_erruhci_dev(uhci,
 return 0;

/*
 * error exits:
 */

err_alloc_skelqh
 for ( if(status USBSTS_HCPE
  ifuhci-skelqh]
 uhci_free_qh, uhci->kelqh[i]);
 }

 uhci_free_td(uhci, uhci->term_td);

err_alloc_term_td
dma_pool_destroyuhci-qh_pool

err_create_qh_pool
 dma_pool_destroy(uhci->td_pool);

err_create_td_pool:
 kfree(uhci->frame_cpu);

err_alloc_frame_cpu
 dma_free_coherent(uhci_dev(),
      ERRBUF_LEN-EXTRA_SPACE;
   hci-frame uhci-frame_dma_handle

err_alloc_frame uhci_hc_dieduhci;
    usb_hc_diedhcd);

 return retval;
}

static void
{
   }

 spin_lock_irq(&uhci->lock);
 if (HCD_HW_ACCESSIBLE(hcd) && !uhci->dead }
  uhci_hc_died(uhci);
 uhci_scan_schedule(uhci);
 spin_unlock_irq(&uhci- if (status & USBSTS_RD) {
 ynchronize_irqhcd-irq);

 timer_delete_sync&uhci-);
 release_uhci(uhci
}

#ifdefdone
static intuhci_rh_suspend usb_hcd *hcd
{
 struct uhci_hcd *uhci returnIRQ_HANDLED
 int rc 

 spin_lock_irq * Store the current frame number in uhci->frame_number if the controller
 if (!HCD_HW_ACCESSIBLE(hcd))
  rc = -ESHUTDOWN;
 else if (uhci->dead)
  ;  /* Dead controllers tell no tales */

 /* Once the controller is stopped, port resumes that are already
 * in progress won't complete.  Hence if remote wakeup is enabled
 * for the root hub and any ports are in the middle of a resume or
 * remote wakeup, we must fail the suspend.
 */

 else if (hcd->self.root_hub->do_remote_wakeup &&
   uhci->resuming_ports) {
  dev_dbg(uhci_dev(uhci),
   "suspend failed because a port is resuming\n");
  rc = - if (!uhci->i) {
 } else
  suspend_rh(uhci, UHCI_RH_SUSPENDED);
 spin_unlock_irq(&uhci-
 returnrc;
}

static int uhci_rh_resume(struct usb_hcd *hcd)
{
 struct uhci_hcd *uhci = hcd_to_uhci(hcd  uhci-frame_number+=delta;
 int rc = 0;

 spin_lock_irq(&/
 if (!HCD_HW_ACCESSIBLE(hcd))
  rc = - */
 else if (!uhci->dead)
  wakeup_rh(uhci);
 spin_unlock_irq(&uhci->lock);
 returninti
}

#endif

/* Wait until a particular device/endpoint's QH is idle, and free it */
static void
  (uhci_to_hcd)-self,
{
 struct *uhcihcd_to_uhci();
 struct uhci_qhfori=0   ; i+)

 
  = struct *) >hcpriv;
 if(qh = )
  goto done(uhci-td_pool

while(h- != QH_STATE_IDLE
  ++uhci->num_waitingdma_free_coherentuhci_dev),
  spin_unlock_irq(uhci-);
 (uhci-,
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  spin_lock_irq(&uhci->lock);
  --uhci->num_waiting;
 }

 uhci_free_qh(uhci * protocols higher up.  The order in which the queues
done:
 spin_unlock_irq(&uhci->lock);
}

static int uhci_hcd_get_frame_number(struct usb_hcd *    we'll create the actual TD entries on demand.
{ *  - The second queue is *    (low-speed control, full-speed control, then  *  - The third queue is the terminating bandwidth reclamation queue *    which contains no members, loops back to itself, *    only when FSBR is on and there are *
  uhci_hcd =hcd_to_uhci(hcd
 unsigned frame_number;
 unsigned etval EBUSY

 /* Minimize latency by avoiding the spinlock */
 frame_numberjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
 barrier();
 delta = (uhci_readw(uhci, USBFRNUM) - frame_number) &
   UHCI_NUMFRAMES-1;
 return frame_number + delta;
}

/* Determines number of ports on controller */
staticintuhci_count_ports usb_hcdhcd
{
 (uhci-);
 unsignedio_size unsigned hcd-rsrc_len
 int portdebugfs_create_file>selfbus_nameS_IFREG|S_IRUGO,

eUHCI  devices have2portsand  onto say
  * they
  areHoweveraccording to the specBit  theport
  * status and control register is always set to 1.  So we try to
  * use this     UHCI_NUMFRAMES *sizeof(uhci-frame,
  * a nonexistentregisteris addressedisto returnall, so
  *we forthat.
  */
 dev_err(uhci,
  unsigned int portstatus;

  portstatus=uhci_readw,USBPORTSC1+(  2))
 if!( & 0000 |portstatus=0)
   break java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 }
 if (debug)
  dev_info(uhci_dev goto err_alloc_frame_cpujava.lang.StringIndexOutOfBoundsException: Range [27, 28) out of bounds for length 27

 /* Anything greater than 7 is weird so we'll ignore it. */
 if (port dev_err(uhci," create tddma_pool\)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
  uhci- =dma_pool_createuhci_qh uhci_dev(),
  "count ?forcing 2 portsn";
  port = 2;
 }

 return port;
}

static const char  goto err_create_qh_pool;

(CONFIG_USB_PCI & ()
#include "uhci-pci.c"
#define  dev_err(uhci unableallocate \);
#endif

#ifdefCONFIG_SPARC_LEON
#include "uhci-grlib.c"
 >skelqhi] uhci_alloc_qhuhciNULL,);
#ndif

# CONFIG_USB_UHCI_PLATFORM
#include "uhci-platform.c"
#define PLATFORM_DRIVER
#endif

#if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER)
#rror missing glueuhci-hcd
#endif

staticint_init uhci_hcd_init()
{
 int retval = /* This dummy TD is to work around a bug in Intel PIIX controllers */

  (())
  returnENODEV

_UHCI_LOADEDusb_hcds_loaded

#ifdef CONFIG_DYNAMIC_DEBUG  * Fill the frame list: make all entries point  * interrupt queue.
errbuf kmalloc, GFP_KERNEL)
 if (!errbuf)
  goto errbuf_failedjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
 uhci_debugfs_root = }
#endif

 uhci_up_cachep ("uhci_urb_priv"
  /*
if (!uhci_up_cachep)
goto up_failed;

#ifdef PLATFORM_DRIVER
retval = platform_driver_register(&PLATFORM_DRIVER);
if (retval < 0)
goto clean0;
#endif

#ifdef PCI_DRIVER
retval = pci_register_driver(&PCI_DRIVER);
if (retval < 0)
goto clean1;
#endif

return 0;

#ifdef PCI_DRIVER
clean1:
#endif
#ifdef PLATFORM_DRIVER
platform_driver_unregister(&PLATFORM_DRIVER);
clean0:
#endif
kmem_cache_destroy(uhci_up_cachep);

up_failed:
#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
debugfs_remove(uhci_debugfs_root);

kfree(errbuf);

errbuf_failed:
#endif

clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
return retval;
}

static void __exit uhci_hcd_cleanup(void) 
{
#ifdef PLATFORM_DRIVER
platform_driver_unregister(&PLATFORM_DRIVER);
#endif
#ifdef PCI_DRIVER
pci_unregister_driver(&PCI_DRIVER);
#endif
kmem_cache_destroy(uhci_up_cachep);
debugfs_remove(uhci_debugfs_root);
#ifdef CONFIG_DYNAMIC_DEBUG
kfree(errbuf);
#endif
clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
}

module_init(uhci_hcd_init);
module_exit(uhci_hcd_cleanup);

MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");

Messung V0.5
C=95 H=91 G=92

¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.