diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:38 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:38 -0400 |
commit | b6308ee0c55acd2e943d849773c9f0a49c516317 (patch) | |
tree | e56f59a7935fccdf0145ffd4638a066bf4ba1e17 | |
parent | adb1af9803d167091c2cb4de14014185054bfe2c (diff) |
ide: move command related fields from ide_hwif_t to struct ide_cmd
* Move command related fields from ide_hwif_t to struct ide_cmd.
* Make ide_init_sg_cmd() take command and sectors number as arguments.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/au1xxx-ide.c | 2 | ||||
-rw-r--r-- | drivers/ide/icside.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-disk.c | 12 | ||||
-rw-r--r-- | drivers/ide/ide-dma-sff.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-dma.c | 16 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 5 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 24 | ||||
-rw-r--r-- | drivers/ide/ide-taskfile.c | 33 | ||||
-rw-r--r-- | drivers/ide/pmac.c | 2 | ||||
-rw-r--r-- | drivers/ide/sgiioc4.c | 2 | ||||
-rw-r--r-- | drivers/ide/tx4939ide.c | 2 | ||||
-rw-r--r-- | include/linux/ide.h | 20 |
12 files changed, 61 insertions, 61 deletions
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c index 72d7d615e1fc..3ace0cda5452 100644 --- a/drivers/ide/au1xxx-ide.c +++ b/drivers/ide/au1xxx-ide.c | |||
@@ -215,7 +215,7 @@ static int auide_build_dmatable(ide_drive_t *drive) | |||
215 | struct request *rq = hwif->rq; | 215 | struct request *rq = hwif->rq; |
216 | _auide_hwif *ahwif = &auide_hwif; | 216 | _auide_hwif *ahwif = &auide_hwif; |
217 | struct scatterlist *sg; | 217 | struct scatterlist *sg; |
218 | int i = hwif->sg_nents, iswrite, count = 0; | 218 | int i = hwif->cmd.sg_nents, iswrite, count = 0; |
219 | 219 | ||
220 | iswrite = (rq_data_dir(rq) == WRITE); | 220 | iswrite = (rq_data_dir(rq) == WRITE); |
221 | /* Save for interrupt context */ | 221 | /* Save for interrupt context */ |
diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c index 78fc36f98d29..bdfeb1222d52 100644 --- a/drivers/ide/icside.c +++ b/drivers/ide/icside.c | |||
@@ -344,7 +344,7 @@ static int icside_dma_setup(ide_drive_t *drive) | |||
344 | * Tell the DMA engine about the SG table and | 344 | * Tell the DMA engine about the SG table and |
345 | * data direction. | 345 | * data direction. |
346 | */ | 346 | */ |
347 | set_dma_sg(ec->dma, hwif->sg_table, hwif->sg_nents); | 347 | set_dma_sg(ec->dma, hwif->sg_table, hwif->cmd.sg_nents); |
348 | set_dma_mode(ec->dma, dma_mode); | 348 | set_dma_mode(ec->dma, dma_mode); |
349 | 349 | ||
350 | drive->waiting_for_dma = 1; | 350 | drive->waiting_for_dma = 1; |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index f1555dd4e6a5..d00d807c0f53 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -104,14 +104,14 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
104 | lba48 = 0; | 104 | lba48 = 0; |
105 | } | 105 | } |
106 | 106 | ||
107 | if (!dma) { | ||
108 | ide_init_sg_cmd(drive, rq); | ||
109 | ide_map_sg(drive, rq); | ||
110 | } | ||
111 | |||
112 | memset(&cmd, 0, sizeof(cmd)); | 107 | memset(&cmd, 0, sizeof(cmd)); |
113 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 108 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
114 | 109 | ||
110 | if (dma == 0) { | ||
111 | ide_init_sg_cmd(&cmd, nsectors); | ||
112 | ide_map_sg(drive, rq); | ||
113 | } | ||
114 | |||
115 | if (drive->dev_flags & IDE_DFLAG_LBA) { | 115 | if (drive->dev_flags & IDE_DFLAG_LBA) { |
116 | if (lba48) { | 116 | if (lba48) { |
117 | pr_debug("%s: LBA=0x%012llx\n", drive->name, | 117 | pr_debug("%s: LBA=0x%012llx\n", drive->name, |
@@ -170,7 +170,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
170 | /* fallback to PIO */ | 170 | /* fallback to PIO */ |
171 | cmd.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK; | 171 | cmd.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK; |
172 | ide_tf_set_cmd(drive, &cmd, 0); | 172 | ide_tf_set_cmd(drive, &cmd, 0); |
173 | ide_init_sg_cmd(drive, rq); | 173 | ide_init_sg_cmd(&cmd, nsectors); |
174 | rc = do_rw_taskfile(drive, &cmd); | 174 | rc = do_rw_taskfile(drive, &cmd); |
175 | } | 175 | } |
176 | 176 | ||
diff --git a/drivers/ide/ide-dma-sff.c b/drivers/ide/ide-dma-sff.c index 22b3e751d19b..7bf28a9b6f65 100644 --- a/drivers/ide/ide-dma-sff.c +++ b/drivers/ide/ide-dma-sff.c | |||
@@ -120,7 +120,7 @@ int ide_build_dmatable(ide_drive_t *drive, struct request *rq) | |||
120 | struct scatterlist *sg; | 120 | struct scatterlist *sg; |
121 | u8 is_trm290 = !!(hwif->host_flags & IDE_HFLAG_TRM290); | 121 | u8 is_trm290 = !!(hwif->host_flags & IDE_HFLAG_TRM290); |
122 | 122 | ||
123 | for_each_sg(hwif->sg_table, sg, hwif->sg_nents, i) { | 123 | for_each_sg(hwif->sg_table, sg, hwif->cmd.sg_nents, i) { |
124 | u32 cur_addr, cur_len, xcount, bcount; | 124 | u32 cur_addr, cur_len, xcount, bcount; |
125 | 125 | ||
126 | cur_addr = sg_dma_address(sg); | 126 | cur_addr = sg_dma_address(sg); |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 54f17ae9225d..cba9fe585d87 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -128,21 +128,22 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq) | |||
128 | { | 128 | { |
129 | ide_hwif_t *hwif = drive->hwif; | 129 | ide_hwif_t *hwif = drive->hwif; |
130 | struct scatterlist *sg = hwif->sg_table; | 130 | struct scatterlist *sg = hwif->sg_table; |
131 | struct ide_cmd *cmd = &hwif->cmd; | ||
131 | int i; | 132 | int i; |
132 | 133 | ||
133 | ide_map_sg(drive, rq); | 134 | ide_map_sg(drive, rq); |
134 | 135 | ||
135 | if (rq_data_dir(rq) == READ) | 136 | if (rq_data_dir(rq) == READ) |
136 | hwif->sg_dma_direction = DMA_FROM_DEVICE; | 137 | cmd->sg_dma_direction = DMA_FROM_DEVICE; |
137 | else | 138 | else |
138 | hwif->sg_dma_direction = DMA_TO_DEVICE; | 139 | cmd->sg_dma_direction = DMA_TO_DEVICE; |
139 | 140 | ||
140 | i = dma_map_sg(hwif->dev, sg, hwif->sg_nents, hwif->sg_dma_direction); | 141 | i = dma_map_sg(hwif->dev, sg, cmd->sg_nents, cmd->sg_dma_direction); |
141 | if (i == 0) | 142 | if (i == 0) |
142 | ide_map_sg(drive, rq); | 143 | ide_map_sg(drive, rq); |
143 | else { | 144 | else { |
144 | hwif->orig_sg_nents = hwif->sg_nents; | 145 | cmd->orig_sg_nents = cmd->sg_nents; |
145 | hwif->sg_nents = i; | 146 | cmd->sg_nents = i; |
146 | } | 147 | } |
147 | 148 | ||
148 | return i; | 149 | return i; |
@@ -162,9 +163,10 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq) | |||
162 | void ide_destroy_dmatable(ide_drive_t *drive) | 163 | void ide_destroy_dmatable(ide_drive_t *drive) |
163 | { | 164 | { |
164 | ide_hwif_t *hwif = drive->hwif; | 165 | ide_hwif_t *hwif = drive->hwif; |
166 | struct ide_cmd *cmd = &hwif->cmd; | ||
165 | 167 | ||
166 | dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->orig_sg_nents, | 168 | dma_unmap_sg(hwif->dev, hwif->sg_table, cmd->orig_sg_nents, |
167 | hwif->sg_dma_direction); | 169 | cmd->sg_dma_direction); |
168 | } | 170 | } |
169 | EXPORT_SYMBOL_GPL(ide_destroy_dmatable); | 171 | EXPORT_SYMBOL_GPL(ide_destroy_dmatable); |
170 | 172 | ||
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 5625946739ad..f56e9a918b99 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -244,6 +244,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, | |||
244 | { | 244 | { |
245 | struct ide_disk_obj *floppy = drive->driver_data; | 245 | struct ide_disk_obj *floppy = drive->driver_data; |
246 | ide_hwif_t *hwif = drive->hwif; | 246 | ide_hwif_t *hwif = drive->hwif; |
247 | struct ide_cmd *cmd = &hwif->cmd; | ||
247 | struct ide_atapi_pc *pc; | 248 | struct ide_atapi_pc *pc; |
248 | 249 | ||
249 | if (drive->debug_mask & IDE_DBG_RQ) | 250 | if (drive->debug_mask & IDE_DBG_RQ) |
@@ -285,12 +286,12 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, | |||
285 | } | 286 | } |
286 | 287 | ||
287 | if (blk_fs_request(rq) || pc->req_xfer) { | 288 | if (blk_fs_request(rq) || pc->req_xfer) { |
288 | ide_init_sg_cmd(drive, rq); | 289 | ide_init_sg_cmd(cmd, rq->nr_sectors); |
289 | ide_map_sg(drive, rq); | 290 | ide_map_sg(drive, rq); |
290 | } | 291 | } |
291 | 292 | ||
292 | pc->sg = hwif->sg_table; | 293 | pc->sg = hwif->sg_table; |
293 | pc->sg_cnt = hwif->sg_nents; | 294 | pc->sg_cnt = cmd->sg_nents; |
294 | 295 | ||
295 | pc->rq = rq; | 296 | pc->rq = rq; |
296 | 297 | ||
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 2900271c6ddd..7917fa09bf15 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -274,30 +274,26 @@ static ide_startstop_t do_special (ide_drive_t *drive) | |||
274 | void ide_map_sg(ide_drive_t *drive, struct request *rq) | 274 | void ide_map_sg(ide_drive_t *drive, struct request *rq) |
275 | { | 275 | { |
276 | ide_hwif_t *hwif = drive->hwif; | 276 | ide_hwif_t *hwif = drive->hwif; |
277 | struct ide_cmd *cmd = &hwif->cmd; | ||
277 | struct scatterlist *sg = hwif->sg_table; | 278 | struct scatterlist *sg = hwif->sg_table; |
278 | 279 | ||
279 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { | 280 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { |
280 | sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE); | 281 | sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE); |
281 | hwif->sg_nents = 1; | 282 | cmd->sg_nents = 1; |
282 | } else if (!rq->bio) { | 283 | } else if (!rq->bio) { |
283 | sg_init_one(sg, rq->data, rq->data_len); | 284 | sg_init_one(sg, rq->data, rq->data_len); |
284 | hwif->sg_nents = 1; | 285 | cmd->sg_nents = 1; |
285 | } else { | 286 | } else |
286 | hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg); | 287 | cmd->sg_nents = blk_rq_map_sg(drive->queue, rq, sg); |
287 | } | ||
288 | } | 288 | } |
289 | |||
290 | EXPORT_SYMBOL_GPL(ide_map_sg); | 289 | EXPORT_SYMBOL_GPL(ide_map_sg); |
291 | 290 | ||
292 | void ide_init_sg_cmd(ide_drive_t *drive, struct request *rq) | 291 | void ide_init_sg_cmd(struct ide_cmd *cmd, int nsect) |
293 | { | 292 | { |
294 | ide_hwif_t *hwif = drive->hwif; | 293 | cmd->nsect = cmd->nleft = nsect; |
295 | 294 | cmd->cursg_ofs = 0; | |
296 | hwif->nsect = hwif->nleft = rq->nr_sectors; | 295 | cmd->cursg = NULL; |
297 | hwif->cursg_ofs = 0; | ||
298 | hwif->cursg = NULL; | ||
299 | } | 296 | } |
300 | |||
301 | EXPORT_SYMBOL_GPL(ide_init_sg_cmd); | 297 | EXPORT_SYMBOL_GPL(ide_init_sg_cmd); |
302 | 298 | ||
303 | /** | 299 | /** |
@@ -323,7 +319,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
323 | case TASKFILE_OUT: | 319 | case TASKFILE_OUT: |
324 | case TASKFILE_MULTI_IN: | 320 | case TASKFILE_MULTI_IN: |
325 | case TASKFILE_IN: | 321 | case TASKFILE_IN: |
326 | ide_init_sg_cmd(drive, rq); | 322 | ide_init_sg_cmd(cmd, rq->nr_sectors); |
327 | ide_map_sg(drive, rq); | 323 | ide_map_sg(drive, rq); |
328 | default: | 324 | default: |
329 | break; | 325 | break; |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index d3bd93afbf2b..249a707f88a4 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -209,7 +209,7 @@ static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd, | |||
209 | { | 209 | { |
210 | ide_hwif_t *hwif = drive->hwif; | 210 | ide_hwif_t *hwif = drive->hwif; |
211 | struct scatterlist *sg = hwif->sg_table; | 211 | struct scatterlist *sg = hwif->sg_table; |
212 | struct scatterlist *cursg = hwif->cursg; | 212 | struct scatterlist *cursg = cmd->cursg; |
213 | struct page *page; | 213 | struct page *page; |
214 | #ifdef CONFIG_HIGHMEM | 214 | #ifdef CONFIG_HIGHMEM |
215 | unsigned long flags; | 215 | unsigned long flags; |
@@ -217,14 +217,14 @@ static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd, | |||
217 | unsigned int offset; | 217 | unsigned int offset; |
218 | u8 *buf; | 218 | u8 *buf; |
219 | 219 | ||
220 | cursg = hwif->cursg; | 220 | cursg = cmd->cursg; |
221 | if (!cursg) { | 221 | if (!cursg) { |
222 | cursg = sg; | 222 | cursg = sg; |
223 | hwif->cursg = sg; | 223 | cmd->cursg = sg; |
224 | } | 224 | } |
225 | 225 | ||
226 | page = sg_page(cursg); | 226 | page = sg_page(cursg); |
227 | offset = cursg->offset + hwif->cursg_ofs * SECTOR_SIZE; | 227 | offset = cursg->offset + cmd->cursg_ofs * SECTOR_SIZE; |
228 | 228 | ||
229 | /* get the current page and offset */ | 229 | /* get the current page and offset */ |
230 | page = nth_page(page, (offset >> PAGE_SHIFT)); | 230 | page = nth_page(page, (offset >> PAGE_SHIFT)); |
@@ -235,12 +235,12 @@ static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd, | |||
235 | #endif | 235 | #endif |
236 | buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset; | 236 | buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset; |
237 | 237 | ||
238 | hwif->nleft--; | 238 | cmd->nleft--; |
239 | hwif->cursg_ofs++; | 239 | cmd->cursg_ofs++; |
240 | 240 | ||
241 | if ((hwif->cursg_ofs * SECTOR_SIZE) == cursg->length) { | 241 | if ((cmd->cursg_ofs * SECTOR_SIZE) == cursg->length) { |
242 | hwif->cursg = sg_next(hwif->cursg); | 242 | cmd->cursg = sg_next(cmd->cursg); |
243 | hwif->cursg_ofs = 0; | 243 | cmd->cursg_ofs = 0; |
244 | } | 244 | } |
245 | 245 | ||
246 | /* do the actual data transfer */ | 246 | /* do the actual data transfer */ |
@@ -260,7 +260,7 @@ static void ide_pio_multi(ide_drive_t *drive, struct ide_cmd *cmd, | |||
260 | { | 260 | { |
261 | unsigned int nsect; | 261 | unsigned int nsect; |
262 | 262 | ||
263 | nsect = min_t(unsigned int, drive->hwif->nleft, drive->mult_count); | 263 | nsect = min_t(unsigned int, cmd->nleft, drive->mult_count); |
264 | while (nsect--) | 264 | while (nsect--) |
265 | ide_pio_sector(drive, cmd, write); | 265 | ide_pio_sector(drive, cmd, write); |
266 | } | 266 | } |
@@ -295,19 +295,18 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct ide_cmd *cmd, | |||
295 | const char *s, u8 stat) | 295 | const char *s, u8 stat) |
296 | { | 296 | { |
297 | if (cmd->tf_flags & IDE_TFLAG_FS) { | 297 | if (cmd->tf_flags & IDE_TFLAG_FS) { |
298 | ide_hwif_t *hwif = drive->hwif; | 298 | int sectors = cmd->nsect - cmd->nleft; |
299 | int sectors = hwif->nsect - hwif->nleft; | ||
300 | 299 | ||
301 | switch (cmd->data_phase) { | 300 | switch (cmd->data_phase) { |
302 | case TASKFILE_IN: | 301 | case TASKFILE_IN: |
303 | if (hwif->nleft) | 302 | if (cmd->nleft) |
304 | break; | 303 | break; |
305 | /* fall through */ | 304 | /* fall through */ |
306 | case TASKFILE_OUT: | 305 | case TASKFILE_OUT: |
307 | sectors--; | 306 | sectors--; |
308 | break; | 307 | break; |
309 | case TASKFILE_MULTI_IN: | 308 | case TASKFILE_MULTI_IN: |
310 | if (hwif->nleft) | 309 | if (cmd->nleft) |
311 | break; | 310 | break; |
312 | /* fall through */ | 311 | /* fall through */ |
313 | case TASKFILE_MULTI_OUT: | 312 | case TASKFILE_MULTI_OUT: |
@@ -375,7 +374,7 @@ static ide_startstop_t task_in_intr(ide_drive_t *drive) | |||
375 | ide_pio_datablock(drive, cmd, 0); | 374 | ide_pio_datablock(drive, cmd, 0); |
376 | 375 | ||
377 | /* Are we done? Check status and finish transfer. */ | 376 | /* Are we done? Check status and finish transfer. */ |
378 | if (!hwif->nleft) { | 377 | if (cmd->nleft == 0) { |
379 | stat = wait_drive_not_busy(drive); | 378 | stat = wait_drive_not_busy(drive); |
380 | if (!OK_STAT(stat, 0, BAD_STAT)) | 379 | if (!OK_STAT(stat, 0, BAD_STAT)) |
381 | return task_error(drive, cmd, __func__, stat); | 380 | return task_error(drive, cmd, __func__, stat); |
@@ -402,10 +401,10 @@ static ide_startstop_t task_out_intr (ide_drive_t *drive) | |||
402 | return task_error(drive, cmd, __func__, stat); | 401 | return task_error(drive, cmd, __func__, stat); |
403 | 402 | ||
404 | /* Deal with unexpected ATA data phase. */ | 403 | /* Deal with unexpected ATA data phase. */ |
405 | if (((stat & ATA_DRQ) == 0) ^ !hwif->nleft) | 404 | if (((stat & ATA_DRQ) == 0) ^ (cmd->nleft == 0)) |
406 | return task_error(drive, cmd, __func__, stat); | 405 | return task_error(drive, cmd, __func__, stat); |
407 | 406 | ||
408 | if (!hwif->nleft) { | 407 | if (cmd->nleft == 0) { |
409 | ide_finish_cmd(drive, cmd, stat); | 408 | ide_finish_cmd(drive, cmd, stat); |
410 | return ide_stopped; | 409 | return ide_stopped; |
411 | } | 410 | } |
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c index 904fb54668e8..f5b85f4c1b65 100644 --- a/drivers/ide/pmac.c +++ b/drivers/ide/pmac.c | |||
@@ -1432,7 +1432,7 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) | |||
1432 | volatile struct dbdma_regs __iomem *dma = pmif->dma_regs; | 1432 | volatile struct dbdma_regs __iomem *dma = pmif->dma_regs; |
1433 | struct scatterlist *sg; | 1433 | struct scatterlist *sg; |
1434 | int wr = (rq_data_dir(rq) == WRITE); | 1434 | int wr = (rq_data_dir(rq) == WRITE); |
1435 | int i = hwif->sg_nents, count = 0; | 1435 | int i = hwif->cmd.sg_nents, count = 0; |
1436 | 1436 | ||
1437 | /* DMA table is already aligned */ | 1437 | /* DMA table is already aligned */ |
1438 | table = (struct dbdma_cmd *) pmif->dma_table_cpu; | 1438 | table = (struct dbdma_cmd *) pmif->dma_table_cpu; |
diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c index ab9433a7ad1f..b0769e96d32f 100644 --- a/drivers/ide/sgiioc4.c +++ b/drivers/ide/sgiioc4.c | |||
@@ -429,7 +429,7 @@ sgiioc4_build_dma_table(ide_drive_t * drive, struct request *rq, int ddir) | |||
429 | { | 429 | { |
430 | ide_hwif_t *hwif = drive->hwif; | 430 | ide_hwif_t *hwif = drive->hwif; |
431 | unsigned int *table = hwif->dmatable_cpu; | 431 | unsigned int *table = hwif->dmatable_cpu; |
432 | unsigned int count = 0, i = hwif->sg_nents; | 432 | unsigned int count = 0, i = hwif->cmd.sg_nents; |
433 | struct scatterlist *sg = hwif->sg_table; | 433 | struct scatterlist *sg = hwif->sg_table; |
434 | 434 | ||
435 | while (i && sg_dma_len(sg)) { | 435 | while (i && sg_dma_len(sg)) { |
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index bf11791476f0..8d155ec8cca9 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c | |||
@@ -240,7 +240,7 @@ static int tx4939ide_build_dmatable(ide_drive_t *drive, struct request *rq) | |||
240 | int i; | 240 | int i; |
241 | struct scatterlist *sg; | 241 | struct scatterlist *sg; |
242 | 242 | ||
243 | for_each_sg(hwif->sg_table, sg, hwif->sg_nents, i) { | 243 | for_each_sg(hwif->sg_table, sg, hwif->cmd.sg_nents, i) { |
244 | u32 cur_addr, cur_len, bcount; | 244 | u32 cur_addr, cur_len, bcount; |
245 | 245 | ||
246 | cur_addr = sg_dma_address(sg); | 246 | cur_addr = sg_dma_address(sg); |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 1785582e1f86..02128e9241d1 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -344,6 +344,16 @@ struct ide_cmd { | |||
344 | u8 ftf_flags; /* for TASKFILE ioctl */ | 344 | u8 ftf_flags; /* for TASKFILE ioctl */ |
345 | u32 tf_flags; | 345 | u32 tf_flags; |
346 | int data_phase; | 346 | int data_phase; |
347 | |||
348 | int sg_nents; /* number of sg entries */ | ||
349 | int orig_sg_nents; | ||
350 | int sg_dma_direction; /* DMA transfer direction */ | ||
351 | |||
352 | unsigned int nsect; | ||
353 | unsigned int nleft; | ||
354 | struct scatterlist *cursg; | ||
355 | unsigned int cursg_ofs; | ||
356 | |||
347 | struct request *rq; /* copy of request */ | 357 | struct request *rq; /* copy of request */ |
348 | void *special; /* valid_t generally */ | 358 | void *special; /* valid_t generally */ |
349 | }; | 359 | }; |
@@ -772,17 +782,9 @@ typedef struct hwif_s { | |||
772 | /* Scatter-gather list used to build the above */ | 782 | /* Scatter-gather list used to build the above */ |
773 | struct scatterlist *sg_table; | 783 | struct scatterlist *sg_table; |
774 | int sg_max_nents; /* Maximum number of entries in it */ | 784 | int sg_max_nents; /* Maximum number of entries in it */ |
775 | int sg_nents; /* Current number of entries in it */ | ||
776 | int orig_sg_nents; | ||
777 | int sg_dma_direction; /* dma transfer direction */ | ||
778 | 785 | ||
779 | struct ide_cmd cmd; /* current command */ | 786 | struct ide_cmd cmd; /* current command */ |
780 | 787 | ||
781 | unsigned int nsect; | ||
782 | unsigned int nleft; | ||
783 | struct scatterlist *cursg; | ||
784 | unsigned int cursg_ofs; | ||
785 | |||
786 | int rqsize; /* max sectors per request */ | 788 | int rqsize; /* max sectors per request */ |
787 | int irq; /* our irq number */ | 789 | int irq; /* our irq number */ |
788 | 790 | ||
@@ -1410,7 +1412,7 @@ int ide_pci_resume(struct pci_dev *); | |||
1410 | #endif | 1412 | #endif |
1411 | 1413 | ||
1412 | void ide_map_sg(ide_drive_t *, struct request *); | 1414 | void ide_map_sg(ide_drive_t *, struct request *); |
1413 | void ide_init_sg_cmd(ide_drive_t *, struct request *); | 1415 | void ide_init_sg_cmd(struct ide_cmd *, int); |
1414 | 1416 | ||
1415 | #define BAD_DMA_DRIVE 0 | 1417 | #define BAD_DMA_DRIVE 0 |
1416 | #define GOOD_DMA_DRIVE 1 | 1418 | #define GOOD_DMA_DRIVE 1 |