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 5*2326Ssl147100 * Common Development and Distribution License (the "License"). 6*2326Ssl147100 * 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*2326Ssl147100 * Copyright 2006 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 #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate #ifdef __cplusplus 320Sstevel@tonic-gate extern "C" { 330Sstevel@tonic-gate #endif 340Sstevel@tonic-gate 350Sstevel@tonic-gate #define USB_DESCR_TYPE_SETUP_HUB 0x2900 360Sstevel@tonic-gate 370Sstevel@tonic-gate /* 380Sstevel@tonic-gate * Section 11.11.2.1 allows up to 255 ports. 390Sstevel@tonic-gate * For simplicity, only a maximum of 31 ports is currently allowed 400Sstevel@tonic-gate */ 410Sstevel@tonic-gate #define MAX_PORTS 31 420Sstevel@tonic-gate 430Sstevel@tonic-gate typedef struct usb_hub_descr { 440Sstevel@tonic-gate uchar_t bDescLength; /* size of descriptor */ 450Sstevel@tonic-gate uchar_t bDescriptorType; /* descriptor type */ 460Sstevel@tonic-gate uchar_t bNbrPorts; /* number of ports */ 470Sstevel@tonic-gate uint16_t wHubCharacteristics; /* hub characteristics */ 480Sstevel@tonic-gate uchar_t bPwrOn2PwrGood; /* time in ms from the time */ 490Sstevel@tonic-gate /* power on sequence begins on a port */ 500Sstevel@tonic-gate /* until power is good on that port */ 510Sstevel@tonic-gate uchar_t bHubContrCurrent; /* max current requirements */ 520Sstevel@tonic-gate uchar_t DeviceRemovable; 530Sstevel@tonic-gate /* removable device attached */ 540Sstevel@tonic-gate uchar_t PortPwrCtrlMask; 550Sstevel@tonic-gate /* power control mask */ 560Sstevel@tonic-gate } usb_hub_descr_t; 570Sstevel@tonic-gate 580Sstevel@tonic-gate #define ROOT_HUB_DESCRIPTOR_LENGTH 9 590Sstevel@tonic-gate #define ROOT_HUB_DESCRIPTOR_TYPE 0x29 600Sstevel@tonic-gate #define ROOT_HUB_ADDR 0x01 /* address of root hub */ 610Sstevel@tonic-gate 620Sstevel@tonic-gate /* Values for wHubCharacteristics */ 630Sstevel@tonic-gate #define HUB_CHARS_POWER_SWITCHING_MODE 0x03 640Sstevel@tonic-gate #define HUB_CHARS_GANGED_POWER 0x00 650Sstevel@tonic-gate #define HUB_CHARS_INDIVIDUAL_PORT_POWER 0x01 660Sstevel@tonic-gate #define HUB_CHARS_NO_POWER_SWITCHING 0x02 670Sstevel@tonic-gate #define HUB_CHARS_COMPOUND_DEV 0x04 680Sstevel@tonic-gate #define HUB_CHARS_GLOBAL_OVER_CURRENT 0x00 690Sstevel@tonic-gate #define HUB_CHARS_INDIV_OVER_CURRENT 0x08 700Sstevel@tonic-gate #define HUB_CHARS_NO_OVER_CURRENT 0x10 710Sstevel@tonic-gate #define HUB_CHARS_TT_THINK_TIME 0x60 720Sstevel@tonic-gate #define HUB_CHARS_TT_16FS_TIME 0x20 730Sstevel@tonic-gate #define HUB_CHARS_TT_24FS_TIME 0x40 740Sstevel@tonic-gate #define HUB_CHARS_TT_32FS_TIME 0x60 750Sstevel@tonic-gate #define HUB_CHARS_PORT_INDICATOR 0x80 760Sstevel@tonic-gate 770Sstevel@tonic-gate /* Default Power On to Power Good time */ 780Sstevel@tonic-gate #define HUB_DEFAULT_POPG 10 790Sstevel@tonic-gate 800Sstevel@tonic-gate /* Hub Status */ 810Sstevel@tonic-gate #define HUB_CHANGE_STATUS 0x01 820Sstevel@tonic-gate 830Sstevel@tonic-gate /* Class Specific bmRequestType values Table 11-10 */ 841001Ssl147100 #define HUB_HANDLE_PORT_FEATURE_TYPE (USB_DEV_REQ_HOST_TO_DEV \ 851001Ssl147100 |USB_DEV_REQ_TYPE_CLASS \ 861001Ssl147100 |USB_DEV_REQ_RCPT_OTHER) 871001Ssl147100 881001Ssl147100 #define HUB_GET_PORT_STATUS_TYPE (USB_DEV_REQ_DEV_TO_HOST \ 891001Ssl147100 |USB_DEV_REQ_TYPE_CLASS \ 901001Ssl147100 |USB_DEV_REQ_RCPT_OTHER) 910Sstevel@tonic-gate 921001Ssl147100 #define HUB_CLASS_REQ_TYPE (USB_DEV_REQ_DEV_TO_HOST \ 931001Ssl147100 |USB_DEV_REQ_TYPE_CLASS) 940Sstevel@tonic-gate 95*2326Ssl147100 #define HUB_HANDLE_HUB_FEATURE_TYPE USB_DEV_REQ_TYPE_CLASS 96*2326Ssl147100 971001Ssl147100 /* bmRequestType for getting device status */ 981001Ssl147100 #define HUB_GET_DEVICE_STATUS_TYPE (USB_DEV_REQ_DEV_TO_HOST \ 991001Ssl147100 |USB_DEV_REQ_TYPE_STANDARD \ 1001001Ssl147100 |USB_DEV_REQ_RCPT_DEV) 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate /* Port Status Field Bits - Table 11-15 */ 1030Sstevel@tonic-gate #define PORT_STATUS_CCS 0x0001 /* port connection status */ 1040Sstevel@tonic-gate #define PORT_STATUS_PES 0x0002 /* port enable status */ 1050Sstevel@tonic-gate #define PORT_STATUS_PSS 0x0004 /* port suspend status */ 1060Sstevel@tonic-gate #define PORT_STATUS_POCI 0x0008 /* port over current indicator */ 1070Sstevel@tonic-gate #define PORT_STATUS_PRS 0x0010 /* port reset status */ 1080Sstevel@tonic-gate #define PORT_STATUS_PPS 0x0100 /* port power status */ 1090Sstevel@tonic-gate #define PORT_STATUS_LSDA 0x0200 /* low speed device */ 1100Sstevel@tonic-gate #define PORT_STATUS_HSDA 0x0400 /* high speed device */ 1110Sstevel@tonic-gate #define PORT_STATUS_PIC 0x1000 /* port indicator control */ 1120Sstevel@tonic-gate 1130Sstevel@tonic-gate #define PORT_STATUS_MASK 0x171f 1140Sstevel@tonic-gate #define PORT_STATUS_OK 0x103 /* connected, enabled, power */ 1150Sstevel@tonic-gate 1160Sstevel@tonic-gate /* Port Change Field Bits - Table 11-16 */ 1170Sstevel@tonic-gate #define PORT_CHANGE_CSC 0x0001 /* connect status change */ 1180Sstevel@tonic-gate #define PORT_CHANGE_PESC 0x0002 /* port enable change */ 1190Sstevel@tonic-gate #define PORT_CHANGE_PSSC 0x0004 /* port suspend change */ 1200Sstevel@tonic-gate #define PORT_CHANGE_OCIC 0x0008 /* over current change */ 1210Sstevel@tonic-gate #define PORT_CHANGE_PRSC 0x0010 /* port reset change */ 1220Sstevel@tonic-gate 1230Sstevel@tonic-gate #define PORT_CHANGE_MASK 0x001f 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate /* Hub status Field Bits - Table 11-14 */ 1260Sstevel@tonic-gate #define HUB_LOCAL_POWER_STATUS 0x0001 /* state of the power supply */ 1270Sstevel@tonic-gate #define HUB_OVER_CURRENT 0x0002 /* global hub OC condition */ 1280Sstevel@tonic-gate 1290Sstevel@tonic-gate /* Hub change clear feature selectors - Table 11-15 */ 1300Sstevel@tonic-gate #define C_HUB_LOCAL_POWER_STATUS 0x0001 /* state of the power supply */ 1310Sstevel@tonic-gate #define C_HUB_OVER_CURRENT 0x0002 /* global hub OC condition */ 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate /* hub class feature selectors - Table 11-12 */ 1340Sstevel@tonic-gate #define CFS_C_HUB_LOCAL_POWER 0 1350Sstevel@tonic-gate #define CFS_C_HUB_OVER_CURRENT 1 1360Sstevel@tonic-gate #define CFS_PORT_CONNECTION 0 1370Sstevel@tonic-gate #define CFS_PORT_ENABLE 1 1380Sstevel@tonic-gate #define CFS_PORT_SUSPEND 2 1390Sstevel@tonic-gate #define CFS_PORT_OVER_CURRENT 3 1400Sstevel@tonic-gate #define CFS_PORT_RESET 4 1410Sstevel@tonic-gate #define CFS_PORT_POWER 8 1420Sstevel@tonic-gate #define CFS_PORT_LOW_SPEED 9 1430Sstevel@tonic-gate #define CFS_C_PORT_CONNECTION 16 1440Sstevel@tonic-gate #define CFS_C_PORT_ENABLE 17 1450Sstevel@tonic-gate #define CFS_C_PORT_SUSPEND 18 1460Sstevel@tonic-gate #define CFS_C_PORT_OVER_CURRENT 19 1470Sstevel@tonic-gate #define CFS_C_PORT_RESET 20 1480Sstevel@tonic-gate 1490Sstevel@tonic-gate #ifdef __cplusplus 1500Sstevel@tonic-gate } 1510Sstevel@tonic-gate #endif 1520Sstevel@tonic-gate 1530Sstevel@tonic-gate #endif /* _SYS_USB_HUB_H */ 154