source: mainline/uspace/drv/bus/usb/xhci/hc.h@ 327f147

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 327f147 was 2b61945, checked in by Ondřej Hlavatý <aearsis@…>, 8 years ago

xhci: use device_t for bookkeeping

This started as a little refactoring to move active transfer batch to endpoint. Finding the EP in handler needs devices indexed by slot id. Then I found out we do not use the device_t extendable mechanism. Then there were a lot of errors found while doing all this…

  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[5cbccd4]1/*
2 * Copyright (c) 2017 Ondrej Hlavaty
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup drvusbxhci
30 * @{
31 */
32/** @file
33 * @brief The host controller data bookkeeping.
34 */
35
[115f25b]36#ifndef XHCI_HC_H
37#define XHCI_HC_H
38
[74b852b]39#include <fibril_synch.h>
[e4d7363]40#include <usb/host/usb_transfer_batch.h>
[5cbccd4]41#include "hw_struct/regs.h"
[cb89430]42#include "hw_struct/context.h"
[fd9f4ffe]43#include "scratchpad.h"
[cb89430]44#include "trb_ring.h"
[d32d51d]45#include "rh.h"
[41924f30]46#include "bus.h"
[5cbccd4]47
48typedef struct xhci_hc {
[91ca111]49 /* MMIO range */
50 addr_range_t mmio_range;
51
52 /* Mapped register sets */
[20eaa82]53 void *reg_base;
[5cbccd4]54 xhci_cap_regs_t *cap_regs;
55 xhci_op_regs_t *op_regs;
[62ba2cbe]56 xhci_rt_regs_t *rt_regs;
57 xhci_doorbell_t *db_arry;
[91ca111]58 xhci_extcap_t *xecp; /**< First extended capability */
59 xhci_legsup_t *legsup; /**< Legacy support capability */
[cb89430]60
[91ca111]61 /* Structures in allocated memory */
[cb89430]62 xhci_trb_ring_t command_ring;
63 xhci_event_ring_t event_ring;
[73e5b62]64 uint64_t *dcbaa;
[fd9f4ffe]65 xhci_scratchpad_t *scratchpad;
[cb89430]66
[07c08ea]67 /* Root hub emulation */
[d32d51d]68 xhci_rh_t rh;
69
[41924f30]70 /* Bus bookkeeping */
71 xhci_bus_t bus;
72
[91ca111]73 /* Cached capabilities */
[cb89430]74 unsigned max_slots;
75 bool ac64;
[110d795]76
77 /* Command list */
78 list_t commands;
[74b852b]79 fibril_mutex_t commands_mtx;
80
[20eaa82]81 /* TODO: Hack. Figure out a better way. */
82 hcd_t *hcd;
[5cbccd4]83} xhci_hc_t;
84
[e4d7363]85int hc_init_mmio(xhci_hc_t *, const hw_res_list_parsed_t *);
[0f6b50f]86int hc_init_memory(xhci_hc_t *, ddf_dev_t *);
[e4d7363]87int hc_claim(xhci_hc_t *, ddf_dev_t *);
88int hc_irq_code_gen(irq_code_t *, xhci_hc_t *, const hw_res_list_parsed_t *);
89int hc_start(xhci_hc_t *, bool);
90int hc_schedule(xhci_hc_t *hc, usb_transfer_batch_t *batch);
91int hc_status(xhci_hc_t *, uint32_t *);
92void hc_interrupt(xhci_hc_t *, uint32_t);
93void hc_fini(xhci_hc_t *);
[a0be5d0]94int hc_ring_doorbell(xhci_hc_t *, unsigned, unsigned);
[8ea7459]95int hc_enable_slot(xhci_hc_t *, uint32_t *);
[f270ecb]96int hc_disable_slot(xhci_hc_t *, uint32_t);
[8ea7459]97int hc_address_device(xhci_hc_t *, uint32_t, xhci_input_ctx_t *);
[5cbccd4]98
[115f25b]99#endif
100
[5cbccd4]101/**
102 * @}
103 */
Note: See TracBrowser for help on using the repository browser.