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