Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/pci In the x86 pci(9) implementation, test for ...



details:   https://anonhg.NetBSD.org/src/rev/20aec74a2a86
branches:  trunk
changeset: 752424:20aec74a2a86
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Thu Feb 25 20:51:10 2010 +0000

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

diffstat:

 sys/arch/x86/pci/pci_intr_machdep.c |  23 ++++++++++++++++++++---
 sys/arch/x86/pci/pci_machdep.c      |  22 ++++++++++++++++++++--
 2 files changed, 40 insertions(+), 5 deletions(-)

diffs (140 lines):

diff -r d6f5ab0a7361 -r 20aec74a2a86 sys/arch/x86/pci/pci_intr_machdep.c
--- a/sys/arch/x86/pci/pci_intr_machdep.c       Thu Feb 25 20:48:58 2010 +0000
+++ b/sys/arch/x86/pci/pci_intr_machdep.c       Thu Feb 25 20:51:10 2010 +0000
@@ -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);
 }
diff -r d6f5ab0a7361 -r 20aec74a2a86 sys/arch/x86/pci/pci_machdep.c
--- a/sys/arch/x86/pci/pci_machdep.c    Thu Feb 25 20:48:58 2010 +0000
+++ b/sys/arch/x86/pci/pci_machdep.c    Thu Feb 25 20:51:10 2010 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index