1 /* 2 * Dongle BUS interface Abstraction layer 3 * target serial buses like USB, SDIO, SPI, etc. 4 * 5 * Copyright (C) 1999-2019, Broadcom. 6 * 7 * Unless you and Broadcom execute a separate written software license 8 * agreement governing use of this software, this software is licensed to you 9 * under the terms of the GNU General Public License version 2 (the "GPL"), 10 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 11 * following added to such license: 12 * 13 * As a special exception, the copyright holders of this software give you 14 * permission to link this software with independent modules, and to copy and 15 * distribute the resulting executable under terms of your choice, provided that 16 * you also meet, for each linked independent module, the terms and conditions 17 * of the license of that module. An independent module is a module which is 18 * not derived from this software. The special exception does not apply to any 19 * modifications of the software. 20 * 21 * Notwithstanding the above, under no circumstances may you combine this 22 * software in any way with any other Broadcom software provided under a license 23 * other than the GPL, without Broadcom's express prior written consent. 24 * 25 * 26 * <<Broadcom-WL-IPTag/Open:>> 27 * 28 * $Id: dbus.h 686618 2017-02-23 07:20:43Z $ 29 */ 30 31 #ifndef __DBUS_H__ 32 #define __DBUS_H__ 33 34 #include "typedefs.h" 35 #include <dhd_linux.h> 36 37 extern uint dbus_msglevel; 38 #define DBUS_ERROR_VAL 0x0001 39 #define DBUS_TRACE_VAL 0x0002 40 #define DBUS_INFO_VAL 0x0004 41 42 #if defined(DHD_DEBUG) 43 #define DBUSERR(args) \ 44 do { \ 45 if (dbus_msglevel & DBUS_ERROR_VAL) \ 46 printf args; \ 47 } while (0) 48 #define DBUSTRACE(args) \ 49 do { \ 50 if (dbus_msglevel & DBUS_TRACE_VAL) \ 51 printf args; \ 52 } while (0) 53 #define DBUSINFO(args) \ 54 do { \ 55 if (dbus_msglevel & DBUS_INFO_VAL) \ 56 printf args; \ 57 } while (0) 58 #else /* defined(DHD_DEBUG) */ 59 #define DBUSERR(args) 60 #define DBUSTRACE(args) 61 #define DBUSINFO(args) 62 #endif 63 64 enum { 65 DBUS_OK = 0, 66 DBUS_ERR = -200, 67 DBUS_ERR_TIMEOUT, 68 DBUS_ERR_DISCONNECT, 69 DBUS_ERR_NODEVICE, 70 DBUS_ERR_UNSUPPORTED, 71 DBUS_ERR_PENDING, 72 DBUS_ERR_NOMEM, 73 DBUS_ERR_TXFAIL, 74 DBUS_ERR_TXTIMEOUT, 75 DBUS_ERR_TXDROP, 76 DBUS_ERR_RXFAIL, 77 DBUS_ERR_RXDROP, 78 DBUS_ERR_TXCTLFAIL, 79 DBUS_ERR_RXCTLFAIL, 80 DBUS_ERR_REG_PARAM, 81 DBUS_STATUS_CANCELLED, 82 DBUS_ERR_NVRAM, 83 DBUS_JUMBO_NOMATCH, 84 DBUS_JUMBO_BAD_FORMAT, 85 DBUS_NVRAM_NONTXT, 86 DBUS_ERR_RXZLP 87 }; 88 89 #define BCM_OTP_SIZE_43236 84 /* number of 16 bit values */ 90 #define BCM_OTP_SW_RGN_43236 24 /* start offset of SW config region */ 91 #define BCM_OTP_ADDR_43236 0x18000800 /* address of otp base */ 92 93 #define ERR_CBMASK_TXFAIL 0x00000001 94 #define ERR_CBMASK_RXFAIL 0x00000002 95 #define ERR_CBMASK_ALL 0xFFFFFFFF 96 97 #define DBUS_CBCTL_WRITE 0 98 #define DBUS_CBCTL_READ 1 99 #if defined(INTR_EP_ENABLE) 100 #define DBUS_CBINTR_POLL 2 101 #endif /* defined(INTR_EP_ENABLE) */ 102 103 #define DBUS_TX_RETRY_LIMIT 3 /* retries for failed txirb */ 104 #define DBUS_TX_TIMEOUT_INTERVAL 250 /* timeout for txirb complete, in ms */ 105 106 #define DBUS_BUFFER_SIZE_TX 32000 107 #define DBUS_BUFFER_SIZE_RX 24000 108 109 #define DBUS_BUFFER_SIZE_TX_NOAGG 2048 110 #define DBUS_BUFFER_SIZE_RX_NOAGG 2048 111 112 /** DBUS types */ 113 enum { DBUS_USB, DBUS_SDIO, DBUS_SPI, DBUS_UNKNOWN }; 114 115 enum dbus_state { 116 DBUS_STATE_DL_PENDING, 117 DBUS_STATE_DL_DONE, 118 DBUS_STATE_UP, 119 DBUS_STATE_DOWN, 120 DBUS_STATE_PNP_FWDL, 121 DBUS_STATE_DISCONNECT, 122 DBUS_STATE_SLEEP, 123 DBUS_STATE_DL_NEEDED 124 }; 125 126 enum dbus_pnp_state { DBUS_PNP_DISCONNECT, DBUS_PNP_SLEEP, DBUS_PNP_RESUME }; 127 128 enum dbus_file { DBUS_FIRMWARE, DBUS_NVFILE }; 129 130 typedef enum _DEVICE_SPEED { 131 INVALID_SPEED = -1, 132 LOW_SPEED = 1, /**< USB 1.1: 1.5 Mbps */ 133 FULL_SPEED, /**< USB 1.1: 12 Mbps */ 134 HIGH_SPEED, /**< USB 2.0: 480 Mbps */ 135 SUPER_SPEED, /**< USB 3.0: 4.8 Gbps */ 136 } DEVICE_SPEED; 137 138 typedef struct { 139 int bustype; 140 int vid; 141 int pid; 142 int devid; 143 int chiprev; /**< chip revsion number */ 144 int mtu; 145 int nchan; /**< Data Channels */ 146 int has_2nd_bulk_in_ep; 147 } dbus_attrib_t; 148 149 /* FIX: Account for errors related to DBUS; 150 * Let upper layer account for packets/bytes 151 */ 152 typedef struct { 153 uint32 rx_errors; 154 uint32 tx_errors; 155 uint32 rx_dropped; 156 uint32 tx_dropped; 157 } dbus_stats_t; 158 159 /** 160 * Configurable BUS parameters 161 */ 162 enum { 163 DBUS_CONFIG_ID_RXCTL_DEFERRES = 1, 164 DBUS_CONFIG_ID_AGGR_LIMIT, 165 DBUS_CONFIG_ID_KEEPIF_ON_DEVRESET 166 }; 167 168 typedef struct { 169 uint32 config_id; 170 union { 171 uint32 general_param; 172 bool rxctl_deferrespok; 173 struct { 174 int maxrxsf; 175 int maxrxsize; 176 int maxtxsf; 177 int maxtxsize; 178 } aggr_param; 179 }; 180 } dbus_config_t; 181 182 /** 183 * External Download Info 184 */ 185 typedef struct dbus_extdl { 186 uint8 *fw; 187 int fwlen; 188 uint8 *vars; 189 int varslen; 190 } dbus_extdl_t; 191 192 struct dbus_callbacks; 193 struct exec_parms; 194 195 typedef void *(*probe_cb_t)(void *arg, const char *desc, uint32 bustype, 196 uint16 bus_no, uint16 slot, uint32 hdrlen); 197 typedef void (*disconnect_cb_t)(void *arg); 198 typedef void *(*exec_cb_t)(struct exec_parms *args); 199 200 /** Client callbacks registered during dbus_attach() */ 201 typedef struct dbus_callbacks { 202 void (*send_complete)(void *cbarg, void *info, int status); 203 void (*recv_buf)(void *cbarg, uint8 *buf, int len); 204 void (*recv_pkt)(void *cbarg, void *pkt); 205 void (*txflowcontrol)(void *cbarg, bool onoff); 206 void (*errhandler)(void *cbarg, int err); 207 void (*ctl_complete)(void *cbarg, int type, int status); 208 void (*state_change)(void *cbarg, int state); 209 void *(*pktget)(void *cbarg, uint len, bool send); 210 void (*pktfree)(void *cbarg, void *p, bool send); 211 } dbus_callbacks_t; 212 213 struct dbus_pub; 214 struct bcmstrbuf; 215 struct dbus_irb; 216 struct dbus_irb_rx; 217 struct dbus_irb_tx; 218 struct dbus_intf_callbacks; 219 220 typedef struct { 221 void *(*attach)(struct dbus_pub *pub, void *cbarg, 222 struct dbus_intf_callbacks *cbs); 223 void (*detach)(struct dbus_pub *pub, void *bus); 224 225 int (*up)(void *bus); 226 int (*down)(void *bus); 227 int (*send_irb)(void *bus, struct dbus_irb_tx *txirb); 228 int (*recv_irb)(void *bus, struct dbus_irb_rx *rxirb); 229 int (*cancel_irb)(void *bus, struct dbus_irb_tx *txirb); 230 int (*send_ctl)(void *bus, uint8 *buf, int len); 231 int (*recv_ctl)(void *bus, uint8 *buf, int len); 232 int (*get_stats)(void *bus, dbus_stats_t *stats); 233 int (*get_attrib)(void *bus, dbus_attrib_t *attrib); 234 235 int (*pnp)(void *bus, int evnt); 236 int (*remove)(void *bus); 237 int (*resume)(void *bus); 238 int (*suspend)(void *bus); 239 int (*stop)(void *bus); 240 int (*reset)(void *bus); 241 242 /* Access to bus buffers directly */ 243 void *(*pktget)(void *bus, int len); 244 void (*pktfree)(void *bus, void *pkt); 245 246 int (*iovar_op)(void *bus, const char *name, void *params, int plen, 247 void *arg, int len, bool set); 248 void (*dump)(void *bus, struct bcmstrbuf *strbuf); 249 int (*set_config)(void *bus, dbus_config_t *config); 250 int (*get_config)(void *bus, dbus_config_t *config); 251 252 bool (*device_exists)(void *bus); 253 int (*dlneeded)(void *bus); 254 int (*dlstart)(void *bus, uint8 *fw, int len); 255 int (*dlrun)(void *bus); 256 bool (*recv_needed)(void *bus); 257 258 void *(*exec_rxlock)(void *bus, exec_cb_t func, struct exec_parms *args); 259 void *(*exec_txlock)(void *bus, exec_cb_t func, struct exec_parms *args); 260 261 int (*tx_timer_init)(void *bus); 262 int (*tx_timer_start)(void *bus, uint timeout); 263 int (*tx_timer_stop)(void *bus); 264 265 int (*sched_dpc)(void *bus); 266 int (*lock)(void *bus); 267 int (*unlock)(void *bus); 268 int (*sched_probe_cb)(void *bus); 269 270 int (*shutdown)(void *bus); 271 272 int (*recv_stop)(void *bus); 273 int (*recv_resume)(void *bus); 274 275 int (*recv_irb_from_ep)(void *bus, struct dbus_irb_rx *rxirb, uint ep_idx); 276 277 int (*readreg)(void *bus, uint32 regaddr, int datalen, uint32 *value); 278 279 /* Add from the bottom */ 280 } dbus_intf_t; 281 282 typedef struct dbus_pub { 283 struct osl_info *osh; 284 dbus_stats_t stats; 285 dbus_attrib_t attrib; 286 enum dbus_state busstate; 287 DEVICE_SPEED device_speed; 288 int ntxq, nrxq, rxsize; 289 void *bus; 290 struct shared_info *sh; 291 void *dev_info; 292 } dbus_pub_t; 293 294 #define BUS_INFO(bus, type) (((type *)bus)->pub->bus) 295 296 #define ALIGNED_LOCAL_VARIABLE(var, align) \ 297 uint8 buffer[SDALIGN + 64]; \ 298 uint8 *var = (uint8 *)(((uintptr)&buffer[0]) & ~(align - 1)) + align; 299 300 /* 301 * Public Bus Function Interface 302 */ 303 304 /* 305 * FIX: Is there better way to pass OS/Host handles to DBUS but still 306 * maintain common interface for all OS?? 307 * Under NDIS, param1 needs to be MiniportHandle 308 * For NDIS60, param2 is WdfDevice 309 * Under Linux, param1 and param2 are NULL; 310 */ 311 extern int dbus_register(int vid, int pid, probe_cb_t prcb, 312 disconnect_cb_t discb, void *prarg, void *param1, 313 void *param2); 314 extern int dbus_deregister(void); 315 extern int dbus_down(dbus_pub_t *pub); 316 extern int dbus_shutdown(dbus_pub_t *pub); 317 extern void dbus_flowctrl_rx(dbus_pub_t *pub, bool on); 318 319 extern int dbus_send_txdata(dbus_pub_t *dbus, void *pktbuf); 320 extern int dbus_send_buf(dbus_pub_t *pub, uint8 *buf, int len, void *info); 321 extern int dbus_send_pkt(dbus_pub_t *pub, void *pkt, void *info); 322 extern int dbus_recv_bulk(dbus_pub_t *pub, uint32 ep_idx); 323 extern int dbus_poll_intr(dbus_pub_t *pub); 324 extern int dbus_get_stats(dbus_pub_t *pub, dbus_stats_t *stats); 325 extern int dbus_get_device_speed(dbus_pub_t *pub); 326 extern int dbus_set_config(dbus_pub_t *pub, dbus_config_t *config); 327 extern int dbus_get_config(dbus_pub_t *pub, dbus_config_t *config); 328 extern void *dbus_get_devinfo(dbus_pub_t *pub); 329 330 extern void *dbus_pktget(dbus_pub_t *pub, int len); 331 extern void dbus_pktfree(dbus_pub_t *pub, void *pkt); 332 333 extern int dbus_set_errmask(dbus_pub_t *pub, uint32 mask); 334 extern int dbus_pnp_sleep(dbus_pub_t *pub); 335 extern int dbus_pnp_resume(dbus_pub_t *pub, int *fw_reload); 336 extern int dbus_pnp_disconnect(dbus_pub_t *pub); 337 338 extern void *dhd_dbus_txq(const dbus_pub_t *pub); 339 extern uint dhd_dbus_hdrlen(const dbus_pub_t *pub); 340 341 /* 342 * Private Common Bus Interface 343 */ 344 345 /** IO Request Block (IRB) */ 346 typedef struct dbus_irb { 347 struct dbus_irb 348 *next; /**< it's casted from dbus_irb_tx or dbus_irb_rx struct */ 349 } dbus_irb_t; 350 351 typedef struct dbus_irb_rx { 352 struct dbus_irb irb; /* Must be first */ 353 uint8 *buf; 354 int buf_len; 355 int actual_len; 356 void *pkt; 357 void *info; 358 void *arg; 359 } dbus_irb_rx_t; 360 361 typedef struct dbus_irb_tx { 362 struct dbus_irb irb; /** Must be first */ 363 uint8 *buf; /** mutually exclusive with struct member 'pkt' */ 364 int len; /** length of field 'buf' */ 365 void *pkt; /** mutually exclusive with struct member 'buf' */ 366 int retry_count; 367 void *info; 368 void *arg; 369 void 370 *send_buf; /**< linear bufffer for LINUX when aggreagtion is enabled */ 371 } dbus_irb_tx_t; 372 373 /** 374 * DBUS interface callbacks are different from user callbacks 375 * so, internally, different info can be passed to upper layer 376 */ 377 typedef struct dbus_intf_callbacks { 378 void (*send_irb_timeout)(void *cbarg, dbus_irb_tx_t *txirb); 379 void (*send_irb_complete)(void *cbarg, dbus_irb_tx_t *txirb, int status); 380 void (*recv_irb_complete)(void *cbarg, dbus_irb_rx_t *rxirb, int status); 381 void (*errhandler)(void *cbarg, int err); 382 void (*ctl_complete)(void *cbarg, int type, int status); 383 void (*state_change)(void *cbarg, int state); 384 bool (*isr)(void *cbarg, bool *wantdpc); 385 bool (*dpc)(void *cbarg, bool bounded); 386 void (*watchdog)(void *cbarg); 387 void *(*pktget)(void *cbarg, uint len, bool send); 388 void (*pktfree)(void *cbarg, void *p, bool send); 389 struct dbus_irb *(*getirb)(void *cbarg, bool send); 390 void (*rxerr_indicate)(void *cbarg, bool on); 391 } dbus_intf_callbacks_t; 392 393 /* 394 * Porting: To support new bus, port these functions below 395 */ 396 397 /* 398 * Bus specific Interface 399 * Implemented by dbus_usb.c/dbus_sdio.c 400 */ 401 extern int dbus_bus_register(int vid, int pid, probe_cb_t prcb, 402 disconnect_cb_t discb, void *prarg, 403 dbus_intf_t **intf, void *param1, void *param2); 404 extern int dbus_bus_deregister(void); 405 extern void dbus_bus_fw_get(void *bus, uint8 **fw, int *fwlen, int *decomp); 406 407 /* 408 * Bus-specific and OS-specific Interface 409 * Implemented by dbus_usb_[linux/ndis].c/dbus_sdio_[linux/ndis].c 410 */ 411 extern int dbus_bus_osl_register(int vid, int pid, probe_cb_t prcb, 412 disconnect_cb_t discb, void *prarg, 413 dbus_intf_t **intf, void *param1, 414 void *param2); 415 extern int dbus_bus_osl_deregister(void); 416 417 /* 418 * Bus-specific, OS-specific, HW-specific Interface 419 * Mainly for SDIO Host HW controller 420 */ 421 extern int dbus_bus_osl_hw_register(int vid, int pid, probe_cb_t prcb, 422 disconnect_cb_t discb, void *prarg, 423 dbus_intf_t **intf); 424 extern int dbus_bus_osl_hw_deregister(void); 425 426 extern uint usbdev_bulkin_eps(void); 427 #if defined(BCM_REQUEST_FW) 428 extern void *dbus_get_fw_nvfile(int devid, int chiprev, uint8 **fw, int *fwlen, 429 int type, uint16 boardtype, uint16 boardrev); 430 extern void dbus_release_fw_nvfile(void *firmware); 431 #endif /* #if defined(BCM_REQUEST_FW) */ 432 433 #if defined(EHCI_FASTPATH_TX) || defined(EHCI_FASTPATH_RX) 434 435 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) 436 /* Backward compatibility */ 437 typedef unsigned int gfp_t; 438 439 #define dma_pool pci_pool 440 #define dma_pool_create(name, dev, size, align, alloc) \ 441 pci_pool_create(name, dev, size, align, alloc, GFP_DMA | GFP_ATOMIC) 442 #define dma_pool_destroy(pool) pci_pool_destroy(pool) 443 #define dma_pool_alloc(pool, flags, handle) pci_pool_alloc(pool, flags, handle) 444 #define dma_pool_free(pool, vaddr, addr) pci_pool_free(pool, vaddr, addr) 445 446 #define dma_map_single(dev, addr, size, dir) \ 447 pci_map_single(dev, addr, size, dir) 448 #define dma_unmap_single(dev, hnd, size, dir) \ 449 pci_unmap_single(dev, hnd, size, dir) 450 #define DMA_FROM_DEVICE PCI_DMA_FROMDEVICE 451 #define DMA_TO_DEVICE PCI_DMA_TODEVICE 452 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) */ 453 454 /* Availability of these functions varies (when present, they have two 455 * arguments) */ 456 #ifndef hc32_to_cpu 457 #define hc32_to_cpu(x) le32_to_cpu(x) 458 #define cpu_to_hc32(x) cpu_to_le32(x) 459 typedef unsigned int __hc32; 460 #else 461 #error Two-argument functions needed 462 #endif // endif 463 464 /* Private USB opcode base */ 465 #define EHCI_FASTPATH 0x31 466 #define EHCI_SET_EP_BYPASS EHCI_FASTPATH 467 #define EHCI_SET_BYPASS_CB (EHCI_FASTPATH + 1) 468 #define EHCI_SET_BYPASS_DEV (EHCI_FASTPATH + 2) 469 #define EHCI_DUMP_STATE (EHCI_FASTPATH + 3) 470 #define EHCI_SET_BYPASS_POOL (EHCI_FASTPATH + 4) 471 #define EHCI_CLR_EP_BYPASS (EHCI_FASTPATH + 5) 472 473 /* 474 * EHCI QTD structure (hardware and extension) 475 * NOTE that is does not need to (and does not) match its kernel counterpart 476 */ 477 #define EHCI_QTD_NBUFFERS 5 478 #define EHCI_QTD_ALIGN 32 479 #define EHCI_BULK_PACKET_SIZE 512 480 #define EHCI_QTD_XACTERR_MAX 32 481 482 struct ehci_qtd { 483 /* Hardware map */ 484 volatile uint32_t qtd_next; 485 volatile uint32_t qtd_altnext; 486 volatile uint32_t qtd_status; 487 #define EHCI_QTD_GET_BYTES(x) (((x) >> 16) & 0x7fff) 488 #define EHCI_QTD_IOC 0x00008000 489 #define EHCI_QTD_GET_CERR(x) (((x) >> 10) & 0x3) 490 #define EHCI_QTD_SET_CERR(x) ((x) << 10) 491 #define EHCI_QTD_GET_PID(x) (((x) >> 8) & 0x3) 492 #define EHCI_QTD_SET_PID(x) ((x) << 8) 493 #define EHCI_QTD_ACTIVE 0x80 494 #define EHCI_QTD_HALTED 0x40 495 #define EHCI_QTD_BUFERR 0x20 496 #define EHCI_QTD_BABBLE 0x10 497 #define EHCI_QTD_XACTERR 0x08 498 #define EHCI_QTD_MISSEDMICRO 0x04 499 volatile uint32_t qtd_buffer[EHCI_QTD_NBUFFERS]; 500 volatile uint32_t qtd_buffer_hi[EHCI_QTD_NBUFFERS]; 501 502 /* Implementation extension */ 503 dma_addr_t qtd_self; /**< own hardware address */ 504 struct ehci_qtd *obj_next; /**< software link to the next QTD */ 505 void *rpc; /**< pointer to the rpc buffer */ 506 size_t length; /**< length of the data in the buffer */ 507 void *buff; /**< pointer to the reassembly buffer */ 508 int xacterrs; /**< retry counter for qtd xact error */ 509 } __attribute__((aligned(EHCI_QTD_ALIGN))); 510 511 #define EHCI_NULL __constant_cpu_to_le32(1) /* HW null pointer shall be odd */ 512 513 #define SHORT_READ_Q(token) \ 514 (EHCI_QTD_GET_BYTES(token) != 0 && EHCI_QTD_GET_PID(token) == 1) 515 516 /** 517 * Queue Head 518 * NOTE This structure is slightly different from the one in the kernel; but 519 * needs to stay compatible. 520 */ 521 struct ehci_qh { 522 /* Hardware map */ 523 volatile uint32_t qh_link; 524 volatile uint32_t qh_endp; 525 volatile uint32_t qh_endphub; 526 volatile uint32_t qh_curqtd; 527 528 /* QTD overlay */ 529 volatile uint32_t ow_next; 530 volatile uint32_t ow_altnext; 531 volatile uint32_t ow_status; 532 volatile uint32_t ow_buffer[EHCI_QTD_NBUFFERS]; 533 volatile uint32_t ow_buffer_hi[EHCI_QTD_NBUFFERS]; 534 535 /* Extension (should match the kernel layout) */ 536 dma_addr_t unused0; 537 void *unused1; 538 struct list_head unused2; 539 struct ehci_qtd *dummy; 540 struct ehci_qh *unused3; 541 542 struct ehci_hcd *unused4; 543 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) 544 struct kref unused5; 545 unsigned unused6; 546 547 uint8_t unused7; 548 549 /* periodic schedule info */ 550 uint8_t unused8; 551 uint8_t unused9; 552 uint8_t unused10; 553 uint16_t unused11; 554 uint16_t unused12; 555 uint16_t unused13; 556 struct usb_device *unused14; 557 #else 558 unsigned unused5; 559 560 u8 unused6; 561 562 /* periodic schedule info */ 563 u8 unused7; 564 u8 unused8; 565 u8 unused9; 566 unsigned short unused10; 567 unsigned short unused11; 568 #define NO_FRAME ((unsigned short)~0) 569 #ifdef EHCI_QUIRK_FIX 570 struct usb_device *unused12; 571 #endif /* EHCI_QUIRK_FIX */ 572 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) */ 573 struct ehci_qtd *first_qtd; 574 /* Link to the first QTD; this is an optimized equivalent of the qtd_list 575 * field */ 576 /* NOTE that ehci_qh in ehci.h shall reserve this word */ 577 } __attribute__((aligned(EHCI_QTD_ALIGN))); 578 579 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) 580 /** The corresponding structure in the kernel is used to get the QH */ 581 struct hcd_dev { /* usb_device.hcpriv points to this */ 582 struct list_head unused0; 583 struct list_head unused1; 584 585 /* array of QH pointers */ 586 void *ep[32]; 587 }; 588 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) */ 589 590 int optimize_qtd_fill_with_rpc(const dbus_pub_t *pub, int epn, 591 struct ehci_qtd *qtd, void *rpc, int token, 592 int len); 593 int optimize_qtd_fill_with_data(const dbus_pub_t *pub, int epn, 594 struct ehci_qtd *qtd, void *data, int token, 595 int len); 596 int optimize_submit_async(struct ehci_qtd *qtd, int epn); 597 void inline optimize_ehci_qtd_init(struct ehci_qtd *qtd, dma_addr_t dma); 598 struct ehci_qtd *optimize_ehci_qtd_alloc(gfp_t flags); 599 void optimize_ehci_qtd_free(struct ehci_qtd *qtd); 600 void optimize_submit_rx_request(const dbus_pub_t *pub, int epn, 601 struct ehci_qtd *qtd_in, void *buf); 602 #endif /* EHCI_FASTPATH_TX || EHCI_FASTPATH_RX */ 603 604 void dbus_flowctrl_tx(void *dbi, bool on); 605 #endif /* __DBUS_H__ */ 606