10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52326Ssl147100 * Common Development and Distribution License (the "License"). 62326Ssl147100 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*7492SZhigang.Lu@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_USB_HUB_H 270Sstevel@tonic-gate #define _SYS_USB_HUB_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifdef __cplusplus 310Sstevel@tonic-gate extern "C" { 320Sstevel@tonic-gate #endif 330Sstevel@tonic-gate 340Sstevel@tonic-gate #define USB_DESCR_TYPE_SETUP_HUB 0x2900 350Sstevel@tonic-gate 360Sstevel@tonic-gate /* 370Sstevel@tonic-gate * Section 11.11.2.1 allows up to 255 ports. 380Sstevel@tonic-gate * For simplicity, only a maximum of 31 ports is currently allowed 390Sstevel@tonic-gate */ 400Sstevel@tonic-gate #define MAX_PORTS 31 410Sstevel@tonic-gate 420Sstevel@tonic-gate typedef struct usb_hub_descr { 430Sstevel@tonic-gate uchar_t bDescLength; /* size of descriptor */ 440Sstevel@tonic-gate uchar_t bDescriptorType; /* descriptor type */ 450Sstevel@tonic-gate uchar_t bNbrPorts; /* number of ports */ 460Sstevel@tonic-gate uint16_t wHubCharacteristics; /* hub characteristics */ 470Sstevel@tonic-gate uchar_t bPwrOn2PwrGood; /* time in ms from the time */ 480Sstevel@tonic-gate /* power on sequence begins on a port */ 490Sstevel@tonic-gate /* until power is good on that port */ 500Sstevel@tonic-gate uchar_t bHubContrCurrent; /* max current requirements */ 510Sstevel@tonic-gate uchar_t DeviceRemovable; 520Sstevel@tonic-gate /* removable device attached */ 530Sstevel@tonic-gate uchar_t PortPwrCtrlMask; 540Sstevel@tonic-gate /* power control mask */ 550Sstevel@tonic-gate } usb_hub_descr_t; 560Sstevel@tonic-gate 570Sstevel@tonic-gate #define ROOT_HUB_DESCRIPTOR_LENGTH 9 580Sstevel@tonic-gate #define ROOT_HUB_DESCRIPTOR_TYPE 0x29 590Sstevel@tonic-gate #define ROOT_HUB_ADDR 0x01 /* address of root hub */ 600Sstevel@tonic-gate 610Sstevel@tonic-gate /* Values for wHubCharacteristics */ 620Sstevel@tonic-gate #define HUB_CHARS_POWER_SWITCHING_MODE 0x03 630Sstevel@tonic-gate #define HUB_CHARS_GANGED_POWER 0x00 640Sstevel@tonic-gate #define HUB_CHARS_INDIVIDUAL_PORT_POWER 0x01 650Sstevel@tonic-gate #define HUB_CHARS_NO_POWER_SWITCHING 0x02 660Sstevel@tonic-gate #define HUB_CHARS_COMPOUND_DEV 0x04 670Sstevel@tonic-gate #define HUB_CHARS_GLOBAL_OVER_CURRENT 0x00 680Sstevel@tonic-gate #define HUB_CHARS_INDIV_OVER_CURRENT 0x08 690Sstevel@tonic-gate #define HUB_CHARS_NO_OVER_CURRENT 0x10 700Sstevel@tonic-gate #define HUB_CHARS_TT_THINK_TIME 0x60 710Sstevel@tonic-gate #define HUB_CHARS_TT_16FS_TIME 0x20 720Sstevel@tonic-gate #define HUB_CHARS_TT_24FS_TIME 0x40 730Sstevel@tonic-gate #define HUB_CHARS_TT_32FS_TIME 0x60 740Sstevel@tonic-gate #define HUB_CHARS_PORT_INDICATOR 0x80 750Sstevel@tonic-gate 760Sstevel@tonic-gate /* Default Power On to Power Good time */ 770Sstevel@tonic-gate #define HUB_DEFAULT_POPG 10 780Sstevel@tonic-gate 790Sstevel@tonic-gate /* Hub Status */ 800Sstevel@tonic-gate #define HUB_CHANGE_STATUS 0x01 810Sstevel@tonic-gate 820Sstevel@tonic-gate /* Class Specific bmRequestType values Table 11-10 */ 831001Ssl147100 #define HUB_HANDLE_PORT_FEATURE_TYPE (USB_DEV_REQ_HOST_TO_DEV \ 841001Ssl147100 |USB_DEV_REQ_TYPE_CLASS \ 851001Ssl147100 |USB_DEV_REQ_RCPT_OTHER) 861001Ssl147100 871001Ssl147100 #define HUB_GET_PORT_STATUS_TYPE (USB_DEV_REQ_DEV_TO_HOST \ 881001Ssl147100 |USB_DEV_REQ_TYPE_CLASS \ 891001Ssl147100 |USB_DEV_REQ_RCPT_OTHER) 900Sstevel@tonic-gate 911001Ssl147100 #define HUB_CLASS_REQ_TYPE (USB_DEV_REQ_DEV_TO_HOST \ 921001Ssl147100 |USB_DEV_REQ_TYPE_CLASS) 930Sstevel@tonic-gate 942326Ssl147100 #define HUB_HANDLE_HUB_FEATURE_TYPE USB_DEV_REQ_TYPE_CLASS 952326Ssl147100 961001Ssl147100 /* bmRequestType for getting device status */ 971001Ssl147100 #define HUB_GET_DEVICE_STATUS_TYPE (USB_DEV_REQ_DEV_TO_HOST \ 981001Ssl147100 |USB_DEV_REQ_TYPE_STANDARD \ 991001Ssl147100 |USB_DEV_REQ_RCPT_DEV) 1000Sstevel@tonic-gate 1010Sstevel@tonic-gate /* Port Status Field Bits - Table 11-15 */ 1020Sstevel@tonic-gate #define PORT_STATUS_CCS 0x0001 /* port connection status */ 1030Sstevel@tonic-gate #define PORT_STATUS_PES 0x0002 /* port enable status */ 1040Sstevel@tonic-gate #define PORT_STATUS_PSS 0x0004 /* port suspend status */ 1050Sstevel@tonic-gate #define PORT_STATUS_POCI 0x0008 /* port over current indicator */ 1060Sstevel@tonic-gate #define PORT_STATUS_PRS 0x0010 /* port reset status */ 1070Sstevel@tonic-gate #define PORT_STATUS_PPS 0x0100 /* port power status */ 1080Sstevel@tonic-gate #define PORT_STATUS_LSDA 0x0200 /* low speed device */ 1090Sstevel@tonic-gate #define PORT_STATUS_HSDA 0x0400 /* high speed device */ 1100Sstevel@tonic-gate #define PORT_STATUS_PIC 0x1000 /* port indicator control */ 1110Sstevel@tonic-gate 1120Sstevel@tonic-gate #define PORT_STATUS_MASK 0x171f 1130Sstevel@tonic-gate #define PORT_STATUS_OK 0x103 /* connected, enabled, power */ 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate /* Port Change Field Bits - Table 11-16 */ 1160Sstevel@tonic-gate #define PORT_CHANGE_CSC 0x0001 /* connect status change */ 1170Sstevel@tonic-gate #define PORT_CHANGE_PESC 0x0002 /* port enable change */ 1180Sstevel@tonic-gate #define PORT_CHANGE_PSSC 0x0004 /* port suspend change */ 1190Sstevel@tonic-gate #define PORT_CHANGE_OCIC 0x0008 /* over current change */ 1200Sstevel@tonic-gate #define PORT_CHANGE_PRSC 0x0010 /* port reset change */ 1210Sstevel@tonic-gate 1220Sstevel@tonic-gate #define PORT_CHANGE_MASK 0x001f 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate /* Hub status Field Bits - Table 11-14 */ 1250Sstevel@tonic-gate #define HUB_LOCAL_POWER_STATUS 0x0001 /* state of the power supply */ 1260Sstevel@tonic-gate #define HUB_OVER_CURRENT 0x0002 /* global hub OC condition */ 1270Sstevel@tonic-gate 1280Sstevel@tonic-gate /* Hub change clear feature selectors - Table 11-15 */ 1290Sstevel@tonic-gate #define C_HUB_LOCAL_POWER_STATUS 0x0001 /* state of the power supply */ 1300Sstevel@tonic-gate #define C_HUB_OVER_CURRENT 0x0002 /* global hub OC condition */ 1310Sstevel@tonic-gate 1320Sstevel@tonic-gate /* hub class feature selectors - Table 11-12 */ 1330Sstevel@tonic-gate #define CFS_C_HUB_LOCAL_POWER 0 1340Sstevel@tonic-gate #define CFS_C_HUB_OVER_CURRENT 1 1350Sstevel@tonic-gate #define CFS_PORT_CONNECTION 0 1360Sstevel@tonic-gate #define CFS_PORT_ENABLE 1 1370Sstevel@tonic-gate #define CFS_PORT_SUSPEND 2 1380Sstevel@tonic-gate #define CFS_PORT_OVER_CURRENT 3 1390Sstevel@tonic-gate #define CFS_PORT_RESET 4 1400Sstevel@tonic-gate #define CFS_PORT_POWER 8 1410Sstevel@tonic-gate #define CFS_PORT_LOW_SPEED 9 1420Sstevel@tonic-gate #define CFS_C_PORT_CONNECTION 16 1430Sstevel@tonic-gate #define CFS_C_PORT_ENABLE 17 1440Sstevel@tonic-gate #define CFS_C_PORT_SUSPEND 18 1450Sstevel@tonic-gate #define CFS_C_PORT_OVER_CURRENT 19 1460Sstevel@tonic-gate #define CFS_C_PORT_RESET 20 1470Sstevel@tonic-gate 1480Sstevel@tonic-gate #ifdef __cplusplus 1490Sstevel@tonic-gate } 1500Sstevel@tonic-gate #endif 1510Sstevel@tonic-gate 1520Sstevel@tonic-gate #endif /* _SYS_USB_HUB_H */ 153