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 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23*1001Ssl147100 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _SYS_USB_HUB_H 280Sstevel@tonic-gate #define _SYS_USB_HUB_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #ifdef __cplusplus 330Sstevel@tonic-gate extern "C" { 340Sstevel@tonic-gate #endif 350Sstevel@tonic-gate 360Sstevel@tonic-gate #define USB_DESCR_TYPE_SETUP_HUB 0x2900 370Sstevel@tonic-gate 380Sstevel@tonic-gate /* 390Sstevel@tonic-gate * Section 11.11.2.1 allows up to 255 ports. 400Sstevel@tonic-gate * For simplicity, only a maximum of 31 ports is currently allowed 410Sstevel@tonic-gate */ 420Sstevel@tonic-gate #define MAX_PORTS 31 430Sstevel@tonic-gate 440Sstevel@tonic-gate typedef struct usb_hub_descr { 450Sstevel@tonic-gate uchar_t bDescLength; /* size of descriptor */ 460Sstevel@tonic-gate uchar_t bDescriptorType; /* descriptor type */ 470Sstevel@tonic-gate uchar_t bNbrPorts; /* number of ports */ 480Sstevel@tonic-gate uint16_t wHubCharacteristics; /* hub characteristics */ 490Sstevel@tonic-gate uchar_t bPwrOn2PwrGood; /* time in ms from the time */ 500Sstevel@tonic-gate /* power on sequence begins on a port */ 510Sstevel@tonic-gate /* until power is good on that port */ 520Sstevel@tonic-gate uchar_t bHubContrCurrent; /* max current requirements */ 530Sstevel@tonic-gate uchar_t DeviceRemovable; 540Sstevel@tonic-gate /* removable device attached */ 550Sstevel@tonic-gate uchar_t PortPwrCtrlMask; 560Sstevel@tonic-gate /* power control mask */ 570Sstevel@tonic-gate } usb_hub_descr_t; 580Sstevel@tonic-gate 590Sstevel@tonic-gate #define ROOT_HUB_DESCRIPTOR_LENGTH 9 600Sstevel@tonic-gate #define ROOT_HUB_DESCRIPTOR_TYPE 0x29 610Sstevel@tonic-gate #define ROOT_HUB_ADDR 0x01 /* address of root hub */ 620Sstevel@tonic-gate 630Sstevel@tonic-gate /* Values for wHubCharacteristics */ 640Sstevel@tonic-gate #define HUB_CHARS_POWER_SWITCHING_MODE 0x03 650Sstevel@tonic-gate #define HUB_CHARS_GANGED_POWER 0x00 660Sstevel@tonic-gate #define HUB_CHARS_INDIVIDUAL_PORT_POWER 0x01 670Sstevel@tonic-gate #define HUB_CHARS_NO_POWER_SWITCHING 0x02 680Sstevel@tonic-gate #define HUB_CHARS_COMPOUND_DEV 0x04 690Sstevel@tonic-gate #define HUB_CHARS_GLOBAL_OVER_CURRENT 0x00 700Sstevel@tonic-gate #define HUB_CHARS_INDIV_OVER_CURRENT 0x08 710Sstevel@tonic-gate #define HUB_CHARS_NO_OVER_CURRENT 0x10 720Sstevel@tonic-gate #define HUB_CHARS_TT_THINK_TIME 0x60 730Sstevel@tonic-gate #define HUB_CHARS_TT_16FS_TIME 0x20 740Sstevel@tonic-gate #define HUB_CHARS_TT_24FS_TIME 0x40 750Sstevel@tonic-gate #define HUB_CHARS_TT_32FS_TIME 0x60 760Sstevel@tonic-gate #define HUB_CHARS_PORT_INDICATOR 0x80 770Sstevel@tonic-gate 780Sstevel@tonic-gate /* Default Power On to Power Good time */ 790Sstevel@tonic-gate #define HUB_DEFAULT_POPG 10 800Sstevel@tonic-gate 810Sstevel@tonic-gate /* Hub Status */ 820Sstevel@tonic-gate #define HUB_CHANGE_STATUS 0x01 830Sstevel@tonic-gate 840Sstevel@tonic-gate /* Class Specific bmRequestType values Table 11-10 */ 85*1001Ssl147100 #define HUB_HANDLE_PORT_FEATURE_TYPE (USB_DEV_REQ_HOST_TO_DEV \ 86*1001Ssl147100 |USB_DEV_REQ_TYPE_CLASS \ 87*1001Ssl147100 |USB_DEV_REQ_RCPT_OTHER) 88*1001Ssl147100 89*1001Ssl147100 #define HUB_GET_PORT_STATUS_TYPE (USB_DEV_REQ_DEV_TO_HOST \ 90*1001Ssl147100 |USB_DEV_REQ_TYPE_CLASS \ 91*1001Ssl147100 |USB_DEV_REQ_RCPT_OTHER) 920Sstevel@tonic-gate 93*1001Ssl147100 #define HUB_CLASS_REQ_TYPE (USB_DEV_REQ_DEV_TO_HOST \ 94*1001Ssl147100 |USB_DEV_REQ_TYPE_CLASS) 950Sstevel@tonic-gate 96*1001Ssl147100 /* bmRequestType for getting device status */ 97*1001Ssl147100 #define HUB_GET_DEVICE_STATUS_TYPE (USB_DEV_REQ_DEV_TO_HOST \ 98*1001Ssl147100 |USB_DEV_REQ_TYPE_STANDARD \ 99*1001Ssl147100 |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