1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Wireless USB - Cable Based Association 4 * 5 * Copyright (C) 2006 Intel Corporation 6 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License version 10 * 2 as published by the Free Software Foundation. 11 * 12 */ 13 #ifndef __LINUX_USB_ASSOCIATION_H 14 #define __LINUX_USB_ASSOCIATION_H 15 16 17 /* 18 * Association attributes 19 * 20 * Association Models Supplement to WUSB 1.0 T[3-1] 21 * 22 * Each field in the structures has it's ID, it's length and then the 23 * value. This is the actual definition of the field's ID and its 24 * length. 25 */ 26 struct wusb_am_attr { 27 __u8 id; 28 __u8 len; 29 }; 30 31 /* Different fields defined by the spec */ 32 #define WUSB_AR_AssociationTypeId { .id = cpu_to_le16(0x0000), .len = cpu_to_le16(2) } 33 #define WUSB_AR_AssociationSubTypeId { .id = cpu_to_le16(0x0001), .len = cpu_to_le16(2) } 34 #define WUSB_AR_Length { .id = cpu_to_le16(0x0002), .len = cpu_to_le16(4) } 35 #define WUSB_AR_AssociationStatus { .id = cpu_to_le16(0x0004), .len = cpu_to_le16(4) } 36 #define WUSB_AR_LangID { .id = cpu_to_le16(0x0008), .len = cpu_to_le16(2) } 37 #define WUSB_AR_DeviceFriendlyName { .id = cpu_to_le16(0x000b), .len = cpu_to_le16(64) } /* max */ 38 #define WUSB_AR_HostFriendlyName { .id = cpu_to_le16(0x000c), .len = cpu_to_le16(64) } /* max */ 39 #define WUSB_AR_CHID { .id = cpu_to_le16(0x1000), .len = cpu_to_le16(16) } 40 #define WUSB_AR_CDID { .id = cpu_to_le16(0x1001), .len = cpu_to_le16(16) } 41 #define WUSB_AR_ConnectionContext { .id = cpu_to_le16(0x1002), .len = cpu_to_le16(48) } 42 #define WUSB_AR_BandGroups { .id = cpu_to_le16(0x1004), .len = cpu_to_le16(2) } 43 44 /* CBAF Control Requests (AMS1.0[T4-1] */ 45 enum { 46 CBAF_REQ_GET_ASSOCIATION_INFORMATION = 0x01, 47 CBAF_REQ_GET_ASSOCIATION_REQUEST, 48 CBAF_REQ_SET_ASSOCIATION_RESPONSE 49 }; 50 51 /* 52 * CBAF USB-interface defitions 53 * 54 * No altsettings, one optional interrupt endpoint. 55 */ 56 enum { 57 CBAF_IFACECLASS = 0xef, 58 CBAF_IFACESUBCLASS = 0x03, 59 CBAF_IFACEPROTOCOL = 0x01, 60 }; 61 62 /* Association Information (AMS1.0[T4-3]) */ 63 struct wusb_cbaf_assoc_info { 64 __le16 Length; 65 __u8 NumAssociationRequests; 66 __le16 Flags; 67 __u8 AssociationRequestsArray[]; 68 } __attribute__((packed)); 69 70 /* Association Request (AMS1.0[T4-4]) */ 71 struct wusb_cbaf_assoc_request { 72 __u8 AssociationDataIndex; 73 __u8 Reserved; 74 __le16 AssociationTypeId; 75 __le16 AssociationSubTypeId; 76 __le32 AssociationTypeInfoSize; 77 } __attribute__((packed)); 78 79 enum { 80 AR_TYPE_WUSB = 0x0001, 81 AR_TYPE_WUSB_RETRIEVE_HOST_INFO = 0x0000, 82 AR_TYPE_WUSB_ASSOCIATE = 0x0001, 83 }; 84 85 /* Association Attribute header (AMS1.0[3.8]) */ 86 struct wusb_cbaf_attr_hdr { 87 __le16 id; 88 __le16 len; 89 } __attribute__((packed)); 90 91 /* Host Info (AMS1.0[T4-7]) (yeah, more headers and fields...) */ 92 struct wusb_cbaf_host_info { 93 struct wusb_cbaf_attr_hdr AssociationTypeId_hdr; 94 __le16 AssociationTypeId; 95 struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr; 96 __le16 AssociationSubTypeId; 97 struct wusb_cbaf_attr_hdr CHID_hdr; 98 struct wusb_ckhdid CHID; 99 struct wusb_cbaf_attr_hdr LangID_hdr; 100 __le16 LangID; 101 struct wusb_cbaf_attr_hdr HostFriendlyName_hdr; 102 __u8 HostFriendlyName[]; 103 } __attribute__((packed)); 104 105 /* Device Info (AMS1.0[T4-8]) 106 * 107 * I still don't get this tag'n'header stuff for each goddamn 108 * field... 109 */ 110 struct wusb_cbaf_device_info { 111 struct wusb_cbaf_attr_hdr Length_hdr; 112 __le32 Length; 113 struct wusb_cbaf_attr_hdr CDID_hdr; 114 struct wusb_ckhdid CDID; 115 struct wusb_cbaf_attr_hdr BandGroups_hdr; 116 __le16 BandGroups; 117 struct wusb_cbaf_attr_hdr LangID_hdr; 118 __le16 LangID; 119 struct wusb_cbaf_attr_hdr DeviceFriendlyName_hdr; 120 __u8 DeviceFriendlyName[]; 121 } __attribute__((packed)); 122 123 /* Connection Context; CC_DATA - Success case (AMS1.0[T4-9]) */ 124 struct wusb_cbaf_cc_data { 125 struct wusb_cbaf_attr_hdr AssociationTypeId_hdr; 126 __le16 AssociationTypeId; 127 struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr; 128 __le16 AssociationSubTypeId; 129 struct wusb_cbaf_attr_hdr Length_hdr; 130 __le32 Length; 131 struct wusb_cbaf_attr_hdr ConnectionContext_hdr; 132 struct wusb_ckhdid CHID; 133 struct wusb_ckhdid CDID; 134 struct wusb_ckhdid CK; 135 struct wusb_cbaf_attr_hdr BandGroups_hdr; 136 __le16 BandGroups; 137 } __attribute__((packed)); 138 139 /* CC_DATA - Failure case (AMS1.0[T4-10]) */ 140 struct wusb_cbaf_cc_data_fail { 141 struct wusb_cbaf_attr_hdr AssociationTypeId_hdr; 142 __le16 AssociationTypeId; 143 struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr; 144 __le16 AssociationSubTypeId; 145 struct wusb_cbaf_attr_hdr Length_hdr; 146 __le16 Length; 147 struct wusb_cbaf_attr_hdr AssociationStatus_hdr; 148 __u32 AssociationStatus; 149 } __attribute__((packed)); 150 151 #endif /* __LINUX_USB_ASSOCIATION_H */ 152