summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/hpsa.c20
-rw-r--r--drivers/scsi/hpsa.h1
-rw-r--r--drivers/scsi/hpsa_cmd.h4
3 files changed, 12 insertions, 13 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 4dc9107456ae..f4dc212ad49b 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2700,16 +2700,16 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
2700 status = -EINVAL; 2700 status = -EINVAL;
2701 goto cleanup1; 2701 goto cleanup1;
2702 } 2702 }
2703 if (ioc->buf_size > ioc->malloc_size * MAXSGENTRIES) { 2703 if (ioc->buf_size > ioc->malloc_size * SG_ENTRIES_IN_CMD) {
2704 status = -EINVAL; 2704 status = -EINVAL;
2705 goto cleanup1; 2705 goto cleanup1;
2706 } 2706 }
2707 buff = kzalloc(MAXSGENTRIES * sizeof(char *), GFP_KERNEL); 2707 buff = kzalloc(SG_ENTRIES_IN_CMD * sizeof(char *), GFP_KERNEL);
2708 if (!buff) { 2708 if (!buff) {
2709 status = -ENOMEM; 2709 status = -ENOMEM;
2710 goto cleanup1; 2710 goto cleanup1;
2711 } 2711 }
2712 buff_size = kmalloc(MAXSGENTRIES * sizeof(int), GFP_KERNEL); 2712 buff_size = kmalloc(SG_ENTRIES_IN_CMD * sizeof(int), GFP_KERNEL);
2713 if (!buff_size) { 2713 if (!buff_size) {
2714 status = -ENOMEM; 2714 status = -ENOMEM;
2715 goto cleanup1; 2715 goto cleanup1;
@@ -4601,15 +4601,15 @@ static __devinit void hpsa_enter_performant_mode(struct ctlr_info *h,
4601 * Each SG entry requires 16 bytes. The eight registers are programmed 4601 * Each SG entry requires 16 bytes. The eight registers are programmed
4602 * with the number of 16-byte blocks a command of that size requires. 4602 * with the number of 16-byte blocks a command of that size requires.
4603 * The smallest command possible requires 5 such 16 byte blocks. 4603 * The smallest command possible requires 5 such 16 byte blocks.
4604 * the largest command possible requires MAXSGENTRIES + 4 16-byte 4604 * the largest command possible requires SG_ENTRIES_IN_CMD + 4 16-byte
4605 * blocks. Note, this only extends to the SG entries contained 4605 * blocks. Note, this only extends to the SG entries contained
4606 * within the command block, and does not extend to chained blocks 4606 * within the command block, and does not extend to chained blocks
4607 * of SG elements. bft[] contains the eight values we write to 4607 * of SG elements. bft[] contains the eight values we write to
4608 * the registers. They are not evenly distributed, but have more 4608 * the registers. They are not evenly distributed, but have more
4609 * sizes for small commands, and fewer sizes for larger commands. 4609 * sizes for small commands, and fewer sizes for larger commands.
4610 */ 4610 */
4611 int bft[8] = {5, 6, 8, 10, 12, 20, 28, MAXSGENTRIES + 4}; 4611 int bft[8] = {5, 6, 8, 10, 12, 20, 28, SG_ENTRIES_IN_CMD + 4};
4612 BUILD_BUG_ON(28 > MAXSGENTRIES + 4); 4612 BUILD_BUG_ON(28 > SG_ENTRIES_IN_CMD + 4);
4613 /* 5 = 1 s/g entry or 4k 4613 /* 5 = 1 s/g entry or 4k
4614 * 6 = 2 s/g entry or 8k 4614 * 6 = 2 s/g entry or 8k
4615 * 8 = 4 s/g entry or 16k 4615 * 8 = 4 s/g entry or 16k
@@ -4622,8 +4622,9 @@ static __devinit void hpsa_enter_performant_mode(struct ctlr_info *h,
4622 memset(h->reply_pool, 0, h->reply_pool_size); 4622 memset(h->reply_pool, 0, h->reply_pool_size);
4623 h->reply_pool_head = h->reply_pool; 4623 h->reply_pool_head = h->reply_pool;
4624 4624
4625 bft[7] = h->max_sg_entries + 4; 4625 bft[7] = SG_ENTRIES_IN_CMD + 4;
4626 calc_bucket_map(bft, ARRAY_SIZE(bft), 32, h->blockFetchTable); 4626 calc_bucket_map(bft, ARRAY_SIZE(bft),
4627 SG_ENTRIES_IN_CMD, h->blockFetchTable);
4627 for (i = 0; i < 8; i++) 4628 for (i = 0; i < 8; i++)
4628 writel(bft[i], &h->transtable->BlockFetch[i]); 4629 writel(bft[i], &h->transtable->BlockFetch[i]);
4629 4630
@@ -4661,14 +4662,13 @@ static __devinit void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h)
4661 return; 4662 return;
4662 4663
4663 hpsa_get_max_perf_mode_cmds(h); 4664 hpsa_get_max_perf_mode_cmds(h);
4664 h->max_sg_entries = 32;
4665 /* Performant mode ring buffer and supporting data structures */ 4665 /* Performant mode ring buffer and supporting data structures */
4666 h->reply_pool_size = h->max_commands * sizeof(u64); 4666 h->reply_pool_size = h->max_commands * sizeof(u64);
4667 h->reply_pool = pci_alloc_consistent(h->pdev, h->reply_pool_size, 4667 h->reply_pool = pci_alloc_consistent(h->pdev, h->reply_pool_size,
4668 &(h->reply_pool_dhandle)); 4668 &(h->reply_pool_dhandle));
4669 4669
4670 /* Need a block fetch table for performant mode */ 4670 /* Need a block fetch table for performant mode */
4671 h->blockFetchTable = kmalloc(((h->max_sg_entries+1) * 4671 h->blockFetchTable = kmalloc(((SG_ENTRIES_IN_CMD + 1) *
4672 sizeof(u32)), GFP_KERNEL); 4672 sizeof(u32)), GFP_KERNEL);
4673 4673
4674 if ((h->reply_pool == NULL) 4674 if ((h->reply_pool == NULL)
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index 91edafb8c7e6..b4b97ebcb47a 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -58,7 +58,6 @@ struct ctlr_info {
58 unsigned long paddr; 58 unsigned long paddr;
59 int nr_cmds; /* Number of commands allowed on this controller */ 59 int nr_cmds; /* Number of commands allowed on this controller */
60 struct CfgTable __iomem *cfgtable; 60 struct CfgTable __iomem *cfgtable;
61 int max_sg_entries;
62 int interrupts_enabled; 61 int interrupts_enabled;
63 int major; 62 int major;
64 int max_commands; 63 int max_commands;
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
index 3fd4715935c2..516d6e53c7e6 100644
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -23,7 +23,7 @@
23 23
24/* general boundary defintions */ 24/* general boundary defintions */
25#define SENSEINFOBYTES 32 /* may vary between hbas */ 25#define SENSEINFOBYTES 32 /* may vary between hbas */
26#define MAXSGENTRIES 32 26#define SG_ENTRIES_IN_CMD 32 /* Max SG entries excluding chain blocks */
27#define HPSA_SG_CHAIN 0x80000000 27#define HPSA_SG_CHAIN 0x80000000
28#define MAXREPLYQS 256 28#define MAXREPLYQS 256
29 29
@@ -282,7 +282,7 @@ struct CommandList {
282 struct CommandListHeader Header; 282 struct CommandListHeader Header;
283 struct RequestBlock Request; 283 struct RequestBlock Request;
284 struct ErrDescriptor ErrDesc; 284 struct ErrDescriptor ErrDesc;
285 struct SGDescriptor SG[MAXSGENTRIES]; 285 struct SGDescriptor SG[SG_ENTRIES_IN_CMD];
286 /* information associated with the command */ 286 /* information associated with the command */
287 u32 busaddr; /* physical addr of this record */ 287 u32 busaddr; /* physical addr of this record */
288 struct ErrorInfo *err_info; /* pointer to the allocated mem */ 288 struct ErrorInfo *err_info; /* pointer to the allocated mem */