diff options
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r-- | drivers/block/cciss.c | 72 |
1 files changed, 46 insertions, 26 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 88452c79fb64..e4e9f255bd1f 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -2178,16 +2178,48 @@ static inline void resend_cciss_cmd( ctlr_info_t *h, CommandList_struct *c) | |||
2178 | 2178 | ||
2179 | start_io(h); | 2179 | start_io(h); |
2180 | } | 2180 | } |
2181 | |||
2182 | static void cciss_softirq_done(struct request *rq) | ||
2183 | { | ||
2184 | CommandList_struct *cmd = rq->completion_data; | ||
2185 | ctlr_info_t *h = hba[cmd->ctlr]; | ||
2186 | u64bit temp64; | ||
2187 | int i, ddir; | ||
2188 | |||
2189 | if (cmd->Request.Type.Direction == XFER_READ) | ||
2190 | ddir = PCI_DMA_FROMDEVICE; | ||
2191 | else | ||
2192 | ddir = PCI_DMA_TODEVICE; | ||
2193 | |||
2194 | /* command did not need to be retried */ | ||
2195 | /* unmap the DMA mapping for all the scatter gather elements */ | ||
2196 | for(i=0; i<cmd->Header.SGList; i++) { | ||
2197 | temp64.val32.lower = cmd->SG[i].Addr.lower; | ||
2198 | temp64.val32.upper = cmd->SG[i].Addr.upper; | ||
2199 | pci_unmap_page(h->pdev, temp64.val, cmd->SG[i].Len, ddir); | ||
2200 | } | ||
2201 | |||
2202 | complete_buffers(rq->bio, rq->errors); | ||
2203 | |||
2204 | #ifdef CCISS_DEBUG | ||
2205 | printk("Done with %p\n", rq); | ||
2206 | #endif /* CCISS_DEBUG */ | ||
2207 | |||
2208 | spin_lock_irq(&h->lock); | ||
2209 | end_that_request_last(rq, rq->errors); | ||
2210 | cmd_free(h, cmd,1); | ||
2211 | spin_unlock_irq(&h->lock); | ||
2212 | } | ||
2213 | |||
2181 | /* checks the status of the job and calls complete buffers to mark all | 2214 | /* checks the status of the job and calls complete buffers to mark all |
2182 | * buffers for the completed job. | 2215 | * buffers for the completed job. Note that this function does not need |
2216 | * to hold the hba/queue lock. | ||
2183 | */ | 2217 | */ |
2184 | static inline void complete_command( ctlr_info_t *h, CommandList_struct *cmd, | 2218 | static inline void complete_command( ctlr_info_t *h, CommandList_struct *cmd, |
2185 | int timeout) | 2219 | int timeout) |
2186 | { | 2220 | { |
2187 | int status = 1; | 2221 | int status = 1; |
2188 | int i; | ||
2189 | int retry_cmd = 0; | 2222 | int retry_cmd = 0; |
2190 | u64bit temp64; | ||
2191 | 2223 | ||
2192 | if (timeout) | 2224 | if (timeout) |
2193 | status = 0; | 2225 | status = 0; |
@@ -2295,24 +2327,10 @@ static inline void complete_command( ctlr_info_t *h, CommandList_struct *cmd, | |||
2295 | resend_cciss_cmd(h,cmd); | 2327 | resend_cciss_cmd(h,cmd); |
2296 | return; | 2328 | return; |
2297 | } | 2329 | } |
2298 | /* command did not need to be retried */ | ||
2299 | /* unmap the DMA mapping for all the scatter gather elements */ | ||
2300 | for(i=0; i<cmd->Header.SGList; i++) { | ||
2301 | temp64.val32.lower = cmd->SG[i].Addr.lower; | ||
2302 | temp64.val32.upper = cmd->SG[i].Addr.upper; | ||
2303 | pci_unmap_page(hba[cmd->ctlr]->pdev, | ||
2304 | temp64.val, cmd->SG[i].Len, | ||
2305 | (cmd->Request.Type.Direction == XFER_READ) ? | ||
2306 | PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); | ||
2307 | } | ||
2308 | complete_buffers(cmd->rq->bio, status); | ||
2309 | |||
2310 | #ifdef CCISS_DEBUG | ||
2311 | printk("Done with %p\n", cmd->rq); | ||
2312 | #endif /* CCISS_DEBUG */ | ||
2313 | 2330 | ||
2314 | end_that_request_last(cmd->rq, status ? 1 : -EIO); | 2331 | cmd->rq->completion_data = cmd; |
2315 | cmd_free(h,cmd,1); | 2332 | cmd->rq->errors = status; |
2333 | blk_complete_request(cmd->rq); | ||
2316 | } | 2334 | } |
2317 | 2335 | ||
2318 | /* | 2336 | /* |
@@ -3199,15 +3217,17 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3199 | drv->queue = q; | 3217 | drv->queue = q; |
3200 | 3218 | ||
3201 | q->backing_dev_info.ra_pages = READ_AHEAD; | 3219 | q->backing_dev_info.ra_pages = READ_AHEAD; |
3202 | blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask); | 3220 | blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask); |
3221 | |||
3222 | /* This is a hardware imposed limit. */ | ||
3223 | blk_queue_max_hw_segments(q, MAXSGENTRIES); | ||
3203 | 3224 | ||
3204 | /* This is a hardware imposed limit. */ | 3225 | /* This is a limit in the driver and could be eliminated. */ |
3205 | blk_queue_max_hw_segments(q, MAXSGENTRIES); | 3226 | blk_queue_max_phys_segments(q, MAXSGENTRIES); |
3206 | 3227 | ||
3207 | /* This is a limit in the driver and could be eliminated. */ | 3228 | blk_queue_max_sectors(q, 512); |
3208 | blk_queue_max_phys_segments(q, MAXSGENTRIES); | ||
3209 | 3229 | ||
3210 | blk_queue_max_sectors(q, 512); | 3230 | blk_queue_softirq_done(q, cciss_softirq_done); |
3211 | 3231 | ||
3212 | q->queuedata = hba[i]; | 3232 | q->queuedata = hba[i]; |
3213 | sprintf(disk->disk_name, "cciss/c%dd%d", i, j); | 3233 | sprintf(disk->disk_name, "cciss/c%dd%d", i, j); |