diff options
Diffstat (limited to 'drivers/scsi/aacraid')
-rw-r--r-- | drivers/scsi/aacraid/aachba.c | 400 | ||||
-rw-r--r-- | drivers/scsi/aacraid/aacraid.h | 335 | ||||
-rw-r--r-- | drivers/scsi/aacraid/commctrl.c | 112 | ||||
-rw-r--r-- | drivers/scsi/aacraid/comminit.c | 4 | ||||
-rw-r--r-- | drivers/scsi/aacraid/commsup.c | 394 | ||||
-rw-r--r-- | drivers/scsi/aacraid/dpcsup.c | 10 | ||||
-rw-r--r-- | drivers/scsi/aacraid/linit.c | 242 | ||||
-rw-r--r-- | drivers/scsi/aacraid/rx.c | 6 |
8 files changed, 862 insertions, 641 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index a77ab8d693d4..d7235f42cf5f 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c | |||
@@ -31,9 +31,9 @@ | |||
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/completion.h> | 32 | #include <linux/completion.h> |
33 | #include <linux/blkdev.h> | 33 | #include <linux/blkdev.h> |
34 | #include <linux/dma-mapping.h> | ||
35 | #include <asm/semaphore.h> | 34 | #include <asm/semaphore.h> |
36 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
36 | #include <linux/highmem.h> /* For flush_kernel_dcache_page */ | ||
37 | 37 | ||
38 | #include <scsi/scsi.h> | 38 | #include <scsi/scsi.h> |
39 | #include <scsi/scsi_cmnd.h> | 39 | #include <scsi/scsi_cmnd.h> |
@@ -56,54 +56,54 @@ | |||
56 | /* | 56 | /* |
57 | * Sense codes | 57 | * Sense codes |
58 | */ | 58 | */ |
59 | 59 | ||
60 | #define SENCODE_NO_SENSE 0x00 | 60 | #define SENCODE_NO_SENSE 0x00 |
61 | #define SENCODE_END_OF_DATA 0x00 | 61 | #define SENCODE_END_OF_DATA 0x00 |
62 | #define SENCODE_BECOMING_READY 0x04 | 62 | #define SENCODE_BECOMING_READY 0x04 |
63 | #define SENCODE_INIT_CMD_REQUIRED 0x04 | 63 | #define SENCODE_INIT_CMD_REQUIRED 0x04 |
64 | #define SENCODE_PARAM_LIST_LENGTH_ERROR 0x1A | 64 | #define SENCODE_PARAM_LIST_LENGTH_ERROR 0x1A |
65 | #define SENCODE_INVALID_COMMAND 0x20 | 65 | #define SENCODE_INVALID_COMMAND 0x20 |
66 | #define SENCODE_LBA_OUT_OF_RANGE 0x21 | 66 | #define SENCODE_LBA_OUT_OF_RANGE 0x21 |
67 | #define SENCODE_INVALID_CDB_FIELD 0x24 | 67 | #define SENCODE_INVALID_CDB_FIELD 0x24 |
68 | #define SENCODE_LUN_NOT_SUPPORTED 0x25 | 68 | #define SENCODE_LUN_NOT_SUPPORTED 0x25 |
69 | #define SENCODE_INVALID_PARAM_FIELD 0x26 | 69 | #define SENCODE_INVALID_PARAM_FIELD 0x26 |
70 | #define SENCODE_PARAM_NOT_SUPPORTED 0x26 | 70 | #define SENCODE_PARAM_NOT_SUPPORTED 0x26 |
71 | #define SENCODE_PARAM_VALUE_INVALID 0x26 | 71 | #define SENCODE_PARAM_VALUE_INVALID 0x26 |
72 | #define SENCODE_RESET_OCCURRED 0x29 | 72 | #define SENCODE_RESET_OCCURRED 0x29 |
73 | #define SENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x3E | 73 | #define SENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x3E |
74 | #define SENCODE_INQUIRY_DATA_CHANGED 0x3F | 74 | #define SENCODE_INQUIRY_DATA_CHANGED 0x3F |
75 | #define SENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x39 | 75 | #define SENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x39 |
76 | #define SENCODE_DIAGNOSTIC_FAILURE 0x40 | 76 | #define SENCODE_DIAGNOSTIC_FAILURE 0x40 |
77 | #define SENCODE_INTERNAL_TARGET_FAILURE 0x44 | 77 | #define SENCODE_INTERNAL_TARGET_FAILURE 0x44 |
78 | #define SENCODE_INVALID_MESSAGE_ERROR 0x49 | 78 | #define SENCODE_INVALID_MESSAGE_ERROR 0x49 |
79 | #define SENCODE_LUN_FAILED_SELF_CONFIG 0x4c | 79 | #define SENCODE_LUN_FAILED_SELF_CONFIG 0x4c |
80 | #define SENCODE_OVERLAPPED_COMMAND 0x4E | 80 | #define SENCODE_OVERLAPPED_COMMAND 0x4E |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * Additional sense codes | 83 | * Additional sense codes |
84 | */ | 84 | */ |
85 | 85 | ||
86 | #define ASENCODE_NO_SENSE 0x00 | 86 | #define ASENCODE_NO_SENSE 0x00 |
87 | #define ASENCODE_END_OF_DATA 0x05 | 87 | #define ASENCODE_END_OF_DATA 0x05 |
88 | #define ASENCODE_BECOMING_READY 0x01 | 88 | #define ASENCODE_BECOMING_READY 0x01 |
89 | #define ASENCODE_INIT_CMD_REQUIRED 0x02 | 89 | #define ASENCODE_INIT_CMD_REQUIRED 0x02 |
90 | #define ASENCODE_PARAM_LIST_LENGTH_ERROR 0x00 | 90 | #define ASENCODE_PARAM_LIST_LENGTH_ERROR 0x00 |
91 | #define ASENCODE_INVALID_COMMAND 0x00 | 91 | #define ASENCODE_INVALID_COMMAND 0x00 |
92 | #define ASENCODE_LBA_OUT_OF_RANGE 0x00 | 92 | #define ASENCODE_LBA_OUT_OF_RANGE 0x00 |
93 | #define ASENCODE_INVALID_CDB_FIELD 0x00 | 93 | #define ASENCODE_INVALID_CDB_FIELD 0x00 |
94 | #define ASENCODE_LUN_NOT_SUPPORTED 0x00 | 94 | #define ASENCODE_LUN_NOT_SUPPORTED 0x00 |
95 | #define ASENCODE_INVALID_PARAM_FIELD 0x00 | 95 | #define ASENCODE_INVALID_PARAM_FIELD 0x00 |
96 | #define ASENCODE_PARAM_NOT_SUPPORTED 0x01 | 96 | #define ASENCODE_PARAM_NOT_SUPPORTED 0x01 |
97 | #define ASENCODE_PARAM_VALUE_INVALID 0x02 | 97 | #define ASENCODE_PARAM_VALUE_INVALID 0x02 |
98 | #define ASENCODE_RESET_OCCURRED 0x00 | 98 | #define ASENCODE_RESET_OCCURRED 0x00 |
99 | #define ASENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x00 | 99 | #define ASENCODE_LUN_NOT_SELF_CONFIGURED_YET 0x00 |
100 | #define ASENCODE_INQUIRY_DATA_CHANGED 0x03 | 100 | #define ASENCODE_INQUIRY_DATA_CHANGED 0x03 |
101 | #define ASENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x00 | 101 | #define ASENCODE_SAVING_PARAMS_NOT_SUPPORTED 0x00 |
102 | #define ASENCODE_DIAGNOSTIC_FAILURE 0x80 | 102 | #define ASENCODE_DIAGNOSTIC_FAILURE 0x80 |
103 | #define ASENCODE_INTERNAL_TARGET_FAILURE 0x00 | 103 | #define ASENCODE_INTERNAL_TARGET_FAILURE 0x00 |
104 | #define ASENCODE_INVALID_MESSAGE_ERROR 0x00 | 104 | #define ASENCODE_INVALID_MESSAGE_ERROR 0x00 |
105 | #define ASENCODE_LUN_FAILED_SELF_CONFIG 0x00 | 105 | #define ASENCODE_LUN_FAILED_SELF_CONFIG 0x00 |
106 | #define ASENCODE_OVERLAPPED_COMMAND 0x00 | 106 | #define ASENCODE_OVERLAPPED_COMMAND 0x00 |
107 | 107 | ||
108 | #define BYTE0(x) (unsigned char)(x) | 108 | #define BYTE0(x) (unsigned char)(x) |
109 | #define BYTE1(x) (unsigned char)((x) >> 8) | 109 | #define BYTE1(x) (unsigned char)((x) >> 8) |
@@ -115,8 +115,8 @@ | |||
115 | *----------------------------------------------------------------------------*/ | 115 | *----------------------------------------------------------------------------*/ |
116 | /* SCSI inquiry data */ | 116 | /* SCSI inquiry data */ |
117 | struct inquiry_data { | 117 | struct inquiry_data { |
118 | u8 inqd_pdt; /* Peripheral qualifier | Peripheral Device Type */ | 118 | u8 inqd_pdt; /* Peripheral qualifier | Peripheral Device Type */ |
119 | u8 inqd_dtq; /* RMB | Device Type Qualifier */ | 119 | u8 inqd_dtq; /* RMB | Device Type Qualifier */ |
120 | u8 inqd_ver; /* ISO version | ECMA version | ANSI-approved version */ | 120 | u8 inqd_ver; /* ISO version | ECMA version | ANSI-approved version */ |
121 | u8 inqd_rdf; /* AENC | TrmIOP | Response data format */ | 121 | u8 inqd_rdf; /* AENC | TrmIOP | Response data format */ |
122 | u8 inqd_len; /* Additional length (n-4) */ | 122 | u8 inqd_len; /* Additional length (n-4) */ |
@@ -130,7 +130,7 @@ struct inquiry_data { | |||
130 | /* | 130 | /* |
131 | * M O D U L E G L O B A L S | 131 | * M O D U L E G L O B A L S |
132 | */ | 132 | */ |
133 | 133 | ||
134 | static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap); | 134 | static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap); |
135 | static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg); | 135 | static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg); |
136 | static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* psg); | 136 | static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* psg); |
@@ -141,9 +141,10 @@ static char *aac_get_status_string(u32 status); | |||
141 | 141 | ||
142 | /* | 142 | /* |
143 | * Non dasd selection is handled entirely in aachba now | 143 | * Non dasd selection is handled entirely in aachba now |
144 | */ | 144 | */ |
145 | 145 | ||
146 | static int nondasd = -1; | 146 | static int nondasd = -1; |
147 | static int aac_cache = 0; | ||
147 | static int dacmode = -1; | 148 | static int dacmode = -1; |
148 | 149 | ||
149 | int aac_commit = -1; | 150 | int aac_commit = -1; |
@@ -152,6 +153,8 @@ int aif_timeout = 120; | |||
152 | 153 | ||
153 | module_param(nondasd, int, S_IRUGO|S_IWUSR); | 154 | module_param(nondasd, int, S_IRUGO|S_IWUSR); |
154 | MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on"); | 155 | MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on"); |
156 | module_param_named(cache, aac_cache, int, S_IRUGO|S_IWUSR); | ||
157 | MODULE_PARM_DESC(cache, "Disable Queue Flush commands:\n\tbit 0 - Disable FUA in WRITE SCSI commands\n\tbit 1 - Disable SYNCHRONIZE_CACHE SCSI command\n\tbit 2 - Disable only if Battery not protecting Cache"); | ||
155 | module_param(dacmode, int, S_IRUGO|S_IWUSR); | 158 | module_param(dacmode, int, S_IRUGO|S_IWUSR); |
156 | MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on"); | 159 | MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on"); |
157 | module_param_named(commit, aac_commit, int, S_IRUGO|S_IWUSR); | 160 | module_param_named(commit, aac_commit, int, S_IRUGO|S_IWUSR); |
@@ -179,7 +182,7 @@ MODULE_PARM_DESC(check_interval, "Interval in seconds between adapter health che | |||
179 | 182 | ||
180 | int aac_check_reset = 1; | 183 | int aac_check_reset = 1; |
181 | module_param_named(check_reset, aac_check_reset, int, S_IRUGO|S_IWUSR); | 184 | module_param_named(check_reset, aac_check_reset, int, S_IRUGO|S_IWUSR); |
182 | MODULE_PARM_DESC(aac_check_reset, "If adapter fails health check, reset the adapter."); | 185 | MODULE_PARM_DESC(aac_check_reset, "If adapter fails health check, reset the adapter. a value of -1 forces the reset to adapters programmed to ignore it."); |
183 | 186 | ||
184 | int expose_physicals = -1; | 187 | int expose_physicals = -1; |
185 | module_param(expose_physicals, int, S_IRUGO|S_IWUSR); | 188 | module_param(expose_physicals, int, S_IRUGO|S_IWUSR); |
@@ -193,12 +196,12 @@ static inline int aac_valid_context(struct scsi_cmnd *scsicmd, | |||
193 | struct fib *fibptr) { | 196 | struct fib *fibptr) { |
194 | struct scsi_device *device; | 197 | struct scsi_device *device; |
195 | 198 | ||
196 | if (unlikely(!scsicmd || !scsicmd->scsi_done )) { | 199 | if (unlikely(!scsicmd || !scsicmd->scsi_done)) { |
197 | dprintk((KERN_WARNING "aac_valid_context: scsi command corrupt\n")); | 200 | dprintk((KERN_WARNING "aac_valid_context: scsi command corrupt\n")); |
198 | aac_fib_complete(fibptr); | 201 | aac_fib_complete(fibptr); |
199 | aac_fib_free(fibptr); | 202 | aac_fib_free(fibptr); |
200 | return 0; | 203 | return 0; |
201 | } | 204 | } |
202 | scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; | 205 | scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; |
203 | device = scsicmd->device; | 206 | device = scsicmd->device; |
204 | if (unlikely(!device || !scsi_device_online(device))) { | 207 | if (unlikely(!device || !scsi_device_online(device))) { |
@@ -240,7 +243,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag) | |||
240 | FsaNormal, | 243 | FsaNormal, |
241 | 1, 1, | 244 | 1, 1, |
242 | NULL, NULL); | 245 | NULL, NULL); |
243 | if (status < 0 ) { | 246 | if (status < 0) { |
244 | printk(KERN_WARNING "aac_get_config_status: SendFIB failed.\n"); | 247 | printk(KERN_WARNING "aac_get_config_status: SendFIB failed.\n"); |
245 | } else { | 248 | } else { |
246 | struct aac_get_config_status_resp *reply | 249 | struct aac_get_config_status_resp *reply |
@@ -264,10 +267,10 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag) | |||
264 | struct aac_commit_config * dinfo; | 267 | struct aac_commit_config * dinfo; |
265 | aac_fib_init(fibptr); | 268 | aac_fib_init(fibptr); |
266 | dinfo = (struct aac_commit_config *) fib_data(fibptr); | 269 | dinfo = (struct aac_commit_config *) fib_data(fibptr); |
267 | 270 | ||
268 | dinfo->command = cpu_to_le32(VM_ContainerConfig); | 271 | dinfo->command = cpu_to_le32(VM_ContainerConfig); |
269 | dinfo->type = cpu_to_le32(CT_COMMIT_CONFIG); | 272 | dinfo->type = cpu_to_le32(CT_COMMIT_CONFIG); |
270 | 273 | ||
271 | status = aac_fib_send(ContainerCommand, | 274 | status = aac_fib_send(ContainerCommand, |
272 | fibptr, | 275 | fibptr, |
273 | sizeof (struct aac_commit_config), | 276 | sizeof (struct aac_commit_config), |
@@ -293,7 +296,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag) | |||
293 | int aac_get_containers(struct aac_dev *dev) | 296 | int aac_get_containers(struct aac_dev *dev) |
294 | { | 297 | { |
295 | struct fsa_dev_info *fsa_dev_ptr; | 298 | struct fsa_dev_info *fsa_dev_ptr; |
296 | u32 index; | 299 | u32 index; |
297 | int status = 0; | 300 | int status = 0; |
298 | struct fib * fibptr; | 301 | struct fib * fibptr; |
299 | struct aac_get_container_count *dinfo; | 302 | struct aac_get_container_count *dinfo; |
@@ -363,6 +366,7 @@ static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigne | |||
363 | if (buf && transfer_len > 0) | 366 | if (buf && transfer_len > 0) |
364 | memcpy(buf + offset, data, transfer_len); | 367 | memcpy(buf + offset, data, transfer_len); |
365 | 368 | ||
369 | flush_kernel_dcache_page(kmap_atomic_to_page(buf - sg->offset)); | ||
366 | kunmap_atomic(buf - sg->offset, KM_IRQ0); | 370 | kunmap_atomic(buf - sg->offset, KM_IRQ0); |
367 | 371 | ||
368 | } | 372 | } |
@@ -395,7 +399,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr) | |||
395 | do { | 399 | do { |
396 | *dp++ = (*sp) ? *sp++ : ' '; | 400 | *dp++ = (*sp) ? *sp++ : ' '; |
397 | } while (--count > 0); | 401 | } while (--count > 0); |
398 | aac_internal_transfer(scsicmd, d, | 402 | aac_internal_transfer(scsicmd, d, |
399 | offsetof(struct inquiry_data, inqd_pid), sizeof(d)); | 403 | offsetof(struct inquiry_data, inqd_pid), sizeof(d)); |
400 | } | 404 | } |
401 | } | 405 | } |
@@ -431,13 +435,13 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd) | |||
431 | dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data)); | 435 | dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data)); |
432 | 436 | ||
433 | status = aac_fib_send(ContainerCommand, | 437 | status = aac_fib_send(ContainerCommand, |
434 | cmd_fibcontext, | 438 | cmd_fibcontext, |
435 | sizeof (struct aac_get_name), | 439 | sizeof (struct aac_get_name), |
436 | FsaNormal, | 440 | FsaNormal, |
437 | 0, 1, | 441 | 0, 1, |
438 | (fib_callback) get_container_name_callback, | 442 | (fib_callback)get_container_name_callback, |
439 | (void *) scsicmd); | 443 | (void *) scsicmd); |
440 | 444 | ||
441 | /* | 445 | /* |
442 | * Check that the command queued to the controller | 446 | * Check that the command queued to the controller |
443 | */ | 447 | */ |
@@ -445,7 +449,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd) | |||
445 | scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; | 449 | scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; |
446 | return 0; | 450 | return 0; |
447 | } | 451 | } |
448 | 452 | ||
449 | printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status); | 453 | printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status); |
450 | aac_fib_complete(cmd_fibcontext); | 454 | aac_fib_complete(cmd_fibcontext); |
451 | aac_fib_free(cmd_fibcontext); | 455 | aac_fib_free(cmd_fibcontext); |
@@ -652,42 +656,47 @@ struct scsi_inq { | |||
652 | * @a: string to copy from | 656 | * @a: string to copy from |
653 | * @b: string to copy to | 657 | * @b: string to copy to |
654 | * | 658 | * |
655 | * Copy a String from one location to another | 659 | * Copy a String from one location to another |
656 | * without copying \0 | 660 | * without copying \0 |
657 | */ | 661 | */ |
658 | 662 | ||
659 | static void inqstrcpy(char *a, char *b) | 663 | static void inqstrcpy(char *a, char *b) |
660 | { | 664 | { |
661 | 665 | ||
662 | while(*a != (char)0) | 666 | while (*a != (char)0) |
663 | *b++ = *a++; | 667 | *b++ = *a++; |
664 | } | 668 | } |
665 | 669 | ||
666 | static char *container_types[] = { | 670 | static char *container_types[] = { |
667 | "None", | 671 | "None", |
668 | "Volume", | 672 | "Volume", |
669 | "Mirror", | 673 | "Mirror", |
670 | "Stripe", | 674 | "Stripe", |
671 | "RAID5", | 675 | "RAID5", |
672 | "SSRW", | 676 | "SSRW", |
673 | "SSRO", | 677 | "SSRO", |
674 | "Morph", | 678 | "Morph", |
675 | "Legacy", | 679 | "Legacy", |
676 | "RAID4", | 680 | "RAID4", |
677 | "RAID10", | 681 | "RAID10", |
678 | "RAID00", | 682 | "RAID00", |
679 | "V-MIRRORS", | 683 | "V-MIRRORS", |
680 | "PSEUDO R4", | 684 | "PSEUDO R4", |
681 | "RAID50", | 685 | "RAID50", |
682 | "RAID5D", | 686 | "RAID5D", |
683 | "RAID5D0", | 687 | "RAID5D0", |
684 | "RAID1E", | 688 | "RAID1E", |
685 | "RAID6", | 689 | "RAID6", |
686 | "RAID60", | 690 | "RAID60", |
687 | "Unknown" | 691 | "Unknown" |
688 | }; | 692 | }; |
689 | 693 | ||
690 | 694 | char * get_container_type(unsigned tindex) | |
695 | { | ||
696 | if (tindex >= ARRAY_SIZE(container_types)) | ||
697 | tindex = ARRAY_SIZE(container_types) - 1; | ||
698 | return container_types[tindex]; | ||
699 | } | ||
691 | 700 | ||
692 | /* Function: setinqstr | 701 | /* Function: setinqstr |
693 | * | 702 | * |
@@ -707,16 +716,21 @@ static void setinqstr(struct aac_dev *dev, void *data, int tindex) | |||
707 | 716 | ||
708 | if (dev->supplement_adapter_info.AdapterTypeText[0]) { | 717 | if (dev->supplement_adapter_info.AdapterTypeText[0]) { |
709 | char * cp = dev->supplement_adapter_info.AdapterTypeText; | 718 | char * cp = dev->supplement_adapter_info.AdapterTypeText; |
710 | int c = sizeof(str->vid); | 719 | int c; |
711 | while (*cp && *cp != ' ' && --c) | 720 | if ((cp[0] == 'A') && (cp[1] == 'O') && (cp[2] == 'C')) |
712 | ++cp; | 721 | inqstrcpy("SMC", str->vid); |
713 | c = *cp; | 722 | else { |
714 | *cp = '\0'; | 723 | c = sizeof(str->vid); |
715 | inqstrcpy (dev->supplement_adapter_info.AdapterTypeText, | 724 | while (*cp && *cp != ' ' && --c) |
716 | str->vid); | 725 | ++cp; |
717 | *cp = c; | 726 | c = *cp; |
718 | while (*cp && *cp != ' ') | 727 | *cp = '\0'; |
719 | ++cp; | 728 | inqstrcpy (dev->supplement_adapter_info.AdapterTypeText, |
729 | str->vid); | ||
730 | *cp = c; | ||
731 | while (*cp && *cp != ' ') | ||
732 | ++cp; | ||
733 | } | ||
720 | while (*cp == ' ') | 734 | while (*cp == ' ') |
721 | ++cp; | 735 | ++cp; |
722 | /* last six chars reserved for vol type */ | 736 | /* last six chars reserved for vol type */ |
@@ -898,9 +912,8 @@ static int aac_bounds_32(struct aac_dev * dev, struct scsi_cmnd * cmd, u64 lba) | |||
898 | ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, | 912 | ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, |
899 | 0, 0); | 913 | 0, 0); |
900 | memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data, | 914 | memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data, |
901 | (sizeof(dev->fsa_dev[cid].sense_data) > sizeof(cmd->sense_buffer)) | 915 | min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data), |
902 | ? sizeof(cmd->sense_buffer) | 916 | SCSI_SENSE_BUFFERSIZE)); |
903 | : sizeof(dev->fsa_dev[cid].sense_data)); | ||
904 | cmd->scsi_done(cmd); | 917 | cmd->scsi_done(cmd); |
905 | return 1; | 918 | return 1; |
906 | } | 919 | } |
@@ -981,7 +994,7 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 | |||
981 | aac_fib_init(fib); | 994 | aac_fib_init(fib); |
982 | readcmd = (struct aac_read *) fib_data(fib); | 995 | readcmd = (struct aac_read *) fib_data(fib); |
983 | readcmd->command = cpu_to_le32(VM_CtBlockRead); | 996 | readcmd->command = cpu_to_le32(VM_CtBlockRead); |
984 | readcmd->cid = cpu_to_le16(scmd_id(cmd)); | 997 | readcmd->cid = cpu_to_le32(scmd_id(cmd)); |
985 | readcmd->block = cpu_to_le32((u32)(lba&0xffffffff)); | 998 | readcmd->block = cpu_to_le32((u32)(lba&0xffffffff)); |
986 | readcmd->count = cpu_to_le32(count * 512); | 999 | readcmd->count = cpu_to_le32(count * 512); |
987 | 1000 | ||
@@ -1013,7 +1026,8 @@ static int aac_write_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u | |||
1013 | writecmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); | 1026 | writecmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); |
1014 | writecmd->count = cpu_to_le32(count<<9); | 1027 | writecmd->count = cpu_to_le32(count<<9); |
1015 | writecmd->cid = cpu_to_le16(scmd_id(cmd)); | 1028 | writecmd->cid = cpu_to_le16(scmd_id(cmd)); |
1016 | writecmd->flags = fua ? | 1029 | writecmd->flags = (fua && ((aac_cache & 5) != 1) && |
1030 | (((aac_cache & 5) != 5) || !fib->dev->cache_protected)) ? | ||
1017 | cpu_to_le16(IO_TYPE_WRITE|IO_SUREWRITE) : | 1031 | cpu_to_le16(IO_TYPE_WRITE|IO_SUREWRITE) : |
1018 | cpu_to_le16(IO_TYPE_WRITE); | 1032 | cpu_to_le16(IO_TYPE_WRITE); |
1019 | writecmd->bpTotal = 0; | 1033 | writecmd->bpTotal = 0; |
@@ -1072,7 +1086,7 @@ static int aac_write_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3 | |||
1072 | aac_fib_init(fib); | 1086 | aac_fib_init(fib); |
1073 | writecmd = (struct aac_write *) fib_data(fib); | 1087 | writecmd = (struct aac_write *) fib_data(fib); |
1074 | writecmd->command = cpu_to_le32(VM_CtBlockWrite); | 1088 | writecmd->command = cpu_to_le32(VM_CtBlockWrite); |
1075 | writecmd->cid = cpu_to_le16(scmd_id(cmd)); | 1089 | writecmd->cid = cpu_to_le32(scmd_id(cmd)); |
1076 | writecmd->block = cpu_to_le32((u32)(lba&0xffffffff)); | 1090 | writecmd->block = cpu_to_le32((u32)(lba&0xffffffff)); |
1077 | writecmd->count = cpu_to_le32(count * 512); | 1091 | writecmd->count = cpu_to_le32(count * 512); |
1078 | writecmd->sg.count = cpu_to_le32(1); | 1092 | writecmd->sg.count = cpu_to_le32(1); |
@@ -1190,6 +1204,15 @@ static int aac_scsi_32(struct fib * fib, struct scsi_cmnd * cmd) | |||
1190 | (fib_callback) aac_srb_callback, (void *) cmd); | 1204 | (fib_callback) aac_srb_callback, (void *) cmd); |
1191 | } | 1205 | } |
1192 | 1206 | ||
1207 | static int aac_scsi_32_64(struct fib * fib, struct scsi_cmnd * cmd) | ||
1208 | { | ||
1209 | if ((sizeof(dma_addr_t) > 4) && | ||
1210 | (num_physpages > (0xFFFFFFFFULL >> PAGE_SHIFT)) && | ||
1211 | (fib->dev->adapter_info.options & AAC_OPT_SGMAP_HOST64)) | ||
1212 | return FAILED; | ||
1213 | return aac_scsi_32(fib, cmd); | ||
1214 | } | ||
1215 | |||
1193 | int aac_get_adapter_info(struct aac_dev* dev) | 1216 | int aac_get_adapter_info(struct aac_dev* dev) |
1194 | { | 1217 | { |
1195 | struct fib* fibptr; | 1218 | struct fib* fibptr; |
@@ -1207,11 +1230,11 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
1207 | memset(info,0,sizeof(*info)); | 1230 | memset(info,0,sizeof(*info)); |
1208 | 1231 | ||
1209 | rcode = aac_fib_send(RequestAdapterInfo, | 1232 | rcode = aac_fib_send(RequestAdapterInfo, |
1210 | fibptr, | 1233 | fibptr, |
1211 | sizeof(*info), | 1234 | sizeof(*info), |
1212 | FsaNormal, | 1235 | FsaNormal, |
1213 | -1, 1, /* First `interrupt' command uses special wait */ | 1236 | -1, 1, /* First `interrupt' command uses special wait */ |
1214 | NULL, | 1237 | NULL, |
1215 | NULL); | 1238 | NULL); |
1216 | 1239 | ||
1217 | if (rcode < 0) { | 1240 | if (rcode < 0) { |
@@ -1222,29 +1245,29 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
1222 | memcpy(&dev->adapter_info, info, sizeof(*info)); | 1245 | memcpy(&dev->adapter_info, info, sizeof(*info)); |
1223 | 1246 | ||
1224 | if (dev->adapter_info.options & AAC_OPT_SUPPLEMENT_ADAPTER_INFO) { | 1247 | if (dev->adapter_info.options & AAC_OPT_SUPPLEMENT_ADAPTER_INFO) { |
1225 | struct aac_supplement_adapter_info * info; | 1248 | struct aac_supplement_adapter_info * sinfo; |
1226 | 1249 | ||
1227 | aac_fib_init(fibptr); | 1250 | aac_fib_init(fibptr); |
1228 | 1251 | ||
1229 | info = (struct aac_supplement_adapter_info *) fib_data(fibptr); | 1252 | sinfo = (struct aac_supplement_adapter_info *) fib_data(fibptr); |
1230 | 1253 | ||
1231 | memset(info,0,sizeof(*info)); | 1254 | memset(sinfo,0,sizeof(*sinfo)); |
1232 | 1255 | ||
1233 | rcode = aac_fib_send(RequestSupplementAdapterInfo, | 1256 | rcode = aac_fib_send(RequestSupplementAdapterInfo, |
1234 | fibptr, | 1257 | fibptr, |
1235 | sizeof(*info), | 1258 | sizeof(*sinfo), |
1236 | FsaNormal, | 1259 | FsaNormal, |
1237 | 1, 1, | 1260 | 1, 1, |
1238 | NULL, | 1261 | NULL, |
1239 | NULL); | 1262 | NULL); |
1240 | 1263 | ||
1241 | if (rcode >= 0) | 1264 | if (rcode >= 0) |
1242 | memcpy(&dev->supplement_adapter_info, info, sizeof(*info)); | 1265 | memcpy(&dev->supplement_adapter_info, sinfo, sizeof(*sinfo)); |
1243 | } | 1266 | } |
1244 | 1267 | ||
1245 | 1268 | ||
1246 | /* | 1269 | /* |
1247 | * GetBusInfo | 1270 | * GetBusInfo |
1248 | */ | 1271 | */ |
1249 | 1272 | ||
1250 | aac_fib_init(fibptr); | 1273 | aac_fib_init(fibptr); |
@@ -1267,6 +1290,8 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
1267 | 1, 1, | 1290 | 1, 1, |
1268 | NULL, NULL); | 1291 | NULL, NULL); |
1269 | 1292 | ||
1293 | /* reasoned default */ | ||
1294 | dev->maximum_num_physicals = 16; | ||
1270 | if (rcode >= 0 && le32_to_cpu(bus_info->Status) == ST_OK) { | 1295 | if (rcode >= 0 && le32_to_cpu(bus_info->Status) == ST_OK) { |
1271 | dev->maximum_num_physicals = le32_to_cpu(bus_info->TargetsPerBus); | 1296 | dev->maximum_num_physicals = le32_to_cpu(bus_info->TargetsPerBus); |
1272 | dev->maximum_num_channels = le32_to_cpu(bus_info->BusCount); | 1297 | dev->maximum_num_channels = le32_to_cpu(bus_info->BusCount); |
@@ -1276,7 +1301,7 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
1276 | char buffer[16]; | 1301 | char buffer[16]; |
1277 | tmp = le32_to_cpu(dev->adapter_info.kernelrev); | 1302 | tmp = le32_to_cpu(dev->adapter_info.kernelrev); |
1278 | printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d] %.*s\n", | 1303 | printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d] %.*s\n", |
1279 | dev->name, | 1304 | dev->name, |
1280 | dev->id, | 1305 | dev->id, |
1281 | tmp>>24, | 1306 | tmp>>24, |
1282 | (tmp>>16)&0xff, | 1307 | (tmp>>16)&0xff, |
@@ -1305,19 +1330,21 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
1305 | (int)sizeof(dev->supplement_adapter_info.VpdInfo.Tsid), | 1330 | (int)sizeof(dev->supplement_adapter_info.VpdInfo.Tsid), |
1306 | dev->supplement_adapter_info.VpdInfo.Tsid); | 1331 | dev->supplement_adapter_info.VpdInfo.Tsid); |
1307 | } | 1332 | } |
1308 | if (!aac_check_reset || | 1333 | if (!aac_check_reset || ((aac_check_reset != 1) && |
1309 | (dev->supplement_adapter_info.SupportedOptions2 & | 1334 | (dev->supplement_adapter_info.SupportedOptions2 & |
1310 | le32_to_cpu(AAC_OPTION_IGNORE_RESET))) { | 1335 | AAC_OPTION_IGNORE_RESET))) { |
1311 | printk(KERN_INFO "%s%d: Reset Adapter Ignored\n", | 1336 | printk(KERN_INFO "%s%d: Reset Adapter Ignored\n", |
1312 | dev->name, dev->id); | 1337 | dev->name, dev->id); |
1313 | } | 1338 | } |
1314 | } | 1339 | } |
1315 | 1340 | ||
1341 | dev->cache_protected = 0; | ||
1342 | dev->jbod = ((dev->supplement_adapter_info.FeatureBits & | ||
1343 | AAC_FEATURE_JBOD) != 0); | ||
1316 | dev->nondasd_support = 0; | 1344 | dev->nondasd_support = 0; |
1317 | dev->raid_scsi_mode = 0; | 1345 | dev->raid_scsi_mode = 0; |
1318 | if(dev->adapter_info.options & AAC_OPT_NONDASD){ | 1346 | if(dev->adapter_info.options & AAC_OPT_NONDASD) |
1319 | dev->nondasd_support = 1; | 1347 | dev->nondasd_support = 1; |
1320 | } | ||
1321 | 1348 | ||
1322 | /* | 1349 | /* |
1323 | * If the firmware supports ROMB RAID/SCSI mode and we are currently | 1350 | * If the firmware supports ROMB RAID/SCSI mode and we are currently |
@@ -1338,11 +1365,10 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
1338 | if (dev->raid_scsi_mode != 0) | 1365 | if (dev->raid_scsi_mode != 0) |
1339 | printk(KERN_INFO "%s%d: ROMB RAID/SCSI mode enabled\n", | 1366 | printk(KERN_INFO "%s%d: ROMB RAID/SCSI mode enabled\n", |
1340 | dev->name, dev->id); | 1367 | dev->name, dev->id); |
1341 | 1368 | ||
1342 | if(nondasd != -1) { | 1369 | if (nondasd != -1) |
1343 | dev->nondasd_support = (nondasd!=0); | 1370 | dev->nondasd_support = (nondasd!=0); |
1344 | } | 1371 | if(dev->nondasd_support != 0) { |
1345 | if(dev->nondasd_support != 0){ | ||
1346 | printk(KERN_INFO "%s%d: Non-DASD support enabled.\n",dev->name, dev->id); | 1372 | printk(KERN_INFO "%s%d: Non-DASD support enabled.\n",dev->name, dev->id); |
1347 | } | 1373 | } |
1348 | 1374 | ||
@@ -1371,12 +1397,14 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
1371 | rcode = -ENOMEM; | 1397 | rcode = -ENOMEM; |
1372 | } | 1398 | } |
1373 | } | 1399 | } |
1374 | /* | 1400 | /* |
1375 | * Deal with configuring for the individualized limits of each packet | 1401 | * Deal with configuring for the individualized limits of each packet |
1376 | * interface. | 1402 | * interface. |
1377 | */ | 1403 | */ |
1378 | dev->a_ops.adapter_scsi = (dev->dac_support) | 1404 | dev->a_ops.adapter_scsi = (dev->dac_support) |
1379 | ? aac_scsi_64 | 1405 | ? ((aac_get_driver_ident(dev->cardtype)->quirks & AAC_QUIRK_SCSI_32) |
1406 | ? aac_scsi_32_64 | ||
1407 | : aac_scsi_64) | ||
1380 | : aac_scsi_32; | 1408 | : aac_scsi_32; |
1381 | if (dev->raw_io_interface) { | 1409 | if (dev->raw_io_interface) { |
1382 | dev->a_ops.adapter_bounds = (dev->raw_io_64) | 1410 | dev->a_ops.adapter_bounds = (dev->raw_io_64) |
@@ -1393,8 +1421,8 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
1393 | if (dev->dac_support) { | 1421 | if (dev->dac_support) { |
1394 | dev->a_ops.adapter_read = aac_read_block64; | 1422 | dev->a_ops.adapter_read = aac_read_block64; |
1395 | dev->a_ops.adapter_write = aac_write_block64; | 1423 | dev->a_ops.adapter_write = aac_write_block64; |
1396 | /* | 1424 | /* |
1397 | * 38 scatter gather elements | 1425 | * 38 scatter gather elements |
1398 | */ | 1426 | */ |
1399 | dev->scsi_host_ptr->sg_tablesize = | 1427 | dev->scsi_host_ptr->sg_tablesize = |
1400 | (dev->max_fib_size - | 1428 | (dev->max_fib_size - |
@@ -1498,9 +1526,8 @@ static void io_callback(void *context, struct fib * fibptr) | |||
1498 | ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, | 1526 | ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, |
1499 | 0, 0); | 1527 | 0, 0); |
1500 | memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, | 1528 | memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, |
1501 | (sizeof(dev->fsa_dev[cid].sense_data) > sizeof(scsicmd->sense_buffer)) | 1529 | min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data), |
1502 | ? sizeof(scsicmd->sense_buffer) | 1530 | SCSI_SENSE_BUFFERSIZE)); |
1503 | : sizeof(dev->fsa_dev[cid].sense_data)); | ||
1504 | } | 1531 | } |
1505 | aac_fib_complete(fibptr); | 1532 | aac_fib_complete(fibptr); |
1506 | aac_fib_free(fibptr); | 1533 | aac_fib_free(fibptr); |
@@ -1524,7 +1551,7 @@ static int aac_read(struct scsi_cmnd * scsicmd) | |||
1524 | case READ_6: | 1551 | case READ_6: |
1525 | dprintk((KERN_DEBUG "aachba: received a read(6) command on id %d.\n", scmd_id(scsicmd))); | 1552 | dprintk((KERN_DEBUG "aachba: received a read(6) command on id %d.\n", scmd_id(scsicmd))); |
1526 | 1553 | ||
1527 | lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | | 1554 | lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | |
1528 | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; | 1555 | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; |
1529 | count = scsicmd->cmnd[4]; | 1556 | count = scsicmd->cmnd[4]; |
1530 | 1557 | ||
@@ -1534,32 +1561,32 @@ static int aac_read(struct scsi_cmnd * scsicmd) | |||
1534 | case READ_16: | 1561 | case READ_16: |
1535 | dprintk((KERN_DEBUG "aachba: received a read(16) command on id %d.\n", scmd_id(scsicmd))); | 1562 | dprintk((KERN_DEBUG "aachba: received a read(16) command on id %d.\n", scmd_id(scsicmd))); |
1536 | 1563 | ||
1537 | lba = ((u64)scsicmd->cmnd[2] << 56) | | 1564 | lba = ((u64)scsicmd->cmnd[2] << 56) | |
1538 | ((u64)scsicmd->cmnd[3] << 48) | | 1565 | ((u64)scsicmd->cmnd[3] << 48) | |
1539 | ((u64)scsicmd->cmnd[4] << 40) | | 1566 | ((u64)scsicmd->cmnd[4] << 40) | |
1540 | ((u64)scsicmd->cmnd[5] << 32) | | 1567 | ((u64)scsicmd->cmnd[5] << 32) | |
1541 | ((u64)scsicmd->cmnd[6] << 24) | | 1568 | ((u64)scsicmd->cmnd[6] << 24) | |
1542 | (scsicmd->cmnd[7] << 16) | | 1569 | (scsicmd->cmnd[7] << 16) | |
1543 | (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; | 1570 | (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; |
1544 | count = (scsicmd->cmnd[10] << 24) | | 1571 | count = (scsicmd->cmnd[10] << 24) | |
1545 | (scsicmd->cmnd[11] << 16) | | 1572 | (scsicmd->cmnd[11] << 16) | |
1546 | (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13]; | 1573 | (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13]; |
1547 | break; | 1574 | break; |
1548 | case READ_12: | 1575 | case READ_12: |
1549 | dprintk((KERN_DEBUG "aachba: received a read(12) command on id %d.\n", scmd_id(scsicmd))); | 1576 | dprintk((KERN_DEBUG "aachba: received a read(12) command on id %d.\n", scmd_id(scsicmd))); |
1550 | 1577 | ||
1551 | lba = ((u64)scsicmd->cmnd[2] << 24) | | 1578 | lba = ((u64)scsicmd->cmnd[2] << 24) | |
1552 | (scsicmd->cmnd[3] << 16) | | 1579 | (scsicmd->cmnd[3] << 16) | |
1553 | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; | 1580 | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; |
1554 | count = (scsicmd->cmnd[6] << 24) | | 1581 | count = (scsicmd->cmnd[6] << 24) | |
1555 | (scsicmd->cmnd[7] << 16) | | 1582 | (scsicmd->cmnd[7] << 16) | |
1556 | (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; | 1583 | (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; |
1557 | break; | 1584 | break; |
1558 | default: | 1585 | default: |
1559 | dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", scmd_id(scsicmd))); | 1586 | dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", scmd_id(scsicmd))); |
1560 | 1587 | ||
1561 | lba = ((u64)scsicmd->cmnd[2] << 24) | | 1588 | lba = ((u64)scsicmd->cmnd[2] << 24) | |
1562 | (scsicmd->cmnd[3] << 16) | | 1589 | (scsicmd->cmnd[3] << 16) | |
1563 | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; | 1590 | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; |
1564 | count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; | 1591 | count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; |
1565 | break; | 1592 | break; |
@@ -1584,7 +1611,7 @@ static int aac_read(struct scsi_cmnd * scsicmd) | |||
1584 | scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; | 1611 | scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; |
1585 | return 0; | 1612 | return 0; |
1586 | } | 1613 | } |
1587 | 1614 | ||
1588 | printk(KERN_WARNING "aac_read: aac_fib_send failed with status: %d.\n", status); | 1615 | printk(KERN_WARNING "aac_read: aac_fib_send failed with status: %d.\n", status); |
1589 | /* | 1616 | /* |
1590 | * For some reason, the Fib didn't queue, return QUEUE_FULL | 1617 | * For some reason, the Fib didn't queue, return QUEUE_FULL |
@@ -1619,11 +1646,11 @@ static int aac_write(struct scsi_cmnd * scsicmd) | |||
1619 | } else if (scsicmd->cmnd[0] == WRITE_16) { /* 16 byte command */ | 1646 | } else if (scsicmd->cmnd[0] == WRITE_16) { /* 16 byte command */ |
1620 | dprintk((KERN_DEBUG "aachba: received a write(16) command on id %d.\n", scmd_id(scsicmd))); | 1647 | dprintk((KERN_DEBUG "aachba: received a write(16) command on id %d.\n", scmd_id(scsicmd))); |
1621 | 1648 | ||
1622 | lba = ((u64)scsicmd->cmnd[2] << 56) | | 1649 | lba = ((u64)scsicmd->cmnd[2] << 56) | |
1623 | ((u64)scsicmd->cmnd[3] << 48) | | 1650 | ((u64)scsicmd->cmnd[3] << 48) | |
1624 | ((u64)scsicmd->cmnd[4] << 40) | | 1651 | ((u64)scsicmd->cmnd[4] << 40) | |
1625 | ((u64)scsicmd->cmnd[5] << 32) | | 1652 | ((u64)scsicmd->cmnd[5] << 32) | |
1626 | ((u64)scsicmd->cmnd[6] << 24) | | 1653 | ((u64)scsicmd->cmnd[6] << 24) | |
1627 | (scsicmd->cmnd[7] << 16) | | 1654 | (scsicmd->cmnd[7] << 16) | |
1628 | (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; | 1655 | (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; |
1629 | count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) | | 1656 | count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) | |
@@ -1712,8 +1739,8 @@ static void synchronize_callback(void *context, struct fib *fibptr) | |||
1712 | ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, | 1739 | ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, |
1713 | 0, 0); | 1740 | 0, 0); |
1714 | memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data, | 1741 | memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data, |
1715 | min(sizeof(dev->fsa_dev[cid].sense_data), | 1742 | min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data), |
1716 | sizeof(cmd->sense_buffer))); | 1743 | SCSI_SENSE_BUFFERSIZE)); |
1717 | } | 1744 | } |
1718 | 1745 | ||
1719 | aac_fib_complete(fibptr); | 1746 | aac_fib_complete(fibptr); |
@@ -1798,7 +1825,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd) | |||
1798 | if (active) | 1825 | if (active) |
1799 | return SCSI_MLQUEUE_DEVICE_BUSY; | 1826 | return SCSI_MLQUEUE_DEVICE_BUSY; |
1800 | 1827 | ||
1801 | aac = (struct aac_dev *)scsicmd->device->host->hostdata; | 1828 | aac = (struct aac_dev *)sdev->host->hostdata; |
1802 | if (aac->in_reset) | 1829 | if (aac->in_reset) |
1803 | return SCSI_MLQUEUE_HOST_BUSY; | 1830 | return SCSI_MLQUEUE_HOST_BUSY; |
1804 | 1831 | ||
@@ -1850,14 +1877,14 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd) | |||
1850 | * Emulate a SCSI command and queue the required request for the | 1877 | * Emulate a SCSI command and queue the required request for the |
1851 | * aacraid firmware. | 1878 | * aacraid firmware. |
1852 | */ | 1879 | */ |
1853 | 1880 | ||
1854 | int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | 1881 | int aac_scsi_cmd(struct scsi_cmnd * scsicmd) |
1855 | { | 1882 | { |
1856 | u32 cid; | 1883 | u32 cid; |
1857 | struct Scsi_Host *host = scsicmd->device->host; | 1884 | struct Scsi_Host *host = scsicmd->device->host; |
1858 | struct aac_dev *dev = (struct aac_dev *)host->hostdata; | 1885 | struct aac_dev *dev = (struct aac_dev *)host->hostdata; |
1859 | struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev; | 1886 | struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev; |
1860 | 1887 | ||
1861 | if (fsa_dev_ptr == NULL) | 1888 | if (fsa_dev_ptr == NULL) |
1862 | return -1; | 1889 | return -1; |
1863 | /* | 1890 | /* |
@@ -1898,7 +1925,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1898 | } | 1925 | } |
1899 | } | 1926 | } |
1900 | } else { /* check for physical non-dasd devices */ | 1927 | } else { /* check for physical non-dasd devices */ |
1901 | if ((dev->nondasd_support == 1) || expose_physicals) { | 1928 | if (dev->nondasd_support || expose_physicals || |
1929 | dev->jbod) { | ||
1902 | if (dev->in_reset) | 1930 | if (dev->in_reset) |
1903 | return -1; | 1931 | return -1; |
1904 | return aac_send_srb_fib(scsicmd); | 1932 | return aac_send_srb_fib(scsicmd); |
@@ -1913,7 +1941,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1913 | * else Command for the controller itself | 1941 | * else Command for the controller itself |
1914 | */ | 1942 | */ |
1915 | else if ((scsicmd->cmnd[0] != INQUIRY) && /* only INQUIRY & TUR cmnd supported for controller */ | 1943 | else if ((scsicmd->cmnd[0] != INQUIRY) && /* only INQUIRY & TUR cmnd supported for controller */ |
1916 | (scsicmd->cmnd[0] != TEST_UNIT_READY)) | 1944 | (scsicmd->cmnd[0] != TEST_UNIT_READY)) |
1917 | { | 1945 | { |
1918 | dprintk((KERN_WARNING "Only INQUIRY & TUR command supported for controller, rcvd = 0x%x.\n", scsicmd->cmnd[0])); | 1946 | dprintk((KERN_WARNING "Only INQUIRY & TUR command supported for controller, rcvd = 0x%x.\n", scsicmd->cmnd[0])); |
1919 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; | 1947 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; |
@@ -1922,9 +1950,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1922 | SENCODE_INVALID_COMMAND, | 1950 | SENCODE_INVALID_COMMAND, |
1923 | ASENCODE_INVALID_COMMAND, 0, 0, 0, 0); | 1951 | ASENCODE_INVALID_COMMAND, 0, 0, 0, 0); |
1924 | memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, | 1952 | memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, |
1925 | (sizeof(dev->fsa_dev[cid].sense_data) > sizeof(scsicmd->sense_buffer)) | 1953 | min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data), |
1926 | ? sizeof(scsicmd->sense_buffer) | 1954 | SCSI_SENSE_BUFFERSIZE)); |
1927 | : sizeof(dev->fsa_dev[cid].sense_data)); | ||
1928 | scsicmd->scsi_done(scsicmd); | 1955 | scsicmd->scsi_done(scsicmd); |
1929 | return 0; | 1956 | return 0; |
1930 | } | 1957 | } |
@@ -1939,7 +1966,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1939 | dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", cid)); | 1966 | dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", cid)); |
1940 | memset(&inq_data, 0, sizeof (struct inquiry_data)); | 1967 | memset(&inq_data, 0, sizeof (struct inquiry_data)); |
1941 | 1968 | ||
1942 | if (scsicmd->cmnd[1] & 0x1 ) { | 1969 | if (scsicmd->cmnd[1] & 0x1) { |
1943 | char *arr = (char *)&inq_data; | 1970 | char *arr = (char *)&inq_data; |
1944 | 1971 | ||
1945 | /* EVPD bit set */ | 1972 | /* EVPD bit set */ |
@@ -1974,10 +2001,9 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1974 | ASENCODE_NO_SENSE, 0, 7, 2, 0); | 2001 | ASENCODE_NO_SENSE, 0, 7, 2, 0); |
1975 | memcpy(scsicmd->sense_buffer, | 2002 | memcpy(scsicmd->sense_buffer, |
1976 | &dev->fsa_dev[cid].sense_data, | 2003 | &dev->fsa_dev[cid].sense_data, |
1977 | (sizeof(dev->fsa_dev[cid].sense_data) > | 2004 | min_t(size_t, |
1978 | sizeof(scsicmd->sense_buffer)) | 2005 | sizeof(dev->fsa_dev[cid].sense_data), |
1979 | ? sizeof(scsicmd->sense_buffer) | 2006 | SCSI_SENSE_BUFFERSIZE)); |
1980 | : sizeof(dev->fsa_dev[cid].sense_data)); | ||
1981 | } | 2007 | } |
1982 | scsicmd->scsi_done(scsicmd); | 2008 | scsicmd->scsi_done(scsicmd); |
1983 | return 0; | 2009 | return 0; |
@@ -2092,7 +2118,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
2092 | mode_buf[2] = 0; /* Device-specific param, | 2118 | mode_buf[2] = 0; /* Device-specific param, |
2093 | bit 8: 0/1 = write enabled/protected | 2119 | bit 8: 0/1 = write enabled/protected |
2094 | bit 4: 0/1 = FUA enabled */ | 2120 | bit 4: 0/1 = FUA enabled */ |
2095 | if (dev->raw_io_interface) | 2121 | if (dev->raw_io_interface && ((aac_cache & 5) != 1)) |
2096 | mode_buf[2] = 0x10; | 2122 | mode_buf[2] = 0x10; |
2097 | mode_buf[3] = 0; /* Block descriptor length */ | 2123 | mode_buf[3] = 0; /* Block descriptor length */ |
2098 | if (((scsicmd->cmnd[2] & 0x3f) == 8) || | 2124 | if (((scsicmd->cmnd[2] & 0x3f) == 8) || |
@@ -2100,7 +2126,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
2100 | mode_buf[0] = 6; | 2126 | mode_buf[0] = 6; |
2101 | mode_buf[4] = 8; | 2127 | mode_buf[4] = 8; |
2102 | mode_buf[5] = 1; | 2128 | mode_buf[5] = 1; |
2103 | mode_buf[6] = 0x04; /* WCE */ | 2129 | mode_buf[6] = ((aac_cache & 6) == 2) |
2130 | ? 0 : 0x04; /* WCE */ | ||
2104 | mode_buf_length = 7; | 2131 | mode_buf_length = 7; |
2105 | if (mode_buf_length > scsicmd->cmnd[4]) | 2132 | if (mode_buf_length > scsicmd->cmnd[4]) |
2106 | mode_buf_length = scsicmd->cmnd[4]; | 2133 | mode_buf_length = scsicmd->cmnd[4]; |
@@ -2123,7 +2150,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
2123 | mode_buf[3] = 0; /* Device-specific param, | 2150 | mode_buf[3] = 0; /* Device-specific param, |
2124 | bit 8: 0/1 = write enabled/protected | 2151 | bit 8: 0/1 = write enabled/protected |
2125 | bit 4: 0/1 = FUA enabled */ | 2152 | bit 4: 0/1 = FUA enabled */ |
2126 | if (dev->raw_io_interface) | 2153 | if (dev->raw_io_interface && ((aac_cache & 5) != 1)) |
2127 | mode_buf[3] = 0x10; | 2154 | mode_buf[3] = 0x10; |
2128 | mode_buf[4] = 0; /* reserved */ | 2155 | mode_buf[4] = 0; /* reserved */ |
2129 | mode_buf[5] = 0; /* reserved */ | 2156 | mode_buf[5] = 0; /* reserved */ |
@@ -2134,7 +2161,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
2134 | mode_buf[1] = 9; | 2161 | mode_buf[1] = 9; |
2135 | mode_buf[8] = 8; | 2162 | mode_buf[8] = 8; |
2136 | mode_buf[9] = 1; | 2163 | mode_buf[9] = 1; |
2137 | mode_buf[10] = 0x04; /* WCE */ | 2164 | mode_buf[10] = ((aac_cache & 6) == 2) |
2165 | ? 0 : 0x04; /* WCE */ | ||
2138 | mode_buf_length = 11; | 2166 | mode_buf_length = 11; |
2139 | if (mode_buf_length > scsicmd->cmnd[8]) | 2167 | if (mode_buf_length > scsicmd->cmnd[8]) |
2140 | mode_buf_length = scsicmd->cmnd[8]; | 2168 | mode_buf_length = scsicmd->cmnd[8]; |
@@ -2179,7 +2207,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
2179 | return 0; | 2207 | return 0; |
2180 | } | 2208 | } |
2181 | 2209 | ||
2182 | switch (scsicmd->cmnd[0]) | 2210 | switch (scsicmd->cmnd[0]) |
2183 | { | 2211 | { |
2184 | case READ_6: | 2212 | case READ_6: |
2185 | case READ_10: | 2213 | case READ_10: |
@@ -2192,11 +2220,11 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
2192 | * corresponds to a container. Needed to convert | 2220 | * corresponds to a container. Needed to convert |
2193 | * containers to /dev/sd device names | 2221 | * containers to /dev/sd device names |
2194 | */ | 2222 | */ |
2195 | 2223 | ||
2196 | if (scsicmd->request->rq_disk) | 2224 | if (scsicmd->request->rq_disk) |
2197 | strlcpy(fsa_dev_ptr[cid].devname, | 2225 | strlcpy(fsa_dev_ptr[cid].devname, |
2198 | scsicmd->request->rq_disk->disk_name, | 2226 | scsicmd->request->rq_disk->disk_name, |
2199 | min(sizeof(fsa_dev_ptr[cid].devname), | 2227 | min(sizeof(fsa_dev_ptr[cid].devname), |
2200 | sizeof(scsicmd->request->rq_disk->disk_name) + 1)); | 2228 | sizeof(scsicmd->request->rq_disk->disk_name) + 1)); |
2201 | 2229 | ||
2202 | return aac_read(scsicmd); | 2230 | return aac_read(scsicmd); |
@@ -2210,9 +2238,16 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
2210 | return aac_write(scsicmd); | 2238 | return aac_write(scsicmd); |
2211 | 2239 | ||
2212 | case SYNCHRONIZE_CACHE: | 2240 | case SYNCHRONIZE_CACHE: |
2241 | if (((aac_cache & 6) == 6) && dev->cache_protected) { | ||
2242 | scsicmd->result = DID_OK << 16 | | ||
2243 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; | ||
2244 | scsicmd->scsi_done(scsicmd); | ||
2245 | return 0; | ||
2246 | } | ||
2213 | /* Issue FIB to tell Firmware to flush it's cache */ | 2247 | /* Issue FIB to tell Firmware to flush it's cache */ |
2214 | return aac_synchronize(scsicmd); | 2248 | if ((aac_cache & 6) != 2) |
2215 | 2249 | return aac_synchronize(scsicmd); | |
2250 | /* FALLTHRU */ | ||
2216 | default: | 2251 | default: |
2217 | /* | 2252 | /* |
2218 | * Unhandled commands | 2253 | * Unhandled commands |
@@ -2223,9 +2258,9 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
2223 | ILLEGAL_REQUEST, SENCODE_INVALID_COMMAND, | 2258 | ILLEGAL_REQUEST, SENCODE_INVALID_COMMAND, |
2224 | ASENCODE_INVALID_COMMAND, 0, 0, 0, 0); | 2259 | ASENCODE_INVALID_COMMAND, 0, 0, 0, 0); |
2225 | memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, | 2260 | memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, |
2226 | (sizeof(dev->fsa_dev[cid].sense_data) > sizeof(scsicmd->sense_buffer)) | 2261 | min_t(size_t, |
2227 | ? sizeof(scsicmd->sense_buffer) | 2262 | sizeof(dev->fsa_dev[cid].sense_data), |
2228 | : sizeof(dev->fsa_dev[cid].sense_data)); | 2263 | SCSI_SENSE_BUFFERSIZE)); |
2229 | scsicmd->scsi_done(scsicmd); | 2264 | scsicmd->scsi_done(scsicmd); |
2230 | return 0; | 2265 | return 0; |
2231 | } | 2266 | } |
@@ -2243,7 +2278,7 @@ static int query_disk(struct aac_dev *dev, void __user *arg) | |||
2243 | return -EFAULT; | 2278 | return -EFAULT; |
2244 | if (qd.cnum == -1) | 2279 | if (qd.cnum == -1) |
2245 | qd.cnum = qd.id; | 2280 | qd.cnum = qd.id; |
2246 | else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1)) | 2281 | else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1)) |
2247 | { | 2282 | { |
2248 | if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers) | 2283 | if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers) |
2249 | return -EINVAL; | 2284 | return -EINVAL; |
@@ -2370,7 +2405,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) | |||
2370 | 2405 | ||
2371 | scsicmd->sense_buffer[0] = '\0'; /* Initialize sense valid flag to false */ | 2406 | scsicmd->sense_buffer[0] = '\0'; /* Initialize sense valid flag to false */ |
2372 | /* | 2407 | /* |
2373 | * Calculate resid for sg | 2408 | * Calculate resid for sg |
2374 | */ | 2409 | */ |
2375 | 2410 | ||
2376 | scsi_set_resid(scsicmd, scsi_bufflen(scsicmd) | 2411 | scsi_set_resid(scsicmd, scsi_bufflen(scsicmd) |
@@ -2385,10 +2420,8 @@ static void aac_srb_callback(void *context, struct fib * fibptr) | |||
2385 | if (le32_to_cpu(srbreply->status) != ST_OK){ | 2420 | if (le32_to_cpu(srbreply->status) != ST_OK){ |
2386 | int len; | 2421 | int len; |
2387 | printk(KERN_WARNING "aac_srb_callback: srb failed, status = %d\n", le32_to_cpu(srbreply->status)); | 2422 | printk(KERN_WARNING "aac_srb_callback: srb failed, status = %d\n", le32_to_cpu(srbreply->status)); |
2388 | len = (le32_to_cpu(srbreply->sense_data_size) > | 2423 | len = min_t(u32, le32_to_cpu(srbreply->sense_data_size), |
2389 | sizeof(scsicmd->sense_buffer)) ? | 2424 | SCSI_SENSE_BUFFERSIZE); |
2390 | sizeof(scsicmd->sense_buffer) : | ||
2391 | le32_to_cpu(srbreply->sense_data_size); | ||
2392 | scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; | 2425 | scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; |
2393 | memcpy(scsicmd->sense_buffer, srbreply->sense_data, len); | 2426 | memcpy(scsicmd->sense_buffer, srbreply->sense_data, len); |
2394 | } | 2427 | } |
@@ -2412,7 +2445,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) | |||
2412 | case WRITE_12: | 2445 | case WRITE_12: |
2413 | case READ_16: | 2446 | case READ_16: |
2414 | case WRITE_16: | 2447 | case WRITE_16: |
2415 | if(le32_to_cpu(srbreply->data_xfer_length) < scsicmd->underflow ) { | 2448 | if (le32_to_cpu(srbreply->data_xfer_length) < scsicmd->underflow) { |
2416 | printk(KERN_WARNING"aacraid: SCSI CMD underflow\n"); | 2449 | printk(KERN_WARNING"aacraid: SCSI CMD underflow\n"); |
2417 | } else { | 2450 | } else { |
2418 | printk(KERN_WARNING"aacraid: SCSI CMD Data Overrun\n"); | 2451 | printk(KERN_WARNING"aacraid: SCSI CMD Data Overrun\n"); |
@@ -2481,26 +2514,23 @@ static void aac_srb_callback(void *context, struct fib * fibptr) | |||
2481 | printk("aacraid: SRB ERROR(%u) %s scsi cmd 0x%x - scsi status 0x%x\n", | 2514 | printk("aacraid: SRB ERROR(%u) %s scsi cmd 0x%x - scsi status 0x%x\n", |
2482 | le32_to_cpu(srbreply->srb_status) & 0x3F, | 2515 | le32_to_cpu(srbreply->srb_status) & 0x3F, |
2483 | aac_get_status_string( | 2516 | aac_get_status_string( |
2484 | le32_to_cpu(srbreply->srb_status) & 0x3F), | 2517 | le32_to_cpu(srbreply->srb_status) & 0x3F), |
2485 | scsicmd->cmnd[0], | 2518 | scsicmd->cmnd[0], |
2486 | le32_to_cpu(srbreply->scsi_status)); | 2519 | le32_to_cpu(srbreply->scsi_status)); |
2487 | #endif | 2520 | #endif |
2488 | scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8; | 2521 | scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8; |
2489 | break; | 2522 | break; |
2490 | } | 2523 | } |
2491 | if (le32_to_cpu(srbreply->scsi_status) == 0x02 ){ // Check Condition | 2524 | if (le32_to_cpu(srbreply->scsi_status) == SAM_STAT_CHECK_CONDITION) { |
2492 | int len; | 2525 | int len; |
2493 | scsicmd->result |= SAM_STAT_CHECK_CONDITION; | 2526 | scsicmd->result |= SAM_STAT_CHECK_CONDITION; |
2494 | len = (le32_to_cpu(srbreply->sense_data_size) > | 2527 | len = min_t(u32, le32_to_cpu(srbreply->sense_data_size), |
2495 | sizeof(scsicmd->sense_buffer)) ? | 2528 | SCSI_SENSE_BUFFERSIZE); |
2496 | sizeof(scsicmd->sense_buffer) : | ||
2497 | le32_to_cpu(srbreply->sense_data_size); | ||
2498 | #ifdef AAC_DETAILED_STATUS_INFO | 2529 | #ifdef AAC_DETAILED_STATUS_INFO |
2499 | printk(KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n", | 2530 | printk(KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n", |
2500 | le32_to_cpu(srbreply->status), len); | 2531 | le32_to_cpu(srbreply->status), len); |
2501 | #endif | 2532 | #endif |
2502 | memcpy(scsicmd->sense_buffer, srbreply->sense_data, len); | 2533 | memcpy(scsicmd->sense_buffer, srbreply->sense_data, len); |
2503 | |||
2504 | } | 2534 | } |
2505 | /* | 2535 | /* |
2506 | * OR in the scsi status (already shifted up a bit) | 2536 | * OR in the scsi status (already shifted up a bit) |
@@ -2517,7 +2547,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) | |||
2517 | * aac_send_scb_fib | 2547 | * aac_send_scb_fib |
2518 | * @scsicmd: the scsi command block | 2548 | * @scsicmd: the scsi command block |
2519 | * | 2549 | * |
2520 | * This routine will form a FIB and fill in the aac_srb from the | 2550 | * This routine will form a FIB and fill in the aac_srb from the |
2521 | * scsicmd passed in. | 2551 | * scsicmd passed in. |
2522 | */ | 2552 | */ |
2523 | 2553 | ||
@@ -2731,7 +2761,7 @@ static struct aac_srb_status_info srb_status_info[] = { | |||
2731 | { SRB_STATUS_ERROR_RECOVERY, "Error Recovery"}, | 2761 | { SRB_STATUS_ERROR_RECOVERY, "Error Recovery"}, |
2732 | { SRB_STATUS_NOT_STARTED, "Not Started"}, | 2762 | { SRB_STATUS_NOT_STARTED, "Not Started"}, |
2733 | { SRB_STATUS_NOT_IN_USE, "Not In Use"}, | 2763 | { SRB_STATUS_NOT_IN_USE, "Not In Use"}, |
2734 | { SRB_STATUS_FORCE_ABORT, "Force Abort"}, | 2764 | { SRB_STATUS_FORCE_ABORT, "Force Abort"}, |
2735 | { SRB_STATUS_DOMAIN_VALIDATION_FAIL,"Domain Validation Failure"}, | 2765 | { SRB_STATUS_DOMAIN_VALIDATION_FAIL,"Domain Validation Failure"}, |
2736 | { 0xff, "Unknown Error"} | 2766 | { 0xff, "Unknown Error"} |
2737 | }; | 2767 | }; |
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 9abba8b90f70..3195d29f2177 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h | |||
@@ -1,4 +1,4 @@ | |||
1 | #if (!defined(dprintk)) | 1 | #ifndef dprintk |
2 | # define dprintk(x) | 2 | # define dprintk(x) |
3 | #endif | 3 | #endif |
4 | /* eg: if (nblank(dprintk(x))) */ | 4 | /* eg: if (nblank(dprintk(x))) */ |
@@ -12,7 +12,7 @@ | |||
12 | *----------------------------------------------------------------------------*/ | 12 | *----------------------------------------------------------------------------*/ |
13 | 13 | ||
14 | #ifndef AAC_DRIVER_BUILD | 14 | #ifndef AAC_DRIVER_BUILD |
15 | # define AAC_DRIVER_BUILD 2449 | 15 | # define AAC_DRIVER_BUILD 2455 |
16 | # define AAC_DRIVER_BRANCH "-ms" | 16 | # define AAC_DRIVER_BRANCH "-ms" |
17 | #endif | 17 | #endif |
18 | #define MAXIMUM_NUM_CONTAINERS 32 | 18 | #define MAXIMUM_NUM_CONTAINERS 32 |
@@ -50,9 +50,9 @@ struct diskparm | |||
50 | /* | 50 | /* |
51 | * Firmware constants | 51 | * Firmware constants |
52 | */ | 52 | */ |
53 | 53 | ||
54 | #define CT_NONE 0 | 54 | #define CT_NONE 0 |
55 | #define CT_OK 218 | 55 | #define CT_OK 218 |
56 | #define FT_FILESYS 8 /* ADAPTEC's "FSA"(tm) filesystem */ | 56 | #define FT_FILESYS 8 /* ADAPTEC's "FSA"(tm) filesystem */ |
57 | #define FT_DRIVE 9 /* physical disk - addressable in scsi by bus/id/lun */ | 57 | #define FT_DRIVE 9 /* physical disk - addressable in scsi by bus/id/lun */ |
58 | 58 | ||
@@ -107,12 +107,12 @@ struct user_sgentryraw { | |||
107 | 107 | ||
108 | struct sgmap { | 108 | struct sgmap { |
109 | __le32 count; | 109 | __le32 count; |
110 | struct sgentry sg[1]; | 110 | struct sgentry sg[1]; |
111 | }; | 111 | }; |
112 | 112 | ||
113 | struct user_sgmap { | 113 | struct user_sgmap { |
114 | u32 count; | 114 | u32 count; |
115 | struct user_sgentry sg[1]; | 115 | struct user_sgentry sg[1]; |
116 | }; | 116 | }; |
117 | 117 | ||
118 | struct sgmap64 { | 118 | struct sgmap64 { |
@@ -137,18 +137,18 @@ struct user_sgmapraw { | |||
137 | 137 | ||
138 | struct creation_info | 138 | struct creation_info |
139 | { | 139 | { |
140 | u8 buildnum; /* e.g., 588 */ | 140 | u8 buildnum; /* e.g., 588 */ |
141 | u8 usec; /* e.g., 588 */ | 141 | u8 usec; /* e.g., 588 */ |
142 | u8 via; /* e.g., 1 = FSU, | 142 | u8 via; /* e.g., 1 = FSU, |
143 | * 2 = API | 143 | * 2 = API |
144 | */ | 144 | */ |
145 | u8 year; /* e.g., 1997 = 97 */ | 145 | u8 year; /* e.g., 1997 = 97 */ |
146 | __le32 date; /* | 146 | __le32 date; /* |
147 | * unsigned Month :4; // 1 - 12 | 147 | * unsigned Month :4; // 1 - 12 |
148 | * unsigned Day :6; // 1 - 32 | 148 | * unsigned Day :6; // 1 - 32 |
149 | * unsigned Hour :6; // 0 - 23 | 149 | * unsigned Hour :6; // 0 - 23 |
150 | * unsigned Minute :6; // 0 - 60 | 150 | * unsigned Minute :6; // 0 - 60 |
151 | * unsigned Second :6; // 0 - 60 | 151 | * unsigned Second :6; // 0 - 60 |
152 | */ | 152 | */ |
153 | __le32 serial[2]; /* e.g., 0x1DEADB0BFAFAF001 */ | 153 | __le32 serial[2]; /* e.g., 0x1DEADB0BFAFAF001 */ |
154 | }; | 154 | }; |
@@ -184,7 +184,7 @@ struct creation_info | |||
184 | /* | 184 | /* |
185 | * Set the queues on a 16 byte alignment | 185 | * Set the queues on a 16 byte alignment |
186 | */ | 186 | */ |
187 | 187 | ||
188 | #define QUEUE_ALIGNMENT 16 | 188 | #define QUEUE_ALIGNMENT 16 |
189 | 189 | ||
190 | /* | 190 | /* |
@@ -203,9 +203,9 @@ struct aac_entry { | |||
203 | * The adapter assumes the ProducerIndex and ConsumerIndex are grouped | 203 | * The adapter assumes the ProducerIndex and ConsumerIndex are grouped |
204 | * adjacently and in that order. | 204 | * adjacently and in that order. |
205 | */ | 205 | */ |
206 | 206 | ||
207 | struct aac_qhdr { | 207 | struct aac_qhdr { |
208 | __le64 header_addr;/* Address to hand the adapter to access | 208 | __le64 header_addr;/* Address to hand the adapter to access |
209 | to this queue head */ | 209 | to this queue head */ |
210 | __le32 *producer; /* The producer index for this queue (host address) */ | 210 | __le32 *producer; /* The producer index for this queue (host address) */ |
211 | __le32 *consumer; /* The consumer index for this queue (host address) */ | 211 | __le32 *consumer; /* The consumer index for this queue (host address) */ |
@@ -215,7 +215,7 @@ struct aac_qhdr { | |||
215 | * Define all the events which the adapter would like to notify | 215 | * Define all the events which the adapter would like to notify |
216 | * the host of. | 216 | * the host of. |
217 | */ | 217 | */ |
218 | 218 | ||
219 | #define HostNormCmdQue 1 /* Change in host normal priority command queue */ | 219 | #define HostNormCmdQue 1 /* Change in host normal priority command queue */ |
220 | #define HostHighCmdQue 2 /* Change in host high priority command queue */ | 220 | #define HostHighCmdQue 2 /* Change in host high priority command queue */ |
221 | #define HostNormRespQue 3 /* Change in host normal priority response queue */ | 221 | #define HostNormRespQue 3 /* Change in host normal priority response queue */ |
@@ -286,17 +286,17 @@ struct aac_fibhdr { | |||
286 | u8 StructType; /* Type FIB */ | 286 | u8 StructType; /* Type FIB */ |
287 | u8 Flags; /* Flags for FIB */ | 287 | u8 Flags; /* Flags for FIB */ |
288 | __le16 Size; /* Size of this FIB in bytes */ | 288 | __le16 Size; /* Size of this FIB in bytes */ |
289 | __le16 SenderSize; /* Size of the FIB in the sender | 289 | __le16 SenderSize; /* Size of the FIB in the sender |
290 | (for response sizing) */ | 290 | (for response sizing) */ |
291 | __le32 SenderFibAddress; /* Host defined data in the FIB */ | 291 | __le32 SenderFibAddress; /* Host defined data in the FIB */ |
292 | __le32 ReceiverFibAddress;/* Logical address of this FIB for | 292 | __le32 ReceiverFibAddress;/* Logical address of this FIB for |
293 | the adapter */ | 293 | the adapter */ |
294 | u32 SenderData; /* Place holder for the sender to store data */ | 294 | u32 SenderData; /* Place holder for the sender to store data */ |
295 | union { | 295 | union { |
296 | struct { | 296 | struct { |
297 | __le32 _ReceiverTimeStart; /* Timestamp for | 297 | __le32 _ReceiverTimeStart; /* Timestamp for |
298 | receipt of fib */ | 298 | receipt of fib */ |
299 | __le32 _ReceiverTimeDone; /* Timestamp for | 299 | __le32 _ReceiverTimeDone; /* Timestamp for |
300 | completion of fib */ | 300 | completion of fib */ |
301 | } _s; | 301 | } _s; |
302 | } _u; | 302 | } _u; |
@@ -311,7 +311,7 @@ struct hw_fib { | |||
311 | * FIB commands | 311 | * FIB commands |
312 | */ | 312 | */ |
313 | 313 | ||
314 | #define TestCommandResponse 1 | 314 | #define TestCommandResponse 1 |
315 | #define TestAdapterCommand 2 | 315 | #define TestAdapterCommand 2 |
316 | /* | 316 | /* |
317 | * Lowlevel and comm commands | 317 | * Lowlevel and comm commands |
@@ -350,10 +350,6 @@ struct hw_fib { | |||
350 | #define ContainerCommand64 501 | 350 | #define ContainerCommand64 501 |
351 | #define ContainerRawIo 502 | 351 | #define ContainerRawIo 502 |
352 | /* | 352 | /* |
353 | * Cluster Commands | ||
354 | */ | ||
355 | #define ClusterCommand 550 | ||
356 | /* | ||
357 | * Scsi Port commands (scsi passthrough) | 353 | * Scsi Port commands (scsi passthrough) |
358 | */ | 354 | */ |
359 | #define ScsiPortCommand 600 | 355 | #define ScsiPortCommand 600 |
@@ -375,19 +371,19 @@ struct hw_fib { | |||
375 | */ | 371 | */ |
376 | 372 | ||
377 | enum fib_xfer_state { | 373 | enum fib_xfer_state { |
378 | HostOwned = (1<<0), | 374 | HostOwned = (1<<0), |
379 | AdapterOwned = (1<<1), | 375 | AdapterOwned = (1<<1), |
380 | FibInitialized = (1<<2), | 376 | FibInitialized = (1<<2), |
381 | FibEmpty = (1<<3), | 377 | FibEmpty = (1<<3), |
382 | AllocatedFromPool = (1<<4), | 378 | AllocatedFromPool = (1<<4), |
383 | SentFromHost = (1<<5), | 379 | SentFromHost = (1<<5), |
384 | SentFromAdapter = (1<<6), | 380 | SentFromAdapter = (1<<6), |
385 | ResponseExpected = (1<<7), | 381 | ResponseExpected = (1<<7), |
386 | NoResponseExpected = (1<<8), | 382 | NoResponseExpected = (1<<8), |
387 | AdapterProcessed = (1<<9), | 383 | AdapterProcessed = (1<<9), |
388 | HostProcessed = (1<<10), | 384 | HostProcessed = (1<<10), |
389 | HighPriority = (1<<11), | 385 | HighPriority = (1<<11), |
390 | NormalPriority = (1<<12), | 386 | NormalPriority = (1<<12), |
391 | Async = (1<<13), | 387 | Async = (1<<13), |
392 | AsyncIo = (1<<13), // rpbfix: remove with new regime | 388 | AsyncIo = (1<<13), // rpbfix: remove with new regime |
393 | PageFileIo = (1<<14), // rpbfix: remove with new regime | 389 | PageFileIo = (1<<14), // rpbfix: remove with new regime |
@@ -420,7 +416,7 @@ struct aac_init | |||
420 | __le32 AdapterFibAlign; | 416 | __le32 AdapterFibAlign; |
421 | __le32 printfbuf; | 417 | __le32 printfbuf; |
422 | __le32 printfbufsiz; | 418 | __le32 printfbufsiz; |
423 | __le32 HostPhysMemPages; /* number of 4k pages of host | 419 | __le32 HostPhysMemPages; /* number of 4k pages of host |
424 | physical memory */ | 420 | physical memory */ |
425 | __le32 HostElapsedSeconds; /* number of seconds since 1970. */ | 421 | __le32 HostElapsedSeconds; /* number of seconds since 1970. */ |
426 | /* | 422 | /* |
@@ -481,7 +477,7 @@ struct adapter_ops | |||
481 | 477 | ||
482 | struct aac_driver_ident | 478 | struct aac_driver_ident |
483 | { | 479 | { |
484 | int (*init)(struct aac_dev *dev); | 480 | int (*init)(struct aac_dev *dev); |
485 | char * name; | 481 | char * name; |
486 | char * vname; | 482 | char * vname; |
487 | char * model; | 483 | char * model; |
@@ -489,7 +485,7 @@ struct aac_driver_ident | |||
489 | int quirks; | 485 | int quirks; |
490 | }; | 486 | }; |
491 | /* | 487 | /* |
492 | * Some adapter firmware needs communication memory | 488 | * Some adapter firmware needs communication memory |
493 | * below 2gig. This tells the init function to set the | 489 | * below 2gig. This tells the init function to set the |
494 | * dma mask such that fib memory will be allocated where the | 490 | * dma mask such that fib memory will be allocated where the |
495 | * adapter firmware can get to it. | 491 | * adapter firmware can get to it. |
@@ -521,33 +517,39 @@ struct aac_driver_ident | |||
521 | #define AAC_QUIRK_17SG 0x0010 | 517 | #define AAC_QUIRK_17SG 0x0010 |
522 | 518 | ||
523 | /* | 519 | /* |
520 | * Some adapter firmware does not support 64 bit scsi passthrough | ||
521 | * commands. | ||
522 | */ | ||
523 | #define AAC_QUIRK_SCSI_32 0x0020 | ||
524 | |||
525 | /* | ||
524 | * The adapter interface specs all queues to be located in the same | 526 | * The adapter interface specs all queues to be located in the same |
525 | * physically contigous block. The host structure that defines the | 527 | * physically contigous block. The host structure that defines the |
526 | * commuication queues will assume they are each a separate physically | 528 | * commuication queues will assume they are each a separate physically |
527 | * contigous memory region that will support them all being one big | 529 | * contigous memory region that will support them all being one big |
528 | * contigous block. | 530 | * contigous block. |
529 | * There is a command and response queue for each level and direction of | 531 | * There is a command and response queue for each level and direction of |
530 | * commuication. These regions are accessed by both the host and adapter. | 532 | * commuication. These regions are accessed by both the host and adapter. |
531 | */ | 533 | */ |
532 | 534 | ||
533 | struct aac_queue { | 535 | struct aac_queue { |
534 | u64 logical; /*address we give the adapter */ | 536 | u64 logical; /*address we give the adapter */ |
535 | struct aac_entry *base; /*system virtual address */ | 537 | struct aac_entry *base; /*system virtual address */ |
536 | struct aac_qhdr headers; /*producer,consumer q headers*/ | 538 | struct aac_qhdr headers; /*producer,consumer q headers*/ |
537 | u32 entries; /*Number of queue entries */ | 539 | u32 entries; /*Number of queue entries */ |
538 | wait_queue_head_t qfull; /*Event to wait on if q full */ | 540 | wait_queue_head_t qfull; /*Event to wait on if q full */ |
539 | wait_queue_head_t cmdready; /*Cmd ready from the adapter */ | 541 | wait_queue_head_t cmdready; /*Cmd ready from the adapter */ |
540 | /* This is only valid for adapter to host command queues. */ | 542 | /* This is only valid for adapter to host command queues. */ |
541 | spinlock_t *lock; /* Spinlock for this queue must take this lock before accessing the lock */ | 543 | spinlock_t *lock; /* Spinlock for this queue must take this lock before accessing the lock */ |
542 | spinlock_t lockdata; /* Actual lock (used only on one side of the lock) */ | 544 | spinlock_t lockdata; /* Actual lock (used only on one side of the lock) */ |
543 | struct list_head cmdq; /* A queue of FIBs which need to be prcessed by the FS thread. This is */ | 545 | struct list_head cmdq; /* A queue of FIBs which need to be prcessed by the FS thread. This is */ |
544 | /* only valid for command queues which receive entries from the adapter. */ | 546 | /* only valid for command queues which receive entries from the adapter. */ |
545 | u32 numpending; /* Number of entries on outstanding queue. */ | 547 | u32 numpending; /* Number of entries on outstanding queue. */ |
546 | struct aac_dev * dev; /* Back pointer to adapter structure */ | 548 | struct aac_dev * dev; /* Back pointer to adapter structure */ |
547 | }; | 549 | }; |
548 | 550 | ||
549 | /* | 551 | /* |
550 | * Message queues. The order here is important, see also the | 552 | * Message queues. The order here is important, see also the |
551 | * queue type ordering | 553 | * queue type ordering |
552 | */ | 554 | */ |
553 | 555 | ||
@@ -559,12 +561,12 @@ struct aac_queue_block | |||
559 | /* | 561 | /* |
560 | * SaP1 Message Unit Registers | 562 | * SaP1 Message Unit Registers |
561 | */ | 563 | */ |
562 | 564 | ||
563 | struct sa_drawbridge_CSR { | 565 | struct sa_drawbridge_CSR { |
564 | /* Offset | Name */ | 566 | /* Offset | Name */ |
565 | __le32 reserved[10]; /* 00h-27h | Reserved */ | 567 | __le32 reserved[10]; /* 00h-27h | Reserved */ |
566 | u8 LUT_Offset; /* 28h | Lookup Table Offset */ | 568 | u8 LUT_Offset; /* 28h | Lookup Table Offset */ |
567 | u8 reserved1[3]; /* 29h-2bh | Reserved */ | 569 | u8 reserved1[3]; /* 29h-2bh | Reserved */ |
568 | __le32 LUT_Data; /* 2ch | Looup Table Data */ | 570 | __le32 LUT_Data; /* 2ch | Looup Table Data */ |
569 | __le32 reserved2[26]; /* 30h-97h | Reserved */ | 571 | __le32 reserved2[26]; /* 30h-97h | Reserved */ |
570 | __le16 PRICLEARIRQ; /* 98h | Primary Clear Irq */ | 572 | __le16 PRICLEARIRQ; /* 98h | Primary Clear Irq */ |
@@ -583,8 +585,8 @@ struct sa_drawbridge_CSR { | |||
583 | __le32 MAILBOX5; /* bch | Scratchpad 5 */ | 585 | __le32 MAILBOX5; /* bch | Scratchpad 5 */ |
584 | __le32 MAILBOX6; /* c0h | Scratchpad 6 */ | 586 | __le32 MAILBOX6; /* c0h | Scratchpad 6 */ |
585 | __le32 MAILBOX7; /* c4h | Scratchpad 7 */ | 587 | __le32 MAILBOX7; /* c4h | Scratchpad 7 */ |
586 | __le32 ROM_Setup_Data; /* c8h | Rom Setup and Data */ | 588 | __le32 ROM_Setup_Data; /* c8h | Rom Setup and Data */ |
587 | __le32 ROM_Control_Addr;/* cch | Rom Control and Address */ | 589 | __le32 ROM_Control_Addr;/* cch | Rom Control and Address */ |
588 | __le32 reserved3[12]; /* d0h-ffh | reserved */ | 590 | __le32 reserved3[12]; /* d0h-ffh | reserved */ |
589 | __le32 LUT[64]; /* 100h-1ffh | Lookup Table Entries */ | 591 | __le32 LUT[64]; /* 100h-1ffh | Lookup Table Entries */ |
590 | }; | 592 | }; |
@@ -597,7 +599,7 @@ struct sa_drawbridge_CSR { | |||
597 | #define Mailbox5 SaDbCSR.MAILBOX5 | 599 | #define Mailbox5 SaDbCSR.MAILBOX5 |
598 | #define Mailbox6 SaDbCSR.MAILBOX6 | 600 | #define Mailbox6 SaDbCSR.MAILBOX6 |
599 | #define Mailbox7 SaDbCSR.MAILBOX7 | 601 | #define Mailbox7 SaDbCSR.MAILBOX7 |
600 | 602 | ||
601 | #define DoorbellReg_p SaDbCSR.PRISETIRQ | 603 | #define DoorbellReg_p SaDbCSR.PRISETIRQ |
602 | #define DoorbellReg_s SaDbCSR.SECSETIRQ | 604 | #define DoorbellReg_s SaDbCSR.SECSETIRQ |
603 | #define DoorbellClrReg_p SaDbCSR.PRICLEARIRQ | 605 | #define DoorbellClrReg_p SaDbCSR.PRICLEARIRQ |
@@ -611,19 +613,19 @@ struct sa_drawbridge_CSR { | |||
611 | #define DOORBELL_5 0x0020 | 613 | #define DOORBELL_5 0x0020 |
612 | #define DOORBELL_6 0x0040 | 614 | #define DOORBELL_6 0x0040 |
613 | 615 | ||
614 | 616 | ||
615 | #define PrintfReady DOORBELL_5 | 617 | #define PrintfReady DOORBELL_5 |
616 | #define PrintfDone DOORBELL_5 | 618 | #define PrintfDone DOORBELL_5 |
617 | 619 | ||
618 | struct sa_registers { | 620 | struct sa_registers { |
619 | struct sa_drawbridge_CSR SaDbCSR; /* 98h - c4h */ | 621 | struct sa_drawbridge_CSR SaDbCSR; /* 98h - c4h */ |
620 | }; | 622 | }; |
621 | 623 | ||
622 | 624 | ||
623 | #define Sa_MINIPORT_REVISION 1 | 625 | #define Sa_MINIPORT_REVISION 1 |
624 | 626 | ||
625 | #define sa_readw(AEP, CSR) readl(&((AEP)->regs.sa->CSR)) | 627 | #define sa_readw(AEP, CSR) readl(&((AEP)->regs.sa->CSR)) |
626 | #define sa_readl(AEP, CSR) readl(&((AEP)->regs.sa->CSR)) | 628 | #define sa_readl(AEP, CSR) readl(&((AEP)->regs.sa->CSR)) |
627 | #define sa_writew(AEP, CSR, value) writew(value, &((AEP)->regs.sa->CSR)) | 629 | #define sa_writew(AEP, CSR, value) writew(value, &((AEP)->regs.sa->CSR)) |
628 | #define sa_writel(AEP, CSR, value) writel(value, &((AEP)->regs.sa->CSR)) | 630 | #define sa_writel(AEP, CSR, value) writel(value, &((AEP)->regs.sa->CSR)) |
629 | 631 | ||
@@ -640,21 +642,21 @@ struct rx_mu_registers { | |||
640 | __le32 IMRx[2]; /* 1310h | 10h | Inbound Message Registers */ | 642 | __le32 IMRx[2]; /* 1310h | 10h | Inbound Message Registers */ |
641 | __le32 OMRx[2]; /* 1318h | 18h | Outbound Message Registers */ | 643 | __le32 OMRx[2]; /* 1318h | 18h | Outbound Message Registers */ |
642 | __le32 IDR; /* 1320h | 20h | Inbound Doorbell Register */ | 644 | __le32 IDR; /* 1320h | 20h | Inbound Doorbell Register */ |
643 | __le32 IISR; /* 1324h | 24h | Inbound Interrupt | 645 | __le32 IISR; /* 1324h | 24h | Inbound Interrupt |
644 | Status Register */ | 646 | Status Register */ |
645 | __le32 IIMR; /* 1328h | 28h | Inbound Interrupt | 647 | __le32 IIMR; /* 1328h | 28h | Inbound Interrupt |
646 | Mask Register */ | 648 | Mask Register */ |
647 | __le32 ODR; /* 132Ch | 2Ch | Outbound Doorbell Register */ | 649 | __le32 ODR; /* 132Ch | 2Ch | Outbound Doorbell Register */ |
648 | __le32 OISR; /* 1330h | 30h | Outbound Interrupt | 650 | __le32 OISR; /* 1330h | 30h | Outbound Interrupt |
649 | Status Register */ | 651 | Status Register */ |
650 | __le32 OIMR; /* 1334h | 34h | Outbound Interrupt | 652 | __le32 OIMR; /* 1334h | 34h | Outbound Interrupt |
651 | Mask Register */ | 653 | Mask Register */ |
652 | __le32 reserved2; /* 1338h | 38h | Reserved */ | 654 | __le32 reserved2; /* 1338h | 38h | Reserved */ |
653 | __le32 reserved3; /* 133Ch | 3Ch | Reserved */ | 655 | __le32 reserved3; /* 133Ch | 3Ch | Reserved */ |
654 | __le32 InboundQueue;/* 1340h | 40h | Inbound Queue Port relative to firmware */ | 656 | __le32 InboundQueue;/* 1340h | 40h | Inbound Queue Port relative to firmware */ |
655 | __le32 OutboundQueue;/*1344h | 44h | Outbound Queue Port relative to firmware */ | 657 | __le32 OutboundQueue;/*1344h | 44h | Outbound Queue Port relative to firmware */ |
656 | /* * Must access through ATU Inbound | 658 | /* * Must access through ATU Inbound |
657 | Translation Window */ | 659 | Translation Window */ |
658 | }; | 660 | }; |
659 | 661 | ||
660 | struct rx_inbound { | 662 | struct rx_inbound { |
@@ -710,12 +712,12 @@ struct rkt_registers { | |||
710 | typedef void (*fib_callback)(void *ctxt, struct fib *fibctx); | 712 | typedef void (*fib_callback)(void *ctxt, struct fib *fibctx); |
711 | 713 | ||
712 | struct aac_fib_context { | 714 | struct aac_fib_context { |
713 | s16 type; // used for verification of structure | 715 | s16 type; // used for verification of structure |
714 | s16 size; | 716 | s16 size; |
715 | u32 unique; // unique value representing this context | 717 | u32 unique; // unique value representing this context |
716 | ulong jiffies; // used for cleanup - dmb changed to ulong | 718 | ulong jiffies; // used for cleanup - dmb changed to ulong |
717 | struct list_head next; // used to link context's into a linked list | 719 | struct list_head next; // used to link context's into a linked list |
718 | struct semaphore wait_sem; // this is used to wait for the next fib to arrive. | 720 | struct semaphore wait_sem; // this is used to wait for the next fib to arrive. |
719 | int wait; // Set to true when thread is in WaitForSingleObject | 721 | int wait; // Set to true when thread is in WaitForSingleObject |
720 | unsigned long count; // total number of FIBs on FibList | 722 | unsigned long count; // total number of FIBs on FibList |
721 | struct list_head fib_list; // this holds fibs and their attachd hw_fibs | 723 | struct list_head fib_list; // this holds fibs and their attachd hw_fibs |
@@ -734,9 +736,9 @@ struct sense_data { | |||
734 | u8 EOM:1; /* End Of Medium - reserved for random access devices */ | 736 | u8 EOM:1; /* End Of Medium - reserved for random access devices */ |
735 | u8 filemark:1; /* Filemark - reserved for random access devices */ | 737 | u8 filemark:1; /* Filemark - reserved for random access devices */ |
736 | 738 | ||
737 | u8 information[4]; /* for direct-access devices, contains the unsigned | 739 | u8 information[4]; /* for direct-access devices, contains the unsigned |
738 | * logical block address or residue associated with | 740 | * logical block address or residue associated with |
739 | * the sense key | 741 | * the sense key |
740 | */ | 742 | */ |
741 | u8 add_sense_len; /* number of additional sense bytes to follow this field */ | 743 | u8 add_sense_len; /* number of additional sense bytes to follow this field */ |
742 | u8 cmnd_info[4]; /* not used */ | 744 | u8 cmnd_info[4]; /* not used */ |
@@ -746,7 +748,7 @@ struct sense_data { | |||
746 | u8 bit_ptr:3; /* indicates which byte of the CDB or parameter data | 748 | u8 bit_ptr:3; /* indicates which byte of the CDB or parameter data |
747 | * was in error | 749 | * was in error |
748 | */ | 750 | */ |
749 | u8 BPV:1; /* bit pointer valid (BPV): 1- indicates that | 751 | u8 BPV:1; /* bit pointer valid (BPV): 1- indicates that |
750 | * the bit_ptr field has valid value | 752 | * the bit_ptr field has valid value |
751 | */ | 753 | */ |
752 | u8 reserved2:2; | 754 | u8 reserved2:2; |
@@ -780,24 +782,24 @@ struct fib { | |||
780 | /* | 782 | /* |
781 | * The Adapter that this I/O is destined for. | 783 | * The Adapter that this I/O is destined for. |
782 | */ | 784 | */ |
783 | struct aac_dev *dev; | 785 | struct aac_dev *dev; |
784 | /* | 786 | /* |
785 | * This is the event the sendfib routine will wait on if the | 787 | * This is the event the sendfib routine will wait on if the |
786 | * caller did not pass one and this is synch io. | 788 | * caller did not pass one and this is synch io. |
787 | */ | 789 | */ |
788 | struct semaphore event_wait; | 790 | struct semaphore event_wait; |
789 | spinlock_t event_lock; | 791 | spinlock_t event_lock; |
790 | 792 | ||
791 | u32 done; /* gets set to 1 when fib is complete */ | 793 | u32 done; /* gets set to 1 when fib is complete */ |
792 | fib_callback callback; | 794 | fib_callback callback; |
793 | void *callback_data; | 795 | void *callback_data; |
794 | u32 flags; // u32 dmb was ulong | 796 | u32 flags; // u32 dmb was ulong |
795 | /* | 797 | /* |
796 | * And for the internal issue/reply queues (we may be able | 798 | * And for the internal issue/reply queues (we may be able |
797 | * to merge these two) | 799 | * to merge these two) |
798 | */ | 800 | */ |
799 | struct list_head fiblink; | 801 | struct list_head fiblink; |
800 | void *data; | 802 | void *data; |
801 | struct hw_fib *hw_fib_va; /* Actual shared object */ | 803 | struct hw_fib *hw_fib_va; /* Actual shared object */ |
802 | dma_addr_t hw_fib_pa; /* physical address of hw_fib*/ | 804 | dma_addr_t hw_fib_pa; /* physical address of hw_fib*/ |
803 | }; | 805 | }; |
@@ -807,7 +809,7 @@ struct fib { | |||
807 | * | 809 | * |
808 | * This is returned by the RequestAdapterInfo block | 810 | * This is returned by the RequestAdapterInfo block |
809 | */ | 811 | */ |
810 | 812 | ||
811 | struct aac_adapter_info | 813 | struct aac_adapter_info |
812 | { | 814 | { |
813 | __le32 platform; | 815 | __le32 platform; |
@@ -826,7 +828,7 @@ struct aac_adapter_info | |||
826 | __le32 biosrev; | 828 | __le32 biosrev; |
827 | __le32 biosbuild; | 829 | __le32 biosbuild; |
828 | __le32 cluster; | 830 | __le32 cluster; |
829 | __le32 clusterchannelmask; | 831 | __le32 clusterchannelmask; |
830 | __le32 serial[2]; | 832 | __le32 serial[2]; |
831 | __le32 battery; | 833 | __le32 battery; |
832 | __le32 options; | 834 | __le32 options; |
@@ -863,9 +865,10 @@ struct aac_supplement_adapter_info | |||
863 | __le32 SupportedOptions2; | 865 | __le32 SupportedOptions2; |
864 | __le32 ReservedGrowth[1]; | 866 | __le32 ReservedGrowth[1]; |
865 | }; | 867 | }; |
866 | #define AAC_FEATURE_FALCON 0x00000010 | 868 | #define AAC_FEATURE_FALCON cpu_to_le32(0x00000010) |
867 | #define AAC_OPTION_MU_RESET 0x00000001 | 869 | #define AAC_FEATURE_JBOD cpu_to_le32(0x08000000) |
868 | #define AAC_OPTION_IGNORE_RESET 0x00000002 | 870 | #define AAC_OPTION_MU_RESET cpu_to_le32(0x00000001) |
871 | #define AAC_OPTION_IGNORE_RESET cpu_to_le32(0x00000002) | ||
869 | #define AAC_SIS_VERSION_V3 3 | 872 | #define AAC_SIS_VERSION_V3 3 |
870 | #define AAC_SIS_SLOT_UNKNOWN 0xFF | 873 | #define AAC_SIS_SLOT_UNKNOWN 0xFF |
871 | 874 | ||
@@ -916,13 +919,13 @@ struct aac_bus_info_response { | |||
916 | #define AAC_OPT_HOST_TIME_FIB cpu_to_le32(1<<4) | 919 | #define AAC_OPT_HOST_TIME_FIB cpu_to_le32(1<<4) |
917 | #define AAC_OPT_RAID50 cpu_to_le32(1<<5) | 920 | #define AAC_OPT_RAID50 cpu_to_le32(1<<5) |
918 | #define AAC_OPT_4GB_WINDOW cpu_to_le32(1<<6) | 921 | #define AAC_OPT_4GB_WINDOW cpu_to_le32(1<<6) |
919 | #define AAC_OPT_SCSI_UPGRADEABLE cpu_to_le32(1<<7) | 922 | #define AAC_OPT_SCSI_UPGRADEABLE cpu_to_le32(1<<7) |
920 | #define AAC_OPT_SOFT_ERR_REPORT cpu_to_le32(1<<8) | 923 | #define AAC_OPT_SOFT_ERR_REPORT cpu_to_le32(1<<8) |
921 | #define AAC_OPT_SUPPORTED_RECONDITION cpu_to_le32(1<<9) | 924 | #define AAC_OPT_SUPPORTED_RECONDITION cpu_to_le32(1<<9) |
922 | #define AAC_OPT_SGMAP_HOST64 cpu_to_le32(1<<10) | 925 | #define AAC_OPT_SGMAP_HOST64 cpu_to_le32(1<<10) |
923 | #define AAC_OPT_ALARM cpu_to_le32(1<<11) | 926 | #define AAC_OPT_ALARM cpu_to_le32(1<<11) |
924 | #define AAC_OPT_NONDASD cpu_to_le32(1<<12) | 927 | #define AAC_OPT_NONDASD cpu_to_le32(1<<12) |
925 | #define AAC_OPT_SCSI_MANAGED cpu_to_le32(1<<13) | 928 | #define AAC_OPT_SCSI_MANAGED cpu_to_le32(1<<13) |
926 | #define AAC_OPT_RAID_SCSI_MODE cpu_to_le32(1<<14) | 929 | #define AAC_OPT_RAID_SCSI_MODE cpu_to_le32(1<<14) |
927 | #define AAC_OPT_SUPPLEMENT_ADAPTER_INFO cpu_to_le32(1<<16) | 930 | #define AAC_OPT_SUPPLEMENT_ADAPTER_INFO cpu_to_le32(1<<16) |
928 | #define AAC_OPT_NEW_COMM cpu_to_le32(1<<17) | 931 | #define AAC_OPT_NEW_COMM cpu_to_le32(1<<17) |
@@ -942,7 +945,7 @@ struct aac_dev | |||
942 | 945 | ||
943 | /* | 946 | /* |
944 | * Map for 128 fib objects (64k) | 947 | * Map for 128 fib objects (64k) |
945 | */ | 948 | */ |
946 | dma_addr_t hw_fib_pa; | 949 | dma_addr_t hw_fib_pa; |
947 | struct hw_fib *hw_fib_va; | 950 | struct hw_fib *hw_fib_va; |
948 | struct hw_fib *aif_base_va; | 951 | struct hw_fib *aif_base_va; |
@@ -953,24 +956,24 @@ struct aac_dev | |||
953 | 956 | ||
954 | struct fib *free_fib; | 957 | struct fib *free_fib; |
955 | spinlock_t fib_lock; | 958 | spinlock_t fib_lock; |
956 | 959 | ||
957 | struct aac_queue_block *queues; | 960 | struct aac_queue_block *queues; |
958 | /* | 961 | /* |
959 | * The user API will use an IOCTL to register itself to receive | 962 | * The user API will use an IOCTL to register itself to receive |
960 | * FIBs from the adapter. The following list is used to keep | 963 | * FIBs from the adapter. The following list is used to keep |
961 | * track of all the threads that have requested these FIBs. The | 964 | * track of all the threads that have requested these FIBs. The |
962 | * mutex is used to synchronize access to all data associated | 965 | * mutex is used to synchronize access to all data associated |
963 | * with the adapter fibs. | 966 | * with the adapter fibs. |
964 | */ | 967 | */ |
965 | struct list_head fib_list; | 968 | struct list_head fib_list; |
966 | 969 | ||
967 | struct adapter_ops a_ops; | 970 | struct adapter_ops a_ops; |
968 | unsigned long fsrev; /* Main driver's revision number */ | 971 | unsigned long fsrev; /* Main driver's revision number */ |
969 | 972 | ||
970 | unsigned base_size; /* Size of mapped in region */ | 973 | unsigned base_size; /* Size of mapped in region */ |
971 | struct aac_init *init; /* Holds initialization info to communicate with adapter */ | 974 | struct aac_init *init; /* Holds initialization info to communicate with adapter */ |
972 | dma_addr_t init_pa; /* Holds physical address of the init struct */ | 975 | dma_addr_t init_pa; /* Holds physical address of the init struct */ |
973 | 976 | ||
974 | struct pci_dev *pdev; /* Our PCI interface */ | 977 | struct pci_dev *pdev; /* Our PCI interface */ |
975 | void * printfbuf; /* pointer to buffer used for printf's from the adapter */ | 978 | void * printfbuf; /* pointer to buffer used for printf's from the adapter */ |
976 | void * comm_addr; /* Base address of Comm area */ | 979 | void * comm_addr; /* Base address of Comm area */ |
@@ -984,11 +987,11 @@ struct aac_dev | |||
984 | struct fsa_dev_info *fsa_dev; | 987 | struct fsa_dev_info *fsa_dev; |
985 | struct task_struct *thread; | 988 | struct task_struct *thread; |
986 | int cardtype; | 989 | int cardtype; |
987 | 990 | ||
988 | /* | 991 | /* |
989 | * The following is the device specific extension. | 992 | * The following is the device specific extension. |
990 | */ | 993 | */ |
991 | #if (!defined(AAC_MIN_FOOTPRINT_SIZE)) | 994 | #ifndef AAC_MIN_FOOTPRINT_SIZE |
992 | # define AAC_MIN_FOOTPRINT_SIZE 8192 | 995 | # define AAC_MIN_FOOTPRINT_SIZE 8192 |
993 | #endif | 996 | #endif |
994 | union | 997 | union |
@@ -1009,7 +1012,9 @@ struct aac_dev | |||
1009 | /* These are in adapter info but they are in the io flow so | 1012 | /* These are in adapter info but they are in the io flow so |
1010 | * lets break them out so we don't have to do an AND to check them | 1013 | * lets break them out so we don't have to do an AND to check them |
1011 | */ | 1014 | */ |
1012 | u8 nondasd_support; | 1015 | u8 nondasd_support; |
1016 | u8 jbod; | ||
1017 | u8 cache_protected; | ||
1013 | u8 dac_support; | 1018 | u8 dac_support; |
1014 | u8 raid_scsi_mode; | 1019 | u8 raid_scsi_mode; |
1015 | u8 comm_interface; | 1020 | u8 comm_interface; |
@@ -1066,18 +1071,19 @@ struct aac_dev | |||
1066 | (dev)->a_ops.adapter_comm(dev, comm) | 1071 | (dev)->a_ops.adapter_comm(dev, comm) |
1067 | 1072 | ||
1068 | #define FIB_CONTEXT_FLAG_TIMED_OUT (0x00000001) | 1073 | #define FIB_CONTEXT_FLAG_TIMED_OUT (0x00000001) |
1074 | #define FIB_CONTEXT_FLAG (0x00000002) | ||
1069 | 1075 | ||
1070 | /* | 1076 | /* |
1071 | * Define the command values | 1077 | * Define the command values |
1072 | */ | 1078 | */ |
1073 | 1079 | ||
1074 | #define Null 0 | 1080 | #define Null 0 |
1075 | #define GetAttributes 1 | 1081 | #define GetAttributes 1 |
1076 | #define SetAttributes 2 | 1082 | #define SetAttributes 2 |
1077 | #define Lookup 3 | 1083 | #define Lookup 3 |
1078 | #define ReadLink 4 | 1084 | #define ReadLink 4 |
1079 | #define Read 5 | 1085 | #define Read 5 |
1080 | #define Write 6 | 1086 | #define Write 6 |
1081 | #define Create 7 | 1087 | #define Create 7 |
1082 | #define MakeDirectory 8 | 1088 | #define MakeDirectory 8 |
1083 | #define SymbolicLink 9 | 1089 | #define SymbolicLink 9 |
@@ -1173,19 +1179,19 @@ struct aac_dev | |||
1173 | 1179 | ||
1174 | struct aac_read | 1180 | struct aac_read |
1175 | { | 1181 | { |
1176 | __le32 command; | 1182 | __le32 command; |
1177 | __le32 cid; | 1183 | __le32 cid; |
1178 | __le32 block; | 1184 | __le32 block; |
1179 | __le32 count; | 1185 | __le32 count; |
1180 | struct sgmap sg; // Must be last in struct because it is variable | 1186 | struct sgmap sg; // Must be last in struct because it is variable |
1181 | }; | 1187 | }; |
1182 | 1188 | ||
1183 | struct aac_read64 | 1189 | struct aac_read64 |
1184 | { | 1190 | { |
1185 | __le32 command; | 1191 | __le32 command; |
1186 | __le16 cid; | 1192 | __le16 cid; |
1187 | __le16 sector_count; | 1193 | __le16 sector_count; |
1188 | __le32 block; | 1194 | __le32 block; |
1189 | __le16 pad; | 1195 | __le16 pad; |
1190 | __le16 flags; | 1196 | __le16 flags; |
1191 | struct sgmap64 sg; // Must be last in struct because it is variable | 1197 | struct sgmap64 sg; // Must be last in struct because it is variable |
@@ -1193,26 +1199,26 @@ struct aac_read64 | |||
1193 | 1199 | ||
1194 | struct aac_read_reply | 1200 | struct aac_read_reply |
1195 | { | 1201 | { |
1196 | __le32 status; | 1202 | __le32 status; |
1197 | __le32 count; | 1203 | __le32 count; |
1198 | }; | 1204 | }; |
1199 | 1205 | ||
1200 | struct aac_write | 1206 | struct aac_write |
1201 | { | 1207 | { |
1202 | __le32 command; | 1208 | __le32 command; |
1203 | __le32 cid; | 1209 | __le32 cid; |
1204 | __le32 block; | 1210 | __le32 block; |
1205 | __le32 count; | 1211 | __le32 count; |
1206 | __le32 stable; // Not used | 1212 | __le32 stable; // Not used |
1207 | struct sgmap sg; // Must be last in struct because it is variable | 1213 | struct sgmap sg; // Must be last in struct because it is variable |
1208 | }; | 1214 | }; |
1209 | 1215 | ||
1210 | struct aac_write64 | 1216 | struct aac_write64 |
1211 | { | 1217 | { |
1212 | __le32 command; | 1218 | __le32 command; |
1213 | __le16 cid; | 1219 | __le16 cid; |
1214 | __le16 sector_count; | 1220 | __le16 sector_count; |
1215 | __le32 block; | 1221 | __le32 block; |
1216 | __le16 pad; | 1222 | __le16 pad; |
1217 | __le16 flags; | 1223 | __le16 flags; |
1218 | #define IO_TYPE_WRITE 0x00000000 | 1224 | #define IO_TYPE_WRITE 0x00000000 |
@@ -1223,7 +1229,7 @@ struct aac_write64 | |||
1223 | struct aac_write_reply | 1229 | struct aac_write_reply |
1224 | { | 1230 | { |
1225 | __le32 status; | 1231 | __le32 status; |
1226 | __le32 count; | 1232 | __le32 count; |
1227 | __le32 committed; | 1233 | __le32 committed; |
1228 | }; | 1234 | }; |
1229 | 1235 | ||
@@ -1326,10 +1332,10 @@ struct aac_srb_reply | |||
1326 | #define SRB_NoDataXfer 0x0000 | 1332 | #define SRB_NoDataXfer 0x0000 |
1327 | #define SRB_DisableDisconnect 0x0004 | 1333 | #define SRB_DisableDisconnect 0x0004 |
1328 | #define SRB_DisableSynchTransfer 0x0008 | 1334 | #define SRB_DisableSynchTransfer 0x0008 |
1329 | #define SRB_BypassFrozenQueue 0x0010 | 1335 | #define SRB_BypassFrozenQueue 0x0010 |
1330 | #define SRB_DisableAutosense 0x0020 | 1336 | #define SRB_DisableAutosense 0x0020 |
1331 | #define SRB_DataIn 0x0040 | 1337 | #define SRB_DataIn 0x0040 |
1332 | #define SRB_DataOut 0x0080 | 1338 | #define SRB_DataOut 0x0080 |
1333 | 1339 | ||
1334 | /* | 1340 | /* |
1335 | * SRB Functions - set in aac_srb->function | 1341 | * SRB Functions - set in aac_srb->function |
@@ -1352,7 +1358,7 @@ struct aac_srb_reply | |||
1352 | #define SRBF_RemoveDevice 0x0016 | 1358 | #define SRBF_RemoveDevice 0x0016 |
1353 | #define SRBF_DomainValidation 0x0017 | 1359 | #define SRBF_DomainValidation 0x0017 |
1354 | 1360 | ||
1355 | /* | 1361 | /* |
1356 | * SRB SCSI Status - set in aac_srb->scsi_status | 1362 | * SRB SCSI Status - set in aac_srb->scsi_status |
1357 | */ | 1363 | */ |
1358 | #define SRB_STATUS_PENDING 0x00 | 1364 | #define SRB_STATUS_PENDING 0x00 |
@@ -1511,17 +1517,17 @@ struct aac_get_container_count_resp { | |||
1511 | */ | 1517 | */ |
1512 | 1518 | ||
1513 | struct aac_mntent { | 1519 | struct aac_mntent { |
1514 | __le32 oid; | 1520 | __le32 oid; |
1515 | u8 name[16]; /* if applicable */ | 1521 | u8 name[16]; /* if applicable */ |
1516 | struct creation_info create_info; /* if applicable */ | 1522 | struct creation_info create_info; /* if applicable */ |
1517 | __le32 capacity; | 1523 | __le32 capacity; |
1518 | __le32 vol; /* substrate structure */ | 1524 | __le32 vol; /* substrate structure */ |
1519 | __le32 obj; /* FT_FILESYS, etc. */ | 1525 | __le32 obj; /* FT_FILESYS, etc. */ |
1520 | __le32 state; /* unready for mounting, | 1526 | __le32 state; /* unready for mounting, |
1521 | readonly, etc. */ | 1527 | readonly, etc. */ |
1522 | union aac_contentinfo fileinfo; /* Info specific to content | 1528 | union aac_contentinfo fileinfo; /* Info specific to content |
1523 | manager (eg, filesystem) */ | 1529 | manager (eg, filesystem) */ |
1524 | __le32 altoid; /* != oid <==> snapshot or | 1530 | __le32 altoid; /* != oid <==> snapshot or |
1525 | broken mirror exists */ | 1531 | broken mirror exists */ |
1526 | __le32 capacityhigh; | 1532 | __le32 capacityhigh; |
1527 | }; | 1533 | }; |
@@ -1538,7 +1544,7 @@ struct aac_query_mount { | |||
1538 | 1544 | ||
1539 | struct aac_mount { | 1545 | struct aac_mount { |
1540 | __le32 status; | 1546 | __le32 status; |
1541 | __le32 type; /* should be same as that requested */ | 1547 | __le32 type; /* should be same as that requested */ |
1542 | __le32 count; | 1548 | __le32 count; |
1543 | struct aac_mntent mnt[1]; | 1549 | struct aac_mntent mnt[1]; |
1544 | }; | 1550 | }; |
@@ -1608,7 +1614,7 @@ struct aac_delete_disk { | |||
1608 | u32 disknum; | 1614 | u32 disknum; |
1609 | u32 cnum; | 1615 | u32 cnum; |
1610 | }; | 1616 | }; |
1611 | 1617 | ||
1612 | struct fib_ioctl | 1618 | struct fib_ioctl |
1613 | { | 1619 | { |
1614 | u32 fibctx; | 1620 | u32 fibctx; |
@@ -1622,10 +1628,10 @@ struct revision | |||
1622 | __le32 version; | 1628 | __le32 version; |
1623 | __le32 build; | 1629 | __le32 build; |
1624 | }; | 1630 | }; |
1625 | 1631 | ||
1626 | 1632 | ||
1627 | /* | 1633 | /* |
1628 | * Ugly - non Linux like ioctl coding for back compat. | 1634 | * Ugly - non Linux like ioctl coding for back compat. |
1629 | */ | 1635 | */ |
1630 | 1636 | ||
1631 | #define CTL_CODE(function, method) ( \ | 1637 | #define CTL_CODE(function, method) ( \ |
@@ -1633,7 +1639,7 @@ struct revision | |||
1633 | ) | 1639 | ) |
1634 | 1640 | ||
1635 | /* | 1641 | /* |
1636 | * Define the method codes for how buffers are passed for I/O and FS | 1642 | * Define the method codes for how buffers are passed for I/O and FS |
1637 | * controls | 1643 | * controls |
1638 | */ | 1644 | */ |
1639 | 1645 | ||
@@ -1644,15 +1650,15 @@ struct revision | |||
1644 | * Filesystem ioctls | 1650 | * Filesystem ioctls |
1645 | */ | 1651 | */ |
1646 | 1652 | ||
1647 | #define FSACTL_SENDFIB CTL_CODE(2050, METHOD_BUFFERED) | 1653 | #define FSACTL_SENDFIB CTL_CODE(2050, METHOD_BUFFERED) |
1648 | #define FSACTL_SEND_RAW_SRB CTL_CODE(2067, METHOD_BUFFERED) | 1654 | #define FSACTL_SEND_RAW_SRB CTL_CODE(2067, METHOD_BUFFERED) |
1649 | #define FSACTL_DELETE_DISK 0x163 | 1655 | #define FSACTL_DELETE_DISK 0x163 |
1650 | #define FSACTL_QUERY_DISK 0x173 | 1656 | #define FSACTL_QUERY_DISK 0x173 |
1651 | #define FSACTL_OPEN_GET_ADAPTER_FIB CTL_CODE(2100, METHOD_BUFFERED) | 1657 | #define FSACTL_OPEN_GET_ADAPTER_FIB CTL_CODE(2100, METHOD_BUFFERED) |
1652 | #define FSACTL_GET_NEXT_ADAPTER_FIB CTL_CODE(2101, METHOD_BUFFERED) | 1658 | #define FSACTL_GET_NEXT_ADAPTER_FIB CTL_CODE(2101, METHOD_BUFFERED) |
1653 | #define FSACTL_CLOSE_GET_ADAPTER_FIB CTL_CODE(2102, METHOD_BUFFERED) | 1659 | #define FSACTL_CLOSE_GET_ADAPTER_FIB CTL_CODE(2102, METHOD_BUFFERED) |
1654 | #define FSACTL_MINIPORT_REV_CHECK CTL_CODE(2107, METHOD_BUFFERED) | 1660 | #define FSACTL_MINIPORT_REV_CHECK CTL_CODE(2107, METHOD_BUFFERED) |
1655 | #define FSACTL_GET_PCI_INFO CTL_CODE(2119, METHOD_BUFFERED) | 1661 | #define FSACTL_GET_PCI_INFO CTL_CODE(2119, METHOD_BUFFERED) |
1656 | #define FSACTL_FORCE_DELETE_DISK CTL_CODE(2120, METHOD_NEITHER) | 1662 | #define FSACTL_FORCE_DELETE_DISK CTL_CODE(2120, METHOD_NEITHER) |
1657 | #define FSACTL_GET_CONTAINERS 2131 | 1663 | #define FSACTL_GET_CONTAINERS 2131 |
1658 | #define FSACTL_SEND_LARGE_FIB CTL_CODE(2138, METHOD_BUFFERED) | 1664 | #define FSACTL_SEND_LARGE_FIB CTL_CODE(2138, METHOD_BUFFERED) |
@@ -1661,7 +1667,7 @@ struct revision | |||
1661 | struct aac_common | 1667 | struct aac_common |
1662 | { | 1668 | { |
1663 | /* | 1669 | /* |
1664 | * If this value is set to 1 then interrupt moderation will occur | 1670 | * If this value is set to 1 then interrupt moderation will occur |
1665 | * in the base commuication support. | 1671 | * in the base commuication support. |
1666 | */ | 1672 | */ |
1667 | u32 irq_mod; | 1673 | u32 irq_mod; |
@@ -1690,11 +1696,11 @@ extern struct aac_common aac_config; | |||
1690 | * The following macro is used when sending and receiving FIBs. It is | 1696 | * The following macro is used when sending and receiving FIBs. It is |
1691 | * only used for debugging. | 1697 | * only used for debugging. |
1692 | */ | 1698 | */ |
1693 | 1699 | ||
1694 | #ifdef DBG | 1700 | #ifdef DBG |
1695 | #define FIB_COUNTER_INCREMENT(counter) (counter)++ | 1701 | #define FIB_COUNTER_INCREMENT(counter) (counter)++ |
1696 | #else | 1702 | #else |
1697 | #define FIB_COUNTER_INCREMENT(counter) | 1703 | #define FIB_COUNTER_INCREMENT(counter) |
1698 | #endif | 1704 | #endif |
1699 | 1705 | ||
1700 | /* | 1706 | /* |
@@ -1726,17 +1732,17 @@ extern struct aac_common aac_config; | |||
1726 | * | 1732 | * |
1727 | * The adapter reports is present state through the phase. Only | 1733 | * The adapter reports is present state through the phase. Only |
1728 | * a single phase should be ever be set. Each phase can have multiple | 1734 | * a single phase should be ever be set. Each phase can have multiple |
1729 | * phase status bits to provide more detailed information about the | 1735 | * phase status bits to provide more detailed information about the |
1730 | * state of the board. Care should be taken to ensure that any phase | 1736 | * state of the board. Care should be taken to ensure that any phase |
1731 | * status bits that are set when changing the phase are also valid | 1737 | * status bits that are set when changing the phase are also valid |
1732 | * for the new phase or be cleared out. Adapter software (monitor, | 1738 | * for the new phase or be cleared out. Adapter software (monitor, |
1733 | * iflash, kernel) is responsible for properly maintining the phase | 1739 | * iflash, kernel) is responsible for properly maintining the phase |
1734 | * status mailbox when it is running. | 1740 | * status mailbox when it is running. |
1735 | * | ||
1736 | * MONKER_API Phases | ||
1737 | * | 1741 | * |
1738 | * Phases are bit oriented. It is NOT valid to have multiple bits set | 1742 | * MONKER_API Phases |
1739 | */ | 1743 | * |
1744 | * Phases are bit oriented. It is NOT valid to have multiple bits set | ||
1745 | */ | ||
1740 | 1746 | ||
1741 | #define SELF_TEST_FAILED 0x00000004 | 1747 | #define SELF_TEST_FAILED 0x00000004 |
1742 | #define MONITOR_PANIC 0x00000020 | 1748 | #define MONITOR_PANIC 0x00000020 |
@@ -1759,16 +1765,22 @@ extern struct aac_common aac_config; | |||
1759 | * For FIB communication, we need all of the following things | 1765 | * For FIB communication, we need all of the following things |
1760 | * to send back to the user. | 1766 | * to send back to the user. |
1761 | */ | 1767 | */ |
1762 | 1768 | ||
1763 | #define AifCmdEventNotify 1 /* Notify of event */ | 1769 | #define AifCmdEventNotify 1 /* Notify of event */ |
1764 | #define AifEnConfigChange 3 /* Adapter configuration change */ | 1770 | #define AifEnConfigChange 3 /* Adapter configuration change */ |
1765 | #define AifEnContainerChange 4 /* Container configuration change */ | 1771 | #define AifEnContainerChange 4 /* Container configuration change */ |
1766 | #define AifEnDeviceFailure 5 /* SCSI device failed */ | 1772 | #define AifEnDeviceFailure 5 /* SCSI device failed */ |
1773 | #define AifEnEnclosureManagement 13 /* EM_DRIVE_* */ | ||
1774 | #define EM_DRIVE_INSERTION 31 | ||
1775 | #define EM_DRIVE_REMOVAL 32 | ||
1776 | #define AifEnBatteryEvent 14 /* Change in Battery State */ | ||
1767 | #define AifEnAddContainer 15 /* A new array was created */ | 1777 | #define AifEnAddContainer 15 /* A new array was created */ |
1768 | #define AifEnDeleteContainer 16 /* A container was deleted */ | 1778 | #define AifEnDeleteContainer 16 /* A container was deleted */ |
1769 | #define AifEnExpEvent 23 /* Firmware Event Log */ | 1779 | #define AifEnExpEvent 23 /* Firmware Event Log */ |
1770 | #define AifExeFirmwarePanic 3 /* Firmware Event Panic */ | 1780 | #define AifExeFirmwarePanic 3 /* Firmware Event Panic */ |
1771 | #define AifHighPriority 3 /* Highest Priority Event */ | 1781 | #define AifHighPriority 3 /* Highest Priority Event */ |
1782 | #define AifEnAddJBOD 30 /* JBOD created */ | ||
1783 | #define AifEnDeleteJBOD 31 /* JBOD deleted */ | ||
1772 | 1784 | ||
1773 | #define AifCmdJobProgress 2 /* Progress report */ | 1785 | #define AifCmdJobProgress 2 /* Progress report */ |
1774 | #define AifJobCtrZero 101 /* Array Zero progress */ | 1786 | #define AifJobCtrZero 101 /* Array Zero progress */ |
@@ -1780,11 +1792,11 @@ extern struct aac_common aac_config; | |||
1780 | #define AifDenVolumeExtendComplete 201 /* A volume extend completed */ | 1792 | #define AifDenVolumeExtendComplete 201 /* A volume extend completed */ |
1781 | #define AifReqJobList 100 /* Gets back complete job list */ | 1793 | #define AifReqJobList 100 /* Gets back complete job list */ |
1782 | #define AifReqJobsForCtr 101 /* Gets back jobs for specific container */ | 1794 | #define AifReqJobsForCtr 101 /* Gets back jobs for specific container */ |
1783 | #define AifReqJobsForScsi 102 /* Gets back jobs for specific SCSI device */ | 1795 | #define AifReqJobsForScsi 102 /* Gets back jobs for specific SCSI device */ |
1784 | #define AifReqJobReport 103 /* Gets back a specific job report or list of them */ | 1796 | #define AifReqJobReport 103 /* Gets back a specific job report or list of them */ |
1785 | #define AifReqTerminateJob 104 /* Terminates job */ | 1797 | #define AifReqTerminateJob 104 /* Terminates job */ |
1786 | #define AifReqSuspendJob 105 /* Suspends a job */ | 1798 | #define AifReqSuspendJob 105 /* Suspends a job */ |
1787 | #define AifReqResumeJob 106 /* Resumes a job */ | 1799 | #define AifReqResumeJob 106 /* Resumes a job */ |
1788 | #define AifReqSendAPIReport 107 /* API generic report requests */ | 1800 | #define AifReqSendAPIReport 107 /* API generic report requests */ |
1789 | #define AifReqAPIJobStart 108 /* Start a job from the API */ | 1801 | #define AifReqAPIJobStart 108 /* Start a job from the API */ |
1790 | #define AifReqAPIJobUpdate 109 /* Update a job report from the API */ | 1802 | #define AifReqAPIJobUpdate 109 /* Update a job report from the API */ |
@@ -1803,8 +1815,8 @@ struct aac_aifcmd { | |||
1803 | }; | 1815 | }; |
1804 | 1816 | ||
1805 | /** | 1817 | /** |
1806 | * Convert capacity to cylinders | 1818 | * Convert capacity to cylinders |
1807 | * accounting for the fact capacity could be a 64 bit value | 1819 | * accounting for the fact capacity could be a 64 bit value |
1808 | * | 1820 | * |
1809 | */ | 1821 | */ |
1810 | static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor) | 1822 | static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor) |
@@ -1861,6 +1873,7 @@ int aac_probe_container(struct aac_dev *dev, int cid); | |||
1861 | int _aac_rx_init(struct aac_dev *dev); | 1873 | int _aac_rx_init(struct aac_dev *dev); |
1862 | int aac_rx_select_comm(struct aac_dev *dev, int comm); | 1874 | int aac_rx_select_comm(struct aac_dev *dev, int comm); |
1863 | int aac_rx_deliver_producer(struct fib * fib); | 1875 | int aac_rx_deliver_producer(struct fib * fib); |
1876 | char * get_container_type(unsigned type); | ||
1864 | extern int numacb; | 1877 | extern int numacb; |
1865 | extern int acbsize; | 1878 | extern int acbsize; |
1866 | extern char aac_driver_version[]; | 1879 | extern char aac_driver_version[]; |
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 1e6d7a9c75bf..851a7e599c50 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c | |||
@@ -48,13 +48,13 @@ | |||
48 | * ioctl_send_fib - send a FIB from userspace | 48 | * ioctl_send_fib - send a FIB from userspace |
49 | * @dev: adapter is being processed | 49 | * @dev: adapter is being processed |
50 | * @arg: arguments to the ioctl call | 50 | * @arg: arguments to the ioctl call |
51 | * | 51 | * |
52 | * This routine sends a fib to the adapter on behalf of a user level | 52 | * This routine sends a fib to the adapter on behalf of a user level |
53 | * program. | 53 | * program. |
54 | */ | 54 | */ |
55 | # define AAC_DEBUG_PREAMBLE KERN_INFO | 55 | # define AAC_DEBUG_PREAMBLE KERN_INFO |
56 | # define AAC_DEBUG_POSTAMBLE | 56 | # define AAC_DEBUG_POSTAMBLE |
57 | 57 | ||
58 | static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) | 58 | static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) |
59 | { | 59 | { |
60 | struct hw_fib * kfib; | 60 | struct hw_fib * kfib; |
@@ -71,7 +71,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) | |||
71 | if(fibptr == NULL) { | 71 | if(fibptr == NULL) { |
72 | return -ENOMEM; | 72 | return -ENOMEM; |
73 | } | 73 | } |
74 | 74 | ||
75 | kfib = fibptr->hw_fib_va; | 75 | kfib = fibptr->hw_fib_va; |
76 | /* | 76 | /* |
77 | * First copy in the header so that we can check the size field. | 77 | * First copy in the header so that we can check the size field. |
@@ -109,7 +109,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) | |||
109 | if (kfib->header.Command == cpu_to_le16(TakeABreakPt)) { | 109 | if (kfib->header.Command == cpu_to_le16(TakeABreakPt)) { |
110 | aac_adapter_interrupt(dev); | 110 | aac_adapter_interrupt(dev); |
111 | /* | 111 | /* |
112 | * Since we didn't really send a fib, zero out the state to allow | 112 | * Since we didn't really send a fib, zero out the state to allow |
113 | * cleanup code not to assert. | 113 | * cleanup code not to assert. |
114 | */ | 114 | */ |
115 | kfib->header.XferState = 0; | 115 | kfib->header.XferState = 0; |
@@ -169,7 +169,7 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg) | |||
169 | 169 | ||
170 | fibctx->type = FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT; | 170 | fibctx->type = FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT; |
171 | fibctx->size = sizeof(struct aac_fib_context); | 171 | fibctx->size = sizeof(struct aac_fib_context); |
172 | /* | 172 | /* |
173 | * Yes yes, I know this could be an index, but we have a | 173 | * Yes yes, I know this could be an index, but we have a |
174 | * better guarantee of uniqueness for the locked loop below. | 174 | * better guarantee of uniqueness for the locked loop below. |
175 | * Without the aid of a persistent history, this also helps | 175 | * Without the aid of a persistent history, this also helps |
@@ -189,7 +189,7 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg) | |||
189 | INIT_LIST_HEAD(&fibctx->fib_list); | 189 | INIT_LIST_HEAD(&fibctx->fib_list); |
190 | fibctx->jiffies = jiffies/HZ; | 190 | fibctx->jiffies = jiffies/HZ; |
191 | /* | 191 | /* |
192 | * Now add this context onto the adapter's | 192 | * Now add this context onto the adapter's |
193 | * AdapterFibContext list. | 193 | * AdapterFibContext list. |
194 | */ | 194 | */ |
195 | spin_lock_irqsave(&dev->fib_lock, flags); | 195 | spin_lock_irqsave(&dev->fib_lock, flags); |
@@ -207,12 +207,12 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg) | |||
207 | } | 207 | } |
208 | list_add_tail(&fibctx->next, &dev->fib_list); | 208 | list_add_tail(&fibctx->next, &dev->fib_list); |
209 | spin_unlock_irqrestore(&dev->fib_lock, flags); | 209 | spin_unlock_irqrestore(&dev->fib_lock, flags); |
210 | if (copy_to_user(arg, &fibctx->unique, | 210 | if (copy_to_user(arg, &fibctx->unique, |
211 | sizeof(fibctx->unique))) { | 211 | sizeof(fibctx->unique))) { |
212 | status = -EFAULT; | 212 | status = -EFAULT; |
213 | } else { | 213 | } else { |
214 | status = 0; | 214 | status = 0; |
215 | } | 215 | } |
216 | } | 216 | } |
217 | return status; | 217 | return status; |
218 | } | 218 | } |
@@ -221,8 +221,8 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg) | |||
221 | * next_getadapter_fib - get the next fib | 221 | * next_getadapter_fib - get the next fib |
222 | * @dev: adapter to use | 222 | * @dev: adapter to use |
223 | * @arg: ioctl argument | 223 | * @arg: ioctl argument |
224 | * | 224 | * |
225 | * This routine will get the next Fib, if available, from the AdapterFibContext | 225 | * This routine will get the next Fib, if available, from the AdapterFibContext |
226 | * passed in from the user. | 226 | * passed in from the user. |
227 | */ | 227 | */ |
228 | 228 | ||
@@ -234,7 +234,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg) | |||
234 | int status; | 234 | int status; |
235 | struct list_head * entry; | 235 | struct list_head * entry; |
236 | unsigned long flags; | 236 | unsigned long flags; |
237 | 237 | ||
238 | if(copy_from_user((void *)&f, arg, sizeof(struct fib_ioctl))) | 238 | if(copy_from_user((void *)&f, arg, sizeof(struct fib_ioctl))) |
239 | return -EFAULT; | 239 | return -EFAULT; |
240 | /* | 240 | /* |
@@ -243,6 +243,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg) | |||
243 | * Search the list of AdapterFibContext addresses on the adapter | 243 | * Search the list of AdapterFibContext addresses on the adapter |
244 | * to be sure this is a valid address | 244 | * to be sure this is a valid address |
245 | */ | 245 | */ |
246 | spin_lock_irqsave(&dev->fib_lock, flags); | ||
246 | entry = dev->fib_list.next; | 247 | entry = dev->fib_list.next; |
247 | fibctx = NULL; | 248 | fibctx = NULL; |
248 | 249 | ||
@@ -251,37 +252,37 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg) | |||
251 | /* | 252 | /* |
252 | * Extract the AdapterFibContext from the Input parameters. | 253 | * Extract the AdapterFibContext from the Input parameters. |
253 | */ | 254 | */ |
254 | if (fibctx->unique == f.fibctx) { /* We found a winner */ | 255 | if (fibctx->unique == f.fibctx) { /* We found a winner */ |
255 | break; | 256 | break; |
256 | } | 257 | } |
257 | entry = entry->next; | 258 | entry = entry->next; |
258 | fibctx = NULL; | 259 | fibctx = NULL; |
259 | } | 260 | } |
260 | if (!fibctx) { | 261 | if (!fibctx) { |
262 | spin_unlock_irqrestore(&dev->fib_lock, flags); | ||
261 | dprintk ((KERN_INFO "Fib Context not found\n")); | 263 | dprintk ((KERN_INFO "Fib Context not found\n")); |
262 | return -EINVAL; | 264 | return -EINVAL; |
263 | } | 265 | } |
264 | 266 | ||
265 | if((fibctx->type != FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT) || | 267 | if((fibctx->type != FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT) || |
266 | (fibctx->size != sizeof(struct aac_fib_context))) { | 268 | (fibctx->size != sizeof(struct aac_fib_context))) { |
269 | spin_unlock_irqrestore(&dev->fib_lock, flags); | ||
267 | dprintk ((KERN_INFO "Fib Context corrupt?\n")); | 270 | dprintk ((KERN_INFO "Fib Context corrupt?\n")); |
268 | return -EINVAL; | 271 | return -EINVAL; |
269 | } | 272 | } |
270 | status = 0; | 273 | status = 0; |
271 | spin_lock_irqsave(&dev->fib_lock, flags); | ||
272 | /* | 274 | /* |
273 | * If there are no fibs to send back, then either wait or return | 275 | * If there are no fibs to send back, then either wait or return |
274 | * -EAGAIN | 276 | * -EAGAIN |
275 | */ | 277 | */ |
276 | return_fib: | 278 | return_fib: |
277 | if (!list_empty(&fibctx->fib_list)) { | 279 | if (!list_empty(&fibctx->fib_list)) { |
278 | struct list_head * entry; | ||
279 | /* | 280 | /* |
280 | * Pull the next fib from the fibs | 281 | * Pull the next fib from the fibs |
281 | */ | 282 | */ |
282 | entry = fibctx->fib_list.next; | 283 | entry = fibctx->fib_list.next; |
283 | list_del(entry); | 284 | list_del(entry); |
284 | 285 | ||
285 | fib = list_entry(entry, struct fib, fiblink); | 286 | fib = list_entry(entry, struct fib, fiblink); |
286 | fibctx->count--; | 287 | fibctx->count--; |
287 | spin_unlock_irqrestore(&dev->fib_lock, flags); | 288 | spin_unlock_irqrestore(&dev->fib_lock, flags); |
@@ -289,7 +290,7 @@ return_fib: | |||
289 | kfree(fib->hw_fib_va); | 290 | kfree(fib->hw_fib_va); |
290 | kfree(fib); | 291 | kfree(fib); |
291 | return -EFAULT; | 292 | return -EFAULT; |
292 | } | 293 | } |
293 | /* | 294 | /* |
294 | * Free the space occupied by this copy of the fib. | 295 | * Free the space occupied by this copy of the fib. |
295 | */ | 296 | */ |
@@ -318,7 +319,7 @@ return_fib: | |||
318 | } | 319 | } |
319 | } else { | 320 | } else { |
320 | status = -EAGAIN; | 321 | status = -EAGAIN; |
321 | } | 322 | } |
322 | } | 323 | } |
323 | fibctx->jiffies = jiffies/HZ; | 324 | fibctx->jiffies = jiffies/HZ; |
324 | return status; | 325 | return status; |
@@ -327,7 +328,9 @@ return_fib: | |||
327 | int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx) | 328 | int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx) |
328 | { | 329 | { |
329 | struct fib *fib; | 330 | struct fib *fib; |
331 | unsigned long flags; | ||
330 | 332 | ||
333 | spin_lock_irqsave(&dev->fib_lock, flags); | ||
331 | /* | 334 | /* |
332 | * First free any FIBs that have not been consumed. | 335 | * First free any FIBs that have not been consumed. |
333 | */ | 336 | */ |
@@ -350,6 +353,7 @@ int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx) | |||
350 | * Remove the Context from the AdapterFibContext List | 353 | * Remove the Context from the AdapterFibContext List |
351 | */ | 354 | */ |
352 | list_del(&fibctx->next); | 355 | list_del(&fibctx->next); |
356 | spin_unlock_irqrestore(&dev->fib_lock, flags); | ||
353 | /* | 357 | /* |
354 | * Invalidate context | 358 | * Invalidate context |
355 | */ | 359 | */ |
@@ -368,7 +372,7 @@ int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx) | |||
368 | * | 372 | * |
369 | * This routine will close down the fibctx passed in from the user. | 373 | * This routine will close down the fibctx passed in from the user. |
370 | */ | 374 | */ |
371 | 375 | ||
372 | static int close_getadapter_fib(struct aac_dev * dev, void __user *arg) | 376 | static int close_getadapter_fib(struct aac_dev * dev, void __user *arg) |
373 | { | 377 | { |
374 | struct aac_fib_context *fibctx; | 378 | struct aac_fib_context *fibctx; |
@@ -415,8 +419,8 @@ static int close_getadapter_fib(struct aac_dev * dev, void __user *arg) | |||
415 | * @arg: ioctl arguments | 419 | * @arg: ioctl arguments |
416 | * | 420 | * |
417 | * This routine returns the driver version. | 421 | * This routine returns the driver version. |
418 | * Under Linux, there have been no version incompatibilities, so this is | 422 | * Under Linux, there have been no version incompatibilities, so this is |
419 | * simple! | 423 | * simple! |
420 | */ | 424 | */ |
421 | 425 | ||
422 | static int check_revision(struct aac_dev *dev, void __user *arg) | 426 | static int check_revision(struct aac_dev *dev, void __user *arg) |
@@ -426,12 +430,12 @@ static int check_revision(struct aac_dev *dev, void __user *arg) | |||
426 | u32 version; | 430 | u32 version; |
427 | 431 | ||
428 | response.compat = 1; | 432 | response.compat = 1; |
429 | version = (simple_strtol(driver_version, | 433 | version = (simple_strtol(driver_version, |
430 | &driver_version, 10) << 24) | 0x00000400; | 434 | &driver_version, 10) << 24) | 0x00000400; |
431 | version += simple_strtol(driver_version + 1, &driver_version, 10) << 16; | 435 | version += simple_strtol(driver_version + 1, &driver_version, 10) << 16; |
432 | version += simple_strtol(driver_version + 1, NULL, 10); | 436 | version += simple_strtol(driver_version + 1, NULL, 10); |
433 | response.version = cpu_to_le32(version); | 437 | response.version = cpu_to_le32(version); |
434 | # if (defined(AAC_DRIVER_BUILD)) | 438 | # ifdef AAC_DRIVER_BUILD |
435 | response.build = cpu_to_le32(AAC_DRIVER_BUILD); | 439 | response.build = cpu_to_le32(AAC_DRIVER_BUILD); |
436 | # else | 440 | # else |
437 | response.build = cpu_to_le32(9999); | 441 | response.build = cpu_to_le32(9999); |
@@ -464,7 +468,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
464 | u32 data_dir; | 468 | u32 data_dir; |
465 | void __user *sg_user[32]; | 469 | void __user *sg_user[32]; |
466 | void *sg_list[32]; | 470 | void *sg_list[32]; |
467 | u32 sg_indx = 0; | 471 | u32 sg_indx = 0; |
468 | u32 byte_count = 0; | 472 | u32 byte_count = 0; |
469 | u32 actual_fibsize64, actual_fibsize = 0; | 473 | u32 actual_fibsize64, actual_fibsize = 0; |
470 | int i; | 474 | int i; |
@@ -475,7 +479,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
475 | return -EBUSY; | 479 | return -EBUSY; |
476 | } | 480 | } |
477 | if (!capable(CAP_SYS_ADMIN)){ | 481 | if (!capable(CAP_SYS_ADMIN)){ |
478 | dprintk((KERN_DEBUG"aacraid: No permission to send raw srb\n")); | 482 | dprintk((KERN_DEBUG"aacraid: No permission to send raw srb\n")); |
479 | return -EPERM; | 483 | return -EPERM; |
480 | } | 484 | } |
481 | /* | 485 | /* |
@@ -490,7 +494,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
490 | 494 | ||
491 | memset(sg_list, 0, sizeof(sg_list)); /* cleanup may take issue */ | 495 | memset(sg_list, 0, sizeof(sg_list)); /* cleanup may take issue */ |
492 | if(copy_from_user(&fibsize, &user_srb->count,sizeof(u32))){ | 496 | if(copy_from_user(&fibsize, &user_srb->count,sizeof(u32))){ |
493 | dprintk((KERN_DEBUG"aacraid: Could not copy data size from user\n")); | 497 | dprintk((KERN_DEBUG"aacraid: Could not copy data size from user\n")); |
494 | rcode = -EFAULT; | 498 | rcode = -EFAULT; |
495 | goto cleanup; | 499 | goto cleanup; |
496 | } | 500 | } |
@@ -507,7 +511,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
507 | goto cleanup; | 511 | goto cleanup; |
508 | } | 512 | } |
509 | if(copy_from_user(user_srbcmd, user_srb,fibsize)){ | 513 | if(copy_from_user(user_srbcmd, user_srb,fibsize)){ |
510 | dprintk((KERN_DEBUG"aacraid: Could not copy srb from user\n")); | 514 | dprintk((KERN_DEBUG"aacraid: Could not copy srb from user\n")); |
511 | rcode = -EFAULT; | 515 | rcode = -EFAULT; |
512 | goto cleanup; | 516 | goto cleanup; |
513 | } | 517 | } |
@@ -518,15 +522,15 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
518 | // Fix up srb for endian and force some values | 522 | // Fix up srb for endian and force some values |
519 | 523 | ||
520 | srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); // Force this | 524 | srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); // Force this |
521 | srbcmd->channel = cpu_to_le32(user_srbcmd->channel); | 525 | srbcmd->channel = cpu_to_le32(user_srbcmd->channel); |
522 | srbcmd->id = cpu_to_le32(user_srbcmd->id); | 526 | srbcmd->id = cpu_to_le32(user_srbcmd->id); |
523 | srbcmd->lun = cpu_to_le32(user_srbcmd->lun); | 527 | srbcmd->lun = cpu_to_le32(user_srbcmd->lun); |
524 | srbcmd->timeout = cpu_to_le32(user_srbcmd->timeout); | 528 | srbcmd->timeout = cpu_to_le32(user_srbcmd->timeout); |
525 | srbcmd->flags = cpu_to_le32(flags); | 529 | srbcmd->flags = cpu_to_le32(flags); |
526 | srbcmd->retry_limit = 0; // Obsolete parameter | 530 | srbcmd->retry_limit = 0; // Obsolete parameter |
527 | srbcmd->cdb_size = cpu_to_le32(user_srbcmd->cdb_size); | 531 | srbcmd->cdb_size = cpu_to_le32(user_srbcmd->cdb_size); |
528 | memcpy(srbcmd->cdb, user_srbcmd->cdb, sizeof(srbcmd->cdb)); | 532 | memcpy(srbcmd->cdb, user_srbcmd->cdb, sizeof(srbcmd->cdb)); |
529 | 533 | ||
530 | switch (flags & (SRB_DataIn | SRB_DataOut)) { | 534 | switch (flags & (SRB_DataIn | SRB_DataOut)) { |
531 | case SRB_DataOut: | 535 | case SRB_DataOut: |
532 | data_dir = DMA_TO_DEVICE; | 536 | data_dir = DMA_TO_DEVICE; |
@@ -582,7 +586,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
582 | void* p; | 586 | void* p; |
583 | /* Does this really need to be GFP_DMA? */ | 587 | /* Does this really need to be GFP_DMA? */ |
584 | p = kmalloc(upsg->sg[i].count,GFP_KERNEL|__GFP_DMA); | 588 | p = kmalloc(upsg->sg[i].count,GFP_KERNEL|__GFP_DMA); |
585 | if(p == 0) { | 589 | if(!p) { |
586 | dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n", | 590 | dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n", |
587 | upsg->sg[i].count,i,upsg->count)); | 591 | upsg->sg[i].count,i,upsg->count)); |
588 | rcode = -ENOMEM; | 592 | rcode = -ENOMEM; |
@@ -594,7 +598,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
594 | sg_list[i] = p; // save so we can clean up later | 598 | sg_list[i] = p; // save so we can clean up later |
595 | sg_indx = i; | 599 | sg_indx = i; |
596 | 600 | ||
597 | if( flags & SRB_DataOut ){ | 601 | if (flags & SRB_DataOut) { |
598 | if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){ | 602 | if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){ |
599 | dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); | 603 | dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); |
600 | rcode = -EFAULT; | 604 | rcode = -EFAULT; |
@@ -626,7 +630,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
626 | void* p; | 630 | void* p; |
627 | /* Does this really need to be GFP_DMA? */ | 631 | /* Does this really need to be GFP_DMA? */ |
628 | p = kmalloc(usg->sg[i].count,GFP_KERNEL|__GFP_DMA); | 632 | p = kmalloc(usg->sg[i].count,GFP_KERNEL|__GFP_DMA); |
629 | if(p == 0) { | 633 | if(!p) { |
630 | kfree (usg); | 634 | kfree (usg); |
631 | dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n", | 635 | dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n", |
632 | usg->sg[i].count,i,usg->count)); | 636 | usg->sg[i].count,i,usg->count)); |
@@ -637,7 +641,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
637 | sg_list[i] = p; // save so we can clean up later | 641 | sg_list[i] = p; // save so we can clean up later |
638 | sg_indx = i; | 642 | sg_indx = i; |
639 | 643 | ||
640 | if( flags & SRB_DataOut ){ | 644 | if (flags & SRB_DataOut) { |
641 | if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){ | 645 | if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){ |
642 | kfree (usg); | 646 | kfree (usg); |
643 | dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); | 647 | dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); |
@@ -668,7 +672,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
668 | void* p; | 672 | void* p; |
669 | /* Does this really need to be GFP_DMA? */ | 673 | /* Does this really need to be GFP_DMA? */ |
670 | p = kmalloc(usg->sg[i].count,GFP_KERNEL|__GFP_DMA); | 674 | p = kmalloc(usg->sg[i].count,GFP_KERNEL|__GFP_DMA); |
671 | if(p == 0) { | 675 | if(!p) { |
672 | dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n", | 676 | dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n", |
673 | usg->sg[i].count,i,usg->count)); | 677 | usg->sg[i].count,i,usg->count)); |
674 | rcode = -ENOMEM; | 678 | rcode = -ENOMEM; |
@@ -680,7 +684,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
680 | sg_list[i] = p; // save so we can clean up later | 684 | sg_list[i] = p; // save so we can clean up later |
681 | sg_indx = i; | 685 | sg_indx = i; |
682 | 686 | ||
683 | if( flags & SRB_DataOut ){ | 687 | if (flags & SRB_DataOut) { |
684 | if(copy_from_user(p,sg_user[i],usg->sg[i].count)){ | 688 | if(copy_from_user(p,sg_user[i],usg->sg[i].count)){ |
685 | dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); | 689 | dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); |
686 | rcode = -EFAULT; | 690 | rcode = -EFAULT; |
@@ -698,7 +702,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
698 | dma_addr_t addr; | 702 | dma_addr_t addr; |
699 | void* p; | 703 | void* p; |
700 | p = kmalloc(upsg->sg[i].count, GFP_KERNEL); | 704 | p = kmalloc(upsg->sg[i].count, GFP_KERNEL); |
701 | if(p == 0) { | 705 | if (!p) { |
702 | dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n", | 706 | dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n", |
703 | upsg->sg[i].count, i, upsg->count)); | 707 | upsg->sg[i].count, i, upsg->count)); |
704 | rcode = -ENOMEM; | 708 | rcode = -ENOMEM; |
@@ -708,7 +712,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
708 | sg_list[i] = p; // save so we can clean up later | 712 | sg_list[i] = p; // save so we can clean up later |
709 | sg_indx = i; | 713 | sg_indx = i; |
710 | 714 | ||
711 | if( flags & SRB_DataOut ){ | 715 | if (flags & SRB_DataOut) { |
712 | if(copy_from_user(p, sg_user[i], | 716 | if(copy_from_user(p, sg_user[i], |
713 | upsg->sg[i].count)) { | 717 | upsg->sg[i].count)) { |
714 | dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); | 718 | dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n")); |
@@ -734,19 +738,19 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
734 | } | 738 | } |
735 | 739 | ||
736 | if (status != 0){ | 740 | if (status != 0){ |
737 | dprintk((KERN_DEBUG"aacraid: Could not send raw srb fib to hba\n")); | 741 | dprintk((KERN_DEBUG"aacraid: Could not send raw srb fib to hba\n")); |
738 | rcode = -ENXIO; | 742 | rcode = -ENXIO; |
739 | goto cleanup; | 743 | goto cleanup; |
740 | } | 744 | } |
741 | 745 | ||
742 | if( flags & SRB_DataIn ) { | 746 | if (flags & SRB_DataIn) { |
743 | for(i = 0 ; i <= sg_indx; i++){ | 747 | for(i = 0 ; i <= sg_indx; i++){ |
744 | byte_count = le32_to_cpu( | 748 | byte_count = le32_to_cpu( |
745 | (dev->adapter_info.options & AAC_OPT_SGMAP_HOST64) | 749 | (dev->adapter_info.options & AAC_OPT_SGMAP_HOST64) |
746 | ? ((struct sgmap64*)&srbcmd->sg)->sg[i].count | 750 | ? ((struct sgmap64*)&srbcmd->sg)->sg[i].count |
747 | : srbcmd->sg.sg[i].count); | 751 | : srbcmd->sg.sg[i].count); |
748 | if(copy_to_user(sg_user[i], sg_list[i], byte_count)){ | 752 | if(copy_to_user(sg_user[i], sg_list[i], byte_count)){ |
749 | dprintk((KERN_DEBUG"aacraid: Could not copy sg data to user\n")); | 753 | dprintk((KERN_DEBUG"aacraid: Could not copy sg data to user\n")); |
750 | rcode = -EFAULT; | 754 | rcode = -EFAULT; |
751 | goto cleanup; | 755 | goto cleanup; |
752 | 756 | ||
@@ -756,7 +760,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
756 | 760 | ||
757 | reply = (struct aac_srb_reply *) fib_data(srbfib); | 761 | reply = (struct aac_srb_reply *) fib_data(srbfib); |
758 | if(copy_to_user(user_reply,reply,sizeof(struct aac_srb_reply))){ | 762 | if(copy_to_user(user_reply,reply,sizeof(struct aac_srb_reply))){ |
759 | dprintk((KERN_DEBUG"aacraid: Could not copy reply to user\n")); | 763 | dprintk((KERN_DEBUG"aacraid: Could not copy reply to user\n")); |
760 | rcode = -EFAULT; | 764 | rcode = -EFAULT; |
761 | goto cleanup; | 765 | goto cleanup; |
762 | } | 766 | } |
@@ -775,34 +779,34 @@ cleanup: | |||
775 | } | 779 | } |
776 | 780 | ||
777 | struct aac_pci_info { | 781 | struct aac_pci_info { |
778 | u32 bus; | 782 | u32 bus; |
779 | u32 slot; | 783 | u32 slot; |
780 | }; | 784 | }; |
781 | 785 | ||
782 | 786 | ||
783 | static int aac_get_pci_info(struct aac_dev* dev, void __user *arg) | 787 | static int aac_get_pci_info(struct aac_dev* dev, void __user *arg) |
784 | { | 788 | { |
785 | struct aac_pci_info pci_info; | 789 | struct aac_pci_info pci_info; |
786 | 790 | ||
787 | pci_info.bus = dev->pdev->bus->number; | 791 | pci_info.bus = dev->pdev->bus->number; |
788 | pci_info.slot = PCI_SLOT(dev->pdev->devfn); | 792 | pci_info.slot = PCI_SLOT(dev->pdev->devfn); |
789 | 793 | ||
790 | if (copy_to_user(arg, &pci_info, sizeof(struct aac_pci_info))) { | 794 | if (copy_to_user(arg, &pci_info, sizeof(struct aac_pci_info))) { |
791 | dprintk((KERN_DEBUG "aacraid: Could not copy pci info\n")); | 795 | dprintk((KERN_DEBUG "aacraid: Could not copy pci info\n")); |
792 | return -EFAULT; | 796 | return -EFAULT; |
793 | } | 797 | } |
794 | return 0; | 798 | return 0; |
795 | } | 799 | } |
796 | 800 | ||
797 | 801 | ||
798 | int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg) | 802 | int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg) |
799 | { | 803 | { |
800 | int status; | 804 | int status; |
801 | 805 | ||
802 | /* | 806 | /* |
803 | * HBA gets first crack | 807 | * HBA gets first crack |
804 | */ | 808 | */ |
805 | 809 | ||
806 | status = aac_dev_ioctl(dev, cmd, arg); | 810 | status = aac_dev_ioctl(dev, cmd, arg); |
807 | if(status != -ENOTTY) | 811 | if(status != -ENOTTY) |
808 | return status; | 812 | return status; |
@@ -832,7 +836,7 @@ int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg) | |||
832 | break; | 836 | break; |
833 | default: | 837 | default: |
834 | status = -ENOTTY; | 838 | status = -ENOTTY; |
835 | break; | 839 | break; |
836 | } | 840 | } |
837 | return status; | 841 | return status; |
838 | } | 842 | } |
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 8736813a0296..89cc8b7b42a2 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c | |||
@@ -301,10 +301,10 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev) | |||
301 | if ((!aac_adapter_sync_cmd(dev, GET_ADAPTER_PROPERTIES, | 301 | if ((!aac_adapter_sync_cmd(dev, GET_ADAPTER_PROPERTIES, |
302 | 0, 0, 0, 0, 0, 0, status+0, status+1, status+2, NULL, NULL)) && | 302 | 0, 0, 0, 0, 0, 0, status+0, status+1, status+2, NULL, NULL)) && |
303 | (status[0] == 0x00000001)) { | 303 | (status[0] == 0x00000001)) { |
304 | if (status[1] & AAC_OPT_NEW_COMM_64) | 304 | if (status[1] & le32_to_cpu(AAC_OPT_NEW_COMM_64)) |
305 | dev->raw_io_64 = 1; | 305 | dev->raw_io_64 = 1; |
306 | if (dev->a_ops.adapter_comm && | 306 | if (dev->a_ops.adapter_comm && |
307 | (status[1] & AAC_OPT_NEW_COMM)) | 307 | (status[1] & le32_to_cpu(AAC_OPT_NEW_COMM))) |
308 | dev->comm_interface = AAC_COMM_MESSAGE; | 308 | dev->comm_interface = AAC_COMM_MESSAGE; |
309 | if ((dev->comm_interface == AAC_COMM_MESSAGE) && | 309 | if ((dev->comm_interface == AAC_COMM_MESSAGE) && |
310 | (status[2] > dev->base_size)) { | 310 | (status[2] > dev->base_size)) { |
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index abce48ccc85b..81b36923e0ef 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c | |||
@@ -56,7 +56,7 @@ | |||
56 | * Allocate and map the shared PCI space for the FIB blocks used to | 56 | * Allocate and map the shared PCI space for the FIB blocks used to |
57 | * talk to the Adaptec firmware. | 57 | * talk to the Adaptec firmware. |
58 | */ | 58 | */ |
59 | 59 | ||
60 | static int fib_map_alloc(struct aac_dev *dev) | 60 | static int fib_map_alloc(struct aac_dev *dev) |
61 | { | 61 | { |
62 | dprintk((KERN_INFO | 62 | dprintk((KERN_INFO |
@@ -109,14 +109,16 @@ int aac_fib_setup(struct aac_dev * dev) | |||
109 | } | 109 | } |
110 | if (i<0) | 110 | if (i<0) |
111 | return -ENOMEM; | 111 | return -ENOMEM; |
112 | 112 | ||
113 | hw_fib = dev->hw_fib_va; | 113 | hw_fib = dev->hw_fib_va; |
114 | hw_fib_pa = dev->hw_fib_pa; | 114 | hw_fib_pa = dev->hw_fib_pa; |
115 | memset(hw_fib, 0, dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB)); | 115 | memset(hw_fib, 0, dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB)); |
116 | /* | 116 | /* |
117 | * Initialise the fibs | 117 | * Initialise the fibs |
118 | */ | 118 | */ |
119 | for (i = 0, fibptr = &dev->fibs[i]; i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); i++, fibptr++) | 119 | for (i = 0, fibptr = &dev->fibs[i]; |
120 | i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); | ||
121 | i++, fibptr++) | ||
120 | { | 122 | { |
121 | fibptr->dev = dev; | 123 | fibptr->dev = dev; |
122 | fibptr->hw_fib_va = hw_fib; | 124 | fibptr->hw_fib_va = hw_fib; |
@@ -148,13 +150,13 @@ int aac_fib_setup(struct aac_dev * dev) | |||
148 | * Allocate a fib from the adapter fib pool. If the pool is empty we | 150 | * Allocate a fib from the adapter fib pool. If the pool is empty we |
149 | * return NULL. | 151 | * return NULL. |
150 | */ | 152 | */ |
151 | 153 | ||
152 | struct fib *aac_fib_alloc(struct aac_dev *dev) | 154 | struct fib *aac_fib_alloc(struct aac_dev *dev) |
153 | { | 155 | { |
154 | struct fib * fibptr; | 156 | struct fib * fibptr; |
155 | unsigned long flags; | 157 | unsigned long flags; |
156 | spin_lock_irqsave(&dev->fib_lock, flags); | 158 | spin_lock_irqsave(&dev->fib_lock, flags); |
157 | fibptr = dev->free_fib; | 159 | fibptr = dev->free_fib; |
158 | if(!fibptr){ | 160 | if(!fibptr){ |
159 | spin_unlock_irqrestore(&dev->fib_lock, flags); | 161 | spin_unlock_irqrestore(&dev->fib_lock, flags); |
160 | return fibptr; | 162 | return fibptr; |
@@ -171,6 +173,7 @@ struct fib *aac_fib_alloc(struct aac_dev *dev) | |||
171 | * each I/O | 173 | * each I/O |
172 | */ | 174 | */ |
173 | fibptr->hw_fib_va->header.XferState = 0; | 175 | fibptr->hw_fib_va->header.XferState = 0; |
176 | fibptr->flags = 0; | ||
174 | fibptr->callback = NULL; | 177 | fibptr->callback = NULL; |
175 | fibptr->callback_data = NULL; | 178 | fibptr->callback_data = NULL; |
176 | 179 | ||
@@ -183,7 +186,7 @@ struct fib *aac_fib_alloc(struct aac_dev *dev) | |||
183 | * | 186 | * |
184 | * Frees up a fib and places it on the appropriate queue | 187 | * Frees up a fib and places it on the appropriate queue |
185 | */ | 188 | */ |
186 | 189 | ||
187 | void aac_fib_free(struct fib *fibptr) | 190 | void aac_fib_free(struct fib *fibptr) |
188 | { | 191 | { |
189 | unsigned long flags; | 192 | unsigned long flags; |
@@ -204,10 +207,10 @@ void aac_fib_free(struct fib *fibptr) | |||
204 | /** | 207 | /** |
205 | * aac_fib_init - initialise a fib | 208 | * aac_fib_init - initialise a fib |
206 | * @fibptr: The fib to initialize | 209 | * @fibptr: The fib to initialize |
207 | * | 210 | * |
208 | * Set up the generic fib fields ready for use | 211 | * Set up the generic fib fields ready for use |
209 | */ | 212 | */ |
210 | 213 | ||
211 | void aac_fib_init(struct fib *fibptr) | 214 | void aac_fib_init(struct fib *fibptr) |
212 | { | 215 | { |
213 | struct hw_fib *hw_fib = fibptr->hw_fib_va; | 216 | struct hw_fib *hw_fib = fibptr->hw_fib_va; |
@@ -227,12 +230,12 @@ void aac_fib_init(struct fib *fibptr) | |||
227 | * Will deallocate and return to the free pool the FIB pointed to by the | 230 | * Will deallocate and return to the free pool the FIB pointed to by the |
228 | * caller. | 231 | * caller. |
229 | */ | 232 | */ |
230 | 233 | ||
231 | static void fib_dealloc(struct fib * fibptr) | 234 | static void fib_dealloc(struct fib * fibptr) |
232 | { | 235 | { |
233 | struct hw_fib *hw_fib = fibptr->hw_fib_va; | 236 | struct hw_fib *hw_fib = fibptr->hw_fib_va; |
234 | BUG_ON(hw_fib->header.StructType != FIB_MAGIC); | 237 | BUG_ON(hw_fib->header.StructType != FIB_MAGIC); |
235 | hw_fib->header.XferState = 0; | 238 | hw_fib->header.XferState = 0; |
236 | } | 239 | } |
237 | 240 | ||
238 | /* | 241 | /* |
@@ -241,7 +244,7 @@ static void fib_dealloc(struct fib * fibptr) | |||
241 | * these routines and are the only routines which have a knowledge of the | 244 | * these routines and are the only routines which have a knowledge of the |
242 | * how these queues are implemented. | 245 | * how these queues are implemented. |
243 | */ | 246 | */ |
244 | 247 | ||
245 | /** | 248 | /** |
246 | * aac_get_entry - get a queue entry | 249 | * aac_get_entry - get a queue entry |
247 | * @dev: Adapter | 250 | * @dev: Adapter |
@@ -254,7 +257,7 @@ static void fib_dealloc(struct fib * fibptr) | |||
254 | * is full(no free entries) than no entry is returned and the function returns 0 otherwise 1 is | 257 | * is full(no free entries) than no entry is returned and the function returns 0 otherwise 1 is |
255 | * returned. | 258 | * returned. |
256 | */ | 259 | */ |
257 | 260 | ||
258 | static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entry, u32 * index, unsigned long *nonotify) | 261 | static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entry, u32 * index, unsigned long *nonotify) |
259 | { | 262 | { |
260 | struct aac_queue * q; | 263 | struct aac_queue * q; |
@@ -279,26 +282,27 @@ static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entr | |||
279 | idx = ADAP_NORM_RESP_ENTRIES; | 282 | idx = ADAP_NORM_RESP_ENTRIES; |
280 | } | 283 | } |
281 | if (idx != le32_to_cpu(*(q->headers.consumer))) | 284 | if (idx != le32_to_cpu(*(q->headers.consumer))) |
282 | *nonotify = 1; | 285 | *nonotify = 1; |
283 | } | 286 | } |
284 | 287 | ||
285 | if (qid == AdapNormCmdQueue) { | 288 | if (qid == AdapNormCmdQueue) { |
286 | if (*index >= ADAP_NORM_CMD_ENTRIES) | 289 | if (*index >= ADAP_NORM_CMD_ENTRIES) |
287 | *index = 0; /* Wrap to front of the Producer Queue. */ | 290 | *index = 0; /* Wrap to front of the Producer Queue. */ |
288 | } else { | 291 | } else { |
289 | if (*index >= ADAP_NORM_RESP_ENTRIES) | 292 | if (*index >= ADAP_NORM_RESP_ENTRIES) |
290 | *index = 0; /* Wrap to front of the Producer Queue. */ | 293 | *index = 0; /* Wrap to front of the Producer Queue. */ |
291 | } | 294 | } |
292 | 295 | ||
293 | if ((*index + 1) == le32_to_cpu(*(q->headers.consumer))) { /* Queue is full */ | 296 | /* Queue is full */ |
297 | if ((*index + 1) == le32_to_cpu(*(q->headers.consumer))) { | ||
294 | printk(KERN_WARNING "Queue %d full, %u outstanding.\n", | 298 | printk(KERN_WARNING "Queue %d full, %u outstanding.\n", |
295 | qid, q->numpending); | 299 | qid, q->numpending); |
296 | return 0; | 300 | return 0; |
297 | } else { | 301 | } else { |
298 | *entry = q->base + *index; | 302 | *entry = q->base + *index; |
299 | return 1; | 303 | return 1; |
300 | } | 304 | } |
301 | } | 305 | } |
302 | 306 | ||
303 | /** | 307 | /** |
304 | * aac_queue_get - get the next free QE | 308 | * aac_queue_get - get the next free QE |
@@ -320,31 +324,29 @@ int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw | |||
320 | { | 324 | { |
321 | struct aac_entry * entry = NULL; | 325 | struct aac_entry * entry = NULL; |
322 | int map = 0; | 326 | int map = 0; |
323 | 327 | ||
324 | if (qid == AdapNormCmdQueue) { | 328 | if (qid == AdapNormCmdQueue) { |
325 | /* if no entries wait for some if caller wants to */ | 329 | /* if no entries wait for some if caller wants to */ |
326 | while (!aac_get_entry(dev, qid, &entry, index, nonotify)) | 330 | while (!aac_get_entry(dev, qid, &entry, index, nonotify)) { |
327 | { | ||
328 | printk(KERN_ERR "GetEntries failed\n"); | 331 | printk(KERN_ERR "GetEntries failed\n"); |
329 | } | 332 | } |
330 | /* | 333 | /* |
331 | * Setup queue entry with a command, status and fib mapped | 334 | * Setup queue entry with a command, status and fib mapped |
332 | */ | 335 | */ |
333 | entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); | 336 | entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); |
334 | map = 1; | 337 | map = 1; |
335 | } else { | 338 | } else { |
336 | while(!aac_get_entry(dev, qid, &entry, index, nonotify)) | 339 | while (!aac_get_entry(dev, qid, &entry, index, nonotify)) { |
337 | { | ||
338 | /* if no entries wait for some if caller wants to */ | 340 | /* if no entries wait for some if caller wants to */ |
339 | } | 341 | } |
340 | /* | 342 | /* |
341 | * Setup queue entry with command, status and fib mapped | 343 | * Setup queue entry with command, status and fib mapped |
342 | */ | 344 | */ |
343 | entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); | 345 | entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); |
344 | entry->addr = hw_fib->header.SenderFibAddress; | 346 | entry->addr = hw_fib->header.SenderFibAddress; |
345 | /* Restore adapters pointer to the FIB */ | 347 | /* Restore adapters pointer to the FIB */ |
346 | hw_fib->header.ReceiverFibAddress = hw_fib->header.SenderFibAddress; /* Let the adapter now where to find its data */ | 348 | hw_fib->header.ReceiverFibAddress = hw_fib->header.SenderFibAddress; /* Let the adapter now where to find its data */ |
347 | map = 0; | 349 | map = 0; |
348 | } | 350 | } |
349 | /* | 351 | /* |
350 | * If MapFib is true than we need to map the Fib and put pointers | 352 | * If MapFib is true than we need to map the Fib and put pointers |
@@ -356,8 +358,8 @@ int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw | |||
356 | } | 358 | } |
357 | 359 | ||
358 | /* | 360 | /* |
359 | * Define the highest level of host to adapter communication routines. | 361 | * Define the highest level of host to adapter communication routines. |
360 | * These routines will support host to adapter FS commuication. These | 362 | * These routines will support host to adapter FS commuication. These |
361 | * routines have no knowledge of the commuication method used. This level | 363 | * routines have no knowledge of the commuication method used. This level |
362 | * sends and receives FIBs. This level has no knowledge of how these FIBs | 364 | * sends and receives FIBs. This level has no knowledge of how these FIBs |
363 | * get passed back and forth. | 365 | * get passed back and forth. |
@@ -379,7 +381,7 @@ int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw | |||
379 | * an event to wait on must be supplied. This event will be set when a | 381 | * an event to wait on must be supplied. This event will be set when a |
380 | * response FIB is received from the adapter. | 382 | * response FIB is received from the adapter. |
381 | */ | 383 | */ |
382 | 384 | ||
383 | int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, | 385 | int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, |
384 | int priority, int wait, int reply, fib_callback callback, | 386 | int priority, int wait, int reply, fib_callback callback, |
385 | void *callback_data) | 387 | void *callback_data) |
@@ -392,16 +394,17 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, | |||
392 | if (!(hw_fib->header.XferState & cpu_to_le32(HostOwned))) | 394 | if (!(hw_fib->header.XferState & cpu_to_le32(HostOwned))) |
393 | return -EBUSY; | 395 | return -EBUSY; |
394 | /* | 396 | /* |
395 | * There are 5 cases with the wait and reponse requested flags. | 397 | * There are 5 cases with the wait and reponse requested flags. |
396 | * The only invalid cases are if the caller requests to wait and | 398 | * The only invalid cases are if the caller requests to wait and |
397 | * does not request a response and if the caller does not want a | 399 | * does not request a response and if the caller does not want a |
398 | * response and the Fib is not allocated from pool. If a response | 400 | * response and the Fib is not allocated from pool. If a response |
399 | * is not requesed the Fib will just be deallocaed by the DPC | 401 | * is not requesed the Fib will just be deallocaed by the DPC |
400 | * routine when the response comes back from the adapter. No | 402 | * routine when the response comes back from the adapter. No |
401 | * further processing will be done besides deleting the Fib. We | 403 | * further processing will be done besides deleting the Fib. We |
402 | * will have a debug mode where the adapter can notify the host | 404 | * will have a debug mode where the adapter can notify the host |
403 | * it had a problem and the host can log that fact. | 405 | * it had a problem and the host can log that fact. |
404 | */ | 406 | */ |
407 | fibptr->flags = 0; | ||
405 | if (wait && !reply) { | 408 | if (wait && !reply) { |
406 | return -EINVAL; | 409 | return -EINVAL; |
407 | } else if (!wait && reply) { | 410 | } else if (!wait && reply) { |
@@ -413,7 +416,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, | |||
413 | } else if (wait && reply) { | 416 | } else if (wait && reply) { |
414 | hw_fib->header.XferState |= cpu_to_le32(ResponseExpected); | 417 | hw_fib->header.XferState |= cpu_to_le32(ResponseExpected); |
415 | FIB_COUNTER_INCREMENT(aac_config.NormalSent); | 418 | FIB_COUNTER_INCREMENT(aac_config.NormalSent); |
416 | } | 419 | } |
417 | /* | 420 | /* |
418 | * Map the fib into 32bits by using the fib number | 421 | * Map the fib into 32bits by using the fib number |
419 | */ | 422 | */ |
@@ -436,7 +439,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, | |||
436 | hw_fib->header.Size = cpu_to_le16(sizeof(struct aac_fibhdr) + size); | 439 | hw_fib->header.Size = cpu_to_le16(sizeof(struct aac_fibhdr) + size); |
437 | if (le16_to_cpu(hw_fib->header.Size) > le16_to_cpu(hw_fib->header.SenderSize)) { | 440 | if (le16_to_cpu(hw_fib->header.Size) > le16_to_cpu(hw_fib->header.SenderSize)) { |
438 | return -EMSGSIZE; | 441 | return -EMSGSIZE; |
439 | } | 442 | } |
440 | /* | 443 | /* |
441 | * Get a queue entry connect the FIB to it and send an notify | 444 | * Get a queue entry connect the FIB to it and send an notify |
442 | * the adapter a command is ready. | 445 | * the adapter a command is ready. |
@@ -450,10 +453,10 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, | |||
450 | if (!wait) { | 453 | if (!wait) { |
451 | fibptr->callback = callback; | 454 | fibptr->callback = callback; |
452 | fibptr->callback_data = callback_data; | 455 | fibptr->callback_data = callback_data; |
456 | fibptr->flags = FIB_CONTEXT_FLAG; | ||
453 | } | 457 | } |
454 | 458 | ||
455 | fibptr->done = 0; | 459 | fibptr->done = 0; |
456 | fibptr->flags = 0; | ||
457 | 460 | ||
458 | FIB_COUNTER_INCREMENT(aac_config.FibsSent); | 461 | FIB_COUNTER_INCREMENT(aac_config.FibsSent); |
459 | 462 | ||
@@ -473,9 +476,9 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, | |||
473 | aac_adapter_deliver(fibptr); | 476 | aac_adapter_deliver(fibptr); |
474 | 477 | ||
475 | /* | 478 | /* |
476 | * If the caller wanted us to wait for response wait now. | 479 | * If the caller wanted us to wait for response wait now. |
477 | */ | 480 | */ |
478 | 481 | ||
479 | if (wait) { | 482 | if (wait) { |
480 | spin_unlock_irqrestore(&fibptr->event_lock, flags); | 483 | spin_unlock_irqrestore(&fibptr->event_lock, flags); |
481 | /* Only set for first known interruptable command */ | 484 | /* Only set for first known interruptable command */ |
@@ -522,7 +525,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, | |||
522 | } | 525 | } |
523 | spin_unlock_irqrestore(&fibptr->event_lock, flags); | 526 | spin_unlock_irqrestore(&fibptr->event_lock, flags); |
524 | BUG_ON(fibptr->done == 0); | 527 | BUG_ON(fibptr->done == 0); |
525 | 528 | ||
526 | if(unlikely(fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT)) | 529 | if(unlikely(fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT)) |
527 | return -ETIMEDOUT; | 530 | return -ETIMEDOUT; |
528 | return 0; | 531 | return 0; |
@@ -537,15 +540,15 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, | |||
537 | return 0; | 540 | return 0; |
538 | } | 541 | } |
539 | 542 | ||
540 | /** | 543 | /** |
541 | * aac_consumer_get - get the top of the queue | 544 | * aac_consumer_get - get the top of the queue |
542 | * @dev: Adapter | 545 | * @dev: Adapter |
543 | * @q: Queue | 546 | * @q: Queue |
544 | * @entry: Return entry | 547 | * @entry: Return entry |
545 | * | 548 | * |
546 | * Will return a pointer to the entry on the top of the queue requested that | 549 | * Will return a pointer to the entry on the top of the queue requested that |
547 | * we are a consumer of, and return the address of the queue entry. It does | 550 | * we are a consumer of, and return the address of the queue entry. It does |
548 | * not change the state of the queue. | 551 | * not change the state of the queue. |
549 | */ | 552 | */ |
550 | 553 | ||
551 | int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry) | 554 | int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry) |
@@ -560,10 +563,10 @@ int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entr | |||
560 | * the end of the queue, else we just use the entry | 563 | * the end of the queue, else we just use the entry |
561 | * pointed to by the header index | 564 | * pointed to by the header index |
562 | */ | 565 | */ |
563 | if (le32_to_cpu(*q->headers.consumer) >= q->entries) | 566 | if (le32_to_cpu(*q->headers.consumer) >= q->entries) |
564 | index = 0; | 567 | index = 0; |
565 | else | 568 | else |
566 | index = le32_to_cpu(*q->headers.consumer); | 569 | index = le32_to_cpu(*q->headers.consumer); |
567 | *entry = q->base + index; | 570 | *entry = q->base + index; |
568 | status = 1; | 571 | status = 1; |
569 | } | 572 | } |
@@ -587,12 +590,12 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid) | |||
587 | 590 | ||
588 | if ((le32_to_cpu(*q->headers.producer)+1) == le32_to_cpu(*q->headers.consumer)) | 591 | if ((le32_to_cpu(*q->headers.producer)+1) == le32_to_cpu(*q->headers.consumer)) |
589 | wasfull = 1; | 592 | wasfull = 1; |
590 | 593 | ||
591 | if (le32_to_cpu(*q->headers.consumer) >= q->entries) | 594 | if (le32_to_cpu(*q->headers.consumer) >= q->entries) |
592 | *q->headers.consumer = cpu_to_le32(1); | 595 | *q->headers.consumer = cpu_to_le32(1); |
593 | else | 596 | else |
594 | *q->headers.consumer = cpu_to_le32(le32_to_cpu(*q->headers.consumer)+1); | 597 | *q->headers.consumer = cpu_to_le32(le32_to_cpu(*q->headers.consumer)+1); |
595 | 598 | ||
596 | if (wasfull) { | 599 | if (wasfull) { |
597 | switch (qid) { | 600 | switch (qid) { |
598 | 601 | ||
@@ -608,7 +611,7 @@ void aac_consumer_free(struct aac_dev * dev, struct aac_queue *q, u32 qid) | |||
608 | } | 611 | } |
609 | aac_adapter_notify(dev, notify); | 612 | aac_adapter_notify(dev, notify); |
610 | } | 613 | } |
611 | } | 614 | } |
612 | 615 | ||
613 | /** | 616 | /** |
614 | * aac_fib_adapter_complete - complete adapter issued fib | 617 | * aac_fib_adapter_complete - complete adapter issued fib |
@@ -630,32 +633,32 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) | |||
630 | if (hw_fib->header.XferState == 0) { | 633 | if (hw_fib->header.XferState == 0) { |
631 | if (dev->comm_interface == AAC_COMM_MESSAGE) | 634 | if (dev->comm_interface == AAC_COMM_MESSAGE) |
632 | kfree (hw_fib); | 635 | kfree (hw_fib); |
633 | return 0; | 636 | return 0; |
634 | } | 637 | } |
635 | /* | 638 | /* |
636 | * If we plan to do anything check the structure type first. | 639 | * If we plan to do anything check the structure type first. |
637 | */ | 640 | */ |
638 | if ( hw_fib->header.StructType != FIB_MAGIC ) { | 641 | if (hw_fib->header.StructType != FIB_MAGIC) { |
639 | if (dev->comm_interface == AAC_COMM_MESSAGE) | 642 | if (dev->comm_interface == AAC_COMM_MESSAGE) |
640 | kfree (hw_fib); | 643 | kfree (hw_fib); |
641 | return -EINVAL; | 644 | return -EINVAL; |
642 | } | 645 | } |
643 | /* | 646 | /* |
644 | * This block handles the case where the adapter had sent us a | 647 | * This block handles the case where the adapter had sent us a |
645 | * command and we have finished processing the command. We | 648 | * command and we have finished processing the command. We |
646 | * call completeFib when we are done processing the command | 649 | * call completeFib when we are done processing the command |
647 | * and want to send a response back to the adapter. This will | 650 | * and want to send a response back to the adapter. This will |
648 | * send the completed cdb to the adapter. | 651 | * send the completed cdb to the adapter. |
649 | */ | 652 | */ |
650 | if (hw_fib->header.XferState & cpu_to_le32(SentFromAdapter)) { | 653 | if (hw_fib->header.XferState & cpu_to_le32(SentFromAdapter)) { |
651 | if (dev->comm_interface == AAC_COMM_MESSAGE) { | 654 | if (dev->comm_interface == AAC_COMM_MESSAGE) { |
652 | kfree (hw_fib); | 655 | kfree (hw_fib); |
653 | } else { | 656 | } else { |
654 | u32 index; | 657 | u32 index; |
655 | hw_fib->header.XferState |= cpu_to_le32(HostProcessed); | 658 | hw_fib->header.XferState |= cpu_to_le32(HostProcessed); |
656 | if (size) { | 659 | if (size) { |
657 | size += sizeof(struct aac_fibhdr); | 660 | size += sizeof(struct aac_fibhdr); |
658 | if (size > le16_to_cpu(hw_fib->header.SenderSize)) | 661 | if (size > le16_to_cpu(hw_fib->header.SenderSize)) |
659 | return -EMSGSIZE; | 662 | return -EMSGSIZE; |
660 | hw_fib->header.Size = cpu_to_le16(size); | 663 | hw_fib->header.Size = cpu_to_le16(size); |
661 | } | 664 | } |
@@ -667,12 +670,11 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) | |||
667 | if (!(nointr & (int)aac_config.irq_mod)) | 670 | if (!(nointr & (int)aac_config.irq_mod)) |
668 | aac_adapter_notify(dev, AdapNormRespQueue); | 671 | aac_adapter_notify(dev, AdapNormRespQueue); |
669 | } | 672 | } |
673 | } else { | ||
674 | printk(KERN_WARNING "aac_fib_adapter_complete: " | ||
675 | "Unknown xferstate detected.\n"); | ||
676 | BUG(); | ||
670 | } | 677 | } |
671 | else | ||
672 | { | ||
673 | printk(KERN_WARNING "aac_fib_adapter_complete: Unknown xferstate detected.\n"); | ||
674 | BUG(); | ||
675 | } | ||
676 | return 0; | 678 | return 0; |
677 | } | 679 | } |
678 | 680 | ||
@@ -682,7 +684,7 @@ int aac_fib_adapter_complete(struct fib *fibptr, unsigned short size) | |||
682 | * | 684 | * |
683 | * Will do all necessary work to complete a FIB. | 685 | * Will do all necessary work to complete a FIB. |
684 | */ | 686 | */ |
685 | 687 | ||
686 | int aac_fib_complete(struct fib *fibptr) | 688 | int aac_fib_complete(struct fib *fibptr) |
687 | { | 689 | { |
688 | struct hw_fib * hw_fib = fibptr->hw_fib_va; | 690 | struct hw_fib * hw_fib = fibptr->hw_fib_va; |
@@ -692,15 +694,15 @@ int aac_fib_complete(struct fib *fibptr) | |||
692 | */ | 694 | */ |
693 | 695 | ||
694 | if (hw_fib->header.XferState == 0) | 696 | if (hw_fib->header.XferState == 0) |
695 | return 0; | 697 | return 0; |
696 | /* | 698 | /* |
697 | * If we plan to do anything check the structure type first. | 699 | * If we plan to do anything check the structure type first. |
698 | */ | 700 | */ |
699 | 701 | ||
700 | if (hw_fib->header.StructType != FIB_MAGIC) | 702 | if (hw_fib->header.StructType != FIB_MAGIC) |
701 | return -EINVAL; | 703 | return -EINVAL; |
702 | /* | 704 | /* |
703 | * This block completes a cdb which orginated on the host and we | 705 | * This block completes a cdb which orginated on the host and we |
704 | * just need to deallocate the cdb or reinit it. At this point the | 706 | * just need to deallocate the cdb or reinit it. At this point the |
705 | * command is complete that we had sent to the adapter and this | 707 | * command is complete that we had sent to the adapter and this |
706 | * cdb could be reused. | 708 | * cdb could be reused. |
@@ -721,7 +723,7 @@ int aac_fib_complete(struct fib *fibptr) | |||
721 | fib_dealloc(fibptr); | 723 | fib_dealloc(fibptr); |
722 | } else { | 724 | } else { |
723 | BUG(); | 725 | BUG(); |
724 | } | 726 | } |
725 | return 0; | 727 | return 0; |
726 | } | 728 | } |
727 | 729 | ||
@@ -741,7 +743,7 @@ void aac_printf(struct aac_dev *dev, u32 val) | |||
741 | { | 743 | { |
742 | int length = val & 0xffff; | 744 | int length = val & 0xffff; |
743 | int level = (val >> 16) & 0xffff; | 745 | int level = (val >> 16) & 0xffff; |
744 | 746 | ||
745 | /* | 747 | /* |
746 | * The size of the printfbuf is set in port.c | 748 | * The size of the printfbuf is set in port.c |
747 | * There is no variable or define for it | 749 | * There is no variable or define for it |
@@ -755,7 +757,7 @@ void aac_printf(struct aac_dev *dev, u32 val) | |||
755 | else | 757 | else |
756 | printk(KERN_INFO "%s:%s", dev->name, cp); | 758 | printk(KERN_INFO "%s:%s", dev->name, cp); |
757 | } | 759 | } |
758 | memset(cp, 0, 256); | 760 | memset(cp, 0, 256); |
759 | } | 761 | } |
760 | 762 | ||
761 | 763 | ||
@@ -773,20 +775,20 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
773 | { | 775 | { |
774 | struct hw_fib * hw_fib = fibptr->hw_fib_va; | 776 | struct hw_fib * hw_fib = fibptr->hw_fib_va; |
775 | struct aac_aifcmd * aifcmd = (struct aac_aifcmd *)hw_fib->data; | 777 | struct aac_aifcmd * aifcmd = (struct aac_aifcmd *)hw_fib->data; |
776 | u32 container; | 778 | u32 channel, id, lun, container; |
777 | struct scsi_device *device; | 779 | struct scsi_device *device; |
778 | enum { | 780 | enum { |
779 | NOTHING, | 781 | NOTHING, |
780 | DELETE, | 782 | DELETE, |
781 | ADD, | 783 | ADD, |
782 | CHANGE | 784 | CHANGE |
783 | } device_config_needed; | 785 | } device_config_needed = NOTHING; |
784 | 786 | ||
785 | /* Sniff for container changes */ | 787 | /* Sniff for container changes */ |
786 | 788 | ||
787 | if (!dev || !dev->fsa_dev) | 789 | if (!dev || !dev->fsa_dev) |
788 | return; | 790 | return; |
789 | container = (u32)-1; | 791 | container = channel = id = lun = (u32)-1; |
790 | 792 | ||
791 | /* | 793 | /* |
792 | * We have set this up to try and minimize the number of | 794 | * We have set this up to try and minimize the number of |
@@ -796,13 +798,13 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
796 | */ | 798 | */ |
797 | switch (le32_to_cpu(aifcmd->command)) { | 799 | switch (le32_to_cpu(aifcmd->command)) { |
798 | case AifCmdDriverNotify: | 800 | case AifCmdDriverNotify: |
799 | switch (le32_to_cpu(((u32 *)aifcmd->data)[0])) { | 801 | switch (le32_to_cpu(((__le32 *)aifcmd->data)[0])) { |
800 | /* | 802 | /* |
801 | * Morph or Expand complete | 803 | * Morph or Expand complete |
802 | */ | 804 | */ |
803 | case AifDenMorphComplete: | 805 | case AifDenMorphComplete: |
804 | case AifDenVolumeExtendComplete: | 806 | case AifDenVolumeExtendComplete: |
805 | container = le32_to_cpu(((u32 *)aifcmd->data)[1]); | 807 | container = le32_to_cpu(((__le32 *)aifcmd->data)[1]); |
806 | if (container >= dev->maximum_num_containers) | 808 | if (container >= dev->maximum_num_containers) |
807 | break; | 809 | break; |
808 | 810 | ||
@@ -814,9 +816,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
814 | */ | 816 | */ |
815 | 817 | ||
816 | if ((dev != NULL) && (dev->scsi_host_ptr != NULL)) { | 818 | if ((dev != NULL) && (dev->scsi_host_ptr != NULL)) { |
817 | device = scsi_device_lookup(dev->scsi_host_ptr, | 819 | device = scsi_device_lookup(dev->scsi_host_ptr, |
818 | CONTAINER_TO_CHANNEL(container), | 820 | CONTAINER_TO_CHANNEL(container), |
819 | CONTAINER_TO_ID(container), | 821 | CONTAINER_TO_ID(container), |
820 | CONTAINER_TO_LUN(container)); | 822 | CONTAINER_TO_LUN(container)); |
821 | if (device) { | 823 | if (device) { |
822 | dev->fsa_dev[container].config_needed = CHANGE; | 824 | dev->fsa_dev[container].config_needed = CHANGE; |
@@ -835,25 +837,29 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
835 | if (container >= dev->maximum_num_containers) | 837 | if (container >= dev->maximum_num_containers) |
836 | break; | 838 | break; |
837 | if ((dev->fsa_dev[container].config_waiting_on == | 839 | if ((dev->fsa_dev[container].config_waiting_on == |
838 | le32_to_cpu(*(u32 *)aifcmd->data)) && | 840 | le32_to_cpu(*(__le32 *)aifcmd->data)) && |
839 | time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) | 841 | time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) |
840 | dev->fsa_dev[container].config_waiting_on = 0; | 842 | dev->fsa_dev[container].config_waiting_on = 0; |
841 | } else for (container = 0; | 843 | } else for (container = 0; |
842 | container < dev->maximum_num_containers; ++container) { | 844 | container < dev->maximum_num_containers; ++container) { |
843 | if ((dev->fsa_dev[container].config_waiting_on == | 845 | if ((dev->fsa_dev[container].config_waiting_on == |
844 | le32_to_cpu(*(u32 *)aifcmd->data)) && | 846 | le32_to_cpu(*(__le32 *)aifcmd->data)) && |
845 | time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) | 847 | time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) |
846 | dev->fsa_dev[container].config_waiting_on = 0; | 848 | dev->fsa_dev[container].config_waiting_on = 0; |
847 | } | 849 | } |
848 | break; | 850 | break; |
849 | 851 | ||
850 | case AifCmdEventNotify: | 852 | case AifCmdEventNotify: |
851 | switch (le32_to_cpu(((u32 *)aifcmd->data)[0])) { | 853 | switch (le32_to_cpu(((__le32 *)aifcmd->data)[0])) { |
854 | case AifEnBatteryEvent: | ||
855 | dev->cache_protected = | ||
856 | (((__le32 *)aifcmd->data)[1] == cpu_to_le32(3)); | ||
857 | break; | ||
852 | /* | 858 | /* |
853 | * Add an Array. | 859 | * Add an Array. |
854 | */ | 860 | */ |
855 | case AifEnAddContainer: | 861 | case AifEnAddContainer: |
856 | container = le32_to_cpu(((u32 *)aifcmd->data)[1]); | 862 | container = le32_to_cpu(((__le32 *)aifcmd->data)[1]); |
857 | if (container >= dev->maximum_num_containers) | 863 | if (container >= dev->maximum_num_containers) |
858 | break; | 864 | break; |
859 | dev->fsa_dev[container].config_needed = ADD; | 865 | dev->fsa_dev[container].config_needed = ADD; |
@@ -866,7 +872,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
866 | * Delete an Array. | 872 | * Delete an Array. |
867 | */ | 873 | */ |
868 | case AifEnDeleteContainer: | 874 | case AifEnDeleteContainer: |
869 | container = le32_to_cpu(((u32 *)aifcmd->data)[1]); | 875 | container = le32_to_cpu(((__le32 *)aifcmd->data)[1]); |
870 | if (container >= dev->maximum_num_containers) | 876 | if (container >= dev->maximum_num_containers) |
871 | break; | 877 | break; |
872 | dev->fsa_dev[container].config_needed = DELETE; | 878 | dev->fsa_dev[container].config_needed = DELETE; |
@@ -880,7 +886,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
880 | * waiting on something else, setup to wait on a Config Change. | 886 | * waiting on something else, setup to wait on a Config Change. |
881 | */ | 887 | */ |
882 | case AifEnContainerChange: | 888 | case AifEnContainerChange: |
883 | container = le32_to_cpu(((u32 *)aifcmd->data)[1]); | 889 | container = le32_to_cpu(((__le32 *)aifcmd->data)[1]); |
884 | if (container >= dev->maximum_num_containers) | 890 | if (container >= dev->maximum_num_containers) |
885 | break; | 891 | break; |
886 | if (dev->fsa_dev[container].config_waiting_on && | 892 | if (dev->fsa_dev[container].config_waiting_on && |
@@ -895,6 +901,60 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
895 | case AifEnConfigChange: | 901 | case AifEnConfigChange: |
896 | break; | 902 | break; |
897 | 903 | ||
904 | case AifEnAddJBOD: | ||
905 | case AifEnDeleteJBOD: | ||
906 | container = le32_to_cpu(((__le32 *)aifcmd->data)[1]); | ||
907 | if ((container >> 28)) | ||
908 | break; | ||
909 | channel = (container >> 24) & 0xF; | ||
910 | if (channel >= dev->maximum_num_channels) | ||
911 | break; | ||
912 | id = container & 0xFFFF; | ||
913 | if (id >= dev->maximum_num_physicals) | ||
914 | break; | ||
915 | lun = (container >> 16) & 0xFF; | ||
916 | channel = aac_phys_to_logical(channel); | ||
917 | device_config_needed = | ||
918 | (((__le32 *)aifcmd->data)[0] == | ||
919 | cpu_to_le32(AifEnAddJBOD)) ? ADD : DELETE; | ||
920 | break; | ||
921 | |||
922 | case AifEnEnclosureManagement: | ||
923 | /* | ||
924 | * If in JBOD mode, automatic exposure of new | ||
925 | * physical target to be suppressed until configured. | ||
926 | */ | ||
927 | if (dev->jbod) | ||
928 | break; | ||
929 | switch (le32_to_cpu(((__le32 *)aifcmd->data)[3])) { | ||
930 | case EM_DRIVE_INSERTION: | ||
931 | case EM_DRIVE_REMOVAL: | ||
932 | container = le32_to_cpu( | ||
933 | ((__le32 *)aifcmd->data)[2]); | ||
934 | if ((container >> 28)) | ||
935 | break; | ||
936 | channel = (container >> 24) & 0xF; | ||
937 | if (channel >= dev->maximum_num_channels) | ||
938 | break; | ||
939 | id = container & 0xFFFF; | ||
940 | lun = (container >> 16) & 0xFF; | ||
941 | if (id >= dev->maximum_num_physicals) { | ||
942 | /* legacy dev_t ? */ | ||
943 | if ((0x2000 <= id) || lun || channel || | ||
944 | ((channel = (id >> 7) & 0x3F) >= | ||
945 | dev->maximum_num_channels)) | ||
946 | break; | ||
947 | lun = (id >> 4) & 7; | ||
948 | id &= 0xF; | ||
949 | } | ||
950 | channel = aac_phys_to_logical(channel); | ||
951 | device_config_needed = | ||
952 | (((__le32 *)aifcmd->data)[3] | ||
953 | == cpu_to_le32(EM_DRIVE_INSERTION)) ? | ||
954 | ADD : DELETE; | ||
955 | break; | ||
956 | } | ||
957 | break; | ||
898 | } | 958 | } |
899 | 959 | ||
900 | /* | 960 | /* |
@@ -905,13 +965,13 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
905 | if (container >= dev->maximum_num_containers) | 965 | if (container >= dev->maximum_num_containers) |
906 | break; | 966 | break; |
907 | if ((dev->fsa_dev[container].config_waiting_on == | 967 | if ((dev->fsa_dev[container].config_waiting_on == |
908 | le32_to_cpu(*(u32 *)aifcmd->data)) && | 968 | le32_to_cpu(*(__le32 *)aifcmd->data)) && |
909 | time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) | 969 | time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) |
910 | dev->fsa_dev[container].config_waiting_on = 0; | 970 | dev->fsa_dev[container].config_waiting_on = 0; |
911 | } else for (container = 0; | 971 | } else for (container = 0; |
912 | container < dev->maximum_num_containers; ++container) { | 972 | container < dev->maximum_num_containers; ++container) { |
913 | if ((dev->fsa_dev[container].config_waiting_on == | 973 | if ((dev->fsa_dev[container].config_waiting_on == |
914 | le32_to_cpu(*(u32 *)aifcmd->data)) && | 974 | le32_to_cpu(*(__le32 *)aifcmd->data)) && |
915 | time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) | 975 | time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) |
916 | dev->fsa_dev[container].config_waiting_on = 0; | 976 | dev->fsa_dev[container].config_waiting_on = 0; |
917 | } | 977 | } |
@@ -926,9 +986,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
926 | * wait for a container change. | 986 | * wait for a container change. |
927 | */ | 987 | */ |
928 | 988 | ||
929 | if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero)) | 989 | if (((__le32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero) && |
930 | && ((((u32 *)aifcmd->data)[6] == ((u32 *)aifcmd->data)[5]) | 990 | (((__le32 *)aifcmd->data)[6] == ((__le32 *)aifcmd->data)[5] || |
931 | || (((u32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsSuccess)))) { | 991 | ((__le32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsSuccess))) { |
932 | for (container = 0; | 992 | for (container = 0; |
933 | container < dev->maximum_num_containers; | 993 | container < dev->maximum_num_containers; |
934 | ++container) { | 994 | ++container) { |
@@ -943,9 +1003,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
943 | jiffies; | 1003 | jiffies; |
944 | } | 1004 | } |
945 | } | 1005 | } |
946 | if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero)) | 1006 | if (((__le32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero) && |
947 | && (((u32 *)aifcmd->data)[6] == 0) | 1007 | ((__le32 *)aifcmd->data)[6] == 0 && |
948 | && (((u32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsRunning))) { | 1008 | ((__le32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsRunning)) { |
949 | for (container = 0; | 1009 | for (container = 0; |
950 | container < dev->maximum_num_containers; | 1010 | container < dev->maximum_num_containers; |
951 | ++container) { | 1011 | ++container) { |
@@ -963,7 +1023,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
963 | break; | 1023 | break; |
964 | } | 1024 | } |
965 | 1025 | ||
966 | device_config_needed = NOTHING; | 1026 | if (device_config_needed == NOTHING) |
967 | for (container = 0; container < dev->maximum_num_containers; | 1027 | for (container = 0; container < dev->maximum_num_containers; |
968 | ++container) { | 1028 | ++container) { |
969 | if ((dev->fsa_dev[container].config_waiting_on == 0) && | 1029 | if ((dev->fsa_dev[container].config_waiting_on == 0) && |
@@ -972,6 +1032,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
972 | device_config_needed = | 1032 | device_config_needed = |
973 | dev->fsa_dev[container].config_needed; | 1033 | dev->fsa_dev[container].config_needed; |
974 | dev->fsa_dev[container].config_needed = NOTHING; | 1034 | dev->fsa_dev[container].config_needed = NOTHING; |
1035 | channel = CONTAINER_TO_CHANNEL(container); | ||
1036 | id = CONTAINER_TO_ID(container); | ||
1037 | lun = CONTAINER_TO_LUN(container); | ||
975 | break; | 1038 | break; |
976 | } | 1039 | } |
977 | } | 1040 | } |
@@ -995,34 +1058,56 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
995 | /* | 1058 | /* |
996 | * force reload of disk info via aac_probe_container | 1059 | * force reload of disk info via aac_probe_container |
997 | */ | 1060 | */ |
998 | if ((device_config_needed == CHANGE) | 1061 | if ((channel == CONTAINER_CHANNEL) && |
999 | && (dev->fsa_dev[container].valid == 1)) | 1062 | (device_config_needed != NOTHING)) { |
1000 | dev->fsa_dev[container].valid = 2; | 1063 | if (dev->fsa_dev[container].valid == 1) |
1001 | if ((device_config_needed == CHANGE) || | 1064 | dev->fsa_dev[container].valid = 2; |
1002 | (device_config_needed == ADD)) | ||
1003 | aac_probe_container(dev, container); | 1065 | aac_probe_container(dev, container); |
1004 | device = scsi_device_lookup(dev->scsi_host_ptr, | 1066 | } |
1005 | CONTAINER_TO_CHANNEL(container), | 1067 | device = scsi_device_lookup(dev->scsi_host_ptr, channel, id, lun); |
1006 | CONTAINER_TO_ID(container), | ||
1007 | CONTAINER_TO_LUN(container)); | ||
1008 | if (device) { | 1068 | if (device) { |
1009 | switch (device_config_needed) { | 1069 | switch (device_config_needed) { |
1010 | case DELETE: | 1070 | case DELETE: |
1071 | if (scsi_device_online(device)) { | ||
1072 | scsi_device_set_state(device, SDEV_OFFLINE); | ||
1073 | sdev_printk(KERN_INFO, device, | ||
1074 | "Device offlined - %s\n", | ||
1075 | (channel == CONTAINER_CHANNEL) ? | ||
1076 | "array deleted" : | ||
1077 | "enclosure services event"); | ||
1078 | } | ||
1079 | break; | ||
1080 | case ADD: | ||
1081 | if (!scsi_device_online(device)) { | ||
1082 | sdev_printk(KERN_INFO, device, | ||
1083 | "Device online - %s\n", | ||
1084 | (channel == CONTAINER_CHANNEL) ? | ||
1085 | "array created" : | ||
1086 | "enclosure services event"); | ||
1087 | scsi_device_set_state(device, SDEV_RUNNING); | ||
1088 | } | ||
1089 | /* FALLTHRU */ | ||
1011 | case CHANGE: | 1090 | case CHANGE: |
1091 | if ((channel == CONTAINER_CHANNEL) | ||
1092 | && (!dev->fsa_dev[container].valid)) { | ||
1093 | if (!scsi_device_online(device)) | ||
1094 | break; | ||
1095 | scsi_device_set_state(device, SDEV_OFFLINE); | ||
1096 | sdev_printk(KERN_INFO, device, | ||
1097 | "Device offlined - %s\n", | ||
1098 | "array failed"); | ||
1099 | break; | ||
1100 | } | ||
1012 | scsi_rescan_device(&device->sdev_gendev); | 1101 | scsi_rescan_device(&device->sdev_gendev); |
1013 | 1102 | ||
1014 | default: | 1103 | default: |
1015 | break; | 1104 | break; |
1016 | } | 1105 | } |
1017 | scsi_device_put(device); | 1106 | scsi_device_put(device); |
1107 | device_config_needed = NOTHING; | ||
1018 | } | 1108 | } |
1019 | if (device_config_needed == ADD) { | 1109 | if (device_config_needed == ADD) |
1020 | scsi_add_device(dev->scsi_host_ptr, | 1110 | scsi_add_device(dev->scsi_host_ptr, channel, id, lun); |
1021 | CONTAINER_TO_CHANNEL(container), | ||
1022 | CONTAINER_TO_ID(container), | ||
1023 | CONTAINER_TO_LUN(container)); | ||
1024 | } | ||
1025 | |||
1026 | } | 1111 | } |
1027 | 1112 | ||
1028 | static int _aac_reset_adapter(struct aac_dev *aac, int forced) | 1113 | static int _aac_reset_adapter(struct aac_dev *aac, int forced) |
@@ -1099,7 +1184,8 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced) | |||
1099 | free_irq(aac->pdev->irq, aac); | 1184 | free_irq(aac->pdev->irq, aac); |
1100 | kfree(aac->fsa_dev); | 1185 | kfree(aac->fsa_dev); |
1101 | aac->fsa_dev = NULL; | 1186 | aac->fsa_dev = NULL; |
1102 | if (aac_get_driver_ident(index)->quirks & AAC_QUIRK_31BIT) { | 1187 | quirks = aac_get_driver_ident(index)->quirks; |
1188 | if (quirks & AAC_QUIRK_31BIT) { | ||
1103 | if (((retval = pci_set_dma_mask(aac->pdev, DMA_31BIT_MASK))) || | 1189 | if (((retval = pci_set_dma_mask(aac->pdev, DMA_31BIT_MASK))) || |
1104 | ((retval = pci_set_consistent_dma_mask(aac->pdev, DMA_31BIT_MASK)))) | 1190 | ((retval = pci_set_consistent_dma_mask(aac->pdev, DMA_31BIT_MASK)))) |
1105 | goto out; | 1191 | goto out; |
@@ -1110,7 +1196,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced) | |||
1110 | } | 1196 | } |
1111 | if ((retval = (*(aac_get_driver_ident(index)->init))(aac))) | 1197 | if ((retval = (*(aac_get_driver_ident(index)->init))(aac))) |
1112 | goto out; | 1198 | goto out; |
1113 | if (aac_get_driver_ident(index)->quirks & AAC_QUIRK_31BIT) | 1199 | if (quirks & AAC_QUIRK_31BIT) |
1114 | if ((retval = pci_set_dma_mask(aac->pdev, DMA_32BIT_MASK))) | 1200 | if ((retval = pci_set_dma_mask(aac->pdev, DMA_32BIT_MASK))) |
1115 | goto out; | 1201 | goto out; |
1116 | if (jafo) { | 1202 | if (jafo) { |
@@ -1121,15 +1207,14 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced) | |||
1121 | } | 1207 | } |
1122 | } | 1208 | } |
1123 | (void)aac_get_adapter_info(aac); | 1209 | (void)aac_get_adapter_info(aac); |
1124 | quirks = aac_get_driver_ident(index)->quirks; | ||
1125 | if ((quirks & AAC_QUIRK_34SG) && (host->sg_tablesize > 34)) { | 1210 | if ((quirks & AAC_QUIRK_34SG) && (host->sg_tablesize > 34)) { |
1126 | host->sg_tablesize = 34; | 1211 | host->sg_tablesize = 34; |
1127 | host->max_sectors = (host->sg_tablesize * 8) + 112; | 1212 | host->max_sectors = (host->sg_tablesize * 8) + 112; |
1128 | } | 1213 | } |
1129 | if ((quirks & AAC_QUIRK_17SG) && (host->sg_tablesize > 17)) { | 1214 | if ((quirks & AAC_QUIRK_17SG) && (host->sg_tablesize > 17)) { |
1130 | host->sg_tablesize = 17; | 1215 | host->sg_tablesize = 17; |
1131 | host->max_sectors = (host->sg_tablesize * 8) + 112; | 1216 | host->max_sectors = (host->sg_tablesize * 8) + 112; |
1132 | } | 1217 | } |
1133 | aac_get_config_status(aac, 1); | 1218 | aac_get_config_status(aac, 1); |
1134 | aac_get_containers(aac); | 1219 | aac_get_containers(aac); |
1135 | /* | 1220 | /* |
@@ -1217,12 +1302,13 @@ int aac_reset_adapter(struct aac_dev * aac, int forced) | |||
1217 | } | 1302 | } |
1218 | 1303 | ||
1219 | /* Quiesce build, flush cache, write through mode */ | 1304 | /* Quiesce build, flush cache, write through mode */ |
1220 | aac_send_shutdown(aac); | 1305 | if (forced < 2) |
1306 | aac_send_shutdown(aac); | ||
1221 | spin_lock_irqsave(host->host_lock, flagv); | 1307 | spin_lock_irqsave(host->host_lock, flagv); |
1222 | retval = _aac_reset_adapter(aac, forced); | 1308 | retval = _aac_reset_adapter(aac, forced ? forced : ((aac_check_reset != 0) && (aac_check_reset != 1))); |
1223 | spin_unlock_irqrestore(host->host_lock, flagv); | 1309 | spin_unlock_irqrestore(host->host_lock, flagv); |
1224 | 1310 | ||
1225 | if (retval == -ENODEV) { | 1311 | if ((forced < 2) && (retval == -ENODEV)) { |
1226 | /* Unwind aac_send_shutdown() IOP_RESET unsupported/disabled */ | 1312 | /* Unwind aac_send_shutdown() IOP_RESET unsupported/disabled */ |
1227 | struct fib * fibctx = aac_fib_alloc(aac); | 1313 | struct fib * fibctx = aac_fib_alloc(aac); |
1228 | if (fibctx) { | 1314 | if (fibctx) { |
@@ -1338,11 +1424,11 @@ int aac_check_health(struct aac_dev * aac) | |||
1338 | fib->data = hw_fib->data; | 1424 | fib->data = hw_fib->data; |
1339 | aif = (struct aac_aifcmd *)hw_fib->data; | 1425 | aif = (struct aac_aifcmd *)hw_fib->data; |
1340 | aif->command = cpu_to_le32(AifCmdEventNotify); | 1426 | aif->command = cpu_to_le32(AifCmdEventNotify); |
1341 | aif->seqnum = cpu_to_le32(0xFFFFFFFF); | 1427 | aif->seqnum = cpu_to_le32(0xFFFFFFFF); |
1342 | aif->data[0] = AifEnExpEvent; | 1428 | ((__le32 *)aif->data)[0] = cpu_to_le32(AifEnExpEvent); |
1343 | aif->data[1] = AifExeFirmwarePanic; | 1429 | ((__le32 *)aif->data)[1] = cpu_to_le32(AifExeFirmwarePanic); |
1344 | aif->data[2] = AifHighPriority; | 1430 | ((__le32 *)aif->data)[2] = cpu_to_le32(AifHighPriority); |
1345 | aif->data[3] = BlinkLED; | 1431 | ((__le32 *)aif->data)[3] = cpu_to_le32(BlinkLED); |
1346 | 1432 | ||
1347 | /* | 1433 | /* |
1348 | * Put the FIB onto the | 1434 | * Put the FIB onto the |
@@ -1372,14 +1458,14 @@ int aac_check_health(struct aac_dev * aac) | |||
1372 | 1458 | ||
1373 | printk(KERN_ERR "%s: Host adapter BLINK LED 0x%x\n", aac->name, BlinkLED); | 1459 | printk(KERN_ERR "%s: Host adapter BLINK LED 0x%x\n", aac->name, BlinkLED); |
1374 | 1460 | ||
1375 | if (!aac_check_reset || | 1461 | if (!aac_check_reset || ((aac_check_reset != 1) && |
1376 | (aac->supplement_adapter_info.SupportedOptions2 & | 1462 | (aac->supplement_adapter_info.SupportedOptions2 & |
1377 | le32_to_cpu(AAC_OPTION_IGNORE_RESET))) | 1463 | AAC_OPTION_IGNORE_RESET))) |
1378 | goto out; | 1464 | goto out; |
1379 | host = aac->scsi_host_ptr; | 1465 | host = aac->scsi_host_ptr; |
1380 | if (aac->thread->pid != current->pid) | 1466 | if (aac->thread->pid != current->pid) |
1381 | spin_lock_irqsave(host->host_lock, flagv); | 1467 | spin_lock_irqsave(host->host_lock, flagv); |
1382 | BlinkLED = _aac_reset_adapter(aac, 0); | 1468 | BlinkLED = _aac_reset_adapter(aac, aac_check_reset != 1); |
1383 | if (aac->thread->pid != current->pid) | 1469 | if (aac->thread->pid != current->pid) |
1384 | spin_unlock_irqrestore(host->host_lock, flagv); | 1470 | spin_unlock_irqrestore(host->host_lock, flagv); |
1385 | return BlinkLED; | 1471 | return BlinkLED; |
@@ -1399,7 +1485,7 @@ out: | |||
1399 | * until the queue is empty. When the queue is empty it will wait for | 1485 | * until the queue is empty. When the queue is empty it will wait for |
1400 | * more FIBs. | 1486 | * more FIBs. |
1401 | */ | 1487 | */ |
1402 | 1488 | ||
1403 | int aac_command_thread(void *data) | 1489 | int aac_command_thread(void *data) |
1404 | { | 1490 | { |
1405 | struct aac_dev *dev = data; | 1491 | struct aac_dev *dev = data; |
@@ -1425,30 +1511,29 @@ int aac_command_thread(void *data) | |||
1425 | add_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait); | 1511 | add_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait); |
1426 | set_current_state(TASK_INTERRUPTIBLE); | 1512 | set_current_state(TASK_INTERRUPTIBLE); |
1427 | dprintk ((KERN_INFO "aac_command_thread start\n")); | 1513 | dprintk ((KERN_INFO "aac_command_thread start\n")); |
1428 | while(1) | 1514 | while (1) { |
1429 | { | ||
1430 | spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags); | 1515 | spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags); |
1431 | while(!list_empty(&(dev->queues->queue[HostNormCmdQueue].cmdq))) { | 1516 | while(!list_empty(&(dev->queues->queue[HostNormCmdQueue].cmdq))) { |
1432 | struct list_head *entry; | 1517 | struct list_head *entry; |
1433 | struct aac_aifcmd * aifcmd; | 1518 | struct aac_aifcmd * aifcmd; |
1434 | 1519 | ||
1435 | set_current_state(TASK_RUNNING); | 1520 | set_current_state(TASK_RUNNING); |
1436 | 1521 | ||
1437 | entry = dev->queues->queue[HostNormCmdQueue].cmdq.next; | 1522 | entry = dev->queues->queue[HostNormCmdQueue].cmdq.next; |
1438 | list_del(entry); | 1523 | list_del(entry); |
1439 | 1524 | ||
1440 | spin_unlock_irqrestore(dev->queues->queue[HostNormCmdQueue].lock, flags); | 1525 | spin_unlock_irqrestore(dev->queues->queue[HostNormCmdQueue].lock, flags); |
1441 | fib = list_entry(entry, struct fib, fiblink); | 1526 | fib = list_entry(entry, struct fib, fiblink); |
1442 | /* | 1527 | /* |
1443 | * We will process the FIB here or pass it to a | 1528 | * We will process the FIB here or pass it to a |
1444 | * worker thread that is TBD. We Really can't | 1529 | * worker thread that is TBD. We Really can't |
1445 | * do anything at this point since we don't have | 1530 | * do anything at this point since we don't have |
1446 | * anything defined for this thread to do. | 1531 | * anything defined for this thread to do. |
1447 | */ | 1532 | */ |
1448 | hw_fib = fib->hw_fib_va; | 1533 | hw_fib = fib->hw_fib_va; |
1449 | memset(fib, 0, sizeof(struct fib)); | 1534 | memset(fib, 0, sizeof(struct fib)); |
1450 | fib->type = FSAFS_NTC_FIB_CONTEXT; | 1535 | fib->type = FSAFS_NTC_FIB_CONTEXT; |
1451 | fib->size = sizeof( struct fib ); | 1536 | fib->size = sizeof(struct fib); |
1452 | fib->hw_fib_va = hw_fib; | 1537 | fib->hw_fib_va = hw_fib; |
1453 | fib->data = hw_fib->data; | 1538 | fib->data = hw_fib->data; |
1454 | fib->dev = dev; | 1539 | fib->dev = dev; |
@@ -1462,20 +1547,19 @@ int aac_command_thread(void *data) | |||
1462 | *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); | 1547 | *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); |
1463 | aac_fib_adapter_complete(fib, (u16)sizeof(u32)); | 1548 | aac_fib_adapter_complete(fib, (u16)sizeof(u32)); |
1464 | } else { | 1549 | } else { |
1465 | struct list_head *entry; | ||
1466 | /* The u32 here is important and intended. We are using | 1550 | /* The u32 here is important and intended. We are using |
1467 | 32bit wrapping time to fit the adapter field */ | 1551 | 32bit wrapping time to fit the adapter field */ |
1468 | 1552 | ||
1469 | u32 time_now, time_last; | 1553 | u32 time_now, time_last; |
1470 | unsigned long flagv; | 1554 | unsigned long flagv; |
1471 | unsigned num; | 1555 | unsigned num; |
1472 | struct hw_fib ** hw_fib_pool, ** hw_fib_p; | 1556 | struct hw_fib ** hw_fib_pool, ** hw_fib_p; |
1473 | struct fib ** fib_pool, ** fib_p; | 1557 | struct fib ** fib_pool, ** fib_p; |
1474 | 1558 | ||
1475 | /* Sniff events */ | 1559 | /* Sniff events */ |
1476 | if ((aifcmd->command == | 1560 | if ((aifcmd->command == |
1477 | cpu_to_le32(AifCmdEventNotify)) || | 1561 | cpu_to_le32(AifCmdEventNotify)) || |
1478 | (aifcmd->command == | 1562 | (aifcmd->command == |
1479 | cpu_to_le32(AifCmdJobProgress))) { | 1563 | cpu_to_le32(AifCmdJobProgress))) { |
1480 | aac_handle_aif(dev, fib); | 1564 | aac_handle_aif(dev, fib); |
1481 | } | 1565 | } |
@@ -1527,7 +1611,7 @@ int aac_command_thread(void *data) | |||
1527 | spin_lock_irqsave(&dev->fib_lock, flagv); | 1611 | spin_lock_irqsave(&dev->fib_lock, flagv); |
1528 | entry = dev->fib_list.next; | 1612 | entry = dev->fib_list.next; |
1529 | /* | 1613 | /* |
1530 | * For each Context that is on the | 1614 | * For each Context that is on the |
1531 | * fibctxList, make a copy of the | 1615 | * fibctxList, make a copy of the |
1532 | * fib, and then set the event to wake up the | 1616 | * fib, and then set the event to wake up the |
1533 | * thread that is waiting for it. | 1617 | * thread that is waiting for it. |
@@ -1552,7 +1636,7 @@ int aac_command_thread(void *data) | |||
1552 | */ | 1636 | */ |
1553 | time_last = fibctx->jiffies; | 1637 | time_last = fibctx->jiffies; |
1554 | /* | 1638 | /* |
1555 | * Has it been > 2 minutes | 1639 | * Has it been > 2 minutes |
1556 | * since the last read off | 1640 | * since the last read off |
1557 | * the queue? | 1641 | * the queue? |
1558 | */ | 1642 | */ |
@@ -1583,7 +1667,7 @@ int aac_command_thread(void *data) | |||
1583 | */ | 1667 | */ |
1584 | list_add_tail(&newfib->fiblink, &fibctx->fib_list); | 1668 | list_add_tail(&newfib->fiblink, &fibctx->fib_list); |
1585 | fibctx->count++; | 1669 | fibctx->count++; |
1586 | /* | 1670 | /* |
1587 | * Set the event to wake up the | 1671 | * Set the event to wake up the |
1588 | * thread that is waiting. | 1672 | * thread that is waiting. |
1589 | */ | 1673 | */ |
@@ -1655,11 +1739,11 @@ int aac_command_thread(void *data) | |||
1655 | struct fib *fibptr; | 1739 | struct fib *fibptr; |
1656 | 1740 | ||
1657 | if ((fibptr = aac_fib_alloc(dev))) { | 1741 | if ((fibptr = aac_fib_alloc(dev))) { |
1658 | u32 * info; | 1742 | __le32 *info; |
1659 | 1743 | ||
1660 | aac_fib_init(fibptr); | 1744 | aac_fib_init(fibptr); |
1661 | 1745 | ||
1662 | info = (u32 *) fib_data(fibptr); | 1746 | info = (__le32 *) fib_data(fibptr); |
1663 | if (now.tv_usec > 500000) | 1747 | if (now.tv_usec > 500000) |
1664 | ++now.tv_sec; | 1748 | ++now.tv_sec; |
1665 | 1749 | ||
diff --git a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c index e6032ffc66a6..d1163ded132b 100644 --- a/drivers/scsi/aacraid/dpcsup.c +++ b/drivers/scsi/aacraid/dpcsup.c | |||
@@ -120,6 +120,7 @@ unsigned int aac_response_normal(struct aac_queue * q) | |||
120 | * NOTE: we cannot touch the fib after this | 120 | * NOTE: we cannot touch the fib after this |
121 | * call, because it may have been deallocated. | 121 | * call, because it may have been deallocated. |
122 | */ | 122 | */ |
123 | fib->flags = 0; | ||
123 | fib->callback(fib->callback_data, fib); | 124 | fib->callback(fib->callback_data, fib); |
124 | } else { | 125 | } else { |
125 | unsigned long flagv; | 126 | unsigned long flagv; |
@@ -229,11 +230,9 @@ unsigned int aac_command_normal(struct aac_queue *q) | |||
229 | * all QE there are and wake up all the waiters before exiting. | 230 | * all QE there are and wake up all the waiters before exiting. |
230 | */ | 231 | */ |
231 | 232 | ||
232 | unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index) | 233 | unsigned int aac_intr_normal(struct aac_dev * dev, u32 index) |
233 | { | 234 | { |
234 | u32 index = le32_to_cpu(Index); | 235 | dprintk((KERN_INFO "aac_intr_normal(%p,%x)\n", dev, index)); |
235 | |||
236 | dprintk((KERN_INFO "aac_intr_normal(%p,%x)\n", dev, Index)); | ||
237 | if ((index & 0x00000002L)) { | 236 | if ((index & 0x00000002L)) { |
238 | struct hw_fib * hw_fib; | 237 | struct hw_fib * hw_fib; |
239 | struct fib * fib; | 238 | struct fib * fib; |
@@ -301,7 +300,7 @@ unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index) | |||
301 | 300 | ||
302 | if (hwfib->header.Command == cpu_to_le16(NuFileSystem)) | 301 | if (hwfib->header.Command == cpu_to_le16(NuFileSystem)) |
303 | { | 302 | { |
304 | u32 *pstatus = (u32 *)hwfib->data; | 303 | __le32 *pstatus = (__le32 *)hwfib->data; |
305 | if (*pstatus & cpu_to_le32(0xffff0000)) | 304 | if (*pstatus & cpu_to_le32(0xffff0000)) |
306 | *pstatus = cpu_to_le32(ST_OK); | 305 | *pstatus = cpu_to_le32(ST_OK); |
307 | } | 306 | } |
@@ -315,6 +314,7 @@ unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index) | |||
315 | * NOTE: we cannot touch the fib after this | 314 | * NOTE: we cannot touch the fib after this |
316 | * call, because it may have been deallocated. | 315 | * call, because it may have been deallocated. |
317 | */ | 316 | */ |
317 | fib->flags = 0; | ||
318 | fib->callback(fib->callback_data, fib); | 318 | fib->callback(fib->callback_data, fib); |
319 | } else { | 319 | } else { |
320 | unsigned long flagv; | 320 | unsigned long flagv; |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 9dd331bc29b0..61be22774e99 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -159,27 +159,27 @@ static struct pci_device_id aac_pci_tbl[] = { | |||
159 | MODULE_DEVICE_TABLE(pci, aac_pci_tbl); | 159 | MODULE_DEVICE_TABLE(pci, aac_pci_tbl); |
160 | 160 | ||
161 | /* | 161 | /* |
162 | * dmb - For now we add the number of channels to this structure. | 162 | * dmb - For now we add the number of channels to this structure. |
163 | * In the future we should add a fib that reports the number of channels | 163 | * In the future we should add a fib that reports the number of channels |
164 | * for the card. At that time we can remove the channels from here | 164 | * for the card. At that time we can remove the channels from here |
165 | */ | 165 | */ |
166 | static struct aac_driver_ident aac_drivers[] = { | 166 | static struct aac_driver_ident aac_drivers[] = { |
167 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* PERC 2/Si (Iguana/PERC2Si) */ | 167 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* PERC 2/Si (Iguana/PERC2Si) */ |
168 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* PERC 3/Di (Opal/PERC3Di) */ | 168 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* PERC 3/Di (Opal/PERC3Di) */ |
169 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* PERC 3/Si (SlimFast/PERC3Si */ | 169 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* PERC 3/Si (SlimFast/PERC3Si */ |
170 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* PERC 3/Di (Iguana FlipChip/PERC3DiF */ | 170 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* PERC 3/Di (Iguana FlipChip/PERC3DiF */ |
171 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* PERC 3/Di (Viper/PERC3DiV) */ | 171 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* PERC 3/Di (Viper/PERC3DiV) */ |
172 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* PERC 3/Di (Lexus/PERC3DiL) */ | 172 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* PERC 3/Di (Lexus/PERC3DiL) */ |
173 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 1, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* PERC 3/Di (Jaguar/PERC3DiJ) */ | 173 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 1, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* PERC 3/Di (Jaguar/PERC3DiJ) */ |
174 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* PERC 3/Di (Dagger/PERC3DiD) */ | 174 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* PERC 3/Di (Dagger/PERC3DiD) */ |
175 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* PERC 3/Di (Boxster/PERC3DiB) */ | 175 | { aac_rx_init, "percraid", "DELL ", "PERCRAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* PERC 3/Di (Boxster/PERC3DiB) */ |
176 | { aac_rx_init, "aacraid", "ADAPTEC ", "catapult ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* catapult */ | 176 | { aac_rx_init, "aacraid", "ADAPTEC ", "catapult ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* catapult */ |
177 | { aac_rx_init, "aacraid", "ADAPTEC ", "tomcat ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* tomcat */ | 177 | { aac_rx_init, "aacraid", "ADAPTEC ", "tomcat ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* tomcat */ |
178 | { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 2120S ", 1, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* Adaptec 2120S (Crusader) */ | 178 | { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 2120S ", 1, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Adaptec 2120S (Crusader) */ |
179 | { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 2200S ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* Adaptec 2200S (Vulcan) */ | 179 | { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 2200S ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Adaptec 2200S (Vulcan) */ |
180 | { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 2200S ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* Adaptec 2200S (Vulcan-2m) */ | 180 | { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 2200S ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Adaptec 2200S (Vulcan-2m) */ |
181 | { aac_rx_init, "aacraid", "Legend ", "Legend S220 ", 1, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* Legend S220 (Legend Crusader) */ | 181 | { aac_rx_init, "aacraid", "Legend ", "Legend S220 ", 1, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Legend S220 (Legend Crusader) */ |
182 | { aac_rx_init, "aacraid", "Legend ", "Legend S230 ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* Legend S230 (Legend Vulcan) */ | 182 | { aac_rx_init, "aacraid", "Legend ", "Legend S230 ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Legend S230 (Legend Vulcan) */ |
183 | 183 | ||
184 | { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 3230S ", 2 }, /* Adaptec 3230S (Harrier) */ | 184 | { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 3230S ", 2 }, /* Adaptec 3230S (Harrier) */ |
185 | { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 3240S ", 2 }, /* Adaptec 3240S (Tornado) */ | 185 | { aac_rx_init, "aacraid", "ADAPTEC ", "Adaptec 3240S ", 2 }, /* Adaptec 3240S (Tornado) */ |
@@ -224,8 +224,8 @@ static struct aac_driver_ident aac_drivers[] = { | |||
224 | { aac_sa_init, "percraid", "DELL ", "PERCRAID ", 4, AAC_QUIRK_34SG }, /* Dell PERC2/QC */ | 224 | { aac_sa_init, "percraid", "DELL ", "PERCRAID ", 4, AAC_QUIRK_34SG }, /* Dell PERC2/QC */ |
225 | { aac_sa_init, "hpnraid", "HP ", "NetRAID ", 4, AAC_QUIRK_34SG }, /* HP NetRAID-4M */ | 225 | { aac_sa_init, "hpnraid", "HP ", "NetRAID ", 4, AAC_QUIRK_34SG }, /* HP NetRAID-4M */ |
226 | 226 | ||
227 | { aac_rx_init, "aacraid", "DELL ", "RAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* Dell Catchall */ | 227 | { aac_rx_init, "aacraid", "DELL ", "RAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Dell Catchall */ |
228 | { aac_rx_init, "aacraid", "Legend ", "RAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* Legend Catchall */ | 228 | { aac_rx_init, "aacraid", "Legend ", "RAID ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Legend Catchall */ |
229 | { aac_rx_init, "aacraid", "ADAPTEC ", "RAID ", 2 }, /* Adaptec Catch All */ | 229 | { aac_rx_init, "aacraid", "ADAPTEC ", "RAID ", 2 }, /* Adaptec Catch All */ |
230 | { aac_rkt_init, "aacraid", "ADAPTEC ", "RAID ", 2 }, /* Adaptec Rocket Catch All */ | 230 | { aac_rkt_init, "aacraid", "ADAPTEC ", "RAID ", 2 }, /* Adaptec Rocket Catch All */ |
231 | { aac_nark_init, "aacraid", "ADAPTEC ", "RAID ", 2 } /* Adaptec NEMER/ARK Catch All */ | 231 | { aac_nark_init, "aacraid", "ADAPTEC ", "RAID ", 2 } /* Adaptec NEMER/ARK Catch All */ |
@@ -239,7 +239,7 @@ static struct aac_driver_ident aac_drivers[] = { | |||
239 | * Queues a command for execution by the associated Host Adapter. | 239 | * Queues a command for execution by the associated Host Adapter. |
240 | * | 240 | * |
241 | * TODO: unify with aac_scsi_cmd(). | 241 | * TODO: unify with aac_scsi_cmd(). |
242 | */ | 242 | */ |
243 | 243 | ||
244 | static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 244 | static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
245 | { | 245 | { |
@@ -258,7 +258,7 @@ static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd | |||
258 | } | 258 | } |
259 | cmd->SCp.phase = AAC_OWNER_LOWLEVEL; | 259 | cmd->SCp.phase = AAC_OWNER_LOWLEVEL; |
260 | return (aac_scsi_cmd(cmd) ? FAILED : 0); | 260 | return (aac_scsi_cmd(cmd) ? FAILED : 0); |
261 | } | 261 | } |
262 | 262 | ||
263 | /** | 263 | /** |
264 | * aac_info - Returns the host adapter name | 264 | * aac_info - Returns the host adapter name |
@@ -292,21 +292,21 @@ struct aac_driver_ident* aac_get_driver_ident(int devtype) | |||
292 | * @capacity: the sector capacity of the disk | 292 | * @capacity: the sector capacity of the disk |
293 | * @geom: geometry block to fill in | 293 | * @geom: geometry block to fill in |
294 | * | 294 | * |
295 | * Return the Heads/Sectors/Cylinders BIOS Disk Parameters for Disk. | 295 | * Return the Heads/Sectors/Cylinders BIOS Disk Parameters for Disk. |
296 | * The default disk geometry is 64 heads, 32 sectors, and the appropriate | 296 | * The default disk geometry is 64 heads, 32 sectors, and the appropriate |
297 | * number of cylinders so as not to exceed drive capacity. In order for | 297 | * number of cylinders so as not to exceed drive capacity. In order for |
298 | * disks equal to or larger than 1 GB to be addressable by the BIOS | 298 | * disks equal to or larger than 1 GB to be addressable by the BIOS |
299 | * without exceeding the BIOS limitation of 1024 cylinders, Extended | 299 | * without exceeding the BIOS limitation of 1024 cylinders, Extended |
300 | * Translation should be enabled. With Extended Translation enabled, | 300 | * Translation should be enabled. With Extended Translation enabled, |
301 | * drives between 1 GB inclusive and 2 GB exclusive are given a disk | 301 | * drives between 1 GB inclusive and 2 GB exclusive are given a disk |
302 | * geometry of 128 heads and 32 sectors, and drives above 2 GB inclusive | 302 | * geometry of 128 heads and 32 sectors, and drives above 2 GB inclusive |
303 | * are given a disk geometry of 255 heads and 63 sectors. However, if | 303 | * are given a disk geometry of 255 heads and 63 sectors. However, if |
304 | * the BIOS detects that the Extended Translation setting does not match | 304 | * the BIOS detects that the Extended Translation setting does not match |
305 | * the geometry in the partition table, then the translation inferred | 305 | * the geometry in the partition table, then the translation inferred |
306 | * from the partition table will be used by the BIOS, and a warning may | 306 | * from the partition table will be used by the BIOS, and a warning may |
307 | * be displayed. | 307 | * be displayed. |
308 | */ | 308 | */ |
309 | 309 | ||
310 | static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev, | 310 | static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev, |
311 | sector_t capacity, int *geom) | 311 | sector_t capacity, int *geom) |
312 | { | 312 | { |
@@ -333,10 +333,10 @@ static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev, | |||
333 | 333 | ||
334 | param->cylinders = cap_to_cyls(capacity, param->heads * param->sectors); | 334 | param->cylinders = cap_to_cyls(capacity, param->heads * param->sectors); |
335 | 335 | ||
336 | /* | 336 | /* |
337 | * Read the first 1024 bytes from the disk device, if the boot | 337 | * Read the first 1024 bytes from the disk device, if the boot |
338 | * sector partition table is valid, search for a partition table | 338 | * sector partition table is valid, search for a partition table |
339 | * entry whose end_head matches one of the standard geometry | 339 | * entry whose end_head matches one of the standard geometry |
340 | * translations ( 64/32, 128/32, 255/63 ). | 340 | * translations ( 64/32, 128/32, 255/63 ). |
341 | */ | 341 | */ |
342 | buf = scsi_bios_ptable(bdev); | 342 | buf = scsi_bios_ptable(bdev); |
@@ -401,30 +401,44 @@ static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev, | |||
401 | 401 | ||
402 | static int aac_slave_configure(struct scsi_device *sdev) | 402 | static int aac_slave_configure(struct scsi_device *sdev) |
403 | { | 403 | { |
404 | struct aac_dev *aac = (struct aac_dev *)sdev->host->hostdata; | ||
404 | if ((sdev->type == TYPE_DISK) && | 405 | if ((sdev->type == TYPE_DISK) && |
405 | (sdev_channel(sdev) != CONTAINER_CHANNEL)) { | 406 | (sdev_channel(sdev) != CONTAINER_CHANNEL) && |
407 | (!aac->jbod || sdev->inq_periph_qual) && | ||
408 | (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2))) { | ||
406 | if (expose_physicals == 0) | 409 | if (expose_physicals == 0) |
407 | return -ENXIO; | 410 | return -ENXIO; |
408 | if (expose_physicals < 0) { | 411 | if (expose_physicals < 0) |
409 | struct aac_dev *aac = | 412 | sdev->no_uld_attach = 1; |
410 | (struct aac_dev *)sdev->host->hostdata; | ||
411 | if (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2)) | ||
412 | sdev->no_uld_attach = 1; | ||
413 | } | ||
414 | } | 413 | } |
415 | if (sdev->tagged_supported && (sdev->type == TYPE_DISK) && | 414 | if (sdev->tagged_supported && (sdev->type == TYPE_DISK) && |
416 | (sdev_channel(sdev) == CONTAINER_CHANNEL)) { | 415 | (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2)) && |
416 | !sdev->no_uld_attach) { | ||
417 | struct scsi_device * dev; | 417 | struct scsi_device * dev; |
418 | struct Scsi_Host *host = sdev->host; | 418 | struct Scsi_Host *host = sdev->host; |
419 | unsigned num_lsu = 0; | 419 | unsigned num_lsu = 0; |
420 | unsigned num_one = 0; | 420 | unsigned num_one = 0; |
421 | unsigned depth; | 421 | unsigned depth; |
422 | unsigned cid; | ||
422 | 423 | ||
424 | /* | ||
425 | * Firmware has an individual device recovery time typically | ||
426 | * of 35 seconds, give us a margin. | ||
427 | */ | ||
428 | if (sdev->timeout < (45 * HZ)) | ||
429 | sdev->timeout = 45 * HZ; | ||
430 | for (cid = 0; cid < aac->maximum_num_containers; ++cid) | ||
431 | if (aac->fsa_dev[cid].valid) | ||
432 | ++num_lsu; | ||
423 | __shost_for_each_device(dev, host) { | 433 | __shost_for_each_device(dev, host) { |
424 | if (dev->tagged_supported && (dev->type == TYPE_DISK) && | 434 | if (dev->tagged_supported && (dev->type == TYPE_DISK) && |
425 | (sdev_channel(dev) == CONTAINER_CHANNEL)) | 435 | (!aac->raid_scsi_mode || |
426 | ++num_lsu; | 436 | (sdev_channel(sdev) != 2)) && |
427 | else | 437 | !dev->no_uld_attach) { |
438 | if ((sdev_channel(dev) != CONTAINER_CHANNEL) | ||
439 | || !aac->fsa_dev[sdev_id(dev)].valid) | ||
440 | ++num_lsu; | ||
441 | } else | ||
428 | ++num_one; | 442 | ++num_one; |
429 | } | 443 | } |
430 | if (num_lsu == 0) | 444 | if (num_lsu == 0) |
@@ -481,9 +495,35 @@ static int aac_change_queue_depth(struct scsi_device *sdev, int depth) | |||
481 | return sdev->queue_depth; | 495 | return sdev->queue_depth; |
482 | } | 496 | } |
483 | 497 | ||
498 | static ssize_t aac_show_raid_level(struct device *dev, struct device_attribute *attr, char *buf) | ||
499 | { | ||
500 | struct scsi_device * sdev = to_scsi_device(dev); | ||
501 | if (sdev_channel(sdev) != CONTAINER_CHANNEL) | ||
502 | return snprintf(buf, PAGE_SIZE, sdev->no_uld_attach | ||
503 | ? "Hidden\n" : "JBOD"); | ||
504 | return snprintf(buf, PAGE_SIZE, "%s\n", | ||
505 | get_container_type(((struct aac_dev *)(sdev->host->hostdata)) | ||
506 | ->fsa_dev[sdev_id(sdev)].type)); | ||
507 | } | ||
508 | |||
509 | static struct device_attribute aac_raid_level_attr = { | ||
510 | .attr = { | ||
511 | .name = "level", | ||
512 | .mode = S_IRUGO, | ||
513 | }, | ||
514 | .show = aac_show_raid_level | ||
515 | }; | ||
516 | |||
517 | static struct device_attribute *aac_dev_attrs[] = { | ||
518 | &aac_raid_level_attr, | ||
519 | NULL, | ||
520 | }; | ||
521 | |||
484 | static int aac_ioctl(struct scsi_device *sdev, int cmd, void __user * arg) | 522 | static int aac_ioctl(struct scsi_device *sdev, int cmd, void __user * arg) |
485 | { | 523 | { |
486 | struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; | 524 | struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; |
525 | if (!capable(CAP_SYS_RAWIO)) | ||
526 | return -EPERM; | ||
487 | return aac_do_ioctl(dev, cmd, arg); | 527 | return aac_do_ioctl(dev, cmd, arg); |
488 | } | 528 | } |
489 | 529 | ||
@@ -506,17 +546,33 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) | |||
506 | break; | 546 | break; |
507 | case INQUIRY: | 547 | case INQUIRY: |
508 | case READ_CAPACITY: | 548 | case READ_CAPACITY: |
509 | case TEST_UNIT_READY: | ||
510 | /* Mark associated FIB to not complete, eh handler does this */ | 549 | /* Mark associated FIB to not complete, eh handler does this */ |
511 | for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) { | 550 | for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) { |
512 | struct fib * fib = &aac->fibs[count]; | 551 | struct fib * fib = &aac->fibs[count]; |
513 | if (fib->hw_fib_va->header.XferState && | 552 | if (fib->hw_fib_va->header.XferState && |
553 | (fib->flags & FIB_CONTEXT_FLAG) && | ||
514 | (fib->callback_data == cmd)) { | 554 | (fib->callback_data == cmd)) { |
515 | fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT; | 555 | fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT; |
516 | cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER; | 556 | cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER; |
517 | ret = SUCCESS; | 557 | ret = SUCCESS; |
518 | } | 558 | } |
519 | } | 559 | } |
560 | break; | ||
561 | case TEST_UNIT_READY: | ||
562 | /* Mark associated FIB to not complete, eh handler does this */ | ||
563 | for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) { | ||
564 | struct scsi_cmnd * command; | ||
565 | struct fib * fib = &aac->fibs[count]; | ||
566 | if ((fib->hw_fib_va->header.XferState & cpu_to_le32(Async | NoResponseExpected)) && | ||
567 | (fib->flags & FIB_CONTEXT_FLAG) && | ||
568 | ((command = fib->callback_data)) && | ||
569 | (command->device == cmd->device)) { | ||
570 | fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT; | ||
571 | command->SCp.phase = AAC_OWNER_ERROR_HANDLER; | ||
572 | if (command == cmd) | ||
573 | ret = SUCCESS; | ||
574 | } | ||
575 | } | ||
520 | } | 576 | } |
521 | return ret; | 577 | return ret; |
522 | } | 578 | } |
@@ -539,12 +595,13 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) | |||
539 | for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) { | 595 | for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) { |
540 | struct fib * fib = &aac->fibs[count]; | 596 | struct fib * fib = &aac->fibs[count]; |
541 | if (fib->hw_fib_va->header.XferState && | 597 | if (fib->hw_fib_va->header.XferState && |
598 | (fib->flags & FIB_CONTEXT_FLAG) && | ||
542 | (fib->callback_data == cmd)) { | 599 | (fib->callback_data == cmd)) { |
543 | fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT; | 600 | fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT; |
544 | cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER; | 601 | cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER; |
545 | } | 602 | } |
546 | } | 603 | } |
547 | printk(KERN_ERR "%s: Host adapter reset request. SCSI hang ?\n", | 604 | printk(KERN_ERR "%s: Host adapter reset request. SCSI hang ?\n", |
548 | AAC_DRIVERNAME); | 605 | AAC_DRIVERNAME); |
549 | 606 | ||
550 | if ((count = aac_check_health(aac))) | 607 | if ((count = aac_check_health(aac))) |
@@ -584,8 +641,11 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) | |||
584 | * support a register, instead of a commanded, reset. | 641 | * support a register, instead of a commanded, reset. |
585 | */ | 642 | */ |
586 | if ((aac->supplement_adapter_info.SupportedOptions2 & | 643 | if ((aac->supplement_adapter_info.SupportedOptions2 & |
587 | le32_to_cpu(AAC_OPTION_MU_RESET|AAC_OPTION_IGNORE_RESET)) == | 644 | AAC_OPTION_MU_RESET) && |
588 | le32_to_cpu(AAC_OPTION_MU_RESET)) | 645 | aac_check_reset && |
646 | ((aac_check_reset != 1) || | ||
647 | (aac->supplement_adapter_info.SupportedOptions2 & | ||
648 | AAC_OPTION_IGNORE_RESET))) | ||
589 | aac_reset_adapter(aac, 2); /* Bypass wait for command quiesce */ | 649 | aac_reset_adapter(aac, 2); /* Bypass wait for command quiesce */ |
590 | return SUCCESS; /* Cause an immediate retry of the command with a ten second delay after successful tur */ | 650 | return SUCCESS; /* Cause an immediate retry of the command with a ten second delay after successful tur */ |
591 | } | 651 | } |
@@ -632,8 +692,8 @@ static int aac_cfg_open(struct inode *inode, struct file *file) | |||
632 | * Bugs: Needs locking against parallel ioctls lower down | 692 | * Bugs: Needs locking against parallel ioctls lower down |
633 | * Bugs: Needs to handle hot plugging | 693 | * Bugs: Needs to handle hot plugging |
634 | */ | 694 | */ |
635 | 695 | ||
636 | static int aac_cfg_ioctl(struct inode *inode, struct file *file, | 696 | static int aac_cfg_ioctl(struct inode *inode, struct file *file, |
637 | unsigned int cmd, unsigned long arg) | 697 | unsigned int cmd, unsigned long arg) |
638 | { | 698 | { |
639 | if (!capable(CAP_SYS_RAWIO)) | 699 | if (!capable(CAP_SYS_RAWIO)) |
@@ -646,7 +706,7 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long | |||
646 | { | 706 | { |
647 | long ret; | 707 | long ret; |
648 | lock_kernel(); | 708 | lock_kernel(); |
649 | switch (cmd) { | 709 | switch (cmd) { |
650 | case FSACTL_MINIPORT_REV_CHECK: | 710 | case FSACTL_MINIPORT_REV_CHECK: |
651 | case FSACTL_SENDFIB: | 711 | case FSACTL_SENDFIB: |
652 | case FSACTL_OPEN_GET_ADAPTER_FIB: | 712 | case FSACTL_OPEN_GET_ADAPTER_FIB: |
@@ -656,14 +716,14 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long | |||
656 | case FSACTL_QUERY_DISK: | 716 | case FSACTL_QUERY_DISK: |
657 | case FSACTL_DELETE_DISK: | 717 | case FSACTL_DELETE_DISK: |
658 | case FSACTL_FORCE_DELETE_DISK: | 718 | case FSACTL_FORCE_DELETE_DISK: |
659 | case FSACTL_GET_CONTAINERS: | 719 | case FSACTL_GET_CONTAINERS: |
660 | case FSACTL_SEND_LARGE_FIB: | 720 | case FSACTL_SEND_LARGE_FIB: |
661 | ret = aac_do_ioctl(dev, cmd, (void __user *)arg); | 721 | ret = aac_do_ioctl(dev, cmd, (void __user *)arg); |
662 | break; | 722 | break; |
663 | 723 | ||
664 | case FSACTL_GET_NEXT_ADAPTER_FIB: { | 724 | case FSACTL_GET_NEXT_ADAPTER_FIB: { |
665 | struct fib_ioctl __user *f; | 725 | struct fib_ioctl __user *f; |
666 | 726 | ||
667 | f = compat_alloc_user_space(sizeof(*f)); | 727 | f = compat_alloc_user_space(sizeof(*f)); |
668 | ret = 0; | 728 | ret = 0; |
669 | if (clear_user(f, sizeof(*f))) | 729 | if (clear_user(f, sizeof(*f))) |
@@ -676,9 +736,9 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long | |||
676 | } | 736 | } |
677 | 737 | ||
678 | default: | 738 | default: |
679 | ret = -ENOIOCTLCMD; | 739 | ret = -ENOIOCTLCMD; |
680 | break; | 740 | break; |
681 | } | 741 | } |
682 | unlock_kernel(); | 742 | unlock_kernel(); |
683 | return ret; | 743 | return ret; |
684 | } | 744 | } |
@@ -735,6 +795,25 @@ static ssize_t aac_show_vendor(struct class_device *class_dev, | |||
735 | return len; | 795 | return len; |
736 | } | 796 | } |
737 | 797 | ||
798 | static ssize_t aac_show_flags(struct class_device *class_dev, char *buf) | ||
799 | { | ||
800 | int len = 0; | ||
801 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | ||
802 | |||
803 | if (nblank(dprintk(x))) | ||
804 | len = snprintf(buf, PAGE_SIZE, "dprintk\n"); | ||
805 | #ifdef AAC_DETAILED_STATUS_INFO | ||
806 | len += snprintf(buf + len, PAGE_SIZE - len, | ||
807 | "AAC_DETAILED_STATUS_INFO\n"); | ||
808 | #endif | ||
809 | if (dev->raw_io_interface && dev->raw_io_64) | ||
810 | len += snprintf(buf + len, PAGE_SIZE - len, | ||
811 | "SAI_READ_CAPACITY_16\n"); | ||
812 | if (dev->jbod) | ||
813 | len += snprintf(buf + len, PAGE_SIZE - len, "SUPPORTED_JBOD\n"); | ||
814 | return len; | ||
815 | } | ||
816 | |||
738 | static ssize_t aac_show_kernel_version(struct class_device *class_dev, | 817 | static ssize_t aac_show_kernel_version(struct class_device *class_dev, |
739 | char *buf) | 818 | char *buf) |
740 | { | 819 | { |
@@ -742,7 +821,7 @@ static ssize_t aac_show_kernel_version(struct class_device *class_dev, | |||
742 | int len, tmp; | 821 | int len, tmp; |
743 | 822 | ||
744 | tmp = le32_to_cpu(dev->adapter_info.kernelrev); | 823 | tmp = le32_to_cpu(dev->adapter_info.kernelrev); |
745 | len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", | 824 | len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", |
746 | tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, | 825 | tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, |
747 | le32_to_cpu(dev->adapter_info.kernelbuild)); | 826 | le32_to_cpu(dev->adapter_info.kernelbuild)); |
748 | return len; | 827 | return len; |
@@ -755,7 +834,7 @@ static ssize_t aac_show_monitor_version(struct class_device *class_dev, | |||
755 | int len, tmp; | 834 | int len, tmp; |
756 | 835 | ||
757 | tmp = le32_to_cpu(dev->adapter_info.monitorrev); | 836 | tmp = le32_to_cpu(dev->adapter_info.monitorrev); |
758 | len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", | 837 | len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", |
759 | tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, | 838 | tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, |
760 | le32_to_cpu(dev->adapter_info.monitorbuild)); | 839 | le32_to_cpu(dev->adapter_info.monitorbuild)); |
761 | return len; | 840 | return len; |
@@ -768,7 +847,7 @@ static ssize_t aac_show_bios_version(struct class_device *class_dev, | |||
768 | int len, tmp; | 847 | int len, tmp; |
769 | 848 | ||
770 | tmp = le32_to_cpu(dev->adapter_info.biosrev); | 849 | tmp = le32_to_cpu(dev->adapter_info.biosrev); |
771 | len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", | 850 | len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", |
772 | tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, | 851 | tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, |
773 | le32_to_cpu(dev->adapter_info.biosbuild)); | 852 | le32_to_cpu(dev->adapter_info.biosbuild)); |
774 | return len; | 853 | return len; |
@@ -844,6 +923,13 @@ static struct class_device_attribute aac_vendor = { | |||
844 | }, | 923 | }, |
845 | .show = aac_show_vendor, | 924 | .show = aac_show_vendor, |
846 | }; | 925 | }; |
926 | static struct class_device_attribute aac_flags = { | ||
927 | .attr = { | ||
928 | .name = "flags", | ||
929 | .mode = S_IRUGO, | ||
930 | }, | ||
931 | .show = aac_show_flags, | ||
932 | }; | ||
847 | static struct class_device_attribute aac_kernel_version = { | 933 | static struct class_device_attribute aac_kernel_version = { |
848 | .attr = { | 934 | .attr = { |
849 | .name = "hba_kernel_version", | 935 | .name = "hba_kernel_version", |
@@ -898,6 +984,7 @@ static struct class_device_attribute aac_reset = { | |||
898 | static struct class_device_attribute *aac_attrs[] = { | 984 | static struct class_device_attribute *aac_attrs[] = { |
899 | &aac_model, | 985 | &aac_model, |
900 | &aac_vendor, | 986 | &aac_vendor, |
987 | &aac_flags, | ||
901 | &aac_kernel_version, | 988 | &aac_kernel_version, |
902 | &aac_monitor_version, | 989 | &aac_monitor_version, |
903 | &aac_bios_version, | 990 | &aac_bios_version, |
@@ -928,21 +1015,22 @@ static struct scsi_host_template aac_driver_template = { | |||
928 | .compat_ioctl = aac_compat_ioctl, | 1015 | .compat_ioctl = aac_compat_ioctl, |
929 | #endif | 1016 | #endif |
930 | .queuecommand = aac_queuecommand, | 1017 | .queuecommand = aac_queuecommand, |
931 | .bios_param = aac_biosparm, | 1018 | .bios_param = aac_biosparm, |
932 | .shost_attrs = aac_attrs, | 1019 | .shost_attrs = aac_attrs, |
933 | .slave_configure = aac_slave_configure, | 1020 | .slave_configure = aac_slave_configure, |
934 | .change_queue_depth = aac_change_queue_depth, | 1021 | .change_queue_depth = aac_change_queue_depth, |
1022 | .sdev_attrs = aac_dev_attrs, | ||
935 | .eh_abort_handler = aac_eh_abort, | 1023 | .eh_abort_handler = aac_eh_abort, |
936 | .eh_host_reset_handler = aac_eh_reset, | 1024 | .eh_host_reset_handler = aac_eh_reset, |
937 | .can_queue = AAC_NUM_IO_FIB, | 1025 | .can_queue = AAC_NUM_IO_FIB, |
938 | .this_id = MAXIMUM_NUM_CONTAINERS, | 1026 | .this_id = MAXIMUM_NUM_CONTAINERS, |
939 | .sg_tablesize = 16, | 1027 | .sg_tablesize = 16, |
940 | .max_sectors = 128, | 1028 | .max_sectors = 128, |
941 | #if (AAC_NUM_IO_FIB > 256) | 1029 | #if (AAC_NUM_IO_FIB > 256) |
942 | .cmd_per_lun = 256, | 1030 | .cmd_per_lun = 256, |
943 | #else | 1031 | #else |
944 | .cmd_per_lun = AAC_NUM_IO_FIB, | 1032 | .cmd_per_lun = AAC_NUM_IO_FIB, |
945 | #endif | 1033 | #endif |
946 | .use_clustering = ENABLE_CLUSTERING, | 1034 | .use_clustering = ENABLE_CLUSTERING, |
947 | .use_sg_chaining = ENABLE_SG_CHAINING, | 1035 | .use_sg_chaining = ENABLE_SG_CHAINING, |
948 | .emulated = 1, | 1036 | .emulated = 1, |
@@ -979,18 +1067,18 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
979 | goto out; | 1067 | goto out; |
980 | error = -ENODEV; | 1068 | error = -ENODEV; |
981 | 1069 | ||
982 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || | 1070 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || |
983 | pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) | 1071 | pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) |
984 | goto out_disable_pdev; | 1072 | goto out_disable_pdev; |
985 | /* | 1073 | /* |
986 | * If the quirk31 bit is set, the adapter needs adapter | 1074 | * If the quirk31 bit is set, the adapter needs adapter |
987 | * to driver communication memory to be allocated below 2gig | 1075 | * to driver communication memory to be allocated below 2gig |
988 | */ | 1076 | */ |
989 | if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) | 1077 | if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) |
990 | if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) || | 1078 | if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) || |
991 | pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK)) | 1079 | pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK)) |
992 | goto out_disable_pdev; | 1080 | goto out_disable_pdev; |
993 | 1081 | ||
994 | pci_set_master(pdev); | 1082 | pci_set_master(pdev); |
995 | 1083 | ||
996 | shost = scsi_host_alloc(&aac_driver_template, sizeof(struct aac_dev)); | 1084 | shost = scsi_host_alloc(&aac_driver_template, sizeof(struct aac_dev)); |
@@ -1003,7 +1091,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
1003 | shost->max_cmd_len = 16; | 1091 | shost->max_cmd_len = 16; |
1004 | 1092 | ||
1005 | aac = (struct aac_dev *)shost->hostdata; | 1093 | aac = (struct aac_dev *)shost->hostdata; |
1006 | aac->scsi_host_ptr = shost; | 1094 | aac->scsi_host_ptr = shost; |
1007 | aac->pdev = pdev; | 1095 | aac->pdev = pdev; |
1008 | aac->name = aac_driver_template.name; | 1096 | aac->name = aac_driver_template.name; |
1009 | aac->id = shost->unique_id; | 1097 | aac->id = shost->unique_id; |
@@ -1040,7 +1128,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
1040 | if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) | 1128 | if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) |
1041 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) | 1129 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) |
1042 | goto out_deinit; | 1130 | goto out_deinit; |
1043 | 1131 | ||
1044 | aac->maximum_num_channels = aac_drivers[index].channels; | 1132 | aac->maximum_num_channels = aac_drivers[index].channels; |
1045 | error = aac_get_adapter_info(aac); | 1133 | error = aac_get_adapter_info(aac); |
1046 | if (error < 0) | 1134 | if (error < 0) |
@@ -1049,7 +1137,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
1049 | /* | 1137 | /* |
1050 | * Lets override negotiations and drop the maximum SG limit to 34 | 1138 | * Lets override negotiations and drop the maximum SG limit to 34 |
1051 | */ | 1139 | */ |
1052 | if ((aac_drivers[index].quirks & AAC_QUIRK_34SG) && | 1140 | if ((aac_drivers[index].quirks & AAC_QUIRK_34SG) && |
1053 | (aac->scsi_host_ptr->sg_tablesize > 34)) { | 1141 | (aac->scsi_host_ptr->sg_tablesize > 34)) { |
1054 | aac->scsi_host_ptr->sg_tablesize = 34; | 1142 | aac->scsi_host_ptr->sg_tablesize = 34; |
1055 | aac->scsi_host_ptr->max_sectors | 1143 | aac->scsi_host_ptr->max_sectors |
@@ -1066,17 +1154,17 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
1066 | /* | 1154 | /* |
1067 | * Firware printf works only with older firmware. | 1155 | * Firware printf works only with older firmware. |
1068 | */ | 1156 | */ |
1069 | if (aac_drivers[index].quirks & AAC_QUIRK_34SG) | 1157 | if (aac_drivers[index].quirks & AAC_QUIRK_34SG) |
1070 | aac->printf_enabled = 1; | 1158 | aac->printf_enabled = 1; |
1071 | else | 1159 | else |
1072 | aac->printf_enabled = 0; | 1160 | aac->printf_enabled = 0; |
1073 | 1161 | ||
1074 | /* | 1162 | /* |
1075 | * max channel will be the physical channels plus 1 virtual channel | 1163 | * max channel will be the physical channels plus 1 virtual channel |
1076 | * all containers are on the virtual channel 0 (CONTAINER_CHANNEL) | 1164 | * all containers are on the virtual channel 0 (CONTAINER_CHANNEL) |
1077 | * physical channels are address by their actual physical number+1 | 1165 | * physical channels are address by their actual physical number+1 |
1078 | */ | 1166 | */ |
1079 | if ((aac->nondasd_support == 1) || expose_physicals) | 1167 | if (aac->nondasd_support || expose_physicals || aac->jbod) |
1080 | shost->max_channel = aac->maximum_num_channels; | 1168 | shost->max_channel = aac->maximum_num_channels; |
1081 | else | 1169 | else |
1082 | shost->max_channel = 0; | 1170 | shost->max_channel = 0; |
@@ -1148,10 +1236,10 @@ static void __devexit aac_remove_one(struct pci_dev *pdev) | |||
1148 | kfree(aac->queues); | 1236 | kfree(aac->queues); |
1149 | 1237 | ||
1150 | aac_adapter_ioremap(aac, 0); | 1238 | aac_adapter_ioremap(aac, 0); |
1151 | 1239 | ||
1152 | kfree(aac->fibs); | 1240 | kfree(aac->fibs); |
1153 | kfree(aac->fsa_dev); | 1241 | kfree(aac->fsa_dev); |
1154 | 1242 | ||
1155 | list_del(&aac->entry); | 1243 | list_del(&aac->entry); |
1156 | scsi_host_put(shost); | 1244 | scsi_host_put(shost); |
1157 | pci_disable_device(pdev); | 1245 | pci_disable_device(pdev); |
@@ -1172,7 +1260,7 @@ static struct pci_driver aac_pci_driver = { | |||
1172 | static int __init aac_init(void) | 1260 | static int __init aac_init(void) |
1173 | { | 1261 | { |
1174 | int error; | 1262 | int error; |
1175 | 1263 | ||
1176 | printk(KERN_INFO "Adaptec %s driver %s\n", | 1264 | printk(KERN_INFO "Adaptec %s driver %s\n", |
1177 | AAC_DRIVERNAME, aac_driver_version); | 1265 | AAC_DRIVERNAME, aac_driver_version); |
1178 | 1266 | ||
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c index 73eef3dc5dc6..a08bbf1fd76c 100644 --- a/drivers/scsi/aacraid/rx.c +++ b/drivers/scsi/aacraid/rx.c | |||
@@ -465,7 +465,7 @@ static int aac_rx_restart_adapter(struct aac_dev *dev, int bled) | |||
465 | u32 var; | 465 | u32 var; |
466 | 466 | ||
467 | if (!(dev->supplement_adapter_info.SupportedOptions2 & | 467 | if (!(dev->supplement_adapter_info.SupportedOptions2 & |
468 | le32_to_cpu(AAC_OPTION_MU_RESET)) || (bled >= 0) || (bled == -2)) { | 468 | AAC_OPTION_MU_RESET) || (bled >= 0) || (bled == -2)) { |
469 | if (bled) | 469 | if (bled) |
470 | printk(KERN_ERR "%s%d: adapter kernel panic'd %x.\n", | 470 | printk(KERN_ERR "%s%d: adapter kernel panic'd %x.\n", |
471 | dev->name, dev->id, bled); | 471 | dev->name, dev->id, bled); |
@@ -549,7 +549,9 @@ int _aac_rx_init(struct aac_dev *dev) | |||
549 | dev->OIMR = status = rx_readb (dev, MUnit.OIMR); | 549 | dev->OIMR = status = rx_readb (dev, MUnit.OIMR); |
550 | if ((((status & 0x0c) != 0x0c) || aac_reset_devices || reset_devices) && | 550 | if ((((status & 0x0c) != 0x0c) || aac_reset_devices || reset_devices) && |
551 | !aac_rx_restart_adapter(dev, 0)) | 551 | !aac_rx_restart_adapter(dev, 0)) |
552 | ++restart; | 552 | /* Make sure the Hardware FIFO is empty */ |
553 | while ((++restart < 512) && | ||
554 | (rx_readl(dev, MUnit.OutboundQueue) != 0xFFFFFFFFL)); | ||
553 | /* | 555 | /* |
554 | * Check to see if the board panic'd while booting. | 556 | * Check to see if the board panic'd while booting. |
555 | */ | 557 | */ |