Print this page
5832 EOF wireless usb (aka UWB)
Reviewed by: TBD
Reviewed by: TBD
Approved by: TBD


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.


  24  */
  25 
  26 #ifndef _SYS_USB_USBAI_H
  27 #define _SYS_USB_USBAI_H
  28 
  29 
  30 #ifdef  __cplusplus
  31 extern "C" {
  32 #endif
  33 
  34 /* This header file is for USBA2.0 */
  35 #define USBA_MAJOR_VER 2
  36 #define USBA_MINOR_VER 0
  37 
  38 /*
  39  * USBAI: Interfaces Between USBA and Client Driver
  40  *
  41  *
  42  * Universal USB device state management :
  43  *


 428 #define USB_EP_MIN_HIGH_INTR_INTRVL     1
 429 #define USB_EP_MAX_HIGH_INTR_INTRVL     16
 430 #define USB_EP_MIN_FULL_ISOCH_INTRVL    1
 431 #define USB_EP_MAX_FULL_ISOCH_INTRVL    16
 432 #define USB_EP_MIN_HIGH_ISOCH_INTRVL    1
 433 #define USB_EP_MAX_HIGH_ISOCH_INTRVL    16
 434 
 435 /*
 436  * usb_string_descr:
 437  *      usb string descriptor, refer to  USB 2.0/9.6.7
 438  */
 439 typedef struct usb_string_descr {
 440         uint8_t         bLength;                /* descr size */
 441         uint8_t         bDescriptorType;        /* set to STRING */
 442         uint8_t         bString[1];             /* variable length unicode */
 443                                                 /* encoded string       */
 444 } usb_string_descr_t;
 445 
 446 #define USB_MAXSTRINGLEN        255             /* max string descr length */
 447 
 448 
 449 /*
 450  * usb_bos_descr:
 451  *      usb BOS descriptor, refer to WUSB 1.0/7.4.1
 452  */
 453 typedef struct usb_bos_descr {
 454         uint8_t         bLength;
 455         uint8_t         bDescriptorType;
 456         uint16_t        wTotalLength;
 457         uint8_t         bNumDeviceCaps;
 458 } usb_bos_descr_t;
 459 
 460 /*
 461  * usb_dev_cap_header:
 462  *      usb device capability descriptor header, refer to WUSB 1.0/7.4.1
 463  */
 464 typedef struct usb_cap_descr_header {
 465         uint8_t         bLength;
 466         uint8_t         bDescriptorType;
 467         uint8_t         bDevCapabilityType;
 468 } usb_cap_descr_header_t;
 469 
 470 typedef struct usb_cap_descr {
 471         uint8_t         bLength;
 472         uint8_t         bDescriptorType;        /* set to DEVICE CAPABILITY */
 473         uint8_t         bDevCapabilityType;
 474         uint8_t         bCapValue[1];           /* variable length data */
 475 } usb_cap_descr_t;
 476 
 477 #define USB_CAP_TYPE_WUSB       1
 478 
 479 /* Wireless USB device capability descriptor - UWB descriptor */
 480 typedef struct usb_uwb_cap_descr {
 481         uint8_t         bLength;
 482         uint8_t         bDescriptorType;
 483         uint8_t         bDevCapabilityType;
 484         uint8_t         bmAttributes;
 485         uint16_t        wPHYRates;
 486         uint8_t         bmTFITXPowerInfo;
 487         uint8_t         bmFFITXPowerInfo;
 488         uint16_t        bmBandGroup;
 489         uint8_t         bReserved;
 490 } usb_uwb_cap_descr_t;
 491 
 492 /*
 493  * usb_ep_comp_descr:
 494  *      usb endpoint companion descriptor, refer to WUSB 1.0/7.4.4
 495  */
 496 typedef struct usb_ep_comp_descr {
 497         uint8_t         bLength;
 498         uint8_t         bDescriptorType;
 499         uint8_t         bMaxBurst;
 500         uint8_t         bMaxSequence;
 501         uint16_t        wMaxStreamDelay;
 502         uint16_t        wOverTheAirPacketSize;
 503         uint8_t         bOverTheAirInterval;
 504         uint8_t         bmCompAttributes;
 505 } usb_ep_comp_descr_t;
 506 
 507 /*
 508  * usb_security_descr:
 509  *      usb security descriptor, refer to WUSB 1.0/7.4.5
 510  */
 511 typedef struct usb_security_descr {
 512         uint8_t         bLength;
 513         uint8_t         bDescriptorType;
 514         uint16_t        wTotalLength;
 515         uint8_t         bNumEncryptionTypes;
 516 } usb_security_descr_t;
 517 
 518 /*
 519  * usb_encryption_descr:
 520  *      usb encryption descriptor, refer to WUSB 1.0/7.4.5
 521  */
 522 typedef struct usb_encryption_descr {
 523         uint8_t         bLength;
 524         uint8_t         bDescriptorType;
 525         uint8_t         bEncryptionType;
 526         uint8_t         bEncryptionValue;
 527         uint8_t         bAuthKeyIndex;
 528 } usb_encryption_descr_t;
 529 
 530 #define USB_ENC_TYPE_UNSECURE           0x00
 531 #define USB_ENC_TYPE_WIRED              0x01
 532 #define USB_ENC_TYPE_CCM_1              0x02
 533 #define USB_ENC_TYPE_RSA_1              0x03
 534 
 535 /*
 536  * usb_key_descr:
 537  *      usb key descriptor, refer to WUSB 1.0/7.4.5
 538  */
 539 typedef struct usb_key_descr {
 540         uint8_t         bLength;
 541         uint8_t         bDescriptorType;
 542         uint8_t         tTKID[3];
 543         uint8_t         bReserved;
 544         uint8_t         KeyData[1];     /* variable length */
 545 } usb_key_descr_t;
 546 
 547 #define USB_EP_COMP_DESCR_SIZE          10
 548 #define USB_BOS_DESCR_SIZE              5
 549 #define USB_CAP_DESCR_HEADER_SIZE       3
 550 #define USB_UWB_CAP_DESCR_SIZE          11
 551 #define USB_SECURITY_DESCR_SIZE         5
 552 #define USB_ENCRYPTION_DESCR_SIZE       5
 553 
 554 
 555 /*
 556  * ***************************************************************************
 557  * Client driver registration with USBA
 558  * ***************************************************************************
 559  *
 560  *      The client registers with USBA during attach in two steps
 561  *      using usb_client_attach() and usb_get_dev_data(). On completion, the
 562  *      registration data has been initialized.  Most data items are
 563  *      straightforward.  Among the items returned in the data is the tree of
 564  *      parsed descriptors, in dev_cfg;  the number of configurations parsed,
 565  *      in dev_n_cfg; a pointer to the current configuration in the tree,
 566  *      in dev_curr_cfg; the index of the first valid interface in the
 567  *      tree, in dev_curr_if, and a parse level that accurately reflects what
 568  *      is in the tree, in dev_parse_level.
 569  */
 570 
 571 
 572 /*
 573  * ***************************************************************************
 574  * Data structures used in the configuration tree
 575  * ***************************************************************************


 605 /*
 606  * Tree data structure for each alternate of each alternate interface set
 607  */
 608 typedef struct usb_alt_if_data {
 609         usb_if_descr_t          altif_descr;    /* parsed alternate if descr */
 610         struct usb_ep_data      *altif_ep;      /* endpts for alt if */
 611                                                 /* (not a sparse array */
 612         struct usb_cvs_data     *altif_cvs;     /* cvs for this alt if */
 613         char                    *altif_str;     /* string descriptor */
 614         uint_t                  altif_n_ep;     /* #elements in altif_ep[] */
 615         uint_t                  altif_n_cvs;    /* #elements in  altif_cvs[] */
 616         uint_t                  altif_strsize;  /* size of string descr */
 617 } usb_alt_if_data_t;
 618 
 619 
 620 /*
 621  * Tree data structure for each endpoint of each alternate
 622  */
 623 typedef struct usb_ep_data {
 624         usb_ep_descr_t          ep_descr;       /* endpoint descriptor */
 625         usb_ep_comp_descr_t     ep_comp_descr;  /* endpoint companion descr */
 626         struct usb_cvs_data     *ep_cvs;        /* cv mod/extending this ep */
 627         uint_t                  ep_n_cvs;       /* #elements in ep_cvs[] */
 628 } usb_ep_data_t;
 629 
 630 
 631 /*
 632  * Tree data structure for each class/vendor specific descriptor
 633  */
 634 typedef struct usb_cvs_data {
 635         uchar_t                 *cvs_buf;       /* raw data of cvs descr */
 636         uint_t                  cvs_buf_len;    /* cvs_buf size */
 637 } usb_cvs_data_t;
 638 
 639 
 640 /*
 641  * Data structure for wireless USB specific descriptor
 642  */
 643 typedef struct usb_bos_data {
 644         usb_bos_descr_t         bos_descr;      /* parsed bos descr */
 645         usb_uwb_cap_descr_t     bos_uwb_cap;    /* uwb cap descr */
 646 } usb_bos_data_t;
 647 
 648 
 649 /*
 650  *      Parse_level determines the extent to which the tree is built, the amount
 651  *      of parsing usb_client_attach() is to do.  It has the following values:
 652  *
 653  *      USB_PARSE_LVL_NONE - Build no tree.  dev_n_cfg will return 0, dev_cfg
 654  *                           will return NULL, the dev_curr_xxx fields will be
 655  *                           invalid.
 656  *      USB_PARSE_LVL_IF   - Parse configured interface only, if configuration#
 657  *                           and interface properties are set (as when different
 658  *                           interfaces are viewed by the OS as different device
 659  *                           instances). If an OS device instance is set up to
 660  *                           represent an entire physical device, this works
 661  *                           like USB_PARSE_LVL_ALL.
 662  *      USB_PARSE_LVL_CFG  - Parse entire configuration of configured interface
 663  *                           only.  This is like USB_PARSE_LVL_IF except entire
 664  *                           configuration is returned.
 665  *      USB_PARSE_LVL_ALL  - Parse entire device (all configurations), even
 666  *                           when driver is bound to a single interface of a
 667  *                           single configuration.
 668  */
 669 typedef enum {


 674 } usb_reg_parse_lvl_t;
 675 
 676 
 677 /*
 678  * Registration data returned by usb_get_dev_data().  Configuration tree roots
 679  * are returned in dev_cfg array.
 680  */
 681 typedef struct usb_client_dev_data {
 682         usb_pipe_handle_t       dev_default_ph; /* default pipe handle */
 683         ddi_iblock_cookie_t     dev_iblock_cookie; /* for mutex_init's */
 684         struct usb_dev_descr    *dev_descr;     /* cooked device descriptor */
 685         char                    *dev_mfg;       /* manufacturing ID */
 686         char                    *dev_product;   /* product ID */
 687         char                    *dev_serial;    /* serial number */
 688         usb_reg_parse_lvl_t     dev_parse_level; /* USB_PARSE_LVL_* flag */
 689         struct usb_cfg_data     *dev_cfg;       /* configs for this device */
 690                                                 /* indexed by config index */
 691         uint_t                  dev_n_cfg;      /* #elements in dev_cfg[] */
 692         struct usb_cfg_data     *dev_curr_cfg;  /* current cfg */
 693         int                     dev_curr_if;    /* current interface number */
 694         struct usb_bos_data     *dev_bos;       /* bos for this device */
 695 } usb_client_dev_data_t;
 696 
 697 
 698 /*
 699  * ***************************************************************************
 700  * Device configuration descriptor tree functions
 701  * ***************************************************************************
 702  */
 703 
 704 /*
 705  * usb_get_dev_data:
 706  *      returns initialized registration data.  Most data items are clear.
 707  *      Among the items returned is the tree ofparsed descriptors in dev_cfg;
 708  *      and the number of configurations parsed in dev_n_cfg.
 709  *
 710  * Arguments:
 711  *      dip             - pointer to devinfo node of the client
 712  *      dev_data        - return registration data at this address
 713  *      parse_level     - See above
 714  *      flags           - None used




   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  *
  25  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  26  */
  27 
  28 #ifndef _SYS_USB_USBAI_H
  29 #define _SYS_USB_USBAI_H
  30 
  31 
  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 /* This header file is for USBA2.0 */
  37 #define USBA_MAJOR_VER 2
  38 #define USBA_MINOR_VER 0
  39 
  40 /*
  41  * USBAI: Interfaces Between USBA and Client Driver
  42  *
  43  *
  44  * Universal USB device state management :
  45  *


 430 #define USB_EP_MIN_HIGH_INTR_INTRVL     1
 431 #define USB_EP_MAX_HIGH_INTR_INTRVL     16
 432 #define USB_EP_MIN_FULL_ISOCH_INTRVL    1
 433 #define USB_EP_MAX_FULL_ISOCH_INTRVL    16
 434 #define USB_EP_MIN_HIGH_ISOCH_INTRVL    1
 435 #define USB_EP_MAX_HIGH_ISOCH_INTRVL    16
 436 
 437 /*
 438  * usb_string_descr:
 439  *      usb string descriptor, refer to  USB 2.0/9.6.7
 440  */
 441 typedef struct usb_string_descr {
 442         uint8_t         bLength;                /* descr size */
 443         uint8_t         bDescriptorType;        /* set to STRING */
 444         uint8_t         bString[1];             /* variable length unicode */
 445                                                 /* encoded string       */
 446 } usb_string_descr_t;
 447 
 448 #define USB_MAXSTRINGLEN        255             /* max string descr length */
 449 

 450 /*










































































































 451  * ***************************************************************************
 452  * Client driver registration with USBA
 453  * ***************************************************************************
 454  *
 455  *      The client registers with USBA during attach in two steps
 456  *      using usb_client_attach() and usb_get_dev_data(). On completion, the
 457  *      registration data has been initialized.  Most data items are
 458  *      straightforward.  Among the items returned in the data is the tree of
 459  *      parsed descriptors, in dev_cfg;  the number of configurations parsed,
 460  *      in dev_n_cfg; a pointer to the current configuration in the tree,
 461  *      in dev_curr_cfg; the index of the first valid interface in the
 462  *      tree, in dev_curr_if, and a parse level that accurately reflects what
 463  *      is in the tree, in dev_parse_level.
 464  */
 465 
 466 
 467 /*
 468  * ***************************************************************************
 469  * Data structures used in the configuration tree
 470  * ***************************************************************************


 500 /*
 501  * Tree data structure for each alternate of each alternate interface set
 502  */
 503 typedef struct usb_alt_if_data {
 504         usb_if_descr_t          altif_descr;    /* parsed alternate if descr */
 505         struct usb_ep_data      *altif_ep;      /* endpts for alt if */
 506                                                 /* (not a sparse array */
 507         struct usb_cvs_data     *altif_cvs;     /* cvs for this alt if */
 508         char                    *altif_str;     /* string descriptor */
 509         uint_t                  altif_n_ep;     /* #elements in altif_ep[] */
 510         uint_t                  altif_n_cvs;    /* #elements in  altif_cvs[] */
 511         uint_t                  altif_strsize;  /* size of string descr */
 512 } usb_alt_if_data_t;
 513 
 514 
 515 /*
 516  * Tree data structure for each endpoint of each alternate
 517  */
 518 typedef struct usb_ep_data {
 519         usb_ep_descr_t          ep_descr;       /* endpoint descriptor */

 520         struct usb_cvs_data     *ep_cvs;        /* cv mod/extending this ep */
 521         uint_t                  ep_n_cvs;       /* #elements in ep_cvs[] */
 522 } usb_ep_data_t;
 523 
 524 
 525 /*
 526  * Tree data structure for each class/vendor specific descriptor
 527  */
 528 typedef struct usb_cvs_data {
 529         uchar_t                 *cvs_buf;       /* raw data of cvs descr */
 530         uint_t                  cvs_buf_len;    /* cvs_buf size */
 531 } usb_cvs_data_t;
 532 
 533 
 534 /*









 535  *      Parse_level determines the extent to which the tree is built, the amount
 536  *      of parsing usb_client_attach() is to do.  It has the following values:
 537  *
 538  *      USB_PARSE_LVL_NONE - Build no tree.  dev_n_cfg will return 0, dev_cfg
 539  *                           will return NULL, the dev_curr_xxx fields will be
 540  *                           invalid.
 541  *      USB_PARSE_LVL_IF   - Parse configured interface only, if configuration#
 542  *                           and interface properties are set (as when different
 543  *                           interfaces are viewed by the OS as different device
 544  *                           instances). If an OS device instance is set up to
 545  *                           represent an entire physical device, this works
 546  *                           like USB_PARSE_LVL_ALL.
 547  *      USB_PARSE_LVL_CFG  - Parse entire configuration of configured interface
 548  *                           only.  This is like USB_PARSE_LVL_IF except entire
 549  *                           configuration is returned.
 550  *      USB_PARSE_LVL_ALL  - Parse entire device (all configurations), even
 551  *                           when driver is bound to a single interface of a
 552  *                           single configuration.
 553  */
 554 typedef enum {


 559 } usb_reg_parse_lvl_t;
 560 
 561 
 562 /*
 563  * Registration data returned by usb_get_dev_data().  Configuration tree roots
 564  * are returned in dev_cfg array.
 565  */
 566 typedef struct usb_client_dev_data {
 567         usb_pipe_handle_t       dev_default_ph; /* default pipe handle */
 568         ddi_iblock_cookie_t     dev_iblock_cookie; /* for mutex_init's */
 569         struct usb_dev_descr    *dev_descr;     /* cooked device descriptor */
 570         char                    *dev_mfg;       /* manufacturing ID */
 571         char                    *dev_product;   /* product ID */
 572         char                    *dev_serial;    /* serial number */
 573         usb_reg_parse_lvl_t     dev_parse_level; /* USB_PARSE_LVL_* flag */
 574         struct usb_cfg_data     *dev_cfg;       /* configs for this device */
 575                                                 /* indexed by config index */
 576         uint_t                  dev_n_cfg;      /* #elements in dev_cfg[] */
 577         struct usb_cfg_data     *dev_curr_cfg;  /* current cfg */
 578         int                     dev_curr_if;    /* current interface number */

 579 } usb_client_dev_data_t;
 580 
 581 
 582 /*
 583  * ***************************************************************************
 584  * Device configuration descriptor tree functions
 585  * ***************************************************************************
 586  */
 587 
 588 /*
 589  * usb_get_dev_data:
 590  *      returns initialized registration data.  Most data items are clear.
 591  *      Among the items returned is the tree ofparsed descriptors in dev_cfg;
 592  *      and the number of configurations parsed in dev_n_cfg.
 593  *
 594  * Arguments:
 595  *      dip             - pointer to devinfo node of the client
 596  *      dev_data        - return registration data at this address
 597  *      parse_level     - See above
 598  *      flags           - None used