PERFORCE change 54253 for review
Scott Long
scottl at FreeBSD.org
Sun Jun 6 03:53:16 GMT 2004
http://perforce.freebsd.org/chv.cgi?CH=54253
Change 54253 by scottl at scottl-esp-sparc64 on 2004/06/06 03:52:58
Use basic #include set, static-ize a bunch of functions, and remove
the ioctl handler.
Affected files ...
.. //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#4 edit
Differences ...
==== //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#4 (text+ko) ====
@@ -77,71 +77,61 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.106 2003/04/16 18:53:50 petrov Exp $");
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/callout.h>
+#include <sys/bus.h>
#include <sys/kernel.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
+#include <sys/resource.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/queue.h>
-#include <sys/pool.h>
-#include <sys/scsiio.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-#include <dev/scsipi/scsi_message.h>
+#include <cam/cam.h>
+#include <cam/cam_ccb.h>
+#include <cam/scsi/scsi_all.h>
-#include <dev/ic/ncr53c9xreg.h>
-#include <dev/ic/ncr53c9xvar.h>
+#include <dev/esp/ncr53c9xreg.h>
+#include <dev/esp/ncr53c9xvar.h>
int ncr53c9x_debug = NCR_SHOWMISC; /*NCR_SHOWPHASE|NCR_SHOWMISC|NCR_SHOWTRAC|NCR_SHOWCMDS;*/
#ifdef DEBUG
int ncr53c9x_notag = 0;
#endif
-/*static*/ void ncr53c9x_readregs(struct ncr53c9x_softc *);
-/*static*/ void ncr53c9x_select(struct ncr53c9x_softc *, struct ncr53c9x_ecb *);
-/*static*/ int ncr53c9x_reselect(struct ncr53c9x_softc *, int, int, int);
-/*static*/ void ncr53c9x_scsi_reset(struct ncr53c9x_softc *);
-/*static*/ int ncr53c9x_poll(struct ncr53c9x_softc *,
+static void ncr53c9x_select(struct ncr53c9x_softc *, struct ncr53c9x_ecb *);
+static int ncr53c9x_reselect(struct ncr53c9x_softc *, int, int, int);
+static void ncr53c9x_scsi_reset(struct ncr53c9x_softc *);
+static int ncr53c9x_poll(struct ncr53c9x_softc *,
struct scsipi_xfer *, int);
-/*static*/ void ncr53c9x_sched(struct ncr53c9x_softc *);
-/*static*/ void ncr53c9x_done(struct ncr53c9x_softc *, struct ncr53c9x_ecb *);
-/*static*/ void ncr53c9x_msgin(struct ncr53c9x_softc *);
-/*static*/ void ncr53c9x_msgout(struct ncr53c9x_softc *);
-/*static*/ void ncr53c9x_timeout(void *arg);
-/*static*/ void ncr53c9x_watch(void *arg);
-/*static*/ void ncr53c9x_abort(struct ncr53c9x_softc *, struct ncr53c9x_ecb *);
-/*static*/ void ncr53c9x_dequeue(struct ncr53c9x_softc *,
+static void ncr53c9x_sched(struct ncr53c9x_softc *);
+static void ncr53c9x_done(struct ncr53c9x_softc *, struct ncr53c9x_ecb *);
+static void ncr53c9x_msgin(struct ncr53c9x_softc *);
+static void ncr53c9x_msgout(struct ncr53c9x_softc *);
+static void ncr53c9x_timeout(void *arg);
+static void ncr53c9x_watch(void *arg);
+static void ncr53c9x_abort(struct ncr53c9x_softc *, struct ncr53c9x_ecb *);
+static void ncr53c9x_dequeue(struct ncr53c9x_softc *,
struct ncr53c9x_ecb *);
-/*static*/ int ncr53c9x_ioctl(struct scsipi_channel *, u_long,
- caddr_t, int, struct proc *);
+static void ncr53c9x_sense(struct ncr53c9x_softc *, struct ncr53c9x_ecb *);
+static void ncr53c9x_free_ecb(struct ncr53c9x_softc *,
+ struct ncr53c9x_ecb *);
+static void ncr53c9x_wrfifo(struct ncr53c9x_softc *, u_char *, int);
+static int ncr53c9x_rdfifo(struct ncr53c9x_softc *, int);
+static void ncr53c9x_update_xfer_mode(struct ncr53c9x_softc *, int);
-void ncr53c9x_sense(struct ncr53c9x_softc *, struct ncr53c9x_ecb *);
-void ncr53c9x_free_ecb(struct ncr53c9x_softc *, struct ncr53c9x_ecb *);
-struct ncr53c9x_ecb *ncr53c9x_get_ecb(struct ncr53c9x_softc *, int);
-
-static inline int ncr53c9x_stp2cpb(struct ncr53c9x_softc *, int);
-static inline void ncr53c9x_setsync(struct ncr53c9x_softc *,
- struct ncr53c9x_tinfo *);
-void ncr53c9x_update_xfer_mode (struct ncr53c9x_softc *, int);
+static struct ncr53c9x_ecb *ncr53c9x_get_ecb(struct ncr53c9x_softc *, int);
static struct ncr53c9x_linfo *ncr53c9x_lunsearch(struct ncr53c9x_tinfo *,
int64_t lun);
-static void ncr53c9x_wrfifo(struct ncr53c9x_softc *, u_char *, int);
+static __inline void ncr53c9x_readregs(struct ncr53c9x_softc *);
+static __inline int ncr53c9x_stp2cpb(struct ncr53c9x_softc *, int);
+static __inline void ncr53c9x_setsync(struct ncr53c9x_softc *,
+ struct ncr53c9x_tinfo *);
-static int ncr53c9x_rdfifo(struct ncr53c9x_softc *, int);
#define NCR_RDFIFO_START 0
#define NCR_RDFIFO_CONTINUE 1
-
#define NCR_SET_COUNT(sc, size) do { \
NCR_WRITE_REG((sc), NCR_TCL, (size)); \
NCR_WRITE_REG((sc), NCR_TCM, (size) >> 8); \
@@ -274,7 +264,6 @@
adapt->adapt_nchannels = 1;
adapt->adapt_openings = 256;
adapt->adapt_max_periph = 256;
- adapt->adapt_ioctl = ncr53c9x_ioctl;
/* adapt_request initialized by front-end */
/* adapt_minphys initialized by front-end */
@@ -415,7 +404,7 @@
/*
* Reset the SCSI bus, but not the chip
*/
-void
+static void
ncr53c9x_scsi_reset(sc)
struct ncr53c9x_softc *sc;
{
@@ -532,7 +521,7 @@
* only make sense when he DMA CSR has an interrupt showing. Call only
* if an interrupt is pending.
*/
-__inline__ void
+static __inline void
ncr53c9x_readregs(sc)
struct ncr53c9x_softc *sc;
{
@@ -564,7 +553,7 @@
/*
* Convert Synchronous Transfer Period to chip register Clock Per Byte value.
*/
-static inline int
+static __inline int
ncr53c9x_stp2cpb(sc, period)
struct ncr53c9x_softc *sc;
int period;
@@ -577,7 +566,7 @@
return (v);
}
-static inline void
+static __inline void
ncr53c9x_setsync(sc, ti)
struct ncr53c9x_softc *sc;
struct ncr53c9x_tinfo *ti;
@@ -630,7 +619,7 @@
* Keeping this as a function allows me to say that this may be done
* by DMA instead of programmed I/O soon.
*/
-void
+static void
ncr53c9x_select(sc, ecb)
struct ncr53c9x_softc *sc;
struct ncr53c9x_ecb *ecb;
@@ -780,7 +769,7 @@
NCRCMD(sc, NCRCMD_SELATN);
}
-void
+static void
ncr53c9x_free_ecb(sc, ecb)
struct ncr53c9x_softc *sc;
struct ncr53c9x_ecb *ecb;
@@ -794,7 +783,7 @@
return;
}
-struct ncr53c9x_ecb *
+static struct ncr53c9x_ecb *
ncr53c9x_get_ecb(sc, flags)
struct ncr53c9x_softc *sc;
int flags;
@@ -948,7 +937,7 @@
splx(s);
}
-void
+static void
ncr53c9x_update_xfer_mode(sc, target)
struct ncr53c9x_softc *sc;
int target;
@@ -978,7 +967,7 @@
/*
* Used when interrupt driven I/O isn't allowed, e.g. during boot.
*/
-int
+static int
ncr53c9x_poll(sc, xs, count)
struct ncr53c9x_softc *sc;
struct scsipi_xfer *xs;
@@ -1008,33 +997,6 @@
return (1);
}
-int
-ncr53c9x_ioctl(chan, cmd, arg, flag, p)
- struct scsipi_channel *chan;
- u_long cmd;
- caddr_t arg;
- int flag;
- struct proc *p;
-{
- struct ncr53c9x_softc *sc = (void *)chan->chan_adapter->adapt_dev;
- int s, error = 0;
-
- switch (cmd) {
- case SCBUSIORESET:
- s = splbio();
- simple_lock(&sc->sc_lock);
- ncr53c9x_init(sc, 1);
- simple_unlock(&sc->sc_lock);
- splx(s);
- break;
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-
-
/*
* LOW LEVEL SCSI UTILITIES
*/
@@ -1045,7 +1007,7 @@
* ncr53c9x_done. This may save us an unecessary interrupt just to get
* things going. Should only be called when state == NCR_IDLE and at bio pl.
*/
-void
+static void
ncr53c9x_sched(sc)
struct ncr53c9x_softc *sc;
{
@@ -1142,7 +1104,7 @@
}
}
-void
+static void
ncr53c9x_sense(sc, ecb)
struct ncr53c9x_softc *sc;
struct ncr53c9x_ecb *ecb;
@@ -1185,7 +1147,7 @@
/*
* POST PROCESSING OF SCSI_CMD (usually current)
*/
-void
+static void
ncr53c9x_done(sc, ecb)
struct ncr53c9x_softc *sc;
struct ncr53c9x_ecb *ecb;
@@ -1267,7 +1229,7 @@
simple_lock(&sc->sc_lock);
}
-void
+static void
ncr53c9x_dequeue(sc, ecb)
struct ncr53c9x_softc *sc;
struct ncr53c9x_ecb *ecb;
@@ -1423,7 +1385,7 @@
}
}
-int
+static int
ncr53c9x_reselect(sc, message, tagtype, tagid)
struct ncr53c9x_softc *sc;
int message;
@@ -1534,7 +1496,7 @@
* The SCSI bus must already be in MESSAGE_IN_PHASE and there is a
* byte in the FIFO
*/
-void
+static void
ncr53c9x_msgin(sc)
struct ncr53c9x_softc *sc;
{
@@ -1888,7 +1850,7 @@
/*
* Send the highest priority, scheduled message
*/
-void
+static void
ncr53c9x_msgout(sc)
struct ncr53c9x_softc *sc;
{
@@ -2838,7 +2800,7 @@
goto out;
}
-void
+static void
ncr53c9x_abort(sc, ecb)
struct ncr53c9x_softc *sc;
struct ncr53c9x_ecb *ecb;
@@ -2872,7 +2834,7 @@
}
}
-void
+static void
ncr53c9x_timeout(arg)
void *arg;
{
@@ -2930,7 +2892,7 @@
splx(s);
}
-void
+static void
ncr53c9x_watch(arg)
void *arg;
{
More information about the p4-projects
mailing list