File: [local] / sys / arch / vax / vxt / vxtbus.c (download)
Revision 1.1.1.1 (vendor branch), Tue Mar 4 16:08:34 2008 UTC (16 years, 4 months ago) by nbrk
Branch: OPENBSD_4_2_BASE, MAIN
CVS Tags: jornada-partial-support-wip, HEAD Changes since 1.1: +0 -0 lines
Import of OpenBSD 4.2 release kernel tree with initial code to support
Jornada 720/728, StrongARM 1110-based handheld PC.
At this point kernel roots on NFS and boots into vfs_mountroot() and traps.
What is supported:
- glass console, Jornada framebuffer (jfb) works in 16bpp direct color mode
(needs some palette tweaks for non black/white/blue colors, i think)
- saic, SA11x0 interrupt controller (needs cleanup)
- sacom, SA11x0 UART (supported only as boot console for now)
- SA11x0 GPIO controller fully supported (but can't handle multiple interrupt
handlers on one gpio pin)
- sassp, SSP port on SA11x0 that attaches spibus
- Jornada microcontroller (jmcu) to control kbd, battery, etc throught
the SPI bus (wskbd attaches on jmcu, but not tested)
- tod functions seem work
- initial code for SA-1111 (chip companion) : this is TODO
Next important steps, i think:
- gpio and intc on sa1111
- pcmcia support for sa11x0 (and sa1111 help logic)
- REAL root on nfs when we have PCMCIA support (we may use any of supported pccard NICs)
- root on wd0! (using already supported PCMCIA-ATA)
|
/* $OpenBSD: vxtbus.c,v 1.2 2006/08/30 19:23:57 miod Exp $ */
/*
* Copyright (c) 2006 Miodrag Vallat.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice, this permission notice, and the disclaimer below
* appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/evcount.h>
#include <sys/queue.h>
#include <machine/cpu.h>
#include <machine/nexus.h>
#include <machine/scb.h>
#include <vax/vxt/vxtbusvar.h>
struct vxtbus_softc {
struct device sc_dev;
LIST_HEAD(, vxtbus_ih) sc_intrlist;
};
void vxtbus_attach(struct device *, struct device *, void *);
int vxtbus_match(struct device *, void*, void *);
struct cfdriver vxtbus_cd = {
NULL, "vxtbus", DV_DULL
};
struct cfattach vxtbus_ca = {
sizeof(struct vxtbus_softc), vxtbus_match, vxtbus_attach
};
void vxtbus_intr(void *);
int vxtbus_print(void *, const char *);
int
vxtbus_match(struct device *parent, void *vcf, void *aux)
{
struct mainbus_attach_args *maa = aux;
return (maa->maa_bustype == VAX_VXTBUS ? 1 : 0);
}
void
vxtbus_attach(struct device *parent, struct device *self, void *aux)
{
struct vxtbus_softc *sc = (void *)self;
struct bp_conf bp;
LIST_INIT(&sc->sc_intrlist);
scb_vecalloc(VXT_INTRVEC, vxtbus_intr, sc, SCB_ISTACK, NULL);
printf("\n");
bp.type = "sgec";
config_found(self, &bp, vxtbus_print);
bp.type = "qsc";
config_found(self, &bp, vxtbus_print);
bp.type = "lcspx";
config_found(self, &bp, vxtbus_print);
}
int
vxtbus_print(void *aux, const char *name)
{
struct bp_conf *bp = aux;
if (name)
printf("%s at %s", bp->type, name);
return (UNCONF);
}
/*
* VXT2000 interrupt code.
*
* All device interrupts end up on the same vector, which is controllable
* by the SC26C94 chip.
*
* Interrupts are handled at spl4 (ipl 0x14).
*
* The following routines implement shared interrupts for vxtbus subdevices.
*/
struct vxtbus_ih {
LIST_ENTRY(vxtbus_ih) ih_link;
int (*ih_fn)(void *);
void * ih_arg;
int ih_vec;
struct evcount ih_cnt;
};
void
vxtbus_intr_establish(const char *name, int ipl, int (*fn)(void *), void *arg)
{
struct vxtbus_softc *sc = (void *)vxtbus_cd.cd_devs[0];
struct vxtbus_ih *ih;
ih = (struct vxtbus_ih *)malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
ih->ih_fn = fn;
ih->ih_arg = arg;
ih->ih_vec = VXT_INTRVEC;
evcount_attach(&ih->ih_cnt, name, (void *)&ih->ih_vec, &evcount_intr);
LIST_INSERT_HEAD(&sc->sc_intrlist, ih, ih_link);
}
void
vxtbus_intr(void *arg)
{
struct vxtbus_softc *sc = arg;
struct vxtbus_ih *ih;
int rc;
#ifdef DIAGNOSTIC
int handled = 0;
static int strayintr = 0;
#endif
LIST_FOREACH(ih, &sc->sc_intrlist, ih_link) {
rc = (*ih->ih_fn)(ih->ih_arg);
if (rc != 0) {
#ifdef DIAGNOSTIC
handled = 1;
#endif
ih->ih_cnt.ec_count++;
if (rc > 0)
break;
}
}
#ifdef DIAGNOSTIC
if (handled == 0) {
if (++strayintr == 10)
panic("%s: too many stray interrupts",
sc->sc_dev.dv_xname);
else
printf("%s: stray interrupt\n", sc->sc_dev.dv_xname);
}
#endif
}