summaryrefslogtreecommitdiff
path: root/sys/arch/alpha/pci/pci_axppci_33.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-06-18 09:45:47 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-06-18 09:45:47 +0000
commit41ae123ec2d77615cd0b0476ff62564bd7a4865f (patch)
treeba6a57d3a8d7d725a5e0ae64e8401ed3bea0efb9 /sys/arch/alpha/pci/pci_axppci_33.c
parent7a0b7f798c45842a34a4c6413f45e1b3824154a5 (diff)
sync to 0616, retaining local diffs
Diffstat (limited to 'sys/arch/alpha/pci/pci_axppci_33.c')
-rw-r--r--sys/arch/alpha/pci/pci_axppci_33.c168
1 files changed, 93 insertions, 75 deletions
diff --git a/sys/arch/alpha/pci/pci_axppci_33.c b/sys/arch/alpha/pci/pci_axppci_33.c
index 2cfb453226b..008f5111636 100644
--- a/sys/arch/alpha/pci/pci_axppci_33.c
+++ b/sys/arch/alpha/pci/pci_axppci_33.c
@@ -1,10 +1,10 @@
-/* $NetBSD: pci_axppci_33.c,v 1.2 1995/12/24 02:29:43 mycroft Exp $ */
+/* $NetBSD: pci_axppci_33.c,v 1.5 1996/04/23 14:15:28 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
- * Author: Jeffrey Hsu
+ * Authors: Jeffrey Hsu and Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
@@ -35,6 +35,9 @@
#include <sys/device.h>
#include <vm/vm.h>
+#include <machine/bus.h>
+#include <machine/intr.h>
+
#include <dev/isa/isavar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
@@ -42,47 +45,74 @@
#include <alpha/pci/lcavar.h>
#include <alpha/pci/pci_axppci_33.h>
-
#include <alpha/pci/siovar.h>
+#include <alpha/pci/sioreg.h>
#include "sio.h"
-void *dec_axppci_33_pci_map_int __P((void *, pci_conftag_t,
- pci_intr_pin_t, pci_intr_line_t, int,
- int (*func)(void *), void *, char *));
-void dec_axppci_33_pci_unmap_int __P((void *, void *));
+int dec_axppci_33_intr_map __P((void *, pcitag_t, int, int,
+ pci_intr_handle_t *));
+const char *dec_axppci_33_intr_string __P((void *, pci_intr_handle_t));
+void *dec_axppci_33_intr_establish __P((void *, pci_intr_handle_t,
+ int, int (*func)(void *), void *));
+void dec_axppci_33_intr_disestablish __P((void *, void *));
-__const struct pci_intr_fns dec_axppci_33_pci_intr_fns = {
- dec_axppci_33_pci_map_int,
- dec_axppci_33_pci_unmap_int,
-};
+#define LCA_SIO_DEVICE 7 /* XXX */
-void *
-dec_axppci_33_pci_map_int(lcv, tag, pin, line, level, func, arg, what)
+void
+pci_axppci_33_pickintr(lcp)
+ struct lca_config *lcp;
+{
+ bus_chipset_tag_t bc = &lcp->lc_bc;
+ pci_chipset_tag_t pc = &lcp->lc_pc;
+ pcireg_t sioclass;
+ int sioII;
+
+ /* XXX MAGIC NUMBER */
+ sioclass = pci_conf_read(pc, pci_make_tag(pc, 0, LCA_SIO_DEVICE, 0),
+ PCI_CLASS_REG);
+ sioII = (sioclass & 0xff) >= 3;
+
+ if (!sioII)
+ printf("WARNING: SIO NOT SIO II... NO BETS...\n");
+
+ pc->pc_intr_v = lcp;
+ pc->pc_intr_map = dec_axppci_33_intr_map;
+ pc->pc_intr_string = dec_axppci_33_intr_string;
+ pc->pc_intr_establish = dec_axppci_33_intr_establish;
+ pc->pc_intr_disestablish = dec_axppci_33_intr_disestablish;
+
+#if NSIO
+ sio_intr_setup(bc);
+ set_iointr(&sio_iointr);
+#else
+ panic("pci_axppci_33_pickintr: no I/O interrupt handler (no sio)");
+#endif
+}
+
+int
+dec_axppci_33_intr_map(lcv, bustag, buspin, line, ihp)
void *lcv;
- pci_conftag_t tag;
- pci_intr_pin_t pin;
- pci_intr_line_t line;
- int level;
- int (*func) __P((void *));
- void *arg;
- char *what;
+ pcitag_t bustag;
+ int buspin, line;
+ pci_intr_handle_t *ihp;
{
struct lca_config *lcp = lcv;
- int bus, device, pirq;
- pci_confreg_t irreg, pirqreg;
+ pci_chipset_tag_t pc = &lcp->lc_pc;
+ int device, pirq;
+ pcireg_t pirqreg;
u_int8_t pirqline;
- if (pin == 0) {
+ if (buspin == 0) {
/* No IRQ used. */
- return 0;
+ return 1;
}
- if (pin > 4) {
- printf("dec_axppci_33_map_int: bad interrupt pin %d\n", pin);
- return NULL;
+ if (buspin > 4) {
+ printf("pci_map_int: bad interrupt pin %d\n", buspin);
+ return 1;
}
- device = PCI_TAG_DEVICE(tag);
+ pci_decompose_tag(pc, bustag, NULL, &device, NULL);
switch (device) {
case 6: /* NCR SCSI */
@@ -90,7 +120,7 @@ dec_axppci_33_pci_map_int(lcv, tag, pin, line, level, func, arg, what)
break;
case 11: /* slot 1 */
- switch (pin) {
+ switch (buspin) {
case PCI_INTERRUPT_PIN_A:
case PCI_INTERRUPT_PIN_D:
pirq = 0;
@@ -105,7 +135,7 @@ dec_axppci_33_pci_map_int(lcv, tag, pin, line, level, func, arg, what)
break;
case 12: /* slot 2 */
- switch (pin) {
+ switch (buspin) {
case PCI_INTERRUPT_PIN_A:
case PCI_INTERRUPT_PIN_D:
pirq = 1;
@@ -120,7 +150,7 @@ dec_axppci_33_pci_map_int(lcv, tag, pin, line, level, func, arg, what)
break;
case 8: /* slot 3 */
- switch (pin) {
+ switch (buspin) {
case PCI_INTERRUPT_PIN_A:
case PCI_INTERRUPT_PIN_D:
pirq = 2;
@@ -139,66 +169,54 @@ dec_axppci_33_pci_map_int(lcv, tag, pin, line, level, func, arg, what)
panic("dec_axppci_33_pci_map_int: bad device number");
}
-#define LCA_SIO_DEVICE 7 /* XXX */
-
- pirqreg = PCI_CONF_READ(lcp->lc_conffns, lcp->lc_confarg,
- PCI_MAKE_TAG(0, LCA_SIO_DEVICE, 0), 0x60); /* XXX */
+ pirqreg = pci_conf_read(pc, pci_make_tag(pc, 0, LCA_SIO_DEVICE, 0),
+ SIO_PCIREG_PIRQ_RTCTRL);
#if 0
- printf("dec_pci_axppci_33_map_int: device %d pin %c: pirq %d, reg = %x\n",
- device, '@' + pin, pirq, pirqreg);
+ printf("pci_axppci_33_map_int: device %d pin %c: pirq %d, reg = %x\n",
+ device, '@' + buspin, pirq, pirqreg);
#endif
pirqline = (pirqreg >> (pirq * 8)) & 0xff;
if ((pirqline & 0x80) != 0)
- return 0; /* not routed? */
+ return 1; /* not routed? */
pirqline &= 0xf;
#if 0
- printf("dec_pci_axppci_33_map_int: device %d pin %c: mapped to line %d\n",
- device, '@' + pin, pirqline);
+ printf("pci_axppci_33_map_int: device %d pin %c: mapped to line %d\n",
+ device, '@' + buspin, pirqline);
#endif
-#if NSIO
- return ISA_INTR_ESTABLISH(&sio_isa_intr_fns, NULL, /* XXX */
- pirqline, IST_LEVEL, level, func, arg);
-#else
- panic("dec_axppci_33_pci_map_int: no sio!");
-#endif
+ *ihp = pirqline;
+ return (0);
}
-void
-dec_axppci_33_pci_unmap_int(pifa, cookie)
- void *pifa;
- void *cookie;
+const char *
+dec_axppci_33_intr_string(lcv, ih)
+ void *lcv;
+ pci_intr_handle_t ih;
{
+ struct lca_config *lcp = lcv;
- panic("dec_axppci_33_pci_unmap_int not implemented"); /* XXX */
+ return sio_intr_string(NULL /*XXX*/, ih);
}
-void
-pci_axppci_33_pickintr(pcf, pcfa, ppf, ppfa, pifp, pifap)
- __const struct pci_conf_fns *pcf;
- __const struct pci_pio_fns *ppf;
- void *pcfa, *ppfa;
- __const struct pci_intr_fns **pifp;
- void **pifap;
+void *
+dec_axppci_33_intr_establish(lcv, ih, level, func, arg)
+ void *lcv, *arg;
+ pci_intr_handle_t ih;
+ int level;
+ int (*func) __P((void *));
{
- pci_confreg_t sioclass;
- int sioII;
+ struct lca_config *lcp = lcv;
- /* XXX MAGIC NUMBER */
- sioclass = PCI_CONF_READ(pcf, pcfa, PCI_MAKE_TAG(0, LCA_SIO_DEVICE, 0),
- PCI_CLASS_REG);
- sioII = (sioclass & 0xff) >= 3;
+ return sio_intr_establish(NULL /*XXX*/, ih, IST_LEVEL, level, func,
+ arg);
+}
- if (!sioII)
- printf("WARNING: SIO NOT SIO II... NO BETS...\n");
+void
+dec_axppci_33_intr_disestablish(lcv, cookie)
+ void *lcv, *cookie;
+{
+ struct lca_config *lcp = lcv;
- *pifp = &dec_axppci_33_pci_intr_fns;
- *pifap = pcfa; /* XXX assumes apecs_config ptr */
-#if NSIO
- sio_intr_setup(ppf, ppfa);
- set_iointr(&sio_iointr);
-#else
- panic("pci_axppci_33_pickintr: no I/O interrupt handler (no sio)");
-#endif
+ sio_intr_disestablish(NULL /*XXX*/, cookie);
}