Subject: port-i386/34116: acpiapm(4) misuses config(9)
To: None <port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: None <tshiozak@netbsd.org>
List: netbsd-bugs
Date: 07/30/2006 20:50:00
>Number:         34116
>Category:       port-i386
>Synopsis:       acpiapm(4) misuses config(9)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 30 20:50:00 +0000 2006
>Originator:     Takuya SHIOZAKI
>Release:        trunk
>Organization:
>Environment:
NetBSD aoi.bogus-hosts.imou.to 3.99.22 NetBSD 3.99.22 (AOI) #13: Fri Jul 21 03:54:24 JST 2006  tshiozak@aoi.bogus-hosts.imou.to:/home/current-build/src/sys/arch/i386/compile/AOI i386
>Description:
acpiapm(4) always matches the first node of AML, which is unrelated with acpiapm.
>How-To-Repeat:
enable acpiapm(4)

>Fix:
separate acpi(4)'s children into two individual interface attributes:

Index: dev/acpi/acpi.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpi.c,v
retrieving revision 1.93
diff -u -u -r1.93 acpi.c
--- dev/acpi/acpi.c	4 Jul 2006 00:30:23 -0000	1.93
+++ dev/acpi/acpi.c	30 Jul 2006 20:42:57 -0000
@@ -519,10 +519,11 @@
 					continue;
 			}
 
-			ad->ad_device = config_found(&sc->sc_dev,
-			    &aa, acpi_print);
+			ad->ad_device = config_found_ia(&sc->sc_dev,
+			    "acpinodebus", &aa, acpi_print);
 		}
 	}
+	config_found_ia(&sc->sc_dev, "acpiapmbus", NULL, NULL);
 }
 
 #ifdef ACPI_ACTIVATE_DEV
@@ -649,7 +650,7 @@
 /*
  * acpi_print:
  *
- *	Autoconfiguration print routine.
+ *	Autoconfiguration print routine for ACPI node bus.
  */
 static int
 acpi_print(void *aux, const char *pnp)
Index: dev/acpi/files.acpi
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/files.acpi,v
retrieving revision 1.38
diff -u -u -r1.38 files.acpi
--- dev/acpi/files.acpi	8 Jul 2006 20:23:53 -0000	1.38
+++ dev/acpi/files.acpi	30 Jul 2006 20:42:57 -0000
@@ -6,7 +6,10 @@
 			ACPI_DSDT_OVERRIDE ACPI_SCANPCI
 defparam opt_acpi.h	ACPI_DSDT_FILE
 
-device	acpi { }: sysmon_power, sysmon_taskq
+define	acpiapmbus { }
+define	acpinodebus { }
+
+device	acpi: acpiapmbus, acpinodebus, sysmon_power, sysmon_taskq
 attach	acpi at acpibus
 file	dev/acpi/acpi.c			acpi		needs-flag
 file	dev/acpi/acpi_resource.c	acpi
@@ -17,74 +20,74 @@
 file	dev/acpi/acpi_timer.c		acpi
 
 # ACPI/apm emulation.
-attach  apm at acpi with acpiapm
+attach  apm at acpiapmbus with acpiapm
 file	dev/acpi/acpi_apm.c		acpiapm
 
 # ACPI Embedded Controller
 device	acpiec
-attach	acpiec at acpi
+attach	acpiec at acpinodebus
 file	dev/acpi/acpi_ec.c		acpiec		needs-flag
 
 # ACPI Lid Switch
 device	acpilid: sysmon_power
-attach	acpilid at acpi
+attach	acpilid at acpinodebus
 file	dev/acpi/acpi_lid.c		acpilid
 
 # ACPI Button
 device	acpibut: sysmon_power
-attach	acpibut at acpi
+attach	acpibut at acpinodebus
 file	dev/acpi/acpi_button.c		acpibut
 
 # ACPI AC Adapter
 device	acpiacad: sysmon_envsys, sysmon_power
-attach	acpiacad at acpi
+attach	acpiacad at acpinodebus
 file	dev/acpi/acpi_acad.c		acpiacad
 
 # ACPI Control Method Battery
 device	acpibat: sysmon_envsys
-attach	acpibat at acpi
+attach	acpibat at acpinodebus
 file	dev/acpi/acpi_bat.c		acpibat
 
 # ACPI Thermal Zone
 device	acpitz: sysmon_envsys
-attach	acpitz at acpi
+attach	acpitz at acpinodebus
 file	dev/acpi/acpi_tz.c		acpitz
 
 # Serial interface
-attach	com at acpi with com_acpi
+attach	com at acpinodebus with com_acpi
 file	dev/acpi/com_acpi.c		com_acpi
 
 # Floppy disk controller
-attach	fdc at acpi with fdc_acpi
+attach	fdc at acpinodebus with fdc_acpi
 file	dev/acpi/fdc_acpi.c		fdc_acpi
 
 # Parallel interface
-attach	lpt at acpi with lpt_acpi
+attach	lpt at acpinodebus with lpt_acpi
 file	dev/acpi/lpt_acpi.c		lpt_acpi & !ppbus
 
-attach	atppc at acpi with atppc_acpi: isadma
+attach	atppc at acpinodebus with atppc_acpi: isadma
 file	dev/acpi/atppc_acpi.c		atppc_acpi
 
 # Keyboard controller
-attach	pckbc at acpi with pckbc_acpi
+attach	pckbc at acpinodebus with pckbc_acpi
 file	dev/acpi/pckbc_acpi.c		pckbc_acpi
 
 # NeoMagic 256AV audio with CS4232 codec
-attach	wss at acpi with wss_acpi
+attach	wss at acpinodebus with wss_acpi
 file	dev/acpi/wss_acpi.c		wss_acpi
 
 # Roland MPU401 (compatible) MIDI UART
-attach	mpu at acpi with mpu_acpi
+attach	mpu at acpinodebus with mpu_acpi
 file	dev/acpi/mpu_acpi.c		mpu_acpi
 
 # Joystick/Game port
-attach	joy at acpi with joy_acpi
+attach	joy at acpinodebus with joy_acpi
 file	dev/acpi/joy_acpi.c		joy_acpi
 
 # AT-style speaker sound
-attach	pcppi at acpi with pcppi_acpi
+attach	pcppi at acpinodebus with pcppi_acpi
 file	dev/acpi/pcppi_acpi.c		pcppi_acpi
 
 # AT Timer
-attach	attimer at acpi with attimer_acpi
+attach	attimer at acpinodebus with attimer_acpi
 file	dev/acpi/attimer_acpi.c		attimer_acpi
Index: arch/i386/conf/files.i386
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/conf/files.i386,v
retrieving revision 1.290
diff -u -u -r1.290 files.i386
--- arch/i386/conf/files.i386	8 Jul 2006 20:28:06 -0000	1.290
+++ arch/i386/conf/files.i386	30 Jul 2006 20:42:57 -0000
@@ -479,20 +479,20 @@
 
 # Toshiba VALD 
 device	vald
-attach	vald at acpi with vald_acpi
+attach	vald at acpinodebus with vald_acpi
 file	arch/i386/acpi/vald_acpi.c		vald_acpi
 
 # Sony SPIC (jog dial etc.)
-attach	spic at acpi with spic_acpi
+attach	spic at acpinodebus with spic_acpi
 file	arch/i386/acpi/spic_acpi.c		spic_acpi
 
 # Sony Misc (brightness etc.)
 device	sony
-attach	sony at acpi with sony_acpi
+attach	sony at acpinodebus with sony_acpi
 file	arch/i386/acpi/sony_acpi.c		sony_acpi
 
 # Numeric Processing Extension; Math Co-processor
-attach	npx at acpi with npx_acpi
+attach	npx at acpinodebus with npx_acpi
 file	arch/i386/acpi/npx_acpi.c		npx_acpi
 
 device	vesabios {}