aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2010-05-27 16:14:39 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-27 13:01:17 -0400
commitdef342bd745d88ed73541b9c07cefb13d8c576fd (patch)
tree2ed39e2ac30fc7af9529906a2450e96830282844
parentd28ce020fb0ef9254fc9e0bd07f5898c69af9f7d (diff)
[SCSI] hpsa: fix block fetch table problem.
We have 32 (MAXSGENTRIES) scatter gather elements embedded in the command. With all these, the total command size is about 576 bytes. However, the last entry in the block fetch table is 35. (the block fetch table contains the number of 16-byte chunks the firmware needs to fetch for a given number of scatter gather elements.) 35 * 16 = 560 bytes, which isn't enough. It needs to be 36. (36 * 16 == 576) or, MAXSGENTRIES + 4. (plus 4 because there's a bunch of stuff at the front of the command before the first scatter gather element that takes up 4 * 16 bytes.) Without this fix, the controller may have to perform two DMA operations to fetch the command since the first one may not get the whole thing. Signed-off-by: Don Brace <brace@beardog.cce.hp.com> Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/scsi/hpsa.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 410910762fc5..1133b5fda0e7 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3826,7 +3826,26 @@ static __devinit void hpsa_enter_performant_mode(struct ctlr_info *h)
3826{ 3826{
3827 int i; 3827 int i;
3828 unsigned long register_value; 3828 unsigned long register_value;
3829 int bft[8] = {5, 6, 8, 10, 12, 20, 28, 35}; /* for scatter/gathers */ 3829
3830 /* This is a bit complicated. There are 8 registers on
3831 * the controller which we write to to tell it 8 different
3832 * sizes of commands which there may be. It's a way of
3833 * reducing the DMA done to fetch each command. Encoded into
3834 * each command's tag are 3 bits which communicate to the controller
3835 * which of the eight sizes that command fits within. The size of
3836 * each command depends on how many scatter gather entries there are.
3837 * Each SG entry requires 16 bytes. The eight registers are programmed
3838 * with the number of 16-byte blocks a command of that size requires.
3839 * The smallest command possible requires 5 such 16 byte blocks.
3840 * the largest command possible requires MAXSGENTRIES + 4 16-byte
3841 * blocks. Note, this only extends to the SG entries contained
3842 * within the command block, and does not extend to chained blocks
3843 * of SG elements. bft[] contains the eight values we write to
3844 * the registers. They are not evenly distributed, but have more
3845 * sizes for small commands, and fewer sizes for larger commands.
3846 */
3847 int bft[8] = {5, 6, 8, 10, 12, 20, 28, MAXSGENTRIES + 4};
3848 BUILD_BUG_ON(28 > MAXSGENTRIES + 4);
3830 /* 5 = 1 s/g entry or 4k 3849 /* 5 = 1 s/g entry or 4k
3831 * 6 = 2 s/g entry or 8k 3850 * 6 = 2 s/g entry or 8k
3832 * 8 = 4 s/g entry or 16k 3851 * 8 = 4 s/g entry or 16k