1#ifndef __XHCI__XHCI_HPP__
2#define __XHCI__XHCI_HPP__
8#define XHCI_VENDOR_ID 0x1b36
9#define XHCI_DEVICE_ID 0x000d
55#define XHCI_PORT_CCS (1 << 0)
56#define XHCI_PORT_PED (1 << 1)
57#define XHCI_PORT_PR (1 << 4)
58#define XHCI_PORT_PLS_MASK (0xF << 5)
59#define XHCI_PORT_PP (1 << 9)
60#define XHCI_PORT_SPEED_MASK (0xF << 10)
61#define XHCI_PORT_CSC (1 << 17)
62#define XHCI_PORT_PRC (1 << 21)
65#define XHCI_CMD_RS (1 << 0)
66#define XHCI_CMD_HCRST (1 << 1)
67#define XHCI_CMD_INTE (1 << 2)
70#define XHCI_STS_HCH (1 << 0)
71#define XHCI_STS_CNR (1 << 11)
74#define XHCI_TRB_NORMAL 1
75#define XHCI_TRB_SETUP_STAGE 2
76#define XHCI_TRB_DATA_STAGE 3
77#define XHCI_TRB_STATUS_STAGE 4
78#define XHCI_TRB_LINK 6
79#define XHCI_TRB_ENABLE_SLOT_CMD 9
80#define XHCI_TRB_ADDRESS_DEVICE_CMD 11
81#define XHCI_TRB_CONFIGURE_ENDPOINT_CMD 12
82#define XHCI_TRB_TRANSFER_EVENT 32
83#define XHCI_TRB_COMMAND_COMPLETION_EVENT 33
84#define XHCI_TRB_PORT_STATUS_CHANGE_EVENT 34
126 void load()
override;
137 uint32_t response_phys,
size_t response_size);
IOforgePCI(const char *mod)
void address_device(uint8_t slot_id, uint8_t port_id)
struct xhci_trb * create_transfer_ring(uintptr_t *phys)
struct xhci_trb * cmd_ring
ioforge_pci_device * device
void set_controller(ioforge_usb_controller_device *ctrl)
static XHCIModule instance
volatile uint32_t * doorbell_regs
struct xhci_trb * event_ring
void send_async_with_response(uint8_t addr, uint8_t endpoint, uint32_t data_phys, size_t size, uint32_t response_phys, size_t response_size)
struct XHCIModule::xhci_slot slots[256]
ioforge_usb_controller_device * controller
void send_command(struct xhci_trb *trb)
struct xhci_op_regs * op_regs
struct xhci_trb wait_for_event(uint8_t type)
static XHCIModule * getInstance()
uint32_t event_ring_index
struct xhci_cap_regs * cap_regs
uintptr_t event_ring_phys
struct xhci_runtime_regs * runtime_regs
static void fireHandler()
struct xhci_trb * rings[32]
uint32_t ring_indices[32]
struct xhci_device_ctx * ctx
struct xhci_slot_ctx slot
struct xhci_endpoint_ctx ep[31]
volatile uint32_t pagesize
volatile uint32_t mfindex
struct xhci_intr_regs ir[1024]