Use ANSI function decls and make use of static.
This commit is contained in:
parent
dff05c2eff
commit
6cb9b7482f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: atapi_base.c,v 1.19 2004/03/10 21:57:31 bouyer Exp $ */
|
||||
/* $NetBSD: atapi_base.c,v 1.20 2004/08/21 17:40:25 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: atapi_base.c,v 1.19 2004/03/10 21:57:31 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: atapi_base.c,v 1.20 2004/08/21 17:40:25 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -62,8 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: atapi_base.c,v 1.19 2004/03/10 21:57:31 bouyer Exp $
|
|||
* THIS IS THE DEFAULT ERROR HANDLER
|
||||
*/
|
||||
int
|
||||
atapi_interpret_sense(xs)
|
||||
struct scsipi_xfer *xs;
|
||||
atapi_interpret_sense(struct scsipi_xfer *xs)
|
||||
{
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
int key, error;
|
||||
|
@ -196,8 +195,7 @@ atapi_interpret_sense(xs)
|
|||
* Print out the scsi_link structure's address info.
|
||||
*/
|
||||
void
|
||||
atapi_print_addr(periph)
|
||||
struct scsipi_periph *periph;
|
||||
atapi_print_addr(struct scsipi_periph *periph)
|
||||
{
|
||||
struct scsipi_channel *chan = periph->periph_channel;
|
||||
struct scsipi_adapter *adapt = chan->chan_adapter;
|
||||
|
@ -215,17 +213,9 @@ atapi_print_addr(periph)
|
|||
* to associate with the transfer, we need that too.
|
||||
*/
|
||||
int
|
||||
atapi_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;
|
||||
atapi_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;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: atapiconf.c,v 1.63 2003/10/17 00:19:46 mycroft Exp $ */
|
||||
/* $NetBSD: atapiconf.c,v 1.64 2004/08/21 17:40:25 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 2001 Manuel Bouyer. All rights reserved.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.63 2003/10/17 00:19:46 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.64 2004/08/21 17:40:25 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -56,23 +56,23 @@ const struct scsipi_periphsw atapi_probe_periphsw = {
|
|||
NULL,
|
||||
};
|
||||
|
||||
int atapibusmatch __P((struct device *, struct cfdata *, void *));
|
||||
void atapibusattach __P((struct device *, struct device *, void *));
|
||||
int atapibusactivate __P((struct device *, enum devact));
|
||||
int atapibusdetach __P((struct device *, int flags));
|
||||
static int atapibusmatch(struct device *, struct cfdata *, void *);
|
||||
static void atapibusattach(struct device *, struct device *, void *);
|
||||
static int atapibusactivate(struct device *, enum devact);
|
||||
static int atapibusdetach(struct device *, int flags);
|
||||
|
||||
int atapibussubmatch __P((struct device *, struct cfdata *, void *));
|
||||
static int atapibussubmatch(struct device *, struct cfdata *, void *);
|
||||
|
||||
int atapi_probe_bus __P((struct atapibus_softc *, int));
|
||||
static int atapi_probe_bus(struct atapibus_softc *, int);
|
||||
|
||||
static int atapibusprint(void *, const char *);
|
||||
|
||||
CFATTACH_DECL(atapibus, sizeof(struct atapibus_softc),
|
||||
atapibusmatch, atapibusattach, atapibusdetach, atapibusactivate);
|
||||
|
||||
extern struct cfdriver atapibus_cd;
|
||||
|
||||
int atapibusprint __P((void *, const char *));
|
||||
|
||||
const struct scsi_quirk_inquiry_pattern atapi_quirk_patterns[] = {
|
||||
static const struct scsi_quirk_inquiry_pattern atapi_quirk_patterns[] = {
|
||||
{{T_CDROM, T_REMOV,
|
||||
"ALPS ELECTRIC CO.,LTD. DC544C", "", "SW03D"}, PQUIRK_NOTUR},
|
||||
{{T_CDROM, T_REMOV,
|
||||
|
@ -106,20 +106,15 @@ const struct scsi_quirk_inquiry_pattern atapi_quirk_patterns[] = {
|
|||
};
|
||||
|
||||
int
|
||||
atapiprint(aux, pnp)
|
||||
void *aux;
|
||||
const char *pnp;
|
||||
atapiprint(void *aux, const char *pnp)
|
||||
{
|
||||
if (pnp)
|
||||
aprint_normal("atapibus at %s", pnp);
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
int
|
||||
atapibusmatch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
static int
|
||||
atapibusmatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct scsipi_channel *chan = aux;
|
||||
|
||||
|
@ -132,11 +127,8 @@ atapibusmatch(parent, cf, aux)
|
|||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
atapibussubmatch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
static int
|
||||
atapibussubmatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct scsipibus_attach_args *sa = aux;
|
||||
struct scsipi_periph *periph = sa->sa_periph;
|
||||
|
@ -147,10 +139,8 @@ atapibussubmatch(parent, cf, aux)
|
|||
return (config_match(parent, cf, aux));
|
||||
}
|
||||
|
||||
void
|
||||
atapibusattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
static void
|
||||
atapibusattach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct atapibus_softc *sc = (void *) self;
|
||||
struct scsipi_channel *chan = aux;
|
||||
|
@ -172,10 +162,8 @@ atapibusattach(parent, self, aux)
|
|||
atapi_probe_bus(sc, -1);
|
||||
}
|
||||
|
||||
int
|
||||
atapibusactivate(self, act)
|
||||
struct device *self;
|
||||
enum devact act;
|
||||
static int
|
||||
atapibusactivate(struct device *self, enum devact act)
|
||||
{
|
||||
struct atapibus_softc *sc = (void *) self;
|
||||
struct scsipi_channel *chan = sc->sc_channel;
|
||||
|
@ -204,10 +192,8 @@ atapibusactivate(self, act)
|
|||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
atapibusdetach(self, flags)
|
||||
struct device *self;
|
||||
int flags;
|
||||
static int
|
||||
atapibusdetach(struct device *self, int flags)
|
||||
{
|
||||
struct atapibus_softc *sc = (void *)self;
|
||||
struct scsipi_channel *chan = sc->sc_channel;
|
||||
|
@ -236,10 +222,8 @@ atapibusdetach(self, flags)
|
|||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
atapi_probe_bus(sc, target)
|
||||
struct atapibus_softc *sc;
|
||||
int target;
|
||||
static int
|
||||
atapi_probe_bus(struct atapibus_softc *sc, int target)
|
||||
{
|
||||
struct scsipi_channel *chan = sc->sc_channel;
|
||||
int maxtarget, mintarget;
|
||||
|
@ -265,11 +249,8 @@ atapi_probe_bus(sc, target)
|
|||
}
|
||||
|
||||
void *
|
||||
atapi_probe_device(sc, target, periph, sa)
|
||||
struct atapibus_softc *sc;
|
||||
int target;
|
||||
struct scsipi_periph *periph;
|
||||
struct scsipibus_attach_args *sa;
|
||||
atapi_probe_device(struct atapibus_softc *sc, int target,
|
||||
struct scsipi_periph *periph, struct scsipibus_attach_args *sa)
|
||||
{
|
||||
struct scsipi_channel *chan = sc->sc_channel;
|
||||
struct scsi_quirk_inquiry_pattern *finger;
|
||||
|
@ -310,10 +291,8 @@ atapi_probe_device(sc, target, periph, sa)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
atapibusprint(aux, pnp)
|
||||
void *aux;
|
||||
const char *pnp;
|
||||
static int
|
||||
atapibusprint(void *aux, const char *pnp)
|
||||
{
|
||||
struct scsipibus_attach_args *sa = aux;
|
||||
struct scsipi_inquiry_pattern *inqbuf;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cd.c,v 1.201 2004/04/24 09:26:14 pk Exp $ */
|
||||
/* $NetBSD: cd.c,v 1.202 2004/08/21 17:40:25 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2001, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -54,7 +54,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.201 2004/04/24 09:26:14 pk Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.202 2004/08/21 17:40:25 thorpej Exp $");
|
||||
|
||||
#include "rnd.h"
|
||||
|
||||
|
@ -106,60 +106,58 @@ struct cd_toc {
|
|||
/* leadout */
|
||||
};
|
||||
|
||||
int cdlock __P((struct cd_softc *));
|
||||
void cdunlock __P((struct cd_softc *));
|
||||
void cdstart __P((struct scsipi_periph *));
|
||||
void cdminphys __P((struct buf *));
|
||||
void cdgetdefaultlabel __P((struct cd_softc *, struct disklabel *));
|
||||
void cdgetdisklabel __P((struct cd_softc *));
|
||||
void cddone __P((struct scsipi_xfer *));
|
||||
void cdbounce __P((struct buf *));
|
||||
int cd_interpret_sense __P((struct scsipi_xfer *));
|
||||
u_long cd_size __P((struct cd_softc *, int));
|
||||
void lba2msf __P((u_long, u_char *, u_char *, u_char *));
|
||||
u_long msf2lba __P((u_char, u_char, u_char));
|
||||
int cd_play __P((struct cd_softc *, int, int));
|
||||
int cd_play_tracks __P((struct cd_softc *, int, int, int, int));
|
||||
int cd_play_msf __P((struct cd_softc *, int, int, int, int, int, int));
|
||||
int cd_pause __P((struct cd_softc *, int));
|
||||
int cd_reset __P((struct cd_softc *));
|
||||
int cd_read_subchannel __P((struct cd_softc *, int, int, int,
|
||||
struct cd_sub_channel_info *, int, int));
|
||||
int cd_read_toc __P((struct cd_softc *, int, int, void *, int, int, int));
|
||||
int cd_get_parms __P((struct cd_softc *, int));
|
||||
int cd_load_toc __P((struct cd_softc *, struct cd_toc *, int));
|
||||
int cdreadmsaddr __P((struct cd_softc *, int *));
|
||||
static int cdlock(struct cd_softc *);
|
||||
static void cdunlock(struct cd_softc *);
|
||||
static void cdstart(struct scsipi_periph *);
|
||||
static void cdminphys(struct buf *);
|
||||
static void cdgetdefaultlabel(struct cd_softc *, struct disklabel *);
|
||||
static void cdgetdisklabel(struct cd_softc *);
|
||||
static void cddone(struct scsipi_xfer *);
|
||||
static void cdbounce(struct buf *);
|
||||
static int cd_interpret_sense(struct scsipi_xfer *);
|
||||
static u_long cd_size(struct cd_softc *, int);
|
||||
static int cd_play(struct cd_softc *, int, int);
|
||||
static int cd_play_tracks(struct cd_softc *, int, int, int, int);
|
||||
static int cd_play_msf(struct cd_softc *, int, int, int, int, int, int);
|
||||
static int cd_pause(struct cd_softc *, int);
|
||||
static int cd_reset(struct cd_softc *);
|
||||
static int cd_read_subchannel(struct cd_softc *, int, int, int,
|
||||
struct cd_sub_channel_info *, int, int);
|
||||
static int cd_read_toc(struct cd_softc *, int, int, void *, int, int, int);
|
||||
static int cd_get_parms(struct cd_softc *, int);
|
||||
static int cd_load_toc(struct cd_softc *, struct cd_toc *, int);
|
||||
static int cdreadmsaddr(struct cd_softc *, int *);
|
||||
|
||||
int dvd_auth __P((struct cd_softc *, dvd_authinfo *));
|
||||
int dvd_read_physical __P((struct cd_softc *, dvd_struct *));
|
||||
int dvd_read_copyright __P((struct cd_softc *, dvd_struct *));
|
||||
int dvd_read_disckey __P((struct cd_softc *, dvd_struct *));
|
||||
int dvd_read_bca __P((struct cd_softc *, dvd_struct *));
|
||||
int dvd_read_manufact __P((struct cd_softc *, dvd_struct *));
|
||||
int dvd_read_struct __P((struct cd_softc *, dvd_struct *));
|
||||
static int dvd_auth(struct cd_softc *, dvd_authinfo *);
|
||||
static int dvd_read_physical(struct cd_softc *, dvd_struct *);
|
||||
static int dvd_read_copyright(struct cd_softc *, dvd_struct *);
|
||||
static int dvd_read_disckey(struct cd_softc *, dvd_struct *);
|
||||
static int dvd_read_bca(struct cd_softc *, dvd_struct *);
|
||||
static int dvd_read_manufact(struct cd_softc *, dvd_struct *);
|
||||
static int dvd_read_struct(struct cd_softc *, dvd_struct *);
|
||||
|
||||
static int cd_mode_sense __P((struct cd_softc *, u_int8_t, void *, size_t, int,
|
||||
int, int *));
|
||||
static int cd_mode_select __P((struct cd_softc *, u_int8_t, void *, size_t,
|
||||
int, int));
|
||||
int cd_setchan __P((struct cd_softc *, int, int, int, int, int));
|
||||
int cd_getvol __P((struct cd_softc *, struct ioc_vol *, int));
|
||||
int cd_setvol __P((struct cd_softc *, const struct ioc_vol *, int));
|
||||
int cd_set_pa_immed __P((struct cd_softc *, int));
|
||||
int cd_load_unload __P((struct cd_softc *, struct ioc_load_unload *));
|
||||
int cd_setblksize __P((struct cd_softc *));
|
||||
static int cd_mode_sense(struct cd_softc *, u_int8_t, void *, size_t, int,
|
||||
int, int *);
|
||||
static int cd_mode_select(struct cd_softc *, u_int8_t, void *, size_t,
|
||||
int, int);
|
||||
static int cd_setchan(struct cd_softc *, int, int, int, int, int);
|
||||
static int cd_getvol(struct cd_softc *, struct ioc_vol *, int);
|
||||
static int cd_setvol(struct cd_softc *, const struct ioc_vol *, int);
|
||||
static int cd_set_pa_immed(struct cd_softc *, int);
|
||||
static int cd_load_unload(struct cd_softc *, struct ioc_load_unload *);
|
||||
static int cd_setblksize(struct cd_softc *);
|
||||
|
||||
int cdmatch __P((struct device *, struct cfdata *, void *));
|
||||
void cdattach __P((struct device *, struct device *, void *));
|
||||
int cdactivate __P((struct device *, enum devact));
|
||||
int cddetach __P((struct device *, int));
|
||||
static int cdmatch(struct device *, struct cfdata *, void *);
|
||||
static void cdattach(struct device *, struct device *, void *);
|
||||
static int cdactivate(struct device *, enum devact);
|
||||
static int cddetach(struct device *, int);
|
||||
|
||||
CFATTACH_DECL(cd, sizeof(struct cd_softc), cdmatch, cdattach, cddetach,
|
||||
cdactivate);
|
||||
|
||||
extern struct cfdriver cd_cd;
|
||||
|
||||
const struct scsipi_inquiry_pattern cd_patterns[] = {
|
||||
static const struct scsipi_inquiry_pattern cd_patterns[] = {
|
||||
{T_CDROM, T_REMOV,
|
||||
"", "", ""},
|
||||
{T_WORM, T_REMOV,
|
||||
|
@ -172,14 +170,14 @@ const struct scsipi_inquiry_pattern cd_patterns[] = {
|
|||
"NEC CD-ROM DRIVE:260", "", ""},
|
||||
};
|
||||
|
||||
dev_type_open(cdopen);
|
||||
dev_type_close(cdclose);
|
||||
dev_type_read(cdread);
|
||||
dev_type_write(cdwrite);
|
||||
dev_type_ioctl(cdioctl);
|
||||
dev_type_strategy(cdstrategy);
|
||||
dev_type_dump(cddump);
|
||||
dev_type_size(cdsize);
|
||||
static dev_type_open(cdopen);
|
||||
static dev_type_close(cdclose);
|
||||
static dev_type_read(cdread);
|
||||
static dev_type_write(cdwrite);
|
||||
static dev_type_ioctl(cdioctl);
|
||||
static dev_type_strategy(cdstrategy);
|
||||
static dev_type_dump(cddump);
|
||||
static dev_type_size(cdsize);
|
||||
|
||||
const struct bdevsw cd_bdevsw = {
|
||||
cdopen, cdclose, cdstrategy, cdioctl, cddump, cdsize, D_DISK
|
||||
|
@ -190,9 +188,9 @@ const struct cdevsw cd_cdevsw = {
|
|||
nostop, notty, nopoll, nommap, nokqfilter, D_DISK
|
||||
};
|
||||
|
||||
struct dkdriver cddkdriver = { cdstrategy };
|
||||
static struct dkdriver cddkdriver = { cdstrategy };
|
||||
|
||||
const struct scsipi_periphsw cd_switch = {
|
||||
static const struct scsipi_periphsw cd_switch = {
|
||||
cd_interpret_sense, /* use our error handler first */
|
||||
cdstart, /* we have a queue, which is started by this */
|
||||
NULL, /* we do not have an async handler */
|
||||
|
@ -203,11 +201,8 @@ const struct scsipi_periphsw cd_switch = {
|
|||
* The routine called by the low level scsi routine when it discovers
|
||||
* A device suitable for this driver
|
||||
*/
|
||||
int
|
||||
cdmatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
static int
|
||||
cdmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct scsipibus_attach_args *sa = aux;
|
||||
int priority;
|
||||
|
@ -219,10 +214,8 @@ cdmatch(parent, match, aux)
|
|||
return (priority);
|
||||
}
|
||||
|
||||
void
|
||||
cdattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
static void
|
||||
cdattach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct cd_softc *cd = (void *)self;
|
||||
struct scsipibus_attach_args *sa = aux;
|
||||
|
@ -268,10 +261,8 @@ cdattach(parent, self, aux)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
cdactivate(self, act)
|
||||
struct device *self;
|
||||
enum devact act;
|
||||
static int
|
||||
cdactivate(struct device *self, enum devact act)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
|
@ -289,10 +280,8 @@ cdactivate(self, act)
|
|||
return (rv);
|
||||
}
|
||||
|
||||
int
|
||||
cddetach(self, flags)
|
||||
struct device *self;
|
||||
int flags;
|
||||
static int
|
||||
cddetach(struct device *self, int flags)
|
||||
{
|
||||
struct cd_softc *cd = (struct cd_softc *) self;
|
||||
struct buf *bp;
|
||||
|
@ -349,9 +338,8 @@ cddetach(self, flags)
|
|||
* XXX
|
||||
* Several drivers do this; it should be abstracted and made MP-safe.
|
||||
*/
|
||||
int
|
||||
cdlock(cd)
|
||||
struct cd_softc *cd;
|
||||
static int
|
||||
cdlock(struct cd_softc *cd)
|
||||
{
|
||||
int error;
|
||||
|
||||
|
@ -367,9 +355,8 @@ cdlock(cd)
|
|||
/*
|
||||
* Unlock and wake up any waiters.
|
||||
*/
|
||||
void
|
||||
cdunlock(cd)
|
||||
struct cd_softc *cd;
|
||||
static void
|
||||
cdunlock(struct cd_softc *cd)
|
||||
{
|
||||
|
||||
cd->flags &= ~CDF_LOCKED;
|
||||
|
@ -382,11 +369,8 @@ cdunlock(cd)
|
|||
/*
|
||||
* open the device. Make sure the partition info is a up-to-date as can be.
|
||||
*/
|
||||
int
|
||||
cdopen(dev, flag, fmt, p)
|
||||
dev_t dev;
|
||||
int flag, fmt;
|
||||
struct proc *p;
|
||||
static int
|
||||
cdopen(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
{
|
||||
struct cd_softc *cd;
|
||||
struct scsipi_periph *periph;
|
||||
|
@ -542,11 +526,8 @@ bad4:
|
|||
* close the device.. only called if we are the LAST
|
||||
* occurence of an open device
|
||||
*/
|
||||
int
|
||||
cdclose(dev, flag, fmt, p)
|
||||
dev_t dev;
|
||||
int flag, fmt;
|
||||
struct proc *p;
|
||||
static int
|
||||
cdclose(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
{
|
||||
struct cd_softc *cd = cd_cd.cd_devs[CDUNIT(dev)];
|
||||
struct scsipi_periph *periph = cd->sc_periph;
|
||||
|
@ -590,9 +571,8 @@ cdclose(dev, flag, fmt, p)
|
|||
* understand. The transfer is described by a buf and will include only one
|
||||
* physical transfer.
|
||||
*/
|
||||
void
|
||||
cdstrategy(bp)
|
||||
struct buf *bp;
|
||||
static void
|
||||
cdstrategy(struct buf *bp)
|
||||
{
|
||||
struct cd_softc *cd = cd_cd.cd_devs[CDUNIT(bp->b_dev)];
|
||||
struct disklabel *lp;
|
||||
|
@ -778,9 +758,8 @@ done:
|
|||
* must be called at the correct (highish) spl level
|
||||
* cdstart() is called at splbio from cdstrategy and scsipi_done
|
||||
*/
|
||||
void
|
||||
cdstart(periph)
|
||||
struct scsipi_periph *periph;
|
||||
static void
|
||||
cdstart(struct scsipi_periph *periph)
|
||||
{
|
||||
struct cd_softc *cd = (void *)periph->periph_dev;
|
||||
struct buf *bp = 0;
|
||||
|
@ -887,9 +866,8 @@ cdstart(periph)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
cddone(xs)
|
||||
struct scsipi_xfer *xs;
|
||||
static void
|
||||
cddone(struct scsipi_xfer *xs)
|
||||
{
|
||||
struct cd_softc *cd = (void *)xs->xs_periph->periph_dev;
|
||||
|
||||
|
@ -902,9 +880,8 @@ cddone(xs)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
cdbounce(bp)
|
||||
struct buf *bp;
|
||||
static void
|
||||
cdbounce(struct buf *bp)
|
||||
{
|
||||
struct buf *obp = (struct buf *)bp->b_private;
|
||||
|
||||
|
@ -990,8 +967,8 @@ done:
|
|||
biodone(obp);
|
||||
}
|
||||
|
||||
int cd_interpret_sense(xs)
|
||||
struct scsipi_xfer *xs;
|
||||
static int
|
||||
cd_interpret_sense(struct scsipi_xfer *xs)
|
||||
{
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
struct scsipi_sense_data *sense = &xs->sense.scsi_sense;
|
||||
|
@ -1030,9 +1007,8 @@ int cd_interpret_sense(xs)
|
|||
return (retval);
|
||||
}
|
||||
|
||||
void
|
||||
cdminphys(bp)
|
||||
struct buf *bp;
|
||||
static void
|
||||
cdminphys(struct buf *bp)
|
||||
{
|
||||
struct cd_softc *cd = cd_cd.cd_devs[CDUNIT(bp->b_dev)];
|
||||
long max;
|
||||
|
@ -1058,34 +1034,27 @@ cdminphys(bp)
|
|||
(*cd->sc_periph->periph_channel->chan_adapter->adapt_minphys)(bp);
|
||||
}
|
||||
|
||||
int
|
||||
cdread(dev, uio, ioflag)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int ioflag;
|
||||
static int
|
||||
cdread(dev_t dev, struct uio *uio, int ioflag)
|
||||
{
|
||||
|
||||
return (physio(cdstrategy, NULL, dev, B_READ, cdminphys, uio));
|
||||
}
|
||||
|
||||
int
|
||||
cdwrite(dev, uio, ioflag)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int ioflag;
|
||||
static int
|
||||
cdwrite(dev_t dev, struct uio *uio, int ioflag)
|
||||
{
|
||||
|
||||
return (physio(cdstrategy, NULL, dev, B_WRITE, cdminphys, uio));
|
||||
}
|
||||
|
||||
#if 0 /* XXX Not used */
|
||||
/*
|
||||
* conversion between minute-seconde-frame and logical block address
|
||||
* addresses format
|
||||
*/
|
||||
void
|
||||
lba2msf (lba, m, s, f)
|
||||
u_long lba;
|
||||
u_char *m, *s, *f;
|
||||
static void
|
||||
lba2msf(u_long lba, u_char *m, u_char *s, u_char *f)
|
||||
{
|
||||
u_long tmp;
|
||||
|
||||
|
@ -1097,18 +1066,16 @@ lba2msf (lba, m, s, f)
|
|||
*f = tmp % CD_FRAMES;
|
||||
}
|
||||
|
||||
u_long
|
||||
msf2lba (m, s, f)
|
||||
u_char m, s, f;
|
||||
static u_long
|
||||
msf2lba(u_char m, u_char s, u_char f)
|
||||
{
|
||||
|
||||
return ((((m * CD_SECS) + s) * CD_FRAMES + f) - CD_BLOCK_OFFSET);
|
||||
}
|
||||
#endif /* XXX Not used */
|
||||
|
||||
int
|
||||
cdreadmsaddr(cd, addr)
|
||||
struct cd_softc *cd;
|
||||
int *addr;
|
||||
static int
|
||||
cdreadmsaddr(struct cd_softc *cd, int *addr)
|
||||
{
|
||||
struct scsipi_periph *periph = cd->sc_periph;
|
||||
int error;
|
||||
|
@ -1141,13 +1108,8 @@ cdreadmsaddr(cd, addr)
|
|||
* Perform special action on behalf of the user.
|
||||
* Knows about the internals of this device
|
||||
*/
|
||||
int
|
||||
cdioctl(dev, cmd, addr, flag, p)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
caddr_t addr;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
static int
|
||||
cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
|
||||
{
|
||||
struct cd_softc *cd = cd_cd.cd_devs[CDUNIT(dev)];
|
||||
struct scsipi_periph *periph = cd->sc_periph;
|
||||
|
@ -1495,10 +1457,8 @@ bad:
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
cdgetdefaultlabel(cd, lp)
|
||||
struct cd_softc *cd;
|
||||
struct disklabel *lp;
|
||||
static void
|
||||
cdgetdefaultlabel(struct cd_softc *cd, struct disklabel *lp)
|
||||
{
|
||||
int lastsession;
|
||||
|
||||
|
@ -1564,9 +1524,8 @@ cdgetdefaultlabel(cd, lp)
|
|||
* EVENTUALLY take information about different
|
||||
* data tracks from the TOC and put it in the disklabel
|
||||
*/
|
||||
void
|
||||
cdgetdisklabel(cd)
|
||||
struct cd_softc *cd;
|
||||
static void
|
||||
cdgetdisklabel(struct cd_softc *cd)
|
||||
{
|
||||
struct disklabel *lp = cd->sc_dk.dk_label;
|
||||
const char *errstring;
|
||||
|
@ -1596,10 +1555,8 @@ error:
|
|||
/*
|
||||
* Find out from the device what it's capacity is
|
||||
*/
|
||||
u_long
|
||||
cd_size(cd, flags)
|
||||
struct cd_softc *cd;
|
||||
int flags;
|
||||
static u_long
|
||||
cd_size(struct cd_softc *cd, int flags)
|
||||
{
|
||||
struct scsipi_read_cd_cap_data rdcap;
|
||||
struct scsipi_read_cd_capacity scsipi_cmd;
|
||||
|
@ -1657,10 +1614,8 @@ cd_size(cd, flags)
|
|||
/*
|
||||
* Get scsi driver to send a "start playing" command
|
||||
*/
|
||||
int
|
||||
cd_play(cd, blkno, nblks)
|
||||
struct cd_softc *cd;
|
||||
int blkno, nblks;
|
||||
static int
|
||||
cd_play(struct cd_softc *cd, int blkno, int nblks)
|
||||
{
|
||||
struct scsipi_play scsipi_cmd;
|
||||
|
||||
|
@ -1676,10 +1631,9 @@ cd_play(cd, blkno, nblks)
|
|||
/*
|
||||
* Get scsi driver to send a "start playing" command
|
||||
*/
|
||||
int
|
||||
cd_play_tracks(cd, strack, sindex, etrack, eindex)
|
||||
struct cd_softc *cd;
|
||||
int strack, sindex, etrack, eindex;
|
||||
static int
|
||||
cd_play_tracks(struct cd_softc *cd, int strack, int sindex, int etrack,
|
||||
int eindex)
|
||||
{
|
||||
struct cd_toc toc;
|
||||
int error;
|
||||
|
@ -1711,10 +1665,9 @@ cd_play_tracks(cd, strack, sindex, etrack, eindex)
|
|||
/*
|
||||
* Get scsi driver to send a "play msf" command
|
||||
*/
|
||||
int
|
||||
cd_play_msf(cd, startm, starts, startf, endm, ends, endf)
|
||||
struct cd_softc *cd;
|
||||
int startm, starts, startf, endm, ends, endf;
|
||||
static int
|
||||
cd_play_msf(struct cd_softc *cd, int startm, int starts, int startf, int endm,
|
||||
int ends, int endf)
|
||||
{
|
||||
struct scsipi_play_msf scsipi_cmd;
|
||||
|
||||
|
@ -1734,10 +1687,8 @@ cd_play_msf(cd, startm, starts, startf, endm, ends, endf)
|
|||
/*
|
||||
* Get scsi driver to send a "start up" command
|
||||
*/
|
||||
int
|
||||
cd_pause(cd, go)
|
||||
struct cd_softc *cd;
|
||||
int go;
|
||||
static int
|
||||
cd_pause(struct cd_softc *cd, int go)
|
||||
{
|
||||
struct scsipi_pause scsipi_cmd;
|
||||
|
||||
|
@ -1752,9 +1703,8 @@ cd_pause(cd, go)
|
|||
/*
|
||||
* Get scsi driver to send a "RESET" command
|
||||
*/
|
||||
int
|
||||
cd_reset(cd)
|
||||
struct cd_softc *cd;
|
||||
static int
|
||||
cd_reset(struct cd_softc *cd)
|
||||
{
|
||||
|
||||
return (scsipi_command(cd->sc_periph, 0, 0, 0, 0,
|
||||
|
@ -1764,12 +1714,9 @@ cd_reset(cd)
|
|||
/*
|
||||
* Read subchannel
|
||||
*/
|
||||
int
|
||||
cd_read_subchannel(cd, mode, format, track, data, len, flags)
|
||||
struct cd_softc *cd;
|
||||
int mode, format, track, len;
|
||||
struct cd_sub_channel_info *data;
|
||||
int flags;
|
||||
static int
|
||||
cd_read_subchannel(struct cd_softc *cd, int mode, int format, int track,
|
||||
struct cd_sub_channel_info *data, int len, int flags)
|
||||
{
|
||||
struct scsipi_read_subchannel scsipi_cmd;
|
||||
|
||||
|
@ -1790,12 +1737,9 @@ cd_read_subchannel(cd, mode, format, track, data, len, flags)
|
|||
/*
|
||||
* Read table of contents
|
||||
*/
|
||||
int
|
||||
cd_read_toc(cd, mode, start, data, len, flags, control)
|
||||
struct cd_softc *cd;
|
||||
int mode, start, len, control;
|
||||
void *data;
|
||||
int flags;
|
||||
static int
|
||||
cd_read_toc(struct cd_softc *cd, int mode, int start, void *data, int len,
|
||||
int flags, int control)
|
||||
{
|
||||
struct scsipi_read_toc scsipi_cmd;
|
||||
int ntoc;
|
||||
|
@ -1820,11 +1764,8 @@ cd_read_toc(cd, mode, start, data, len, flags, control)
|
|||
30000, NULL, flags | XS_CTL_DATA_IN));
|
||||
}
|
||||
|
||||
int
|
||||
cd_load_toc(cd, toc, flags)
|
||||
struct cd_softc *cd;
|
||||
struct cd_toc *toc;
|
||||
int flags;
|
||||
static int
|
||||
cd_load_toc(struct cd_softc *cd, struct cd_toc *toc, int flags)
|
||||
{
|
||||
int ntracks, len, error;
|
||||
|
||||
|
@ -1845,10 +1786,8 @@ cd_load_toc(cd, toc, flags)
|
|||
* Get the scsi driver to send a full inquiry to the device and use the
|
||||
* results to fill out the disk parameter structure.
|
||||
*/
|
||||
int
|
||||
cd_get_parms(cd, flags)
|
||||
struct cd_softc *cd;
|
||||
int flags;
|
||||
static int
|
||||
cd_get_parms(struct cd_softc *cd, int flags)
|
||||
{
|
||||
|
||||
/*
|
||||
|
@ -1860,21 +1799,16 @@ cd_get_parms(cd, flags)
|
|||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
cdsize(dev)
|
||||
dev_t dev;
|
||||
static int
|
||||
cdsize(dev_t dev)
|
||||
{
|
||||
|
||||
/* CD-ROMs are read-only. */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
int
|
||||
cddump(dev, blkno, va, size)
|
||||
dev_t dev;
|
||||
daddr_t blkno;
|
||||
caddr_t va;
|
||||
size_t size;
|
||||
static int
|
||||
cddump(dev_t dev, daddr_t blkno, caddr_t va, size_t size)
|
||||
{
|
||||
|
||||
/* Not implemented. */
|
||||
|
@ -1884,10 +1818,8 @@ cddump(dev, blkno, va, size)
|
|||
#define dvd_copy_key(dst, src) memcpy((dst), (src), sizeof(dvd_key))
|
||||
#define dvd_copy_challenge(dst, src) memcpy((dst), (src), sizeof(dvd_challenge))
|
||||
|
||||
int
|
||||
dvd_auth(cd, a)
|
||||
struct cd_softc *cd;
|
||||
dvd_authinfo *a;
|
||||
static int
|
||||
dvd_auth(struct cd_softc *cd, dvd_authinfo *a)
|
||||
{
|
||||
struct scsipi_generic cmd;
|
||||
u_int8_t buf[20];
|
||||
|
@ -2034,10 +1966,8 @@ dvd_auth(cd, a)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
dvd_read_physical(cd, s)
|
||||
struct cd_softc *cd;
|
||||
dvd_struct *s;
|
||||
static int
|
||||
dvd_read_physical(struct cd_softc *cd, dvd_struct *s)
|
||||
{
|
||||
struct scsipi_generic cmd;
|
||||
u_int8_t buf[4 + 4 * 20], *bufp;
|
||||
|
@ -2076,10 +2006,8 @@ dvd_read_physical(cd, s)
|
|||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
dvd_read_copyright(cd, s)
|
||||
struct cd_softc *cd;
|
||||
dvd_struct *s;
|
||||
static int
|
||||
dvd_read_copyright(struct cd_softc *cd, dvd_struct *s)
|
||||
{
|
||||
struct scsipi_generic cmd;
|
||||
u_int8_t buf[8];
|
||||
|
@ -2101,10 +2029,8 @@ dvd_read_copyright(cd, s)
|
|||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
dvd_read_disckey(cd, s)
|
||||
struct cd_softc *cd;
|
||||
dvd_struct *s;
|
||||
static int
|
||||
dvd_read_disckey(struct cd_softc *cd, dvd_struct *s)
|
||||
{
|
||||
struct scsipi_generic cmd;
|
||||
u_int8_t *buf;
|
||||
|
@ -2127,10 +2053,8 @@ dvd_read_disckey(cd, s)
|
|||
return error;
|
||||
}
|
||||
|
||||
int
|
||||
dvd_read_bca(cd, s)
|
||||
struct cd_softc *cd;
|
||||
dvd_struct *s;
|
||||
static int
|
||||
dvd_read_bca(struct cd_softc *cd, dvd_struct *s)
|
||||
{
|
||||
struct scsipi_generic cmd;
|
||||
u_int8_t buf[4 + 188];
|
||||
|
@ -2153,10 +2077,8 @@ dvd_read_bca(cd, s)
|
|||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
dvd_read_manufact(cd, s)
|
||||
struct cd_softc *cd;
|
||||
dvd_struct *s;
|
||||
static int
|
||||
dvd_read_manufact(struct cd_softc *cd, dvd_struct *s)
|
||||
{
|
||||
struct scsipi_generic cmd;
|
||||
u_int8_t *buf;
|
||||
|
@ -2183,10 +2105,8 @@ dvd_read_manufact(cd, s)
|
|||
return error;
|
||||
}
|
||||
|
||||
int
|
||||
dvd_read_struct(cd, s)
|
||||
struct cd_softc *cd;
|
||||
dvd_struct *s;
|
||||
static int
|
||||
dvd_read_struct(struct cd_softc *cd, dvd_struct *s)
|
||||
{
|
||||
|
||||
switch (s->type) {
|
||||
|
@ -2206,13 +2126,8 @@ dvd_read_struct(cd, s)
|
|||
}
|
||||
|
||||
static int
|
||||
cd_mode_sense(cd, byte2, sense, size, page, flags, big)
|
||||
struct cd_softc *cd;
|
||||
u_int8_t byte2;
|
||||
void *sense;
|
||||
size_t size;
|
||||
int page, flags;
|
||||
int *big;
|
||||
cd_mode_sense(struct cd_softc *cd, u_int8_t byte2, void *sense, size_t size,
|
||||
int page, int flags, int *big)
|
||||
{
|
||||
|
||||
if (cd->sc_periph->periph_quirks & PQUIRK_ONLYBIG) {
|
||||
|
@ -2229,12 +2144,8 @@ cd_mode_sense(cd, byte2, sense, size, page, flags, big)
|
|||
}
|
||||
|
||||
static int
|
||||
cd_mode_select(cd, byte2, sense, size, flags, big)
|
||||
struct cd_softc *cd;
|
||||
u_int8_t byte2;
|
||||
void *sense;
|
||||
size_t size;
|
||||
int flags, big;
|
||||
cd_mode_select(struct cd_softc *cd, u_int8_t byte2, void *sense, size_t size,
|
||||
int flags, int big)
|
||||
{
|
||||
|
||||
if (big) {
|
||||
|
@ -2254,10 +2165,8 @@ cd_mode_select(cd, byte2, sense, size, flags, big)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
cd_set_pa_immed(cd, flags)
|
||||
struct cd_softc *cd;
|
||||
int flags;
|
||||
static int
|
||||
cd_set_pa_immed(struct cd_softc *cd, int flags)
|
||||
{
|
||||
struct {
|
||||
union {
|
||||
|
@ -2303,11 +2212,8 @@ try_again:
|
|||
flags, big));
|
||||
}
|
||||
|
||||
int
|
||||
cd_setchan(cd, p0, p1, p2, p3, flags)
|
||||
struct cd_softc *cd;
|
||||
int p0, p1, p2, p3;
|
||||
int flags;
|
||||
static int
|
||||
cd_setchan(struct cd_softc *cd, int p0, int p1, int p2, int p3, int flags)
|
||||
{
|
||||
struct {
|
||||
union {
|
||||
|
@ -2351,11 +2257,8 @@ try_again:
|
|||
flags, big));
|
||||
}
|
||||
|
||||
int
|
||||
cd_getvol(cd, arg, flags)
|
||||
struct cd_softc *cd;
|
||||
struct ioc_vol *arg;
|
||||
int flags;
|
||||
static int
|
||||
cd_getvol(struct cd_softc *cd, struct ioc_vol *arg, int flags)
|
||||
{
|
||||
struct {
|
||||
union {
|
||||
|
@ -2397,11 +2300,8 @@ try_again:
|
|||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
cd_setvol(cd, arg, flags)
|
||||
struct cd_softc *cd;
|
||||
const struct ioc_vol *arg;
|
||||
int flags;
|
||||
static int
|
||||
cd_setvol(struct cd_softc *cd, const struct ioc_vol *arg, int flags)
|
||||
{
|
||||
struct {
|
||||
union {
|
||||
|
@ -2458,10 +2358,8 @@ try_again:
|
|||
flags, big));
|
||||
}
|
||||
|
||||
int
|
||||
cd_load_unload(cd, args)
|
||||
struct cd_softc *cd;
|
||||
struct ioc_load_unload *args;
|
||||
static int
|
||||
cd_load_unload(struct cd_softc *cd, struct ioc_load_unload *args)
|
||||
{
|
||||
struct scsipi_load_unload scsipi_cmd;
|
||||
|
||||
|
@ -2475,9 +2373,8 @@ cd_load_unload(cd, args)
|
|||
0, 0, CDRETRIES, 200000, NULL, 0));
|
||||
}
|
||||
|
||||
int
|
||||
cd_setblksize(cd)
|
||||
struct cd_softc *cd;
|
||||
static int
|
||||
cd_setblksize(struct cd_softc *cd)
|
||||
{
|
||||
struct {
|
||||
union {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ch.c,v 1.60 2004/06/23 23:44:58 seb Exp $ */
|
||||
/* $NetBSD: ch.c,v 1.61 2004/08/21 17:40:25 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ch.c,v 1.60 2004/06/23 23:44:58 seb Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ch.c,v 1.61 2004/08/21 17:40:25 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -106,25 +106,25 @@ struct ch_softc {
|
|||
#define CHF_ROTATE 0x01 /* picker can rotate */
|
||||
|
||||
/* Autoconfiguration glue */
|
||||
int chmatch __P((struct device *, struct cfdata *, void *));
|
||||
void chattach __P((struct device *, struct device *, void *));
|
||||
static int chmatch(struct device *, struct cfdata *, void *);
|
||||
static void chattach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(ch, sizeof(struct ch_softc),
|
||||
chmatch, chattach, NULL, NULL);
|
||||
|
||||
extern struct cfdriver ch_cd;
|
||||
|
||||
struct scsipi_inquiry_pattern ch_patterns[] = {
|
||||
static struct scsipi_inquiry_pattern ch_patterns[] = {
|
||||
{T_CHANGER, T_REMOV,
|
||||
"", "", ""},
|
||||
};
|
||||
|
||||
dev_type_open(chopen);
|
||||
dev_type_close(chclose);
|
||||
dev_type_read(chread);
|
||||
dev_type_ioctl(chioctl);
|
||||
dev_type_poll(chpoll);
|
||||
dev_type_kqfilter(chkqfilter);
|
||||
static dev_type_open(chopen);
|
||||
static dev_type_close(chclose);
|
||||
static dev_type_read(chread);
|
||||
static dev_type_ioctl(chioctl);
|
||||
static dev_type_poll(chpoll);
|
||||
static dev_type_kqfilter(chkqfilter);
|
||||
|
||||
const struct cdevsw ch_cdevsw = {
|
||||
chopen, chclose, chread, nowrite, chioctl,
|
||||
|
@ -132,36 +132,38 @@ const struct cdevsw ch_cdevsw = {
|
|||
};
|
||||
|
||||
/* SCSI glue */
|
||||
int ch_interpret_sense __P((struct scsipi_xfer *));
|
||||
static int ch_interpret_sense(struct scsipi_xfer *);
|
||||
|
||||
const struct scsipi_periphsw ch_switch = {
|
||||
static const struct scsipi_periphsw ch_switch = {
|
||||
ch_interpret_sense, /* check our error handler first */
|
||||
NULL, /* no queue; our commands are synchronous */
|
||||
NULL, /* have no async handler */
|
||||
NULL, /* nothing to be done when xfer is done */
|
||||
};
|
||||
|
||||
int ch_move __P((struct ch_softc *, struct changer_move_request *));
|
||||
int ch_exchange __P((struct ch_softc *, struct changer_exchange_request *));
|
||||
int ch_position __P((struct ch_softc *, struct changer_position_request *));
|
||||
int ch_ielem __P((struct ch_softc *));
|
||||
int ch_ousergetelemstatus __P((struct ch_softc *, int, u_int8_t *));
|
||||
int ch_usergetelemstatus __P((struct ch_softc *,
|
||||
struct changer_element_status_request *));
|
||||
int ch_getelemstatus __P((struct ch_softc *, int, int, void *,
|
||||
size_t, int, int));
|
||||
int ch_setvoltag __P((struct ch_softc *,
|
||||
struct changer_set_voltag_request *));
|
||||
int ch_get_params __P((struct ch_softc *, int));
|
||||
void ch_get_quirks __P((struct ch_softc *,
|
||||
struct scsipi_inquiry_pattern *));
|
||||
void ch_event __P((struct ch_softc *, u_int));
|
||||
int ch_map_element __P((struct ch_softc *, u_int16_t, int *, int *));
|
||||
static int ch_move(struct ch_softc *, struct changer_move_request *);
|
||||
static int ch_exchange(struct ch_softc *,
|
||||
struct changer_exchange_request *);
|
||||
static int ch_position(struct ch_softc *,
|
||||
struct changer_position_request *);
|
||||
static int ch_ielem(struct ch_softc *);
|
||||
static int ch_ousergetelemstatus(struct ch_softc *, int, u_int8_t *);
|
||||
static int ch_usergetelemstatus(struct ch_softc *,
|
||||
struct changer_element_status_request *);
|
||||
static int ch_getelemstatus(struct ch_softc *, int, int, void *,
|
||||
size_t, int, int);
|
||||
static int ch_setvoltag(struct ch_softc *,
|
||||
struct changer_set_voltag_request *);
|
||||
static int ch_get_params(struct ch_softc *, int);
|
||||
static void ch_get_quirks(struct ch_softc *,
|
||||
struct scsipi_inquiry_pattern *);
|
||||
static void ch_event(struct ch_softc *, u_int);
|
||||
static int ch_map_element(struct ch_softc *, u_int16_t, int *, int *);
|
||||
|
||||
void ch_voltag_convert_in __P((const struct changer_volume_tag *,
|
||||
struct changer_voltag *));
|
||||
int ch_voltag_convert_out __P((const struct changer_voltag *,
|
||||
struct changer_volume_tag *));
|
||||
static void ch_voltag_convert_in(const struct changer_volume_tag *,
|
||||
struct changer_voltag *);
|
||||
static int ch_voltag_convert_out(const struct changer_voltag *,
|
||||
struct changer_volume_tag *);
|
||||
|
||||
/*
|
||||
* SCSI changer quirks.
|
||||
|
@ -171,17 +173,14 @@ struct chquirk {
|
|||
int cq_settledelay; /* settle delay, in seconds */
|
||||
};
|
||||
|
||||
const struct chquirk chquirks[] = {
|
||||
static const struct chquirk chquirks[] = {
|
||||
{{T_CHANGER, T_REMOV,
|
||||
"SPECTRA", "9000", "0200"},
|
||||
75},
|
||||
};
|
||||
|
||||
int
|
||||
chmatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
static int
|
||||
chmatch(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct scsipibus_attach_args *sa = aux;
|
||||
int priority;
|
||||
|
@ -193,10 +192,8 @@ chmatch(parent, match, aux)
|
|||
return (priority);
|
||||
}
|
||||
|
||||
void
|
||||
chattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
static void
|
||||
chattach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct ch_softc *sc = (struct ch_softc *)self;
|
||||
struct scsipibus_attach_args *sa = aux;
|
||||
|
@ -255,11 +252,8 @@ chattach(parent, self, aux)
|
|||
sc->sc_picker = sc->sc_firsts[CHET_MT];
|
||||
}
|
||||
|
||||
int
|
||||
chopen(dev, flags, fmt, p)
|
||||
dev_t dev;
|
||||
int flags, fmt;
|
||||
struct proc *p;
|
||||
static int
|
||||
chopen(dev_t dev, int flags, int fmt, struct proc *p)
|
||||
{
|
||||
struct ch_softc *sc;
|
||||
struct scsipi_periph *periph;
|
||||
|
@ -311,11 +305,8 @@ chopen(dev, flags, fmt, p)
|
|||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
chclose(dev, flags, fmt, p)
|
||||
dev_t dev;
|
||||
int flags, fmt;
|
||||
struct proc *p;
|
||||
static int
|
||||
chclose(dev_t dev, int flags, int fmt, struct proc *p)
|
||||
{
|
||||
struct ch_softc *sc = ch_cd.cd_devs[CHUNIT(dev)];
|
||||
struct scsipi_periph *periph = sc->sc_periph;
|
||||
|
@ -331,11 +322,8 @@ chclose(dev, flags, fmt, p)
|
|||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
chread(dev, uio, flags)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flags;
|
||||
static int
|
||||
chread(dev_t dev, struct uio *uio, int flags)
|
||||
{
|
||||
struct ch_softc *sc = ch_cd.cd_devs[CHUNIT(dev)];
|
||||
int error;
|
||||
|
@ -353,13 +341,8 @@ chread(dev, uio, flags)
|
|||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
chioctl(dev, cmd, data, flags, p)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flags;
|
||||
struct proc *p;
|
||||
static int
|
||||
chioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
|
||||
{
|
||||
struct ch_softc *sc = ch_cd.cd_devs[CHUNIT(dev)];
|
||||
int error = 0;
|
||||
|
@ -458,11 +441,8 @@ chioctl(dev, cmd, data, flags, p)
|
|||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
chpoll(dev, events, p)
|
||||
dev_t dev;
|
||||
int events;
|
||||
struct proc *p;
|
||||
static int
|
||||
chpoll(dev_t dev, int events, struct proc *p)
|
||||
{
|
||||
struct ch_softc *sc = ch_cd.cd_devs[CHUNIT(dev)];
|
||||
int revents;
|
||||
|
@ -505,7 +485,7 @@ static const struct filterops chread_filtops =
|
|||
static const struct filterops chwrite_filtops =
|
||||
{ 1, NULL, filt_chdetach, filt_seltrue };
|
||||
|
||||
int
|
||||
static int
|
||||
chkqfilter(dev_t dev, struct knote *kn)
|
||||
{
|
||||
struct ch_softc *sc = ch_cd.cd_devs[CHUNIT(dev)];
|
||||
|
@ -533,9 +513,8 @@ chkqfilter(dev_t dev, struct knote *kn)
|
|||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
ch_interpret_sense(xs)
|
||||
struct scsipi_xfer *xs;
|
||||
static int
|
||||
ch_interpret_sense(struct scsipi_xfer *xs)
|
||||
{
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
struct scsipi_sense_data *sense = &xs->sense.scsi_sense;
|
||||
|
@ -587,20 +566,16 @@ ch_interpret_sense(xs)
|
|||
return (EJUSTRETURN);
|
||||
}
|
||||
|
||||
void
|
||||
ch_event(sc, event)
|
||||
struct ch_softc *sc;
|
||||
u_int event;
|
||||
static void
|
||||
ch_event(struct ch_softc *sc, u_int event)
|
||||
{
|
||||
|
||||
sc->sc_events |= event;
|
||||
selnotify(&sc->sc_selq, 0);
|
||||
}
|
||||
|
||||
int
|
||||
ch_move(sc, cm)
|
||||
struct ch_softc *sc;
|
||||
struct changer_move_request *cm;
|
||||
static int
|
||||
ch_move(struct ch_softc *sc, struct changer_move_request *cm)
|
||||
{
|
||||
struct scsi_move_medium cmd;
|
||||
u_int16_t fromelem, toelem;
|
||||
|
@ -645,10 +620,8 @@ ch_move(sc, cm)
|
|||
100000, NULL, 0));
|
||||
}
|
||||
|
||||
int
|
||||
ch_exchange(sc, ce)
|
||||
struct ch_softc *sc;
|
||||
struct changer_exchange_request *ce;
|
||||
static int
|
||||
ch_exchange(struct ch_softc *sc, struct changer_exchange_request *ce)
|
||||
{
|
||||
struct scsi_exchange_medium cmd;
|
||||
u_int16_t src, dst1, dst2;
|
||||
|
@ -702,10 +675,8 @@ ch_exchange(sc, ce)
|
|||
100000, NULL, 0));
|
||||
}
|
||||
|
||||
int
|
||||
ch_position(sc, cp)
|
||||
struct ch_softc *sc;
|
||||
struct changer_position_request *cp;
|
||||
static int
|
||||
ch_position(struct ch_softc *sc, struct changer_position_request *cp)
|
||||
{
|
||||
struct scsi_position_to_element cmd;
|
||||
u_int16_t dst;
|
||||
|
@ -746,11 +717,8 @@ ch_position(sc, cp)
|
|||
* the user only the data the user is interested in. This returns the
|
||||
* old data format.
|
||||
*/
|
||||
int
|
||||
ch_ousergetelemstatus(sc, chet, uptr)
|
||||
struct ch_softc *sc;
|
||||
int chet;
|
||||
u_int8_t *uptr;
|
||||
static int
|
||||
ch_ousergetelemstatus(struct ch_softc *sc, int chet, u_int8_t *uptr)
|
||||
{
|
||||
struct read_element_status_header *st_hdrp, st_hdr;
|
||||
struct read_element_status_page_header *pg_hdrp;
|
||||
|
@ -835,10 +803,9 @@ ch_ousergetelemstatus(sc, chet, uptr)
|
|||
* Perform a READ ELEMENT STATUS on behalf of the user. This returns
|
||||
* the new (more complete) data format.
|
||||
*/
|
||||
int
|
||||
ch_usergetelemstatus(sc, cesr)
|
||||
struct ch_softc *sc;
|
||||
struct changer_element_status_request *cesr;
|
||||
static int
|
||||
ch_usergetelemstatus(struct ch_softc *sc,
|
||||
struct changer_element_status_request *cesr)
|
||||
{
|
||||
struct scsipi_channel *chan = sc->sc_periph->periph_channel;
|
||||
struct scsipi_periph *dtperiph;
|
||||
|
@ -1059,14 +1026,9 @@ ch_usergetelemstatus(sc, cesr)
|
|||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
ch_getelemstatus(sc, first, count, data, datalen, scsiflags, flags)
|
||||
struct ch_softc *sc;
|
||||
int first, count;
|
||||
void *data;
|
||||
size_t datalen;
|
||||
int scsiflags;
|
||||
int flags;
|
||||
static int
|
||||
ch_getelemstatus(struct ch_softc *sc, int first, int count, void *data,
|
||||
size_t datalen, int scsiflags, int flags)
|
||||
{
|
||||
struct scsi_read_element_status cmd;
|
||||
|
||||
|
@ -1091,10 +1053,8 @@ ch_getelemstatus(sc, first, count, data, datalen, scsiflags, flags)
|
|||
scsiflags | XS_CTL_DATA_IN));
|
||||
}
|
||||
|
||||
int
|
||||
ch_setvoltag(sc, csvr)
|
||||
struct ch_softc *sc;
|
||||
struct changer_set_voltag_request *csvr;
|
||||
static int
|
||||
ch_setvoltag(struct ch_softc *sc, struct changer_set_voltag_request *csvr)
|
||||
{
|
||||
struct scsi_send_volume_tag cmd;
|
||||
struct changer_volume_tag voltag;
|
||||
|
@ -1159,9 +1119,8 @@ ch_setvoltag(sc, csvr)
|
|||
datalen ? XS_CTL_DATA_OUT | XS_CTL_DATA_ONSTACK : 0));
|
||||
}
|
||||
|
||||
int
|
||||
ch_ielem(sc)
|
||||
struct ch_softc *sc;
|
||||
static int
|
||||
ch_ielem(struct ch_softc *sc)
|
||||
{
|
||||
int tmo;
|
||||
struct scsi_initialize_element_status cmd;
|
||||
|
@ -1200,10 +1159,8 @@ ch_ielem(sc)
|
|||
* Ask the device about itself and fill in the parameters in our
|
||||
* softc.
|
||||
*/
|
||||
int
|
||||
ch_get_params(sc, scsiflags)
|
||||
struct ch_softc *sc;
|
||||
int scsiflags;
|
||||
static int
|
||||
ch_get_params(struct ch_softc *sc, int scsiflags)
|
||||
{
|
||||
struct scsi_mode_sense_data {
|
||||
struct scsipi_mode_header header;
|
||||
|
@ -1282,10 +1239,8 @@ ch_get_params(sc, scsiflags)
|
|||
return (error);
|
||||
}
|
||||
|
||||
void
|
||||
ch_get_quirks(sc, inqbuf)
|
||||
struct ch_softc *sc;
|
||||
struct scsipi_inquiry_pattern *inqbuf;
|
||||
static void
|
||||
ch_get_quirks(struct ch_softc *sc, struct scsipi_inquiry_pattern *inqbuf)
|
||||
{
|
||||
struct chquirk *match;
|
||||
int priority;
|
||||
|
@ -1300,11 +1255,8 @@ ch_get_quirks(sc, inqbuf)
|
|||
sc->sc_settledelay = match->cq_settledelay;
|
||||
}
|
||||
|
||||
int
|
||||
ch_map_element(sc, elem, typep, unitp)
|
||||
struct ch_softc *sc;
|
||||
u_int16_t elem;
|
||||
int *typep, *unitp;
|
||||
static int
|
||||
ch_map_element(struct ch_softc *sc, u_int16_t elem, int *typep, int *unitp)
|
||||
{
|
||||
int chet;
|
||||
|
||||
|
@ -1319,10 +1271,9 @@ ch_map_element(sc, elem, typep, unitp)
|
|||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
ch_voltag_convert_in(sv, cv)
|
||||
const struct changer_volume_tag *sv;
|
||||
struct changer_voltag *cv;
|
||||
static void
|
||||
ch_voltag_convert_in(const struct changer_volume_tag *sv,
|
||||
struct changer_voltag *cv)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1342,10 +1293,9 @@ ch_voltag_convert_in(sv, cv)
|
|||
cv->cv_serial = _2btol(sv->volseq);
|
||||
}
|
||||
|
||||
int
|
||||
ch_voltag_convert_out(cv, sv)
|
||||
const struct changer_voltag *cv;
|
||||
struct changer_volume_tag *sv;
|
||||
static int
|
||||
ch_voltag_convert_out(const struct changer_voltag *cv,
|
||||
struct changer_volume_tag *sv)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
Loading…
Reference in New Issue