diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2010-07-22 05:58:05 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2010-07-27 05:04:11 -0400 |
commit | 1bcc69fb6a48edb3ddf2e8c42f1d1c242196bf74 (patch) | |
tree | 0399ebe11dc5a153d22acef24c67c27aa85eb0ab /tools | |
parent | 9f6d3c4b76314c40c866a935d78c80fd284768bd (diff) |
tools/firewire: nosy-dump: fix it on x86-64
Replace 'unsigned long' and the (unaffected) 'unsigned int' by uint32_t
if they represent quadlets.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/firewire/decode-fcp.c | 12 | ||||
-rw-r--r-- | tools/firewire/nosy-dump.c | 37 | ||||
-rw-r--r-- | tools/firewire/nosy-dump.h | 272 |
3 files changed, 112 insertions, 209 deletions
diff --git a/tools/firewire/decode-fcp.c b/tools/firewire/decode-fcp.c index cb9a31b37530..b6b372537618 100644 --- a/tools/firewire/decode-fcp.c +++ b/tools/firewire/decode-fcp.c | |||
@@ -158,12 +158,12 @@ static const struct avc_opcode_info opcode_info[256] = { | |||
158 | }; | 158 | }; |
159 | 159 | ||
160 | struct avc_frame { | 160 | struct avc_frame { |
161 | unsigned int operand0 : 8; | 161 | uint32_t operand0:8; |
162 | unsigned int opcode : 8; | 162 | uint32_t opcode:8; |
163 | unsigned int subunit_id : 3; | 163 | uint32_t subunit_id:3; |
164 | unsigned int subunit_type : 5; | 164 | uint32_t subunit_type:5; |
165 | unsigned int ctype : 4; | 165 | uint32_t ctype:4; |
166 | unsigned int cts : 4; | 166 | uint32_t cts:4; |
167 | }; | 167 | }; |
168 | 168 | ||
169 | static void | 169 | static void |
diff --git a/tools/firewire/nosy-dump.c b/tools/firewire/nosy-dump.c index 64e5ea438928..0bad0a42d772 100644 --- a/tools/firewire/nosy-dump.c +++ b/tools/firewire/nosy-dump.c | |||
@@ -46,7 +46,7 @@ enum { | |||
46 | }; | 46 | }; |
47 | 47 | ||
48 | static void | 48 | static void |
49 | print_packet(unsigned long *data, size_t length); | 49 | print_packet(uint32_t *data, size_t length); |
50 | static void | 50 | static void |
51 | decode_link_packet(struct link_packet *packet, size_t length, | 51 | decode_link_packet(struct link_packet *packet, size_t length, |
52 | int include_flags, int exclude_flags); | 52 | int include_flags, int exclude_flags); |
@@ -151,7 +151,7 @@ sigint_handler(int signal_num) | |||
151 | } | 151 | } |
152 | 152 | ||
153 | struct subaction * | 153 | struct subaction * |
154 | subaction_create(unsigned long *data, size_t length) | 154 | subaction_create(uint32_t *data, size_t length) |
155 | { | 155 | { |
156 | struct subaction *sa; | 156 | struct subaction *sa; |
157 | 157 | ||
@@ -247,9 +247,9 @@ handle_transaction(struct link_transaction *t) | |||
247 | 247 | ||
248 | if (option_verbose) { | 248 | if (option_verbose) { |
249 | list_for_each_entry(sa, &t->request_list, link) | 249 | list_for_each_entry(sa, &t->request_list, link) |
250 | print_packet((unsigned long *) &sa->packet, sa->length); | 250 | print_packet((uint32_t *) &sa->packet, sa->length); |
251 | list_for_each_entry(sa, &t->response_list, link) | 251 | list_for_each_entry(sa, &t->response_list, link) |
252 | print_packet((unsigned long *) &sa->packet, sa->length); | 252 | print_packet((uint32_t *) &sa->packet, sa->length); |
253 | } | 253 | } |
254 | printf("\r\n"); | 254 | printf("\r\n"); |
255 | 255 | ||
@@ -506,7 +506,7 @@ static struct packet_info packet_info[] = { | |||
506 | }; | 506 | }; |
507 | 507 | ||
508 | int | 508 | int |
509 | handle_packet(unsigned long *data, size_t length) | 509 | handle_packet(uint32_t *data, size_t length) |
510 | { | 510 | { |
511 | if (length == 0) { | 511 | if (length == 0) { |
512 | printf("bus reset\r\n"); | 512 | printf("bus reset\r\n"); |
@@ -642,8 +642,8 @@ handle_packet(unsigned long *data, size_t length) | |||
642 | 642 | ||
643 | unsigned int get_bits(struct link_packet *packet, int offset, int width) | 643 | unsigned int get_bits(struct link_packet *packet, int offset, int width) |
644 | { | 644 | { |
645 | unsigned long *data = (unsigned long *) packet; | 645 | uint32_t *data = (uint32_t *) packet; |
646 | unsigned long index, shift, mask; | 646 | uint32_t index, shift, mask; |
647 | 647 | ||
648 | index = offset / 32 + 1; | 648 | index = offset / 32 + 1; |
649 | shift = 32 - (offset & 31) - width; | 649 | shift = 32 - (offset & 31) - width; |
@@ -703,7 +703,7 @@ decode_link_packet(struct link_packet *packet, size_t length, | |||
703 | offset = f->offset; | 703 | offset = f->offset; |
704 | 704 | ||
705 | if (f->value_names != NULL) { | 705 | if (f->value_names != NULL) { |
706 | unsigned long bits; | 706 | uint32_t bits; |
707 | 707 | ||
708 | bits = get_bits(packet, offset, f->width); | 708 | bits = get_bits(packet, offset, f->width); |
709 | printf("%s", f->value_names[bits]); | 709 | printf("%s", f->value_names[bits]); |
@@ -741,18 +741,18 @@ decode_link_packet(struct link_packet *packet, size_t length, | |||
741 | } | 741 | } |
742 | 742 | ||
743 | static void | 743 | static void |
744 | print_packet(unsigned long *data, size_t length) | 744 | print_packet(uint32_t *data, size_t length) |
745 | { | 745 | { |
746 | int i; | 746 | int i; |
747 | 747 | ||
748 | printf("%6lu ", data[0]); | 748 | printf("%6u ", data[0]); |
749 | 749 | ||
750 | if (length == 4) | 750 | if (length == 4) |
751 | printf("bus reset"); | 751 | printf("bus reset"); |
752 | else if (length < sizeof(struct phy_packet)) { | 752 | else if (length < sizeof(struct phy_packet)) { |
753 | printf("short packet: "); | 753 | printf("short packet: "); |
754 | for (i = 1; i < length / 4; i++) | 754 | for (i = 1; i < length / 4; i++) |
755 | printf("%s%08lx", i == 0 ? "[" : " ", data[i]); | 755 | printf("%s%08x", i == 0 ? "[" : " ", data[i]); |
756 | printf("]"); | 756 | printf("]"); |
757 | 757 | ||
758 | } | 758 | } |
@@ -803,7 +803,7 @@ print_packet(unsigned long *data, size_t length) | |||
803 | default: | 803 | default: |
804 | printf("unknown phy packet: "); | 804 | printf("unknown phy packet: "); |
805 | for (i = 1; i < length / 4; i++) | 805 | for (i = 1; i < length / 4; i++) |
806 | printf("%s%08lx", i == 0 ? "[" : " ", data[i]); | 806 | printf("%s%08x", i == 0 ? "[" : " ", data[i]); |
807 | printf("]"); | 807 | printf("]"); |
808 | break; | 808 | break; |
809 | } | 809 | } |
@@ -829,7 +829,7 @@ print_packet(unsigned long *data, size_t length) | |||
829 | #define CLEAR "\033[H\033[2J" | 829 | #define CLEAR "\033[H\033[2J" |
830 | 830 | ||
831 | static void | 831 | static void |
832 | print_stats(unsigned long *data, size_t length) | 832 | print_stats(uint32_t *data, size_t length) |
833 | { | 833 | { |
834 | static int bus_reset_count, short_packet_count, phy_packet_count; | 834 | static int bus_reset_count, short_packet_count, phy_packet_count; |
835 | static int tcode_count[16]; | 835 | static int tcode_count[16]; |
@@ -959,8 +959,8 @@ int main(int argc, const char *argv[]) | |||
959 | setvbuf(stdout, NULL, _IOLBF, BUFSIZ); | 959 | setvbuf(stdout, NULL, _IOLBF, BUFSIZ); |
960 | 960 | ||
961 | if (1) { | 961 | if (1) { |
962 | unsigned long buf[128 * 1024]; | 962 | uint32_t buf[128 * 1024]; |
963 | unsigned int filter; | 963 | uint32_t filter; |
964 | int length; | 964 | int length; |
965 | 965 | ||
966 | filter = ~0; | 966 | filter = ~0; |
@@ -968,11 +968,10 @@ int main(int argc, const char *argv[]) | |||
968 | filter &= ~(1 <<TCODE_ISO_DATA); | 968 | filter &= ~(1 <<TCODE_ISO_DATA); |
969 | if (!option_cycle_start) | 969 | if (!option_cycle_start) |
970 | filter &= ~(1 << TCODE_CYCLE_START); | 970 | filter &= ~(1 << TCODE_CYCLE_START); |
971 | |||
972 | if (view == VIEW_STATS) | 971 | if (view == VIEW_STATS) |
973 | ioctl(fd, NOSY_IOC_FILTER, ~(1 << TCODE_CYCLE_START)); | 972 | filter = ~(1 << TCODE_CYCLE_START); |
974 | else | 973 | |
975 | ioctl(fd, NOSY_IOC_FILTER, filter); | 974 | ioctl(fd, NOSY_IOC_FILTER, filter); |
976 | 975 | ||
977 | ioctl(fd, NOSY_IOC_START); | 976 | ioctl(fd, NOSY_IOC_START); |
978 | 977 | ||
diff --git a/tools/firewire/nosy-dump.h b/tools/firewire/nosy-dump.h index d8bcb61ab954..60cf556e228e 100644 --- a/tools/firewire/nosy-dump.h +++ b/tools/firewire/nosy-dump.h | |||
@@ -33,61 +33,63 @@ | |||
33 | #define SPEED_200 0x1 | 33 | #define SPEED_200 0x1 |
34 | #define SPEED_400 0x2 | 34 | #define SPEED_400 0x2 |
35 | 35 | ||
36 | struct phy_packet { | 36 | #include <stdint.h> |
37 | unsigned long timestamp; | ||
38 | 37 | ||
38 | struct phy_packet { | ||
39 | uint32_t timestamp; | ||
39 | union { | 40 | union { |
40 | struct { | 41 | struct { |
41 | unsigned int zero : 24; | 42 | uint32_t zero:24; |
42 | unsigned int phy_id : 6; | 43 | uint32_t phy_id:6; |
43 | unsigned int identifier : 2; | 44 | uint32_t identifier:2; |
44 | } common, link_on; | 45 | } common, link_on; |
46 | |||
45 | struct { | 47 | struct { |
46 | unsigned int zero : 16; | 48 | uint32_t zero:16; |
47 | unsigned int gap_count : 6; | 49 | uint32_t gap_count:6; |
48 | unsigned int set_gap_count : 1; | 50 | uint32_t set_gap_count:1; |
49 | unsigned int set_root : 1; | 51 | uint32_t set_root:1; |
50 | unsigned int root_id : 6; | 52 | uint32_t root_id:6; |
51 | unsigned int identifier : 2; | 53 | uint32_t identifier:2; |
52 | } phy_config; | 54 | } phy_config; |
55 | |||
53 | struct { | 56 | struct { |
54 | unsigned int more_packets : 1; | 57 | uint32_t more_packets:1; |
55 | unsigned int initiated_reset : 1; | 58 | uint32_t initiated_reset:1; |
56 | unsigned int port2 : 2; | 59 | uint32_t port2:2; |
57 | unsigned int port1 : 2; | 60 | uint32_t port1:2; |
58 | unsigned int port0 : 2; | 61 | uint32_t port0:2; |
59 | unsigned int power_class : 3; | 62 | uint32_t power_class:3; |
60 | unsigned int contender : 1; | 63 | uint32_t contender:1; |
61 | unsigned int phy_delay : 2; | 64 | uint32_t phy_delay:2; |
62 | unsigned int phy_speed : 2; | 65 | uint32_t phy_speed:2; |
63 | unsigned int gap_count : 6; | 66 | uint32_t gap_count:6; |
64 | unsigned int link_active : 1; | 67 | uint32_t link_active:1; |
65 | unsigned int extended : 1; | 68 | uint32_t extended:1; |
66 | unsigned int phy_id : 6; | 69 | uint32_t phy_id:6; |
67 | unsigned int identifier : 2; | 70 | uint32_t identifier:2; |
68 | } self_id; | 71 | } self_id; |
69 | 72 | ||
70 | struct { | 73 | struct { |
71 | unsigned int more_packets : 1; | 74 | uint32_t more_packets:1; |
72 | unsigned int reserved1 : 1; | 75 | uint32_t reserved1:1; |
73 | unsigned int porth : 2; | 76 | uint32_t porth:2; |
74 | unsigned int portg : 2; | 77 | uint32_t portg:2; |
75 | unsigned int portf : 2; | 78 | uint32_t portf:2; |
76 | unsigned int porte : 2; | 79 | uint32_t porte:2; |
77 | unsigned int portd : 2; | 80 | uint32_t portd:2; |
78 | unsigned int portc : 2; | 81 | uint32_t portc:2; |
79 | unsigned int portb : 2; | 82 | uint32_t portb:2; |
80 | unsigned int porta : 2; | 83 | uint32_t porta:2; |
81 | unsigned int reserved0 : 2; | 84 | uint32_t reserved0:2; |
82 | unsigned int sequence : 3; | 85 | uint32_t sequence:3; |
83 | unsigned int extended : 1; | 86 | uint32_t extended:1; |
84 | unsigned int phy_id : 6; | 87 | uint32_t phy_id:6; |
85 | unsigned int identifier : 2; | 88 | uint32_t identifier:2; |
86 | } ext_self_id; | 89 | } ext_self_id; |
87 | }; | 90 | }; |
88 | 91 | uint32_t inverted; | |
89 | unsigned long inverted; | 92 | uint32_t ack; |
90 | unsigned long ack; | ||
91 | }; | 93 | }; |
92 | 94 | ||
93 | #define PHY_PACKET_CONFIGURATION 0x00 | 95 | #define PHY_PACKET_CONFIGURATION 0x00 |
@@ -95,186 +97,88 @@ struct phy_packet { | |||
95 | #define PHY_PACKET_SELF_ID 0x02 | 97 | #define PHY_PACKET_SELF_ID 0x02 |
96 | 98 | ||
97 | struct link_packet { | 99 | struct link_packet { |
98 | unsigned long timestamp; | 100 | uint32_t timestamp; |
99 | |||
100 | union { | 101 | union { |
101 | struct { | 102 | struct { |
102 | unsigned int priority : 4; | 103 | uint32_t priority:4; |
103 | unsigned int tcode : 4; | 104 | uint32_t tcode:4; |
104 | unsigned int rt : 2; | 105 | uint32_t rt:2; |
105 | unsigned int tlabel : 6; | 106 | uint32_t tlabel:6; |
106 | unsigned int destination : 16; | 107 | uint32_t destination:16; |
107 | 108 | ||
108 | unsigned int offset_high : 16; | 109 | uint32_t offset_high:16; |
109 | unsigned int source : 16; | 110 | uint32_t source:16; |
110 | 111 | ||
111 | unsigned long offset_low; | 112 | uint32_t offset_low; |
112 | } common; | 113 | } common; |
113 | 114 | ||
114 | struct { | 115 | struct { |
115 | unsigned int priority : 4; | 116 | uint32_t common[3]; |
116 | unsigned int tcode : 4; | 117 | uint32_t crc; |
117 | unsigned int rt : 2; | ||
118 | unsigned int tlabel : 6; | ||
119 | unsigned int destination : 16; | ||
120 | |||
121 | unsigned int offset_high : 16; | ||
122 | unsigned int source : 16; | ||
123 | |||
124 | unsigned long offset_low; | ||
125 | |||
126 | unsigned long crc; | ||
127 | } read_quadlet; | 118 | } read_quadlet; |
128 | 119 | ||
129 | struct { | 120 | struct { |
130 | unsigned int priority : 4; | 121 | uint32_t common[3]; |
131 | unsigned int tcode : 4; | 122 | uint32_t data; |
132 | unsigned int rt : 2; | 123 | uint32_t crc; |
133 | unsigned int tlabel : 6; | ||
134 | unsigned int destination : 16; | ||
135 | |||
136 | unsigned int reserved0 : 12; | ||
137 | unsigned int rcode : 4; | ||
138 | unsigned int source : 16; | ||
139 | |||
140 | unsigned long reserved1; | ||
141 | |||
142 | unsigned long data; | ||
143 | |||
144 | unsigned long crc; | ||
145 | } read_quadlet_response; | 124 | } read_quadlet_response; |
146 | 125 | ||
147 | struct { | 126 | struct { |
148 | unsigned int priority : 4; | 127 | uint32_t common[3]; |
149 | unsigned int tcode : 4; | 128 | uint32_t extended_tcode:16; |
150 | unsigned int rt : 2; | 129 | uint32_t data_length:16; |
151 | unsigned int tlabel : 6; | 130 | uint32_t crc; |
152 | unsigned int destination : 16; | ||
153 | |||
154 | unsigned int offset_high : 16; | ||
155 | unsigned int source : 16; | ||
156 | |||
157 | unsigned long offset_low; | ||
158 | |||
159 | unsigned int extended_tcode : 16; | ||
160 | unsigned int data_length : 16; | ||
161 | |||
162 | unsigned long crc; | ||
163 | } read_block; | 131 | } read_block; |
164 | 132 | ||
165 | struct { | 133 | struct { |
166 | unsigned int priority : 4; | 134 | uint32_t common[3]; |
167 | unsigned int tcode : 4; | 135 | uint32_t extended_tcode:16; |
168 | unsigned int rt : 2; | 136 | uint32_t data_length:16; |
169 | unsigned int tlabel : 6; | 137 | uint32_t crc; |
170 | unsigned int destination : 16; | 138 | uint32_t data[0]; |
171 | |||
172 | unsigned int reserved0 : 12; | ||
173 | unsigned int rcode : 4; | ||
174 | unsigned int source : 16; | ||
175 | |||
176 | unsigned long reserved1; | ||
177 | |||
178 | unsigned int extended_tcode : 16; | ||
179 | unsigned int data_length : 16; | ||
180 | |||
181 | unsigned long crc; | ||
182 | |||
183 | unsigned long data[0]; | ||
184 | |||
185 | /* crc and ack follows. */ | 139 | /* crc and ack follows. */ |
186 | |||
187 | } read_block_response; | 140 | } read_block_response; |
188 | 141 | ||
189 | struct { | 142 | struct { |
190 | unsigned int priority : 4; | 143 | uint32_t common[3]; |
191 | unsigned int tcode : 4; | 144 | uint32_t data; |
192 | unsigned int rt : 2; | 145 | uint32_t crc; |
193 | unsigned int tlabel : 6; | ||
194 | unsigned int destination : 16; | ||
195 | |||
196 | unsigned int offset_high : 16; | ||
197 | unsigned int source : 16; | ||
198 | |||
199 | unsigned long offset_low; | ||
200 | |||
201 | unsigned long data; | ||
202 | |||
203 | unsigned long crc; | ||
204 | |||
205 | } write_quadlet; | 146 | } write_quadlet; |
206 | 147 | ||
207 | struct { | 148 | struct { |
208 | unsigned int priority : 4; | 149 | uint32_t common[3]; |
209 | unsigned int tcode : 4; | 150 | uint32_t extended_tcode:16; |
210 | unsigned int rt : 2; | 151 | uint32_t data_length:16; |
211 | unsigned int tlabel : 6; | 152 | uint32_t crc; |
212 | unsigned int destination : 16; | 153 | uint32_t data[0]; |
213 | |||
214 | unsigned int offset_high : 16; | ||
215 | unsigned int source : 16; | ||
216 | |||
217 | unsigned int offset_low : 32; | ||
218 | |||
219 | unsigned int extended_tcode : 16; | ||
220 | unsigned int data_length : 16; | ||
221 | |||
222 | unsigned long crc; | ||
223 | unsigned long data[0]; | ||
224 | |||
225 | /* crc and ack follows. */ | 154 | /* crc and ack follows. */ |
226 | |||
227 | } write_block; | 155 | } write_block; |
228 | 156 | ||
229 | struct { | 157 | struct { |
230 | unsigned int priority : 4; | 158 | uint32_t common[3]; |
231 | unsigned int tcode : 4; | 159 | uint32_t crc; |
232 | unsigned int rt : 2; | ||
233 | unsigned int tlabel : 6; | ||
234 | unsigned int destination : 16; | ||
235 | |||
236 | unsigned int reserved0 : 12; | ||
237 | unsigned int rcode : 4; | ||
238 | unsigned int source : 16; | ||
239 | |||
240 | unsigned long reserved1; | ||
241 | |||
242 | unsigned long crc; | ||
243 | } write_response; | 160 | } write_response; |
244 | 161 | ||
245 | struct { | 162 | struct { |
246 | unsigned int priority : 4; | 163 | uint32_t common[3]; |
247 | unsigned int tcode : 4; | 164 | uint32_t data; |
248 | unsigned int rt : 2; | 165 | uint32_t crc; |
249 | unsigned int tlabel : 6; | ||
250 | unsigned int destination : 16; | ||
251 | |||
252 | unsigned int offset_high : 16; | ||
253 | unsigned int source : 16; | ||
254 | |||
255 | unsigned long offset_low; | ||
256 | |||
257 | unsigned long data; | ||
258 | |||
259 | unsigned long crc; | ||
260 | } cycle_start; | 166 | } cycle_start; |
261 | 167 | ||
262 | struct { | 168 | struct { |
263 | unsigned int sy : 4; | 169 | uint32_t sy:4; |
264 | unsigned int tcode : 4; | 170 | uint32_t tcode:4; |
265 | unsigned int channel : 6; | 171 | uint32_t channel:6; |
266 | unsigned int tag : 2; | 172 | uint32_t tag:2; |
267 | unsigned int data_length : 16; | 173 | uint32_t data_length:16; |
268 | 174 | ||
269 | unsigned long crc; | 175 | uint32_t crc; |
270 | } iso_data; | 176 | } iso_data; |
271 | |||
272 | }; | 177 | }; |
273 | |||
274 | }; | 178 | }; |
275 | 179 | ||
276 | struct subaction { | 180 | struct subaction { |
277 | unsigned long ack; | 181 | uint32_t ack; |
278 | size_t length; | 182 | size_t length; |
279 | struct list link; | 183 | struct list link; |
280 | struct link_packet packet; | 184 | struct link_packet packet; |