Commit 60ee6529 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Martin K. Petersen

scsi: megaraid_sas: switch to generic DMA API

Switch from the legacy PCI DMA API to the generic DMA API.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarSumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 66e3a241
...@@ -1330,11 +1330,11 @@ megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp, ...@@ -1330,11 +1330,11 @@ megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp,
device_id = MEGASAS_DEV_INDEX(scp); device_id = MEGASAS_DEV_INDEX(scp);
pthru = (struct megasas_pthru_frame *)cmd->frame; pthru = (struct megasas_pthru_frame *)cmd->frame;
if (scp->sc_data_direction == PCI_DMA_TODEVICE) if (scp->sc_data_direction == DMA_TO_DEVICE)
flags = MFI_FRAME_DIR_WRITE; flags = MFI_FRAME_DIR_WRITE;
else if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) else if (scp->sc_data_direction == DMA_FROM_DEVICE)
flags = MFI_FRAME_DIR_READ; flags = MFI_FRAME_DIR_READ;
else if (scp->sc_data_direction == PCI_DMA_NONE) else if (scp->sc_data_direction == DMA_NONE)
flags = MFI_FRAME_DIR_NONE; flags = MFI_FRAME_DIR_NONE;
if (instance->flag_ieee == 1) { if (instance->flag_ieee == 1) {
...@@ -1428,9 +1428,9 @@ megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp, ...@@ -1428,9 +1428,9 @@ megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp,
device_id = MEGASAS_DEV_INDEX(scp); device_id = MEGASAS_DEV_INDEX(scp);
ldio = (struct megasas_io_frame *)cmd->frame; ldio = (struct megasas_io_frame *)cmd->frame;
if (scp->sc_data_direction == PCI_DMA_TODEVICE) if (scp->sc_data_direction == DMA_TO_DEVICE)
flags = MFI_FRAME_DIR_WRITE; flags = MFI_FRAME_DIR_WRITE;
else if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) else if (scp->sc_data_direction == DMA_FROM_DEVICE)
flags = MFI_FRAME_DIR_READ; flags = MFI_FRAME_DIR_READ;
if (instance->flag_ieee == 1) { if (instance->flag_ieee == 1) {
...@@ -2240,9 +2240,9 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance, ...@@ -2240,9 +2240,9 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance,
sizeof(struct MR_LD_VF_AFFILIATION_111)); sizeof(struct MR_LD_VF_AFFILIATION_111));
else { else {
new_affiliation_111 = new_affiliation_111 =
pci_zalloc_consistent(instance->pdev, dma_zalloc_coherent(&instance->pdev->dev,
sizeof(struct MR_LD_VF_AFFILIATION_111), sizeof(struct MR_LD_VF_AFFILIATION_111),
&new_affiliation_111_h); &new_affiliation_111_h, GFP_KERNEL);
if (!new_affiliation_111) { if (!new_affiliation_111) {
dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate " dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "
"memory for new affiliation for scsi%d\n", "memory for new affiliation for scsi%d\n",
...@@ -2302,7 +2302,7 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance, ...@@ -2302,7 +2302,7 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance,
} }
out: out:
if (new_affiliation_111) { if (new_affiliation_111) {
pci_free_consistent(instance->pdev, dma_free_coherent(&instance->pdev->dev,
sizeof(struct MR_LD_VF_AFFILIATION_111), sizeof(struct MR_LD_VF_AFFILIATION_111),
new_affiliation_111, new_affiliation_111,
new_affiliation_111_h); new_affiliation_111_h);
...@@ -2347,10 +2347,10 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance, ...@@ -2347,10 +2347,10 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance,
sizeof(struct MR_LD_VF_AFFILIATION)); sizeof(struct MR_LD_VF_AFFILIATION));
else { else {
new_affiliation = new_affiliation =
pci_zalloc_consistent(instance->pdev, dma_zalloc_coherent(&instance->pdev->dev,
(MAX_LOGICAL_DRIVES + 1) * (MAX_LOGICAL_DRIVES + 1) *
sizeof(struct MR_LD_VF_AFFILIATION), sizeof(struct MR_LD_VF_AFFILIATION),
&new_affiliation_h); &new_affiliation_h, GFP_KERNEL);
if (!new_affiliation) { if (!new_affiliation) {
dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate " dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "
"memory for new affiliation for scsi%d\n", "memory for new affiliation for scsi%d\n",
...@@ -2470,7 +2470,7 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance, ...@@ -2470,7 +2470,7 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance,
} }
if (new_affiliation) if (new_affiliation)
pci_free_consistent(instance->pdev, dma_free_coherent(&instance->pdev->dev,
(MAX_LOGICAL_DRIVES + 1) * (MAX_LOGICAL_DRIVES + 1) *
sizeof(struct MR_LD_VF_AFFILIATION), sizeof(struct MR_LD_VF_AFFILIATION),
new_affiliation, new_affiliation_h); new_affiliation, new_affiliation_h);
...@@ -2513,9 +2513,9 @@ int megasas_sriov_start_heartbeat(struct megasas_instance *instance, ...@@ -2513,9 +2513,9 @@ int megasas_sriov_start_heartbeat(struct megasas_instance *instance,
if (initial) { if (initial) {
instance->hb_host_mem = instance->hb_host_mem =
pci_zalloc_consistent(instance->pdev, dma_zalloc_coherent(&instance->pdev->dev,
sizeof(struct MR_CTRL_HB_HOST_MEM), sizeof(struct MR_CTRL_HB_HOST_MEM),
&instance->hb_host_mem_h); &instance->hb_host_mem_h, GFP_KERNEL);
if (!instance->hb_host_mem) { if (!instance->hb_host_mem) {
dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate" dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate"
" memory for heartbeat host memory for scsi%d\n", " memory for heartbeat host memory for scsi%d\n",
...@@ -4995,9 +4995,8 @@ megasas_init_adapter_mfi(struct megasas_instance *instance) ...@@ -4995,9 +4995,8 @@ megasas_init_adapter_mfi(struct megasas_instance *instance)
context_sz = sizeof(u32); context_sz = sizeof(u32);
reply_q_sz = context_sz * (instance->max_fw_cmds + 1); reply_q_sz = context_sz * (instance->max_fw_cmds + 1);
instance->reply_queue = pci_alloc_consistent(instance->pdev, instance->reply_queue = dma_alloc_coherent(&instance->pdev->dev,
reply_q_sz, reply_q_sz, &instance->reply_queue_h, GFP_KERNEL);
&instance->reply_queue_h);
if (!instance->reply_queue) { if (!instance->reply_queue) {
dev_printk(KERN_DEBUG, &instance->pdev->dev, "Out of DMA mem for reply queue\n"); dev_printk(KERN_DEBUG, &instance->pdev->dev, "Out of DMA mem for reply queue\n");
...@@ -5029,7 +5028,7 @@ megasas_init_adapter_mfi(struct megasas_instance *instance) ...@@ -5029,7 +5028,7 @@ megasas_init_adapter_mfi(struct megasas_instance *instance)
fail_fw_init: fail_fw_init:
pci_free_consistent(instance->pdev, reply_q_sz, dma_free_coherent(&instance->pdev->dev, reply_q_sz,
instance->reply_queue, instance->reply_queue_h); instance->reply_queue, instance->reply_queue_h);
fail_reply_queue: fail_reply_queue:
megasas_free_cmds(instance); megasas_free_cmds(instance);
...@@ -5533,7 +5532,7 @@ static int megasas_init_fw(struct megasas_instance *instance) ...@@ -5533,7 +5532,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
else { else {
if (instance->crash_dump_buf) if (instance->crash_dump_buf)
pci_free_consistent(instance->pdev, dma_free_coherent(&instance->pdev->dev,
CRASH_DMA_BUF_SIZE, CRASH_DMA_BUF_SIZE,
instance->crash_dump_buf, instance->crash_dump_buf,
instance->crash_dump_h); instance->crash_dump_h);
...@@ -5616,7 +5615,7 @@ static void megasas_release_mfi(struct megasas_instance *instance) ...@@ -5616,7 +5615,7 @@ static void megasas_release_mfi(struct megasas_instance *instance)
u32 reply_q_sz = sizeof(u32) *(instance->max_mfi_cmds + 1); u32 reply_q_sz = sizeof(u32) *(instance->max_mfi_cmds + 1);
if (instance->reply_queue) if (instance->reply_queue)
pci_free_consistent(instance->pdev, reply_q_sz, dma_free_coherent(&instance->pdev->dev, reply_q_sz,
instance->reply_queue, instance->reply_queue_h); instance->reply_queue, instance->reply_queue_h);
megasas_free_cmds(instance); megasas_free_cmds(instance);
...@@ -5655,10 +5654,9 @@ megasas_get_seq_num(struct megasas_instance *instance, ...@@ -5655,10 +5654,9 @@ megasas_get_seq_num(struct megasas_instance *instance,
} }
dcmd = &cmd->frame->dcmd; dcmd = &cmd->frame->dcmd;
el_info = pci_zalloc_consistent(instance->pdev, el_info = dma_zalloc_coherent(&instance->pdev->dev,
sizeof(struct megasas_evt_log_info), sizeof(struct megasas_evt_log_info), &el_info_h,
&el_info_h); GFP_KERNEL);
if (!el_info) { if (!el_info) {
megasas_return_cmd(instance, cmd); megasas_return_cmd(instance, cmd);
return -ENOMEM; return -ENOMEM;
...@@ -5695,7 +5693,8 @@ megasas_get_seq_num(struct megasas_instance *instance, ...@@ -5695,7 +5693,8 @@ megasas_get_seq_num(struct megasas_instance *instance,
eli->boot_seq_num = el_info->boot_seq_num; eli->boot_seq_num = el_info->boot_seq_num;
dcmd_failed: dcmd_failed:
pci_free_consistent(instance->pdev, sizeof(struct megasas_evt_log_info), dma_free_coherent(&instance->pdev->dev,
sizeof(struct megasas_evt_log_info),
el_info, el_info_h); el_info, el_info_h);
megasas_return_cmd(instance, cmd); megasas_return_cmd(instance, cmd);
...@@ -6134,10 +6133,10 @@ static inline void megasas_set_adapter_type(struct megasas_instance *instance) ...@@ -6134,10 +6133,10 @@ static inline void megasas_set_adapter_type(struct megasas_instance *instance)
static inline int megasas_alloc_mfi_ctrl_mem(struct megasas_instance *instance) static inline int megasas_alloc_mfi_ctrl_mem(struct megasas_instance *instance)
{ {
instance->producer = pci_alloc_consistent(instance->pdev, sizeof(u32), instance->producer = dma_alloc_coherent(&instance->pdev->dev,
&instance->producer_h); sizeof(u32), &instance->producer_h, GFP_KERNEL);
instance->consumer = pci_alloc_consistent(instance->pdev, sizeof(u32), instance->consumer = dma_alloc_coherent(&instance->pdev->dev,
&instance->consumer_h); sizeof(u32), &instance->consumer_h, GFP_KERNEL);
if (!instance->producer || !instance->consumer) { if (!instance->producer || !instance->consumer) {
dev_err(&instance->pdev->dev, dev_err(&instance->pdev->dev,
...@@ -6199,11 +6198,11 @@ static inline void megasas_free_ctrl_mem(struct megasas_instance *instance) ...@@ -6199,11 +6198,11 @@ static inline void megasas_free_ctrl_mem(struct megasas_instance *instance)
kfree(instance->reply_map); kfree(instance->reply_map);
if (instance->adapter_type == MFI_SERIES) { if (instance->adapter_type == MFI_SERIES) {
if (instance->producer) if (instance->producer)
pci_free_consistent(instance->pdev, sizeof(u32), dma_free_coherent(&instance->pdev->dev, sizeof(u32),
instance->producer, instance->producer,
instance->producer_h); instance->producer_h);
if (instance->consumer) if (instance->consumer)
pci_free_consistent(instance->pdev, sizeof(u32), dma_free_coherent(&instance->pdev->dev, sizeof(u32),
instance->consumer, instance->consumer,
instance->consumer_h); instance->consumer_h);
} else { } else {
...@@ -6224,10 +6223,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) ...@@ -6224,10 +6223,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance)
struct pci_dev *pdev = instance->pdev; struct pci_dev *pdev = instance->pdev;
struct fusion_context *fusion = instance->ctrl_context; struct fusion_context *fusion = instance->ctrl_context;
instance->evt_detail = instance->evt_detail = dma_alloc_coherent(&pdev->dev,
pci_alloc_consistent(pdev,
sizeof(struct megasas_evt_detail), sizeof(struct megasas_evt_detail),
&instance->evt_detail_h); &instance->evt_detail_h, GFP_KERNEL);
if (!instance->evt_detail) { if (!instance->evt_detail) {
dev_err(&instance->pdev->dev, dev_err(&instance->pdev->dev,
...@@ -6250,9 +6248,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) ...@@ -6250,9 +6248,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance)
} }
instance->pd_list_buf = instance->pd_list_buf =
pci_alloc_consistent(pdev, dma_alloc_coherent(&pdev->dev,
MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST), MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST),
&instance->pd_list_buf_h); &instance->pd_list_buf_h, GFP_KERNEL);
if (!instance->pd_list_buf) { if (!instance->pd_list_buf) {
dev_err(&pdev->dev, "Failed to allocate PD list buffer\n"); dev_err(&pdev->dev, "Failed to allocate PD list buffer\n");
...@@ -6260,9 +6258,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) ...@@ -6260,9 +6258,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance)
} }
instance->ctrl_info_buf = instance->ctrl_info_buf =
pci_alloc_consistent(pdev, dma_alloc_coherent(&pdev->dev,
sizeof(struct megasas_ctrl_info), sizeof(struct megasas_ctrl_info),
&instance->ctrl_info_buf_h); &instance->ctrl_info_buf_h, GFP_KERNEL);
if (!instance->ctrl_info_buf) { if (!instance->ctrl_info_buf) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
...@@ -6271,9 +6269,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) ...@@ -6271,9 +6269,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance)
} }
instance->ld_list_buf = instance->ld_list_buf =
pci_alloc_consistent(pdev, dma_alloc_coherent(&pdev->dev,
sizeof(struct MR_LD_LIST), sizeof(struct MR_LD_LIST),
&instance->ld_list_buf_h); &instance->ld_list_buf_h, GFP_KERNEL);
if (!instance->ld_list_buf) { if (!instance->ld_list_buf) {
dev_err(&pdev->dev, "Failed to allocate LD list buffer\n"); dev_err(&pdev->dev, "Failed to allocate LD list buffer\n");
...@@ -6281,9 +6279,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) ...@@ -6281,9 +6279,9 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance)
} }
instance->ld_targetid_list_buf = instance->ld_targetid_list_buf =
pci_alloc_consistent(pdev, dma_alloc_coherent(&pdev->dev,
sizeof(struct MR_LD_TARGETID_LIST), sizeof(struct MR_LD_TARGETID_LIST),
&instance->ld_targetid_list_buf_h); &instance->ld_targetid_list_buf_h, GFP_KERNEL);
if (!instance->ld_targetid_list_buf) { if (!instance->ld_targetid_list_buf) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
...@@ -6293,21 +6291,20 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance) ...@@ -6293,21 +6291,20 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance)
if (!reset_devices) { if (!reset_devices) {
instance->system_info_buf = instance->system_info_buf =
pci_alloc_consistent(pdev, dma_alloc_coherent(&pdev->dev,
sizeof(struct MR_DRV_SYSTEM_INFO), sizeof(struct MR_DRV_SYSTEM_INFO),
&instance->system_info_h); &instance->system_info_h, GFP_KERNEL);
instance->pd_info = instance->pd_info =
pci_alloc_consistent(pdev, dma_alloc_coherent(&pdev->dev,
sizeof(struct MR_PD_INFO), sizeof(struct MR_PD_INFO),
&instance->pd_info_h); &instance->pd_info_h, GFP_KERNEL);
instance->tgt_prop = instance->tgt_prop =
pci_alloc_consistent(pdev, dma_alloc_coherent(&pdev->dev,
sizeof(struct MR_TARGET_PROPERTIES), sizeof(struct MR_TARGET_PROPERTIES),
&instance->tgt_prop_h); &instance->tgt_prop_h, GFP_KERNEL);
instance->crash_dump_buf = instance->crash_dump_buf =
pci_alloc_consistent(pdev, dma_alloc_coherent(&pdev->dev, CRASH_DMA_BUF_SIZE,
CRASH_DMA_BUF_SIZE, &instance->crash_dump_h, GFP_KERNEL);
&instance->crash_dump_h);
if (!instance->system_info_buf) if (!instance->system_info_buf)
dev_err(&instance->pdev->dev, dev_err(&instance->pdev->dev,
...@@ -6343,7 +6340,7 @@ void megasas_free_ctrl_dma_buffers(struct megasas_instance *instance) ...@@ -6343,7 +6340,7 @@ void megasas_free_ctrl_dma_buffers(struct megasas_instance *instance)
struct fusion_context *fusion = instance->ctrl_context; struct fusion_context *fusion = instance->ctrl_context;
if (instance->evt_detail) if (instance->evt_detail)
pci_free_consistent(pdev, sizeof(struct megasas_evt_detail), dma_free_coherent(&pdev->dev, sizeof(struct megasas_evt_detail),
instance->evt_detail, instance->evt_detail,
instance->evt_detail_h); instance->evt_detail_h);
...@@ -6354,41 +6351,41 @@ void megasas_free_ctrl_dma_buffers(struct megasas_instance *instance) ...@@ -6354,41 +6351,41 @@ void megasas_free_ctrl_dma_buffers(struct megasas_instance *instance)
fusion->ioc_init_request_phys); fusion->ioc_init_request_phys);
if (instance->pd_list_buf) if (instance->pd_list_buf)
pci_free_consistent(pdev, dma_free_coherent(&pdev->dev,
MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST), MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST),
instance->pd_list_buf, instance->pd_list_buf,
instance->pd_list_buf_h); instance->pd_list_buf_h);
if (instance->ld_list_buf) if (instance->ld_list_buf)
pci_free_consistent(pdev, sizeof(struct MR_LD_LIST), dma_free_coherent(&pdev->dev, sizeof(struct MR_LD_LIST),
instance->ld_list_buf, instance->ld_list_buf,
instance->ld_list_buf_h); instance->ld_list_buf_h);
if (instance->ld_targetid_list_buf) if (instance->ld_targetid_list_buf)
pci_free_consistent(pdev, sizeof(struct MR_LD_TARGETID_LIST), dma_free_coherent(&pdev->dev, sizeof(struct MR_LD_TARGETID_LIST),
instance->ld_targetid_list_buf, instance->ld_targetid_list_buf,
instance->ld_targetid_list_buf_h); instance->ld_targetid_list_buf_h);
if (instance->ctrl_info_buf) if (instance->ctrl_info_buf)
pci_free_consistent(pdev, sizeof(struct megasas_ctrl_info), dma_free_coherent(&pdev->dev, sizeof(struct megasas_ctrl_info),
instance->ctrl_info_buf, instance->ctrl_info_buf,
instance->ctrl_info_buf_h); instance->ctrl_info_buf_h);
if (instance->system_info_buf) if (instance->system_info_buf)
pci_free_consistent(pdev, sizeof(struct MR_DRV_SYSTEM_INFO), dma_free_coherent(&pdev->dev, sizeof(struct MR_DRV_SYSTEM_INFO),
instance->system_info_buf, instance->system_info_buf,
instance->system_info_h); instance->system_info_h);
if (instance->pd_info) if (instance->pd_info)
pci_free_consistent(pdev, sizeof(struct MR_PD_INFO), dma_free_coherent(&pdev->dev, sizeof(struct MR_PD_INFO),
instance->pd_info, instance->pd_info_h); instance->pd_info, instance->pd_info_h);
if (instance->tgt_prop) if (instance->tgt_prop)
pci_free_consistent(pdev, sizeof(struct MR_TARGET_PROPERTIES), dma_free_coherent(&pdev->dev, sizeof(struct MR_TARGET_PROPERTIES),
instance->tgt_prop, instance->tgt_prop_h); instance->tgt_prop, instance->tgt_prop_h);
if (instance->crash_dump_buf) if (instance->crash_dump_buf)
pci_free_consistent(pdev, CRASH_DMA_BUF_SIZE, dma_free_coherent(&pdev->dev, CRASH_DMA_BUF_SIZE,
instance->crash_dump_buf, instance->crash_dump_buf,
instance->crash_dump_h); instance->crash_dump_h);
} }
...@@ -6516,17 +6513,20 @@ static int megasas_probe_one(struct pci_dev *pdev, ...@@ -6516,17 +6513,20 @@ static int megasas_probe_one(struct pci_dev *pdev,
if (instance->requestorId) { if (instance->requestorId) {
if (instance->PlasmaFW111) { if (instance->PlasmaFW111) {
instance->vf_affiliation_111 = instance->vf_affiliation_111 =
pci_alloc_consistent(pdev, sizeof(struct MR_LD_VF_AFFILIATION_111), dma_alloc_coherent(&pdev->dev,
&instance->vf_affiliation_111_h); sizeof(struct MR_LD_VF_AFFILIATION_111),
&instance->vf_affiliation_111_h,
GFP_KERNEL);
if (!instance->vf_affiliation_111) if (!instance->vf_affiliation_111)
dev_warn(&pdev->dev, "Can't allocate " dev_warn(&pdev->dev, "Can't allocate "
"memory for VF affiliation buffer\n"); "memory for VF affiliation buffer\n");
} else { } else {
instance->vf_affiliation = instance->vf_affiliation =
pci_alloc_consistent(pdev, dma_alloc_coherent(&pdev->dev,
(MAX_LOGICAL_DRIVES + 1) * (MAX_LOGICAL_DRIVES + 1) *
sizeof(struct MR_LD_VF_AFFILIATION), sizeof(struct MR_LD_VF_AFFILIATION),
&instance->vf_affiliation_h); &instance->vf_affiliation_h,
GFP_KERNEL);
if (!instance->vf_affiliation) if (!instance->vf_affiliation)
dev_warn(&pdev->dev, "Can't allocate " dev_warn(&pdev->dev, "Can't allocate "
"memory for VF affiliation buffer\n"); "memory for VF affiliation buffer\n");
...@@ -6994,19 +6994,19 @@ static void megasas_detach_one(struct pci_dev *pdev) ...@@ -6994,19 +6994,19 @@ static void megasas_detach_one(struct pci_dev *pdev)
} }
if (instance->vf_affiliation) if (instance->vf_affiliation)
pci_free_consistent(pdev, (MAX_LOGICAL_DRIVES + 1) * dma_free_coherent(&pdev->dev, (MAX_LOGICAL_DRIVES + 1) *
sizeof(struct MR_LD_VF_AFFILIATION), sizeof(struct MR_LD_VF_AFFILIATION),
instance->vf_affiliation, instance->vf_affiliation,
instance->vf_affiliation_h); instance->vf_affiliation_h);
if (instance->vf_affiliation_111) if (instance->vf_affiliation_111)
pci_free_consistent(pdev, dma_free_coherent(&pdev->dev,
sizeof(struct MR_LD_VF_AFFILIATION_111), sizeof(struct MR_LD_VF_AFFILIATION_111),
instance->vf_affiliation_111, instance->vf_affiliation_111,
instance->vf_affiliation_111_h); instance->vf_affiliation_111_h);
if (instance->hb_host_mem) if (instance->hb_host_mem)
pci_free_consistent(pdev, sizeof(struct MR_CTRL_HB_HOST_MEM), dma_free_coherent(&pdev->dev, sizeof(struct MR_CTRL_HB_HOST_MEM),
instance->hb_host_mem, instance->hb_host_mem,
instance->hb_host_mem_h); instance->hb_host_mem_h);
...@@ -7254,7 +7254,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance, ...@@ -7254,7 +7254,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
/* /*
* We don't change the dma_coherent_mask, so * We don't change the dma_coherent_mask, so
* pci_alloc_consistent only returns 32bit addresses * dma_alloc_coherent only returns 32bit addresses
*/ */
if (instance->consistent_mask_64bit) { if (instance->consistent_mask_64bit) {
kern_sge64[i].phys_addr = cpu_to_le64(buf_handle); kern_sge64[i].phys_addr = cpu_to_le64(buf_handle);
......
...@@ -684,8 +684,8 @@ megasas_alloc_rdpq_fusion(struct megasas_instance *instance) ...@@ -684,8 +684,8 @@ megasas_alloc_rdpq_fusion(struct megasas_instance *instance)
array_size = sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) * array_size = sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) *
MAX_MSIX_QUEUES_FUSION; MAX_MSIX_QUEUES_FUSION;
fusion->rdpq_virt = pci_zalloc_consistent(instance->pdev, array_size, fusion->rdpq_virt = dma_zalloc_coherent(&instance->pdev->dev,
&fusion->rdpq_phys); array_size, &fusion->rdpq_phys, GFP_KERNEL);
if (!fusion->rdpq_virt) { if (!fusion->rdpq_virt) {
dev_err(&instance->pdev->dev, dev_err(&instance->pdev->dev,
"Failed from %s %d\n", __func__, __LINE__); "Failed from %s %d\n", __func__, __LINE__);
...@@ -813,7 +813,7 @@ megasas_free_rdpq_fusion(struct megasas_instance *instance) { ...@@ -813,7 +813,7 @@ megasas_free_rdpq_fusion(struct megasas_instance *instance) {
dma_pool_destroy(fusion->reply_frames_desc_pool_align); dma_pool_destroy(fusion->reply_frames_desc_pool_align);
if (fusion->rdpq_virt) if (fusion->rdpq_virt)
pci_free_consistent(instance->pdev, dma_free_coherent(&instance->pdev->dev,
sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) * MAX_MSIX_QUEUES_FUSION, sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) * MAX_MSIX_QUEUES_FUSION,
fusion->rdpq_virt, fusion->rdpq_phys); fusion->rdpq_virt, fusion->rdpq_phys);
} }
...@@ -2209,7 +2209,7 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len, ...@@ -2209,7 +2209,7 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len,
cdb[0] = MEGASAS_SCSI_VARIABLE_LENGTH_CMD; cdb[0] = MEGASAS_SCSI_VARIABLE_LENGTH_CMD;
cdb[7] = MEGASAS_SCSI_ADDL_CDB_LEN; cdb[7] = MEGASAS_SCSI_ADDL_CDB_LEN;
if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) if (scp->sc_data_direction == DMA_FROM_DEVICE)
cdb[9] = MEGASAS_SCSI_SERVICE_ACTION_READ32; cdb[9] = MEGASAS_SCSI_SERVICE_ACTION_READ32;
else else
cdb[9] = MEGASAS_SCSI_SERVICE_ACTION_WRITE32; cdb[9] = MEGASAS_SCSI_SERVICE_ACTION_WRITE32;
...@@ -2238,7 +2238,7 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len, ...@@ -2238,7 +2238,7 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len,
cdb[31] = (u8)(num_blocks & 0xff); cdb[31] = (u8)(num_blocks & 0xff);
/* set SCSI IO EEDPFlags */ /* set SCSI IO EEDPFlags */
if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) { if (scp->sc_data_direction == DMA_FROM_DEVICE) {
io_request->EEDPFlags = cpu_to_le16( io_request->EEDPFlags = cpu_to_le16(
MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG | MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG |
MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG | MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG |
...@@ -2621,7 +2621,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, ...@@ -2621,7 +2621,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,
scsi_buff_len = scsi_bufflen(scp); scsi_buff_len = scsi_bufflen(scp);
io_request->DataLength = cpu_to_le32(scsi_buff_len); io_request->DataLength = cpu_to_le32(scsi_buff_len);
if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) if (scp->sc_data_direction == DMA_FROM_DEVICE)
io_info.isRead = 1; io_info.isRead = 1;
local_map_ptr = fusion->ld_drv_map[(instance->map_id & 1)]; local_map_ptr = fusion->ld_drv_map[(instance->map_id & 1)];
...@@ -3088,9 +3088,9 @@ megasas_build_io_fusion(struct megasas_instance *instance, ...@@ -3088,9 +3088,9 @@ megasas_build_io_fusion(struct megasas_instance *instance,
io_request->SGLFlags = cpu_to_le16(MPI2_SGE_FLAGS_64_BIT_ADDRESSING); io_request->SGLFlags = cpu_to_le16(MPI2_SGE_FLAGS_64_BIT_ADDRESSING);
if (scp->sc_data_direction == PCI_DMA_TODEVICE) if (scp->sc_data_direction == DMA_TO_DEVICE)
io_request->Control |= cpu_to_le32(MPI2_SCSIIO_CONTROL_WRITE); io_request->Control |= cpu_to_le32(MPI2_SCSIIO_CONTROL_WRITE);
else if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) else if (scp->sc_data_direction == DMA_FROM_DEVICE)
io_request->Control |= cpu_to_le32(MPI2_SCSIIO_CONTROL_READ); io_request->Control |= cpu_to_le32(MPI2_SCSIIO_CONTROL_READ);
io_request->SGLOffset0 = io_request->SGLOffset0 =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment