ide: remove ata_nsector_t, ata_data_t and atapi_bcount_t

Remove ata_nsector_t, ata_data_t (unused) and atapi_bcount_t.

While at it:
* replace 'HWIF(drive)' by 'hwif'
Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
上级 e5f9f5a8
...@@ -137,14 +137,12 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, ...@@ -137,14 +137,12 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
unsigned int dma = drive->using_dma; unsigned int dma = drive->using_dma;
u16 nsectors = (u16)rq->nr_sectors;
u8 lba48 = (drive->addressing == 1) ? 1 : 0; u8 lba48 = (drive->addressing == 1) ? 1 : 0;
u8 command = WIN_NOP; u8 command = WIN_NOP;
ata_nsector_t nsectors;
ide_task_t task; ide_task_t task;
struct ide_taskfile *tf = &task.tf; struct ide_taskfile *tf = &task.tf;
nsectors.all = (u16) rq->nr_sectors;
if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) { if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) {
if (block + rq->nr_sectors > 1ULL << 28) if (block + rq->nr_sectors > 1ULL << 28)
dma = 0; dma = 0;
...@@ -166,14 +164,14 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, ...@@ -166,14 +164,14 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
pr_debug("%s: LBA=0x%012llx\n", drive->name, pr_debug("%s: LBA=0x%012llx\n", drive->name,
(unsigned long long)block); (unsigned long long)block);
tf->hob_nsect = nsectors.b.high; tf->hob_nsect = (nsectors >> 8) & 0xff;
tf->hob_lbal = (u8)(block >> 24); tf->hob_lbal = (u8)(block >> 24);
if (sizeof(block) != 4) { if (sizeof(block) != 4) {
tf->hob_lbam = (u8)((u64)block >> 32); tf->hob_lbam = (u8)((u64)block >> 32);
tf->hob_lbah = (u8)((u64)block >> 40); tf->hob_lbah = (u8)((u64)block >> 40);
} }
tf->nsect = nsectors.b.low; tf->nsect = nsectors & 0xff;
tf->lbal = (u8) block; tf->lbal = (u8) block;
tf->lbam = (u8)(block >> 8); tf->lbam = (u8)(block >> 8);
tf->lbah = (u8)(block >> 16); tf->lbah = (u8)(block >> 16);
...@@ -185,7 +183,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, ...@@ -185,7 +183,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
#endif #endif
task.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); task.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB);
} else { } else {
tf->nsect = nsectors.b.low; tf->nsect = nsectors & 0xff;
tf->lbal = block; tf->lbal = block;
tf->lbam = block >>= 8; tf->lbam = block >>= 8;
tf->lbah = block >>= 8; tf->lbah = block >>= 8;
...@@ -200,7 +198,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, ...@@ -200,7 +198,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect); pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect);
tf->nsect = nsectors.b.low; tf->nsect = nsectors & 0xff;
tf->lbal = sect; tf->lbal = sect;
tf->lbam = cyl; tf->lbam = cyl;
tf->lbah = cyl >> 8; tf->lbah = cyl >> 8;
......
...@@ -787,11 +787,12 @@ static void idefloppy_retry_pc (ide_drive_t *drive) ...@@ -787,11 +787,12 @@ static void idefloppy_retry_pc (ide_drive_t *drive)
static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
{ {
idefloppy_floppy_t *floppy = drive->driver_data; idefloppy_floppy_t *floppy = drive->driver_data;
atapi_bcount_t bcount; ide_hwif_t *hwif = drive->hwif;
atapi_ireason_t ireason; atapi_ireason_t ireason;
idefloppy_pc_t *pc = floppy->pc; idefloppy_pc_t *pc = floppy->pc;
struct request *rq = pc->rq; struct request *rq = pc->rq;
unsigned int temp; unsigned int temp;
u16 bcount;
u8 stat; u8 stat;
debug_log(KERN_INFO "ide-floppy: Reached %s interrupt handler\n", debug_log(KERN_INFO "ide-floppy: Reached %s interrupt handler\n",
...@@ -848,8 +849,8 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) ...@@ -848,8 +849,8 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
} }
/* Get the number of bytes to transfer */ /* Get the number of bytes to transfer */
bcount.b.high = HWIF(drive)->INB(IDE_BCOUNTH_REG); bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) |
bcount.b.low = HWIF(drive)->INB(IDE_BCOUNTL_REG); hwif->INB(IDE_BCOUNTL_REG);
/* on this interrupt */ /* on this interrupt */
ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); ireason.all = HWIF(drive)->INB(IDE_IREASON_REG);
...@@ -867,13 +868,13 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) ...@@ -867,13 +868,13 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
} }
if (!test_bit(PC_WRITING, &pc->flags)) { if (!test_bit(PC_WRITING, &pc->flags)) {
/* Reading - Check that we have enough space */ /* Reading - Check that we have enough space */
temp = pc->actually_transferred + bcount.all; temp = pc->actually_transferred + bcount;
if (temp > pc->request_transfer) { if (temp > pc->request_transfer) {
if (temp > pc->buffer_size) { if (temp > pc->buffer_size) {
printk(KERN_ERR "ide-floppy: The floppy wants " printk(KERN_ERR "ide-floppy: The floppy wants "
"to send us more data than expected " "to send us more data than expected "
"- discarding data\n"); "- discarding data\n");
idefloppy_discard_data(drive,bcount.all); idefloppy_discard_data(drive, bcount);
BUG_ON(HWGROUP(drive)->handler != NULL); BUG_ON(HWGROUP(drive)->handler != NULL);
ide_set_handler(drive, ide_set_handler(drive,
&idefloppy_pc_intr, &idefloppy_pc_intr,
...@@ -889,23 +890,21 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) ...@@ -889,23 +890,21 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
if (test_bit(PC_WRITING, &pc->flags)) { if (test_bit(PC_WRITING, &pc->flags)) {
if (pc->buffer != NULL) if (pc->buffer != NULL)
/* Write the current buffer */ /* Write the current buffer */
HWIF(drive)->atapi_output_bytes(drive, hwif->atapi_output_bytes(drive, pc->current_position,
pc->current_position, bcount);
bcount.all);
else else
idefloppy_output_buffers(drive, pc, bcount.all); idefloppy_output_buffers(drive, pc, bcount);
} else { } else {
if (pc->buffer != NULL) if (pc->buffer != NULL)
/* Read the current buffer */ /* Read the current buffer */
HWIF(drive)->atapi_input_bytes(drive, hwif->atapi_input_bytes(drive, pc->current_position,
pc->current_position, bcount);
bcount.all);
else else
idefloppy_input_buffers(drive, pc, bcount.all); idefloppy_input_buffers(drive, pc, bcount);
} }
/* Update the current position */ /* Update the current position */
pc->actually_transferred += bcount.all; pc->actually_transferred += bcount;
pc->current_position += bcount.all; pc->current_position += bcount;
BUG_ON(HWGROUP(drive)->handler != NULL); BUG_ON(HWGROUP(drive)->handler != NULL);
ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */ ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */
...@@ -1019,8 +1018,8 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p ...@@ -1019,8 +1018,8 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
{ {
idefloppy_floppy_t *floppy = drive->driver_data; idefloppy_floppy_t *floppy = drive->driver_data;
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
atapi_bcount_t bcount;
ide_handler_t *pkt_xfer_routine; ide_handler_t *pkt_xfer_routine;
u16 bcount;
u8 dma; u8 dma;
if (floppy->failed_pc == NULL && if (floppy->failed_pc == NULL &&
...@@ -1059,7 +1058,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p ...@@ -1059,7 +1058,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
/* We haven't transferred any data yet */ /* We haven't transferred any data yet */
pc->actually_transferred = 0; pc->actually_transferred = 0;
pc->current_position = pc->buffer; pc->current_position = pc->buffer;
bcount.all = min(pc->request_transfer, 63 * 1024); bcount = min(pc->request_transfer, 63 * 1024);
if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags)) if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags))
ide_dma_off(drive); ide_dma_off(drive);
...@@ -1073,8 +1072,8 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p ...@@ -1073,8 +1072,8 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG); HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
/* Use PIO/DMA */ /* Use PIO/DMA */
hwif->OUTB(dma, IDE_FEATURE_REG); hwif->OUTB(dma, IDE_FEATURE_REG);
HWIF(drive)->OUTB(bcount.b.high, IDE_BCOUNTH_REG); hwif->OUTB((bcount >> 8) & 0xff, IDE_BCOUNTH_REG);
HWIF(drive)->OUTB(bcount.b.low, IDE_BCOUNTL_REG); hwif->OUTB(bcount & 0xff, IDE_BCOUNTL_REG);
HWIF(drive)->OUTB(drive->select.all, IDE_SELECT_REG); HWIF(drive)->OUTB(drive->select.all, IDE_SELECT_REG);
if (dma) { /* Begin DMA, if necessary */ if (dma) { /* Begin DMA, if necessary */
......
...@@ -1847,13 +1847,13 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) ...@@ -1847,13 +1847,13 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
atapi_bcount_t bcount;
atapi_ireason_t ireason; atapi_ireason_t ireason;
idetape_pc_t *pc = tape->pc; idetape_pc_t *pc = tape->pc;
unsigned int temp; unsigned int temp;
#if SIMULATE_ERRORS #if SIMULATE_ERRORS
static int error_sim_count = 0; static int error_sim_count = 0;
#endif #endif
u16 bcount;
u8 stat; u8 stat;
#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
...@@ -1962,8 +1962,8 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) ...@@ -1962,8 +1962,8 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
return ide_do_reset(drive); return ide_do_reset(drive);
} }
/* Get the number of bytes to transfer on this interrupt. */ /* Get the number of bytes to transfer on this interrupt. */
bcount.b.high = hwif->INB(IDE_BCOUNTH_REG); bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) |
bcount.b.low = hwif->INB(IDE_BCOUNTL_REG); hwif->INB(IDE_BCOUNTL_REG);
ireason.all = hwif->INB(IDE_IREASON_REG); ireason.all = hwif->INB(IDE_IREASON_REG);
...@@ -1981,11 +1981,11 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) ...@@ -1981,11 +1981,11 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
} }
if (!test_bit(PC_WRITING, &pc->flags)) { if (!test_bit(PC_WRITING, &pc->flags)) {
/* Reading - Check that we have enough space */ /* Reading - Check that we have enough space */
temp = pc->actually_transferred + bcount.all; temp = pc->actually_transferred + bcount;
if (temp > pc->request_transfer) { if (temp > pc->request_transfer) {
if (temp > pc->buffer_size) { if (temp > pc->buffer_size) {
printk(KERN_ERR "ide-tape: The tape wants to send us more data than expected - discarding data\n"); printk(KERN_ERR "ide-tape: The tape wants to send us more data than expected - discarding data\n");
idetape_discard_data(drive, bcount.all); idetape_discard_data(drive, bcount);
ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL);
return ide_started; return ide_started;
} }
...@@ -1997,23 +1997,26 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) ...@@ -1997,23 +1997,26 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
} }
if (test_bit(PC_WRITING, &pc->flags)) { if (test_bit(PC_WRITING, &pc->flags)) {
if (pc->bh != NULL) if (pc->bh != NULL)
idetape_output_buffers(drive, pc, bcount.all); idetape_output_buffers(drive, pc, bcount);
else else
/* Write the current buffer */ /* Write the current buffer */
HWIF(drive)->atapi_output_bytes(drive, pc->current_position, bcount.all); hwif->atapi_output_bytes(drive, pc->current_position,
bcount);
} else { } else {
if (pc->bh != NULL) if (pc->bh != NULL)
idetape_input_buffers(drive, pc, bcount.all); idetape_input_buffers(drive, pc, bcount);
else else
/* Read the current buffer */ /* Read the current buffer */
HWIF(drive)->atapi_input_bytes(drive, pc->current_position, bcount.all); hwif->atapi_input_bytes(drive, pc->current_position,
bcount);
} }
/* Update the current position */ /* Update the current position */
pc->actually_transferred += bcount.all; pc->actually_transferred += bcount;
pc->current_position += bcount.all; pc->current_position += bcount;
#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 2) if (tape->debug_level >= 2)
printk(KERN_INFO "ide-tape: [cmd %x] transferred %d bytes on that interrupt\n", pc->c[0], bcount.all); printk(KERN_INFO "ide-tape: [cmd %x] transferred %d bytes "
"on that interrupt\n", pc->c[0], bcount);
#endif #endif
/* And set the interrupt handler again */ /* And set the interrupt handler again */
ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL);
...@@ -2109,8 +2112,8 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape ...@@ -2109,8 +2112,8 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
atapi_bcount_t bcount;
int dma_ok = 0; int dma_ok = 0;
u16 bcount;
#if IDETAPE_DEBUG_BUGS #if IDETAPE_DEBUG_BUGS
if (tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD && if (tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD &&
...@@ -2159,7 +2162,7 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape ...@@ -2159,7 +2162,7 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape
pc->actually_transferred = 0; pc->actually_transferred = 0;
pc->current_position = pc->buffer; pc->current_position = pc->buffer;
/* Request to transfer the entire buffer at once */ /* Request to transfer the entire buffer at once */
bcount.all = pc->request_transfer; bcount = pc->request_transfer;
if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags)) { if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags)) {
printk(KERN_WARNING "ide-tape: DMA disabled, " printk(KERN_WARNING "ide-tape: DMA disabled, "
...@@ -2172,8 +2175,8 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape ...@@ -2172,8 +2175,8 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape
if (IDE_CONTROL_REG) if (IDE_CONTROL_REG)
hwif->OUTB(drive->ctl, IDE_CONTROL_REG); hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
hwif->OUTB(dma_ok ? 1 : 0, IDE_FEATURE_REG); /* Use PIO/DMA */ hwif->OUTB(dma_ok ? 1 : 0, IDE_FEATURE_REG); /* Use PIO/DMA */
hwif->OUTB(bcount.b.high, IDE_BCOUNTH_REG); hwif->OUTB((bcount >> 8) & 0xff, IDE_BCOUNTH_REG);
hwif->OUTB(bcount.b.low, IDE_BCOUNTL_REG); hwif->OUTB(bcount & 0xff, IDE_BCOUNTL_REG);
hwif->OUTB(drive->select.all, IDE_SELECT_REG); hwif->OUTB(drive->select.all, IDE_SELECT_REG);
if (dma_ok) /* Will begin DMA later */ if (dma_ok) /* Will begin DMA later */
set_bit(PC_DMA_IN_PROGRESS, &pc->flags); set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
......
...@@ -395,11 +395,12 @@ static int idescsi_expiry(ide_drive_t *drive) ...@@ -395,11 +395,12 @@ static int idescsi_expiry(ide_drive_t *drive)
static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
{ {
idescsi_scsi_t *scsi = drive_to_idescsi(drive); idescsi_scsi_t *scsi = drive_to_idescsi(drive);
idescsi_pc_t *pc=scsi->pc; ide_hwif_t *hwif = drive->hwif;
idescsi_pc_t *pc = scsi->pc;
struct request *rq = pc->rq; struct request *rq = pc->rq;
atapi_bcount_t bcount;
atapi_ireason_t ireason; atapi_ireason_t ireason;
unsigned int temp; unsigned int temp;
u16 bcount;
u8 stat; u8 stat;
#if IDESCSI_DEBUG_LOG #if IDESCSI_DEBUG_LOG
...@@ -436,8 +437,8 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) ...@@ -436,8 +437,8 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
idescsi_end_request (drive, 1, 0); idescsi_end_request (drive, 1, 0);
return ide_stopped; return ide_stopped;
} }
bcount.b.low = HWIF(drive)->INB(IDE_BCOUNTL_REG); bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) |
bcount.b.high = HWIF(drive)->INB(IDE_BCOUNTH_REG); hwif->INB(IDE_BCOUNTL_REG);
ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); ireason.all = HWIF(drive)->INB(IDE_IREASON_REG);
if (ireason.b.cod) { if (ireason.b.cod) {
...@@ -445,7 +446,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) ...@@ -445,7 +446,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
return ide_do_reset (drive); return ide_do_reset (drive);
} }
if (ireason.b.io) { if (ireason.b.io) {
temp = pc->actually_transferred + bcount.all; temp = pc->actually_transferred + bcount;
if (temp > pc->request_transfer) { if (temp > pc->request_transfer) {
if (temp > pc->buffer_size) { if (temp > pc->buffer_size) {
printk(KERN_ERR "ide-scsi: The scsi wants to " printk(KERN_ERR "ide-scsi: The scsi wants to "
...@@ -458,11 +459,13 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) ...@@ -458,11 +459,13 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
idescsi_input_buffers(drive, pc, temp); idescsi_input_buffers(drive, pc, temp);
else else
drive->hwif->atapi_input_bytes(drive, pc->current_position, temp); drive->hwif->atapi_input_bytes(drive, pc->current_position, temp);
printk(KERN_ERR "ide-scsi: transferred %d of %d bytes\n", temp, bcount.all); printk(KERN_ERR "ide-scsi: transferred"
" %d of %d bytes\n",
temp, bcount);
} }
pc->actually_transferred += temp; pc->actually_transferred += temp;
pc->current_position += temp; pc->current_position += temp;
idescsi_discard_data(drive, bcount.all - temp); idescsi_discard_data(drive, bcount - temp);
ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
return ide_started; return ide_started;
} }
...@@ -474,19 +477,21 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) ...@@ -474,19 +477,21 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
if (ireason.b.io) { if (ireason.b.io) {
clear_bit(PC_WRITING, &pc->flags); clear_bit(PC_WRITING, &pc->flags);
if (pc->sg) if (pc->sg)
idescsi_input_buffers(drive, pc, bcount.all); idescsi_input_buffers(drive, pc, bcount);
else else
HWIF(drive)->atapi_input_bytes(drive, pc->current_position, bcount.all); hwif->atapi_input_bytes(drive, pc->current_position,
bcount);
} else { } else {
set_bit(PC_WRITING, &pc->flags); set_bit(PC_WRITING, &pc->flags);
if (pc->sg) if (pc->sg)
idescsi_output_buffers (drive, pc, bcount.all); idescsi_output_buffers(drive, pc, bcount);
else else
HWIF(drive)->atapi_output_bytes(drive, pc->current_position, bcount.all); hwif->atapi_output_bytes(drive, pc->current_position,
bcount);
} }
/* Update the current position */ /* Update the current position */
pc->actually_transferred += bcount.all; pc->actually_transferred += bcount;
pc->current_position += bcount.all; pc->current_position += bcount;
/* And set the interrupt handler again */ /* And set the interrupt handler again */
ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
...@@ -570,13 +575,14 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc) ...@@ -570,13 +575,14 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc)
{ {
idescsi_scsi_t *scsi = drive_to_idescsi(drive); idescsi_scsi_t *scsi = drive_to_idescsi(drive);
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
atapi_bcount_t bcount; u16 bcount;
u8 dma = 0; u8 dma = 0;
scsi->pc=pc; /* Set the current packet command */ scsi->pc=pc; /* Set the current packet command */
pc->actually_transferred=0; /* We haven't transferred any data yet */ pc->actually_transferred=0; /* We haven't transferred any data yet */
pc->current_position=pc->buffer; pc->current_position=pc->buffer;
bcount.all = min(pc->request_transfer, 63 * 1024); /* Request to transfer the entire buffer at once */ /* Request to transfer the entire buffer at once */
bcount = min(pc->request_transfer, 63 * 1024);
if (drive->using_dma && !idescsi_map_sg(drive, pc)) { if (drive->using_dma && !idescsi_map_sg(drive, pc)) {
hwif->sg_mapped = 1; hwif->sg_mapped = 1;
...@@ -589,8 +595,8 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc) ...@@ -589,8 +595,8 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc)
HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG); HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
hwif->OUTB(dma, IDE_FEATURE_REG); hwif->OUTB(dma, IDE_FEATURE_REG);
HWIF(drive)->OUTB(bcount.b.high, IDE_BCOUNTH_REG); hwif->OUTB((bcount >> 8) & 0xff, IDE_BCOUNTH_REG);
HWIF(drive)->OUTB(bcount.b.low, IDE_BCOUNTL_REG); hwif->OUTB(bcount & 0xff, IDE_BCOUNTL_REG);
if (dma) if (dma)
set_bit(PC_DMA_OK, &pc->flags); set_bit(PC_DMA_OK, &pc->flags);
......
...@@ -315,26 +315,6 @@ typedef union { ...@@ -315,26 +315,6 @@ typedef union {
} b; } b;
} special_t; } special_t;
/*
* ATA DATA Register Special.
* ATA NSECTOR Count Register().
* ATAPI Byte Count Register.
*/
typedef union {
unsigned all :16;
struct {
#if defined(__LITTLE_ENDIAN_BITFIELD)
unsigned low :8; /* LSB */
unsigned high :8; /* MSB */
#elif defined(__BIG_ENDIAN_BITFIELD)
unsigned high :8; /* MSB */
unsigned low :8; /* LSB */
#else
#error "Please fix <asm/byteorder.h>"
#endif
} b;
} ata_nsector_t, ata_data_t, atapi_bcount_t;
/* /*
* ATA-IDE Select Register, aka Device-Head * ATA-IDE Select Register, aka Device-Head
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册