Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #include <linux/module.h> |
| 2 | #include <linux/kernel.h> |
| 3 | #include <linux/pci.h> |
| 4 | #include <linux/i2o.h> |
| 5 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | static void i2o_report_util_cmd(u8 cmd); |
| 7 | static void i2o_report_exec_cmd(u8 cmd); |
| 8 | static void i2o_report_fail_status(u8 req_status, u32 * msg); |
| 9 | static void i2o_report_common_status(u8 req_status); |
| 10 | static void i2o_report_common_dsc(u16 detailed_status); |
| 11 | |
| 12 | /* |
| 13 | * Used for error reporting/debugging purposes. |
| 14 | * Report Cmd name, Request status, Detailed Status. |
| 15 | */ |
| 16 | void i2o_report_status(const char *severity, const char *str, |
| 17 | struct i2o_message *m) |
| 18 | { |
| 19 | u32 *msg = (u32 *) m; |
| 20 | u8 cmd = (msg[1] >> 24) & 0xFF; |
| 21 | u8 req_status = (msg[4] >> 24) & 0xFF; |
| 22 | u16 detailed_status = msg[4] & 0xFFFF; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
| 24 | if (cmd == I2O_CMD_UTIL_EVT_REGISTER) |
| 25 | return; // No status in this reply |
| 26 | |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 27 | printk("%s%s: ", severity, str); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
| 29 | if (cmd < 0x1F) // Utility cmd |
| 30 | i2o_report_util_cmd(cmd); |
| 31 | |
| 32 | else if (cmd >= 0xA0 && cmd <= 0xEF) // Executive cmd |
| 33 | i2o_report_exec_cmd(cmd); |
| 34 | else |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 35 | printk("Cmd = %0#2x, ", cmd); // Other cmds |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
| 37 | if (msg[0] & MSG_FAIL) { |
| 38 | i2o_report_fail_status(req_status, msg); |
| 39 | return; |
| 40 | } |
| 41 | |
| 42 | i2o_report_common_status(req_status); |
| 43 | |
| 44 | if (cmd < 0x1F || (cmd >= 0xA0 && cmd <= 0xEF)) |
| 45 | i2o_report_common_dsc(detailed_status); |
| 46 | else |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 47 | printk(" / DetailedStatus = %0#4x.\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | detailed_status); |
| 49 | } |
| 50 | |
| 51 | /* Used to dump a message to syslog during debugging */ |
| 52 | void i2o_dump_message(struct i2o_message *m) |
| 53 | { |
| 54 | #ifdef DEBUG |
| 55 | u32 *msg = (u32 *) m; |
| 56 | int i; |
| 57 | printk(KERN_INFO "Dumping I2O message size %d @ %p\n", |
| 58 | msg[0] >> 16 & 0xffff, msg); |
| 59 | for (i = 0; i < ((msg[0] >> 16) & 0xffff); i++) |
| 60 | printk(KERN_INFO " msg[%d] = %0#10x\n", i, msg[i]); |
| 61 | #endif |
| 62 | } |
| 63 | |
| 64 | /* |
| 65 | * Used for error reporting/debugging purposes. |
| 66 | * Following fail status are common to all classes. |
| 67 | * The preserved message must be handled in the reply handler. |
| 68 | */ |
| 69 | static void i2o_report_fail_status(u8 req_status, u32 * msg) |
| 70 | { |
| 71 | static char *FAIL_STATUS[] = { |
| 72 | "0x80", /* not used */ |
| 73 | "SERVICE_SUSPENDED", /* 0x81 */ |
| 74 | "SERVICE_TERMINATED", /* 0x82 */ |
| 75 | "CONGESTION", |
| 76 | "FAILURE", |
| 77 | "STATE_ERROR", |
| 78 | "TIME_OUT", |
| 79 | "ROUTING_FAILURE", |
| 80 | "INVALID_VERSION", |
| 81 | "INVALID_OFFSET", |
| 82 | "INVALID_MSG_FLAGS", |
| 83 | "FRAME_TOO_SMALL", |
| 84 | "FRAME_TOO_LARGE", |
| 85 | "INVALID_TARGET_ID", |
| 86 | "INVALID_INITIATOR_ID", |
| 87 | "INVALID_INITIATOR_CONTEX", /* 0x8F */ |
| 88 | "UNKNOWN_FAILURE" /* 0xFF */ |
| 89 | }; |
| 90 | |
| 91 | if (req_status == I2O_FSC_TRANSPORT_UNKNOWN_FAILURE) |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 92 | printk("TRANSPORT_UNKNOWN_FAILURE (%0#2x).\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | req_status); |
| 94 | else |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 95 | printk("TRANSPORT_%s.\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | FAIL_STATUS[req_status & 0x0F]); |
| 97 | |
| 98 | /* Dump some details */ |
| 99 | |
| 100 | printk(KERN_ERR " InitiatorId = %d, TargetId = %d\n", |
| 101 | (msg[1] >> 12) & 0xFFF, msg[1] & 0xFFF); |
| 102 | printk(KERN_ERR " LowestVersion = 0x%02X, HighestVersion = 0x%02X\n", |
| 103 | (msg[4] >> 8) & 0xFF, msg[4] & 0xFF); |
| 104 | printk(KERN_ERR " FailingHostUnit = 0x%04X, FailingIOP = 0x%03X\n", |
| 105 | msg[5] >> 16, msg[5] & 0xFFF); |
| 106 | |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 107 | printk(KERN_ERR " Severity: 0x%02X\n", (msg[4] >> 16) & 0xFF); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | if (msg[4] & (1 << 16)) |
| 109 | printk(KERN_DEBUG "(FormatError), " |
| 110 | "this msg can never be delivered/processed.\n"); |
| 111 | if (msg[4] & (1 << 17)) |
| 112 | printk(KERN_DEBUG "(PathError), " |
| 113 | "this msg can no longer be delivered/processed.\n"); |
| 114 | if (msg[4] & (1 << 18)) |
| 115 | printk(KERN_DEBUG "(PathState), " |
| 116 | "the system state does not allow delivery.\n"); |
| 117 | if (msg[4] & (1 << 19)) |
| 118 | printk(KERN_DEBUG |
| 119 | "(Congestion), resources temporarily not available;" |
| 120 | "do not retry immediately.\n"); |
| 121 | } |
| 122 | |
| 123 | /* |
| 124 | * Used for error reporting/debugging purposes. |
| 125 | * Following reply status are common to all classes. |
| 126 | */ |
| 127 | static void i2o_report_common_status(u8 req_status) |
| 128 | { |
| 129 | static char *REPLY_STATUS[] = { |
| 130 | "SUCCESS", |
| 131 | "ABORT_DIRTY", |
| 132 | "ABORT_NO_DATA_TRANSFER", |
| 133 | "ABORT_PARTIAL_TRANSFER", |
| 134 | "ERROR_DIRTY", |
| 135 | "ERROR_NO_DATA_TRANSFER", |
| 136 | "ERROR_PARTIAL_TRANSFER", |
| 137 | "PROCESS_ABORT_DIRTY", |
| 138 | "PROCESS_ABORT_NO_DATA_TRANSFER", |
| 139 | "PROCESS_ABORT_PARTIAL_TRANSFER", |
| 140 | "TRANSACTION_ERROR", |
| 141 | "PROGRESS_REPORT" |
| 142 | }; |
| 143 | |
| 144 | if (req_status >= ARRAY_SIZE(REPLY_STATUS)) |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 145 | printk("RequestStatus = %0#2x", req_status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | else |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 147 | printk("%s", REPLY_STATUS[req_status]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | } |
| 149 | |
| 150 | /* |
| 151 | * Used for error reporting/debugging purposes. |
| 152 | * Following detailed status are valid for executive class, |
| 153 | * utility class, DDM class and for transaction error replies. |
| 154 | */ |
| 155 | static void i2o_report_common_dsc(u16 detailed_status) |
| 156 | { |
| 157 | static char *COMMON_DSC[] = { |
| 158 | "SUCCESS", |
| 159 | "0x01", // not used |
| 160 | "BAD_KEY", |
| 161 | "TCL_ERROR", |
| 162 | "REPLY_BUFFER_FULL", |
| 163 | "NO_SUCH_PAGE", |
| 164 | "INSUFFICIENT_RESOURCE_SOFT", |
| 165 | "INSUFFICIENT_RESOURCE_HARD", |
| 166 | "0x08", // not used |
| 167 | "CHAIN_BUFFER_TOO_LARGE", |
| 168 | "UNSUPPORTED_FUNCTION", |
| 169 | "DEVICE_LOCKED", |
| 170 | "DEVICE_RESET", |
| 171 | "INAPPROPRIATE_FUNCTION", |
| 172 | "INVALID_INITIATOR_ADDRESS", |
| 173 | "INVALID_MESSAGE_FLAGS", |
| 174 | "INVALID_OFFSET", |
| 175 | "INVALID_PARAMETER", |
| 176 | "INVALID_REQUEST", |
| 177 | "INVALID_TARGET_ADDRESS", |
| 178 | "MESSAGE_TOO_LARGE", |
| 179 | "MESSAGE_TOO_SMALL", |
| 180 | "MISSING_PARAMETER", |
| 181 | "TIMEOUT", |
| 182 | "UNKNOWN_ERROR", |
| 183 | "UNKNOWN_FUNCTION", |
| 184 | "UNSUPPORTED_VERSION", |
| 185 | "DEVICE_BUSY", |
| 186 | "DEVICE_NOT_AVAILABLE" |
| 187 | }; |
| 188 | |
| 189 | if (detailed_status > I2O_DSC_DEVICE_NOT_AVAILABLE) |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 190 | printk(" / DetailedStatus = %0#4x.\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | detailed_status); |
| 192 | else |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 193 | printk(" / %s.\n", COMMON_DSC[detailed_status]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | /* |
| 197 | * Used for error reporting/debugging purposes |
| 198 | */ |
| 199 | static void i2o_report_util_cmd(u8 cmd) |
| 200 | { |
| 201 | switch (cmd) { |
| 202 | case I2O_CMD_UTIL_NOP: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 203 | printk("UTIL_NOP, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | break; |
| 205 | case I2O_CMD_UTIL_ABORT: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 206 | printk("UTIL_ABORT, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | break; |
| 208 | case I2O_CMD_UTIL_CLAIM: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 209 | printk("UTIL_CLAIM, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | break; |
| 211 | case I2O_CMD_UTIL_RELEASE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 212 | printk("UTIL_CLAIM_RELEASE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | break; |
| 214 | case I2O_CMD_UTIL_CONFIG_DIALOG: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 215 | printk("UTIL_CONFIG_DIALOG, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | break; |
| 217 | case I2O_CMD_UTIL_DEVICE_RESERVE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 218 | printk("UTIL_DEVICE_RESERVE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | break; |
| 220 | case I2O_CMD_UTIL_DEVICE_RELEASE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 221 | printk("UTIL_DEVICE_RELEASE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | break; |
| 223 | case I2O_CMD_UTIL_EVT_ACK: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 224 | printk("UTIL_EVENT_ACKNOWLEDGE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | break; |
| 226 | case I2O_CMD_UTIL_EVT_REGISTER: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 227 | printk("UTIL_EVENT_REGISTER, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | break; |
| 229 | case I2O_CMD_UTIL_LOCK: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 230 | printk("UTIL_LOCK, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | break; |
| 232 | case I2O_CMD_UTIL_LOCK_RELEASE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 233 | printk("UTIL_LOCK_RELEASE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | break; |
| 235 | case I2O_CMD_UTIL_PARAMS_GET: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 236 | printk("UTIL_PARAMS_GET, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | break; |
| 238 | case I2O_CMD_UTIL_PARAMS_SET: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 239 | printk("UTIL_PARAMS_SET, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | break; |
| 241 | case I2O_CMD_UTIL_REPLY_FAULT_NOTIFY: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 242 | printk("UTIL_REPLY_FAULT_NOTIFY, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | break; |
| 244 | default: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 245 | printk("Cmd = %0#2x, ", cmd); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | } |
| 247 | } |
| 248 | |
| 249 | /* |
| 250 | * Used for error reporting/debugging purposes |
| 251 | */ |
| 252 | static void i2o_report_exec_cmd(u8 cmd) |
| 253 | { |
| 254 | switch (cmd) { |
| 255 | case I2O_CMD_ADAPTER_ASSIGN: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 256 | printk("EXEC_ADAPTER_ASSIGN, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | break; |
| 258 | case I2O_CMD_ADAPTER_READ: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 259 | printk("EXEC_ADAPTER_READ, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | break; |
| 261 | case I2O_CMD_ADAPTER_RELEASE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 262 | printk("EXEC_ADAPTER_RELEASE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | break; |
| 264 | case I2O_CMD_BIOS_INFO_SET: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 265 | printk("EXEC_BIOS_INFO_SET, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | break; |
| 267 | case I2O_CMD_BOOT_DEVICE_SET: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 268 | printk("EXEC_BOOT_DEVICE_SET, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | break; |
| 270 | case I2O_CMD_CONFIG_VALIDATE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 271 | printk("EXEC_CONFIG_VALIDATE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | break; |
| 273 | case I2O_CMD_CONN_SETUP: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 274 | printk("EXEC_CONN_SETUP, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | break; |
| 276 | case I2O_CMD_DDM_DESTROY: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 277 | printk("EXEC_DDM_DESTROY, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | break; |
| 279 | case I2O_CMD_DDM_ENABLE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 280 | printk("EXEC_DDM_ENABLE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | break; |
| 282 | case I2O_CMD_DDM_QUIESCE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 283 | printk("EXEC_DDM_QUIESCE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | break; |
| 285 | case I2O_CMD_DDM_RESET: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 286 | printk("EXEC_DDM_RESET, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | break; |
| 288 | case I2O_CMD_DDM_SUSPEND: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 289 | printk("EXEC_DDM_SUSPEND, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | break; |
| 291 | case I2O_CMD_DEVICE_ASSIGN: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 292 | printk("EXEC_DEVICE_ASSIGN, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | break; |
| 294 | case I2O_CMD_DEVICE_RELEASE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 295 | printk("EXEC_DEVICE_RELEASE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | break; |
| 297 | case I2O_CMD_HRT_GET: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 298 | printk("EXEC_HRT_GET, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | break; |
| 300 | case I2O_CMD_ADAPTER_CLEAR: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 301 | printk("EXEC_IOP_CLEAR, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | break; |
| 303 | case I2O_CMD_ADAPTER_CONNECT: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 304 | printk("EXEC_IOP_CONNECT, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | break; |
| 306 | case I2O_CMD_ADAPTER_RESET: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 307 | printk("EXEC_IOP_RESET, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | break; |
| 309 | case I2O_CMD_LCT_NOTIFY: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 310 | printk("EXEC_LCT_NOTIFY, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | break; |
| 312 | case I2O_CMD_OUTBOUND_INIT: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 313 | printk("EXEC_OUTBOUND_INIT, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | break; |
| 315 | case I2O_CMD_PATH_ENABLE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 316 | printk("EXEC_PATH_ENABLE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | break; |
| 318 | case I2O_CMD_PATH_QUIESCE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 319 | printk("EXEC_PATH_QUIESCE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | break; |
| 321 | case I2O_CMD_PATH_RESET: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 322 | printk("EXEC_PATH_RESET, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | break; |
| 324 | case I2O_CMD_STATIC_MF_CREATE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 325 | printk("EXEC_STATIC_MF_CREATE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | break; |
| 327 | case I2O_CMD_STATIC_MF_RELEASE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 328 | printk("EXEC_STATIC_MF_RELEASE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | break; |
| 330 | case I2O_CMD_STATUS_GET: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 331 | printk("EXEC_STATUS_GET, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | break; |
| 333 | case I2O_CMD_SW_DOWNLOAD: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 334 | printk("EXEC_SW_DOWNLOAD, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | break; |
| 336 | case I2O_CMD_SW_UPLOAD: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 337 | printk("EXEC_SW_UPLOAD, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | break; |
| 339 | case I2O_CMD_SW_REMOVE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 340 | printk("EXEC_SW_REMOVE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | break; |
| 342 | case I2O_CMD_SYS_ENABLE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 343 | printk("EXEC_SYS_ENABLE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | break; |
| 345 | case I2O_CMD_SYS_MODIFY: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 346 | printk("EXEC_SYS_MODIFY, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | break; |
| 348 | case I2O_CMD_SYS_QUIESCE: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 349 | printk("EXEC_SYS_QUIESCE, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | break; |
| 351 | case I2O_CMD_SYS_TAB_SET: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 352 | printk("EXEC_SYS_TAB_SET, "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | break; |
| 354 | default: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 355 | printk("Cmd = %#02x, ", cmd); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | } |
| 357 | } |
| 358 | |
| 359 | void i2o_debug_state(struct i2o_controller *c) |
| 360 | { |
| 361 | printk(KERN_INFO "%s: State = ", c->name); |
| 362 | switch (((i2o_status_block *) c->status_block.virt)->iop_state) { |
| 363 | case 0x01: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 364 | printk("INIT\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | break; |
| 366 | case 0x02: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 367 | printk("RESET\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | break; |
| 369 | case 0x04: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 370 | printk("HOLD\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | break; |
| 372 | case 0x05: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 373 | printk("READY\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 374 | break; |
| 375 | case 0x08: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 376 | printk("OPERATIONAL\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | break; |
| 378 | case 0x10: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 379 | printk("FAILED\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 380 | break; |
| 381 | case 0x11: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 382 | printk("FAULTED\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | break; |
| 384 | default: |
Vasily Averin | 6dd4ac3 | 2007-07-17 04:04:27 -0700 | [diff] [blame] | 385 | printk("%x (unknown !!)\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | ((i2o_status_block *) c->status_block.virt)->iop_state); |
| 387 | } |
| 388 | }; |
| 389 | |
| 390 | void i2o_dump_hrt(struct i2o_controller *c) |
| 391 | { |
| 392 | u32 *rows = (u32 *) c->hrt.virt; |
| 393 | u8 *p = (u8 *) c->hrt.virt; |
| 394 | u8 *d; |
| 395 | int count; |
| 396 | int length; |
| 397 | int i; |
| 398 | int state; |
| 399 | |
| 400 | if (p[3] != 0) { |
| 401 | printk(KERN_ERR |
| 402 | "%s: HRT table for controller is too new a version.\n", |
| 403 | c->name); |
| 404 | return; |
| 405 | } |
| 406 | |
| 407 | count = p[0] | (p[1] << 8); |
| 408 | length = p[2]; |
| 409 | |
| 410 | printk(KERN_INFO "%s: HRT has %d entries of %d bytes each.\n", |
| 411 | c->name, count, length << 2); |
| 412 | |
| 413 | rows += 2; |
| 414 | |
| 415 | for (i = 0; i < count; i++) { |
| 416 | printk(KERN_INFO "Adapter %08X: ", rows[0]); |
| 417 | p = (u8 *) (rows + 1); |
| 418 | d = (u8 *) (rows + 2); |
| 419 | state = p[1] << 8 | p[0]; |
| 420 | |
Vasily Averin | 30087ba | 2006-03-25 03:08:03 -0800 | [diff] [blame] | 421 | printk("TID %04X:[", state & 0xFFF); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 422 | state >>= 12; |
| 423 | if (state & (1 << 0)) |
Vasily Averin | 30087ba | 2006-03-25 03:08:03 -0800 | [diff] [blame] | 424 | printk("H"); /* Hidden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 425 | if (state & (1 << 2)) { |
Vasily Averin | 30087ba | 2006-03-25 03:08:03 -0800 | [diff] [blame] | 426 | printk("P"); /* Present */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 427 | if (state & (1 << 1)) |
Vasily Averin | 30087ba | 2006-03-25 03:08:03 -0800 | [diff] [blame] | 428 | printk("C"); /* Controlled */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 429 | } |
| 430 | if (state > 9) |
Vasily Averin | 30087ba | 2006-03-25 03:08:03 -0800 | [diff] [blame] | 431 | printk("*"); /* Hard */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 432 | |
Vasily Averin | 30087ba | 2006-03-25 03:08:03 -0800 | [diff] [blame] | 433 | printk("]:"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 434 | |
| 435 | switch (p[3] & 0xFFFF) { |
| 436 | case 0: |
| 437 | /* Adapter private bus - easy */ |
Vasily Averin | 30087ba | 2006-03-25 03:08:03 -0800 | [diff] [blame] | 438 | printk("Local bus %d: I/O at 0x%04X Mem 0x%08X", p[2], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | d[1] << 8 | d[0], *(u32 *) (d + 4)); |
| 440 | break; |
| 441 | case 1: |
| 442 | /* ISA bus */ |
Vasily Averin | 30087ba | 2006-03-25 03:08:03 -0800 | [diff] [blame] | 443 | printk("ISA %d: CSN %d I/O at 0x%04X Mem 0x%08X", p[2], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | d[2], d[1] << 8 | d[0], *(u32 *) (d + 4)); |
| 445 | break; |
| 446 | |
| 447 | case 2: /* EISA bus */ |
Vasily Averin | 30087ba | 2006-03-25 03:08:03 -0800 | [diff] [blame] | 448 | printk("EISA %d: Slot %d I/O at 0x%04X Mem 0x%08X", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | p[2], d[3], d[1] << 8 | d[0], *(u32 *) (d + 4)); |
| 450 | break; |
| 451 | |
| 452 | case 3: /* MCA bus */ |
Vasily Averin | 30087ba | 2006-03-25 03:08:03 -0800 | [diff] [blame] | 453 | printk("MCA %d: Slot %d I/O at 0x%04X Mem 0x%08X", p[2], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | d[3], d[1] << 8 | d[0], *(u32 *) (d + 4)); |
| 455 | break; |
| 456 | |
| 457 | case 4: /* PCI bus */ |
Vasily Averin | 30087ba | 2006-03-25 03:08:03 -0800 | [diff] [blame] | 458 | printk("PCI %d: Bus %d Device %d Function %d", p[2], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | d[2], d[1], d[0]); |
| 460 | break; |
| 461 | |
| 462 | case 0x80: /* Other */ |
| 463 | default: |
Vasily Averin | 30087ba | 2006-03-25 03:08:03 -0800 | [diff] [blame] | 464 | printk("Unsupported bus type."); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | break; |
| 466 | } |
Vasily Averin | 30087ba | 2006-03-25 03:08:03 -0800 | [diff] [blame] | 467 | printk("\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | rows += length; |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | EXPORT_SYMBOL(i2o_dump_message); |