diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2010-05-27 16:13:27 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-27 13:01:08 -0400 |
commit | b93d7536eaa1206ad4a00ad8ea700ff0bd75a0da (patch) | |
tree | b454aba91e44c26fd7073fb9f38850fd87f6d02d /drivers/scsi/hpsa.c | |
parent | 204892e9717790cd17689aaebf2790a477492734 (diff) |
[SCSI] hpsa: hpsa factor out hpsa_find_board_params
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r-- | drivers/scsi/hpsa.c | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 4983f3452dc4..dcbe54b1dfba 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) | |||
3348 | return 0; | 3348 | return 0; |
3349 | } | 3349 | } |
3350 | 3350 | ||
3351 | /* Interrogate the hardware for some limits: | ||
3352 | * max commands, max SG elements without chaining, and with chaining, | ||
3353 | * SG chain block size, etc. | ||
3354 | */ | ||
3355 | static void __devinit hpsa_find_board_params(struct ctlr_info *h) | ||
3356 | { | ||
3357 | h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands)); | ||
3358 | h->nr_cmds = h->max_commands - 4; /* Allow room for some ioctls */ | ||
3359 | h->maxsgentries = readl(&(h->cfgtable->MaxScatterGatherElements)); | ||
3360 | /* | ||
3361 | * Limit in-command s/g elements to 32 save dma'able memory. | ||
3362 | * Howvever spec says if 0, use 31 | ||
3363 | */ | ||
3364 | h->max_cmd_sg_entries = 31; | ||
3365 | if (h->maxsgentries > 512) { | ||
3366 | h->max_cmd_sg_entries = 32; | ||
3367 | h->chainsize = h->maxsgentries - h->max_cmd_sg_entries + 1; | ||
3368 | h->maxsgentries--; /* save one for chain pointer */ | ||
3369 | } else { | ||
3370 | h->maxsgentries = 31; /* default to traditional values */ | ||
3371 | h->chainsize = 0; | ||
3372 | } | ||
3373 | } | ||
3374 | |||
3351 | static int __devinit hpsa_pci_init(struct ctlr_info *h) | 3375 | static int __devinit hpsa_pci_init(struct ctlr_info *h) |
3352 | { | 3376 | { |
3353 | int i, prod_index, err; | 3377 | int i, prod_index, err; |
@@ -3389,27 +3413,7 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h) | |||
3389 | err = hpsa_find_cfgtables(h); | 3413 | err = hpsa_find_cfgtables(h); |
3390 | if (err) | 3414 | if (err) |
3391 | goto err_out_free_res; | 3415 | goto err_out_free_res; |
3392 | 3416 | hpsa_find_board_params(h); | |
3393 | h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands)); | ||
3394 | h->maxsgentries = readl(&(h->cfgtable->MaxScatterGatherElements)); | ||
3395 | |||
3396 | /* | ||
3397 | * Limit in-command s/g elements to 32 save dma'able memory. | ||
3398 | * Howvever spec says if 0, use 31 | ||
3399 | */ | ||
3400 | |||
3401 | h->max_cmd_sg_entries = 31; | ||
3402 | if (h->maxsgentries > 512) { | ||
3403 | h->max_cmd_sg_entries = 32; | ||
3404 | h->chainsize = h->maxsgentries - h->max_cmd_sg_entries + 1; | ||
3405 | h->maxsgentries--; /* save one for chain pointer */ | ||
3406 | } else { | ||
3407 | h->maxsgentries = 31; /* default to traditional values */ | ||
3408 | h->chainsize = 0; | ||
3409 | } | ||
3410 | |||
3411 | /* Allow room for some ioctls */ | ||
3412 | h->nr_cmds = h->max_commands - 4; | ||
3413 | 3417 | ||
3414 | if ((readb(&h->cfgtable->Signature[0]) != 'C') || | 3418 | if ((readb(&h->cfgtable->Signature[0]) != 'C') || |
3415 | (readb(&h->cfgtable->Signature[1]) != 'I') || | 3419 | (readb(&h->cfgtable->Signature[1]) != 'I') || |