Split device_t/softc, with misc cleanup.
This commit is contained in:
parent
c43d57923a
commit
8f53f53cd9
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: apbus.c,v 1.20 2005/12/11 12:18:24 christos Exp $ */
|
||||
/* $NetBSD: apbus.c,v 1.21 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.20 2005/12/11 12:18:24 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.21 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -44,8 +44,8 @@ __KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.20 2005/12/11 12:18:24 christos Exp $");
|
|||
#include <machine/intr.h>
|
||||
#include <newsmips/apbus/apbusvar.h>
|
||||
|
||||
static int apbusmatch(struct device *, struct cfdata *, void *);
|
||||
static void apbusattach(struct device *, struct device *, void *);
|
||||
static int apbusmatch(device_t, cfdata_t, void *);
|
||||
static void apbusattach(device_t, device_t, void *);
|
||||
static int apbusprint(void *, const char *);
|
||||
#if 0
|
||||
static void *aptokseg0 (void *);
|
||||
|
@ -70,18 +70,14 @@ static void apbus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
|
|||
|
||||
#define MAXAPDEVNUM 32
|
||||
|
||||
struct apbus_softc {
|
||||
struct device apbs_dev;
|
||||
};
|
||||
|
||||
CFATTACH_DECL(ap, sizeof(struct apbus_softc),
|
||||
CFATTACH_DECL_NEW(ap, 0,
|
||||
apbusmatch, apbusattach, NULL, NULL);
|
||||
|
||||
#define NLEVEL 2
|
||||
static struct newsmips_intr apintr_tab[NLEVEL];
|
||||
|
||||
static int
|
||||
apbusmatch(struct device *parent, struct cfdata *cfdata, void *aux)
|
||||
apbusmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct confargs *ca = aux;
|
||||
|
||||
|
@ -93,7 +89,7 @@ apbusmatch(struct device *parent, struct cfdata *cfdata, void *aux)
|
|||
|
||||
|
||||
static void
|
||||
apbusattach(struct device *parent, struct device *self, void *aux)
|
||||
apbusattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct apbus_attach_args child;
|
||||
struct apbus_dev *apdev;
|
||||
|
@ -101,12 +97,12 @@ apbusattach(struct device *parent, struct device *self, void *aux)
|
|||
struct newsmips_intr *ip;
|
||||
int i;
|
||||
|
||||
*(volatile u_int *)(NEWS5000_APBUS_INTST) = 0xffffffff;
|
||||
*(volatile u_int *)(NEWS5000_APBUS_INTMSK) = 0xffffffff;
|
||||
*(volatile u_int *)(NEWS5000_APBUS_CTRL) = 0x00000004;
|
||||
*(volatile u_int *)(NEWS5000_APBUS_DMA) = 0xffffffff;
|
||||
*(volatile uint32_t *)(NEWS5000_APBUS_INTST) = 0xffffffff;
|
||||
*(volatile uint32_t *)(NEWS5000_APBUS_INTMSK) = 0xffffffff;
|
||||
*(volatile uint32_t *)(NEWS5000_APBUS_CTRL) = 0x00000004;
|
||||
*(volatile uint32_t *)(NEWS5000_APBUS_DMA) = 0xffffffff;
|
||||
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
for (i = 0; i < NLEVEL; i++) {
|
||||
ip = &apintr_tab[i];
|
||||
|
@ -156,15 +152,14 @@ apbusprint(void *aux, const char *pnp)
|
|||
|
||||
if (pnp)
|
||||
aprint_normal("%s at %s slot%d addr 0x%lx",
|
||||
a->apa_name, pnp, a->apa_slotno, a->apa_hwbase);
|
||||
a->apa_name, pnp, a->apa_slotno, a->apa_hwbase);
|
||||
|
||||
return UNCONF;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void *
|
||||
aptokseg0(va)
|
||||
void *va;
|
||||
aptokseg0(void *va)
|
||||
{
|
||||
vaddr_t addr = (vaddr_t)va;
|
||||
|
||||
|
@ -181,7 +176,7 @@ aptokseg0(va)
|
|||
void
|
||||
apbus_wbflush(void)
|
||||
{
|
||||
volatile int *wbflush = (int *)NEWS5000_WBFLUSH;
|
||||
volatile int32_t *wbflush = (uint32_t *)NEWS5000_WBFLUSH;
|
||||
|
||||
(void)*wbflush;
|
||||
}
|
||||
|
@ -221,7 +216,7 @@ apbus_intr_establish(int level, int mask, int priority, int (*func)(void *),
|
|||
|
||||
ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT);
|
||||
if (ih == NULL)
|
||||
panic("apbus_intr_establish: can't malloc handler info");
|
||||
panic("%s: can't malloc handler info", __func__);
|
||||
ih->ih_mask = mask;
|
||||
ih->ih_priority = priority;
|
||||
ih->ih_func = func;
|
||||
|
@ -276,9 +271,10 @@ apbus_dma_unmapped(bus_dma_tag_t t, bus_dmamap_t map)
|
|||
}
|
||||
|
||||
#define APBUS_NDMAMAP (NEWS5000_APBUS_MAPSIZE / NEWS5000_APBUS_MAPENT)
|
||||
#define APBUS_MAPTBL(n, v) (*(volatile u_int *)(NEWS5000_APBUS_DMAMAP + \
|
||||
#define APBUS_MAPTBL(n, v) \
|
||||
(*(volatile uint32_t *)(NEWS5000_APBUS_DMAMAP + \
|
||||
NEWS5000_APBUS_MAPENT * (n) + 1) = (v))
|
||||
static u_char apbus_dma_maptbl[APBUS_NDMAMAP];
|
||||
static uint8_t apbus_dma_maptbl[APBUS_NDMAMAP];
|
||||
|
||||
static int
|
||||
apbus_dma_mapalloc(bus_dma_tag_t t, bus_dmamap_t map, int flags)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: apbus_subr.c,v 1.7 2005/12/11 12:18:24 christos Exp $ */
|
||||
/* $NetBSD: apbus_subr.c,v 1.8 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1999 SHIMIZU Ryo. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: apbus_subr.c,v 1.7 2005/12/11 12:18:24 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: apbus_subr.c,v 1.8 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -62,7 +62,7 @@ apbus_lookupdev(char *devname)
|
|||
|
||||
/* search apbus_dev named 'devname' */
|
||||
while (dp) {
|
||||
if (strcmp(devname,dp->apbd_name) == 0)
|
||||
if (strcmp(devname, dp->apbd_name) == 0)
|
||||
return dp;
|
||||
|
||||
dp = dp->apbd_link;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dmac3.c,v 1.9 2006/08/27 08:43:05 tsutsui Exp $ */
|
||||
/* $NetBSD: dmac3.c,v 1.10 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dmac3.c,v 1.9 2006/08/27 08:43:05 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dmac3.c,v 1.10 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: dmac3.c,v 1.9 2006/08/27 08:43:05 tsutsui Exp $");
|
|||
|
||||
#include <newsmips/apbus/apbusvar.h>
|
||||
#include <newsmips/apbus/dmac3reg.h>
|
||||
#include <newsmips/apbus/dmac3var.h>
|
||||
|
||||
#include <mips/cache.h>
|
||||
|
||||
|
@ -58,25 +59,16 @@ __KERNEL_RCSID(0, "$NetBSD: dmac3.c,v 1.9 2006/08/27 08:43:05 tsutsui Exp $");
|
|||
# define BURST_MODE 0
|
||||
#endif
|
||||
|
||||
struct dmac3_softc {
|
||||
struct device sc_dev;
|
||||
struct dmac3reg *sc_reg;
|
||||
vaddr_t sc_dmaaddr;
|
||||
volatile uint32_t *sc_dmamap;
|
||||
int sc_conf;
|
||||
int sc_ctlnum;
|
||||
};
|
||||
|
||||
int dmac3_match(struct device *, struct cfdata *, void *);
|
||||
void dmac3_attach(struct device *, struct device *, void *);
|
||||
int dmac3_match(device_t, cfdata_t, void *);
|
||||
void dmac3_attach(device_t, device_t, void *);
|
||||
|
||||
extern paddr_t kvtophys(vaddr_t);
|
||||
|
||||
CFATTACH_DECL(dmac, sizeof(struct dmac3_softc),
|
||||
CFATTACH_DECL_NEW(dmac, sizeof(struct dmac3_softc),
|
||||
dmac3_match, dmac3_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
dmac3_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
dmac3_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -87,15 +79,15 @@ dmac3_match(struct device *parent, struct cfdata *cf, void *aux)
|
|||
}
|
||||
|
||||
void
|
||||
dmac3_attach(struct device *parent, struct device *self, void *aux)
|
||||
dmac3_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct dmac3_softc *sc = (void *)self;
|
||||
struct dmac3_softc *sc = device_private(self);
|
||||
struct apbus_attach_args *apa = aux;
|
||||
struct dmac3reg *reg;
|
||||
|
||||
static paddr_t dmamap = DMAC3_PAGEMAP;
|
||||
static vaddr_t dmaaddr = 0;
|
||||
|
||||
sc->sc_dev = self;
|
||||
reg = (void *)apa->apa_hwbase;
|
||||
sc->sc_reg = reg;
|
||||
sc->sc_ctlnum = apa->apa_ctlnum;
|
||||
|
@ -108,21 +100,22 @@ dmac3_attach(struct device *parent, struct device *self, void *aux)
|
|||
|
||||
dmac3_reset(sc);
|
||||
|
||||
printf(" slot%d addr 0x%lx", apa->apa_slotno, apa->apa_hwbase);
|
||||
printf(": ctlnum = %d, map = %p, va = %lx",
|
||||
aprint_normal(" slot%d addr 0x%lx", apa->apa_slotno, apa->apa_hwbase);
|
||||
aprint_normal(": ctlnum = %d, map = %p, va = %lx",
|
||||
apa->apa_ctlnum, sc->sc_dmamap, sc->sc_dmaaddr);
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
}
|
||||
|
||||
void *
|
||||
struct dmac3_softc *
|
||||
dmac3_link(int ctlnum)
|
||||
{
|
||||
struct dmac3_softc *sc;
|
||||
struct device *dv;
|
||||
|
||||
for (dv = alldevs.tqh_first; dv; dv = dv->dv_list.tqe_next) {
|
||||
if (strncmp(dv->dv_xname, "dmac", 4) == 0) {
|
||||
sc = (void *)dv;
|
||||
for (dv = TAILQ_FIRST(&alldevs); dv != NULL;
|
||||
dv = TAILQ_NEXT(dv, dv_list)) {
|
||||
if (strncmp(device_xname(dv), "dmac", 4) == 0) {
|
||||
sc = device_private(dv);
|
||||
if (sc->sc_ctlnum == ctlnum)
|
||||
return sc;
|
||||
}
|
||||
|
@ -190,12 +183,12 @@ dmac3_intr(void *v)
|
|||
reg->intr = intr;
|
||||
|
||||
if (intr & DMAC3_INTR_PERR) {
|
||||
printf("%s: intr = 0x%x\n", sc->sc_dev.dv_xname, intr);
|
||||
printf("%s: intr = 0x%x\n", device_xname(sc->sc_dev), intr);
|
||||
rv = -1;
|
||||
}
|
||||
|
||||
if (conf & (DMAC3_CONF_IPER | DMAC3_CONF_MPER | DMAC3_CONF_DERR)) {
|
||||
printf("%s: conf = 0x%x\n", sc->sc_dev.dv_xname, conf);
|
||||
printf("%s: conf = 0x%x\n", device_xname(sc->sc_dev), conf);
|
||||
if (conf & DMAC3_CONF_DERR) {
|
||||
printf("DMA address = 0x%x\n", reg->addr);
|
||||
printf("resetting DMA...\n");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dmac3reg.h,v 1.1 2000/10/30 10:07:35 tsubai Exp $ */
|
||||
/* $NetBSD: dmac3reg.h,v 1.2 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,11 +27,11 @@
|
|||
*/
|
||||
|
||||
struct dmac3reg {
|
||||
volatile u_int csr;
|
||||
volatile u_int intr;
|
||||
volatile u_int len;
|
||||
volatile u_int addr;
|
||||
volatile u_int conf;
|
||||
volatile uint32_t csr;
|
||||
volatile uint32_t intr;
|
||||
volatile uint32_t len;
|
||||
volatile uint32_t addr;
|
||||
volatile uint32_t conf;
|
||||
};
|
||||
|
||||
#define DMAC3_CSR_DBURST 0x0020
|
||||
|
@ -69,15 +69,15 @@ struct dmac3reg {
|
|||
#define DMAC3_MAPSIZE 0x20000
|
||||
|
||||
struct dma_pte {
|
||||
u_int pad1;
|
||||
u_int valid:1,
|
||||
uint32_t pad1;
|
||||
uint32_t valid:1,
|
||||
coherent:1, /* ? */
|
||||
pad2:10, /* ? */
|
||||
pfnum:20;
|
||||
};
|
||||
|
||||
struct dmac3_softc;
|
||||
void *dmac3_link(int);
|
||||
struct dmac3_softc *dmac3_link(int);
|
||||
void dmac3_reset(struct dmac3_softc *);
|
||||
void dmac3_start(struct dmac3_softc *, vaddr_t, int, int);
|
||||
int dmac3_intr(void *);
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/* $NetBSD: dmac3var.h,v 1.1 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
struct dmac3_softc {
|
||||
device_t sc_dev;
|
||||
struct dmac3reg *sc_reg;
|
||||
vaddr_t sc_dmaaddr;
|
||||
volatile uint32_t *sc_dmamap;
|
||||
int sc_conf;
|
||||
int sc_ctlnum;
|
||||
};
|
||||
|
||||
struct dmac3_softc *dmac3_link(int);
|
||||
void dmac3_reset(struct dmac3_softc *);
|
||||
void dmac3_start(struct dmac3_softc *, vaddr_t, int, int);
|
||||
int dmac3_intr(void *);
|
||||
void dmac3_misc(struct dmac3_softc *, int);
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_sn.c,v 1.29 2008/01/01 01:04:20 he Exp $ */
|
||||
/* $NetBSD: if_sn.c,v 1.30 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* National Semiconductor DP8393X SONIC Driver
|
||||
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.29 2008/01/01 01:04:20 he Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.30 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
|
@ -110,13 +110,13 @@ int
|
|||
snsetup(struct sn_softc *sc, uint8_t *lladdr)
|
||||
{
|
||||
struct ifnet *ifp = &sc->sc_if;
|
||||
u_char *p;
|
||||
u_char *pp;
|
||||
uint8_t *p;
|
||||
uint8_t *pp;
|
||||
int i;
|
||||
|
||||
if (sc->space == NULL) {
|
||||
printf ("%s: memory allocation for descriptors failed\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error_dev(sc->sc_dev,
|
||||
"memory allocation for descriptors failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ snsetup(struct sn_softc *sc, uint8_t *lladdr)
|
|||
* around problems near the end of 64k !!
|
||||
*/
|
||||
p = sc->space;
|
||||
pp = (u_char *)roundup((int)p, PAGE_SIZE);
|
||||
pp = (uint8_t *)roundup((int)p, PAGE_SIZE);
|
||||
p = pp;
|
||||
|
||||
for (i = 0; i < NRRA; i++) {
|
||||
|
@ -149,13 +149,13 @@ snsetup(struct sn_softc *sc, uint8_t *lladdr)
|
|||
}
|
||||
sc->v_rea = SONIC_GETDMA(p);
|
||||
|
||||
p = (u_char *)SOALIGN(sc, p);
|
||||
p = (uint8_t *)SOALIGN(sc, p);
|
||||
|
||||
sc->p_cda = (void *)(p);
|
||||
sc->v_cda = SONIC_GETDMA(p);
|
||||
p += CDA_SIZE(sc);
|
||||
|
||||
p = (u_char *)SOALIGN(sc, p);
|
||||
p = (uint8_t *)SOALIGN(sc, p);
|
||||
|
||||
for (i = 0; i < NTDA; i++) {
|
||||
struct mtd *mtdp = &sc->mtda[i];
|
||||
|
@ -164,12 +164,11 @@ snsetup(struct sn_softc *sc, uint8_t *lladdr)
|
|||
p += TXP_SIZE(sc);
|
||||
}
|
||||
|
||||
p = (u_char *)SOALIGN(sc, p);
|
||||
p = (uint8_t *)SOALIGN(sc, p);
|
||||
|
||||
if ((p - pp) > PAGE_SIZE) {
|
||||
printf ("%s: sizeof RRA (%ld) + CDA (%ld) +"
|
||||
aprint_error_dev(sc->sc_dev, "sizeof RRA (%ld) + CDA (%ld) +"
|
||||
"TDA (%ld) > PAGE_SIZE (%d). Punt!\n",
|
||||
sc->sc_dev.dv_xname,
|
||||
(ulong)sc->p_cda - (ulong)sc->p_rra[0],
|
||||
(ulong)sc->mtda[0].mtd_txp - (ulong)sc->p_cda,
|
||||
(ulong)p - (ulong)sc->mtda[0].mtd_txp,
|
||||
|
@ -203,16 +202,16 @@ snsetup(struct sn_softc *sc, uint8_t *lladdr)
|
|||
#ifdef SNDEBUG
|
||||
camdump(sc);
|
||||
#endif
|
||||
printf("%s: Ethernet address %s\n",
|
||||
sc->sc_dev.dv_xname, ether_sprintf(lladdr));
|
||||
aprint_normal_dev(sc->sc_dev, "Ethernet address %s\n",
|
||||
ether_sprintf(lladdr));
|
||||
|
||||
#ifdef SNDEBUG
|
||||
printf("%s: buffers: rra=%p cda=%p rda=%p tda=%p\n",
|
||||
aprint_debug_dev(sc->sc_dev, "buffers: rra=%p cda=%p rda=%p tda=%p\n",
|
||||
sc->sc_dev.dv_xname, sc->p_rra[0], sc->p_cda,
|
||||
sc->p_rda, sc->mtda[0].mtd_txp);
|
||||
#endif
|
||||
|
||||
strcpy(ifp->if_xname, sc->sc_dev.dv_xname);
|
||||
strcpy(ifp->if_xname, device_xname(sc->sc_dev));
|
||||
ifp->if_softc = sc;
|
||||
ifp->if_ioctl = snioctl;
|
||||
ifp->if_start = snstart;
|
||||
|
@ -330,7 +329,7 @@ outloop:
|
|||
|
||||
/* We need the header for m_pkthdr.len. */
|
||||
if ((m->m_flags & M_PKTHDR) == 0)
|
||||
panic("%s: snstart: no header mbuf", sc->sc_dev.dv_xname);
|
||||
panic("%s: snstart: no header mbuf", device_xname(sc->sc_dev));
|
||||
|
||||
#if NBPFILTER > 0
|
||||
/*
|
||||
|
@ -494,10 +493,10 @@ snwatchdog(struct ifnet *ifp)
|
|||
mtd = &sc->mtda[sc->mtd_hw];
|
||||
if (SRO(sc->bitmode, mtd->mtd_txp, TXP_STATUS) == 0)
|
||||
log(LOG_ERR, "%s: Tx - timeout\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
else
|
||||
log(LOG_ERR, "%s: Tx - lost interrupt\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
temp = ifp->if_flags & IFF_UP;
|
||||
snreset(sc);
|
||||
ifp->if_flags |= temp;
|
||||
|
@ -548,7 +547,8 @@ sonicput(struct sn_softc *sc, struct mbuf *m0, int mtd_next)
|
|||
buff += len;
|
||||
}
|
||||
if (totlen >= TXBSIZE) {
|
||||
panic("%s: sonicput: packet overflow", sc->sc_dev.dv_xname);
|
||||
panic("%s: sonicput: packet overflow",
|
||||
device_xname(sc->sc_dev));
|
||||
}
|
||||
|
||||
SWO(sc->bitmode, txp, TXP_FRAGOFF + (0 * TXP_FRAGSIZE) + TXP_FPTRLO,
|
||||
|
@ -684,7 +684,8 @@ camprogram(struct sn_softc *sc)
|
|||
delay(10);
|
||||
if (timeout == 0) {
|
||||
/* XXX */
|
||||
panic("%s: CAM initialisation failed", sc->sc_dev.dv_xname);
|
||||
panic("%s: CAM initialisation failed",
|
||||
device_xname(sc->sc_dev));
|
||||
}
|
||||
timeout = 10000;
|
||||
while (((NIC_GET(sc, SNR_ISR) & ISR_LCD) == 0) && timeout--)
|
||||
|
@ -694,7 +695,7 @@ camprogram(struct sn_softc *sc)
|
|||
NIC_PUT(sc, SNR_ISR, ISR_LCD);
|
||||
else
|
||||
printf("%s: CAM initialisation without interrupt\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
}
|
||||
|
||||
#ifdef SNDEBUG
|
||||
|
@ -819,7 +820,7 @@ snintr(void *arg)
|
|||
|
||||
if (isr & (ISR_BR | ISR_LCD | ISR_TC))
|
||||
printf("%s: unexpected interrupt status 0x%x\n",
|
||||
sc->sc_dev.dv_xname, isr);
|
||||
device_xname(sc->sc_dev), isr);
|
||||
|
||||
if (isr & (ISR_TXDN | ISR_TXER | ISR_PINT))
|
||||
sonictxint(sc);
|
||||
|
@ -840,16 +841,16 @@ snintr(void *arg)
|
|||
;
|
||||
if (isr & ISR_RDE)
|
||||
printf("%s: receive descriptors exhausted\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
if (isr & ISR_RBE)
|
||||
printf("%s: receive buffers exhausted\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
if (isr & ISR_RBAE)
|
||||
printf("%s: receive buffer area exhausted\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
if (isr & ISR_RFO)
|
||||
printf("%s: receive FIFO overrun\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
}
|
||||
if (isr & (ISR_CRC | ISR_FAE | ISR_MP)) {
|
||||
#ifdef notdef
|
||||
|
@ -898,7 +899,7 @@ sonictxint(struct sn_softc *sc)
|
|||
|
||||
eh = (struct ether_header *) mtd->mtd_buf;
|
||||
printf("%s: xmit status=0x%x len=%d type=0x%x from %s",
|
||||
sc->sc_dev.dv_xname,
|
||||
device_xname(sc->sc_dev),
|
||||
SRO(sc->bitmode, txp, TXP_STATUS),
|
||||
SRO(sc->bitmode, txp, TXP_PKTSIZE),
|
||||
htons(eh->ether_type),
|
||||
|
@ -923,7 +924,7 @@ sonictxint(struct sn_softc *sc)
|
|||
if ((txp_status & TCR_PTX) == 0) {
|
||||
ifp->if_oerrors++;
|
||||
printf("%s: Tx packet status=0x%x\n",
|
||||
sc->sc_dev.dv_xname, txp_status);
|
||||
device_xname(sc->sc_dev), txp_status);
|
||||
|
||||
/* XXX - DG This looks bogus */
|
||||
if (mtd_hw != sc->mtd_free) {
|
||||
|
@ -1044,7 +1045,7 @@ sonic_read(struct sn_softc *sc, void *pkt, int len)
|
|||
#ifdef SNDEBUG
|
||||
{
|
||||
printf("%s: rcvd %p len=%d type=0x%x from %s",
|
||||
sc->sc_dev.dv_xname, et, len, htons(et->ether_type),
|
||||
devoce_xname(sc->sc_dev), et, len, htons(et->ether_type),
|
||||
ether_sprintf(et->ether_shost));
|
||||
printf(" (to %s)\n", ether_sprintf(et->ether_dhost));
|
||||
}
|
||||
|
@ -1053,7 +1054,7 @@ sonic_read(struct sn_softc *sc, void *pkt, int len)
|
|||
if (len < (ETHER_MIN_LEN - ETHER_CRC_LEN) ||
|
||||
len > (ETHER_MAX_LEN - ETHER_CRC_LEN)) {
|
||||
printf("%s: invalid packet length %d bytes\n",
|
||||
sc->sc_dev.dv_xname, len);
|
||||
device_xname(sc->sc_dev), len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_sn_ap.c,v 1.10 2007/03/08 22:08:50 he Exp $ */
|
||||
/* $NetBSD: if_sn_ap.c,v 1.11 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Allen Briggs
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sn_ap.c,v 1.10 2007/03/08 22:08:50 he Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sn_ap.c,v 1.11 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
|
@ -59,15 +59,15 @@ __KERNEL_RCSID(0, "$NetBSD: if_sn_ap.c,v 1.10 2007/03/08 22:08:50 he Exp $");
|
|||
#define SONIC_APBUS_MEM_OFFSET 0x00020000
|
||||
#define SONIC_APBUS_CTL_OFFSET (-0x00100000)
|
||||
|
||||
static int sn_ap_match(struct device *, struct cfdata *, void *);
|
||||
static void sn_ap_attach(struct device *, struct device *, void *);
|
||||
static int sn_ap_match(device_t, cfdata_t, void *);
|
||||
static void sn_ap_attach(device_t, device_t, void *);
|
||||
static int sn_ap_getaddr(struct sn_softc *, uint8_t *);
|
||||
|
||||
CFATTACH_DECL(sn_ap, sizeof(struct sn_softc),
|
||||
CFATTACH_DECL_NEW(sn_ap, sizeof(struct sn_softc),
|
||||
sn_ap_match, sn_ap_attach, NULL, NULL);
|
||||
|
||||
static int
|
||||
sn_ap_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
sn_ap_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -81,18 +81,19 @@ sn_ap_match(struct device *parent, struct cfdata *cf, void *aux)
|
|||
* Install interface into kernel networking data structures
|
||||
*/
|
||||
static void
|
||||
sn_ap_attach(struct device *parent, struct device *self, void *aux)
|
||||
sn_ap_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct sn_softc *sc = (void *)self;
|
||||
struct sn_softc *sc = device_private(self);
|
||||
struct apbus_attach_args *apa = aux;
|
||||
uint8_t myaddr[ETHER_ADDR_LEN];
|
||||
u_int intrmask;
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_hwbase = (void *)apa->apa_hwbase;
|
||||
sc->sc_regbase = (void *)(apa->apa_hwbase + SONIC_APBUS_REG_OFFSET);
|
||||
sc->space = (void *)(apa->apa_hwbase + SONIC_APBUS_MEM_OFFSET);
|
||||
|
||||
printf(" slot%d addr 0x%lx", apa->apa_slotno, apa->apa_hwbase);
|
||||
aprint_normal(" slot%d addr 0x%lx", apa->apa_slotno, apa->apa_hwbase);
|
||||
|
||||
sc->snr_dcr = DCR_WAIT0 | DCR_DMABLOCK | DCR_RFT16 | DCR_TFT16;
|
||||
sc->snr_dcr2 = 0;
|
||||
|
@ -100,18 +101,18 @@ sn_ap_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc->bitmode = 1;
|
||||
|
||||
if (sn_ap_getaddr(sc, myaddr)) {
|
||||
printf(": failed to get MAC address\n");
|
||||
aprint_error(": failed to get MAC address\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
/* snsetup returns 1 if something fails */
|
||||
if (snsetup(sc, myaddr))
|
||||
return;
|
||||
|
||||
intrmask = (apa->apa_slotno == 0) ?
|
||||
NEWS5000_INT0_SONIC : SLOTTOMASK(apa->apa_slotno);
|
||||
NEWS5000_INT0_SONIC : SLOTTOMASK(apa->apa_slotno);
|
||||
|
||||
apbus_intr_establish(0, /* interrupt level (0 or 1) */
|
||||
intrmask,
|
||||
|
@ -122,10 +123,11 @@ sn_ap_attach(struct device *parent, struct device *self, void *aux)
|
|||
int
|
||||
sn_ap_getaddr(struct sn_softc *sc, uint8_t *lladdr)
|
||||
{
|
||||
u_int *p = (u_int *)((char *)sc->sc_hwbase + SONIC_MACROM_OFFSET);
|
||||
uint32_t *p;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
p = (uint32_t *)((uint8_t *)sc->sc_hwbase + SONIC_MACROM_OFFSET);
|
||||
for (i = 0; i < ETHER_ADDR_LEN; i++) {
|
||||
int h = *p++ & 0x0f;
|
||||
int l = *p++ & 0x0f;
|
||||
*lladdr++ = (h << 4) + l;
|
||||
|
@ -140,7 +142,7 @@ sn_ap_getaddr(struct sn_softc *sc, uint8_t *lladdr)
|
|||
void
|
||||
sn_md_init(struct sn_softc *sc)
|
||||
{
|
||||
u_int *reg = (u_int *)APSONIC_INT_REG(sc->sc_hwbase);
|
||||
volatile uint32_t *reg = (uint32_t *)APSONIC_INT_REG(sc->sc_hwbase);
|
||||
|
||||
*reg = APSONIC_INT_MASK;
|
||||
wbflush();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_snvar.h,v 1.11 2007/10/17 19:55:54 garbled Exp $ */
|
||||
/* $NetBSD: if_snvar.h,v 1.12 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk)
|
||||
|
@ -65,14 +65,14 @@ wbflush(void)
|
|||
* maximum receive packet size plus 2 byte pad to make each
|
||||
* one aligned. 4 byte slop (required for eobc)
|
||||
*/
|
||||
#define RBASIZE(sc) (sizeof(struct ether_header) + ETHERMTU + FCSSIZE + 6)
|
||||
#define RBASIZE(sc) (ETHER_HDR_LEN + ETHERMTU + FCSSIZE + 6)
|
||||
|
||||
/*
|
||||
* transmit buffer area
|
||||
*/
|
||||
#define TXBSIZE 1536 /* 6*2^8 -- the same size as the 8390 TXBUF */
|
||||
|
||||
#define SN_NPAGES 2 + NRBA + (NTDA/2)
|
||||
#define SN_NPAGES 2 + NRBA + (NTDA / 2)
|
||||
|
||||
typedef struct mtd {
|
||||
void *mtd_txp;
|
||||
|
@ -86,7 +86,7 @@ typedef struct mtd {
|
|||
* The sn_softc for NEWS5000 if_sn.
|
||||
*/
|
||||
struct sn_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
struct ethercom sc_ethercom;
|
||||
#define sc_if sc_ethercom.ec_if /* network visible interface */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kb_ap.c,v 1.8 2007/03/04 06:00:26 christos Exp $ */
|
||||
/* $NetBSD: kb_ap.c,v 1.9 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kb_ap.c,v 1.8 2007/03/04 06:00:26 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kb_ap.c,v 1.9 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -41,36 +41,36 @@ __KERNEL_RCSID(0, "$NetBSD: kb_ap.c,v 1.8 2007/03/04 06:00:26 christos Exp $");
|
|||
#include <newsmips/apbus/apbusvar.h>
|
||||
|
||||
struct kbreg {
|
||||
u_int kb_rx_data;
|
||||
u_int kb_rx_stat;
|
||||
u_int kb_rx_intr_en;
|
||||
u_int kb_rx_reset;
|
||||
u_int kb_rx_speed;
|
||||
volatile uint32_t kb_rx_data;
|
||||
volatile uint32_t kb_rx_stat;
|
||||
volatile uint32_t kb_rx_intr_en;
|
||||
volatile uint32_t kb_rx_reset;
|
||||
volatile uint32_t kb_rx_speed;
|
||||
|
||||
u_int ms_rx_data;
|
||||
u_int ms_rx_stat;
|
||||
u_int ms_rx_intr_en;
|
||||
u_int ms_rx_reset;
|
||||
u_int ms_rx_speed;
|
||||
volatile uint32_t ms_rx_data;
|
||||
volatile uint32_t ms_rx_stat;
|
||||
volatile uint32_t ms_rx_intr_en;
|
||||
volatile uint32_t ms_rx_reset;
|
||||
volatile uint32_t ms_rx_speed;
|
||||
|
||||
u_int kb_buzzf;
|
||||
u_int kb_buzz;
|
||||
volatile uint32_t kb_buzzf;
|
||||
volatile uint32_t kb_buzz;
|
||||
|
||||
u_int kb_tx_data;
|
||||
u_int kb_tx_stat;
|
||||
u_int kb_tx_intr_en;
|
||||
u_int kb_tx_reset;
|
||||
u_int kb_tx_speed;
|
||||
volatile uint32_t kb_tx_data;
|
||||
volatile uint32_t kb_tx_stat;
|
||||
volatile uint32_t kb_tx_intr_en;
|
||||
volatile uint32_t kb_tx_reset;
|
||||
volatile uint32_t kb_tx_speed;
|
||||
};
|
||||
|
||||
struct kb_ap_softc {
|
||||
struct device sc_dev;
|
||||
volatile struct kbreg *sc_reg;
|
||||
device_t sc_dev;
|
||||
struct kbreg *sc_reg;
|
||||
struct device *sc_wskbddev;
|
||||
};
|
||||
|
||||
int kb_ap_match(struct device *, struct cfdata *, void *);
|
||||
void kb_ap_attach(struct device *, struct device *, void *);
|
||||
int kb_ap_match(device_t, cfdata_t, void *);
|
||||
void kb_ap_attach(device_t, device_t, void *);
|
||||
int kb_ap_intr(void *);
|
||||
|
||||
void kb_ap_cnattach(void);
|
||||
|
@ -83,7 +83,7 @@ int kb_ap_ioctl(void *, u_long, void *, int, struct lwp *);
|
|||
|
||||
extern struct wscons_keydesc newskb_keydesctab[];
|
||||
|
||||
CFATTACH_DECL(kb_ap, sizeof(struct kb_ap_softc),
|
||||
CFATTACH_DECL_NEW(kb_ap, sizeof(struct kb_ap_softc),
|
||||
kb_ap_match, kb_ap_attach, NULL, NULL);
|
||||
|
||||
struct wskbd_accessops kb_ap_accessops = {
|
||||
|
@ -103,7 +103,7 @@ struct wskbd_mapdata kb_ap_keymapdata = {
|
|||
};
|
||||
|
||||
int
|
||||
kb_ap_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
kb_ap_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -114,24 +114,25 @@ kb_ap_match(struct device *parent, struct cfdata *cf, void *aux)
|
|||
}
|
||||
|
||||
void
|
||||
kb_ap_attach(struct device *parent, struct device *self, void *aux)
|
||||
kb_ap_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct kb_ap_softc *sc = (void *)self;
|
||||
struct kb_ap_softc *sc = device_private(self);
|
||||
struct apbus_attach_args *apa = aux;
|
||||
volatile struct kbreg *reg = (void *)apa->apa_hwbase;
|
||||
volatile int *dipsw = (void *)NEWS5000_DIP_SWITCH;
|
||||
struct kbreg *reg = (void *)apa->apa_hwbase;
|
||||
volatile uint32_t *dipsw = (void *)NEWS5000_DIP_SWITCH;
|
||||
struct wskbddev_attach_args waa;
|
||||
int cons = 0;
|
||||
|
||||
printf(" slot%d addr 0x%lx", apa->apa_slotno, apa->apa_hwbase);
|
||||
sc->sc_dev = self;
|
||||
aprint_normal(" slot%d addr 0x%lx", apa->apa_slotno, apa->apa_hwbase);
|
||||
|
||||
sc->sc_reg = reg;
|
||||
|
||||
if (*dipsw & 7) {
|
||||
printf(" (console)");
|
||||
aprint_normal(" (console)");
|
||||
cons = 1;
|
||||
}
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
reg->kb_rx_reset = 0x03;
|
||||
reg->kb_tx_reset = 0x03;
|
||||
|
@ -157,7 +158,7 @@ int
|
|||
kb_ap_intr(void *v)
|
||||
{
|
||||
struct kb_ap_softc *sc = v;
|
||||
volatile struct kbreg *reg = sc->sc_reg;
|
||||
struct kbreg *reg = sc->sc_reg;
|
||||
int key, val, type, release;
|
||||
int rv = 0;
|
||||
|
||||
|
@ -186,7 +187,7 @@ kb_ap_cnattach(void)
|
|||
void
|
||||
kb_ap_cngetc(void *v, u_int *type, int *data)
|
||||
{
|
||||
volatile struct kbreg *reg = v;
|
||||
struct kbreg *reg = v;
|
||||
int key, release, ointr;
|
||||
|
||||
/* Disable keyboard interrupt. */
|
||||
|
@ -194,7 +195,8 @@ kb_ap_cngetc(void *v, u_int *type, int *data)
|
|||
reg->kb_rx_intr_en = 0;
|
||||
|
||||
/* Wait for key data. */
|
||||
while ((reg->kb_rx_stat & RX_KBRDY) == 0);
|
||||
while ((reg->kb_rx_stat & RX_KBRDY) == 0)
|
||||
;
|
||||
|
||||
key = reg->kb_rx_data;
|
||||
release = key & 0x80;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ms_ap.c,v 1.9 2007/03/04 06:00:26 christos Exp $ */
|
||||
/* $NetBSD: ms_ap.c,v 1.10 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ms_ap.c,v 1.9 2007/03/04 06:00:26 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ms_ap.c,v 1.10 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -40,30 +40,30 @@ __KERNEL_RCSID(0, "$NetBSD: ms_ap.c,v 1.9 2007/03/04 06:00:26 christos Exp $");
|
|||
#include <newsmips/apbus/apbusvar.h>
|
||||
|
||||
struct msreg {
|
||||
u_int ms_data;
|
||||
u_int ms_stat;
|
||||
u_int ms_intr_en;
|
||||
u_int ms_reset;
|
||||
u_int ms_speed;
|
||||
volatile uint32_t ms_data;
|
||||
volatile uint32_t ms_stat;
|
||||
volatile uint32_t ms_intr_en;
|
||||
volatile uint32_t ms_reset;
|
||||
volatile uint32_t ms_speed;
|
||||
};
|
||||
|
||||
struct ms_ap_softc {
|
||||
struct device sc_dev;
|
||||
volatile struct msreg *sc_reg;
|
||||
device_t sc_dev;
|
||||
struct msreg *sc_reg;
|
||||
struct device *sc_wsmousedev;
|
||||
int sc_ndata;
|
||||
u_char sc_buf[3];
|
||||
uint8_t sc_buf[3];
|
||||
};
|
||||
|
||||
int ms_ap_match(struct device *, struct cfdata *, void *);
|
||||
void ms_ap_attach(struct device *, struct device *, void *);
|
||||
int ms_ap_match(device_t, cfdata_t, void *);
|
||||
void ms_ap_attach(device_t, device_t, void *);
|
||||
int ms_ap_intr(void *);
|
||||
|
||||
int ms_ap_enable(void *);
|
||||
int ms_ap_ioctl(void *, u_long, void *, int, struct lwp *);
|
||||
void ms_ap_disable(void *);
|
||||
|
||||
CFATTACH_DECL(ms_ap, sizeof(struct ms_ap_softc),
|
||||
CFATTACH_DECL_NEW(ms_ap, sizeof(struct ms_ap_softc),
|
||||
ms_ap_match, ms_ap_attach, NULL, NULL);
|
||||
|
||||
struct wsmouse_accessops ms_ap_accessops = {
|
||||
|
@ -73,7 +73,7 @@ struct wsmouse_accessops ms_ap_accessops = {
|
|||
};
|
||||
|
||||
int
|
||||
ms_ap_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
ms_ap_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -84,14 +84,15 @@ ms_ap_match(struct device *parent, struct cfdata *cf, void *aux)
|
|||
}
|
||||
|
||||
void
|
||||
ms_ap_attach(struct device *parent, struct device *self, void *aux)
|
||||
ms_ap_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct ms_ap_softc *sc = (void *)self;
|
||||
struct ms_ap_softc *sc = device_private(self);
|
||||
struct apbus_attach_args *apa = aux;
|
||||
volatile struct msreg *reg = (void *)apa->apa_hwbase;
|
||||
struct msreg *reg = (void *)apa->apa_hwbase;
|
||||
struct wsmousedev_attach_args aa;
|
||||
|
||||
printf(" slot%d addr 0x%lx\n", apa->apa_slotno, apa->apa_hwbase);
|
||||
sc->sc_dev = self;
|
||||
aprint_normal(" slot%d addr 0x%lx\n", apa->apa_slotno, apa->apa_hwbase);
|
||||
|
||||
sc->sc_reg = reg;
|
||||
|
||||
|
@ -111,7 +112,7 @@ int
|
|||
ms_ap_intr(void *v)
|
||||
{
|
||||
struct ms_ap_softc *sc = v;
|
||||
volatile struct msreg *reg = sc->sc_reg;
|
||||
struct msreg *reg = sc->sc_reg;
|
||||
int code, index, byte0, byte1, byte2;
|
||||
int button, dx, dy;
|
||||
int rv = 0;
|
||||
|
@ -178,7 +179,7 @@ int
|
|||
ms_ap_enable(void *v)
|
||||
{
|
||||
struct ms_ap_softc *sc = v;
|
||||
volatile struct msreg *reg = sc->sc_reg;
|
||||
struct msreg *reg = sc->sc_reg;
|
||||
|
||||
reg->ms_intr_en = 1;
|
||||
return 0;
|
||||
|
@ -188,7 +189,7 @@ void
|
|||
ms_ap_disable(void *v)
|
||||
{
|
||||
struct ms_ap_softc *sc = v;
|
||||
volatile struct msreg *reg = sc->sc_reg;
|
||||
struct msreg *reg = sc->sc_reg;
|
||||
|
||||
reg->ms_intr_en = 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: spifi.c,v 1.15 2007/02/28 04:21:54 thorpej Exp $ */
|
||||
/* $NetBSD: spifi.c,v 1.16 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: spifi.c,v 1.15 2007/02/28 04:21:54 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: spifi.c,v 1.16 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
|
@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: spifi.c,v 1.15 2007/02/28 04:21:54 thorpej Exp $");
|
|||
#include <newsmips/apbus/apbusvar.h>
|
||||
#include <newsmips/apbus/spifireg.h>
|
||||
#include <newsmips/apbus/dmac3reg.h>
|
||||
#include <newsmips/apbus/dmac3var.h>
|
||||
|
||||
#include <machine/adrsmap.h>
|
||||
|
||||
|
@ -66,17 +67,17 @@ struct spifi_scb {
|
|||
int cmdlen;
|
||||
int resid;
|
||||
vaddr_t daddr;
|
||||
u_char target;
|
||||
u_char lun;
|
||||
u_char lun_targ;
|
||||
u_char status;
|
||||
uint8_t target;
|
||||
uint8_t lun;
|
||||
uint8_t lun_targ;
|
||||
uint8_t status;
|
||||
};
|
||||
/* scb flags */
|
||||
#define SPIFI_READ 0x80
|
||||
#define SPIFI_DMA 0x01
|
||||
|
||||
struct spifi_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
struct scsipi_channel sc_channel;
|
||||
struct scsipi_adapter sc_adapter;
|
||||
|
||||
|
@ -85,7 +86,7 @@ struct spifi_softc {
|
|||
void *sc_dma; /* attached DMA softc */
|
||||
int sc_id; /* my SCSI ID */
|
||||
int sc_msgout;
|
||||
u_char sc_omsg[16];
|
||||
uint8_t sc_omsg[16];
|
||||
struct spifi_scb sc_scb[16];
|
||||
TAILQ_HEAD(, spifi_scb) free_scb;
|
||||
TAILQ_HEAD(, spifi_scb) ready_scb;
|
||||
|
@ -104,8 +105,8 @@ struct spifi_softc {
|
|||
#define SPIFI_MSGOUT (PRS_MSG | PRS_CD)
|
||||
#define SPIFI_MSGIN (PRS_MSG | PRS_CD | PRS_IO)
|
||||
|
||||
int spifi_match(struct device *, struct cfdata *, void *);
|
||||
void spifi_attach(struct device *, struct device *, void *);
|
||||
int spifi_match(device_t, cfdata_t, void *);
|
||||
void spifi_attach(device_t, device_t, void *);
|
||||
|
||||
void spifi_scsipi_request(struct scsipi_channel *, scsipi_adapter_req_t,
|
||||
void *);
|
||||
|
@ -134,11 +135,11 @@ static void spifi_write_count(struct spifi_reg *, int);
|
|||
#define DMAC3_FASTACCESS(sc) dmac3_misc((sc)->sc_dma, DMAC3_CONF_FASTACCESS)
|
||||
#define DMAC3_SLOWACCESS(sc) dmac3_misc((sc)->sc_dma, DMAC3_CONF_SLOWACCESS)
|
||||
|
||||
CFATTACH_DECL(spifi, sizeof(struct spifi_softc),
|
||||
CFATTACH_DECL_NEW(spifi, sizeof(struct spifi_softc),
|
||||
spifi_match, spifi_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
spifi_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
spifi_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -149,17 +150,19 @@ spifi_match(struct device *parent, struct cfdata *cf, void *aux)
|
|||
}
|
||||
|
||||
void
|
||||
spifi_attach(struct device *parent, struct device *self, void *aux)
|
||||
spifi_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct spifi_softc *sc = (void *)self;
|
||||
struct spifi_softc *sc = device_private(self);
|
||||
struct apbus_attach_args *apa = aux;
|
||||
struct device *dma;
|
||||
struct dmac3_softc *dma;
|
||||
int intr, i;
|
||||
|
||||
sc->sc_dev = self;
|
||||
|
||||
/* Initialize scbs. */
|
||||
TAILQ_INIT(&sc->free_scb);
|
||||
TAILQ_INIT(&sc->ready_scb);
|
||||
for (i = 0; i < sizeof(sc->sc_scb)/sizeof(sc->sc_scb[0]); i++)
|
||||
for (i = 0; i < __arraycount(sc->sc_scb); i++)
|
||||
TAILQ_INSERT_TAIL(&sc->free_scb, &sc->sc_scb[i], chain);
|
||||
|
||||
sc->sc_reg = (struct spifi_reg *)apa->apa_hwbase;
|
||||
|
@ -168,13 +171,14 @@ spifi_attach(struct device *parent, struct device *self, void *aux)
|
|||
/* Find my dmac3. */
|
||||
dma = dmac3_link(apa->apa_ctlnum);
|
||||
if (dma == NULL) {
|
||||
printf(": cannot find slave dmac\n");
|
||||
aprint_error(": cannot find slave dmac\n");
|
||||
return;
|
||||
}
|
||||
sc->sc_dma = dma;
|
||||
|
||||
printf(" slot%d addr 0x%lx", apa->apa_slotno, apa->apa_hwbase);
|
||||
printf(": SCSI ID = %d, using %s\n", sc->sc_id, dma->dv_xname);
|
||||
aprint_normal(" slot%d addr 0x%lx", apa->apa_slotno, apa->apa_hwbase);
|
||||
aprint_normal(": SCSI ID = %d, using %s\n",
|
||||
sc->sc_id, device_xname(dma->sc_dev));
|
||||
|
||||
dmac3_reset(sc->sc_dma);
|
||||
|
||||
|
@ -182,7 +186,7 @@ spifi_attach(struct device *parent, struct device *self, void *aux)
|
|||
spifi_reset(sc);
|
||||
DMAC3_FASTACCESS(sc);
|
||||
|
||||
sc->sc_adapter.adapt_dev = &sc->sc_dev;
|
||||
sc->sc_adapter.adapt_dev = self;
|
||||
sc->sc_adapter.adapt_nchannels = 1;
|
||||
sc->sc_adapter.adapt_openings = 7;
|
||||
sc->sc_adapter.adapt_max_periph = 1;
|
||||
|
@ -205,7 +209,7 @@ spifi_attach(struct device *parent, struct device *self, void *aux)
|
|||
apbus_intr_establish(0, intr, 0, spifi_intr, sc, apa->apa_name,
|
||||
apa->apa_ctlnum);
|
||||
|
||||
config_found(&sc->sc_dev, &sc->sc_channel, scsiprint);
|
||||
config_found(self, &sc->sc_channel, scsiprint);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -214,7 +218,7 @@ spifi_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
|||
{
|
||||
struct scsipi_xfer *xs;
|
||||
struct scsipi_periph *periph;
|
||||
struct spifi_softc *sc = (void *)chan->chan_adapter->adapt_dev;
|
||||
struct spifi_softc *sc = device_private(chan->chan_adapter->adapt_dev);
|
||||
struct spifi_scb *scb;
|
||||
u_int flags;
|
||||
int s;
|
||||
|
@ -281,7 +285,7 @@ spifi_get_scb(struct spifi_softc *sc)
|
|||
int s;
|
||||
|
||||
s = splbio();
|
||||
scb = sc->free_scb.tqh_first;
|
||||
scb = TAILQ_FIRST(&sc->free_scb);
|
||||
if (scb)
|
||||
TAILQ_REMOVE(&sc->free_scb, scb, chain);
|
||||
splx(s);
|
||||
|
@ -306,7 +310,7 @@ spifi_poll(struct spifi_softc *sc)
|
|||
struct scsipi_xfer *xs;
|
||||
int count;
|
||||
|
||||
printf("spifi_poll: not implemented yet\n");
|
||||
printf("%s: not implemented yet\n", __func__);
|
||||
delay(10000);
|
||||
scb->status = SCSI_OK;
|
||||
scb->resid = 0;
|
||||
|
@ -346,7 +350,7 @@ spifi_sched(struct spifi_softc *sc)
|
|||
{
|
||||
struct spifi_scb *scb;
|
||||
|
||||
scb = sc->ready_scb.tqh_first;
|
||||
scb = TAILQ_FIRST(&sc->ready_scb);
|
||||
start:
|
||||
if (scb == NULL || sc->sc_nexus != NULL)
|
||||
return;
|
||||
|
@ -399,7 +403,7 @@ spifi_write_count(struct spifi_reg *reg, int count)
|
|||
|
||||
|
||||
#ifdef SPIFI_DEBUG
|
||||
static char scsi_phase_name[][8] = {
|
||||
static const char scsi_phase_name[][8] = {
|
||||
"DATAOUT", "DATAIN", "COMMAND", "STATUS",
|
||||
"", "", "MSGOUT", "MSGIN"
|
||||
};
|
||||
|
@ -470,7 +474,7 @@ spifi_intr(void *v)
|
|||
return 1;
|
||||
}
|
||||
if (intr & INTR_DISCON)
|
||||
panic("disconnect");
|
||||
panic("%s: disconnect", __func__);
|
||||
|
||||
if (intr & INTR_TIMEO) {
|
||||
xs->error = XS_SELTIMEOUT;
|
||||
|
@ -480,11 +484,12 @@ spifi_intr(void *v)
|
|||
}
|
||||
if (intr & INTR_BSRQ) {
|
||||
if (scb == NULL)
|
||||
panic("reconnect?");
|
||||
panic("%s: reconnect?", __func__);
|
||||
|
||||
if (intr & INTR_PERR) {
|
||||
printf("%s: %d:%d parity error\n", sc->sc_dev.dv_xname,
|
||||
scb->target, scb->lun);
|
||||
printf("%s: %d:%d parity error\n",
|
||||
device_xname(sc->sc_dev),
|
||||
scb->target, scb->lun);
|
||||
|
||||
/* XXX reset */
|
||||
xs->error = XS_DRIVER_STUFFUP;
|
||||
|
@ -493,9 +498,9 @@ spifi_intr(void *v)
|
|||
}
|
||||
|
||||
if (state >> 4 == SPS_MSGIN && icond == ICOND_NXTREQ)
|
||||
panic("spifi_intr: NXTREQ");
|
||||
panic("%s: NXTREQ", __func__);
|
||||
if (reg->fifoctrl & FIFOC_RQOVRN)
|
||||
panic("spifi_intr RQOVRN");
|
||||
panic("%s: RQOVRN", __func__);
|
||||
if (icond == ICOND_UXPHASEZ)
|
||||
panic("ICOND_UXPHASEZ");
|
||||
|
||||
|
@ -523,7 +528,7 @@ spifi_intr(void *v)
|
|||
goto done;
|
||||
}
|
||||
|
||||
panic("spifi_intr: unknown intr state");
|
||||
panic("%s: unknown intr state", __func__);
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -540,7 +545,7 @@ spifi_pmatch(struct spifi_softc *sc)
|
|||
phase = (reg->prstat & PRS_PHASE);
|
||||
|
||||
#ifdef SPIFI_DEBUG
|
||||
printf("spifi_pmatch (%s)\n", scsi_phase_name[phase >> 3]);
|
||||
printf("%s (%s)\n", __func__, scsi_phase_name[phase >> 3]);
|
||||
#endif
|
||||
|
||||
switch (phase) {
|
||||
|
@ -576,7 +581,8 @@ spifi_select(struct spifi_softc *sc)
|
|||
#endif
|
||||
|
||||
if (scb == NULL) {
|
||||
printf("%s: spifi_select: NULL nexus\n", sc->sc_dev.dv_xname);
|
||||
printf("%s: spifi_select: NULL nexus\n",
|
||||
device_xname(sc->sc_dev));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -598,7 +604,7 @@ spifi_sendmsg(struct spifi_softc *sc, int msg)
|
|||
int id = sc->sc_id;
|
||||
struct spifi_reg *reg = sc->sc_reg;
|
||||
|
||||
DPRINTF("spifi_sendmsg: sending");
|
||||
DPRINTF("%s: sending", __func__);
|
||||
sc->sc_msgout = msg;
|
||||
len = 0;
|
||||
|
||||
|
@ -635,10 +641,10 @@ spifi_command(struct spifi_softc *sc)
|
|||
struct spifi_scb *scb = sc->sc_nexus;
|
||||
struct spifi_reg *reg = sc->sc_reg;
|
||||
int len = scb->cmdlen;
|
||||
u_char *cmdp = (char *)&scb->cmd;
|
||||
uint8_t *cmdp = (uint8_t *)&scb->cmd;
|
||||
int i;
|
||||
|
||||
DPRINTF("spifi_command\n");
|
||||
DPRINTF("%s\n", __func__);
|
||||
|
||||
reg->cmdpage = scb->lun_targ;
|
||||
|
||||
|
@ -663,7 +669,7 @@ spifi_data_io(struct spifi_softc *sc)
|
|||
struct spifi_reg *reg = sc->sc_reg;
|
||||
int phase;
|
||||
|
||||
DPRINTF("spifi_data_io\n");
|
||||
DPRINTF("%s\n", __func__);
|
||||
|
||||
phase = reg->prstat & PRS_PHASE;
|
||||
dmac3_reset(sc->sc_dma);
|
||||
|
@ -698,7 +704,7 @@ spifi_status(struct spifi_softc *sc)
|
|||
{
|
||||
struct spifi_reg *reg = sc->sc_reg;
|
||||
|
||||
DPRINTF("spifi_status\n");
|
||||
DPRINTF("%s\n", __func__);
|
||||
spifi_fifo_drain(sc);
|
||||
reg->cmlen = CML_AMSG_EN | 1;
|
||||
reg->prcmd = PRC_STATUS;
|
||||
|
@ -710,11 +716,11 @@ spifi_done(struct spifi_softc *sc)
|
|||
struct spifi_scb *scb = sc->sc_nexus;
|
||||
struct scsipi_xfer *xs = scb->xs;
|
||||
|
||||
DPRINTF("spifi_done\n");
|
||||
DPRINTF("%s\n", __func__);
|
||||
|
||||
xs->status = scb->status;
|
||||
if (xs->status == SCSI_CHECK) {
|
||||
DPRINTF("spifi_done: CHECK CONDITION\n");
|
||||
DPRINTF("%s: CHECK CONDITION\n", __func__);
|
||||
if (xs->error == XS_NOERROR)
|
||||
xs->error = XS_BUSY;
|
||||
}
|
||||
|
@ -737,7 +743,7 @@ spifi_fifo_drain(struct spifi_softc *sc)
|
|||
struct spifi_reg *reg = sc->sc_reg;
|
||||
int fifoctrl, fifo_count;
|
||||
|
||||
DPRINTF("spifi_fifo_drain\n");
|
||||
DPRINTF("%s\n", __func__);
|
||||
|
||||
if ((scb->flags & SPIFI_READ) == 0)
|
||||
return;
|
||||
|
@ -762,7 +768,7 @@ spifi_reset(struct spifi_softc *sc)
|
|||
struct spifi_reg *reg = sc->sc_reg;
|
||||
int id = sc->sc_id;
|
||||
|
||||
DPRINTF("spifi_reset\n");
|
||||
DPRINTF("%s\n", __func__);
|
||||
|
||||
reg->auxctrl = AUXCTRL_SRST;
|
||||
reg->auxctrl = AUXCTRL_CRST;
|
||||
|
@ -796,7 +802,7 @@ spifi_bus_reset(struct spifi_softc *sc)
|
|||
{
|
||||
struct spifi_reg *reg = sc->sc_reg;
|
||||
|
||||
printf("%s: bus reset\n", sc->sc_dev.dv_xname);
|
||||
printf("%s: bus reset\n", device_xname(sc->sc_dev));
|
||||
|
||||
sc->sc_nexus = NULL;
|
||||
|
||||
|
@ -806,7 +812,7 @@ spifi_bus_reset(struct spifi_softc *sc)
|
|||
}
|
||||
|
||||
#if 0
|
||||
static u_char spifi_sync_period[] = {
|
||||
static uint8_t spifi_sync_period[] = {
|
||||
/* 0 1 2 3 4 5 6 7 8 9 10 11 */
|
||||
137, 125, 112, 100, 87, 75, 62, 50, 43, 37, 31, 25
|
||||
};
|
||||
|
@ -818,8 +824,8 @@ spifi_setsync(struct spifi_softc *sc, struct spifi_tinfo *ti)
|
|||
if ((ti->flags & T_SYNCMODE) == 0)
|
||||
reg->data_xfer = 0;
|
||||
else {
|
||||
int period = ti->period;
|
||||
int offset = ti->offset;
|
||||
uint8_t period = ti->period;
|
||||
uint8_t offset = ti->offset;
|
||||
int v;
|
||||
|
||||
for (v = sizeof(spifi_sync_period) - 1; v >= 0; v--)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: xafb.c,v 1.14 2007/03/04 06:00:26 christos Exp $ */
|
||||
/* $NetBSD: xafb.c,v 1.15 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -29,7 +29,7 @@
|
|||
/* "xa" frame buffer driver. Currently supports 1280x1024x8 only. */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: xafb.c,v 1.14 2007/03/04 06:00:26 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xafb.c,v 1.15 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
|
@ -50,34 +50,34 @@ __KERNEL_RCSID(0, "$NetBSD: xafb.c,v 1.14 2007/03/04 06:00:26 christos Exp $");
|
|||
#include <newsmips/apbus/apbusvar.h>
|
||||
|
||||
struct xafb_reg {
|
||||
volatile u_int r0;
|
||||
volatile u_int index;
|
||||
volatile u_int r2;
|
||||
volatile u_int zero;
|
||||
volatile u_int r4;
|
||||
volatile u_int r5;
|
||||
volatile u_int r6;
|
||||
volatile u_int rgb;
|
||||
volatile uint32_t r0;
|
||||
volatile uint32_t index;
|
||||
volatile uint32_t r2;
|
||||
volatile uint32_t zero;
|
||||
volatile uint32_t r4;
|
||||
volatile uint32_t r5;
|
||||
volatile uint32_t r6;
|
||||
volatile uint32_t rgb;
|
||||
};
|
||||
|
||||
struct xafb_devconfig {
|
||||
u_char *dc_fbbase; /* VRAM base address */
|
||||
uint8_t *dc_fbbase; /* VRAM base address */
|
||||
paddr_t dc_fbpaddr; /* VRAM physical address */
|
||||
struct xafb_reg *dc_reg; /* register address */
|
||||
struct rasops_info dc_ri;
|
||||
};
|
||||
|
||||
struct xafb_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
struct xafb_devconfig *sc_dc;
|
||||
int sc_nscreens;
|
||||
u_char sc_cmap_red[256];
|
||||
u_char sc_cmap_green[256];
|
||||
u_char sc_cmap_blue[256];
|
||||
uint8_t sc_cmap_red[256];
|
||||
uint8_t sc_cmap_green[256];
|
||||
uint8_t sc_cmap_blue[256];
|
||||
};
|
||||
|
||||
int xafb_match(struct device *, struct cfdata *, void *);
|
||||
void xafb_attach(struct device *, struct device *, void *);
|
||||
int xafb_match(device_t, cfdata_t, void *);
|
||||
void xafb_attach(device_t, device_t, void *);
|
||||
|
||||
int xafb_common_init(struct xafb_devconfig *);
|
||||
int xafb_is_console(void);
|
||||
|
@ -95,7 +95,7 @@ int xafb_putcmap(struct xafb_softc *, struct wsdisplay_cmap *);
|
|||
|
||||
static inline void xafb_setcolor(struct xafb_devconfig *, int, int, int, int);
|
||||
|
||||
CFATTACH_DECL(xafb, sizeof(struct xafb_softc),
|
||||
CFATTACH_DECL_NEW(xafb, sizeof(struct xafb_softc),
|
||||
xafb_match, xafb_attach, NULL, NULL);
|
||||
|
||||
struct xafb_devconfig xafb_console_dc;
|
||||
|
@ -122,11 +122,11 @@ const struct wsscreen_descr *xafb_scrlist[] = {
|
|||
};
|
||||
|
||||
struct wsscreen_list xafb_screenlist = {
|
||||
sizeof(xafb_scrlist) / sizeof(xafb_scrlist[0]), xafb_scrlist
|
||||
__arraycount(xafb_scrlist), xafb_scrlist
|
||||
};
|
||||
|
||||
int
|
||||
xafb_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
xafb_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct apbus_attach_args *apa = aux;
|
||||
|
||||
|
@ -137,15 +137,16 @@ xafb_match(struct device *parent, struct cfdata *match, void *aux)
|
|||
}
|
||||
|
||||
void
|
||||
xafb_attach(struct device *parent, struct device *self, void *aux)
|
||||
xafb_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct xafb_softc *sc = (void *)self;
|
||||
struct xafb_softc *sc = device_private(self);
|
||||
struct apbus_attach_args *apa = aux;
|
||||
struct wsemuldisplaydev_attach_args wsa;
|
||||
struct xafb_devconfig *dc;
|
||||
struct rasops_info *ri;
|
||||
int console, i;
|
||||
|
||||
sc->sc_dev = self;
|
||||
console = xafb_is_console();
|
||||
|
||||
if (console) {
|
||||
|
@ -159,7 +160,7 @@ xafb_attach(struct device *parent, struct device *self, void *aux)
|
|||
dc->dc_fbbase = (void *)MIPS_PHYS_TO_KSEG1(dc->dc_fbpaddr);
|
||||
dc->dc_reg = (void *)(apa->apa_hwbase + 0x3000);
|
||||
if (xafb_common_init(dc) != 0) {
|
||||
printf(": couldn't initialize device\n");
|
||||
aprint_error(": couldn't initialize device\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -176,7 +177,8 @@ xafb_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc->sc_cmap_blue[i] = i;
|
||||
}
|
||||
|
||||
printf(": %d x %d, %dbpp\n", ri->ri_width, ri->ri_height, ri->ri_depth);
|
||||
aprint_normal(": %d x %d, %dbpp\n",
|
||||
ri->ri_width, ri->ri_height, ri->ri_depth);
|
||||
|
||||
wsa.console = console;
|
||||
wsa.scrdata = &xafb_screenlist;
|
||||
|
@ -232,7 +234,7 @@ xafb_common_init(struct xafb_devconfig *dc)
|
|||
int
|
||||
xafb_is_console(void)
|
||||
{
|
||||
volatile u_int *dipsw = (void *)NEWS5000_DIP_SWITCH;
|
||||
volatile uint32_t *dipsw = (void *)NEWS5000_DIP_SWITCH;
|
||||
|
||||
if (*dipsw & 1) /* XXX right? */
|
||||
return 1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dmac_0448.h,v 1.5 2005/12/11 12:18:24 christos Exp $ */
|
||||
/* $NetBSD: dmac_0448.h,v 1.6 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
|
@ -63,56 +63,42 @@
|
|||
#define DMAC_CMAPH (DMAC_BASE + 0xc)
|
||||
#define DMAC_CMAPL (DMAC_BASE + 0xd)
|
||||
|
||||
#ifdef __mips__
|
||||
#define VOLATILE volatile
|
||||
#else
|
||||
#define VOLATILE
|
||||
#endif
|
||||
#define dmac_gstat (*(volatile uint8_t *)DMAC_GSTAT)
|
||||
#define dmac_gsel (*(volatile uint8_t *)DMAC_GSEL)
|
||||
|
||||
#ifndef U_CHAR
|
||||
#define U_CHAR unsigned VOLATILE char
|
||||
#endif
|
||||
|
||||
#ifndef U_SHORT
|
||||
#define U_SHORT unsigned VOLATILE short
|
||||
#endif
|
||||
|
||||
#define dmac_gstat *(U_CHAR *)DMAC_GSTAT
|
||||
#define dmac_gsel *(U_CHAR *)DMAC_GSEL
|
||||
|
||||
#define dmac_cstat *(U_CHAR *)DMAC_CSTAT
|
||||
#define dmac_cctl *(U_CHAR *)DMAC_CCTL
|
||||
#define dmac_ctrcl *(U_CHAR *)DMAC_CTRCL
|
||||
#define dmac_ctrcm *(U_CHAR *)DMAC_CTRCM
|
||||
#define dmac_ctrch *(U_CHAR *)DMAC_CTRCH
|
||||
#define dmac_ctag *(U_CHAR *)DMAC_CTAG
|
||||
#define dmac_cwid *(U_CHAR *)DMAC_CWID
|
||||
#define dmac_cofsl *(U_CHAR *)DMAC_COFSL
|
||||
#define dmac_cofsh *(U_CHAR *)DMAC_COFSH
|
||||
#define dmac_cmap *(U_SHORT *)DMAC_CMAP
|
||||
#define dmac_cmaph *(U_CHAR *)DMAC_CMAPH
|
||||
#define dmac_cmapl *(U_CHAR *)DMAC_CMAPL
|
||||
#define dmac_cstat (*(volatile uint8_t *)DMAC_CSTAT)
|
||||
#define dmac_cctl (*(volatile uint8_t *)DMAC_CCTL)
|
||||
#define dmac_ctrcl (*(volatile uint8_t *)DMAC_CTRCL)
|
||||
#define dmac_ctrcm (*(volatile uint8_t *)DMAC_CTRCM)
|
||||
#define dmac_ctrch (*(volatile uint8_t *)DMAC_CTRCH)
|
||||
#define dmac_ctag (*(volatile uint8_t *)DMAC_CTAG)
|
||||
#define dmac_cwid (*(volatile uint8_t *)DMAC_CWID)
|
||||
#define dmac_cofsl (*(volatile uint8_t *)DMAC_COFSL)
|
||||
#define dmac_cofsh (*(volatile uint8_t *)DMAC_COFSH)
|
||||
#define dmac_cmap (*(volatile uint16_t *)DMAC_CMAP)
|
||||
#define dmac_cmaph (*(volatile uint8_t *)DMAC_CMAPH)
|
||||
#define dmac_cmapl (*(volatile uint8_t *)DMAC_CMAPL)
|
||||
|
||||
/* status/control bit definition */
|
||||
#define DM_TCZ 0x80
|
||||
#define DM_A28 0x40
|
||||
#define DM_AFIX 0x20
|
||||
#define DM_APAD 0x10
|
||||
#define DM_ZINTEN 0x8
|
||||
#define DM_RST 0x4
|
||||
#define DM_MODE 0x2
|
||||
#define DM_ENABLE 1
|
||||
#define DM_ZINTEN 0x08
|
||||
#define DM_RST 0x04
|
||||
#define DM_MODE 0x02
|
||||
#define DM_ENABLE 0x01
|
||||
|
||||
/* general status bit definition */
|
||||
#define CH_INT(x) (u_char)(1 << (2 * x))
|
||||
#define CH0_INT 1
|
||||
#define CH1_INT 4
|
||||
#define CH_INT(x) (uint8_t)(1 << (2 * x))
|
||||
#define CH0_INT 0x01
|
||||
#define CH1_INT 0x04
|
||||
#define CH2_INT 0x10
|
||||
#define CH3_INT 0x40
|
||||
|
||||
#define CH_MRQ(x) (u_char)(1 << (2 * x + 1))
|
||||
#define CH0_MRQ 2
|
||||
#define CH1_MRQ 8
|
||||
#define CH_MRQ(x) (uint8_t)(1 << (2 * x + 1))
|
||||
#define CH0_MRQ 0x02
|
||||
#define CH1_MRQ 0x08
|
||||
#define CH2_MRQ 0x20
|
||||
#define CH3_MRQ 0x80
|
||||
|
||||
|
@ -124,15 +110,15 @@
|
|||
|
||||
/* dma status */
|
||||
|
||||
struct dm_stat {
|
||||
unsigned int dm_gstat;
|
||||
unsigned int dm_cstat;
|
||||
unsigned int dm_cctl;
|
||||
unsigned int dm_tcnt;
|
||||
unsigned int dm_offset;
|
||||
unsigned int dm_tag;
|
||||
unsigned int dm_width;
|
||||
} ;
|
||||
struct dm_stat {
|
||||
unsigned int dm_gstat;
|
||||
unsigned int dm_cstat;
|
||||
unsigned int dm_cctl;
|
||||
unsigned int dm_tcnt;
|
||||
unsigned int dm_offset;
|
||||
unsigned int dm_tag;
|
||||
unsigned int dm_width;
|
||||
};
|
||||
|
||||
#define DMAC_WAIT nops(10)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fb.c,v 1.23 2007/03/04 06:00:26 christos Exp $ */
|
||||
/* $NetBSD: fb.c,v 1.24 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fb.c,v 1.23 2007/03/04 06:00:26 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fb.c,v 1.24 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -51,13 +51,13 @@ struct fb_devconfig {
|
|||
};
|
||||
|
||||
struct fb_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
struct fb_devconfig *sc_dc;
|
||||
int sc_nscreens;
|
||||
};
|
||||
|
||||
int fb_match(struct device *, struct cfdata *, void *);
|
||||
void fb_attach(struct device *, struct device *, void *);
|
||||
int fb_match(device_t, cfdata_t, void *);
|
||||
void fb_attach(device_t, device_t, void *);
|
||||
|
||||
int fb_common_init(struct fb_devconfig *);
|
||||
int fb_is_console(void);
|
||||
|
@ -73,7 +73,7 @@ void fb_cnattach(void);
|
|||
|
||||
static void fb253_init(void);
|
||||
|
||||
CFATTACH_DECL(fb, sizeof(struct fb_softc),
|
||||
CFATTACH_DECL_NEW(fb, sizeof(struct fb_softc),
|
||||
fb_match, fb_attach, NULL, NULL);
|
||||
|
||||
struct fb_devconfig fb_console_dc;
|
||||
|
@ -100,17 +100,17 @@ const struct wsscreen_descr *fb_scrlist[] = {
|
|||
};
|
||||
|
||||
struct wsscreen_list fb_screenlist = {
|
||||
sizeof(fb_scrlist) / sizeof(fb_scrlist[0]), fb_scrlist
|
||||
__arraycount(fb_scrlist), fb_scrlist
|
||||
};
|
||||
|
||||
#define NWB253_VRAM ((u_char *) 0x88000000)
|
||||
#define NWB253_CTLREG ((u_short *)0xb8ff0000)
|
||||
#define NWB253_CRTREG ((u_short *)0xb8fe0000)
|
||||
#define NWB253_VRAM ((uint8_t *) 0x88000000)
|
||||
#define NWB253_CTLREG ((uint16_t *)0xb8ff0000)
|
||||
#define NWB253_CRTREG ((uint16_t *)0xb8fe0000)
|
||||
|
||||
static const char *devname[8] = { "NWB-512", "NWB-518", "NWE-501" }; /* XXX ? */
|
||||
|
||||
int
|
||||
fb_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
fb_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
||||
|
@ -119,16 +119,16 @@ fb_match(struct device *parent, struct cfdata *match, void *aux)
|
|||
|
||||
if (hb_badaddr(NWB253_CTLREG, 2) || hb_badaddr(NWB253_CRTREG, 2))
|
||||
return 0;
|
||||
if ((*(volatile u_short *)NWB253_CTLREG & 7) != 4)
|
||||
if ((*(volatile uint16_t *)NWB253_CTLREG & 7) != 4)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
fb_attach(struct device *parent, struct device *self, void *aux)
|
||||
fb_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct fb_softc *sc = (void *)self;
|
||||
struct fb_softc *sc = device_private(self);
|
||||
struct wsemuldisplaydev_attach_args waa;
|
||||
struct fb_devconfig *dc;
|
||||
struct rasops_info *ri;
|
||||
|
@ -136,6 +136,8 @@ fb_attach(struct device *parent, struct device *self, void *aux)
|
|||
volatile u_short *ctlreg = NWB253_CTLREG;
|
||||
int id;
|
||||
|
||||
sc->sc_dev = self;
|
||||
|
||||
console = fb_is_console();
|
||||
|
||||
if (console) {
|
||||
|
@ -158,7 +160,7 @@ fb_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc->sc_dc = dc;
|
||||
|
||||
id = (*ctlreg >> 8) & 0xf;
|
||||
printf(": %s, %d x %d, %dbpp\n", devname[id],
|
||||
aprint_normal(": %s, %d x %d, %dbpp\n", devname[id],
|
||||
ri->ri_width, ri->ri_height, ri->ri_depth);
|
||||
|
||||
waa.console = console;
|
||||
|
@ -173,7 +175,7 @@ int
|
|||
fb_common_init(struct fb_devconfig *dc)
|
||||
{
|
||||
struct rasops_info *ri = &dc->dc_ri;
|
||||
volatile u_short *ctlreg = NWB253_CTLREG;
|
||||
volatile uint16_t *ctlreg = NWB253_CTLREG;
|
||||
int id;
|
||||
int width, height, xoff, yoff, cols, rows;
|
||||
|
||||
|
@ -303,7 +305,7 @@ fb_free_screen(void *v, void *cookie)
|
|||
struct fb_softc *sc = v;
|
||||
|
||||
if (sc->sc_dc == &fb_console_dc)
|
||||
panic("fb_free_screen: console");
|
||||
panic("%s: console", __func__);
|
||||
|
||||
sc->sc_nscreens--;
|
||||
}
|
||||
|
@ -418,8 +420,8 @@ static const uint8_t
|
|||
static void
|
||||
fb253_init(void)
|
||||
{
|
||||
volatile u_short *ctlreg = NWB253_CTLREG;
|
||||
volatile u_short *crtreg = NWB253_CRTREG;
|
||||
volatile uint16_t *ctlreg = NWB253_CTLREG;
|
||||
volatile uint16_t *crtreg = NWB253_CRTREG;
|
||||
int id = (*ctlreg >> 8) & 0xf;
|
||||
const uint8_t *p;
|
||||
int i;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* $NetBSD: hb.c,v 1.17 2005/12/11 12:18:24 christos Exp $ */
|
||||
/* $NetBSD: hb.c,v 1.18 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: hb.c,v 1.17 2005/12/11 12:18:24 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: hb.c,v 1.18 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -13,22 +13,21 @@ __KERNEL_RCSID(0, "$NetBSD: hb.c,v 1.17 2005/12/11 12:18:24 christos Exp $");
|
|||
|
||||
#include <newsmips/dev/hbvar.h>
|
||||
|
||||
static int hb_match(struct device *, struct cfdata *, void *);
|
||||
static void hb_attach(struct device *, struct device *, void *);
|
||||
static int hb_search(struct device *, struct cfdata *,
|
||||
const int *, void *);
|
||||
#include "ioconf.h"
|
||||
|
||||
static int hb_match(device_t, cfdata_t, void *);
|
||||
static void hb_attach(device_t, device_t, void *);
|
||||
static int hb_search(device_t, cfdata_t, const int *, void *);
|
||||
static int hb_print(void *, const char *);
|
||||
|
||||
CFATTACH_DECL(hb, sizeof(struct device),
|
||||
CFATTACH_DECL_NEW(hb, 0,
|
||||
hb_match, hb_attach, NULL, NULL);
|
||||
|
||||
extern struct cfdriver hb_cd;
|
||||
|
||||
#define NLEVEL 4
|
||||
static struct newsmips_intr hbintr_tab[NLEVEL];
|
||||
|
||||
static int
|
||||
hb_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
hb_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct confargs *ca = aux;
|
||||
|
||||
|
@ -39,13 +38,13 @@ hb_match(struct device *parent, struct cfdata *cf, void *aux)
|
|||
}
|
||||
|
||||
static void
|
||||
hb_attach(struct device *parent, struct device *self, void *aux)
|
||||
hb_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct hb_attach_args ha;
|
||||
struct newsmips_intr *ip;
|
||||
int i;
|
||||
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
memset(&ha, 0, sizeof(ha));
|
||||
for (i = 0; i < NLEVEL; i++) {
|
||||
|
@ -57,8 +56,7 @@ hb_attach(struct device *parent, struct device *self, void *aux)
|
|||
}
|
||||
|
||||
static int
|
||||
hb_search(struct device *parent, struct cfdata *cf,
|
||||
const int *ldesc, void *aux)
|
||||
hb_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
|
||||
{
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
||||
|
@ -102,7 +100,7 @@ hb_intr_establish(int level, int mask, int priority, int (*func)(void *),
|
|||
|
||||
ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT);
|
||||
if (ih == NULL)
|
||||
panic("hb_intr_establish: malloc failed");
|
||||
panic("%s: malloc failed", __func__);
|
||||
|
||||
ih->ih_func = func;
|
||||
ih->ih_arg = arg;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kb_hb.c,v 1.11 2007/03/04 06:00:26 christos Exp $ */
|
||||
/* $NetBSD: kb_hb.c,v 1.12 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kb_hb.c,v 1.11 2007/03/04 06:00:26 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kb_hb.c,v 1.12 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -43,20 +43,20 @@ __KERNEL_RCSID(0, "$NetBSD: kb_hb.c,v 1.11 2007/03/04 06:00:26 christos Exp $");
|
|||
#include <newsmips/dev/hbvar.h>
|
||||
|
||||
struct kbreg {
|
||||
u_char kb_data;
|
||||
u_char kb_stat;
|
||||
u_char kb_reset;
|
||||
u_char kb_init;
|
||||
volatile uint8_t kb_data;
|
||||
volatile uint8_t kb_stat;
|
||||
volatile uint8_t kb_reset;
|
||||
volatile uint8_t kb_init;
|
||||
};
|
||||
|
||||
struct kb_hb_softc {
|
||||
struct device sc_dev;
|
||||
volatile struct kbreg *sc_reg;
|
||||
device_t sc_dev;
|
||||
struct kbreg *sc_reg;
|
||||
struct device *sc_wskbddev;
|
||||
};
|
||||
|
||||
int kb_hb_match(struct device *, struct cfdata *, void *);
|
||||
void kb_hb_attach(struct device *, struct device *, void *);
|
||||
int kb_hb_match(device_t, cfdata_t, void *);
|
||||
void kb_hb_attach(device_t, device_t, void *);
|
||||
int kb_hb_intr(void *);
|
||||
|
||||
void kb_hb_cnattach(void);
|
||||
|
@ -69,7 +69,7 @@ int kb_hb_ioctl(void *, u_long, void *, int, struct lwp *);
|
|||
|
||||
extern struct wscons_keydesc newskb_keydesctab[];
|
||||
|
||||
CFATTACH_DECL(kb_hb, sizeof(struct kb_hb_softc),
|
||||
CFATTACH_DECL_NEW(kb_hb, sizeof(struct kb_hb_softc),
|
||||
kb_hb_match, kb_hb_attach, NULL, NULL);
|
||||
|
||||
struct wskbd_accessops kb_hb_accessops = {
|
||||
|
@ -89,7 +89,7 @@ struct wskbd_mapdata kb_hb_keymapdata = {
|
|||
};
|
||||
|
||||
int
|
||||
kb_hb_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
kb_hb_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
||||
|
@ -100,15 +100,17 @@ kb_hb_match(struct device *parent, struct cfdata *cf, void *aux)
|
|||
}
|
||||
|
||||
void
|
||||
kb_hb_attach(struct device *parent, struct device *self, void *aux)
|
||||
kb_hb_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct kb_hb_softc *sc = (void *)self;
|
||||
struct kb_hb_softc *sc = device_private(self);
|
||||
struct hb_attach_args *ha = aux;
|
||||
volatile struct kbreg *reg;
|
||||
volatile int *dipsw = (void *)DIP_SWITCH;
|
||||
struct kbreg *reg;
|
||||
volatile uint32_t *dipsw = (void *)DIP_SWITCH;
|
||||
struct wskbddev_attach_args aa;
|
||||
int intr, cons;
|
||||
|
||||
sc->sc_dev = self;
|
||||
|
||||
reg = (struct kbreg *)ha->ha_addr;
|
||||
intr = ha->ha_level;
|
||||
|
||||
|
@ -119,13 +121,13 @@ kb_hb_attach(struct device *parent, struct device *self, void *aux)
|
|||
reg->kb_reset = 0x01;
|
||||
reg->kb_init = 0xf0; /* 9600 bps */
|
||||
|
||||
printf(" level %d", intr);
|
||||
aprint_normal(" level %d", intr);
|
||||
cons = 0;
|
||||
if (*dipsw & 7) {
|
||||
cons = 1;
|
||||
printf(" (console)");
|
||||
aprint_normal(" (console)");
|
||||
}
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
hb_intr_establish(intr, INTEN0_KBDINT, IPL_TTY, kb_hb_intr, sc);
|
||||
|
||||
|
@ -140,8 +142,8 @@ int
|
|||
kb_hb_intr(void *v)
|
||||
{
|
||||
struct kb_hb_softc *sc = v;
|
||||
volatile struct kbreg *reg = sc->sc_reg;
|
||||
volatile u_char *ien = (void *)INTEN0;
|
||||
struct kbreg *reg = sc->sc_reg;
|
||||
volatile uint8_t *ien = (void *)INTEN0;
|
||||
int code, type, release, val;
|
||||
int rv = 0;
|
||||
|
||||
|
@ -164,7 +166,7 @@ kb_hb_intr(void *v)
|
|||
void
|
||||
kb_hb_cnattach(void)
|
||||
{
|
||||
volatile int *dipsw = (void *)DIP_SWITCH;
|
||||
volatile uint32_t *dipsw = (void *)DIP_SWITCH;
|
||||
|
||||
if (*dipsw & 7)
|
||||
wskbd_cnattach(&kb_hb_consops, (void *)KEYB_DATA,
|
||||
|
@ -174,8 +176,8 @@ kb_hb_cnattach(void)
|
|||
void
|
||||
kb_hb_cngetc(void *v, u_int *type, int *data)
|
||||
{
|
||||
volatile struct kbreg *reg = v;
|
||||
volatile u_char *ien = (void *)INTEN0;
|
||||
struct kbreg *reg = v;
|
||||
volatile uint8_t *ien = (void *)INTEN0;
|
||||
int code, release, ointr;
|
||||
|
||||
ointr = *ien & RX_KBINTE;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ms_hb.c,v 1.12 2007/03/04 06:00:26 christos Exp $ */
|
||||
/* $NetBSD: ms_hb.c,v 1.13 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ms_hb.c,v 1.12 2007/03/04 06:00:26 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ms_hb.c,v 1.13 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -41,29 +41,29 @@ __KERNEL_RCSID(0, "$NetBSD: ms_hb.c,v 1.12 2007/03/04 06:00:26 christos Exp $");
|
|||
#include <newsmips/dev/hbvar.h>
|
||||
|
||||
struct msreg {
|
||||
u_char ms_data;
|
||||
u_char ms_stat;
|
||||
u_char ms_reset;
|
||||
u_char ms_init;
|
||||
volatile uint8_t ms_data;
|
||||
volatile uint8_t ms_stat;
|
||||
volatile uint8_t ms_reset;
|
||||
volatile uint8_t ms_init;
|
||||
};
|
||||
|
||||
struct ms_hb_softc {
|
||||
struct device sc_dev;
|
||||
volatile struct msreg *sc_reg;
|
||||
device_t sc_dev;
|
||||
struct msreg *sc_reg;
|
||||
struct device *sc_wsmousedev;
|
||||
int sc_ndata;
|
||||
u_char sc_buf[3];
|
||||
uint8_t sc_buf[3];
|
||||
};
|
||||
|
||||
int ms_hb_match(struct device *, struct cfdata *, void *);
|
||||
void ms_hb_attach(struct device *, struct device *, void *);
|
||||
int ms_hb_match(device_t, cfdata_t, void *);
|
||||
void ms_hb_attach(device_t, device_t, void *);
|
||||
int ms_hb_intr(void *);
|
||||
|
||||
int ms_hb_enable(void *);
|
||||
int ms_hb_ioctl(void *, u_long, void *, int, struct lwp *);
|
||||
void ms_hb_disable(void *);
|
||||
|
||||
CFATTACH_DECL(ms_hb, sizeof(struct ms_hb_softc),
|
||||
CFATTACH_DECL_NEW(ms_hb, sizeof(struct ms_hb_softc),
|
||||
ms_hb_match, ms_hb_attach, NULL, NULL);
|
||||
|
||||
struct wsmouse_accessops ms_hb_accessops = {
|
||||
|
@ -73,7 +73,7 @@ struct wsmouse_accessops ms_hb_accessops = {
|
|||
};
|
||||
|
||||
int
|
||||
ms_hb_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
ms_hb_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
||||
|
@ -84,14 +84,16 @@ ms_hb_match(struct device *parent, struct cfdata *cf, void *aux)
|
|||
}
|
||||
|
||||
void
|
||||
ms_hb_attach(struct device *parent, struct device *self, void *aux)
|
||||
ms_hb_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct ms_hb_softc *sc = (void *)self;
|
||||
struct ms_hb_softc *sc = device_private(self);
|
||||
struct hb_attach_args *ha = aux;
|
||||
volatile struct msreg *reg;
|
||||
struct msreg *reg;
|
||||
struct wsmousedev_attach_args aa;
|
||||
int intr;
|
||||
|
||||
sc->sc_dev = self;
|
||||
|
||||
reg = (struct msreg *)ha->ha_addr;
|
||||
intr = ha->ha_level;
|
||||
|
||||
|
@ -103,7 +105,7 @@ ms_hb_attach(struct device *parent, struct device *self, void *aux)
|
|||
reg->ms_reset = 0x01;
|
||||
reg->ms_init = 0x80; /* 1200 bps */
|
||||
|
||||
printf(" level %d\n", intr);
|
||||
aprint_normal(" level %d\n", intr);
|
||||
|
||||
hb_intr_establish(intr, INTEN0_MSINT, IPL_TTY, ms_hb_intr, sc);
|
||||
|
||||
|
@ -116,8 +118,8 @@ int
|
|||
ms_hb_intr(void *v)
|
||||
{
|
||||
struct ms_hb_softc *sc = v;
|
||||
volatile struct msreg *reg = sc->sc_reg;
|
||||
volatile u_char *ien = (void *)INTEN0;
|
||||
struct msreg *reg = sc->sc_reg;
|
||||
volatile uint8_t *ien = (void *)INTEN0;
|
||||
int code, index, byte0, byte1, byte2;
|
||||
int button, dx, dy;
|
||||
int rv = 0;
|
||||
|
@ -183,7 +185,7 @@ ms_hb_intr(void *v)
|
|||
int
|
||||
ms_hb_enable(void *v)
|
||||
{
|
||||
volatile u_char *ien = (void *)INTEN0;
|
||||
volatile uint8_t *ien = (void *)INTEN0;
|
||||
|
||||
*ien |= RX_MSINTE;
|
||||
return 0;
|
||||
|
@ -192,7 +194,7 @@ ms_hb_enable(void *v)
|
|||
void
|
||||
ms_hb_disable(void *v)
|
||||
{
|
||||
volatile u_char *ien = (void *)INTEN0;
|
||||
volatile uint8_t *ien = (void *)INTEN0;
|
||||
|
||||
*ien &= ~RX_MSINTE;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: sc_wrap.c,v 1.30 2007/03/04 06:00:26 christos Exp $ */
|
||||
/* $NetBSD: sc_wrap.c,v 1.31 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* This driver is slow! Need to rewrite.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sc_wrap.c,v 1.30 2007/03/04 06:00:26 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sc_wrap.c,v 1.31 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -34,10 +34,10 @@ __KERNEL_RCSID(0, "$NetBSD: sc_wrap.c,v 1.30 2007/03/04 06:00:26 christos Exp $"
|
|||
|
||||
#include <mips/cache.h>
|
||||
|
||||
static int cxd1185_match(struct device *, struct cfdata *, void *);
|
||||
static void cxd1185_attach(struct device *, struct device *, void *);
|
||||
static int cxd1185_match(device_t, cfdata_t, void *);
|
||||
static void cxd1185_attach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(sc, sizeof(struct sc_softc),
|
||||
CFATTACH_DECL_NEW(sc, sizeof(struct sc_softc),
|
||||
cxd1185_match, cxd1185_attach, NULL, NULL);
|
||||
|
||||
void cxd1185_init(struct sc_softc *);
|
||||
|
@ -60,7 +60,7 @@ extern paddr_t kvtophys(vaddr_t);
|
|||
static int sc_disconnect = IDT_DISCON;
|
||||
|
||||
int
|
||||
cxd1185_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
cxd1185_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct hb_attach_args *ha = aux;
|
||||
|
||||
|
@ -71,31 +71,33 @@ cxd1185_match(struct device *parent, struct cfdata *cf, void *aux)
|
|||
}
|
||||
|
||||
void
|
||||
cxd1185_attach(struct device *parent, struct device *self, void *aux)
|
||||
cxd1185_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct sc_softc *sc = (void *)self;
|
||||
struct sc_softc *sc = device_private(self);
|
||||
struct hb_attach_args *ha = aux;
|
||||
struct sc_scb *scb;
|
||||
int i, intlevel;
|
||||
|
||||
sc->sc_dev = self;
|
||||
|
||||
intlevel = ha->ha_level;
|
||||
if (intlevel == -1) {
|
||||
#if 0
|
||||
printf(": interrupt level not configured\n");
|
||||
aprint_error(": interrupt level not configured\n");
|
||||
return;
|
||||
#else
|
||||
printf(": interrupt level not configured; using");
|
||||
aprint_normal(": interrupt level not configured; using");
|
||||
intlevel = 0;
|
||||
#endif
|
||||
}
|
||||
printf(" level %d\n", intlevel);
|
||||
aprint_normal(" level %d\n", intlevel);
|
||||
|
||||
if (sc_idenr & 0x08)
|
||||
sc->scsi_1185AQ = 1;
|
||||
else
|
||||
sc->scsi_1185AQ = 0;
|
||||
|
||||
sc->sc_adapter.adapt_dev = &sc->sc_dev;
|
||||
sc->sc_adapter.adapt_dev = self;
|
||||
sc->sc_adapter.adapt_nchannels = 1;
|
||||
sc->sc_adapter.adapt_openings = 7;
|
||||
sc->sc_adapter.adapt_max_periph = 1;
|
||||
|
@ -125,7 +127,7 @@ cxd1185_attach(struct device *parent, struct device *self, void *aux)
|
|||
|
||||
hb_intr_establish(intlevel, INTEN1_DMA, IPL_BIO, sc_intr, sc);
|
||||
|
||||
config_found(&sc->sc_dev, &sc->sc_channel, scsiprint);
|
||||
config_found(self, &sc->sc_channel, scsiprint);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -183,7 +185,7 @@ sc_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
|||
{
|
||||
struct scsipi_xfer *xs;
|
||||
struct scsipi_periph *periph;
|
||||
struct sc_softc *sc = (void *)chan->chan_adapter->adapt_dev;
|
||||
struct sc_softc *sc = device_private(chan->chan_adapter->adapt_dev);
|
||||
struct sc_scb *scb;
|
||||
int flags, s;
|
||||
int target;
|
||||
|
@ -195,7 +197,7 @@ sc_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
|||
|
||||
flags = xs->xs_control;
|
||||
if ((scb = get_scb(sc, flags)) == NULL)
|
||||
panic("sc_scsipi_request: no scb");
|
||||
panic("%s: no scb", __func__);
|
||||
|
||||
scb->xs = xs;
|
||||
scb->flags = 0;
|
||||
|
@ -239,8 +241,8 @@ sc_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
|||
int
|
||||
sc_poll(struct sc_softc *sc, int chan, int count)
|
||||
{
|
||||
volatile u_char *int_stat = (void *)INTST1;
|
||||
volatile u_char *int_clear = (void *)INTCLR1;
|
||||
volatile uint8_t *int_stat = (void *)INTST1;
|
||||
volatile uint8_t *int_clear = (void *)INTCLR1;
|
||||
|
||||
while (sc_busy(sc, chan)) {
|
||||
if (*int_stat & INTST1_DMA) {
|
||||
|
@ -299,8 +301,8 @@ start:
|
|||
|
||||
/* make va->pa mapping table for DMA */
|
||||
if (xs->datalen > 0) {
|
||||
int pages, offset;
|
||||
int i, pn;
|
||||
uint32_t pn, pages, offset;
|
||||
int i;
|
||||
vaddr_t va;
|
||||
|
||||
#if 0
|
||||
|
@ -352,9 +354,9 @@ sc_done(struct sc_scb *scb)
|
|||
{
|
||||
struct scsipi_xfer *xs = scb->xs;
|
||||
struct scsipi_periph *periph = xs->xs_periph;
|
||||
struct sc_softc *sc =
|
||||
(void *)periph->periph_channel->chan_adapter->adapt_dev;
|
||||
struct sc_softc *sc;
|
||||
|
||||
sc = device_private(periph->periph_channel->chan_adapter->adapt_dev);
|
||||
xs->resid = 0;
|
||||
xs->status = 0;
|
||||
|
||||
|
@ -395,7 +397,7 @@ int
|
|||
sc_intr(void *v)
|
||||
{
|
||||
/* struct sc_softc *sc = v; */
|
||||
volatile u_char *gsp = (u_char *)DMAC_GSTAT;
|
||||
volatile uint8_t *gsp = (uint8_t *)DMAC_GSTAT;
|
||||
u_int gstat = *gsp;
|
||||
int mrqb, i;
|
||||
|
||||
|
@ -414,7 +416,7 @@ sc_intr(void *v)
|
|||
for (i = 0; i < 50; i++)
|
||||
;
|
||||
if (*gsp & mrqb)
|
||||
printf("sc_intr: MRQ\n");
|
||||
printf("%s: MRQ\n", __func__);
|
||||
}
|
||||
scintr();
|
||||
|
||||
|
@ -435,7 +437,7 @@ scop_rsense(int intr, struct scsi *sc_param, int lun, int ie, int count,
|
|||
sc_param->identify = MSG_IDENT | sc_disconnect | (lun & IDT_DRMASK);
|
||||
sc_param->sc_lun = lun;
|
||||
|
||||
sc_param->sc_cpoint = (u_char *)param;
|
||||
sc_param->sc_cpoint = (uint8_t *)param;
|
||||
sc_param->sc_ctrnscnt = count;
|
||||
|
||||
/* sc_cdb */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: screg_1185.h,v 1.6 2005/12/11 12:18:24 christos Exp $ */
|
||||
/* $NetBSD: screg_1185.h,v 1.7 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
|
@ -53,33 +53,25 @@
|
|||
# define SCSI_BASE 0xe1900000
|
||||
#endif
|
||||
|
||||
#ifndef U_CHAR
|
||||
#ifdef __mips__
|
||||
#define U_CHAR volatile u_char
|
||||
#else
|
||||
#define U_CHAR u_char
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define sc_statr *( (U_CHAR *)(SCSI_BASE + 0x0) )
|
||||
#define sc_comr *( (U_CHAR *)(SCSI_BASE + 0x0) )
|
||||
#define sc_datr *( (U_CHAR *)(SCSI_BASE + 0x1) )
|
||||
#define sc_intrq1 *( (U_CHAR *)(SCSI_BASE + 0x2) )
|
||||
#define sc_intrq2 *( (U_CHAR *)(SCSI_BASE + 0x3) )
|
||||
#define sc_envir *( (U_CHAR *)(SCSI_BASE + 0x3) )
|
||||
#define sc_cmonr *( (U_CHAR *)(SCSI_BASE + 0x4) )
|
||||
#define sc_timer *( (U_CHAR *)(SCSI_BASE + 0x4) )
|
||||
#define sc_ffstr *( (U_CHAR *)(SCSI_BASE + 0x5) )
|
||||
#define sc_idenr *( (U_CHAR *)(SCSI_BASE + 0x6) )
|
||||
#define sc_tclow *( (U_CHAR *)(SCSI_BASE + 0x7) )
|
||||
#define sc_tcmid *( (U_CHAR *)(SCSI_BASE + 0x8) )
|
||||
#define sc_tchi *( (U_CHAR *)(SCSI_BASE + 0x9) )
|
||||
#define sc_intok1 *( (U_CHAR *)(SCSI_BASE + 0xa) )
|
||||
#define sc_intok2 *( (U_CHAR *)(SCSI_BASE + 0xb) )
|
||||
#define sc_moder *( (U_CHAR *)(SCSI_BASE + 0xc) )
|
||||
#define sc_syncr *( (U_CHAR *)(SCSI_BASE + 0xd) )
|
||||
#define sc_busconr *( (U_CHAR *)(SCSI_BASE + 0xe) )
|
||||
#define sc_ioptr *( (U_CHAR *)(SCSI_BASE + 0xf) )
|
||||
#define sc_statr *((volatile uint8_t *)(SCSI_BASE + 0x0))
|
||||
#define sc_comr *((volatile uint8_t *)(SCSI_BASE + 0x0))
|
||||
#define sc_datr *((volatile uint8_t *)(SCSI_BASE + 0x1))
|
||||
#define sc_intrq1 *((volatile uint8_t *)(SCSI_BASE + 0x2))
|
||||
#define sc_intrq2 *((volatile uint8_t *)(SCSI_BASE + 0x3))
|
||||
#define sc_envir *((volatile uint8_t *)(SCSI_BASE + 0x3))
|
||||
#define sc_cmonr *((volatile uint8_t *)(SCSI_BASE + 0x4))
|
||||
#define sc_timer *((volatile uint8_t *)(SCSI_BASE + 0x4))
|
||||
#define sc_ffstr *((volatile uint8_t *)(SCSI_BASE + 0x5))
|
||||
#define sc_idenr *((volatile uint8_t *)(SCSI_BASE + 0x6))
|
||||
#define sc_tclow *((volatile uint8_t *)(SCSI_BASE + 0x7))
|
||||
#define sc_tcmid *((volatile uint8_t *)(SCSI_BASE + 0x8))
|
||||
#define sc_tchi *((volatile uint8_t *)(SCSI_BASE + 0x9))
|
||||
#define sc_intok1 *((volatile uint8_t *)(SCSI_BASE + 0xa))
|
||||
#define sc_intok2 *((volatile uint8_t *)(SCSI_BASE + 0xb))
|
||||
#define sc_moder *((volatile uint8_t *)(SCSI_BASE + 0xc))
|
||||
#define sc_syncr *((volatile uint8_t *)(SCSI_BASE + 0xd))
|
||||
#define sc_busconr *((volatile uint8_t *)(SCSI_BASE + 0xe))
|
||||
#define sc_ioptr *((volatile uint8_t *)(SCSI_BASE + 0xf))
|
||||
|
||||
/*
|
||||
* CXD1185Q Register bit assignment
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: scsi_1185.c,v 1.18 2005/12/11 12:18:24 christos Exp $ */
|
||||
/* $NetBSD: scsi_1185.c,v 1.19 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -53,7 +53,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: scsi_1185.c,v 1.18 2005/12/11 12:18:24 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: scsi_1185.c,v 1.19 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -74,6 +74,8 @@ __KERNEL_RCSID(0, "$NetBSD: scsi_1185.c,v 1.18 2005/12/11 12:18:24 christos Exp
|
|||
#include <newsmips/dev/screg_1185.h>
|
||||
#include <newsmips/dev/scsireg.h>
|
||||
|
||||
#include "ioconf.h"
|
||||
|
||||
#if defined(news3400)
|
||||
# include <newsmips/dev/dmac_0448.h>
|
||||
# ifndef NDMACMAP
|
||||
|
@ -130,8 +132,6 @@ static int dmac_map_init = 0;
|
|||
|
||||
#define SEL_TIMEOUT_VALUE 0x7a
|
||||
|
||||
extern struct cfdriver sc_cd;
|
||||
|
||||
void sc_send(struct sc_scb *, int, int);
|
||||
int scintr(void);
|
||||
void scsi_hardreset(void);
|
||||
|
@ -144,7 +144,7 @@ static int WAIT_STATR_BITSET(int);
|
|||
static void SET_CMD(struct sc_softc *, int);
|
||||
static void SET_CNT(int);
|
||||
static int GET_CNT(void);
|
||||
static void GET_INTR(volatile int *, volatile int *);
|
||||
static void GET_INTR(uint8_t *, uint8_t *);
|
||||
static void sc_start(struct sc_softc *);
|
||||
static void sc_resel(struct sc_softc *);
|
||||
static void sc_discon(struct sc_softc *);
|
||||
|
@ -167,18 +167,18 @@ extern void sc_done(struct sc_scb *);
|
|||
extern paddr_t kvtophys(vaddr_t);
|
||||
|
||||
#if defined(__mips__) && defined(CPU_SINGLE)
|
||||
#define dma_reset(x) { \
|
||||
#define dma_reset(x) do { \
|
||||
int __s = splscsi(); \
|
||||
dmac_gsel = (x); dmac_cctl = DM_RST; dmac_cctl = 0; \
|
||||
splx(__s); \
|
||||
}
|
||||
} while (/* CONSTCOND */ 0)
|
||||
#endif
|
||||
|
||||
int
|
||||
WAIT_STATR_BITCLR(int bitmask)
|
||||
{
|
||||
int iloop;
|
||||
volatile int dummy;
|
||||
uint8_t dummy;
|
||||
|
||||
iloop = 0;
|
||||
do {
|
||||
|
@ -194,7 +194,7 @@ int
|
|||
WAIT_STATR_BITSET(int bitmask)
|
||||
{
|
||||
int iloop;
|
||||
volatile int dummy;
|
||||
uint8_t dummy;
|
||||
|
||||
iloop = 0;
|
||||
do {
|
||||
|
@ -231,7 +231,7 @@ SET_CNT(int COUNT)
|
|||
int
|
||||
GET_CNT(void)
|
||||
{
|
||||
volatile int COUNT;
|
||||
int COUNT;
|
||||
|
||||
COUNT = sc_tclow;
|
||||
DMAC_WAIT0;
|
||||
|
@ -243,7 +243,7 @@ GET_CNT(void)
|
|||
}
|
||||
|
||||
void
|
||||
GET_INTR(volatile int *DATA1, volatile int *DATA2)
|
||||
GET_INTR(uint8_t *DATA1, uint8_t *DATA2)
|
||||
{
|
||||
|
||||
(void)WAIT_STATR_BITCLR(R0_CIP);
|
||||
|
@ -264,12 +264,12 @@ sc_send(struct sc_scb *scb, int chan, int ie)
|
|||
struct sc_chan_stat *cs;
|
||||
struct scsipi_xfer *xs;
|
||||
int i;
|
||||
u_char *p;
|
||||
uint8_t *p;
|
||||
|
||||
cs = &sc->chan_stat[chan];
|
||||
xs = scb->xs;
|
||||
|
||||
p = (u_char *)xs->cmd;
|
||||
p = (uint8_t *)xs->cmd;
|
||||
if (cs->scb != NULL) {
|
||||
printf("SCSI%d: sc_send() NOT NULL cs->sc\n", chan);
|
||||
printf("ie=0x%x scb=%p cs->sc=%p\n", ie, scb, cs->scb);
|
||||
|
@ -339,8 +339,8 @@ void
|
|||
sc_start(struct sc_softc *sc)
|
||||
{
|
||||
struct sc_chan_stat *cs;
|
||||
int chan, dummy;
|
||||
int s;
|
||||
int chan, s;
|
||||
uint8_t dummy;
|
||||
|
||||
s = splscsi();
|
||||
cs = get_wb_chan(sc);
|
||||
|
@ -410,13 +410,13 @@ int
|
|||
scintr(void)
|
||||
{
|
||||
int iloop;
|
||||
volatile int chan;
|
||||
volatile int dummy;
|
||||
int chan;
|
||||
uint8_t dummy;
|
||||
struct sc_softc *sc;
|
||||
struct sc_chan_stat *cs;
|
||||
int s_int1, s_int2;
|
||||
uint8_t s_int1, s_int2;
|
||||
|
||||
sc = sc_cd.cd_devs[0]; /* XXX */
|
||||
sc = device_lookup_private(&sc_cd, 0); /* XXX */
|
||||
|
||||
scintr_loop:
|
||||
|
||||
|
@ -461,7 +461,8 @@ scintr_loop:
|
|||
}
|
||||
|
||||
cs = get_wb_chan(sc);
|
||||
if (cs) chan = cs->chan_num;
|
||||
if (cs)
|
||||
chan = cs->chan_num;
|
||||
|
||||
if (cs && (sc->sel_stat[chan] == SEL_START) &&
|
||||
(sc->lastcmd == SCMD_SEL_ATN)) {
|
||||
|
@ -664,7 +665,7 @@ scsi_hardreset(void)
|
|||
#endif
|
||||
struct sc_softc *sc;
|
||||
|
||||
sc = sc_cd.cd_devs[0]; /* XXX */
|
||||
sc = device_lookup_private(&sc_cd, 0); /* XXX */
|
||||
s = splscsi();
|
||||
|
||||
scsi_chipreset(sc);
|
||||
|
@ -679,8 +680,8 @@ scsi_hardreset(void)
|
|||
for (i = 0; i < NDMACMAP; i++) {
|
||||
# if defined(__mips__) && defined(CPU_SINGLE)
|
||||
dmac_gsel = CH_SCSI;
|
||||
dmac_ctag = (u_char)i;
|
||||
dmac_cmap = (u_short)0;
|
||||
dmac_ctag = (uint8_t)i;
|
||||
dmac_cmap = (uint16_t)0;
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
@ -702,14 +703,14 @@ void
|
|||
scsi_chipreset(struct sc_softc *sc)
|
||||
{
|
||||
int s;
|
||||
volatile int save_ioptr;
|
||||
uint8_t save_ioptr;
|
||||
|
||||
s = splscsi();
|
||||
|
||||
#if defined(__mips__) && defined(CPU_SINGLE)
|
||||
dmac_gsel = CH_SCSI;
|
||||
dmac_cwid = 4; /* initialize DMAC SCSI chan */
|
||||
*(unsigned volatile char *)PINTEN |= DMA_INTEN;
|
||||
*(volatile uint8_t *)PINTEN |= DMA_INTEN;
|
||||
dma_reset(CH_SCSI);
|
||||
#endif
|
||||
sc_envir = 0; /* 1/4 clock */
|
||||
|
@ -759,7 +760,7 @@ scsi_chipreset(struct sc_softc *sc)
|
|||
void
|
||||
scsi_softreset(struct sc_softc *sc)
|
||||
{
|
||||
volatile struct sc_chan_stat *cs;
|
||||
struct sc_chan_stat *cs;
|
||||
int i;
|
||||
/* int (*handler)(); */
|
||||
|
||||
|
@ -811,8 +812,8 @@ void
|
|||
sc_resel(struct sc_softc *sc)
|
||||
{
|
||||
struct sc_chan_stat *cs;
|
||||
volatile int chan;
|
||||
volatile int statr;
|
||||
uint8_t chan;
|
||||
uint8_t statr;
|
||||
int iloop;
|
||||
|
||||
sc->min_flag = 0;
|
||||
|
@ -895,9 +896,9 @@ sc_resel(struct sc_softc *sc)
|
|||
void
|
||||
sc_discon(struct sc_softc *sc)
|
||||
{
|
||||
volatile struct sc_chan_stat *cs;
|
||||
struct sc_chan_stat *cs;
|
||||
/* int (*handler)(); */
|
||||
volatile int dummy;
|
||||
uint8_t dummy;
|
||||
|
||||
/*
|
||||
* Signal reflection on BSY has occurred.
|
||||
|
@ -932,7 +933,7 @@ sc_discon(struct sc_softc *sc)
|
|||
|
||||
if ((sc->sel_stat[cs->chan_num] != SEL_SUCCESS)
|
||||
&& (sc->sel_stat[cs->chan_num] != SEL_TIMEOUT))
|
||||
printf("sc_discon: eh!\n");
|
||||
printf("%s: eh!\n", __func__);
|
||||
|
||||
/*
|
||||
* indicate abnormal terminate
|
||||
|
@ -977,9 +978,9 @@ void
|
|||
sc_pmatch(struct sc_softc *sc)
|
||||
{
|
||||
struct sc_chan_stat *cs;
|
||||
volatile int phase;
|
||||
volatile int phase2;
|
||||
volatile int cmonr;
|
||||
uint8_t phase;
|
||||
uint8_t phase2;
|
||||
uint8_t cmonr;
|
||||
|
||||
sc->int_stat2 &= ~R3_FNC; /* XXXXXXXX */
|
||||
|
||||
|
@ -1050,9 +1051,9 @@ sc_pmatch(struct sc_softc *sc)
|
|||
void
|
||||
flush_fifo(struct sc_softc *sc)
|
||||
{
|
||||
volatile int dummy;
|
||||
volatile int tmp;
|
||||
volatile int tmp0;
|
||||
uint8_t dummy;
|
||||
uint8_t tmp;
|
||||
uint8_t tmp0;
|
||||
|
||||
dummy = sc_ffstr;
|
||||
DMAC_WAIT0;
|
||||
|
@ -1080,8 +1081,8 @@ sc_cout(struct sc_softc *sc, struct sc_chan_stat *cs)
|
|||
{
|
||||
int iloop;
|
||||
int cdb_bytes;
|
||||
volatile int dummy;
|
||||
volatile int statr;
|
||||
uint8_t dummy;
|
||||
uint8_t statr;
|
||||
struct scsipi_xfer *xs;
|
||||
|
||||
if (cs->comflg == CF_SET) {
|
||||
|
@ -1167,7 +1168,7 @@ sc_min(struct sc_softc *sc, struct sc_chan_stat *cs)
|
|||
{
|
||||
struct sc_scb *scb = cs->scb;
|
||||
struct scsipi_xfer *xs = scb->xs;
|
||||
volatile int dummy;
|
||||
uint8_t dummy;
|
||||
|
||||
sc_intok2 = Rb_FNC|Rb_DCNT|Rb_SRST|Rb_PHC|Rb_SPE|Rb_RMSG;
|
||||
DMAC_WAIT0;
|
||||
|
@ -1192,7 +1193,7 @@ sc_min(struct sc_softc *sc, struct sc_chan_stat *cs)
|
|||
dummy = sc_statr;
|
||||
DMAC_WAIT0;
|
||||
} while (dummy & R0_CIP);
|
||||
GET_INTR(&sc->int_stat1, &sc->int_stat2); /* clear interrupt */
|
||||
GET_INTR(&sc->int_stat1, &sc->int_stat2); /* clear interrupt */
|
||||
} while ((sc->int_stat2 & R3_FNC) == 0);
|
||||
sc->int_stat2 &= ~R3_FNC;
|
||||
|
||||
|
@ -1222,7 +1223,7 @@ sc_min(struct sc_softc *sc, struct sc_chan_stat *cs)
|
|||
/* Extended Message */
|
||||
sc->min_cnt[cs->chan_num] = GET_MIN_COUNT;
|
||||
sc->min_point[cs->chan_num] = scb->msgbuf;
|
||||
bzero(scb->msgbuf, 8);
|
||||
memset(scb->msgbuf, 0, 8);
|
||||
*sc->min_point[cs->chan_num]++ = dummy;
|
||||
} else {
|
||||
switch ((dummy & MSG_IDENT)? MSG_IDENT : dummy) {
|
||||
|
@ -1324,9 +1325,9 @@ sc_mout(struct sc_softc *sc, struct sc_chan_stat *cs)
|
|||
u_char *mp;
|
||||
int cnt;
|
||||
int iloop;
|
||||
volatile int dummy;
|
||||
volatile int tmp;
|
||||
volatile int tmp0;
|
||||
uint8_t dummy;
|
||||
uint8_t tmp;
|
||||
uint8_t tmp0;
|
||||
|
||||
flush_fifo(sc);
|
||||
|
||||
|
@ -1444,7 +1445,7 @@ sc_mout(struct sc_softc *sc, struct sc_chan_stat *cs)
|
|||
void
|
||||
sc_sin(struct sc_softc *sc, volatile struct sc_chan_stat *cs)
|
||||
{
|
||||
volatile int dummy;
|
||||
uint8_t dummy;
|
||||
int iloop;
|
||||
|
||||
flush_fifo(sc);
|
||||
|
@ -1484,12 +1485,12 @@ sc_sin(struct sc_softc *sc, volatile struct sc_chan_stat *cs)
|
|||
void
|
||||
sc_dio(struct sc_softc *sc, volatile struct sc_chan_stat *cs)
|
||||
{
|
||||
volatile struct sc_scb *scb;
|
||||
struct sc_scb *scb;
|
||||
int i;
|
||||
int pages;
|
||||
u_int tag;
|
||||
u_int pfn;
|
||||
volatile int phase;
|
||||
uint8_t tag;
|
||||
uint32_t pfn;
|
||||
uint8_t phase;
|
||||
struct scsipi_xfer *xs;
|
||||
|
||||
scb = cs->scb;
|
||||
|
@ -1536,11 +1537,11 @@ sc_dio(struct sc_softc *sc, volatile struct sc_chan_stat *cs)
|
|||
|
||||
#if defined(__mips__) && defined(CPU_SINGLE)
|
||||
dmac_gsel = CH_SCSI;
|
||||
dmac_ctrcl = (u_char)(cs->act_trcnt & 0xff);
|
||||
dmac_ctrcm = (u_char)((cs->act_trcnt >> 8) & 0xff);
|
||||
dmac_ctrch = (u_char)((cs->act_trcnt >> 16) & 0x0f);
|
||||
dmac_cofsh = (u_char)((cs->act_offset >> 8) & 0xf);
|
||||
dmac_cofsl = (u_char)(cs->act_offset & 0xff);
|
||||
dmac_ctrcl = (uint8_t)(cs->act_trcnt & 0xff);
|
||||
dmac_ctrcm = (uint8_t)((cs->act_trcnt >> 8) & 0xff);
|
||||
dmac_ctrch = (uint8_t)((cs->act_trcnt >> 16) & 0x0f);
|
||||
dmac_cofsh = (uint8_t)((cs->act_offset >> 8) & 0xf);
|
||||
dmac_cofsl = (uint8_t)(cs->act_offset & 0xff);
|
||||
#endif
|
||||
tag = 0;
|
||||
|
||||
|
@ -1554,15 +1555,15 @@ sc_dio(struct sc_softc *sc, volatile struct sc_chan_stat *cs)
|
|||
panic("SCSI:sc_dma() zero entry");
|
||||
#if defined(__mips__) && defined(CPU_SINGLE)
|
||||
dmac_gsel = CH_SCSI;
|
||||
dmac_ctag = (u_char)tag++;
|
||||
dmac_cmap = (u_short)pfn;
|
||||
dmac_ctag = (uint8_t)tag++;
|
||||
dmac_cmap = (uint16_t)pfn;
|
||||
#endif
|
||||
}
|
||||
#ifdef MAP_OVER_ACCESS
|
||||
# if defined(__mips__) && defined(CPU_SINGLE)
|
||||
dmac_gsel = CH_SCSI;
|
||||
dmac_ctag = (u_char)tag++;
|
||||
dmac_cmap = (u_short)pfn;
|
||||
dmac_ctag = (uint8_t)tag++;
|
||||
dmac_cmap = (uint16_t)pfn;
|
||||
# endif
|
||||
#endif
|
||||
} else {
|
||||
|
@ -1574,8 +1575,8 @@ sc_dio(struct sc_softc *sc, volatile struct sc_chan_stat *cs)
|
|||
for (i = 0; i < pages; i++) {
|
||||
#if defined(__mips__) && defined(CPU_SINGLE)
|
||||
dmac_gsel = CH_SCSI;
|
||||
dmac_ctag = (u_char)tag++;
|
||||
dmac_cmap = (u_short)pfn + i;
|
||||
dmac_ctag = (uint8_t)tag++;
|
||||
dmac_cmap = (uint8_t)pfn + i;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1615,7 +1616,7 @@ sc_dio(struct sc_softc *sc, volatile struct sc_chan_stat *cs)
|
|||
void
|
||||
sc_dio_pad(struct sc_softc *sc, volatile struct sc_chan_stat *cs)
|
||||
{
|
||||
int dummy;
|
||||
uint8_t dummy;
|
||||
|
||||
if (cs->act_trcnt >= 0)
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: scsireg.h,v 1.11 2007/03/04 06:00:26 christos Exp $ */
|
||||
/* $NetBSD: scsireg.h,v 1.12 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -203,21 +203,21 @@
|
|||
#endif
|
||||
|
||||
struct sc_map {
|
||||
u_int mp_offset;
|
||||
u_int mp_pages;
|
||||
u_int mp_addr[NSCMAP]; /* page number */
|
||||
volatile uint32_t mp_offset;
|
||||
volatile uint32_t mp_pages;
|
||||
volatile uint32_t mp_addr[NSCMAP]; /* page number */
|
||||
};
|
||||
|
||||
struct sc_chan_stat {
|
||||
struct sc_chan_stat *wb_next; /* wait bus channel queue */
|
||||
struct sc_scb *scb; /* scsi struct address */
|
||||
u_int stcnt; /* save transfer count */
|
||||
u_char *spoint; /* save transfer point */
|
||||
uint8_t *spoint; /* save transfer point */
|
||||
u_int stag; /* save tag register */
|
||||
u_int soffset; /* save offset register */
|
||||
int chan_num; /* channel NO. */
|
||||
u_char comflg; /* flag for save comand pointer */
|
||||
u_char intr_flg; /* interrupt flag. SCSI_INTEN/INTDIS */
|
||||
uint8_t comflg; /* flag for save comand pointer */
|
||||
uint8_t intr_flg; /* interrupt flag. SCSI_INTEN/INTDIS */
|
||||
};
|
||||
|
||||
struct sc_scb {
|
||||
|
@ -227,27 +227,27 @@ struct sc_scb {
|
|||
|
||||
struct sc_softc *scb_softc;
|
||||
struct sc_map *sc_map;
|
||||
u_char *sc_cpoint; /* pointer to buffer address */
|
||||
uint8_t *sc_cpoint; /* pointer to buffer address */
|
||||
u_int sc_ctrnscnt; /* transfer count */
|
||||
u_int sc_ctag;
|
||||
u_int sc_coffset;
|
||||
|
||||
u_char istatus;
|
||||
u_char tstatus;
|
||||
u_char identify;
|
||||
u_char message;
|
||||
u_char msgbuf[20];
|
||||
uint8_t istatus;
|
||||
uint8_t tstatus;
|
||||
uint8_t identify;
|
||||
uint8_t message;
|
||||
uint8_t msgbuf[20];
|
||||
};
|
||||
|
||||
#define NTARGET 8
|
||||
|
||||
struct sc_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
struct scsipi_channel sc_channel;
|
||||
struct scsipi_adapter sc_adapter;
|
||||
|
||||
TAILQ_HEAD(scb_list, sc_scb) ready_list, free_list;
|
||||
struct sc_scb sc_scb[3*NTARGET];
|
||||
struct sc_scb sc_scb[3 * NTARGET];
|
||||
|
||||
int inuse[NTARGET];
|
||||
struct sc_map sc_map[NTARGET];
|
||||
|
@ -269,15 +269,15 @@ struct sc_softc {
|
|||
struct sc_chan_stat *wbq_actf; /* forword active pointer */
|
||||
struct sc_chan_stat *wbq_actl; /* last active pointer */
|
||||
|
||||
u_char *act_cmd_pointer;
|
||||
u_char *min_point[NTARGET];
|
||||
uint8_t *act_cmd_pointer;
|
||||
uint8_t *min_point[NTARGET];
|
||||
int pad_cnt[NTARGET];
|
||||
char min_cnt[NTARGET];
|
||||
char sync_tr[NTARGET]; /* sync/async flag */
|
||||
char mout_flag[NTARGET];
|
||||
char perr_flag[NTARGET];
|
||||
int int_stat1;
|
||||
int int_stat2;
|
||||
int8_t min_cnt[NTARGET];
|
||||
uint8_t sync_tr[NTARGET]; /* sync/async flag */
|
||||
uint8_t mout_flag[NTARGET];
|
||||
uint8_t perr_flag[NTARGET];
|
||||
uint8_t int_stat1;
|
||||
uint8_t int_stat2;
|
||||
int min_flag;
|
||||
int lastcmd;
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mainbus.c,v 1.10 2005/12/11 12:18:25 christos Exp $ */
|
||||
/* $NetBSD: mainbus.c,v 1.11 2008/04/09 15:40:30 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.10 2005/12/11 12:18:25 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.11 2008/04/09 15:40:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -39,23 +39,19 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.10 2005/12/11 12:18:25 christos Exp $"
|
|||
#include <machine/autoconf.h>
|
||||
#include <machine/apbus.h>
|
||||
|
||||
struct mainbus_softc {
|
||||
struct device sc_dev;
|
||||
};
|
||||
|
||||
/* Definition of the mainbus driver. */
|
||||
static int mbmatch(struct device *, struct cfdata *, void *);
|
||||
static void mbattach(struct device *, struct device *, void *);
|
||||
static int mbmatch(device_t, cfdata_t, void *);
|
||||
static void mbattach(device_t, device_t, void *);
|
||||
static int mbprint(void *, const char *);
|
||||
|
||||
CFATTACH_DECL(mainbus, sizeof(struct mainbus_softc),
|
||||
CFATTACH_DECL_NEW(mainbus, 0,
|
||||
mbmatch, mbattach, NULL, NULL);
|
||||
|
||||
/* There can be only one. */
|
||||
static int mainbus_found;
|
||||
|
||||
static int
|
||||
mbmatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
mbmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
|
||||
if (mainbus_found)
|
||||
|
@ -65,16 +61,15 @@ mbmatch(struct device *parent, struct cfdata *cf, void *aux)
|
|||
}
|
||||
|
||||
static void
|
||||
mbattach(struct device *parent, struct device *self, void *aux)
|
||||
mbattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct device *mb = self;
|
||||
struct confargs nca;
|
||||
|
||||
mainbus_found = 1;
|
||||
printf("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
nca.ca_name = "cpu";
|
||||
config_found(mb, &nca, mbprint);
|
||||
config_found(self, &nca, mbprint);
|
||||
|
||||
/* XXX */
|
||||
if (_sip != NULL) {
|
||||
|
|
Loading…
Reference in New Issue