ANSIfy KNF.

This commit is contained in:
uch 2002-02-12 15:26:45 +00:00
parent d4a4f7bbb8
commit b3f7b11fe7
33 changed files with 1040 additions and 1545 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcic_shb.c,v 1.4 2000/09/01 10:43:33 tsubai Exp $ */ /* $NetBSD: pcic_shb.c,v 1.5 2002/02/12 15:26:45 uch Exp $ */
#define PCICSHBDEBUG #define PCICSHBDEBUG
@ -80,12 +80,12 @@ int pcicshb_debug = 1 /* XXX */ ;
#define DPRINTF(arg) #define DPRINTF(arg)
#endif #endif
int pcic_shb_probe __P((struct device *, struct cfdata *, void *)); int pcic_shb_probe(struct device *, struct cfdata *, void *);
void pcic_shb_attach __P((struct device *, struct device *, void *)); void pcic_shb_attach(struct device *, struct device *, void *);
void *pcic_shb_chip_intr_establish __P((pcmcia_chipset_handle_t, void *pcic_shb_chip_intr_establish(pcmcia_chipset_handle_t,
struct pcmcia_function *, int, int (*) (void *), void *)); struct pcmcia_function *, int, int (*) (void *), void *);
void pcic_shb_chip_intr_disestablish __P((pcmcia_chipset_handle_t, void *)); void pcic_shb_chip_intr_disestablish(pcmcia_chipset_handle_t, void *);
struct cfattach pcic_shb_ca = { struct cfattach pcic_shb_ca = {
sizeof(struct shpcic_softc), sizeof(struct shpcic_softc),
@ -112,10 +112,7 @@ static struct pcmcia_chip_functions pcic_shb_functions = {
}; };
int int
pcic_shb_probe(parent, match, aux) pcic_shb_probe(struct device *parent, struct cfdata *match, void *aux)
struct device *parent;
struct cfdata *match;
void *aux;
{ {
struct shb_attach_args *ia = aux; struct shb_attach_args *ia = aux;
#if 0 #if 0
@ -187,9 +184,7 @@ pcic_shb_probe(parent, match, aux)
} }
void void
pcic_shb_attach(parent, self, aux) pcic_shb_attach(struct device *parent, struct device *self, void *aux)
struct device *parent, *self;
void *aux;
{ {
struct shpcic_softc *sc = (void *) self; struct shpcic_softc *sc = (void *) self;
struct shb_attach_args *ia = aux; struct shb_attach_args *ia = aux;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcic_shbsubr.c,v 1.3 2000/06/29 07:44:02 mrg Exp $ */ /* $NetBSD: pcic_shbsubr.c,v 1.4 2002/02/12 15:26:45 uch Exp $ */
#define SHPCICSUBRDEBUG #define SHPCICSUBRDEBUG
@ -115,12 +115,8 @@ int shpcicsubr_debug = 0 /* XXX */ ;
#define DPRINTF(arg) #define DPRINTF(arg)
#endif #endif
void pcic_shb_bus_width_probe (sc, iot, ioh, base, length) void pcic_shb_bus_width_probe (struct shpcic_softc *sc, bus_space_tag_t iot,
struct shpcic_softc *sc; bus_space_handle_t ioh, bus_addr_t base, u_int32_t length)
bus_space_tag_t iot;
bus_space_handle_t ioh;
bus_addr_t base;
u_int32_t length;
{ {
#if 0 #if 0
bus_space_handle_t ioh_high; bus_space_handle_t ioh_high;
@ -220,7 +216,7 @@ pcic_shb_chip_intr_establish(pch, pf, ipl, fct, arg)
pcmcia_chipset_handle_t pch; pcmcia_chipset_handle_t pch;
struct pcmcia_function *pf; struct pcmcia_function *pf;
int ipl; int ipl;
int (*fct) __P((void *)); int (*fct)(void *);
void *arg; void *arg;
{ {
struct shpcic_handle *h = (struct shpcic_handle *) pch; struct shpcic_handle *h = (struct shpcic_handle *) pch;
@ -265,9 +261,7 @@ pcic_shb_chip_intr_establish(pch, pf, ipl, fct, arg)
} }
void void
pcic_shb_chip_intr_disestablish(pch, ih) pcic_shb_chip_intr_disestablish(pcmcia_chipset_handle_t pch, void *ih)
pcmcia_chipset_handle_t pch;
void *ih;
{ {
struct shpcic_handle *h = (struct shpcic_handle *) pch; struct shpcic_handle *h = (struct shpcic_handle *) pch;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sci.c,v 1.17 2002/02/01 17:52:56 uch Exp $ */ /* $NetBSD: sci.c,v 1.18 2002/02/12 15:26:46 uch Exp $ */
/*- /*-
* Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved.
@ -126,15 +126,15 @@
#include <machine/shbvar.h> #include <machine/shbvar.h>
static void scistart __P((struct tty *)); static void scistart(struct tty *);
static int sciparam __P((struct tty *, struct termios *)); static int sciparam(struct tty *, struct termios *);
void scicnprobe __P((struct consdev *)); void scicnprobe(struct consdev *);
void scicninit __P((struct consdev *)); void scicninit(struct consdev *);
void scicnputc __P((dev_t, int)); void scicnputc(dev_t, int);
int scicngetc __P((dev_t)); int scicngetc(dev_t);
void scicnpoolc __P((dev_t, int)); void scicnpoolc(dev_t, int);
int sciintr __P((void *)); int sciintr(void *);
struct sci_softc { struct sci_softc {
struct device sc_dev; /* boilerplate */ struct device sc_dev; /* boilerplate */
@ -189,27 +189,27 @@ struct sci_softc {
}; };
/* controller driver configuration */ /* controller driver configuration */
static int sci_match __P((struct device *, struct cfdata *, void *)); static int sci_match(struct device *, struct cfdata *, void *);
static void sci_attach __P((struct device *, struct device *, void *)); static void sci_attach(struct device *, struct device *, void *);
void sci_break __P((struct sci_softc *, int)); void sci_break(struct sci_softc *, int);
void sci_iflush __P((struct sci_softc *)); void sci_iflush(struct sci_softc *);
#define integrate static inline #define integrate static inline
#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS #ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
void scisoft __P((void *)); void scisoft(void *);
#else #else
#ifndef __NO_SOFT_SERIAL_INTERRUPT #ifndef __NO_SOFT_SERIAL_INTERRUPT
void scisoft __P((void)); void scisoft(void);
#else #else
void scisoft __P((void *)); void scisoft(void *);
#endif #endif
#endif #endif
integrate void sci_rxsoft __P((struct sci_softc *, struct tty *)); integrate void sci_rxsoft(struct sci_softc *, struct tty *);
integrate void sci_txsoft __P((struct sci_softc *, struct tty *)); integrate void sci_txsoft(struct sci_softc *, struct tty *);
integrate void sci_stsoft __P((struct sci_softc *, struct tty *)); integrate void sci_stsoft(struct sci_softc *, struct tty *);
integrate void sci_schedrx __P((struct sci_softc *)); integrate void sci_schedrx(struct sci_softc *);
void scidiag __P((void *)); void scidiag(void *);
#define SCIUNIT_MASK 0x7ffff #define SCIUNIT_MASK 0x7ffff
#define SCIDIALOUT_MASK 0x80000 #define SCIDIALOUT_MASK 0x80000
@ -266,7 +266,7 @@ extern struct cfdriver sci_cd;
cdev_decl(sci); cdev_decl(sci);
void InitializeSci __P((unsigned int)); void InitializeSci (unsigned int);
/* /*
* following functions are debugging prupose only * following functions are debugging prupose only
@ -275,18 +275,17 @@ void InitializeSci __P((unsigned int));
#define I2C_ADRS (*(volatile unsigned int *)0xa8000000) #define I2C_ADRS (*(volatile unsigned int *)0xa8000000)
#define USART_ON (unsigned int)~0x08 #define USART_ON (unsigned int)~0x08
static void WaitFor __P((int)); static void WaitFor(int);
void sci_putc __P((unsigned char)); void sci_putc(unsigned char);
unsigned char sci_getc __P((void)); unsigned char sci_getc(void);
int SciErrCheck __P((void)); int SciErrCheck(void);
/* /*
* WaitFor * WaitFor
* : int mSec; * : int mSec;
*/ */
static void static void
WaitFor(mSec) WaitFor(int mSec)
int mSec;
{ {
/* Disable Under Flow interrupt, rising edge, 1/4 */ /* Disable Under Flow interrupt, rising edge, 1/4 */
@ -313,8 +312,7 @@ WaitFor(mSec)
*/ */
void void
InitializeSci(bps) InitializeSci(unsigned int bps)
unsigned int bps;
{ {
/* Initialize SCR */ /* Initialize SCR */
@ -349,8 +347,7 @@ InitializeSci(bps)
* : unsigned char c; * : unsigned char c;
*/ */
void void
sci_putc(c) sci_putc(unsigned char c)
unsigned char c;
{ {
if (c == '\n') if (c == '\n')
@ -411,10 +408,7 @@ sci_getc(void)
static int static int
sci_match(parent, cfp, aux) sci_match(struct device *parent, struct cfdata *cfp, void *aux)
struct device *parent;
struct cfdata *cfp;
void *aux;
{ {
struct shb_attach_args *sa = aux; struct shb_attach_args *sa = aux;
@ -427,9 +421,7 @@ sci_match(parent, cfp, aux)
} }
static void static void
sci_attach(parent, self, aux) sci_attach(struct device *parent, struct device *self, void *aux)
struct device *parent, *self;
void *aux;
{ {
struct sci_softc *sc = (struct sci_softc *)self; struct sci_softc *sc = (struct sci_softc *)self;
struct tty *tp; struct tty *tp;
@ -488,8 +480,7 @@ sci_attach(parent, self, aux)
* Start or restart transmission. * Start or restart transmission.
*/ */
static void static void
scistart(tp) scistart(struct tty *tp)
struct tty *tp;
{ {
struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(tp->t_dev)]; struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(tp->t_dev)];
int s; int s;
@ -549,9 +540,7 @@ out:
* making sure all the changes could be done. * making sure all the changes could be done.
*/ */
static int static int
sciparam(tp, t) sciparam(struct tty *tp, struct termios *t)
struct tty *tp;
struct termios *t;
{ {
struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(tp->t_dev)]; struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(tp->t_dev)];
int ospeed = t->c_ospeed; int ospeed = t->c_ospeed;
@ -662,8 +651,7 @@ sciparam(tp, t)
} }
void void
sci_iflush(sc) sci_iflush(struct sci_softc *sc)
struct sci_softc *sc;
{ {
unsigned char err_c; unsigned char err_c;
volatile unsigned char c; volatile unsigned char c;
@ -683,10 +671,7 @@ sci_iflush(sc)
} }
int int
sciopen(dev, flag, mode, p) sciopen(dev_t dev, int flag, int mode, struct proc *p)
dev_t dev;
int flag, mode;
struct proc *p;
{ {
int unit = SCIUNIT(dev); int unit = SCIUNIT(dev);
struct sci_softc *sc; struct sci_softc *sc;
@ -801,10 +786,7 @@ bad:
} }
int int
sciclose(dev, flag, mode, p) sciclose(dev_t dev, int flag, int mode, struct proc *p)
dev_t dev;
int flag, mode;
struct proc *p;
{ {
struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(dev)]; struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(dev)];
struct tty *tp = sc->sc_tty; struct tty *tp = sc->sc_tty;
@ -823,10 +805,7 @@ sciclose(dev, flag, mode, p)
} }
int int
sciread(dev, uio, flag) sciread(dev_t dev, struct uio *uio, int flag)
dev_t dev;
struct uio *uio;
int flag;
{ {
struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(dev)]; struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(dev)];
struct tty *tp = sc->sc_tty; struct tty *tp = sc->sc_tty;
@ -835,10 +814,7 @@ sciread(dev, uio, flag)
} }
int int
sciwrite(dev, uio, flag) sciwrite(dev_t dev, struct uio *uio, int flag)
dev_t dev;
struct uio *uio;
int flag;
{ {
struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(dev)]; struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(dev)];
struct tty *tp = sc->sc_tty; struct tty *tp = sc->sc_tty;
@ -847,10 +823,7 @@ sciwrite(dev, uio, flag)
} }
int int
scipoll(dev, events, p) scipoll(dev_t dev, int events, struct proc *p)
dev_t dev;
int events;
struct proc *p;
{ {
struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(dev)]; struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(dev)];
struct tty *tp = sc->sc_tty; struct tty *tp = sc->sc_tty;
@ -859,8 +832,7 @@ scipoll(dev, events, p)
} }
struct tty * struct tty *
scitty(dev) scitty(dev_t dev)
dev_t dev;
{ {
struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(dev)]; struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(dev)];
struct tty *tp = sc->sc_tty; struct tty *tp = sc->sc_tty;
@ -869,12 +841,7 @@ scitty(dev)
} }
int int
sciioctl(dev, cmd, data, flag, p) sciioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
dev_t dev;
u_long cmd;
caddr_t data;
int flag;
struct proc *p;
{ {
struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(dev)]; struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(dev)];
struct tty *tp = sc->sc_tty; struct tty *tp = sc->sc_tty;
@ -927,8 +894,7 @@ sciioctl(dev, cmd, data, flag, p)
} }
integrate void integrate void
sci_schedrx(sc) sci_schedrx(struct sci_softc *sc)
struct sci_softc *sc;
{ {
sc->sc_rx_ready = 1; sc->sc_rx_ready = 1;
@ -949,9 +915,7 @@ sci_schedrx(sc)
} }
void void
sci_break(sc, onoff) sci_break(struct sci_softc *sc, int onoff)
struct sci_softc *sc;
int onoff;
{ {
if (onoff) if (onoff)
@ -975,9 +939,7 @@ sci_break(sc, onoff)
* Stop output, e.g., for ^S or output flush. * Stop output, e.g., for ^S or output flush.
*/ */
void void
scistop(tp, flag) scistop(struct tty *tp, int flag)
struct tty *tp;
int flag;
{ {
struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(tp->t_dev)]; struct sci_softc *sc = sci_cd.cd_devs[SCIUNIT(tp->t_dev)];
int s; int s;
@ -994,8 +956,7 @@ scistop(tp, flag)
} }
void void
scidiag(arg) scidiag(void *arg)
void *arg;
{ {
struct sci_softc *sc = arg; struct sci_softc *sc = arg;
int overflows, floods; int overflows, floods;
@ -1016,11 +977,9 @@ scidiag(arg)
} }
integrate void integrate void
sci_rxsoft(sc, tp) sci_rxsoft(struct sci_softc *sc, struct tty *tp)
struct sci_softc *sc;
struct tty *tp;
{ {
int (*rint) __P((int c, struct tty *tp)) = tp->t_linesw->l_rint; int (*rint)(int c, struct tty *tp) = tp->t_linesw->l_rint;
u_char *get, *end; u_char *get, *end;
u_int cc, scc; u_int cc, scc;
u_char ssr; u_char ssr;
@ -1116,9 +1075,7 @@ sci_txsoft(sc, tp)
} }
integrate void integrate void
sci_stsoft(sc, tp) sci_stsoft(struct sci_softc *sc, struct tty *tp)
struct sci_softc *sc;
struct tty *tp;
{ {
#if 0 #if 0
/* XXX (msaitoh) */ /* XXX (msaitoh) */
@ -1157,8 +1114,7 @@ sci_stsoft(sc, tp)
#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS #ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
void void
scisoft(arg) scisoft(void *arg)
void *arg;
{ {
struct sci_softc *sc = arg; struct sci_softc *sc = arg;
struct tty *tp; struct tty *tp;
@ -1172,8 +1128,7 @@ void
#ifndef __NO_SOFT_SERIAL_INTERRUPT #ifndef __NO_SOFT_SERIAL_INTERRUPT
scisoft() scisoft()
#else #else
scisoft(arg) scisoft(void *arg)
void *arg;
#endif #endif
{ {
struct sci_softc *sc; struct sci_softc *sc;
@ -1228,8 +1183,7 @@ scisoft(arg)
} }
int int
sciintr(arg) sciintr(void *arg)
void *arg;
{ {
struct sci_softc *sc = arg; struct sci_softc *sc = arg;
u_char *put, *end; u_char *put, *end;
@ -1465,8 +1419,7 @@ scicnprobe(cp)
} }
void void
scicninit(cp) scicninit(struct consdev *cp)
struct consdev *cp;
{ {
InitializeSci(scicn_speed); InitializeSci(scicn_speed);
@ -1474,8 +1427,7 @@ scicninit(cp)
} }
int int
scicngetc(dev) scicngetc(dev_t dev)
dev_t dev;
{ {
int c; int c;
int s; int s;
@ -1488,9 +1440,7 @@ scicngetc(dev)
} }
void void
scicnputc(dev, c) scicnputc(dev_t dev, int c)
dev_t dev;
int c;
{ {
int s; int s;

View File

@ -1,4 +1,4 @@
/* $NetBSD: scif.c,v 1.19 2002/02/01 17:52:56 uch Exp $ */ /* $NetBSD: scif.c,v 1.20 2002/02/12 15:26:46 uch Exp $ */
/*- /*-
* Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved.
@ -126,16 +126,16 @@
#include <machine/shbvar.h> #include <machine/shbvar.h>
static void scifstart __P((struct tty *)); static void scifstart(struct tty *);
static int scifparam __P((struct tty *, struct termios *)); static int scifparam(struct tty *, struct termios *);
void scifcnprobe __P((struct consdev *)); void scifcnprobe(struct consdev *);
void scifcninit __P((struct consdev *)); void scifcninit(struct consdev *);
void scifcnputc __P((dev_t, int)); void scifcnputc(dev_t, int);
int scifcngetc __P((dev_t)); int scifcngetc(dev_t);
void scifcnpoolc __P((dev_t, int)); void scifcnpoolc(dev_t, int);
void scif_intr_init __P((void)); void scif_intr_init(void);
int scifintr __P((void *)); int scifintr(void *);
struct scif_softc { struct scif_softc {
struct device sc_dev; /* boilerplate */ struct device sc_dev; /* boilerplate */
@ -190,27 +190,27 @@ struct scif_softc {
}; };
/* controller driver configuration */ /* controller driver configuration */
static int scif_match __P((struct device *, struct cfdata *, void *)); static int scif_match(struct device *, struct cfdata *, void *);
static void scif_attach __P((struct device *, struct device *, void *)); static void scif_attach(struct device *, struct device *, void *);
void scif_break __P((struct scif_softc *, int)); void scif_break(struct scif_softc *, int);
void scif_iflush __P((struct scif_softc *)); void scif_iflush(struct scif_softc *);
#define integrate static inline #define integrate static inline
#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS #ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
void scifsoft __P((void *)); void scifsoft(void *);
#else #else
#ifndef __NO_SOFT_SERIAL_INTERRUPT #ifndef __NO_SOFT_SERIAL_INTERRUPT
void scifsoft __P((void)); void scifsoft(void);
#else #else
void scifsoft __P((void *)); void scifsoft(void *);
#endif #endif
#endif #endif
integrate void scif_rxsoft __P((struct scif_softc *, struct tty *)); integrate void scif_rxsoft(struct scif_softc *, struct tty *);
integrate void scif_txsoft __P((struct scif_softc *, struct tty *)); integrate void scif_txsoft(struct scif_softc *, struct tty *);
integrate void scif_stsoft __P((struct scif_softc *, struct tty *)); integrate void scif_stsoft(struct scif_softc *, struct tty *);
integrate void scif_schedrx __P((struct scif_softc *)); integrate void scif_schedrx(struct scif_softc *);
void scifdiag __P((void *)); void scifdiag(void *);
#define SCIFUNIT_MASK 0x7ffff #define SCIFUNIT_MASK 0x7ffff
@ -268,7 +268,7 @@ extern struct cfdriver scif_cd;
cdev_decl(scif); cdev_decl(scif);
void InitializeScif __P((unsigned int)); void InitializeScif (unsigned int);
/* /*
* following functions are debugging prupose only * following functions are debugging prupose only
@ -276,18 +276,17 @@ void InitializeScif __P((unsigned int));
#define CR 0x0D #define CR 0x0D
#define USART_ON (unsigned int)~0x08 #define USART_ON (unsigned int)~0x08
static void WaitFor __P((int)); static void WaitFor(int);
void scif_putc __P((unsigned char)); void scif_putc(unsigned char);
unsigned char scif_getc __P((void)); unsigned char scif_getc(void);
int ScifErrCheck __P((void)); int ScifErrCheck(void);
/* /*
* WaitFor * WaitFor
* : int mSec; * : int mSec;
*/ */
static void static void
WaitFor(mSec) WaitFor(int mSec)
int mSec;
{ {
/* Disable Under Flow interrupt, rising edge, 1/4 */ /* Disable Under Flow interrupt, rising edge, 1/4 */
@ -314,8 +313,7 @@ WaitFor(mSec)
*/ */
void void
InitializeScif(bps) InitializeScif(unsigned int bps)
unsigned int bps;
{ {
/* Initialize SCR */ /* Initialize SCR */
@ -358,8 +356,7 @@ InitializeScif(bps)
*/ */
void void
scif_putc(c) scif_putc(unsigned char c)
unsigned char c;
{ {
if (c == '\n') if (c == '\n')
@ -445,10 +442,7 @@ scif_getc(void)
static int static int
scif_match(parent, cfp, aux) scif_match(struct device *parent, struct cfdata *cfp, void *aux)
struct device *parent;
struct cfdata *cfp;
void *aux;
{ {
struct shb_attach_args *sa = aux; struct shb_attach_args *sa = aux;
@ -461,9 +455,7 @@ scif_match(parent, cfp, aux)
} }
static void static void
scif_attach(parent, self, aux) scif_attach(struct device *parent, struct device *self, void *aux)
struct device *parent, *self;
void *aux;
{ {
struct scif_softc *sc = (struct scif_softc *)self; struct scif_softc *sc = (struct scif_softc *)self;
struct tty *tp; struct tty *tp;
@ -523,8 +515,7 @@ scif_attach(parent, self, aux)
* Start or restart transmission. * Start or restart transmission.
*/ */
static void static void
scifstart(tp) scifstart(struct tty *tp)
struct tty *tp;
{ {
struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(tp->t_dev)]; struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(tp->t_dev)];
int s; int s;
@ -593,9 +584,7 @@ out:
* making sure all the changes could be done. * making sure all the changes could be done.
*/ */
static int static int
scifparam(tp, t) scifparam(struct tty *tp, struct termios *t)
struct tty *tp;
struct termios *t;
{ {
struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(tp->t_dev)]; struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(tp->t_dev)];
int ospeed = t->c_ospeed; int ospeed = t->c_ospeed;
@ -718,8 +707,7 @@ scifparam(tp, t)
} }
void void
scif_iflush(sc) scif_iflush(struct scif_softc *sc)
struct scif_softc *sc;
{ {
int i; int i;
unsigned char c; unsigned char c;
@ -734,10 +722,7 @@ scif_iflush(sc)
} }
int int
scifopen(dev, flag, mode, p) scifopen(dev_t dev, int flag, int mode, struct proc *p)
dev_t dev;
int flag, mode;
struct proc *p;
{ {
int unit = SCIFUNIT(dev); int unit = SCIFUNIT(dev);
struct scif_softc *sc; struct scif_softc *sc;
@ -852,10 +837,7 @@ bad:
} }
int int
scifclose(dev, flag, mode, p) scifclose(dev_t dev, int flag, int mode, struct proc *p)
dev_t dev;
int flag, mode;
struct proc *p;
{ {
struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(dev)]; struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(dev)];
struct tty *tp = sc->sc_tty; struct tty *tp = sc->sc_tty;
@ -874,10 +856,7 @@ scifclose(dev, flag, mode, p)
} }
int int
scifread(dev, uio, flag) scifread(dev_t dev, struct uio *uio, int flag)
dev_t dev;
struct uio *uio;
int flag;
{ {
struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(dev)]; struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(dev)];
struct tty *tp = sc->sc_tty; struct tty *tp = sc->sc_tty;
@ -886,10 +865,7 @@ scifread(dev, uio, flag)
} }
int int
scifwrite(dev, uio, flag) scifwrite(dev_t dev, struct uio *uio, int flag)
dev_t dev;
struct uio *uio;
int flag;
{ {
struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(dev)]; struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(dev)];
struct tty *tp = sc->sc_tty; struct tty *tp = sc->sc_tty;
@ -898,10 +874,7 @@ scifwrite(dev, uio, flag)
} }
int int
scifpoll(dev, events, p) scifpoll(dev_t dev, int events, struct proc *p)
dev_t dev;
int events;
struct proc *p;
{ {
struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(dev)]; struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(dev)];
struct tty *tp = sc->sc_tty; struct tty *tp = sc->sc_tty;
@ -910,8 +883,7 @@ scifpoll(dev, events, p)
} }
struct tty * struct tty *
sciftty(dev) sciftty(dev_t dev)
dev_t dev;
{ {
struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(dev)]; struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(dev)];
struct tty *tp = sc->sc_tty; struct tty *tp = sc->sc_tty;
@ -920,12 +892,7 @@ sciftty(dev)
} }
int int
scifioctl(dev, cmd, data, flag, p) scifioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
dev_t dev;
u_long cmd;
caddr_t data;
int flag;
struct proc *p;
{ {
struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(dev)]; struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(dev)];
struct tty *tp = sc->sc_tty; struct tty *tp = sc->sc_tty;
@ -978,8 +945,7 @@ scifioctl(dev, cmd, data, flag, p)
} }
integrate void integrate void
scif_schedrx(sc) scif_schedrx(struct scif_softc *sc)
struct scif_softc *sc;
{ {
sc->sc_rx_ready = 1; sc->sc_rx_ready = 1;
@ -1000,9 +966,7 @@ scif_schedrx(sc)
} }
void void
scif_break(sc, onoff) scif_break(struct scif_softc *sc, int onoff)
struct scif_softc *sc;
int onoff;
{ {
if (onoff) if (onoff)
@ -1026,9 +990,7 @@ scif_break(sc, onoff)
* Stop output, e.g., for ^S or output flush. * Stop output, e.g., for ^S or output flush.
*/ */
void void
scifstop(tp, flag) scifstop(struct tty *tp, int flag)
struct tty *tp;
int flag;
{ {
struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(tp->t_dev)]; struct scif_softc *sc = scif_cd.cd_devs[SCIFUNIT(tp->t_dev)];
int s; int s;
@ -1051,8 +1013,7 @@ scif_intr_init()
} }
void void
scifdiag(arg) scifdiag(void *arg)
void *arg;
{ {
struct scif_softc *sc = arg; struct scif_softc *sc = arg;
int overflows, floods; int overflows, floods;
@ -1073,11 +1034,9 @@ scifdiag(arg)
} }
integrate void integrate void
scif_rxsoft(sc, tp) scif_rxsoft(struct scif_softc *sc, struct tty *tp)
struct scif_softc *sc;
struct tty *tp;
{ {
int (*rint) __P((int c, struct tty *tp)) = tp->t_linesw->l_rint; int (*rint)(int c, struct tty *tp) = tp->t_linesw->l_rint;
u_char *get, *end; u_char *get, *end;
u_int cc, scc; u_int cc, scc;
u_char ssr2; u_char ssr2;
@ -1159,9 +1118,7 @@ scif_rxsoft(sc, tp)
} }
integrate void integrate void
scif_txsoft(sc, tp) scif_txsoft(struct scif_softc *sc, struct tty *tp)
struct scif_softc *sc;
struct tty *tp;
{ {
CLR(tp->t_state, TS_BUSY); CLR(tp->t_state, TS_BUSY);
@ -1173,9 +1130,7 @@ scif_txsoft(sc, tp)
} }
integrate void integrate void
scif_stsoft(sc, tp) scif_stsoft(struct scif_softc *sc, struct tty *tp)
struct scif_softc *sc;
struct tty *tp;
{ {
#if 0 #if 0
/* XXX (msaitoh) */ /* XXX (msaitoh) */
@ -1214,8 +1169,7 @@ scif_stsoft(sc, tp)
#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS #ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
void void
scifsoft(arg) scifsoft(void *arg)
void *arg;
{ {
struct scif_softc *sc = arg; struct scif_softc *sc = arg;
struct tty *tp; struct tty *tp;
@ -1229,8 +1183,7 @@ void
#ifndef __NO_SOFT_SERIAL_INTERRUPT #ifndef __NO_SOFT_SERIAL_INTERRUPT
scifsoft() scifsoft()
#else #else
scifsoft(arg) scifsoft(void *arg)
void *arg;
#endif #endif
{ {
struct scif_softc *sc; struct scif_softc *sc;
@ -1285,8 +1238,7 @@ scifsoft(arg)
} }
int int
scifintr(arg) scifintr(void *arg)
void *arg;
{ {
struct scif_softc *sc = arg; struct scif_softc *sc = arg;
u_char *put, *end; u_char *put, *end;
@ -1503,15 +1455,14 @@ scifintr(arg)
#endif #endif
#if NRND > 0 && defined(RND_SCIF) #if NRND > 0 && defined(RND_SCIF)
rnd_add_uint32(&sc->rnd_source, iir | lsr); rnd_add_uint32(&sc->rnd_source, iir | lsr);
#endif #endif
return (1); return (1);
} }
void void
scifcnprobe(cp) scifcnprobe(struct consdev *cp)
struct consdev *cp;
{ {
int maj; int maj;
@ -1530,8 +1481,7 @@ scifcnprobe(cp)
} }
void void
scifcninit(cp) scifcninit(struct consdev *cp)
struct consdev *cp;
{ {
InitializeScif(scifcn_speed); InitializeScif(scifcn_speed);
@ -1539,8 +1489,7 @@ scifcninit(cp)
} }
int int
scifcngetc(dev) scifcngetc(dev_t dev)
dev_t dev;
{ {
int c; int c;
int s; int s;
@ -1553,9 +1502,7 @@ scifcngetc(dev)
} }
void void
scifcnputc(dev, c) scifcnputc(dev_t dev, int c)
dev_t dev;
int c;
{ {
int s; int s;

View File

@ -1,4 +1,4 @@
/* $NetBSD: shpcic.c,v 1.5 2001/12/15 13:23:21 soren Exp $ */ /* $NetBSD: shpcic.c,v 1.6 2002/02/12 15:26:46 uch Exp $ */
#define SHPCICDEBUG #define SHPCICDEBUG
@ -70,30 +70,29 @@ int shpcic_debug = 0;
#define SHPCIC_MEM_ALIGN SHPCIC_MEM_PAGESIZE #define SHPCIC_MEM_ALIGN SHPCIC_MEM_PAGESIZE
void shpcic_attach_socket __P((struct shpcic_handle *)); void shpcic_attach_socket(struct shpcic_handle *);
void shpcic_init_socket __P((struct shpcic_handle *)); void shpcic_init_socket(struct shpcic_handle *);
int shpcic_submatch __P((struct device *, struct cfdata *, void *)); int shpcic_submatch(struct device *, struct cfdata *, void *);
int shpcic_print __P((void *arg, const char *pnp)); int shpcic_print (void *, const char *);
int shpcic_intr_socket __P((struct shpcic_handle *)); int shpcic_intr_socket(struct shpcic_handle *);
void shpcic_attach_card __P((struct shpcic_handle *)); void shpcic_attach_card(struct shpcic_handle *);
void shpcic_detach_card __P((struct shpcic_handle *, int)); void shpcic_detach_card(struct shpcic_handle *, int);
void shpcic_deactivate_card __P((struct shpcic_handle *)); void shpcic_deactivate_card(struct shpcic_handle *);
void shpcic_chip_do_mem_map __P((struct shpcic_handle *, int)); void shpcic_chip_do_mem_map(struct shpcic_handle *, int);
void shpcic_chip_do_io_map __P((struct shpcic_handle *, int)); void shpcic_chip_do_io_map(struct shpcic_handle *, int);
void shpcic_create_event_thread __P((void *)); void shpcic_create_event_thread(void *);
void shpcic_event_thread __P((void *)); void shpcic_event_thread(void *);
void shpcic_queue_event __P((struct shpcic_handle *, int)); void shpcic_queue_event(struct shpcic_handle *, int);
/* static void shpcic_wait_ready __P((struct shpcic_handle *)); */ /* static void shpcic_wait_ready(struct shpcic_handle *); */
int int
shpcic_ident_ok(ident) shpcic_ident_ok(int ident)
int ident;
{ {
/* this is very empirical and heuristic */ /* this is very empirical and heuristic */
@ -111,16 +110,16 @@ shpcic_ident_ok(ident)
} }
int int
shpcic_vendor(h) shpcic_vendor(struct shpcic_handle *h)
struct shpcic_handle *h;
{ {
return (PCIC_VENDOR_HITACHI); return (PCIC_VENDOR_HITACHI);
} }
char * char *
shpcic_vendor_to_string(vendor) shpcic_vendor_to_string(int vendor)
int vendor;
{ {
switch (vendor) { switch (vendor) {
case PCIC_VENDOR_HITACHI: case PCIC_VENDOR_HITACHI:
return ("Hitachi SH"); return ("Hitachi SH");
@ -130,8 +129,7 @@ shpcic_vendor_to_string(vendor)
} }
void void
shpcic_attach(sc) shpcic_attach(struct shpcic_softc *sc)
struct shpcic_softc *sc;
{ {
int vendor, count, i; int vendor, count, i;
@ -215,8 +213,7 @@ shpcic_attach(sc)
} }
void void
shpcic_attach_sockets(sc) shpcic_attach_sockets(struct shpcic_softc *sc)
struct shpcic_softc *sc;
{ {
int i; int i;
@ -226,8 +223,7 @@ shpcic_attach_sockets(sc)
} }
void void
shpcic_attach_socket(h) shpcic_attach_socket(struct shpcic_handle *h)
struct shpcic_handle *h;
{ {
struct pcmciabus_attach_args paa; struct pcmciabus_attach_args paa;
@ -256,8 +252,7 @@ shpcic_attach_socket(h)
} }
void void
shpcic_create_event_thread(arg) shpcic_create_event_thread(void *arg)
void *arg;
{ {
struct shpcic_handle *h = arg; struct shpcic_handle *h = arg;
const char *cs; const char *cs;
@ -288,8 +283,7 @@ shpcic_create_event_thread(arg)
} }
void void
shpcic_event_thread(arg) shpcic_event_thread(void *arg)
void *arg;
{ {
struct shpcic_handle *h = arg; struct shpcic_handle *h = arg;
struct shpcic_event *pe; struct shpcic_event *pe;
@ -375,8 +369,7 @@ shpcic_event_thread(arg)
} }
void void
shpcic_init_socket(h) shpcic_init_socket(struct shpcic_handle *h)
struct shpcic_handle *h;
{ {
int reg; int reg;
@ -414,10 +407,7 @@ shpcic_init_socket(h)
} }
int int
shpcic_submatch(parent, cf, aux) shpcic_submatch(struct device *parent, struct cfdata *cf, void *aux)
struct device *parent;
struct cfdata *cf;
void *aux;
{ {
struct pcmciabus_attach_args *paa = aux; struct pcmciabus_attach_args *paa = aux;
@ -480,9 +470,7 @@ shpcic_submatch(parent, cf, aux)
} }
int int
shpcic_print(arg, pnp) shpcic_print(void *arg, const char *pnp)
void *arg;
const char *pnp;
{ {
struct pcmciabus_attach_args *paa = arg; struct pcmciabus_attach_args *paa = arg;
struct shpcic_handle *h = (struct shpcic_handle *) paa->pch; struct shpcic_handle *h = (struct shpcic_handle *) paa->pch;
@ -512,8 +500,7 @@ shpcic_print(arg, pnp)
} }
int int
shpcic_intr(arg) shpcic_intr(void *arg)
void *arg;
{ {
struct shpcic_softc *sc = arg; struct shpcic_softc *sc = arg;
int i, ret = 0; int i, ret = 0;
@ -528,8 +515,7 @@ shpcic_intr(arg)
} }
int int
shpcic_intr_socket(h) shpcic_intr_socket(struct shpcic_handle *h)
struct shpcic_handle *h;
{ {
int cscreg; int cscreg;
@ -589,9 +575,7 @@ shpcic_intr_socket(h)
} }
void void
shpcic_queue_event(h, event) shpcic_queue_event(struct shpcic_handle *h, int event)
struct shpcic_handle *h;
int event;
{ {
struct shpcic_event *pe; struct shpcic_event *pe;
int s; int s;
@ -608,8 +592,7 @@ shpcic_queue_event(h, event)
} }
void void
shpcic_attach_card(h) shpcic_attach_card(struct shpcic_handle *h)
struct shpcic_handle *h;
{ {
if (!(h->flags & SHPCIC_FLAG_CARDP)) { if (!(h->flags & SHPCIC_FLAG_CARDP)) {
@ -623,9 +606,7 @@ shpcic_attach_card(h)
} }
void void
shpcic_detach_card(h, flags) shpcic_detach_card(struct shpcic_handle *h, int flags)
struct shpcic_handle *h;
int flags; /* DETACH_* */
{ {
if (h->flags & SHPCIC_FLAG_CARDP) { if (h->flags & SHPCIC_FLAG_CARDP) {
@ -639,8 +620,7 @@ shpcic_detach_card(h, flags)
} }
void void
shpcic_deactivate_card(h) shpcic_deactivate_card(struct shpcic_handle *h)
struct shpcic_handle *h;
{ {
/* call the MI deactivate function */ /* call the MI deactivate function */
@ -656,10 +636,8 @@ shpcic_deactivate_card(h)
} }
int int
shpcic_chip_mem_alloc(pch, size, pcmhp) shpcic_chip_mem_alloc(pcmcia_chipset_handle_t pch, bus_size_t size,
pcmcia_chipset_handle_t pch; struct pcmcia_mem_handle *pcmhp)
bus_size_t size;
struct pcmcia_mem_handle *pcmhp;
{ {
struct shpcic_handle *h = (struct shpcic_handle *) pch; struct shpcic_handle *h = (struct shpcic_handle *) pch;
bus_space_handle_t memh = 0; bus_space_handle_t memh = 0;
@ -705,9 +683,8 @@ shpcic_chip_mem_alloc(pch, size, pcmhp)
} }
void void
shpcic_chip_mem_free(pch, pcmhp) shpcic_chip_mem_free(pcmcia_chipset_handle_t pch,
pcmcia_chipset_handle_t pch; struct pcmcia_mem_handle *pcmhp)
struct pcmcia_mem_handle *pcmhp;
{ {
struct shpcic_handle *h = (struct shpcic_handle *) pch; struct shpcic_handle *h = (struct shpcic_handle *) pch;
@ -715,14 +692,9 @@ shpcic_chip_mem_free(pch, pcmhp)
} }
int int
shpcic_chip_mem_map(pch, kind, card_addr, size, pcmhp, offsetp, windowp) shpcic_chip_mem_map(pcmcia_chipset_handle_t pch, int kind,
pcmcia_chipset_handle_t pch; bus_addr_t card_addr, bus_size_t size, struct pcmcia_mem_handle *pcmhp,
int kind; bus_size_t *offsetp, int *windowp)
bus_addr_t card_addr;
bus_size_t size;
struct pcmcia_mem_handle *pcmhp;
bus_size_t *offsetp;
int *windowp;
{ {
struct shpcic_handle *h = (struct shpcic_handle *) pch; struct shpcic_handle *h = (struct shpcic_handle *) pch;
bus_addr_t busaddr; bus_addr_t busaddr;
@ -791,9 +763,7 @@ shpcic_chip_mem_map(pch, kind, card_addr, size, pcmhp, offsetp, windowp)
} }
void void
shpcic_chip_mem_unmap(pch, window) shpcic_chip_mem_unmap(pcmcia_chipset_handle_t pch, int window)
pcmcia_chipset_handle_t pch;
int window;
{ {
struct shpcic_handle *h = (struct shpcic_handle *) pch; struct shpcic_handle *h = (struct shpcic_handle *) pch;
@ -804,12 +774,8 @@ shpcic_chip_mem_unmap(pch, window)
} }
int int
shpcic_chip_io_alloc(pch, start, size, align, pcihp) shpcic_chip_io_alloc(pcmcia_chipset_handle_t pch, bus_addr_t start,
pcmcia_chipset_handle_t pch; bus_size_t size, bus_size_t align, struct pcmcia_io_handle *pcihp)
bus_addr_t start;
bus_size_t size;
bus_size_t align;
struct pcmcia_io_handle *pcihp;
{ {
struct shpcic_handle *h = (struct shpcic_handle *) pch; struct shpcic_handle *h = (struct shpcic_handle *) pch;
bus_space_tag_t iot; bus_space_tag_t iot;
@ -849,9 +815,8 @@ shpcic_chip_io_alloc(pch, start, size, align, pcihp)
} }
void void
shpcic_chip_io_free(pch, pcihp) shpcic_chip_io_free(pcmcia_chipset_handle_t pch,
pcmcia_chipset_handle_t pch; struct pcmcia_io_handle *pcihp)
struct pcmcia_io_handle *pcihp;
{ {
bus_space_tag_t iot = pcihp->iot; bus_space_tag_t iot = pcihp->iot;
bus_space_handle_t ioh = pcihp->ioh; bus_space_handle_t ioh = pcihp->ioh;
@ -864,13 +829,8 @@ shpcic_chip_io_free(pch, pcihp)
} }
int int
shpcic_chip_io_map(pch, width, offset, size, pcihp, windowp) shpcic_chip_io_map(pcmcia_chipset_handle_t pch, int width, bus_addr_t offset,
pcmcia_chipset_handle_t pch; bus_size_t size, struct pcmcia_io_handle *pcihp, int *windowp)
int width;
bus_addr_t offset;
bus_size_t size;
struct pcmcia_io_handle *pcihp;
int *windowp;
{ {
struct shpcic_handle *h = (struct shpcic_handle *) pch; struct shpcic_handle *h = (struct shpcic_handle *) pch;
bus_addr_t ioaddr = pcihp->addr + offset; bus_addr_t ioaddr = pcihp->addr + offset;
@ -935,9 +895,7 @@ shpcic_chip_io_map(pch, width, offset, size, pcihp, windowp)
} }
void void
shpcic_chip_io_unmap(pch, window) shpcic_chip_io_unmap(pcmcia_chipset_handle_t pch, int window)
pcmcia_chipset_handle_t pch;
int window;
{ {
struct shpcic_handle *h = (struct shpcic_handle *) pch; struct shpcic_handle *h = (struct shpcic_handle *) pch;
@ -949,8 +907,7 @@ shpcic_chip_io_unmap(pch, window)
#if 0 #if 0
static void static void
shpcic_wait_ready(h) shpcic_wait_ready(struct shpcic_handle *h)
struct shpcic_handle *h;
{ {
int i; int i;
@ -974,8 +931,7 @@ shpcic_wait_ready(h)
#endif #endif
void void
shpcic_chip_socket_enable(pch) shpcic_chip_socket_enable(pcmcia_chipset_handle_t pch)
pcmcia_chipset_handle_t pch;
{ {
#if 0 #if 0
struct shpcic_handle *h = (struct shpcic_handle *) pch; struct shpcic_handle *h = (struct shpcic_handle *) pch;
@ -1078,8 +1034,7 @@ shpcic_chip_socket_enable(pch)
} }
void void
shpcic_chip_socket_disable(pch) shpcic_chip_socket_disable(pcmcia_chipset_handle_t pch)
pcmcia_chipset_handle_t pch;
{ {
#if 0 #if 0
struct shpcic_handle *h = (struct shpcic_handle *) pch; struct shpcic_handle *h = (struct shpcic_handle *) pch;

View File

@ -1,4 +1,4 @@
/* $NetBSD: shpcicvar.h,v 1.2 2001/12/15 13:23:21 soren Exp $ */ /* $NetBSD: shpcicvar.h,v 1.3 2002/02/12 15:26:46 uch Exp $ */
/* /*
* Copyright (c) 1997 Marc Horowitz. All rights reserved. * Copyright (c) 1997 Marc Horowitz. All rights reserved.
@ -135,41 +135,39 @@ struct shpcic_softc {
}; };
int shpcic_ident_ok __P((int)); int shpcic_ident_ok(int);
int shpcic_vendor __P((struct shpcic_handle *)); int shpcic_vendor(struct shpcic_handle *);
char *shpcic_vendor_to_string __P((int)); char *shpcic_vendor_to_string(int);
void shpcic_attach __P((struct shpcic_softc *)); void shpcic_attach(struct shpcic_softc *);
void shpcic_attach_sockets __P((struct shpcic_softc *)); void shpcic_attach_sockets(struct shpcic_softc *);
int shpcic_intr __P((void *arg)); int shpcic_intr(void *arg);
static inline int shpcic_read __P((struct shpcic_handle *, int)); static inline int shpcic_read(struct shpcic_handle *, int);
static inline void shpcic_write __P((struct shpcic_handle *, int, int)); static inline void shpcic_write(struct shpcic_handle *, int, int);
int shpcic_chip_mem_alloc __P((pcmcia_chipset_handle_t, bus_size_t, int shpcic_chip_mem_alloc(pcmcia_chipset_handle_t, bus_size_t,
struct pcmcia_mem_handle *)); struct pcmcia_mem_handle *);
void shpcic_chip_mem_free __P((pcmcia_chipset_handle_t, void shpcic_chip_mem_free(pcmcia_chipset_handle_t,
struct pcmcia_mem_handle *)); struct pcmcia_mem_handle *);
int shpcic_chip_mem_map __P((pcmcia_chipset_handle_t, int, bus_addr_t, int shpcic_chip_mem_map(pcmcia_chipset_handle_t, int, bus_addr_t,
bus_size_t, struct pcmcia_mem_handle *, bus_size_t *, int *)); bus_size_t, struct pcmcia_mem_handle *, bus_size_t *, int *);
void shpcic_chip_mem_unmap __P((pcmcia_chipset_handle_t, int)); void shpcic_chip_mem_unmap(pcmcia_chipset_handle_t, int);
int shpcic_chip_io_alloc __P((pcmcia_chipset_handle_t, bus_addr_t, int shpcic_chip_io_alloc(pcmcia_chipset_handle_t, bus_addr_t,
bus_size_t, bus_size_t, struct pcmcia_io_handle *)); bus_size_t, bus_size_t, struct pcmcia_io_handle *);
void shpcic_chip_io_free __P((pcmcia_chipset_handle_t, void shpcic_chip_io_free(pcmcia_chipset_handle_t,
struct pcmcia_io_handle *)); struct pcmcia_io_handle *);
int shpcic_chip_io_map __P((pcmcia_chipset_handle_t, int, bus_addr_t, int shpcic_chip_io_map(pcmcia_chipset_handle_t, int, bus_addr_t,
bus_size_t, struct pcmcia_io_handle *, int *)); bus_size_t, struct pcmcia_io_handle *, int *);
void shpcic_chip_io_unmap __P((pcmcia_chipset_handle_t, int)); void shpcic_chip_io_unmap(pcmcia_chipset_handle_t, int);
void shpcic_chip_socket_enable __P((pcmcia_chipset_handle_t)); void shpcic_chip_socket_enable(pcmcia_chipset_handle_t);
void shpcic_chip_socket_disable __P((pcmcia_chipset_handle_t)); void shpcic_chip_socket_disable(pcmcia_chipset_handle_t);
static __inline int shpcic_read __P((struct shpcic_handle *, int)); static __inline int shpcic_read(struct shpcic_handle *, int);
static __inline int static __inline int
shpcic_read(h, idx) shpcic_read(struct shpcic_handle *h, int idx)
struct shpcic_handle *h;
int idx;
{ {
static int prev_idx = 0; static int prev_idx = 0;
@ -180,12 +178,9 @@ shpcic_read(h, idx)
return (bus_space_read_stream_2(h->sc->iot, h->sc->ioh, idx)); return (bus_space_read_stream_2(h->sc->iot, h->sc->ioh, idx));
} }
static __inline void shpcic_write __P((struct shpcic_handle *, int, int)); static __inline void shpcic_write(struct shpcic_handle *, int, int);
static __inline void static __inline void
shpcic_write(h, idx, data) shpcic_write(struct shpcic_handle *h, int idx, int data)
struct shpcic_handle *h;
int idx;
int data;
{ {
static int prev_idx; static int prev_idx;
if (idx == -1){ if (idx == -1){
@ -195,8 +190,8 @@ shpcic_write(h, idx, data)
bus_space_write_stream_2(h->sc->iot, h->sc->ioh, idx, (data)); bus_space_write_stream_2(h->sc->iot, h->sc->ioh, idx, (data));
} }
void *pcic_shb_chip_intr_establish __P((pcmcia_chipset_handle_t, void *pcic_shb_chip_intr_establish(pcmcia_chipset_handle_t,
struct pcmcia_function *, int, int (*) (void *), void *)); struct pcmcia_function *, int, int (*) (void *), void *);
void pcic_shb_chip_intr_disestablish __P((pcmcia_chipset_handle_t, void *)); void pcic_shb_chip_intr_disestablish(pcmcia_chipset_handle_t, void *);
void pcic_shb_bus_width_probe __P((struct shpcic_softc *, bus_space_tag_t, void pcic_shb_bus_width_probe(struct shpcic_softc *, bus_space_tag_t,
bus_space_handle_t, bus_addr_t, u_int32_t)); bus_space_handle_t, bus_addr_t, u_int32_t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdog.c,v 1.4 2000/10/31 02:04:12 msaitoh Exp $ */ /* $NetBSD: wdog.c,v 1.5 2002/02/12 15:26:46 uch Exp $ */
/*- /*-
* Copyright (C) 2000 SAITOH Masanobu. All rights reserved. * Copyright (C) 2000 SAITOH Masanobu. All rights reserved.
@ -51,9 +51,9 @@ struct wdog_softc {
int flags; int flags;
}; };
static int wdogmatch __P((struct device *, struct cfdata *, void *)); static int wdogmatch(struct device *, struct cfdata *, void *);
static void wdogattach __P((struct device *, struct device *, void *)); static void wdogattach(struct device *, struct device *, void *);
static int wdogintr __P((void *)); static int wdogintr(void *);
struct cfattach wdog_ca = { struct cfattach wdog_ca = {
sizeof(struct wdog_softc), wdogmatch, wdogattach sizeof(struct wdog_softc), wdogmatch, wdogattach
@ -62,26 +62,21 @@ struct cfattach wdog_ca = {
extern struct cfdriver wdog_cd; extern struct cfdriver wdog_cd;
void void
wdog_wr_cnt(x) wdog_wr_cnt(unsigned char x)
unsigned char x;
{ {
SHREG_WTCNT_W = WTCNT_W_M | (unsigned short) x; SHREG_WTCNT_W = WTCNT_W_M | (unsigned short) x;
} }
void void
wdog_wr_csr(x) wdog_wr_csr(unsigned char x)
unsigned char x;
{ {
SHREG_WTCSR_W = WTCSR_W_M | (unsigned short) x; SHREG_WTCSR_W = WTCSR_W_M | (unsigned short) x;
} }
static int static int
wdogmatch(parent, cfp, aux) wdogmatch(struct device *parent, struct cfdata *cfp, void *aux)
struct device *parent;
struct cfdata *cfp;
void *aux;
{ {
struct shb_attach_args *sa = aux; struct shb_attach_args *sa = aux;
@ -98,9 +93,7 @@ wdogmatch(parent, cfp, aux)
*/ */
/* ARGSUSED */ /* ARGSUSED */
static void static void
wdogattach(parent, self, aux) wdogattach(struct device *parent, struct device *self, void *aux)
struct device *parent, *self;
void *aux;
{ {
struct wdog_softc *sc = (struct wdog_softc *)self; struct wdog_softc *sc = (struct wdog_softc *)self;
struct shb_attach_args *sa = aux; struct shb_attach_args *sa = aux;
@ -117,10 +110,7 @@ wdogattach(parent, self, aux)
/*ARGSUSED*/ /*ARGSUSED*/
int int
wdogopen(dev, flag, mode, p) wdogopen(dev_t dev, int flag, int mode, struct proc *p)
dev_t dev;
int flag, mode;
struct proc *p;
{ {
struct wdog_softc *sc = wdog_cd.cd_devs[0]; /* XXX */ struct wdog_softc *sc = wdog_cd.cd_devs[0]; /* XXX */
@ -134,10 +124,7 @@ wdogopen(dev, flag, mode, p)
/*ARGSUSED*/ /*ARGSUSED*/
int int
wdogclose(dev, flag, mode, p) wdogclose(dev_t dev, int flag, int mode, struct proc *p)
dev_t dev;
int flag, mode;
struct proc *p;
{ {
struct wdog_softc *sc = wdog_cd.cd_devs[0]; /* XXX */ struct wdog_softc *sc = wdog_cd.cd_devs[0]; /* XXX */
@ -151,12 +138,7 @@ extern unsigned int maxwdog;
/*ARGSUSED*/ /*ARGSUSED*/
int int
wdogioctl (dev, cmd, data, flag, p) wdogioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
dev_t dev;
u_long cmd;
caddr_t data;
int flag;
struct proc *p;
{ {
int error = 0; int error = 0;
int request; int request;
@ -205,8 +187,7 @@ wdogioctl (dev, cmd, data, flag, p)
} }
int int
wdogintr(arg) wdogintr(void *arg)
void *arg;
{ {
struct trapframe *frame = arg; struct trapframe *frame = arg;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bootinfo.h,v 1.1 1999/09/13 10:31:14 itojun Exp $ */ /* $NetBSD: bootinfo.h,v 1.2 2002/02/12 15:26:47 uch Exp $ */
/* /*
* Copyright (c) 1997 * Copyright (c) 1997
@ -122,7 +122,7 @@ struct btinfo_biosgeom {
}; };
#ifdef _KERNEL #ifdef _KERNEL
void *lookup_bootinfo __P((int)); void *lookup_bootinfo(int);
#endif #endif
#endif /* _LOCORE */ #endif /* _LOCORE */

View File

@ -1,4 +1,4 @@
/* $NetBSD: bswap.h,v 1.1 1999/09/13 10:31:14 itojun Exp $ */ /* $NetBSD: bswap.h,v 1.2 2002/02/12 15:26:47 uch Exp $ */
/* Written by Manuel Bouyer. Public domain */ /* Written by Manuel Bouyer. Public domain */
@ -10,40 +10,38 @@
#ifndef _KERNEL #ifndef _KERNEL
__BEGIN_DECLS __BEGIN_DECLS
u_int16_t bswap16 __P((u_int16_t)); u_int16_t bswap16(u_int16_t);
u_int32_t bswap32 __P((u_int32_t)); u_int32_t bswap32(u_int32_t);
u_int64_t bswap64 __P((u_int64_t)); u_int64_t bswap64(u_int64_t);
__END_DECLS __END_DECLS
#else /* _KERNEL */ #else /* _KERNEL */
__BEGIN_DECLS __BEGIN_DECLS
static __inline u_int16_t bswap16 __P((u_int16_t)); static __inline u_int16_t bswap16(u_int16_t);
static __inline u_int32_t bswap32 __P((u_int32_t)); static __inline u_int32_t bswap32(u_int32_t);
u_int64_t bswap64 __P((u_int64_t)); u_int64_t bswap64(u_int64_t);
__END_DECLS __END_DECLS
static __inline u_int16_t static __inline u_int16_t
bswap16(x) bswap16(u_int16_t x)
u_int16_t x;
{ {
u_int16_t rval; u_int16_t rval;
__asm __volatile ("swap.b %1,%0" : "=r"(rval) : "r"(x)); __asm __volatile ("swap.b %1,%0" : "=r"(rval) : "r"(x));
return rval; return (rval);
} }
static __inline u_int32_t static __inline u_int32_t
bswap32(x) bswap32(u_int32_t x)
u_int32_t x;
{ {
u_int32_t rval; u_int32_t rval;
__asm __volatile ("swap.b %1,%0; swap.w %0,%0; swap.b %0,%0" __asm __volatile ("swap.b %1,%0; swap.w %0,%0; swap.b %0,%0"
: "=r"(rval) : "r"(x)); : "=r"(rval) : "r"(x));
return rval; return (rval);
} }
#endif /* _KERNEL */ #endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus.h,v 1.6 2001/07/19 15:32:18 thorpej Exp $ */ /* $NetBSD: bus.h,v 1.7 2002/02/12 15:26:47 uch Exp $ */
/*- /*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -112,250 +112,224 @@ typedef int bus_space_tag_t;
typedef u_long bus_space_handle_t; typedef u_long bus_space_handle_t;
/* /*
* int bus_space_map __P((bus_space_tag_t t, bus_addr_t addr, * int bus_space_map (bus_space_tag_t t, bus_addr_t addr,
* bus_size_t size, int flags, bus_space_handle_t *bshp)); * bus_size_t size, int flags, bus_space_handle_t *bshp);
* *
* Map a region of bus space. * Map a region of bus space.
*/ */
#define BUS_SPACE_MAP_CACHEABLE 0x01 #define BUS_SPACE_MAP_CACHEABLE 0x01
#define BUS_SPACE_MAP_LINEAR 0x02 #define BUS_SPACE_MAP_LINEAR 0x02
int bus_space_map __P((bus_space_tag_t, bus_addr_t, bus_size_t size, int bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t size,
int, bus_space_handle_t *)); int, bus_space_handle_t *);
#ifdef SH4_PCMCIA #ifdef SH4_PCMCIA
int shpcmcia_memio_map __P((bus_space_tag_t, bus_addr_t, bus_size_t size, int shpcmcia_memio_map(bus_space_tag_t, bus_addr_t, bus_size_t size,
int, bus_space_handle_t *)); int, bus_space_handle_t *);
int shpcmcia_mem_add_mapping __P((bus_addr_t, bus_size_t, int, int shpcmcia_mem_add_mapping(bus_addr_t, bus_size_t, int,
bus_space_handle_t *)); bus_space_handle_t *);
void shpcmcia_memio_unmap __P((bus_space_tag_t, bus_space_handle_t, void shpcmcia_memio_unmap(bus_space_tag_t, bus_space_handle_t,
bus_size_t)); bus_size_t);
void shpcmcia_memio_free __P((bus_space_tag_t, bus_space_handle_t, void shpcmcia_memio_free(bus_space_tag_t, bus_space_handle_t,
bus_size_t)); bus_size_t);
int shpcmcia_memio_subregion __P((bus_space_tag_t, bus_space_handle_t, int shpcmcia_memio_subregion(bus_space_tag_t, bus_space_handle_t,
bus_size_t, bus_size_t, bus_size_t, bus_size_t, bus_space_handle_t *);
bus_space_handle_t *));
#endif #endif
/* /*
* u_intN_t bus_space_read_N __P((bus_space_tag_t tag, * u_intN_t bus_space_read_N(bus_space_tag_t tag,
* bus_space_handle_t bsh, bus_size_t offset)); * bus_space_handle_t bsh, bus_size_t offset);
* *
* Read a 1, 2, 4, or 8 byte quantity from bus space * Read a 1, 2, 4, or 8 byte quantity from bus space
* described by tag/handle/offset. * described by tag/handle/offset.
*/ */
static __inline u_int8_t bus_space_read_1 static __inline u_int8_t bus_space_read_1
__P((bus_space_tag_t, bus_space_handle_t, bus_size_t)); (bus_space_tag_t, bus_space_handle_t, bus_size_t);
static __inline u_int16_t bus_space_read_2 static __inline u_int16_t bus_space_read_2
__P((bus_space_tag_t, bus_space_handle_t, bus_size_t)); (bus_space_tag_t, bus_space_handle_t, bus_size_t);
static __inline u_int32_t bus_space_read_4 static __inline u_int32_t bus_space_read_4
__P((bus_space_tag_t, bus_space_handle_t, bus_size_t)); (bus_space_tag_t, bus_space_handle_t, bus_size_t);
u_int8_t u_int8_t
bus_space_read_1(tag, bsh, offset) bus_space_read_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset)
bus_space_handle_t bsh;
bus_size_t offset;
{ {
return *(volatile u_int8_t *)(bsh + offset); return *(volatile u_int8_t *)(bsh + offset);
} }
u_int16_t u_int16_t
bus_space_read_2(tag, bsh, offset) bus_space_read_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset)
bus_space_handle_t bsh;
bus_size_t offset;
{ {
return bswap16(*(volatile u_int16_t *)(bsh + offset)); return bswap16(*(volatile u_int16_t *)(bsh + offset));
} }
u_int32_t u_int32_t
bus_space_read_4(tag, bsh, offset) bus_space_read_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset)
bus_space_handle_t bsh;
bus_size_t offset;
{ {
return bswap32(*(volatile u_int32_t *)(bsh + offset)); return bswap32(*(volatile u_int32_t *)(bsh + offset));
} }
static __inline u_int16_t bus_space_read_stream_2 static __inline u_int16_t bus_space_read_stream_2
__P((bus_space_tag_t, bus_space_handle_t, bus_size_t)); (bus_space_tag_t, bus_space_handle_t, bus_size_t);
static __inline u_int32_t bus_space_read_stream_4 static __inline u_int32_t bus_space_read_stream_4
__P((bus_space_tag_t, bus_space_handle_t, bus_size_t)); (bus_space_tag_t, bus_space_handle_t, bus_size_t);
u_int16_t u_int16_t
bus_space_read_stream_2(tag, bsh, offset) bus_space_read_stream_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset)
bus_space_handle_t bsh;
bus_size_t offset;
{ {
return *(volatile u_int16_t *)(bsh + offset); return *(volatile u_int16_t *)(bsh + offset);
} }
u_int32_t u_int32_t
bus_space_read_stream_4(tag, bsh, offset) bus_space_read_stream_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset)
bus_space_handle_t bsh;
bus_size_t offset;
{ {
return *(volatile u_int32_t *)(bsh + offset); return *(volatile u_int32_t *)(bsh + offset);
} }
/* /*
* void bus_space_read_multi_N __P((bus_space_tag_t tag, * void bus_space_read_multi_N(bus_space_tag_t tag,
* bus_space_handle_t bsh, bus_size_t offset, * bus_space_handle_t bsh, bus_size_t offset,
* u_intN_t *addr, size_t count)); * u_intN_t *addr, size_t count);
* *
* Read `count' 1, 2, 4, or 8 byte quantities from bus space * Read `count' 1, 2, 4, or 8 byte quantities from bus space
* described by tag/handle/offset and copy into buffer provided. * described by tag/handle/offset and copy into buffer provided.
*/ */
static __inline void bus_space_read_multi_1 __P((bus_space_tag_t, static __inline void bus_space_read_multi_1(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t)); bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t);
static __inline void bus_space_read_multi_2 __P((bus_space_tag_t, static __inline void bus_space_read_multi_2(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t)); bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t);
static __inline void bus_space_read_multi_4 __P((bus_space_tag_t, static __inline void bus_space_read_multi_4(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t)); bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t);
void void
bus_space_read_multi_1(tag, bsh, offset, addr, count) bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int8_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int8_t *addr;
bus_size_t count;
{ {
while (count--) while (count--)
*addr++ = bus_space_read_1(tag, bsh, offset); *addr++ = bus_space_read_1(tag, bsh, offset);
} }
void void
bus_space_read_multi_2(tag, bsh, offset, addr, count) bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int16_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int16_t *addr;
bus_size_t count;
{ {
while (count--) while (count--)
*addr++ = bus_space_read_2(tag, bsh, offset); *addr++ = bus_space_read_2(tag, bsh, offset);
} }
void void
bus_space_read_multi_4(tag, bsh, offset, addr, count) bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int32_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int32_t *addr;
bus_size_t count;
{ {
while (count--) while (count--)
*addr++ = bus_space_read_4(tag, bsh, offset); *addr++ = bus_space_read_4(tag, bsh, offset);
} }
static __inline void bus_space_read_multi_stream_2 __P((bus_space_tag_t, static __inline void bus_space_read_multi_stream_2(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t)); bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t);
static __inline void bus_space_read_multi_stream_4 __P((bus_space_tag_t, static __inline void bus_space_read_multi_stream_4(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t)); bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t);
void void
bus_space_read_multi_stream_2(tag, bsh, offset, addr, count) bus_space_read_multi_stream_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int16_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int16_t *addr;
bus_size_t count;
{ {
while (count--) while (count--)
*addr++ = *(volatile u_int16_t *)(bsh + offset); *addr++ = *(volatile u_int16_t *)(bsh + offset);
} }
void void
bus_space_read_multi_stream_4(tag, bsh, offset, addr, count) bus_space_read_multi_stream_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int32_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int32_t *addr;
bus_size_t count;
{ {
while (count--) while (count--)
*addr++ = *(volatile u_int32_t *)(bsh + offset); *addr++ = *(volatile u_int32_t *)(bsh + offset);
} }
/* /*
* int bus_space_alloc __P((bus_space_tag_t t, bus_addr_t rstart, * int bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart,
* bus_addr_t rend, bus_size_t size, bus_size_t align, * bus_addr_t rend, bus_size_t size, bus_size_t align,
* bus_size_t boundary, int flags, bus_addr_t *addrp, * bus_size_t boundary, int flags, bus_addr_t *addrp,
* bus_space_handle_t *bshp)); * bus_space_handle_t *bshp);
* *
* Allocate a region of bus space. * Allocate a region of bus space.
*/ */
int sh_memio_alloc __P((bus_space_tag_t, bus_addr_t, bus_addr_t, bus_size_t, int sh_memio_alloc(bus_space_tag_t, bus_addr_t, bus_addr_t, bus_size_t,
bus_size_t, bus_size_t, int, bus_size_t, bus_size_t, int, bus_addr_t *, bus_space_handle_t *);
bus_addr_t *, bus_space_handle_t *));
#define bus_space_alloc(t, rs, re, s, a, b, f, ap, hp) \ #define bus_space_alloc(t, rs, re, s, a, b, f, ap, hp) \
sh_memio_alloc((t), (rs), (re), (s), (a), (b), (f), (ap), (hp)) sh_memio_alloc((t), (rs), (re), (s), (a), (b), (f), (ap), (hp))
/* /*
* int bus_space_free __P((bus_space_tag_t t, * int bus_space_free(bus_space_tag_t t,
* bus_space_handle_t bsh, bus_size_t size)); * bus_space_handle_t bsh, bus_size_t size);
* *
* Free a region of bus space. * Free a region of bus space.
*/ */
void sh_memio_free __P((bus_space_tag_t, bus_space_handle_t, bus_size_t)); void sh_memio_free(bus_space_tag_t, bus_space_handle_t, bus_size_t);
#define bus_space_free(t, h, s) \ #define bus_space_free(t, h, s) \
sh_memio_free((t), (h), (s)) sh_memio_free((t), (h), (s))
/* /*
* int bus_space_unmap __P((bus_space_tag_t t, * int bus_space_unmap(bus_space_tag_t t,
* bus_space_handle_t bsh, bus_size_t size)); * bus_space_handle_t bsh, bus_size_t size);
* *
* Unmap a region of bus space. * Unmap a region of bus space.
*/ */
void sh_memio_unmap __P((bus_space_tag_t, bus_space_handle_t, bus_size_t)); void sh_memio_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t);
#define bus_space_unmap(t, h, s) \ #define bus_space_unmap(t, h, s) \
sh_memio_unmap((t), (h), (s)) sh_memio_unmap((t), (h), (s))
/* /*
* int bus_space_subregion __P((bus_space_tag_t t, * int 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 bsh, bus_size_t offset, bus_size_t size,
* bus_space_handle_t *nbshp)); * bus_space_handle_t *nbshp);
* *
* Get a new handle for a subregion of an already-mapped area of bus space. * Get a new handle for a subregion of an already-mapped area of bus space.
*/ */
int sh_memio_subregion __P((bus_space_tag_t, bus_space_handle_t, int sh_memio_subregion(bus_space_tag_t, bus_space_handle_t,
bus_size_t, bus_size_t, bus_space_handle_t *)); bus_size_t, bus_size_t, bus_space_handle_t *);
#define bus_space_subregion(t, h, o, s, nhp) \ #define bus_space_subregion(t, h, o, s, nhp) \
sh_memio_subregion((t), (h), (o), (s), (nhp)) sh_memio_subregion((t), (h), (o), (s), (nhp))
/* /*
* void bus_space_read_region_N __P((bus_space_tag_t tag, * void bus_space_read_region_N(bus_space_tag_t tag,
* bus_space_handle_t bsh, bus_size_t offset, * bus_space_handle_t bsh, bus_size_t offset,
* u_intN_t *addr, size_t count)); * u_intN_t *addr, size_t count);
* *
* Read `count' 1, 2, 4, or 8 byte quantities from bus space * Read `count' 1, 2, 4, or 8 byte quantities from bus space
* described by tag/handle and starting at `offset' and copy into * described by tag/handle and starting at `offset' and copy into
* buffer provided. * buffer provided.
*/ */
static __inline void bus_space_read_region_1 __P((bus_space_tag_t, static __inline void bus_space_read_region_1(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t)); bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t);
static __inline void bus_space_read_region_2 __P((bus_space_tag_t, static __inline void bus_space_read_region_2(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t)); bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t);
static __inline void bus_space_read_region_4 __P((bus_space_tag_t, static __inline void bus_space_read_region_4(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t)); bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t);
void void
bus_space_read_region_1(tag, bsh, offset, addr, count) bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int8_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int8_t *addr;
bus_size_t count;
{ {
u_int8_t *p = (u_int8_t *)(bsh + offset); u_int8_t *p = (u_int8_t *)(bsh + offset);
@ -364,12 +338,8 @@ bus_space_read_region_1(tag, bsh, offset, addr, count)
} }
void void
bus_space_read_region_2(tag, bsh, offset, addr, count) bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int16_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int16_t *addr;
bus_size_t count;
{ {
u_int16_t *p = (u_int16_t *)(bsh + offset); u_int16_t *p = (u_int16_t *)(bsh + offset);
@ -378,12 +348,8 @@ bus_space_read_region_2(tag, bsh, offset, addr, count)
} }
void void
bus_space_read_region_4(tag, bsh, offset, addr, count) bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int32_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int32_t *addr;
bus_size_t count;
{ {
u_int32_t *p = (u_int32_t *)(bsh + offset); u_int32_t *p = (u_int32_t *)(bsh + offset);
@ -392,27 +358,23 @@ bus_space_read_region_4(tag, bsh, offset, addr, count)
} }
/* /*
* void bus_space_write_region_N __P((bus_space_tag_t tag, * void bus_space_write_region_N(bus_space_tag_t tag,
* bus_space_handle_t bsh, bus_size_t offset, * bus_space_handle_t bsh, bus_size_t offset,
* const u_intN_t *addr, size_t count)); * const u_intN_t *addr, size_t count);
* *
* Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
* to bus space described by tag/handle starting at `offset'. * to bus space described by tag/handle starting at `offset'.
*/ */
static __inline void bus_space_write_region_1 __P((bus_space_tag_t, static __inline void bus_space_write_region_1(bus_space_tag_t,
bus_space_handle_t, bus_size_t, const u_int8_t *, bus_size_t)); bus_space_handle_t, bus_size_t, const u_int8_t *, bus_size_t);
static __inline void bus_space_write_region_2 __P((bus_space_tag_t, static __inline void bus_space_write_region_2(bus_space_tag_t,
bus_space_handle_t, bus_size_t, const u_int16_t *, bus_size_t)); bus_space_handle_t, bus_size_t, const u_int16_t *, bus_size_t);
static __inline void bus_space_write_region_4 __P((bus_space_tag_t, static __inline void bus_space_write_region_4(bus_space_tag_t,
bus_space_handle_t, bus_size_t, const u_int32_t *, bus_size_t)); bus_space_handle_t, bus_size_t, const u_int32_t *, bus_size_t);
void void
bus_space_write_region_1(tag, bsh, offset, addr, count) bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, const u_int8_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
const u_int8_t *addr;
bus_size_t count;
{ {
u_int8_t *p = (u_int8_t *)(bsh + offset); u_int8_t *p = (u_int8_t *)(bsh + offset);
@ -421,12 +383,8 @@ bus_space_write_region_1(tag, bsh, offset, addr, count)
} }
void void
bus_space_write_region_2(tag, bsh, offset, addr, count) bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, const u_int16_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
const u_int16_t *addr;
bus_size_t count;
{ {
u_int16_t *p = (u_int16_t *)(bsh + offset); u_int16_t *p = (u_int16_t *)(bsh + offset);
@ -435,12 +393,8 @@ bus_space_write_region_2(tag, bsh, offset, addr, count)
} }
void void
bus_space_write_region_4(tag, bsh, offset, addr, count) bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, const u_int32_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
const u_int32_t *addr;
bus_size_t count;
{ {
u_int32_t *p = (u_int32_t *)(bsh + offset); u_int32_t *p = (u_int32_t *)(bsh + offset);
@ -449,228 +403,190 @@ bus_space_write_region_4(tag, bsh, offset, addr, count)
} }
/* /*
* void bus_space_write_N __P((bus_space_tag_t tag, * void bus_space_write_N(bus_space_tag_t tag,
* bus_space_handle_t bsh, bus_size_t offset, * bus_space_handle_t bsh, bus_size_t offset,
* u_intN_t value)); * u_intN_t value);
* *
* Write the 1, 2, 4, or 8 byte value `value' to bus space * Write the 1, 2, 4, or 8 byte value `value' to bus space
* described by tag/handle/offset. * described by tag/handle/offset.
*/ */
static __inline void bus_space_write_1 __P((bus_space_tag_t, static __inline void bus_space_write_1(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int8_t)); bus_space_handle_t, bus_size_t, u_int8_t);
static __inline void bus_space_write_2 __P((bus_space_tag_t, static __inline void bus_space_write_2(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int16_t)); bus_space_handle_t, bus_size_t, u_int16_t);
static __inline void bus_space_write_4 __P((bus_space_tag_t, static __inline void bus_space_write_4(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int32_t)); bus_space_handle_t, bus_size_t, u_int32_t);
void void
bus_space_write_1(tag, bsh, offset, value) bus_space_write_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int8_t value)
bus_space_handle_t bsh;
bus_size_t offset;
u_int8_t value;
{ {
*(volatile u_int8_t *)(bsh + offset) = value; *(volatile u_int8_t *)(bsh + offset) = value;
} }
void void
bus_space_write_2(tag, bsh, offset, value) bus_space_write_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int16_t value)
bus_space_handle_t bsh;
bus_size_t offset;
u_int16_t value;
{ {
*(volatile u_int16_t *)(bsh + offset) = bswap16(value); *(volatile u_int16_t *)(bsh + offset) = bswap16(value);
} }
void void
bus_space_write_4(tag, bsh, offset, value) bus_space_write_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int32_t value)
bus_space_handle_t bsh;
bus_size_t offset;
u_int32_t value;
{ {
*(volatile u_int32_t *)(bsh + offset) = bswap32(value); *(volatile u_int32_t *)(bsh + offset) = bswap32(value);
} }
static __inline void bus_space_write_stream_2 __P((bus_space_tag_t, static __inline void bus_space_write_stream_2(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int16_t)); bus_space_handle_t, bus_size_t, u_int16_t);
static __inline void bus_space_write_stream_4 __P((bus_space_tag_t, static __inline void bus_space_write_stream_4(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int32_t)); bus_space_handle_t, bus_size_t, u_int32_t);
void void
bus_space_write_stream_2(tag, bsh, offset, value) bus_space_write_stream_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int16_t value)
bus_space_handle_t bsh;
bus_size_t offset;
u_int16_t value;
{ {
*(volatile u_int16_t *)(bsh + offset) = value; *(volatile u_int16_t *)(bsh + offset) = value;
} }
void void
bus_space_write_stream_4(tag, bsh, offset, value) bus_space_write_stream_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int32_t value)
bus_space_handle_t bsh;
bus_size_t offset;
u_int32_t value;
{ {
*(volatile u_int32_t *)(bsh + offset) = value; *(volatile u_int32_t *)(bsh + offset) = value;
} }
/* /*
* void bus_space_write_multi_N __P((bus_space_tag_t tag, * void bus_space_write_multi_N(bus_space_tag_t tag,
* bus_space_handle_t bsh, bus_size_t offset, * bus_space_handle_t bsh, bus_size_t offset,
* const u_intN_t *addr, size_t count)); * const u_intN_t *addr, size_t count);
* *
* Write `count' 1, 2, 4, or 8 byte quantities from the buffer * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
* provided to bus space described by tag/handle/offset. * provided to bus space described by tag/handle/offset.
*/ */
static __inline void bus_space_write_multi_1 __P((bus_space_tag_t, static __inline void bus_space_write_multi_1(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t)); bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t);
static __inline void bus_space_write_multi_2 __P((bus_space_tag_t, static __inline void bus_space_write_multi_2(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t)); bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t);
static __inline void bus_space_write_multi_4 __P((bus_space_tag_t, static __inline void bus_space_write_multi_4(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t)); bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t);
void void
bus_space_write_multi_1(tag, bsh, offset, addr, count) bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int8_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int8_t *addr;
bus_size_t count;
{ {
while (count--) while (count--)
bus_space_write_1(tag, bsh, offset, *addr++); bus_space_write_1(tag, bsh, offset, *addr++);
} }
void void
bus_space_write_multi_2(tag, bsh, offset, addr, count) bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int16_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int16_t *addr;
bus_size_t count;
{ {
while (count--) while (count--)
bus_space_write_2(tag, bsh, offset, *addr++); bus_space_write_2(tag, bsh, offset, *addr++);
} }
void void
bus_space_write_multi_4(tag, bsh, offset, addr, count) bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int32_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int32_t *addr;
bus_size_t count;
{ {
while (count--) while (count--)
bus_space_write_4(tag, bsh, offset, *addr++); bus_space_write_4(tag, bsh, offset, *addr++);
} }
static __inline void bus_space_write_multi_stream_2 __P((bus_space_tag_t, static __inline void bus_space_write_multi_stream_2(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t)); bus_space_handle_t, bus_size_t, u_int16_t *, bus_size_t);
static __inline void bus_space_write_multi_stream_4 __P((bus_space_tag_t, static __inline void bus_space_write_multi_stream_4(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t)); bus_space_handle_t, bus_size_t, u_int32_t *, bus_size_t);
void void
bus_space_write_multi_stream_2(tag, bsh, offset, addr, count) bus_space_write_multi_stream_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int16_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int16_t *addr;
bus_size_t count;
{ {
while (count--) while (count--)
bus_space_write_stream_2(tag, bsh, offset, *addr++); bus_space_write_stream_2(tag, bsh, offset, *addr++);
} }
void void
bus_space_write_multi_stream_4(tag, bsh, offset, addr, count) bus_space_write_multi_stream_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int32_t *addr, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int32_t *addr;
bus_size_t count;
{ {
while (count--) while (count--)
bus_space_write_stream_4(tag, bsh, offset, *addr++); bus_space_write_stream_4(tag, bsh, offset, *addr++);
} }
/* /*
* void bus_space_set_multi_N __P((bus_space_tag_t tag, * 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, u_intN_t val,
* size_t count)); * size_t count);
* *
* Write the 1, 2, 4, or 8 byte value `val' to bus space described * Write the 1, 2, 4, or 8 byte value `val' to bus space described
* by tag/handle/offset `count' times. * by tag/handle/offset `count' times.
*/ */
static __inline void bus_space_set_multi_1 __P((bus_space_tag_t, static __inline void bus_space_set_multi_1(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int8_t, bus_size_t)); bus_space_handle_t, bus_size_t, u_int8_t, bus_size_t);
static __inline void bus_space_set_multi_2 __P((bus_space_tag_t, static __inline void bus_space_set_multi_2(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int16_t, bus_size_t)); bus_space_handle_t, bus_size_t, u_int16_t, bus_size_t);
static __inline void bus_space_set_multi_4 __P((bus_space_tag_t, static __inline void bus_space_set_multi_4(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int32_t, bus_size_t)); bus_space_handle_t, bus_size_t, u_int32_t, bus_size_t);
void void
bus_space_set_multi_1(tag, bsh, offset, val, count) bus_space_set_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int8_t val, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int8_t val;
bus_size_t count;
{ {
while (count--) while (count--)
bus_space_write_1(tag, bsh, offset, val); bus_space_write_1(tag, bsh, offset, val);
} }
void void
bus_space_set_multi_2(tag, bsh, offset, val, count) bus_space_set_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int16_t val, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int16_t val;
bus_size_t count;
{ {
while (count--) while (count--)
bus_space_write_2(tag, bsh, offset, val); bus_space_write_2(tag, bsh, offset, val);
} }
void void
bus_space_set_multi_4(tag, bsh, offset, val, count) bus_space_set_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int32_t val, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int32_t val;
bus_size_t count;
{ {
while (count--) while (count--)
bus_space_write_4(tag, bsh, offset, val); bus_space_write_4(tag, bsh, offset, val);
} }
/* /*
* void bus_space_set_region_N __P((bus_space_tag_t tag, * 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, u_intN_t val,
* size_t count)); * size_t count);
* *
* Write `count' 1, 2, 4, or 8 byte value `val' to bus space described * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
* by tag/handle starting at `offset'. * by tag/handle starting at `offset'.
*/ */
static __inline void bus_space_set_region_1 __P((bus_space_tag_t, static __inline void bus_space_set_region_1(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int8_t, bus_size_t)); bus_space_handle_t, bus_size_t, u_int8_t, bus_size_t);
static __inline void bus_space_set_region_2 __P((bus_space_tag_t, static __inline void bus_space_set_region_2(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int16_t, bus_size_t)); bus_space_handle_t, bus_size_t, u_int16_t, bus_size_t);
static __inline void bus_space_set_region_4 __P((bus_space_tag_t, static __inline void bus_space_set_region_4(bus_space_tag_t,
bus_space_handle_t, bus_size_t, u_int32_t, bus_size_t)); bus_space_handle_t, bus_size_t, u_int32_t, bus_size_t);
void void
bus_space_set_region_1(tag, bsh, offset, val, count) bus_space_set_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int8_t val, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int8_t val;
bus_size_t count;
{ {
volatile u_int8_t *addr = (void *)(bsh + offset); volatile u_int8_t *addr = (void *)(bsh + offset);
@ -679,12 +595,8 @@ bus_space_set_region_1(tag, bsh, offset, val, count)
} }
void void
bus_space_set_region_2(tag, bsh, offset, val, count) bus_space_set_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int16_t val, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int16_t val;
bus_size_t count;
{ {
volatile u_int16_t *addr = (void *)(bsh + offset); volatile u_int16_t *addr = (void *)(bsh + offset);
@ -694,12 +606,8 @@ bus_space_set_region_2(tag, bsh, offset, val, count)
} }
void void
bus_space_set_region_4(tag, bsh, offset, val, count) bus_space_set_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_space_tag_t tag; bus_size_t offset, u_int32_t val, bus_size_t count)
bus_space_handle_t bsh;
bus_size_t offset;
u_int32_t val;
bus_size_t count;
{ {
volatile u_int32_t *addr = (void *)(bsh + offset); volatile u_int32_t *addr = (void *)(bsh + offset);
@ -709,32 +617,27 @@ bus_space_set_region_4(tag, bsh, offset, val, count)
} }
/* /*
* void bus_space_copy_region_N __P((bus_space_tag_t tag, * void bus_space_copy_region_N(bus_space_tag_t tag,
* bus_space_handle_t bsh1, bus_size_t off1, * bus_space_handle_t bsh1, bus_size_t off1,
* bus_space_handle_t bsh2, bus_size_t off2, * bus_space_handle_t bsh2, bus_size_t off2,
* size_t count)); * size_t count);
* *
* Copy `count' 1, 2, 4, or 8 byte values from bus space starting * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
* at tag/bsh1/off1 to bus space starting at tag/bsh2/off2. * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
*/ */
static __inline void bus_space_copy_region_1 __P((bus_space_tag_t, static __inline void bus_space_copy_region_1(bus_space_tag_t,
bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t,
bus_size_t)); bus_size_t);
static __inline void bus_space_copy_region_2 __P((bus_space_tag_t, static __inline void bus_space_copy_region_2(bus_space_tag_t,
bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t,
bus_size_t)); bus_size_t);
static __inline void bus_space_copy_region_4 __P((bus_space_tag_t, static __inline void bus_space_copy_region_4(bus_space_tag_t,
bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t, bus_space_handle_t, bus_size_t,
bus_size_t)); bus_size_t);
void void
bus_space_copy_region_1(t, h1, o1, h2, o2, c) bus_space_copy_region_1(bus_space_tag_t t, bus_space_handle_t h1,
bus_space_tag_t t; bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
bus_space_handle_t h1;
bus_size_t o1;
bus_space_handle_t h2;
bus_size_t o2;
bus_size_t c;
{ {
volatile u_int8_t *addr1 = (void *)(h1 + o1); volatile u_int8_t *addr1 = (void *)(h1 + o1);
volatile u_int8_t *addr2 = (void *)(h2 + o2); volatile u_int8_t *addr2 = (void *)(h2 + o2);
@ -751,13 +654,8 @@ bus_space_copy_region_1(t, h1, o1, h2, o2, c)
} }
void void
bus_space_copy_region_2(t, h1, o1, h2, o2, c) bus_space_copy_region_2(bus_space_tag_t t, bus_space_handle_t h1,
bus_space_tag_t t; bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
bus_space_handle_t h1;
bus_size_t o1;
bus_space_handle_t h2;
bus_size_t o2;
bus_size_t c;
{ {
volatile u_int16_t *addr1 = (void *)(h1 + o1); volatile u_int16_t *addr1 = (void *)(h1 + o1);
volatile u_int16_t *addr2 = (void *)(h2 + o2); volatile u_int16_t *addr2 = (void *)(h2 + o2);
@ -774,13 +672,8 @@ bus_space_copy_region_2(t, h1, o1, h2, o2, c)
} }
void void
bus_space_copy_region_4(t, h1, o1, h2, o2, c) bus_space_copy_region_4(bus_space_tag_t t, bus_space_handle_t h1,
bus_space_tag_t t; bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
bus_space_handle_t h1;
bus_size_t o1;
bus_space_handle_t h2;
bus_size_t o2;
bus_size_t c;
{ {
volatile u_int32_t *addr1 = (void *)(h1 + o1); volatile u_int32_t *addr1 = (void *)(h1 + o1);
volatile u_int32_t *addr2 = (void *)(h2 + o2); volatile u_int32_t *addr2 = (void *)(h2 + o2);
@ -811,9 +704,9 @@ bus_space_copy_region_4(t, h1, o1, h2, o2, c)
/* /*
* Bus read/write barrier methods. * Bus read/write barrier methods.
* *
* void bus_space_barrier __P((bus_space_tag_t tag, * void bus_space_barrier(bus_space_tag_t tag,
* bus_space_handle_t bsh, bus_size_t offset, * bus_space_handle_t bsh, bus_size_t offset,
* bus_size_t len, int flags)); * bus_size_t len, int flags);
* *
* Note: the sh3 does not currently require barriers, but we must * Note: the sh3 does not currently require barriers, but we must
* provide the flags to MI code. * provide the flags to MI code.
@ -888,33 +781,33 @@ struct sh3_bus_dma_tag {
/* /*
* DMA mapping methods. * DMA mapping methods.
*/ */
int (*_dmamap_create) __P((bus_dma_tag_t, bus_size_t, int, int (*_dmamap_create)(bus_dma_tag_t, bus_size_t, int,
bus_size_t, bus_size_t, int, bus_dmamap_t *)); bus_size_t, bus_size_t, int, bus_dmamap_t *);
void (*_dmamap_destroy) __P((bus_dma_tag_t, bus_dmamap_t)); void (*_dmamap_destroy)(bus_dma_tag_t, bus_dmamap_t);
int (*_dmamap_load) __P((bus_dma_tag_t, bus_dmamap_t, void *, int (*_dmamap_load)(bus_dma_tag_t, bus_dmamap_t, void *,
bus_size_t, struct proc *, int)); bus_size_t, struct proc *, int);
int (*_dmamap_load_mbuf) __P((bus_dma_tag_t, bus_dmamap_t, int (*_dmamap_load_mbuf)(bus_dma_tag_t, bus_dmamap_t,
struct mbuf *, int)); struct mbuf *, int);
int (*_dmamap_load_uio) __P((bus_dma_tag_t, bus_dmamap_t, int (*_dmamap_load_uio)(bus_dma_tag_t, bus_dmamap_t,
struct uio *, int)); struct uio *, int);
int (*_dmamap_load_raw) __P((bus_dma_tag_t, bus_dmamap_t, int (*_dmamap_load_raw)(bus_dma_tag_t, bus_dmamap_t,
bus_dma_segment_t *, int, bus_size_t, int)); bus_dma_segment_t *, int, bus_size_t, int);
void (*_dmamap_unload) __P((bus_dma_tag_t, bus_dmamap_t)); void (*_dmamap_unload)(bus_dma_tag_t, bus_dmamap_t);
void (*_dmamap_sync) __P((bus_dma_tag_t, bus_dmamap_t, void (*_dmamap_sync)(bus_dma_tag_t, bus_dmamap_t,
bus_dmasync_op_t)); bus_dmasync_op_t);
/* /*
* DMA memory utility functions. * DMA memory utility functions.
*/ */
int (*_dmamem_alloc) __P((bus_dma_tag_t, bus_size_t, bus_size_t, int (*_dmamem_alloc)(bus_dma_tag_t, bus_size_t, bus_size_t,
bus_size_t, bus_dma_segment_t *, int, int *, int)); bus_size_t, bus_dma_segment_t *, int, int *, int);
void (*_dmamem_free) __P((bus_dma_tag_t, void (*_dmamem_free)(bus_dma_tag_t,
bus_dma_segment_t *, int)); bus_dma_segment_t *, int);
int (*_dmamem_map) __P((bus_dma_tag_t, bus_dma_segment_t *, int (*_dmamem_map)(bus_dma_tag_t, bus_dma_segment_t *,
int, size_t, caddr_t *, int)); int, size_t, caddr_t *, int);
void (*_dmamem_unmap) __P((bus_dma_tag_t, caddr_t, size_t)); void (*_dmamem_unmap)(bus_dma_tag_t, caddr_t, size_t);
paddr_t (*_dmamem_mmap) __P((bus_dma_tag_t, bus_dma_segment_t *, paddr_t (*_dmamem_mmap)(bus_dma_tag_t, bus_dma_segment_t *,
int, off_t, int, int)); int, off_t, int, int);
}; };
#define bus_dmamap_create(t, s, n, m, b, f, p) \ #define bus_dmamap_create(t, s, n, m, b, f, p) \
@ -971,36 +864,36 @@ struct sh3_bus_dmamap {
}; };
#ifdef _SH3_BUS_DMA_PRIVATE #ifdef _SH3_BUS_DMA_PRIVATE
int _bus_dmamap_create __P((bus_dma_tag_t, bus_size_t, int, bus_size_t, int _bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
bus_size_t, int, bus_dmamap_t *)); bus_size_t, int, bus_dmamap_t *);
void _bus_dmamap_destroy __P((bus_dma_tag_t, bus_dmamap_t)); void _bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
int _bus_dmamap_load __P((bus_dma_tag_t, bus_dmamap_t, void *, int _bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *,
bus_size_t, struct proc *, int)); bus_size_t, struct proc *, int);
int _bus_dmamap_load_mbuf __P((bus_dma_tag_t, bus_dmamap_t, int _bus_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t,
struct mbuf *, int)); struct mbuf *, int);
int _bus_dmamap_load_uio __P((bus_dma_tag_t, bus_dmamap_t, int _bus_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t,
struct uio *, int)); struct uio *, int);
int _bus_dmamap_load_raw __P((bus_dma_tag_t, bus_dmamap_t, int _bus_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t,
bus_dma_segment_t *, int, bus_size_t, int)); bus_dma_segment_t *, int, bus_size_t, int);
void _bus_dmamap_unload __P((bus_dma_tag_t, bus_dmamap_t)); void _bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
void _bus_dmamap_sync __P((bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t)); void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t);
int _bus_dmamem_alloc __P((bus_dma_tag_t tag, bus_size_t size, int _bus_dmamem_alloc(bus_dma_tag_t tag, bus_size_t size,
bus_size_t alignment, bus_size_t boundary, bus_size_t alignment, bus_size_t boundary,
bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags)); bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags);
void _bus_dmamem_free __P((bus_dma_tag_t tag, bus_dma_segment_t *segs, void _bus_dmamem_free(bus_dma_tag_t tag, bus_dma_segment_t *segs,
int nsegs)); int nsegs);
int _bus_dmamem_map __P((bus_dma_tag_t tag, bus_dma_segment_t *segs, int _bus_dmamem_map(bus_dma_tag_t tag, bus_dma_segment_t *segs,
int nsegs, size_t size, caddr_t *kvap, int flags)); int nsegs, size_t size, caddr_t *kvap, int flags);
void _bus_dmamem_unmap __P((bus_dma_tag_t tag, caddr_t kva, void _bus_dmamem_unmap(bus_dma_tag_t tag, caddr_t kva,
size_t size)); size_t size);
paddr_t _bus_dmamem_mmap __P((bus_dma_tag_t tag, bus_dma_segment_t *segs, paddr_t _bus_dmamem_mmap(bus_dma_tag_t tag, bus_dma_segment_t *segs,
int nsegs, off_t off, int prot, int flags)); int nsegs, off_t off, int prot, int flags);
int _bus_dmamem_alloc_range __P((bus_dma_tag_t tag, bus_size_t size, int _bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
bus_size_t alignment, bus_size_t boundary, bus_size_t alignment, bus_size_t boundary,
bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags, bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags,
vm_offset_t low, vm_offset_t high)); vm_offset_t low, vm_offset_t high);
#endif /* _SH3_BUS_DMA_PRIVATE */ #endif /* _SH3_BUS_DMA_PRIVATE */
#endif /* 0 */ #endif /* 0 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.14 2002/02/11 18:04:24 uch Exp $ */ /* $NetBSD: cpu.h,v 1.15 2002/02/12 15:26:47 uch Exp $ */
/*- /*-
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -124,7 +124,7 @@ int want_resched; /* resched() was called */
* We need a machine-independent name for this. * We need a machine-independent name for this.
*/ */
#define DELAY(x) delay(x) #define DELAY(x) delay(x)
void delay __P((int)); void delay(int);
/* /*
* Logical address space of SH3 CPU. * Logical address space of SH3 CPU.
@ -181,46 +181,42 @@ extern struct cpu_nocpuid_nameclass sh3_nocpuid_cpus[];
extern struct cpu_cpuid_nameclass sh3_cpuid_cpus[]; extern struct cpu_cpuid_nameclass sh3_cpuid_cpus[];
/* autoconf.c */ /* autoconf.c */
void configure __P((void)); void configure(void);
/* sh3_machdep.c */ /* sh3_machdep.c */
void sh3_startup __P((void)); void sh3_startup(void);
/* machdep.c */ /* machdep.c */
void delay __P((int)); void delay(int);
void dumpconf __P((void)); void dumpconf(void);
void cpu_reset __P((void)); void cpu_reset(void);
/* locore.s */ /* locore.s */
struct region_descriptor; struct region_descriptor;
void lgdt __P((struct region_descriptor *)); void lgdt(struct region_descriptor *);
void fillw __P((short, void *, size_t)); void fillw(short, void *, size_t);
void void bcopyb (caddr_t, caddr_t, size_t);
bcopyb __P((caddr_t from, caddr_t to, size_t len)); void bcopyw(caddr_t, caddr_t, size_t);
void void setPageDirReg(int);
bcopyw __P((caddr_t from, caddr_t to, size_t len));
void
setPageDirReg __P((int pgdir));
struct pcb; struct pcb;
void savectx __P((struct pcb *)); void savectx(struct pcb *);
void switch_exit __P((struct proc *)); void switch_exit(struct proc *);
void proc_trampoline __P((void)); void proc_trampoline(void);
/* clock.c */ /* clock.c */
void startrtclock __P((void)); void startrtclock(void);
/* npx.c */ /* npx.c */
void npxdrop __P((void)); void npxdrop(void);
void npxsave __P((void)); void npxsave(void);
/* vm_machdep.c */ /* vm_machdep.c */
int kvtop __P((caddr_t)); int kvtop(caddr_t);
#ifdef MATH_EMULATE #ifdef MATH_EMULATE
/* math_emulate.c */ /* math_emulate.c */
int math_emulate __P((struct trapframe *)); int math_emulate(struct trapframe *);
#endif #endif
#endif /* _KERNEL */ #endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpufunc.h,v 1.9 2002/02/11 18:03:05 uch Exp $ */ /* $NetBSD: cpufunc.h,v 1.10 2002/02/12 15:26:48 uch Exp $ */
/* /*
* Copyright (c) 1993 Charles Hannum. * Copyright (c) 1993 Charles Hannum.
@ -133,7 +133,8 @@ enable_intr(void)
static __inline void static __inline void
breakpoint() breakpoint()
{ {
__asm __volatile ("trapa #0xc3");
__asm __volatile("trapa #0xc3");
} }
#endif /* _KERNEL */ #endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: disklabel.h,v 1.1 1999/09/13 10:31:17 itojun Exp $ */ /* $NetBSD: disklabel.h,v 1.2 2002/02/12 15:26:48 uch Exp $ */
/* /*
* Copyright (c) 1994 Christopher G. Demetriou * Copyright (c) 1994 Christopher G. Demetriou
@ -51,7 +51,7 @@ struct cpu_disklabel {
#ifdef _KERNEL #ifdef _KERNEL
struct disklabel; struct disklabel;
int bounds_check_with_label __P((struct buf *, struct disklabel *, int)); int bounds_check_with_label(struct buf *, struct disklabel *, int);
#endif #endif
#endif /* _MACHINE_DISKLABEL_H_ */ #endif /* _MACHINE_DISKLABEL_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.12 2001/09/16 16:34:34 wiz Exp $ */ /* $NetBSD: intr.h,v 1.13 2002/02/12 15:26:48 uch Exp $ */
/* /*
* Copyright (c) 1996, 1997 Charles M. Hannum. All rights reserved. * Copyright (c) 1996, 1997 Charles M. Hannum. All rights reserved.
@ -49,18 +49,17 @@
volatile int cpl, ipending, astpending; volatile int cpl, ipending, astpending;
int imask[NIPL]; int imask[NIPL];
extern void Xspllower __P((void)); extern void Xspllower(void);
static __inline int splraise __P((int)); static __inline int splraise(int);
static __inline void spllower __P((int)); static __inline void spllower(int);
static __inline void softintr __P((int)); static __inline void softintr(int);
/* /*
* Add a mask to cpl, and return the old value of cpl. * Add a mask to cpl, and return the old value of cpl.
*/ */
static __inline int static __inline int
splraise(ncpl) splraise(int ncpl)
register int ncpl;
{ {
int ocpl ; int ocpl ;
@ -75,8 +74,7 @@ splraise(ncpl)
* interrupts are pending, call Xspllower() to process them. * interrupts are pending, call Xspllower() to process them.
*/ */
static __inline void static __inline void
spllower(ncpl) spllower(int ncpl)
register int ncpl;
{ {
cpl = ncpl; cpl = ncpl;
@ -122,8 +120,7 @@ spllower(ncpl)
* We hand-code this to ensure that it's atomic. * We hand-code this to ensure that it's atomic.
*/ */
static __inline void static __inline void
softintr(mask) softintr(int mask)
register int mask;
{ {
extern void enable_interrupt(void); /* XXX */ extern void enable_interrupt(void); /* XXX */
extern void disable_interrupt(void); extern void disable_interrupt(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.15 2002/02/11 18:05:17 uch Exp $ */ /* $NetBSD: pmap.h,v 1.16 2002/02/12 15:26:48 uch Exp $ */
/* /*
* Copyright (c) 1997 Charles D. Cranor and Washington University. * Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -379,23 +379,23 @@ extern int pmap_pg_g; /* do we support PG_G? */
* prototypes * prototypes
*/ */
void pmap_activate __P((struct proc *)); void pmap_activate(struct proc *);
void pmap_bootstrap __P((vaddr_t)); void pmap_bootstrap(vaddr_t);
boolean_t pmap_change_attrs __P((struct vm_page *, int, int)); boolean_t pmap_change_attrs(struct vm_page *, int, int);
void pmap_deactivate __P((struct proc *)); void pmap_deactivate(struct proc *);
void pmap_page_remove __P((struct vm_page *)); void pmap_page_remove (struct vm_page *);
static void pmap_protect __P((struct pmap *, vaddr_t, static void pmap_protect(struct pmap *, vaddr_t,
vaddr_t, vm_prot_t)); vaddr_t, vm_prot_t);
void pmap_remove __P((struct pmap *, vaddr_t, vaddr_t)); void pmap_remove(struct pmap *, vaddr_t, vaddr_t);
boolean_t pmap_test_attrs __P((struct vm_page *, int)); boolean_t pmap_test_attrs(struct vm_page *, int);
void pmap_transfer __P((struct pmap *, struct pmap *, vaddr_t, void pmap_transfer(struct pmap *, struct pmap *, vaddr_t,
vsize_t, vaddr_t, boolean_t)); vsize_t, vaddr_t, boolean_t);
static void pmap_update_pg __P((vaddr_t)); static void pmap_update_pg(vaddr_t);
static void pmap_update_2pg __P((vaddr_t,vaddr_t)); static void pmap_update_2pg(vaddr_t,vaddr_t);
void pmap_write_protect __P((struct pmap *, vaddr_t, void pmap_write_protect(struct pmap *, vaddr_t,
vaddr_t, vm_prot_t)); vaddr_t, vm_prot_t);
vaddr_t reserve_dumppages __P((vaddr_t)); /* XXX: not a pmap fn */ vaddr_t reserve_dumppages(vaddr_t); /* XXX: not a pmap fn */
#define PMAP_GROWKERNEL /* turn on pmap_growkernel interface */ #define PMAP_GROWKERNEL /* turn on pmap_growkernel interface */
@ -428,8 +428,7 @@ vaddr_t reserve_dumppages __P((vaddr_t)); /* XXX: not a pmap fn */
*/ */
__inline static void __inline static void
pmap_update_pg(va) pmap_update_pg(vaddr_t va)
vaddr_t va;
{ {
#ifdef SH4 #ifdef SH4
#if 1 #if 1
@ -478,11 +477,9 @@ pmap_update_2pg(va, vb)
*/ */
__inline static void __inline static void
pmap_protect(pmap, sva, eva, prot) pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
struct pmap *pmap;
vaddr_t sva, eva;
vm_prot_t prot;
{ {
if ((prot & VM_PROT_WRITE) == 0) { if ((prot & VM_PROT_WRITE) == 0) {
if (prot & (VM_PROT_READ|VM_PROT_EXECUTE)) { if (prot & (VM_PROT_READ|VM_PROT_EXECUTE)) {
pmap_write_protect(pmap, sva, eva, prot); pmap_write_protect(pmap, sva, eva, prot);
@ -492,9 +489,9 @@ pmap_protect(pmap, sva, eva, prot)
} }
} }
vaddr_t pmap_map __P((vaddr_t, paddr_t, paddr_t, vm_prot_t)); vaddr_t pmap_map(vaddr_t, paddr_t, paddr_t, vm_prot_t);
paddr_t vtophys __P((vaddr_t)); paddr_t vtophys(vaddr_t);
void pmap_emulate_reference __P((struct proc *, vaddr_t, int, int)); void pmap_emulate_reference(struct proc *, vaddr_t, int, int);
/* XXX */ /* XXX */
#define PG_U 0 /* referenced bit */ #define PG_U 0 /* referenced bit */

View File

@ -1,4 +1,4 @@
/* $NetBSD: shbvar.h,v 1.1 1999/09/13 10:31:22 itojun Exp $ */ /* $NetBSD: shbvar.h,v 1.2 2002/02/12 15:26:48 uch Exp $ */
/*- /*-
* Copyright (c) 1997 The NetBSD Foundation, Inc. * Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -172,7 +172,7 @@ struct shb_softc {
*/ */
/* SHB interrupt sharing types */ /* SHB interrupt sharing types */
char *shb_intr_typename __P((int type)); char *shb_intr_typename(int);
#define ICU_LEN 32 #define ICU_LEN 32
#define SHB_MAX_HARDINTR 16 #define SHB_MAX_HARDINTR 16
@ -183,7 +183,7 @@ char *shb_intr_typename __P((int type));
*/ */
struct intrhand { struct intrhand {
int (*ih_fun) __P((void *)); int (*ih_fun)(void *);
void *ih_arg; void *ih_arg;
u_long ih_count; u_long ih_count;
struct intrhand *ih_next; struct intrhand *ih_next;
@ -191,9 +191,8 @@ struct intrhand {
int ih_irq; int ih_irq;
}; };
void *shb_intr_establish __P((int irq, int type, void *shb_intr_establish(int, int, int, int (*_fun)(void *), void *);
int level, int (*ih_fun)(void *), void *ih_arg)); void shb_intr_disestablish(void *, void *);
void shb_intr_disestablish __P((void *, void *)); int sh_intr_alloc(int, int, int *);
int sh_intr_alloc __P((int mask, int type, int *irq));
#endif /* !_DEV_SHB_SHBVAR_H_ */ #endif /* !_DEV_SHB_SHBVAR_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdogvar.h,v 1.3 2000/10/31 02:04:13 msaitoh Exp $ */ /* $NetBSD: wdogvar.h,v 1.4 2002/02/12 15:26:48 uch Exp $ */
#ifndef _SH3_WDOGVAR_H_ #ifndef _SH3_WDOGVAR_H_
#define _SH3_WDOGVAR_H_ #define _SH3_WDOGVAR_H_
@ -16,8 +16,8 @@
#ifdef _KERNEL #ifdef _KERNEL
extern unsigned int maxwdog; extern unsigned int maxwdog;
extern void wdog_wr_cnt __P((unsigned char)); extern void wdog_wr_cnt(unsigned char);
extern void wdog_wr_csr __P((unsigned char)); extern void wdog_wr_csr(unsigned char);
#endif #endif
#endif /* !_SH3_WDOGVAR_H_ */ #endif /* !_SH3_WDOGVAR_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.18 2002/02/01 17:52:56 uch Exp $ */ /* $NetBSD: clock.c,v 1.19 2002/02/12 15:26:48 uch Exp $ */
/*- /*-
* Copyright (c) 1993, 1994 Charles Hannum. * Copyright (c) 1993, 1994 Charles Hannum.
@ -108,10 +108,10 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <machine/cpufunc.h> #include <machine/cpufunc.h>
#include <machine/shbvar.h> #include <machine/shbvar.h>
void findcpuspeed __P((void)); void findcpuspeed(void);
int clockintr __P((void *)); int clockintr(void *);
int gettick __P((void)); int gettick(void);
void rtcinit __P((void)); void rtcinit(void);
int timer0speed; int timer0speed;
@ -137,8 +137,7 @@ startrtclock()
* Fill in *tvp with current time with microsecond resolution. * Fill in *tvp with current time with microsecond resolution.
*/ */
void void
microtime(tvp) microtime(struct timeval *tvp)
struct timeval *tvp;
{ {
int s = splclock(); int s = splclock();
long diff; long diff;
@ -191,8 +190,7 @@ microtime(tvp)
unsigned int maxwdog; unsigned int maxwdog;
int int
clockintr(arg) clockintr(void *arg)
void *arg;
{ {
struct clockframe *frame = arg; /* not strictly necessary */ struct clockframe *frame = arg; /* not strictly necessary */
@ -237,8 +235,7 @@ gettick()
* wave' mode counts at 2:1). * wave' mode counts at 2:1).
*/ */
void void
delay(n) delay(int n)
int n;
{ {
unsigned int limit, tick, otick; unsigned int limit, tick, otick;
@ -338,8 +335,7 @@ static int timeset;
* from a filesystem. * from a filesystem.
*/ */
void void
inittodr(base) inittodr(time_t base)
time_t base;
{ {
struct clock_ymdhms dt; struct clock_ymdhms dt;
int doreset = 0; int doreset = 0;
@ -478,7 +474,6 @@ resettodr()
} }
void void
setstatclockrate(arg) setstatclockrate(int arg)
int arg;
{ {
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: coff_exec.c,v 1.12 2001/12/14 23:30:03 thorpej Exp $ */ /* $NetBSD: coff_exec.c,v 1.13 2002/02/12 15:26:49 uch Exp $ */
/* /*
* Copyright (c) 1994, 1995 Scott Bartram * Copyright (c) 1994, 1995 Scott Bartram
@ -46,13 +46,8 @@
#include <sys/exec_coff.h> #include <sys/exec_coff.h>
#if 0 static int coff_find_section(struct proc *, struct vnode *,
int coff_load_shlib __P((struct proc *, char *, struct exec_package *)); struct coff_filehdr *, struct coff_scnhdr *, int);
#endif
static int coff_find_section __P((struct proc *, struct vnode *,
struct coff_filehdr *, struct coff_scnhdr *,
int));
/* /*
* exec_coff_makecmds(): Check if it's an coff-format executable. * exec_coff_makecmds(): Check if it's an coff-format executable.
@ -67,9 +62,7 @@ static int coff_find_section __P((struct proc *, struct vnode *,
*/ */
int int
exec_coff_makecmds(p, epp) exec_coff_makecmds(struct proc *p, struct exec_package *epp)
struct proc *p;
struct exec_package *epp;
{ {
int error; int error;
struct coff_filehdr *fp = epp->ep_hdr; struct coff_filehdr *fp = epp->ep_hdr;
@ -121,9 +114,7 @@ exec_coff_makecmds(p, epp)
*/ */
int int
exec_coff_setup_stack(p, epp) exec_coff_setup_stack(struct proc *p, struct exec_package *epp)
struct proc *p;
struct exec_package *epp;
{ {
DPRINTF(("enter exec_coff_setup_stack\n")); DPRINTF(("enter exec_coff_setup_stack\n"));
@ -143,16 +134,16 @@ exec_coff_setup_stack(p, epp)
* <stack> ep_minsaddr * <stack> ep_minsaddr
*/ */
DPRINTF(("VMCMD: addr %lx size %lx\n", epp->ep_maxsaddr, DPRINTF(("VMCMD: addr %lx size %lx\n", epp->ep_maxsaddr,
(epp->ep_minsaddr - epp->ep_ssize) - epp->ep_maxsaddr)); (epp->ep_minsaddr - epp->ep_ssize) - epp->ep_maxsaddr));
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero,
((epp->ep_minsaddr - epp->ep_ssize) - epp->ep_maxsaddr), ((epp->ep_minsaddr - epp->ep_ssize) - epp->ep_maxsaddr),
epp->ep_maxsaddr, NULLVP, 0, VM_PROT_NONE); epp->ep_maxsaddr, NULLVP, 0, VM_PROT_NONE);
DPRINTF(("VMCMD: addr %lx size %lx\n", DPRINTF(("VMCMD: addr %lx size %lx\n",
epp->ep_minsaddr - epp->ep_ssize, epp->ep_minsaddr - epp->ep_ssize,
epp->ep_ssize)); epp->ep_ssize));
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, epp->ep_ssize, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, epp->ep_ssize,
(epp->ep_minsaddr - epp->ep_ssize), NULLVP, 0, (epp->ep_minsaddr - epp->ep_ssize), NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
return 0; return 0;
} }
@ -163,11 +154,8 @@ exec_coff_setup_stack(p, epp)
*/ */
int int
exec_coff_prep_omagic(p, epp, fp, ap) exec_coff_prep_omagic(struct proc *p, struct exec_package *epp,
struct proc *p; struct coff_filehdr *fp, struct coff_aouthdr *ap)
struct exec_package *epp;
struct coff_filehdr *fp;
struct coff_aouthdr *ap;
{ {
epp->ep_taddr = COFF_SEGMENT_ALIGN(fp, ap, ap->a_tstart); epp->ep_taddr = COFF_SEGMENT_ALIGN(fp, ap, ap->a_tstart);
epp->ep_tsize = ap->a_tsize; epp->ep_tsize = ap->a_tsize;
@ -177,24 +165,24 @@ exec_coff_prep_omagic(p, epp, fp, ap)
/* set up command for text and data segments */ /* set up command for text and data segments */
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn,
ap->a_tsize + ap->a_dsize, epp->ep_taddr, epp->ep_vp, ap->a_tsize + ap->a_dsize, epp->ep_taddr, epp->ep_vp,
COFF_TXTOFF(fp, ap), COFF_TXTOFF(fp, ap),
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
/* set up command for bss segment */ /* set up command for bss segment */
#ifdef __sh__ #ifdef __sh__
if (ap->a_bsize > 0) if (ap->a_bsize > 0)
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, ap->a_bsize, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, ap->a_bsize,
COFF_ROUND(ap->a_dstart + ap->a_dsize, COFF_LDPGSZ), COFF_ROUND(ap->a_dstart + ap->a_dsize, COFF_LDPGSZ),
NULLVP, 0, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
#else #else
if (ap->a_bsize > 0) if (ap->a_bsize > 0)
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, ap->a_bsize, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, ap->a_bsize,
COFF_SEGMENT_ALIGN(fp, ap, COFF_SEGMENT_ALIGN(fp, ap,
ap->a_dstart + ap->a_dsize), ap->a_dstart + ap->a_dsize),
NULLVP, 0, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
#endif #endif
return exec_coff_setup_stack(p, epp); return exec_coff_setup_stack(p, epp);
@ -220,21 +208,21 @@ exec_coff_prep_nmagic(p, epp, fp, ap)
/* set up command for text segment */ /* set up command for text segment */
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, epp->ep_tsize, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, epp->ep_tsize,
epp->ep_taddr, epp->ep_vp, COFF_TXTOFF(fp, ap), epp->ep_taddr, epp->ep_vp, COFF_TXTOFF(fp, ap),
VM_PROT_READ|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_EXECUTE);
/* set up command for data segment */ /* set up command for data segment */
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, epp->ep_dsize, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, epp->ep_dsize,
epp->ep_daddr, epp->ep_vp, COFF_DATOFF(fp, ap), epp->ep_daddr, epp->ep_vp, COFF_DATOFF(fp, ap),
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
/* set up command for bss segment */ /* set up command for bss segment */
if (ap->a_bsize > 0) if (ap->a_bsize > 0)
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, ap->a_bsize, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, ap->a_bsize,
COFF_SEGMENT_ALIGN(fp, ap, COFF_SEGMENT_ALIGN(fp, ap,
ap->a_dstart + ap->a_dsize), ap->a_dstart + ap->a_dsize),
NULLVP, 0, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
return exec_coff_setup_stack(p, epp); return exec_coff_setup_stack(p, epp);
} }
@ -246,12 +234,8 @@ exec_coff_prep_nmagic(p, epp, fp, ap)
*/ */
static int static int
coff_find_section(p, vp, fp, sh, s_type) coff_find_section(struct proc *p, struct vnode *vp, struct coff_filehdr *fp,
struct proc *p; struct coff_scnhdr *sh, int s_type)
struct vnode *vp;
struct coff_filehdr *fp;
struct coff_scnhdr *sh;
int s_type;
{ {
int i, pos, resid, siz, error; int i, pos, resid, siz, error;
@ -268,8 +252,8 @@ coff_find_section(p, vp, fp, sh, s_type)
siz -= resid; siz -= resid;
if (siz != sizeof(struct coff_scnhdr)) { if (siz != sizeof(struct coff_scnhdr)) {
DPRINTF(("incomplete read: hdr %d ask=%d, rem=%d got %d\n", DPRINTF(("incomplete read: hdr %d ask=%d, rem=%d got %d\n",
s_type, sizeof(struct coff_scnhdr), s_type, sizeof(struct coff_scnhdr),
resid, siz)); resid, siz));
return ENOEXEC; return ENOEXEC;
} }
DPRINTF(("found section: %lu\n", sh->s_flags)); DPRINTF(("found section: %lu\n", sh->s_flags));
@ -290,11 +274,8 @@ coff_find_section(p, vp, fp, sh, s_type)
*/ */
int int
exec_coff_prep_zmagic(p, epp, fp, ap) exec_coff_prep_zmagic(struct proc *p, struct exec_package *epp,
struct proc *p; struct coff_filehdr *fp, struct coff_aouthdr *ap)
struct exec_package *epp;
struct coff_filehdr *fp;
struct coff_aouthdr *ap;
{ {
int error; int error;
u_long offset; u_long offset;
@ -313,7 +294,7 @@ exec_coff_prep_zmagic(p, epp, fp, ap)
return error; return error;
} }
DPRINTF(("COFF text addr %lu size %ld offset %ld\n", sh.s_vaddr, DPRINTF(("COFF text addr %lu size %ld offset %ld\n", sh.s_vaddr,
sh.s_size, sh.s_scnptr)); sh.s_size, sh.s_scnptr));
epp->ep_taddr = COFF_ALIGN(sh.s_vaddr); epp->ep_taddr = COFF_ALIGN(sh.s_vaddr);
offset = sh.s_scnptr - (sh.s_vaddr - epp->ep_taddr); offset = sh.s_scnptr - (sh.s_vaddr - epp->ep_taddr);
epp->ep_tsize = sh.s_size + (sh.s_vaddr - epp->ep_taddr); epp->ep_tsize = sh.s_size + (sh.s_vaddr - epp->ep_taddr);
@ -334,16 +315,16 @@ exec_coff_prep_zmagic(p, epp, fp, ap)
epp->ep_vp->v_flag |= VTEXT; epp->ep_vp->v_flag |= VTEXT;
DPRINTF(("VMCMD: addr %lx size %lx offset %lx\n", epp->ep_taddr, DPRINTF(("VMCMD: addr %lx size %lx offset %lx\n", epp->ep_taddr,
epp->ep_tsize, offset)); epp->ep_tsize, offset));
if (!(offset & PAGE_MASK) && !(epp->ep_taddr & PAGE_MASK)) { if (!(offset & PAGE_MASK) && !(epp->ep_taddr & PAGE_MASK)) {
epp->ep_tsize = round_page(epp->ep_tsize); epp->ep_tsize = round_page(epp->ep_tsize);
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, epp->ep_tsize, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, epp->ep_tsize,
epp->ep_taddr, epp->ep_vp, offset, epp->ep_taddr, epp->ep_vp, offset,
VM_PROT_READ|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_EXECUTE);
} else { } else {
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, epp->ep_tsize, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, epp->ep_tsize,
epp->ep_taddr, epp->ep_vp, offset, epp->ep_taddr, epp->ep_vp, offset,
VM_PROT_READ|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_EXECUTE);
} }
/* set up command for data segment */ /* set up command for data segment */
@ -353,7 +334,7 @@ exec_coff_prep_zmagic(p, epp, fp, ap)
return error; return error;
} }
DPRINTF(("COFF data addr %lx size %ld offset %ld\n", sh.s_vaddr, DPRINTF(("COFF data addr %lx size %ld offset %ld\n", sh.s_vaddr,
sh.s_size, sh.s_scnptr)); sh.s_size, sh.s_scnptr));
epp->ep_daddr = COFF_ALIGN(sh.s_vaddr); epp->ep_daddr = COFF_ALIGN(sh.s_vaddr);
offset = sh.s_scnptr - (sh.s_vaddr - epp->ep_daddr); offset = sh.s_scnptr - (sh.s_vaddr - epp->ep_daddr);
dsize = sh.s_size + (sh.s_vaddr - epp->ep_daddr); dsize = sh.s_size + (sh.s_vaddr - epp->ep_daddr);
@ -364,24 +345,24 @@ exec_coff_prep_zmagic(p, epp, fp, ap)
#endif #endif
DPRINTF(("VMCMD: addr %lx size %lx offset %lx\n", epp->ep_daddr, DPRINTF(("VMCMD: addr %lx size %lx offset %lx\n", epp->ep_daddr,
dsize, offset)); dsize, offset));
if (!(offset & PAGE_MASK) && !(epp->ep_daddr & PAGE_MASK)) { if (!(offset & PAGE_MASK) && !(epp->ep_daddr & PAGE_MASK)) {
dsize = round_page(dsize); dsize = round_page(dsize);
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, dsize, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, dsize,
epp->ep_daddr, epp->ep_vp, offset, epp->ep_daddr, epp->ep_vp, offset,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
} else { } else {
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn,
dsize, epp->ep_daddr, epp->ep_vp, offset, dsize, epp->ep_daddr, epp->ep_vp, offset,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
} }
#ifdef __sh__ #ifdef __sh__
if (ap->a_bsize > 0) { if (ap->a_bsize > 0) {
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, ap->a_bsize, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, ap->a_bsize,
COFF_ROUND(ap->a_dstart + ap->a_dsize, COFF_LDPGSZ), COFF_ROUND(ap->a_dstart + ap->a_dsize, COFF_LDPGSZ),
NULLVP, 0, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
} }
#else #else
@ -390,10 +371,10 @@ exec_coff_prep_zmagic(p, epp, fp, ap)
bsize = epp->ep_daddr + epp->ep_dsize - baddr; bsize = epp->ep_daddr + epp->ep_dsize - baddr;
if (bsize > 0) { if (bsize > 0) {
DPRINTF(("VMCMD: addr %x size %x offset %x\n", DPRINTF(("VMCMD: addr %x size %x offset %x\n",
baddr, bsize, 0)); baddr, bsize, 0));
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero,
bsize, baddr, NULLVP, 0, bsize, baddr, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
} }
#endif #endif
@ -407,12 +388,12 @@ exec_coff_prep_zmagic(p, epp, fp, ap)
int len = sh.s_size, path_index, entry_len; int len = sh.s_size, path_index, entry_len;
DPRINTF(("COFF shlib size %d offset %d\n", DPRINTF(("COFF shlib size %d offset %d\n",
sh.s_size, sh.s_scnptr)); sh.s_size, sh.s_scnptr));
error = vn_rdwr(UIO_READ, epp->ep_vp, (caddr_t) buf, error = vn_rdwr(UIO_READ, epp->ep_vp, (caddr_t) buf,
len, sh.s_scnptr, len, sh.s_scnptr,
UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred,
&resid, p); &resid, p);
if (error) { if (error) {
DPRINTF(("shlib section read error %d\n", error)); DPRINTF(("shlib section read error %d\n", error));
return ENOEXEC; return ENOEXEC;
@ -424,7 +405,7 @@ exec_coff_prep_zmagic(p, epp, fp, ap)
entry_len = slhdr->entry_len * sizeof(long); entry_len = slhdr->entry_len * sizeof(long);
DPRINTF(("path_index: %d entry_len: %d name: %s\n", DPRINTF(("path_index: %d entry_len: %d name: %s\n",
path_index, entry_len, slhdr->sl_name)); path_index, entry_len, slhdr->sl_name));
error = coff_load_shlib(p, slhdr->sl_name, epp); error = coff_load_shlib(p, slhdr->sl_name, epp);
if (error) if (error)
@ -440,9 +421,9 @@ exec_coff_prep_zmagic(p, epp, fp, ap)
#if 1 #if 1
DPRINTF(("text addr: %lx size: %ld data addr: %lx size: %ld entry: %lx\n", DPRINTF(("text addr: %lx size: %ld data addr: %lx size: %ld entry: %lx\n",
epp->ep_taddr, epp->ep_tsize, epp->ep_taddr, epp->ep_tsize,
epp->ep_daddr, epp->ep_dsize, epp->ep_daddr, epp->ep_dsize,
epp->ep_entry)); epp->ep_entry));
#endif #endif
return exec_coff_setup_stack(p, epp); return exec_coff_setup_stack(p, epp);
@ -450,10 +431,7 @@ exec_coff_prep_zmagic(p, epp, fp, ap)
#if 0 #if 0
int int
coff_load_shlib(p, path, epp) coff_load_shlib(struct proc *p, char *path, struct exec_package *epp)
struct proc *p;
char *path;
struct exec_package *epp;
{ {
int error, siz, resid; int error, siz, resid;
int taddr, tsize, daddr, dsize, offset; int taddr, tsize, daddr, dsize, offset;
@ -481,44 +459,44 @@ coff_load_shlib(p, path, epp)
error = vn_rdwr(UIO_READ, nd.ni_vp, (caddr_t) fhp, siz, 0, error = vn_rdwr(UIO_READ, nd.ni_vp, (caddr_t) fhp, siz, 0,
UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, p); UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, p);
if (error) { if (error) {
DPRINTF(("filehdr read error %d\n", error)); DPRINTF(("filehdr read error %d\n", error));
vrele(nd.ni_vp); vrele(nd.ni_vp);
return error; return error;
} }
siz -= resid; siz -= resid;
if (siz != sizeof(struct coff_filehdr)) { if (siz != sizeof(struct coff_filehdr)) {
DPRINTF(("coff_load_shlib: incomplete read: ask=%d, rem=%d got %d\n", DPRINTF(("coff_load_shlib: incomplete read: ask=%d, rem=%d got %d\n",
sizeof(struct coff_filehdr), resid, siz)); sizeof(struct coff_filehdr), resid, siz));
vrele(nd.ni_vp); vrele(nd.ni_vp);
return ENOEXEC; return ENOEXEC;
} }
/* load text */ /* load text */
error = coff_find_section(p, nd.ni_vp, fhp, shp, COFF_STYP_TEXT); error = coff_find_section(p, nd.ni_vp, fhp, shp, COFF_STYP_TEXT);
if (error) { if (error) {
DPRINTF(("can't find shlib text section\n")); DPRINTF(("can't find shlib text section\n"));
vrele(nd.ni_vp); vrele(nd.ni_vp);
return error; return error;
} }
DPRINTF(("COFF text addr %x size %d offset %d\n", sh.s_vaddr, DPRINTF(("COFF text addr %x size %d offset %d\n", sh.s_vaddr,
sh.s_size, sh.s_scnptr)); sh.s_size, sh.s_scnptr));
taddr = COFF_ALIGN(shp->s_vaddr); taddr = COFF_ALIGN(shp->s_vaddr);
offset = shp->s_scnptr - (shp->s_vaddr - taddr); offset = shp->s_scnptr - (shp->s_vaddr - taddr);
tsize = shp->s_size + (shp->s_vaddr - taddr); tsize = shp->s_size + (shp->s_vaddr - taddr);
DPRINTF(("VMCMD: addr %x size %x offset %x\n", taddr, tsize, offset)); DPRINTF(("VMCMD: addr %x size %x offset %x\n", taddr, tsize, offset));
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, tsize, taddr, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, tsize, taddr,
nd.ni_vp, offset, nd.ni_vp, offset,
VM_PROT_READ|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_EXECUTE);
/* load data */ /* load data */
error = coff_find_section(p, nd.ni_vp, fhp, shp, COFF_STYP_DATA); error = coff_find_section(p, nd.ni_vp, fhp, shp, COFF_STYP_DATA);
if (error) { if (error) {
DPRINTF(("can't find shlib data section\n")); DPRINTF(("can't find shlib data section\n"));
vrele(nd.ni_vp); vrele(nd.ni_vp);
return error; return error;
} }
DPRINTF(("COFF data addr %x size %d offset %d\n", shp->s_vaddr, DPRINTF(("COFF data addr %x size %d offset %d\n", shp->s_vaddr,
shp->s_size, shp->s_scnptr)); shp->s_size, shp->s_scnptr));
daddr = COFF_ALIGN(shp->s_vaddr); daddr = COFF_ALIGN(shp->s_vaddr);
offset = shp->s_scnptr - (shp->s_vaddr - daddr); offset = shp->s_scnptr - (shp->s_vaddr - daddr);
dsize = shp->s_size + (shp->s_vaddr - daddr); dsize = shp->s_size + (shp->s_vaddr - daddr);
@ -526,8 +504,8 @@ coff_load_shlib(p, path, epp)
DPRINTF(("VMCMD: addr %x size %x offset %x\n", daddr, dsize, offset)); DPRINTF(("VMCMD: addr %x size %x offset %x\n", daddr, dsize, offset));
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn,
dsize, daddr, nd.ni_vp, offset, dsize, daddr, nd.ni_vp, offset,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
/* load bss */ /* load bss */
error = coff_find_section(p, nd.ni_vp, fhp, shp, COFF_STYP_BSS); error = coff_find_section(p, nd.ni_vp, fhp, shp, COFF_STYP_BSS);
@ -536,11 +514,11 @@ coff_load_shlib(p, path, epp)
int bsize = daddr + dsize + shp->s_size - baddr; int bsize = daddr + dsize + shp->s_size - baddr;
if (bsize > 0) { if (bsize > 0) {
DPRINTF(("VMCMD: addr %x size %x offset %x\n", DPRINTF(("VMCMD: addr %x size %x offset %x\n",
baddr, bsize, 0)); baddr, bsize, 0));
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero,
bsize, baddr, NULLVP, 0, bsize, baddr, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
} }
} }
vrele(nd.ni_vp); vrele(nd.ni_vp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat_13_machdep.c,v 1.3 2001/05/16 12:42:38 msaitoh Exp $ */ /* $NetBSD: compat_13_machdep.c,v 1.4 2002/02/12 15:26:49 uch Exp $ */
/*- /*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -47,14 +47,11 @@
#include <sys/syscallargs.h> #include <sys/syscallargs.h>
int int
compat_13_sys_sigreturn(p, v, retval) compat_13_sys_sigreturn(struct proc *p, void *v, register_t *retval)
struct proc *p;
void *v;
register_t *retval;
{ {
struct compat_13_sys_sigreturn_args /* { struct compat_13_sys_sigreturn_args /* {
syscallarg(struct sigcontext13 *) sigcntxp; syscallarg(struct sigcontext13 *) sigcntxp;
} */ *uap = v; } */ *uap = v;
struct sigcontext13 *scp, context; struct sigcontext13 *scp, context;
struct trapframe *tf; struct trapframe *tf;
sigset_t mask; sigset_t mask;

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_disasm.c,v 1.4 2000/09/04 23:02:43 tsubai Exp $ */ /* $NetBSD: db_disasm.c,v 1.5 2002/02/12 15:26:49 uch Exp $ */
/*- /*-
* Copyright (c) 2000 Tsubai Masanari. All rights reserved. * Copyright (c) 2000 Tsubai Masanari. All rights reserved.
@ -37,9 +37,7 @@
void sh3_disasm(void *, char *, char *); void sh3_disasm(void *, char *, char *);
db_addr_t db_addr_t
db_disasm(loc, altfmt) db_disasm(db_addr_t loc, boolean_t altfmt)
db_addr_t loc;
boolean_t altfmt;
{ {
char line[40], ascii[4]; char line[40], ascii[4];

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_interface.c,v 1.6 2002/02/11 17:50:17 uch Exp $ */ /* $NetBSD: db_interface.c,v 1.7 2002/02/12 15:26:49 uch Exp $ */
/*- /*-
* Copyright (C) 2002 UCHIYAMA Yasushi. All rights reserved. * Copyright (C) 2002 UCHIYAMA Yasushi. All rights reserved.
@ -64,10 +64,9 @@ const struct db_command db_machine_command_table[] = {
int db_active; int db_active;
void void
kdb_printtrap(type, code) kdb_printtrap(u_int type, int code)
u_int type;
int code;
{ {
db_printf("kernel mode trap: "); db_printf("kernel mode trap: ");
if (type >= trap_types) if (type >= trap_types)
db_printf("type %d", type); db_printf("type %d", type);
@ -77,9 +76,7 @@ kdb_printtrap(type, code)
} }
int int
kdb_trap(type, code, regs) kdb_trap(int type, int code, db_regs_t *regs)
int type, code;
db_regs_t *regs;
{ {
int s; int s;
@ -120,6 +117,7 @@ kdb_trap(type, code, regs)
void void
cpu_Debugger() cpu_Debugger()
{ {
breakpoint(); breakpoint();
} }
@ -135,8 +133,7 @@ cpu_Debugger()
#define I_RTE 0x002b #define I_RTE 0x002b
boolean_t boolean_t
inst_call(inst) inst_call(int inst)
int inst;
{ {
#if _BYTE_ORDER == BIG_ENDIAN #if _BYTE_ORDER == BIG_ENDIAN
inst >>= 16; inst >>= 16;
@ -146,8 +143,7 @@ inst_call(inst)
} }
boolean_t boolean_t
inst_return(inst) inst_return(int inst)
int inst;
{ {
#if _BYTE_ORDER == BIG_ENDIAN #if _BYTE_ORDER == BIG_ENDIAN
inst >>= 16; inst >>= 16;
@ -156,8 +152,7 @@ inst_return(inst)
} }
boolean_t boolean_t
inst_trap_return(inst) inst_trap_return(int inst)
int inst;
{ {
#if _BYTE_ORDER == BIG_ENDIAN #if _BYTE_ORDER == BIG_ENDIAN
inst >>= 16; inst >>= 16;
@ -166,9 +161,9 @@ inst_trap_return(inst)
} }
void void
db_set_single_step(regs) db_set_single_step(db_regs_t *regs)
db_regs_t *regs;
{ {
SHREG_BBRA = 0; /* disable break */ SHREG_BBRA = 0; /* disable break */
SHREG_BARA = 0; /* break address */ SHREG_BARA = 0; /* break address */
SHREG_BASRA = 0; /* break ASID */ SHREG_BASRA = 0; /* break ASID */
@ -179,9 +174,9 @@ db_set_single_step(regs)
} }
void void
db_clear_single_step(regs) db_clear_single_step(db_regs_t *regs)
db_regs_t *regs;
{ {
regs->tf_ubc = 0; regs->tf_ubc = 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_memrw.c,v 1.3 2000/09/04 23:11:42 tsubai Exp $ */ /* $NetBSD: db_memrw.c,v 1.4 2002/02/12 15:26:49 uch Exp $ */
/* /*
* Mach Operating System * Mach Operating System
@ -47,12 +47,9 @@
* Read bytes from kernel address space for debugger. * Read bytes from kernel address space for debugger.
*/ */
void void
db_read_bytes(addr, size, data) db_read_bytes(vaddr_t addr, size_t size, char *data)
vaddr_t addr;
register size_t size;
register char *data;
{ {
register char *src; char *src;
src = (char *)addr; src = (char *)addr;
while (size-- > 0) while (size-- > 0)
@ -63,12 +60,9 @@ db_read_bytes(addr, size, data)
* Write bytes to kernel address space for debugger. * Write bytes to kernel address space for debugger.
*/ */
void void
db_write_bytes(addr, size, data) db_write_bytes(vaddr_t addr, size_t size, char *data)
vaddr_t addr;
register size_t size;
register char *data;
{ {
register char *dst; char *dst;
dst = (char *)addr; dst = (char *)addr;

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_trace.c,v 1.6 2001/01/18 10:54:28 jdolecek Exp $ */ /* $NetBSD: db_trace.c,v 1.7 2002/02/12 15:26:49 uch Exp $ */
/*- /*-
* Copyright (c) 2000 Tsubai Masanari. All rights reserved. * Copyright (c) 2000 Tsubai Masanari. All rights reserved.
@ -47,37 +47,35 @@ extern char _start[], etext[];
void db_nextframe(db_addr_t, db_addr_t *, db_addr_t *); void db_nextframe(db_addr_t, db_addr_t *, db_addr_t *);
const struct db_variable db_regs[] = { const struct db_variable db_regs[] = {
{ "r0", (long *)&ddb_regs.tf_r0, FCN_NULL }, { "r0", (long *)&ddb_regs.tf_r0, FCN_NULL },
{ "r1", (long *)&ddb_regs.tf_r1, FCN_NULL }, { "r1", (long *)&ddb_regs.tf_r1, FCN_NULL },
{ "r2", (long *)&ddb_regs.tf_r2, FCN_NULL }, { "r2", (long *)&ddb_regs.tf_r2, FCN_NULL },
{ "r3", (long *)&ddb_regs.tf_r3, FCN_NULL }, { "r3", (long *)&ddb_regs.tf_r3, FCN_NULL },
{ "r4", (long *)&ddb_regs.tf_r4, FCN_NULL }, { "r4", (long *)&ddb_regs.tf_r4, FCN_NULL },
{ "r5", (long *)&ddb_regs.tf_r5, FCN_NULL }, { "r5", (long *)&ddb_regs.tf_r5, FCN_NULL },
{ "r6", (long *)&ddb_regs.tf_r6, FCN_NULL }, { "r6", (long *)&ddb_regs.tf_r6, FCN_NULL },
{ "r7", (long *)&ddb_regs.tf_r7, FCN_NULL }, { "r7", (long *)&ddb_regs.tf_r7, FCN_NULL },
{ "r8", (long *)&ddb_regs.tf_r8, FCN_NULL }, { "r8", (long *)&ddb_regs.tf_r8, FCN_NULL },
{ "r9", (long *)&ddb_regs.tf_r9, FCN_NULL }, { "r9", (long *)&ddb_regs.tf_r9, FCN_NULL },
{ "r10", (long *)&ddb_regs.tf_r10, FCN_NULL }, { "r10", (long *)&ddb_regs.tf_r10, FCN_NULL },
{ "r11", (long *)&ddb_regs.tf_r11, FCN_NULL }, { "r11", (long *)&ddb_regs.tf_r11, FCN_NULL },
{ "r12", (long *)&ddb_regs.tf_r12, FCN_NULL }, { "r12", (long *)&ddb_regs.tf_r12, FCN_NULL },
{ "r13", (long *)&ddb_regs.tf_r13, FCN_NULL }, { "r13", (long *)&ddb_regs.tf_r13, FCN_NULL },
{ "r14", (long *)&ddb_regs.tf_r14, FCN_NULL }, { "r14", (long *)&ddb_regs.tf_r14, FCN_NULL },
{ "r15", (long *)&ddb_regs.tf_r15, FCN_NULL }, { "r15", (long *)&ddb_regs.tf_r15, FCN_NULL },
{ "pr", (long *)&ddb_regs.tf_pr, FCN_NULL }, { "pr", (long *)&ddb_regs.tf_pr, FCN_NULL },
{ "spc", (long *)&ddb_regs.tf_spc, FCN_NULL }, { "spc", (long *)&ddb_regs.tf_spc, FCN_NULL },
{ "ssr", (long *)&ddb_regs.tf_ssr, FCN_NULL }, { "ssr", (long *)&ddb_regs.tf_ssr, FCN_NULL },
{ "mach", (long *)&ddb_regs.tf_mach, FCN_NULL }, { "mach", (long *)&ddb_regs.tf_mach, FCN_NULL },
{ "macl", (long *)&ddb_regs.tf_macl, FCN_NULL }, { "macl", (long *)&ddb_regs.tf_macl, FCN_NULL },
}; };
const struct db_variable * const db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); const struct db_variable * const db_eregs =
db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
void void
db_stack_trace_print(addr, have_addr, count, modif, print) db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count,
db_expr_t addr, count; char *modif, void (*print)(const char *, ...))
boolean_t have_addr;
char *modif;
void (*print)(const char *, ...);
{ {
db_addr_t callpc, frame, lastframe; db_addr_t callpc, frame, lastframe;
@ -116,10 +114,10 @@ db_stack_trace_print(addr, have_addr, count, modif, print)
} }
void void
db_nextframe(pc, fp, pr) db_nextframe(
db_addr_t pc; /* in: entry address of current function */ db_addr_t pc, /* in: entry address of current function */
db_addr_t *fp; /* in: current fp, out: parent fp */ db_addr_t *fp, /* in: current fp, out: parent fp */
db_addr_t *pr; /* out: parent fp */ db_addr_t *pr) /* out: parent fp */
{ {
int *frame = (void *)*fp; int *frame = (void *)*fp;
int i, inst; int i, inst;
@ -186,7 +184,7 @@ db_nextframe(pc, fp, pr)
db_disasm(pc - 2, 0); db_disasm(pc - 2, 0);
} }
out: out:
if (fpdepth != -1) if (fpdepth != -1)
*fp = frame[depth - fpdepth - 1]; *fp = frame[depth - fpdepth - 1];
else else

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.4 2000/11/20 08:24:21 chs Exp $ */ /* $NetBSD: disksubr.c,v 1.5 2002/02/12 15:26:50 uch Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California. * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -35,6 +35,8 @@
* @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
*/ */
#include "opt_mbr.h"
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/buf.h> #include <sys/buf.h>
@ -42,7 +44,6 @@
#include <sys/syslog.h> #include <sys/syslog.h>
#include <machine/bswap.h> #include <machine/bswap.h>
#include "opt_mbr.h"
int fat_types[] = { MBR_PTYPE_FAT12, MBR_PTYPE_FAT16S, int fat_types[] = { MBR_PTYPE_FAT12, MBR_PTYPE_FAT16S,
MBR_PTYPE_FAT16B, MBR_PTYPE_FAT32, MBR_PTYPE_FAT16B, MBR_PTYPE_FAT32,
@ -51,14 +52,13 @@ int fat_types[] = { MBR_PTYPE_FAT12, MBR_PTYPE_FAT16S,
#define NO_MBR_SIGNATURE ((struct mbr_partition *) -1) #define NO_MBR_SIGNATURE ((struct mbr_partition *) -1)
void ChangeEndianDiskLabel __P((struct disklabel *)); void change_endian_disk_label(struct disklabel *);
u_int sh3_dkcksum __P((struct disklabel *)); u_int sh3_dkcksum(struct disklabel *);
static struct mbr_partition * static struct mbr_partition *mbr_findslice(struct mbr_partition *,
mbr_findslice __P((struct mbr_partition *, struct buf *)); struct buf *);
void void
ChangeEndianDiskLabel(lp) change_endian_disk_label(struct disklabel *lp)
struct disklabel *lp;
{ {
int i; int i;
u_int16_t d; u_int16_t d;
@ -109,7 +109,7 @@ ChangeEndianDiskLabel(lp)
SW32(d_magic2); /* the magic number (again) */ SW32(d_magic2); /* the magic number (again) */
SW16(d_checksum); /* xor of data incl. partitions */ SW16(d_checksum); /* xor of data incl. partitions */
/* filesystem and partition information: */ /* filesystem and partition information: */
SW16(d_npartitions); /* number of partitions in following */ SW16(d_npartitions); /* number of partitions in following */
SW32(d_bbsize); /* size of boot area at sn0, bytes */ SW32(d_bbsize); /* size of boot area at sn0, bytes */
SW32(d_sbsize); /* max size of fs superblock, bytes */ SW32(d_sbsize); /* max size of fs superblock, bytes */
@ -121,17 +121,17 @@ ChangeEndianDiskLabel(lp)
#if 0 #if 0
t = lp->d_partitions[i].p_fstype; t = lp->d_partitions[i].p_fstype;
lp->d_partitions[i].p_fstype = lp->d_partitions[i].p_fstype =
lp->d_partitions[i].p_frag; lp->d_partitions[i].p_frag;
lp->d_partitions[i].p_frag = t; lp->d_partitions[i].p_frag = t;
#endif #endif
SW16(d_partitions[i].__partition_u1.cpg); SW16(d_partitions[i].__partition_u1.cpg);
#if 0 #if 0
printf("size,offset,fsize,fstype,frag=[%x,%x,%x,%x,%x]\n", printf("size,offset,fsize,fstype,frag=[%x,%x,%x,%x,%x]\n",
lp->d_partitions[i].p_size, lp->d_partitions[i].p_size,
lp->d_partitions[i].p_offset, lp->d_partitions[i].p_offset,
lp->d_partitions[i].p_fsize, lp->d_partitions[i].p_fsize,
lp->d_partitions[i].p_fstype, lp->d_partitions[i].p_fstype,
lp->d_partitions[i].p_frag); lp->d_partitions[i].p_frag);
#endif #endif
} }
}; };
@ -142,11 +142,8 @@ ChangeEndianDiskLabel(lp)
* Otherwise, copy valid MBR partition-table into dp, and if a NetBSD * Otherwise, copy valid MBR partition-table into dp, and if a NetBSD
* partition is found, return a pointer to it; else return NULL. * partition is found, return a pointer to it; else return NULL.
*/ */
static static struct mbr_partition *
struct mbr_partition * mbr_findslice(struct mbr_partition *dp, struct buf *bp)
mbr_findslice(dp, bp)
struct mbr_partition *dp;
struct buf *bp;
{ {
struct mbr_partition *ourdp = NULL; struct mbr_partition *ourdp = NULL;
u_int16_t *mbrmagicp; u_int16_t *mbrmagicp;
@ -187,7 +184,7 @@ mbr_findslice(dp, bp)
} }
#endif /* COMPAT_386BSD_MBRPART */ #endif /* COMPAT_386BSD_MBRPART */
return (ourdp); return (ourdp);
} }
@ -207,11 +204,8 @@ mbr_findslice(dp, bp)
* Returns null on success and an error string on failure. * Returns null on success and an error string on failure.
*/ */
char * char *
readdisklabel(dev, strat, lp, osdep) readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
dev_t dev; struct cpu_disklabel *osdep)
void (*strat) __P((struct buf *));
struct disklabel *lp;
struct cpu_disklabel *osdep;
{ {
struct mbr_partition *dp; struct mbr_partition *dp;
struct partition *pp; struct partition *pp;
@ -230,10 +224,10 @@ readdisklabel(dev, strat, lp, osdep)
#if 0 #if 0
if (lp->d_ncylinders == 16383) { if (lp->d_ncylinders == 16383) {
printf("disklabel: Disk > 8G ... readjusting chs %d/%d/%d to ", printf("disklabel: Disk > 8G ... readjusting chs %d/%d/%d to ",
lp->d_ncylinders, lp->d_ntracks, lp->d_nsectors); lp->d_ncylinders, lp->d_ntracks, lp->d_nsectors);
lp->d_ncylinders = lp->d_secperunit / lp->d_ntracks / lp->d_nsectors; lp->d_ncylinders = lp->d_secperunit / lp->d_ntracks / lp->d_nsectors;
printf("%d/%d/%d\n", printf("%d/%d/%d\n",
lp->d_ncylinders, lp->d_ntracks, lp->d_nsectors); lp->d_ncylinders, lp->d_ntracks, lp->d_nsectors);
} }
#endif #endif
lp->d_npartitions = RAW_PART + 1; lp->d_npartitions = RAW_PART + 1;
@ -295,15 +289,15 @@ readdisklabel(dev, strat, lp, osdep)
/* update disklabel with details */ /* update disklabel with details */
lp->d_partitions[2].p_size = lp->d_partitions[2].p_size =
dp->mbrp_size; dp->mbrp_size;
lp->d_partitions[2].p_offset = lp->d_partitions[2].p_offset =
dp->mbrp_start; dp->mbrp_start;
#if 0 #if 0
if (lp->d_ntracks != dp->mbrp_ehd + 1 || if (lp->d_ntracks != dp->mbrp_ehd + 1 ||
lp->d_nsectors != MBR_PSECT(dp->mbrp_esect)) { lp->d_nsectors != MBR_PSECT(dp->mbrp_esect)) {
printf("disklabel: BIOS sees chs %d/%d/%d as ", printf("disklabel: BIOS sees chs %d/%d/%d as ",
lp->d_ncylinders, lp->d_ntracks, lp->d_ncylinders, lp->d_ntracks,
lp->d_nsectors); lp->d_nsectors);
lp->d_ntracks = dp->mbrp_ehd + 1; lp->d_ntracks = dp->mbrp_ehd + 1;
lp->d_nsectors = MBR_PSECT(dp->mbrp_esect); lp->d_nsectors = MBR_PSECT(dp->mbrp_esect);
lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors; lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors;
@ -311,9 +305,9 @@ readdisklabel(dev, strat, lp, osdep)
if (! lp->d_ncylinders) if (! lp->d_ncylinders)
lp->d_ncylinders = 1; lp->d_ncylinders = 1;
printf("%d/%d/%d\n", printf("%d/%d/%d\n",
lp->d_ncylinders, lp->d_ntracks, lp->d_ncylinders, lp->d_ntracks,
lp->d_nsectors); lp->d_nsectors);
} }
#endif #endif
} }
} }
@ -339,12 +333,12 @@ readdisklabel(dev, strat, lp, osdep)
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) { dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
dls = *dlp; dls = *dlp;
ChangeEndianDiskLabel(&dls); change_endian_disk_label(&dls);
if (dls.d_magic != DISKMAGIC || dls.d_magic2 != DISKMAGIC) { if (dls.d_magic != DISKMAGIC || dls.d_magic2 != DISKMAGIC) {
if (msg == NULL) if (msg == NULL)
msg = "no disk label"; msg = "no disk label";
} else if (dls.d_npartitions > MAXPARTITIONS || } else if (dls.d_npartitions > MAXPARTITIONS ||
sh3_dkcksum(&dls) != 0) sh3_dkcksum(&dls) != 0)
msg = "disk label corrupted"; msg = "disk label corrupted";
else { else {
*lp = dls; *lp = dls;
@ -382,7 +376,7 @@ readdisklabel(dev, strat, lp, osdep)
db = (struct dkbad *)(bp->b_data); db = (struct dkbad *)(bp->b_data);
#define DKBAD_MAGIC 0x4321 #define DKBAD_MAGIC 0x4321
if (db->bt_mbz == 0 if (db->bt_mbz == 0
&& db->bt_flag == DKBAD_MAGIC) { && db->bt_flag == DKBAD_MAGIC) {
msg = NULL; msg = NULL;
*bdp = *db; *bdp = *db;
break; break;
@ -390,39 +384,38 @@ readdisklabel(dev, strat, lp, osdep)
msg = "bad sector table corrupted"; msg = "bad sector table corrupted";
} }
} while ((bp->b_flags & B_ERROR) && (i += 2) < 10 && } while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
i < lp->d_nsectors); i < lp->d_nsectors);
} }
done: done:
brelse(bp); brelse(bp);
return (msg); return (msg);
} }
u_int u_int
sh3_dkcksum(lp) sh3_dkcksum(struct disklabel *lp)
struct disklabel *lp;
{ {
struct disklabel tdl; struct disklabel tdl;
u_short *start, *end; u_short *start, *end;
int offset; int offset;
u_short sum = 0; u_short sum = 0;
u_short w; u_short w;
tdl = *lp; tdl = *lp;
ChangeEndianDiskLabel(&tdl); change_endian_disk_label(&tdl);
start = (u_short *)lp; start = (u_short *)lp;
end = (u_short *)&lp->d_partitions[lp->d_npartitions]; end = (u_short *)&lp->d_partitions[lp->d_npartitions];
offset = end - start; offset = end - start;
start = (u_short *)&tdl; start = (u_short *)&tdl;
end = start + offset; end = start + offset;
while (start < end) { while (start < end) {
w = *start++; w = *start++;
sum ^= bswap16(w); sum ^= bswap16(w);
} }
return (sum); return (sum);
} }
/* /*
@ -430,18 +423,16 @@ sh3_dkcksum(lp)
* before setting it. * before setting it.
*/ */
int int
setdisklabel(olp, nlp, openmask, osdep) setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask,
struct disklabel *olp, *nlp; struct cpu_disklabel *osdep)
u_long openmask;
struct cpu_disklabel *osdep;
{ {
int i; int i;
struct partition *opp, *npp; struct partition *opp, *npp;
/* sanity clause */ /* sanity clause */
if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0 if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0
|| (nlp->d_secsize % DEV_BSIZE) != 0) || (nlp->d_secsize % DEV_BSIZE) != 0)
return(EINVAL); return(EINVAL);
/* special case to allow disklabel to be invalidated */ /* special case to allow disklabel to be invalidated */
if (nlp->d_magic == 0xffffffff) { if (nlp->d_magic == 0xffffffff) {
@ -486,11 +477,8 @@ setdisklabel(olp, nlp, openmask, osdep)
* Write disk label back to device after modification. * Write disk label back to device after modification.
*/ */
int int
writedisklabel(dev, strat, lp, osdep) writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
dev_t dev; struct cpu_disklabel *osdep)
void (*strat) __P((struct buf *));
struct disklabel *lp;
struct cpu_disklabel *osdep;
{ {
struct mbr_partition *dp; struct mbr_partition *dp;
struct buf *bp; struct buf *bp;
@ -525,7 +513,7 @@ writedisklabel(dev, strat, lp, osdep)
if (ourdp) { if (ourdp) {
/* need sector address for SCSI/IDE, /* need sector address for SCSI/IDE,
cylinder for ESDI/ST506/RLL */ cylinder for ESDI/ST506/RLL */
dospartoff = ourdp->mbrp_start; dospartoff = ourdp->mbrp_start;
cyl = MBR_PCYL(ourdp->mbrp_scyl, ourdp->mbrp_ssect); cyl = MBR_PCYL(ourdp->mbrp_scyl, ourdp->mbrp_ssect);
} }
@ -535,7 +523,7 @@ writedisklabel(dev, strat, lp, osdep)
#ifdef maybe #ifdef maybe
/* disklabel in appropriate location? */ /* disklabel in appropriate location? */
if (lp->d_partitions[2].p_offset != 0 if (lp->d_partitions[2].p_offset != 0
&& lp->d_partitions[2].p_offset != dospartoff) { && lp->d_partitions[2].p_offset != dospartoff) {
error = EXDEV; error = EXDEV;
goto done; goto done;
} }
@ -557,11 +545,11 @@ writedisklabel(dev, strat, lp, osdep)
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) { dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
dls = *dlp; dls = *dlp;
ChangeEndianDiskLabel(&dls); change_endian_disk_label(&dls);
if (dls.d_magic == DISKMAGIC && dls.d_magic2 == DISKMAGIC && if (dls.d_magic == DISKMAGIC && dls.d_magic2 == DISKMAGIC &&
sh3_dkcksum(&dls) == 0) { sh3_dkcksum(&dls) == 0) {
dls = *lp; dls = *lp;
ChangeEndianDiskLabel(&dls); change_endian_disk_label(&dls);
*dlp = dls; *dlp = dls;
bp->b_flags &= ~(B_READ|B_DONE); bp->b_flags &= ~(B_READ|B_DONE);
bp->b_flags |= B_WRITE; bp->b_flags |= B_WRITE;
@ -572,7 +560,7 @@ writedisklabel(dev, strat, lp, osdep)
} }
error = ESRCH; error = ESRCH;
done: done:
brelse(bp); brelse(bp);
return (error); return (error);
} }
@ -583,10 +571,7 @@ done:
* if needed, and signal errors or early completion. * if needed, and signal errors or early completion.
*/ */
int int
bounds_check_with_label(bp, lp, wlabel) bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
struct buf *bp;
struct disklabel *lp;
int wlabel;
{ {
struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
int labelsector = lp->d_partitions[2].p_offset + LABELSECTOR; int labelsector = lp->d_partitions[2].p_offset + LABELSECTOR;
@ -625,8 +610,8 @@ bounds_check_with_label(bp, lp, wlabel)
(lp->d_secsize / DEV_BSIZE) / lp->d_secpercyl; (lp->d_secsize / DEV_BSIZE) / lp->d_secpercyl;
return (1); return (1);
bad: bad:
bp->b_flags |= B_ERROR; bp->b_flags |= B_ERROR;
done: done:
return (0); return (0);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: dkbad.c,v 1.1 1999/09/13 10:31:29 itojun Exp $ */ /* $NetBSD: dkbad.c,v 1.2 2002/02/12 15:26:50 uch Exp $ */
/*- /*-
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -50,15 +50,15 @@
* Return -1 if not found. * Return -1 if not found.
*/ */
isbad(bt, cyl, trk, sec) isbad(struct dkbad *bt)
register struct dkbad *bt;
{ {
register int i; int i;
register long blk, bblk; long blk, bblk;
blk = ((long)cyl << 16) + (trk << 8) + sec; blk = ((long)cyl << 16) + (trk << 8) + sec;
for (i = 0; i < 126; i++) { for (i = 0; i < 126; i++) {
bblk = ((long)bt->bt_bad[i].bt_cyl << 16) + bt->bt_bad[i].bt_trksec; bblk = ((long)bt->bt_bad[i].bt_cyl << 16) +
bt->bt_bad[i].bt_trksec;
if (blk == bblk) if (blk == bblk)
return (i); return (i);
if (blk < bblk || bblk < 0) if (blk < bblk || bblk < 0)
@ -66,4 +66,4 @@ isbad(bt, cyl, trk, sec)
} }
return (-1); return (-1);
} }
#endif #endif /* !NOBADSECT */

View File

@ -1,4 +1,4 @@
/* $NetBSD: kgdb_machdep.c,v 1.3 2001/11/20 08:43:34 lukem Exp $ */ /* $NetBSD: kgdb_machdep.c,v 1.4 2002/02/12 15:26:50 uch Exp $ */
/*- /*-
* Copyright (c) 1997 The NetBSD Foundation, Inc. * Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -91,15 +91,13 @@
#include <machine/trap.h> #include <machine/trap.h>
/* XXX Should be in <machine/pmap.h> */ /* XXX Should be in <machine/pmap.h> */
pt_entry_t *pmap_pte __P((pmap_t, vaddr_t)); pt_entry_t *pmap_pte(pmap_t, vaddr_t);
/* /*
* Determine if the memory at va..(va+len) is valid. * Determine if the memory at va..(va+len) is valid.
*/ */
int int
kgdb_acc(va, len) kgdb_acc(vaddr_t va, size_t len)
vaddr_t va;
size_t len;
{ {
vaddr_t last_va; vaddr_t last_va;
pt_entry_t pte; pt_entry_t pte;
@ -123,8 +121,7 @@ kgdb_acc(va, len)
* (gdb only understands unix signal numbers). * (gdb only understands unix signal numbers).
*/ */
int int
kgdb_signal(type) kgdb_signal(int type)
int type;
{ {
switch (type) { switch (type) {
case T_NMI: case T_NMI:
@ -169,9 +166,7 @@ kgdb_signal(type)
* understood by gdb. * understood by gdb.
*/ */
void void
kgdb_getregs(regs, gdb_regs) kgdb_getregs(db_regs_t *regs, kgdb_reg_t *gdb_regs)
db_regs_t *regs;
kgdb_reg_t *gdb_regs;
{ {
gdb_regs[ 0] = regs->tf_eax; gdb_regs[ 0] = regs->tf_eax;
@ -201,9 +196,7 @@ kgdb_getregs(regs, gdb_regs)
* Reverse the above. * Reverse the above.
*/ */
void void
kgdb_setregs(regs, gdb_regs) kgdb_setregs(db_regs_t *regs, kgdb_reg_t *gdb_regs)
db_regs_t *regs;
kgdb_reg_t *gdb_regs;
{ {
regs->tf_eax = gdb_regs[ 0]; regs->tf_eax = gdb_regs[ 0];
@ -233,8 +226,7 @@ kgdb_setregs(regs, gdb_regs)
* noting on the console why nothing else is going on. * noting on the console why nothing else is going on.
*/ */
void void
kgdb_connect(verbose) kgdb_connect(int verbose)
int verbose;
{ {
if (kgdb_dev < 0) if (kgdb_dev < 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.7 2001/09/10 21:19:23 chris Exp $ */ /* $NetBSD: mem.c,v 1.8 2002/02/12 15:26:50 uch Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -65,10 +65,7 @@ caddr_t zeropage;
/*ARGSUSED*/ /*ARGSUSED*/
int int
mmopen(dev, flag, mode, p) mmopen(dev_t dev, int flag, int mode, struct proc *p)
dev_t dev;
int flag, mode;
struct proc *p;
{ {
switch (minor(dev)) { switch (minor(dev)) {
@ -81,10 +78,7 @@ mmopen(dev, flag, mode, p)
/*ARGSUSED*/ /*ARGSUSED*/
int int
mmclose(dev, flag, mode, p) mmclose(dev_t dev, int flag, int mode, struct proc *p)
dev_t dev;
int flag, mode;
struct proc *p;
{ {
return (0); return (0);
@ -92,10 +86,7 @@ mmclose(dev, flag, mode, p)
/*ARGSUSED*/ /*ARGSUSED*/
int int
mmrw(dev, uio, flags) mmrw(dev_t dev, struct uio *uio, int flags)
dev_t dev;
struct uio *uio;
int flags;
{ {
register vaddr_t o, v; register vaddr_t o, v;
register int c; register int c;
@ -189,10 +180,7 @@ mmrw(dev, uio, flags)
} }
paddr_t paddr_t
mmmmap(dev, off, prot) mmmmap(dev_t dev, off_t off, int prot)
dev_t dev;
off_t off;
int prot;
{ {
struct proc *p = curproc; /* XXX */ struct proc *p = curproc; /* XXX */

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: process_machdep.c,v 1.2 2000/04/13 15:51:26 msaitoh Exp $ */ /* $NetBSD: process_machdep.c,v 1.3 2002/02/12 15:26:50 uch Exp $ */
/* /*
* Copyright (c) 1995, 1996, 1997 * Copyright (c) 1995, 1996, 1997
@ -77,20 +77,17 @@
#include <machine/reg.h> #include <machine/reg.h>
#include <machine/segments.h> #include <machine/segments.h>
static __inline struct trapframe *process_frame __P((struct proc *)); static __inline struct trapframe *process_frame(struct proc *);
static __inline struct trapframe * static __inline struct trapframe *
process_frame(p) process_frame(struct proc *p)
struct proc *p;
{ {
return (p->p_md.md_regs); return (p->p_md.md_regs);
} }
int int
process_read_regs(p, regs) process_read_regs(struct proc *p, struct reg *regs)
struct proc *p;
struct reg *regs;
{ {
struct trapframe *tf = process_frame(p); struct trapframe *tf = process_frame(p);
#if 0 #if 0
@ -126,9 +123,7 @@ process_read_regs(p, regs)
} }
int int
process_write_regs(p, regs) process_write_regs(struct proc *p, struct reg *regs)
struct proc *p;
struct reg *regs;
{ {
struct trapframe *tf = process_frame(p); struct trapframe *tf = process_frame(p);
@ -186,9 +181,7 @@ process_sstep(p, sstep)
} }
int int
process_set_pc(p, addr) process_set_pc(struct proc *p, caddr_t addr)
struct proc *p;
caddr_t addr;
{ {
struct trapframe *tf = process_frame(p); struct trapframe *tf = process_frame(p);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sh3_machdep.c,v 1.22 2002/02/11 18:03:06 uch Exp $ */ /* $NetBSD: sh3_machdep.c,v 1.23 2002/02/12 15:26:50 uch Exp $ */
/*- /*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -237,11 +237,7 @@ sh3_startup()
* specified pc, psl. * specified pc, psl.
*/ */
void void
sendsig(catcher, sig, mask, code) sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
sig_t catcher;
int sig;
sigset_t *mask;
u_long code;
{ {
struct proc *p = curproc; struct proc *p = curproc;
struct trapframe *tf; struct trapframe *tf;
@ -344,10 +340,7 @@ sendsig(catcher, sig, mask, code)
* a machine fault. * a machine fault.
*/ */
int int
sys___sigreturn14(p, v, retval) sys___sigreturn14(struct proc *p, void *v, register_t *retval)
struct proc *p;
void *v;
register_t *retval;
{ {
struct sys___sigreturn14_args /* { struct sys___sigreturn14_args /* {
syscallarg(struct sigcontext *) sigcntxp; syscallarg(struct sigcontext *) sigcntxp;
@ -407,10 +400,7 @@ sys___sigreturn14(p, v, retval)
* Clear registers on exec * Clear registers on exec
*/ */
void void
setregs(p, pack, stack) setregs(struct proc *p, struct exec_package *pack, u_long stack)
struct proc *p;
struct exec_package *pack;
u_long stack;
{ {
register struct pcb *pcb = &p->p_addr->u_pcb; register struct pcb *pcb = &p->p_addr->u_pcb;
register struct trapframe *tf; register struct trapframe *tf;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_machdep.c,v 1.4 2000/06/29 07:44:06 mrg Exp $ */ /* $NetBSD: sys_machdep.c,v 1.5 2002/02/12 15:26:51 uch Exp $ */
/*- /*-
* Copyright (c) 1995, 1997 * Copyright (c) 1995, 1997
@ -63,10 +63,7 @@
#include <machine/reg.h> #include <machine/reg.h>
int int
sys_sysarch(p, v, retval) sys_sysarch(struct proc *p, void *v, register_t *retval)
struct proc *p;
void *v;
register_t *retval;
{ {
#if 0 /* unused */ #if 0 /* unused */
struct sys_sysarch_args /* { struct sys_sysarch_args /* {

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.22 2001/09/16 16:40:45 wiz Exp $ */ /* $NetBSD: vm_machdep.c,v 1.23 2002/02/12 15:26:51 uch Exp $ */
/*- /*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved. * Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@ -61,7 +61,7 @@
#include <machine/cpu.h> #include <machine/cpu.h>
#include <machine/reg.h> #include <machine/reg.h>
void setredzone __P((u_short *, caddr_t)); void setredzone(u_short *, caddr_t);
/* /*
* Finish a fork operation, with process p2 nearly set up. * Finish a fork operation, with process p2 nearly set up.
@ -82,16 +82,12 @@ void setredzone __P((u_short *, caddr_t));
* accordingly. * accordingly.
*/ */
void void
cpu_fork(p1, p2, stack, stacksize, func, arg) cpu_fork(struct proc *p1, struct proc *p2, void *stack,
register struct proc *p1, *p2; size_t stacksize, void (*func)(void *), void *arg)
void *stack;
size_t stacksize;
void (*func) __P((void *));
void *arg;
{ {
register struct pcb *pcb = &p2->p_addr->u_pcb; struct pcb *pcb = &p2->p_addr->u_pcb;
register struct trapframe *tf; struct trapframe *tf;
register struct switchframe *sf; struct switchframe *sf;
#ifdef sh3_debug #ifdef sh3_debug
printf("cpu_fork:p1(%p),p2(%p)\n", p1, p2); printf("cpu_fork:p1(%p),p2(%p)\n", p1, p2);
@ -143,8 +139,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
} }
void void
cpu_swapout(p) cpu_swapout(struct proc *p)
struct proc *p;
{ {
} }
@ -157,8 +152,7 @@ cpu_swapout(p)
* jumps into switch() to wait for another process to wake up. * jumps into switch() to wait for another process to wake up.
*/ */
void void
cpu_exit(p) cpu_exit(struct proc *p)
register struct proc *p;
{ {
uvmexp.swtch++; uvmexp.swtch++;
switch_exit(p); switch_exit(p);
@ -172,11 +166,8 @@ struct md_core {
}; };
int int
cpu_coredump(p, vp, cred, chdr) cpu_coredump(struct proc *p, struct vnode *vp, struct ucred *cred,
struct proc *p; struct core *chdr)
struct vnode *vp;
struct ucred *cred;
struct core *chdr;
{ {
struct md_core md_core; struct md_core md_core;
struct coreseg cseg; struct coreseg cseg;
@ -218,9 +209,7 @@ cpu_coredump(p, vp, cred, chdr)
* Set a red zone in the kernel stack after the u. area. * Set a red zone in the kernel stack after the u. area.
*/ */
void void
setredzone(pte, vaddr) setredzone(u_short *pte, caddr_t vaddr)
u_short *pte;
caddr_t vaddr;
{ {
/* eventually do this by setting up an expand-down stack segment /* eventually do this by setting up an expand-down stack segment
for ss0: selector, allowing stack access down to top of u. for ss0: selector, allowing stack access down to top of u.
@ -238,11 +227,9 @@ setredzone(pte, vaddr)
* Both addresses are assumed to reside in the Sysmap. * Both addresses are assumed to reside in the Sysmap.
*/ */
void void
pagemove(from, to, size) pagemove(caddr_t from, caddr_t to, size_t size)
register caddr_t from, to;
size_t size;
{ {
register pt_entry_t *fpte, *tpte; pt_entry_t *fpte, *tpte;
if (size % NBPG) if (size % NBPG)
panic("pagemove"); panic("pagemove");
@ -280,9 +267,7 @@ extern struct vm_map *phys_map;
*/ */
void void
vmapbuf(bp, len) vmapbuf(struct buf *bp, vsize_t len)
struct buf *bp;
vsize_t len;
{ {
vaddr_t faddr, taddr, off; vaddr_t faddr, taddr, off;
paddr_t fpa; paddr_t fpa;
@ -323,9 +308,7 @@ vmapbuf(bp, len)
* We also invalidate the TLB entries and restore the original b_addr. * We also invalidate the TLB entries and restore the original b_addr.
*/ */
void void
vunmapbuf(bp, len) vunmapbuf(struct buf *bp, vsize_t len)
struct buf *bp;
vsize_t len;
{ {
vaddr_t addr, off; vaddr_t addr, off;