.. | .. |
---|
143 | 143 | static int twa_post_command_packet(TW_Device_Extension *tw_dev, int request_id, char internal); |
---|
144 | 144 | static int twa_reset_device_extension(TW_Device_Extension *tw_dev); |
---|
145 | 145 | static int twa_reset_sequence(TW_Device_Extension *tw_dev, int soft_reset); |
---|
146 | | -static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg); |
---|
| 146 | +static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, |
---|
| 147 | + unsigned char *cdb, int use_sg, |
---|
| 148 | + TW_SG_Entry *sglistarg); |
---|
147 | 149 | static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int request_id); |
---|
148 | 150 | static char *twa_string_lookup(twa_message_type *table, unsigned int aen_code); |
---|
149 | 151 | |
---|
.. | .. |
---|
278 | 280 | static int twa_aen_drain_queue(TW_Device_Extension *tw_dev, int no_check_reset) |
---|
279 | 281 | { |
---|
280 | 282 | int request_id = 0; |
---|
281 | | - char cdb[TW_MAX_CDB_LEN]; |
---|
| 283 | + unsigned char cdb[TW_MAX_CDB_LEN]; |
---|
282 | 284 | TW_SG_Entry sglist[1]; |
---|
283 | 285 | int finished = 0, count = 0; |
---|
284 | 286 | TW_Command_Full *full_command_packet; |
---|
.. | .. |
---|
423 | 425 | /* This function will read the aen queue from the isr */ |
---|
424 | 426 | static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id) |
---|
425 | 427 | { |
---|
426 | | - char cdb[TW_MAX_CDB_LEN]; |
---|
| 428 | + unsigned char cdb[TW_MAX_CDB_LEN]; |
---|
427 | 429 | TW_SG_Entry sglist[1]; |
---|
428 | 430 | TW_Command_Full *full_command_packet; |
---|
429 | 431 | int retval = 1; |
---|
.. | .. |
---|
518 | 520 | unsigned long *cpu_addr; |
---|
519 | 521 | int retval = 1; |
---|
520 | 522 | |
---|
521 | | - cpu_addr = pci_alloc_consistent(tw_dev->tw_pci_dev, size*TW_Q_LENGTH, &dma_handle); |
---|
| 523 | + cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev, |
---|
| 524 | + size * TW_Q_LENGTH, &dma_handle, GFP_KERNEL); |
---|
522 | 525 | if (!cpu_addr) { |
---|
523 | 526 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed"); |
---|
524 | 527 | goto out; |
---|
.. | .. |
---|
526 | 529 | |
---|
527 | 530 | if ((unsigned long)cpu_addr % (TW_ALIGNMENT_9000)) { |
---|
528 | 531 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x6, "Failed to allocate correctly aligned memory"); |
---|
529 | | - pci_free_consistent(tw_dev->tw_pci_dev, size*TW_Q_LENGTH, cpu_addr, dma_handle); |
---|
| 532 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, size * TW_Q_LENGTH, |
---|
| 533 | + cpu_addr, dma_handle); |
---|
530 | 534 | goto out; |
---|
531 | 535 | } |
---|
532 | 536 | |
---|
.. | .. |
---|
1027 | 1031 | static void twa_free_device_extension(TW_Device_Extension *tw_dev) |
---|
1028 | 1032 | { |
---|
1029 | 1033 | if (tw_dev->command_packet_virt[0]) |
---|
1030 | | - pci_free_consistent(tw_dev->tw_pci_dev, |
---|
1031 | | - sizeof(TW_Command_Full)*TW_Q_LENGTH, |
---|
1032 | | - tw_dev->command_packet_virt[0], |
---|
1033 | | - tw_dev->command_packet_phys[0]); |
---|
| 1034 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, |
---|
| 1035 | + sizeof(TW_Command_Full) * TW_Q_LENGTH, |
---|
| 1036 | + tw_dev->command_packet_virt[0], |
---|
| 1037 | + tw_dev->command_packet_phys[0]); |
---|
1034 | 1038 | |
---|
1035 | 1039 | if (tw_dev->generic_buffer_virt[0]) |
---|
1036 | | - pci_free_consistent(tw_dev->tw_pci_dev, |
---|
1037 | | - TW_SECTOR_SIZE*TW_Q_LENGTH, |
---|
1038 | | - tw_dev->generic_buffer_virt[0], |
---|
1039 | | - tw_dev->generic_buffer_phys[0]); |
---|
| 1040 | + dma_free_coherent(&tw_dev->tw_pci_dev->dev, |
---|
| 1041 | + TW_SECTOR_SIZE * TW_Q_LENGTH, |
---|
| 1042 | + tw_dev->generic_buffer_virt[0], |
---|
| 1043 | + tw_dev->generic_buffer_phys[0]); |
---|
1040 | 1044 | |
---|
1041 | 1045 | kfree(tw_dev->event_queue[0]); |
---|
1042 | 1046 | } /* End twa_free_device_extension() */ |
---|
.. | .. |
---|
1796 | 1800 | static DEF_SCSI_QCMD(twa_scsi_queue) |
---|
1797 | 1801 | |
---|
1798 | 1802 | /* This function hands scsi cdb's to the firmware */ |
---|
1799 | | -static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg) |
---|
| 1803 | +static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, |
---|
| 1804 | + unsigned char *cdb, int use_sg, |
---|
| 1805 | + TW_SG_Entry *sglistarg) |
---|
1800 | 1806 | { |
---|
1801 | 1807 | TW_Command_Full *full_command_packet; |
---|
1802 | 1808 | TW_Command_Apache *command_packet; |
---|
.. | .. |
---|
1992 | 1998 | .sg_tablesize = TW_APACHE_MAX_SGL_LENGTH, |
---|
1993 | 1999 | .max_sectors = TW_MAX_SECTORS, |
---|
1994 | 2000 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, |
---|
1995 | | - .use_clustering = ENABLE_CLUSTERING, |
---|
1996 | 2001 | .shost_attrs = twa_host_attrs, |
---|
1997 | 2002 | .emulated = 1, |
---|
1998 | 2003 | .no_write_same = 1, |
---|
.. | .. |
---|
2004 | 2009 | struct Scsi_Host *host = NULL; |
---|
2005 | 2010 | TW_Device_Extension *tw_dev; |
---|
2006 | 2011 | unsigned long mem_addr, mem_len; |
---|
2007 | | - int retval = -ENODEV; |
---|
| 2012 | + int retval; |
---|
2008 | 2013 | |
---|
2009 | 2014 | retval = pci_enable_device(pdev); |
---|
2010 | 2015 | if (retval) { |
---|
2011 | 2016 | TW_PRINTK(host, TW_DRIVER, 0x34, "Failed to enable pci device"); |
---|
2012 | | - goto out_disable_device; |
---|
| 2017 | + return -ENODEV; |
---|
2013 | 2018 | } |
---|
2014 | 2019 | |
---|
2015 | 2020 | pci_set_master(pdev); |
---|
2016 | 2021 | pci_try_set_mwi(pdev); |
---|
2017 | 2022 | |
---|
2018 | | - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) |
---|
2019 | | - || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) |
---|
2020 | | - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) |
---|
2021 | | - || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { |
---|
2022 | | - TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask"); |
---|
2023 | | - retval = -ENODEV; |
---|
2024 | | - goto out_disable_device; |
---|
2025 | | - } |
---|
| 2023 | + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); |
---|
| 2024 | + if (retval) |
---|
| 2025 | + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
---|
| 2026 | + if (retval) { |
---|
| 2027 | + TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask"); |
---|
| 2028 | + retval = -ENODEV; |
---|
| 2029 | + goto out_disable_device; |
---|
| 2030 | + } |
---|
2026 | 2031 | |
---|
2027 | 2032 | host = scsi_host_alloc(&driver_template, sizeof(TW_Device_Extension)); |
---|
2028 | 2033 | if (!host) { |
---|
.. | .. |
---|
2237 | 2242 | pci_set_master(pdev); |
---|
2238 | 2243 | pci_try_set_mwi(pdev); |
---|
2239 | 2244 | |
---|
2240 | | - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) |
---|
2241 | | - || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) |
---|
2242 | | - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) |
---|
2243 | | - || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { |
---|
2244 | | - TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume"); |
---|
2245 | | - retval = -ENODEV; |
---|
2246 | | - goto out_disable_device; |
---|
2247 | | - } |
---|
| 2245 | + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); |
---|
| 2246 | + if (retval) |
---|
| 2247 | + retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
---|
| 2248 | + if (retval) { |
---|
| 2249 | + TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume"); |
---|
| 2250 | + retval = -ENODEV; |
---|
| 2251 | + goto out_disable_device; |
---|
| 2252 | + } |
---|
2248 | 2253 | |
---|
2249 | 2254 | /* Initialize the card */ |
---|
2250 | 2255 | if (twa_reset_sequence(tw_dev, 0)) { |
---|