1/* $FreeBSD: head/tools/tools/bus_autoconf/bus_autoconf_format_example.txt 223534 2011-06-25 13:44:05Z hselasky $ */
2
3#if BYTE_ORDER == BIG_ENDIAN
4#define	U16_XOR "8"
5#define	U32_XOR "12"
6#define	U64_XOR "56"
7#define	U8_BITFIELD_XOR "7"
8#define	U16_BITFIELD_XOR "15"
9#define	U32_BITFIELD_XOR "31"
10#define	U64_BITFIELD_XOR "63"
11#else
12#define	U16_XOR "0"
13#define	U32_XOR "0"
14#define	U64_XOR "0"
15#define	U8_BITFIELD_XOR "0"
16#define	U16_BITFIELD_XOR "0"
17#define	U32_BITFIELD_XOR "0"
18#define	U64_BITFIELD_XOR "0"
19#endif
20
21#if USB_HAVE_COMPAT_LINUX
22#define	MFL_SIZE "1"
23#else
24#define	MFL_SIZE "0"
25#endif
26
27static const char __section("bus_autoconf_format") __used usb_id_format[] = {
28
29		/*
30		 * Declare three different sections that use the same format.
31		 * All sizes are in bits. Fields cannot be greater than
32		 * 8 bits in size. Bitfields having a size greater than 1
33		 * must fit within the byte in which the bitfield is defined.
34		 */
35
36		"usb_host_id{256,:}"
37		"usb_device_id{256,:}"
38		"usb_dual_id{256,:}"
39
40		/*
41		 * Describe all fields in the usb_device_id structure
42		 * which is found in sys/dev/usb/usbdi.h.
43		 */
44
45#if BITS_PER_LONG == 32 || BITS_PER_LONG == 64
46		"unused{0,8}"
47		"unused{0,8}"
48		"unused{0,8}"
49		"unused{0,8}"
50#if BITS_PER_LONG == 64
51		"unused{0,8}"
52		"unused{0,8}"
53		"unused{0,8}"
54		"unused{0,8}"
55#endif
56#else
57#error "Please update code."
58#endif
59
60		"idVendor[0]{" U16_XOR ",8}"
61		"idVendor[1]{" U16_XOR ",8}"
62		"idProduct[0]{" U16_XOR ",8}"
63		"idProduct[1]{" U16_XOR ",8}"
64		"bcdDevice_lo[0]{" U16_XOR ",8}"
65		"bcdDevice_lo[1]{" U16_XOR ",8}"
66		"bcdDevice_hi[0]{" U16_XOR ",8}"
67		"bcdDevice_hi[1]{" U16_XOR ",8}"
68
69		"bDeviceClass{0,8}"
70		"bDeviceSubClass{0,8}"
71		"bDeviceProtocol{0,8}"
72		"bInterfaceClass{0,8}"
73		"bInterfaceSubClass{0,8}"
74		"bInterfaceProtocol{0,8}"
75
76/* NOTE: On big endian machines bitfields are bitreversed. */
77
78		"mf_vendor{" U8_BITFIELD_XOR ",1}"
79		"mf_product{" U8_BITFIELD_XOR ",1}"
80		"mf_dev_lo{" U8_BITFIELD_XOR ",1}"
81		"mf_dev_hi{" U8_BITFIELD_XOR ",1}"
82
83		"mf_dev_class{" U8_BITFIELD_XOR ",1}"
84		"mf_dev_subclass{" U8_BITFIELD_XOR ",1}"
85		"mf_dev_protocol{" U8_BITFIELD_XOR ",1}"
86		"mf_int_class{" U8_BITFIELD_XOR ",1}"
87
88		"mf_int_subclass{" U8_BITFIELD_XOR ",1}"
89		"mf_int_protocol{" U8_BITFIELD_XOR ",1}"
90		"unused{" U8_BITFIELD_XOR ",6}"
91
92		"mfl_vendor{" U16_XOR "," MFL_SIZE "}"
93		"mfl_product{" U16_XOR "," MFL_SIZE "}"
94		"mfl_dev_lo{" U16_XOR "," MFL_SIZE "}"
95		"mfl_dev_hi{" U16_XOR "," MFL_SIZE "}"
96
97		"mfl_dev_class{" U16_XOR "," MFL_SIZE "}"
98		"mfl_dev_subclass{" U16_XOR "," MFL_SIZE "}"
99		"mfl_dev_protocol{" U16_XOR "," MFL_SIZE "}"
100		"mfl_int_class{" U16_XOR "," MFL_SIZE "}"
101
102		"mfl_int_subclass{" U16_XOR "," MFL_SIZE "}"
103		"mfl_int_protocol{" U16_XOR "," MFL_SIZE "}"
104		"unused{" U16_XOR "," MFL_SIZE "}"
105		"unused{" U16_XOR "," MFL_SIZE "}"
106
107		"unused{" U16_XOR "," MFL_SIZE "}"
108		"unused{" U16_XOR "," MFL_SIZE "}"
109		"unused{" U16_XOR "," MFL_SIZE "}"
110		"unused{" U16_XOR "," MFL_SIZE "}"
111};
112