mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Various whitespace and style fixes.
This commit is contained in:
parent
62162dfc94
commit
284c87f60e
19 changed files with 291 additions and 284 deletions
|
|
@ -125,19 +125,19 @@ __FBSDID("$FreeBSD$");
|
|||
#define LPMAXERRS 100
|
||||
#endif
|
||||
|
||||
#define CLPIPHDRLEN 14 /* We send dummy ethernet addresses (two) + packet type in front of packet */
|
||||
#define CLPIPHDRLEN 14 /* We send dummy ethernet addresses (two) + packet type in front of packet */
|
||||
#define CLPIP_SHAKE 0x80 /* This bit toggles between nibble reception */
|
||||
#define MLPIPHDRLEN CLPIPHDRLEN
|
||||
#define MLPIPHDRLEN CLPIPHDRLEN
|
||||
|
||||
#define LPIPHDRLEN 2 /* We send 0x08, 0x00 in front of packet */
|
||||
#define LPIPHDRLEN 2 /* We send 0x08, 0x00 in front of packet */
|
||||
#define LPIP_SHAKE 0x40 /* This bit toggles between nibble reception */
|
||||
#if !defined(MLPIPHDRLEN) || LPIPHDRLEN > MLPIPHDRLEN
|
||||
#define MLPIPHDRLEN LPIPHDRLEN
|
||||
#define MLPIPHDRLEN LPIPHDRLEN
|
||||
#endif
|
||||
|
||||
#define LPIPTBLSIZE 256 /* Size of octet translation table */
|
||||
|
||||
#define lprintf if (lptflag) printf
|
||||
#define lprintf if (lptflag) printf
|
||||
|
||||
#ifdef PLIP_DEBUG
|
||||
static int volatile lptflag = 1;
|
||||
|
|
@ -156,14 +156,14 @@ struct lp_data {
|
|||
|
||||
/* Tables for the lp# interface */
|
||||
static u_char *txmith;
|
||||
#define txmitl (txmith + (1 * LPIPTBLSIZE))
|
||||
#define trecvh (txmith + (2 * LPIPTBLSIZE))
|
||||
#define trecvl (txmith + (3 * LPIPTBLSIZE))
|
||||
#define txmitl (txmith + (1 * LPIPTBLSIZE))
|
||||
#define trecvh (txmith + (2 * LPIPTBLSIZE))
|
||||
#define trecvl (txmith + (3 * LPIPTBLSIZE))
|
||||
|
||||
static u_char *ctxmith;
|
||||
#define ctxmitl (ctxmith + (1 * LPIPTBLSIZE))
|
||||
#define ctrecvh (ctxmith + (2 * LPIPTBLSIZE))
|
||||
#define ctrecvl (ctxmith + (3 * LPIPTBLSIZE))
|
||||
#define ctxmitl (ctxmith + (1 * LPIPTBLSIZE))
|
||||
#define ctrecvh (ctxmith + (2 * LPIPTBLSIZE))
|
||||
#define ctrecvl (ctxmith + (3 * LPIPTBLSIZE))
|
||||
|
||||
/* Functions for the lp# interface */
|
||||
static int lpinittables(void);
|
||||
|
|
@ -172,7 +172,7 @@ static int lpoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
|
|||
struct rtentry *);
|
||||
static void lp_intr(void *);
|
||||
|
||||
#define DEVTOSOFTC(dev) \
|
||||
#define DEVTOSOFTC(dev) \
|
||||
((struct lp_data *)device_get_softc(dev))
|
||||
|
||||
static devclass_t lp_devclass;
|
||||
|
|
@ -254,7 +254,7 @@ lpinittables(void)
|
|||
return (1);
|
||||
|
||||
if (ctxmith == NULL)
|
||||
ctxmith = malloc(4*LPIPTBLSIZE, M_DEVBUF, M_NOWAIT);
|
||||
ctxmith = malloc(4 * LPIPTBLSIZE, M_DEVBUF, M_NOWAIT);
|
||||
|
||||
if (ctxmith == NULL)
|
||||
return (1);
|
||||
|
|
@ -446,7 +446,7 @@ static void
|
|||
lp_intr(void *arg)
|
||||
{
|
||||
device_t dev = (device_t)arg;
|
||||
device_t ppbus = device_get_parent(dev);
|
||||
device_t ppbus = device_get_parent(dev);
|
||||
struct lp_data *sc = DEVTOSOFTC(dev);
|
||||
int len, s, j;
|
||||
u_char *bp;
|
||||
|
|
@ -559,7 +559,7 @@ lp_intr(void *arg)
|
|||
}
|
||||
goto done;
|
||||
|
||||
err:
|
||||
err:
|
||||
ppb_wdtr(ppbus, 0);
|
||||
lprintf("R");
|
||||
sc->sc_ifp->if_ierrors++;
|
||||
|
|
@ -576,12 +576,12 @@ lp_intr(void *arg)
|
|||
sc->sc_iferrs = 0;
|
||||
}
|
||||
|
||||
done:
|
||||
done:
|
||||
splx(s);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
lpoutbyte (u_char byte, int spin, device_t ppbus)
|
||||
lpoutbyte(u_char byte, int spin, device_t ppbus)
|
||||
{
|
||||
|
||||
ppb_wdtr(ppbus, txmith[byte]);
|
||||
|
|
|
|||
|
|
@ -250,10 +250,10 @@ static struct ppb_microseq spp_outbyte_submicroseq[] = {
|
|||
MS_CASS(0x4),
|
||||
|
||||
/* loop: */
|
||||
MS_RASSERT_P(1, MS_REG_DTR),
|
||||
MS_RASSERT_P(1, MS_REG_DTR),
|
||||
MS_CASS(0x5),
|
||||
MS_DBRA(0), /* decrement counter */
|
||||
MS_RASSERT_P(1, MS_REG_DTR),
|
||||
MS_RASSERT_P(1, MS_REG_DTR),
|
||||
MS_CASS(0x0),
|
||||
MS_DBRA(-6 /* loop */),
|
||||
|
||||
|
|
@ -265,14 +265,14 @@ static struct ppb_microseq spp_outbyte_submicroseq[] = {
|
|||
/* EPP 1.7 microsequences, ptr and len set at runtime */
|
||||
static struct ppb_microseq epp17_outstr[] = {
|
||||
MS_CASS(0x4),
|
||||
MS_RASSERT_P(MS_ACCUM, MS_REG_EPP_D),
|
||||
MS_RASSERT_P(MS_ACCUM, MS_REG_EPP_D),
|
||||
MS_CASS(0xc),
|
||||
MS_RET(0),
|
||||
};
|
||||
|
||||
static struct ppb_microseq epp17_instr[] = {
|
||||
MS_CASS(PCD | 0x4),
|
||||
MS_RFETCH_P(MS_ACCUM, MS_REG_EPP_D, MS_FETCH_ALL),
|
||||
MS_RFETCH_P(MS_ACCUM, MS_REG_EPP_D, MS_FETCH_ALL),
|
||||
MS_CASS(PCD | 0xc),
|
||||
MS_RET(0),
|
||||
};
|
||||
|
|
@ -416,7 +416,7 @@ imm_detect(struct vpoio_data *vpo)
|
|||
/* release the bus now */
|
||||
imm_disconnect(vpo, &error, 1);
|
||||
|
||||
/* ensure we are disconnected or daisy chained peripheral
|
||||
/* ensure we are disconnected or daisy chained peripheral
|
||||
* may cause serious problem to the disk */
|
||||
|
||||
if (error) {
|
||||
|
|
@ -479,7 +479,7 @@ imm_select(struct vpoio_data *vpo, int initiator, int target)
|
|||
/* initialize the select microsequence */
|
||||
ppb_MS_init_msq(select_microseq, 1,
|
||||
SELECT_TARGET, 1 << initiator | 1 << target);
|
||||
|
||||
|
||||
ppb_MS_microseq(ppbus, vpo->vpo_dev, select_microseq, &ret);
|
||||
|
||||
return (ret);
|
||||
|
|
@ -514,7 +514,7 @@ imm_wait(struct vpoio_data *vpo, int tmo)
|
|||
ppb_MS_microseq(ppbus, vpo->vpo_dev, wait_microseq, &err);
|
||||
|
||||
if (err)
|
||||
return (0); /* command timed out */
|
||||
return (0); /* command timed out */
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
|
@ -540,7 +540,7 @@ imm_negociate(struct vpoio_data *vpo)
|
|||
if (ret)
|
||||
return (VP0_ENEGOCIATE);
|
||||
#endif
|
||||
|
||||
|
||||
ppb_MS_init_msq(negociate_microseq, 1,
|
||||
NEGOCIATED_MODE, negociate_mode);
|
||||
|
||||
|
|
@ -580,7 +580,7 @@ imm_probe(device_t dev, struct vpoio_data *vpo)
|
|||
int
|
||||
imm_attach(struct vpoio_data *vpo)
|
||||
{
|
||||
DECLARE_NIBBLE_INBYTE_SUBMICROSEQ;
|
||||
DECLARE_NIBBLE_INBYTE_SUBMICROSEQ;
|
||||
device_t ppbus = device_get_parent(vpo->vpo_dev);
|
||||
int error = 0;
|
||||
|
||||
|
|
@ -601,7 +601,7 @@ imm_attach(struct vpoio_data *vpo)
|
|||
INB_NIBBLE_H, (void *)&(vpo)->vpo_nibble.h,
|
||||
INB_NIBBLE_L, (void *)&(vpo)->vpo_nibble.l,
|
||||
INB_NIBBLE_F, nibble_inbyte_hook,
|
||||
INB_NIBBLE_P, (void *)&(vpo)->vpo_nibble);
|
||||
INB_NIBBLE_P, (void *)&(vpo)->vpo_nibble);
|
||||
|
||||
/*
|
||||
* Initialize mode dependent in/out microsequences
|
||||
|
|
@ -666,7 +666,7 @@ imm_reset_bus(struct vpoio_data *vpo)
|
|||
* Send an SCSI command
|
||||
*
|
||||
*/
|
||||
int
|
||||
int
|
||||
imm_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
|
||||
int clen, char *buffer, int blen, int *result, int *count,
|
||||
int *ret)
|
||||
|
|
@ -690,7 +690,8 @@ imm_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
|
|||
return (error);
|
||||
|
||||
if (not_connected) {
|
||||
*ret = VP0_ECONNECT; goto error;
|
||||
*ret = VP0_ECONNECT;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -714,7 +715,8 @@ imm_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
|
|||
}
|
||||
|
||||
if (!(r = imm_wait(vpo, VP0_LOW_SPINTMO))) {
|
||||
*ret = VP0_ESTATUS_TIMEOUT; goto error;
|
||||
*ret = VP0_ESTATUS_TIMEOUT;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((r & 0x30) == 0x10) {
|
||||
|
|
@ -725,14 +727,15 @@ imm_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
|
|||
negociated = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Complete transfer ...
|
||||
/*
|
||||
* Complete transfer ...
|
||||
*/
|
||||
*count = 0;
|
||||
for (;;) {
|
||||
|
||||
if (!(r = imm_wait(vpo, VP0_LOW_SPINTMO))) {
|
||||
*ret = VP0_ESTATUS_TIMEOUT; goto error;
|
||||
*ret = VP0_ESTATUS_TIMEOUT;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* stop when the ZIP+ wants to send status */
|
||||
|
|
@ -782,13 +785,15 @@ imm_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
|
|||
negociated = 1;
|
||||
|
||||
if (imm_instr(vpo, &l, 1)) {
|
||||
*ret = VP0_EOTHER; goto error;
|
||||
*ret = VP0_EOTHER;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* check if the ZIP+ wants to send more status */
|
||||
if (imm_wait(vpo, VP0_FAST_SPINTMO) == (char)0xb8)
|
||||
if (imm_instr(vpo, &h, 1)) {
|
||||
*ret = VP0_EOTHER+2; goto error;
|
||||
*ret = VP0_EOTHER + 2;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Experience showed that we should discard this */
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ static int
|
|||
lpbb_attach(device_t dev)
|
||||
{
|
||||
device_t bitbang;
|
||||
|
||||
|
||||
/* add generic bit-banging code */
|
||||
bitbang = device_add_child(dev, "iicbb", -1);
|
||||
device_probe_and_attach(bitbang);
|
||||
|
|
@ -159,7 +159,7 @@ lpbb_setsda(device_t dev, char val)
|
|||
mtx_lock(&Giant);
|
||||
if (val == 0)
|
||||
ppb_wdtr(ppbus, (u_char)SDA_out);
|
||||
else
|
||||
else
|
||||
ppb_wdtr(ppbus, (u_char)~SDA_out);
|
||||
mtx_unlock(&Giant);
|
||||
}
|
||||
|
|
@ -172,8 +172,8 @@ lpbb_setscl(device_t dev, unsigned char val)
|
|||
mtx_lock(&Giant);
|
||||
if (val == 0)
|
||||
ppb_wctr(ppbus, (u_char)(ppb_rctr(ppbus) & ~SCL_out));
|
||||
else
|
||||
ppb_wctr(ppbus, (u_char)(ppb_rctr(ppbus) | SCL_out));
|
||||
else
|
||||
ppb_wctr(ppbus, (u_char)(ppb_rctr(ppbus) | SCL_out));
|
||||
mtx_unlock(&Giant);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,9 +87,9 @@ __FBSDID("$FreeBSD$");
|
|||
#include <dev/ppbus/ppbio.h>
|
||||
|
||||
#ifndef LPT_DEBUG
|
||||
#define lprintf(args)
|
||||
#define lprintf(args)
|
||||
#else
|
||||
#define lprintf(args) \
|
||||
#define lprintf(args) \
|
||||
do { \
|
||||
if (lptflag) \
|
||||
printf args; \
|
||||
|
|
@ -113,36 +113,35 @@ struct lpt_data {
|
|||
prime once */
|
||||
u_char sc_control;
|
||||
char sc_flags;
|
||||
#define LP_POS_INIT 0x04 /* if we are a postive init signal */
|
||||
#define LP_POS_ACK 0x08 /* if we are a positive going ack */
|
||||
#define LP_NO_PRIME 0x10 /* don't prime the printer at all */
|
||||
#define LP_PRIMEOPEN 0x20 /* prime on every open */
|
||||
#define LP_AUTOLF 0x40 /* tell printer to do an automatic lf */
|
||||
#define LP_BYPASS 0x80 /* bypass printer ready checks */
|
||||
#define LP_POS_INIT 0x04 /* if we are a postive init signal */
|
||||
#define LP_POS_ACK 0x08 /* if we are a positive going ack */
|
||||
#define LP_NO_PRIME 0x10 /* don't prime the printer at all */
|
||||
#define LP_PRIMEOPEN 0x20 /* prime on every open */
|
||||
#define LP_AUTOLF 0x40 /* tell printer to do an automatic lf */
|
||||
#define LP_BYPASS 0x80 /* bypass printer ready checks */
|
||||
void *sc_inbuf;
|
||||
void *sc_statbuf;
|
||||
short sc_xfercnt ;
|
||||
char sc_primed;
|
||||
char *sc_cp ;
|
||||
u_short sc_irq ; /* IRQ status of port */
|
||||
#define LP_HAS_IRQ 0x01 /* we have an irq available */
|
||||
#define LP_USE_IRQ 0x02 /* we are using our irq */
|
||||
#define LP_ENABLE_IRQ 0x04 /* enable IRQ on open */
|
||||
#define LP_ENABLE_EXT 0x10 /* we shall use advanced mode when possible */
|
||||
#define LP_HAS_IRQ 0x01 /* we have an irq available */
|
||||
#define LP_USE_IRQ 0x02 /* we are using our irq */
|
||||
#define LP_ENABLE_IRQ 0x04 /* enable IRQ on open */
|
||||
#define LP_ENABLE_EXT 0x10 /* we shall use advanced mode when possible */
|
||||
u_char sc_backoff ; /* time to call lptout() again */
|
||||
|
||||
struct resource *intr_resource; /* interrupt resource */
|
||||
void *intr_cookie; /* interrupt registration cookie */
|
||||
|
||||
};
|
||||
|
||||
#define LPT_NAME "lpt" /* our official name */
|
||||
#define LPT_NAME "lpt" /* our official name */
|
||||
|
||||
static timeout_t lptout;
|
||||
static int lpt_port_test(device_t dev, u_char data, u_char mask);
|
||||
static int lpt_detect(device_t dev);
|
||||
|
||||
#define DEVTOSOFTC(dev) \
|
||||
#define DEVTOSOFTC(dev) \
|
||||
((struct lpt_data *)device_get_softc(dev))
|
||||
|
||||
static void lptintr(device_t dev);
|
||||
|
|
@ -156,17 +155,15 @@ static devclass_t lpt_devclass;
|
|||
#define ASLP (1<<1) /* awaiting draining of printer */
|
||||
#define EERROR (1<<2) /* error was received from printer */
|
||||
#define OBUSY (1<<3) /* printer is busy doing output */
|
||||
#define LPTOUT (1<<4) /* timeout while not selected */
|
||||
#define TOUT (1<<5) /* timeout while not selected */
|
||||
#define LPTINIT (1<<6) /* waiting to initialize for open */
|
||||
#define INTERRUPTED (1<<7) /* write call was interrupted */
|
||||
|
||||
#define HAVEBUS (1<<8) /* the driver owns the bus */
|
||||
|
||||
#define LPTOUT (1<<4) /* timeout while not selected */
|
||||
#define TOUT (1<<5) /* timeout while not selected */
|
||||
#define LPTINIT (1<<6) /* waiting to initialize for open */
|
||||
#define INTERRUPTED (1<<7) /* write call was interrupted */
|
||||
#define HAVEBUS (1<<8) /* the driver owns the bus */
|
||||
|
||||
/* status masks to interrogate printer status */
|
||||
#define RDY_MASK (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR) /* ready ? */
|
||||
#define LP_READY (LPS_SEL|LPS_NBSY|LPS_NERR)
|
||||
#define RDY_MASK (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR) /* ready ? */
|
||||
#define LP_READY (LPS_SEL|LPS_NBSY|LPS_NERR)
|
||||
|
||||
/* Printer Ready condition - from lpa.c */
|
||||
/* Only used in polling code */
|
||||
|
|
@ -503,7 +500,7 @@ lptopen(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||
|
||||
/* init printer */
|
||||
if ((sc->sc_flags & LP_NO_PRIME) == 0) {
|
||||
if((sc->sc_flags & LP_PRIMEOPEN) || sc->sc_primed == 0) {
|
||||
if ((sc->sc_flags & LP_PRIMEOPEN) || sc->sc_primed == 0) {
|
||||
ppb_wctr(ppbus, 0);
|
||||
sc->sc_primed++;
|
||||
DELAY(500);
|
||||
|
|
@ -582,7 +579,7 @@ lptclose(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||
{
|
||||
struct lpt_data *sc = dev->si_drv1;
|
||||
device_t lptdev = sc->dev;
|
||||
device_t ppbus = device_get_parent(lptdev);
|
||||
device_t ppbus = device_get_parent(lptdev);
|
||||
int err;
|
||||
|
||||
if (sc->sc_flags & LP_BYPASS)
|
||||
|
|
@ -594,7 +591,7 @@ lptclose(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||
sc->sc_state &= ~OPEN;
|
||||
|
||||
/* if the last write was interrupted, don't complete it */
|
||||
if((!(sc->sc_state & INTERRUPTED)) && (sc->sc_irq & LP_USE_IRQ))
|
||||
if ((!(sc->sc_state & INTERRUPTED)) && (sc->sc_irq & LP_USE_IRQ))
|
||||
while ((ppb_rstr(ppbus) &
|
||||
(LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) !=
|
||||
(LPS_SEL|LPS_NBSY|LPS_NERR) || sc->sc_xfercnt)
|
||||
|
|
@ -690,7 +687,7 @@ lptread(struct cdev *dev, struct uio *uio, int ioflag)
|
|||
{
|
||||
struct lpt_data *sc = dev->si_drv1;
|
||||
device_t lptdev = sc->dev;
|
||||
device_t ppbus = device_get_parent(lptdev);
|
||||
device_t ppbus = device_get_parent(lptdev);
|
||||
int error = 0, len;
|
||||
|
||||
if (sc->sc_flags & LP_BYPASS) {
|
||||
|
|
@ -736,9 +733,9 @@ lptwrite(struct cdev *dev, struct uio *uio, int ioflag)
|
|||
int err;
|
||||
struct lpt_data *sc = dev->si_drv1;
|
||||
device_t lptdev = sc->dev;
|
||||
device_t ppbus = device_get_parent(lptdev);
|
||||
device_t ppbus = device_get_parent(lptdev);
|
||||
|
||||
if(sc->sc_flags & LP_BYPASS) {
|
||||
if (sc->sc_flags & LP_BYPASS) {
|
||||
/* we can't do writes in bypass mode */
|
||||
return(EPERM);
|
||||
}
|
||||
|
|
@ -777,7 +774,7 @@ lptwrite(struct cdev *dev, struct uio *uio, int ioflag)
|
|||
sc->sc_xfercnt = 0;
|
||||
break;
|
||||
case EINTR:
|
||||
sc->sc_state |= INTERRUPTED;
|
||||
sc->sc_state |= INTERRUPTED;
|
||||
return(err);
|
||||
case EINVAL:
|
||||
/* advanced mode not avail */
|
||||
|
|
@ -806,7 +803,7 @@ lptwrite(struct cdev *dev, struct uio *uio, int ioflag)
|
|||
}
|
||||
|
||||
/* check to see if we must do a polled write */
|
||||
if(!(sc->sc_irq & LP_USE_IRQ) && (sc->sc_xfercnt)) {
|
||||
if (!(sc->sc_irq & LP_USE_IRQ) && (sc->sc_xfercnt)) {
|
||||
lprintf(("p"));
|
||||
|
||||
err = lpt_pushbytes(lptdev);
|
||||
|
|
@ -828,16 +825,15 @@ lptwrite(struct cdev *dev, struct uio *uio, int ioflag)
|
|||
*
|
||||
* do checking for interrupted write call.
|
||||
*/
|
||||
|
||||
static void
|
||||
lpt_intr(void *arg)
|
||||
{
|
||||
device_t lptdev = (device_t)arg;
|
||||
device_t ppbus = device_get_parent(lptdev);
|
||||
device_t ppbus = device_get_parent(lptdev);
|
||||
struct lpt_data *sc = DEVTOSOFTC(lptdev);
|
||||
int sts = 0;
|
||||
int i;
|
||||
|
||||
|
||||
/* we must own the bus to use it */
|
||||
if ((sc->sc_state & HAVEBUS) == 0)
|
||||
return;
|
||||
|
|
@ -853,7 +849,7 @@ lpt_intr(void *arg)
|
|||
|
||||
if ((sts & RDY_MASK) == LP_READY) {
|
||||
sc->sc_state = (sc->sc_state | OBUSY) & ~EERROR;
|
||||
sc->sc_backoff = hz/LPTOUTINITIAL;
|
||||
sc->sc_backoff = hz / LPTOUTINITIAL;
|
||||
|
||||
if (sc->sc_xfercnt) {
|
||||
/* send char */
|
||||
|
|
@ -864,7 +860,8 @@ lpt_intr(void *arg)
|
|||
ppb_wctr(ppbus, sc->sc_control);
|
||||
|
||||
/* any more data for printer */
|
||||
if(--(sc->sc_xfercnt) > 0) return;
|
||||
if (--(sc->sc_xfercnt) > 0)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -873,12 +870,12 @@ lpt_intr(void *arg)
|
|||
*/
|
||||
sc->sc_state &= ~OBUSY;
|
||||
|
||||
if(!(sc->sc_state & INTERRUPTED))
|
||||
if (!(sc->sc_state & INTERRUPTED))
|
||||
wakeup(lptdev);
|
||||
lprintf(("w "));
|
||||
return;
|
||||
} else { /* check for error */
|
||||
if(((sts & (LPS_NERR | LPS_OUT) ) != LPS_NERR) &&
|
||||
if (((sts & (LPS_NERR | LPS_OUT) ) != LPS_NERR) &&
|
||||
(sc->sc_state & OPEN))
|
||||
sc->sc_state |= EERROR;
|
||||
/* lptout() will jump in and try to restart. */
|
||||
|
|
@ -907,7 +904,7 @@ lptioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t
|
|||
|
||||
switch (cmd) {
|
||||
case LPT_IRQ :
|
||||
if(sc->sc_irq & LP_HAS_IRQ) {
|
||||
if (sc->sc_irq & LP_HAS_IRQ) {
|
||||
/*
|
||||
* NOTE:
|
||||
* If the IRQ status is changed,
|
||||
|
|
@ -939,7 +936,7 @@ lptioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (old_sc_irq != sc->sc_irq )
|
||||
log(LOG_NOTICE, "%s: switched to %s %s mode\n",
|
||||
device_get_nameunit(sc->dev),
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* Distantly from :
|
||||
* @(#)lptreg.h 1.1 (Berkeley) 12/19/90
|
||||
* Id: lptreg.h,v 1.6 1997/02/22 09:36:52 peter Exp
|
||||
* Id: lptreg.h,v 1.6 1997/02/22 09:36:52 peter Exp
|
||||
* From Id: nlpt.h,v 1.3 1999/01/10 12:04:54 nsouch Exp
|
||||
*
|
||||
* $FreeBSD$
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
*/
|
||||
|
||||
#ifndef __LPT_H
|
||||
#define __LPT_H
|
||||
#define __LPT_H
|
||||
|
||||
/* machine independent definitions, it shall only depend on the ppbus
|
||||
* parallel port model */
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY SASCHA SCHUMANN ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
|
|
@ -105,7 +105,7 @@ static struct cdevsw pcfclock_cdevsw = {
|
|||
NR(buf, 2) <= 59)
|
||||
|
||||
#define PCFCLOCK_BATTERY_STATUS_LOW(buf) (buf[8] & 4)
|
||||
|
||||
|
||||
#define PCFCLOCK_CMD_TIME 0 /* send current time */
|
||||
#define PCFCLOCK_CMD_COPY 7 /* copy received signal to PC */
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ pcfclock_attach(device_t dev)
|
|||
{
|
||||
struct pcfclock_data *sc = device_get_softc(dev);
|
||||
int unit;
|
||||
|
||||
|
||||
unit = device_get_unit(dev);
|
||||
|
||||
sc->dev = dev;
|
||||
|
|
@ -148,14 +148,14 @@ pcfclock_attach(device_t dev)
|
|||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
pcfclock_open(struct cdev *dev, int flag, int fms, struct thread *td)
|
||||
{
|
||||
struct pcfclock_data *sc = dev->si_drv1;
|
||||
device_t pcfclockdev = sc->dev;
|
||||
device_t ppbus = device_get_parent(pcfclockdev);
|
||||
int res;
|
||||
|
||||
|
||||
if (!sc)
|
||||
return (ENXIO);
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ pcfclock_open(struct cdev *dev, int flag, int fms, struct thread *td)
|
|||
return (res);
|
||||
|
||||
sc->count++;
|
||||
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
@ -187,10 +187,10 @@ pcfclock_write_cmd(struct cdev *dev, unsigned char command)
|
|||
{
|
||||
struct pcfclock_data *sc = dev->si_drv1;
|
||||
device_t pcfclockdev = sc->dev;
|
||||
device_t ppbus = device_get_parent(pcfclockdev);
|
||||
device_t ppbus = device_get_parent(pcfclockdev);
|
||||
unsigned char ctr = 14;
|
||||
char i;
|
||||
|
||||
|
||||
for (i = 0; i <= 7; i++) {
|
||||
ppb_wdtr(ppbus, i);
|
||||
AUTOFEED_CLOCK(i & 1 ? AFC_HI : AFC_LO);
|
||||
|
|
@ -203,7 +203,7 @@ pcfclock_write_cmd(struct cdev *dev, unsigned char command)
|
|||
}
|
||||
|
||||
static void
|
||||
pcfclock_display_data(struct cdev *dev, char buf[18])
|
||||
pcfclock_display_data(struct cdev *dev, char buf[18])
|
||||
{
|
||||
struct pcfclock_data *sc = dev->si_drv1;
|
||||
#ifdef PCFCLOCK_VERBOSE
|
||||
|
|
@ -224,19 +224,19 @@ pcfclock_display_data(struct cdev *dev, char buf[18])
|
|||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
pcfclock_read_data(struct cdev *dev, char *buf, ssize_t bits)
|
||||
{
|
||||
struct pcfclock_data *sc = dev->si_drv1;
|
||||
device_t pcfclockdev = sc->dev;
|
||||
device_t ppbus = device_get_parent(pcfclockdev);
|
||||
device_t ppbus = device_get_parent(pcfclockdev);
|
||||
int i;
|
||||
char waitfor;
|
||||
int offset;
|
||||
|
||||
/* one byte per four bits */
|
||||
bzero(buf, ((bits + 3) >> 2) + 1);
|
||||
|
||||
|
||||
waitfor = 100;
|
||||
for (i = 0; i <= bits; i++) {
|
||||
/* wait for clock, maximum (waitfor*100) usec */
|
||||
|
|
@ -244,11 +244,11 @@ pcfclock_read_data(struct cdev *dev, char *buf, ssize_t bits)
|
|||
DELAY(100);
|
||||
|
||||
/* timed out? */
|
||||
if (!waitfor)
|
||||
if (!waitfor)
|
||||
return (EIO);
|
||||
|
||||
|
||||
waitfor = 100; /* reload */
|
||||
|
||||
|
||||
/* give it some time */
|
||||
DELAY(500);
|
||||
|
||||
|
|
@ -263,12 +263,12 @@ pcfclock_read_data(struct cdev *dev, char *buf, ssize_t bits)
|
|||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
pcfclock_read_dev(struct cdev *dev, char *buf, int maxretries)
|
||||
static int
|
||||
pcfclock_read_dev(struct cdev *dev, char *buf, int maxretries)
|
||||
{
|
||||
struct pcfclock_data *sc = dev->si_drv1;
|
||||
device_t pcfclockdev = sc->dev;
|
||||
device_t ppbus = device_get_parent(pcfclockdev);
|
||||
device_t ppbus = device_get_parent(pcfclockdev);
|
||||
int error = 0;
|
||||
|
||||
ppb_set_mode(ppbus, PPB_COMPATIBLE);
|
||||
|
|
@ -277,7 +277,7 @@ pcfclock_read_dev(struct cdev *dev, char *buf, int maxretries)
|
|||
pcfclock_write_cmd(dev, PCFCLOCK_CMD_TIME);
|
||||
if (pcfclock_read_data(dev, buf, 68))
|
||||
continue;
|
||||
|
||||
|
||||
if (!PCFCLOCK_CORRECT_SYNC(buf))
|
||||
continue;
|
||||
|
||||
|
|
@ -289,7 +289,7 @@ pcfclock_read_dev(struct cdev *dev, char *buf, int maxretries)
|
|||
|
||||
if (!maxretries)
|
||||
error = EIO;
|
||||
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
@ -304,15 +304,15 @@ pcfclock_read(struct cdev *dev, struct uio *uio, int ioflag)
|
|||
return (ERANGE);
|
||||
|
||||
error = pcfclock_read_dev(dev, buf, PCFCLOCK_MAX_RETRIES);
|
||||
|
||||
|
||||
if (error) {
|
||||
device_printf(sc->dev, "no PCF found\n");
|
||||
} else {
|
||||
pcfclock_display_data(dev, buf);
|
||||
|
||||
|
||||
uiomove(buf, 18, uio);
|
||||
}
|
||||
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,8 @@ ppb_1284_reset_error(device_t bus, int state)
|
|||
int
|
||||
ppb_1284_get_state(device_t bus)
|
||||
{
|
||||
return (DEVTOSOFTC(bus)->state);
|
||||
|
||||
return (DEVTOSOFTC(bus)->state);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -293,7 +294,7 @@ ppb_peripheral_terminate(device_t bus, int how)
|
|||
}
|
||||
|
||||
/* Event 24 */
|
||||
ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN));
|
||||
ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN));
|
||||
|
||||
/* Event 25 - wait up to host response time (1s) */
|
||||
if ((error = do_peripheral_wait(bus, nBUSY, nBUSY))) {
|
||||
|
|
@ -302,17 +303,17 @@ ppb_peripheral_terminate(device_t bus, int how)
|
|||
}
|
||||
|
||||
/* Event 26 */
|
||||
ppb_wctr(bus, (SELECTIN | nINIT | STROBE) & ~(AUTOFEED));
|
||||
ppb_wctr(bus, (SELECTIN | nINIT | STROBE) & ~(AUTOFEED));
|
||||
DELAY(1);
|
||||
/* Event 27 */
|
||||
ppb_wctr(bus, (SELECTIN | nINIT) & ~(STROBE | AUTOFEED));
|
||||
ppb_wctr(bus, (SELECTIN | nINIT) & ~(STROBE | AUTOFEED));
|
||||
|
||||
/* Event 28 - wait up to host response time (1s) */
|
||||
if ((error = do_peripheral_wait(bus, nBUSY, 0))) {
|
||||
ppb_1284_set_error(bus, PPB_TIMEOUT, 28);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
error:
|
||||
ppb_set_mode(bus, PPB_COMPATIBLE);
|
||||
ppb_1284_set_state(bus, PPB_FORWARD_IDLE);
|
||||
|
|
@ -538,7 +539,7 @@ spp_1284_read(device_t bus, int mode, char *buffer, int max, int *read)
|
|||
case PPB_REVERSE_IDLE:
|
||||
terminate_after_transfer = 0;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
ppb_1284_terminate(bus);
|
||||
if ((error = ppb_1284_negociate(bus, mode, 0)))
|
||||
|
|
@ -689,9 +690,9 @@ ppb_1284_negociate(device_t bus, int mode, int options)
|
|||
|
||||
#ifdef PERIPH_1284
|
||||
/* request remote host attention */
|
||||
ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN));
|
||||
DELAY(1);
|
||||
ppb_wctr(bus, (nINIT) & ~(STROBE | AUTOFEED | SELECTIN));
|
||||
ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN));
|
||||
DELAY(1);
|
||||
ppb_wctr(bus, (nINIT) & ~(STROBE | AUTOFEED | SELECTIN));
|
||||
#else
|
||||
DELAY(1);
|
||||
|
||||
|
|
@ -701,14 +702,14 @@ ppb_1284_negociate(device_t bus, int mode, int options)
|
|||
ppb_wctr(bus, (nINIT | AUTOFEED) & ~(STROBE | SELECTIN));
|
||||
|
||||
#ifdef PERIPH_1284
|
||||
/* ignore the PError line, wait a bit more, remote host's
|
||||
/* ignore the PError line, wait a bit more, remote host's
|
||||
* interrupts don't respond fast enough */
|
||||
if (ppb_poll_bus(bus, 40, nACK | SELECT | nFAULT,
|
||||
SELECT | nFAULT, PPB_NOINTR | PPB_POLL)) {
|
||||
ppb_1284_set_error(bus, PPB_NOT_IEEE1284, 2);
|
||||
error = ENODEV;
|
||||
goto error;
|
||||
}
|
||||
ppb_1284_set_error(bus, PPB_NOT_IEEE1284, 2);
|
||||
error = ENODEV;
|
||||
goto error;
|
||||
}
|
||||
#else
|
||||
/* Event 2 - trying IEEE1284 dialog */
|
||||
if (do_1284_wait(bus, nACK | PERROR | SELECT | nFAULT,
|
||||
|
|
@ -770,11 +771,11 @@ ppb_1284_negociate(device_t bus, int mode, int options)
|
|||
#ifdef PERIPH_1284
|
||||
/* ignore PError line */
|
||||
if (do_1284_wait(bus, nACK | SELECT | nBUSY,
|
||||
nACK | SELECT | nBUSY)) {
|
||||
ppb_1284_set_error(bus, PPB_TIMEOUT, 30);
|
||||
error = ENODEV;
|
||||
goto error;
|
||||
}
|
||||
nACK | SELECT | nBUSY)) {
|
||||
ppb_1284_set_error(bus, PPB_TIMEOUT, 30);
|
||||
error = ENODEV;
|
||||
goto error;
|
||||
}
|
||||
#else
|
||||
if (do_1284_wait(bus, nACK | SELECT | PERROR | nBUSY,
|
||||
nACK | SELECT | PERROR | nBUSY)) {
|
||||
|
|
@ -824,8 +825,8 @@ ppb_1284_terminate(device_t bus)
|
|||
|
||||
#ifdef PERIPH_1284
|
||||
/* request remote host attention */
|
||||
ppb_wctr(bus, (nINIT | STROBE | SELECTIN) & ~(AUTOFEED));
|
||||
DELAY(1);
|
||||
ppb_wctr(bus, (nINIT | STROBE | SELECTIN) & ~(AUTOFEED));
|
||||
DELAY(1);
|
||||
#endif /* PERIPH_1284 */
|
||||
|
||||
/* Event 22 - set nSelectin low and nAutoFeed high */
|
||||
|
|
|
|||
|
|
@ -34,15 +34,15 @@ __FBSDID("$FreeBSD$");
|
|||
#include <sys/bus.h>
|
||||
|
||||
#include <dev/ppbus/ppbconf.h>
|
||||
|
||||
|
||||
#include "ppbus_if.h"
|
||||
|
||||
#include <dev/ppbus/ppbio.h>
|
||||
|
||||
|
||||
MODULE_VERSION(ppbus, 1);
|
||||
|
||||
#define DEVTOSOFTC(dev) ((struct ppb_data *)device_get_softc(dev))
|
||||
|
||||
|
||||
/*
|
||||
* ppb_poll_bus()
|
||||
*
|
||||
|
|
@ -133,7 +133,7 @@ ppb_set_mode(device_t bus, int mode)
|
|||
int old_mode = ppb_get_mode(bus);
|
||||
|
||||
if (PPBUS_SETMODE(device_get_parent(bus), mode))
|
||||
return -1;
|
||||
return (-1);
|
||||
|
||||
/* XXX yet device mode = ppbus mode = chipset mode */
|
||||
ppb->mode = (mode & PPB_MASK);
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ ppb_MS_init_msq(struct ppb_microseq *msq, int nbparam, ...)
|
|||
__func__, param);
|
||||
|
||||
#if 0
|
||||
printf("%s: param = %d, ins = %d, arg = %d, type = %d\n",
|
||||
printf("%s: param = %d, ins = %d, arg = %d, type = %d\n",
|
||||
__func__, param, ins, arg, type);
|
||||
#endif
|
||||
|
||||
|
|
@ -272,7 +272,7 @@ ppb_MS_microseq(device_t bus, device_t dev, struct ppb_microseq *msq, int *ret)
|
|||
|
||||
mi = msq;
|
||||
for (;;) {
|
||||
switch (mi->opcode) {
|
||||
switch (mi->opcode) {
|
||||
case MS_OP_PUT:
|
||||
case MS_OP_GET:
|
||||
|
||||
|
|
@ -315,11 +315,10 @@ ppb_MS_microseq(device_t bus, device_t dev, struct ppb_microseq *msq, int *ret)
|
|||
INCR_PC;
|
||||
break;
|
||||
|
||||
case MS_OP_RET:
|
||||
case MS_OP_RET:
|
||||
if (ret)
|
||||
*ret = mi->arg[0].i; /* return code */
|
||||
return (0);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* executing microinstructions at ppc level is
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ __FBSDID("$FreeBSD$");
|
|||
#include <dev/ppbus/ppb_1284.h>
|
||||
|
||||
#include "ppbus_if.h"
|
||||
|
||||
|
||||
#define DEVTOSOFTC(dev) ((struct ppb_data *)device_get_softc(dev))
|
||||
|
||||
|
||||
static MALLOC_DEFINE(M_PPBUSDEV, "ppbusdev", "Parallel Port bus device");
|
||||
|
||||
|
||||
|
|
@ -90,12 +90,12 @@ ppbus_add_child(device_t dev, int order, const char *name, int unit)
|
|||
{
|
||||
struct ppb_device *ppbdev;
|
||||
device_t child;
|
||||
|
||||
|
||||
/* allocate ivars for the new ppbus child */
|
||||
ppbdev = malloc(sizeof(struct ppb_device), M_PPBUSDEV,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (!ppbdev)
|
||||
return NULL;
|
||||
return (NULL);
|
||||
|
||||
/* initialize the ivars */
|
||||
ppbdev->name = name;
|
||||
|
|
@ -105,13 +105,13 @@ ppbus_add_child(device_t dev, int order, const char *name, int unit)
|
|||
child = device_add_child_ordered(dev, order, name, unit);
|
||||
device_set_ivars(child, ppbdev);
|
||||
|
||||
return child;
|
||||
return (child);
|
||||
}
|
||||
|
||||
static int
|
||||
ppbus_read_ivar(device_t bus, device_t dev, int index, uintptr_t* val)
|
||||
{
|
||||
|
||||
|
||||
switch (index) {
|
||||
case PPBUS_IVAR_MODE:
|
||||
/* XXX yet device mode = ppbus mode = chipset mode */
|
||||
|
|
@ -120,12 +120,12 @@ ppbus_read_ivar(device_t bus, device_t dev, int index, uintptr_t* val)
|
|||
default:
|
||||
return (ENOENT);
|
||||
}
|
||||
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ppbus_write_ivar(device_t bus, device_t dev, int index, u_long val)
|
||||
ppbus_write_ivar(device_t bus, device_t dev, int index, uintptr_t val)
|
||||
{
|
||||
|
||||
switch (index) {
|
||||
|
|
@ -208,7 +208,7 @@ ppb_pnp_detect(device_t bus)
|
|||
char str[PPB_PnP_STRING_SIZE+1];
|
||||
|
||||
device_printf(bus, "Probing for PnP devices:\n");
|
||||
|
||||
|
||||
if ((error = ppb_1284_read_id(bus, PPB_NIBBLE, str,
|
||||
PPB_PnP_STRING_SIZE, &len)))
|
||||
goto end_detect;
|
||||
|
|
@ -287,7 +287,7 @@ ppb_scan_bus(device_t bus)
|
|||
int error = 0;
|
||||
|
||||
/* try all IEEE1284 modes, for one device only
|
||||
*
|
||||
*
|
||||
* XXX We should implement the IEEE1284.3 standard to detect
|
||||
* daisy chained devices
|
||||
*/
|
||||
|
|
@ -384,7 +384,7 @@ ppbus_attach(device_t dev)
|
|||
ppb_scan_bus(dev);
|
||||
#endif /* !DONTPROBE_1284 */
|
||||
|
||||
/* launch attachement of the added children */
|
||||
/* launch attachment of the added children */
|
||||
bus_generic_attach(dev);
|
||||
|
||||
return (0);
|
||||
|
|
@ -393,8 +393,8 @@ ppbus_attach(device_t dev)
|
|||
static int
|
||||
ppbus_detach(device_t dev)
|
||||
{
|
||||
device_t *children;
|
||||
int error, nchildren, i;
|
||||
device_t *children;
|
||||
int error, nchildren, i;
|
||||
|
||||
error = bus_generic_detach(dev);
|
||||
if (error)
|
||||
|
|
@ -406,7 +406,7 @@ ppbus_detach(device_t dev)
|
|||
if (children[i])
|
||||
device_delete_child(dev, children[i]);
|
||||
free(children, M_TEMP);
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
@ -441,7 +441,7 @@ ppbus_teardown_intr(device_t bus, device_t child, struct resource *r, void *ih)
|
|||
{
|
||||
struct ppb_data *ppb = DEVTOSOFTC(bus);
|
||||
struct ppb_device *ppbdev = (struct ppb_device *)device_get_ivars(child);
|
||||
|
||||
|
||||
/* a device driver must own the bus to unregister an interrupt */
|
||||
if ((ppb->ppb_owner != child) || (ppbdev->intr_cookie != ih) ||
|
||||
(ppbdev->intr_resource != r))
|
||||
|
|
@ -469,7 +469,7 @@ ppb_request_bus(device_t bus, device_t dev, int how)
|
|||
struct ppb_device *ppbdev = (struct ppb_device *)device_get_ivars(dev);
|
||||
|
||||
while (!error) {
|
||||
s = splhigh();
|
||||
s = splhigh();
|
||||
if (ppb->ppb_owner) {
|
||||
splx(s);
|
||||
|
||||
|
|
@ -493,7 +493,7 @@ ppb_request_bus(device_t bus, device_t dev, int how)
|
|||
/* restore the context of the device
|
||||
* The first time, ctx.valid is certainly false
|
||||
* then do not change anything. This is usefull for
|
||||
* drivers that do not set there operating mode
|
||||
* drivers that do not set there operating mode
|
||||
* during attachement
|
||||
*/
|
||||
if (ppbdev->ctx.valid)
|
||||
|
|
@ -549,27 +549,27 @@ ppb_release_bus(device_t bus, device_t dev)
|
|||
static devclass_t ppbus_devclass;
|
||||
|
||||
static device_method_t ppbus_methods[] = {
|
||||
/* device interface */
|
||||
DEVMETHOD(device_probe, ppbus_probe),
|
||||
DEVMETHOD(device_attach, ppbus_attach),
|
||||
DEVMETHOD(device_detach, ppbus_detach),
|
||||
|
||||
/* bus interface */
|
||||
/* device interface */
|
||||
DEVMETHOD(device_probe, ppbus_probe),
|
||||
DEVMETHOD(device_attach, ppbus_attach),
|
||||
DEVMETHOD(device_detach, ppbus_detach),
|
||||
|
||||
/* bus interface */
|
||||
DEVMETHOD(bus_add_child, ppbus_add_child),
|
||||
DEVMETHOD(bus_print_child, ppbus_print_child),
|
||||
DEVMETHOD(bus_read_ivar, ppbus_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, ppbus_write_ivar),
|
||||
DEVMETHOD(bus_read_ivar, ppbus_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, ppbus_write_ivar),
|
||||
DEVMETHOD(bus_setup_intr, ppbus_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, ppbus_teardown_intr),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
|
||||
{ 0, 0 }
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t ppbus_driver = {
|
||||
"ppbus",
|
||||
ppbus_methods,
|
||||
sizeof(struct ppb_data),
|
||||
"ppbus",
|
||||
ppbus_methods,
|
||||
sizeof(struct ppb_data),
|
||||
};
|
||||
DRIVER_MODULE(ppbus, ppc, ppbus_driver, ppbus_devclass, 0, 0);
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ struct ppb_device {
|
|||
* IEEE1284 code is used */
|
||||
struct ppb_xfer
|
||||
put_xfer[PPB_MAX_XFER];
|
||||
|
||||
|
||||
struct resource *intr_resource;
|
||||
void *intr_cookie;
|
||||
};
|
||||
|
|
@ -206,10 +206,10 @@ struct ppb_device {
|
|||
/* EPP standards */
|
||||
#define EPP_1_9 0x0 /* default */
|
||||
#define EPP_1_7 0x1
|
||||
|
||||
|
||||
/* Parallel Port Chipset IVARS */ /* elsewhere XXX */
|
||||
#define PPC_IVAR_EPP_PROTO 0
|
||||
|
||||
|
||||
/*
|
||||
* Maximum size of the PnP info string
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ static void
|
|||
ppi_disable_intr(device_t ppidev)
|
||||
{
|
||||
char r;
|
||||
device_t ppbus = device_get_parent(ppidev);
|
||||
device_t ppbus = device_get_parent(ppidev);
|
||||
|
||||
r = ppb_rctr(ppbus);
|
||||
ppb_wctr(ppbus, r & ~IRQENABLE);
|
||||
|
|
@ -197,7 +197,7 @@ static void
|
|||
ppiintr(void *arg)
|
||||
{
|
||||
device_t ppidev = (device_t)arg;
|
||||
device_t ppbus = device_get_parent(ppidev);
|
||||
device_t ppbus = device_get_parent(ppidev);
|
||||
struct ppi_data *ppi = DEVTOSOFTC(ppidev);
|
||||
|
||||
ppi_disable_intr(ppidev);
|
||||
|
|
@ -256,7 +256,7 @@ ppiopen(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||
{
|
||||
struct ppi_data *ppi = dev->si_drv1;
|
||||
device_t ppidev = ppi->ppi_device;
|
||||
device_t ppbus = device_get_parent(ppidev);
|
||||
device_t ppbus = device_get_parent(ppidev);
|
||||
int res;
|
||||
|
||||
if (!(ppi->ppi_flags & HAVE_PPBUS)) {
|
||||
|
|
@ -270,7 +270,7 @@ ppiopen(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||
#ifdef PERIPH_1284
|
||||
if (ppi->intr_resource) {
|
||||
/* register our interrupt handler */
|
||||
bus_setup_intr(ppidev, ppi->intr_resource,
|
||||
bus_setup_intr(ppidev, ppi->intr_resource,
|
||||
INTR_TYPE_TTY, NULL, ppiintr, dev,
|
||||
&ppi->intr_cookie);
|
||||
}
|
||||
|
|
@ -286,7 +286,7 @@ ppiclose(struct cdev *dev, int flags, int fmt, struct thread *td)
|
|||
{
|
||||
struct ppi_data *ppi = dev->si_drv1;
|
||||
device_t ppidev = ppi->ppi_device;
|
||||
device_t ppbus = device_get_parent(ppidev);
|
||||
device_t ppbus = device_get_parent(ppidev);
|
||||
|
||||
ppi->ppi_count --;
|
||||
if (!ppi->ppi_count) {
|
||||
|
|
@ -328,7 +328,7 @@ ppiread(struct cdev *dev, struct uio *uio, int ioflag)
|
|||
#ifdef PERIPH_1284
|
||||
struct ppi_data *ppi = dev->si_drv1;
|
||||
device_t ppidev = ppi->ppi_device;
|
||||
device_t ppbus = device_get_parent(ppidev);
|
||||
device_t ppbus = device_get_parent(ppidev);
|
||||
int len, error = 0;
|
||||
|
||||
switch (ppb_1284_get_state(ppbus)) {
|
||||
|
|
@ -347,7 +347,7 @@ ppiread(struct cdev *dev, struct uio *uio, int ioflag)
|
|||
* time to terminate its interrupt
|
||||
*/
|
||||
tsleep(ppi, PPBPRI, "ppiread", 2*hz);
|
||||
|
||||
|
||||
if ((error = ppb_1284_negociate(ppbus,
|
||||
ppi->ppi_mode = PPB_BYTE, 0)))
|
||||
return (error);
|
||||
|
|
@ -411,7 +411,7 @@ ppiwrite(struct cdev *dev, struct uio *uio, int ioflag)
|
|||
#ifdef PERIPH_1284
|
||||
struct ppi_data *ppi = dev->si_drv1;
|
||||
device_t ppidev = ppi->ppi_device;
|
||||
device_t ppbus = device_get_parent(ppidev);
|
||||
device_t ppbus = device_get_parent(ppidev);
|
||||
int len, error = 0, sent;
|
||||
|
||||
#if 0
|
||||
|
|
@ -548,7 +548,7 @@ ppiioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t
|
|||
error = ENOTTY;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
*
|
||||
*/
|
||||
#ifndef __PPI_H
|
||||
#define __PPI_H
|
||||
#define __PPI_H
|
||||
|
||||
#ifndef _KERNEL
|
||||
# include <sys/types.h>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
*
|
||||
* This driver implements a draft-mogul-pps-api-02.txt PPS source.
|
||||
*
|
||||
* The input pin is pin#10
|
||||
* The input pin is pin#10
|
||||
* The echo output pin is pin#14
|
||||
*
|
||||
*/
|
||||
|
|
@ -256,7 +256,7 @@ ppshcpoll(void *arg)
|
|||
mtx_lock_spin(&sc->mtx);
|
||||
sc->timeout = timeout(ppshcpoll, sc, 1);
|
||||
i = ppb_rdtr(sc->ppbus);
|
||||
if (i == sc->lastdata)
|
||||
if (i == sc->lastdata)
|
||||
return;
|
||||
l = sc->lastdata ^ i;
|
||||
k = 1;
|
||||
|
|
@ -280,12 +280,12 @@ ppsintr(void *arg)
|
|||
pps_capture(&sc->pps[0]);
|
||||
if (!(ppb_rstr(sc->ppbus) & nACK))
|
||||
return (FILTER_STRAY);
|
||||
if (sc->pps[0].ppsparam.mode & PPS_ECHOASSERT)
|
||||
if (sc->pps[0].ppsparam.mode & PPS_ECHOASSERT)
|
||||
ppb_wctr(sc->ppbus, IRQENABLE | AUTOFEED);
|
||||
mtx_lock_spin(&sc->mtx);
|
||||
pps_event(&sc->pps[0], PPS_CAPTUREASSERT);
|
||||
mtx_unlock_spin(&sc->mtx);
|
||||
if (sc->pps[0].ppsparam.mode & PPS_ECHOASSERT)
|
||||
if (sc->pps[0].ppsparam.mode & PPS_ECHOASSERT)
|
||||
ppb_wctr(sc->ppbus, IRQENABLE);
|
||||
return (FILTER_HANDLED);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,29 +178,30 @@ vpo_attach(device_t dev)
|
|||
static void
|
||||
vpo_cam_rescan_callback(struct cam_periph *periph, union ccb *ccb)
|
||||
{
|
||||
free(ccb, M_TEMP);
|
||||
|
||||
free(ccb, M_TEMP);
|
||||
}
|
||||
|
||||
static void
|
||||
vpo_cam_rescan(struct vpo_data *vpo)
|
||||
{
|
||||
struct cam_path *path;
|
||||
union ccb *ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK | M_ZERO);
|
||||
struct cam_path *path;
|
||||
union ccb *ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK | M_ZERO);
|
||||
|
||||
if (xpt_create_path(&path, xpt_periph, cam_sim_path(vpo->sim), 0, 0)
|
||||
!= CAM_REQ_CMP) {
|
||||
if (xpt_create_path(&path, xpt_periph, cam_sim_path(vpo->sim), 0, 0)
|
||||
!= CAM_REQ_CMP) {
|
||||
/* A failure is benign as the user can do a manual rescan */
|
||||
free(ccb, M_TEMP);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
xpt_setup_ccb(&ccb->ccb_h, path, 5/*priority (low)*/);
|
||||
ccb->ccb_h.func_code = XPT_SCAN_BUS;
|
||||
ccb->ccb_h.cbfcnp = vpo_cam_rescan_callback;
|
||||
ccb->crcn.flags = CAM_FLAG_NONE;
|
||||
xpt_action(ccb);
|
||||
xpt_setup_ccb(&ccb->ccb_h, path, 5/*priority (low)*/);
|
||||
ccb->ccb_h.func_code = XPT_SCAN_BUS;
|
||||
ccb->ccb_h.cbfcnp = vpo_cam_rescan_callback;
|
||||
ccb->crcn.flags = CAM_FLAG_NONE;
|
||||
xpt_action(ccb);
|
||||
|
||||
/* The scan is in progress now. */
|
||||
/* The scan is in progress now. */
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -232,7 +233,7 @@ vpo_intr(struct vpo_data *vpo, struct ccb_scsiio *csio)
|
|||
}
|
||||
|
||||
#ifdef VP0_DEBUG
|
||||
printf("vpo_do_scsi = %d, status = 0x%x, count = %d, vpo_error = %d\n",
|
||||
printf("vpo_do_scsi = %d, status = 0x%x, count = %d, vpo_error = %d\n",
|
||||
errno, vpo->vpo_stat, vpo->vpo_count, vpo->vpo_error);
|
||||
|
||||
/* dump of command */
|
||||
|
|
@ -286,10 +287,10 @@ vpo_intr(struct vpo_data *vpo, struct ccb_scsiio *csio)
|
|||
&vpo->vpo_sense.stat, &vpo->vpo_sense.count,
|
||||
&vpo->vpo_error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef VP0_DEBUG
|
||||
printf("(sense) vpo_do_scsi = %d, status = 0x%x, count = %d, vpo_error = %d\n",
|
||||
printf("(sense) vpo_do_scsi = %d, status = 0x%x, count = %d, vpo_error = %d\n",
|
||||
errno, vpo->vpo_sense.stat, vpo->vpo_sense.count, vpo->vpo_error);
|
||||
#endif
|
||||
|
||||
|
|
@ -313,7 +314,7 @@ vpo_intr(struct vpo_data *vpo, struct ccb_scsiio *csio)
|
|||
}
|
||||
} else {
|
||||
/* no sense */
|
||||
csio->ccb_h.status = CAM_SCSI_STATUS_ERROR;
|
||||
csio->ccb_h.status = CAM_SCSI_STATUS_ERROR;
|
||||
}
|
||||
|
||||
goto error;
|
||||
|
|
@ -345,7 +346,7 @@ vpo_action(struct cam_sim *sim, union ccb *ccb)
|
|||
device_printf(vpo->vpo_dev, "XPT_SCSI_IO (0x%x) request\n",
|
||||
csio->cdb_io.cdb_bytes[0]);
|
||||
#endif
|
||||
|
||||
|
||||
vpo_intr(vpo, csio);
|
||||
|
||||
xpt_done(ccb);
|
||||
|
|
@ -404,7 +405,7 @@ vpo_action(struct cam_sim *sim, union ccb *ccb)
|
|||
case XPT_PATH_INQ: /* Path routing inquiry */
|
||||
{
|
||||
struct ccb_pathinq *cpi = &ccb->cpi;
|
||||
|
||||
|
||||
#ifdef VP0_DEBUG
|
||||
device_printf(vpo->vpo_dev, "XPT_PATH_INQ request\n");
|
||||
#endif
|
||||
|
|
@ -438,9 +439,9 @@ vpo_action(struct cam_sim *sim, union ccb *ccb)
|
|||
|
||||
static void
|
||||
vpo_poll(struct cam_sim *sim)
|
||||
{
|
||||
/* The ZIP is actually always polled throw vpo_action() */
|
||||
return;
|
||||
{
|
||||
|
||||
/* The ZIP is actually always polled throw vpo_action(). */
|
||||
}
|
||||
|
||||
static devclass_t vpo_devclass;
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ static struct ppb_microseq ps2_inbyte_submicroseq[] = {
|
|||
static struct ppb_microseq spp_outbyte_submicroseq[] = {
|
||||
|
||||
/* loop: */
|
||||
MS_RASSERT_P(1, MS_REG_DTR),
|
||||
MS_RASSERT_P(1, MS_REG_DTR),
|
||||
MS_CASS(H_nAUTO | H_nSELIN | H_INIT | H_STROBE),
|
||||
MS_CASS( H_AUTO | H_nSELIN | H_INIT | H_STROBE),
|
||||
MS_DELAY(VP0_PULSE),
|
||||
|
|
@ -233,7 +233,7 @@ static struct ppb_microseq epp17_outstr_body[] = {
|
|||
MS_CASS(H_AUTO | H_SELIN | H_INIT | H_STROBE),
|
||||
|
||||
/* loop: */
|
||||
MS_RASSERT_P(1, MS_REG_EPP_D),
|
||||
MS_RASSERT_P(1, MS_REG_EPP_D),
|
||||
MS_BRSET(TIMEOUT, 3 /* error */), /* EPP timeout? */
|
||||
MS_DBRA(-3 /* loop */),
|
||||
|
||||
|
|
@ -248,7 +248,7 @@ static struct ppb_microseq epp17_instr_body[] = {
|
|||
MS_CASS(PCD | H_AUTO | H_SELIN | H_INIT | H_STROBE),
|
||||
|
||||
/* loop: */
|
||||
MS_RFETCH_P(1, MS_REG_EPP_D, MS_FETCH_ALL),
|
||||
MS_RFETCH_P(1, MS_REG_EPP_D, MS_FETCH_ALL),
|
||||
MS_BRSET(TIMEOUT, 3 /* error */), /* EPP timeout? */
|
||||
MS_DBRA(-3 /* loop */),
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ vpoio_connect(struct vpoio_data *vpo, int how)
|
|||
#ifdef VP0_DEBUG
|
||||
printf("%s: can't request bus!\n", __func__);
|
||||
#endif
|
||||
return error;
|
||||
return (error);
|
||||
}
|
||||
|
||||
if (PPB_IN_EPP_MODE(ppbus))
|
||||
|
|
@ -314,7 +314,7 @@ vpoio_connect(struct vpoio_data *vpo, int how)
|
|||
* SCSI reset signal, the drive must be in disk mode
|
||||
*/
|
||||
static void
|
||||
vpoio_reset (struct vpoio_data *vpo)
|
||||
vpoio_reset(struct vpoio_data *vpo)
|
||||
{
|
||||
device_t ppbus = device_get_parent(vpo->vpo_dev);
|
||||
int ret;
|
||||
|
|
@ -363,7 +363,7 @@ vpoio_detect(struct vpoio_data *vpo)
|
|||
|
||||
/* allocate the bus, then apply microsequences */
|
||||
if ((error = ppb_request_bus(ppbus, vpo->vpo_dev, PPB_DONTWAIT)))
|
||||
return (error);
|
||||
return (error);
|
||||
|
||||
/* Force disconnection */
|
||||
ppb_MS_microseq(ppbus, vpo->vpo_dev, disconnect_microseq, &ret);
|
||||
|
|
@ -416,7 +416,7 @@ vpoio_detect(struct vpoio_data *vpo)
|
|||
|
||||
ppb_MS_microseq(ppbus, vpo->vpo_dev, disconnect_microseq, &ret);
|
||||
|
||||
/* ensure we are disconnected or daisy chained peripheral
|
||||
/* ensure we are disconnected or daisy chained peripheral
|
||||
* may cause serious problem to the disk */
|
||||
if (vpoio_in_disk_mode(vpo)) {
|
||||
if (bootverbose)
|
||||
|
|
@ -499,7 +499,7 @@ vpoio_select(struct vpoio_data *vpo, int initiator, int target)
|
|||
ppb_MS_init_msq(select_microseq, 2,
|
||||
SELECT_TARGET, 1 << target,
|
||||
SELECT_INITIATOR, 1 << initiator);
|
||||
|
||||
|
||||
ppb_MS_microseq(ppbus, vpo->vpo_dev, select_microseq, &ret);
|
||||
|
||||
if (ret)
|
||||
|
|
@ -545,7 +545,7 @@ vpoio_wait(struct vpoio_data *vpo, int tmo)
|
|||
ppb_MS_microseq(ppbus, vpo->vpo_dev, wait_microseq, &err);
|
||||
|
||||
if (err)
|
||||
return (0); /* command timed out */
|
||||
return (0); /* command timed out */
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
|
@ -586,7 +586,7 @@ vpoio_probe(device_t dev, struct vpoio_data *vpo)
|
|||
int
|
||||
vpoio_attach(struct vpoio_data *vpo)
|
||||
{
|
||||
DECLARE_NIBBLE_INBYTE_SUBMICROSEQ;
|
||||
DECLARE_NIBBLE_INBYTE_SUBMICROSEQ;
|
||||
device_t ppbus = device_get_parent(vpo->vpo_dev);
|
||||
int error = 0;
|
||||
|
||||
|
|
@ -604,7 +604,7 @@ vpoio_attach(struct vpoio_data *vpo)
|
|||
INB_NIBBLE_H, (void *)&(vpo)->vpo_nibble.h,
|
||||
INB_NIBBLE_L, (void *)&(vpo)->vpo_nibble.l,
|
||||
INB_NIBBLE_F, nibble_inbyte_hook,
|
||||
INB_NIBBLE_P, (void *)&(vpo)->vpo_nibble);
|
||||
INB_NIBBLE_P, (void *)&(vpo)->vpo_nibble);
|
||||
|
||||
/*
|
||||
* Initialize mode dependent in/out microsequences
|
||||
|
|
@ -672,7 +672,7 @@ vpoio_reset_bus(struct vpoio_data *vpo)
|
|||
* Send an SCSI command
|
||||
*
|
||||
*/
|
||||
int
|
||||
int
|
||||
vpoio_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
|
||||
int clen, char *buffer, int blen, int *result, int *count,
|
||||
int *ret)
|
||||
|
|
@ -695,7 +695,8 @@ vpoio_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
|
|||
return (error);
|
||||
|
||||
if (!vpoio_in_disk_mode(vpo)) {
|
||||
*ret = VP0_ECONNECT; goto error;
|
||||
*ret = VP0_ECONNECT;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((*ret = vpoio_select(vpo,host,target)))
|
||||
|
|
@ -719,15 +720,16 @@ vpoio_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Completion ...
|
||||
/*
|
||||
* Completion ...
|
||||
*/
|
||||
|
||||
*count = 0;
|
||||
for (;;) {
|
||||
|
||||
if (!(r = vpoio_wait(vpo, VP0_LOW_SPINTMO))) {
|
||||
*ret = VP0_ESTATUS_TIMEOUT; goto error;
|
||||
*ret = VP0_ESTATUS_TIMEOUT;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* stop when the ZIP wants to send status */
|
||||
|
|
@ -763,13 +765,15 @@ vpoio_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,
|
|||
}
|
||||
|
||||
if (vpoio_instr(vpo, &l, 1)) {
|
||||
*ret = VP0_EOTHER; goto error;
|
||||
*ret = VP0_EOTHER;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* check if the ZIP wants to send more status */
|
||||
if (vpoio_wait(vpo, VP0_FAST_SPINTMO) == (char)0xf0)
|
||||
if (vpoio_instr(vpo, &h, 1)) {
|
||||
*ret = VP0_EOTHER+2; goto error;
|
||||
*ret = VP0_EOTHER + 2;
|
||||
goto error;
|
||||
}
|
||||
|
||||
*result = ((int) h << 8) | ((int) l & 0xff);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
#define VP0_ECMD_TIMEOUT 2
|
||||
#define VP0_ECONNECT 3
|
||||
#define VP0_ESTATUS_TIMEOUT 4
|
||||
#define VP0_EDATA_OVERFLOW 5
|
||||
#define VP0_EDATA_OVERFLOW 5
|
||||
#define VP0_EDISCONNECT 6
|
||||
#define VP0_EPPDATA_TIMEOUT 7
|
||||
#define VP0_ENEGOCIATE 8
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
|
|||
#include <sys/module.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
|
@ -114,8 +114,8 @@ static char *ppc_epp_protocol[] = { " (EPP 1.9)", " (EPP 1.7)", 0 };
|
|||
* ppc_ecp_sync() XXX
|
||||
*/
|
||||
void
|
||||
ppc_ecp_sync(device_t dev) {
|
||||
|
||||
ppc_ecp_sync(device_t dev)
|
||||
{
|
||||
int i, r;
|
||||
struct ppc_data *ppc = DEVTOSOFTC(dev);
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ ppc_detect_fifo(struct ppc_data *ppc)
|
|||
char ecr_sav;
|
||||
char ctr_sav, ctr, cc;
|
||||
short i;
|
||||
|
||||
|
||||
/* save registers */
|
||||
ecr_sav = r_ecr(ppc);
|
||||
ctr_sav = r_ctr(ppc);
|
||||
|
|
@ -236,7 +236,7 @@ ppc_detect_fifo(struct ppc_data *ppc)
|
|||
LOG_PPC(__func__, ppc, "can't empty the FIFO");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
w_ctr(ppc, ctr_sav);
|
||||
w_ecr(ppc, ecr_sav);
|
||||
|
||||
|
|
@ -407,9 +407,9 @@ ppc_pc873xx_detect(struct ppc_data *ppc, int chipset_mode) /* XXX mode never for
|
|||
static int index = 0;
|
||||
int idport, irq;
|
||||
int ptr, pcr, val, i;
|
||||
|
||||
|
||||
while ((idport = pc873xx_basetab[index++])) {
|
||||
|
||||
|
||||
/* XXX should check first to see if this location is already claimed */
|
||||
|
||||
/*
|
||||
|
|
@ -456,7 +456,7 @@ ppc_pc873xx_detect(struct ppc_data *ppc, int chipset_mode) /* XXX mode never for
|
|||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* We think we have one. Is it enabled and where we want it to be?
|
||||
*/
|
||||
|
|
@ -513,7 +513,7 @@ ppc_pc873xx_detect(struct ppc_data *ppc, int chipset_mode) /* XXX mode never for
|
|||
}
|
||||
|
||||
outb(idport, PC873_PTR);
|
||||
ptr = inb(idport + 1);
|
||||
ptr = inb(idport + 1);
|
||||
|
||||
/* get irq settings */
|
||||
if (ppc->ppc_base == 0x378)
|
||||
|
|
@ -523,7 +523,7 @@ ppc_pc873xx_detect(struct ppc_data *ppc, int chipset_mode) /* XXX mode never for
|
|||
|
||||
if (bootverbose)
|
||||
printf("PC873xx irq %d at 0x%x\n", irq, ppc->ppc_base);
|
||||
|
||||
|
||||
/*
|
||||
* Check if irq settings are correct
|
||||
*/
|
||||
|
|
@ -553,7 +553,7 @@ ppc_pc873xx_detect(struct ppc_data *ppc, int chipset_mode) /* XXX mode never for
|
|||
|
||||
outb(idport, PC873_PCR);
|
||||
pcr = inb(idport + 1);
|
||||
|
||||
|
||||
if ((ptr & PC873_CFGLOCK) || !chipset_mode) {
|
||||
if (bootverbose)
|
||||
printf("PC873xx %s", (ptr & PC873_CFGLOCK)?"locked":"unlocked");
|
||||
|
|
@ -563,7 +563,7 @@ ppc_pc873xx_detect(struct ppc_data *ppc, int chipset_mode) /* XXX mode never for
|
|||
printf(", NIBBLE");
|
||||
|
||||
if (pcr & PC873_EPPEN) {
|
||||
ppc->ppc_avm |= PPB_EPP;
|
||||
ppc->ppc_avm |= PPB_EPP;
|
||||
|
||||
if (bootverbose)
|
||||
printf(", EPP");
|
||||
|
|
@ -596,8 +596,8 @@ ppc_pc873xx_detect(struct ppc_data *ppc, int chipset_mode) /* XXX mode never for
|
|||
ptr = inb(idport + 1);
|
||||
if (ptr & PC873_EXTENDED) {
|
||||
ppc->ppc_avm |= PPB_SPP;
|
||||
if (bootverbose)
|
||||
printf(", SPP");
|
||||
if (bootverbose)
|
||||
printf(", SPP");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -652,7 +652,7 @@ ppc_pc873xx_detect(struct ppc_data *ppc, int chipset_mode) /* XXX mode never for
|
|||
|
||||
if (bootverbose)
|
||||
printf(", PS/2");
|
||||
|
||||
|
||||
} else {
|
||||
/* default to NIBBLE mode */
|
||||
ptr &= ~PC873_EXTENDED;
|
||||
|
|
@ -699,7 +699,7 @@ ppc_smc37c66xgt_detect(struct ppc_data *ppc, int chipset_mode)
|
|||
/*
|
||||
* Detection: enter configuration mode and read CRD register.
|
||||
*/
|
||||
|
||||
|
||||
s = splhigh();
|
||||
outb(csr, SMC665_iCODE);
|
||||
outb(csr, SMC665_iCODE);
|
||||
|
|
@ -914,7 +914,7 @@ ppc_smc37c935_detect(struct ppc_data *ppc, int chipset_mode)
|
|||
ppc->ppc_model = type;
|
||||
|
||||
outb(SMC935_IND, SMC935_LOGDEV); /* select parallel port, */
|
||||
outb(SMC935_DAT, 3); /* which is logical device 3 */
|
||||
outb(SMC935_DAT, 3); /* which is logical device 3 */
|
||||
|
||||
/* set io port base */
|
||||
outb(SMC935_IND, SMC935_PORTHI);
|
||||
|
|
@ -983,7 +983,7 @@ ppc_smc37c935_detect(struct ppc_data *ppc, int chipset_mode)
|
|||
#define efdr ((efer == 0x250) ? 0x252 : 0x3f1)
|
||||
|
||||
static int w83877f_efers[] = { 0x250, 0x3f0, 0x3f0, 0x250 };
|
||||
static int w83877f_keys[] = { 0x89, 0x86, 0x87, 0x88 };
|
||||
static int w83877f_keys[] = { 0x89, 0x86, 0x87, 0x88 };
|
||||
static int w83877f_keyiter[] = { 1, 2, 2, 1 };
|
||||
static int w83877f_hefs[] = { WINB_HEFERE, WINB_HEFRAS, WINB_HEFERE | WINB_HEFRAS, 0 };
|
||||
|
||||
|
|
@ -1322,14 +1322,14 @@ ppc_exec_microseq(device_t dev, struct ppb_microseq **p_msq)
|
|||
|
||||
mi = *p_msq;
|
||||
for (;;) {
|
||||
switch (mi->opcode) {
|
||||
switch (mi->opcode) {
|
||||
case MS_OP_RSET:
|
||||
cc = r_reg(mi->arg[0].i, ppc);
|
||||
cc &= (char)mi->arg[2].i; /* clear mask */
|
||||
cc |= (char)mi->arg[1].i; /* assert mask */
|
||||
w_reg(mi->arg[0].i, ppc, cc);
|
||||
w_reg(mi->arg[0].i, ppc, cc);
|
||||
INCR_PC;
|
||||
break;
|
||||
break;
|
||||
|
||||
case MS_OP_RASSERT_P:
|
||||
reg = mi->arg[1].i;
|
||||
|
|
@ -1348,7 +1348,7 @@ ppc_exec_microseq(device_t dev, struct ppb_microseq **p_msq)
|
|||
INCR_PC;
|
||||
break;
|
||||
|
||||
case MS_OP_RFETCH_P:
|
||||
case MS_OP_RFETCH_P:
|
||||
reg = mi->arg[1].i;
|
||||
mask = (char)mi->arg[2].i;
|
||||
ptr = ppc->ppc_ptr;
|
||||
|
|
@ -1364,17 +1364,17 @@ ppc_exec_microseq(device_t dev, struct ppb_microseq **p_msq)
|
|||
ppc->ppc_ptr = ptr;
|
||||
|
||||
INCR_PC;
|
||||
break;
|
||||
break;
|
||||
|
||||
case MS_OP_RFETCH:
|
||||
case MS_OP_RFETCH:
|
||||
*((char *) mi->arg[2].p) = r_reg(mi->arg[0].i, ppc) &
|
||||
(char)mi->arg[1].i;
|
||||
INCR_PC;
|
||||
break;
|
||||
break;
|
||||
|
||||
case MS_OP_RASSERT:
|
||||
case MS_OP_DELAY:
|
||||
|
||||
case MS_OP_DELAY:
|
||||
|
||||
/* let's suppose the next instr. is the same */
|
||||
prefetch:
|
||||
for (;mi->opcode == MS_OP_RASSERT; INCR_PC)
|
||||
|
|
@ -1406,30 +1406,30 @@ ppc_exec_microseq(device_t dev, struct ppb_microseq **p_msq)
|
|||
INCR_PC;
|
||||
break;
|
||||
|
||||
case MS_OP_SET:
|
||||
ppc->ppc_accum = mi->arg[0].i;
|
||||
case MS_OP_SET:
|
||||
ppc->ppc_accum = mi->arg[0].i;
|
||||
INCR_PC;
|
||||
break;
|
||||
break;
|
||||
|
||||
case MS_OP_DBRA:
|
||||
if (--ppc->ppc_accum > 0)
|
||||
mi += mi->arg[0].i;
|
||||
case MS_OP_DBRA:
|
||||
if (--ppc->ppc_accum > 0)
|
||||
mi += mi->arg[0].i;
|
||||
INCR_PC;
|
||||
break;
|
||||
break;
|
||||
|
||||
case MS_OP_BRSET:
|
||||
cc = r_str(ppc);
|
||||
if ((cc & (char)mi->arg[0].i) == (char)mi->arg[0].i)
|
||||
mi += mi->arg[1].i;
|
||||
case MS_OP_BRSET:
|
||||
cc = r_str(ppc);
|
||||
if ((cc & (char)mi->arg[0].i) == (char)mi->arg[0].i)
|
||||
mi += mi->arg[1].i;
|
||||
INCR_PC;
|
||||
break;
|
||||
break;
|
||||
|
||||
case MS_OP_BRCLEAR:
|
||||
cc = r_str(ppc);
|
||||
if ((cc & (char)mi->arg[0].i) == 0)
|
||||
mi += mi->arg[1].i;
|
||||
case MS_OP_BRCLEAR:
|
||||
cc = r_str(ppc);
|
||||
if ((cc & (char)mi->arg[0].i) == 0)
|
||||
mi += mi->arg[1].i;
|
||||
INCR_PC;
|
||||
break;
|
||||
break;
|
||||
|
||||
case MS_OP_BRSTAT:
|
||||
cc = r_str(ppc);
|
||||
|
|
@ -1484,9 +1484,9 @@ ppc_exec_microseq(device_t dev, struct ppb_microseq **p_msq)
|
|||
INCR_PC;
|
||||
break;
|
||||
|
||||
case MS_OP_PUT:
|
||||
case MS_OP_GET:
|
||||
case MS_OP_RET:
|
||||
case MS_OP_PUT:
|
||||
case MS_OP_GET:
|
||||
case MS_OP_RET:
|
||||
/* can't return to ppb level during the execution
|
||||
* of a submicrosequence */
|
||||
if (stack)
|
||||
|
|
@ -1499,10 +1499,10 @@ ppc_exec_microseq(device_t dev, struct ppb_microseq **p_msq)
|
|||
/* return to ppb level of execution */
|
||||
return (0);
|
||||
|
||||
default:
|
||||
panic("%s: unknown microsequence opcode 0x%x",
|
||||
__func__, mi->opcode);
|
||||
}
|
||||
default:
|
||||
panic("%s: unknown microsequence opcode 0x%x",
|
||||
__func__, mi->opcode);
|
||||
}
|
||||
}
|
||||
|
||||
/* unreached */
|
||||
|
|
@ -1605,7 +1605,7 @@ void
|
|||
ppc_reset_epp(device_t dev)
|
||||
{
|
||||
struct ppc_data *ppc = DEVTOSOFTC(dev);
|
||||
|
||||
|
||||
ppc_reset_epp_timeout(ppc);
|
||||
|
||||
return;
|
||||
|
|
@ -1668,19 +1668,18 @@ ppc_probe(device_t dev, int rid)
|
|||
next_bios_ppc += 1;
|
||||
if (bootverbose)
|
||||
device_printf(dev,
|
||||
"parallel port found at 0x%x\n",
|
||||
(int) port);
|
||||
"parallel port found at 0x%lx\n", port);
|
||||
}
|
||||
#else
|
||||
if((next_bios_ppc < BIOS_MAX_PPC) &&
|
||||
(*(BIOS_PORTS+next_bios_ppc) != 0) ) {
|
||||
port = *(BIOS_PORTS+next_bios_ppc++);
|
||||
if ((next_bios_ppc < BIOS_MAX_PPC) &&
|
||||
(*(BIOS_PORTS + next_bios_ppc) != 0)) {
|
||||
port = *(BIOS_PORTS + next_bios_ppc++);
|
||||
if (bootverbose)
|
||||
device_printf(dev, "parallel port found at 0x%x\n",
|
||||
(int) port);
|
||||
device_printf(dev,
|
||||
"parallel port found at 0x%lx\n", port);
|
||||
} else {
|
||||
device_printf(dev, "parallel port not found.\n");
|
||||
return ENXIO;
|
||||
return (ENXIO);
|
||||
}
|
||||
#endif /* PC98 */
|
||||
bus_set_resource(dev, SYS_RES_IOPORT, rid, port,
|
||||
|
|
@ -1804,7 +1803,7 @@ ppc_attach(device_t dev)
|
|||
ppc_models[ppc->ppc_model], ppc_avms[ppc->ppc_avm],
|
||||
ppc_modes[ppc->ppc_mode], (PPB_IS_EPP(ppc->ppc_mode)) ?
|
||||
ppc_epp_protocol[ppc->ppc_epp] : "");
|
||||
|
||||
|
||||
if (ppc->ppc_fifo)
|
||||
device_printf(dev, "FIFO with %d/%d/%d bytes threshold\n",
|
||||
ppc->ppc_fifo, ppc->ppc_wthr, ppc->ppc_rthr);
|
||||
|
|
@ -1884,6 +1883,7 @@ u_char
|
|||
ppc_io(device_t ppcdev, int iop, u_char *addr, int cnt, u_char byte)
|
||||
{
|
||||
struct ppc_data *ppc = DEVTOSOFTC(ppcdev);
|
||||
|
||||
switch (iop) {
|
||||
case PPB_OUTSB_EPP:
|
||||
bus_write_multi_1(ppc->res_ioport, PPC_EPP_DATA, addr, cnt);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
|
|||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <isa/isareg.h>
|
||||
|
|
|
|||
Loading…
Reference in a new issue