aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ipr.c28
-rw-r--r--drivers/scsi/ipr.h31
2 files changed, 39 insertions, 20 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index aa1fb72ca235..5cf1002283b4 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -480,12 +480,16 @@ static void ipr_reinit_ipr_cmnd(struct ipr_cmnd *ipr_cmd)
480{ 480{
481 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; 481 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
482 struct ipr_ioasa *ioasa = &ipr_cmd->ioasa; 482 struct ipr_ioasa *ioasa = &ipr_cmd->ioasa;
483 dma_addr_t dma_addr = be32_to_cpu(ioarcb->ioarcb_host_pci_addr);
483 484
484 memset(&ioarcb->cmd_pkt, 0, sizeof(struct ipr_cmd_pkt)); 485 memset(&ioarcb->cmd_pkt, 0, sizeof(struct ipr_cmd_pkt));
485 ioarcb->write_data_transfer_length = 0; 486 ioarcb->write_data_transfer_length = 0;
486 ioarcb->read_data_transfer_length = 0; 487 ioarcb->read_data_transfer_length = 0;
487 ioarcb->write_ioadl_len = 0; 488 ioarcb->write_ioadl_len = 0;
488 ioarcb->read_ioadl_len = 0; 489 ioarcb->read_ioadl_len = 0;
490 ioarcb->write_ioadl_addr =
491 cpu_to_be32(dma_addr + offsetof(struct ipr_cmnd, ioadl));
492 ioarcb->read_ioadl_addr = ioarcb->write_ioadl_addr;
489 ioasa->ioasc = 0; 493 ioasa->ioasc = 0;
490 ioasa->residual_data_len = 0; 494 ioasa->residual_data_len = 0;
491 ioasa->u.gata.status = 0; 495 ioasa->u.gata.status = 0;
@@ -4230,6 +4234,14 @@ static int ipr_build_ioadl(struct ipr_ioa_cfg *ioa_cfg,
4230 4234
4231 sglist = scsi_cmd->request_buffer; 4235 sglist = scsi_cmd->request_buffer;
4232 4236
4237 if (ipr_cmd->dma_use_sg <= ARRAY_SIZE(ioarcb->add_data.u.ioadl)) {
4238 ioadl = ioarcb->add_data.u.ioadl;
4239 ioarcb->write_ioadl_addr =
4240 cpu_to_be32(be32_to_cpu(ioarcb->ioarcb_host_pci_addr) +
4241 offsetof(struct ipr_ioarcb, add_data));
4242 ioarcb->read_ioadl_addr = ioarcb->write_ioadl_addr;
4243 }
4244
4233 for (i = 0; i < ipr_cmd->dma_use_sg; i++) { 4245 for (i = 0; i < ipr_cmd->dma_use_sg; i++) {
4234 ioadl[i].flags_and_data_len = 4246 ioadl[i].flags_and_data_len =
4235 cpu_to_be32(ioadl_flags | sg_dma_len(&sglist[i])); 4247 cpu_to_be32(ioadl_flags | sg_dma_len(&sglist[i]));
@@ -4260,6 +4272,11 @@ static int ipr_build_ioadl(struct ipr_ioa_cfg *ioa_cfg,
4260 scsi_cmd->sc_data_direction); 4272 scsi_cmd->sc_data_direction);
4261 4273
4262 if (likely(!pci_dma_mapping_error(ipr_cmd->dma_handle))) { 4274 if (likely(!pci_dma_mapping_error(ipr_cmd->dma_handle))) {
4275 ioadl = ioarcb->add_data.u.ioadl;
4276 ioarcb->write_ioadl_addr =
4277 cpu_to_be32(be32_to_cpu(ioarcb->ioarcb_host_pci_addr) +
4278 offsetof(struct ipr_ioarcb, add_data));
4279 ioarcb->read_ioadl_addr = ioarcb->write_ioadl_addr;
4263 ipr_cmd->dma_use_sg = 1; 4280 ipr_cmd->dma_use_sg = 1;
4264 ioadl[0].flags_and_data_len = 4281 ioadl[0].flags_and_data_len =
4265 cpu_to_be32(ioadl_flags | length | IPR_IOADL_FLAGS_LAST); 4282 cpu_to_be32(ioadl_flags | length | IPR_IOADL_FLAGS_LAST);
@@ -4346,11 +4363,9 @@ static void ipr_erp_done(struct ipr_cmnd *ipr_cmd)
4346 **/ 4363 **/
4347static void ipr_reinit_ipr_cmnd_for_erp(struct ipr_cmnd *ipr_cmd) 4364static void ipr_reinit_ipr_cmnd_for_erp(struct ipr_cmnd *ipr_cmd)
4348{ 4365{
4349 struct ipr_ioarcb *ioarcb; 4366 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
4350 struct ipr_ioasa *ioasa; 4367 struct ipr_ioasa *ioasa = &ipr_cmd->ioasa;
4351 4368 dma_addr_t dma_addr = be32_to_cpu(ioarcb->ioarcb_host_pci_addr);
4352 ioarcb = &ipr_cmd->ioarcb;
4353 ioasa = &ipr_cmd->ioasa;
4354 4369
4355 memset(&ioarcb->cmd_pkt, 0, sizeof(struct ipr_cmd_pkt)); 4370 memset(&ioarcb->cmd_pkt, 0, sizeof(struct ipr_cmd_pkt));
4356 ioarcb->write_data_transfer_length = 0; 4371 ioarcb->write_data_transfer_length = 0;
@@ -4359,6 +4374,9 @@ static void ipr_reinit_ipr_cmnd_for_erp(struct ipr_cmnd *ipr_cmd)
4359 ioarcb->read_ioadl_len = 0; 4374 ioarcb->read_ioadl_len = 0;
4360 ioasa->ioasc = 0; 4375 ioasa->ioasc = 0;
4361 ioasa->residual_data_len = 0; 4376 ioasa->residual_data_len = 0;
4377 ioarcb->write_ioadl_addr =
4378 cpu_to_be32(dma_addr + offsetof(struct ipr_cmnd, ioadl));
4379 ioarcb->read_ioadl_addr = ioarcb->write_ioadl_addr;
4362} 4380}
4363 4381
4364/** 4382/**
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h
index 4d068887608c..50e14f59f2fa 100644
--- a/drivers/scsi/ipr.h
+++ b/drivers/scsi/ipr.h
@@ -422,9 +422,25 @@ struct ipr_ioarcb_ata_regs {
422 u8 ctl; 422 u8 ctl;
423}__attribute__ ((packed, aligned(4))); 423}__attribute__ ((packed, aligned(4)));
424 424
425struct ipr_ioadl_desc {
426 __be32 flags_and_data_len;
427#define IPR_IOADL_FLAGS_MASK 0xff000000
428#define IPR_IOADL_GET_FLAGS(x) (be32_to_cpu(x) & IPR_IOADL_FLAGS_MASK)
429#define IPR_IOADL_DATA_LEN_MASK 0x00ffffff
430#define IPR_IOADL_GET_DATA_LEN(x) (be32_to_cpu(x) & IPR_IOADL_DATA_LEN_MASK)
431#define IPR_IOADL_FLAGS_READ 0x48000000
432#define IPR_IOADL_FLAGS_READ_LAST 0x49000000
433#define IPR_IOADL_FLAGS_WRITE 0x68000000
434#define IPR_IOADL_FLAGS_WRITE_LAST 0x69000000
435#define IPR_IOADL_FLAGS_LAST 0x01000000
436
437 __be32 address;
438}__attribute__((packed, aligned (8)));
439
425struct ipr_ioarcb_add_data { 440struct ipr_ioarcb_add_data {
426 union { 441 union {
427 struct ipr_ioarcb_ata_regs regs; 442 struct ipr_ioarcb_ata_regs regs;
443 struct ipr_ioadl_desc ioadl[5];
428 __be32 add_cmd_parms[10]; 444 __be32 add_cmd_parms[10];
429 }u; 445 }u;
430}__attribute__ ((packed, aligned(4))); 446}__attribute__ ((packed, aligned(4)));
@@ -456,21 +472,6 @@ struct ipr_ioarcb {
456 struct ipr_ioarcb_add_data add_data; 472 struct ipr_ioarcb_add_data add_data;
457}__attribute__((packed, aligned (4))); 473}__attribute__((packed, aligned (4)));
458 474
459struct ipr_ioadl_desc {
460 __be32 flags_and_data_len;
461#define IPR_IOADL_FLAGS_MASK 0xff000000
462#define IPR_IOADL_GET_FLAGS(x) (be32_to_cpu(x) & IPR_IOADL_FLAGS_MASK)
463#define IPR_IOADL_DATA_LEN_MASK 0x00ffffff
464#define IPR_IOADL_GET_DATA_LEN(x) (be32_to_cpu(x) & IPR_IOADL_DATA_LEN_MASK)
465#define IPR_IOADL_FLAGS_READ 0x48000000
466#define IPR_IOADL_FLAGS_READ_LAST 0x49000000
467#define IPR_IOADL_FLAGS_WRITE 0x68000000
468#define IPR_IOADL_FLAGS_WRITE_LAST 0x69000000
469#define IPR_IOADL_FLAGS_LAST 0x01000000
470
471 __be32 address;
472}__attribute__((packed, aligned (8)));
473
474struct ipr_ioasa_vset { 475struct ipr_ioasa_vset {
475 __be32 failing_lba_hi; 476 __be32 failing_lba_hi;
476 __be32 failing_lba_lo; 477 __be32 failing_lba_lo;