From 856766d5daa71e5a784f3c1d8f85c15ed212df7b Mon Sep 17 00:00:00 2001 From: DizzyOfCRN Date: Sat, 16 Aug 2014 13:22:45 +0000 Subject: [PATCH] Added XHCI HW definitions for this new try git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@49447 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- rom/usb/pciusbhc/xhci/pcixhci_controller.h | 313 +++++++++++++++++++++++++++++ 1 file changed, 313 insertions(+) create mode 100644 rom/usb/pciusbhc/xhci/pcixhci_controller.h diff --git a/rom/usb/pciusbhc/xhci/pcixhci_controller.h b/rom/usb/pciusbhc/xhci/pcixhci_controller.h new file mode 100644 index 0000000000..f3c6423b86 --- /dev/null +++ b/rom/usb/pciusbhc/xhci/pcixhci_controller.h @@ -0,0 +1,313 @@ +/* + Copyright © 2014, The AROS Development Team. All rights reserved. + $Id$ + + Desc: + Lang: English +*/ +#ifndef PCIXHCICONTROLLER_H +#define PCIXHCICONTROLLER_H + +/* + *---------------------------------------------------------------------------- + * Includes for XHCI USB Controller + *---------------------------------------------------------------------------- + */ + +/* + XHCI_xxx's are offsets to something + XHCB_xxx's are bitnumbers + XHCF_xxx's are flags + XHCM_xxx's are bitmasks + XHCV_xxx(p)'s return shifted values from p +*/ + +#define opreg_readl(opreg) READREG32_LE(unit->hc.opregbase, opreg) +#define opreg_writel(opreg, value) WRITEREG32_LE(unit->hc.opregbase, opreg, value) +#define opreg_writeq(opreg, value) WRITEREG64_LE(unit->hc.opregbase, opreg, value) + +#define capreg_readl(capreg) READREG32_LE(unit->hc.capregbase, capreg) +#define capreg_readw(capreg) READREG16_LE(unit->hc.capregbase, capreg) +#define capreg_readb(capreg) (*((volatile UBYTE *) (((UBYTE *) (unit->hc.capregbase)) + ((ULONG) (capreg))))) + + +/* XHCI capability register defines */ +#define XHCI_CAPLENGTH 0x00 +#define XHCI_HCIVERSION 0x02 +#define XHCI_HCSPARAMS1 0x04 +#define XHCI_HCSPARAMS2 0x08 +#define XHCI_HCSPARAMS3 0x0C +#define XHCI_HCCPARAMS 0x10 +#define XHCI_DBOFF 0x14 +#define XHCI_RTSOFF 0x18 + + +/* XHCI_HCSPARAMS1 defines */ +#define XHCB_MaxSlots 0 +#define XHCB_MaxIntrs 8 +#define XHCB_MaxPorts 24 + +#define XHCM_MaxSlots (((1UL<<8)-1)<>XHCB_MaxPorts) +#define XHCV_MaxIntrs(p) (((p)&XHCM_MaxIntrs)>>XHCB_MaxIntrs) +#define XHCV_MaxSlots(p) (((p)&XHCM_MaxSlots)>>XHCB_MaxSlots) + + +/* XHCI_HCSPARAMS2 defines */ +#define XHCB_IST 0 +#define XHCB_ERST_Max 4 +#define XHCB_SPR 26 +#define XHCB_SPB_Max 27 + +#define XHCM_IST (((1UL<<4)-1)<>XHCB_SPB_Max) + +#define XHCI_MAX_SCRATCHPADS 31 + +/* XHCI_HCSPARAMS3 defines */ +#define XHCB_U1DEV_LAT 0 +#define XHCB_U2DEV_LAT 16 + +#define XHCM_U1DEV_LAT (((1UL<<8)-1)<>XHCB_xECP)<<2) + + +/* Extended capability IDs */ +#define XHCB_EXT_CAPS_ID 0 +#define XHCB_EXT_CAPS_NEXT 8 +#define XHCB_EXT_CAPS_VALUE 16 + +#define XHCM_EXT_CAPS_ID (((1UL<<8)-1)<>XHCB_EXT_CAPS_ID) +#define XHCV_EXT_CAPS_NEXT(p) ((((p)&XHCM_EXT_CAPS_NEXT)>>XHCB_EXT_CAPS_NEXT)<<2) +#define XHCV_EXT_CAPS_VALUE(p) (((p)&XHCM_EXT_CAPS_VALUE)>>XHCB_EXT_CAPS_VALUE) + + +/* Reserved ID 0 */ +#define XHCI_EXT_CAPS_LEGACY 1 +#define XHCI_EXT_CAPS_PROTOCOL 2 +#define XHCI_EXT_CAPS_XPOWERMNG 3 +#define XHCI_EXT_CAPS_IOVIRT 4 +#define XHCI_EXT_CAPS_MSGINTR 5 +#define XHCI_EXT_CAPS_LOCALMEM 6 +/* Reserved IDs 7-9 */ +#define XHCI_EXT_CAPS_USBDEBUG 10 +/* Reserved IDs 11-16 */ +#define XHCI_EXT_CAPS_XMSGINTR 17 +/* Reserved IDs 18-191 */ +/* Vendor defined IDs 192-255 */ +#define XHCI_EXT_CAPS_MAX 255 + + +/* These are for XHCI_EXT_CAPS_LEGACY */ +/* USB Legacy Support Capability (USBLEGSUP) */ +#define XHCI_USBLEGSUP 0x00 +#define XHCB_BIOSOWNED 16 +#define XHCB_OSOWNED 24 +#define XHCF_BIOSOWNED (1UL<>XHCB_SPFD_RMINOR) +#define XHCV_SPFD_RMAJOR(p) (((p)&XHCM_SPFD_RMAJOR)>>XHCB_SPFD_RMAJOR) + +#define XHCI_SPNAMESTRING 0x04 + +#define XHCI_SPPORT 0x08 +#define XHCB_SPPORT_CPO 0 /* Compatible Port Offset */ +#define XHCB_SPPORT_CPCNT 8 /* Compatible Port Count */ +#define XHCB_SPPORT_PD 16 /* Protocol Defined */ +#define XHCB_SPPORT_PSIC 28 /* Protocol Speed ID Count */ + +#define XHCM_SPPORT_CPO (((1UL<<8)-1)<>XHCB_SPPORT_CPO) +#define XHCV_SPPORT_CPCNT(p) (((p)&XHCM_SPPORT_CPCNT)>>XHCB_SPPORT_CPCNT) +#define XHCV_SPPORT_PD(p) (((p)&XHCM_SPPORT_PD)>>XHCB_SPPORT_PD) +#define XHCV_SPPORT_PSIC(p) (((p)&XHCM_SPPORT_PSIC)>>XHCB_SPPORT_PSIC) + +#define XHCI_SPPSI(psic) ((psic *4) + 0x10 ) +/* XHCI operational register defines */ +/* USB Command Register (USBCMD) */ +#define XHCI_USBCMD 0x00 + +#define XHCB_CMD_RS 0 +#define XHCB_CMD_HCRST 1 +#define XHCB_CMD_INTE 2 +#define XHCB_CMD_HSEE 3 +#define XHCB_CMD_LHCRST 7 +#define XHCB_CMD_CSS 8 +#define XHCB_CMD_CRS 9 +#define XHCB_CMD_EWE 10 +#define XHCB_CMD_EU3S 11 + +#define XHCF_CMD_RS (1UL<>XHCB_PS_SPEED) + +#endif /* PCIXHCICONTROLLER_H */ -- 2.11.4.GIT