.. | .. |
---|
700 | 700 | static int |
---|
701 | 701 | ahd_linux_slave_configure(struct scsi_device *sdev) |
---|
702 | 702 | { |
---|
703 | | - struct ahd_softc *ahd; |
---|
704 | | - |
---|
705 | | - ahd = *((struct ahd_softc **)sdev->host->hostdata); |
---|
706 | 703 | if (bootverbose) |
---|
707 | 704 | sdev_printk(KERN_INFO, sdev, "Slave Configure\n"); |
---|
708 | 705 | |
---|
.. | .. |
---|
723 | 720 | ahd_linux_biosparam(struct scsi_device *sdev, struct block_device *bdev, |
---|
724 | 721 | sector_t capacity, int geom[]) |
---|
725 | 722 | { |
---|
726 | | - uint8_t *bh; |
---|
727 | 723 | int heads; |
---|
728 | 724 | int sectors; |
---|
729 | 725 | int cylinders; |
---|
730 | | - int ret; |
---|
731 | 726 | int extended; |
---|
732 | 727 | struct ahd_softc *ahd; |
---|
733 | 728 | |
---|
734 | 729 | ahd = *((struct ahd_softc **)sdev->host->hostdata); |
---|
735 | 730 | |
---|
736 | | - bh = scsi_bios_ptable(bdev); |
---|
737 | | - if (bh) { |
---|
738 | | - ret = scsi_partsize(bh, capacity, |
---|
739 | | - &geom[2], &geom[0], &geom[1]); |
---|
740 | | - kfree(bh); |
---|
741 | | - if (ret != -1) |
---|
742 | | - return (ret); |
---|
743 | | - } |
---|
| 731 | + if (scsi_partsize(bdev, capacity, geom)) |
---|
| 732 | + return 0; |
---|
| 733 | + |
---|
744 | 734 | heads = 64; |
---|
745 | 735 | sectors = 32; |
---|
746 | 736 | cylinders = aic_sector_div(capacity, heads, sectors); |
---|
.. | .. |
---|
785 | 775 | struct scb *reset_scb; |
---|
786 | 776 | u_int cdb_byte; |
---|
787 | 777 | int retval = SUCCESS; |
---|
788 | | - int paused; |
---|
789 | | - int wait; |
---|
790 | 778 | struct ahd_initiator_tinfo *tinfo; |
---|
791 | 779 | struct ahd_tmode_tstate *tstate; |
---|
792 | 780 | unsigned long flags; |
---|
793 | 781 | DECLARE_COMPLETION_ONSTACK(done); |
---|
794 | 782 | |
---|
795 | 783 | reset_scb = NULL; |
---|
796 | | - paused = FALSE; |
---|
797 | | - wait = FALSE; |
---|
| 784 | + |
---|
798 | 785 | ahd = *(struct ahd_softc **)cmd->device->host->hostdata; |
---|
799 | 786 | |
---|
800 | 787 | scmd_printk(KERN_INFO, cmd, |
---|
.. | .. |
---|
920 | 907 | .this_id = -1, |
---|
921 | 908 | .max_sectors = 8192, |
---|
922 | 909 | .cmd_per_lun = 2, |
---|
923 | | - .use_clustering = ENABLE_CLUSTERING, |
---|
924 | 910 | .slave_alloc = ahd_linux_slave_alloc, |
---|
925 | 911 | .slave_configure = ahd_linux_slave_configure, |
---|
926 | 912 | .target_alloc = ahd_linux_target_alloc, |
---|
.. | .. |
---|
966 | 952 | ahd_dmamem_alloc(struct ahd_softc *ahd, bus_dma_tag_t dmat, void** vaddr, |
---|
967 | 953 | int flags, bus_dmamap_t *mapp) |
---|
968 | 954 | { |
---|
969 | | - *vaddr = pci_alloc_consistent(ahd->dev_softc, |
---|
970 | | - dmat->maxsize, mapp); |
---|
| 955 | + *vaddr = dma_alloc_coherent(&ahd->dev_softc->dev, dmat->maxsize, mapp, |
---|
| 956 | + GFP_ATOMIC); |
---|
971 | 957 | if (*vaddr == NULL) |
---|
972 | 958 | return (ENOMEM); |
---|
973 | 959 | return(0); |
---|
.. | .. |
---|
977 | 963 | ahd_dmamem_free(struct ahd_softc *ahd, bus_dma_tag_t dmat, |
---|
978 | 964 | void* vaddr, bus_dmamap_t map) |
---|
979 | 965 | { |
---|
980 | | - pci_free_consistent(ahd->dev_softc, dmat->maxsize, |
---|
981 | | - vaddr, map); |
---|
| 966 | + dma_free_coherent(&ahd->dev_softc->dev, dmat->maxsize, vaddr, map); |
---|
982 | 967 | } |
---|
983 | 968 | |
---|
984 | 969 | int |
---|
.. | .. |
---|
1801 | 1786 | */ |
---|
1802 | 1787 | cmd->sense_buffer[0] = 0; |
---|
1803 | 1788 | if (ahd_get_transaction_status(scb) == CAM_REQ_INPROG) { |
---|
| 1789 | +#ifdef AHD_REPORT_UNDERFLOWS |
---|
1804 | 1790 | uint32_t amount_xferred; |
---|
1805 | 1791 | |
---|
1806 | 1792 | amount_xferred = |
---|
1807 | 1793 | ahd_get_transfer_length(scb) - ahd_get_residual(scb); |
---|
| 1794 | +#endif |
---|
1808 | 1795 | if ((scb->flags & SCB_TRANSMISSION_ERROR) != 0) { |
---|
1809 | 1796 | #ifdef AHD_DEBUG |
---|
1810 | 1797 | if ((ahd_debug & AHD_SHOW_MISC) != 0) { |
---|
.. | .. |
---|
2047 | 2034 | break; |
---|
2048 | 2035 | case CAM_AUTOSENSE_FAIL: |
---|
2049 | 2036 | new_status = DID_ERROR; |
---|
2050 | | - /* Fallthrough */ |
---|
| 2037 | + fallthrough; |
---|
2051 | 2038 | case CAM_SCSI_STATUS_ERROR: |
---|
2052 | 2039 | scsi_status = ahd_cmd_get_scsi_status(cmd); |
---|
2053 | 2040 | |
---|
.. | .. |
---|
2155 | 2142 | u_int last_phase; |
---|
2156 | 2143 | u_int saved_scsiid; |
---|
2157 | 2144 | u_int cdb_byte; |
---|
2158 | | - int retval; |
---|
| 2145 | + int retval = SUCCESS; |
---|
2159 | 2146 | int was_paused; |
---|
2160 | 2147 | int paused; |
---|
2161 | 2148 | int wait; |
---|
.. | .. |
---|
2193 | 2180 | * so we must not still own the command. |
---|
2194 | 2181 | */ |
---|
2195 | 2182 | scmd_printk(KERN_INFO, cmd, "Is not an active device\n"); |
---|
2196 | | - retval = SUCCESS; |
---|
2197 | | - goto no_cmd; |
---|
| 2183 | + goto done; |
---|
2198 | 2184 | } |
---|
2199 | 2185 | |
---|
2200 | 2186 | /* |
---|
.. | .. |
---|
2207 | 2193 | |
---|
2208 | 2194 | if (pending_scb == NULL) { |
---|
2209 | 2195 | scmd_printk(KERN_INFO, cmd, "Command not found\n"); |
---|
2210 | | - goto no_cmd; |
---|
| 2196 | + goto done; |
---|
2211 | 2197 | } |
---|
2212 | 2198 | |
---|
2213 | 2199 | if ((pending_scb->flags & SCB_RECOVERY_SCB) != 0) { |
---|
.. | .. |
---|
2215 | 2201 | * We can't queue two recovery actions using the same SCB |
---|
2216 | 2202 | */ |
---|
2217 | 2203 | retval = FAILED; |
---|
2218 | | - goto done; |
---|
| 2204 | + goto done; |
---|
2219 | 2205 | } |
---|
2220 | 2206 | |
---|
2221 | 2207 | /* |
---|
.. | .. |
---|
2230 | 2216 | |
---|
2231 | 2217 | if ((pending_scb->flags & SCB_ACTIVE) == 0) { |
---|
2232 | 2218 | scmd_printk(KERN_INFO, cmd, "Command already completed\n"); |
---|
2233 | | - goto no_cmd; |
---|
| 2219 | + goto done; |
---|
2234 | 2220 | } |
---|
2235 | 2221 | |
---|
2236 | 2222 | printk("%s: At time of recovery, card was %spaused\n", |
---|
.. | .. |
---|
2247 | 2233 | printk("%s:%d:%d:%d: Cmd aborted from QINFIFO\n", |
---|
2248 | 2234 | ahd_name(ahd), cmd->device->channel, |
---|
2249 | 2235 | cmd->device->id, (u8)cmd->device->lun); |
---|
2250 | | - retval = SUCCESS; |
---|
2251 | 2236 | goto done; |
---|
2252 | 2237 | } |
---|
2253 | 2238 | |
---|
.. | .. |
---|
2344 | 2329 | } else { |
---|
2345 | 2330 | scmd_printk(KERN_INFO, cmd, "Unable to deliver message\n"); |
---|
2346 | 2331 | retval = FAILED; |
---|
2347 | | - goto done; |
---|
2348 | 2332 | } |
---|
2349 | 2333 | |
---|
2350 | | -no_cmd: |
---|
2351 | | - /* |
---|
2352 | | - * Our assumption is that if we don't have the command, no |
---|
2353 | | - * recovery action was required, so we return success. Again, |
---|
2354 | | - * the semantics of the mid-layer recovery engine are not |
---|
2355 | | - * well defined, so this may change in time. |
---|
2356 | | - */ |
---|
2357 | | - retval = SUCCESS; |
---|
| 2334 | + |
---|
| 2335 | + ahd_restore_modes(ahd, saved_modes); |
---|
2358 | 2336 | done: |
---|
2359 | 2337 | if (paused) |
---|
2360 | 2338 | ahd_unpause(ahd); |
---|