Current-Users archive

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

Re: pchb@acpi again



Hi!


From: KIYOHARA Takashi <kiyohara%kk.iij4u.or.jp@localhost>
Date: Sat, 13 Apr 2013 19:55:44 +0900 (JST)

> From: KIYOHARA Takashi <kiyohara%kk.iij4u.or.jp@localhost>
> Date: Tue, 09 Apr 2013 07:44:25 +0900 (JST)
> 
> > From: Chuck Silvers <chuq%chuq.com@localhost>
> > Date: Mon, 8 Apr 2013 09:34:06 -0700
> > 
> > > in acpi_pci.c, why do you need to skip the check for ACPI_VALID_ADR?
> > > does the ACPI info on ia64 not have that flag set when it should?
> > 
> > In my memory, YES.  :-<
> > But I can't access to my ia64 now.  I will try and check at next weekend.
> 
> In my ia64(zx6000), it looked that AcpiNsSearchAndEnter() returned
> AE_NOT_FOUND.
> How enable ACPI_DEBUG_PRINT or others many print?

I look this messages on my ia64. (e.g. PCI0)

_ADR Not found in 0xe00000003f9dd1e8 [Not adding]
Name [_ADR] not found in scope [PCI0] 0xe00000003f9dd1e8


I think that no this problem crops up by all ia64 machines.  Do you know
the better evasion method?
# Can I fixup by acpi_md_callback()?  I look and find that now.

Also my ia64 patch attach to this mail.


Thanks,
--
kiyohara
? ia64/bus_dma.c
Index: conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/conf/GENERIC,v
retrieving revision 1.5
diff -u -r1.5 GENERIC
--- conf/GENERIC        28 Apr 2012 23:03:40 -0000      1.5
+++ conf/GENERIC        14 Apr 2013 04:02:03 -0000
@@ -55,6 +55,7 @@
 # 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        PCIVERBOSE      # verbose PCI device autoconfig messages
 
 
 # Kernel root file system and dump configuration.
@@ -75,8 +76,10 @@
 # ACPI devices
 acpitz*                at acpi?                # ACPI Thermal Zone
 com*           at acpi?                # Serial communications interface
+pchb*          at acpi?
 
-# PCI bus support
-#pci*          at mainbus? bus ?
+# PCI Bus support
+pci*           at pchb?
+
 # 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.7
diff -u -r1.7 files.ia64
--- conf/files.ia64     1 Oct 2011 15:59:27 -0000       1.7
+++ conf/files.ia64     14 Apr 2013 04:02:03 -0000
@@ -86,6 +87,7 @@
 # PCI fixup options                    # XXXXXX: Oops, required by acpi.c
 defflag opt_pcifixup.h                 ACPI_PCI_FIXUP
 
+device pchb: pcibus
 include "dev/acpi/files.acpi"
 
 include "arch/ia64/conf/majors.ia64"
Index: ia64/autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/ia64/autoconf.c,v
retrieving revision 1.6
diff -u -r1.6 autoconf.c
--- ia64/autoconf.c     29 Jul 2012 18:05:43 -0000      1.6
+++ ia64/autoconf.c     14 Apr 2013 04:02:03 -0000
@@ -36,6 +36,13 @@
 #include <sys/device.h>
 #include <sys/conf.h>
 
+#include <dev/pci/pcivar.h>
+
+#include <machine/pci_machdep.h>
+
+#include "pci.h"
+
+
 void
 cpu_rootconf(void)
 {
@@ -58,3 +65,20 @@
 
        spl0();
 }
+
+void
+device_register(device_t dev, void *aux)
+{
+       device_t parent = device_parent(dev);
+
+#if NPCI > 0
+       if (parent != NULL &&
+           device_is_a(parent, "pci")) {
+               struct pci_attach_args *pa = aux;
+               pcitag_t tag = pci_make_tag(pa->pa_pc,
+                   pa->pa_bus, pa->pa_device, pa->pa_function);
+
+               pci_device_register(tag, dev);
+       }
+#endif
+}
Index: ia64/mainbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/ia64/mainbus.c,v
retrieving revision 1.9
diff -u -r1.9 mainbus.c
--- ia64/mainbus.c      17 May 2011 17:34:50 -0000      1.9
+++ ia64/mainbus.c      14 Apr 2013 04:02:03 -0000
@@ -118,6 +118,8 @@
 
        aaa.aa_iot = IA64_BUS_SPACE_IO;
        aaa.aa_memt = IA64_BUS_SPACE_MEM;
+       aaa.aa_dmat = 0;
+       aaa.aa_dmat64 = 0;
        aaa.aa_pc = 0;
        aaa.aa_pciflags =
            PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY |
Index: pci/pci_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/pci/pci_machdep.c,v
retrieving revision 1.3
diff -u -r1.3 pci_machdep.c
--- pci/pci_machdep.c   12 Jan 2013 08:40:51 -0000      1.3
+++ pci/pci_machdep.c   14 Apr 2013 04:02:04 -0000
@@ -1,6 +1,6 @@
 /*     $NetBSD: pci_machdep.c,v 1.3 2013/01/12 08:40:51 kiyohara Exp $ */
 /*
- * Copyright (c) 2009, 2010 KIYOHARA Takashi
+ * Copyright (c) 2009, 2010, 2013 KIYOHARA Takashi
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,6 +27,11 @@
 #include <sys/cdefs.h>
 __KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.3 2013/01/12 08:40:51 kiyohara 
Exp $");
 
+#include <sys/errno.h>
+#include <sys/kmem.h>
+#include <sys/queue.h>
+#include <sys/systm.h>
+
 #include <machine/bus.h>
 #include <machine/sal.h>
 
@@ -34,6 +39,17 @@
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcidevs.h>
 
+#include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_pci.h>
+#include <dev/acpi/pchb_acpivar.h>
+
+struct pcidev {
+       pcitag_t ptag;
+       device_t pdev;
+
+       SLIST_ENTRY(pcidev) pnext;
+};
+SLIST_HEAD(, pcidev) pcidevs = SLIST_HEAD_INITIALIZER(pcidevs);
 
 void
 pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba)
@@ -96,3 +112,102 @@
        if (res.sal_status < 0)
                printf("pci configuration write failed\n");
 }
+
+int
+pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ih)
+{
+       device_t dev, bus, bridge;
+       pcitag_t tag;
+       struct pcidev *pcidev, *_pcidev;
+       struct acpi_devnode *ad;
+       struct acpi_resources res;
+       struct acpi_irq *irq;
+
+       dev = NULL;
+       ad = acpi_pcidev_find(0, pa->pa_bus, pa->pa_device, pa->pa_function);
+       if (ad != NULL && (dev = acpi_pcidev_find_dev(ad))) {
+               /* Find already maped resource in _CRS. */
+               ACPI_STATUS rv;
+
+               rv = acpi_resource_parse(dev, ad->ad_handle, "_CRS",
+                   &res, &acpi_resource_parse_ops_default);
+               if (ACPI_SUCCESS(rv) && (irq = acpi_res_irq(&res, 0))) {
+                       *ih = irq->ar_irq;
+                       aprint_verbose_dev(dev, "irq found in _CRS\n");
+                       return 0;
+               }
+       }
+
+       if (dev == NULL) {      /* Find our device_t. */
+               tag = pci_make_tag(pa->pa_pc,
+                   pa->pa_bus, pa->pa_device, pa->pa_function);
+               SLIST_FOREACH_SAFE(pcidev, &pcidevs, pnext, _pcidev)
+                       if (pcidev->ptag == tag) {
+                               dev = pcidev->pdev;
+                               break;
+                       }
+       }
+       if (dev != NULL) {
+               /* Find our Host-Bridge. */
+               int rv;
+
+               bus = device_parent(dev);
+               while (1) {
+                       KASSERT(device_is_a(bus, "pci"));
+                       bridge = device_parent(bus);
+                       if (device_is_a(bridge, "pchb"))
+                               break;
+                       bus = device_parent(bridge);    /* Is it pcib? */
+               }
+
+               /* Assign IRQ number in _PRT for our Host-Bridge. */
+               rv = pchb_acpi_assign_irq(bridge, pa);
+               if (rv != -1) {
+                       *ih = rv;
+                       aprint_verbose_dev(dev, "irq found in _PRT\n");
+                       return 0;
+               }
+       }
+
+       return -1;
+}
+
+const char *
+pci_intr_string(pci_chipset_tag_t pc, pci_intr_handle_t ih)
+{
+       static char irqstr[16];
+        
+       sprintf(irqstr, "irq %d", ih);
+       return irqstr;
+}
+
+void *
+pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level,
+                  int (*handler)(void *), void *arg)
+{
+
+       return intr_establish(ih, IST_LEVEL, level, handler, arg);
+}
+
+void
+pci_intr_disestablish(pci_chipset_tag_t pc, void *ih)
+{
+
+       intr_disestablish(ih);
+}
+
+void
+pci_device_register(pcitag_t tag, device_t dev)
+{
+       struct pcidev *pcidev;
+
+       pcidev = kmem_alloc(sizeof(struct pcidev), KM_NOSLEEP);
+       if (pcidev == NULL) {
+               aprint_error_dev(dev, "pci device register failed\n");
+               return;
+       }
+
+       pcidev->ptag = tag;
+       pcidev->pdev = dev;
+       SLIST_INSERT_HEAD(&pcidevs, pcidev, pnext);
+}


Home | Main Index | Thread Index | Old Index