Misc cleanup:
- ANSI function decls - remove __P() - u_intNN_t -> uintNN_t - remove register decls - bcopy -> memcpy, strcpy - bzero -> memset - bcmp -> memcmp - use malloc(9) with M_ZERO - some KNF etc.
This commit is contained in:
parent
00b2fb8253
commit
fd4afa037b
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: apbus.c,v 1.17 2003/07/15 02:59:28 lukem Exp $ */
|
||||
/* $NetBSD: apbus.c,v 1.18 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.17 2003/07/15 02:59:28 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.18 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -44,27 +44,29 @@ __KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.17 2003/07/15 02:59:28 lukem Exp $");
|
|||
#include <machine/intr.h>
|
||||
#include <newsmips/apbus/apbusvar.h>
|
||||
|
||||
static int apbusmatch (struct device *, struct cfdata *, void *);
|
||||
static void apbusattach (struct device *, struct device *, void *);
|
||||
static int apbusprint (void *, const char *);
|
||||
/* static void *aptokseg0 (void *); */
|
||||
static void apbus_dma_unmapped (bus_dma_tag_t, bus_dmamap_t);
|
||||
static int apbus_dma_mapalloc (bus_dma_tag_t, bus_dmamap_t, int);
|
||||
static void apbus_dma_mapfree (bus_dma_tag_t, bus_dmamap_t);
|
||||
static void apbus_dma_mapset (bus_dma_tag_t, bus_dmamap_t);
|
||||
static int apbus_dmamap_create (bus_dma_tag_t, bus_size_t, int, bus_size_t,
|
||||
bus_size_t, int, bus_dmamap_t *);
|
||||
static void apbus_dmamap_destroy (bus_dma_tag_t, bus_dmamap_t);
|
||||
static int apbus_dmamap_load (bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t,
|
||||
struct proc *, int);
|
||||
static int apbus_dmamap_load_mbuf (bus_dma_tag_t, bus_dmamap_t, struct mbuf *,
|
||||
int);
|
||||
static int apbus_dmamap_load_uio (bus_dma_tag_t, bus_dmamap_t, struct uio *,
|
||||
int);
|
||||
static int apbus_dmamap_load_raw (bus_dma_tag_t, bus_dmamap_t,
|
||||
bus_dma_segment_t *, int, bus_size_t, int);
|
||||
static void apbus_dmamap_sync (bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
|
||||
bus_size_t, int);
|
||||
static int apbusmatch(struct device *, struct cfdata *, void *);
|
||||
static void apbusattach(struct device *, struct device *, void *);
|
||||
static int apbusprint(void *, const char *);
|
||||
#if 0
|
||||
static void *aptokseg0 (void *);
|
||||
#endif
|
||||
static void apbus_dma_unmapped(bus_dma_tag_t, bus_dmamap_t);
|
||||
static int apbus_dma_mapalloc(bus_dma_tag_t, bus_dmamap_t, int);
|
||||
static void apbus_dma_mapfree(bus_dma_tag_t, bus_dmamap_t);
|
||||
static void apbus_dma_mapset(bus_dma_tag_t, bus_dmamap_t);
|
||||
static int apbus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
|
||||
bus_size_t, int, bus_dmamap_t *);
|
||||
static void apbus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
|
||||
static int apbus_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t,
|
||||
struct proc *, int);
|
||||
static int apbus_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t, struct mbuf *,
|
||||
int);
|
||||
static int apbus_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t, struct uio *,
|
||||
int);
|
||||
static int apbus_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
|
||||
bus_dma_segment_t *, int, bus_size_t, int);
|
||||
static void apbus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
|
||||
bus_size_t, int);
|
||||
|
||||
#define MAXAPDEVNUM 32
|
||||
|
||||
|
@ -79,10 +81,7 @@ CFATTACH_DECL(ap, sizeof(struct apbus_softc),
|
|||
static struct newsmips_intr apintr_tab[NLEVEL];
|
||||
|
||||
static int
|
||||
apbusmatch(parent, cfdata, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cfdata;
|
||||
void *aux;
|
||||
apbusmatch(struct device *parent, struct cfdata *cfdata, void *aux)
|
||||
{
|
||||
struct confargs *ca = aux;
|
||||
|
||||
|
@ -94,10 +93,7 @@ apbusmatch(parent, cfdata, aux)
|
|||
|
||||
|
||||
static void
|
||||
apbusattach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
apbusattach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct apbus_attach_args child;
|
||||
struct apbus_dev *apdev;
|
||||
|
@ -154,9 +150,7 @@ apbusattach(parent, self, aux)
|
|||
}
|
||||
|
||||
int
|
||||
apbusprint(aux, pnp)
|
||||
void *aux;
|
||||
const char *pnp;
|
||||
apbusprint(void *aux, const char *pnp)
|
||||
{
|
||||
struct apbus_attach_args *a = aux;
|
||||
|
||||
|
@ -185,7 +179,7 @@ aptokseg0(va)
|
|||
#endif
|
||||
|
||||
void
|
||||
apbus_wbflush()
|
||||
apbus_wbflush(void)
|
||||
{
|
||||
volatile int *wbflush = (int *)NEWS5000_WBFLUSH;
|
||||
|
||||
|
@ -196,9 +190,7 @@ apbus_wbflush()
|
|||
* called by hardware interrupt routine
|
||||
*/
|
||||
int
|
||||
apbus_intr_dispatch(level, stat)
|
||||
int level;
|
||||
int stat;
|
||||
apbus_intr_dispatch(int level, int stat)
|
||||
{
|
||||
struct newsmips_intr *ip;
|
||||
struct newsmips_intrhand *ih;
|
||||
|
@ -218,18 +210,12 @@ apbus_intr_dispatch(level, stat)
|
|||
* register device interrupt routine
|
||||
*/
|
||||
void *
|
||||
apbus_intr_establish(level, mask, priority, func, arg, name, ctlno)
|
||||
int level;
|
||||
int mask;
|
||||
int priority;
|
||||
int (*func) (void *);
|
||||
void *arg;
|
||||
char *name;
|
||||
int ctlno;
|
||||
apbus_intr_establish(int level, int mask, int priority, int (*func)(void *),
|
||||
void *arg, char *name, int ctlno)
|
||||
{
|
||||
struct newsmips_intr *ip;
|
||||
struct newsmips_intrhand *ih, *curih;
|
||||
volatile u_int32_t *inten0, *inten1;
|
||||
volatile uint32_t *inten0, *inten1;
|
||||
|
||||
ip = &apintr_tab[level];
|
||||
|
||||
|
@ -260,11 +246,11 @@ apbus_intr_establish(level, mask, priority, func, arg, name, ctlno)
|
|||
done:
|
||||
switch (level) {
|
||||
case 0:
|
||||
inten0 = (volatile u_int32_t *)NEWS5000_INTEN0;
|
||||
inten0 = (volatile uint32_t *)NEWS5000_INTEN0;
|
||||
*inten0 |= mask;
|
||||
break;
|
||||
case 1:
|
||||
inten1 = (volatile u_int32_t *)NEWS5000_INTEN1;
|
||||
inten1 = (volatile uint32_t *)NEWS5000_INTEN1;
|
||||
*inten1 |= mask;
|
||||
break;
|
||||
}
|
||||
|
@ -273,9 +259,7 @@ apbus_intr_establish(level, mask, priority, func, arg, name, ctlno)
|
|||
}
|
||||
|
||||
static void
|
||||
apbus_dma_unmapped(t, map)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
apbus_dma_unmapped(bus_dma_tag_t t, bus_dmamap_t map)
|
||||
{
|
||||
int seg;
|
||||
|
||||
|
@ -297,10 +281,7 @@ apbus_dma_unmapped(t, map)
|
|||
static u_char apbus_dma_maptbl[APBUS_NDMAMAP];
|
||||
|
||||
static int
|
||||
apbus_dma_mapalloc(t, map, flags)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
int flags;
|
||||
apbus_dma_mapalloc(bus_dma_tag_t t, bus_dmamap_t map, int flags)
|
||||
{
|
||||
int i, j, cnt;
|
||||
|
||||
|
@ -328,9 +309,7 @@ apbus_dma_mapalloc(t, map, flags)
|
|||
}
|
||||
|
||||
static void
|
||||
apbus_dma_mapfree(t, map)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
apbus_dma_mapfree(bus_dma_tag_t t, bus_dmamap_t map)
|
||||
{
|
||||
int i, n;
|
||||
|
||||
|
@ -350,9 +329,7 @@ apbus_dma_mapfree(t, map)
|
|||
}
|
||||
|
||||
static void
|
||||
apbus_dma_mapset(t, map)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
apbus_dma_mapset(bus_dma_tag_t t, bus_dmamap_t map)
|
||||
{
|
||||
int i;
|
||||
bus_addr_t addr, eaddr;
|
||||
|
@ -380,14 +357,8 @@ apbus_dma_mapset(t, map)
|
|||
}
|
||||
|
||||
static int
|
||||
apbus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
|
||||
bus_dma_tag_t t;
|
||||
bus_size_t size;
|
||||
int nsegments;
|
||||
bus_size_t maxsegsz;
|
||||
bus_size_t boundary;
|
||||
int flags;
|
||||
bus_dmamap_t *dmamp;
|
||||
apbus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
||||
bus_size_t maxsegsz, bus_size_t boundary, int flags, bus_dmamap_t *dmamp)
|
||||
{
|
||||
int error;
|
||||
|
||||
|
@ -406,23 +377,17 @@ apbus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
|
|||
}
|
||||
|
||||
static void
|
||||
apbus_dmamap_destroy(t, map)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
apbus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
|
||||
{
|
||||
|
||||
if (map->_dm_flags & NEWSMIPS_DMAMAP_MAPTBL)
|
||||
apbus_dma_mapfree(t, map);
|
||||
_bus_dmamap_destroy(t, map);
|
||||
}
|
||||
|
||||
static int
|
||||
apbus_dmamap_load(t, map, buf, buflen, p, flags)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
void *buf;
|
||||
bus_size_t buflen;
|
||||
struct proc *p;
|
||||
int flags;
|
||||
apbus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
|
||||
bus_size_t buflen, struct proc *p, int flags)
|
||||
{
|
||||
int error;
|
||||
|
||||
|
@ -437,11 +402,8 @@ apbus_dmamap_load(t, map, buf, buflen, p, flags)
|
|||
}
|
||||
|
||||
static int
|
||||
apbus_dmamap_load_mbuf(t, map, m0, flags)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
struct mbuf *m0;
|
||||
int flags;
|
||||
apbus_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0,
|
||||
int flags)
|
||||
{
|
||||
int error;
|
||||
|
||||
|
@ -456,11 +418,8 @@ apbus_dmamap_load_mbuf(t, map, m0, flags)
|
|||
}
|
||||
|
||||
static int
|
||||
apbus_dmamap_load_uio(t, map, uio, flags)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
struct uio *uio;
|
||||
int flags;
|
||||
apbus_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio,
|
||||
int flags)
|
||||
{
|
||||
int error;
|
||||
|
||||
|
@ -475,13 +434,8 @@ apbus_dmamap_load_uio(t, map, uio, flags)
|
|||
}
|
||||
|
||||
static int
|
||||
apbus_dmamap_load_raw(t, map, segs, nsegs, size, flags)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
bus_dma_segment_t *segs;
|
||||
int nsegs;
|
||||
bus_size_t size;
|
||||
int flags;
|
||||
apbus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map,
|
||||
bus_dma_segment_t *segs, int nsegs, bus_size_t size, int flags)
|
||||
{
|
||||
int error;
|
||||
|
||||
|
@ -496,12 +450,8 @@ apbus_dmamap_load_raw(t, map, segs, nsegs, size, flags)
|
|||
}
|
||||
|
||||
static void
|
||||
apbus_dmamap_sync(t, map, offset, len, ops)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
bus_addr_t offset;
|
||||
bus_size_t len;
|
||||
int ops;
|
||||
apbus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset,
|
||||
bus_size_t len, int ops)
|
||||
{
|
||||
|
||||
/*
|
||||
|
@ -529,8 +479,7 @@ struct newsmips_bus_dma_tag apbus_dma_tag = {
|
|||
};
|
||||
|
||||
struct newsmips_bus_dma_tag *
|
||||
apbus_dmatag_init(apa)
|
||||
struct apbus_attach_args *apa;
|
||||
apbus_dmatag_init(struct apbus_attach_args *apa)
|
||||
{
|
||||
struct newsmips_bus_dma_tag *dmat;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: apbus_subr.c,v 1.5 2003/07/15 02:59:28 lukem Exp $ */
|
||||
/* $NetBSD: apbus_subr.c,v 1.6 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
|
||||
|
@ -27,18 +27,17 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: apbus_subr.c,v 1.5 2003/07/15 02:59:28 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: apbus_subr.c,v 1.6 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <newsmips/apbus/apbusvar.h>
|
||||
|
||||
static void apctl_dump (struct apbus_ctl *);
|
||||
static void apctl_dump(struct apbus_ctl *);
|
||||
|
||||
void *
|
||||
apbus_device_to_hwaddr(apbus_dev)
|
||||
struct apbus_dev *apbus_dev;
|
||||
apbus_device_to_hwaddr(struct apbus_dev *apbus_dev)
|
||||
{
|
||||
struct apbus_ctl *ctl;
|
||||
|
||||
|
@ -53,8 +52,7 @@ apbus_device_to_hwaddr(apbus_dev)
|
|||
}
|
||||
|
||||
struct apbus_dev *
|
||||
apbus_lookupdev(devname)
|
||||
char *devname;
|
||||
apbus_lookupdev(char *devname)
|
||||
{
|
||||
struct apbus_dev *dp;
|
||||
|
||||
|
@ -74,8 +72,7 @@ apbus_lookupdev(devname)
|
|||
}
|
||||
|
||||
static void
|
||||
apctl_dump(apctl)
|
||||
struct apbus_ctl *apctl;
|
||||
apctl_dump(struct apbus_ctl *apctl)
|
||||
{
|
||||
unsigned int *p;
|
||||
|
||||
|
@ -97,8 +94,7 @@ apctl_dump(apctl)
|
|||
}
|
||||
|
||||
void
|
||||
apdevice_dump(apdev)
|
||||
struct apbus_dev *apdev;
|
||||
apdevice_dump(struct apbus_dev *apdev)
|
||||
{
|
||||
struct apbus_ctl *apctl;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: apbusvar.h,v 1.4 2003/05/10 10:20:00 tsutsui Exp $ */
|
||||
/* $NetBSD: apbusvar.h,v 1.5 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
|
||||
|
@ -39,14 +39,12 @@ struct apbus_attach_args {
|
|||
u_long apa_hwbase; /* hardware I/O address */
|
||||
};
|
||||
|
||||
void *apbus_device_to_hwaddr __P((struct apbus_dev *));
|
||||
struct apbus_dev *apbus_lookupdev __P((char *));
|
||||
void apdevice_dump __P((struct apbus_dev *));
|
||||
void apbus_intr_init __P((void));
|
||||
int apbus_intr_dispatch __P((int, int));
|
||||
void *apbus_intr_establish __P((int, int, int, int (*)(void *), void *,
|
||||
char *, int));
|
||||
struct newsmips_bus_dma_tag *apbus_dmatag_init
|
||||
__P((struct apbus_attach_args *));
|
||||
void *apbus_device_to_hwaddr(struct apbus_dev *);
|
||||
struct apbus_dev *apbus_lookupdev(char *);
|
||||
void apdevice_dump(struct apbus_dev *);
|
||||
void apbus_intr_init(void);
|
||||
int apbus_intr_dispatch(int, int);
|
||||
void *apbus_intr_establish(int, int, int, int (*)(void *), void *, char *, int);
|
||||
struct newsmips_bus_dma_tag *apbus_dmatag_init(struct apbus_attach_args *);
|
||||
|
||||
#define SLOTTOMASK(slot) ((slot) ? (0x0100 << ((slot) - 1)) : 0)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dmac3.c,v 1.6 2003/07/15 02:59:28 lukem Exp $ */
|
||||
/* $NetBSD: dmac3.c,v 1.7 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dmac3.c,v 1.6 2003/07/15 02:59:28 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dmac3.c,v 1.7 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -67,19 +67,16 @@ struct dmac3_softc {
|
|||
int sc_ctlnum;
|
||||
};
|
||||
|
||||
int dmac3_match __P((struct device *, struct cfdata *, void *));
|
||||
void dmac3_attach __P((struct device *, struct device *, void *));
|
||||
int dmac3_match(struct device *, struct cfdata *, void *);
|
||||
void dmac3_attach(struct device *, struct device *, void *);
|
||||
|
||||
paddr_t kvtophys __P((vaddr_t));
|
||||
extern paddr_t kvtophys(vaddr_t);
|
||||
|
||||
CFATTACH_DECL(dmac, sizeof(struct dmac3_softc),
|
||||
dmac3_match, dmac3_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
dmac3_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
dmac3_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -90,9 +87,7 @@ dmac3_match(parent, cf, aux)
|
|||
}
|
||||
|
||||
void
|
||||
dmac3_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
dmac3_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct dmac3_softc *sc = (void *)self;
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
@ -120,8 +115,7 @@ dmac3_attach(parent, self, aux)
|
|||
}
|
||||
|
||||
void *
|
||||
dmac3_link(ctlnum)
|
||||
int ctlnum;
|
||||
dmac3_link(int ctlnum)
|
||||
{
|
||||
struct dmac3_softc *sc;
|
||||
struct device *dv;
|
||||
|
@ -137,8 +131,7 @@ dmac3_link(ctlnum)
|
|||
}
|
||||
|
||||
void
|
||||
dmac3_reset(sc)
|
||||
struct dmac3_softc *sc;
|
||||
dmac3_reset(struct dmac3_softc *sc)
|
||||
{
|
||||
struct dmac3reg *reg = sc->sc_reg;
|
||||
|
||||
|
@ -149,10 +142,7 @@ dmac3_reset(sc)
|
|||
}
|
||||
|
||||
void
|
||||
dmac3_start(sc, addr, len, direction)
|
||||
struct dmac3_softc *sc;
|
||||
vaddr_t addr;
|
||||
int len, direction;
|
||||
dmac3_start(struct dmac3_softc *sc, vaddr_t addr, int len, int direction)
|
||||
{
|
||||
struct dmac3reg *reg = sc->sc_reg;
|
||||
paddr_t pa;
|
||||
|
@ -184,8 +174,7 @@ dmac3_start(sc, addr, len, direction)
|
|||
}
|
||||
|
||||
int
|
||||
dmac3_intr(v)
|
||||
void *v;
|
||||
dmac3_intr(void *v)
|
||||
{
|
||||
struct dmac3_softc *sc = v;
|
||||
struct dmac3reg *reg = sc->sc_reg;
|
||||
|
@ -218,9 +207,7 @@ dmac3_intr(v)
|
|||
}
|
||||
|
||||
void
|
||||
dmac3_misc(sc, cmd)
|
||||
struct dmac3_softc *sc;
|
||||
int cmd;
|
||||
dmac3_misc(struct dmac3_softc *sc, int cmd)
|
||||
{
|
||||
struct dmac3reg *reg = sc->sc_reg;
|
||||
int conf;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_sn.c,v 1.15 2004/10/30 18:08:34 thorpej Exp $ */
|
||||
/* $NetBSD: if_sn.c,v 1.16 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* National Semiconductor DP8393X SONIC Driver
|
||||
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.15 2004/10/30 18:08:34 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.16 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
|
@ -63,30 +63,30 @@ __KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.15 2004/10/30 18:08:34 thorpej Exp $");
|
|||
# define DPRINTF while (0) printf
|
||||
#endif
|
||||
|
||||
static void snwatchdog __P((struct ifnet *));
|
||||
static int sninit __P((struct sn_softc *sc));
|
||||
static int snstop __P((struct sn_softc *sc));
|
||||
static int snioctl __P((struct ifnet *ifp, u_long cmd, caddr_t data));
|
||||
static void snstart __P((struct ifnet *ifp));
|
||||
static void snreset __P((struct sn_softc *sc));
|
||||
static void snwatchdog(struct ifnet *);
|
||||
static int sninit(struct sn_softc *sc);
|
||||
static int snstop(struct sn_softc *sc);
|
||||
static int snioctl(struct ifnet *ifp, u_long cmd, caddr_t data);
|
||||
static void snstart(struct ifnet *ifp);
|
||||
static void snreset(struct sn_softc *sc);
|
||||
|
||||
static void caminitialise __P((struct sn_softc *));
|
||||
static void camentry __P((struct sn_softc *, int, u_char *ea));
|
||||
static void camprogram __P((struct sn_softc *));
|
||||
static void initialise_tda __P((struct sn_softc *));
|
||||
static void initialise_rda __P((struct sn_softc *));
|
||||
static void initialise_rra __P((struct sn_softc *));
|
||||
static void caminitialise(struct sn_softc *);
|
||||
static void camentry(struct sn_softc *, int, u_char *ea);
|
||||
static void camprogram(struct sn_softc *);
|
||||
static void initialise_tda(struct sn_softc *);
|
||||
static void initialise_rda(struct sn_softc *);
|
||||
static void initialise_rra(struct sn_softc *);
|
||||
#ifdef SNDEBUG
|
||||
static void camdump __P((struct sn_softc *sc));
|
||||
static void camdump(struct sn_softc *sc);
|
||||
#endif
|
||||
|
||||
static void sonictxint __P((struct sn_softc *));
|
||||
static void sonicrxint __P((struct sn_softc *));
|
||||
static void sonictxint(struct sn_softc *);
|
||||
static void sonicrxint(struct sn_softc *);
|
||||
|
||||
static __inline__ u_int sonicput __P((struct sn_softc *sc, struct mbuf *m0,
|
||||
int mtd_next));
|
||||
static __inline__ int sonic_read __P((struct sn_softc *, caddr_t, int));
|
||||
static __inline__ struct mbuf *sonic_get __P((struct sn_softc *, caddr_t, int));
|
||||
static __inline__ u_int sonicput(struct sn_softc *sc, struct mbuf *m0,
|
||||
int mtd_next);
|
||||
static __inline__ int sonic_read(struct sn_softc *, caddr_t, int);
|
||||
static __inline__ struct mbuf *sonic_get(struct sn_softc *, caddr_t, int);
|
||||
|
||||
#undef assert
|
||||
#undef _assert
|
||||
|
@ -122,9 +122,7 @@ int sndebug = 0;
|
|||
* to accept packets.
|
||||
*/
|
||||
int
|
||||
snsetup(sc, lladdr)
|
||||
struct sn_softc *sc;
|
||||
u_int8_t *lladdr;
|
||||
snsetup(struct sn_softc *sc, uint8_t *lladdr)
|
||||
{
|
||||
struct ifnet *ifp = &sc->sc_if;
|
||||
u_char *p;
|
||||
|
@ -134,7 +132,7 @@ snsetup(sc, lladdr)
|
|||
if (sc->space == NULL) {
|
||||
printf ("%s: memory allocation for descriptors failed\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -156,7 +154,7 @@ snsetup(sc, lladdr)
|
|||
* around problems near the end of 64k !!
|
||||
*/
|
||||
p = sc->space;
|
||||
pp = (u_char *)ROUNDUP ((int)p, PAGE_SIZE);
|
||||
pp = (u_char *)ROUNDUP((int)p, PAGE_SIZE);
|
||||
p = pp;
|
||||
|
||||
for (i = 0; i < NRRA; i++) {
|
||||
|
@ -191,14 +189,14 @@ snsetup(sc, lladdr)
|
|||
(ulong)sc->mtda[0].mtd_txp - (ulong)sc->p_cda,
|
||||
(ulong)p - (ulong)sc->mtda[0].mtd_txp,
|
||||
PAGE_SIZE);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
p = pp + PAGE_SIZE;
|
||||
pp = p;
|
||||
|
||||
sc->sc_nrda = PAGE_SIZE / RXPKT_SIZE(sc);
|
||||
sc->p_rda = (caddr_t) p;
|
||||
sc->p_rda = (caddr_t)p;
|
||||
sc->v_rda = SONIC_GETDMA(p);
|
||||
|
||||
p = pp + PAGE_SIZE;
|
||||
|
@ -229,7 +227,7 @@ snsetup(sc, lladdr)
|
|||
sc->p_rda, sc->mtda[0].mtd_txp);
|
||||
#endif
|
||||
|
||||
bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
|
||||
strcpy(ifp->if_xname, sc->sc_dev.dv_xname);
|
||||
ifp->if_softc = sc;
|
||||
ifp->if_ioctl = snioctl;
|
||||
ifp->if_start = snstart;
|
||||
|
@ -239,14 +237,11 @@ snsetup(sc, lladdr)
|
|||
if_attach(ifp);
|
||||
ether_ifattach(ifp, lladdr);
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
snioctl(ifp, cmd, data)
|
||||
struct ifnet *ifp;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
snioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||
{
|
||||
struct ifaddr *ifa;
|
||||
struct ifreq *ifr;
|
||||
|
@ -325,15 +320,14 @@ snioctl(ifp, cmd, data)
|
|||
err = EINVAL;
|
||||
}
|
||||
splx(s);
|
||||
return (err);
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encapsulate a packet of type family for the local net.
|
||||
*/
|
||||
static void
|
||||
snstart(ifp)
|
||||
struct ifnet *ifp;
|
||||
snstart(struct ifnet *ifp)
|
||||
{
|
||||
struct sn_softc *sc = ifp->if_softc;
|
||||
struct mbuf *m;
|
||||
|
@ -393,23 +387,22 @@ outloop:
|
|||
* hardware/software errors.
|
||||
*/
|
||||
static void
|
||||
snreset(sc)
|
||||
struct sn_softc *sc;
|
||||
snreset(struct sn_softc *sc)
|
||||
{
|
||||
|
||||
snstop(sc);
|
||||
sninit(sc);
|
||||
}
|
||||
|
||||
static int
|
||||
sninit(sc)
|
||||
struct sn_softc *sc;
|
||||
sninit(struct sn_softc *sc)
|
||||
{
|
||||
u_long s_rcr;
|
||||
int s;
|
||||
|
||||
if (sc->sc_if.if_flags & IFF_RUNNING)
|
||||
/* already running */
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
s = splnet();
|
||||
|
||||
|
@ -471,7 +464,7 @@ sninit(sc)
|
|||
sc->sc_if.if_flags &= ~IFF_OACTIVE;
|
||||
|
||||
splx(s);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -480,8 +473,7 @@ sninit(sc)
|
|||
* part way through.
|
||||
*/
|
||||
static int
|
||||
snstop(sc)
|
||||
struct sn_softc *sc;
|
||||
snstop(struct sn_softc *sc)
|
||||
{
|
||||
struct mtd *mtd;
|
||||
int s = splnet();
|
||||
|
@ -504,7 +496,7 @@ snstop(sc)
|
|||
sc->sc_if.if_flags &= ~(IFF_RUNNING | IFF_UP);
|
||||
|
||||
splx(s);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -513,8 +505,7 @@ snstop(sc)
|
|||
* will be handled by higher level protocol timeouts.
|
||||
*/
|
||||
static void
|
||||
snwatchdog(ifp)
|
||||
struct ifnet *ifp;
|
||||
snwatchdog(struct ifnet *ifp)
|
||||
{
|
||||
struct sn_softc *sc = ifp->if_softc;
|
||||
struct mtd *mtd;
|
||||
|
@ -539,10 +530,7 @@ snwatchdog(ifp)
|
|||
* stuff packet into sonic (at splnet)
|
||||
*/
|
||||
static __inline__ u_int
|
||||
sonicput(sc, m0, mtd_next)
|
||||
struct sn_softc *sc;
|
||||
struct mbuf *m0;
|
||||
int mtd_next;
|
||||
sonicput(struct sn_softc *sc, struct mbuf *m0, int mtd_next)
|
||||
{
|
||||
struct mtd *mtdp;
|
||||
struct mbuf *m;
|
||||
|
@ -553,7 +541,7 @@ sonicput(sc, m0, mtd_next)
|
|||
|
||||
#ifdef whyonearthwouldyoudothis
|
||||
if (NIC_GET(sc, SNR_CR) & CR_TXP)
|
||||
return (0);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
/* grab the replacement mtd */
|
||||
|
@ -578,7 +566,7 @@ sonicput(sc, m0, mtd_next)
|
|||
u_char *data = mtod(m, u_char *);
|
||||
len = m->m_len;
|
||||
totlen += len;
|
||||
bcopy(data, buff, len);
|
||||
memcpy(buff, data, len);
|
||||
buff += len;
|
||||
}
|
||||
if (totlen >= TXBSIZE) {
|
||||
|
@ -592,7 +580,7 @@ sonicput(sc, m0, mtd_next)
|
|||
|
||||
if (totlen < ETHERMIN + ETHER_HDR_LEN) {
|
||||
int pad = ETHERMIN + ETHER_HDR_LEN - totlen;
|
||||
bzero(mtdp->mtd_buf + totlen, pad);
|
||||
memset(mtdp->mtd_buf + totlen, 0, pad);
|
||||
totlen = ETHERMIN + ETHER_HDR_LEN;
|
||||
}
|
||||
|
||||
|
@ -619,7 +607,7 @@ sonicput(sc, m0, mtd_next)
|
|||
wbflush();
|
||||
sc->sc_if.if_timer = 5; /* 5 seconds to watch for failing to transmit */
|
||||
|
||||
return (totlen);
|
||||
return totlen;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -630,8 +618,7 @@ sonicput(sc, m0, mtd_next)
|
|||
* CAM support
|
||||
*/
|
||||
static void
|
||||
caminitialise(sc)
|
||||
struct sn_softc *sc;
|
||||
caminitialise(struct sn_softc *sc)
|
||||
{
|
||||
void *p_cda = sc->p_cda;
|
||||
int i;
|
||||
|
@ -648,10 +635,7 @@ caminitialise(sc)
|
|||
}
|
||||
|
||||
static void
|
||||
camentry(sc, entry, ea)
|
||||
int entry;
|
||||
u_char *ea;
|
||||
struct sn_softc *sc;
|
||||
camentry(struct sn_softc *sc, int entry, u_char *ea)
|
||||
{
|
||||
void *p_cda = sc->p_cda;
|
||||
int camoffset = entry * CDA_CAMDESC;
|
||||
|
@ -665,8 +649,7 @@ camentry(sc, entry, ea)
|
|||
}
|
||||
|
||||
static void
|
||||
camprogram(sc)
|
||||
struct sn_softc *sc;
|
||||
camprogram(struct sn_softc *sc)
|
||||
{
|
||||
struct ether_multistep step;
|
||||
struct ether_multi *enm;
|
||||
|
@ -679,7 +662,7 @@ camprogram(sc)
|
|||
ifp = &sc->sc_if;
|
||||
|
||||
/* Always load our own address first. */
|
||||
camentry (sc, mcount, LLADDR(ifp->if_sadl));
|
||||
camentry(sc, mcount, LLADDR(ifp->if_sadl));
|
||||
mcount++;
|
||||
|
||||
/* Assume we won't need allmulti bit. */
|
||||
|
@ -693,7 +676,7 @@ camprogram(sc)
|
|||
break;
|
||||
}
|
||||
|
||||
if (bcmp(enm->enm_addrlo, enm->enm_addrhi,
|
||||
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
|
||||
sizeof(enm->enm_addrlo)) != 0) {
|
||||
/*
|
||||
* SONIC's CAM is programmed with specific
|
||||
|
@ -738,8 +721,7 @@ camprogram(sc)
|
|||
|
||||
#ifdef SNDEBUG
|
||||
static void
|
||||
camdump(sc)
|
||||
struct sn_softc *sc;
|
||||
camdump(struct sn_softc *sc)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -764,8 +746,7 @@ camdump(sc)
|
|||
#endif
|
||||
|
||||
static void
|
||||
initialise_tda(sc)
|
||||
struct sn_softc *sc;
|
||||
initialise_tda(struct sn_softc *sc)
|
||||
{
|
||||
struct mtd *mtd;
|
||||
int i;
|
||||
|
@ -786,12 +767,11 @@ initialise_tda(sc)
|
|||
}
|
||||
|
||||
static void
|
||||
initialise_rda(sc)
|
||||
struct sn_softc *sc;
|
||||
initialise_rda(struct sn_softc *sc)
|
||||
{
|
||||
int i;
|
||||
caddr_t p_rda = 0;
|
||||
u_int32_t v_rda = 0;
|
||||
uint32_t v_rda = 0;
|
||||
|
||||
/* link the RDA's together into a circular list */
|
||||
for (i = 0; i < (sc->sc_nrda - 1); i++) {
|
||||
|
@ -815,8 +795,7 @@ initialise_rda(sc)
|
|||
}
|
||||
|
||||
static void
|
||||
initialise_rra(sc)
|
||||
struct sn_softc *sc;
|
||||
initialise_rra(struct sn_softc *sc)
|
||||
{
|
||||
int i;
|
||||
u_int v;
|
||||
|
@ -848,8 +827,7 @@ initialise_rra(sc)
|
|||
}
|
||||
|
||||
int
|
||||
snintr(arg)
|
||||
void *arg;
|
||||
snintr(void *arg)
|
||||
{
|
||||
struct sn_softc *sc = (struct sn_softc *)arg;
|
||||
int handled = 0;
|
||||
|
@ -914,8 +892,7 @@ snintr(arg)
|
|||
* Transmit interrupt routine
|
||||
*/
|
||||
static void
|
||||
sonictxint(sc)
|
||||
struct sn_softc *sc;
|
||||
sonictxint(struct sn_softc *sc)
|
||||
{
|
||||
struct mtd *mtd;
|
||||
void *txp;
|
||||
|
@ -990,15 +967,14 @@ sonictxint(sc)
|
|||
* Receive interrupt routine
|
||||
*/
|
||||
static void
|
||||
sonicrxint(sc)
|
||||
struct sn_softc *sc;
|
||||
sonicrxint(struct sn_softc *sc)
|
||||
{
|
||||
caddr_t rda;
|
||||
int orra;
|
||||
int len;
|
||||
int rramark;
|
||||
int rdamark;
|
||||
u_int16_t rxpkt_ptr;
|
||||
uint16_t rxpkt_ptr;
|
||||
|
||||
rda = sc->p_rda + (sc->sc_rxmark * RXPKT_SIZE(sc));
|
||||
|
||||
|
@ -1038,13 +1014,13 @@ sonicrxint(sc)
|
|||
tmp1 = sc->p_rra[rramark];
|
||||
tmp2 = sc->p_rra[orra];
|
||||
SWO(bitmode, tmp1, RXRSRC_PTRLO,
|
||||
SRO(bitmode, tmp2, RXRSRC_PTRLO));
|
||||
SRO(bitmode, tmp2, RXRSRC_PTRLO));
|
||||
SWO(bitmode, tmp1, RXRSRC_PTRHI,
|
||||
SRO(bitmode, tmp2, RXRSRC_PTRHI));
|
||||
SRO(bitmode, tmp2, RXRSRC_PTRHI));
|
||||
SWO(bitmode, tmp1, RXRSRC_WCLO,
|
||||
SRO(bitmode, tmp2, RXRSRC_WCLO));
|
||||
SRO(bitmode, tmp2, RXRSRC_WCLO));
|
||||
SWO(bitmode, tmp1, RXRSRC_WCHI,
|
||||
SRO(bitmode, tmp2, RXRSRC_WCHI));
|
||||
SRO(bitmode, tmp2, RXRSRC_WCHI));
|
||||
|
||||
/* zap old rra for fun */
|
||||
SWO(bitmode, tmp2, RXRSRC_WCHI, 0);
|
||||
|
@ -1062,10 +1038,11 @@ sonicrxint(sc)
|
|||
rdamark = sc->sc_rdamark;
|
||||
SWO(bitmode, rda, RXPKT_INUSE, 1);
|
||||
SWO(bitmode, rda, RXPKT_RLINK,
|
||||
SRO(bitmode, rda, RXPKT_RLINK) | EOL);
|
||||
SWO(bitmode, (sc->p_rda + (rdamark * RXPKT_SIZE(sc))), RXPKT_RLINK,
|
||||
SRO(bitmode, (sc->p_rda + (rdamark * RXPKT_SIZE(sc))),
|
||||
RXPKT_RLINK) & ~EOL);
|
||||
SRO(bitmode, rda, RXPKT_RLINK) | EOL);
|
||||
SWO(bitmode, (sc->p_rda + (rdamark * RXPKT_SIZE(sc))),
|
||||
RXPKT_RLINK,
|
||||
SRO(bitmode, (sc->p_rda + (rdamark * RXPKT_SIZE(sc))),
|
||||
RXPKT_RLINK) & ~EOL);
|
||||
sc->sc_rdamark = sc->sc_rxmark;
|
||||
|
||||
if (++sc->sc_rxmark >= sc->sc_nrda)
|
||||
|
@ -1079,10 +1056,7 @@ sonicrxint(sc)
|
|||
* appropriate protocol handler
|
||||
*/
|
||||
static __inline__ int
|
||||
sonic_read(sc, pkt, len)
|
||||
struct sn_softc *sc;
|
||||
caddr_t pkt;
|
||||
int len;
|
||||
sonic_read(struct sn_softc *sc, caddr_t pkt, int len)
|
||||
{
|
||||
struct ifnet *ifp = &sc->sc_if;
|
||||
struct mbuf *m;
|
||||
|
@ -1100,36 +1074,33 @@ sonic_read(sc, pkt, len)
|
|||
len > (ETHER_MAX_LEN - ETHER_CRC_LEN)) {
|
||||
printf("%s: invalid packet length %d bytes\n",
|
||||
sc->sc_dev.dv_xname, len);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
m = sonic_get(sc, pkt, len);
|
||||
if (m == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
#if NBPFILTER > 0
|
||||
/* Pass the packet to any BPF listeners. */
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
#endif
|
||||
(*ifp->if_input)(ifp, m);
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* munge the received packet into an mbuf chain
|
||||
*/
|
||||
static __inline__ struct mbuf *
|
||||
sonic_get(sc, pkt, datalen)
|
||||
struct sn_softc *sc;
|
||||
caddr_t pkt;
|
||||
int datalen;
|
||||
sonic_get(struct sn_softc *sc, caddr_t pkt, int datalen)
|
||||
{
|
||||
struct mbuf *m, *top, **mp;
|
||||
int len;
|
||||
|
||||
MGETHDR(m, M_DONTWAIT, MT_DATA);
|
||||
if (m == 0)
|
||||
return (0);
|
||||
return 0;
|
||||
m->m_pkthdr.rcvif = &sc->sc_if;
|
||||
m->m_pkthdr.len = datalen;
|
||||
len = MHLEN;
|
||||
|
@ -1141,7 +1112,7 @@ sonic_get(sc, pkt, datalen)
|
|||
MGET(m, M_DONTWAIT, MT_DATA);
|
||||
if (m == 0) {
|
||||
m_freem(top);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
len = MLEN;
|
||||
}
|
||||
|
@ -1149,7 +1120,7 @@ sonic_get(sc, pkt, datalen)
|
|||
MCLGET(m, M_DONTWAIT);
|
||||
if ((m->m_flags & M_EXT) == 0) {
|
||||
if (top) m_freem(top);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
len = MCLBYTES;
|
||||
}
|
||||
|
@ -1164,12 +1135,12 @@ sonic_get(sc, pkt, datalen)
|
|||
|
||||
m->m_len = len = min(datalen, len);
|
||||
|
||||
bcopy(pkt, mtod(m, caddr_t), (unsigned) len);
|
||||
memcpy(mtod(m, caddr_t), pkt, (unsigned) len);
|
||||
pkt += len;
|
||||
datalen -= len;
|
||||
*mp = m;
|
||||
mp = &m->m_next;
|
||||
}
|
||||
|
||||
return (top);
|
||||
return top;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_sn_ap.c,v 1.6 2003/07/15 02:59:28 lukem Exp $ */
|
||||
/* $NetBSD: if_sn_ap.c,v 1.7 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Allen Briggs
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sn_ap.c,v 1.6 2003/07/15 02:59:28 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sn_ap.c,v 1.7 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
|
@ -59,18 +59,15 @@ __KERNEL_RCSID(0, "$NetBSD: if_sn_ap.c,v 1.6 2003/07/15 02:59:28 lukem Exp $");
|
|||
#define SONIC_APBUS_MEM_OFFSET 0x00020000
|
||||
#define SONIC_APBUS_CTL_OFFSET (-0x00100000)
|
||||
|
||||
static int sn_ap_match __P((struct device *, struct cfdata *, void *));
|
||||
static void sn_ap_attach __P((struct device *, struct device *, void *));
|
||||
static int sn_ap_getaddr __P((struct sn_softc *, u_int8_t *));
|
||||
static int sn_ap_match(struct device *, struct cfdata *, void *);
|
||||
static void sn_ap_attach(struct device *, struct device *, void *);
|
||||
static int sn_ap_getaddr(struct sn_softc *, uint8_t *);
|
||||
|
||||
CFATTACH_DECL(sn_ap, sizeof(struct sn_softc),
|
||||
sn_ap_match, sn_ap_attach, NULL, NULL);
|
||||
|
||||
static int
|
||||
sn_ap_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
sn_ap_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -84,13 +81,11 @@ sn_ap_match(parent, cf, aux)
|
|||
* Install interface into kernel networking data structures
|
||||
*/
|
||||
static void
|
||||
sn_ap_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
sn_ap_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct sn_softc *sc = (void *)self;
|
||||
struct apbus_attach_args *apa = aux;
|
||||
u_int8_t myaddr[ETHER_ADDR_LEN];
|
||||
uint8_t myaddr[ETHER_ADDR_LEN];
|
||||
u_int intrmask;
|
||||
|
||||
sc->sc_hwbase = (caddr_t)apa->apa_hwbase;
|
||||
|
@ -119,15 +114,13 @@ sn_ap_attach(parent, self, aux)
|
|||
NEWS5000_INT0_SONIC : SLOTTOMASK(apa->apa_slotno);
|
||||
|
||||
apbus_intr_establish(0, /* interrupt level (0 or 1) */
|
||||
intrmask,
|
||||
0, /* priority */
|
||||
snintr, sc, apa->apa_name, apa->apa_ctlnum);
|
||||
intrmask,
|
||||
0, /* priority */
|
||||
snintr, sc, apa->apa_name, apa->apa_ctlnum);
|
||||
}
|
||||
|
||||
int
|
||||
sn_ap_getaddr(sc, lladdr)
|
||||
struct sn_softc *sc;
|
||||
u_int8_t *lladdr;
|
||||
sn_ap_getaddr(struct sn_softc *sc, uint8_t *lladdr)
|
||||
{
|
||||
u_int *p = (u_int *)(sc->sc_hwbase + SONIC_MACROM_OFFSET);
|
||||
int i;
|
||||
|
@ -145,8 +138,7 @@ sn_ap_getaddr(sc, lladdr)
|
|||
#define APSONIC_INT_REG(base) (((u_long)(base) & 0xffc00000) | 0x00100000)
|
||||
|
||||
void
|
||||
sn_md_init(sc)
|
||||
struct sn_softc *sc;
|
||||
sn_md_init(struct sn_softc *sc)
|
||||
{
|
||||
u_int *reg = (u_int *)APSONIC_INT_REG(sc->sc_hwbase);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_snvar.h,v 1.4 2003/12/02 13:19:06 tsutsui Exp $ */
|
||||
/* $NetBSD: if_snvar.h,v 1.5 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk)
|
||||
|
@ -16,8 +16,8 @@
|
|||
* binary, all structures have to be accessed using macros which can
|
||||
* adjust the offsets appropriately.
|
||||
*/
|
||||
#define SWO(m, a, o, x) (*(u_int32_t *)((u_int32_t *)(a) + (o)) = (x))
|
||||
#define SRO(m, a, o) (*(u_int32_t *)((u_int32_t *)(a) + (o)) & 0xffff)
|
||||
#define SWO(m, a, o, x) (*(uint32_t *)((uint32_t *)(a) + (o)) = (x))
|
||||
#define SRO(m, a, o) (*(uint32_t *)((uint32_t *)(a) + (o)) & 0xffff)
|
||||
|
||||
/*
|
||||
* Register access macros. We use bus_space_* to talk to the Sonic
|
||||
|
@ -27,12 +27,12 @@
|
|||
#define NIC_GET(sc, reg) ((sc)->sc_regbase[(reg) * 4 + 3])
|
||||
#define NIC_PUT(sc, reg, val) ((sc)->sc_regbase[(reg) * 4 + 3] = val)
|
||||
|
||||
#define SONIC_GETDMA(p) ((u_int32_t)(p))
|
||||
#define SONIC_GETDMA(p) ((uint32_t)(p))
|
||||
|
||||
#define SN_REGSIZE SN_NREGS*4
|
||||
#define SN_REGSIZE (SN_NREGS * 4)
|
||||
|
||||
void mips3_wbflush __P((void));
|
||||
void apbus_wbflush __P((void));
|
||||
void mips3_wbflush(void);
|
||||
void apbus_wbflush(void);
|
||||
|
||||
static __inline void
|
||||
wbflush(void)
|
||||
|
@ -54,10 +54,10 @@ wbflush(void)
|
|||
*/
|
||||
|
||||
#define NRBA 4 /* # receive buffers < NRRA */
|
||||
#define RBAMASK (NRBA-1)
|
||||
#define RBAMASK (NRBA - 1)
|
||||
#define NTDA 4 /* # transmit descriptors */
|
||||
#define NRRA 8 /* # receive resource descriptors */
|
||||
#define RRAMASK (NRRA-1) /* the reason why NRRA must be power of two */
|
||||
#define RRAMASK (NRRA - 1) /* the reason why NRRA must be power of two */
|
||||
|
||||
#define FCSSIZE 4 /* size of FCS appended to packets */
|
||||
|
||||
|
@ -76,9 +76,9 @@ wbflush(void)
|
|||
|
||||
typedef struct mtd {
|
||||
void *mtd_txp;
|
||||
u_int32_t mtd_vtxp;
|
||||
uint32_t mtd_vtxp;
|
||||
caddr_t mtd_buf;
|
||||
u_int32_t mtd_vbuf;
|
||||
uint32_t mtd_vbuf;
|
||||
struct mbuf *mtd_mbuf;
|
||||
} mtd_t;
|
||||
|
||||
|
@ -91,24 +91,24 @@ struct sn_softc {
|
|||
#define sc_if sc_ethercom.ec_if /* network visible interface */
|
||||
|
||||
caddr_t sc_hwbase; /* hardware base address */
|
||||
volatile u_int16_t *sc_regbase; /* register base address */
|
||||
volatile uint16_t *sc_regbase; /* register base address */
|
||||
|
||||
int bitmode; /* 32 bit mode == 1, 16 == 0 */
|
||||
|
||||
u_int16_t snr_dcr; /* DCR for this instance */
|
||||
u_int16_t snr_dcr2; /* DCR2 for this instance */
|
||||
uint16_t snr_dcr; /* DCR for this instance */
|
||||
uint16_t snr_dcr2; /* DCR2 for this instance */
|
||||
int slotno; /* Slot number */
|
||||
|
||||
int sc_rramark; /* index into p_rra of wp */
|
||||
void *p_rra[NRRA]; /* RX resource descs */
|
||||
u_int32_t v_rra[NRRA]; /* DMA addresses of p_rra */
|
||||
u_int32_t v_rea; /* ptr to the end of the rra space */
|
||||
uint32_t v_rra[NRRA]; /* DMA addresses of p_rra */
|
||||
uint32_t v_rea; /* ptr to the end of the rra space */
|
||||
|
||||
int sc_rxmark; /* current hw pos in rda ring */
|
||||
int sc_rdamark; /* current sw pos in rda ring */
|
||||
int sc_nrda; /* total number of RDAs */
|
||||
caddr_t p_rda;
|
||||
u_int32_t v_rda;
|
||||
uint32_t v_rda;
|
||||
|
||||
caddr_t rbuf[NRBA];
|
||||
|
||||
|
@ -124,7 +124,7 @@ struct sn_softc {
|
|||
int mtd_pint; /* Counter to set TXP_PINT */
|
||||
|
||||
void *p_cda;
|
||||
u_int32_t v_cda;
|
||||
uint32_t v_cda;
|
||||
|
||||
unsigned char *space;
|
||||
};
|
||||
|
@ -182,7 +182,7 @@ struct sn_softc {
|
|||
#define TXP_FPTRHI 1 /* ptr to packet fragment HI */
|
||||
#define TXP_FSIZE 2 /* fragment size */
|
||||
|
||||
#define TXP_WORDS TXP_FRAGOFF + (FRAGMAX*TXP_FRAGSIZE) + 1 /* 1 for tlink */
|
||||
#define TXP_WORDS (TXP_FRAGOFF + (FRAGMAX * TXP_FRAGSIZE) + 1) /* 1 for tlink */
|
||||
#define TXP_SIZE(sc) (TXP_WORDS*4)
|
||||
|
||||
#define EOL 0x0001 /* end of list marker for link fields */
|
||||
|
@ -199,8 +199,8 @@ struct sn_softc {
|
|||
#define CDA_CAMAP1 2 /* CAM Address Port 2 YY-YY-xx-xx-xx-xx */
|
||||
#define CDA_CAMAP2 3
|
||||
#define CDA_ENABLE 64 /* mask enabling CAM entries */
|
||||
#define CDA_SIZE(sc) ((4*16 + 1) * ((sc->bitmode) ? 4 : 2))
|
||||
#define CDA_SIZE(sc) ((4 * 16 + 1) * ((sc->bitmode) ? 4 : 2))
|
||||
|
||||
int snsetup __P((struct sn_softc *sc, u_int8_t *));
|
||||
int snintr __P((void *));
|
||||
void sn_md_init __P((struct sn_softc *));
|
||||
int snsetup(struct sn_softc *sc, uint8_t *);
|
||||
int snintr(void *);
|
||||
void sn_md_init(struct sn_softc *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_tlp_ap.c,v 1.6 2003/07/15 02:59:28 lukem Exp $ */
|
||||
/* $NetBSD: if_tlp_ap.c,v 1.7 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.6 2003/07/15 02:59:28 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.7 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -79,7 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.6 2003/07/15 02:59:28 lukem Exp $");
|
|||
#define TLP_AP_RST 0x00100000 /* Board Reset */
|
||||
|
||||
|
||||
extern void tlp_idle __P((struct tulip_softc *, u_int32_t));
|
||||
extern void tlp_idle(struct tulip_softc *, uint32_t);
|
||||
|
||||
struct tulip_ap_softc {
|
||||
struct tulip_softc sc_tulip; /* real Tulip softc */
|
||||
|
@ -87,26 +87,23 @@ struct tulip_ap_softc {
|
|||
bus_space_handle_t sc_cfsh;
|
||||
};
|
||||
|
||||
static int tlp_ap_match __P((struct device *, struct cfdata *, void *));
|
||||
static void tlp_ap_attach __P((struct device *, struct device *, void *));
|
||||
static int tlp_ap_match(struct device *, struct cfdata *, void *);
|
||||
static void tlp_ap_attach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(tlp_ap, sizeof(struct tulip_ap_softc),
|
||||
tlp_ap_match, tlp_ap_attach, NULL, NULL);
|
||||
|
||||
static void tlp_ap_preinit __P((struct tulip_softc *));
|
||||
static void tlp_ap_tmsw_init __P((struct tulip_softc *));
|
||||
static void tlp_ap_getmedia __P((struct tulip_softc *, struct ifmediareq *));
|
||||
static int tlp_ap_setmedia __P((struct tulip_softc *));
|
||||
static void tlp_ap_preinit(struct tulip_softc *);
|
||||
static void tlp_ap_tmsw_init(struct tulip_softc *);
|
||||
static void tlp_ap_getmedia(struct tulip_softc *, struct ifmediareq *);
|
||||
static int tlp_ap_setmedia(struct tulip_softc *);
|
||||
|
||||
const struct tulip_mediasw tlp_ap_mediasw = {
|
||||
tlp_ap_tmsw_init, tlp_ap_getmedia, tlp_ap_setmedia
|
||||
};
|
||||
|
||||
static int
|
||||
tlp_ap_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
tlp_ap_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -120,14 +117,12 @@ tlp_ap_match(parent, cf, aux)
|
|||
* Install interface into kernel networking data structures
|
||||
*/
|
||||
static void
|
||||
tlp_ap_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
tlp_ap_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct tulip_ap_softc *psc = (void *) self;
|
||||
struct tulip_softc *sc = &psc->sc_tulip;
|
||||
struct apbus_attach_args *apa = aux;
|
||||
u_int8_t enaddr[ETHER_ADDR_LEN];
|
||||
uint8_t enaddr[ETHER_ADDR_LEN];
|
||||
u_int intrmask;
|
||||
int i;
|
||||
|
||||
|
@ -232,14 +227,13 @@ tlp_ap_attach(parent, self, aux)
|
|||
|
||||
intrmask = SLOTTOMASK(apa->apa_slotno);
|
||||
apbus_intr_establish(0, /* interrupt level (0 or 1) */
|
||||
intrmask,
|
||||
0, /* priority */
|
||||
tlp_intr, sc, apa->apa_name, apa->apa_ctlnum);
|
||||
intrmask,
|
||||
0, /* priority */
|
||||
tlp_intr, sc, apa->apa_name, apa->apa_ctlnum);
|
||||
}
|
||||
|
||||
static void
|
||||
tlp_ap_preinit(sc)
|
||||
struct tulip_softc *sc;
|
||||
tlp_ap_preinit(struct tulip_softc *sc)
|
||||
{
|
||||
|
||||
sc->sc_opmode |= OPMODE_MBO | OPMODE_SCR | OPMODE_PCS | OPMODE_HBD |
|
||||
|
@ -248,8 +242,7 @@ tlp_ap_preinit(sc)
|
|||
}
|
||||
|
||||
static void
|
||||
tlp_ap_tmsw_init(sc)
|
||||
struct tulip_softc *sc;
|
||||
tlp_ap_tmsw_init(struct tulip_softc *sc)
|
||||
{
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
|
||||
|
@ -268,9 +261,7 @@ tlp_ap_tmsw_init(sc)
|
|||
}
|
||||
|
||||
static void
|
||||
tlp_ap_getmedia(sc, ifmr)
|
||||
struct tulip_softc *sc;
|
||||
struct ifmediareq *ifmr;
|
||||
tlp_ap_getmedia(struct tulip_softc *sc, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
|
||||
|
@ -281,8 +272,7 @@ tlp_ap_getmedia(sc, ifmr)
|
|||
}
|
||||
|
||||
static int
|
||||
tlp_ap_setmedia(sc)
|
||||
struct tulip_softc *sc;
|
||||
tlp_ap_setmedia(struct tulip_softc *sc)
|
||||
{
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
|
||||
|
@ -296,5 +286,5 @@ tlp_ap_setmedia(sc)
|
|||
sc->sc_opmode &= ~OPMODE_FD;
|
||||
if (ifp->if_flags & IFF_UP)
|
||||
TULIP_WRITE(sc, CSR_OPMODE, sc->sc_opmode);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kb_ap.c,v 1.5 2003/07/15 02:59:28 lukem Exp $ */
|
||||
/* $NetBSD: kb_ap.c,v 1.6 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kb_ap.c,v 1.5 2003/07/15 02:59:28 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kb_ap.c,v 1.6 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -103,10 +103,7 @@ struct wskbd_mapdata kb_ap_keymapdata = {
|
|||
};
|
||||
|
||||
int
|
||||
kb_ap_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
kb_ap_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -117,9 +114,7 @@ kb_ap_match(parent, cf, aux)
|
|||
}
|
||||
|
||||
void
|
||||
kb_ap_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
kb_ap_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct kb_ap_softc *sc = (void *)self;
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
@ -159,8 +154,7 @@ kb_ap_attach(parent, self, aux)
|
|||
}
|
||||
|
||||
int
|
||||
kb_ap_intr(v)
|
||||
void *v;
|
||||
kb_ap_intr(void *v)
|
||||
{
|
||||
struct kb_ap_softc *sc = v;
|
||||
volatile struct kbreg *reg = sc->sc_reg;
|
||||
|
@ -183,16 +177,14 @@ kb_ap_intr(v)
|
|||
}
|
||||
|
||||
void
|
||||
kb_ap_cnattach()
|
||||
kb_ap_cnattach(void)
|
||||
{
|
||||
|
||||
wskbd_cnattach(&kb_ap_consops, (void *)0xbf900000, &kb_ap_keymapdata);
|
||||
}
|
||||
|
||||
void
|
||||
kb_ap_cngetc(v, type, data)
|
||||
void *v;
|
||||
u_int *type;
|
||||
int *data;
|
||||
kb_ap_cngetc(void *v, u_int *type, int *data)
|
||||
{
|
||||
volatile struct kbreg *reg = v;
|
||||
int key, release, ointr;
|
||||
|
@ -213,35 +205,26 @@ kb_ap_cngetc(v, type, data)
|
|||
}
|
||||
|
||||
void
|
||||
kb_ap_cnpollc(v, on)
|
||||
void *v;
|
||||
int on;
|
||||
kb_ap_cnpollc(void *v, int on)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
kb_ap_enable(v, on)
|
||||
void *v;
|
||||
int on;
|
||||
kb_ap_enable(void *v, int on)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
kb_ap_setleds(v, on)
|
||||
void *v;
|
||||
int on;
|
||||
kb_ap_setleds(void *v, int on)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
kb_ap_ioctl(v, cmd, data, flag, p)
|
||||
void *v;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
kb_ap_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
{
|
||||
|
||||
switch (cmd) {
|
||||
case WSKBDIO_GTYPE:
|
||||
*(int *)data = 0; /* XXX */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mkclock_ap.c,v 1.2 2003/11/01 22:50:45 tsutsui Exp $ */
|
||||
/* $NetBSD: mkclock_ap.c,v 1.3 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mkclock_ap.c,v 1.2 2003/11/01 22:50:45 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mkclock_ap.c,v 1.3 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -59,8 +59,8 @@ __KERNEL_RCSID(0, "$NetBSD: mkclock_ap.c,v 1.2 2003/11/01 22:50:45 tsutsui Exp $
|
|||
|
||||
int mkclock_ap_match(struct device *, struct cfdata *, void *);
|
||||
void mkclock_ap_attach(struct device *, struct device *, void *);
|
||||
static u_int8_t mkclock_ap_nvrd(struct mk48txx_softc *, int);
|
||||
static void mkclock_ap_nvwr(struct mk48txx_softc *, int, u_int8_t);
|
||||
static uint8_t mkclock_ap_nvrd(struct mk48txx_softc *, int);
|
||||
static void mkclock_ap_nvwr(struct mk48txx_softc *, int, uint8_t);
|
||||
|
||||
CFATTACH_DECL(mkclock_ap, sizeof(struct mk48txx_softc),
|
||||
mkclock_ap_match, mkclock_ap_attach, NULL, NULL);
|
||||
|
@ -68,10 +68,7 @@ CFATTACH_DECL(mkclock_ap, sizeof(struct mk48txx_softc),
|
|||
extern struct cfdriver mkclock_cd;
|
||||
|
||||
int
|
||||
mkclock_ap_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
mkclock_ap_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -82,9 +79,7 @@ mkclock_ap_match(parent, cf, aux)
|
|||
}
|
||||
|
||||
void
|
||||
mkclock_ap_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
mkclock_ap_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct mk48txx_softc *sc = (void *)self;
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
@ -106,22 +101,17 @@ mkclock_ap_attach(parent, self, aux)
|
|||
todr_attach(&sc->sc_handle);
|
||||
}
|
||||
|
||||
static u_int8_t
|
||||
mkclock_ap_nvrd(sc, off)
|
||||
struct mk48txx_softc *sc;
|
||||
int off;
|
||||
static uint8_t
|
||||
mkclock_ap_nvrd(struct mk48txx_softc *sc, int off)
|
||||
{
|
||||
u_int8_t rv;
|
||||
uint8_t rv;
|
||||
|
||||
rv = bus_space_read_4(sc->sc_bst, sc->sc_bsh, off << MKCLOCK_AP_STRIDE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static void
|
||||
mkclock_ap_nvwr(sc, off, v)
|
||||
struct mk48txx_softc *sc;
|
||||
int off;
|
||||
u_int8_t v;
|
||||
mkclock_ap_nvwr(struct mk48txx_softc *sc, int off, uint8_t v)
|
||||
{
|
||||
|
||||
bus_space_write_4(sc->sc_bst, sc->sc_bsh, off << MKCLOCK_AP_STRIDE, v);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ms_ap.c,v 1.5 2003/07/15 02:59:28 lukem Exp $ */
|
||||
/* $NetBSD: ms_ap.c,v 1.6 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ms_ap.c,v 1.5 2003/07/15 02:59:28 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ms_ap.c,v 1.6 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -73,10 +73,7 @@ struct wsmouse_accessops ms_ap_accessops = {
|
|||
};
|
||||
|
||||
int
|
||||
ms_ap_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
ms_ap_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -87,9 +84,7 @@ ms_ap_match(parent, cf, aux)
|
|||
}
|
||||
|
||||
void
|
||||
ms_ap_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
ms_ap_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct ms_ap_softc *sc = (void *)self;
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
@ -113,8 +108,7 @@ ms_ap_attach(parent, self, aux)
|
|||
}
|
||||
|
||||
int
|
||||
ms_ap_intr(v)
|
||||
void *v;
|
||||
ms_ap_intr(void *v)
|
||||
{
|
||||
struct ms_ap_softc *sc = v;
|
||||
volatile struct msreg *reg = sc->sc_reg;
|
||||
|
@ -179,8 +173,7 @@ ms_ap_intr(v)
|
|||
}
|
||||
|
||||
int
|
||||
ms_ap_enable(v)
|
||||
void *v;
|
||||
ms_ap_enable(void *v)
|
||||
{
|
||||
struct ms_ap_softc *sc = v;
|
||||
volatile struct msreg *reg = sc->sc_reg;
|
||||
|
@ -190,8 +183,7 @@ ms_ap_enable(v)
|
|||
}
|
||||
|
||||
void
|
||||
ms_ap_disable(v)
|
||||
void *v;
|
||||
ms_ap_disable(void *v)
|
||||
{
|
||||
struct ms_ap_softc *sc = v;
|
||||
volatile struct msreg *reg = sc->sc_reg;
|
||||
|
@ -200,12 +192,8 @@ ms_ap_disable(v)
|
|||
}
|
||||
|
||||
int
|
||||
ms_ap_ioctl(v, cmd, data, flag, p)
|
||||
void *v;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
ms_ap_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
{
|
||||
|
||||
return EPASSTHROUGH;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: spifi.c,v 1.12 2004/12/07 22:23:45 thorpej Exp $ */
|
||||
/* $NetBSD: spifi.c,v 1.13 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: spifi.c,v 1.12 2004/12/07 22:23:45 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: spifi.c,v 1.13 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
|
@ -107,7 +107,8 @@ struct spifi_softc {
|
|||
int spifi_match(struct device *, struct cfdata *, void *);
|
||||
void spifi_attach(struct device *, struct device *, void *);
|
||||
|
||||
void spifi_scsipi_request(struct scsipi_channel *, scsipi_adapter_req_t, void *);
|
||||
void spifi_scsipi_request(struct scsipi_channel *, scsipi_adapter_req_t,
|
||||
void *);
|
||||
struct spifi_scb *spifi_get_scb(struct spifi_softc *);
|
||||
void spifi_free_scb(struct spifi_softc *, struct spifi_scb *);
|
||||
int spifi_poll(struct spifi_softc *);
|
||||
|
@ -137,10 +138,7 @@ CFATTACH_DECL(spifi, sizeof(struct spifi_softc),
|
|||
spifi_match, spifi_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
spifi_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
spifi_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -151,9 +149,7 @@ spifi_match(parent, cf, aux)
|
|||
}
|
||||
|
||||
void
|
||||
spifi_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
spifi_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct spifi_softc *sc = (void *)self;
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
@ -213,10 +209,8 @@ spifi_attach(parent, self, aux)
|
|||
}
|
||||
|
||||
void
|
||||
spifi_scsipi_request(chan, req, arg)
|
||||
struct scsipi_channel *chan;
|
||||
scsipi_adapter_req_t req;
|
||||
void *arg;
|
||||
spifi_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||
void *arg)
|
||||
{
|
||||
struct scsipi_xfer *xs;
|
||||
struct scsipi_periph *periph;
|
||||
|
@ -244,7 +238,7 @@ spifi_scsipi_request(chan, req, arg)
|
|||
scb->status = 0;
|
||||
scb->daddr = (vaddr_t)xs->data;
|
||||
scb->resid = xs->datalen;
|
||||
bcopy(xs->cmd, &scb->cmd, xs->cmdlen);
|
||||
memcpy(&scb->cmd, xs->cmd, xs->cmdlen);
|
||||
scb->cmdlen = xs->cmdlen;
|
||||
|
||||
scb->target = periph->periph_target;
|
||||
|
@ -281,8 +275,7 @@ spifi_scsipi_request(chan, req, arg)
|
|||
}
|
||||
|
||||
struct spifi_scb *
|
||||
spifi_get_scb(sc)
|
||||
struct spifi_softc *sc;
|
||||
spifi_get_scb(struct spifi_softc *sc)
|
||||
{
|
||||
struct spifi_scb *scb;
|
||||
int s;
|
||||
|
@ -297,9 +290,7 @@ spifi_get_scb(sc)
|
|||
}
|
||||
|
||||
void
|
||||
spifi_free_scb(sc, scb)
|
||||
struct spifi_softc *sc;
|
||||
struct spifi_scb *scb;
|
||||
spifi_free_scb(struct spifi_softc *sc, struct spifi_scb *scb)
|
||||
{
|
||||
int s;
|
||||
|
||||
|
@ -309,8 +300,7 @@ spifi_free_scb(sc, scb)
|
|||
}
|
||||
|
||||
int
|
||||
spifi_poll(sc)
|
||||
struct spifi_softc *sc;
|
||||
spifi_poll(struct spifi_softc *sc)
|
||||
{
|
||||
struct spifi_scb *scb = sc->sc_nexus;
|
||||
struct scsipi_xfer *xs;
|
||||
|
@ -342,18 +332,17 @@ spifi_poll(sc)
|
|||
}
|
||||
|
||||
void
|
||||
spifi_minphys(bp)
|
||||
struct buf *bp;
|
||||
spifi_minphys(struct buf *bp)
|
||||
{
|
||||
if (bp->b_bcount > 64*1024)
|
||||
bp->b_bcount = 64*1024;
|
||||
|
||||
if (bp->b_bcount > 64 * 1024)
|
||||
bp->b_bcount = 64 * 1024;
|
||||
|
||||
minphys(bp);
|
||||
}
|
||||
|
||||
void
|
||||
spifi_sched(sc)
|
||||
struct spifi_softc *sc;
|
||||
spifi_sched(struct spifi_softc *sc)
|
||||
{
|
||||
struct spifi_scb *scb;
|
||||
|
||||
|
@ -361,10 +350,10 @@ spifi_sched(sc)
|
|||
start:
|
||||
if (scb == NULL || sc->sc_nexus != NULL)
|
||||
return;
|
||||
/*
|
||||
#if 0
|
||||
if (sc->sc_targets[scb->target] & (1 << scb->lun))
|
||||
goto next;
|
||||
*/
|
||||
#endif
|
||||
TAILQ_REMOVE(&sc->ready_scb, scb, chain);
|
||||
|
||||
#ifdef SPIFI_DEBUG
|
||||
|
@ -389,8 +378,7 @@ start:
|
|||
}
|
||||
|
||||
static inline int
|
||||
spifi_read_count(reg)
|
||||
struct spifi_reg *reg;
|
||||
spifi_read_count(struct spifi_reg *reg)
|
||||
{
|
||||
int count;
|
||||
|
||||
|
@ -401,10 +389,9 @@ spifi_read_count(reg)
|
|||
}
|
||||
|
||||
static inline void
|
||||
spifi_write_count(reg, count)
|
||||
struct spifi_reg *reg;
|
||||
int count;
|
||||
spifi_write_count(struct spifi_reg *reg, int count)
|
||||
{
|
||||
|
||||
reg->count_hi = count >> 16;
|
||||
reg->count_mid = count >> 8;
|
||||
reg->count_low = count;
|
||||
|
@ -419,8 +406,7 @@ static char scsi_phase_name[][8] = {
|
|||
#endif
|
||||
|
||||
int
|
||||
spifi_intr(v)
|
||||
void *v;
|
||||
spifi_intr(void *v)
|
||||
{
|
||||
struct spifi_softc *sc = v;
|
||||
struct spifi_reg *reg = sc->sc_reg;
|
||||
|
@ -546,8 +532,7 @@ done:
|
|||
}
|
||||
|
||||
void
|
||||
spifi_pmatch(sc)
|
||||
struct spifi_softc *sc;
|
||||
spifi_pmatch(struct spifi_softc *sc)
|
||||
{
|
||||
struct spifi_reg *reg = sc->sc_reg;
|
||||
int phase;
|
||||
|
@ -579,8 +564,7 @@ spifi_pmatch(sc)
|
|||
}
|
||||
|
||||
void
|
||||
spifi_select(sc)
|
||||
struct spifi_softc *sc;
|
||||
spifi_select(struct spifi_softc *sc)
|
||||
{
|
||||
struct spifi_reg *reg = sc->sc_reg;
|
||||
struct spifi_scb *scb = sc->sc_nexus;
|
||||
|
@ -605,9 +589,7 @@ spifi_select(sc)
|
|||
}
|
||||
|
||||
void
|
||||
spifi_sendmsg(sc, msg)
|
||||
struct spifi_softc *sc;
|
||||
int msg;
|
||||
spifi_sendmsg(struct spifi_softc *sc, int msg)
|
||||
{
|
||||
struct spifi_scb *scb = sc->sc_nexus;
|
||||
/* struct mesh_tinfo *ti; */
|
||||
|
@ -646,6 +628,7 @@ spifi_sendmsg(sc, msg)
|
|||
for (i = 0; i < len; i++)
|
||||
reg->cmbuf[id].cdb[i] = sc->sc_omsg[i];
|
||||
}
|
||||
|
||||
void
|
||||
spifi_command(struct spifi_softc *sc)
|
||||
{
|
||||
|
@ -722,8 +705,7 @@ spifi_status(struct spifi_softc *sc)
|
|||
}
|
||||
|
||||
int
|
||||
spifi_done(sc)
|
||||
struct spifi_softc *sc;
|
||||
spifi_done(struct spifi_softc *sc)
|
||||
{
|
||||
struct spifi_scb *scb = sc->sc_nexus;
|
||||
struct scsipi_xfer *xs = scb->xs;
|
||||
|
@ -749,8 +731,7 @@ spifi_done(sc)
|
|||
}
|
||||
|
||||
void
|
||||
spifi_fifo_drain(sc)
|
||||
struct spifi_softc *sc;
|
||||
spifi_fifo_drain(struct spifi_softc *sc)
|
||||
{
|
||||
struct spifi_scb *scb = sc->sc_nexus;
|
||||
struct spifi_reg *reg = sc->sc_reg;
|
||||
|
@ -776,8 +757,7 @@ spifi_fifo_drain(sc)
|
|||
}
|
||||
|
||||
void
|
||||
spifi_reset(sc)
|
||||
struct spifi_softc *sc;
|
||||
spifi_reset(struct spifi_softc *sc)
|
||||
{
|
||||
struct spifi_reg *reg = sc->sc_reg;
|
||||
int id = sc->sc_id;
|
||||
|
@ -812,8 +792,7 @@ spifi_reset(sc)
|
|||
}
|
||||
|
||||
void
|
||||
spifi_bus_reset(sc)
|
||||
struct spifi_softc *sc;
|
||||
spifi_bus_reset(struct spifi_softc *sc)
|
||||
{
|
||||
struct spifi_reg *reg = sc->sc_reg;
|
||||
|
||||
|
@ -833,10 +812,9 @@ static u_char spifi_sync_period[] = {
|
|||
};
|
||||
|
||||
void
|
||||
spifi_setsync(sc, ti)
|
||||
struct spifi_softc *sc;
|
||||
struct spifi_tinfo *ti;
|
||||
spifi_setsync(struct spifi_softc *sc, struct spifi_tinfo *ti)
|
||||
{
|
||||
|
||||
if ((ti->flags & T_SYNCMODE) == 0)
|
||||
reg->data_xfer = 0;
|
||||
else {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: xafb.c,v 1.8 2004/08/01 18:53:17 uch Exp $ */
|
||||
/* $NetBSD: xafb.c,v 1.9 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -29,7 +29,7 @@
|
|||
/* "xa" frame buffer driver. Currently supports 1280x1024x8 only. */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: xafb.c,v 1.8 2004/08/01 18:53:17 uch Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xafb.c,v 1.9 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
|
@ -76,23 +76,22 @@ struct xafb_softc {
|
|||
u_char sc_cmap_blue[256];
|
||||
};
|
||||
|
||||
int xafb_match __P((struct device *, struct cfdata *, void *));
|
||||
void xafb_attach __P((struct device *, struct device *, void *));
|
||||
int xafb_match(struct device *, struct cfdata *, void *);
|
||||
void xafb_attach(struct device *, struct device *, void *);
|
||||
|
||||
int xafb_common_init __P((struct xafb_devconfig *));
|
||||
int xafb_is_console __P((void));
|
||||
int xafb_common_init(struct xafb_devconfig *);
|
||||
int xafb_is_console(void);
|
||||
|
||||
int xafb_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
|
||||
paddr_t xafb_mmap __P((void *, off_t, int));
|
||||
int xafb_alloc_screen __P((void *, const struct wsscreen_descr *,
|
||||
void **, int *, int *, long *));
|
||||
void xafb_free_screen __P((void *, void *));
|
||||
int xafb_show_screen __P((void *, void *, int,
|
||||
void (*) (void *, int, int), void *));
|
||||
int xafb_ioctl(void *, u_long, caddr_t, int, struct proc *);
|
||||
paddr_t xafb_mmap(void *, off_t, int);
|
||||
int xafb_alloc_screen(void *, const struct wsscreen_descr *, void **, int *,
|
||||
int *, long *);
|
||||
void xafb_free_screen(void *, void *);
|
||||
int xafb_show_screen(void *, void *, int, void (*) (void *, int, int), void *);
|
||||
|
||||
int xafb_cnattach __P((void));
|
||||
int xafb_getcmap __P((struct xafb_softc *, struct wsdisplay_cmap *));
|
||||
int xafb_putcmap __P((struct xafb_softc *, struct wsdisplay_cmap *));
|
||||
int xafb_cnattach(void);
|
||||
int xafb_getcmap(struct xafb_softc *, struct wsdisplay_cmap *);
|
||||
int xafb_putcmap(struct xafb_softc *, struct wsdisplay_cmap *);
|
||||
|
||||
static __inline void xafb_setcolor(struct xafb_devconfig *, int, int, int, int);
|
||||
|
||||
|
@ -127,10 +126,7 @@ struct wsscreen_list xafb_screenlist = {
|
|||
};
|
||||
|
||||
int
|
||||
xafb_match(parent, match, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
xafb_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -141,9 +137,7 @@ xafb_match(parent, match, aux)
|
|||
}
|
||||
|
||||
void
|
||||
xafb_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
xafb_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct xafb_softc *sc = (void *)self;
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
@ -159,8 +153,8 @@ xafb_attach(parent, self, aux)
|
|||
ri = &dc->dc_ri;
|
||||
sc->sc_nscreens = 1;
|
||||
} else {
|
||||
dc = malloc(sizeof(struct xafb_devconfig), M_DEVBUF, M_WAITOK);
|
||||
bzero(dc, sizeof(struct xafb_devconfig));
|
||||
dc = malloc(sizeof(struct xafb_devconfig), M_DEVBUF,
|
||||
M_WAITOK|M_ZERO);
|
||||
dc->dc_fbpaddr = (paddr_t)0x10000000;
|
||||
dc->dc_fbbase = (void *)MIPS_PHYS_TO_KSEG1(dc->dc_fbpaddr);
|
||||
dc->dc_reg = (void *)(apa->apa_hwbase + 0x3000);
|
||||
|
@ -193,9 +187,7 @@ xafb_attach(parent, self, aux)
|
|||
}
|
||||
|
||||
void
|
||||
xafb_setcolor(dc, index, r, g, b)
|
||||
struct xafb_devconfig *dc;
|
||||
int index, r, g, b;
|
||||
xafb_setcolor(struct xafb_devconfig *dc, int index, int r, int g, int b)
|
||||
{
|
||||
volatile struct xafb_reg *reg = dc->dc_reg;
|
||||
|
||||
|
@ -207,8 +199,7 @@ xafb_setcolor(dc, index, r, g, b)
|
|||
}
|
||||
|
||||
int
|
||||
xafb_common_init(dc)
|
||||
struct xafb_devconfig *dc;
|
||||
xafb_common_init(struct xafb_devconfig *dc)
|
||||
{
|
||||
struct rasops_info *ri = &dc->dc_ri;
|
||||
int i;
|
||||
|
@ -239,7 +230,7 @@ xafb_common_init(dc)
|
|||
}
|
||||
|
||||
int
|
||||
xafb_is_console()
|
||||
xafb_is_console(void)
|
||||
{
|
||||
volatile u_int *dipsw = (void *)NEWS5000_DIP_SWITCH;
|
||||
|
||||
|
@ -250,12 +241,7 @@ xafb_is_console()
|
|||
}
|
||||
|
||||
int
|
||||
xafb_ioctl(v, cmd, data, flag, p)
|
||||
void *v;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
xafb_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
{
|
||||
struct xafb_softc *sc = v;
|
||||
struct xafb_devconfig *dc = sc->sc_dc;
|
||||
|
@ -289,10 +275,7 @@ xafb_ioctl(v, cmd, data, flag, p)
|
|||
}
|
||||
|
||||
paddr_t
|
||||
xafb_mmap(v, offset, prot)
|
||||
void *v;
|
||||
off_t offset;
|
||||
int prot;
|
||||
xafb_mmap(void *v, off_t offset, int prot)
|
||||
{
|
||||
struct xafb_softc *sc = v;
|
||||
struct xafb_devconfig *dc = sc->sc_dc;
|
||||
|
@ -305,12 +288,8 @@ xafb_mmap(v, offset, prot)
|
|||
}
|
||||
|
||||
int
|
||||
xafb_alloc_screen(v, scrdesc, cookiep, ccolp, crowp, attrp)
|
||||
void *v;
|
||||
const struct wsscreen_descr *scrdesc;
|
||||
void **cookiep;
|
||||
int *ccolp, *crowp;
|
||||
long *attrp;
|
||||
xafb_alloc_screen(void *v, const struct wsscreen_descr *scrdesc,
|
||||
void **cookiep, int *ccolp, int *crowp, long *attrp)
|
||||
{
|
||||
struct xafb_softc *sc = v;
|
||||
struct rasops_info *ri = &sc->sc_dc->dc_ri;
|
||||
|
@ -329,9 +308,7 @@ xafb_alloc_screen(v, scrdesc, cookiep, ccolp, crowp, attrp)
|
|||
}
|
||||
|
||||
void
|
||||
xafb_free_screen(v, cookie)
|
||||
void *v;
|
||||
void *cookie;
|
||||
xafb_free_screen(void *v, void *cookie)
|
||||
{
|
||||
struct xafb_softc *sc = v;
|
||||
|
||||
|
@ -342,18 +319,15 @@ xafb_free_screen(v, cookie)
|
|||
}
|
||||
|
||||
int
|
||||
xafb_show_screen(v, cookie, waitok, cb, cbarg)
|
||||
void *v;
|
||||
void *cookie;
|
||||
int waitok;
|
||||
void (*cb) __P((void *, int, int));
|
||||
void *cbarg;
|
||||
xafb_show_screen(void *v, void *cookie, int waitok,
|
||||
void (*cb)(void *, int, int), void *cbarg)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
xafb_cnattach()
|
||||
xafb_cnattach(void)
|
||||
{
|
||||
struct xafb_devconfig *dc = &xafb_console_dc;
|
||||
struct rasops_info *ri = &dc->dc_ri;
|
||||
|
@ -377,9 +351,7 @@ xafb_cnattach()
|
|||
}
|
||||
|
||||
int
|
||||
xafb_getcmap(sc, cm)
|
||||
struct xafb_softc *sc;
|
||||
struct wsdisplay_cmap *cm;
|
||||
xafb_getcmap(struct xafb_softc *sc, struct wsdisplay_cmap *cm)
|
||||
{
|
||||
u_int index = cm->index;
|
||||
u_int count = cm->count;
|
||||
|
@ -402,9 +374,7 @@ xafb_getcmap(sc, cm)
|
|||
}
|
||||
|
||||
int
|
||||
xafb_putcmap(sc, cm)
|
||||
struct xafb_softc *sc;
|
||||
struct wsdisplay_cmap *cm;
|
||||
xafb_putcmap(struct xafb_softc *sc, struct wsdisplay_cmap *cm)
|
||||
{
|
||||
u_int index = cm->index;
|
||||
u_int count = cm->count;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: zs_ap.c,v 1.16 2003/07/15 02:59:29 lukem Exp $ */
|
||||
/* $NetBSD: zs_ap.c,v 1.17 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
|
@ -45,7 +45,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: zs_ap.c,v 1.16 2003/07/15 02:59:29 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: zs_ap.c,v 1.17 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -96,7 +96,7 @@ __KERNEL_RCSID(0, "$NetBSD: zs_ap.c,v 1.16 2003/07/15 02:59:29 lukem Exp $");
|
|||
#define INTMASK_SCC 0x01
|
||||
|
||||
extern int zs_def_cflag;
|
||||
extern void (*zs_delay) __P((void));
|
||||
extern void (*zs_delay)(void);
|
||||
|
||||
/*
|
||||
* The news5000 provides a 9.8304 MHz clock to the ZS chips.
|
||||
|
@ -140,15 +140,14 @@ static u_char zs_init_reg[16] = {
|
|||
ZSWR15_BREAK_IE,
|
||||
};
|
||||
|
||||
static struct zschan * zs_get_chan_addr __P((int, int));
|
||||
static void zs_ap_delay __P((void));
|
||||
static int zshard_ap __P((void *));
|
||||
static int zs_getc __P((void *));
|
||||
static void zs_putc __P((void *, int));
|
||||
static struct zschan * zs_get_chan_addr(int, int);
|
||||
static void zs_ap_delay(void);
|
||||
static int zshard_ap(void *);
|
||||
static int zs_getc(void *);
|
||||
static void zs_putc(void *, int);
|
||||
|
||||
struct zschan *
|
||||
zs_get_chan_addr(zs_unit, channel)
|
||||
int zs_unit, channel;
|
||||
zs_get_chan_addr(int zs_unit, int channel)
|
||||
{
|
||||
caddr_t addr;
|
||||
struct zschan *zc;
|
||||
|
@ -163,11 +162,11 @@ zs_get_chan_addr(zs_unit, channel)
|
|||
} else {
|
||||
zc = (void *)(addr + PORTB_OFFSET);
|
||||
}
|
||||
return (zc);
|
||||
return zc;
|
||||
}
|
||||
|
||||
void
|
||||
zs_ap_delay()
|
||||
zs_ap_delay(void)
|
||||
{
|
||||
|
||||
ZS_DELAY();
|
||||
|
@ -178,8 +177,8 @@ zs_ap_delay()
|
|||
****************************************************************/
|
||||
|
||||
/* Definition of the driver for autoconfig. */
|
||||
int zs_ap_match __P((struct device *, struct cfdata *, void *));
|
||||
void zs_ap_attach __P((struct device *, struct device *, void *));
|
||||
int zs_ap_match(struct device *, struct cfdata *, void *);
|
||||
void zs_ap_attach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(zsc_ap, sizeof(struct zsc_softc),
|
||||
zs_ap_match, zs_ap_attach, NULL, NULL);
|
||||
|
@ -188,10 +187,7 @@ CFATTACH_DECL(zsc_ap, sizeof(struct zsc_softc),
|
|||
* Is the zs chip present?
|
||||
*/
|
||||
int
|
||||
zs_ap_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
zs_ap_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -208,10 +204,7 @@ zs_ap_match(parent, cf, aux)
|
|||
* not set up the keyboard as ttya, etc.
|
||||
*/
|
||||
void
|
||||
zs_ap_attach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
zs_ap_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct zsc_softc *zsc = (void *)self;
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
@ -266,8 +259,8 @@ zs_ap_attach(parent, self, aux)
|
|||
cs->cs_reg_csr = &zc->zc_csr;
|
||||
cs->cs_reg_data = &zc->zc_data;
|
||||
|
||||
bcopy(zs_init_reg, cs->cs_creg, 16);
|
||||
bcopy(zs_init_reg, cs->cs_preg, 16);
|
||||
memcpy(cs->cs_creg, zs_init_reg, 16);
|
||||
memcpy(cs->cs_preg, zs_init_reg, 16);
|
||||
|
||||
/* XXX: Get these from the EEPROM instead? */
|
||||
/* XXX: See the mvme167 code. Better. */
|
||||
|
@ -351,8 +344,7 @@ zs_ap_attach(parent, self, aux)
|
|||
}
|
||||
|
||||
static int
|
||||
zshard_ap(arg)
|
||||
void *arg;
|
||||
zshard_ap(void *arg)
|
||||
{
|
||||
|
||||
zshard(arg);
|
||||
|
@ -363,8 +355,7 @@ zshard_ap(arg)
|
|||
* Polled input char.
|
||||
*/
|
||||
int
|
||||
zs_getc(arg)
|
||||
void *arg;
|
||||
zs_getc(void *arg)
|
||||
{
|
||||
volatile struct zschan *zc = arg;
|
||||
int s, c, rr0;
|
||||
|
@ -384,16 +375,14 @@ zs_getc(arg)
|
|||
* This is used by the kd driver to read scan codes,
|
||||
* so don't translate '\r' ==> '\n' here...
|
||||
*/
|
||||
return (c);
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
* Polled output char.
|
||||
*/
|
||||
void
|
||||
zs_putc(arg, c)
|
||||
void *arg;
|
||||
int c;
|
||||
zs_putc(void *arg, int c)
|
||||
{
|
||||
volatile struct zschan *zc = arg;
|
||||
int s, rr0;
|
||||
|
@ -412,10 +401,10 @@ zs_putc(arg, c)
|
|||
|
||||
/*****************************************************************/
|
||||
|
||||
static void zscnprobe __P((struct consdev *));
|
||||
static void zscninit __P((struct consdev *));
|
||||
static int zscngetc __P((dev_t));
|
||||
static void zscnputc __P((dev_t, int));
|
||||
static void zscnprobe(struct consdev *);
|
||||
static void zscninit(struct consdev *);
|
||||
static int zscngetc(dev_t);
|
||||
static void zscnputc(dev_t, int);
|
||||
|
||||
struct consdev consdev_zs_ap = {
|
||||
zscnprobe,
|
||||
|
@ -431,14 +420,12 @@ struct consdev consdev_zs_ap = {
|
|||
};
|
||||
|
||||
static void
|
||||
zscnprobe(cn)
|
||||
struct consdev *cn;
|
||||
zscnprobe(struct consdev *cn)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
zscninit(cn)
|
||||
struct consdev *cn;
|
||||
zscninit(struct consdev *cn)
|
||||
{
|
||||
extern const struct cdevsw zstty_cdevsw;
|
||||
|
||||
|
@ -448,17 +435,14 @@ zscninit(cn)
|
|||
}
|
||||
|
||||
static int
|
||||
zscngetc(dev)
|
||||
dev_t dev;
|
||||
zscngetc(dev_t dev)
|
||||
{
|
||||
|
||||
return zs_getc((void *)NEWS5000_SCCPORT0A);
|
||||
}
|
||||
|
||||
static void
|
||||
zscnputc(dev, c)
|
||||
dev_t dev;
|
||||
int c;
|
||||
zscnputc(dev_t dev, int c)
|
||||
{
|
||||
|
||||
zs_putc((void *)NEWS5000_SCCPORT0A, c);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fb.c,v 1.18 2003/11/07 19:21:39 dsl Exp $ */
|
||||
/* $NetBSD: fb.c,v 1.19 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fb.c,v 1.18 2003/11/07 19:21:39 dsl Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fb.c,v 1.19 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -65,7 +65,7 @@ int fb_is_console(void);
|
|||
int fb_ioctl(void *, u_long, caddr_t, int, struct proc *);
|
||||
paddr_t fb_mmap(void *, off_t, int);
|
||||
int fb_alloc_screen(void *, const struct wsscreen_descr *, void **, int *,
|
||||
int *, long *);
|
||||
int *, long *);
|
||||
void fb_free_screen(void *, void *);
|
||||
int fb_show_screen(void *, void *, int, void (*)(void *, int, int), void *);
|
||||
|
||||
|
@ -110,10 +110,7 @@ struct wsscreen_list fb_screenlist = {
|
|||
static char *devname[8] = { "NWB-512", "NWB-518", "NWE-501" }; /* XXX ? */
|
||||
|
||||
int
|
||||
fb_match(parent, match, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
fb_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
||||
|
@ -129,9 +126,7 @@ fb_match(parent, match, aux)
|
|||
}
|
||||
|
||||
void
|
||||
fb_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
fb_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct fb_softc *sc = (void *)self;
|
||||
struct wsemuldisplaydev_attach_args waa;
|
||||
|
@ -148,8 +143,8 @@ fb_attach(parent, self, aux)
|
|||
ri = &dc->dc_ri;
|
||||
sc->sc_nscreens = 1;
|
||||
} else {
|
||||
dc = malloc(sizeof(struct fb_devconfig), M_DEVBUF, M_WAITOK);
|
||||
bzero(dc, sizeof(struct fb_devconfig));
|
||||
dc = malloc(sizeof(struct fb_devconfig), M_DEVBUF,
|
||||
M_WAITOK|M_ZERO);
|
||||
|
||||
dc->dc_fbbase = NWB253_VRAM;
|
||||
fb_common_init(dc);
|
||||
|
@ -175,8 +170,7 @@ fb_attach(parent, self, aux)
|
|||
}
|
||||
|
||||
int
|
||||
fb_common_init(dc)
|
||||
struct fb_devconfig *dc;
|
||||
fb_common_init(struct fb_devconfig *dc)
|
||||
{
|
||||
struct rasops_info *ri = &dc->dc_ri;
|
||||
volatile u_short *ctlreg = NWB253_CTLREG;
|
||||
|
@ -226,7 +220,7 @@ fb_common_init(dc)
|
|||
}
|
||||
|
||||
int
|
||||
fb_is_console()
|
||||
fb_is_console(void)
|
||||
{
|
||||
volatile u_int *dipsw = (void *)DIP_SWITCH;
|
||||
|
||||
|
@ -237,12 +231,7 @@ fb_is_console()
|
|||
}
|
||||
|
||||
int
|
||||
fb_ioctl(v, cmd, data, flag, p)
|
||||
void *v;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
fb_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
{
|
||||
struct fb_softc *sc = v;
|
||||
struct fb_devconfig *dc = sc->sc_dc;
|
||||
|
@ -277,10 +266,7 @@ fb_ioctl(v, cmd, data, flag, p)
|
|||
}
|
||||
|
||||
paddr_t
|
||||
fb_mmap(v, offset, prot)
|
||||
void *v;
|
||||
off_t offset;
|
||||
int prot;
|
||||
fb_mmap(void *v, off_t offset, int prot)
|
||||
{
|
||||
struct fb_softc *sc = v;
|
||||
struct fb_devconfig *dc = sc->sc_dc;
|
||||
|
@ -292,12 +278,8 @@ fb_mmap(v, offset, prot)
|
|||
}
|
||||
|
||||
int
|
||||
fb_alloc_screen(v, scrdesc, cookiep, ccolp, crowp, attrp)
|
||||
void *v;
|
||||
const struct wsscreen_descr *scrdesc;
|
||||
void **cookiep;
|
||||
int *ccolp, *crowp;
|
||||
long *attrp;
|
||||
fb_alloc_screen(void *v, const struct wsscreen_descr *scrdesc, void **cookiep,
|
||||
int *ccolp, int *crowp, long *attrp)
|
||||
{
|
||||
struct fb_softc *sc = v;
|
||||
struct rasops_info *ri = &sc->sc_dc->dc_ri;
|
||||
|
@ -316,9 +298,7 @@ fb_alloc_screen(v, scrdesc, cookiep, ccolp, crowp, attrp)
|
|||
}
|
||||
|
||||
void
|
||||
fb_free_screen(v, cookie)
|
||||
void *v;
|
||||
void *cookie;
|
||||
fb_free_screen(void *v, void *cookie)
|
||||
{
|
||||
struct fb_softc *sc = v;
|
||||
|
||||
|
@ -329,18 +309,15 @@ fb_free_screen(v, cookie)
|
|||
}
|
||||
|
||||
int
|
||||
fb_show_screen(v, cookie, waitok, cb, cbarg)
|
||||
void *v;
|
||||
void *cookie;
|
||||
int waitok;
|
||||
void (*cb)(void *, int, int);
|
||||
void *cbarg;
|
||||
fb_show_screen(void *v, void *cookie, int waitok, void (*cb)(void *, int, int),
|
||||
void *cbarg)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
fb_cnattach()
|
||||
fb_cnattach(void)
|
||||
{
|
||||
struct fb_devconfig *dc = &fb_console_dc;
|
||||
struct rasops_info *ri = &dc->dc_ri;
|
||||
|
@ -356,7 +333,7 @@ fb_cnattach()
|
|||
wsdisplay_cnattach(&fb_stdscreen, ri, 0, ri->ri_rows - 1, defattr);
|
||||
}
|
||||
|
||||
static u_char
|
||||
static const uint8_t
|
||||
nwp512_data1[] = {
|
||||
0x00, 0x44,
|
||||
0x01, 0x33,
|
||||
|
@ -374,14 +351,14 @@ nwp512_data1[] = {
|
|||
0x1b, 0x03
|
||||
};
|
||||
|
||||
static u_char
|
||||
static const uint8_t
|
||||
nwp512_data2[] = {
|
||||
0x1e, 0x08,
|
||||
0x20, 0x08,
|
||||
0x21, 0x0d
|
||||
};
|
||||
|
||||
static u_char
|
||||
static const uint8_t
|
||||
nwp518_data1[] = {
|
||||
0x00, 0x52,
|
||||
0x01, 0x40,
|
||||
|
@ -399,14 +376,14 @@ nwp518_data1[] = {
|
|||
0x1b, 0x04
|
||||
};
|
||||
|
||||
static u_char
|
||||
static const uint8_t
|
||||
nwp518_data2[] = {
|
||||
0x1e, 0x08,
|
||||
0x20, 0x00,
|
||||
0x21, 0x00
|
||||
};
|
||||
|
||||
static u_char
|
||||
static const uint8_t
|
||||
nwe501_data1[] = {
|
||||
0x00, 0x4b,
|
||||
0x01, 0x40,
|
||||
|
@ -424,14 +401,14 @@ nwe501_data1[] = {
|
|||
0x1b, 0x04
|
||||
};
|
||||
|
||||
static u_char
|
||||
static const uint8_t
|
||||
nwe501_data2[] = {
|
||||
0x1e, 0x08,
|
||||
0x20, 0x00,
|
||||
0x21, 0x00
|
||||
};
|
||||
|
||||
static u_char
|
||||
static const uint8_t
|
||||
*crtc_data[3][2] = {
|
||||
{ nwp512_data1, nwp512_data2 },
|
||||
{ nwp518_data1, nwp518_data2 },
|
||||
|
@ -444,7 +421,7 @@ fb253_init(void)
|
|||
volatile u_short *ctlreg = NWB253_CTLREG;
|
||||
volatile u_short *crtreg = NWB253_CRTREG;
|
||||
int id = (*ctlreg >> 8) & 0xf;
|
||||
u_char *p;
|
||||
const uint8_t *p;
|
||||
int i;
|
||||
|
||||
*ctlreg = 0; /* stop crtc */
|
||||
|
@ -475,15 +452,14 @@ static char fontarea16[96][32];
|
|||
static char fontarea24[96][96];
|
||||
|
||||
void
|
||||
initfont(ri)
|
||||
struct rasops_info *ri;
|
||||
initfont(struct rasops_info *ri)
|
||||
{
|
||||
int c, x;
|
||||
|
||||
for (c = 0; c < 96; c++) {
|
||||
x = ((c & 0x1f) | ((c & 0xe0) << 2)) << 7;
|
||||
bcopy((char *)0xb8e00000 + x + 96, fontarea16 + c, 32);
|
||||
bcopy((char *)0xb8e00000 + x, fontarea24 + c, 96);
|
||||
memcpy(fontarea16 + c, (char *)0xb8e00000 + x + 96, 32);
|
||||
memcpy(fontarea24 + c, (char *)0xb8e00000 + x, 96);
|
||||
}
|
||||
|
||||
newsrom8x16.name = "rom8x16";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* $NetBSD: hb.c,v 1.13 2003/07/15 02:59:29 lukem Exp $ */
|
||||
/* $NetBSD: hb.c,v 1.14 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: hb.c,v 1.13 2003/07/15 02:59:29 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: hb.c,v 1.14 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -13,10 +13,10 @@ __KERNEL_RCSID(0, "$NetBSD: hb.c,v 1.13 2003/07/15 02:59:29 lukem Exp $");
|
|||
|
||||
#include <newsmips/dev/hbvar.h>
|
||||
|
||||
static int hb_match __P((struct device *, struct cfdata *, void *));
|
||||
static void hb_attach __P((struct device *, struct device *, void *));
|
||||
static int hb_search __P((struct device *, struct cfdata *, void *));
|
||||
static int hb_print __P((void *, const char *));
|
||||
static int hb_match(struct device *, struct cfdata *, void *);
|
||||
static void hb_attach(struct device *, struct device *, void *);
|
||||
static int hb_search(struct device *, struct cfdata *, void *);
|
||||
static int hb_print(void *, const char *);
|
||||
|
||||
CFATTACH_DECL(hb, sizeof(struct device),
|
||||
hb_match, hb_attach, NULL, NULL);
|
||||
|
@ -27,10 +27,7 @@ extern struct cfdriver hb_cd;
|
|||
static struct newsmips_intr hbintr_tab[NLEVEL];
|
||||
|
||||
static int
|
||||
hb_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
hb_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct confargs *ca = aux;
|
||||
|
||||
|
@ -41,10 +38,7 @@ hb_match(parent, cf, aux)
|
|||
}
|
||||
|
||||
static void
|
||||
hb_attach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
hb_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct hb_attach_args ha;
|
||||
struct newsmips_intr *ip;
|
||||
|
@ -62,10 +56,7 @@ hb_attach(parent, self, aux)
|
|||
}
|
||||
|
||||
static int
|
||||
hb_search(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
hb_search(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
||||
|
@ -84,9 +75,7 @@ hb_search(parent, cf, aux)
|
|||
* when there was no match found by config_found().
|
||||
*/
|
||||
static int
|
||||
hb_print(args, name)
|
||||
void *args;
|
||||
const char *name;
|
||||
hb_print(void *args, const char *name)
|
||||
{
|
||||
struct hb_attach_args *ha = args;
|
||||
|
||||
|
@ -101,10 +90,8 @@ hb_print(args, name)
|
|||
}
|
||||
|
||||
void *
|
||||
hb_intr_establish(level, mask, priority, func, arg)
|
||||
int level, mask, priority;
|
||||
int (*func) __P((void *));
|
||||
void *arg;
|
||||
hb_intr_establish(int level, int mask, int priority, int (*func)(void *),
|
||||
void *arg)
|
||||
{
|
||||
struct newsmips_intr *ip;
|
||||
struct newsmips_intrhand *ih, *curih;
|
||||
|
@ -142,9 +129,7 @@ hb_intr_establish(level, mask, priority, func, arg)
|
|||
}
|
||||
|
||||
void
|
||||
hb_intr_dispatch(level, stat)
|
||||
int level;
|
||||
int stat;
|
||||
hb_intr_dispatch(int level, int stat)
|
||||
{
|
||||
struct newsmips_intr *ip;
|
||||
struct newsmips_intrhand *ih;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_le.c,v 1.12 2003/07/15 02:59:29 lukem Exp $ */
|
||||
/* $NetBSD: if_le.c,v 1.13 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.12 2003/07/15 02:59:29 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.13 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "bpfilter.h"
|
||||
|
@ -73,8 +73,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.12 2003/07/15 02:59:29 lukem Exp $");
|
|||
* The real stuff is in dev/ic/am7990reg.h
|
||||
*/
|
||||
struct lereg1 {
|
||||
volatile u_int16_t ler1_rdp; /* data port */
|
||||
volatile u_int16_t ler1_rap; /* register select port */
|
||||
volatile uint16_t ler1_rdp; /* data port */
|
||||
volatile uint16_t ler1_rap; /* register select port */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -87,8 +87,8 @@ struct le_softc {
|
|||
struct lereg1 *sc_r1; /* LANCE registers */
|
||||
};
|
||||
|
||||
static int le_match __P((struct device *, struct cfdata *, void *));
|
||||
static void le_attach __P((struct device *, struct device *, void *));
|
||||
static int le_match(struct device *, struct cfdata *, void *);
|
||||
static void le_attach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(le, sizeof(struct le_softc),
|
||||
le_match, le_attach, NULL, NULL);
|
||||
|
@ -105,38 +105,31 @@ CFATTACH_DECL(le, sizeof(struct le_softc),
|
|||
#define hide static
|
||||
#endif
|
||||
|
||||
hide void lewrcsr __P((struct lance_softc *, u_int16_t, u_int16_t));
|
||||
hide u_int16_t lerdcsr __P((struct lance_softc *, u_int16_t));
|
||||
hide void lewrcsr(struct lance_softc *, uint16_t, uint16_t);
|
||||
hide uint16_t lerdcsr(struct lance_softc *, uint16_t);
|
||||
|
||||
hide void
|
||||
lewrcsr(sc, port, val)
|
||||
struct lance_softc *sc;
|
||||
u_int16_t port, val;
|
||||
lewrcsr(struct lance_softc *sc, uint16_t port, uint16_t val)
|
||||
{
|
||||
register struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1;
|
||||
struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1;
|
||||
|
||||
ler1->ler1_rap = port;
|
||||
ler1->ler1_rdp = val;
|
||||
}
|
||||
|
||||
hide u_int16_t
|
||||
lerdcsr(sc, port)
|
||||
struct lance_softc *sc;
|
||||
u_int16_t port;
|
||||
hide uint16_t
|
||||
lerdcsr(struct lance_softc *sc, uint16_t port)
|
||||
{
|
||||
register struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1;
|
||||
u_int16_t val;
|
||||
struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1;
|
||||
uint16_t val;
|
||||
|
||||
ler1->ler1_rap = port;
|
||||
val = ler1->ler1_rdp;
|
||||
return (val);
|
||||
return val;
|
||||
}
|
||||
|
||||
int
|
||||
le_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
le_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
||||
|
@ -150,9 +143,7 @@ le_match(parent, cf, aux)
|
|||
}
|
||||
|
||||
void
|
||||
le_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
le_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct le_softc *lesc = (struct le_softc *)self;
|
||||
struct lance_softc *sc = &lesc->sc_am7990.lsc;
|
||||
|
@ -171,17 +162,17 @@ le_attach(parent, self, aux)
|
|||
|
||||
case LANCE_PORT:
|
||||
sc->sc_mem = (void *)LANCE_MEMORY;
|
||||
p = (u_char *)(ETHER_ID+16);
|
||||
p = (u_char *)(ETHER_ID + 16);
|
||||
intmask = INTST1_LANCE;
|
||||
break;
|
||||
case LANCE_PORT1:
|
||||
sc->sc_mem = (void *)LANCE_MEMORY1;
|
||||
p = (u_char *)(ETHER_ID1+16);
|
||||
p = (u_char *)(ETHER_ID1 + 16);
|
||||
intmask = INTST1_SLOT3; /* XXX not tested */
|
||||
break;
|
||||
case LANCE_PORT2:
|
||||
sc->sc_mem = (void *)LANCE_MEMORY2;
|
||||
p = (u_char *)(ETHER_ID2+16);
|
||||
p = (u_char *)(ETHER_ID2 + 16);
|
||||
intmask = INTST1_SLOT3; /* XXX not tested */
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kb_hb.c,v 1.7 2003/07/15 02:59:29 lukem Exp $ */
|
||||
/* $NetBSD: kb_hb.c,v 1.8 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kb_hb.c,v 1.7 2003/07/15 02:59:29 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kb_hb.c,v 1.8 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -89,10 +89,7 @@ struct wskbd_mapdata kb_hb_keymapdata = {
|
|||
};
|
||||
|
||||
int
|
||||
kb_hb_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
kb_hb_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
||||
|
@ -103,9 +100,7 @@ kb_hb_match(parent, cf, aux)
|
|||
}
|
||||
|
||||
void
|
||||
kb_hb_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
kb_hb_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct kb_hb_softc *sc = (void *)self;
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
@ -142,8 +137,7 @@ kb_hb_attach(parent, self, aux)
|
|||
}
|
||||
|
||||
int
|
||||
kb_hb_intr(v)
|
||||
void *v;
|
||||
kb_hb_intr(void *v)
|
||||
{
|
||||
struct kb_hb_softc *sc = v;
|
||||
volatile struct kbreg *reg = sc->sc_reg;
|
||||
|
@ -168,7 +162,7 @@ kb_hb_intr(v)
|
|||
}
|
||||
|
||||
void
|
||||
kb_hb_cnattach()
|
||||
kb_hb_cnattach(void)
|
||||
{
|
||||
volatile int *dipsw = (void *)DIP_SWITCH;
|
||||
volatile struct kbreg *reg = (void *)KEYB_DATA;
|
||||
|
@ -178,10 +172,7 @@ kb_hb_cnattach()
|
|||
}
|
||||
|
||||
void
|
||||
kb_hb_cngetc(v, type, data)
|
||||
void *v;
|
||||
u_int *type;
|
||||
int *data;
|
||||
kb_hb_cngetc(void *v, u_int *type, int *data)
|
||||
{
|
||||
volatile struct kbreg *reg = v;
|
||||
volatile u_char *ien = (void *)INTEN0;
|
||||
|
@ -202,35 +193,26 @@ kb_hb_cngetc(v, type, data)
|
|||
}
|
||||
|
||||
void
|
||||
kb_hb_cnpollc(v, on)
|
||||
void *v;
|
||||
int on;
|
||||
kb_hb_cnpollc(void *v, int on)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
kb_hb_enable(v, on)
|
||||
void *v;
|
||||
int on;
|
||||
kb_hb_enable(void *v, int on)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
kb_hb_setleds(v, on)
|
||||
void *v;
|
||||
int on;
|
||||
kb_hb_setleds(void *v, int on)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
kb_hb_ioctl(v, cmd, data, flag, p)
|
||||
void *v;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
kb_hb_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
{
|
||||
|
||||
switch (cmd) {
|
||||
|
||||
case WSKBDIO_GTYPE:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mkclock_hb.c,v 1.2 2003/11/01 22:50:45 tsutsui Exp $ */
|
||||
/* $NetBSD: mkclock_hb.c,v 1.3 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mkclock_hb.c,v 1.2 2003/11/01 22:50:45 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mkclock_hb.c,v 1.3 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -62,20 +62,17 @@ CFATTACH_DECL(mkclock_hb, sizeof(struct mk48txx_softc),
|
|||
extern struct cfdriver mkclock_cd;
|
||||
|
||||
int
|
||||
mkclock_hb_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
mkclock_hb_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct hb_attach_args *ha = aux;
|
||||
static int mkclock_hb_matched;
|
||||
|
||||
/* Only one clock, please. */
|
||||
if (mkclock_hb_matched)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (strcmp(ha->ha_name, mkclock_cd.cd_name))
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
mkclock_hb_matched = 1;
|
||||
|
||||
|
@ -83,9 +80,7 @@ mkclock_hb_match(parent, cf, aux)
|
|||
}
|
||||
|
||||
void
|
||||
mkclock_hb_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
mkclock_hb_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct mk48txx_softc *sc = (void *)self;
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ms_hb.c,v 1.8 2003/07/15 02:59:29 lukem Exp $ */
|
||||
/* $NetBSD: ms_hb.c,v 1.9 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ms_hb.c,v 1.8 2003/07/15 02:59:29 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ms_hb.c,v 1.9 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -73,10 +73,7 @@ struct wsmouse_accessops ms_hb_accessops = {
|
|||
};
|
||||
|
||||
int
|
||||
ms_hb_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
ms_hb_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
||||
|
@ -87,9 +84,7 @@ ms_hb_match(parent, cf, aux)
|
|||
}
|
||||
|
||||
void
|
||||
ms_hb_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
ms_hb_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct ms_hb_softc *sc = (void *)self;
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
@ -118,8 +113,7 @@ ms_hb_attach(parent, self, aux)
|
|||
}
|
||||
|
||||
int
|
||||
ms_hb_intr(v)
|
||||
void *v;
|
||||
ms_hb_intr(void *v)
|
||||
{
|
||||
struct ms_hb_softc *sc = v;
|
||||
volatile struct msreg *reg = sc->sc_reg;
|
||||
|
@ -185,8 +179,7 @@ ms_hb_intr(v)
|
|||
}
|
||||
|
||||
int
|
||||
ms_hb_enable(v)
|
||||
void *v;
|
||||
ms_hb_enable(void *v)
|
||||
{
|
||||
volatile u_char *ien = (void *)INTEN0;
|
||||
|
||||
|
@ -195,8 +188,7 @@ ms_hb_enable(v)
|
|||
}
|
||||
|
||||
void
|
||||
ms_hb_disable(v)
|
||||
void *v;
|
||||
ms_hb_disable(void *v)
|
||||
{
|
||||
volatile u_char *ien = (void *)INTEN0;
|
||||
|
||||
|
@ -204,12 +196,8 @@ ms_hb_disable(v)
|
|||
}
|
||||
|
||||
int
|
||||
ms_hb_ioctl(v, cmd, data, flag, p)
|
||||
void *v;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
ms_hb_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
{
|
||||
|
||||
return EPASSTHROUGH;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: sc_wrap.c,v 1.26 2004/09/18 02:21:33 mycroft Exp $ */
|
||||
/* $NetBSD: sc_wrap.c,v 1.27 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* This driver is slow! Need to rewrite.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sc_wrap.c,v 1.26 2004/09/18 02:21:33 mycroft Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sc_wrap.c,v 1.27 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -34,36 +34,33 @@ __KERNEL_RCSID(0, "$NetBSD: sc_wrap.c,v 1.26 2004/09/18 02:21:33 mycroft Exp $")
|
|||
|
||||
#include <mips/cache.h>
|
||||
|
||||
static int cxd1185_match __P((struct device *, struct cfdata *, void *));
|
||||
static void cxd1185_attach __P((struct device *, struct device *, void *));
|
||||
static int cxd1185_match(struct device *, struct cfdata *, void *);
|
||||
static void cxd1185_attach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(sc, sizeof(struct sc_softc),
|
||||
cxd1185_match, cxd1185_attach, NULL, NULL);
|
||||
|
||||
void cxd1185_init __P((struct sc_softc *));
|
||||
static void free_scb __P((struct sc_softc *, struct sc_scb *));
|
||||
static struct sc_scb *get_scb __P((struct sc_softc *, int));
|
||||
static void sc_scsipi_request __P((struct scsipi_channel *,
|
||||
scsipi_adapter_req_t, void *));
|
||||
static int sc_poll __P((struct sc_softc *, int, int));
|
||||
static void sc_sched __P((struct sc_softc *));
|
||||
void sc_done __P((struct sc_scb *));
|
||||
int sc_intr __P((void *));
|
||||
static void cxd1185_timeout __P((void *));
|
||||
void cxd1185_init(struct sc_softc *);
|
||||
static void free_scb(struct sc_softc *, struct sc_scb *);
|
||||
static struct sc_scb *get_scb(struct sc_softc *, int);
|
||||
static void sc_scsipi_request(struct scsipi_channel *,
|
||||
scsipi_adapter_req_t, void *);
|
||||
static int sc_poll(struct sc_softc *, int, int);
|
||||
static void sc_sched(struct sc_softc *);
|
||||
void sc_done(struct sc_scb *);
|
||||
int sc_intr(void *);
|
||||
static void cxd1185_timeout(void *);
|
||||
|
||||
extern void sc_send __P((struct sc_scb *, int, int));
|
||||
extern int scintr __P((void));
|
||||
extern void scsi_hardreset __P((void));
|
||||
extern int sc_busy __P((struct sc_softc *, int));
|
||||
extern paddr_t kvtophys __P((vaddr_t));
|
||||
extern void sc_send(struct sc_scb *, int, int);
|
||||
extern int scintr(void);
|
||||
extern void scsi_hardreset(void);
|
||||
extern int sc_busy(struct sc_softc *, int);
|
||||
extern paddr_t kvtophys(vaddr_t);
|
||||
|
||||
static int sc_disconnect = IDT_DISCON;
|
||||
|
||||
int
|
||||
cxd1185_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
cxd1185_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
||||
|
@ -74,9 +71,7 @@ cxd1185_match(parent, cf, aux)
|
|||
}
|
||||
|
||||
void
|
||||
cxd1185_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
cxd1185_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct sc_softc *sc = (void *)self;
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
@ -134,8 +129,7 @@ cxd1185_attach(parent, self, aux)
|
|||
}
|
||||
|
||||
void
|
||||
cxd1185_init(sc)
|
||||
struct sc_softc *sc;
|
||||
cxd1185_init(struct sc_softc *sc)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -146,9 +140,7 @@ cxd1185_init(sc)
|
|||
}
|
||||
|
||||
void
|
||||
free_scb(sc, scb)
|
||||
struct sc_softc *sc;
|
||||
struct sc_scb *scb;
|
||||
free_scb(struct sc_softc *sc, struct sc_scb *scb)
|
||||
{
|
||||
int s;
|
||||
|
||||
|
@ -167,9 +159,7 @@ free_scb(sc, scb)
|
|||
}
|
||||
|
||||
struct sc_scb *
|
||||
get_scb(sc, flags)
|
||||
struct sc_softc *sc;
|
||||
int flags;
|
||||
get_scb(struct sc_softc *sc, int flags)
|
||||
{
|
||||
int s;
|
||||
struct sc_scb *scb;
|
||||
|
@ -188,10 +178,8 @@ get_scb(sc, flags)
|
|||
}
|
||||
|
||||
void
|
||||
sc_scsipi_request(chan, req, arg)
|
||||
struct scsipi_channel *chan;
|
||||
scsipi_adapter_req_t req;
|
||||
void *arg;
|
||||
sc_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||
void *arg)
|
||||
{
|
||||
struct scsipi_xfer *xs;
|
||||
struct scsipi_periph *periph;
|
||||
|
@ -216,7 +204,7 @@ sc_scsipi_request(chan, req, arg)
|
|||
scb->istatus = 0;
|
||||
scb->tstatus = 0;
|
||||
scb->message = 0;
|
||||
bzero(scb->msgbuf, sizeof(scb->msgbuf));
|
||||
memset(scb->msgbuf, 0, sizeof(scb->msgbuf));
|
||||
|
||||
s = splbio();
|
||||
|
||||
|
@ -249,9 +237,7 @@ sc_scsipi_request(chan, req, arg)
|
|||
* Used when interrupt driven I/O isn't allowed, e.g. during boot.
|
||||
*/
|
||||
int
|
||||
sc_poll(sc, chan, count)
|
||||
struct sc_softc *sc;
|
||||
int chan, count;
|
||||
sc_poll(struct sc_softc *sc, int chan, int count)
|
||||
{
|
||||
volatile u_char *int_stat = (void *)INTST1;
|
||||
volatile u_char *int_clear = (void *)INTCLR1;
|
||||
|
@ -278,8 +264,7 @@ sc_poll(sc, chan, count)
|
|||
}
|
||||
|
||||
void
|
||||
sc_sched(sc)
|
||||
struct sc_softc *sc;
|
||||
sc_sched(struct sc_softc *sc)
|
||||
{
|
||||
struct scsipi_xfer *xs;
|
||||
struct scsipi_periph *periph;
|
||||
|
@ -318,7 +303,9 @@ start:
|
|||
int i, pn;
|
||||
vaddr_t va;
|
||||
|
||||
/* bzero(&sc->sc_map[chan], sizeof(struct sc_map)); */
|
||||
#if 0
|
||||
memset(&sc->sc_map[chan], 0, sizeof(struct sc_map));
|
||||
#endif
|
||||
|
||||
va = (vaddr_t)xs->data;
|
||||
|
||||
|
@ -361,12 +348,12 @@ start:
|
|||
}
|
||||
|
||||
void
|
||||
sc_done(scb)
|
||||
struct sc_scb *scb;
|
||||
sc_done(struct sc_scb *scb)
|
||||
{
|
||||
struct scsipi_xfer *xs = scb->xs;
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
struct sc_softc *sc = (void *)periph->periph_channel->chan_adapter->adapt_dev;
|
||||
struct sc_softc *sc =
|
||||
(void *)periph->periph_channel->chan_adapter->adapt_dev;
|
||||
|
||||
xs->resid = 0;
|
||||
xs->status = 0;
|
||||
|
@ -404,8 +391,7 @@ sc_done(scb)
|
|||
}
|
||||
|
||||
int
|
||||
sc_intr(v)
|
||||
void *v;
|
||||
sc_intr(void *v)
|
||||
{
|
||||
/* struct sc_softc *sc = v; */
|
||||
volatile u_char *gsp = (u_char *)DMAC_GSTAT;
|
||||
|
@ -440,15 +426,11 @@ sc_intr(v)
|
|||
* SCOP_RSENSE request
|
||||
*/
|
||||
void
|
||||
scop_rsense(intr, sc_param, lun, ie, count, param)
|
||||
register int intr;
|
||||
register struct scsi *sc_param;
|
||||
register int lun;
|
||||
register int ie;
|
||||
register int count;
|
||||
register caddr_t param;
|
||||
scop_rsense(int intr, struct scsi *sc_param, int lun, int ie, int count,
|
||||
caddr_t param)
|
||||
{
|
||||
bzero(sc_param, sizeof(struct scsi));
|
||||
|
||||
memset(sc_param, 0, sizeof(struct scsi));
|
||||
sc_param->identify = MSG_IDENT | sc_disconnect | (lun & IDT_DRMASK);
|
||||
sc_param->sc_lun = lun;
|
||||
|
||||
|
@ -464,8 +446,7 @@ scop_rsense(intr, sc_param, lun, ie, count, param)
|
|||
#endif
|
||||
|
||||
void
|
||||
cxd1185_timeout(arg)
|
||||
void *arg;
|
||||
cxd1185_timeout(void *arg)
|
||||
{
|
||||
struct sc_scb *scb = arg;
|
||||
struct scsipi_xfer *xs = scb->xs;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: scsi_1185.c,v 1.14 2004/02/13 11:36:16 wiz Exp $ */
|
||||
/* $NetBSD: scsi_1185.c,v 1.15 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -53,7 +53,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: scsi_1185.c,v 1.14 2004/02/13 11:36:16 wiz Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: scsi_1185.c,v 1.15 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -81,7 +81,6 @@ __KERNEL_RCSID(0, "$NetBSD: scsi_1185.c,v 1.14 2004/02/13 11:36:16 wiz Exp $");
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#define VOLATILE volatile
|
||||
#define ABORT_SYNCTR_MES_FROM_TARGET
|
||||
#define SCSI_1185AQ
|
||||
#define RESET_RECOVER
|
||||
|
@ -133,39 +132,39 @@ static int dmac_map_init = 0;
|
|||
|
||||
extern struct cfdriver sc_cd;
|
||||
|
||||
void sc_send __P((struct sc_scb *, int, int));
|
||||
int scintr __P((void));
|
||||
void scsi_hardreset __P((void));
|
||||
void scsi_chipreset __P((struct sc_softc *));
|
||||
void scsi_softreset __P((struct sc_softc *));
|
||||
int sc_busy __P((struct sc_softc *, int));
|
||||
void sc_send(struct sc_scb *, int, int);
|
||||
int scintr(void);
|
||||
void scsi_hardreset(void);
|
||||
void scsi_chipreset(struct sc_softc *);
|
||||
void scsi_softreset(struct sc_softc *);
|
||||
int sc_busy(struct sc_softc *, int);
|
||||
|
||||
static int WAIT_STATR_BITCLR __P((int));
|
||||
static int WAIT_STATR_BITSET __P((int));
|
||||
static void SET_CMD __P((struct sc_softc *, int));
|
||||
static void SET_CNT __P((int));
|
||||
static int GET_CNT __P((void));
|
||||
static void GET_INTR __P((VOLATILE int *, VOLATILE int *));
|
||||
static void sc_start __P((struct sc_softc *));
|
||||
static void sc_resel __P((struct sc_softc *));
|
||||
static void sc_discon __P((struct sc_softc *));
|
||||
static void sc_pmatch __P((struct sc_softc *));
|
||||
static void flush_fifo __P((struct sc_softc *));
|
||||
static void sc_cout __P((struct sc_softc *, struct sc_chan_stat *));
|
||||
static void sc_min __P((struct sc_softc *, struct sc_chan_stat *));
|
||||
static void sc_mout __P((struct sc_softc *, struct sc_chan_stat *));
|
||||
static void sc_sin __P((struct sc_softc *, VOLATILE struct sc_chan_stat *));
|
||||
static void sc_dio __P((struct sc_softc *, VOLATILE struct sc_chan_stat *));
|
||||
static void sc_dio_pad __P((struct sc_softc *, VOLATILE struct sc_chan_stat *));
|
||||
static void print_scsi_stat __P((struct sc_softc *));
|
||||
static void append_wb __P((struct sc_softc *, struct sc_chan_stat *));
|
||||
static struct sc_chan_stat *get_wb_chan __P((struct sc_softc *));
|
||||
static int release_wb __P((struct sc_softc *));
|
||||
static void adjust_transfer __P((struct sc_softc *, struct sc_chan_stat *));
|
||||
static void clean_k2dcache __P((struct sc_scb *));
|
||||
static int WAIT_STATR_BITCLR(int);
|
||||
static int WAIT_STATR_BITSET(int);
|
||||
static void SET_CMD(struct sc_softc *, int);
|
||||
static void SET_CNT(int);
|
||||
static int GET_CNT(void);
|
||||
static void GET_INTR(volatile int *, volatile int *);
|
||||
static void sc_start(struct sc_softc *);
|
||||
static void sc_resel(struct sc_softc *);
|
||||
static void sc_discon(struct sc_softc *);
|
||||
static void sc_pmatch(struct sc_softc *);
|
||||
static void flush_fifo(struct sc_softc *);
|
||||
static void sc_cout(struct sc_softc *, struct sc_chan_stat *);
|
||||
static void sc_min(struct sc_softc *, struct sc_chan_stat *);
|
||||
static void sc_mout(struct sc_softc *, struct sc_chan_stat *);
|
||||
static void sc_sin(struct sc_softc *, volatile struct sc_chan_stat *);
|
||||
static void sc_dio(struct sc_softc *, volatile struct sc_chan_stat *);
|
||||
static void sc_dio_pad(struct sc_softc *, volatile struct sc_chan_stat *);
|
||||
static void print_scsi_stat(struct sc_softc *);
|
||||
static void append_wb(struct sc_softc *, struct sc_chan_stat *);
|
||||
static struct sc_chan_stat *get_wb_chan(struct sc_softc *);
|
||||
static int release_wb(struct sc_softc *);
|
||||
static void adjust_transfer(struct sc_softc *, struct sc_chan_stat *);
|
||||
static void clean_k2dcache(struct sc_scb *);
|
||||
|
||||
extern void sc_done __P((struct sc_scb *));
|
||||
extern paddr_t kvtophys __P((vaddr_t));
|
||||
extern void sc_done(struct sc_scb *);
|
||||
extern paddr_t kvtophys(vaddr_t);
|
||||
|
||||
#if defined(__mips__) && defined(CPU_SINGLE)
|
||||
#define dma_reset(x) { \
|
||||
|
@ -176,66 +175,63 @@ extern paddr_t kvtophys __P((vaddr_t));
|
|||
#endif
|
||||
|
||||
int
|
||||
WAIT_STATR_BITCLR(bitmask)
|
||||
register int bitmask;
|
||||
WAIT_STATR_BITCLR(int bitmask)
|
||||
{
|
||||
register int iloop;
|
||||
register VOLATILE int dummy;
|
||||
int iloop;
|
||||
volatile int dummy;
|
||||
|
||||
iloop = 0;
|
||||
do {
|
||||
dummy = sc_statr;
|
||||
DMAC_WAIT0;
|
||||
if (iloop++ > CHECK_LOOP_CNT)
|
||||
return (-1);
|
||||
return -1;
|
||||
} while (dummy & bitmask);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
WAIT_STATR_BITSET(bitmask)
|
||||
register int bitmask;
|
||||
WAIT_STATR_BITSET(int bitmask)
|
||||
{
|
||||
register int iloop;
|
||||
register VOLATILE int dummy;
|
||||
int iloop;
|
||||
volatile int dummy;
|
||||
|
||||
iloop = 0;
|
||||
do {
|
||||
dummy = sc_statr;
|
||||
DMAC_WAIT0;
|
||||
if (iloop++ > CHECK_LOOP_CNT)
|
||||
return (-1);
|
||||
return -1;
|
||||
} while ((dummy & bitmask) == 0);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
SET_CMD(sc, CMD)
|
||||
struct sc_softc *sc;
|
||||
register int CMD;
|
||||
SET_CMD(struct sc_softc *sc, int CMD)
|
||||
{
|
||||
(void) WAIT_STATR_BITCLR(R0_CIP);
|
||||
sc->lastcmd = (CMD);
|
||||
sc_comr = (CMD);
|
||||
|
||||
(void)WAIT_STATR_BITCLR(R0_CIP);
|
||||
sc->lastcmd = CMD;
|
||||
sc_comr = CMD;
|
||||
DMAC_WAIT0;
|
||||
}
|
||||
|
||||
void
|
||||
SET_CNT(COUNT)
|
||||
register int COUNT;
|
||||
SET_CNT(int COUNT)
|
||||
{
|
||||
sc_tclow = (COUNT) & 0xff;
|
||||
|
||||
sc_tclow = COUNT & 0xff;
|
||||
DMAC_WAIT0;
|
||||
sc_tcmid = ((COUNT) >> 8) & 0xff;
|
||||
sc_tcmid = (COUNT >> 8) & 0xff;
|
||||
DMAC_WAIT0;
|
||||
sc_tchi = ((COUNT) >> 16) & 0xff;
|
||||
sc_tchi = (COUNT >> 16) & 0xff;
|
||||
DMAC_WAIT0;
|
||||
}
|
||||
|
||||
int
|
||||
GET_CNT()
|
||||
GET_CNT(void)
|
||||
{
|
||||
register VOLATILE int COUNT;
|
||||
volatile int COUNT;
|
||||
|
||||
COUNT = sc_tclow;
|
||||
DMAC_WAIT0;
|
||||
|
@ -243,15 +239,14 @@ GET_CNT()
|
|||
DMAC_WAIT0;
|
||||
COUNT += (sc_tchi << 16) & 0xff0000;
|
||||
DMAC_WAIT0;
|
||||
return (COUNT);
|
||||
return COUNT;
|
||||
}
|
||||
|
||||
void
|
||||
GET_INTR(DATA1, DATA2)
|
||||
register VOLATILE int *DATA1;
|
||||
register VOLATILE int *DATA2;
|
||||
GET_INTR(volatile int *DATA1, volatile int *DATA2)
|
||||
{
|
||||
(void) WAIT_STATR_BITCLR(R0_CIP);
|
||||
|
||||
(void)WAIT_STATR_BITCLR(R0_CIP);
|
||||
while (sc_statr & R0_MIRQ) {
|
||||
DMAC_WAIT0;
|
||||
*DATA1 |= sc_intrq1;
|
||||
|
@ -263,9 +258,7 @@ GET_INTR(DATA1, DATA2)
|
|||
|
||||
|
||||
void
|
||||
sc_send(scb, chan, ie)
|
||||
struct sc_scb *scb;
|
||||
int chan, ie;
|
||||
sc_send(struct sc_scb *scb, int chan, int ie)
|
||||
{
|
||||
struct sc_softc *sc = scb->scb_softc;
|
||||
struct sc_chan_stat *cs;
|
||||
|
@ -343,8 +336,7 @@ sc_send(scb, chan, ie)
|
|||
* SCSI start up routine
|
||||
*/
|
||||
void
|
||||
sc_start(sc)
|
||||
struct sc_softc *sc;
|
||||
sc_start(struct sc_softc *sc)
|
||||
{
|
||||
struct sc_chan_stat *cs;
|
||||
int chan, dummy;
|
||||
|
@ -415,11 +407,11 @@ sc_start_exit:
|
|||
* SCSI interrupt service routine
|
||||
*/
|
||||
int
|
||||
scintr()
|
||||
scintr(void)
|
||||
{
|
||||
register int iloop;
|
||||
register VOLATILE int chan;
|
||||
register VOLATILE int dummy;
|
||||
int iloop;
|
||||
volatile int chan;
|
||||
volatile int dummy;
|
||||
struct sc_softc *sc;
|
||||
struct sc_chan_stat *cs;
|
||||
int s_int1, s_int2;
|
||||
|
@ -501,7 +493,8 @@ scintr_loop:
|
|||
* SELECTION timeout
|
||||
*/
|
||||
sc->int_stat1 &= ~R2_STO;
|
||||
if ((sc->int_stat2&(R3_PHC|R3_RMSG)) != (R3_PHC|R3_RMSG)) {
|
||||
if ((sc->int_stat2&(R3_PHC|R3_RMSG)) !=
|
||||
(R3_PHC|R3_RMSG)) {
|
||||
sc->ipc = chan;
|
||||
sc->ip = &sc->chan_stat[chan];
|
||||
sc->sel_stat[chan] = SEL_TIMEOUT;
|
||||
|
@ -568,8 +561,8 @@ scintr_loop:
|
|||
adjust_transfer(sc, sc->ip);
|
||||
}
|
||||
if (sc->int_stat2 & R3_SPE) {
|
||||
register int VOLATILE statr;
|
||||
register int VOLATILE cmonr;
|
||||
int volatile statr;
|
||||
int volatile cmonr;
|
||||
|
||||
statr = sc_statr;
|
||||
DMAC_WAIT0;
|
||||
|
@ -654,7 +647,7 @@ scintr_loop:
|
|||
}
|
||||
|
||||
scintr_exit:
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -663,11 +656,11 @@ scintr_exit:
|
|||
* And call scsi_softreset().
|
||||
*/
|
||||
void
|
||||
scsi_hardreset()
|
||||
scsi_hardreset(void)
|
||||
{
|
||||
register int s;
|
||||
int s;
|
||||
#ifdef DMAC_MAP_INIT
|
||||
register int i;
|
||||
int i;
|
||||
#endif
|
||||
struct sc_softc *sc;
|
||||
|
||||
|
@ -706,18 +699,17 @@ scsi_hardreset()
|
|||
*/
|
||||
|
||||
void
|
||||
scsi_chipreset(sc)
|
||||
struct sc_softc *sc;
|
||||
scsi_chipreset(struct sc_softc *sc)
|
||||
{
|
||||
register int s;
|
||||
register VOLATILE int save_ioptr;
|
||||
int s;
|
||||
volatile int save_ioptr;
|
||||
|
||||
s = splscsi();
|
||||
|
||||
#if defined(__mips__) && defined(CPU_SINGLE)
|
||||
dmac_gsel = CH_SCSI;
|
||||
dmac_cwid = 4; /* initialize DMAC SCSI chan */
|
||||
*(unsigned VOLATILE char *)PINTEN |= DMA_INTEN;
|
||||
*(unsigned volatile char *)PINTEN |= DMA_INTEN;
|
||||
dma_reset(CH_SCSI);
|
||||
#endif
|
||||
sc_envir = 0; /* 1/4 clock */
|
||||
|
@ -727,7 +719,7 @@ scsi_chipreset(sc)
|
|||
sc->lastcmd = SCMD_CHIP_RST;
|
||||
sc_comr = SCMD_CHIP_RST; /* reset chip */
|
||||
DMAC_WAIT;
|
||||
(void) WAIT_STATR_BITCLR(R0_CIP);
|
||||
(void)WAIT_STATR_BITCLR(R0_CIP);
|
||||
/*
|
||||
* SCMD_CHIP_RST command reset all register
|
||||
* except sc_statr<7:6> & sc_cmonr.
|
||||
|
@ -765,12 +757,11 @@ scsi_chipreset(sc)
|
|||
}
|
||||
|
||||
void
|
||||
scsi_softreset(sc)
|
||||
struct sc_softc *sc;
|
||||
scsi_softreset(struct sc_softc *sc)
|
||||
{
|
||||
register VOLATILE struct sc_chan_stat *cs;
|
||||
volatile struct sc_chan_stat *cs;
|
||||
int i;
|
||||
/* register int (*handler)(); */
|
||||
/* int (*handler)(); */
|
||||
|
||||
sc->wbq_actf = NULL;
|
||||
sc->wbq_actl = NULL;
|
||||
|
@ -817,13 +808,12 @@ scsi_softreset(sc)
|
|||
* ( RESELECTION phase )
|
||||
*/
|
||||
void
|
||||
sc_resel(sc)
|
||||
struct sc_softc *sc;
|
||||
sc_resel(struct sc_softc *sc)
|
||||
{
|
||||
register struct sc_chan_stat *cs;
|
||||
register VOLATILE int chan;
|
||||
register VOLATILE int statr;
|
||||
register int iloop;
|
||||
struct sc_chan_stat *cs;
|
||||
volatile int chan;
|
||||
volatile int statr;
|
||||
int iloop;
|
||||
|
||||
sc->min_flag = 0;
|
||||
chan = (sc_idenr & R6_SID_MASK) >> SC_TG_SHIFT;
|
||||
|
@ -903,12 +893,11 @@ sc_resel(sc)
|
|||
* ( Target disconnect / job done )
|
||||
*/
|
||||
void
|
||||
sc_discon(sc)
|
||||
struct sc_softc *sc;
|
||||
sc_discon(struct sc_softc *sc)
|
||||
{
|
||||
register VOLATILE struct sc_chan_stat *cs;
|
||||
/* register int (*handler)(); */
|
||||
register VOLATILE int dummy;
|
||||
volatile struct sc_chan_stat *cs;
|
||||
/* int (*handler)(); */
|
||||
volatile int dummy;
|
||||
|
||||
/*
|
||||
* Signal reflection on BSY has occurred.
|
||||
|
@ -985,13 +974,12 @@ sc_discon_exit:
|
|||
* SCSI phase match interrupt service routine
|
||||
*/
|
||||
void
|
||||
sc_pmatch(sc)
|
||||
struct sc_softc *sc;
|
||||
sc_pmatch(struct sc_softc *sc)
|
||||
{
|
||||
struct sc_chan_stat *cs;
|
||||
register VOLATILE int phase;
|
||||
register VOLATILE int phase2;
|
||||
register VOLATILE int cmonr;
|
||||
volatile int phase;
|
||||
volatile int phase2;
|
||||
volatile int cmonr;
|
||||
|
||||
sc->int_stat2 &= ~R3_FNC; /* XXXXXXXX */
|
||||
|
||||
|
@ -1060,12 +1048,11 @@ sc_pmatch(sc)
|
|||
|
||||
|
||||
void
|
||||
flush_fifo(sc)
|
||||
struct sc_softc *sc;
|
||||
flush_fifo(struct sc_softc *sc)
|
||||
{
|
||||
register VOLATILE int dummy;
|
||||
VOLATILE int tmp;
|
||||
VOLATILE int tmp0;
|
||||
volatile int dummy;
|
||||
volatile int tmp;
|
||||
volatile int tmp0;
|
||||
|
||||
dummy = sc_ffstr;
|
||||
DMAC_WAIT0;
|
||||
|
@ -1089,14 +1076,12 @@ flush_fifo(sc)
|
|||
* SCSI command send routine
|
||||
*/
|
||||
void
|
||||
sc_cout(sc, cs)
|
||||
struct sc_softc *sc;
|
||||
register struct sc_chan_stat *cs;
|
||||
sc_cout(struct sc_softc *sc, struct sc_chan_stat *cs)
|
||||
{
|
||||
register int iloop;
|
||||
register int cdb_bytes;
|
||||
register VOLATILE int dummy;
|
||||
register VOLATILE int statr;
|
||||
int iloop;
|
||||
int cdb_bytes;
|
||||
volatile int dummy;
|
||||
volatile int statr;
|
||||
struct scsipi_xfer *xs;
|
||||
|
||||
if (cs->comflg == CF_SET) {
|
||||
|
@ -1178,13 +1163,11 @@ sc_cout(sc, cs)
|
|||
* SCSI message accept routine
|
||||
*/
|
||||
void
|
||||
sc_min(sc, cs)
|
||||
struct sc_softc *sc;
|
||||
register struct sc_chan_stat *cs;
|
||||
sc_min(struct sc_softc *sc, struct sc_chan_stat *cs)
|
||||
{
|
||||
struct sc_scb *scb = cs->scb;
|
||||
struct scsipi_xfer *xs = scb->xs;
|
||||
register VOLATILE int dummy;
|
||||
volatile int dummy;
|
||||
|
||||
sc_intok2 = Rb_FNC|Rb_DCNT|Rb_SRST|Rb_PHC|Rb_SPE|Rb_RMSG;
|
||||
DMAC_WAIT0;
|
||||
|
@ -1306,7 +1289,7 @@ sc_min(sc, cs)
|
|||
#else
|
||||
if (scb->msgbuf[2] == 0x01) {
|
||||
#endif
|
||||
register int i;
|
||||
int i;
|
||||
/*
|
||||
* receive Synchronous transfer message reply
|
||||
* calculate transfer period val
|
||||
|
@ -1335,17 +1318,15 @@ sc_min(sc, cs)
|
|||
* SCSI message send routine
|
||||
*/
|
||||
void
|
||||
sc_mout(sc, cs)
|
||||
struct sc_softc *sc;
|
||||
register struct sc_chan_stat *cs;
|
||||
sc_mout(struct sc_softc *sc, struct sc_chan_stat *cs)
|
||||
{
|
||||
register struct sc_scb *scb = cs->scb;
|
||||
register u_char *mp;
|
||||
register int cnt;
|
||||
register int iloop;
|
||||
register VOLATILE int dummy;
|
||||
VOLATILE int tmp;
|
||||
VOLATILE int tmp0;
|
||||
struct sc_scb *scb = cs->scb;
|
||||
u_char *mp;
|
||||
int cnt;
|
||||
int iloop;
|
||||
volatile int dummy;
|
||||
volatile int tmp;
|
||||
volatile int tmp0;
|
||||
|
||||
flush_fifo(sc);
|
||||
|
||||
|
@ -1398,7 +1379,7 @@ sc_mout(sc, cs)
|
|||
return;
|
||||
} while ((dummy & R4_MREQ) == 0);
|
||||
SET_CMD(sc, SCMD_NGT_ATN);
|
||||
(void) WAIT_STATR_BITCLR(R0_CIP);
|
||||
(void)WAIT_STATR_BITCLR(R0_CIP);
|
||||
GET_INTR(&tmp0, &tmp); /* clear interrupt */
|
||||
|
||||
dummy = sc_cmonr;
|
||||
|
@ -1461,12 +1442,10 @@ sc_mout(sc, cs)
|
|||
* SCSI status accept routine
|
||||
*/
|
||||
void
|
||||
sc_sin(sc, cs)
|
||||
struct sc_softc *sc;
|
||||
register VOLATILE struct sc_chan_stat *cs;
|
||||
sc_sin(struct sc_softc *sc, volatile struct sc_chan_stat *cs)
|
||||
{
|
||||
register VOLATILE int dummy;
|
||||
register int iloop;
|
||||
volatile int dummy;
|
||||
int iloop;
|
||||
|
||||
flush_fifo(sc);
|
||||
|
||||
|
@ -1484,7 +1463,7 @@ sc_sin(sc, cs)
|
|||
|
||||
SET_CMD(sc, SCMD_TR_INFO);
|
||||
|
||||
(void) WAIT_STATR_BITCLR(R0_CIP);
|
||||
(void)WAIT_STATR_BITCLR(R0_CIP);
|
||||
|
||||
sc->int_stat2 &= ~R3_FNC;
|
||||
iloop = 0;
|
||||
|
@ -1503,16 +1482,14 @@ sc_sin(sc, cs)
|
|||
* SCSI data in/out routine
|
||||
*/
|
||||
void
|
||||
sc_dio(sc, cs)
|
||||
struct sc_softc *sc;
|
||||
register VOLATILE struct sc_chan_stat *cs;
|
||||
sc_dio(struct sc_softc *sc, volatile struct sc_chan_stat *cs)
|
||||
{
|
||||
register VOLATILE struct sc_scb *scb;
|
||||
register int i;
|
||||
register int pages;
|
||||
register u_int tag;
|
||||
register u_int pfn;
|
||||
VOLATILE int phase;
|
||||
volatile struct sc_scb *scb;
|
||||
int i;
|
||||
int pages;
|
||||
u_int tag;
|
||||
u_int pfn;
|
||||
volatile int phase;
|
||||
struct scsipi_xfer *xs;
|
||||
|
||||
scb = cs->scb;
|
||||
|
@ -1636,11 +1613,9 @@ sc_dio(sc, cs)
|
|||
|
||||
#define MAX_TR_CNT24 ((1 << 24) -1)
|
||||
void
|
||||
sc_dio_pad(sc, cs)
|
||||
struct sc_softc *sc;
|
||||
register VOLATILE struct sc_chan_stat *cs;
|
||||
sc_dio_pad(struct sc_softc *sc, volatile struct sc_chan_stat *cs)
|
||||
{
|
||||
register int dummy;
|
||||
int dummy;
|
||||
|
||||
if (cs->act_trcnt >= 0)
|
||||
return;
|
||||
|
@ -1657,9 +1632,9 @@ sc_dio_pad(sc, cs)
|
|||
}
|
||||
|
||||
void
|
||||
print_scsi_stat(sc)
|
||||
struct sc_softc *sc;
|
||||
print_scsi_stat(struct sc_softc *sc)
|
||||
{
|
||||
|
||||
printf("ipc=%d wrc=%d wbc=%d\n", sc->ipc, sc->wrc, sc->wbc);
|
||||
}
|
||||
|
||||
|
@ -1667,11 +1642,10 @@ print_scsi_stat(sc)
|
|||
* return 0 if it was done. Or retun TRUE if it is busy.
|
||||
*/
|
||||
int
|
||||
sc_busy(sc, chan)
|
||||
struct sc_softc *sc;
|
||||
register int chan;
|
||||
sc_busy(struct sc_softc *sc, int chan)
|
||||
{
|
||||
return ((int)sc->chan_stat[chan].scb);
|
||||
|
||||
return (int)sc->chan_stat[chan].scb;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1679,9 +1653,7 @@ sc_busy(sc, chan)
|
|||
* append channel into Waiting Bus_free queue
|
||||
*/
|
||||
void
|
||||
append_wb(sc, cs)
|
||||
struct sc_softc *sc;
|
||||
struct sc_chan_stat *cs;
|
||||
append_wb(struct sc_softc *sc, struct sc_chan_stat *cs)
|
||||
{
|
||||
int s;
|
||||
|
||||
|
@ -1700,8 +1672,7 @@ append_wb(sc, cs)
|
|||
* get channel from Waiting Bus_free queue
|
||||
*/
|
||||
struct sc_chan_stat *
|
||||
get_wb_chan(sc)
|
||||
struct sc_softc *sc;
|
||||
get_wb_chan(struct sc_softc *sc)
|
||||
{
|
||||
struct sc_chan_stat *cs;
|
||||
int s;
|
||||
|
@ -1718,8 +1689,7 @@ get_wb_chan(sc)
|
|||
* release channel from Waiting Bus_free queue
|
||||
*/
|
||||
int
|
||||
release_wb(sc)
|
||||
struct sc_softc *sc;
|
||||
release_wb(struct sc_softc *sc)
|
||||
{
|
||||
struct sc_chan_stat *cs;
|
||||
int error = 0;
|
||||
|
@ -1742,9 +1712,7 @@ release_wb(sc)
|
|||
}
|
||||
|
||||
void
|
||||
adjust_transfer(sc, cs)
|
||||
struct sc_softc *sc;
|
||||
struct sc_chan_stat *cs;
|
||||
adjust_transfer(struct sc_softc *sc, struct sc_chan_stat *cs)
|
||||
{
|
||||
struct sc_scb *scb = cs->scb;
|
||||
u_int remain_cnt;
|
||||
|
@ -1778,8 +1746,7 @@ adjust_transfer(sc, cs)
|
|||
|
||||
#ifdef __mips__
|
||||
static void
|
||||
clean_k2dcache(scb)
|
||||
struct sc_scb *scb;
|
||||
clean_k2dcache(struct sc_scb *scb)
|
||||
{
|
||||
struct sc_map *sc_map = scb->sc_map;
|
||||
paddr_t pa;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: zs.c,v 1.19 2003/07/15 02:59:30 lukem Exp $ */
|
||||
/* $NetBSD: zs.c,v 1.20 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
|
@ -45,7 +45,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.19 2003/07/15 02:59:30 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.20 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
|
@ -72,9 +72,7 @@ extern struct cfdriver zsc_cd;
|
|||
int zs_def_cflag = (CREAD | CS8 | HUPCL);
|
||||
|
||||
int
|
||||
zs_print(aux, name)
|
||||
void *aux;
|
||||
const char *name;
|
||||
zs_print(void *aux, const char *name)
|
||||
{
|
||||
struct zsc_attach_args *args = aux;
|
||||
|
||||
|
@ -92,8 +90,7 @@ zs_print(aux, name)
|
|||
* so we have to look at all of them on each interrupt.
|
||||
*/
|
||||
int
|
||||
zshard(arg)
|
||||
void *arg;
|
||||
zshard(void *arg)
|
||||
{
|
||||
struct zsc_softc *zsc;
|
||||
int unit, rval, softreq;
|
||||
|
@ -117,8 +114,7 @@ zshard(arg)
|
|||
* Similar scheme as for zshard (look at all of them)
|
||||
*/
|
||||
void
|
||||
zssoft(arg)
|
||||
void *arg;
|
||||
zssoft(void *arg)
|
||||
{
|
||||
struct zsc_softc *zsc;
|
||||
int s, unit;
|
||||
|
@ -138,28 +134,25 @@ zssoft(arg)
|
|||
* Compute the current baud rate given a ZS channel.
|
||||
*/
|
||||
int
|
||||
zs_get_speed(cs)
|
||||
struct zs_chanstate *cs;
|
||||
zs_get_speed(struct zs_chanstate *cs)
|
||||
{
|
||||
int tconst;
|
||||
|
||||
tconst = zs_read_reg(cs, 12);
|
||||
tconst |= zs_read_reg(cs, 13) << 8;
|
||||
return (TCONST_TO_BPS(cs->cs_brg_clk, tconst));
|
||||
return TCONST_TO_BPS(cs->cs_brg_clk, tconst);
|
||||
}
|
||||
|
||||
/*
|
||||
* MD functions for setting the baud rate and control modes.
|
||||
*/
|
||||
int
|
||||
zs_set_speed(cs, bps)
|
||||
struct zs_chanstate *cs;
|
||||
int bps; /* bits per second */
|
||||
zs_set_speed(struct zs_chanstate *cs, int bps)
|
||||
{
|
||||
int tconst, real_bps;
|
||||
|
||||
if (bps == 0)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (cs->cs_brg_clk == 0)
|
||||
|
@ -168,26 +161,24 @@ zs_set_speed(cs, bps)
|
|||
|
||||
tconst = BPS_TO_TCONST(cs->cs_brg_clk, bps);
|
||||
if (tconst < 0)
|
||||
return (EINVAL);
|
||||
return EINVAL;
|
||||
|
||||
/* Convert back to make sure we can do it. */
|
||||
real_bps = TCONST_TO_BPS(cs->cs_brg_clk, tconst);
|
||||
|
||||
/* XXX - Allow some tolerance here? */
|
||||
if (real_bps != bps)
|
||||
return (EINVAL);
|
||||
return EINVAL;
|
||||
|
||||
cs->cs_preg[12] = tconst;
|
||||
cs->cs_preg[13] = tconst >> 8;
|
||||
|
||||
/* Caller will stuff the pending registers. */
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
zs_set_modes(cs, cflag)
|
||||
struct zs_chanstate *cs;
|
||||
int cflag; /* bits per second */
|
||||
zs_set_modes(struct zs_chanstate *cs, int cflag)
|
||||
{
|
||||
int s;
|
||||
|
||||
|
@ -222,7 +213,7 @@ zs_set_modes(cs, cflag)
|
|||
splx(s);
|
||||
|
||||
/* Caller will stuff the pending registers. */
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -230,9 +221,7 @@ zs_set_modes(cs, cflag)
|
|||
*/
|
||||
|
||||
u_char
|
||||
zs_read_reg(cs, reg)
|
||||
struct zs_chanstate *cs;
|
||||
u_char reg;
|
||||
zs_read_reg(struct zs_chanstate *cs, u_char reg)
|
||||
{
|
||||
u_char val;
|
||||
|
||||
|
@ -244,18 +233,16 @@ zs_read_reg(cs, reg)
|
|||
}
|
||||
|
||||
void
|
||||
zs_write_reg(cs, reg, val)
|
||||
struct zs_chanstate *cs;
|
||||
u_char reg, val;
|
||||
zs_write_reg(struct zs_chanstate *cs, u_char reg, u_char val)
|
||||
{
|
||||
|
||||
*cs->cs_reg_csr = reg;
|
||||
ZS_DELAY();
|
||||
*cs->cs_reg_csr = val;
|
||||
ZS_DELAY();
|
||||
}
|
||||
|
||||
u_char zs_read_csr(cs)
|
||||
struct zs_chanstate *cs;
|
||||
u_char zs_read_csr(struct zs_chanstate *cs)
|
||||
{
|
||||
u_char val;
|
||||
|
||||
|
@ -264,16 +251,14 @@ u_char zs_read_csr(cs)
|
|||
return val;
|
||||
}
|
||||
|
||||
void zs_write_csr(cs, val)
|
||||
struct zs_chanstate *cs;
|
||||
u_char val;
|
||||
void zs_write_csr(struct zs_chanstate *cs, u_char val)
|
||||
{
|
||||
|
||||
*cs->cs_reg_csr = val;
|
||||
ZS_DELAY();
|
||||
}
|
||||
|
||||
u_char zs_read_data(cs)
|
||||
struct zs_chanstate *cs;
|
||||
u_char zs_read_data(struct zs_chanstate *cs)
|
||||
{
|
||||
u_char val;
|
||||
|
||||
|
@ -282,18 +267,17 @@ u_char zs_read_data(cs)
|
|||
return val;
|
||||
}
|
||||
|
||||
void zs_write_data(cs, val)
|
||||
struct zs_chanstate *cs;
|
||||
u_char val;
|
||||
void zs_write_data(struct zs_chanstate *cs, u_char val)
|
||||
{
|
||||
|
||||
*cs->cs_reg_data = val;
|
||||
ZS_DELAY();
|
||||
}
|
||||
|
||||
void
|
||||
zs_abort(cs)
|
||||
struct zs_chanstate *cs;
|
||||
zs_abort(struct zs_chanstate *cs)
|
||||
{
|
||||
|
||||
#ifdef DDB
|
||||
Debugger();
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: zs_hb.c,v 1.17 2003/07/15 02:59:30 lukem Exp $ */
|
||||
/* $NetBSD: zs_hb.c,v 1.18 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
|
@ -45,7 +45,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: zs_hb.c,v 1.17 2003/07/15 02:59:30 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: zs_hb.c,v 1.18 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -126,15 +126,14 @@ static u_char zs_init_reg[16] = {
|
|||
ZSWR15_BREAK_IE,
|
||||
};
|
||||
|
||||
static struct zschan * zs_get_chan_addr __P((int, int));
|
||||
static void zs_hb_delay __P((void));
|
||||
static int zshard_hb __P((void *));
|
||||
static int zs_getc __P((void *));
|
||||
static void zs_putc __P((void *, int));
|
||||
static struct zschan * zs_get_chan_addr(int, int);
|
||||
static void zs_hb_delay(void);
|
||||
static int zshard_hb(void *);
|
||||
static int zs_getc(void *);
|
||||
static void zs_putc(void *, int);
|
||||
|
||||
struct zschan *
|
||||
zs_get_chan_addr(zs_unit, channel)
|
||||
int zs_unit, channel;
|
||||
zs_get_chan_addr(int zs_unit, int channel)
|
||||
{
|
||||
struct zsdevice *addr;
|
||||
struct zschan *zc;
|
||||
|
@ -149,11 +148,11 @@ zs_get_chan_addr(zs_unit, channel)
|
|||
} else {
|
||||
zc = &addr->zs_chan_b;
|
||||
}
|
||||
return (zc);
|
||||
return zc;
|
||||
}
|
||||
|
||||
static void
|
||||
zs_hb_delay()
|
||||
zs_hb_delay(void)
|
||||
{
|
||||
|
||||
ZS_DELAY();
|
||||
|
@ -164,8 +163,8 @@ zs_hb_delay()
|
|||
****************************************************************/
|
||||
|
||||
/* Definition of the driver for autoconfig. */
|
||||
int zs_hb_match __P((struct device *, struct cfdata *, void *));
|
||||
void zs_hb_attach __P((struct device *, struct device *, void *));
|
||||
int zs_hb_match(struct device *, struct cfdata *, void *);
|
||||
void zs_hb_attach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(zsc_hb, sizeof(struct zsc_softc),
|
||||
zs_hb_match, zs_hb_attach, NULL, NULL);
|
||||
|
@ -174,10 +173,7 @@ CFATTACH_DECL(zsc_hb, sizeof(struct zsc_softc),
|
|||
* Is the zs chip present?
|
||||
*/
|
||||
int
|
||||
zs_hb_match(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
zs_hb_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
||||
|
@ -198,10 +194,7 @@ zs_hb_match(parent, cf, aux)
|
|||
* not set up the keyboard as ttya, etc.
|
||||
*/
|
||||
void
|
||||
zs_hb_attach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
zs_hb_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct zsc_softc *zsc = (void *)self;
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
@ -251,8 +244,8 @@ zs_hb_attach(parent, self, aux)
|
|||
cs->cs_reg_csr = &zc->zc_csr;
|
||||
cs->cs_reg_data = &zc->zc_data;
|
||||
|
||||
bcopy(zs_init_reg, cs->cs_creg, 16);
|
||||
bcopy(zs_init_reg, cs->cs_preg, 16);
|
||||
memcpy(cs->cs_creg, zs_init_reg, 16);
|
||||
memcpy(cs->cs_preg, zs_init_reg, 16);
|
||||
|
||||
/* XXX: Get these from the EEPROM instead? */
|
||||
/* XXX: See the mvme167 code. Better. */
|
||||
|
@ -319,8 +312,7 @@ zs_hb_attach(parent, self, aux)
|
|||
}
|
||||
|
||||
static int
|
||||
zshard_hb(arg)
|
||||
void *arg;
|
||||
zshard_hb(void *arg)
|
||||
{
|
||||
int rv;
|
||||
|
||||
|
@ -338,8 +330,7 @@ zshard_hb(arg)
|
|||
* Polled input char.
|
||||
*/
|
||||
int
|
||||
zs_getc(arg)
|
||||
void *arg;
|
||||
zs_getc(void *arg)
|
||||
{
|
||||
volatile struct zschan *zc = arg;
|
||||
int s, c, rr0;
|
||||
|
@ -359,16 +350,14 @@ zs_getc(arg)
|
|||
* This is used by the kd driver to read scan codes,
|
||||
* so don't translate '\r' ==> '\n' here...
|
||||
*/
|
||||
return (c);
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
* Polled output char.
|
||||
*/
|
||||
void
|
||||
zs_putc(arg, c)
|
||||
void *arg;
|
||||
int c;
|
||||
zs_putc(void *arg, int c)
|
||||
{
|
||||
volatile struct zschan *zc = arg;
|
||||
int s, rr0;
|
||||
|
@ -387,10 +376,10 @@ zs_putc(arg, c)
|
|||
|
||||
/*****************************************************************/
|
||||
|
||||
static void zscnprobe __P((struct consdev *));
|
||||
static void zscninit __P((struct consdev *));
|
||||
static int zscngetc __P((dev_t));
|
||||
static void zscnputc __P((dev_t, int));
|
||||
static void zscnprobe(struct consdev *);
|
||||
static void zscninit(struct consdev *);
|
||||
static int zscngetc(dev_t);
|
||||
static void zscnputc(dev_t, int);
|
||||
|
||||
struct consdev consdev_zs = {
|
||||
zscnprobe,
|
||||
|
@ -406,14 +395,12 @@ struct consdev consdev_zs = {
|
|||
};
|
||||
|
||||
static void
|
||||
zscnprobe(cn)
|
||||
struct consdev *cn;
|
||||
zscnprobe(struct consdev *cn)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
zscninit(cn)
|
||||
struct consdev *cn;
|
||||
zscninit(struct consdev *cn)
|
||||
{
|
||||
extern const struct cdevsw zstty_cdevsw;
|
||||
|
||||
|
@ -423,17 +410,14 @@ zscninit(cn)
|
|||
}
|
||||
|
||||
static int
|
||||
zscngetc(dev)
|
||||
dev_t dev;
|
||||
zscngetc(dev_t dev)
|
||||
{
|
||||
|
||||
return zs_getc((void *)SCCPORT0A);
|
||||
}
|
||||
|
||||
static void
|
||||
zscnputc(dev, c)
|
||||
dev_t dev;
|
||||
int c;
|
||||
zscnputc(dev_t dev, int c)
|
||||
{
|
||||
|
||||
zs_putc((void *)SCCPORT0A, c);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: apbus.h,v 1.3 2000/12/03 01:42:30 matt Exp $ */
|
||||
/* $NetBSD: apbus.h,v 1.4 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
|
||||
|
@ -103,6 +103,6 @@ struct apbus_sysinfo {
|
|||
*/
|
||||
|
||||
extern struct apbus_sysinfo *_sip;
|
||||
void apbus_wbflush __P((void));
|
||||
void apbus_wbflush(void);
|
||||
|
||||
#endif /* !__MACHINE_APBUS__ */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bootinfo.h,v 1.2 2004/03/24 17:06:57 drochner Exp $ */
|
||||
/* $NetBSD: bootinfo.h,v 1.3 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997
|
||||
|
@ -73,10 +73,10 @@ struct btinfo_systype {
|
|||
};
|
||||
|
||||
#ifdef _KERNEL
|
||||
void *lookup_bootinfo __P((int));
|
||||
void *lookup_bootinfo(int);
|
||||
#endif
|
||||
|
||||
#ifdef _STANDALONE
|
||||
void bi_init __P((paddr_t));
|
||||
void bi_add __P((void *, int, int));
|
||||
void bi_init(paddr_t);
|
||||
void bi_add(void *, int, int);
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bus.h,v 1.8 2003/06/15 23:09:03 fvdl Exp $ */
|
||||
/* $NetBSD: bus.h,v 1.9 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -119,7 +119,7 @@ void bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh,
|
|||
bus_size_t size);
|
||||
|
||||
/*
|
||||
* u_intN_t bus_space_read_N(bus_space_tag_t tag,
|
||||
* uintN_t bus_space_read_N(bus_space_tag_t tag,
|
||||
* bus_space_handle_t bsh, bus_size_t offset);
|
||||
*
|
||||
* Read a 1, 2, 4, or 8 byte quantity from bus space
|
||||
|
@ -127,13 +127,13 @@ void bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh,
|
|||
*/
|
||||
|
||||
#define bus_space_read_1(t, h, o) \
|
||||
((void) t, (*(volatile u_int8_t *)((h) + (o))))
|
||||
((void) t, (*(volatile uint8_t *)((h) + (o))))
|
||||
|
||||
#define bus_space_read_2(t, h, o) \
|
||||
((void) t, (*(volatile u_int16_t *)((h) + (o))))
|
||||
((void) t, (*(volatile uint16_t *)((h) + (o))))
|
||||
|
||||
#define bus_space_read_4(t, h, o) \
|
||||
((void) t, (*(volatile u_int32_t *)((h) + (o))))
|
||||
((void) t, (*(volatile uint32_t *)((h) + (o))))
|
||||
|
||||
#if 0 /* Cause a link error for bus_space_read_8 */
|
||||
#define bus_space_read_8(t, h, o) !!! bus_space_read_8 unimplemented !!!
|
||||
|
@ -142,7 +142,7 @@ void bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh,
|
|||
/*
|
||||
* void bus_space_read_multi_N(bus_space_tag_t tag,
|
||||
* bus_space_handle_t bsh, bus_size_t offset,
|
||||
* u_intN_t *addr, size_t count);
|
||||
* uintN_t *addr, size_t count);
|
||||
*
|
||||
* Read `count' 1, 2, 4, or 8 byte quantities from bus space
|
||||
* described by tag/handle/offset and copy into buffer provided.
|
||||
|
@ -179,7 +179,7 @@ __NEWSMIPS_bus_space_read_multi(4,32)
|
|||
/*
|
||||
* void bus_space_read_region_N(bus_space_tag_t tag,
|
||||
* bus_space_handle_t bsh, bus_size_t offset,
|
||||
* u_intN_t *addr, size_t count);
|
||||
* uintN_t *addr, size_t count);
|
||||
*
|
||||
* Read `count' 1, 2, 4, or 8 byte quantities from bus space
|
||||
* described by tag/handle and starting at `offset' and copy into
|
||||
|
@ -219,7 +219,7 @@ __NEWSMIPS_bus_space_read_region(4,32)
|
|||
/*
|
||||
* void bus_space_write_N(bus_space_tag_t tag,
|
||||
* bus_space_handle_t bsh, bus_size_t offset,
|
||||
* u_intN_t value);
|
||||
* uintN_t value);
|
||||
*
|
||||
* Write the 1, 2, 4, or 8 byte value `value' to bus space
|
||||
* described by tag/handle/offset.
|
||||
|
@ -228,19 +228,19 @@ __NEWSMIPS_bus_space_read_region(4,32)
|
|||
#define bus_space_write_1(t, h, o, v) \
|
||||
do { \
|
||||
(void) t; \
|
||||
*(volatile u_int8_t *)((h) + (o)) = (v); \
|
||||
*(volatile uint8_t *)((h) + (o)) = (v); \
|
||||
} while (0)
|
||||
|
||||
#define bus_space_write_2(t, h, o, v) \
|
||||
do { \
|
||||
(void) t; \
|
||||
*(volatile u_int16_t *)((h) + (o)) = (v); \
|
||||
*(volatile uint16_t *)((h) + (o)) = (v); \
|
||||
} while (0)
|
||||
|
||||
#define bus_space_write_4(t, h, o, v) \
|
||||
do { \
|
||||
(void) t; \
|
||||
*(volatile u_int32_t *)((h) + (o)) = (v); \
|
||||
*(volatile uint32_t *)((h) + (o)) = (v); \
|
||||
} while (0)
|
||||
|
||||
#if 0 /* Cause a link error for bus_space_write_8 */
|
||||
|
@ -250,7 +250,7 @@ do { \
|
|||
/*
|
||||
* void bus_space_write_multi_N(bus_space_tag_t tag,
|
||||
* bus_space_handle_t bsh, bus_size_t offset,
|
||||
* const u_intN_t *addr, size_t count);
|
||||
* const uintN_t *addr, size_t count);
|
||||
*
|
||||
* Write `count' 1, 2, 4, or 8 byte quantities from the buffer
|
||||
* provided to bus space described by tag/handle/offset.
|
||||
|
@ -288,7 +288,7 @@ __NEWSMIPS_bus_space_write_multi(4,32)
|
|||
/*
|
||||
* void bus_space_write_region_N(bus_space_tag_t tag,
|
||||
* bus_space_handle_t bsh, bus_size_t offset,
|
||||
* const u_intN_t *addr, size_t count);
|
||||
* const uintN_t *addr, size_t count);
|
||||
*
|
||||
* Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
|
||||
* to bus space described by tag/handle starting at `offset'.
|
||||
|
@ -327,7 +327,7 @@ __NEWSMIPS_bus_space_write_region(4,32)
|
|||
|
||||
/*
|
||||
* void bus_space_set_multi_N(bus_space_tag_t tag,
|
||||
* bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
|
||||
* bus_space_handle_t bsh, bus_size_t offset, uintN_t val,
|
||||
* size_t count);
|
||||
*
|
||||
* Write the 1, 2, 4, or 8 byte value `val' to bus space described
|
||||
|
@ -365,7 +365,7 @@ __NEWSMIPS_bus_space_set_multi(4,32)
|
|||
|
||||
/*
|
||||
* void bus_space_set_region_N(bus_space_tag_t tag,
|
||||
* bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
|
||||
* bus_space_handle_t bsh, bus_size_t offset, uintN_t val,
|
||||
* size_t count);
|
||||
*
|
||||
* Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: intr.h,v 1.14 2003/10/25 04:07:28 tsutsui Exp $ */
|
||||
/* $NetBSD: intr.h,v 1.15 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -75,15 +75,15 @@
|
|||
|
||||
#include <sys/device.h>
|
||||
|
||||
extern const u_int32_t ipl_sr_bits[_IPL_N];
|
||||
extern const uint32_t ipl_sr_bits[_IPL_N];
|
||||
|
||||
extern int _splraise __P((int));
|
||||
extern int _spllower __P((int));
|
||||
extern int _splset __P((int));
|
||||
extern int _splget __P((void));
|
||||
extern void _splnone __P((void));
|
||||
extern void _setsoftintr __P((int));
|
||||
extern void _clrsoftintr __P((int));
|
||||
extern int _splraise(int);
|
||||
extern int _spllower(int);
|
||||
extern int _splset(int);
|
||||
extern int _splget(void);
|
||||
extern void _splnone(void);
|
||||
extern void _setsoftintr(int);
|
||||
extern void _clrsoftintr(int);
|
||||
|
||||
#define splhigh() _splraise(ipl_sr_bits[IPL_HIGH])
|
||||
#define spl0() (void)_spllower(0)
|
||||
|
@ -143,16 +143,16 @@ extern u_int intrcnt[];
|
|||
|
||||
/* handle i/o device interrupts */
|
||||
#ifdef news3400
|
||||
void news3400_intr __P((u_int, u_int, u_int, u_int));
|
||||
void news3400_intr(u_int, u_int, u_int, u_int);
|
||||
#endif
|
||||
#ifdef news5000
|
||||
void news5000_intr __P((u_int, u_int, u_int, u_int));
|
||||
void news5000_intr(u_int, u_int, u_int, u_int);
|
||||
#endif
|
||||
extern void (*hardware_intr) __P((u_int, u_int, u_int, u_int));
|
||||
extern void (*hardware_intr)(u_int, u_int, u_int, u_int);
|
||||
|
||||
extern void (*enable_intr) __P((void));
|
||||
extern void (*disable_intr) __P((void));
|
||||
extern void (*enable_timer) __P((void));
|
||||
extern void (*enable_intr)(void);
|
||||
extern void (*disable_intr)(void);
|
||||
extern void (*enable_timer)(void);
|
||||
|
||||
#endif /* !_LOCORE */
|
||||
#endif /* _KERNEL */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: z8530var.h,v 1.6 2003/08/07 16:28:53 agc Exp $ */
|
||||
/* $NetBSD: z8530var.h,v 1.7 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -101,18 +101,18 @@ struct zsc_softc {
|
|||
* These could be inlines, but with the delay, speed is moot.
|
||||
*/
|
||||
|
||||
u_char zs_read_reg __P((struct zs_chanstate *cs, u_char reg));
|
||||
u_char zs_read_csr __P((struct zs_chanstate *cs));
|
||||
u_char zs_read_data __P((struct zs_chanstate *cs));
|
||||
u_char zs_read_reg(struct zs_chanstate *cs, u_char reg);
|
||||
u_char zs_read_csr(struct zs_chanstate *cs);
|
||||
u_char zs_read_data(struct zs_chanstate *cs);
|
||||
|
||||
void zs_write_reg __P((struct zs_chanstate *cs, u_char reg, u_char val));
|
||||
void zs_write_csr __P((struct zs_chanstate *cs, u_char val));
|
||||
void zs_write_data __P((struct zs_chanstate *cs, u_char val));
|
||||
void zs_write_reg(struct zs_chanstate *cs, u_char reg, u_char val);
|
||||
void zs_write_csr(struct zs_chanstate *cs, u_char val);
|
||||
void zs_write_data(struct zs_chanstate *cs, u_char val);
|
||||
|
||||
int zs_print __P((void *, const char *));
|
||||
int zshard __P((void *));
|
||||
void zssoft __P((void*));
|
||||
int zs_get_speed __P((struct zs_chanstate *));
|
||||
void (*zs_delay) __P((void));
|
||||
int zs_print(void *, const char *);
|
||||
int zshard(void *);
|
||||
void zssoft(void*);
|
||||
int zs_get_speed(struct zs_chanstate *);
|
||||
void (*zs_delay)(void);
|
||||
|
||||
#define splzs() splserial()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: autoconf.c,v 1.23 2004/10/23 17:12:22 thorpej Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.24 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -85,7 +85,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.23 2004/10/23 17:12:22 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.24 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -113,7 +113,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.23 2004/10/23 17:12:22 thorpej Exp $"
|
|||
*/
|
||||
int cpuspeed = 10; /* approx # instr per usec. */
|
||||
|
||||
static void findroot __P((void));
|
||||
static void findroot(void);
|
||||
|
||||
/*
|
||||
* Determine mass storage and memory configuration for a machine.
|
||||
|
@ -123,7 +123,7 @@ static void findroot __P((void));
|
|||
* for attached scsi devices.
|
||||
*/
|
||||
void
|
||||
cpu_configure()
|
||||
cpu_configure(void)
|
||||
{
|
||||
extern struct idrom idrom;
|
||||
|
||||
|
@ -153,7 +153,7 @@ cpu_configure()
|
|||
}
|
||||
|
||||
void
|
||||
cpu_rootconf()
|
||||
cpu_rootconf(void)
|
||||
{
|
||||
findroot();
|
||||
|
||||
|
@ -168,8 +168,8 @@ u_long bootdev = 0; /* should be dev_t, but not until 32 bits */
|
|||
/*
|
||||
* Attempt to find the device from which we were booted.
|
||||
*/
|
||||
void
|
||||
findroot()
|
||||
static void
|
||||
findroot(void)
|
||||
{
|
||||
int ctlr, unit, part, type;
|
||||
struct device *dv;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bus.c,v 1.17 2004/11/28 17:34:46 thorpej Exp $ */
|
||||
/* $NetBSD: bus.c,v 1.18 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.17 2004/11/28 17:34:46 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.18 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -78,6 +78,7 @@ struct newsmips_bus_dma_tag newsmips_default_bus_dma_tag = {
|
|||
void
|
||||
newsmips_bus_dma_init(void)
|
||||
{
|
||||
|
||||
#ifdef MIPS1
|
||||
if (CPUISMIPS3 == 0)
|
||||
newsmips_default_bus_dma_tag._dmamap_sync =
|
||||
|
@ -91,12 +92,8 @@ newsmips_bus_dma_init(void)
|
|||
}
|
||||
|
||||
int
|
||||
bus_space_map(t, bpa, size, flags, bshp)
|
||||
bus_space_tag_t t;
|
||||
bus_addr_t bpa;
|
||||
bus_size_t size;
|
||||
int flags;
|
||||
bus_space_handle_t *bshp;
|
||||
bus_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags,
|
||||
bus_space_handle_t *bshp)
|
||||
{
|
||||
int cacheable = flags & BUS_SPACE_MAP_CACHEABLE;
|
||||
|
||||
|
@ -109,41 +106,31 @@ bus_space_map(t, bpa, size, flags, bshp)
|
|||
}
|
||||
|
||||
int
|
||||
bus_space_alloc(t, rstart, rend, size, alignment, boundary, flags, bpap, bshp)
|
||||
bus_space_tag_t t;
|
||||
bus_addr_t rstart, rend;
|
||||
bus_size_t size, alignment, boundary;
|
||||
int flags;
|
||||
bus_addr_t *bpap;
|
||||
bus_space_handle_t *bshp;
|
||||
bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart, bus_addr_t rend,
|
||||
bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags,
|
||||
bus_addr_t *bpap, bus_space_handle_t *bshp)
|
||||
{
|
||||
|
||||
panic("bus_space_alloc: not implemented");
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_free(t, bsh, size)
|
||||
bus_space_tag_t t;
|
||||
bus_space_handle_t bsh;
|
||||
bus_size_t size;
|
||||
bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size)
|
||||
{
|
||||
|
||||
panic("bus_space_free: not implemented");
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_unmap(t, bsh, size)
|
||||
bus_space_tag_t t;
|
||||
bus_space_handle_t bsh;
|
||||
bus_size_t size;
|
||||
bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size)
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
bus_space_subregion(t, bsh, offset, size, nbshp)
|
||||
bus_space_tag_t t;
|
||||
bus_space_handle_t bsh;
|
||||
bus_size_t offset, size;
|
||||
bus_space_handle_t *nbshp;
|
||||
bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh,
|
||||
bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp)
|
||||
{
|
||||
|
||||
*nbshp = bsh + offset;
|
||||
|
@ -155,14 +142,8 @@ bus_space_subregion(t, bsh, offset, size, nbshp)
|
|||
* DMA map creation functions.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
|
||||
bus_dma_tag_t t;
|
||||
bus_size_t size;
|
||||
int nsegments;
|
||||
bus_size_t maxsegsz;
|
||||
bus_size_t boundary;
|
||||
int flags;
|
||||
bus_dmamap_t *dmamp;
|
||||
_bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
||||
bus_size_t maxsegsz, bus_size_t boundary, int flags, bus_dmamap_t *dmamp)
|
||||
{
|
||||
struct newsmips_bus_dmamap *map;
|
||||
void *mapstore;
|
||||
|
@ -183,10 +164,9 @@ _bus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
|
|||
mapsize = sizeof(struct newsmips_bus_dmamap) +
|
||||
(sizeof(bus_dma_segment_t) * (nsegments - 1));
|
||||
if ((mapstore = malloc(mapsize, M_DMAMAP,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
|
||||
((flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)|M_ZERO)) == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
bzero(mapstore, mapsize);
|
||||
map = (struct newsmips_bus_dmamap *)mapstore;
|
||||
map->_dm_size = size;
|
||||
map->_dm_segcnt = nsegments;
|
||||
|
@ -206,13 +186,12 @@ _bus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
|
|||
* DMA map destruction functions.
|
||||
*/
|
||||
void
|
||||
_bus_dmamap_destroy(t, map)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
_bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
|
||||
{
|
||||
|
||||
free(map, M_DMAMAP);
|
||||
}
|
||||
|
||||
extern paddr_t kvtophys(vaddr_t); /* XXX */
|
||||
|
||||
/*
|
||||
|
@ -222,16 +201,8 @@ extern paddr_t kvtophys(vaddr_t); /* XXX */
|
|||
* first indicates if this is the first invocation of this function.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_load_buffer(map, buf, buflen, p, flags,
|
||||
lastaddrp, segp, first)
|
||||
bus_dmamap_t map;
|
||||
void *buf;
|
||||
bus_size_t buflen;
|
||||
struct proc *p;
|
||||
int flags;
|
||||
vaddr_t *lastaddrp;
|
||||
int *segp;
|
||||
int first;
|
||||
_bus_dmamap_load_buffer(bus_dmamap_t map, void *buf, bus_size_t buflen,
|
||||
struct proc *p, int flags, vaddr_t *lastaddrp, int *segp, int first)
|
||||
{
|
||||
bus_size_t sgsize;
|
||||
bus_addr_t curaddr, lastaddr, baddr, bmask;
|
||||
|
@ -315,13 +286,8 @@ _bus_dmamap_load_buffer(map, buf, buflen, p, flags,
|
|||
* buffer.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_load(t, map, buf, buflen, p, flags)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
void *buf;
|
||||
bus_size_t buflen;
|
||||
struct proc *p;
|
||||
int flags;
|
||||
_bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
|
||||
bus_size_t buflen, struct proc *p, int flags)
|
||||
{
|
||||
vaddr_t lastaddr;
|
||||
int seg, error;
|
||||
|
@ -360,11 +326,8 @@ _bus_dmamap_load(t, map, buf, buflen, p, flags)
|
|||
* Like _bus_dmamap_load(), but for mbufs.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_load_mbuf(t, map, m0, flags)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
struct mbuf *m0;
|
||||
int flags;
|
||||
_bus_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0,
|
||||
int flags)
|
||||
{
|
||||
vaddr_t lastaddr;
|
||||
int seg, error, first;
|
||||
|
@ -406,11 +369,8 @@ _bus_dmamap_load_mbuf(t, map, m0, flags)
|
|||
* Like _bus_dmamap_load(), but for uios.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_load_uio(t, map, uio, flags)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
struct uio *uio;
|
||||
int flags;
|
||||
_bus_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio,
|
||||
int flags)
|
||||
{
|
||||
vaddr_t lastaddr;
|
||||
int seg, i, error, first;
|
||||
|
@ -465,13 +425,7 @@ _bus_dmamap_load_uio(t, map, uio, flags)
|
|||
* Like _bus_dmamap_load(), but for raw memory.
|
||||
*/
|
||||
int
|
||||
_bus_dmamap_load_raw(t, map, segs, nsegs, size, flags)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
bus_dma_segment_t *segs;
|
||||
int nsegs;
|
||||
bus_size_t size;
|
||||
int flags;
|
||||
_bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs, int nsegs, bus_size_t size, int flags)
|
||||
{
|
||||
|
||||
panic("_bus_dmamap_load_raw: not implemented");
|
||||
|
@ -482,9 +436,7 @@ _bus_dmamap_load_raw(t, map, segs, nsegs, size, flags)
|
|||
* chipset-specific DMA map unload functions.
|
||||
*/
|
||||
void
|
||||
_bus_dmamap_unload(t, map)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
_bus_dmamap_unload(bus_dma_tag_t t, bus_dmamap_t map)
|
||||
{
|
||||
|
||||
/*
|
||||
|
@ -505,12 +457,8 @@ _bus_dmamap_unload(t, map)
|
|||
* This is the R3000 version.
|
||||
*/
|
||||
void
|
||||
_bus_dmamap_sync_r3k(t, map, offset, len, ops)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
bus_addr_t offset;
|
||||
bus_size_t len;
|
||||
int ops;
|
||||
_bus_dmamap_sync_r3k(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset,
|
||||
bus_size_t len, int ops)
|
||||
{
|
||||
bus_size_t minlen;
|
||||
bus_addr_t addr;
|
||||
|
@ -613,12 +561,8 @@ _bus_dmamap_sync_r3k(t, map, offset, len, ops)
|
|||
* This is the R4000 version.
|
||||
*/
|
||||
void
|
||||
_bus_dmamap_sync_r4k(t, map, offset, len, ops)
|
||||
bus_dma_tag_t t;
|
||||
bus_dmamap_t map;
|
||||
bus_addr_t offset;
|
||||
bus_size_t len;
|
||||
int ops;
|
||||
_bus_dmamap_sync_r4k(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset,
|
||||
bus_size_t len, int ops)
|
||||
{
|
||||
bus_size_t minlen;
|
||||
bus_addr_t addr;
|
||||
|
@ -754,13 +698,9 @@ _bus_dmamap_sync_r4k(t, map, offset, len, ops)
|
|||
* by bus-specific DMA memory allocation functions.
|
||||
*/
|
||||
int
|
||||
_bus_dmamem_alloc(t, size, alignment, boundary, segs, nsegs, rsegs, flags)
|
||||
bus_dma_tag_t t;
|
||||
bus_size_t size, alignment, boundary;
|
||||
bus_dma_segment_t *segs;
|
||||
int nsegs;
|
||||
int *rsegs;
|
||||
int flags;
|
||||
_bus_dmamem_alloc(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
||||
bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs,
|
||||
int flags)
|
||||
{
|
||||
extern paddr_t avail_start, avail_end;
|
||||
vaddr_t curaddr, lastaddr;
|
||||
|
@ -821,10 +761,7 @@ _bus_dmamem_alloc(t, size, alignment, boundary, segs, nsegs, rsegs, flags)
|
|||
* bus-specific DMA memory free functions.
|
||||
*/
|
||||
void
|
||||
_bus_dmamem_free(t, segs, nsegs)
|
||||
bus_dma_tag_t t;
|
||||
bus_dma_segment_t *segs;
|
||||
int nsegs;
|
||||
_bus_dmamem_free(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs)
|
||||
{
|
||||
struct vm_page *m;
|
||||
bus_addr_t addr;
|
||||
|
@ -852,13 +789,8 @@ _bus_dmamem_free(t, segs, nsegs)
|
|||
* bus-specific DMA memory map functions.
|
||||
*/
|
||||
int
|
||||
_bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
|
||||
bus_dma_tag_t t;
|
||||
bus_dma_segment_t *segs;
|
||||
int nsegs;
|
||||
size_t size;
|
||||
caddr_t *kvap;
|
||||
int flags;
|
||||
_bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs,
|
||||
size_t size, caddr_t *kvap, int flags)
|
||||
{
|
||||
vaddr_t va;
|
||||
bus_addr_t addr;
|
||||
|
@ -881,7 +813,7 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
|
|||
va = uvm_km_valloc(kernel_map, size);
|
||||
|
||||
if (va == 0)
|
||||
return (ENOMEM);
|
||||
return ENOMEM;
|
||||
|
||||
*kvap = (caddr_t)va;
|
||||
|
||||
|
@ -908,10 +840,7 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
|
|||
* bus-specific DMA memory unmapping functions.
|
||||
*/
|
||||
void
|
||||
_bus_dmamem_unmap(t, kva, size)
|
||||
bus_dma_tag_t t;
|
||||
caddr_t kva;
|
||||
size_t size;
|
||||
_bus_dmamem_unmap(bus_dma_tag_t t, caddr_t kva, size_t size)
|
||||
{
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
|
@ -936,12 +865,8 @@ _bus_dmamem_unmap(t, kva, size)
|
|||
* bus-specific DMA mmap(2)'ing functions.
|
||||
*/
|
||||
paddr_t
|
||||
_bus_dmamem_mmap(t, segs, nsegs, off, prot, flags)
|
||||
bus_dma_tag_t t;
|
||||
bus_dma_segment_t *segs;
|
||||
int nsegs;
|
||||
off_t off;
|
||||
int prot, flags;
|
||||
_bus_dmamem_mmap(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs,
|
||||
off_t off, int prot, int flags)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clock.c,v 1.10 2003/10/25 04:07:28 tsutsui Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.11 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.10 2003/10/25 04:07:28 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.11 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -59,8 +59,7 @@ static todr_chip_handle_t todr_handle;
|
|||
* Common parts of todclock autoconfiguration.
|
||||
*/
|
||||
void
|
||||
todr_attach(handle)
|
||||
todr_chip_handle_t handle;
|
||||
todr_attach(todr_chip_handle_t handle)
|
||||
{
|
||||
|
||||
if (todr_handle)
|
||||
|
@ -76,7 +75,7 @@ todr_attach(handle)
|
|||
* The frequencies of these clocks must be an even number of microseconds.
|
||||
*/
|
||||
void
|
||||
cpu_initclocks()
|
||||
cpu_initclocks(void)
|
||||
{
|
||||
|
||||
if (todr_handle == NULL)
|
||||
|
@ -91,8 +90,7 @@ cpu_initclocks()
|
|||
* profhz == stathz == hz.
|
||||
*/
|
||||
void
|
||||
setstatclockrate(newhz)
|
||||
int newhz;
|
||||
setstatclockrate(int newhz)
|
||||
{
|
||||
|
||||
/* nothing to do */
|
||||
|
@ -102,8 +100,7 @@ setstatclockrate(newhz)
|
|||
* Set up the system's time, given a `reasonable' time value.
|
||||
*/
|
||||
void
|
||||
inittodr(base)
|
||||
time_t base;
|
||||
inittodr(time_t base)
|
||||
{
|
||||
int badbase, waszero;
|
||||
|
||||
|
@ -153,7 +150,7 @@ inittodr(base)
|
|||
* when crashing during autoconfig.
|
||||
*/
|
||||
void
|
||||
resettodr()
|
||||
resettodr(void)
|
||||
{
|
||||
|
||||
if (time.tv_sec == 0)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cpu.c,v 1.9 2003/07/15 02:59:30 lukem Exp $ */
|
||||
/* $NetBSD: cpu.c,v 1.10 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.9 2003/07/15 02:59:30 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.10 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -49,10 +49,7 @@ CFATTACH_DECL(cpu, sizeof(struct device),
|
|||
extern struct cfdriver cpu_cd;
|
||||
|
||||
static int
|
||||
cpumatch(parent, cfdata, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cfdata;
|
||||
void *aux;
|
||||
cpumatch(struct device *parent, struct cfdata *cfdata, void *aux)
|
||||
{
|
||||
struct confargs *ca = aux;
|
||||
|
||||
|
@ -64,10 +61,7 @@ cpumatch(parent, cfdata, aux)
|
|||
}
|
||||
|
||||
static void
|
||||
cpuattach(parent, dev, aux)
|
||||
struct device *parent;
|
||||
struct device *dev;
|
||||
void *aux;
|
||||
cpuattach(struct device *parent, struct device *dev, void *aux)
|
||||
{
|
||||
|
||||
printf(": ");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cpu_cons.c,v 1.9 2003/08/07 16:28:54 agc Exp $ */
|
||||
/* $NetBSD: cpu_cons.c,v 1.10 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -73,7 +73,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu_cons.c,v 1.9 2003/08/07 16:28:54 agc Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu_cons.c,v 1.10 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -110,7 +110,7 @@ void kb_ap_cnattach(void);
|
|||
#include "zsc.h"
|
||||
|
||||
void
|
||||
consinit()
|
||||
consinit(void)
|
||||
{
|
||||
volatile int *dipsw;
|
||||
static int initted = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: disksubr.c,v 1.16 2003/08/07 16:28:54 agc Exp $ */
|
||||
/* $NetBSD: disksubr.c,v 1.17 2005/02/06 02:18:02 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.16 2003/08/07 16:28:54 agc Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.17 2005/02/06 02:18:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -50,11 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.16 2003/08/07 16:28:54 agc Exp $");
|
|||
* Returns null on success and an error string on failure.
|
||||
*/
|
||||
const char *
|
||||
readdisklabel(dev, strat, lp, osdep)
|
||||
dev_t dev;
|
||||
void (*strat) __P((struct buf *bp));
|
||||
struct disklabel *lp;
|
||||
struct cpu_disklabel *osdep;
|
||||
readdisklabel(dev_t dev, void (*strat)(struct buf *bp), struct disklabel *lp,
|
||||
struct cpu_disklabel *osdep)
|
||||
{
|
||||
struct buf *bp;
|
||||
struct disklabel *dlp;
|
||||
|
@ -92,7 +89,7 @@ readdisklabel(dev, strat, lp, osdep)
|
|||
}
|
||||
}
|
||||
brelse(bp);
|
||||
return (msg);
|
||||
return msg;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -100,26 +97,24 @@ readdisklabel(dev, strat, lp, osdep)
|
|||
* before setting it.
|
||||
*/
|
||||
int
|
||||
setdisklabel(olp, nlp, openmask, osdep)
|
||||
struct disklabel *olp, *nlp;
|
||||
u_long openmask;
|
||||
struct cpu_disklabel *osdep;
|
||||
setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask,
|
||||
struct cpu_disklabel *osdep)
|
||||
{
|
||||
int i;
|
||||
struct partition *opp, *npp;
|
||||
|
||||
if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC ||
|
||||
dkcksum(nlp) != 0)
|
||||
return (EINVAL);
|
||||
return EINVAL;
|
||||
while ((i = ffs(openmask)) != 0) {
|
||||
i--;
|
||||
openmask &= ~(1 << i);
|
||||
if (nlp->d_npartitions <= i)
|
||||
return (EBUSY);
|
||||
return EBUSY;
|
||||
opp = &olp->d_partitions[i];
|
||||
npp = &nlp->d_partitions[i];
|
||||
if (npp->p_offset != opp->p_offset || npp->p_size < opp->p_size)
|
||||
return (EBUSY);
|
||||
return EBUSY;
|
||||
/*
|
||||
* Copy internally-set partition information
|
||||
* if new label doesn't include it. XXX
|
||||
|
@ -134,18 +129,15 @@ setdisklabel(olp, nlp, openmask, osdep)
|
|||
nlp->d_checksum = 0;
|
||||
nlp->d_checksum = dkcksum(nlp);
|
||||
*olp = *nlp;
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write disk label back to device after modification.
|
||||
*/
|
||||
int
|
||||
writedisklabel(dev, strat, lp, osdep)
|
||||
dev_t dev;
|
||||
void (*strat) __P((struct buf *bp));
|
||||
struct disklabel *lp;
|
||||
struct cpu_disklabel *osdep;
|
||||
writedisklabel(dev_t dev, void (*strat)(struct buf *bp), struct disklabel *lp,
|
||||
struct cpu_disklabel *osdep)
|
||||
{
|
||||
struct buf *bp;
|
||||
struct disklabel *dlp;
|
||||
|
@ -155,7 +147,7 @@ writedisklabel(dev, strat, lp, osdep)
|
|||
labelpart = DISKPART(dev);
|
||||
if (lp->d_partitions[labelpart].p_offset != 0) {
|
||||
if (lp->d_partitions[0].p_offset != 0)
|
||||
return (EXDEV); /* not quite right */
|
||||
return EXDEV; /* not quite right */
|
||||
labelpart = 0;
|
||||
}
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
|
@ -183,7 +175,7 @@ writedisklabel(dev, strat, lp, osdep)
|
|||
error = ESRCH;
|
||||
done:
|
||||
brelse(bp);
|
||||
return (error);
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -194,10 +186,7 @@ done:
|
|||
* if needed, and signal errors or early completion.
|
||||
*/
|
||||
int
|
||||
bounds_check_with_label(dk, bp, wlabel)
|
||||
struct disk *dk;
|
||||
struct buf *bp;
|
||||
int wlabel;
|
||||
bounds_check_with_label(struct disk *dk, struct buf *bp, int wlabel)
|
||||
{
|
||||
struct disklabel *lp = dk->dk_label;
|
||||
struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
|
||||
|
@ -219,7 +208,7 @@ bounds_check_with_label(dk, bp, wlabel)
|
|||
/* if exactly at end of disk, return an EOF */
|
||||
if (bp->b_blkno == maxsz) {
|
||||
bp->b_resid = bp->b_bcount;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
/* or truncate if part of it fits */
|
||||
sz = maxsz - bp->b_blkno;
|
||||
|
@ -232,8 +221,8 @@ bounds_check_with_label(dk, bp, wlabel)
|
|||
|
||||
/* calculate cylinder for disksort to order transfers with */
|
||||
bp->b_resid = (bp->b_blkno + p->p_offset) / lp->d_secpercyl;
|
||||
return(1);
|
||||
return 1;
|
||||
bad:
|
||||
bp->b_flags |= B_ERROR;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.77 2004/02/13 11:36:16 wiz Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.78 2005/02/06 02:18:03 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -76,7 +76,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.77 2004/02/13 11:36:16 wiz Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.78 2005/02/06 02:18:03 tsutsui Exp $");
|
||||
|
||||
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
|
||||
|
||||
|
@ -162,25 +162,25 @@ phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX];
|
|||
int mem_cluster_cnt;
|
||||
|
||||
struct idrom idrom;
|
||||
void (*readmicrotime) __P((struct timeval *tvp));
|
||||
void (*hardware_intr) __P((u_int, u_int, u_int, u_int));
|
||||
void (*enable_intr) __P((void));
|
||||
void (*disable_intr) __P((void));
|
||||
void (*enable_timer) __P((void));
|
||||
void (*readmicrotime)(struct timeval *tvp);
|
||||
void (*hardware_intr)(u_int, u_int, u_int, u_int);
|
||||
void (*enable_intr)(void);
|
||||
void (*disable_intr)(void);
|
||||
void (*enable_timer)(void);
|
||||
|
||||
/*
|
||||
* Local functions.
|
||||
*/
|
||||
|
||||
/* initialize bss, etc. from kernel start, before main() is called. */
|
||||
void mach_init __P((int, int, int, int));
|
||||
void mach_init(int, int, int, int);
|
||||
|
||||
void prom_halt __P((int)) __attribute__((__noreturn__));
|
||||
void to_monitor __P((int)) __attribute__((__noreturn__));
|
||||
void prom_halt(int) __attribute__((__noreturn__));
|
||||
void to_monitor(int) __attribute__((__noreturn__));
|
||||
|
||||
#ifdef DEBUG
|
||||
/* stacktrace code violates prototypes to get callee's registers */
|
||||
extern void stacktrace __P((void)); /*XXX*/
|
||||
extern void stacktrace(void); /*XXX*/
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -195,7 +195,7 @@ int safepri = MIPS3_PSL_LOWIPL; /* XXX */
|
|||
* This is a mask of bits to clear in the SR when we go to a
|
||||
* given interrupt priority level.
|
||||
*/
|
||||
const u_int32_t ipl_sr_bits[_IPL_N] = {
|
||||
const uint32_t ipl_sr_bits[_IPL_N] = {
|
||||
0, /* IPL_NONE */
|
||||
|
||||
MIPS_SOFT_INT_MASK_0, /* IPL_SOFT */
|
||||
|
@ -229,7 +229,7 @@ const u_int32_t ipl_sr_bits[_IPL_N] = {
|
|||
MIPS_INT_MASK_2, /* IPL_{CLOCK,HIGH} */
|
||||
};
|
||||
|
||||
const u_int32_t mips_ipl_si_to_sr[_IPL_NSOFT] = {
|
||||
const uint32_t mips_ipl_si_to_sr[_IPL_NSOFT] = {
|
||||
MIPS_SOFT_INT_MASK_0, /* IPL_SOFT */
|
||||
MIPS_SOFT_INT_MASK_0, /* IPL_SOFTCLOCK */
|
||||
MIPS_SOFT_INT_MASK_1, /* IPL_SOFTNET */
|
||||
|
@ -246,11 +246,7 @@ extern char edata[], end[];
|
|||
* Return the first page address following the system.
|
||||
*/
|
||||
void
|
||||
mach_init(x_boothowto, x_bootdev, x_bootname, x_maxmem)
|
||||
int x_boothowto;
|
||||
int x_bootdev;
|
||||
int x_bootname;
|
||||
int x_maxmem;
|
||||
mach_init(int x_boothowto, int x_bootdev, int x_bootname, int x_maxmem)
|
||||
{
|
||||
u_long first, last;
|
||||
caddr_t kernend, v;
|
||||
|
@ -267,7 +263,7 @@ mach_init(x_boothowto, x_bootdev, x_bootname, x_maxmem)
|
|||
bi_arg = NULL;
|
||||
|
||||
/* clear the BSS segment */
|
||||
bzero(edata, end - edata);
|
||||
memset(edata, 0, end - edata);
|
||||
|
||||
systype = NEWS3400; /* XXX compatibility */
|
||||
|
||||
|
@ -475,7 +471,7 @@ mips_machdep_cache_config(void)
|
|||
* initialize CPU, and do autoconfiguration.
|
||||
*/
|
||||
void
|
||||
cpu_startup()
|
||||
cpu_startup(void)
|
||||
{
|
||||
vaddr_t minaddr, maxaddr;
|
||||
char pbuf[9];
|
||||
|
@ -499,12 +495,12 @@ cpu_startup()
|
|||
* limits the number of processes exec'ing at any time.
|
||||
*/
|
||||
exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
16 * NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
|
||||
16 * NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
|
||||
/*
|
||||
* Allocate a submap for physio
|
||||
*/
|
||||
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
VM_PHYS_SIZE, 0, FALSE, NULL);
|
||||
VM_PHYS_SIZE, 0, FALSE, NULL);
|
||||
|
||||
/*
|
||||
* No need to allocate an mbuf cluster submap. Mbuf clusters
|
||||
|
@ -524,33 +520,31 @@ cpu_startup()
|
|||
* Look up information in bootinfo of boot loader.
|
||||
*/
|
||||
void *
|
||||
lookup_bootinfo(type)
|
||||
int type;
|
||||
lookup_bootinfo(int type)
|
||||
{
|
||||
struct btinfo_common *bt;
|
||||
char *help = bootinfo;
|
||||
|
||||
/* Check for a bootinfo record first. */
|
||||
if (help == NULL)
|
||||
return (NULL);
|
||||
return NULL;
|
||||
|
||||
do {
|
||||
bt = (struct btinfo_common *)help;
|
||||
if (bt->type == type)
|
||||
return ((void *)help);
|
||||
return (void *)help;
|
||||
help += bt->next;
|
||||
} while (bt->next != 0 &&
|
||||
(size_t)help < (size_t)bootinfo + BOOTINFO_SIZE);
|
||||
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* call PROM to halt or reboot.
|
||||
*/
|
||||
void
|
||||
prom_halt(howto)
|
||||
int howto;
|
||||
prom_halt(int howto)
|
||||
|
||||
{
|
||||
#ifdef news5000
|
||||
|
@ -567,9 +561,7 @@ prom_halt(howto)
|
|||
int waittime = -1;
|
||||
|
||||
void
|
||||
cpu_reboot(howto, bootstr)
|
||||
volatile int howto;
|
||||
char *bootstr;
|
||||
cpu_reboot(volatile int howto, char *bootstr)
|
||||
{
|
||||
|
||||
/* take a snap shot before clobbering any registers */
|
||||
|
@ -640,8 +632,7 @@ haltsys:
|
|||
* previous call.
|
||||
*/
|
||||
void
|
||||
microtime(tvp)
|
||||
register struct timeval *tvp;
|
||||
microtime(struct timeval *tvp)
|
||||
{
|
||||
int s = splclock();
|
||||
static struct timeval lasttime;
|
||||
|
@ -662,18 +653,14 @@ microtime(tvp)
|
|||
}
|
||||
|
||||
void
|
||||
delay(n)
|
||||
int n;
|
||||
delay(int n)
|
||||
{
|
||||
|
||||
DELAY(n);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_intr(status, cause, pc, ipending)
|
||||
u_int32_t status;
|
||||
u_int32_t cause;
|
||||
u_int32_t pc;
|
||||
u_int32_t ipending;
|
||||
cpu_intr(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending)
|
||||
{
|
||||
|
||||
uvmexp.intrs++;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mainbus.c,v 1.8 2003/07/15 02:59:31 lukem Exp $ */
|
||||
/* $NetBSD: mainbus.c,v 1.9 2005/02/06 02:18:03 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.8 2003/07/15 02:59:31 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.9 2005/02/06 02:18:03 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -44,9 +44,9 @@ struct mainbus_softc {
|
|||
};
|
||||
|
||||
/* Definition of the mainbus driver. */
|
||||
static int mbmatch __P((struct device *, struct cfdata *, void *));
|
||||
static void mbattach __P((struct device *, struct device *, void *));
|
||||
static int mbprint __P((void *, const char *));
|
||||
static int mbmatch(struct device *, struct cfdata *, void *);
|
||||
static void mbattach(struct device *, struct device *, void *);
|
||||
static int mbprint(void *, const char *);
|
||||
|
||||
CFATTACH_DECL(mainbus, sizeof(struct mainbus_softc),
|
||||
mbmatch, mbattach, NULL, NULL);
|
||||
|
@ -55,11 +55,9 @@ CFATTACH_DECL(mainbus, sizeof(struct mainbus_softc),
|
|||
static int mainbus_found;
|
||||
|
||||
static int
|
||||
mbmatch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
mbmatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
|
||||
if (mainbus_found)
|
||||
return 0;
|
||||
|
||||
|
@ -67,12 +65,9 @@ mbmatch(parent, cf, aux)
|
|||
}
|
||||
|
||||
static void
|
||||
mbattach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
mbattach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
register struct device *mb = self;
|
||||
struct device *mb = self;
|
||||
struct confargs nca;
|
||||
|
||||
mainbus_found = 1;
|
||||
|
@ -92,9 +87,7 @@ mbattach(parent, self, aux)
|
|||
}
|
||||
|
||||
static int
|
||||
mbprint(aux, pnp)
|
||||
void *aux;
|
||||
const char *pnp;
|
||||
mbprint(void *aux, const char *pnp)
|
||||
{
|
||||
|
||||
if (pnp)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: news3400.c,v 1.13 2003/10/25 04:07:28 tsutsui Exp $ */
|
||||
/* $NetBSD: news3400.c,v 1.14 2005/02/06 02:18:03 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: news3400.c,v 1.13 2003/10/25 04:07:28 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: news3400.c,v 1.14 2005/02/06 02:18:03 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -63,11 +63,7 @@ static int badaddr_flag;
|
|||
* Handle news3400 interrupts.
|
||||
*/
|
||||
void
|
||||
news3400_intr(status, cause, pc, ipending)
|
||||
u_int status; /* status register at time of the exception */
|
||||
u_int cause; /* cause register at time of exception */
|
||||
u_int pc; /* program counter where to continue */
|
||||
u_int ipending;
|
||||
news3400_intr(u_int status, u_int cause, u_int pc, u_int ipending)
|
||||
{
|
||||
struct clockframe cf;
|
||||
|
||||
|
@ -137,7 +133,7 @@ news3400_intr(status, cause, pc, ipending)
|
|||
(INTST1_DMA|INTST1_SLOT1|INTST1_SLOT3|INTST1_EXT1|INTST1_EXT3)
|
||||
|
||||
static void
|
||||
news3400_level0_intr()
|
||||
news3400_level0_intr(void)
|
||||
{
|
||||
volatile u_char *intst1 = (void *)INTST1;
|
||||
volatile u_char *intclr1 = (void *)INTCLR1;
|
||||
|
@ -158,7 +154,7 @@ news3400_level0_intr()
|
|||
#define LEVEL1_MASK1 (INTST1_BEEP|INTST1_SCC|INTST1_LANCE)
|
||||
|
||||
static void
|
||||
news3400_level1_intr()
|
||||
news3400_level1_intr(void)
|
||||
{
|
||||
volatile u_char *inten1 = (void *)INTEN1;
|
||||
volatile u_char *intst1 = (void *)INTST1;
|
||||
|
@ -185,9 +181,7 @@ news3400_level1_intr()
|
|||
}
|
||||
|
||||
int
|
||||
news3400_badaddr(addr, size)
|
||||
void *addr;
|
||||
u_int size;
|
||||
news3400_badaddr(void *addr, u_int size)
|
||||
{
|
||||
volatile int x;
|
||||
|
||||
|
@ -211,10 +205,10 @@ news3400_badaddr(addr, size)
|
|||
static void
|
||||
news3400_enable_intr(void)
|
||||
{
|
||||
volatile u_int8_t *inten0 = (void *)INTEN0;
|
||||
volatile u_int8_t *inten1 = (void *)INTEN1;
|
||||
volatile u_int8_t *intclr0 = (void *)INTCLR0;
|
||||
volatile u_int8_t *intclr1 = (void *)INTCLR1;
|
||||
volatile uint8_t *inten0 = (void *)INTEN0;
|
||||
volatile uint8_t *inten1 = (void *)INTEN1;
|
||||
volatile uint8_t *intclr0 = (void *)INTCLR0;
|
||||
volatile uint8_t *intclr1 = (void *)INTCLR1;
|
||||
|
||||
/* clear all interrupts */
|
||||
*intclr0 = 0xff;
|
||||
|
@ -240,8 +234,8 @@ static void
|
|||
news3400_disable_intr(void)
|
||||
{
|
||||
|
||||
volatile u_int8_t *inten0 = (void *)INTEN0;
|
||||
volatile u_int8_t *inten1 = (void *)INTEN1;
|
||||
volatile uint8_t *inten0 = (void *)INTEN0;
|
||||
volatile uint8_t *inten1 = (void *)INTEN1;
|
||||
|
||||
*inten0 = 0;
|
||||
*inten1 = 0;
|
||||
|
@ -252,15 +246,14 @@ news3400_enable_timer(void)
|
|||
{
|
||||
|
||||
/* initialize interval timer */
|
||||
*(volatile u_int8_t *)ITIMER = IOCLOCK / 6144 / 100 - 1;
|
||||
*(volatile uint8_t *)ITIMER = IOCLOCK / 6144 / 100 - 1;
|
||||
|
||||
/* enable timer interrupt */
|
||||
*(volatile u_int8_t *)INTEN0 |= (u_int8_t)INTEN0_TIMINT;
|
||||
*(volatile uint8_t *)INTEN0 |= (uint8_t)INTEN0_TIMINT;
|
||||
}
|
||||
|
||||
static void
|
||||
news3400_readidrom(rom)
|
||||
u_char *rom;
|
||||
news3400_readidrom(u_char *rom)
|
||||
{
|
||||
u_char *p = (u_char *)IDROM;
|
||||
int i;
|
||||
|
@ -272,7 +265,7 @@ news3400_readidrom(rom)
|
|||
extern struct idrom idrom;
|
||||
|
||||
void
|
||||
news3400_init()
|
||||
news3400_init(void)
|
||||
{
|
||||
|
||||
enable_intr = news3400_enable_intr;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: news5000.c,v 1.12 2003/10/25 04:07:28 tsutsui Exp $ */
|
||||
/* $NetBSD: news5000.c,v 1.13 2005/02/06 02:18:03 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: news5000.c,v 1.12 2003/10/25 04:07:28 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: news5000.c,v 1.13 2005/02/06 02:18:03 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -57,11 +57,7 @@ static u_int freerun_off;
|
|||
* Handle news5000 interrupts.
|
||||
*/
|
||||
void
|
||||
news5000_intr(status, cause, pc, ipending)
|
||||
u_int status; /* status register at time of the exception */
|
||||
u_int cause; /* cause register at time of exception */
|
||||
u_int pc; /* program counter where to continue */
|
||||
u_int ipending;
|
||||
news5000_intr(u_int status, u_int cause, u_int pc, u_int ipending)
|
||||
{
|
||||
if (ipending & MIPS_INT_MASK_2) {
|
||||
#ifdef DEBUG
|
||||
|
@ -219,12 +215,11 @@ news5000_enable_timer(void)
|
|||
{
|
||||
|
||||
/* enable timer interrpt */
|
||||
*(volatile u_int32_t *)NEWS5000_INTEN2 = NEWS5000_INT2_TIMER0;
|
||||
*(volatile uint32_t *)NEWS5000_INTEN2 = NEWS5000_INT2_TIMER0;
|
||||
}
|
||||
|
||||
static void
|
||||
news5000_readmicrotime(tvp)
|
||||
struct timeval *tvp;
|
||||
news5000_readmicrotime(struct timeval *tvp)
|
||||
{
|
||||
u_int freerun;
|
||||
|
||||
|
@ -241,10 +236,9 @@ news5000_readmicrotime(tvp)
|
|||
}
|
||||
|
||||
static void
|
||||
news5000_readidrom(rom)
|
||||
u_char *rom;
|
||||
news5000_readidrom(u_char *rom)
|
||||
{
|
||||
u_int32_t *p = (void *)NEWS5000_IDROM;
|
||||
uint32_t *p = (void *)NEWS5000_IDROM;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof (struct idrom); i++, p += 2)
|
||||
|
@ -268,5 +262,5 @@ news5000_init(void)
|
|||
/* XXX reset uPD72067 FDC to avoid spurious interrupts */
|
||||
#define NEWS5000_FDC_FDOUT 0xbed20000
|
||||
#define FDO_FRST 0x04
|
||||
*(volatile u_int8_t *)NEWS5000_FDC_FDOUT = FDO_FRST;
|
||||
*(volatile uint8_t *)NEWS5000_FDC_FDOUT = FDO_FRST;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: boot.c,v 1.13 2003/11/21 19:44:53 tsutsui Exp $ */
|
||||
/* $NetBSD: boot.c,v 1.14 2005/02/06 02:18:03 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 Tsubai Masanari. All rights reserved.
|
||||
|
@ -35,10 +35,9 @@
|
|||
#include <machine/cpu.h>
|
||||
#include <machine/romcall.h>
|
||||
|
||||
void boot __P((u_int32_t, u_int32_t, uint32_t, u_int32_t, u_int32_t,
|
||||
u_int32_t));
|
||||
void boot(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
|
||||
|
||||
void mips1_flushicache __P((void *, int));
|
||||
void mips1_flushicache(void *, int);
|
||||
extern char _edata[], _end[];
|
||||
|
||||
/* version strings in vers.c (generated by newvers.sh) */
|
||||
|
@ -60,16 +59,16 @@ char *kernels[] = { "/netbsd", "/netbsd.gz", NULL };
|
|||
#endif
|
||||
|
||||
void
|
||||
boot(a0, a1, a2, a3, a4, a5)
|
||||
u_int32_t a0, a1, a2, a3, a4, a5;
|
||||
boot(uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t a4,
|
||||
uint32_t a5)
|
||||
{
|
||||
int fd, i;
|
||||
char *netbsd = "";
|
||||
int maxmem;
|
||||
u_long marks[MARK_MAX];
|
||||
char devname[32], file[32];
|
||||
void (*entry) __P((u_int32_t, u_int32_t, uint32_t, u_int32_t,
|
||||
u_int32_t, u_int32_t));
|
||||
void (*entry)(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t,
|
||||
uint32_t));
|
||||
struct btinfo_symtab bi_sym;
|
||||
struct btinfo_bootarg bi_arg;
|
||||
struct btinfo_bootpath bi_bpath;
|
||||
|
@ -208,8 +207,7 @@ boot(a0, a1, a2, a3, a4, a5)
|
|||
}
|
||||
|
||||
void
|
||||
putchar(x)
|
||||
int x;
|
||||
putchar(int x)
|
||||
{
|
||||
char c = x;
|
||||
|
||||
|
@ -220,7 +218,7 @@ putchar(x)
|
|||
}
|
||||
|
||||
int
|
||||
getchar()
|
||||
getchar(void)
|
||||
{
|
||||
unsigned char c = '\0';
|
||||
int i;
|
||||
|
@ -236,7 +234,7 @@ getchar()
|
|||
}
|
||||
|
||||
void
|
||||
_rtt()
|
||||
_rtt(void)
|
||||
{
|
||||
if (apbus)
|
||||
apcall_exit(8);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bootinfo.c,v 1.2 2002/04/13 07:34:41 tsutsui Exp $ */
|
||||
/* $NetBSD: bootinfo.c,v 1.3 2005/02/06 02:18:03 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -46,8 +46,7 @@ static char *bi_next;
|
|||
static int bi_size;
|
||||
|
||||
void
|
||||
bi_init(addr)
|
||||
paddr_t addr;
|
||||
bi_init(paddr_t addr)
|
||||
{
|
||||
struct btinfo_common *bi;
|
||||
struct btinfo_magic bi_magic;
|
||||
|
@ -63,9 +62,7 @@ bi_init(addr)
|
|||
}
|
||||
|
||||
void
|
||||
bi_add(new, type, size)
|
||||
void *new;
|
||||
int type, size;
|
||||
bi_add(void *new, int type, int size)
|
||||
{
|
||||
struct btinfo_common *bi;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: devopen.c,v 1.6 2003/11/21 19:44:53 tsutsui Exp $ */
|
||||
/* $NetBSD: devopen.c,v 1.7 2005/02/06 02:18:03 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 Tsubai Masanari. All rights reserved.
|
||||
|
@ -43,11 +43,11 @@
|
|||
# define DPRINTF while (0) printf
|
||||
#endif
|
||||
|
||||
int dkopen __P((struct open_file *, ...));
|
||||
int dkclose __P((struct open_file *));
|
||||
int dkstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
|
||||
int dkopen(struct open_file *, ...);
|
||||
int dkclose(struct open_file *);
|
||||
int dkstrategy(void *, int, daddr_t, size_t, void *, size_t *);
|
||||
#ifdef HAVE_CHANGEDISK_HOOK
|
||||
void changedisk_hook __P((struct open_file *));
|
||||
void changedisk_hook(struct open_file *);
|
||||
#endif
|
||||
|
||||
struct devsw devsw[] = {
|
||||
|
@ -77,10 +77,7 @@ struct romdev romdev;
|
|||
extern int apbus;
|
||||
|
||||
int
|
||||
devopen(f, fname, file)
|
||||
struct open_file *f;
|
||||
const char *fname;
|
||||
char **file; /* out */
|
||||
devopen(struct open_file *f, const char *fname, char **file)
|
||||
{
|
||||
int fd;
|
||||
char *cp;
|
||||
|
@ -135,13 +132,13 @@ devopen(f, fname, file)
|
|||
int
|
||||
dkopen(struct open_file *f, ...)
|
||||
{
|
||||
|
||||
DPRINTF("dkopen\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dkclose(f)
|
||||
struct open_file *f;
|
||||
dkclose(struct open_file *f)
|
||||
{
|
||||
struct romdev *dev = f->f_devdata;
|
||||
|
||||
|
@ -155,13 +152,8 @@ dkclose(f)
|
|||
}
|
||||
|
||||
int
|
||||
dkstrategy(devdata, rw, blk, size, buf, rsize)
|
||||
void *devdata;
|
||||
int rw;
|
||||
daddr_t blk;
|
||||
size_t size;
|
||||
void *buf;
|
||||
size_t *rsize; /* out: number of bytes transfered */
|
||||
dkstrategy(void *devdata, int rw, daddr_t blk, size_t size, void *buf,
|
||||
size_t *rsize)
|
||||
{
|
||||
struct romdev *dev = devdata;
|
||||
|
||||
|
@ -180,8 +172,7 @@ dkstrategy(devdata, rw, blk, size, buf, rsize)
|
|||
|
||||
#ifdef HAVE_CHANGEDISK_HOOK
|
||||
void
|
||||
changedisk_hook(f)
|
||||
struct open_file *f;
|
||||
changedisk_hook(struct open_file *f)
|
||||
{
|
||||
struct romdev *dev = f->f_devdata;
|
||||
|
||||
|
@ -196,6 +187,5 @@ changedisk_hook(f)
|
|||
getchar();
|
||||
dev->fd = rom_open(dev->devname, 2);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: net.c,v 1.2 2003/03/13 14:49:12 drochner Exp $ */
|
||||
/* $NetBSD: net.c,v 1.3 2005/02/06 02:18:03 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Gordon W. Ross
|
||||
|
@ -75,8 +75,7 @@ static int open_count;
|
|||
* This opens the low-level device and sets f->f_devdata.
|
||||
*/
|
||||
int
|
||||
net_open(pd)
|
||||
struct romdev *pd;
|
||||
net_open(struct romdev *pd)
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
|
@ -92,25 +91,24 @@ net_open(pd)
|
|||
}
|
||||
open_count++;
|
||||
bad:
|
||||
return (error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int
|
||||
net_close(pd)
|
||||
struct romdev *pd;
|
||||
net_close(struct romdev *pd)
|
||||
{
|
||||
/* On last close, do netif close, etc. */
|
||||
if (open_count <= 0)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (--open_count == 0)
|
||||
netif_news_close(netdev_sock);
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
net_mountroot()
|
||||
net_mountroot(void)
|
||||
{
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -165,5 +163,5 @@ net_mountroot()
|
|||
if (nfs_mount(netdev_sock, rootip, rootpath) != 0)
|
||||
return (errno);
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: netif_news.c,v 1.4 2003/03/13 14:49:12 drochner Exp $ */
|
||||
/* $NetBSD: netif_news.c,v 1.5 2005/02/06 02:18:03 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Gordon W. Ross
|
||||
|
@ -61,18 +61,16 @@ int netif_debug;
|
|||
static struct iodesc sdesc;
|
||||
|
||||
struct iodesc *
|
||||
socktodesc(sock)
|
||||
int sock;
|
||||
socktodesc(int sock)
|
||||
{
|
||||
if (sock != 0) {
|
||||
return(NULL);
|
||||
return NULL;
|
||||
}
|
||||
return (&sdesc);
|
||||
return &sdesc;
|
||||
}
|
||||
|
||||
int
|
||||
netif_news_open(pd)
|
||||
struct romdev *pd;
|
||||
netif_news_open(struct romdev *pd)
|
||||
{
|
||||
struct iodesc *io;
|
||||
|
||||
|
@ -83,7 +81,7 @@ netif_news_open(pd)
|
|||
printf("netif_open: device busy\n");
|
||||
#endif
|
||||
errno = ENFILE;
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
memset(io, 0, sizeof(*io));
|
||||
|
||||
|
@ -92,12 +90,11 @@ netif_news_open(pd)
|
|||
/* Put our ethernet address in io->myea */
|
||||
prom_getether(pd, io->myea);
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
netif_news_close(fd)
|
||||
int fd;
|
||||
netif_news_close(int fd)
|
||||
{
|
||||
struct iodesc *io;
|
||||
|
||||
|
@ -110,10 +107,7 @@ netif_news_close(fd)
|
|||
* Return the length sent (or -1 on error).
|
||||
*/
|
||||
ssize_t
|
||||
netif_put(desc, pkt, len)
|
||||
struct iodesc *desc;
|
||||
void *pkt;
|
||||
size_t len;
|
||||
netif_put(struct iodesc *desc, void *pkt, size_t len)
|
||||
{
|
||||
struct romdev *pd;
|
||||
ssize_t rv;
|
||||
|
@ -157,11 +151,7 @@ netif_put(desc, pkt, len)
|
|||
* Return the total length received (or -1 on error).
|
||||
*/
|
||||
ssize_t
|
||||
netif_get(desc, pkt, maxlen, timo)
|
||||
struct iodesc *desc;
|
||||
void *pkt;
|
||||
size_t maxlen;
|
||||
time_t timo;
|
||||
netif_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timo)
|
||||
{
|
||||
struct romdev *pd;
|
||||
int tick0;
|
||||
|
@ -203,10 +193,9 @@ netif_get(desc, pkt, maxlen, timo)
|
|||
}
|
||||
|
||||
int
|
||||
prom_getether(pd, ea)
|
||||
struct romdev *pd;
|
||||
u_char *ea;
|
||||
prom_getether(struct romdev *pd, u_char *ea)
|
||||
{
|
||||
|
||||
if (apcall_ioctl(pd->fd, APIOCGIFHWADDR, ea));
|
||||
return -1;
|
||||
|
||||
|
@ -218,7 +207,7 @@ prom_getether(pd, ea)
|
|||
}
|
||||
|
||||
time_t
|
||||
getsecs()
|
||||
getsecs(void)
|
||||
{
|
||||
u_int t[2];
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ struct romdev {
|
|||
#define DT_BLOCK 1
|
||||
#define DT_NET 2
|
||||
|
||||
int net_open __P((struct romdev *));
|
||||
int net_close __P((struct romdev *));
|
||||
int net_mountroot __P((void));
|
||||
int prom_getether __P((struct romdev *, u_char *));
|
||||
int net_open(struct romdev *);
|
||||
int net_close(struct romdev *);
|
||||
int net_mountroot(void);
|
||||
int prom_getether(struct romdev *, u_char *);
|
||||
|
|
Loading…
Reference in New Issue