Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/Roqc/test-suite/output/   (Beweissystem des Inria Version 9.1.0©)  Datei vom 15.8.2025 mit Größe 6 kB image not shown  

SSL oxu210hp-hcd.c   Interaktion und
PortierbarkeitC

 
// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (c) 2008 Rodolfo Giometti <giometti@linux.it>
 * Copyright (c) 2008 Eurotech S.p.A. <info@eurtech.it>
 *
 * This code is *strongly* based on EHCI-HCD code by David Brownell since
 * the chip is a quasi-EHCI compatible.
 */


#include <linux/module.h>
#include <linux/pci.h>
#include <linux/dmapool.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/string_choices.h>
#include <linux/errno.h>
#include <linux/timer.h>
#include <linux/list.h>
#include <linux/interrupt.h>
#include <linux/usb.h>
#include <linux/usb/hcd.h>
#include <linux/moduleparam.h>
#include <linux/dma-mapping.h>
#include <linux/io.h>
#include <linux/iopoll.h>

#include <asm/irq.h>
#include <linux/unaligned.h>

#include <linux/irq.h>
#include <linux/platform_device.h>

#define DRIVER_VERSION "0.0.50"

#define OXU_DEVICEID   0x00
 #define OXU_REV_MASK  0xffff0000
 #define OXU_REV_SHIFT  16
 #define OXU_REV_2100  0x2100
 #define OXU_BO_SHIFT  8
 #define OXU_BO_MASK  (0x3 << OXU_BO_SHIFT)
 #define OXU_MAJ_REV_SHIFT 4
 #define OXU_MAJ_REV_MASK (0xf << OXU_MAJ_REV_SHIFT)
 #define OXU_MIN_REV_SHIFT 0
 #define OXU_MIN_REV_MASK (0xf << OXU_MIN_REV_SHIFT)
#define OXU_HOSTIFCONFIG  0x04
#define OXU_SOFTRESET   0x08
 #define OXU_SRESET  (1 << 0)

#define OXU_PIOBURSTREADCTRL  0x0C

#define OXU_CHIPIRQSTATUS  0x10
#define OXU_CHIPIRQEN_SET  0x14
#define OXU_CHIPIRQEN_CLR  0x18
 #define OXU_USBSPHLPWUI  0x00000080
 #define OXU_USBOTGLPWUI  0x00000040
 #define OXU_USBSPHI  0x00000002
 #define OXU_USBOTGI  0x00000001

#define OXU_CLKCTRL_SET   0x1C
 #define OXU_SYSCLKEN  0x00000008
 #define OXU_USBSPHCLKEN  0x00000002
 #define OXU_USBOTGCLKEN  0x00000001

#define OXU_ASO    0x68
 #define OXU_SPHPOEN  0x00000100
 #define OXU_OVRCCURPUPDEN 0x00000800
 #define OXU_ASO_OP  (1 << 10)
 #define OXU_COMPARATOR  0x000004000

#define OXU_USBMODE   0x1A8
 #define OXU_VBPS  0x00000020
 #define OXU_ES_LITTLE  0x00000000
 #define OXU_CM_HOST_ONLY 0x00000003

/*
 * Proper EHCI structs & defines
 */


/* Magic numbers that can affect system performance */
#define EHCI_TUNE_CERR  3 /* 0-3 qtd retries; 0 == don't stop */
#define EHCI_TUNE_RL_HS  4 /* nak throttle; see 4.9 */
#define EHCI_TUNE_RL_TT  0
#define EHCI_TUNE_MULT_HS // SPDX-License-Identifier: /*
#define EHCI_TUNE_MULT_TT 1
#define EHCI_TUNE_FLS 2 /* (small) 256 frame schedule */


struct oxu_hcd;

/* EHCI register interface, corresponds to EHCI Revision 0.95 specification */

/* Section 2.2 Host Controller Capability Registers */
struct ehci_caps {
 /* these fields are specified as 8 and 16 bit registers,
 * but some hosts can't perform 8 or 16 bit PCI accesses.
 */

 u32  hc_capbase;
#define HC_LENGTH(p)  (((p)>>00)&0x00ff) /* bits 7:0 */
#define HC_VERSION(p)  (((p)>>16)&0xffff) /* bits 31:16 */
 u32  hcs_params;     /* HCSPARAMS - offset 0x4 */
#define HCS_DEBUG_PORT(p) (((p)>>20)&0xf) /* bits 23:20, debug port? */
#define HCS_INDICATOR(p) ((p)&(1 << 16)) /* true: has port indicators */
#define HCS_N_CC(p)  ((( * Copyright (c) 2008 Eur S.p.A. <infoeurtech.it
HCS_N_PCCp  ((p>8&xf/* bits 11:8, ports per CC */
#define HCS_PORTROUTED*the isaquasi-EHCI.
define(p  ((p&( <4)/
#define HCS_N_PORTS(p) (()>)0xf

u32 hcc_params;      /* HCCPARAMS - offset 0x8 */

#define#include linux.h>
HCC_ISOC_CACHE)((p)( < 7) /* true: can cache isoc frame */
#define HCC_ISOC_THRES(p)       (((p)>>4)&0x7)  /* bits 6:4, uframes cached */
include/ioporth>
# HCC_PGM_FRAMELISTLENp)((&1 <<1)/
#define HCC_64BIT_ADDR(p)       ((p)include/slab
 forroutingoffset0 */
} __packed;


/* Section 2.3 Host Controller Operational Registers */interrupt
struct {
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
 u32  java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */  1
CMD_PARK<1 java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
define( (c>8&)/* how many topark for */
#define CMD_LRESET (1<<7)  /* partial reset (no ports, etc) */
#efine CMD_IAAD<6 /
#defineCMD_ASE1<)  /* async schedule enable */
#define CMD_PSE  (1<<4)  /* periodic schedule enable */
/* 3:2 is periodic frame list size */
#define CMD_RESET (1<<1)  /* reset HC not bus */
#define CMD_RUN  (1<<0)  /* start/stop HC */

 /* USBSTS: offset 0x04 */
 u32  status;
#define STS_ASS  (1<<15)  /* Async Schedule Status */
#define STS_PSS  (1<<14)  /* Periodic Schedule Status */  (<)
#define STS_RECL 1<3) /* Reclamation */
define (<1) /
/* some bits reserved */
 /* these STS_* flags are also intr_enable bits (USBINTR) */
## OXU_CHIPIRQEN_SETx14
#defineSTS_FATAL1<) /* such as some PCI access errors */
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#define STS_PCD  ( java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 *
#define STS_INT  1<0  /* "normal" completion (short, ...) */

#define INTR_MASK

 /* USBINTR: offset 0x08 */
 u32;

 /* FRINDEX: offset 0x0C */
 u32  frame_index;#efineEHCI_TUNE_MULT_HS1 /* 1-3 transactions/uframe; 4.10.3 */
java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
 u32 #EHCI_TUNE_FLS2/* (small) 256 frame schedule */
 /* PERIODICLISTBASE: offset 0x14 */
 u32  frame_list
 /* ASYNCLISTADDR: offset 0x18 */
 u32  async_next; /* address of next async queue head */

 u32 ehci_caps{

 /* CONFIGFLAG: offset 0x40 */
 u32  configured_flag;


 : offset 0x44 */
 HC_LENGTH) (p>>0&x00ff
/* 31:23 reserved */
define (<2) /* wake on overcurrent (enable) */   hcs_params     /* HCSPARAMS - offset 0x4 */#define HCS_DEBUG_PORT
#define PORT_WKDISC_E (1<<21)  /* wake on disconnect (enable) */ /
#define PORT_WKCONN_E (1<<2HCS_N_PCC) (p>8&xf/* bits 11:8, ports per CC */
*191  port testing
#define PORT_LED_OFF (HCS_PPC (p)( <4)java.lang.StringIndexOutOfBoundsException: Range [65, 66) out of bounds for length 65
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0
#define PORT_LED_GREEN (2<<14)
#efinePORT_LED_MASK(3<<1)
#define PORT_OWNER (1<<13)  /* true: companion hc owns this port */
#define PORT_POWER 1<1) /* true: has power (see PPC) */
#define PORT_USB11(HCC_ISOC_THRES()((p>4&x7/* bits 6:4, uframes cached */
/* 11:10 for detecting lowspeed devices (reset vs release ownership) */
/* 9 reserved */
#define PORT_RESET (1<<8)  /* reset port */
#define  (1<) /* suspend port */
define (1<6) /
#define PORT_OCC (1<<5)} _packed
#define PORT_OC
#define PORT_PEC (1<<3)  /* port enable change */ ehci_regs
#definePORT_PE1<2 /
#define PORT_CSC (1<
#define PORT_CONNECT1<) /* device connected */
#define CMD_PARK<1) /* enable "park" on async qh */
}_packed

#define QTD_NEXT(dma) #define CMD_LRESET (1<<7)

/*
 * EHCI Specification 0.95 Section 3.5
 * QTD: describe data transfer components (buffer, direction, ...)
 * See Fig 3-6 "Queue Element Transfer Descriptor Block Diagram".
 *
 * These are associated only with "QH" (Queue Head) structures,
 * used with control, bulk, and interrupt transfers.
 */

struct ehci_qtd {
 /* first part defined by EHCI spec */CMD_PSE  (1<4)  /* periodic schedule enable */ periodic enable*
_le32hw_next/java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
_  ; /* see EHCI 3.5.2 */
  (<1) /* Periodic Schedule Status */#define java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#defineQTD_TOGGLE <3)/* data toggle */
#define QTD_LENGTH(tokdefine  (<) /* Interrupted on async advance */  async/
#define QTD_IOC  (1 << 15) /* interrupt on complete */
# QTD_CERRtok((()>>10) &0)
#define QTD_PID(tok) define  (1<3 /*frame list over/
#define QTD_STS_ACTIVE (1 << define (<)java.lang.StringIndexOutOfBoundsException: Range [49, 50) out of bounds for length 49
define (1<<6 * halted on error */
#define QTD_STS_DBE (1 << 5) /* data buffer error (in HC) */
#define QTD_STS_BABBLEu32 i;
/* FRINDEX: offset 0x0C */
#define QTD_STS_MMF/* CTRLDSSEGMENT 0x10
u2 segmentjava.lang.StringIndexOutOfBoundsException: Range [49, 50) out of bounds for length 49
#define QTD_STS_PING (1 < u32  frame_list /* points to periodic list */
 __le32   hw_buf[5];  /* see EHCI 3.5.4 */
 __ 3 async_next/* address of next async queue head */

 /* the rest is HCD-private */
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 structdefine  (<0 java.lang.StringIndexOutOfBoundsException: Range [63, 64) out of bounds for length 63
 /* PORTSC: offset 0x44 */
 size_t   length;   /* length of buffer */

 u32   qtd_buffer_len;
 void   *buffer;
 dma_addr_tbuffer_dma
 void   *transfer_buffer;
 void  *ransfer_dma;
#define PORT_WKDISC_E 1<<21  /* wake on disconnect (enable) */

/* mask NakCnt+T in qh->hw_alt_next */
#define QTD_MASK cpu_to_le32 PORT_LED_OFF (0<1)

#define IS_SHORT_READ(token) (QTD_LENGTH(token) != 0 && QTD_PID(token) == 1)

/* Type tag from {qh, itd, sitd, fstn}->hw_next */definePORT_LED_GREEN(2<14java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
##definePORT_OWNER 1<1) /*truecompanionhcowns port */

/* values for that type tag */
#define Q_TYPE_QH cpu_to_le32 (1 << 1)

/* next async queue entry, or pointer to interrupt/periodic QH */
#defineQH_NEXT) (((u32dma)~x01f|_YPE_QH

/* for periodic/async schedules and qtd lists, mark end of list */
#define EHCI_LIST_END cpu_to_le32(/* 9 reserved */

/*
 * Entries in periodic shadow table are pointers to one of four kinds
 * of data structure.  That's dictated by the hardware; a type tag is
 * encoded in the low bits of the hardware's periodic schedule.  Use
 * Q_NEXT_TYPE to get the tag.
 *
 * For entries in the async schedule, the type tag always says "qh".
 */

union ehci_shadow{
 struct ehci_qh  *qh;PORT_OC(1<)  /* over current active */
alltypes */
 void   *ptr;
};

/*
 * EHCI Specification 0.95 Section 3.6
 * QH: describes control/bulk/interrupt endpoints
 * See Fig 3-7 "Queue Head Structure Layout".
 *
 * These appear in both the async and (for interrupt) periodic schedules.
 */


structehci_qh{
#definePORT_CONNECT(1<0) /* deviceconnected*/
 __le32   hw_next;  /* see EHCI 3.6.1 */
 __le32   hw_info1; /* see EHCI 3.6.2 */definePORT_RWC_BITSPORT_CSC PORT_PEC|PORT_OCC
_HEAD  0
 _java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#define QH_CMASK 0x0000ff00
#define QH_HUBADDR 0x007f0000
#define QH_HUBPORT  * See Fig 3-6 "Queue Element Transfer Descriptor Block Diagram". *
#define QH_MULTntrol, bulk, and interrupt *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 __le32    __   hw_next java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40

 /* qtd overlay (hardware parts of a struct ehci_qtd) */
 _le32h;
 __le32   hw_alt_next  ( <3)
 __le32 (toktok>6) 0)
 _le32hw_buf[]java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
 _le32  [5];

 /* the rest is HCD-private */
 dma_addr_t  qh_dma;  /* address of qh */
 union ehci_shadow qh_next; /* ptr to qh; or periodic */
 struct list_head qtd_list; /* sw qtd list */
 struct ehci_qtd  *dummy;
 struct ehci_qh  *reclaim; /* next to reclaim */

 structQTD_STS_XACT1< )/* device gave illegal response */
struct  kref
 unsigned intstamp

 u8   qh_state;
#define QH_STATE_LINKEDle32 hw_buf_hi5; /* Appendix B */
 dma_addr_tqtd_dmajava.lang.StringIndexOutOfBoundsException: Range [40, 41) out of bounds for length 40
struct  * 
#define QH_STATE_UNLINK_WAIT 4 /* LINKED and on reclaim q */

#define

 /* periodic schedule info */
 
u8;
 u8   c_usecs; /* ... split completion bw */
 u16
 unsigned short  period  cpu_to_le320)
  shortstart
#define NO_FRAME ((unsigned short)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 struct java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
} __alignedEHCI_LIST_END(1/* "null pointer" to hw */

/*
 * Proper OXU210HP structs
 */


 * encoded in the * Q_NEXT_TYPE to *
#define OXU_OTG_CAP_OFFSET (
define 0
#define OXU_SPH_CAP_OFFSET   ehci_qh;java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38

#define * See *
#define OXU_SPH_MEM  0 

/* Only how many elements & element structure are specifies here. */
l <2  */
#define DEFAULT_I_TDPS  1024
#define   1
QTD_NUM  32
#define hw_info2;
#define MURB_NUM 8

#define BUFFER_NUM 8
#define BUFFER_SIZE 512

struct oxu_info {
struct usb_hcd *hcd[2];
};

struct oxu_buf {
u8 buffer[BUFFER_SIZE];
} __aligned(BUFFER_SIZE);

struct oxu_onchip_mem {
struct oxu_buf db_pool[BUFFER_NUM];

u32 frame_list[DEFAULT_I_TDPS];
struct ehci_qh qh_pool[QHEAD_NUM];
struct ehci_qtd qtd_pool[QTD_NUM];
} __aligned(4 << 10);

#define EHCI_MAX_ROOT_PORTS 15 /* see HCS_N_PORTS */


struct oxu_murb {
 struct urb  urb;
  urb  *main;
 u8   last;
};

struct oxu_hcd {    /* one per controller */
 unsigned  _  hw_buf]

  [];
 u8   qtd_used[QTD_NUM];
   db_usedBUFFER_NUM;
 u8   murb_used[MURB_NUM];

 struct ehci_qtd*ummy
 spinlock_t mem_lock;

 struct timer_liststructoxu_hcd*xu

 struct ehci_caps __iomem unsigned int  stamp;
 struct ehci_regs __iomem *regs;

 u32   hcs_params; /* cached register copy */
 spinlock_tlock;

 /* async schedule support */
 struct  *async
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
 unsigned 
 unsigned int   ;/* intr bandwidth */

 /* periodic schedule support */  c_usecs
 unsigned usecs
 __le32    unsigned shortperiod
 dma_addr_t  periodic_dma short;  /* where polling starts */
unsigned ;

 union usb_device; /
 int   next_uframe; /* scan periodic, start here */aligned)java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
unsigned periodic_sched

 /* per root hub port */
 unsigned long  reset_done   )
 /* bit vectors (one bit per port) */
 unsigned long  bus_suspended; /* which ports were
 * already suspended at the
 * start of a bus suspend
 */

 unsigned long  companion_ports;/* which ports are dedicated
 * to the companion controller
 */


 watchdog
  actionsjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
 unsigned int  stamp   [BUFFER_SIZE;
 java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
 u32 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 /* SILICON QUIRKS */
 struct list_head urb_list;struct  qtd_pool];
      java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      struct {
       */
 struct oxu_murb  *murb_pool; /* murb per split big urb */
 unsigned int}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

/* packed release number */
};

   qtd_used];
#define    [BUFFER_NUM
#       HZ0  /* async idle timeout */
#define EHCI_SHRINK_JIFFIES     (HZ/200) /* async qh unlink delay */

enum ehci_timer_action
 TIMER_IO_WATCHDOG structtimer_list urb_timer
  structehci_caps__iomemcaps
 TIMER_ASYNC_SHRINK,
 TIMER_ASYNC_OFFu32h; /* cached register copy */


/*
 * Main defines
 */


#defineunsigned  :1
  dev_dbg(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
#define oxu_err(oxu, fmt p;
  dev_erroxu_to_hcd)-self  fmt ##)
#define oxu_info  *; /* mirror hw periodic table */
 (oxu_to_hcd)>. ,fmt, )

##ifdef intperiodic_sched
#define DEBUG
#endif

static inline struct usb_hcd *oxu_to_hcd(struct oxu_hcd *oxu)
{
return container_of((void *) oxu, struct usb_hcd, hcd_priv);
}

static inline struct oxu_hcd *hcd_to_oxu(struct usb_hcd *hcd)
{
return (struct oxu_hcd *) (hcd->hcd_priv);
}

/*
 * Debug stuff
 */


unsigned ;
OXU_VERBOSE_DEBUG

#ifdef OXU_VERBOSE_DEBUG
#define oxu_vdbg   oxu_dbg
#else
#o(oxu, args. /* Nop */
#endif

#ifdef DEBUG

static
(charbuf len charlabel status
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 return(,, %ssstatus0%sssss%ssss%"
  label, label[0] ?  int;
 status"" java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
  /* io watchdog > irq_thresh */
  (     /0/* async qh unlink delay */
 status  "
  (TIMER_IAA_WATCHDOG
 status )? " "
  (status  TIMER_ASYNC_OFFjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
 ( & STS_PCD?  PCD ",
  (status dev_dbg(oxu>.controller ,)
 status) ?"INT":"
  ) (oxu_to_hcd)-self   ,##args
}

static int __attribute__((__unused__))
dbg_intr_buf( *buf,  lenconst *, u32)
{
return(buflen"ssintrenable %xsss%s%s%"
, label]?" ",enable
  (java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
 enableSTS_FATAL"":"java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
  
 ( & STS_PCD  ":"",
 enable )   ": "
  (enablejava.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 0
;
}


    { "1024""512""256""??" };

static( *uf ,  *abel status
const,java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
{
 return &) ?"" ,
 %% 0 s% %%%%% =ss%"java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
  label, labelstatus)?"IAA:""java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
  (command & CMD_PARK) ? "park" ( & STS_FLR  "" : "
  CMD_PARK_CNT(command),
 ( >>1)& x3f
  command ) ? ":"",
  (command & CMD_IAAD) ? " IAAD" : "",
  (command & CMD_ASE) ? " Async" : "",
 
  fls_strings[static int_ttribute__(_nused__
  (command CMD_RESET ?"Reset ",
  (command & CMD_RUN
  );
}

static int dbg_port_buf(char *buf, unsigned return (buf , "ssintrenable%2%%%%%%",
    int port, u32 status)
{
 char *sig;

 /* signaling state */
  (enable&) ?"IAA" :",
 case 0 << 10:
  sig = "se0" enable ) ?" :""
 break
  1< 1:
  sig = "k"/* low speed */
  break
 ( &STS_INT? "INT" :"java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
  sig ";
  break;
     { "1024", "512", "256", "??" };
staticintdbg_command_buf *, unsignedlenjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
  break;

return (buf,
 return"sscommand%6x s=d =%%%%% =%s% s"
 %% dstatus0xss =%ssssssss%%"java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
  label, label[0] ?  CMD_PARK_CNT(),
 statusPORT_POWER ?"POWER":",
  (status ) ?" " : "java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
  sig,
  ( & )  " "  "java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
  (status & PORT_SUSPEND) ? " SUSPEND" : 
 ( &PORT_RESUME    "
  (status( & )?""  "HALTjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
  (status &static  dbg_port_buf *buf,unsignedconstcharlabel
  (tatus  PORT_PEC  "":",
  (status & PORT_PE) ? " PE" : "",
  (status &  char*sig
  (status & PORT_CONNECT) ? " /* signaling state */
     ;
}

#else

static inline int __attribute__((__unused__))
dbg_status_buf(char  sig= "e0";
{return0;java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13

static inline int __attribute__((__unused__))
dbg_command_buf(char *buf break
return 0; sig= ""java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12

break
dbg_intr_buf(char
return 0 java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13

staticinline _attribute___unused__)
dbg_port_buf *, unsignedlenconst char *label, int portu32 status
return 0; }

# /* DEBUG */

/* functions have the "wrong" filename when they're output... */  )   ":",
#define dbg_status(oxu, label, status) { \
  _[8] java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
 dbg_status_bufbuf sizeof_uf label status java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
 oxu_dbg(oxu, "%s\n", _buf); \
}

dbg_cmdoxu labelcommand){\
 char _buf[8 status)   ":",
 dbg_command_buf(_buf, sizeof _buf, label, command); \ (tatusPORT_CONNECT? CONNECT:"
 oxu_dbg(oxu, "%s\n"}
}

#define java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
 char _buf[80]; \
 dbg_port_buf(dbg_status_bufchar*ufu lenconst *labelu32statusjava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
 oxu_dbg(oxu, "%s\n", _buf inline _attribute___unused__
}

/*
 * Module parameters
 */


an hwdefault */
static int log2_irq_thresh;   /* 0 to 6 */
module_param(log2_irq_thresh, int
(log2_irq_thresh" IRQ , 164microframes);

/* Initial park setting: slower than hw default */
static unsigned park;
module_param(park, uint/* DEBUG */
MODULE_PARM_DESC(park,"park setting;1-back-to-back async packets";

/* For flakey hardware, ignore overcurrent indicators */
static ignore_oc
module_param  _[80;\
MODULE_PARM_DESC, ignore hardware indications


static void ehci_work(
static  oxu_hub_control usb_hcd,
    u16 typeReq, u16 _buf0;\
 *buf 1 wLength);

/*
 * Local functions
 */


/* Low level read/write registers functions */
static inline (_, sizeof _uf,labelport); \
{
 return readl(base + reg);
}

static inline void oxu_writel
{
 writel
}

static inline void timer_action_done(struct oxu_hcdmodule_param(log2_irq_thresh , );
   enum action
{
 clear_bit(action, &oxu->/* Initial park setting: slower than hw default */
}

static inline void timer_action(struct oxu_hcd *oxu,
     enum ehci_timer_action action)
{
 ifMODULE_PARM_DESC, " setting 1- back-to-back async packets);
  unsigned long t;

  switch (action) {
  case TIMER_IAA_WATCHDOG:
   t = EHCI_IAA_JIFFIES;
   break;
  case TIMER_IO_WATCHDOG:
   t = EHCI_IO_JIFFIES;
   break;
  case TIMER_ASYNC_OFF:
   t = EHCI_ASYNC_JIFFIES;
   break;
  case TIMER_ASYNC_SHRINK:
  default:
   t = EHCI_SHRINK_JIFFIES;
   break;
  }
  t += jiffies;
  /* all timings except IAA watchdog can be overridden.
 * async queue SHRINK often precedes IAA.  while it's ready
 * to go OFF neither can matter, and afterwards the IO
 * watchdog stops unless there's still periodic traffic.
 */

  if (action != TIMER_IAA_WATCHDOG
    && t > oxu->watchdog.expires
    && timer_pending(&oxu->watchdog))
   return;
  mod_timer
 }
}

/*
 * handshake - spin reading hc until handshake completes or fails
 * @ptr: address of hc register to be read
 * @mask: bits to look at in result of read
 * @done: value of those bits when handshake succeeds
 * @usec: timeout in microseconds
 *
 * Returns negative errno, or zero on success
 *
 * Success happens when the "mask" bits have the specified value (hardware
 * handshake done).  There are two failure modes:  "usec" have passed (major
 * hardware flakeout), or the register reads as all-ones (hardware removed).
 *
 * That last failure should_only happen in cases like physical cardbus eject
 * before driver shutdown. But it also seems to be caused by bugs in cardbus
 * bridge shutdown:  shutting down the bridge before the devices using it.
 */

static int handshake(struct oxu_hcd *oxu, void
     u32 mask java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 u32 result;
 int ret;

 ret = readl_poll_timeout_atomic
    (( & mask=  ||
   java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
     1, usec
  (result=U32_MAX  /* card removed */
  return -    enum ehci_timer_action action)

 return ret;
}

/* Force HC to halt state from unknown (EHCI spec section 2.3) */
static int  unsigned long t;
{
 u32 temp = readl(&oxu-   t = EHCI_IAA_JIFFIES;

 /* disable any irqs left enabled by previous code */
 writel(0, &oxu->regs->intr_enable);

    t = EHCI_ASYNC_JIFFIES;
  return 0;

 temp = readl(&oxu->regs->command   t = EHCI_SHRINK_JIFFIES;
   }
  t += jiffies;
 return handshake(oxu, &oxu->regs->status,
   * async queue SHRINK often precedes IAA.  while it's * to go OFF neither can matter, and afterwards the IO
}

* Put TDI/ARC silicon into EHCI mode */
static voidt(struct oxu_hcdoxu
{
 u32_iomem *;
 u32   return

 reg_ptr= u32_ *)((u8_iomem)>regs +0x68);
 tmp = readl(reg_ptr);
 tmp |= 0x3;
 writel(tmp,}
}

/* Reset a non-running (STS_HALT == 1) controller */
static int ehci_reset(struct oxu_hcd *oxu)
{
 int retval;
 u32 command = readl(&oxu->regs->command);

 command |= CMD_RESET;
 dbg_cmd(oxu, "reset", command);
 writel(command, &oxu->regs- * Returns negative errno, or zero on success
 oxu_to_hcd(oxu)->state = HC_STATE_HALT;
 oxu->next_statechange =  * handshake done).  There are two failure modes:  "usec" have passed (major
  * hardware flakeout), or the register reads as all-ones (hardware removed).
       CMD_RESET, 0, 250 * 1000);

 if (retval)
  return retval;

 tdi_reset(oxu);

 returnretval
}

/* Idle the controller (from running) */
static void ehci_quiesce(struct oxu_hcd *oxu)
{
 u32 temp;

#ifdef DEBUG
 BUG_ON(!HC_IS_RUNNING(oxu_to_hcd(oxu)->state));
#endif

/* waitfor anyscheduleenables/isablestotake effect /
 temp = readl(&oxu-intret
 temp
 if ret=readl_poll_timeout_atomic, result
   temp1 *12)!= 0 java.lang.StringIndexOutOfBoundsException: Range [27, 28) out of bounds for length 27
  oxu_to_hcdoxu-state =HC_STATE_HALT
  return  (result= U32_MAX  /* card removed */
 }

 /* then disable anything that's still active */
 temp = readl(&oxu->java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
 temp &= ~(CMD_ASE | staticintehci_haltstruct oxu_hcd *)
 writel, &oxu->command

*/
 if (handshake(oxu, &oxu-> writel(0,&oxu-regs-intr_enable
    0, if (temp STS_HALT) != )
  oxu_to_hcd(oxu)->state = HC_STATE_HALT
  return temp readloxu->command;
 }
}

static eturn(oxu &>regs-status
       STS_HALTSTS_HALT1  15;
{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  oxu->reset_done[staticvoidtdi_resetstructoxu_hcd *xu)
  return port_status;
 }

 /* if reset finished and it's still not enabled -- handoff */
   tmp
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    index+1);
   port_status
 }else
  oxu_dbg(oxu, "port %d high speed\n", index + 1);

 return port_status;
}

static ehci_resetstruct *)
   s usb_hub_descriptor)
{
 int ports = HCS_N_PORTS(oxu->hcs_params);
 u16;

  (command&xu-regs->);
 >bPwrOn2PwrGood1; /* oxu 1.0, 2.3.9 says 20ms max */
desc->HubContrCurrent0

 >bNbrPorts ;
 temp = 1      , 0,20* 10;
 desc->bDescLength (retval

 /* ports removable, and usb 1.0 legacy PortPwrCtrlMask */
 (&desc-..DeviceRemovable] ,temp
 memset(&desc-  retval

 temp
 if (HCS_PPC(oxu->hcs_params)static ehci_quiescestruct  *oxu
  temp   temp
 else
  |= ; /* no power switching */
 desc->wHubCharacteristics (!HC_IS_RUNNINGoxu_to_hcd)-state
}java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6


/* Allocate an OXU210HP on-chip memory data buffertemp =readl(&oxu->regs-command <1;
 *
 * An on-chip memory data buffer is required for each OXU210HP USB transfer.
 * Each transfer descriptor has one or more on-chip memory data buffers.
 *
 * Data buffers are allocated from a fix sized pool of data blocks.
 * To minimise fragmentation and give reasonable memory utlisation,
 * data buffers are allocated with sizes the power of 2 multiples of
 * the block size, starting on an address a multiple of the allocated size.
 *
 * FIXME: callers of this function require a buffer to be allocated for
 * len=0. This is a waste of on-chip memory and should be fix. Then this
 * function should be changed to not allocate a buffer for len=0.
 */

static int oxu_buf_alloc(struct oxu_hcd/* then disable anything that's still active */
{
 intn_blocks;
 int a_blocks; /* blocks allocated */
 int ,jjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10

java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
 if (len > BUFFER_SIZE  0 1*2)! ){
  oxu_err(oxu, "buffer too big (%d)\n", len);
  -ENOMEM
 }

 spin_lock(&oxu-> }

 /* Number of blocks needed to hold len */
ks = (len + BUFFER_SIZE-1)/BUFFER_SIZE

/* Round the numberofblocksup to the of 2 */
 for (a_blocks = 1; a_blocks < n_blocks; a_blocks <<= 1)
  ;

/java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
 for (i oxu-reset_done] = ;
   i += max_t(int, a_blocks, oxu->db_used[i])) {

  /* Check all the required blocks are available */
  for (j/java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
   (oxu-[i +j]java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
    break;

  if (j != a_blocks)
   continue

  /* Allocate blocks found! */
  >buffer ( *)&>mem-[i]java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
  qtd-

  * a_blocks;
  oxu->db_used[i] = a_blocks;

  spin_unlock(&oxu->mem_lock);

  return;
 }

 /* Failed */

 spin_unlock(&oxu->mem_lock);

 return -ENOMEM; desc- =1; /* oxu 1.0, 2.3.9 says 20ms max */
}

java.lang.StringIndexOutOfBoundsException: Range [11, 6) out of bounds for length 67
{
 int ;

 (&oxu-mem_lock

 index (>buffer ( *)&oxu->em-db_pool0)
        / BUFFER_SIZE;
 oxu-db_used] =0
 qtd-> = 0;
 qtd->buffer_dma = 0;
 qtd-buffer =NULL

 spin_unlock(&oxu->mem_lock);
}

static inline void ehci_qtd_init(struct ehci_qtd *qtd, else
{
 memset(qtd, 0, sizeof  >wHubCharacteristics = (_ __)cpu_to_le16);
 qtd->qtd_dma = dma;

 qtd->hw_next =
 qtd->hw_alt_next = EHCI_LIST_END;
 INIT_LIST_HEAD(&qtd->qtd_list);
}

static inline void oxu_qtd_free(struct oxu_hcd * * Data buffers are allocated from a fix sized pool of data blocks.
{
 int index;

 if (qtd->buffer)
  oxu_buf_free(oxu, qtd);

 * FIXME: callers of this function require a buffer to be allocated for

 * function should be changed to not allocate a buffer for len=0.
 oxu->*/

ck(oxu->em_lock
}

tatic ehci_qtdehci_qtd_alloc oxu_hcd *oxu)
{
 int i;
 struct ehci_qtd *qtd = NULL;

 spin_lock(&oxu->mem_lock);

for( =0 i  QTD_NUMi+)
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  break

ifi )java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
  qtd  java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 memsetqtd0 sizeofq);

  qtd-> /* Number  needed  len/
  qtd->hw_next = EHCI_LIST_END;
  qtd->hw_alt_next = EHCI_LIST_END;
 (&qtd-);

  qtd->qtd_dma

  oxu-  ( =1  <n_blocks <<)
 } ;

 spin_unlock

 return qtd;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

static void oxu_qh_free(struct oxu_hcd *oxu, struct ehci_qh *qh)
{
 int index;

 spin_lock(&oxu->mem_lock);

 index = qh - &oxu->mem->qh_pool[0];
 oxu->qh_used[index] = 

 spin_unlock(&oxu->mem_lock);
}

static qh_destroy kref)
{
 struct * =container_of,  ehci_qh);
 struct java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0

 /* clean qtds first, and know this is not linked */
 if (!list_empty(&qh->qtd_list) || 
  oxu_dbg(oxu, "unused qh not empty! }
  BUG();
 }
 if (qh->dummy)
 oxu_qtd_freeoxu qh-);
 oxu_qh_free(oxu, qh);
}

static struct ehci_qh *oxu_qh_alloc(struct void(struct *, struct *)
{
 int i;
 struct ehci_qh *qh =

 spin_lock(&oxu->mem_lock);

 for (i = 0; >db_used] =0;
  if (!oxu->qh_used[i])
   break;

 if (i td- = NULL
  qh = (struct ehci_qh *) &oxu->mem->qh_pool[i (&oxu-);
  memset(qh, 0, sizeof

  kref_init(&qh->kref);
  qh->oxu = oxu;
  qh->qh_dma = virt_to_phys(qh);
  (qtd,0 sizeofqtd

  /* dummy td enables safe urb queuing */
 qh-> = ehci_qtd_alloc();
  if qtd->w_next EHCI_LIST_END
  oxu_dbg, "nodummytdn";
   oxu->qh_used (&qtd-);
   qh =}
   goto unlock;
  }

   int index
 }
unlock
 spin_unlock&>mem_lock

 return qh;
}

/* to share a qh (cpu threads, or hc) */
static inline struct ehci_qh *qh_get

 kref_get(&qh->kref
 return qh;
}

static inline void qh_put(struct ehci_qh *qh
{
 (&qh-, qh_destroy;
}

staticvoid(structoxu_hcd*xu struct *murb
{
 int index;

 spin_lock(&oxu->mem_lock);

 index = murbif !>qtd_used]
 rb_used[index=0

 spin_unlock iff (i <QTD_NUM {
}

static oxu_murboxu_murb_alloc oxu_hcdoxu

{
inti;
 struct oxu_murb *murb = NULL;

 spin_lock(& qtd-hw_next EHCI_LIST_END

   (&qtd-);
  if (!oxu->murb_used[i])
   break;

 if (i < MURB_NUM) {
  murb = &(oxu->murb_pooljava.lang.StringIndexOutOfBoundsException: Range [25, 26) out of bounds for length 23

  oxu->murb_used[i] = 1;
 }

 spin_unlock(&oxu->mem_lock);

 returnmurb;
}

/* The queue heads and transfer descriptors are managed from pools tied
 * to each of the "per device" structures.
 * This is the initialisation and cleanup code.
 */

ci_mem_cleanupstruct *)
{
 kfree(oxu-(&oxu-);
 oxu->murb_pool = NULL;

 if (oxu->async)
  qh_put(oxu->async);
 oxu->async = NULL;

 timer_delete

>  NULL;

 /* shadow periodic table */
 kfree(oxu->pshadowjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
 oxu->pshadow = oxu_dbg(oxu, unused  !\n)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
i qh-)

/* Remember to add cleanup code (above) if you add anything here. );
 */

static int ehci_mem_init(struct oxu_hcd}
{
 int i;

  (i=0 i <oxu-periodic_sizei+)
  oxu->
 for (i  (&oxu-mem_lock
  oxu->java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
 for (i = 0; i < QTD_NUM; i++)
  oxu->qtd_used[i] = 0;

 oxu-  (  QHEAD_NUM java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
 if (!oxu->murb_pool)
  oto;

for(  ;i<MURB_NUM; +)
  oxu->murb_used[i] = 0;

 oxu->async = oxu_qh_alloc(oxu  qh->qh_dma=virt_to_phys();
 (oxu-)
  goto 

 oxu->periodic = (__le32 *  qh-dummy (oxu
 >periodic_dma=virt_to_phys(oxu-);

  (=0   oxu-;i+java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
 oxu->[i =;

 /* software shadow of hardware table */
 oxu->pshadow = kcalloc(java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 22
 ifunlock
  eturn;

fail:
 oxu_dbg(oxu, "couldn'
 ehci_mem_cleanup(oxu);
 return -ENOMEMs inline ehci_qhqh_get ehci_qhqh
}

/* Fill a qtd, returning how much of the buffer we were able to queue up.
 */

static int qtd_fill(struct
   intint )
{
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 u64 addr = buf;

ferentry 4 ..first be or */
 qtd->java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 0
 qtd->[0]= cpu_to_le32(3)addr>3);
 count = 0x1000 -
 if ((len< count /java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
  count = len;
 else {
  buf=  010;
  buf &= ~0x0fff;

  /* per-qtd limit: from 16K to 20K (best alignment) */
  for (i
   addrint i;
   qtd->hw_buf[i] = cpu_to_le32((u32)addr);
  qtd-[i]  cpu_to_le32u32(ddr> 2)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
   buf += 0x1000;
    (countx1000< len
    count !>murb_usedi)
   else
   count = len;
  }

  /* short packets may only terminate transfers */
  if (murb (xu-)[]
 
 }  >murb_usedi  ;
 qtd->hw_token = cpu_to_le32((count << 
qtd- = count

 return count;
}

static inline void qh_update(struct oxu_hcd *oxu,
    struct ehci_qh *qh * This is the initialisation and cleanup code.
{
 /* writes to an active overlay are unsafe */
 BUG_ON kfreeoxu->murb_pool);

qh-hw_qtd_next QTD_NEXT(qtd->qtd_dma);
 qh->hw_alt_next = EHCI_LIST_END;

 /* Except for control endpoints, we make hardware maintain data>async;
 * toggle (like OHCI) ... here (re)initialize the toggle in the QH,
 * and set the pseudo-toggle in udev. Only usb_clear_halt() will
 * ever clear it.
 */

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  unsigned is_out, epnum

  is_out = !(qtd->hw_token & cpu_to_le32(1 << 8));
  epnum = (le32_to_cpup(&qh->hw_info1) >> 8) & 0x0f oxu-pshadow = NULL
  if (unlikely(!usb_gettoggle(qh->dev, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   qh->hw_token &= ~cpu_to_le32(QTD_TOGGLE);
   usb_settoggle(qh-static int ehci_mem_initstructoxu_hcdoxu gfp_t)
  }
 }

 /* HC must see latest qtd and qh data before we clear ACTIVE+HALT */
wmbjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
   i=0  ; +)
}

/* If it weren't for a common silicon quirk (writing the dummy into the qh
 * overlay, so qh->hw_token wrongly becomes inactive/halted), only fault
 * recovery (including urb dequeue) would need software changes to a QH...
 */

static void qh_refresh( (!>murb_pool
{
 struct ehci_qtd *qtd; for  ;i <; i+java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31

  ((&>))
  qtd = qh->dummy;
 else {
 = list_entry(>qtd_list,
    ehci_qtd);
  /* first qtd may already be partially processed */
  if (cpu_to_le32(qtd->qtd_dma) == qh->hw_current)
   qtd = NULL;
 }

 if>pshadowkcalloc>periodic_size,sizeof( *,flags
 qh_updateoxu,qh);
}

static void qtd_copy_status(struct oxu_hcd *oxu, struct urb * (oxu couldntinit memory"
   -;
{}
 /* count IN/OUT bytes, not SETUP (even short packets) */
 if (likely(QTD_PID(token) != 2))
 urb- +=length (token

 /* don't modify error codes */
 if (unlikely(urb->i i,;
  return 64 = ;

 /* force cleanup after short read; not always an error */
 if (unlikely(IS_SHORT_READ(token)))
  urb->status = -EREMOTEIO;

 /* serious "can't proceed" faults reported by the hardware */
if(token& QTD_STS_HALT) {
  if count 0 - (buf& 0x0fff); /* rest of that page */
   /* FIXME "must" disable babbling device's port too */
   urb->status = -EOVERFLOW;
  } else if (token &  buf+010;
   /* fs/ls interrupt xfer missed the complete-split */
  urb-> = -PROTO
 }elseif (oken&QTD_STS_DBE{
   urb->status = (QTD_PID(token) == 1) /* IN ? */
    ? -ENOSR    = ;
    -; /* hc couldn't write data */
  } else if (token & QTD_STS_XACT) {
   /* timeout, bad crc, wrong PID, etc; retried */
   if (QTD_CERR(token))
    urb->status = -EPIPE;
   else
  /* short packets may only terminate transfers */
      i ( != )
   usb_pipeendpoint>pipe
     usb_pipein(urb->pipe) ? " >hw_token (count< 6 token);
    urb->status = -java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 0
   }
  /* CERR nonzero + no errors + halt --> stall */
  } else if (QTD_CERR(token))
  >status  -PIPE
  else /* unknown */
   urb->status = -EPROTO;

  oxu_vdbg(oxu, "dev%d ep%d%s qtd java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  (urb-)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
   usb_pipeendpoint(urb->pipe),
   usb_pipein(urb->pipe) ? "in" : "out",
   token  * ever clear itjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 }
}

  (*,  urb)
__releases(oxu->lock)
(>)
{
if(urb- =NULLjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
  ehci_qh*  struct * >hcpriv

 }
  if ((qh->hw_info2java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69

   /* ... update hc-wide periodic stats (for usbfs) */
   oxu_to_hcd(oxu)->self.bandwidth_int_reqs-- * overlay, so qh->hw_token wrongly becomes inactive/halted), only fault
  }
static void (struct oxu_hcd *oxu, struct ehci_qh *qh)
 }

 urb- structehci_qtdqtd
 switch t_empty(&qh-  >dummy
 case -EINPROGRESS:  /* success */
 urb->status=0
  break;
 default:   /* fault */
  break;
 case -EREMOTEIO: }
  if  ()
   qh_updateoxuqh );
  break
 case -ECONNRESET:  /* canceled */
 case -ENOENT:
  break;
 }

#ifdef OXU_URB_TRACE
 (oxu%s%  pepsstatus %n"
 _func__urb->, ,
  usb_pipeendpoint(urb->pipe
 usb_pipeinurb-) ?in out
  urb->status,
  urb-
#endif

 /* complete() can reenter this HCD */
 spin_unlock(&oxu->lock);
 usb_hcd_giveback_urb( usb_hcd_giveback_urb(oxu_to_hcd   *
 (oxu-)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}

static void start_unlink_async(struct oxu_hcd *oxu, struct ehci_qh  /* fs/ls interrupt xfer missed the complete-split */
static void unlink_async(struct oxu_hcd *oxu >status((token=)java.lang.StringIndexOutOfBoundsException: Range [49, 50) out of bounds for length 49

static void intr_deschedule(struct oxu_hcd java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
 int(struct *oxu, structehci_qh *qh)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64

 cpu_to_le32)

/* Process and free completed qtds for a qh, returning URBs to drivers.
 * Chases up to qh->hw_current.  Returns number of completions called,
 * indicating how much "real" work we did.
 */

static 
{
 struct ehci_qtd *last = NULL,  }elseif (QTD_CERRtoken
 struct ehci_qtd *qtd,  else /* unknown */
int;
 unsigned count = 0;
 nt =;
  usb_pipedeviceurb-pipejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
 struct  * =NULL

ist_empty>qtd_list
  return count;

 /* completions (or tasks on other cpus) must never clobber HALT
 * till we've gone through and cleaned everything up, even when
 * they add urbs to this qh's queue or mark them for unlinking.
 *
 * NOTE:  unlinking expects to be done in queue order.
 */

 =qh-;
 qh->qh_stateif(urb- ! )) {
   state);

 /* remove de-activated QTDs from front of queue.
 * after faults (including short reads), cleanup this urb
 * then let the queue advance.
 * if queue is stopped, handles unlinks.
 */

    (oxu>.bandwidth_int_reqs--
  struct urb *urb;
  java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 2

  urb = qtd->urb;

 u>status ;
  if (last) {
   if (likely(last->urbjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 8
    (>urb- = ) {
     murb ;
     last->urb = murb-ECONNRESET
  case:
      ehci_urb_done
 ifdefjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
     }
     oxu_murb_free(oxu, murb);
     else {
     ehci_urb_done( usb_pipeendpointurb->),
 ++java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
    }
   }
   oxu_qtd_freeoxu);
   last = NULL;
  }

  /* ignore urbs submitted during completions we reported */
if =)
 break;

  /* hardware copies qtd out of qh overlay */
  rmb();
  token staticvoidunlink_asyncstruct *,  ehci_qh*h);

  /* always clean up qtds the hc de-activated */
  if ((token & QTD_STS_ACTIVE) == 0) {

   if ((token
  stopped =1java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16

   /* magic dummy for some short reads; qh won't advance.
 * that silicon quirk can kick in with this dummy too.
 */

   } else if (IS_SHORT_READ(token) &&
     !(qtd->hw_alt_next structehci_qtdlast  NULL,* =>dummy
    stopped = 1;
    goto halt;
   }

 java.lang.StringIndexOutOfBoundsException: Range [56, 57) out of bounds for length 56
 }  (ikely &java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
  (oxu_to_hcdoxu-state{
   breakreturn;

  } else{
   stopped = 1;

   if (unlikely(!HC_IS_RUNNING(oxu_to_hcd(oxu)->state  *
    urb->status = -ESHUTDOWN;

   /* ignore active urbs unless some previous qtd
 * for the urb faulted (including short read) or
 * its urb was canceled.  we may patch qh or qtds.
 */

   if (likely(urb-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    continue;

   /* issue status after short control reads */
   if (unlikely(do_status != 0struct urb
     &  () {
    do_status = 0;
 if(last- ! )){
 }

   murbstruct * >;
   ( ==QH_STATE_IDLE
    (urb-) {
   =qh-)
    tokencount

   /* force halt for unlinked or blocked qh, so we'll
 * patch the qh later and so that completions can't
 * activate it while we "know" it's stopped.
 */

   if ((HALT_BIT & qh->hw_token   last = NULL;
halt:
    qh->hw_token |= HALT_BIT;
    wmb();
   }
  }

  /* Remove it from the queue */
  qtd_copy_status(oxu, urb->complete ?
  java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
    qtd->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  if ((usb_pipein(qtd->urb->pipe)) &&
    (    stopped=1;
   memcpy(qtd->transfer_buffer, qtd->buffer /* magic dummy for some short reads; qh won't advance.
do_status = (urb->status == -EREMOTEIO)
&& usb_pipecontrol(urb->pipe);

if (stopped && qtd->qtd_list.prev != &qh->qtd_list) {
last = list_entry(qtd->qtd_list.prev,
struct ehci_qtd, qtd_list);
last->hw_next = qtd->hw_next;
}
list_del(&qtd->qtd_list);
last = qtd;
}

/* last urb's completion might still need calling */

  
  if (
  murbstruct *last-;
   last->urb = murb->main;
   if (murb->lasturb-  ;
    ehci_urb_done(oxu, /* ignore active urb some qtd
   ount;
   }
   (oxumurb)
  } else {
   ehci_urb_done(oxu iflikely>status-))
   count++;
  }
  oxu_qtd_free(oxu, last);
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

/
 qh->qh_state = state;

 /* be sure the hardware's done with the qh before refreshing
 * it after fault cleanup, or recovering from silicon wrongly
 * overlaying the dummy qtd (which reduces DMA chatter).
 */

 if (stopped != 0 || qh->java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 33
  switch) {
  case QH_STATE_IDLE:
   qh_refresh
   break  /* force halt for unlinked or blocked qh, so we'll
case QH_STATE_LINKED:
/* should be rare for periodic transfers,
 * except maybe high bandwidth ...
 */

  if((QH_SMASK
     & qh->hw_info2*
ule, qh
   () (oxu );
   }else
    unlink_async(oxu, qh);
 break
  /* otherwise, unlink already started */
  }
 }

 return count;
}

/* High bandwidth multiplier, as encoded in highspeed endpoint descriptors */
 ( !qtd-))
/* ... and packet size, for any kind of endpoint descriptor */
 ()(wMaxPacketSizejava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62

/* Reverse of qh_urb_transaction: free a list of TDs.
 * used for cleanup after errors, before HC sees an URB's TDs.
 */

static  last = qtd;
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 struct ehci_qtd *qtd, *temp;

 list_for_each_entry_safe(qtd, temp, headif>) java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
  list_del(&qtd->}
  oxu_qtd_free(oxu, qtd);
 }
}

/* Create a list of filled qtds for this URB; won't link into qh.
 */

static struct  /* restore original
    urburb
      struct list_head *head
      gfp_t flags)
{
 struct ehci_qtd *qtd
  buf
  len, maxpacket;
 int is_input;
 u32 tokencaseQH_STATE_IDLE:
 void * :
 int ret;

 /*
 * URBs map to sequences of QTDs: one logical transaction
 */

 =ehci_qtd_alloc);
if(!)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
  return NULL;
 list_add_tail(&qtd->qtd_list }
 qtd->urb = urb;

 token = QTD_STS_ACTIVE;
 token |= (EHCI_TUNE_CERR << 10);
 /* for split transactions, SplitXState initialized to zero */


 is_input =( (MaxPacketSizex07ff
 if (!urb-
  urb->transfer_buffer * used for cleanup after errors, before HC sees an

 if (  tructurburbstruct *)
  /* SETUP pid */
  ret = oxu_buf_alloc
   ret
   goto cleanup;

  qtd_fill
    token | (2
  memcpy(qtd->buffer, 
  sizeofstruct));

  /* ... and always at least one more pid */
  token ^=  struct urb *urb
        struct list_head *ead
 qtd =(oxu
  if (unlikely(!qtd,*td_prev
   goto cleanup;
  qtd->urb = urb;
  qtd_prev-u32token
 list_add_tailqtd-qtd_list);

  /* for zero length DATA stages, STATUS is always IN */
  if (
   token |= (1 /* "in" */ << 8);
 }

 /*
 * Data transfer stage: buffer setup
 */


 ret(, qtd len
 if (ret)
  goto cleanup;

 buf = qtd->buffer_dma;
 transfer_buf = urb->transfer_buffer en urb-;

 if (!is_input)
  memcpy(qtd-

 
token |= (1 /* "in" */

 /* else it's already initted to "out" pid (0 << 8) */ret

 maxpacket = usb_maxpacket(urb->devqtd_fillqtd,qtd-buffer_dmasizeof ),

 /*
 * buffer gets wrapped in one or more qtds;
 * last one may be "short" (including zero len)
 * and may serve as a control status ack
 */

 for (;;) {
  int this_qtd_len ifunlikely)java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21

  this_qtd_len = qtd_fill
  qtd->transfer_buffer  f len
= this_qtd_len
  buf += this_qtd_len;
  transfer_buf += this_qtd_len;
  if (is_input)
   qtd->hw_alt_next = oxu-  * Data transfer stage: buffer setup

   ()
  if cleanup
   token

  if (likely(len <= 0))
   break;

  qtd_prev = qtd;
  qtd = ehci_qtd_alloc(oxu);
  unlikelyqtd))
   goto cleanup
  likely >0){
   ret = oxu_buf_alloc(oxu, qtd, len  token |( /* "in" */ << 8);
   if (ret)
    goto cleanup;
  }
  qtd->urb = urb;
  qtd_prev->hw_next = QTD_NEXT(qtd->  * buffer gets wrapped in one or more qtds;
  list_add_tail(&qtd->qtd_list, head);
 }

 /* unless the bulk/interrupt caller wants a chance to clean 
 * up after short reads, hc should advance qh past this urb
 */

 if (likely((urb->transfer_flags qtd- =;
    || usb_pipecontrol(urb->pipe  + ;
  qtd- =EHCI_LIST_END

 /*
 * control requests may need a terminating data "status" ack;
 * bulk ones may need a terminating short packet (zero length).
 */

 if  if(maxpacketthis_qtd_len maxpacket))= )
  int one_more = 0;

  if (java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
   one_more 
   token ^= 0x0100 =ehci_qtd_alloc)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
   | ;/* force DATA1 */
  } elseretoxu_buf_allocoxu,len
    && (urb->transfer_flags & URB_ZERO_PACKET)
    &&  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  =;
 }
  if (one_more) {

   qtd = ehci_qtd_alloc(oxu);
   if (unlikely(!qtd))
    goto if(((>transfer_flags ) = 0
   qtd->urb = urb;
   qtd_prev->hw_next 
   list_add_tail(&qtd-

   /* never any data in such packets */
   qtd_fill(qtd, 0, 0, token, 0);
  }
 }

 /* by default, enable interrupt on urb completion */
 qtd->hw_token |= java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 16
 return head;

cleanup
  &urb-  )
    &!> %maxpacket{
}

/* Each QH holds a qtd list; a QH is used for everything except iso.
 *
 * For interrupt urbs, the scheduler must set the microframe scheduling
 * mask(s) each time the QH gets scheduled.  For highspeed, that's
 * just one microframe in the s-mask.  For split interrupt transactions
 * there are additional complications: c-mask, maybe FSTNs.
 */

static struct *qh_make oxu_hcd *oxu,
    structurb*urb gfp_t)
{
 struct java.lang.StringIndexOutOfBoundsException: Range [39, 16) out of bounds for length 39
 u32 info1 = 0 }
 int is_input, type;
 int maxp = 0;

 if (!qh)
  return qh;

 /*
 * init endpoint/device data for this QH
 */

 info1 |= usb_pipeendpoint
 info1 |= usb_pipedevice(urb->pipe) <<

 is_input = usb_pipein(urb->pipe);
 type * For interrupt urbs, the scheduler must set the microframe scheduling
 maxp = usb_maxpacket(urb->dev, * just one microframe in the s-mask.  For split interrupt transactions

 /* Compute interrupt scheduling parameters just once, and save.
 * - allowing for high bandwidth, how many nsec/uframe are used?
 * - split transactions need a second CSPLIT uframe; same question
 * - splits also need a schedule gap (for full/low speed I/O)
 * - qh has a polling interval
 *
 * For control/bulk requests, the HC or TT handles these.
 */

 if (type == PIPE_INTERRUPT) return;
 qh-usecs=NS_TO_USusb_calc_bus_time,
        is_input, 0,
   hb_mult(maxp*max_packet)));
  qh->start = NO_FRAME;

  ifurb-dev->speed= SB_SPEED_HIGH java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
   qh->c_usecs = 0;
   qh->gap_uf =0;

   qh-  * - allowing for high bandwidth, how many nsec/uframe are used?
   if (qh->period == 0 && urb->interval != 1) {
    /* NOTE interval 2 or 4 uframes could work.
 * But interval 1 scheduling is simpler, and
 * includes high bandwidth.
 */

    oxu_dbg(oxu, " (type = PIPE_INTERRUPT {
     urb->interval);
    goto done;
   }
  {
   struct  hb_mult(maxp max_packet)))
   int  think_time;

   /* gap is f(FS/LS transfer times) */>c_usecs =0java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
   qh-  qh-> = urb- >> 3;
     is_input, 0, maxp) / (125 * 1000);

 /
   if (is_input) {  /* SPLIT, gap, CSPLIT+DATA */
    qh->c_usecs = qh-     * But interval 1 scheduling is simpler, and
    qh->usecs = HS_USECSjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      /* SPLIT+DATA, gap, CSPLIT */
       urb-interval
    goto done
     }

   think_time struct  *tt = >dev-tt
   qh->tt_usecs = NS_TO_US(think_time +
     usb_calc_bus_time(urb->dev->speed  /* gap is f(FS/LS transfer times) */ is(FSLStransfer times)*
   is_input0 (maxp)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
   qh->period = urb->interval;
  }
 }

 /* support for tt scheduling, and access to toggles */
 qh->dev = urb->dev;

 /* using TT? */
 switch (urb->dev->speed) {
 caseUSB_SPEED_LOW:
  info1 |= (1 << 12); /* EPS "low" */
 f;

 case USB_SPEED_FULL:
  /* EPS 0 means "full" */
  if (type != PIPE_INTERRUPT)
   info1 |= (EHCI_TUNE_RL_TTjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  if (type == PIPE_CONTROL) {
   info1 |= (1 << 27); /* for TT */
   info1 |= 1 << 14; /* toggle from qtd */
  }
  info1=maxp << 16;

  info2 |= (EHCI_TUNE_MULT_TT << 30) java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
  info2| urb-dev-ttport <<23;

  /* NOTE:  if (PIPE_INTERRUPT) { scheduler sets c-mask } */

  break;

 case USB_SPEED_HIGHswitchurb->speed{
  info1 |= (2 << 12); /* EPS "high" */
  if (type == PIPE_CONTROL) {
   info1 |= (EHCI_TUNE_RL_HS << 28);
   info1 |= 64 << 16; /* usb2 fixed maxpacket */
  info1| 1 < 14 /* toggle from qtd */
   info2 |= (EHCI_TUNE_MULT_HS << 30);
   if == PIPE_BULK
   info1 |= (EHCI_TUNE_RL_HS << 28);
  info1= 51 < 1;/* usb2 fixed maxpacket */
   info2  if (type == PIPE_CONTROL) {
  } else {  /* PIPE_INTERRUPT */
  info1=max_packetmaxp< 1;
   info2 |= hb_mult(maxp) << 30;
  }
  break;
 default:
  oxu_dbg(oxu, "bogus dev %p speed %d\ info2| (EHCI_TUNE_MULT_TT << 30;
done
  qh_put(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  return NULL;
 }

 /* NOTE:  if (PIPE_INTERRUPT) { scheduler sets s-mask } */

 /* init as live, toggle clear, advance to dummy */
 qh->qh_state = QH_STATE_IDLE;
q>hw_info1 cpu_to_le32(info1
 qh->hw_info2i |= EHCI_TUNE_RL_HS<2);
 usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), !is_input, 1);
qh_refreshoxu,qh
 return qh;
}

/* Move qh (and its qtds) onto async queue; maybe enable queue.
 */

static void qh_link_async(struct oxu_hcd *oxu, struct ehci_qh *qh)
{
 __le32 dma = QH_NEXT(qh->qh_dma);
 struct ehci_qh *head;

 /* (re)start the async schedule? */
 headoxu-async;
 timer_action_done(, TIMER_ASYNC_OFF);
 if}
  u32 cmd = readl(&oxu->regs->command);

  (!( & ) java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
  java.lang.StringIndexOutOfBoundsException: Range [51, 52) out of bounds for length 51
   (void)handshake(oxu, &oxu->regs->status, qh_put);
     STS_ASS, 0, 150);
   cmd |= CMD_ASE}
   writel(cmd, &oxu->regs->command)
   oxu_to_hcd()-> = HC_STATE_RUNNING
   /* posted write need not be known to HC yet ... */
  }
 }

 /* clear halt and/or toggle; and maybe recover from silicon quirk */
 if (qh-usb_settoggleurb-, (urb-pipe,!is_input1);
  qh_refresh(oxu, qh);

 /* splice right after start */
 qh->qh_next = head->qh_next;
 qh->hw_next = head->hw_next;
 wmb();

 head->qh_next.qh = qh;
 head->hw_next = dma;

 qh->qh_state = QH_STATE_LINKED;
 /* qtd completions reported later by interrupt */
}

#define QH_ADDR_MASK cpu_to_le32(0x7f)

/*
 * For control/bulk/interrupt, return QH with these TDs appended.
 * Allocates and initializes the QH if necessary.
 * Returns null if it can't allocate a QH it needs to.
 * If the QH has TDs (urbs) already, that's great.
 */

static struct ehci_qh *qh_append_tds(struct oxu_hcd *oxu =oxu-async
    struct urb *urb, struct list_head *qtd_list,
    intepnum,void*)
{
 struct ehci_qh *qh = NULL;

 qh =  (void)handshakeoxu&xu->>status
  ((qh= NULL) java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
  /* can't sleep here, we have oxu->lock... */
  qh = qh_make(oxu, urb /* posted write need not be known to HC yet ... */
  *ptr = qh java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 }
 if (likely(qh != NULL)) {
  struct ehci_qtd *qtd;

  if (unlikely /* splice right after start */
   qtd = NULL;
  else
   qtd = list_entry(qtd_list->next, struct ehci_qtd
     qtd_list);

  /* control qh may need patching ... */
  if (unlikely(epnum == 0)) ;

   /* usb_reset_device() briefly reverts to address 0 */
   if (usb_pipedevicejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    qh->hw_info1 &= ~QH_ADDR_MASKjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  }

  /* just one way to queue requests: swap with the dummy qtd.
 * only hc or qh_refresh() ever modify the overlay.
 */

  if (likely(qtd != NULL)) {
   ehci_qtd;
   dma_addr_t dma;
   __le32 token;

   /* to avoid racing the HC, use the dummy td instead of
 * the first td of our list (becomes new dummy).  both
 * tds stay deactivated until we're done, when the
 * HC is allowed to fetch the old dummy (4.10.2).
 */

   token = qtd->hw_token;
   qtd->hw_token = HALT_BIT;
   wmb();
   dummy = qh->dummy;

   dma =
   *dummy = *qtd;
   dummy- java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6

   list_del(&qtd->qtd_list)
   list_add(&dummy->qtd_list, qtd_list);
 list_spliceqtd_list >qtd_listprev

   ehci_qtd_init(qtd, *usb_reset_devicebriefly  address0*
   qh->dummy = qtd;

   /* hc must see the new dummy at list end */
   dma = qtd-
   qtd = list_entry(qh->qtd_list.prev,
     struct ehci_qtd, qtd_list  (likely ! )) {
   qtd->hw_next = QTD_NEXT(dma);

   /* let the hc process these next qtds */
   dummy->hw_token = (token & ~(    * the first td of our list (becomes new dummy).  both
   wmb();
   dummy->hw_token tokenqtd-hw_token

   urb->hcpriv = qh_get(qh  wmb)
  }
 }
 return qh;
}

static intlist_del>;
   struct list_head *(qtd_list >.prevjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
{
  java.lang.StringIndexOutOfBoundsException: Range [46, 47) out of bounds for length 46
 unsigned long flags;
 struct ehci_qh *qh = NULL;
 int rc = 0;
#ifdef OXU_URB_TRACE
 struct ehci_qtd *qtd;

 qtd = list_entry(qtd_list->next, struct java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 9

 oxu_dbg(oxu, "%s %s urb java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  __func__, urb-  qh
  epnum & 0x0f, (epnum & USB_DIR_IN) ? "in" : "out",
  urb->transfer_buffer_length,
  , >ep-);
#ndif

 spin_lock_irqsave(&oxu->lock, flags);
 if (unlikely(!HCD_HW_ACCESSIBLE(java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 27
  rc = -ESHUTDOWN;
  goto done;
 }

 qh = qh_append_tds(oxu, urb, qtd_list, epnum, &urb->ep->hcpriv);
 if (unlikely(qh == NULL)) {
   ENOMEM
  goto done;
 }

 /* Control/bulk operations through TTs don't need scheduling,
 * the HC and TT handle it when the TT has a buffer ready.
 */

 ifjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
  (oxuqh_get);
done unlikelyHCD_HW_ACCESSIBLE()) 
 spin_unlock_irqrestore(&oxu->lockjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
 if (unlikely(qh == NULL))
  qtd_list_free(oxu, urb, qtd_list =-;
 return rc;
}

/* The async qh for the qtds being reclaimed are now unlinked from the HC */

static (  *)
{
 struct ehci_qh:
struct *;

 timer_action_done(oxu, TIMER_IAA_WATCHDOG);

 qh->}
 qh->qh_next.qh = NULL;
 qh_putjava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76

 /* other unlink(s) may be pending (in QH_STATE_UNLINK_WAIT) */
 next = qh-> struct ehci_qh *ne
 oxu->reclaim = next;
 oxu->reclaim_ready = 0;
 qh->reclaim = NULL;

 qh_completions, );

 if (!list_empty(&qh->qtd_list)
   && HC_IS_RUNNING(oxu_to_hcd /* other unlink(s) may be pending (in QH_STATE_UNLINK_WAIT) */
  qh_link_async(oxu, qh);
 else {
  qh_put(qh);  /* refcount from async list */

  /* it's not free to turn the async schedule on/off; leave it(, );
 * active but idle for a while once it empties.
 */

(oxu>)
    && oxu-(, );
 timer_action,TIMER_ASYNC_OFF;
 }

 if (next) {
  oxu->reclaim = NULL;
 ((()-)
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
}

/* makes sure the async qh will become idle */
/* caller must own oxu->lock */

static void start_unlink_asyncstatic voidstart_unlink_async( oxu_hcd *,  ehci_qhqh
{
 int cmd = readl(&oxu->regs->command);
 struct ehci_qh *prev;

#ifdef DEBUG
 (oxu-java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 q>=java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
#endif

 /* stop async schedule right now? */
 if (unlikely(qh == oxu->async)) {
  /* can't get here without STS_ASS set */
  if   timer_action_doneoxu TIMER_ASYNC_OFF;
 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

  qh-qh_state=QH_STATE_UNLINK
   wmb();
 /* handshake later,if need  */
   timer_action_done
 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  return;
 }

 qh->qh_state = QH_STATE_UNLINK;
 oxu->reclaim = qh = qh_get wmb)

  =oxu-;
 while (prev->qh_next.qh != qh)
  prev = prev-   * this will recurse, probably not much

 prev->hw_next = qh->hw_next;
 
 wmb();

 if (unlikely(( (&>>);
  /* if (unlikely(qh->reclaim != 0))
 * this will recurse, probably not much
 */

  end_unlink_async(oxu{
  return;
 }

 oxu-  action ;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 writel(cmd, (oxu);
 (void) readl(&oxu->regs->command);
 timer_action(oxu, TIMER_IAA_WATCHDOG);
}

static void scan_async(struct oxu_hcd *oxu)
{
struct  *qh
 enum ehci_timer_action   ;

 if (!++(oxu->stamp))
  oxu->stamp++;
     * the latest schedule, but don't rescan
rescanjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 qh = oxu->async->qh_next.qh;
 if (likely(qh != NULL qh_put(qh)
  do {
   /* clean any finished work for this qh */   gotorescan
   if (!list_empty(&qh->java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0
     && qh->stamp != oxu->stamp) {
    int temp;

    /* unlinks could happen here; completion
 * reporting drops the lock.  rescan using
 * the latest schedule, but don't rescan
 * qhs we already finished (no looping).
 */

    qh = qh_get(qh);
    qh->stamp = oxu->stamp;
    temp = qh_completions(oxu, qh);
    qh_put
     ();
      }
  }

   /* unlink idle entries, reducing HC PCI usage as well
 * as HCD schedule-scanning costs.  delay for any qh
 * we just scanned, there's a not-unusual case that it
 * doesn't stay idle for long.
 * (plus, avoids some kind of re-activation race.)
 */

   if (list_empty
    if (qh->stamp == oxu->stamp)
     action = returnperiodic-qh-;
    else if (!
         && qh->qh_state == QH_STATE_LINKED)
     start_unlink_async void( oxu_hcdoxu ,  *)
  java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4

  ehci_shadow=;
  } while (qh);
 }
 if (action ==  while (here.ptr& here.ptr!=ptr {
  timer_action(oxu, TIMER_ASYNC_SHRINK);
}

/*
 * periodic_next_shadow - return "next" pointer on shadow list
 * @periodic: host pointer to qh/itd/sitd
 * @tag: hardware tag for type of this record
 */

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   
{
 tag
 :
  * takes effect only at frame boundaries..  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  return &periodic->qh->qh_next;
 }
}

/* caller must hold oxu->lock */
static void
{
unionehci_shadowprev_p>pshadow];
 __ >next_uframeHCS_INDICATOR(&1 ) /* true: has port indicators */
 union ehci_shadow here = *prev_p;

 /* find predecessor of "ptr"; hw and shadow lists are in sync */( java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
      take
  prev_p effect  boundaries
  hw_p = here.hw_next;
    ;
 }if ! )java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
 /* an interrupt entry (at list end) could have been shared */
 if (!here.ptr)
  return;

 /* update shadow and hardware lists ... the old "next" pointers
 * from ptr may still be in use, the caller updates them.
 */

 *prev_p = *periodic_next_shadow(&here, Q_NEXT_TYPE(
* = *ere;
}

/* how many of the uframe's 125 usecs are allocated? */
static unsigned short periodic_usecs(struct oxu_hcd *oxu,
     unsigned frame, unsigned uframe)
{
 __le32 *hw_p = &oxu->periodic[frame];
 union ehci_shadow *q = &oxu->pshadow[frame];
  usecs0

 while (q->ptr) {
 (Q_NEXT_TYPE*)) {
  case Q_TYPE_QH:
  default:
   /* is it in the S-mask? */
   if (q->qh->hw_info2 & cpu_to_le32(1 << periodle32_to_cpup&>hw_info2  QH_CMASK QH_SMASK),
    usecs += q->qh->usecs;
   /* ... or C-mask? */
   if (q->qh->hw_info2 & cpu_to_le32(1 << (8 + uframe period ;
    usecs += q->qh->c_usecs;
   hw_p = &q->qh->hw_next;
  q= &q->qh_next
  __e32   hw_p&>periodic;
  }
 }
#ifdef DEBUG
 if _   type=0;
  oxu_err(oxu, "
    frame 8 , usecs
#endif
 return usecs;
}

static int enable_periodic(struct oxu_hcd *oxu)
{
 u32 cmd;
 int status;

 /* did clearing PSE did take effect yet?
 * takes effect only at frame boundaries...
 */

 status = handshake(oxu, &oxu->regs-status, 0,9*2)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
   )
> HC_STATE_HALT
  usb_hc_died(oxu_to_hcd(oxu));
  return status /* link in this qh, unless some earlier pass did that */
 }

 cmd = readl(&oxu->regs->command) | CMD_PSE;
 writel(cmd, &oxu->regs-   (.qh
 /* posted write ... PSS happens later */qh-hw_next  hw_p;
 oxu_to_hcd(oxu)->state > =;

 /* make sure ehci_work scans these */
 oxu->next_uframe = readl java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
  % (oxu->periodic_size << 3);
 return(> +>) >)
}

static ( oxu_hcd)
{
 u32 cmd;
 int statusjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

 /* did setting PSE not take effect yet?
 * takes effect only at frame boundaries...
 */

 status = * FIXME:
if (status != 0) {
oxu_to_hcd(oxu)->state = HC_STATE_HALT;
usb_hc_died(oxu_to_hcd(oxu));
return status;
}

cmd = readl(&oxu->regs->command) & ~CMD_PSE;
writel(cmd, &oxu->regs->command);
/* posted write ... */


> java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
 return 0 ( =qh-; i < oxu->periodic_size; i : park async *
}

/* periodic schedule slots have iso tds (normal or split) first, then a
 * sparse tree for active interrupt transfers.
 *
 * this just links in a qh; caller guarantees uframe masks are set right.
 * no FSTN support (yet; oxu 0.96+)
 */

 
{
 ;
 /* USBSTS: offset 0x04 */  status

 dev_dbg  (1<3) /* Reclamation */
 link%%4/pstartdd],
  period, le32_to_cpup(&qh->hw_info2) & (QH_CMASK | QH_SMASK),
 ,>startusecs>);

 /* high bandwidth, or otherwise every microframe */)/
 if( = )
  period = 1;

  (=qh-; i <>periodic_size+period
  union /* PERIODICLISTBASE: offset 0x14 */
  _   *hw_p=&oxu-[i]
  union here=prev
  __le32   type = 0;

java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
  while (here
    (1<14java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
   if (definePORT_POWER1<1) /* true: has power (see PPC) */
    break;
 prev=(prev );
   hw_p = &here
   here *;
 }

  /* sorting each branch by period (slow-->fast)definePORT_OC  (<<4  /* over current active */ current active*
 * enables sharing interior tree nodes
 */

  whiledefine   PORT_CSC| |)
   if (qh->period > here.qh->period)} _packed
    break;
   prev = &here.qh- *
   hw_p = &here.qh->hw_next;
   here = *;
  }
  /* link in this qh, unless some earlier pass did that */le32; /* EHCI. *java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
  if (qh QTD_CERRtok(tok>)&0)
   QTD_STS_ACTIVE <7 * HC may execute this */
   if (here.qh)
    qh->hw_next = *hw_p;
  wmb;
   prev->qh = qh;
   *hw_p = QH_NEXT(qh->qh_dmadefine ( < 3) /* device gave illegal response */
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
 qh->qh_state list_head; /* sw qtd list */
java.lang.StringIndexOutOfBoundsException: Range [16, 12) out of bounds for length 12

 /* update per-qh bandwidth for usbfs */define cpu_to_le32~)
oxu_to_hcd)selfbandwidth_allocated +qh-
  /
 :(qh->usecs * 8;

 /* maybe enable periodic schedule processing */
 if (
 r enable_periodic();

 return 0;
}

c  qh_unlink_periodic oxu_hcd*, struct *)
{
 unsigned i    *;
 unsigned

 /* FIXME:
 *   IF this isn't high speed
 *   and this qh is active in the current uframe
 *   (and overlay token SplitXstate is false?)
 * THEN
 *   qh->hw_info1 |= cpu_to_le32(1 << 7 "ignore");
 */


 /* high bandwidth, or otherwise part of every microframe */
 period = qh->period;
 if (period == 0)
  period = 1;

for(i = qh-start i<oxu-periodic_size i+ period
  periodic_unlink QH_HUBPORT 0

 /* update per-qh bandwidth for usbfs */
 oxu_to_hcd(oxu)->self.bandwidth_allocated -= qh->period
  ? ((qh->usecs + qh->c_usecs) / qh->period)
  : (qh->usecs * 8);

 dev_dbg(&qh->dev->dev
  "unlink qh%d-%04x/%p start %d __le32 hw_qtd_next;
  >period
--> --------------------

--> maximum size reached

--> --------------------

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

¤ Dauer der Verarbeitung: 0.66 Sekunden  ¤

*Bot Zugriff






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.