summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2006-01-06 20:30:10 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2006-01-06 20:30:10 +0000
commit3d968d723dbeb3379884001adc825a01b6513dce (patch)
tree0c9661c900e7ac3eb2c685ec694ac749e9623335 /sys/arch/sparc64/dev
parent8a17126475421e14e9472dc99164709f0466ed56 (diff)
Don't add the same function twice when ordering the functions of a PCI device.
Prevents alipm(4) attaching twice on Blade-100. ok deraadt@
Diffstat (limited to 'sys/arch/sparc64/dev')
-rw-r--r--sys/arch/sparc64/dev/pci_machdep.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/arch/sparc64/dev/pci_machdep.c b/sys/arch/sparc64/dev/pci_machdep.c
index 359e7373808..7b7c6469a75 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.20 2005/09/04 20:40:53 brad Exp $ */
+/* $OpenBSD: pci_machdep.c,v 1.21 2006/01/06 20:30:09 kettenis Exp $ */
/* $NetBSD: pci_machdep.c,v 1.22 2001/07/20 00:07:13 eeh Exp $ */
/*
@@ -159,7 +159,8 @@ pci_dev_funcorder(pc, busno, device, funcs)
char *funcs;
{
struct ofw_pci_register reg;
- int node, len, i = 0;
+ int node, len, function, i = 0;
+ u_int8_t done = 0;
#ifdef DEBUG
char name[80];
#endif
@@ -188,7 +189,14 @@ pci_dev_funcorder(pc, busno, device, funcs)
if (device != OFW_PCI_PHYS_HI_DEVICE(reg.phys_hi))
continue;
- funcs[i++] = OFW_PCI_PHYS_HI_FUNCTION(reg.phys_hi);
+
+ function = OFW_PCI_PHYS_HI_FUNCTION(reg.phys_hi);
+
+ if (done & (1 << function))
+ continue;
+
+ funcs[i++] = function;
+ done |= 1 << function;
#ifdef DEBUG
if (sparc_pci_debug & SPDB_PROBE) {
OF_getprop(node, "name", &name, sizeof(name));