summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2005-06-28 18:33:12 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2005-06-28 18:33:12 +0000
commit0570c3547bdedb8fb5921875d7e13a64595c72b0 (patch)
tree230bc3307026ad75824305e282e234b242572786 /sys/dev
parenta90165c97cf041ad9a474064474991ad70e89e8e (diff)
NBIO > 0 the bioctl code.
Conditional jump to ami_ioctl() if NBIO > 0 is defined. ok deraadt@ mickey@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/ami.c17
-rw-r--r--sys/dev/ic/amivar.h3
2 files changed, 16 insertions, 4 deletions
diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c
index c4c175ab289..b7abfbeacce 100644
--- a/sys/dev/ic/ami.c
+++ b/sys/dev/ic/ami.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ami.c,v 1.44 2005/06/28 15:09:36 marco Exp $ */
+/* $OpenBSD: ami.c,v 1.45 2005/06/28 18:33:11 marco Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -135,11 +135,13 @@ int ami_done(struct ami_softc *sc, int idx);
void ami_copy_internal_data(struct scsi_xfer *xs, void *v, size_t size);
int ami_inquire(struct ami_softc *sc, u_int8_t op);
+#if NBIO > 0
int ami_ioctl(struct device *, u_long, caddr_t);
int ami_ioctl_alarm(struct ami_softc *, bioc_alarm *);
int ami_ioctl_startstop( struct ami_softc *, bioc_startstop *);
int ami_ioctl_status( struct ami_softc *, bioc_status *);
int ami_ioctl_passthru(struct ami_softc *, bioc_scsicmd *);
+#endif /* NBIO > 0 */
struct ami_ccb *
ami_get_ccb(sc)
@@ -605,7 +607,9 @@ ami_attach(sc)
if (bio_register(&sc->sc_dev, ami_ioctl) != 0)
printf("%s: controller registration failed",
sc->sc_dev.dv_xname);
-#endif
+ else
+ sc->sc_ioctl = ami_ioctl;
+#endif /* NBIO > 0 */
config_found(&sc->sc_dev, &sc->sc_link, scsiprint);
@@ -1674,9 +1678,15 @@ int
ami_scsi_ioctl(struct scsi_link *link, u_long cmd,
caddr_t addr, int flag, struct proc *p)
{
- return ami_ioctl(link->adapter_softc, cmd, addr);
+ struct ami_softc *sc = (struct ami_softc *)link->adapter_softc;
+
+ if (sc->sc_ioctl)
+ return (sc->sc_ioctl(link->adapter_softc, cmd, addr));
+ else
+ return (ENOTTY);
}
+#if NBIO > 0
int
ami_ioctl(dev, cmd, addr)
struct device *dev;
@@ -2061,6 +2071,7 @@ ami_ioctl_passthru(sc, bp)
return (error);
}
+#endif /* NBIO > 0 */
#ifdef AMI_DEBUG
void
diff --git a/sys/dev/ic/amivar.h b/sys/dev/ic/amivar.h
index 77a5d86048f..ae0cbc8cbcd 100644
--- a/sys/dev/ic/amivar.h
+++ b/sys/dev/ic/amivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: amivar.h,v 1.10 2005/05/27 20:39:30 marco Exp $ */
+/* $OpenBSD: amivar.h,v 1.11 2005/06/28 18:33:11 marco Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -69,6 +69,7 @@ struct ami_softc {
int (*sc_exec)(struct ami_softc *sc, struct ami_iocmd *);
int (*sc_done)(struct ami_softc *sc, struct ami_iocmd *);
int (*sc_poll)(struct ami_softc *sc, struct ami_iocmd *);
+ int (*sc_ioctl)(struct device *, u_long, caddr_t);
bus_space_tag_t iot;
bus_space_handle_t ioh;