| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 1 | #ifndef __nosy_dump_h__ | 
|  | 2 | #define __nosy_dump_h__ | 
|  | 3 |  | 
|  | 4 | #define array_length(array) (sizeof(array) / sizeof(array[0])) | 
|  | 5 |  | 
| Stefan Richter | 83ef7c7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 6 | #define ACK_NO_ACK   0x0 | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 7 | #define ACK_DONE(a)  ((a >> 2) == 0) | 
|  | 8 | #define ACK_BUSY(a)  ((a >> 2) == 1) | 
|  | 9 | #define ACK_ERROR(a) ((a >> 2) == 3) | 
|  | 10 |  | 
| Stefan Richter | 1bcc69f | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 11 | #include <stdint.h> | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 12 |  | 
| Stefan Richter | 1bcc69f | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 13 | struct phy_packet { | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 14 | uint32_t timestamp; | 
|  | 15 | union { | 
|  | 16 | struct { | 
|  | 17 | uint32_t zero:24; | 
|  | 18 | uint32_t phy_id:6; | 
|  | 19 | uint32_t identifier:2; | 
|  | 20 | } common, link_on; | 
| Stefan Richter | 1bcc69f | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 21 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 22 | struct { | 
|  | 23 | uint32_t zero:16; | 
|  | 24 | uint32_t gap_count:6; | 
|  | 25 | uint32_t set_gap_count:1; | 
|  | 26 | uint32_t set_root:1; | 
|  | 27 | uint32_t root_id:6; | 
|  | 28 | uint32_t identifier:2; | 
|  | 29 | } phy_config; | 
| Stefan Richter | 1bcc69f | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 30 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 31 | struct { | 
|  | 32 | uint32_t more_packets:1; | 
|  | 33 | uint32_t initiated_reset:1; | 
|  | 34 | uint32_t port2:2; | 
|  | 35 | uint32_t port1:2; | 
|  | 36 | uint32_t port0:2; | 
|  | 37 | uint32_t power_class:3; | 
|  | 38 | uint32_t contender:1; | 
|  | 39 | uint32_t phy_delay:2; | 
|  | 40 | uint32_t phy_speed:2; | 
|  | 41 | uint32_t gap_count:6; | 
|  | 42 | uint32_t link_active:1; | 
|  | 43 | uint32_t extended:1; | 
|  | 44 | uint32_t phy_id:6; | 
|  | 45 | uint32_t identifier:2; | 
|  | 46 | } self_id; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 47 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 48 | struct { | 
|  | 49 | uint32_t more_packets:1; | 
|  | 50 | uint32_t reserved1:1; | 
|  | 51 | uint32_t porth:2; | 
|  | 52 | uint32_t portg:2; | 
|  | 53 | uint32_t portf:2; | 
|  | 54 | uint32_t porte:2; | 
|  | 55 | uint32_t portd:2; | 
|  | 56 | uint32_t portc:2; | 
|  | 57 | uint32_t portb:2; | 
|  | 58 | uint32_t porta:2; | 
|  | 59 | uint32_t reserved0:2; | 
|  | 60 | uint32_t sequence:3; | 
|  | 61 | uint32_t extended:1; | 
|  | 62 | uint32_t phy_id:6; | 
|  | 63 | uint32_t identifier:2; | 
|  | 64 | } ext_self_id; | 
|  | 65 | }; | 
|  | 66 | uint32_t inverted; | 
|  | 67 | uint32_t ack; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 68 | }; | 
|  | 69 |  | 
| Stefan Richter | 83ef7c7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 70 | #define TCODE_PHY_PACKET 0x10 | 
|  | 71 |  | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 72 | #define PHY_PACKET_CONFIGURATION 0x00 | 
|  | 73 | #define PHY_PACKET_LINK_ON 0x01 | 
|  | 74 | #define PHY_PACKET_SELF_ID 0x02 | 
|  | 75 |  | 
|  | 76 | struct link_packet { | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 77 | uint32_t timestamp; | 
|  | 78 | union { | 
|  | 79 | struct { | 
|  | 80 | uint32_t priority:4; | 
|  | 81 | uint32_t tcode:4; | 
|  | 82 | uint32_t rt:2; | 
|  | 83 | uint32_t tlabel:6; | 
|  | 84 | uint32_t destination:16; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 85 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 86 | uint32_t offset_high:16; | 
|  | 87 | uint32_t source:16; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 88 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 89 | uint32_t offset_low; | 
|  | 90 | } common; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 91 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 92 | struct { | 
|  | 93 | uint32_t common[3]; | 
|  | 94 | uint32_t crc; | 
|  | 95 | } read_quadlet; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 96 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 97 | struct { | 
|  | 98 | uint32_t common[3]; | 
|  | 99 | uint32_t data; | 
|  | 100 | uint32_t crc; | 
|  | 101 | } read_quadlet_response; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 102 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 103 | struct { | 
|  | 104 | uint32_t common[3]; | 
|  | 105 | uint32_t extended_tcode:16; | 
|  | 106 | uint32_t data_length:16; | 
|  | 107 | uint32_t crc; | 
|  | 108 | } read_block; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 109 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 110 | struct { | 
|  | 111 | uint32_t common[3]; | 
|  | 112 | uint32_t extended_tcode:16; | 
|  | 113 | uint32_t data_length:16; | 
|  | 114 | uint32_t crc; | 
|  | 115 | uint32_t data[0]; | 
|  | 116 | /* crc and ack follows. */ | 
|  | 117 | } read_block_response; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 118 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 119 | struct { | 
|  | 120 | uint32_t common[3]; | 
|  | 121 | uint32_t data; | 
|  | 122 | uint32_t crc; | 
|  | 123 | } write_quadlet; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 124 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 125 | struct { | 
|  | 126 | uint32_t common[3]; | 
|  | 127 | uint32_t extended_tcode:16; | 
|  | 128 | uint32_t data_length:16; | 
|  | 129 | uint32_t crc; | 
|  | 130 | uint32_t data[0]; | 
|  | 131 | /* crc and ack follows. */ | 
|  | 132 | } write_block; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 133 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 134 | struct { | 
|  | 135 | uint32_t common[3]; | 
|  | 136 | uint32_t crc; | 
|  | 137 | } write_response; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 138 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 139 | struct { | 
|  | 140 | uint32_t common[3]; | 
|  | 141 | uint32_t data; | 
|  | 142 | uint32_t crc; | 
|  | 143 | } cycle_start; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 144 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 145 | struct { | 
|  | 146 | uint32_t sy:4; | 
|  | 147 | uint32_t tcode:4; | 
|  | 148 | uint32_t channel:6; | 
|  | 149 | uint32_t tag:2; | 
|  | 150 | uint32_t data_length:16; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 151 |  | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 152 | uint32_t crc; | 
|  | 153 | } iso_data; | 
|  | 154 | }; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 155 | }; | 
|  | 156 |  | 
|  | 157 | struct subaction { | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 158 | uint32_t ack; | 
|  | 159 | size_t length; | 
|  | 160 | struct list link; | 
|  | 161 | struct link_packet packet; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 162 | }; | 
|  | 163 |  | 
|  | 164 | struct link_transaction { | 
| Stefan Richter | 92c16f7 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 165 | int request_node, response_node, tlabel; | 
|  | 166 | struct subaction *request, *response; | 
|  | 167 | struct list request_list, response_list; | 
|  | 168 | struct list link; | 
| Stefan Richter | 9f6d3c4 | 2010-07-22 11:58:05 +0200 | [diff] [blame] | 169 | }; | 
|  | 170 |  | 
|  | 171 | int decode_fcp(struct link_transaction *t); | 
|  | 172 |  | 
|  | 173 | #endif /* __nosy_dump_h__ */ |