summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1999-01-17 05:46:25 +0000
committerbde <bde@FreeBSD.org>1999-01-17 05:46:25 +0000
commitdbb879887a22e434e5cf1a725ed4225cc87d67bd (patch)
tree4876f56b000cd56ffb8972e67767fd0b320ff451
parent66115cf2aaeeaf0faf0a598f154171fccae928d9 (diff)
downloadFreeBSD-src-dbb879887a22e434e5cf1a725ed4225cc87d67bd.zip
FreeBSD-src-dbb879887a22e434e5cf1a725ed4225cc87d67bd.tar.gz
Pass the unit number to the DMA cookie lookup routine and use it
to look up cookies properly, at least for standard controllers. Cookies are used so that we don't have to pass around lots of args. All of the dmainit functions use the unit number so it is essential that we pass them a cookie with the correct unit number. This may break working configurations if there are bugs in the dmainit functions like the ones I just fixed for VIA chipsets. Broken in: rev 1.4 of ide_pci.c and rev.1.139 of wd.c.
-rw-r--r--sys/i386/isa/wd.c8
-rw-r--r--sys/i386/isa/wdreg.h4
-rw-r--r--sys/pci/ide_pci.c11
3 files changed, 13 insertions, 10 deletions
diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c
index fc16d7c..4886155 100644
--- a/sys/i386/isa/wd.c
+++ b/sys/i386/isa/wd.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
- * $Id: wd.c,v 1.184 1999/01/12 01:04:38 eivind Exp $
+ * $Id: wd.c,v 1.185 1999/01/16 01:06:23 bde Exp $
*/
/* TODO:
@@ -314,7 +314,8 @@ wdprobe(struct isa_device *dvp)
du->dk_port = dvp->id_iobase;
if (wddma[interface].wdd_candma != NULL) {
du->dk_dmacookie =
- wddma[interface].wdd_candma(dvp->id_iobase, du->dk_ctrlr);
+ wddma[interface].wdd_candma(dvp->id_iobase, du->dk_ctrlr,
+ du->dk_unit);
du->dk_altport =
wddma[interface].wdd_altiobase(du->dk_dmacookie);
}
@@ -1878,7 +1879,8 @@ failed:
* check drive's DMA capability
*/
if (wddma[du->dk_interface].wdd_candma) {
- du->dk_dmacookie = wddma[du->dk_interface].wdd_candma(du->dk_port, du->dk_ctrlr);
+ du->dk_dmacookie = wddma[du->dk_interface].wdd_candma(
+ du->dk_port, du->dk_ctrlr, du->dk_unit);
/* does user want this? */
if ((du->cfg_flags & WDOPT_DMA) &&
/* have we got a DMA controller? */
diff --git a/sys/i386/isa/wdreg.h b/sys/i386/isa/wdreg.h
index 0c06aa9..88a0fec 100644
--- a/sys/i386/isa/wdreg.h
+++ b/sys/i386/isa/wdreg.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wdreg.h 7.1 (Berkeley) 5/9/91
- * $Id: wdreg.h,v 1.23 1998/10/22 05:58:41 bde Exp $
+ * $Id: wdreg.h,v 1.24 1999/01/12 01:04:38 eivind Exp $
*/
/*
@@ -262,7 +262,7 @@ int wdformat(struct buf *bp);
*/
struct wddma {
void *(*wdd_candma) /* returns a cookie if PCI */
- __P((int ctlr, int drive));
+ __P((int iobase_wd, int ctlr, int unit));
int (*wdd_dmaverify) /* verify that request is DMA-able */
__P((void *cookie, char *vaddr, u_long len, int direction));
int (*wdd_dmaprep) /* prepare DMA hardware */
diff --git a/sys/pci/ide_pci.c b/sys/pci/ide_pci.c
index 099aed4..39c53a5 100644
--- a/sys/pci/ide_pci.c
+++ b/sys/pci/ide_pci.c
@@ -26,7 +26,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ide_pci.c,v 1.26 1999/01/16 19:48:01 bde Exp $
+ * $Id: ide_pci.c,v 1.27 1999/01/17 05:18:54 bde Exp $
*/
#include "pci.h"
@@ -159,7 +159,7 @@ mkcookie(int iobase_wd,
static void ide_pci_attach(pcici_t tag, int unit);
-static void *ide_pci_candma(int, int);
+static void *ide_pci_candma(int, int, int);
static int ide_pci_dmainit(void *,
struct wdparams *,
int (*)(int, void *),
@@ -1449,16 +1449,17 @@ static struct pci_device ide_pci_device = {
DATA_SET(pcidevice_set, ide_pci_device);
/*
- * Return a cookie if we can do DMA on the specified (iobase_wd, ctlr).
+ * Return a cookie if we may be able to do DMA on the specified
+ * (iobase_wd, ctlr, unit).
*/
static void *
-ide_pci_candma(int iobase_wd, int ctlr)
+ide_pci_candma(int iobase_wd, int ctlr, int unit)
{
struct ide_pci_cookie *cp;
cp = softc.cookies.lh_first;
while(cp) {
- if (cp->ctlr == ctlr &&
+ if (cp->ctlr == ctlr && cp->unit == unit &&
((iobase_wd == 0) || (cp->iobase_wd == iobase_wd)))
break;
cp = cp->le.le_next;
OpenPOWER on IntegriCloud