Port-ia64 archive

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

pchb@acpi support for ia64



Hi! Jukka and all,


Please support pchb@acpi for ia64.

pchb%acpi-support.diff@localhost include pchb_acpi.c.  And some fixes.

  1. Call acpi_pcidev_scan() before acpi_rescan1().
     It scan the PCI Root Bridge and obtain PCI Bus number.

  2. Add aa_dmat and aa_dmat64 to acpi's attach_args.

  3. Pass through it, if PCI Root Bridge not have valid ADR.


My zx6000 boot log:
  ftp://ftp.netbsd.org/pub/NetBSD/misc/kiyohara/ia64/typescript-20100628


I will commit pchb@acpi on the next weekend if you do not have the
problem. With the pci support for ia64.


By the way, The debug message of ACPI is very noisy.  Can I start
more quietly?  X-<

    :
  [ACPI Debug]  Integer 0x00000000
  [ACPI Debug]  String [0x21] "PARS.GPTR: Getting SERIAL DEV Ptr"
  [ACPI Debug]  String [0x1F] "PARS.GUID: evaluating for COMP1"
    :
  [ACPI Debug] ...


And, a lot of PCI devices will be added to ia64 GENERIC soon by me.  ;-)
--
kiyohara
? pchb_acpi.c
Index: acpi.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpi.c,v
retrieving revision 1.203
diff -u -r1.203 acpi.c
--- acpi.c      10 Jun 2010 20:36:55 -0000      1.203
+++ acpi.c      29 Jun 2010 05:46:45 -0000
@@ -458,6 +458,8 @@
 
        sc->sc_iot = aa->aa_iot;
        sc->sc_memt = aa->aa_memt;
+       sc->sc_dmat = aa->aa_dmat;
+       sc->sc_dmat64 = aa->aa_dmat64;
        sc->sc_pc = aa->aa_pc;
        sc->sc_pciflags = aa->aa_pciflags;
        sc->sc_ic = aa->aa_ic;
@@ -675,14 +677,14 @@
        (void)AcpiWalkNamespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, UINT32_MAX,
            acpi_make_devnode, acpi_make_devnode_post, &awc, NULL);
 
+       (void)acpi_pcidev_scan(sc->sc_root);
+
        /*
         * Scan the internal namespace.
         */
        acpi_rescan1(sc, NULL, NULL);
        acpi_rescan_capabilities(sc);
 
-       (void)acpi_pcidev_scan(sc->sc_root);
-
        acpi_print_devnodes(sc);
        acpi_print_tree(sc->sc_root, 0);
 }
@@ -1023,6 +1025,8 @@
                aa.aa_node = ad;
                aa.aa_iot = sc->sc_iot;
                aa.aa_memt = sc->sc_memt;
+               aa.aa_dmat = sc->sc_dmat;
+               aa.aa_dmat64 = sc->sc_dmat64;
                aa.aa_pc = sc->sc_pc;
                aa.aa_pciflags = sc->sc_pciflags;
                aa.aa_ic = sc->sc_ic;
Index: acpi_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpi_pci.c,v
retrieving revision 1.12
diff -u -r1.12 acpi_pci.c
--- acpi_pci.c  9 Jun 2010 04:20:10 -0000       1.12
+++ acpi_pci.c  29 Jun 2010 05:46:46 -0000
@@ -164,7 +164,8 @@
        ACPI_STATUS rv;
 
        if (ad->ad_devinfo->Type != ACPI_TYPE_DEVICE ||
-           !(ad->ad_devinfo->Valid & ACPI_VALID_ADR)) {
+           !((ad->ad_devinfo->Valid & ACPI_VALID_ADR) ||
+           (ad->ad_devinfo->Flags & ACPI_PCI_ROOT_BRIDGE))) {
                ad->ad_pciinfo = NULL;
                goto rec;
        }
Index: acpivar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpivar.h,v
retrieving revision 1.57
diff -u -r1.57 acpivar.h
--- acpivar.h   8 Jun 2010 16:55:02 -0000       1.57
+++ acpivar.h   29 Jun 2010 05:46:46 -0000
@@ -59,6 +59,8 @@
 struct acpibus_attach_args {
        bus_space_tag_t          aa_iot;        /* PCI I/O space tag */
        bus_space_tag_t          aa_memt;       /* PCI MEM space tag */
+       bus_dma_tag_t            aa_dmat;       /* PCI DMA tag */
+       bus_dma_tag_t            aa_dmat64;     /* PCI 64bit DMA tag */
        pci_chipset_tag_t        aa_pc;         /* PCI chipset */
        int                      aa_pciflags;   /* PCI bus flags */
        isa_chipset_tag_t        aa_ic;         /* ISA chipset */
@@ -129,6 +131,8 @@
 
        bus_space_tag_t          sc_iot;        /* PCI I/O space tag */
        bus_space_tag_t          sc_memt;       /* PCI MEM space tag */
+       bus_dma_tag_t            sc_dmat;       /* PCI DMA tag */
+       bus_dma_tag_t            sc_dmat64;     /* PCI 64bit DMA tag */
        pci_chipset_tag_t        sc_pc;         /* PCI chipset tag */
        int                      sc_pciflags;   /* PCI bus flags */
        int                      sc_pci_bus;    /* internal PCI fixup */
@@ -155,6 +159,8 @@
        struct acpi_devnode *aa_node;   /* ACPI device node */
        bus_space_tag_t aa_iot;         /* PCI I/O space tag */
        bus_space_tag_t aa_memt;        /* PCI MEM space tag */
+       bus_dma_tag_t aa_dmat;          /* PCI DMA tag */
+       bus_dma_tag_t aa_dmat64;        /* PCI 64bit DMA tag */
        pci_chipset_tag_t aa_pc;        /* PCI chipset tag */
        int aa_pciflags;                /* PCI bus flags */
        isa_chipset_tag_t aa_ic;        /* ISA chipset */
Index: files.acpi
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/files.acpi,v
retrieving revision 1.75
diff -u -r1.75 files.acpi
--- files.acpi  31 May 2010 20:32:29 -0000      1.75
+++ files.acpi  29 Jun 2010 05:46:46 -0000
@@ -167,4 +167,8 @@
 attach acpismbus at acpinodebus
 file   dev/acpi/smbus_acpi.c           acpismbus
 
+# PCI Root Bridge
+attach pchb at acpinodebus with pchb_acpi
+file   dev/acpi/pchb_acpi.c            pchb_acpi
+
 include        "dev/acpi/wmi/files.wmi"
--- pchb_acpi.c.orig    1970-01-01 09:00:00.000000000 +0900
+++ pchb_acpi.c 2010-06-28 21:18:15.000000000 +0900
@@ -0,0 +1,97 @@
+/*     $NetBSD$        */
+/*
+ * Copyright (c) 2010 KIYOHARA Takashi
+ * All rights reserved.
+ *
+ * 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$");
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/errno.h>
+
+#include <dev/acpi/acpivar.h>
+#include <dev/pci/pcivar.h>
+
+
+struct pchb_acpi_softc {
+       device_t sc_dev;
+};
+
+
+static int pchb_acpi_match(device_t, struct cfdata *, void *);
+static void pchb_acpi_attach(device_t, device_t, void *);
+
+
+CFATTACH_DECL_NEW(pchb_acpi, sizeof(struct pchb_acpi_softc),
+    pchb_acpi_match, pchb_acpi_attach, NULL, NULL);
+
+/*
+ * Supported device IDs
+ */
+static const char * const pchb_acpi_ids[] = {
+       "PNP0A03",      /* PCI/PCI-X Host Bridge */
+       "PNP0A08",      /* PCI Express/PCI-X Mode-2 Host Bridge */
+       NULL
+};
+
+
+/* ARGSUSED */
+static int
+pchb_acpi_match(device_t parent, struct cfdata *match, void *aux)
+{
+       struct acpi_attach_args *aa = aux;
+       struct acpi_devnode *ad = aa->aa_node;
+
+       if (ad->ad_type != ACPI_TYPE_DEVICE)
+               return 0;
+
+       if (ad->ad_devinfo->Flags & ACPI_PCI_ROOT_BRIDGE)
+               /* If we are ACPI_PCI_ROOT_BRIDGE, it is always the truth. */
+               return acpi_match_hid(ad->ad_devinfo, pchb_acpi_ids);
+       return 0;
+}
+
+/* ARGSUSED */
+static void
+pchb_acpi_attach(device_t parent, device_t self, void *aux)
+{
+       struct acpi_attach_args *aa = aux;
+       struct acpi_devnode *ad = aa->aa_node;
+       struct acpi_pci_info *ap = ad->ad_pciinfo;
+       struct pcibus_attach_args pba;
+
+       aprint_naive("\n");
+       aprint_normal(": ACPI Host-PCI Bridge\n");
+
+       pba.pba_iot = aa->aa_iot;
+       pba.pba_memt = aa->aa_memt;
+       pba.pba_dmat = aa->aa_dmat;
+       pba.pba_dmat64 = aa->aa_dmat64;
+       pba.pba_pc = aa->aa_pc;
+       pba.pba_flags = aa->aa_pciflags;
+       pba.pba_bus = ap->ap_bus;
+       pba.pba_bridgetag = NULL;
+       config_found_ia(self, "pcibus", &pba, pcibusprint);
+}
Index: conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/conf/GENERIC,v
retrieving revision 1.4
diff -u -r1.4 GENERIC
--- conf/GENERIC        17 May 2010 11:41:28 -0000      1.4
+++ conf/GENERIC        29 Jun 2010 05:45:59 -0000
@@ -56,8 +56,8 @@
 
 # These options enable verbose messages for several subsystems.
 # Warning, these may compile large string tables into the kernel!
-options        ACPIVERBOSE     # verbose ACPI device autoconfig messages
-
+#options       ACPIVERBOSE     # verbose ACPI device autoconfig messages
+options        PCIVERBOSE      # verbose PCI device autoconfig messages
 
 # Kernel root file system and dump configuration.
 config         netbsd  root on ? type ?
@@ -77,9 +77,10 @@
 # ACPI devices
 acpitz*                at acpi?                # ACPI Thermal Zone
 com*           at acpi?                # Serial communications interface
+pchb*          at acpi?                # PCI Root Bridge
 
-# PCI bus support
-#pci*          at mainbus? bus ?
+# PCI Bus support
+pci*           at pchb? bus ?
 
 # Pull in optional local configuration
 cinclude "arch/ia64/conf/GENERIC.local"
Index: conf/files.ia64
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/conf/files.ia64,v
retrieving revision 1.5
diff -u -r1.5 files.ia64
--- conf/files.ia64     20 Jul 2009 04:41:36 -0000      1.5
+++ conf/files.ia64     29 Jun 2010 05:45:59 -0000
@@ -84,6 +84,12 @@
 # PCI fixup options                    # XXXXXX: Oops, required by acpi.c
 defflag opt_pcifixup.h                 ACPI_PCI_FIXUP
 
+# PCI Root Bridge 
+device pchb: pcibus
 include "dev/acpi/files.acpi"
 
+include "dev/i2o/files.i2o"            # XXXXXX: Oops, required by pci
+
+include "dev/pci/files.pci"
+
 include "arch/ia64/conf/majors.ia64"
Index: ia64/mainbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/ia64/mainbus.c,v
retrieving revision 1.8
diff -u -r1.8 mainbus.c
--- ia64/mainbus.c      17 May 2010 11:46:19 -0000      1.8
+++ ia64/mainbus.c      29 Jun 2010 05:45:59 -0000
@@ -118,12 +118,14 @@
 
        aaa.aa_iot = IA64_BUS_SPACE_IO;
        aaa.aa_memt = IA64_BUS_SPACE_MEM;
-       aaa.aa_pc = 0;
+       aaa.aa_dmat = 0;        /* XXXX */
+       aaa.aa_dmat64 = 0;      /* XXXX */
+       aaa.aa_pc = 0;          /* XXXX */
        aaa.aa_pciflags =
            PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
            PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY |
            PCI_FLAGS_MWI_OKAY;
-       aaa.aa_ic = 0;
+       aaa.aa_ic = 0;          /* XXXX */
        config_found_ia(self, "acpibus", &aaa, 0);
 #endif
 


Home | Main Index | Thread Index | Old Index