Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Remove bitrotted xen specific versions of pci, pcii...



details:   https://anonhg.NetBSD.org/src/rev/eccb5f3de12d
branches:  trunk
changeset: 827599:eccb5f3de12d
user:      cherry <cherry%NetBSD.org@localhost>
date:      Sat Nov 04 15:24:42 2017 +0000

description:
Remove bitrotted xen specific versions of pci, pciide machdep related code.

Use the common x86/ code instead.

diffstat:

 sys/arch/x86/pci/pciide_machdep.c   |    8 +-
 sys/arch/xen/conf/files.xen         |    8 +-
 sys/arch/xen/xen/pci_intr_machdep.c |  237 ------------------------------------
 sys/arch/xen/xen/pciide_machdep.c   |  127 -------------------
 4 files changed, 11 insertions(+), 369 deletions(-)

diffs (truncated from 442 to 300 lines):

diff -r cfef2d7d3322 -r eccb5f3de12d sys/arch/x86/pci/pciide_machdep.c
--- a/sys/arch/x86/pci/pciide_machdep.c Sat Nov 04 14:56:48 2017 +0000
+++ b/sys/arch/x86/pci/pciide_machdep.c Sat Nov 04 15:24:42 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pciide_machdep.c,v 1.16 2016/10/15 16:46:14 jdolecek Exp $     */
+/*     $NetBSD: pciide_machdep.c,v 1.17 2017/11/04 15:24:42 cherry Exp $       */
 
 /*
  * Copyright (c) 1998 Christopher G. Demetriou.  All rights reserved.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.16 2016/10/15 16:46:14 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.17 2017/11/04 15:24:42 cherry Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -61,6 +61,7 @@
 #include <machine/mpbiosvar.h>
 #endif
 
+#ifdef __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
 void *
 pciide_machdep_compat_intr_establish(device_t dev,
     const struct pci_attach_args *pa, int chan, int (*func)(void *),
@@ -96,7 +97,9 @@
            PCIIDE_CHANNEL_NAME(chan), irq);
        return cookie;
 }
+#endif /* __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH */
 
+#ifdef __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_DISESTABLISH
 void
 pciide_machdep_compat_intr_disestablish(device_t dev, pci_chipset_tag_t pc,
     int chan, void *cookie)
@@ -104,3 +107,4 @@
        isa_intr_disestablish(NULL, cookie);
        return;
 }
+#endif /* __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_DISESTABLISH */
diff -r cfef2d7d3322 -r eccb5f3de12d sys/arch/xen/conf/files.xen
--- a/sys/arch/xen/conf/files.xen       Sat Nov 04 14:56:48 2017 +0000
+++ b/sys/arch/xen/conf/files.xen       Sat Nov 04 15:24:42 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.xen,v 1.161 2017/11/04 14:56:48 cherry Exp $
+#      $NetBSD: files.xen,v 1.162 2017/11/04 15:24:42 cherry Exp $
 #      NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #      NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -232,7 +232,7 @@
 include "dev/i2o/files.i2o"
 include "dev/pci/files.pci"
 include "dev/pci/files.agp"
-file   arch/xen/xen/pciide_machdep.c   pciide_common
+file   arch/x86/pci/pciide_machdep.c   pciide_common
 
 device pciback {unit = -1}
 attach pciback at pci
@@ -382,7 +382,9 @@
 file   arch/xen/xen/privcmd.c          dom0ops
 file   arch/xen/x86/xen_shm_machdep.c  dom0ops
 file   arch/x86/pci/pci_machdep.c      hypervisor & pci & dom0ops
-file   arch/xen/xen/pci_intr_machdep.c hypervisor & pci
+file   arch/x86/pci/pci_intr_machdep.c hypervisor & pci
+file   arch/x86/pci/pci_msi_machdep.c  hypervisor & pci
+file   arch/x86/pci/msipic.c           hypervisor & pci
 file   arch/x86/isa/isa_machdep.c      hypervisor & dom0ops
 file   arch/xen/xen/xenevt.c           xenevt & dom0ops
 file   arch/xen/xen/xennetback_xenbus.c xvif
diff -r cfef2d7d3322 -r eccb5f3de12d sys/arch/xen/xen/pci_intr_machdep.c
--- a/sys/arch/xen/xen/pci_intr_machdep.c       Sat Nov 04 14:56:48 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,237 +0,0 @@
-/*      $NetBSD: pci_intr_machdep.c,v 1.21 2017/11/04 14:56:48 cherry Exp $      */
-
-/*
- * Copyright (c) 2005 Manuel Bouyer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.21 2017/11/04 14:56:48 cherry Exp $");
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <sys/bus.h>
-#include <machine/bus_private.h>
-
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcidevs.h>
-
-#include <xen/evtchn.h>
-
-#include "locators.h"
-#include "opt_ddb.h"
-#include "ioapic.h"
-#include "acpica.h"
-#include "opt_mpbios.h"
-#include "opt_acpi.h"
-
-#if NIOAPIC > 0
-#include <machine/i82093var.h>
-#include <machine/mpconfig.h>
-#include <machine/pic.h>
-#endif
-
-#ifdef MPBIOS
-#include <machine/mpbiosvar.h>
-#endif
-
-#if NACPICA > 0
-#include <machine/mpacpi.h>
-#endif
-
-/* XXX: cherry@: Hack - this is a symptom of lapic vs. ioapic
- * needing more code separation.
- */
-#if NIOAPIC > 0
-#define IRQ_LEGACY_IRQ(_irq) APIC_IRQ_LEGACY_IRQ(_irq)
-#else
-#define IRQ_LEGACY_IRQ(_irq) (_irq & 0xff)
-#endif
-
-int
-pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
-{
-       int pin;
-       int line;
-       int evtch;
-
-#if NIOAPIC > 0
-       int rawpin = pa->pa_rawintrpin;
-       pci_chipset_tag_t pc = pa->pa_pc;
-       int bus, dev, func;
-#endif
-
-       pin = pa->pa_intrpin;
-       line = pa->pa_intrline;
-#if 0 /* XXXX why is it always 0 ? */
-       if (pin == 0) {
-               /* No IRQ used */
-               goto bad;
-       }
-#endif
-       if (pin > PCI_INTERRUPT_PIN_MAX) {
-               printf("pci_intr_map: bad interrupt pin %d\n", pin);
-               goto bad;
-       }
-       *ihp = 0;
-
-#if NIOAPIC > 0
-       pci_decompose_tag(pc, pa->pa_tag, &bus, &dev, &func);
-       if (mp_busses != NULL) {
-               if (intr_find_mpmapping(bus, (dev<<2)|(rawpin-1), ihp) == 0) {
-                       if (*ihp & APIC_INT_VIA_APIC) {
-                               /* make sure a new IRQ will be allocated */
-                               *ihp &= ~0xff;
-                       } else {
-                               *ihp |= line;
-                       }
-                       goto end;
-               }
-               /*
-                * No explicit PCI mapping found. This is not fatal,
-                * we'll try the ISA (or possibly EISA) mappings next.
-                */
-       }
-#endif
-
-       if (line == 0 || line == X86_PCI_INTERRUPT_LINE_NO_CONNECTION) {
-               printf("pci_intr_map: no mapping for pin %c (line=%02x)\n",
-                   '@' + pin, line);
-               goto bad;
-       }
-#ifdef DOM0OPS
-       if (line >= NUM_LEGACY_IRQS) {
-               printf("pci_intr_map: bad interrupt line %d\n", line);
-               goto bad;
-       }
-#endif
-       if (line == 2) {
-               printf("pci_intr_map: changed line 2 to line 9\n");
-               line = 9;
-       }
-#if NIOAPIC > 0
-       if (mp_busses != NULL) {
-               if (intr_find_mpmapping(mp_isa_bus, line, ihp) == 0) {
-                       if ((*ihp & 0xff) == 0)
-                               *ihp |= line;
-                       goto end;
-               }
-               printf("pci_intr_map: bus %d dev %d func %d pin %d; line %d\n",
-                   bus, dev, func, pin, line);
-               printf("pci_intr_map: no MP mapping found\n");
-       }
-#endif /* NIOAPIC */
-
-       *ihp = line;
-
-#if NIOAPIC > 0
-end:
-#endif
-       evtch = xen_pirq_alloc((intr_handle_t *)ihp, IST_LEVEL);
-       if (evtch == -1)
-               goto bad;
-
-       return 0;
-
-bad:
-       *ihp = -1;
-       return 1;
-}
-
-const char *
-pci_intr_string(pci_chipset_tag_t pc, pci_intr_handle_t ih, char *buf,
-    size_t len)
-{
-       int evtch;
-
-       evtch = get_pirq_to_evtch(IRQ_LEGACY_IRQ(ih));
-#if NIOAPIC > 0
-       struct ioapic_softc *pic;
-       if (ih & APIC_INT_VIA_APIC) {
-               pic = ioapic_find(APIC_IRQ_APIC(ih));
-               if (pic == NULL) {
-                       printf("%s: bad ioapic %d\n", __func__,
-                           APIC_IRQ_APIC(ih));
-                       return NULL;
-               }
-               snprintf(buf, len, "%s pin %d, event channel %d",
-                   device_xname(pic->sc_dev), APIC_IRQ_PIN(ih),
-                   evtch);
-               return buf;
-       }
-#endif
-       snprintf(buf, len, "irq %"PRIu64", event channel %d",
-           ih, evtch);
-       return buf;
-}
-
-const struct evcnt*
-pci_intr_evcnt(pci_chipset_tag_t pcitag, pci_intr_handle_t intrh)
-{
-       return NULL;
-}
-
-int
-pci_intr_setattr(pci_chipset_tag_t pc, pci_intr_handle_t *ih,
-                int attr, uint64_t data)
-{
-
-       switch (attr) {
-       case PCI_INTR_MPSAFE:
-               return 0;
-       default:
-               return ENODEV;
-       }
-}
-
-void *
-pci_intr_establish(pci_chipset_tag_t pcitag, pci_intr_handle_t intrh,
-    int level, int (*func)(void *), void *arg)
-{
-       char evname[16];
-#if NIOAPIC > 0
-       struct ioapic_softc *pic;
-       if (intrh & APIC_INT_VIA_APIC) {
-               pic = ioapic_find(APIC_IRQ_APIC(intrh));
-               if (pic == NULL) {
-                       printf("pci_intr_establish: bad ioapic %d\n",
-                           APIC_IRQ_APIC(intrh));
-                       return NULL;
-               }
-               snprintf(evname, sizeof(evname), "%s pin %d",
-                   device_xname(pic->sc_dev), APIC_IRQ_PIN(intrh));
-       } else
-#endif



Home | Main Index | Thread Index | Old Index