🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fa.netbsd.tech.kern
Article #86

Re: pchb@acpi again

#86
From: KIYOHARA Takashi
Date: Sun, 28 Apr 2013 08:19
140 lines
5871 bytes
----Next_Part(Sun_Apr_28_17_18_49_2013_410)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 8bit

Hi! Chuck,


From: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>
Date: Mon, 22 Apr 2013 21:21:50 +0900 (JST)

> > so I guess the easiest thing for now would be to add another MD callback
> > that is called from acpi_build_tree() just before the call to
> > acpi_pcidev_scan().  in that callback you could adjust ACPI_VALID_ADR
> > and ad->ad_devinfo->Address as I was originally thinking.
> > once we eventually migrate more of the logic from x86/mpacpi.c
> > to dev/acpi/*.c, maybe we'll find that we can merge some of these
> > callbacks.
> 
> I wish to call each device(or node?), like acpi_device_md_callback().
> Please add new callback.

I have wrote new patch.
It call acpi_node_md_callback() and retry.

Thanks,
--
kiyohara

----Next_Part(Sun_Apr_28_17_18_49_2013_410)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="acpi_node_md_callback.diff"

Index: acpi_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpi_pci.c,v
retrieving revision 1.18
diff -u -r1.18 acpi_pci.c
--- acpi_pci.c	31 Dec 2010 10:56:39 -0000	1.18
+++ acpi_pci.c	27 Apr 2013 07:21:35 -0000
@@ -45,6 +45,8 @@
 #include <dev/acpi/acpivar.h>
 #include <dev/acpi/acpi_pci.h>
 
+#include <machine/acpi_machdep.h>
+
 #include "locators.h"
 
 #define _COMPONENT	  ACPI_BUS_COMPONENT
@@ -175,6 +177,9 @@
 	ACPI_STATUS rv;
 
 	ad->ad_pciinfo = NULL;
+	ap = NULL;
+
+retry:
 
 	/*
 	 * We attach PCI information only to devices that are present,
@@ -189,11 +194,11 @@
 		goto rec;
 
 	if (ad->ad_devinfo->Flags & ACPI_PCI_ROOT_BRIDGE) {
-
-		ap = kmem_zalloc(sizeof(*ap), KM_SLEEP);
-
-		if (ap == NULL)
-			return AE_NO_MEMORY;
+		if (ap == NULL) {
+			ap = kmem_zalloc(sizeof(*ap), KM_SLEEP);
+			if (ap == NULL)
+				return AE_NO_MEMORY;
+		}
 
 		/*
 		 * If no _SEG exist, all PCI bus segments are assumed
@@ -224,6 +229,7 @@
 		}
 
 		ap->ap_flags |= ACPI_PCI_INFO_BRIDGE;
+		ad->ad_pciinfo = ap;
 
 		/*
 		 * This ACPI node denotes a PCI root bridge, but it may also
@@ -242,11 +248,8 @@
 				    "invalid PCI address for %s\n", ad->ad_name);
 			else
 				ap->ap_flags |= ACPI_PCI_INFO_DEVICE;
+			goto rec;
 		}
-
-		ad->ad_pciinfo = ap;
-
-		goto rec;
 	}
 
 	if ((ad->ad_parent != NULL) &&
@@ -259,10 +262,11 @@
 		 * bridge. We have the same PCI segment number, and
 		 * our bus number is its downstream bus number.
 		 */
-		ap = kmem_zalloc(sizeof(*ap), KM_SLEEP);
-
-		if (ap == NULL)
-			return AE_NO_MEMORY;
+		if (ap == NULL) {
+			ap = kmem_zalloc(sizeof(*ap), KM_SLEEP);
+			if (ap == NULL)
+				return AE_NO_MEMORY;
+		}
 
 		ap->ap_segment = ad->ad_parent->ad_pciinfo->ap_segment;
 		ap->ap_bus = ad->ad_parent->ad_pciinfo->ap_downbus;
@@ -279,6 +283,7 @@
 		}
 
 		ap->ap_flags |= ACPI_PCI_INFO_DEVICE;
+		ad->ad_pciinfo = ap;
 
 		if (ap->ap_function == 0xFFFF) {
 			/*
@@ -295,12 +300,12 @@
 
 			if (ACPI_SUCCESS(rv))
 				ap->ap_flags |= ACPI_PCI_INFO_BRIDGE;
-		}
 
-		ad->ad_pciinfo = ap;
-
-		goto rec;
+			goto rec;
+		}
 	}
+	if (acpi_node_md_callback(ad) != 0)
+		goto retry;
 
 rec:
 	SIMPLEQ_FOREACH(child, &ad->ad_child_head, ad_child_list) {

----Next_Part(Sun_Apr_28_17_18_49_2013_410)----
Technical Details
Message-ID: <fa.J++xQ2ygUzlpDWrHLBhlJurjUtI@ifi.uio.no>
Path: arc1-ca.pugleaf.net!hg5ni38751wib.1!nntp.google.com!goblin3!goblin1!goblin.stu.neva.ru!uio.no!nntp.uio.no!.POSTED!not-for-mail
References: <fa.fcWJUyl0UCw8r/FisApR9wfKDdA@ifi.uio.no> <fa.rGsQKoX+IRByuQ+mngLE3fAZkDA@ifi.uio.no> <fa.Xun/FJMYdz3J4kmoErCvKzZIluA@ifi.uio.no>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10c6f4,c9fc83a65eb70a5f
X-Google-NewGroupId: yes
X-Google-Attributes: gidb7e13b6095,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
X-Received: by 10.180.188.198 with SMTP id gc6mr496668wic.3.1367137166614;
        Sun, 28 Apr 2013 01:19:26 -0700 (PDT)
Path: arc1-ca.pugleaf.net!hg5ni38751wib.1!nntp.google.com!goblin3!goblin1!goblin.stu.neva.ru!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: Sun, 28 Apr 2013 08:19:26 UTC
Organization: Internet mailing list
Lines: 141
Sender: tech-kern-owner@NetBSD.org
Message-ID: <fa.J++xQ2ygUzlpDWrHLBhlJurjUtI@ifi.uio.no>
References: <fa.fcWJUyl0UCw8r/FisApR9wfKDdA@ifi.uio.no> <fa.rGsQKoX+IRByuQ+mngLE3fAZkDA@ifi.uio.no> <fa.Xun/FJMYdz3J4kmoErCvKzZIluA@ifi.uio.no>
NNTP-Posting-Host: mail-jess.uio.no
Mime-Version: 1.0
X-Trace: readme.uio.no 1367137166 18423 129.240.7.9 (28 Apr 2013 08:19:26 GMT)
X-Complaints-To: abuse@uio.no
NNTP-Posting-Date: Sun, 28 Apr 2013 08:19:26 +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=
 1367137135;x=1368346735;bh=If+7crn3L/0/OtTRS1khjhhhq1Il+WSRbZX7b8ZZ2eg=;b=PKR
 53mr7M9QkLyPKn9u6tEypeLNK3bWTKEDcelkVGQ9rkMGIyC5bzmSAkr03+619LJFHIjcrybxXvp34
 Qv/tCEwxDkcXiP9aNSWwPfmtve7ZI7WTuzGPj+/bwj/rdCuPUUz+gMqU5A8C+zdVgA7hpxXzPDDcm
 WMI5bYaPw6E8rA=;
In-Reply-To: <20130422.212150.118996763.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: Sun, 28 Apr 2013 17:18:48 +0900 (JST)
Original-Message-Id: <20130428.171848.130210806.kiyohara@kk.iij4u.or.jp>
Original-References: <20130415.211451.08399088.kiyohara@kk.iij4u.or.jp>
 <20130421153324.GB7327@spathi.chuq.com>
 <20130422.212150.118996763.kiyohara@kk.iij4u.or.jp>
Content-Type: Multipart/Mixed;
 boundary="--Next_Part(Sun_Apr_28_17_18_49_2013_410)--"
Content-Transfer-Encoding: 7bit