@@ -208,7 +208,7 @@ module_param(ips, charp, 0);
208
208
209
209
#define IPS_DMA_DIR (scb ) ((!scb->scsi_cmd || ips_is_passthru(scb->scsi_cmd) || \
210
210
DMA_NONE == scb->scsi_cmd->sc_data_direction) ? \
211
- PCI_DMA_BIDIRECTIONAL : \
211
+ DMA_BIDIRECTIONAL : \
212
212
scb->scsi_cmd->sc_data_direction)
213
213
214
214
#ifdef IPS_DEBUG
@@ -1529,11 +1529,12 @@ ips_alloc_passthru_buffer(ips_ha_t * ha, int length)
1529
1529
if (ha -> ioctl_data && length <= ha -> ioctl_len )
1530
1530
return 0 ;
1531
1531
/* there is no buffer or it's not big enough, allocate a new one */
1532
- bigger_buf = pci_alloc_consistent (ha -> pcidev , length , & dma_busaddr );
1532
+ bigger_buf = dma_alloc_coherent (& ha -> pcidev -> dev , length , & dma_busaddr ,
1533
+ GFP_KERNEL );
1533
1534
if (bigger_buf ) {
1534
1535
/* free the old memory */
1535
- pci_free_consistent ( ha -> pcidev , ha -> ioctl_len , ha -> ioctl_data ,
1536
- ha -> ioctl_busaddr );
1536
+ dma_free_coherent ( & ha -> pcidev -> dev , ha -> ioctl_len ,
1537
+ ha -> ioctl_data , ha -> ioctl_busaddr );
1537
1538
/* use the new memory */
1538
1539
ha -> ioctl_data = (char * ) bigger_buf ;
1539
1540
ha -> ioctl_len = length ;
@@ -1678,9 +1679,8 @@ ips_flash_copperhead(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb)
1678
1679
} else if (!ha -> flash_data ) {
1679
1680
datasize = pt -> CoppCP .cmd .flashfw .total_packets *
1680
1681
pt -> CoppCP .cmd .flashfw .count ;
1681
- ha -> flash_data = pci_alloc_consistent (ha -> pcidev ,
1682
- datasize ,
1683
- & ha -> flash_busaddr );
1682
+ ha -> flash_data = dma_alloc_coherent (& ha -> pcidev -> dev ,
1683
+ datasize , & ha -> flash_busaddr , GFP_KERNEL );
1684
1684
if (!ha -> flash_data ){
1685
1685
printk (KERN_WARNING "Unable to allocate a flash buffer\n" );
1686
1686
return IPS_FAILURE ;
@@ -1858,7 +1858,7 @@ ips_flash_firmware(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb)
1858
1858
1859
1859
scb -> data_len = ha -> flash_datasize ;
1860
1860
scb -> data_busaddr =
1861
- pci_map_single ( ha -> pcidev , ha -> flash_data , scb -> data_len ,
1861
+ dma_map_single ( & ha -> pcidev -> dev , ha -> flash_data , scb -> data_len ,
1862
1862
IPS_DMA_DIR (scb ));
1863
1863
scb -> flags |= IPS_SCB_MAP_SINGLE ;
1864
1864
scb -> cmd .flashfw .command_id = IPS_COMMAND_ID (ha , scb );
@@ -1880,8 +1880,8 @@ ips_free_flash_copperhead(ips_ha_t * ha)
1880
1880
if (ha -> flash_data == ips_FlashData )
1881
1881
test_and_clear_bit (0 , & ips_FlashDataInUse );
1882
1882
else if (ha -> flash_data )
1883
- pci_free_consistent ( ha -> pcidev , ha -> flash_len , ha -> flash_data ,
1884
- ha -> flash_busaddr );
1883
+ dma_free_coherent ( & ha -> pcidev -> dev , ha -> flash_len ,
1884
+ ha -> flash_data , ha -> flash_busaddr );
1885
1885
ha -> flash_data = NULL ;
1886
1886
}
1887
1887
@@ -4213,7 +4213,7 @@ ips_free(ips_ha_t * ha)
4213
4213
4214
4214
if (ha ) {
4215
4215
if (ha -> enq ) {
4216
- pci_free_consistent ( ha -> pcidev , sizeof (IPS_ENQ ),
4216
+ dma_free_coherent ( & ha -> pcidev -> dev , sizeof (IPS_ENQ ),
4217
4217
ha -> enq , ha -> enq_busaddr );
4218
4218
ha -> enq = NULL ;
4219
4219
}
@@ -4222,15 +4222,15 @@ ips_free(ips_ha_t * ha)
4222
4222
ha -> conf = NULL ;
4223
4223
4224
4224
if (ha -> adapt ) {
4225
- pci_free_consistent ( ha -> pcidev ,
4225
+ dma_free_coherent ( & ha -> pcidev -> dev ,
4226
4226
sizeof (IPS_ADAPTER ) +
4227
4227
sizeof (IPS_IO_CMD ), ha -> adapt ,
4228
4228
ha -> adapt -> hw_status_start );
4229
4229
ha -> adapt = NULL ;
4230
4230
}
4231
4231
4232
4232
if (ha -> logical_drive_info ) {
4233
- pci_free_consistent ( ha -> pcidev ,
4233
+ dma_free_coherent ( & ha -> pcidev -> dev ,
4234
4234
sizeof (IPS_LD_INFO ),
4235
4235
ha -> logical_drive_info ,
4236
4236
ha -> logical_drive_info_dma_addr );
@@ -4244,7 +4244,7 @@ ips_free(ips_ha_t * ha)
4244
4244
ha -> subsys = NULL ;
4245
4245
4246
4246
if (ha -> ioctl_data ) {
4247
- pci_free_consistent ( ha -> pcidev , ha -> ioctl_len ,
4247
+ dma_free_coherent ( & ha -> pcidev -> dev , ha -> ioctl_len ,
4248
4248
ha -> ioctl_data , ha -> ioctl_busaddr );
4249
4249
ha -> ioctl_data = NULL ;
4250
4250
ha -> ioctl_datasize = 0 ;
@@ -4277,11 +4277,11 @@ static int
4277
4277
ips_deallocatescbs (ips_ha_t * ha , int cmds )
4278
4278
{
4279
4279
if (ha -> scbs ) {
4280
- pci_free_consistent ( ha -> pcidev ,
4280
+ dma_free_coherent ( & ha -> pcidev -> dev ,
4281
4281
IPS_SGLIST_SIZE (ha ) * IPS_MAX_SG * cmds ,
4282
4282
ha -> scbs -> sg_list .list ,
4283
4283
ha -> scbs -> sg_busaddr );
4284
- pci_free_consistent ( ha -> pcidev , sizeof (ips_scb_t ) * cmds ,
4284
+ dma_free_coherent ( & ha -> pcidev -> dev , sizeof (ips_scb_t ) * cmds ,
4285
4285
ha -> scbs , ha -> scbs -> scb_busaddr );
4286
4286
ha -> scbs = NULL ;
4287
4287
} /* end if */
@@ -4308,17 +4308,16 @@ ips_allocatescbs(ips_ha_t * ha)
4308
4308
METHOD_TRACE ("ips_allocatescbs" , 1 );
4309
4309
4310
4310
/* Allocate memory for the SCBs */
4311
- ha -> scbs =
4312
- pci_alloc_consistent ( ha -> pcidev , ha -> max_cmds * sizeof (ips_scb_t ),
4313
- & command_dma );
4311
+ ha -> scbs = dma_alloc_coherent ( & ha -> pcidev -> dev ,
4312
+ ha -> max_cmds * sizeof (ips_scb_t ),
4313
+ & command_dma , GFP_KERNEL );
4314
4314
if (ha -> scbs == NULL )
4315
4315
return 0 ;
4316
- ips_sg .list =
4317
- pci_alloc_consistent (ha -> pcidev ,
4318
- IPS_SGLIST_SIZE (ha ) * IPS_MAX_SG *
4319
- ha -> max_cmds , & sg_dma );
4316
+ ips_sg .list = dma_alloc_coherent (& ha -> pcidev -> dev ,
4317
+ IPS_SGLIST_SIZE (ha ) * IPS_MAX_SG * ha -> max_cmds ,
4318
+ & sg_dma , GFP_KERNEL );
4320
4319
if (ips_sg .list == NULL ) {
4321
- pci_free_consistent ( ha -> pcidev ,
4320
+ dma_free_coherent ( & ha -> pcidev -> dev ,
4322
4321
ha -> max_cmds * sizeof (ips_scb_t ), ha -> scbs ,
4323
4322
command_dma );
4324
4323
return 0 ;
@@ -4447,8 +4446,8 @@ ips_freescb(ips_ha_t * ha, ips_scb_t * scb)
4447
4446
if (scb -> flags & IPS_SCB_MAP_SG )
4448
4447
scsi_dma_unmap (scb -> scsi_cmd );
4449
4448
else if (scb -> flags & IPS_SCB_MAP_SINGLE )
4450
- pci_unmap_single ( ha -> pcidev , scb -> data_busaddr , scb -> data_len ,
4451
- IPS_DMA_DIR (scb ));
4449
+ dma_unmap_single ( & ha -> pcidev -> dev , scb -> data_busaddr ,
4450
+ scb -> data_len , IPS_DMA_DIR (scb ));
4452
4451
4453
4452
/* check to make sure this is not our "special" scb */
4454
4453
if (IPS_COMMAND_ID (ha , scb ) < (ha -> max_cmds - 1 )) {
@@ -4560,7 +4559,8 @@ ips_flush_and_reset(ips_ha_t *ha)
4560
4559
dma_addr_t command_dma ;
4561
4560
4562
4561
/* Create a usuable SCB */
4563
- scb = pci_alloc_consistent (ha -> pcidev , sizeof (ips_scb_t ), & command_dma );
4562
+ scb = dma_alloc_coherent (& ha -> pcidev -> dev , sizeof (ips_scb_t ),
4563
+ & command_dma , GFP_KERNEL );
4564
4564
if (scb ) {
4565
4565
memset (scb , 0 , sizeof (ips_scb_t ));
4566
4566
ips_init_scb (ha , scb );
@@ -4595,7 +4595,7 @@ ips_flush_and_reset(ips_ha_t *ha)
4595
4595
/* Now RESET and INIT the adapter */
4596
4596
(* ha -> func .reset ) (ha );
4597
4597
4598
- pci_free_consistent ( ha -> pcidev , sizeof (ips_scb_t ), scb , command_dma );
4598
+ dma_free_coherent ( & ha -> pcidev -> dev , sizeof (ips_scb_t ), scb , command_dma );
4599
4599
return ;
4600
4600
}
4601
4601
@@ -6927,29 +6927,30 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr)
6927
6927
* are guaranteed to be < 4G.
6928
6928
*/
6929
6929
if (IPS_ENABLE_DMA64 && IPS_HAS_ENH_SGLIST (ha ) &&
6930
- !pci_set_dma_mask ( ha -> pcidev , DMA_BIT_MASK (64 ))) {
6930
+ !dma_set_mask ( & ha -> pcidev -> dev , DMA_BIT_MASK (64 ))) {
6931
6931
(ha )-> flags |= IPS_HA_ENH_SG ;
6932
6932
} else {
6933
- if (pci_set_dma_mask ( ha -> pcidev , DMA_BIT_MASK (32 )) != 0 ) {
6933
+ if (dma_set_mask ( & ha -> pcidev -> dev , DMA_BIT_MASK (32 )) != 0 ) {
6934
6934
printk (KERN_WARNING "Unable to set DMA Mask\n" );
6935
6935
return ips_abort_init (ha , index );
6936
6936
}
6937
6937
}
6938
6938
if (ips_cd_boot && !ips_FlashData ){
6939
- ips_FlashData = pci_alloc_consistent ( pci_dev , PAGE_SIZE << 7 ,
6940
- & ips_flashbusaddr );
6939
+ ips_FlashData = dma_alloc_coherent ( & pci_dev -> dev ,
6940
+ PAGE_SIZE << 7 , & ips_flashbusaddr , GFP_KERNEL );
6941
6941
}
6942
6942
6943
- ha -> enq = pci_alloc_consistent ( pci_dev , sizeof (IPS_ENQ ),
6944
- & ha -> enq_busaddr );
6943
+ ha -> enq = dma_alloc_coherent ( & pci_dev -> dev , sizeof (IPS_ENQ ),
6944
+ & ha -> enq_busaddr , GFP_KERNEL );
6945
6945
if (!ha -> enq ) {
6946
6946
IPS_PRINTK (KERN_WARNING , pci_dev ,
6947
6947
"Unable to allocate host inquiry structure\n" );
6948
6948
return ips_abort_init (ha , index );
6949
6949
}
6950
6950
6951
- ha -> adapt = pci_alloc_consistent (pci_dev , sizeof (IPS_ADAPTER ) +
6952
- sizeof (IPS_IO_CMD ), & dma_address );
6951
+ ha -> adapt = dma_alloc_coherent (& pci_dev -> dev ,
6952
+ sizeof (IPS_ADAPTER ) + sizeof (IPS_IO_CMD ),
6953
+ & dma_address , GFP_KERNEL );
6953
6954
if (!ha -> adapt ) {
6954
6955
IPS_PRINTK (KERN_WARNING , pci_dev ,
6955
6956
"Unable to allocate host adapt & dummy structures\n" );
@@ -6960,7 +6961,8 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr)
6960
6961
6961
6962
6962
6963
6963
- ha -> logical_drive_info = pci_alloc_consistent (pci_dev , sizeof (IPS_LD_INFO ), & dma_address );
6964
+ ha -> logical_drive_info = dma_alloc_coherent (& pci_dev -> dev ,
6965
+ sizeof (IPS_LD_INFO ), & dma_address , GFP_KERNEL );
6964
6966
if (!ha -> logical_drive_info ) {
6965
6967
IPS_PRINTK (KERN_WARNING , pci_dev ,
6966
6968
"Unable to allocate logical drive info structure\n" );
@@ -6998,8 +7000,8 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr)
6998
7000
if (ips_ioctlsize < PAGE_SIZE )
6999
7001
ips_ioctlsize = PAGE_SIZE ;
7000
7002
7001
- ha -> ioctl_data = pci_alloc_consistent ( pci_dev , ips_ioctlsize ,
7002
- & ha -> ioctl_busaddr );
7003
+ ha -> ioctl_data = dma_alloc_coherent ( & pci_dev -> dev , ips_ioctlsize ,
7004
+ & ha -> ioctl_busaddr , GFP_KERNEL );
7003
7005
ha -> ioctl_len = ips_ioctlsize ;
7004
7006
if (!ha -> ioctl_data ) {
7005
7007
IPS_PRINTK (KERN_WARNING , pci_dev ,
0 commit comments