aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aacraid
diff options
context:
space:
mode:
authorMahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>2015-03-26 10:41:24 -0400
committerJames Bottomley <JBottomley@Odin.com>2015-04-09 19:46:30 -0400
commitb836439faf04b16c80ffd9a0699a2354ebde13e1 (patch)
tree1718c9192dfaa192007ec6d1b6c4a561e2c48a94 /drivers/scsi/aacraid
parent2f5d1f7998b67d49263ee9d9a49669e1b8d0e302 (diff)
aacraid: 4KB sector support
Also fix up a name truncation problem Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Murthy Bhat <Murthy.Bhat@pmcs.com> Signed-off-by: James Bottomley <JBottomley@Odin.com>
Diffstat (limited to 'drivers/scsi/aacraid')
-rw-r--r--drivers/scsi/aacraid/aachba.c240
-rw-r--r--drivers/scsi/aacraid/aacraid.h11
2 files changed, 200 insertions, 51 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index b32e77db0c48..aee3eaa0bd5d 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -111,6 +111,41 @@
111#define BYTE2(x) (unsigned char)((x) >> 16) 111#define BYTE2(x) (unsigned char)((x) >> 16)
112#define BYTE3(x) (unsigned char)((x) >> 24) 112#define BYTE3(x) (unsigned char)((x) >> 24)
113 113
114/* MODE_SENSE data format */
115typedef struct {
116 struct {
117 u8 data_length;
118 u8 med_type;
119 u8 dev_par;
120 u8 bd_length;
121 } __attribute__((packed)) hd;
122 struct {
123 u8 dens_code;
124 u8 block_count[3];
125 u8 reserved;
126 u8 block_length[3];
127 } __attribute__((packed)) bd;
128 u8 mpc_buf[3];
129} __attribute__((packed)) aac_modep_data;
130
131/* MODE_SENSE_10 data format */
132typedef struct {
133 struct {
134 u8 data_length[2];
135 u8 med_type;
136 u8 dev_par;
137 u8 rsrvd[2];
138 u8 bd_length[2];
139 } __attribute__((packed)) hd;
140 struct {
141 u8 dens_code;
142 u8 block_count[3];
143 u8 reserved;
144 u8 block_length[3];
145 } __attribute__((packed)) bd;
146 u8 mpc_buf[3];
147} __attribute__((packed)) aac_modep10_data;
148
114/*------------------------------------------------------------------------------ 149/*------------------------------------------------------------------------------
115 * S T R U C T S / T Y P E D E F S 150 * S T R U C T S / T Y P E D E F S
116 *----------------------------------------------------------------------------*/ 151 *----------------------------------------------------------------------------*/
@@ -438,7 +473,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
438 if ((le32_to_cpu(get_name_reply->status) == CT_OK) 473 if ((le32_to_cpu(get_name_reply->status) == CT_OK)
439 && (get_name_reply->data[0] != '\0')) { 474 && (get_name_reply->data[0] != '\0')) {
440 char *sp = get_name_reply->data; 475 char *sp = get_name_reply->data;
441 sp[sizeof(((struct aac_get_name_resp *)NULL)->data)-1] = '\0'; 476 sp[sizeof(((struct aac_get_name_resp *)NULL)->data)] = '\0';
442 while (*sp == ' ') 477 while (*sp == ' ')
443 ++sp; 478 ++sp;
444 if (*sp) { 479 if (*sp) {
@@ -539,6 +574,14 @@ static void _aac_probe_container2(void * context, struct fib * fibptr)
539 if ((le32_to_cpu(dresp->status) == ST_OK) && 574 if ((le32_to_cpu(dresp->status) == ST_OK) &&
540 (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) && 575 (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) &&
541 (le32_to_cpu(dresp->mnt[0].state) != FSCS_HIDDEN)) { 576 (le32_to_cpu(dresp->mnt[0].state) != FSCS_HIDDEN)) {
577 if (!(fibptr->dev->supplement_adapter_info.SupportedOptions2 &
578 AAC_OPTION_VARIABLE_BLOCK_SIZE)) {
579 dresp->mnt[0].fileinfo.bdevinfo.block_size = 0x200;
580 fsa_dev_ptr->block_size = 0x200;
581 } else {
582 fsa_dev_ptr->block_size =
583 le32_to_cpu(dresp->mnt[0].fileinfo.bdevinfo.block_size);
584 }
542 fsa_dev_ptr->valid = 1; 585 fsa_dev_ptr->valid = 1;
543 /* sense_key holds the current state of the spin-up */ 586 /* sense_key holds the current state of the spin-up */
544 if (dresp->mnt[0].state & cpu_to_le32(FSCS_NOT_READY)) 587 if (dresp->mnt[0].state & cpu_to_le32(FSCS_NOT_READY))
@@ -571,7 +614,9 @@ static void _aac_probe_container1(void * context, struct fib * fibptr)
571 int status; 614 int status;
572 615
573 dresp = (struct aac_mount *) fib_data(fibptr); 616 dresp = (struct aac_mount *) fib_data(fibptr);
574 dresp->mnt[0].capacityhigh = 0; 617 if (!(fibptr->dev->supplement_adapter_info.SupportedOptions2 &
618 AAC_OPTION_VARIABLE_BLOCK_SIZE))
619 dresp->mnt[0].capacityhigh = 0;
575 if ((le32_to_cpu(dresp->status) != ST_OK) || 620 if ((le32_to_cpu(dresp->status) != ST_OK) ||
576 (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE)) { 621 (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE)) {
577 _aac_probe_container2(context, fibptr); 622 _aac_probe_container2(context, fibptr);
@@ -586,7 +631,12 @@ static void _aac_probe_container1(void * context, struct fib * fibptr)
586 631
587 dinfo = (struct aac_query_mount *)fib_data(fibptr); 632 dinfo = (struct aac_query_mount *)fib_data(fibptr);
588 633
589 dinfo->command = cpu_to_le32(VM_NameServe64); 634 if (fibptr->dev->supplement_adapter_info.SupportedOptions2 &
635 AAC_OPTION_VARIABLE_BLOCK_SIZE)
636 dinfo->command = cpu_to_le32(VM_NameServeAllBlk);
637 else
638 dinfo->command = cpu_to_le32(VM_NameServe64);
639
590 dinfo->count = cpu_to_le32(scmd_id(scsicmd)); 640 dinfo->count = cpu_to_le32(scmd_id(scsicmd));
591 dinfo->type = cpu_to_le32(FT_FILESYS); 641 dinfo->type = cpu_to_le32(FT_FILESYS);
592 642
@@ -621,7 +671,12 @@ static int _aac_probe_container(struct scsi_cmnd * scsicmd, int (*callback)(stru
621 671
622 dinfo = (struct aac_query_mount *)fib_data(fibptr); 672 dinfo = (struct aac_query_mount *)fib_data(fibptr);
623 673
624 dinfo->command = cpu_to_le32(VM_NameServe); 674 if (fibptr->dev->supplement_adapter_info.SupportedOptions2 &
675 AAC_OPTION_VARIABLE_BLOCK_SIZE)
676 dinfo->command = cpu_to_le32(VM_NameServeAllBlk);
677 else
678 dinfo->command = cpu_to_le32(VM_NameServe);
679
625 dinfo->count = cpu_to_le32(scmd_id(scsicmd)); 680 dinfo->count = cpu_to_le32(scmd_id(scsicmd));
626 dinfo->type = cpu_to_le32(FT_FILESYS); 681 dinfo->type = cpu_to_le32(FT_FILESYS);
627 scsicmd->SCp.ptr = (char *)callback; 682 scsicmd->SCp.ptr = (char *)callback;
@@ -982,7 +1037,8 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3
982 memset(readcmd2, 0, sizeof(struct aac_raw_io2)); 1037 memset(readcmd2, 0, sizeof(struct aac_raw_io2));
983 readcmd2->blockLow = cpu_to_le32((u32)(lba&0xffffffff)); 1038 readcmd2->blockLow = cpu_to_le32((u32)(lba&0xffffffff));
984 readcmd2->blockHigh = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); 1039 readcmd2->blockHigh = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32));
985 readcmd2->byteCount = cpu_to_le32(count<<9); 1040 readcmd2->byteCount = cpu_to_le32(count *
1041 dev->fsa_dev[scmd_id(cmd)].block_size);
986 readcmd2->cid = cpu_to_le16(scmd_id(cmd)); 1042 readcmd2->cid = cpu_to_le16(scmd_id(cmd));
987 readcmd2->flags = cpu_to_le16(RIO2_IO_TYPE_READ); 1043 readcmd2->flags = cpu_to_le16(RIO2_IO_TYPE_READ);
988 ret = aac_build_sgraw2(cmd, readcmd2, 1044 ret = aac_build_sgraw2(cmd, readcmd2,
@@ -997,7 +1053,8 @@ static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3
997 readcmd = (struct aac_raw_io *) fib_data(fib); 1053 readcmd = (struct aac_raw_io *) fib_data(fib);
998 readcmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff)); 1054 readcmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff));
999 readcmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); 1055 readcmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32));
1000 readcmd->count = cpu_to_le32(count<<9); 1056 readcmd->count = cpu_to_le32(count *
1057 dev->fsa_dev[scmd_id(cmd)].block_size);
1001 readcmd->cid = cpu_to_le16(scmd_id(cmd)); 1058 readcmd->cid = cpu_to_le16(scmd_id(cmd));
1002 readcmd->flags = cpu_to_le16(RIO_TYPE_READ); 1059 readcmd->flags = cpu_to_le16(RIO_TYPE_READ);
1003 readcmd->bpTotal = 0; 1060 readcmd->bpTotal = 0;
@@ -1062,6 +1119,7 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32
1062{ 1119{
1063 u16 fibsize; 1120 u16 fibsize;
1064 struct aac_read *readcmd; 1121 struct aac_read *readcmd;
1122 struct aac_dev *dev = fib->dev;
1065 long ret; 1123 long ret;
1066 1124
1067 aac_fib_init(fib); 1125 aac_fib_init(fib);
@@ -1069,7 +1127,8 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32
1069 readcmd->command = cpu_to_le32(VM_CtBlockRead); 1127 readcmd->command = cpu_to_le32(VM_CtBlockRead);
1070 readcmd->cid = cpu_to_le32(scmd_id(cmd)); 1128 readcmd->cid = cpu_to_le32(scmd_id(cmd));
1071 readcmd->block = cpu_to_le32((u32)(lba&0xffffffff)); 1129 readcmd->block = cpu_to_le32((u32)(lba&0xffffffff));
1072 readcmd->count = cpu_to_le32(count * 512); 1130 readcmd->count = cpu_to_le32(count *
1131 dev->fsa_dev[scmd_id(cmd)].block_size);
1073 1132
1074 ret = aac_build_sg(cmd, &readcmd->sg); 1133 ret = aac_build_sg(cmd, &readcmd->sg);
1075 if (ret < 0) 1134 if (ret < 0)
@@ -1104,7 +1163,8 @@ static int aac_write_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u
1104 memset(writecmd2, 0, sizeof(struct aac_raw_io2)); 1163 memset(writecmd2, 0, sizeof(struct aac_raw_io2));
1105 writecmd2->blockLow = cpu_to_le32((u32)(lba&0xffffffff)); 1164 writecmd2->blockLow = cpu_to_le32((u32)(lba&0xffffffff));
1106 writecmd2->blockHigh = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); 1165 writecmd2->blockHigh = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32));
1107 writecmd2->byteCount = cpu_to_le32(count<<9); 1166 writecmd2->byteCount = cpu_to_le32(count *
1167 dev->fsa_dev[scmd_id(cmd)].block_size);
1108 writecmd2->cid = cpu_to_le16(scmd_id(cmd)); 1168 writecmd2->cid = cpu_to_le16(scmd_id(cmd));
1109 writecmd2->flags = (fua && ((aac_cache & 5) != 1) && 1169 writecmd2->flags = (fua && ((aac_cache & 5) != 1) &&
1110 (((aac_cache & 5) != 5) || !fib->dev->cache_protected)) ? 1170 (((aac_cache & 5) != 5) || !fib->dev->cache_protected)) ?
@@ -1122,7 +1182,8 @@ static int aac_write_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u
1122 writecmd = (struct aac_raw_io *) fib_data(fib); 1182 writecmd = (struct aac_raw_io *) fib_data(fib);
1123 writecmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff)); 1183 writecmd->block[0] = cpu_to_le32((u32)(lba&0xffffffff));
1124 writecmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32)); 1184 writecmd->block[1] = cpu_to_le32((u32)((lba&0xffffffff00000000LL)>>32));
1125 writecmd->count = cpu_to_le32(count<<9); 1185 writecmd->count = cpu_to_le32(count *
1186 dev->fsa_dev[scmd_id(cmd)].block_size);
1126 writecmd->cid = cpu_to_le16(scmd_id(cmd)); 1187 writecmd->cid = cpu_to_le16(scmd_id(cmd));
1127 writecmd->flags = (fua && ((aac_cache & 5) != 1) && 1188 writecmd->flags = (fua && ((aac_cache & 5) != 1) &&
1128 (((aac_cache & 5) != 5) || !fib->dev->cache_protected)) ? 1189 (((aac_cache & 5) != 5) || !fib->dev->cache_protected)) ?
@@ -1190,6 +1251,7 @@ static int aac_write_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3
1190{ 1251{
1191 u16 fibsize; 1252 u16 fibsize;
1192 struct aac_write *writecmd; 1253 struct aac_write *writecmd;
1254 struct aac_dev *dev = fib->dev;
1193 long ret; 1255 long ret;
1194 1256
1195 aac_fib_init(fib); 1257 aac_fib_init(fib);
@@ -1197,7 +1259,8 @@ static int aac_write_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3
1197 writecmd->command = cpu_to_le32(VM_CtBlockWrite); 1259 writecmd->command = cpu_to_le32(VM_CtBlockWrite);
1198 writecmd->cid = cpu_to_le32(scmd_id(cmd)); 1260 writecmd->cid = cpu_to_le32(scmd_id(cmd));
1199 writecmd->block = cpu_to_le32((u32)(lba&0xffffffff)); 1261 writecmd->block = cpu_to_le32((u32)(lba&0xffffffff));
1200 writecmd->count = cpu_to_le32(count * 512); 1262 writecmd->count = cpu_to_le32(count *
1263 dev->fsa_dev[scmd_id(cmd)].block_size);
1201 writecmd->sg.count = cpu_to_le32(1); 1264 writecmd->sg.count = cpu_to_le32(1);
1202 /* ->stable is not used - it did mean which type of write */ 1265 /* ->stable is not used - it did mean which type of write */
1203 1266
@@ -2329,10 +2392,10 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
2329 cp[5] = (capacity >> 16) & 0xff; 2392 cp[5] = (capacity >> 16) & 0xff;
2330 cp[6] = (capacity >> 8) & 0xff; 2393 cp[6] = (capacity >> 8) & 0xff;
2331 cp[7] = (capacity >> 0) & 0xff; 2394 cp[7] = (capacity >> 0) & 0xff;
2332 cp[8] = 0; 2395 cp[8] = (fsa_dev_ptr[cid].block_size >> 24) & 0xff;
2333 cp[9] = 0; 2396 cp[9] = (fsa_dev_ptr[cid].block_size >> 16) & 0xff;
2334 cp[10] = 2; 2397 cp[10] = (fsa_dev_ptr[cid].block_size >> 8) & 0xff;
2335 cp[11] = 0; 2398 cp[11] = (fsa_dev_ptr[cid].block_size) & 0xff;
2336 cp[12] = 0; 2399 cp[12] = 0;
2337 2400
2338 alloc_len = ((scsicmd->cmnd[10] << 24) 2401 alloc_len = ((scsicmd->cmnd[10] << 24)
@@ -2369,10 +2432,10 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
2369 cp[1] = (capacity >> 16) & 0xff; 2432 cp[1] = (capacity >> 16) & 0xff;
2370 cp[2] = (capacity >> 8) & 0xff; 2433 cp[2] = (capacity >> 8) & 0xff;
2371 cp[3] = (capacity >> 0) & 0xff; 2434 cp[3] = (capacity >> 0) & 0xff;
2372 cp[4] = 0; 2435 cp[4] = (fsa_dev_ptr[cid].block_size >> 24) & 0xff;
2373 cp[5] = 0; 2436 cp[5] = (fsa_dev_ptr[cid].block_size >> 16) & 0xff;
2374 cp[6] = 2; 2437 cp[6] = (fsa_dev_ptr[cid].block_size >> 8) & 0xff;
2375 cp[7] = 0; 2438 cp[7] = (fsa_dev_ptr[cid].block_size) & 0xff;
2376 scsi_sg_copy_from_buffer(scsicmd, cp, sizeof(cp)); 2439 scsi_sg_copy_from_buffer(scsicmd, cp, sizeof(cp));
2377 /* Do not cache partition table for arrays */ 2440 /* Do not cache partition table for arrays */
2378 scsicmd->device->removable = 1; 2441 scsicmd->device->removable = 1;
@@ -2385,30 +2448,64 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
2385 2448
2386 case MODE_SENSE: 2449 case MODE_SENSE:
2387 { 2450 {
2388 char mode_buf[7];
2389 int mode_buf_length = 4; 2451 int mode_buf_length = 4;
2452 u32 capacity;
2453 aac_modep_data mpd;
2454
2455 if (fsa_dev_ptr[cid].size <= 0x100000000ULL)
2456 capacity = fsa_dev_ptr[cid].size - 1;
2457 else
2458 capacity = (u32)-1;
2390 2459
2391 dprintk((KERN_DEBUG "MODE SENSE command.\n")); 2460 dprintk((KERN_DEBUG "MODE SENSE command.\n"));
2392 mode_buf[0] = 3; /* Mode data length */ 2461 memset((char *)&mpd, 0, sizeof(aac_modep_data));
2393 mode_buf[1] = 0; /* Medium type - default */ 2462
2394 mode_buf[2] = 0; /* Device-specific param, 2463 /* Mode data length */
2395 bit 8: 0/1 = write enabled/protected 2464 mpd.hd.data_length = sizeof(mpd.hd) - 1;
2396 bit 4: 0/1 = FUA enabled */ 2465 /* Medium type - default */
2466 mpd.hd.med_type = 0;
2467 /* Device-specific param,
2468 bit 8: 0/1 = write enabled/protected
2469 bit 4: 0/1 = FUA enabled */
2470 mpd.hd.dev_par = 0;
2471
2397 if (dev->raw_io_interface && ((aac_cache & 5) != 1)) 2472 if (dev->raw_io_interface && ((aac_cache & 5) != 1))
2398 mode_buf[2] = 0x10; 2473 mpd.hd.dev_par = 0x10;
2399 mode_buf[3] = 0; /* Block descriptor length */ 2474 if (scsicmd->cmnd[1] & 0x8)
2475 mpd.hd.bd_length = 0; /* Block descriptor length */
2476 else {
2477 mpd.hd.bd_length = sizeof(mpd.bd);
2478 mpd.hd.data_length += mpd.hd.bd_length;
2479 mpd.bd.block_length[0] =
2480 (fsa_dev_ptr[cid].block_size >> 16) & 0xff;
2481 mpd.bd.block_length[1] =
2482 (fsa_dev_ptr[cid].block_size >> 8) & 0xff;
2483 mpd.bd.block_length[2] =
2484 fsa_dev_ptr[cid].block_size & 0xff;
2485 if (capacity > 0xffffff) {
2486 mpd.bd.block_count[0] = 0xff;
2487 mpd.bd.block_count[1] = 0xff;
2488 mpd.bd.block_count[2] = 0xff;
2489 } else {
2490 mpd.bd.block_count[0] = (capacity >> 16) & 0xff;
2491 mpd.bd.block_count[1] = (capacity >> 8) & 0xff;
2492 mpd.bd.block_count[2] = capacity & 0xff;
2493 }
2494 }
2400 if (((scsicmd->cmnd[2] & 0x3f) == 8) || 2495 if (((scsicmd->cmnd[2] & 0x3f) == 8) ||
2401 ((scsicmd->cmnd[2] & 0x3f) == 0x3f)) { 2496 ((scsicmd->cmnd[2] & 0x3f) == 0x3f)) {
2402 mode_buf[0] = 6; 2497 mpd.hd.data_length += 3;
2403 mode_buf[4] = 8; 2498 mpd.mpc_buf[0] = 8;
2404 mode_buf[5] = 1; 2499 mpd.mpc_buf[1] = 1;
2405 mode_buf[6] = ((aac_cache & 6) == 2) 2500 mpd.mpc_buf[2] = ((aac_cache & 6) == 2)
2406 ? 0 : 0x04; /* WCE */ 2501 ? 0 : 0x04; /* WCE */
2407 mode_buf_length = 7; 2502 mode_buf_length = sizeof(mpd);
2408 if (mode_buf_length > scsicmd->cmnd[4]) 2503 if (mode_buf_length > scsicmd->cmnd[4])
2409 mode_buf_length = scsicmd->cmnd[4]; 2504 mode_buf_length = scsicmd->cmnd[4];
2410 } 2505 }
2411 scsi_sg_copy_from_buffer(scsicmd, mode_buf, mode_buf_length); 2506 scsi_sg_copy_from_buffer(scsicmd,
2507 (char *)&mpd,
2508 mode_buf_length);
2412 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; 2509 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
2413 scsicmd->scsi_done(scsicmd); 2510 scsicmd->scsi_done(scsicmd);
2414 2511
@@ -2416,34 +2513,77 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
2416 } 2513 }
2417 case MODE_SENSE_10: 2514 case MODE_SENSE_10:
2418 { 2515 {
2419 char mode_buf[11]; 2516 u32 capacity;
2420 int mode_buf_length = 8; 2517 int mode_buf_length = 8;
2518 aac_modep10_data mpd10;
2519
2520 if (fsa_dev_ptr[cid].size <= 0x100000000ULL)
2521 capacity = fsa_dev_ptr[cid].size - 1;
2522 else
2523 capacity = (u32)-1;
2421 2524
2422 dprintk((KERN_DEBUG "MODE SENSE 10 byte command.\n")); 2525 dprintk((KERN_DEBUG "MODE SENSE 10 byte command.\n"));
2423 mode_buf[0] = 0; /* Mode data length (MSB) */ 2526 memset((char *)&mpd10, 0, sizeof(aac_modep10_data));
2424 mode_buf[1] = 6; /* Mode data length (LSB) */ 2527 /* Mode data length (MSB) */
2425 mode_buf[2] = 0; /* Medium type - default */ 2528 mpd10.hd.data_length[0] = 0;
2426 mode_buf[3] = 0; /* Device-specific param, 2529 /* Mode data length (LSB) */
2427 bit 8: 0/1 = write enabled/protected 2530 mpd10.hd.data_length[1] = sizeof(mpd10.hd) - 1;
2428 bit 4: 0/1 = FUA enabled */ 2531 /* Medium type - default */
2532 mpd10.hd.med_type = 0;
2533 /* Device-specific param,
2534 bit 8: 0/1 = write enabled/protected
2535 bit 4: 0/1 = FUA enabled */
2536 mpd10.hd.dev_par = 0;
2537
2429 if (dev->raw_io_interface && ((aac_cache & 5) != 1)) 2538 if (dev->raw_io_interface && ((aac_cache & 5) != 1))
2430 mode_buf[3] = 0x10; 2539 mpd10.hd.dev_par = 0x10;
2431 mode_buf[4] = 0; /* reserved */ 2540 mpd10.hd.rsrvd[0] = 0; /* reserved */
2432 mode_buf[5] = 0; /* reserved */ 2541 mpd10.hd.rsrvd[1] = 0; /* reserved */
2433 mode_buf[6] = 0; /* Block descriptor length (MSB) */ 2542 if (scsicmd->cmnd[1] & 0x8) {
2434 mode_buf[7] = 0; /* Block descriptor length (LSB) */ 2543 /* Block descriptor length (MSB) */
2544 mpd10.hd.bd_length[0] = 0;
2545 /* Block descriptor length (LSB) */
2546 mpd10.hd.bd_length[1] = 0;
2547 } else {
2548 mpd10.hd.bd_length[0] = 0;
2549 mpd10.hd.bd_length[1] = sizeof(mpd10.bd);
2550
2551 mpd10.hd.data_length[1] += mpd10.hd.bd_length[1];
2552
2553 mpd10.bd.block_length[0] =
2554 (fsa_dev_ptr[cid].block_size >> 16) & 0xff;
2555 mpd10.bd.block_length[1] =
2556 (fsa_dev_ptr[cid].block_size >> 8) & 0xff;
2557 mpd10.bd.block_length[2] =
2558 fsa_dev_ptr[cid].block_size & 0xff;
2559
2560 if (capacity > 0xffffff) {
2561 mpd10.bd.block_count[0] = 0xff;
2562 mpd10.bd.block_count[1] = 0xff;
2563 mpd10.bd.block_count[2] = 0xff;
2564 } else {
2565 mpd10.bd.block_count[0] =
2566 (capacity >> 16) & 0xff;
2567 mpd10.bd.block_count[1] =
2568 (capacity >> 8) & 0xff;
2569 mpd10.bd.block_count[2] =
2570 capacity & 0xff;
2571 }
2572 }
2435 if (((scsicmd->cmnd[2] & 0x3f) == 8) || 2573 if (((scsicmd->cmnd[2] & 0x3f) == 8) ||
2436 ((scsicmd->cmnd[2] & 0x3f) == 0x3f)) { 2574 ((scsicmd->cmnd[2] & 0x3f) == 0x3f)) {
2437 mode_buf[1] = 9; 2575 mpd10.hd.data_length[1] += 3;
2438 mode_buf[8] = 8; 2576 mpd10.mpc_buf[0] = 8;
2439 mode_buf[9] = 1; 2577 mpd10.mpc_buf[1] = 1;
2440 mode_buf[10] = ((aac_cache & 6) == 2) 2578 mpd10.mpc_buf[2] = ((aac_cache & 6) == 2)
2441 ? 0 : 0x04; /* WCE */ 2579 ? 0 : 0x04; /* WCE */
2442 mode_buf_length = 11; 2580 mode_buf_length = sizeof(mpd10);
2443 if (mode_buf_length > scsicmd->cmnd[8]) 2581 if (mode_buf_length > scsicmd->cmnd[8])
2444 mode_buf_length = scsicmd->cmnd[8]; 2582 mode_buf_length = scsicmd->cmnd[8];
2445 } 2583 }
2446 scsi_sg_copy_from_buffer(scsicmd, mode_buf, mode_buf_length); 2584 scsi_sg_copy_from_buffer(scsicmd,
2585 (char *)&mpd10,
2586 mode_buf_length);
2447 2587
2448 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; 2588 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
2449 scsicmd->scsi_done(scsicmd); 2589 scsicmd->scsi_done(scsicmd);
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 284db3937a82..9e38b209787d 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -857,6 +857,7 @@ struct fsa_dev_info {
857 u8 deleted; 857 u8 deleted;
858 char devname[8]; 858 char devname[8];
859 struct sense_data sense_data; 859 struct sense_data sense_data;
860 u32 block_size;
860}; 861};
861 862
862struct fib { 863struct fib {
@@ -960,6 +961,8 @@ struct aac_supplement_adapter_info
960#define AAC_OPTION_IGNORE_RESET cpu_to_le32(0x00000002) 961#define AAC_OPTION_IGNORE_RESET cpu_to_le32(0x00000002)
961#define AAC_OPTION_POWER_MANAGEMENT cpu_to_le32(0x00000004) 962#define AAC_OPTION_POWER_MANAGEMENT cpu_to_le32(0x00000004)
962#define AAC_OPTION_DOORBELL_RESET cpu_to_le32(0x00004000) 963#define AAC_OPTION_DOORBELL_RESET cpu_to_le32(0x00004000)
964/* 4KB sector size */
965#define AAC_OPTION_VARIABLE_BLOCK_SIZE cpu_to_le32(0x00040000)
963#define AAC_SIS_VERSION_V3 3 966#define AAC_SIS_VERSION_V3 3
964#define AAC_SIS_SLOT_UNKNOWN 0xFF 967#define AAC_SIS_SLOT_UNKNOWN 0xFF
965 968
@@ -1589,6 +1592,7 @@ struct aac_srb_reply
1589#define VM_CtHostWrite64 20 1592#define VM_CtHostWrite64 20
1590#define VM_DrvErrTblLog 21 1593#define VM_DrvErrTblLog 21
1591#define VM_NameServe64 22 1594#define VM_NameServe64 22
1595#define VM_NameServeAllBlk 30
1592 1596
1593#define MAX_VMCOMMAND_NUM 23 /* used for sizing stats array - leave last */ 1597#define MAX_VMCOMMAND_NUM 23 /* used for sizing stats array - leave last */
1594 1598
@@ -1611,8 +1615,13 @@ struct aac_fsinfo {
1611 __le32 fsInodeDensity; 1615 __le32 fsInodeDensity;
1612}; /* valid iff ObjType == FT_FILESYS && !(ContentState & FSCS_NOTCLEAN) */ 1616}; /* valid iff ObjType == FT_FILESYS && !(ContentState & FSCS_NOTCLEAN) */
1613 1617
1618struct aac_blockdevinfo {
1619 __le32 block_size;
1620};
1621
1614union aac_contentinfo { 1622union aac_contentinfo {
1615 struct aac_fsinfo filesys; /* valid iff ObjType == FT_FILESYS && !(ContentState & FSCS_NOTCLEAN) */ 1623 struct aac_fsinfo filesys;
1624 struct aac_blockdevinfo bdevinfo;
1616}; 1625};
1617 1626
1618/* 1627/*