Module Name:    src
Committed By:   dyoung
Date:           Thu Feb 25 20:51:10 UTC 2010

Modified Files:
        src/sys/arch/x86/pci: pci_intr_machdep.c pci_machdep.c

Log Message:
In the x86 pci(9) implementation, test for and call a
pci_chipset_tag_t's override functions.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/pci/pci_intr_machdep.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/x86/pci/pci_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/pci/pci_intr_machdep.c
diff -u src/sys/arch/x86/pci/pci_intr_machdep.c:1.14 src/sys/arch/x86/pci/pci_intr_machdep.c:1.15
--- src/sys/arch/x86/pci/pci_intr_machdep.c:1.14	Tue Aug 18 16:41:03 2009
+++ src/sys/arch/x86/pci/pci_intr_machdep.c	Thu Feb 25 20:51:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_intr_machdep.c,v 1.14 2009/08/18 16:41:03 jmcneill Exp $	*/
+/*	$NetBSD: pci_intr_machdep.c,v 1.15 2010/02/25 20:51:10 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2009 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.14 2009/08/18 16:41:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.15 2010/02/25 20:51:10 dyoung Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -115,12 +115,15 @@
 {
 	int pin = pa->pa_intrpin;
 	int line = pa->pa_intrline;
+	pci_chipset_tag_t pc;
 #if NIOAPIC > 0 || NACPICA > 0
 	int rawpin = pa->pa_rawintrpin;
-	pci_chipset_tag_t pc = pa->pa_pc;
 	int bus, dev, func;
 #endif
 
+	if ((pc = pa->pa_pc) != NULL && pc->pc_intr_map != NULL)
+		return (*pc->pc_intr_map)(pa, ihp);
+
 	if (pin == 0) {
 		/* No IRQ used. */
 		goto bad;
@@ -207,6 +210,9 @@
 const char *
 pci_intr_string(pci_chipset_tag_t pc, pci_intr_handle_t ih)
 {
+	if (pc != NULL && pc->pc_intr_string != NULL)
+		return (*pc->pc_intr_string)(pc, ih);
+
 	return intr_string(ih & ~MPSAFE_MASK);
 }
 
@@ -215,6 +221,9 @@
 pci_intr_evcnt(pci_chipset_tag_t pc, pci_intr_handle_t ih)
 {
 
+	if (pc != NULL && pc->pc_intr_evcnt != NULL)
+		return (*pc->pc_intr_evcnt)(pc, ih);
+
 	/* XXX for now, no evcnt parent reported */
 	return NULL;
 }
@@ -249,6 +258,9 @@
 #endif
 	bool mpsafe;
 
+	if (pc != NULL && pc->pc_intr_establish != NULL)
+		return (*pc->pc_intr_establish)(pc, ih, level, func, arg);
+
 	pic = &i8259_pic;
 	pin = irq = (ih & ~MPSAFE_MASK);
 	mpsafe = ((ih & MPSAFE_MASK) != 0);
@@ -277,5 +289,10 @@
 pci_intr_disestablish(pci_chipset_tag_t pc, void *cookie)
 {
 
+	if (pc != NULL && pc->pc_intr_disestablish != NULL) {
+		(*pc->pc_intr_disestablish)(pc, cookie);
+		return;
+	}
+
 	intr_disestablish(cookie);
 }

Index: src/sys/arch/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.39 src/sys/arch/x86/pci/pci_machdep.c:1.40
--- src/sys/arch/x86/pci/pci_machdep.c:1.39	Tue Feb 16 19:29:40 2010
+++ src/sys/arch/x86/pci/pci_machdep.c	Thu Feb 25 20:51:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.39 2010/02/16 19:29:40 dyoung Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.40 2010/02/25 20:51:10 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.39 2010/02/16 19:29:40 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.40 2010/02/25 20:51:10 dyoung Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -344,6 +344,9 @@
 {
 	pcitag_t tag;
 
+	if (pc != NULL && pc->pc_make_tag != NULL)
+		return (*pc->pc_make_tag)(pc, bus, device, function);
+
 	switch (pci_mode) {
 	case 1:
 		if (bus >= 256 || device >= 32 || function >= 8)
@@ -370,6 +373,11 @@
     int *bp, int *dp, int *fp)
 {
 
+	if (pc != NULL && pc->pc_decompose_tag != NULL) {
+		(*pc->pc_decompose_tag)(pc, tag, bp, dp, fp);
+		return;
+	}
+
 	switch (pci_mode) {
 	case 1:
 		if (bp != NULL)
@@ -400,6 +408,10 @@
 	int s;
 
 	KASSERT((reg & 0x3) == 0);
+
+	if (pc != NULL && pc->pc_conf_read != NULL)
+		return (*pc->pc_conf_read)(pc, tag, reg);
+
 #if defined(__i386__) && defined(XBOX)
 	if (arch_i386_is_xbox) {
 		int bus, dev, fn;
@@ -424,6 +436,12 @@
 	int s;
 
 	KASSERT((reg & 0x3) == 0);
+
+	if (pc != NULL && pc->pc_conf_write != NULL) {
+		(*pc->pc_conf_write)(pc, tag, reg, data);
+		return;
+	}
+
 #if defined(__i386__) && defined(XBOX)
 	if (arch_i386_is_xbox) {
 		int bus, dev, fn;

Reply via email to