File: [local] / sys / arch / alpha / pci / sio.c (download)
Revision 1.1.1.1 (vendor branch), Tue Mar 4 16:04:46 2008 UTC (16 years, 6 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: sio.c,v 1.31 2006/01/02 05:21:26 brad Exp $ */
/* $NetBSD: sio.c,v 1.15 1996/12/05 01:39:36 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
#include <machine/intr.h>
#include <machine/bus.h>
#include <dev/isa/isavar.h>
#include <dev/eisa/eisavar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
#include <alpha/pci/siovar.h>
#include "isadma.h"
struct sio_softc {
struct device sc_dv;
bus_space_tag_t sc_iot, sc_memt;
bus_dma_tag_t sc_dmat;
int sc_haseisa;
};
int siomatch(struct device *, void *, void *);
void sioattach(struct device *, struct device *, void *);
extern int sio_intr_alloc(isa_chipset_tag_t *, int, int, int *);
struct cfattach sio_ca = {
sizeof(struct sio_softc), siomatch, sioattach,
};
struct cfdriver sio_cd = {
NULL, "sio", DV_DULL,
};
int pcebmatch(struct device *, void *, void *);
struct cfattach pceb_ca = {
sizeof(struct sio_softc), pcebmatch, sioattach,
};
struct cfdriver pceb_cd = {
NULL, "pceb", DV_DULL,
};
union sio_attach_args {
const char *sa_name; /* XXX should be common */
struct isabus_attach_args sa_iba;
struct eisabus_attach_args sa_eba;
};
int sioprint(void *, const char *pnp);
void sio_isa_attach_hook(struct device *, struct device *,
struct isabus_attach_args *);
void sio_eisa_attach_hook(struct device *, struct device *,
struct eisabus_attach_args *);
int sio_eisa_maxslots(void *);
int sio_eisa_intr_map(void *, u_int, eisa_intr_handle_t *);
void sio_bridge_callback(struct device *);
int
siomatch(parent, match, aux)
struct device *parent;
void *match;
void *aux;
{
struct pci_attach_args *pa = aux;
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_CONTAQ &&
PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CONTAQ_82C693 &&
pa->pa_function == 0)
return (1);
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_INTEL &&
PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_SIO)
return (1);
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ALI &&
PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ALI_M1533)
return(1);
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ALI &&
PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ALI_M1543)
return(1);
return (0);
}
int
pcebmatch(parent, match, aux)
struct device *parent;
void *match;
void *aux;
{
struct pci_attach_args *pa = aux;
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_INTEL &&
PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_PCEB)
return (1);
return (0);
}
void
sioattach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct sio_softc *sc = (struct sio_softc *)self;
struct pci_attach_args *pa = aux;
printf("\n");
sc->sc_iot = pa->pa_iot;
sc->sc_memt = pa->pa_memt;
sc->sc_dmat = pa->pa_dmat;
sc->sc_haseisa = (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_INTEL &&
PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_PCEB);
evcount_attach(&sio_intr_count, self->dv_xname, NULL, &evcount_intr);
config_defer(self, sio_bridge_callback);
}
void
sio_bridge_callback(self)
struct device *self;
{
struct sio_softc *sc = (struct sio_softc *)self;
struct alpha_eisa_chipset ec;
struct alpha_isa_chipset ic;
union sio_attach_args sa;
if (sc->sc_haseisa) {
ec.ec_v = NULL;
ec.ec_attach_hook = sio_eisa_attach_hook;
ec.ec_maxslots = sio_eisa_maxslots;
ec.ec_intr_map = sio_eisa_intr_map;
ec.ec_intr_string = sio_intr_string;
ec.ec_intr_establish = sio_intr_establish;
ec.ec_intr_disestablish = sio_intr_disestablish;
sa.sa_eba.eba_busname = "eisa";
sa.sa_eba.eba_iot = sc->sc_iot;
sa.sa_eba.eba_memt = sc->sc_memt;
sa.sa_eba.eba_ec = &ec;
config_found(&sc->sc_dv, &sa.sa_eba, sioprint);
}
ic.ic_v = NULL;
ic.ic_attach_hook = sio_isa_attach_hook;
ic.ic_intr_establish = sio_intr_establish;
ic.ic_intr_disestablish = sio_intr_disestablish;
ic.ic_intr_alloc = sio_intr_alloc;
sa.sa_iba.iba_busname = "isa";
sa.sa_iba.iba_iot = sc->sc_iot;
sa.sa_iba.iba_memt = sc->sc_memt;
#if NISADMA > 0
sa.sa_iba.iba_dmat =
alphabus_dma_get_tag(sc->sc_dmat, ALPHA_BUS_ISA);
#endif
sa.sa_iba.iba_ic = ⁣
config_found(&sc->sc_dv, &sa.sa_iba, sioprint);
}
int
sioprint(aux, pnp)
void *aux;
const char *pnp;
{
register union sio_attach_args *sa = aux;
if (pnp)
printf("%s at %s", sa->sa_name, pnp);
return (UNCONF);
}
void
sio_isa_attach_hook(parent, self, iba)
struct device *parent, *self;
struct isabus_attach_args *iba;
{
/* Nothing to do. */
}
void
sio_eisa_attach_hook(parent, self, eba)
struct device *parent, *self;
struct eisabus_attach_args *eba;
{
/* Nothing to do. */
}
int
sio_eisa_maxslots(v)
void *v;
{
return 16; /* as good a number as any. only 8, maybe? */
}
int
sio_eisa_intr_map(v, irq, ihp)
void *v;
u_int irq;
eisa_intr_handle_t *ihp;
{
#define ICU_LEN 16 /* number of ISA IRQs (XXX) */
if (irq >= ICU_LEN) {
printf("sio_eisa_intr_map: bad IRQ %d\n", irq);
*ihp = -1;
return 1;
}
if (irq == 2) {
printf("sio_eisa_intr_map: changed IRQ 2 to IRQ 9\n");
irq = 9;
}
*ihp = irq;
return 0;
}