2 Copyright © 2014, The AROS Development Team. All rights reserved.
8 #ifndef PCIXHCI_INTERN_H
9 #define PCIXHCI_INTERN_H
12 #include <aros/debug.h>
13 #include <aros/macros.h>
14 #include <aros/asmcall.h>
15 #include <aros/symbolsets.h>
17 #include <proto/oop.h>
18 #include <proto/exec.h>
19 #include <proto/stdc.h>
20 #include <proto/arossupport.h>
22 #include <devices/usb.h>
23 #include <devices/usb_hub.h>
24 #include <devices/newstyle.h>
25 #include <devices/usbhardware.h>
26 #include <devices/timer.h>
32 #include <hidd/hidd.h>
34 #include LC_LIBDEFS_FILE
37 #define RC_DONTREPLY -1
40 #define mybug(l, x) D(if ((l>=MYBUG_LEVEL)||(l==-1)) { do { { bug x; } } while (0); } )
41 #define mybug_unit(l, x) D(if ((l>=MYBUG_LEVEL)||(l==-1)) { do { { bug("%s %s: ", unit->name, __FUNCTION__); bug x; } } while (0); } )
43 #define PCI_BASE_CLASS_SERIAL 0x0c
44 #define PCI_SUB_CLASS_USB 0x03
45 #define PCI_INTERFACE_XHCI 0x30
54 struct PCIXHCIRootHub
{
55 struct List port_list
;
57 struct List intxferqueue_list
;
61 struct UsbStdDevDesc devdesc
;
63 struct UsbStdBOSDesc bosdesc
;
66 struct UsbStdCfgDesc cfgdesc
;
67 struct UsbStdIfDesc ifdesc
;
68 struct UsbStdEPDesc epdesc
;
71 struct UsbSSHubDesc hubdesc
;
75 struct PCIXHCIHostController
{
76 OOP_Object
*pcidevice
;
77 OOP_Object
*pcidriver
;
79 volatile APTR capability_base
;
80 volatile APTR operational_base
;
81 volatile APTR doorbell_base
;
82 volatile APTR runtime_base
;
93 ULONG maxeventringsegments
;
95 UQUAD
*dcbaa
; /* Device Context Base Address Array */
96 UQUAD
*spbaba
; /* Scratch Pad Buffer Address Base Array */
98 volatile struct xhci_erste
*erstbl
;
101 struct Interrupt inthandler
;
110 struct PCIXHCIBase
*pcixhcibase
;
111 struct PCIXHCIRootHub roothub
;
112 struct PCIXHCIHostController hc
;
114 struct timerequest
*tr
;
120 struct Library library
;
121 struct List unit_list
;
125 OOP_AttrBase HiddPCIDeviceAB
;
130 #undef HiddPCIDeviceAttrBase
131 #define HiddAttrBase (LIBBASE->HiddAB)
132 #define HiddPCIDeviceAttrBase (LIBBASE->HiddPCIDeviceAB)
134 VOID
PCIXHCI_PCIE(struct PCIXHCIUnit
*unit
);
136 BOOL
PCIXHCI_Discover(struct PCIXHCIBase
*PCIXHCIBase
);
137 BOOL
PCIXHCI_HCReset(struct PCIXHCIUnit
*unit
);
138 BOOL
PCIXHCI_HCHalt(struct PCIXHCIUnit
*unit
);
139 BOOL
PCIXHCI_GetFromBIOS(struct PCIXHCIUnit
*unit
);
140 BOOL
PCIXHCI_HCInit(struct PCIXHCIUnit
*unit
);
141 BOOL
PCIXHCI_FindPorts(struct PCIXHCIUnit
*unit
);
142 BOOL
PCIXHCI_PortPower(struct PCIXHCIUnit
*unit
, ULONG portnum
, BOOL poweron
);
143 IPTR
PCIXHCI_SearchExtendedCap(struct PCIXHCIUnit
*unit
, ULONG id
, IPTR extcapoff
);
144 void PCIXHCI_Delay(struct PCIXHCIUnit
*unit
, ULONG msec
);
146 void FreeVecOnBoundary(APTR onboundary
);
147 APTR
AllocVecOnBoundary(ULONG size
, ULONG boundary
, STRPTR description
);
148 BOOL
PCIXHCI_CreateTimer(struct PCIXHCIUnit
*unit
);
149 void PCIXHCI_DeleteTimer(struct PCIXHCIUnit
*unit
);
151 VOID
PCIXHCI_AllocaterInit(struct PCIXHCIUnit
*unit
);
152 struct PCIXHCIAlloc
*PCIXHCI_AllocateMemory(struct PCIXHCIUnit
*unit
, IPTR bytesize
, ULONG alignmentmin
, IPTR boundary
, STRPTR allocname
);
154 BOOL
cmdAbortIO(struct IOUsbHWReq
*ioreq
);
155 WORD
cmdReset(struct IOUsbHWReq
*ioreq
);
156 WORD
cmdUsbReset(struct IOUsbHWReq
*ioreq
);
157 WORD
cmdNSDeviceQuery(struct IOStdReq
*ioreq
);
158 WORD
cmdQueryDevice(struct IOUsbHWReq
*ioreq
);
159 WORD
cmdControlXFer(struct IOUsbHWReq
*ioreq
);
160 WORD
cmdControlXFerRootHub(struct IOUsbHWReq
*ioreq
);
161 WORD
cmdIntXFer(struct IOUsbHWReq
*ioreq
);
162 WORD
cmdIntXFerRootHub(struct IOUsbHWReq
*ioreq
);
163 WORD
cmdGetString(struct IOUsbHWReq
*ioreq
, char *cstring
);
165 #endif /* PCIXHCI_INTERN_H */