1139749Simp/*-
2120431Ssimokawa * Copyright (C) 2003
3120431Ssimokawa * 	Hidetoshi Shimokawa. All rights reserved.
4120431Ssimokawa *
5120431Ssimokawa * Redistribution and use in source and binary forms, with or without
6120431Ssimokawa * modification, are permitted provided that the following conditions
7120431Ssimokawa * are met:
8120431Ssimokawa * 1. Redistributions of source code must retain the above copyright
9120431Ssimokawa *    notice, this list of conditions and the following disclaimer.
10120431Ssimokawa * 2. Redistributions in binary form must reproduce the above copyright
11120431Ssimokawa *    notice, this list of conditions and the following disclaimer in the
12120431Ssimokawa *    documentation and/or other materials provided with the distribution.
13120431Ssimokawa * 3. All advertising materials mentioning features or use of this software
14120431Ssimokawa *    must display the following acknowledgement:
15120431Ssimokawa *
16120431Ssimokawa *	This product includes software developed by Hidetoshi Shimokawa.
17120431Ssimokawa *
18120431Ssimokawa * 4. Neither the name of the author nor the names of its contributors
19120431Ssimokawa *    may be used to endorse or promote products derived from this software
20120431Ssimokawa *    without specific prior written permission.
21120431Ssimokawa *
22120431Ssimokawa * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23120431Ssimokawa * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24120431Ssimokawa * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25120431Ssimokawa * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26120431Ssimokawa * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27120431Ssimokawa * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28120431Ssimokawa * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29120431Ssimokawa * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30120431Ssimokawa * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31120431Ssimokawa * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32120431Ssimokawa * SUCH DAMAGE.
33120431Ssimokawa *
34120431Ssimokawa * $FreeBSD: releng/10.3/sys/dev/firewire/fwphyreg.h 188508 2009-02-12 03:05:42Z sbruno $
35120431Ssimokawa */
36120431Ssimokawa
37188508Ssbruno/*
38188508Ssbruno * IEEE 1394a
39188508Ssbruno * Figure 5B - 1
40188508Ssbruno */
41120431Ssimokawastruct phyreg_base {
42120431Ssimokawa#if BYTE_ORDER == BIG_ENDIAN
43129585Sdfr	uint8_t	phy_id:6,
44129585Sdfr		r:1,
45129585Sdfr		cps:1;
46129585Sdfr	uint8_t	rhb:1,
47129585Sdfr		ibr:1,
48129585Sdfr		gap_count:6;
49129585Sdfr	uint8_t	extended:3,
50129585Sdfr		num_ports:5;
51129585Sdfr	uint8_t	phy_speed:3,
52129585Sdfr		:1,
53129585Sdfr		delay:4;
54129585Sdfr	uint8_t	lctrl:1,
55129585Sdfr		c:1,
56129585Sdfr		jitter:3,
57129585Sdfr		pwr_class:3;
58129585Sdfr	uint8_t	wdie:1,
59129585Sdfr		isbr:1,
60129585Sdfr		ctoi:1,
61129585Sdfr		cpsi:1,
62129585Sdfr		stoi:1,
63129585Sdfr		pei:1,
64129585Sdfr		eaa:1,
65129585Sdfr		emc:1;
66129585Sdfr	uint8_t	legacy_spd:3,
67129585Sdfr		blink:1,
68129585Sdfr		bridge:2,
69129585Sdfr		:2;
70129585Sdfr	uint8_t	page_select:3,
71129585Sdfr		:1,
72129585Sdfr		port_select:4;
73120431Ssimokawa#else
74129585Sdfr	uint8_t	cps:1,
75129585Sdfr		r:1,
76129585Sdfr		phy_id:6;
77129585Sdfr	uint8_t	gap_count:6,
78129585Sdfr		ibr:1,
79129585Sdfr		rhb:1;
80129585Sdfr	uint8_t	num_ports:5,
81129585Sdfr		extended:3;
82129585Sdfr	uint8_t	delay:4,
83129585Sdfr		:1,
84129585Sdfr		phy_speed:3;
85129585Sdfr	uint8_t	pwr_class:3,
86129585Sdfr		jitter:3,
87129585Sdfr		c:1,
88129585Sdfr		lctrl:1;
89129585Sdfr	uint8_t	emc:1,
90129585Sdfr		eaa:1,
91129585Sdfr		pei:1,
92129585Sdfr		stoi:1,
93129585Sdfr		cpsi:1,
94129585Sdfr		ctoi:1,
95129585Sdfr		isbr:1,
96129585Sdfr		wdie:1;
97129585Sdfr	uint8_t	:2,
98129585Sdfr		bridge:2,
99129585Sdfr		blink:1,
100129585Sdfr		legacy_spd:3;
101129585Sdfr	uint8_t	port_select:4,
102129585Sdfr		:1,
103129585Sdfr		page_select:3;
104120431Ssimokawa#endif
105120431Ssimokawa};
106120431Ssimokawa
107188508Ssbruno/*
108188508Ssbruno * IEEE 1394a
109188508Ssbruno * Figure 5B - 2
110188508Ssbruno */
111120431Ssimokawastruct phyreg_page0 {
112120431Ssimokawa#if BYTE_ORDER == BIG_ENDIAN
113129585Sdfr	uint8_t	astat:2,
114129585Sdfr		bstat:2,
115129585Sdfr		ch:1,
116129585Sdfr		con:1,
117129585Sdfr		rxok:1,
118129585Sdfr		dis:1;
119129585Sdfr	uint8_t	negotiated_speed:3,
120129585Sdfr		pie:1,
121129585Sdfr		fault:1,
122129585Sdfr		stanby_fault:1,
123129585Sdfr		disscrm:1,
124129585Sdfr		b_only:1;
125129585Sdfr	uint8_t	dc_connected:1,
126129585Sdfr		max_port_speed:3,
127129585Sdfr		lpp:1,
128129585Sdfr		cable_speed:3;
129129585Sdfr	uint8_t	connection_unreliable:1,
130129585Sdfr		:3,
131129585Sdfr		beta_mode:1,
132129585Sdfr		:3;
133129585Sdfr	uint8_t	port_error;
134129585Sdfr	uint8_t	:5,
135129585Sdfr		loop_disable:1,
136129585Sdfr		in_standby:1,
137129585Sdfr		hard_disable:1;
138129585Sdfr	uint8_t	:8;
139129585Sdfr	uint8_t	:8;
140120431Ssimokawa#else
141129585Sdfr	uint8_t	dis:1,
142129585Sdfr		rxok:1,
143129585Sdfr		con:1,
144129585Sdfr		ch:1,
145129585Sdfr		bstat:2,
146129585Sdfr		astat:2;
147129585Sdfr	uint8_t	b_only:1,
148129585Sdfr		disscrm:1,
149129585Sdfr		stanby_fault:1,
150129585Sdfr		fault:1,
151129585Sdfr		pie:1,
152129585Sdfr		negotiated_speed:3;
153129585Sdfr	uint8_t	cable_speed:3,
154129585Sdfr		lpp:1,
155129585Sdfr		max_port_speed:3,
156129585Sdfr		dc_connected:1;
157129585Sdfr	uint8_t	:3,
158129585Sdfr		beta_mode:1,
159129585Sdfr		:3,
160129585Sdfr		connection_unreliable:1;
161129585Sdfr	uint8_t	port_error;
162129585Sdfr	uint8_t	hard_disable:1,
163129585Sdfr		in_standby:1,
164129585Sdfr		loop_disable:1,
165129585Sdfr		:5;
166129585Sdfr	uint8_t	:8;
167129585Sdfr	uint8_t	:8;
168120431Ssimokawa#endif
169120431Ssimokawa};
170120431Ssimokawa
171188508Ssbruno/*
172188508Ssbruno * IEEE 1394a
173188508Ssbruno * Figure 5B - 3
174188508Ssbruno */
175120431Ssimokawastruct phyreg_page1 {
176129585Sdfr	uint8_t	compliance;
177129585Sdfr	uint8_t	:8;
178129585Sdfr	uint8_t	vendor_id[3];
179129585Sdfr	uint8_t	product_id[3];
180120431Ssimokawa};
181