From: Stephen M. Cameron Date: Thu, 27 May 2010 20:13:27 +0000 (-0500) Subject: [SCSI] hpsa: hpsa factor out hpsa_find_board_params X-Git-Tag: v2.6.36-rc1~570^2~264 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b93d7536eaa1206ad4a00ad8ea700ff0bd75a0da;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git [SCSI] hpsa: hpsa factor out hpsa_find_board_params Signed-off-by: Stephen M. Cameron Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 4983f34..dcbe54b 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -3348,6 +3348,30 @@ static int __devinit hpsa_find_cfgtables(struct ctlr_info *h) return 0; } +/* Interrogate the hardware for some limits: + * max commands, max SG elements without chaining, and with chaining, + * SG chain block size, etc. + */ +static void __devinit hpsa_find_board_params(struct ctlr_info *h) +{ + h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands)); + h->nr_cmds = h->max_commands - 4; /* Allow room for some ioctls */ + h->maxsgentries = readl(&(h->cfgtable->MaxScatterGatherElements)); + /* + * Limit in-command s/g elements to 32 save dma'able memory. + * Howvever spec says if 0, use 31 + */ + h->max_cmd_sg_entries = 31; + if (h->maxsgentries > 512) { + h->max_cmd_sg_entries = 32; + h->chainsize = h->maxsgentries - h->max_cmd_sg_entries + 1; + h->maxsgentries--; /* save one for chain pointer */ + } else { + h->maxsgentries = 31; /* default to traditional values */ + h->chainsize = 0; + } +} + static int __devinit hpsa_pci_init(struct ctlr_info *h) { int i, prod_index, err; @@ -3389,27 +3413,7 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h) err = hpsa_find_cfgtables(h); if (err) goto err_out_free_res; - - h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands)); - h->maxsgentries = readl(&(h->cfgtable->MaxScatterGatherElements)); - - /* - * Limit in-command s/g elements to 32 save dma'able memory. - * Howvever spec says if 0, use 31 - */ - - h->max_cmd_sg_entries = 31; - if (h->maxsgentries > 512) { - h->max_cmd_sg_entries = 32; - h->chainsize = h->maxsgentries - h->max_cmd_sg_entries + 1; - h->maxsgentries--; /* save one for chain pointer */ - } else { - h->maxsgentries = 31; /* default to traditional values */ - h->chainsize = 0; - } - - /* Allow room for some ioctls */ - h->nr_cmds = h->max_commands - 4; + hpsa_find_board_params(h); if ((readb(&h->cfgtable->Signature[0]) != 'C') || (readb(&h->cfgtable->Signature[1]) != 'I') ||