diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-03-25 13:11:59 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-03-25 13:11:59 +0000 |
commit | e062b2ded8bea4b44e6b5782a79fabbebb2eb929 (patch) | |
tree | 2b254b38691ca1d18309eaf5b10ebcde5eb617ac /sys/dev/ata/ata.c | |
parent | f8ee0399c6e8a97e07e33bfdd2cf4ed7bd611704 (diff) |
Minor mods to DMA interface - get rid of unnecessary args. Allow DMA functions to return status flags.
Note: Changing code to have DMA interface indicate when I/O is done (a la NetBSD) was considered. It was rejected due to questionable backward compatability
with ISA DMA and MAC obio DMA
Added irqack from NetBSD (though this feature should really be in the
PCI interrupt handlers)
Use pool
Diffstat (limited to 'sys/dev/ata/ata.c')
-rw-r--r-- | sys/dev/ata/ata.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sys/dev/ata/ata.c b/sys/dev/ata/ata.c index b9ce6f180b8..5a235e9102b 100644 --- a/sys/dev/ata/ata.c +++ b/sys/dev/ata/ata.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ata.c,v 1.9 2001/01/29 02:18:33 niklas Exp $ */ +/* $OpenBSD: ata.c,v 1.10 2001/03/25 13:11:55 csapuntz Exp $ */ /* $NetBSD: ata.c,v 1.9 1999/04/15 09:41:09 bouyer Exp $ */ /* * Copyright (c) 1998 Manuel Bouyer. All rights reserved. @@ -196,6 +196,30 @@ ata_set_mode(drvp, mode, flags) } void +ata_dmaerr(drvp) + struct ata_drive_datas *drvp; +{ + /* + * Downgrade decision: if we get NERRS_MAX in NXFER. + * We start with n_dmaerrs set to NERRS_MAX-1 so that the + * first error within the first NXFER ops will immediatly trigger + * a downgrade. + * If we got an error and n_xfers is bigger than NXFER reset counters. + */ + drvp->n_dmaerrs++; + if (drvp->n_dmaerrs >= NERRS_MAX && drvp->n_xfers <= NXFER) { + wdc_downgrade_mode(drvp); + drvp->n_dmaerrs = NERRS_MAX-1; + drvp->n_xfers = 0; + return; + } + if (drvp->n_xfers > NXFER) { + drvp->n_dmaerrs = 1; /* just got an error */ + drvp->n_xfers = 1; /* restart counting from this error */ + } +} + +void ata_perror(drvp, errno, buf) struct ata_drive_datas *drvp; int errno; |