Implement CIA interrupts.

Obtained from: SRM console magic from NetBSD
This commit is contained in:
Doug Rabson 1998-07-12 16:17:54 +00:00
parent b46e6c4115
commit d19af714d3
2 changed files with 96 additions and 1 deletions

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
* $Id: cia.c,v 1.1 1998/07/05 12:16:14 dfr Exp $
*/
#include <sys/param.h>
@ -35,12 +35,15 @@
#include <alpha/pci/ciareg.h>
#include <alpha/pci/ciavar.h>
#include <machine/bwx.h>
#include <machine/intr.h>
#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa)
static devclass_t cia_devclass;
static device_t cia0; /* XXX only one for now */
extern void eb164_intr_enable(int irq);
extern void eb164_intr_disable(int irq);
static void cia_intr(void* frame, u_long vector);
struct cia_softc {
@ -179,12 +182,18 @@ cia_bwx_cfgwritel(u_int b, u_int s, u_int f, u_int r, u_int32_t data)
static int cia_probe(device_t dev);
static int cia_attach(device_t dev);
static void *cia_create_intr(device_t dev, device_t child, int irq, driver_intr_t *intr, void *arg);
static int cia_connect_intr(device_t dev, void* ih);
static device_method_t cia_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, cia_probe),
DEVMETHOD(device_attach, cia_attach),
/* Bus interface */
DEVMETHOD(bus_create_intr, cia_create_intr),
DEVMETHOD(bus_connect_intr, cia_connect_intr),
{ 0, 0 }
};
@ -226,6 +235,7 @@ cia_attach(device_t dev)
struct cia_softc* sc = CIA_SOFTC(dev);
cia_init();
chipset.bridge = dev;
sc->dmem_base = CIA_EV56_BWMEM;
sc->smem_base = CIA_PCI_SMEM1;
@ -237,9 +247,30 @@ cia_attach(device_t dev)
return 0;
}
static void *
cia_create_intr(device_t dev, device_t child,
int irq, driver_intr_t *intr, void *arg)
{
int vector = 0x900 + (irq << 4);
return alpha_create_intr(vector, intr, arg);
}
static int
cia_connect_intr(device_t dev, void* ih)
{
struct alpha_intr *i = ih;
int s = splhigh();
int error = alpha_connect_intr(i);
if (!error)
eb164_intr_enable((i->vector - 0x900) >> 4);
splx(s);
return error;
}
static void
cia_intr(void* frame, u_long vector)
{
alpha_dispatch_intr(vector);
}
DRIVER_MODULE(cia, root, cia_driver, cia_devclass, 0, 0);

View File

@ -0,0 +1,64 @@
/* $NetBSD: pci_eb164_intr.s,v 1.5 1997/09/02 13:19:42 thorpej Exp $ */
/*
* Copyright (c) 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.
*/
/*
* The description of how to enable and disable interrupts in the
* AlphaPC 164 motherboard technical reference manual is incorrect,
* at least for the OSF/1 PALcode.
*
* These functions were written by disassembling a Digital UNIX kernel's
* eb164_intrdsabl and eb164_intrenabl functions (because they had
* interesting names), and then playing with them to see how to call
* them correctly.
*
* It looks like the right thing to do is to call them with the interrupt
* request that you want to enable or disable (presumably in the range
* 0 -> 23, since there are 3 8-bit interrupt-enable bits in the
* interrupt mask PLD).
*/
#include <machine/asm.h>
__KERNEL_RCSID(0, "$NetBSD: pci_eb164_intr.s,v 1.5 1997/09/02 13:19:42 thorpej Exp $");
.text
LEAF(eb164_intr_enable,1)
mov a0, a1
ldiq a0, 0x34
call_pal PAL_cserve
RET
END(eb164_intr_enable)
.text
LEAF(eb164_intr_disable,1)
mov a0, a1
ldiq a0, 0x35
call_pal PAL_cserve
RET
END(eb164_intr_enable)