Article View: fa.netbsd.tech.kern
Article #62Re: pchb@acpi again
From: KIYOHARA Takashi
Date: Mon, 15 Apr 2013 12:15
Date: Mon, 15 Apr 2013 12:15
300 lines
10950 bytes
10950 bytes
----Next_Part(Mon_Apr_15_21_14_52_2013_901)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 8bit
Hi!
From: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>
Date: Sat, 13 Apr 2013 19:55:44 +0900 (JST)
> From: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>
> Date: Tue, 09 Apr 2013 07:44:25 +0900 (JST)
>
> > From: Chuck Silvers <chuq@chuq.com>
> > 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
----Next_Part(Mon_Apr_15_21_14_52_2013_901)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="ia64.diff"
? 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);
+}
----Next_Part(Mon_Apr_15_21_14_52_2013_901)----
Technical Details
Message-ID:
<fa.fcWJUyl0UCw8r/FisApR9wfKDdA@ifi.uio.no>Path:
arc1-ca.pugleaf.net!hg5ni15550wib.1!nntp.google.com!feeder1.cambriumusenet.nl!82.197.223.108.MISMATCH!feeder2.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.87.MISMATCH!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.nobody.at!feeder.erje.net!eu.feeder.erje.net!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!uio.no!nntp.uio.no!.POSTED!not-for-mailReferences:
<fa.l065r8g/boh8Wxrx35LRmcupVn0@ifi.uio.no> <fa.5Bktg6MSFFhoN4VwuaGQU8ywRGk@ifi.uio.no> <fa.y1drGTLKpF7oqWdhfvcx49fHB4E@ifi.uio.no>Show Full Headers
Complete Article Headers
X-Google-Thread: b7e13b6095,c9fc83a65eb70a5f
X-Google-Attributes: gidb7e13b6095,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
X-Received: by 10.180.106.73 with SMTP id gs9mr6639663wib.2.1366254634662;
Wed, 17 Apr 2013 20:10:34 -0700 (PDT)
Path: arc1-ca.pugleaf.net!hg5ni15550wib.1!nntp.google.com!feeder1.cambriumusenet.nl!82.197.223.108.MISMATCH!feeder2.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.87.MISMATCH!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.nobody.at!feeder.erje.net!eu.feeder.erje.net!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!uio.no!nntp.uio.no!.POSTED!not-for-mail
From: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>
Newsgroups: fa.netbsd.tech.kern
Subject: Re: pchb@acpi again
Date: Mon, 15 Apr 2013 12:15:48 UTC
Organization: Internet mailing list
Lines: 301
Sender: tech-kern-owner@NetBSD.org
Message-ID: <fa.fcWJUyl0UCw8r/FisApR9wfKDdA@ifi.uio.no>
References: <fa.l065r8g/boh8Wxrx35LRmcupVn0@ifi.uio.no> <fa.5Bktg6MSFFhoN4VwuaGQU8ywRGk@ifi.uio.no> <fa.y1drGTLKpF7oqWdhfvcx49fHB4E@ifi.uio.no>
NNTP-Posting-Host: mail-jess.uio.no
Mime-Version: 1.0
X-Trace: readme.uio.no 1366028148 10551 129.240.7.9 (15 Apr 2013 12:15:48 GMT)
X-Complaints-To: abuse@uio.no
NNTP-Posting-Date: Mon, 15 Apr 2013 12:15:48 +0000 (UTC)
Cc: current-users@netbsd.org, tech-kern@netbsd.org
To: chuq@chuq.com
Delivered-To: tech-kern@netbsd.org
X-Virus-Scanned: amavisd-new at NetBSD.org
Authentication-Results: mail.NetBSD.org (amavisd-new);
dkim=pass (1024-bit key) header.d=kk.iij4u.or.jp
DKIM-Signature: v=1;a=rsa-sha256;c=relaxed/simple;d=kk.iij4u.or.jp;h=Date:
Message-Id:To:Cc:From:In-Reply-To:References:Mime-Version:Content-Type:
Content-Transfer-Encoding;i=kiyohara@kk.iij4u.or.jp;s=20120530.iij4u;t=
1366028098;x=1367237698;bh=j5W5XzbYw7I6nbLu9iN43zVMVrgwwO6LiFYDEjdWfaI=;b=Hfd
vRFVjrG6aHRMj+6gpACQWHcGGDS7E4QtrsixfxWRjfAkKVDTD3wj8IREbhKUyDReN/4YQpQMxLkPp
XU+vZ1/52UZ301ponr6NLuenztiwqAxZrZwczLo2PUAdEqXPwOtsfFVOUbGMl1u2VvR6VoWz80bGO
72c7sqemY8236k=;
In-Reply-To: <20130413.195544.93783137.kiyohara@kk.iij4u.or.jp>
X-Mailer: Mew version 4.2 on Emacs 20.7 / Mule 4.1 (AOI)
List-Id: tech-kern.NetBSD.org
Original-Date: Mon, 15 Apr 2013 21:14:51 +0900 (JST)
Original-Message-Id: <20130415.211451.08399088.kiyohara@kk.iij4u.or.jp>
Original-References: <20130408163406.GB25751@spathi.chuq.com>
<20130409.074425.31967194.kiyohara@kk.iij4u.or.jp>
<20130413.195544.93783137.kiyohara@kk.iij4u.or.jp>
Content-Type: Multipart/Mixed;
boundary="--Next_Part(Mon_Apr_15_21_14_52_2013_901)--"
Content-Transfer-Encoding: 7bit