summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2004-12-02 02:41:03 +0000
committerBrad Smith <brad@cvs.openbsd.org>2004-12-02 02:41:03 +0000
commitb82e3bee10b38d4c4af1ed87c910e8fb7dc53861 (patch)
tree88e18f37597a4987f4b03273ce5d64a9f9eb5878
parent5be4aaa7d145a69c784aa2e4ac65453b5c39e9d3 (diff)
Add pci_decompose_tag() for sparc64.
From NetBSD ok deraadt@
-rw-r--r--sys/arch/sparc64/dev/pci_machdep.c17
-rw-r--r--sys/arch/sparc64/dev/vgafb.c4
-rw-r--r--sys/arch/sparc64/include/pci_machdep.h12
3 files changed, 25 insertions, 8 deletions
diff --git a/sys/arch/sparc64/dev/pci_machdep.c b/sys/arch/sparc64/dev/pci_machdep.c
index 867053bd25a..f77530f81fb 100644
--- a/sys/arch/sparc64/dev/pci_machdep.c
+++ b/sys/arch/sparc64/dev/pci_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.c,v 1.14 2003/06/24 21:54:39 henric Exp $ */
+/* $OpenBSD: pci_machdep.c,v 1.15 2004/12/02 02:41:02 brad Exp $ */
/* $NetBSD: pci_machdep.c,v 1.22 2001/07/20 00:07:13 eeh Exp $ */
/*
@@ -336,6 +336,21 @@ pci_make_tag(pc, b, d, f)
return (tag);
}
+void
+pci_decompose_tag(pc, tag, bp, dp, fp)
+ pci_chipset_tag_t pc;
+ pcitag_t tag;
+ int *bp, *dp, *fp;
+{
+
+ if (bp != NULL)
+ *bp = PCITAG_BUS(tag);
+ if (dp != NULL)
+ *dp = PCITAG_DEV(tag);
+ if (fp != NULL)
+ *fp = PCITAG_FUN(tag);
+}
+
/* assume we are mapped little-endian/side-effect */
pcireg_t
pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
diff --git a/sys/arch/sparc64/dev/vgafb.c b/sys/arch/sparc64/dev/vgafb.c
index 7cb33d541c2..efe9dd9ec9c 100644
--- a/sys/arch/sparc64/dev/vgafb.c
+++ b/sys/arch/sparc64/dev/vgafb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafb.c,v 1.36 2004/11/30 13:23:19 miod Exp $ */
+/* $OpenBSD: vgafb.c,v 1.37 2004/12/02 02:41:02 brad Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -225,7 +225,7 @@ vgafb_ioctl(v, cmd, data, flags, p)
sel = (struct pcisel *)data;
sel->pc_bus = PCITAG_BUS(sc->sc_pcitag);
sel->pc_dev = PCITAG_DEV(sc->sc_pcitag);
- sel->pc_func = PCITAG_FUNC(sc->sc_pcitag);
+ sel->pc_func = PCITAG_FUN(sc->sc_pcitag);
break;
case WSDISPLAYIO_SVIDEO:
diff --git a/sys/arch/sparc64/include/pci_machdep.h b/sys/arch/sparc64/include/pci_machdep.h
index b121e6c77de..8339e9f0461 100644
--- a/sys/arch/sparc64/include/pci_machdep.h
+++ b/sys/arch/sparc64/include/pci_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.h,v 1.12 2003/05/16 06:59:12 henric Exp $ */
+/* $OpenBSD: pci_machdep.h,v 1.13 2004/12/02 02:41:02 brad Exp $ */
/* $NetBSD: pci_machdep.h,v 1.7 2001/07/20 00:07:14 eeh Exp $ */
/*
@@ -33,7 +33,7 @@
#define _MACHINE_PCI_MACHDEP_H_
/*
- * We want to contro both device & function probe order.
+ * We want to control both device & function probe order.
*/
#define __PCI_BUS_DEVORDER
#define __PCI_DEV_FUNCORDER
@@ -60,10 +60,10 @@ typedef u_int pci_intr_handle_t;
*/
#define PCITAG_NODE(x) (int)(((x)>>32)&0xffffffff)
-#define PCITAG_BUS(t) (((t) >> 16) & 0xff)
-#define PCITAG_DEV(t) (((t) >> 11) & 0x1f)
-#define PCITAG_FUNC(t) (((t) >> 8) & 0x07)
#define PCITAG_OFFSET(x) ((x)&0xffffffff)
+#define PCITAG_BUS(t) ((PCITAG_OFFSET(t)>>16)&0xff)
+#define PCITAG_DEV(t) ((PCITAG_OFFSET(t)>>11)&0x1f)
+#define PCITAG_FUN(t) ((PCITAG_OFFSET(t)>>8)&0x7)
#define PCITAG_CREATE(n,b,d,f) (((u_int64_t)(n)<<32)|((b)<<16)|((d)<<11)|((f)<<8))
#define PCITAG_SETNODE(t,n) ((t)&0xffffffff)|(((n)<<32)
typedef u_int64_t pcitag_t;
@@ -87,6 +87,8 @@ int pci_dev_funcorder(pci_chipset_tag_t, int, int, char *);
#endif
int pci_bus_maxdevs(pci_chipset_tag_t, int);
pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int);
+void pci_decompose_tag(pci_chipset_tag_t, pcitag_t, int *, int *,
+ int *);
pcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
void pci_conf_write(pci_chipset_tag_t, pcitag_t, int,
pcireg_t);