2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-21 03:33:59 +08:00

[SCSI] hpsa: do ioaccel mode 2 resource allocations

Signed-off-by: Mike Miller <michael.miller@canonical.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
Stephen M. Cameron 2014-02-18 13:56:14 -06:00 committed by James Bottomley
parent 1f7cee8c7d
commit aca9012a41
2 changed files with 53 additions and 0 deletions

View File

@ -5291,6 +5291,10 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h)
pci_free_consistent(h->pdev, pci_free_consistent(h->pdev,
h->nr_cmds * sizeof(struct CommandList), h->nr_cmds * sizeof(struct CommandList),
h->cmd_pool, h->cmd_pool_dhandle); h->cmd_pool, h->cmd_pool_dhandle);
if (h->ioaccel2_cmd_pool)
pci_free_consistent(h->pdev,
h->nr_cmds * sizeof(*h->ioaccel2_cmd_pool),
h->ioaccel2_cmd_pool, h->ioaccel2_cmd_pool_dhandle);
if (h->errinfo_pool) if (h->errinfo_pool)
pci_free_consistent(h->pdev, pci_free_consistent(h->pdev,
h->nr_cmds * sizeof(struct ErrorInfo), h->nr_cmds * sizeof(struct ErrorInfo),
@ -5829,6 +5833,7 @@ static void hpsa_remove_one(struct pci_dev *pdev)
kfree(h->cmd_pool_bits); kfree(h->cmd_pool_bits);
kfree(h->blockFetchTable); kfree(h->blockFetchTable);
kfree(h->ioaccel1_blockFetchTable); kfree(h->ioaccel1_blockFetchTable);
kfree(h->ioaccel2_blockFetchTable);
kfree(h->hba_inquiry_data); kfree(h->hba_inquiry_data);
pci_disable_device(pdev); pci_disable_device(pdev);
pci_release_regions(pdev); pci_release_regions(pdev);
@ -6048,6 +6053,44 @@ clean_up:
return 1; return 1;
} }
static int ioaccel2_alloc_cmds_and_bft(struct ctlr_info *h)
{
/* Allocate ioaccel2 mode command blocks and block fetch table */
h->ioaccel_maxsg =
readl(&(h->cfgtable->io_accel_max_embedded_sg_count));
if (h->ioaccel_maxsg > IOACCEL2_MAXSGENTRIES)
h->ioaccel_maxsg = IOACCEL2_MAXSGENTRIES;
#define IOACCEL2_COMMANDLIST_ALIGNMENT 128
BUILD_BUG_ON(sizeof(struct io_accel2_cmd) %
IOACCEL2_COMMANDLIST_ALIGNMENT);
h->ioaccel2_cmd_pool =
pci_alloc_consistent(h->pdev,
h->nr_cmds * sizeof(*h->ioaccel2_cmd_pool),
&(h->ioaccel2_cmd_pool_dhandle));
h->ioaccel2_blockFetchTable =
kmalloc(((h->ioaccel_maxsg + 1) *
sizeof(u32)), GFP_KERNEL);
if ((h->ioaccel2_cmd_pool == NULL) ||
(h->ioaccel2_blockFetchTable == NULL))
goto clean_up;
memset(h->ioaccel2_cmd_pool, 0,
h->nr_cmds * sizeof(*h->ioaccel2_cmd_pool));
return 0;
clean_up:
if (h->ioaccel2_cmd_pool)
pci_free_consistent(h->pdev,
h->nr_cmds * sizeof(*h->ioaccel2_cmd_pool),
h->ioaccel2_cmd_pool, h->ioaccel2_cmd_pool_dhandle);
kfree(h->ioaccel2_blockFetchTable);
return 1;
}
static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h) static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h)
{ {
u32 trans_support; u32 trans_support;
@ -6064,6 +6107,13 @@ static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h)
CFGTBL_Trans_enable_directed_msix; CFGTBL_Trans_enable_directed_msix;
if (hpsa_alloc_ioaccel_cmd_and_bft(h)) if (hpsa_alloc_ioaccel_cmd_and_bft(h))
goto clean_up; goto clean_up;
} else {
if (trans_support & CFGTBL_Trans_io_accel2) {
transMethod |= CFGTBL_Trans_io_accel2 |
CFGTBL_Trans_enable_directed_msix;
if (ioaccel2_alloc_cmds_and_bft(h))
goto clean_up;
}
} }
/* TODO, check that this next line h->nreply_queues is correct */ /* TODO, check that this next line h->nreply_queues is correct */

View File

@ -105,6 +105,8 @@ struct ctlr_info {
dma_addr_t cmd_pool_dhandle; dma_addr_t cmd_pool_dhandle;
struct io_accel1_cmd *ioaccel_cmd_pool; struct io_accel1_cmd *ioaccel_cmd_pool;
dma_addr_t ioaccel_cmd_pool_dhandle; dma_addr_t ioaccel_cmd_pool_dhandle;
struct io_accel2_cmd *ioaccel2_cmd_pool;
dma_addr_t ioaccel2_cmd_pool_dhandle;
struct ErrorInfo *errinfo_pool; struct ErrorInfo *errinfo_pool;
dma_addr_t errinfo_pool_dhandle; dma_addr_t errinfo_pool_dhandle;
unsigned long *cmd_pool_bits; unsigned long *cmd_pool_bits;
@ -139,6 +141,7 @@ struct ctlr_info {
dma_addr_t reply_pool_dhandle; dma_addr_t reply_pool_dhandle;
u32 *blockFetchTable; u32 *blockFetchTable;
u32 *ioaccel1_blockFetchTable; u32 *ioaccel1_blockFetchTable;
u32 *ioaccel2_blockFetchTable;
unsigned char *hba_inquiry_data; unsigned char *hba_inquiry_data;
u32 driver_support; u32 driver_support;
u32 fw_support; u32 fw_support;