summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authordm <dm@cvs.openbsd.org>1997-06-18 19:07:08 +0000
committerdm <dm@cvs.openbsd.org>1997-06-18 19:07:08 +0000
commit1c75760df2aa97a8690075e9e6f2d176f48c3a59 (patch)
tree3aa38e8571bb5d149872d2ce355dc143439c4695 /sys/arch/i386
parent78972811db4829fdf182ea3527504c6c7987390a (diff)
csapuntz@lcs.mit.edu: Port of NetBSD tulip driver. Works with new (21140-AC-based) SMC Etherpower cards.
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/pci/pci_machdep.c46
-rw-r--r--sys/arch/i386/pci/pci_machdep.h4
2 files changed, 48 insertions, 2 deletions
diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c
index cafdd18922e..4a66aa2632b 100644
--- a/sys/arch/i386/pci/pci_machdep.c
+++ b/sys/arch/i386/pci/pci_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.c,v 1.9 1996/11/28 23:37:42 niklas Exp $ */
+/* $OpenBSD: pci_machdep.c,v 1.10 1997/06/18 19:07:01 dm Exp $ */
/* $NetBSD: pci_machdep.c,v 1.26 1996/10/24 12:32:29 fvdl Exp $ */
/*
@@ -141,6 +141,50 @@ mode2:
#endif
}
+void
+pci_decompose_tag(pc, tag, bp, dp, fp)
+ pci_chipset_tag_t pc;
+ pcitag_t tag;
+ int *bp, *dp, *fp;
+{
+
+#ifndef PCI_CONF_MODE
+ switch (pci_mode) {
+ case 1:
+ goto mode1;
+ case 2:
+ goto mode2;
+ default:
+ panic("pci_decompose_tag: mode not configured");
+ }
+#endif
+
+#if !defined(PCI_CONF_MODE) || (PCI_CONF_MODE == 1)
+#ifndef PCI_CONF_MODE
+mode1:
+#endif
+ if (bp != NULL)
+ *bp = (tag.mode1 >> 16) & 0xff;
+ if (dp != NULL)
+ *dp = (tag.mode1 >> 11) & 0x1f;
+ if (fp != NULL)
+ *fp = (tag.mode1 >> 8) & 0x7;
+ return;
+#endif
+
+#if !defined(PCI_CONF_MODE) || (PCI_CONF_MODE == 2)
+#ifndef PCI_CONF_MODE
+mode2:
+#endif
+ if (bp != NULL)
+ *bp = tag.mode2.forward & 0xff;
+ if (dp != NULL)
+ *dp = (tag.mode2.port >> 8) & 0xf;
+ if (fp != NULL)
+ *fp = (tag.mode2.enable >> 1) & 0x7;
+#endif
+}
+
pcireg_t
pci_conf_read(pc, tag, reg)
pci_chipset_tag_t pc;
diff --git a/sys/arch/i386/pci/pci_machdep.h b/sys/arch/i386/pci/pci_machdep.h
index e4c21cb3399..02e02048084 100644
--- a/sys/arch/i386/pci/pci_machdep.h
+++ b/sys/arch/i386/pci/pci_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.h,v 1.3 1996/04/21 22:17:34 deraadt Exp $ */
+/* $OpenBSD: pci_machdep.h,v 1.4 1997/06/18 19:07:02 dm Exp $ */
/* $NetBSD: pci_machdep.h,v 1.5 1996/03/27 04:01:16 cgd Exp $ */
/*
@@ -85,6 +85,8 @@ const char *pci_intr_string __P((pci_chipset_tag_t, pci_intr_handle_t));
void *pci_intr_establish __P((pci_chipset_tag_t, pci_intr_handle_t,
int, int (*)(void *), void *, char *));
void pci_intr_disestablish __P((pci_chipset_tag_t, void *));
+void pci_decompose_tag __P((pci_chipset_tag_t, pcitag_t,
+ int *, int *, int *));
/*
* Compatibility functions, to map the old i386 PCI functions to the new ones.