17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5fef1e07eSsl147100 * Common Development and Distribution License (the "License"). 6fef1e07eSsl147100 * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*d29f5a71Szhigang lu - Sun Microsystems - Beijing China * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_USB_HUB_H 277c478bd9Sstevel@tonic-gate #define _SYS_USB_HUB_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #ifdef __cplusplus 317c478bd9Sstevel@tonic-gate extern "C" { 327c478bd9Sstevel@tonic-gate #endif 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #define USB_DESCR_TYPE_SETUP_HUB 0x2900 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* 377c478bd9Sstevel@tonic-gate * Section 11.11.2.1 allows up to 255 ports. 387c478bd9Sstevel@tonic-gate * For simplicity, only a maximum of 31 ports is currently allowed 397c478bd9Sstevel@tonic-gate */ 407c478bd9Sstevel@tonic-gate #define MAX_PORTS 31 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate typedef struct usb_hub_descr { 437c478bd9Sstevel@tonic-gate uchar_t bDescLength; /* size of descriptor */ 447c478bd9Sstevel@tonic-gate uchar_t bDescriptorType; /* descriptor type */ 457c478bd9Sstevel@tonic-gate uchar_t bNbrPorts; /* number of ports */ 467c478bd9Sstevel@tonic-gate uint16_t wHubCharacteristics; /* hub characteristics */ 477c478bd9Sstevel@tonic-gate uchar_t bPwrOn2PwrGood; /* time in ms from the time */ 487c478bd9Sstevel@tonic-gate /* power on sequence begins on a port */ 497c478bd9Sstevel@tonic-gate /* until power is good on that port */ 507c478bd9Sstevel@tonic-gate uchar_t bHubContrCurrent; /* max current requirements */ 517c478bd9Sstevel@tonic-gate uchar_t DeviceRemovable; 527c478bd9Sstevel@tonic-gate /* removable device attached */ 537c478bd9Sstevel@tonic-gate uchar_t PortPwrCtrlMask; 547c478bd9Sstevel@tonic-gate /* power control mask */ 557c478bd9Sstevel@tonic-gate } usb_hub_descr_t; 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate #define ROOT_HUB_DESCRIPTOR_LENGTH 9 587c478bd9Sstevel@tonic-gate #define ROOT_HUB_DESCRIPTOR_TYPE 0x29 597c478bd9Sstevel@tonic-gate #define ROOT_HUB_ADDR 0x01 /* address of root hub */ 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate /* Values for wHubCharacteristics */ 627c478bd9Sstevel@tonic-gate #define HUB_CHARS_POWER_SWITCHING_MODE 0x03 637c478bd9Sstevel@tonic-gate #define HUB_CHARS_GANGED_POWER 0x00 647c478bd9Sstevel@tonic-gate #define HUB_CHARS_INDIVIDUAL_PORT_POWER 0x01 657c478bd9Sstevel@tonic-gate #define HUB_CHARS_NO_POWER_SWITCHING 0x02 667c478bd9Sstevel@tonic-gate #define HUB_CHARS_COMPOUND_DEV 0x04 677c478bd9Sstevel@tonic-gate #define HUB_CHARS_GLOBAL_OVER_CURRENT 0x00 687c478bd9Sstevel@tonic-gate #define HUB_CHARS_INDIV_OVER_CURRENT 0x08 697c478bd9Sstevel@tonic-gate #define HUB_CHARS_NO_OVER_CURRENT 0x10 707c478bd9Sstevel@tonic-gate #define HUB_CHARS_TT_THINK_TIME 0x60 717c478bd9Sstevel@tonic-gate #define HUB_CHARS_TT_16FS_TIME 0x20 727c478bd9Sstevel@tonic-gate #define HUB_CHARS_TT_24FS_TIME 0x40 737c478bd9Sstevel@tonic-gate #define HUB_CHARS_TT_32FS_TIME 0x60 747c478bd9Sstevel@tonic-gate #define HUB_CHARS_PORT_INDICATOR 0x80 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate /* Default Power On to Power Good time */ 777c478bd9Sstevel@tonic-gate #define HUB_DEFAULT_POPG 10 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate /* Hub Status */ 807c478bd9Sstevel@tonic-gate #define HUB_CHANGE_STATUS 0x01 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate /* Class Specific bmRequestType values Table 11-10 */ 8335f36846Ssl147100 #define HUB_HANDLE_PORT_FEATURE_TYPE (USB_DEV_REQ_HOST_TO_DEV \ 847c478bd9Sstevel@tonic-gate |USB_DEV_REQ_TYPE_CLASS \ 857c478bd9Sstevel@tonic-gate |USB_DEV_REQ_RCPT_OTHER) 867c478bd9Sstevel@tonic-gate 8735f36846Ssl147100 #define HUB_GET_PORT_STATUS_TYPE (USB_DEV_REQ_DEV_TO_HOST \ 887c478bd9Sstevel@tonic-gate |USB_DEV_REQ_TYPE_CLASS \ 897c478bd9Sstevel@tonic-gate |USB_DEV_REQ_RCPT_OTHER) 907c478bd9Sstevel@tonic-gate 9135f36846Ssl147100 #define HUB_CLASS_REQ_TYPE (USB_DEV_REQ_DEV_TO_HOST \ 927c478bd9Sstevel@tonic-gate |USB_DEV_REQ_TYPE_CLASS) 937c478bd9Sstevel@tonic-gate 94fef1e07eSsl147100 #define HUB_HANDLE_HUB_FEATURE_TYPE USB_DEV_REQ_TYPE_CLASS 95fef1e07eSsl147100 9635f36846Ssl147100 /* bmRequestType for getting device status */ 9735f36846Ssl147100 #define HUB_GET_DEVICE_STATUS_TYPE (USB_DEV_REQ_DEV_TO_HOST \ 9835f36846Ssl147100 |USB_DEV_REQ_TYPE_STANDARD \ 9935f36846Ssl147100 |USB_DEV_REQ_RCPT_DEV) 10035f36846Ssl147100 1017c478bd9Sstevel@tonic-gate /* Port Status Field Bits - Table 11-15 */ 1027c478bd9Sstevel@tonic-gate #define PORT_STATUS_CCS 0x0001 /* port connection status */ 1037c478bd9Sstevel@tonic-gate #define PORT_STATUS_PES 0x0002 /* port enable status */ 1047c478bd9Sstevel@tonic-gate #define PORT_STATUS_PSS 0x0004 /* port suspend status */ 1057c478bd9Sstevel@tonic-gate #define PORT_STATUS_POCI 0x0008 /* port over current indicator */ 1067c478bd9Sstevel@tonic-gate #define PORT_STATUS_PRS 0x0010 /* port reset status */ 1077c478bd9Sstevel@tonic-gate #define PORT_STATUS_PPS 0x0100 /* port power status */ 1087c478bd9Sstevel@tonic-gate #define PORT_STATUS_LSDA 0x0200 /* low speed device */ 1097c478bd9Sstevel@tonic-gate #define PORT_STATUS_HSDA 0x0400 /* high speed device */ 1107c478bd9Sstevel@tonic-gate #define PORT_STATUS_PIC 0x1000 /* port indicator control */ 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate #define PORT_STATUS_MASK 0x171f 1137c478bd9Sstevel@tonic-gate #define PORT_STATUS_OK 0x103 /* connected, enabled, power */ 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate /* Port Change Field Bits - Table 11-16 */ 1167c478bd9Sstevel@tonic-gate #define PORT_CHANGE_CSC 0x0001 /* connect status change */ 1177c478bd9Sstevel@tonic-gate #define PORT_CHANGE_PESC 0x0002 /* port enable change */ 1187c478bd9Sstevel@tonic-gate #define PORT_CHANGE_PSSC 0x0004 /* port suspend change */ 1197c478bd9Sstevel@tonic-gate #define PORT_CHANGE_OCIC 0x0008 /* over current change */ 1207c478bd9Sstevel@tonic-gate #define PORT_CHANGE_PRSC 0x0010 /* port reset change */ 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gate #define PORT_CHANGE_MASK 0x001f 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate /* Hub status Field Bits - Table 11-14 */ 1257c478bd9Sstevel@tonic-gate #define HUB_LOCAL_POWER_STATUS 0x0001 /* state of the power supply */ 1267c478bd9Sstevel@tonic-gate #define HUB_OVER_CURRENT 0x0002 /* global hub OC condition */ 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate /* Hub change clear feature selectors - Table 11-15 */ 1297c478bd9Sstevel@tonic-gate #define C_HUB_LOCAL_POWER_STATUS 0x0001 /* state of the power supply */ 1307c478bd9Sstevel@tonic-gate #define C_HUB_OVER_CURRENT 0x0002 /* global hub OC condition */ 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate /* hub class feature selectors - Table 11-12 */ 1337c478bd9Sstevel@tonic-gate #define CFS_C_HUB_LOCAL_POWER 0 1347c478bd9Sstevel@tonic-gate #define CFS_C_HUB_OVER_CURRENT 1 1357c478bd9Sstevel@tonic-gate #define CFS_PORT_CONNECTION 0 1367c478bd9Sstevel@tonic-gate #define CFS_PORT_ENABLE 1 1377c478bd9Sstevel@tonic-gate #define CFS_PORT_SUSPEND 2 1387c478bd9Sstevel@tonic-gate #define CFS_PORT_OVER_CURRENT 3 1397c478bd9Sstevel@tonic-gate #define CFS_PORT_RESET 4 1407c478bd9Sstevel@tonic-gate #define CFS_PORT_POWER 8 1417c478bd9Sstevel@tonic-gate #define CFS_PORT_LOW_SPEED 9 1427c478bd9Sstevel@tonic-gate #define CFS_C_PORT_CONNECTION 16 1437c478bd9Sstevel@tonic-gate #define CFS_C_PORT_ENABLE 17 1447c478bd9Sstevel@tonic-gate #define CFS_C_PORT_SUSPEND 18 1457c478bd9Sstevel@tonic-gate #define CFS_C_PORT_OVER_CURRENT 19 1467c478bd9Sstevel@tonic-gate #define CFS_C_PORT_RESET 20 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1497c478bd9Sstevel@tonic-gate } 1507c478bd9Sstevel@tonic-gate #endif 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_HUB_H */ 153