From owner-acpi-jp@jp.FreeBSD.org Wed Jan 30 02:35:58 2002
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6+3.4W/8.11.3) id g0THZwC52594;
	Wed, 30 Jan 2002 02:35:58 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from mass.dis.org (dhcp45-21.dis.org [216.240.45.21])
	by castle.jp.FreeBSD.org (8.11.6+3.4W/8.11.3) with ESMTP/inet id g0THZu652589
	for <acpi-jp@jp.FreeBSD.org>; Wed, 30 Jan 2002 02:35:57 +0900 (JST)
	(envelope-from msmith@mass.dis.org)
Received: from mass.dis.org (localhost [127.0.0.1])
	by mass.dis.org (8.11.6/8.11.6) with ESMTP id g0THa5x01309
	for <acpi-jp@jp.FreeBSD.org>; Tue, 29 Jan 2002 09:36:10 -0800 (PST)
	(envelope-from msmith@mass.dis.org)
Message-Id: <200201291736.g0THa5x01309@mass.dis.org>
X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4
To: acpi-jp@jp.FreeBSD.org
In-reply-to: Your message of "Tue, 29 Jan 2002 22:20:09 +0900."
             <200201291320.WAA16180@shidahara1.planet.sci.kobe-u.ac.jp> 
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Tue, 29 Jan 2002 09:36:05 -0800
From: Michael Smith <msmith@freebsd.org>
Reply-To: acpi-jp@jp.FreeBSD.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+011218
X-Sequence: acpi-jp 1568
Subject: [acpi-jp 1568] Re: What this code means? 
Errors-To: owner-acpi-jp@jp.FreeBSD.org
Sender: owner-acpi-jp@jp.FreeBSD.org
X-Originator: msmith@freebsd.org

> 
> I have a question about following code in acpi_pcib_route interrupt.
> 
>     /* find the bridge softc */
>     if (devclass_get_devices(acpi_pcib_devclass, &devlist, &devcount))
>         goto out;
>     BUS_READ_IVAR(pcib, pcib, PCIB_IVAR_BUS, &up);
>     bus = up;
>     sc = NULL;
>     for (i = 0; i < devcount; i++) {
>         sc = device_get_softc(*(devlist + i));
>         if (sc->ap_bus == bus)
>             break;
>         sc = NULL;
>     }
>     if (sc == NULL)                     /* not one of ours */
>         goto out;
>     prtp = sc->ap_prt.Pointer;
> 
> Are there any problem with simply device_get_softc(pcib)?

You want to be sure that pcib is actually an acpi_pcib and not a generic 
pcib.  I don't know why it's like this; if I wrote that code, I don't 
remember why.

You could probably simplify it.  Note that the Linux folks are 
discovering systems where there are multiple PCI interrupt routing 
tables; I think we'll be OK with that though.




