hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/scsi/3w-sas.c
....@@ -287,7 +287,9 @@
287287 } /* End twl_post_command_packet() */
288288
289289 /* This function hands scsi cdb's to the firmware */
290
-static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry_ISO *sglistarg)
290
+static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
291
+ unsigned char *cdb, int use_sg,
292
+ TW_SG_Entry_ISO *sglistarg)
291293 {
292294 TW_Command_Full *full_command_packet;
293295 TW_Command_Apache *command_packet;
....@@ -372,7 +374,7 @@
372374 /* This function will read the aen queue from the isr */
373375 static int twl_aen_read_queue(TW_Device_Extension *tw_dev, int request_id)
374376 {
375
- char cdb[TW_MAX_CDB_LEN];
377
+ unsigned char cdb[TW_MAX_CDB_LEN];
376378 TW_SG_Entry_ISO sglist[1];
377379 TW_Command_Full *full_command_packet;
378380 int retval = 1;
....@@ -554,7 +556,7 @@
554556 static int twl_aen_drain_queue(TW_Device_Extension *tw_dev, int no_check_reset)
555557 {
556558 int request_id = 0;
557
- char cdb[TW_MAX_CDB_LEN];
559
+ unsigned char cdb[TW_MAX_CDB_LEN];
558560 TW_SG_Entry_ISO sglist[1];
559561 int finished = 0, count = 0;
560562 TW_Command_Full *full_command_packet;
....@@ -644,8 +646,9 @@
644646 unsigned long *cpu_addr;
645647 int retval = 1;
646648
647
- cpu_addr = pci_zalloc_consistent(tw_dev->tw_pci_dev, size * TW_Q_LENGTH,
648
- &dma_handle);
649
+ cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev,
650
+ size * TW_Q_LENGTH, &dma_handle,
651
+ GFP_KERNEL);
649652 if (!cpu_addr) {
650653 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed");
651654 goto out;
....@@ -899,19 +902,19 @@
899902 static void twl_free_device_extension(TW_Device_Extension *tw_dev)
900903 {
901904 if (tw_dev->command_packet_virt[0])
902
- pci_free_consistent(tw_dev->tw_pci_dev,
905
+ dma_free_coherent(&tw_dev->tw_pci_dev->dev,
903906 sizeof(TW_Command_Full)*TW_Q_LENGTH,
904907 tw_dev->command_packet_virt[0],
905908 tw_dev->command_packet_phys[0]);
906909
907910 if (tw_dev->generic_buffer_virt[0])
908
- pci_free_consistent(tw_dev->tw_pci_dev,
911
+ dma_free_coherent(&tw_dev->tw_pci_dev->dev,
909912 TW_SECTOR_SIZE*TW_Q_LENGTH,
910913 tw_dev->generic_buffer_virt[0],
911914 tw_dev->generic_buffer_phys[0]);
912915
913916 if (tw_dev->sense_buffer_virt[0])
914
- pci_free_consistent(tw_dev->tw_pci_dev,
917
+ dma_free_coherent(&tw_dev->tw_pci_dev->dev,
915918 sizeof(TW_Command_Apache_Header)*
916919 TW_Q_LENGTH,
917920 tw_dev->sense_buffer_virt[0],
....@@ -1548,7 +1551,6 @@
15481551 .sg_tablesize = TW_LIBERATOR_MAX_SGL_LENGTH,
15491552 .max_sectors = TW_MAX_SECTORS,
15501553 .cmd_per_lun = TW_MAX_CMDS_PER_LUN,
1551
- .use_clustering = ENABLE_CLUSTERING,
15521554 .shost_attrs = twl_host_attrs,
15531555 .emulated = 1,
15541556 .no_write_same = 1,
....@@ -1571,14 +1573,14 @@
15711573 pci_set_master(pdev);
15721574 pci_try_set_mwi(pdev);
15731575
1574
- if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))
1575
- || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))
1576
- if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
1577
- || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
1578
- TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");
1579
- retval = -ENODEV;
1580
- goto out_disable_device;
1581
- }
1576
+ retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
1577
+ if (retval)
1578
+ retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
1579
+ if (retval) {
1580
+ TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");
1581
+ retval = -ENODEV;
1582
+ goto out_disable_device;
1583
+ }
15821584
15831585 host = scsi_host_alloc(&driver_template, sizeof(TW_Device_Extension));
15841586 if (!host) {
....@@ -1805,14 +1807,14 @@
18051807 pci_set_master(pdev);
18061808 pci_try_set_mwi(pdev);
18071809
1808
- if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))
1809
- || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))
1810
- if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
1811
- || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
1812
- TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");
1813
- retval = -ENODEV;
1814
- goto out_disable_device;
1815
- }
1810
+ retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
1811
+ if (retval)
1812
+ retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
1813
+ if (retval) {
1814
+ TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");
1815
+ retval = -ENODEV;
1816
+ goto out_disable_device;
1817
+ }
18161818
18171819 /* Initialize the card */
18181820 if (twl_reset_sequence(tw_dev, 0)) {