Commit 1bcc69fb authored by Stefan Richter's avatar Stefan Richter

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: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 9f6d3c4b
...@@ -158,12 +158,12 @@ static const struct avc_opcode_info opcode_info[256] = { ...@@ -158,12 +158,12 @@ static const struct avc_opcode_info opcode_info[256] = {
}; };
struct avc_frame { struct avc_frame {
unsigned int operand0 : 8; uint32_t operand0:8;
unsigned int opcode : 8; uint32_t opcode:8;
unsigned int subunit_id : 3; uint32_t subunit_id:3;
unsigned int subunit_type : 5; uint32_t subunit_type:5;
unsigned int ctype : 4; uint32_t ctype:4;
unsigned int cts : 4; uint32_t cts:4;
}; };
static void static void
......
...@@ -46,7 +46,7 @@ enum { ...@@ -46,7 +46,7 @@ enum {
}; };
static void static void
print_packet(unsigned long *data, size_t length); print_packet(uint32_t *data, size_t length);
static void static void
decode_link_packet(struct link_packet *packet, size_t length, decode_link_packet(struct link_packet *packet, size_t length,
int include_flags, int exclude_flags); int include_flags, int exclude_flags);
...@@ -151,7 +151,7 @@ sigint_handler(int signal_num) ...@@ -151,7 +151,7 @@ sigint_handler(int signal_num)
} }
struct subaction * struct subaction *
subaction_create(unsigned long *data, size_t length) subaction_create(uint32_t *data, size_t length)
{ {
struct subaction *sa; struct subaction *sa;
...@@ -247,9 +247,9 @@ handle_transaction(struct link_transaction *t) ...@@ -247,9 +247,9 @@ handle_transaction(struct link_transaction *t)
if (option_verbose) { if (option_verbose) {
list_for_each_entry(sa, &t->request_list, link) list_for_each_entry(sa, &t->request_list, link)
print_packet((unsigned long *) &sa->packet, sa->length); print_packet((uint32_t *) &sa->packet, sa->length);
list_for_each_entry(sa, &t->response_list, link) list_for_each_entry(sa, &t->response_list, link)
print_packet((unsigned long *) &sa->packet, sa->length); print_packet((uint32_t *) &sa->packet, sa->length);
} }
printf("\r\n"); printf("\r\n");
...@@ -506,7 +506,7 @@ static struct packet_info packet_info[] = { ...@@ -506,7 +506,7 @@ static struct packet_info packet_info[] = {
}; };
int int
handle_packet(unsigned long *data, size_t length) handle_packet(uint32_t *data, size_t length)
{ {
if (length == 0) { if (length == 0) {
printf("bus reset\r\n"); printf("bus reset\r\n");
...@@ -642,8 +642,8 @@ handle_packet(unsigned long *data, size_t length) ...@@ -642,8 +642,8 @@ handle_packet(unsigned long *data, size_t length)
unsigned int get_bits(struct link_packet *packet, int offset, int width) unsigned int get_bits(struct link_packet *packet, int offset, int width)
{ {
unsigned long *data = (unsigned long *) packet; uint32_t *data = (uint32_t *) packet;
unsigned long index, shift, mask; uint32_t index, shift, mask;
index = offset / 32 + 1; index = offset / 32 + 1;
shift = 32 - (offset & 31) - width; shift = 32 - (offset & 31) - width;
...@@ -703,7 +703,7 @@ decode_link_packet(struct link_packet *packet, size_t length, ...@@ -703,7 +703,7 @@ decode_link_packet(struct link_packet *packet, size_t length,
offset = f->offset; offset = f->offset;
if (f->value_names != NULL) { if (f->value_names != NULL) {
unsigned long bits; uint32_t bits;
bits = get_bits(packet, offset, f->width); bits = get_bits(packet, offset, f->width);
printf("%s", f->value_names[bits]); printf("%s", f->value_names[bits]);
...@@ -741,18 +741,18 @@ decode_link_packet(struct link_packet *packet, size_t length, ...@@ -741,18 +741,18 @@ decode_link_packet(struct link_packet *packet, size_t length,
} }
static void static void
print_packet(unsigned long *data, size_t length) print_packet(uint32_t *data, size_t length)
{ {
int i; int i;
printf("%6lu ", data[0]); printf("%6u ", data[0]);
if (length == 4) if (length == 4)
printf("bus reset"); printf("bus reset");
else if (length < sizeof(struct phy_packet)) { else if (length < sizeof(struct phy_packet)) {
printf("short packet: "); printf("short packet: ");
for (i = 1; i < length / 4; i++) for (i = 1; i < length / 4; i++)
printf("%s%08lx", i == 0 ? "[" : " ", data[i]); printf("%s%08x", i == 0 ? "[" : " ", data[i]);
printf("]"); printf("]");
} }
...@@ -803,7 +803,7 @@ print_packet(unsigned long *data, size_t length) ...@@ -803,7 +803,7 @@ print_packet(unsigned long *data, size_t length)
default: default:
printf("unknown phy packet: "); printf("unknown phy packet: ");
for (i = 1; i < length / 4; i++) for (i = 1; i < length / 4; i++)
printf("%s%08lx", i == 0 ? "[" : " ", data[i]); printf("%s%08x", i == 0 ? "[" : " ", data[i]);
printf("]"); printf("]");
break; break;
} }
...@@ -829,7 +829,7 @@ print_packet(unsigned long *data, size_t length) ...@@ -829,7 +829,7 @@ print_packet(unsigned long *data, size_t length)
#define CLEAR "\033[H\033[2J" #define CLEAR "\033[H\033[2J"
static void static void
print_stats(unsigned long *data, size_t length) print_stats(uint32_t *data, size_t length)
{ {
static int bus_reset_count, short_packet_count, phy_packet_count; static int bus_reset_count, short_packet_count, phy_packet_count;
static int tcode_count[16]; static int tcode_count[16];
...@@ -959,8 +959,8 @@ int main(int argc, const char *argv[]) ...@@ -959,8 +959,8 @@ int main(int argc, const char *argv[])
setvbuf(stdout, NULL, _IOLBF, BUFSIZ); setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
if (1) { if (1) {
unsigned long buf[128 * 1024]; uint32_t buf[128 * 1024];
unsigned int filter; uint32_t filter;
int length; int length;
filter = ~0; filter = ~0;
...@@ -968,11 +968,10 @@ int main(int argc, const char *argv[]) ...@@ -968,11 +968,10 @@ int main(int argc, const char *argv[])
filter &= ~(1 <<TCODE_ISO_DATA); filter &= ~(1 <<TCODE_ISO_DATA);
if (!option_cycle_start) if (!option_cycle_start)
filter &= ~(1 << TCODE_CYCLE_START); filter &= ~(1 << TCODE_CYCLE_START);
if (view == VIEW_STATS) if (view == VIEW_STATS)
ioctl(fd, NOSY_IOC_FILTER, ~(1 << TCODE_CYCLE_START)); filter = ~(1 << TCODE_CYCLE_START);
else
ioctl(fd, NOSY_IOC_FILTER, filter); ioctl(fd, NOSY_IOC_FILTER, filter);
ioctl(fd, NOSY_IOC_START); ioctl(fd, NOSY_IOC_START);
......
...@@ -33,61 +33,63 @@ ...@@ -33,61 +33,63 @@
#define SPEED_200 0x1 #define SPEED_200 0x1
#define SPEED_400 0x2 #define SPEED_400 0x2
struct phy_packet { #include <stdint.h>
unsigned long timestamp;
struct phy_packet {
uint32_t timestamp;
union { union {
struct { struct {
unsigned int zero : 24; uint32_t zero:24;
unsigned int phy_id : 6; uint32_t phy_id:6;
unsigned int identifier : 2; uint32_t identifier:2;
} common, link_on; } common, link_on;
struct { struct {
unsigned int zero : 16; uint32_t zero:16;
unsigned int gap_count : 6; uint32_t gap_count:6;
unsigned int set_gap_count : 1; uint32_t set_gap_count:1;
unsigned int set_root : 1; uint32_t set_root:1;
unsigned int root_id : 6; uint32_t root_id:6;
unsigned int identifier : 2; uint32_t identifier:2;
} phy_config; } phy_config;
struct { struct {
unsigned int more_packets : 1; uint32_t more_packets:1;
unsigned int initiated_reset : 1; uint32_t initiated_reset:1;
unsigned int port2 : 2; uint32_t port2:2;
unsigned int port1 : 2; uint32_t port1:2;
unsigned int port0 : 2; uint32_t port0:2;
unsigned int power_class : 3; uint32_t power_class:3;
unsigned int contender : 1; uint32_t contender:1;
unsigned int phy_delay : 2; uint32_t phy_delay:2;
unsigned int phy_speed : 2; uint32_t phy_speed:2;
unsigned int gap_count : 6; uint32_t gap_count:6;
unsigned int link_active : 1; uint32_t link_active:1;
unsigned int extended : 1; uint32_t extended:1;
unsigned int phy_id : 6; uint32_t phy_id:6;
unsigned int identifier : 2; uint32_t identifier:2;
} self_id; } self_id;
struct { struct {
unsigned int more_packets : 1; uint32_t more_packets:1;
unsigned int reserved1 : 1; uint32_t reserved1:1;
unsigned int porth : 2; uint32_t porth:2;
unsigned int portg : 2; uint32_t portg:2;
unsigned int portf : 2; uint32_t portf:2;
unsigned int porte : 2; uint32_t porte:2;
unsigned int portd : 2; uint32_t portd:2;
unsigned int portc : 2; uint32_t portc:2;
unsigned int portb : 2; uint32_t portb:2;
unsigned int porta : 2; uint32_t porta:2;
unsigned int reserved0 : 2; uint32_t reserved0:2;
unsigned int sequence : 3; uint32_t sequence:3;
unsigned int extended : 1; uint32_t extended:1;
unsigned int phy_id : 6; uint32_t phy_id:6;
unsigned int identifier : 2; uint32_t identifier:2;
} ext_self_id; } ext_self_id;
}; };
uint32_t inverted;
unsigned long inverted; uint32_t ack;
unsigned long ack;
}; };
#define PHY_PACKET_CONFIGURATION 0x00 #define PHY_PACKET_CONFIGURATION 0x00
...@@ -95,186 +97,88 @@ struct phy_packet { ...@@ -95,186 +97,88 @@ struct phy_packet {
#define PHY_PACKET_SELF_ID 0x02 #define PHY_PACKET_SELF_ID 0x02
struct link_packet { struct link_packet {
unsigned long timestamp; uint32_t timestamp;
union { union {
struct { struct {
unsigned int priority : 4; uint32_t priority:4;
unsigned int tcode : 4; uint32_t tcode:4;
unsigned int rt : 2; uint32_t rt:2;
unsigned int tlabel : 6; uint32_t tlabel:6;
unsigned int destination : 16; uint32_t destination:16;
unsigned int offset_high : 16; uint32_t offset_high:16;
unsigned int source : 16; uint32_t source:16;
unsigned long offset_low; uint32_t offset_low;
} common; } common;
struct { struct {
unsigned int priority : 4; uint32_t common[3];
unsigned int tcode : 4; uint32_t crc;
unsigned int rt : 2;
unsigned int tlabel : 6;
unsigned int destination : 16;
unsigned int offset_high : 16;
unsigned int source : 16;
unsigned long offset_low;
unsigned long crc;
} read_quadlet; } read_quadlet;
struct { struct {
unsigned int priority : 4; uint32_t common[3];
unsigned int tcode : 4; uint32_t data;
unsigned int rt : 2; uint32_t crc;
unsigned int tlabel : 6;
unsigned int destination : 16;
unsigned int reserved0 : 12;
unsigned int rcode : 4;
unsigned int source : 16;
unsigned long reserved1;
unsigned long data;
unsigned long crc;
} read_quadlet_response; } read_quadlet_response;
struct { struct {
unsigned int priority : 4; uint32_t common[3];
unsigned int tcode : 4; uint32_t extended_tcode:16;
unsigned int rt : 2; uint32_t data_length:16;
unsigned int tlabel : 6; uint32_t crc;
unsigned int destination : 16;
unsigned int offset_high : 16;
unsigned int source : 16;
unsigned long offset_low;
unsigned int extended_tcode : 16;
unsigned int data_length : 16;
unsigned long crc;
} read_block; } read_block;
struct { struct {
unsigned int priority : 4; uint32_t common[3];
unsigned int tcode : 4; uint32_t extended_tcode:16;
unsigned int rt : 2; uint32_t data_length:16;
unsigned int tlabel : 6; uint32_t crc;
unsigned int destination : 16; uint32_t data[0];
unsigned int reserved0 : 12;
unsigned int rcode : 4;
unsigned int source : 16;
unsigned long reserved1;
unsigned int extended_tcode : 16;
unsigned int data_length : 16;
unsigned long crc;
unsigned long data[0];
/* crc and ack follows. */ /* crc and ack follows. */
} read_block_response; } read_block_response;
struct { struct {
unsigned int priority : 4; uint32_t common[3];
unsigned int tcode : 4; uint32_t data;
unsigned int rt : 2; uint32_t crc;
unsigned int tlabel : 6;
unsigned int destination : 16;
unsigned int offset_high : 16;
unsigned int source : 16;
unsigned long offset_low;
unsigned long data;
unsigned long crc;
} write_quadlet; } write_quadlet;
struct { struct {
unsigned int priority : 4; uint32_t common[3];
unsigned int tcode : 4; uint32_t extended_tcode:16;
unsigned int rt : 2; uint32_t data_length:16;
unsigned int tlabel : 6; uint32_t crc;
unsigned int destination : 16; uint32_t data[0];
unsigned int offset_high : 16;
unsigned int source : 16;
unsigned int offset_low : 32;
unsigned int extended_tcode : 16;
unsigned int data_length : 16;
unsigned long crc;
unsigned long data[0];
/* crc and ack follows. */ /* crc and ack follows. */
} write_block; } write_block;
struct { struct {
unsigned int priority : 4; uint32_t common[3];
unsigned int tcode : 4; uint32_t crc;
unsigned int rt : 2;
unsigned int tlabel : 6;
unsigned int destination : 16;
unsigned int reserved0 : 12;
unsigned int rcode : 4;
unsigned int source : 16;
unsigned long reserved1;
unsigned long crc;
} write_response; } write_response;
struct { struct {
unsigned int priority : 4; uint32_t common[3];
unsigned int tcode : 4; uint32_t data;
unsigned int rt : 2; uint32_t crc;
unsigned int tlabel : 6;
unsigned int destination : 16;
unsigned int offset_high : 16;
unsigned int source : 16;
unsigned long offset_low;
unsigned long data;
unsigned long crc;
} cycle_start; } cycle_start;
struct { struct {
unsigned int sy : 4; uint32_t sy:4;
unsigned int tcode : 4; uint32_t tcode:4;
unsigned int channel : 6; uint32_t channel:6;
unsigned int tag : 2; uint32_t tag:2;
unsigned int data_length : 16; uint32_t data_length:16;
unsigned long crc; uint32_t crc;
} iso_data; } iso_data;
}; };
}; };
struct subaction { struct subaction {
unsigned long ack; uint32_t ack;
size_t length; size_t length;
struct list link; struct list link;
struct link_packet packet; struct link_packet packet;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment