summaryrefslogtreecommitdiff
path: root/sys/arch/alpha/pci/cia_pci.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1997-01-24 19:58:34 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1997-01-24 19:58:34 +0000
commit0ef244d8476654749f2eaf9441dc06b2fd4d4f7b (patch)
tree270851bce850e6dddd96484e78fa648cb8bec296 /sys/arch/alpha/pci/cia_pci.c
parenta77b8c21d70779c5365903c1f86d3c3126549212 (diff)
Sync with NetBSD 961207
Diffstat (limited to 'sys/arch/alpha/pci/cia_pci.c')
-rw-r--r--sys/arch/alpha/pci/cia_pci.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/sys/arch/alpha/pci/cia_pci.c b/sys/arch/alpha/pci/cia_pci.c
index ac66d48a0ea..353c5615a21 100644
--- a/sys/arch/alpha/pci/cia_pci.c
+++ b/sys/arch/alpha/pci/cia_pci.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: cia_pci.c,v 1.4 1996/10/30 22:39:56 niklas Exp $ */
-/* $NetBSD: cia_pci.c,v 1.5 1996/10/13 03:00:04 christos Exp $ */
+/* $OpenBSD: cia_pci.c,v 1.5 1997/01/24 19:57:39 niklas Exp $ */
+/* $NetBSD: cia_pci.c,v 1.7 1996/11/23 06:46:50 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -41,6 +41,9 @@
#include <alpha/pci/ciareg.h>
#include <alpha/pci/ciavar.h>
+#include <machine/rpb.h> /* XXX for eb164 CIA firmware workarounds. */
+#include "dec_eb164.h" /* XXX for eb164 CIA firmware workarounds. */
+
void cia_attach_hook __P((struct device *, struct device *,
struct pcibus_attach_args *));
int cia_bus_maxdevs __P((void *, int));
@@ -115,6 +118,34 @@ cia_conf_read(cpv, tag, offset)
pcireg_t *datap, data;
int s, secondary, ba;
int32_t old_haxr2; /* XXX */
+#if NDEC_EB164
+ extern int cputype; /* XXX */
+#endif
+
+#ifdef DIAGNOSTIC
+ s = 0; /* XXX gcc -Wuninitialized */
+ old_haxr2 = 0; /* XXX gcc -Wuninitialized */
+#endif
+
+#if NDEC_EB164
+ /*
+ * Some (apparently-common) revisions of EB164 firmware do the
+ * Wrong thing with PCI master aborts, which are caused by
+ * accesing the configuration space of devices that don't
+ * exist (for example).
+ *
+ * On EB164's we clear the CIA error register's PCI master
+ * abort bit before touching PCI configuration space and
+ * check it afterwards. If it indicates a master abort,
+ * the device wasn't there so we return 0xffffffff.
+ */
+ if (cputype == ST_EB164) {
+ /* clear the PCI master abort bit in CIA error register */
+ REGVAL(CIA_CSR_CIA_ERR) = 0x00000080; /* XXX */
+ alpha_mb();
+ alpha_pal_draina();
+ }
+#endif
/* secondary if bus # != 0 */
pci_decompose_tag(&ccp->cc_pc, tag, &secondary, 0, 0);
@@ -142,6 +173,17 @@ cia_conf_read(cpv, tag, offset)
splx(s);
}
+#if NDEC_EB164
+ if (cputype == ST_EB164) {
+ alpha_pal_draina();
+ /* check CIA error register for PCI master abort */
+ if (REGVAL(CIA_CSR_CIA_ERR) & 0x00000080) { /* XXX */
+ ba = 1;
+ data = 0xffffffff;
+ }
+ }
+#endif
+
#if 0
printf("cia_conf_read: tag 0x%lx, reg 0x%lx -> %x @ %p%s\n", tag, reg,
data, datap, ba ? " (badaddr)" : "");
@@ -162,6 +204,11 @@ cia_conf_write(cpv, tag, offset, data)
int s, secondary;
int32_t old_haxr2; /* XXX */
+#ifdef DIAGNOSTIC
+ s = 0; /* XXX gcc -Wuninitialized */
+ old_haxr2 = 0; /* XXX gcc -Wuninitialized */
+#endif
+
/* secondary if bus # != 0 */
pci_decompose_tag(&ccp->cc_pc, tag, &secondary, 0, 0);
if (secondary) {