Use ANSI function decls and make use of static.

This commit is contained in:
thorpej 2004-08-21 21:29:39 +00:00
parent 3a4c3c0872
commit be6339d21a
6 changed files with 184 additions and 341 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsi_base.c,v 1.78 2004/08/05 19:45:13 bouyer Exp $ */
/* $NetBSD: scsi_base.c,v 1.79 2004/08/21 21:29:39 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scsi_base.c,v 1.78 2004/08/05 19:45:13 bouyer Exp $");
__KERNEL_RCSID(0, "$NetBSD: scsi_base.c,v 1.79 2004/08/21 21:29:39 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -59,9 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: scsi_base.c,v 1.78 2004/08/05 19:45:13 bouyer Exp $"
* Do a scsi operation, asking a device to run as SCSI-II if it can.
*/
int
scsi_change_def(periph, flags)
struct scsipi_periph *periph;
int flags;
scsi_change_def(struct scsipi_periph *periph, int flags)
{
struct scsi_changedef scsipi_cmd;
@ -81,17 +79,9 @@ scsi_change_def(periph, flags)
* to associate with the transfer, we need that too.
*/
int
scsi_scsipi_cmd(periph, scsipi_cmd, cmdlen, data, datalen,
retries, timeout, bp, flags)
struct scsipi_periph *periph;
struct scsipi_generic *scsipi_cmd;
int cmdlen;
void *data;
size_t datalen;
int retries;
int timeout;
struct buf *bp;
int flags;
scsi_scsipi_cmd(struct scsipi_periph *periph, struct scsipi_generic *scsipi_cmd,
int cmdlen, void *data, size_t datalen, int retries, int timeout,
struct buf *bp, int flags)
{
struct scsipi_xfer *xs;
int error, s;
@ -137,8 +127,7 @@ scsi_scsipi_cmd(periph, scsipi_cmd, cmdlen, data, datalen,
* Print out the periph's address info.
*/
void
scsi_print_addr(periph)
struct scsipi_periph *periph;
scsi_print_addr(struct scsipi_periph *periph)
{
struct scsipi_channel *chan = periph->periph_channel;
struct scsipi_adapter *adapt = chan->chan_adapter;
@ -156,7 +145,6 @@ scsi_print_addr(periph)
* Must be called at splbio().
*/
void
scsi_kill_pending(periph)
struct scsipi_periph *periph;
scsi_kill_pending(struct scsipi_periph *periph)
{
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsiconf.c,v 1.225 2004/08/18 11:50:59 drochner Exp $ */
/* $NetBSD: scsiconf.c,v 1.226 2004/08/21 21:29:39 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.225 2004/08/18 11:50:59 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.226 2004/08/21 21:29:39 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -76,7 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.225 2004/08/18 11:50:59 drochner Exp
#include "locators.h"
const struct scsipi_periphsw scsi_probe_dev = {
static const struct scsipi_periphsw scsi_probe_dev = {
NULL,
NULL,
NULL,
@ -92,17 +92,17 @@ static TAILQ_HEAD(, scsi_initq) scsi_initq_head =
TAILQ_HEAD_INITIALIZER(scsi_initq_head);
static struct simplelock scsibus_interlock = SIMPLELOCK_INITIALIZER;
int scsi_probe_device __P((struct scsibus_softc *, int, int));
static int scsi_probe_device(struct scsibus_softc *, int, int);
int scsibusmatch __P((struct device *, struct cfdata *, void *));
void scsibusattach __P((struct device *, struct device *, void *));
int scsibusactivate __P((struct device *, enum devact));
int scsibusdetach __P((struct device *, int flags));
int scsibusrescan(struct device *, const char *, const int *);
void scsidevdetached(struct device *, struct device *);
static int scsibusmatch(struct device *, struct cfdata *, void *);
static void scsibusattach(struct device *, struct device *, void *);
static int scsibusactivate(struct device *, enum devact);
static int scsibusdetach(struct device *, int flags);
static int scsibusrescan(struct device *, const char *, const int *);
static void scsidevdetached(struct device *, struct device *);
int scsibussubmatch __P((struct device *, struct cfdata *,
const locdesc_t *, void *));
static int scsibussubmatch(struct device *, struct cfdata *,
const locdesc_t *, void *);
CFATTACH_DECL2(scsibus, sizeof(struct scsibus_softc),
scsibusmatch, scsibusattach, scsibusdetach, scsibusactivate,
@ -110,17 +110,17 @@ CFATTACH_DECL2(scsibus, sizeof(struct scsibus_softc),
extern struct cfdriver scsibus_cd;
dev_type_open(scsibusopen);
dev_type_close(scsibusclose);
dev_type_ioctl(scsibusioctl);
static dev_type_open(scsibusopen);
static dev_type_close(scsibusclose);
static dev_type_ioctl(scsibusioctl);
const struct cdevsw scsibus_cdevsw = {
scsibusopen, scsibusclose, noread, nowrite, scsibusioctl,
nostop, notty, nopoll, nommap, nokqfilter,
};
int scsibusprint __P((void *, const char *));
void scsibus_config __P((struct scsipi_channel *, void *));
static int scsibusprint(void *, const char *);
static void scsibus_config(struct scsipi_channel *, void *);
const struct scsipi_bustype scsi_bustype = {
SCSIPI_BUSTYPE_SCSI,
@ -131,9 +131,7 @@ const struct scsipi_bustype scsi_bustype = {
};
int
scsiprint(aux, pnp)
void *aux;
const char *pnp;
scsiprint(void *aux, const char *pnp)
{
struct scsipi_channel *chan = aux;
struct scsipi_adapter *adapt = chan->chan_adapter;
@ -149,11 +147,8 @@ scsiprint(aux, pnp)
return (UNCONF);
}
int
scsibusmatch(parent, cf, aux)
struct device *parent;
struct cfdata *cf;
void *aux;
static int
scsibusmatch(struct device *parent, struct cfdata *cf, void *aux)
{
struct scsipi_channel *chan = aux;
@ -167,10 +162,8 @@ scsibusmatch(parent, cf, aux)
return (1);
}
void
scsibusattach(parent, self, aux)
struct device *parent, *self;
void *aux;
static void
scsibusattach(struct device *parent, struct device *self, void *aux)
{
struct scsibus_softc *sc = (void *) self;
struct scsipi_channel *chan = aux;
@ -204,10 +197,8 @@ scsibusattach(parent, self, aux)
}
}
void
scsibus_config(chan, arg)
struct scsipi_channel *chan;
void *arg;
static void
scsibus_config(struct scsipi_channel *chan, void *arg)
{
struct scsibus_softc *sc = arg;
struct scsi_initq *scsi_initq;
@ -251,7 +242,7 @@ scsibus_config(chan, arg)
config_pending_decr();
}
int
static int
scsibussubmatch(struct device *parent, struct cfdata *cf,
const locdesc_t *ldesc, void *aux)
{
@ -265,10 +256,8 @@ scsibussubmatch(struct device *parent, struct cfdata *cf,
return (config_match(parent, cf, aux));
}
int
scsibusactivate(self, act)
struct device *self;
enum devact act;
static int
scsibusactivate(struct device *self, enum devact act)
{
struct scsibus_softc *sc = (void *) self;
struct scsipi_channel *chan = sc->sc_channel;
@ -303,10 +292,8 @@ scsibusactivate(self, act)
return (error);
}
int
scsibusdetach(self, flags)
struct device *self;
int flags;
static int
scsibusdetach(struct device *self, int flags)
{
struct scsibus_softc *sc = (void *) self;
struct scsipi_channel *chan = sc->sc_channel;
@ -353,9 +340,7 @@ scsibusdetach(self, flags)
* target and lun optionally narrow the search if not -1
*/
int
scsi_probe_bus(sc, target, lun)
struct scsibus_softc *sc;
int target, lun;
scsi_probe_bus(struct scsibus_softc *sc, int target, int lun)
{
struct scsipi_channel *chan = sc->sc_channel;
int maxtarget, mintarget, maxlun, minlun;
@ -412,7 +397,7 @@ scsi_probe_bus(sc, target, lun)
return (0);
}
int
static int
scsibusrescan(struct device *sc, const char *ifattr, const int *locators)
{
@ -423,7 +408,7 @@ scsibusrescan(struct device *sc, const char *ifattr, const int *locators)
locators[SCSIBUSCF_TARGET], locators[SCSIBUSCF_LUN]));
}
void
static void
scsidevdetached(struct device *sc, struct device *dev)
{
struct scsibus_softc *ssc = (struct scsibus_softc *)sc;
@ -451,10 +436,8 @@ scsidevdetached(struct device *sc, struct device *dev)
* or having the device driver call a special function to print out
* the standard device information.
*/
int
scsibusprint(aux, pnp)
void *aux;
const char *pnp;
static int
scsibusprint(void *aux, const char *pnp)
{
struct scsipibus_attach_args *sa = aux;
struct scsipi_inquiry_pattern *inqbuf;
@ -485,7 +468,7 @@ scsibusprint(aux, pnp)
return (UNCONF);
}
const struct scsi_quirk_inquiry_pattern scsi_quirk_patterns[] = {
static const struct scsi_quirk_inquiry_pattern scsi_quirk_patterns[] = {
{{T_CDROM, T_REMOV,
"CHINON ", "CD-ROM CDS-431 ", ""}, PQUIRK_NOLUNS},
{{T_CDROM, T_REMOV,
@ -746,10 +729,8 @@ const struct scsi_quirk_inquiry_pattern scsi_quirk_patterns[] = {
* it is, and find the correct driver table
* entry.
*/
int
scsi_probe_device(sc, target, lun)
struct scsibus_softc *sc;
int target, lun;
static int
scsi_probe_device(struct scsibus_softc *sc, int target, int lun)
{
struct scsipi_channel *chan = sc->sc_channel;
struct scsipi_periph *periph;
@ -1002,11 +983,8 @@ bad:
/****** Entry points for user control of the SCSI bus. ******/
int
scsibusopen(dev, flag, fmt, p)
dev_t dev;
int flag, fmt;
struct proc *p;
static int
scsibusopen(dev_t dev, int flag, int fmt, struct proc *p)
{
struct scsibus_softc *sc;
int error, unit = minor(dev);
@ -1026,11 +1004,8 @@ scsibusopen(dev, flag, fmt, p)
return (0);
}
int
scsibusclose(dev, flag, fmt, p)
dev_t dev;
int flag, fmt;
struct proc *p;
static int
scsibusclose(dev_t dev, int flag, int fmt, struct proc *p)
{
struct scsibus_softc *sc = scsibus_cd.cd_devs[minor(dev)];
@ -1041,13 +1016,8 @@ scsibusclose(dev, flag, fmt, p)
return (0);
}
int
scsibusioctl(dev, cmd, addr, flag, p)
dev_t dev;
u_long cmd;
caddr_t addr;
int flag;
struct proc *p;
static int
scsibusioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
{
struct scsibus_softc *sc = scsibus_cd.cd_devs[minor(dev)];
struct scsipi_channel *chan = sc->sc_channel;

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsipi_base.c,v 1.107 2004/08/18 11:50:59 drochner Exp $ */
/* $NetBSD: scsipi_base.c,v 1.108 2004/08/21 21:29:39 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002, 2003 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.107 2004/08/18 11:50:59 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.108 2004/08/21 21:29:39 thorpej Exp $");
#include "opt_scsi.h"
@ -63,27 +63,26 @@ __KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.107 2004/08/18 11:50:59 drochner E
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsi_message.h>
int scsipi_complete __P((struct scsipi_xfer *));
void scsipi_request_sense __P((struct scsipi_xfer *));
int scsipi_enqueue __P((struct scsipi_xfer *));
void scsipi_run_queue __P((struct scsipi_channel *chan));
static int scsipi_complete(struct scsipi_xfer *);
static void scsipi_request_sense(struct scsipi_xfer *);
static int scsipi_enqueue(struct scsipi_xfer *);
static void scsipi_run_queue(struct scsipi_channel *chan);
void scsipi_completion_thread __P((void *));
static void scsipi_completion_thread(void *);
void scsipi_get_tag __P((struct scsipi_xfer *));
void scsipi_put_tag __P((struct scsipi_xfer *));
static void scsipi_get_tag(struct scsipi_xfer *);
static void scsipi_put_tag(struct scsipi_xfer *);
int scsipi_get_resource __P((struct scsipi_channel *));
void scsipi_put_resource __P((struct scsipi_channel *));
__inline int scsipi_grow_resources __P((struct scsipi_channel *));
static int scsipi_get_resource(struct scsipi_channel *);
static void scsipi_put_resource(struct scsipi_channel *);
void scsipi_async_event_max_openings __P((struct scsipi_channel *,
struct scsipi_max_openings *));
void scsipi_async_event_xfer_mode __P((struct scsipi_channel *,
struct scsipi_xfer_mode *));
void scsipi_async_event_channel_reset __P((struct scsipi_channel *));
static void scsipi_async_event_max_openings(struct scsipi_channel *,
struct scsipi_max_openings *);
static void scsipi_async_event_xfer_mode(struct scsipi_channel *,
struct scsipi_xfer_mode *);
static void scsipi_async_event_channel_reset(struct scsipi_channel *);
struct pool scsipi_xfer_pool;
static struct pool scsipi_xfer_pool;
/*
* scsipi_init:
@ -92,7 +91,7 @@ struct pool scsipi_xfer_pool;
* to initialize shared data structures.
*/
void
scsipi_init()
scsipi_init(void)
{
static int scsipi_init_done;
@ -111,8 +110,7 @@ scsipi_init()
* Initialize a scsipi_channel when it is attached.
*/
int
scsipi_channel_init(chan)
struct scsipi_channel *chan;
scsipi_channel_init(struct scsipi_channel *chan)
{
int i;
@ -139,8 +137,7 @@ scsipi_channel_init(chan)
* Shutdown a scsipi_channel.
*/
void
scsipi_channel_shutdown(chan)
struct scsipi_channel *chan;
scsipi_channel_shutdown(struct scsipi_channel *chan)
{
/*
@ -173,9 +170,7 @@ scsipi_chan_periph_hash(uint64_t t, uint64_t l)
* Insert a periph into the channel.
*/
void
scsipi_insert_periph(chan, periph)
struct scsipi_channel *chan;
struct scsipi_periph *periph;
scsipi_insert_periph(struct scsipi_channel *chan, struct scsipi_periph *periph)
{
uint32_t hash;
int s;
@ -194,9 +189,7 @@ scsipi_insert_periph(chan, periph)
* Remove a periph from the channel.
*/
void
scsipi_remove_periph(chan, periph)
struct scsipi_channel *chan;
struct scsipi_periph *periph;
scsipi_remove_periph(struct scsipi_channel *chan, struct scsipi_periph *periph)
{
int s;
@ -211,9 +204,7 @@ scsipi_remove_periph(chan, periph)
* Lookup a periph on the specified channel.
*/
struct scsipi_periph *
scsipi_lookup_periph(chan, target, lun)
struct scsipi_channel *chan;
int target, lun;
scsipi_lookup_periph(struct scsipi_channel *chan, int target, int lun)
{
struct scsipi_periph *periph;
uint32_t hash;
@ -243,9 +234,8 @@ scsipi_lookup_periph(chan, target, lun)
*
* NOTE: Must be called at splbio().
*/
int
scsipi_get_resource(chan)
struct scsipi_channel *chan;
static int
scsipi_get_resource(struct scsipi_channel *chan)
{
struct scsipi_adapter *adapt = chan->chan_adapter;
@ -272,9 +262,8 @@ scsipi_get_resource(chan)
*
* NOTE: Must be called at splbio().
*/
__inline int
scsipi_grow_resources(chan)
struct scsipi_channel *chan;
static __inline int
scsipi_grow_resources(struct scsipi_channel *chan)
{
if (chan->chan_flags & SCSIPI_CHAN_CANGROW) {
@ -303,9 +292,8 @@ scsipi_grow_resources(chan)
*
* NOTE: Must be called at splbio().
*/
void
scsipi_put_resource(chan)
struct scsipi_channel *chan;
static void
scsipi_put_resource(struct scsipi_channel *chan)
{
struct scsipi_adapter *adapt = chan->chan_adapter;
@ -322,9 +310,8 @@ scsipi_put_resource(chan)
*
* NOTE: Must be called at splbio().
*/
void
scsipi_get_tag(xs)
struct scsipi_xfer *xs;
static void
scsipi_get_tag(struct scsipi_xfer *xs)
{
struct scsipi_periph *periph = xs->xs_periph;
int bit, tag;
@ -365,9 +352,8 @@ scsipi_get_tag(xs)
*
* NOTE: Must be called at splbio().
*/
void
scsipi_put_tag(xs)
struct scsipi_xfer *xs;
static void
scsipi_put_tag(struct scsipi_xfer *xs)
{
struct scsipi_periph *periph = xs->xs_periph;
int word, bit;
@ -387,9 +373,7 @@ scsipi_put_tag(xs)
* one to become available, or fail.
*/
struct scsipi_xfer *
scsipi_get_xs(periph, flags)
struct scsipi_periph *periph;
int flags;
scsipi_get_xs(struct scsipi_periph *periph, int flags)
{
struct scsipi_xfer *xs;
int s;
@ -503,8 +487,7 @@ scsipi_get_xs(periph, flags)
* NOTE: Must be called at splbio().
*/
void
scsipi_put_xs(xs)
struct scsipi_xfer *xs;
scsipi_put_xs(struct scsipi_xfer *xs)
{
struct scsipi_periph *periph = xs->xs_periph;
int flags = xs->xs_control;
@ -553,9 +536,7 @@ scsipi_put_xs(xs)
* Freeze a channel's xfer queue.
*/
void
scsipi_channel_freeze(chan, count)
struct scsipi_channel *chan;
int count;
scsipi_channel_freeze(struct scsipi_channel *chan, int count)
{
int s;
@ -570,9 +551,7 @@ scsipi_channel_freeze(chan, count)
* Thaw a channel's xfer queue.
*/
void
scsipi_channel_thaw(chan, count)
struct scsipi_channel *chan;
int count;
scsipi_channel_thaw(struct scsipi_channel *chan, int count)
{
int s;
@ -605,8 +584,7 @@ scsipi_channel_thaw(chan, count)
* run the channel's queue if the freeze count has reached 0.
*/
void
scsipi_channel_timed_thaw(arg)
void *arg;
scsipi_channel_timed_thaw(void *arg)
{
struct scsipi_channel *chan = arg;
@ -619,9 +597,7 @@ scsipi_channel_timed_thaw(arg)
* Freeze a device's xfer queue.
*/
void
scsipi_periph_freeze(periph, count)
struct scsipi_periph *periph;
int count;
scsipi_periph_freeze(struct scsipi_periph *periph, int count)
{
int s;
@ -636,9 +612,7 @@ scsipi_periph_freeze(periph, count)
* Thaw a device's xfer queue.
*/
void
scsipi_periph_thaw(periph, count)
struct scsipi_periph *periph;
int count;
scsipi_periph_thaw(struct scsipi_periph *periph, int count)
{
int s;
@ -664,8 +638,7 @@ scsipi_periph_thaw(periph, count)
* Thaw a device after some time has expired.
*/
void
scsipi_periph_timed_thaw(arg)
void *arg;
scsipi_periph_timed_thaw(void *arg)
{
int s;
struct scsipi_periph *periph = arg;
@ -697,8 +670,7 @@ scsipi_periph_timed_thaw(arg)
* Wait for a periph's pending xfers to drain.
*/
void
scsipi_wait_drain(periph)
struct scsipi_periph *periph;
scsipi_wait_drain(struct scsipi_periph *periph)
{
int s;
@ -718,8 +690,7 @@ scsipi_wait_drain(periph)
* NOTE: Must be called at splbio().
*/
void
scsipi_kill_pending(periph)
struct scsipi_periph *periph;
scsipi_kill_pending(struct scsipi_periph *periph)
{
(*periph->periph_channel->chan_bustype->bustype_kill_pending)(periph);
@ -732,8 +703,7 @@ scsipi_kill_pending(periph)
* SCSIPI_VERBOSE, ...)
*/
void
scsipi_print_cdb(cmd)
struct scsipi_generic *cmd;
scsipi_print_cdb(struct scsipi_generic *cmd)
{
int i, j;
@ -785,8 +755,7 @@ scsipi_print_cdb(cmd)
* THIS IS THE DEFAULT ERROR HANDLER FOR SCSI DEVICES.
*/
int
scsipi_interpret_sense(xs)
struct scsipi_xfer *xs;
scsipi_interpret_sense(struct scsipi_xfer *xs)
{
struct scsipi_sense_data *sense;
struct scsipi_periph *periph = xs->xs_periph;
@ -1053,9 +1022,7 @@ scsipi_interpret_sense(xs)
* Find out from the device what its capacity is.
*/
u_int64_t
scsipi_size(periph, flags)
struct scsipi_periph *periph;
int flags;
scsipi_size(struct scsipi_periph *periph, int flags)
{
struct scsipi_read_cap_data rdcap;
struct scsipi_read_capacity scsipi_cmd;
@ -1082,9 +1049,7 @@ scsipi_size(periph, flags)
* Issue a `test unit ready' request.
*/
int
scsipi_test_unit_ready(periph, flags)
struct scsipi_periph *periph;
int flags;
scsipi_test_unit_ready(struct scsipi_periph *periph, int flags)
{
int retries;
struct scsipi_test_unit_ready scsipi_cmd;
@ -1112,10 +1077,8 @@ scsipi_test_unit_ready(periph, flags)
* Ask the device about itself.
*/
int
scsipi_inquire(periph, inqbuf, flags)
struct scsipi_periph *periph;
struct scsipi_inquiry_data *inqbuf;
int flags;
scsipi_inquire(struct scsipi_periph *periph, struct scsipi_inquiry_data *inqbuf,
int flags)
{
int retries;
struct scsipi_inquiry scsipi_cmd;
@ -1203,9 +1166,7 @@ scsipi_inquire(periph, inqbuf, flags)
* Prevent or allow the user to remove the media
*/
int
scsipi_prevent(periph, type, flags)
struct scsipi_periph *periph;
int type, flags;
scsipi_prevent(struct scsipi_periph *periph, int type, int flags)
{
struct scsipi_prevent scsipi_cmd;
@ -1224,9 +1185,7 @@ scsipi_prevent(periph, type, flags)
* Send a START UNIT.
*/
int
scsipi_start(periph, type, flags)
struct scsipi_periph *periph;
int type, flags;
scsipi_start(struct scsipi_periph *periph, int type, int flags)
{
struct scsipi_start_stop scsipi_cmd;
@ -1247,10 +1206,9 @@ scsipi_start(periph, type, flags)
*/
int
scsipi_mode_sense(periph, byte2, page, data, len, flags, retries, timeout)
struct scsipi_periph *periph;
int byte2, page, len, flags, retries, timeout;
struct scsipi_mode_header *data;
scsipi_mode_sense(struct scsipi_periph *periph, int byte2, int page,
struct scsipi_mode_header *data, int len, int flags, int retries,
int timeout)
{
struct scsipi_mode_sense scsipi_cmd;
int error;
@ -1269,10 +1227,9 @@ scsipi_mode_sense(periph, byte2, page, data, len, flags, retries, timeout)
}
int
scsipi_mode_sense_big(periph, byte2, page, data, len, flags, retries, timeout)
struct scsipi_periph *periph;
int byte2, page, len, flags, retries, timeout;
struct scsipi_mode_header_big *data;
scsipi_mode_sense_big(struct scsipi_periph *periph, int byte2, int page,
struct scsipi_mode_header_big *data, int len, int flags, int retries,
int timeout)
{
struct scsipi_mode_sense_big scsipi_cmd;
int error;
@ -1291,10 +1248,9 @@ scsipi_mode_sense_big(periph, byte2, page, data, len, flags, retries, timeout)
}
int
scsipi_mode_select(periph, byte2, data, len, flags, retries, timeout)
struct scsipi_periph *periph;
int byte2, len, flags, retries, timeout;
struct scsipi_mode_header *data;
scsipi_mode_select(struct scsipi_periph *periph, int byte2,
struct scsipi_mode_header *data, int len, int flags, int retries,
int timeout)
{
struct scsipi_mode_select scsipi_cmd;
int error;
@ -1312,10 +1268,9 @@ scsipi_mode_select(periph, byte2, data, len, flags, retries, timeout)
}
int
scsipi_mode_select_big(periph, byte2, data, len, flags, retries, timeout)
struct scsipi_periph *periph;
int byte2, len, flags, retries, timeout;
struct scsipi_mode_header_big *data;
scsipi_mode_select_big(struct scsipi_periph *periph, int byte2,
struct scsipi_mode_header_big *data, int len, int flags, int retries,
int timeout)
{
struct scsipi_mode_select_big scsipi_cmd;
int error;
@ -1339,8 +1294,7 @@ scsipi_mode_select_big(periph, byte2, data, len, flags, retries, timeout)
* an xfer is completed.
*/
void
scsipi_done(xs)
struct scsipi_xfer *xs;
scsipi_done(struct scsipi_xfer *xs)
{
struct scsipi_periph *periph = xs->xs_periph;
struct scsipi_channel *chan = periph->periph_channel;
@ -1475,9 +1429,8 @@ scsipi_done(xs)
* - If there is a buf associated with the xfer,
* it has been biodone()'d.
*/
int
scsipi_complete(xs)
struct scsipi_xfer *xs;
static int
scsipi_complete(struct scsipi_xfer *xs)
{
struct scsipi_periph *periph = xs->xs_periph;
struct scsipi_channel *chan = periph->periph_channel;
@ -1709,9 +1662,8 @@ scsipi_complete(xs)
* context and at splbio().
*/
void
scsipi_request_sense(xs)
struct scsipi_xfer *xs;
static void
scsipi_request_sense(struct scsipi_xfer *xs)
{
struct scsipi_periph *periph = xs->xs_periph;
int flags, error;
@ -1769,9 +1721,8 @@ scsipi_request_sense(xs)
*
* Enqueue an xfer on a channel.
*/
int
scsipi_enqueue(xs)
struct scsipi_xfer *xs;
static int
scsipi_enqueue(struct scsipi_xfer *xs)
{
struct scsipi_channel *chan = xs->xs_periph->periph_channel;
struct scsipi_xfer *qxs;
@ -1835,9 +1786,8 @@ scsipi_enqueue(xs)
*
* Start as many xfers as possible running on the channel.
*/
void
scsipi_run_queue(chan)
struct scsipi_channel *chan;
static void
scsipi_run_queue(struct scsipi_channel *chan)
{
struct scsipi_xfer *xs;
struct scsipi_periph *periph;
@ -1949,8 +1899,7 @@ scsipi_run_queue(chan)
* Begin execution of an xfer, waiting for it to complete, if necessary.
*/
int
scsipi_execute_xs(xs)
struct scsipi_xfer *xs;
scsipi_execute_xs(struct scsipi_xfer *xs)
{
struct scsipi_periph *periph = xs->xs_periph;
struct scsipi_channel *chan = periph->periph_channel;
@ -2128,9 +2077,8 @@ scsipi_execute_xs(xs)
* asynchronous xfers, and perform the error handling
* function, restarting the command, if necessary.
*/
void
scsipi_completion_thread(arg)
void *arg;
static void
scsipi_completion_thread(void *arg)
{
struct scsipi_channel *chan = arg;
struct scsipi_xfer *xs;
@ -2212,8 +2160,7 @@ scsipi_completion_thread(arg)
* Callback to actually create the completion thread.
*/
void
scsipi_create_completion_thread(arg)
void *arg;
scsipi_create_completion_thread(void *arg)
{
struct scsipi_channel *chan = arg;
struct scsipi_adapter *adapt = chan->chan_adapter;
@ -2233,10 +2180,8 @@ scsipi_create_completion_thread(arg)
* request to call a callback from the completion thread
*/
int
scsipi_thread_call_callback(chan, callback, arg)
struct scsipi_channel *chan;
void (*callback) __P((struct scsipi_channel *, void *));
void *arg;
scsipi_thread_call_callback(struct scsipi_channel *chan,
void (*callback)(struct scsipi_channel *, void *), void *arg)
{
int s;
@ -2265,10 +2210,8 @@ scsipi_thread_call_callback(chan, callback, arg)
* Handle an asynchronous event from an adapter.
*/
void
scsipi_async_event(chan, event, arg)
struct scsipi_channel *chan;
scsipi_async_event_t event;
void *arg;
scsipi_async_event(struct scsipi_channel *chan, scsipi_async_event_t event,
void *arg)
{
int s;
@ -2296,8 +2239,7 @@ scsipi_async_event(chan, event, arg)
* Print a periph's capabilities.
*/
void
scsipi_print_xfer_mode(periph)
struct scsipi_periph *periph;
scsipi_print_xfer_mode(struct scsipi_periph *periph)
{
int period, freq, speed, mbs;
@ -2348,10 +2290,9 @@ scsipi_print_xfer_mode(periph)
* Update the maximum number of outstanding commands a
* device may have.
*/
void
scsipi_async_event_max_openings(chan, mo)
struct scsipi_channel *chan;
struct scsipi_max_openings *mo;
static void
scsipi_async_event_max_openings(struct scsipi_channel *chan,
struct scsipi_max_openings *mo)
{
struct scsipi_periph *periph;
int minlun, maxlun;
@ -2385,10 +2326,9 @@ scsipi_async_event_max_openings(chan, mo)
* Update the xfer mode for all periphs sharing the
* specified I_T Nexus.
*/
void
scsipi_async_event_xfer_mode(chan, xm)
struct scsipi_channel *chan;
struct scsipi_xfer_mode *xm;
static void
scsipi_async_event_xfer_mode(struct scsipi_channel *chan,
struct scsipi_xfer_mode *xm)
{
struct scsipi_periph *periph;
int lun, announce, mode, period, offset;
@ -2437,9 +2377,7 @@ scsipi_async_event_xfer_mode(chan, xm)
* Set the xfer mode for the specified I_T Nexus.
*/
void
scsipi_set_xfer_mode(chan, target, immed)
struct scsipi_channel *chan;
int target, immed;
scsipi_set_xfer_mode(struct scsipi_channel *chan, int target, int immed)
{
struct scsipi_xfer_mode xm;
struct scsipi_periph *itperiph;
@ -2489,9 +2427,8 @@ scsipi_set_xfer_mode(chan, target, immed)
* handle scsi bus reset
* called at splbio
*/
void
scsipi_async_event_channel_reset(chan)
struct scsipi_channel *chan;
static void
scsipi_async_event_channel_reset(struct scsipi_channel *chan)
{
struct scsipi_xfer *xs, *xs_next;
struct scsipi_periph *periph;
@ -2537,10 +2474,8 @@ scsipi_async_event_channel_reset(chan)
* must be called from valid thread context
*/
int
scsipi_target_detach(chan, target, lun, flags)
struct scsipi_channel *chan;
int target, lun;
int flags;
scsipi_target_detach(struct scsipi_channel *chan, int target, int lun,
int flags)
{
struct scsipi_periph *periph;
int ctarget, mintarget, maxtarget;
@ -2592,8 +2527,7 @@ scsipi_target_detach(chan, target, lun, flags)
* link, enabling the adapter if necessary.
*/
int
scsipi_adapter_addref(adapt)
struct scsipi_adapter *adapt;
scsipi_adapter_addref(struct scsipi_adapter *adapt)
{
int s, error = 0;
@ -2614,8 +2548,7 @@ scsipi_adapter_addref(adapt)
* link, disabling the adapter if possible.
*/
void
scsipi_adapter_delref(adapt)
struct scsipi_adapter *adapt;
scsipi_adapter_delref(struct scsipi_adapter *adapt)
{
int s;
@ -2625,7 +2558,7 @@ scsipi_adapter_delref(adapt)
splx(s);
}
struct scsipi_syncparam {
static struct scsipi_syncparam {
int ss_factor;
int ss_period; /* ns * 100 */
} scsipi_syncparams[] = {
@ -2635,12 +2568,11 @@ struct scsipi_syncparam {
{ 0x0b, 3030 }, /* FAST-40 33MHz (Ultra2) */
{ 0x0c, 5000 }, /* FAST-20 (Ultra) */
};
const int scsipi_nsyncparams =
static const int scsipi_nsyncparams =
sizeof(scsipi_syncparams) / sizeof(scsipi_syncparams[0]);
int
scsipi_sync_period_to_factor(period)
int period; /* ns * 100 */
scsipi_sync_period_to_factor(int period /* ns * 100 */)
{
int i;
@ -2653,8 +2585,7 @@ scsipi_sync_period_to_factor(period)
}
int
scsipi_sync_factor_to_period(factor)
int factor;
scsipi_sync_factor_to_period(int factor)
{
int i;
@ -2667,8 +2598,7 @@ scsipi_sync_factor_to_period(factor)
}
int
scsipi_sync_factor_to_freq(factor)
int factor;
scsipi_sync_factor_to_freq(int factor)
{
int i;
@ -2685,8 +2615,7 @@ scsipi_sync_factor_to_freq(factor)
* Given a scsipi_xfer, dump the request, in all it's glory
*/
void
show_scsipi_xs(xs)
struct scsipi_xfer *xs;
show_scsipi_xs(struct scsipi_xfer *xs)
{
printf("xs(%p): ", xs);
@ -2706,8 +2635,7 @@ show_scsipi_xs(xs)
}
void
show_scsipi_cmd(xs)
struct scsipi_xfer *xs;
show_scsipi_cmd(strict scsipi_xfer *xs)
{
u_char *b = (u_char *) xs->cmd;
int i = 0;
@ -2729,9 +2657,7 @@ show_scsipi_cmd(xs)
}
void
show_mem(address, num)
u_char *address;
int num;
show_mem(u_char *address, int num)
{
int x;

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsipi_ioctl.c,v 1.46 2003/06/29 22:30:41 fvdl Exp $ */
/* $NetBSD: scsipi_ioctl.c,v 1.47 2004/08/21 21:29:39 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scsipi_ioctl.c,v 1.46 2003/06/29 22:30:41 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: scsipi_ioctl.c,v 1.47 2004/08/21 21:29:39 thorpej Exp $");
#include "opt_compat_freebsd.h"
#include "opt_compat_netbsd.h"
@ -76,15 +76,10 @@ struct scsi_ioctl {
struct scsipi_periph *si_periph;
};
LIST_HEAD(, scsi_ioctl) si_head;
static LIST_HEAD(, scsi_ioctl) si_head;
struct scsi_ioctl *si_find __P((struct buf *));
void si_free __P((struct scsi_ioctl *));
struct scsi_ioctl *si_get __P((void));
void scsistrategy __P((struct buf *));
struct scsi_ioctl *
si_get()
static struct scsi_ioctl *
si_get(void)
{
struct scsi_ioctl *si;
int s;
@ -97,9 +92,8 @@ si_get()
return (si);
}
void
si_free(si)
struct scsi_ioctl *si;
static void
si_free(struct scsi_ioctl *si)
{
int s;
@ -109,9 +103,8 @@ si_free(si)
free(si, M_TEMP);
}
struct scsi_ioctl *
si_find(bp)
struct buf *bp;
static struct scsi_ioctl *
si_find(struct buf *bp)
{
struct scsi_ioctl *si;
int s;
@ -133,8 +126,7 @@ si_find(bp)
* the device's queue if such exists.
*/
void
scsipi_user_done(xs)
struct scsipi_xfer *xs;
scsipi_user_done(struct scsipi_xfer *xs)
{
struct buf *bp;
struct scsi_ioctl *si;
@ -235,9 +227,8 @@ scsipi_user_done(xs)
* from the cdevsw/bdevsw tables because they couldn't have added
* the screq structure. [JRE]
*/
void
scsistrategy(bp)
struct buf *bp;
static void
scsistrategy(struct buf *bp)
{
struct scsi_ioctl *si;
scsireq_t *screq;
@ -319,13 +310,8 @@ bad:
* still be running in the context of the calling process
*/
int
scsipi_do_ioctl(periph, dev, cmd, addr, flag, p)
struct scsipi_periph *periph;
dev_t dev;
u_long cmd;
caddr_t addr;
int flag;
struct proc *p;
scsipi_do_ioctl(struct scsipi_periph *periph, dev_t dev, u_long cmd,
caddr_t addr, int flag, struct proc *p)
{
int error;

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsipi_verbose.c,v 1.22 2004/04/23 21:52:17 itojun Exp $ */
/* $NetBSD: scsipi_verbose.c,v 1.23 2004/08/21 21:29:39 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scsipi_verbose.c,v 1.22 2004/04/23 21:52:17 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: scsipi_verbose.c,v 1.23 2004/08/21 21:29:39 thorpej Exp $");
#include <sys/param.h>
#include <sys/time.h>
@ -604,14 +604,8 @@ static const struct {
{ 0x00, 0x00, NULL }
};
static __inline void asc2ascii __P((unsigned char, unsigned char, char *,
size_t));
static __inline void
asc2ascii(asc, ascq, result, l)
unsigned char asc, ascq;
char *result;
size_t l;
static void
asc2ascii(u_char asc, u_char ascq, char *result, size_t l)
{
int i = 0;
@ -633,9 +627,7 @@ asc2ascii(asc, ascq, result, l)
}
void
scsipi_print_sense_data(sense, verbosity)
struct scsipi_sense_data *sense;
int verbosity;
scsipi_print_sense_data(struct scsipi_sense_data *sense, int verbosity)
{
int32_t info;
int i, j, k;
@ -752,9 +744,7 @@ scsipi_print_sense_data(sense, verbosity)
}
char *
scsipi_decode_sense(sinfo, flag)
void *sinfo;
int flag;
scsipi_decode_sense(void *sinfo, int flag)
{
unsigned char *snsbuf;
unsigned char skey;
@ -816,9 +806,7 @@ scsipi_decode_sense(sinfo, flag)
}
void
scsipi_print_sense(xs, verbosity)
struct scsipi_xfer *xs;
int verbosity;
scsipi_print_sense(struct scsipi_xfer *xs, int verbosity)
{
scsipi_printaddr(xs->xs_periph);
printf(" Check Condition on CDB: ");

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsipiconf.c,v 1.20 2003/01/18 12:05:39 martin Exp $ */
/* $NetBSD: scsipiconf.c,v 1.21 2004/08/21 21:29:39 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scsipiconf.c,v 1.20 2003/01/18 12:05:39 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: scsipiconf.c,v 1.21 2004/08/21 21:29:39 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -71,17 +71,9 @@ __KERNEL_RCSID(0, "$NetBSD: scsipiconf.c,v 1.20 2003/01/18 12:05:39 martin Exp $
#define STRVIS_ISWHITE(x) ((x) == ' ' || (x) == '\0' || (x) == (u_char)'\377')
int
scsipi_command(periph, cmd, cmdlen, data_addr, datalen, retries, timeout, bp,
flags)
struct scsipi_periph *periph;
struct scsipi_generic *cmd;
int cmdlen;
u_char *data_addr;
int datalen;
int retries;
int timeout;
struct buf *bp;
int flags;
scsipi_command(struct scsipi_periph *periph, struct scsipi_generic *cmd,
int cmdlen, u_char *data_addr, int datalen, int retries, int timeout,
struct buf *bp, int flags)
{
int error;
@ -104,8 +96,7 @@ scsipi_command(periph, cmd, cmdlen, data_addr, datalen, retries, timeout, bp,
* allocate and init a scsipi_periph structure for a new device.
*/
struct scsipi_periph *
scsipi_alloc_periph(malloc_flag)
int malloc_flag;
scsipi_alloc_periph(int malloc_flag)
{
struct scsipi_periph *periph;
u_int i;
@ -137,11 +128,8 @@ scsipi_alloc_periph(malloc_flag)
* the patterns for the particular driver.
*/
caddr_t
scsipi_inqmatch(inqbuf, base, nmatches, matchsize, bestpriority)
struct scsipi_inquiry_pattern *inqbuf;
caddr_t base;
int nmatches, matchsize;
int *bestpriority;
scsipi_inqmatch(struct scsipi_inquiry_pattern *inqbuf, caddr_t base,
int nmatches, int matchsize, int *bestpriority)
{
u_int8_t type;
caddr_t bestmatch;
@ -186,8 +174,7 @@ scsipi_inqmatch(inqbuf, base, nmatches, matchsize, bestpriority)
}
char *
scsipi_dtype(type)
int type;
scsipi_dtype(int type)
{
char *dtype;
@ -251,9 +238,7 @@ scsipi_dtype(type)
}
void
scsipi_strvis(dst, dlen, src, slen)
u_char *dst, *src;
int dlen, slen;
scsipi_strvis(u_char *dst, int dlen, u_char *src, int slen)
{
/* Trim leading and trailing blanks and NULs. */