diff options
author | Mike Miller <mikem@beardog.cce.hp.com> | 2014-02-18 14:56:04 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2014-03-15 13:19:04 -0400 |
commit | b66cc250ee700ba019ae6801726588b8bf6d9144 (patch) | |
tree | 52a2100fec4844aeccb02413086bee39b505d183 | |
parent | 0e7a7fcea03bc527310183c11f4b871c3416d488 (diff) |
[SCSI] hpsa: add ioaccel mode 2 structure definitions
Signed-off-by: Mike Miller <michael.miller@canonical.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/hpsa.c | 22 | ||||
-rw-r--r-- | drivers/scsi/hpsa.h | 8 | ||||
-rw-r--r-- | drivers/scsi/hpsa_cmd.h | 99 |
3 files changed, 129 insertions, 0 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 9fdcb189b024..e55e787f5092 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -6134,6 +6134,28 @@ static void __exit hpsa_cleanup(void) | |||
6134 | static void __attribute__((unused)) verify_offsets(void) | 6134 | static void __attribute__((unused)) verify_offsets(void) |
6135 | { | 6135 | { |
6136 | #define VERIFY_OFFSET(member, offset) \ | 6136 | #define VERIFY_OFFSET(member, offset) \ |
6137 | BUILD_BUG_ON(offsetof(struct io_accel2_cmd, member) != offset) | ||
6138 | |||
6139 | VERIFY_OFFSET(IU_type, 0); | ||
6140 | VERIFY_OFFSET(direction, 1); | ||
6141 | VERIFY_OFFSET(reply_queue, 2); | ||
6142 | /* VERIFY_OFFSET(reserved1, 3); */ | ||
6143 | VERIFY_OFFSET(scsi_nexus, 4); | ||
6144 | VERIFY_OFFSET(Tag, 8); | ||
6145 | VERIFY_OFFSET(cdb, 16); | ||
6146 | VERIFY_OFFSET(cciss_lun, 32); | ||
6147 | VERIFY_OFFSET(data_len, 40); | ||
6148 | VERIFY_OFFSET(cmd_priority_task_attr, 44); | ||
6149 | VERIFY_OFFSET(sg_count, 45); | ||
6150 | /* VERIFY_OFFSET(reserved3 */ | ||
6151 | VERIFY_OFFSET(err_ptr, 48); | ||
6152 | VERIFY_OFFSET(err_len, 56); | ||
6153 | /* VERIFY_OFFSET(reserved4 */ | ||
6154 | VERIFY_OFFSET(sg, 64); | ||
6155 | |||
6156 | #undef VERIFY_OFFSET | ||
6157 | |||
6158 | #define VERIFY_OFFSET(member, offset) \ | ||
6137 | BUILD_BUG_ON(offsetof(struct io_accel1_cmd, member) != offset) | 6159 | BUILD_BUG_ON(offsetof(struct io_accel1_cmd, member) != offset) |
6138 | 6160 | ||
6139 | VERIFY_OFFSET(dev_handle, 0x00); | 6161 | VERIFY_OFFSET(dev_handle, 0x00); |
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h index df2f88df10be..74eb22af4506 100644 --- a/drivers/scsi/hpsa.h +++ b/drivers/scsi/hpsa.h | |||
@@ -258,6 +258,14 @@ struct ctlr_info { | |||
258 | 258 | ||
259 | #define HPSA_INTR_ON 1 | 259 | #define HPSA_INTR_ON 1 |
260 | #define HPSA_INTR_OFF 0 | 260 | #define HPSA_INTR_OFF 0 |
261 | |||
262 | /* | ||
263 | * Inbound Post Queue offsets for IO Accelerator Mode 2 | ||
264 | */ | ||
265 | #define IOACCEL2_INBOUND_POSTQ_32 0x48 | ||
266 | #define IOACCEL2_INBOUND_POSTQ_64_LOW 0xd0 | ||
267 | #define IOACCEL2_INBOUND_POSTQ_64_HI 0xd4 | ||
268 | |||
261 | /* | 269 | /* |
262 | Send the command to the hardware | 270 | Send the command to the hardware |
263 | */ | 271 | */ |
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h index 21f8a616e997..9e00988817f3 100644 --- a/drivers/scsi/hpsa_cmd.h +++ b/drivers/scsi/hpsa_cmd.h | |||
@@ -332,6 +332,7 @@ struct ErrorInfo { | |||
332 | #define CMD_IOCTL_PEND 0x01 | 332 | #define CMD_IOCTL_PEND 0x01 |
333 | #define CMD_SCSI 0x03 | 333 | #define CMD_SCSI 0x03 |
334 | #define CMD_IOACCEL1 0x04 | 334 | #define CMD_IOACCEL1 0x04 |
335 | #define CMD_IOACCEL2 0x05 | ||
335 | 336 | ||
336 | #define DIRECT_LOOKUP_SHIFT 5 | 337 | #define DIRECT_LOOKUP_SHIFT 5 |
337 | #define DIRECT_LOOKUP_BIT 0x10 | 338 | #define DIRECT_LOOKUP_BIT 0x10 |
@@ -384,6 +385,7 @@ struct CommandList { | |||
384 | 385 | ||
385 | /* Max S/G elements in I/O accelerator command */ | 386 | /* Max S/G elements in I/O accelerator command */ |
386 | #define IOACCEL1_MAXSGENTRIES 24 | 387 | #define IOACCEL1_MAXSGENTRIES 24 |
388 | #define IOACCEL2_MAXSGENTRIES 28 | ||
387 | 389 | ||
388 | /* | 390 | /* |
389 | * Structure for I/O accelerator (mode 1) commands. | 391 | * Structure for I/O accelerator (mode 1) commands. |
@@ -444,6 +446,103 @@ struct io_accel1_cmd { | |||
444 | 446 | ||
445 | #define IOACCEL1_BUSADDR_CMDTYPE 0x00000060 | 447 | #define IOACCEL1_BUSADDR_CMDTYPE 0x00000060 |
446 | 448 | ||
449 | struct ioaccel2_sg_element { | ||
450 | u64 address; | ||
451 | u32 length; | ||
452 | u8 reserved[3]; | ||
453 | u8 chain_indicator; | ||
454 | #define IOACCEL2_CHAIN 0x80 | ||
455 | }; | ||
456 | |||
457 | /* | ||
458 | * SCSI Response Format structure for IO Accelerator Mode 2 | ||
459 | */ | ||
460 | struct io_accel2_scsi_response { | ||
461 | u8 IU_type; | ||
462 | #define IOACCEL2_IU_TYPE_SRF 0x60 | ||
463 | u8 reserved1[3]; | ||
464 | u8 req_id[4]; /* request identifier */ | ||
465 | u8 reserved2[4]; | ||
466 | u8 serv_response; /* service response */ | ||
467 | #define IOACCEL2_SERV_RESPONSE_COMPLETE 0x000 | ||
468 | #define IOACCEL2_SERV_RESPONSE_FAILURE 0x001 | ||
469 | #define IOACCEL2_SERV_RESPONSE_TMF_COMPLETE 0x002 | ||
470 | #define IOACCEL2_SERV_RESPONSE_TMF_SUCCESS 0x003 | ||
471 | #define IOACCEL2_SERV_RESPONSE_TMF_REJECTED 0x004 | ||
472 | #define IOACCEL2_SERV_RESPONSE_TMF_WRONG_LUN 0x005 | ||
473 | u8 status; /* status */ | ||
474 | #define IOACCEL2_STATUS_SR_TASK_COMP_GOOD 0x00 | ||
475 | #define IOACCEL2_STATUS_SR_TASK_COMP_CHK_COND 0x02 | ||
476 | #define IOACCEL2_STATUS_SR_TASK_COMP_BUSY 0x08 | ||
477 | #define IOACCEL2_STATUS_SR_TASK_COMP_RES_CON 0x18 | ||
478 | #define IOACCEL2_STATUS_SR_TASK_COMP_SET_FULL 0x28 | ||
479 | #define IOACCEL2_STATUS_SR_TASK_COMP_ABORTED 0x40 | ||
480 | u8 data_present; /* low 2 bits */ | ||
481 | #define IOACCEL2_NO_DATAPRESENT 0x000 | ||
482 | #define IOACCEL2_RESPONSE_DATAPRESENT 0x001 | ||
483 | #define IOACCEL2_SENSE_DATA_PRESENT 0x002 | ||
484 | #define IOACCEL2_RESERVED 0x003 | ||
485 | u8 sense_data_len; /* sense/response data length */ | ||
486 | u8 resid_cnt[4]; /* residual count */ | ||
487 | u8 sense_data_buff[32]; /* sense/response data buffer */ | ||
488 | }; | ||
489 | |||
490 | #define IOACCEL2_64_PAD 76 | ||
491 | #define IOACCEL2_32_PAD 76 | ||
492 | #define IOACCEL2_PAD (IS_32_BIT * IOACCEL2_32_PAD + \ | ||
493 | IS_64_BIT * IOACCEL2_64_PAD) | ||
494 | /* | ||
495 | * Structure for I/O accelerator (mode 2 or m2) commands. | ||
496 | * Note that this structure must be 128-byte aligned in size. | ||
497 | */ | ||
498 | struct io_accel2_cmd { | ||
499 | u8 IU_type; /* IU Type */ | ||
500 | u8 direction; /* Transfer direction, 2 bits */ | ||
501 | u8 reply_queue; /* Reply Queue ID */ | ||
502 | u8 reserved1; /* Reserved */ | ||
503 | u32 scsi_nexus; /* Device Handle */ | ||
504 | struct vals32 Tag; /* cciss tag */ | ||
505 | u8 cdb[16]; /* SCSI Command Descriptor Block */ | ||
506 | u8 cciss_lun[8]; /* 8 byte SCSI address */ | ||
507 | u32 data_len; /* Total bytes to transfer */ | ||
508 | u8 cmd_priority_task_attr; /* priority and task attrs */ | ||
509 | #define IOACCEL2_PRIORITY_MASK 0x78 | ||
510 | #define IOACCEL2_ATTR_MASK 0x07 | ||
511 | u8 sg_count; /* Number of sg elements */ | ||
512 | u8 reserved3[2]; /* Reserved */ | ||
513 | u64 err_ptr; /* Error Pointer */ | ||
514 | u32 err_len; /* Error Length*/ | ||
515 | u8 reserved4[4]; /* Reserved */ | ||
516 | struct ioaccel2_sg_element sg[IOACCEL2_MAXSGENTRIES]; | ||
517 | struct io_accel2_scsi_response error_data; | ||
518 | u8 pad[IOACCEL2_PAD]; | ||
519 | }; | ||
520 | |||
521 | /* | ||
522 | * defines for Mode 2 command struct | ||
523 | * FIXME: this can't be all I need mfm | ||
524 | */ | ||
525 | #define IOACCEL2_IU_TYPE 0x40 | ||
526 | #define IU_TYPE_TMF 0x41 | ||
527 | #define IOACCEL2_DIR_NO_DATA 0x00 | ||
528 | #define IOACCEL2_DIR_DATA_IN 0x01 | ||
529 | #define IOACCEL2_DIR_DATA_OUT 0x02 | ||
530 | /* | ||
531 | * SCSI Task Management Request format for Accelerator Mode 2 | ||
532 | */ | ||
533 | struct hpsa_tmf_struct { | ||
534 | u8 iu_type; /* Information Unit Type */ | ||
535 | u8 reply_queue; /* Reply Queue ID */ | ||
536 | u8 tmf; /* Task Management Function */ | ||
537 | u8 reserved1; /* byte 3 Reserved */ | ||
538 | u32 it_nexus; /* SCSI I-T Nexus */ | ||
539 | u8 lun_id[8]; /* LUN ID for TMF request */ | ||
540 | struct vals32 Tag; /* cciss tag associated w/ request */ | ||
541 | struct vals32 abort_tag;/* cciss tag of SCSI cmd or task to abort */ | ||
542 | u64 error_ptr; /* Error Pointer */ | ||
543 | u32 error_len; /* Error Length */ | ||
544 | }; | ||
545 | |||
447 | /* Configuration Table Structure */ | 546 | /* Configuration Table Structure */ |
448 | struct HostWrite { | 547 | struct HostWrite { |
449 | u32 TransportRequest; | 548 | u32 TransportRequest; |