Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104998
b: refs/heads/master
c: b73c7ee
h: refs/heads/master
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Jul 23, 2008
1 parent eacb05e commit 577eeb4
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 70 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c6dfa867bb45f4bff2e48f3bc89ab1d6a7ab4c21
refs/heads/master: b73c7ee25da6133f97f47ffd3557288417da7c76
4 changes: 3 additions & 1 deletion trunk/drivers/ide/arm/icside.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,14 @@ static int icside_dma_test_irq(ide_drive_t *drive)

static void icside_dma_timeout(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;

printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name);

if (icside_dma_test_irq(drive))
return;

ide_dump_status(drive, "DMA timeout", ide_read_status(drive));
ide_dump_status(drive, "DMA timeout", hwif->read_status(hwif));

icside_dma_end(drive);
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/ide/ide-atapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
}

/* Clear the interrupt */
stat = ide_read_status(drive);
stat = hwif->read_status(hwif);

if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
if (hwif->dma_ops->dma_end(drive) ||
Expand Down
12 changes: 8 additions & 4 deletions trunk/drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,12 @@ static void ide_dump_status_no_sense(ide_drive_t *drive, const char *msg, u8 st)
*/
static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
{
struct request *rq = HWGROUP(drive)->rq;
ide_hwif_t *hwif = drive->hwif;
struct request *rq = hwif->hwgroup->rq;
int stat, err, sense_key;

/* check for errors */
stat = ide_read_status(drive);
stat = hwif->read_status(hwif);

if (stat_ret)
*stat_ret = stat;
Expand Down Expand Up @@ -606,6 +607,8 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq,
int len, int ireason, int rw)
{
ide_hwif_t *hwif = drive->hwif;

/*
* ireason == 0: the drive wants to receive data from us
* ireason == 2: the drive is expecting to transfer data to us
Expand All @@ -624,7 +627,7 @@ static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq,
* Some drives (ASUS) seem to tell us that status info is
* available. Just get it and ignore.
*/
(void)ide_read_status(drive);
(void)hwif->read_status(hwif);
return 0;
} else {
/* drive wants a command packet, or invalid ireason... */
Expand Down Expand Up @@ -1199,8 +1202,9 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,

if (blk_fs_request(rq)) {
if (info->cd_flags & IDE_CD_FLAG_SEEKING) {
ide_hwif_t *hwif = drive->hwif;
unsigned long elapsed = jiffies - info->start_seek;
int stat = ide_read_status(drive);
int stat = hwif->read_status(hwif);

if ((stat & SEEK_STAT) != SEEK_STAT) {
if (elapsed < IDECD_SEEK_TIMEOUT) {
Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/ide/ide-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ static const struct drive_list_entry drive_blacklist [] = {

ide_startstop_t ide_dma_intr (ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
u8 stat = 0, dma_stat = 0;

dma_stat = drive->hwif->dma_ops->dma_end(drive);
stat = ide_read_status(drive);
dma_stat = hwif->dma_ops->dma_end(drive);
stat = hwif->read_status(hwif);

if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
if (!dma_stat) {
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/ide/ide-floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,11 +949,12 @@ static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg)

/* Else assume format_unit has finished, and we're at 0x10000 */
} else {
ide_hwif_t *hwif = drive->hwif;
unsigned long flags;
u8 stat;

local_irq_save(flags);
stat = ide_read_status(drive);
stat = hwif->read_status(hwif);
local_irq_restore(flags);

progress_indication = ((stat & SEEK_STAT) == 0) ? 0 : 0x10000;
Expand Down
19 changes: 10 additions & 9 deletions trunk/drivers/ide/ide-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
if (err == ABRT_ERR) {
if (drive->select.b.lba &&
/* some newer drives don't support WIN_SPECIFY */
hwif->INB(hwif->io_ports.command_addr) ==
WIN_SPECIFY)
hwif->read_status(hwif) == WIN_SPECIFY)
return ide_stopped;
} else if ((err & BAD_CRC) == BAD_CRC) {
/* UDMA crc error, just retry the operation */
Expand All @@ -408,7 +407,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
return ide_stopped;
}

if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT))
if (hwif->read_status(hwif) & (BUSY_STAT | DRQ_STAT))
rq->errors |= ERROR_RESET;

if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
Expand All @@ -435,7 +434,7 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u
/* add decoding error stuff */
}

if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT))
if (hwif->read_status(hwif) & (BUSY_STAT | DRQ_STAT))
/* force an abort */
hwif->exec_command(hwif, WIN_IDLEIMMEDIATE);

Expand Down Expand Up @@ -711,7 +710,8 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
#ifdef DEBUG
printk("%s: DRIVE_CMD (null)\n", drive->name);
#endif
ide_end_drive_cmd(drive, ide_read_status(drive), ide_read_error(drive));
ide_end_drive_cmd(drive, hwif->read_status(hwif),
ide_read_error(drive));

return ide_stopped;
}
Expand Down Expand Up @@ -1141,7 +1141,7 @@ static ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error)
printk(KERN_WARNING "%s: DMA timeout error\n", drive->name);
(void)hwif->dma_ops->dma_end(drive);
ret = ide_error(drive, "dma timeout error",
ide_read_status(drive));
hwif->read_status(hwif));
} else {
printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name);
hwif->dma_ops->dma_timeout(drive);
Expand Down Expand Up @@ -1266,7 +1266,7 @@ void ide_timer_expiry (unsigned long data)
} else
startstop =
ide_error(drive, "irq timeout",
ide_read_status(drive));
hwif->read_status(hwif));
}
drive->service_time = jiffies - drive->service_start;
spin_lock_irq(&ide_lock);
Expand Down Expand Up @@ -1322,7 +1322,8 @@ static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup)
*/
do {
if (hwif->irq == irq) {
stat = hwif->INB(hwif->io_ports.status_addr);
stat = hwif->read_status(hwif);

if (!OK_STAT(stat, READY_STAT, BAD_STAT)) {
/* Try to not flood the console with msgs */
static unsigned long last_msgtime, count;
Expand Down Expand Up @@ -1412,7 +1413,7 @@ irqreturn_t ide_intr (int irq, void *dev_id)
* Whack the status register, just in case
* we have a leftover pending IRQ.
*/
(void) hwif->INB(hwif->io_ports.status_addr);
(void)hwif->read_status(hwif);
#endif /* CONFIG_BLK_DEV_IDEPCI */
}
spin_unlock_irqrestore(&ide_lock, flags);
Expand Down
33 changes: 22 additions & 11 deletions trunk/drivers/ide/ide-iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ static void ide_exec_command(ide_hwif_t *hwif, u8 cmd)
outb(cmd, hwif->io_ports.command_addr);
}

static u8 ide_read_status(ide_hwif_t *hwif)
{
if (hwif->host_flags & IDE_HFLAG_MMIO)
return readb((void __iomem *)hwif->io_ports.status_addr);
else
return inb(hwif->io_ports.status_addr);
}

static u8 ide_read_sff_dma_status(ide_hwif_t *hwif)
{
if (hwif->host_flags & IDE_HFLAG_MMIO)
Expand Down Expand Up @@ -340,6 +348,7 @@ static void ata_output_data(ide_drive_t *drive, struct request *rq,
void default_hwif_transport(ide_hwif_t *hwif)
{
hwif->exec_command = ide_exec_command;
hwif->read_status = ide_read_status;
hwif->read_sff_dma_status = ide_read_sff_dma_status;

hwif->tf_load = ide_tf_load;
Expand Down Expand Up @@ -505,7 +514,7 @@ int drive_is_ready (ide_drive_t *drive)
stat = ide_read_altstatus(drive);
else
/* Note: this may clear a pending IRQ!! */
stat = ide_read_status(drive);
stat = hwif->read_status(hwif);

if (stat & BUSY_STAT)
/* drive busy: definitely not interrupting */
Expand All @@ -530,24 +539,25 @@ EXPORT_SYMBOL(drive_is_ready);
*/
static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long timeout, u8 *rstat)
{
ide_hwif_t *hwif = drive->hwif;
unsigned long flags;
int i;
u8 stat;

udelay(1); /* spec allows drive 400ns to assert "BUSY" */
stat = ide_read_status(drive);
stat = hwif->read_status(hwif);

if (stat & BUSY_STAT) {
local_irq_set(flags);
timeout += jiffies;
while ((stat = ide_read_status(drive)) & BUSY_STAT) {
while ((stat = hwif->read_status(hwif)) & BUSY_STAT) {
if (time_after(jiffies, timeout)) {
/*
* One last read after the timeout in case
* heavy interrupt load made us not make any
* progress during the timeout..
*/
stat = ide_read_status(drive);
stat = hwif->read_status(hwif);
if (!(stat & BUSY_STAT))
break;

Expand All @@ -567,7 +577,7 @@ static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long ti
*/
for (i = 0; i < 10; i++) {
udelay(1);
stat = ide_read_status(drive);
stat = hwif->read_status(hwif);

if (OK_STAT(stat, good, bad)) {
*rstat = stat;
Expand Down Expand Up @@ -718,7 +728,7 @@ int ide_driveid_update(ide_drive_t *drive)
} while (stat & BUSY_STAT);

msleep(50); /* wait for IRQ and DRQ_STAT */
stat = ide_read_status(drive);
stat = hwif->read_status(hwif);

if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) {
SELECT_MASK(drive, 0);
Expand All @@ -733,7 +743,7 @@ int ide_driveid_update(ide_drive_t *drive)
return 0;
}
hwif->input_data(drive, NULL, id, SECTOR_SIZE);
(void)ide_read_status(drive); /* clear drive IRQ */
(void)hwif->read_status(hwif); /* clear drive IRQ */
local_irq_enable();
local_irq_restore(flags);
ide_fix_driveid(id);
Expand Down Expand Up @@ -943,12 +953,13 @@ static ide_startstop_t do_reset1 (ide_drive_t *, int);
*/
static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive)
{
ide_hwgroup_t *hwgroup = HWGROUP(drive);
ide_hwif_t *hwif = drive->hwif;
ide_hwgroup_t *hwgroup = hwif->hwgroup;
u8 stat;

SELECT_DRIVE(drive);
udelay (10);
stat = ide_read_status(drive);
stat = hwif->read_status(hwif);

if (OK_STAT(stat, 0, BUSY_STAT))
printk("%s: ATAPI reset complete\n", drive->name);
Expand Down Expand Up @@ -994,7 +1005,7 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
}
}

tmp = ide_read_status(drive);
tmp = hwif->read_status(hwif);

if (!OK_STAT(tmp, 0, BUSY_STAT)) {
if (time_before(jiffies, hwgroup->poll_timeout)) {
Expand Down Expand Up @@ -1208,7 +1219,7 @@ int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout)
* about locking issues (2.5 work ?).
*/
mdelay(1);
stat = hwif->INB(hwif->io_ports.status_addr);
stat = hwif->read_status(hwif);
if ((stat & BUSY_STAT) == 0)
return 0;
/*
Expand Down
22 changes: 11 additions & 11 deletions trunk/drivers/ide/ide-probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd)

if (io_ports->ctl_addr) {
a = ide_read_altstatus(drive);
s = ide_read_status(drive);
s = hwif->read_status(hwif);
if ((a ^ s) & ~INDEX_STAT)
/* ancient Seagate drives, broken interfaces */
printk(KERN_INFO "%s: probing with STATUS(0x%02x) "
Expand Down Expand Up @@ -307,12 +307,12 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd)
/* give drive a breather */
msleep(50);
s = use_altstatus ? ide_read_altstatus(drive)
: ide_read_status(drive);
: hwif->read_status(hwif);
} while (s & BUSY_STAT);

/* wait for IRQ and DRQ_STAT */
msleep(50);
s = ide_read_status(drive);
s = hwif->read_status(hwif);

if (OK_STAT(s, DRQ_STAT, BAD_R_STAT)) {
unsigned long flags;
Expand All @@ -324,7 +324,7 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd)
/* drive responded with ID */
rc = 0;
/* clear drive IRQ */
(void)ide_read_status(drive);
(void)hwif->read_status(hwif);
local_irq_restore(flags);
} else {
/* drive refused ID */
Expand Down Expand Up @@ -371,7 +371,7 @@ static int try_to_identify (ide_drive_t *drive, u8 cmd)

ide_set_irq(drive, 0);
/* clear drive IRQ */
(void)ide_read_status(drive);
(void)hwif->read_status(hwif);
udelay(5);
irq = probe_irq_off(cookie);
if (!hwif->irq) {
Expand All @@ -396,7 +396,7 @@ static int ide_busy_sleep(ide_hwif_t *hwif)

do {
msleep(50);
stat = hwif->INB(hwif->io_ports.status_addr);
stat = hwif->read_status(hwif);
if ((stat & BUSY_STAT) == 0)
return 0;
} while (time_before(jiffies, timeout));
Expand Down Expand Up @@ -461,7 +461,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
return 3;
}

stat = ide_read_status(drive);
stat = hwif->read_status(hwif);

if (OK_STAT(stat, READY_STAT, BUSY_STAT) ||
drive->present || cmd == WIN_PIDENTIFY) {
Expand All @@ -471,7 +471,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
rc = try_to_identify(drive,cmd);
}

stat = ide_read_status(drive);
stat = hwif->read_status(hwif);

if (stat == (BUSY_STAT | READY_STAT))
return 4;
Expand All @@ -488,7 +488,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
}

/* ensure drive IRQ is clear */
stat = ide_read_status(drive);
stat = hwif->read_status(hwif);

if (rc == 1)
printk(KERN_ERR "%s: no response (status = 0x%02x)\n",
Expand All @@ -502,7 +502,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
SELECT_DRIVE(&hwif->drives[0]);
msleep(50);
/* ensure drive irq is clear */
(void)ide_read_status(drive);
(void)hwif->read_status(hwif);
}
return rc;
}
Expand All @@ -527,7 +527,7 @@ static void enable_nest (ide_drive_t *drive)

msleep(50);

stat = ide_read_status(drive);
stat = hwif->read_status(hwif);

if (!OK_STAT(stat, 0, BAD_STAT))
printk(KERN_CONT "failed (status = 0x%02x)\n", stat);
Expand Down
Loading

0 comments on commit 577eeb4

Please sign in to comment.