PERFORCE change 57418 for review

Robert Watson rwatson at FreeBSD.org
Thu Jul 15 15:16:53 PDT 2004


http://perforce.freebsd.org/chv.cgi?CH=57418

Change 57418 by rwatson at rwatson_tislabs on 2004/07/15 22:16:26

	Integrate netperf_socket from rwatson_netperf:
	
	More VM lockisms.
	More ACPIisms.
	More tty reformulation.
	Return EOPNOTSUPP for unrecognized module events.

Affected files ...

.. //depot/projects/netperf_socket/sys/alpha/alpha/pmap.c#12 integrate
.. //depot/projects/netperf_socket/sys/alpha/alpha/promcons.c#6 integrate
.. //depot/projects/netperf_socket/sys/alpha/linux/linux_sysvec.c#2 integrate
.. //depot/projects/netperf_socket/sys/alpha/tlsb/zs_tlsb.c#7 integrate
.. //depot/projects/netperf_socket/sys/amd64/amd64/pmap.c#20 integrate
.. //depot/projects/netperf_socket/sys/cam/cam_periph.h#2 integrate
.. //depot/projects/netperf_socket/sys/cam/cam_xpt.c#5 integrate
.. //depot/projects/netperf_socket/sys/coda/coda_fbsd.c#5 integrate
.. //depot/projects/netperf_socket/sys/compat/svr4/svr4_sysvec.c#2 integrate
.. //depot/projects/netperf_socket/sys/conf/NOTES#28 integrate
.. //depot/projects/netperf_socket/sys/conf/files.amd64#12 integrate
.. //depot/projects/netperf_socket/sys/conf/files.i386#22 integrate
.. //depot/projects/netperf_socket/sys/dev/acpica/acpi.c#32 integrate
.. //depot/projects/netperf_socket/sys/dev/acpica/acpi_if.m#2 integrate
.. //depot/projects/netperf_socket/sys/dev/aic7xxx/aic79xx_osm.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/aic7xxx/aic7xxx_osm.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/bktr/bktr_mem.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/cx/if_cx.c#13 integrate
.. //depot/projects/netperf_socket/sys/dev/cy/cy.c#12 integrate
.. //depot/projects/netperf_socket/sys/dev/dcons/dcons.c#9 integrate
.. //depot/projects/netperf_socket/sys/dev/digi/digi.c#13 integrate
.. //depot/projects/netperf_socket/sys/dev/fb/fb.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/fb/splashreg.h#2 integrate
.. //depot/projects/netperf_socket/sys/dev/fdc/fdc.c#6 integrate
.. //depot/projects/netperf_socket/sys/dev/fdc/fdc_acpi.c#1 branch
.. //depot/projects/netperf_socket/sys/dev/fdc/fdc_isa.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/fdc/fdc_pccard.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/fdc/fdcvar.h#3 integrate
.. //depot/projects/netperf_socket/sys/dev/firewire/firewire.c#7 integrate
.. //depot/projects/netperf_socket/sys/dev/harp/if_harp.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/hfa/hfa_freebsd.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/ispfw/ispfw.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/md/md.c#16 integrate
.. //depot/projects/netperf_socket/sys/dev/nmdm/nmdm.c#10 integrate
.. //depot/projects/netperf_socket/sys/dev/null/null.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/ofw/ofw_console.c#9 integrate
.. //depot/projects/netperf_socket/sys/dev/ofw/openpromio.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/random/randomdev.c#10 integrate
.. //depot/projects/netperf_socket/sys/dev/rc/rc.c#11 integrate
.. //depot/projects/netperf_socket/sys/dev/rp/rp.c#9 integrate
.. //depot/projects/netperf_socket/sys/dev/sab/sab.c#10 integrate
.. //depot/projects/netperf_socket/sys/dev/si/si.c#10 integrate
.. //depot/projects/netperf_socket/sys/dev/sio/sio.c#18 integrate
.. //depot/projects/netperf_socket/sys/dev/snp/snp.c#7 integrate
.. //depot/projects/netperf_socket/sys/dev/sound/driver.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/streams/streams.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/sx/sx.c#9 integrate
.. //depot/projects/netperf_socket/sys/dev/syscons/syscons.c#9 integrate
.. //depot/projects/netperf_socket/sys/dev/syscons/syscons.h#3 integrate
.. //depot/projects/netperf_socket/sys/dev/syscons/sysmouse.c#6 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_tty.c#9 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ehci.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ubser.c#8 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ucom.c#10 integrate
.. //depot/projects/netperf_socket/sys/dev/utopia/utopia.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/vinum/vinum.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/zs/zs.c#9 integrate
.. //depot/projects/netperf_socket/sys/fs/pseudofs/pseudofs.c#3 integrate
.. //depot/projects/netperf_socket/sys/fs/unionfs/union_subr.c#3 integrate
.. //depot/projects/netperf_socket/sys/geom/gate/g_gate.c#7 integrate
.. //depot/projects/netperf_socket/sys/i386/acpica/acpi_wakeup.c#5 integrate
.. //depot/projects/netperf_socket/sys/i386/i386/pmap.c#18 integrate
.. //depot/projects/netperf_socket/sys/i386/i386/swtch.s#5 integrate
.. //depot/projects/netperf_socket/sys/i386/ibcs2/ibcs2_sysvec.c#2 integrate
.. //depot/projects/netperf_socket/sys/i386/isa/pcvt/pcvt_drv.c#6 integrate
.. //depot/projects/netperf_socket/sys/i386/isa/vesa.c#4 integrate
.. //depot/projects/netperf_socket/sys/i386/linux/linux_sysvec.c#3 integrate
.. //depot/projects/netperf_socket/sys/i4b/include/i4b_global.h#2 integrate
.. //depot/projects/netperf_socket/sys/ia64/ia64/pmap.c#12 integrate
.. //depot/projects/netperf_socket/sys/ia64/ia64/ssc.c#6 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_event.c#7 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_mac.c#4 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_module.c#3 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_shutdown.c#8 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_syscalls.c#2 integrate
.. //depot/projects/netperf_socket/sys/kern/subr_bus.c#11 integrate
.. //depot/projects/netperf_socket/sys/kern/tty.c#13 integrate
.. //depot/projects/netperf_socket/sys/kern/tty_conf.c#6 integrate
.. //depot/projects/netperf_socket/sys/kern/tty_pty.c#11 integrate
.. //depot/projects/netperf_socket/sys/kern/tty_subr.c#2 integrate
.. //depot/projects/netperf_socket/sys/kern/vfs_init.c#5 integrate
.. //depot/projects/netperf_socket/sys/kern/vfs_subr.c#15 integrate
.. //depot/projects/netperf_socket/sys/modules/fdc/Makefile#5 integrate
.. //depot/projects/netperf_socket/sys/modules/sound/sound/Makefile#1 branch
.. //depot/projects/netperf_socket/sys/net/if_disc.c#6 integrate
.. //depot/projects/netperf_socket/sys/net/if_ef.c#4 integrate
.. //depot/projects/netperf_socket/sys/net/if_faith.c#8 integrate
.. //depot/projects/netperf_socket/sys/net/if_gif.c#8 integrate
.. //depot/projects/netperf_socket/sys/net/if_gre.c#8 integrate
.. //depot/projects/netperf_socket/sys/net/if_loop.c#7 integrate
.. //depot/projects/netperf_socket/sys/net/if_ppp.c#7 integrate
.. //depot/projects/netperf_socket/sys/net/if_sl.c#9 integrate
.. //depot/projects/netperf_socket/sys/net/if_spppsubr.c#9 integrate
.. //depot/projects/netperf_socket/sys/net/if_stf.c#8 integrate
.. //depot/projects/netperf_socket/sys/net/if_tun.c#10 integrate
.. //depot/projects/netperf_socket/sys/net/if_vlan.c#10 integrate
.. //depot/projects/netperf_socket/sys/net/ppp_tty.c#4 integrate
.. //depot/projects/netperf_socket/sys/netgraph/ng_base.c#8 integrate
.. //depot/projects/netperf_socket/sys/netinet/ip_dummynet.c#6 integrate
.. //depot/projects/netperf_socket/sys/netinet/ip_fw2.c#9 integrate
.. //depot/projects/netperf_socket/sys/netinet/ip_mroute.c#9 integrate
.. //depot/projects/netperf_socket/sys/netinet6/ip6_fw.c#3 integrate
.. //depot/projects/netperf_socket/sys/nfsserver/nfs_srvsubs.c#8 integrate
.. //depot/projects/netperf_socket/sys/pc98/pc98/fd.c#11 integrate
.. //depot/projects/netperf_socket/sys/pc98/pc98/fdc_cbus.c#3 integrate
.. //depot/projects/netperf_socket/sys/pc98/pc98/sio.c#16 integrate
.. //depot/projects/netperf_socket/sys/powerpc/powerpc/pmap.c#11 integrate
.. //depot/projects/netperf_socket/sys/sparc64/sparc64/pmap.c#8 integrate
.. //depot/projects/netperf_socket/sys/sys/exec.h#3 integrate
.. //depot/projects/netperf_socket/sys/sys/procfs.h#3 integrate
.. //depot/projects/netperf_socket/sys/sys/tty.h#11 integrate
.. //depot/projects/netperf_socket/sys/vm/vm_map.c#12 integrate
.. //depot/projects/netperf_socket/sys/vm/vm_pageout.c#9 integrate

Differences ...

==== //depot/projects/netperf_socket/sys/alpha/alpha/pmap.c#12 (text+ko) ====

@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/alpha/pmap.c,v 1.157 2004/07/14 05:49:44 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/alpha/pmap.c,v 1.158 2004/07/15 18:00:41 alc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1573,6 +1573,8 @@
 	 */
 	if (pmap->pm_stats.resident_count == 0)
 		return;
+
+	vm_page_lock_queues();
 	PMAP_LOCK(pmap);
 
 	/*
@@ -1600,6 +1602,7 @@
 		nva = va + PAGE_SIZE;
 	}
 out:
+	vm_page_unlock_queues();
 	PMAP_UNLOCK(pmap);
 }
 
@@ -1700,6 +1703,7 @@
 	if ((sva & PAGE_MASK) || (eva & PAGE_MASK))
 		panic("pmap_protect: unaligned addresses");
 
+	vm_page_lock_queues();
 	PMAP_LOCK(pmap);
 	while (sva < eva) {
 
@@ -1751,6 +1755,7 @@
 
 		sva += PAGE_SIZE;
 	}
+	vm_page_unlock_queues();
 	PMAP_UNLOCK(pmap);
 }
 

==== //depot/projects/netperf_socket/sys/alpha/alpha/promcons.c#6 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/alpha/promcons.c,v 1.39 2004/06/16 09:46:26 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/alpha/promcons.c,v 1.40 2004/07/15 20:47:36 phk Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -149,7 +149,7 @@
 
 	untimeout(promtimeout, tp, promtimeouthandle);
 	ttyld_close(tp, flag);
-	ttyclose(tp);
+	tty_close(tp);
 	return 0;
 }
  

==== //depot/projects/netperf_socket/sys/alpha/linux/linux_sysvec.c#2 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/linux/linux_sysvec.c,v 1.92 2003/12/23 02:42:38 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/linux/linux_sysvec.c,v 1.93 2004/07/15 08:25:59 phk Exp $");
 
 /* XXX we use functions that might not exist. */
 #include "opt_compat.h"
@@ -274,6 +274,7 @@
 			printf("Could not deinstall ELF interpreter entry\n");
 		break;
 	default:
+		return (EOPNOTSUPP);
 		break;
 	}
 	return error;

==== //depot/projects/netperf_socket/sys/alpha/tlsb/zs_tlsb.c#7 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/tlsb/zs_tlsb.c,v 1.46 2004/07/10 20:50:19 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/tlsb/zs_tlsb.c,v 1.47 2004/07/15 20:47:36 phk Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -318,7 +318,7 @@
 	s = spltty();
 	untimeout(zs_poll_intr, sc, sc->zst);
 	ttyld_close(tp, flag);
-	ttyclose(tp);
+	tty_close(tp);
 	splx(s);
 
 	return (0);

==== //depot/projects/netperf_socket/sys/amd64/amd64/pmap.c#20 (text+ko) ====

@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.484 2004/07/14 07:13:33 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.485 2004/07/15 18:00:41 alc Exp $");
 
 /*
  *	Manages physical address maps.
@@ -1602,6 +1602,8 @@
 	 */
 	if (pmap->pm_stats.resident_count == 0)
 		return;
+
+	vm_page_lock_queues();
 	PMAP_LOCK(pmap);
 
 	/*
@@ -1613,8 +1615,7 @@
 		pde = pmap_pde(pmap, sva);
 		if (pde && (*pde & PG_PS) == 0) {
 			pmap_remove_page(pmap, sva);
-			PMAP_UNLOCK(pmap);
-			return;
+			goto out;
 		}
 	}
 
@@ -1684,6 +1685,8 @@
 
 	if (anyvalid)
 		pmap_invalidate_all(pmap);
+out:
+	vm_page_unlock_queues();
 	PMAP_UNLOCK(pmap);
 }
 
@@ -1778,6 +1781,7 @@
 
 	anychanged = 0;
 
+	vm_page_lock_queues();
 	PMAP_LOCK(pmap);
 	for (; sva < eva; sva = va_next) {
 
@@ -1856,6 +1860,7 @@
 	}
 	if (anychanged)
 		pmap_invalidate_all(pmap);
+	vm_page_unlock_queues();
 	PMAP_UNLOCK(pmap);
 }
 

==== //depot/projects/netperf_socket/sys/cam/cam_periph.h#2 (text+ko) ====

@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/cam/cam_periph.h,v 1.13 2003/03/08 08:01:26 phk Exp $
+ * $FreeBSD: src/sys/cam/cam_periph.h,v 1.14 2004/07/15 08:25:59 phk Exp $
  */
 
 #ifndef _CAM_CAM_PERIPH_H
@@ -53,6 +53,8 @@
 		case MOD_UNLOAD: \
 			printf(#name " module unload - not possible for this module type\n"); \
 			return EINVAL; \
+		default: \
+			return EOPNOTSUPP; \
 		} \
 		return 0; \
 	} \

==== //depot/projects/netperf_socket/sys/cam/cam_xpt.c#5 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.141 2004/06/21 19:01:55 ps Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.142 2004/07/15 08:25:59 phk Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -1348,6 +1348,8 @@
 		xpt_init(NULL);
 	} else if (what == MOD_UNLOAD) {
 		return EBUSY;
+	} else {
+		return EOPNOTSUPP;
 	}
 
 	return 0;

==== //depot/projects/netperf_socket/sys/coda/coda_fbsd.c#5 (text+ko) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/coda/coda_fbsd.c,v 1.35 2004/06/17 17:16:40 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/coda/coda_fbsd.c,v 1.36 2004/07/15 08:25:59 phk Exp $");
 
 #include "vcoda.h"
 
@@ -90,9 +90,9 @@
 	case MOD_LOAD:
 		break;
 	case MOD_UNLOAD:
-		break;
+		return (EBUSY);
 	default:
-		break;
+		return (EOPNOTSUPP);
 	}
 	return 0;
 }

==== //depot/projects/netperf_socket/sys/compat/svr4/svr4_sysvec.c#2 (text+ko) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_sysvec.c,v 1.36 2003/12/23 02:42:38 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_sysvec.c,v 1.37 2004/07/15 08:26:00 phk Exp $");
 
 /* XXX we use functions that might not exist. */
 #include "opt_compat.h"
@@ -411,6 +411,7 @@
 			printf("svr4 ELF exec handler removed\n");
 		break;
 	default:
+		return (EOPNOTSUPP);
 		break;
 	}
 	return error;

==== //depot/projects/netperf_socket/sys/conf/NOTES#28 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1244 2004/07/11 01:44:07 marcel Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1245 2004/07/15 07:52:27 roam Exp $
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
@@ -1932,7 +1932,7 @@
 #
 # The 'bktr' device is a PCI video capture device using the Brooktree
 # bt848/bt848a/bt849a/bt878/bt879 chipset. When used with a TV Tuner it forms a
-# TV card, eg Miro PC/TV, Hauppauge WinCast/TV WinTV, VideoLogic Captivator,
+# TV card, e.g. Miro PC/TV, Hauppauge WinCast/TV WinTV, VideoLogic Captivator,
 # Intel Smart Video III, AverMedia, IMS Turbo, FlyVideo.
 #
 # options 	OVERRIDE_CARD=xxx
@@ -1948,11 +1948,11 @@
 # options 	BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_NTSC
 # Specifies the default video capture mode.
 # This is required for Dual Crystal (28&35Mhz) boards where PAL is used
-# to prevent hangs during initialisation.  eg VideoLogic Captivator PCI.
+# to prevent hangs during initialisation, e.g. VideoLogic Captivator PCI.
 #
 # options 	BKTR_USE_PLL
-# PAL or SECAM users who have a 28Mhz crystal (and no 35Mhz crystal)
-# must enable PLL mode with this option. eg some new Bt878 cards.
+# This is required for PAL or SECAM boards with a 28Mhz crystal and no 35Mhz
+# crystal, e.g. some new Bt878 cards.
 #
 # options 	BKTR_GPIO_ACCESS
 # This enable IOCTLs which give user level access to the GPIO port.

==== //depot/projects/netperf_socket/sys/conf/files.amd64#12 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: src/sys/conf/files.amd64,v 1.41 2004/07/10 23:31:17 marcel Exp $
+# $FreeBSD: src/sys/conf/files.amd64,v 1.42 2004/07/15 16:43:52 njl Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -101,6 +101,7 @@
 dev/fb/splash.c			optional	splash
 dev/fb/vga.c			optional	vga
 dev/fdc/fdc.c			optional	fdc
+dev/fdc/fdc_acpi.c		optional	fdc
 dev/fdc/fdc_isa.c		optional	fdc isa
 dev/fdc/fdc_pccard.c		optional	fdc pccard
 dev/kbd/atkbd.c			optional	atkbd

==== //depot/projects/netperf_socket/sys/conf/files.i386#22 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: src/sys/conf/files.i386,v 1.498 2004/07/13 17:43:03 phk Exp $
+# $FreeBSD: src/sys/conf/files.i386,v 1.499 2004/07/15 16:43:52 njl Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -133,6 +133,7 @@
 dev/fb/splash.c			optional	splash
 dev/fb/vga.c			optional	vga
 dev/fdc/fdc.c			optional	fdc
+dev/fdc/fdc_acpi.c		optional	fdc
 dev/fdc/fdc_isa.c		optional	fdc isa
 dev/fdc/fdc_pccard.c		optional	fdc card
 dev/fdc/fdc_pccard.c		optional	fdc pccard

==== //depot/projects/netperf_socket/sys/dev/acpica/acpi.c#32 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.176 2004/07/13 18:59:49 njl Exp $
+ *	$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.177 2004/07/15 16:29:08 njl Exp $
  */
 
 #include "opt_acpi.h"
@@ -111,15 +111,16 @@
 static ACPI_STATUS acpi_device_eval_obj(device_t bus, device_t dev,
 		    ACPI_STRING pathname, ACPI_OBJECT_LIST *parameters,
 		    ACPI_BUFFER *ret);
-static ACPI_STATUS acpi_device_walk_ns(device_t bus, device_t dev,
-		    ACPI_OBJECT_TYPE type, UINT32 max_depth,
-		    ACPI_WALK_CALLBACK user_fn, void *context, void **ret);
+static ACPI_STATUS acpi_device_scan_cb(ACPI_HANDLE h, UINT32 level,
+		    void *context, void **retval);
+static ACPI_STATUS acpi_device_scan_children(device_t bus, device_t dev,
+		    int max_depth, acpi_scan_cb_t user_fn, void *arg);
 static int	acpi_isa_pnp_probe(device_t bus, device_t child,
-			struct isa_pnp_id *ids);
+		    struct isa_pnp_id *ids);
 static void	acpi_probe_children(device_t bus);
 static int	acpi_probe_order(ACPI_HANDLE handle, int *order);
 static ACPI_STATUS acpi_probe_child(ACPI_HANDLE handle, UINT32 level,
-			void *context, void **status);
+		    void *context, void **status);
 static BOOLEAN	acpi_MatchHid(ACPI_HANDLE h, const char *hid);
 static void	acpi_shutdown_final(void *arg, int howto);
 static void	acpi_enable_fixed_events(struct acpi_softc *sc);
@@ -169,7 +170,7 @@
     /* ACPI bus */
     DEVMETHOD(acpi_id_probe,		acpi_device_id_probe),
     DEVMETHOD(acpi_evaluate_object,	acpi_device_eval_obj),
-    DEVMETHOD(acpi_walk_namespace,	acpi_device_walk_ns),
+    DEVMETHOD(acpi_scan_children,	acpi_device_scan_children),
 
     /* ISA emulation */
     DEVMETHOD(isa_pnp_probe,		acpi_isa_pnp_probe),
@@ -1036,20 +1037,85 @@
 {
     ACPI_HANDLE h;
 
-    if ((h = acpi_get_handle(dev)) == NULL)
+    if (dev == NULL)
+	h = ACPI_ROOT_OBJECT;
+    else if ((h = acpi_get_handle(dev)) == NULL)
 	return (AE_BAD_PARAMETER);
     return (AcpiEvaluateObject(h, pathname, parameters, ret));
 }
 
+/* Callback arg for our implementation of walking the namespace. */
+struct acpi_device_scan_ctx {
+    acpi_scan_cb_t	user_fn;
+    void		*arg;
+    ACPI_HANDLE		parent;
+};
+
+static ACPI_STATUS
+acpi_device_scan_cb(ACPI_HANDLE h, UINT32 level, void *arg, void **retval)
+{
+    struct acpi_device_scan_ctx *ctx;
+    device_t dev, old_dev;
+    ACPI_STATUS status;
+    ACPI_OBJECT_TYPE type;
+
+    /*
+     * Skip this device if we think we'll have trouble with it or it is
+     * the parent where the scan began.
+     */
+    ctx = (struct acpi_device_scan_ctx *)arg;
+    if (acpi_avoid(h) || h == ctx->parent)
+	return (AE_OK);
+
+    /* If this is not a valid device type (e.g., a method), skip it. */
+    if (ACPI_FAILURE(AcpiGetType(h, &type)))
+	return (AE_OK);
+    if (type != ACPI_TYPE_DEVICE && type != ACPI_TYPE_PROCESSOR &&
+	type != ACPI_TYPE_THERMAL && type != ACPI_TYPE_POWER)
+	return (AE_OK);
+
+    /*
+     * Call the user function with the current device.  If it is unchanged
+     * afterwards, return.  Otherwise, we update the handle to the new dev.
+     */
+    old_dev = acpi_get_device(h);
+    dev = old_dev;
+    status = ctx->user_fn(h, &dev, level, ctx->arg);
+    if (ACPI_FAILURE(status) || old_dev == dev)
+	return (status);
+
+    /* Remove the old child and its connection to the handle. */
+    if (old_dev != NULL) {
+	device_delete_child(device_get_parent(old_dev), old_dev);
+	AcpiDetachData(h, acpi_fake_objhandler);
+    }
+
+    /* Recreate the handle association if the user created a device. */
+    if (dev != NULL)
+	AcpiAttachData(h, acpi_fake_objhandler, dev);
+
+    return (AE_OK);
+}
+
 static ACPI_STATUS
-acpi_device_walk_ns(device_t bus, device_t dev, ACPI_OBJECT_TYPE type,
-    UINT32 max_depth, ACPI_WALK_CALLBACK user_fn, void *context, void **ret)
+acpi_device_scan_children(device_t bus, device_t dev, int max_depth,
+    acpi_scan_cb_t user_fn, void *arg)
 {
     ACPI_HANDLE h;
+    struct acpi_device_scan_ctx ctx;
+
+    if (acpi_disabled("children"))
+	return (AE_OK);
 
-    if ((h = acpi_get_handle(dev)) == NULL)
+    if (dev == NULL)
+	h = ACPI_ROOT_OBJECT;
+    else if ((h = acpi_get_handle(dev)) == NULL)
 	return (AE_BAD_PARAMETER);
-    return (AcpiWalkNamespace(type, h, max_depth, user_fn, context, ret));
+    ctx.user_fn = user_fn;
+    ctx.arg = arg;
+    ctx.parent = h;
+    return (AcpiWalkNamespace(ACPI_TYPE_ANY, h, max_depth,
+	acpi_device_scan_cb, &ctx, NULL));
 }
 
 static int

==== //depot/projects/netperf_socket/sys/dev/acpica/acpi_if.m#2 (text+ko) ====

@@ -23,7 +23,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: src/sys/dev/acpica/acpi_if.m,v 1.1 2004/06/29 18:56:14 njl Exp $
+# $FreeBSD: src/sys/dev/acpica/acpi_if.m,v 1.2 2004/07/15 16:29:08 njl Exp $
 #
 
 #include <sys/bus.h>
@@ -33,7 +33,28 @@
 INTERFACE acpi;
 
 #
-# Default implementation for the probe method.
+# Callback function for each child handle traversed in acpi_scan_children().
+#
+# ACPI_HANDLE h:  current child device being considered
+#
+# device_t *dev:  pointer to the child's original device_t or NULL if there
+#   was none.  The callback should store a new device in *dev if it has
+#   created one.  The method implementation will automatically clean up the
+#   previous device and properly associate the current ACPI_HANDLE with it.
+#
+# level:  current level being scanned
+#
+# void *arg:  argument passed in original call to acpi_scan_children()
+#
+# Returns:  AE_OK if the scan should continue, otherwise an error
+#
+HEADER {
+	typedef ACPI_STATUS (*acpi_scan_cb_t)(ACPI_HANDLE h, device_t *dev,
+	    int level, void *arg);
+};
+
+#
+# Default implementation for acpi_id_probe().
 #
 CODE {
 	static char *
@@ -44,7 +65,16 @@
 };
 
 #
-# Probe
+# Check a device for a match in a list of ID strings.  The strings can be
+# EISA PNP IDs or ACPI _HID/_CID values.
+#
+# device_t bus:  parent bus for the device
+#
+# device_t dev:  device being considered
+#
+# char **ids:  array of ID strings to consider
+#
+# Returns:  ID string matched or NULL if no match
 #
 METHOD char * id_probe {
 	device_t	bus;
@@ -53,7 +83,22 @@
 } DEFAULT acpi_generic_id_probe;
 
 #
-# AcpiEvaluateObject
+# Evaluate an ACPI method or object, given its path.
+#
+# device_t bus:  parent bus for the device
+#
+# device_t dev:  evaluate the object relative to this device's handle.
+#   Specify NULL to begin the search at the ACPI root.
+#
+# ACPI_STRING pathname:  absolute or relative path to this object
+#
+# ACPI_OBJECT_LIST *parameters:  array of arguments to pass to the object.
+#   Specify NULL if there are none.
+#
+# ACPI_BUFFER *ret:  the result (if any) of the evaluation
+#   Specify NULL if there is none.
+#
+# Returns:  AE_OK or an error value
 #
 METHOD ACPI_STATUS evaluate_object {
 	device_t	bus;
@@ -64,14 +109,28 @@
 };
 
 #
-# AcpiWalkNamespace
+# Rescan a subtree and optionally reattach devices to handles.  Users
+# specify a callback that is called for each ACPI_HANDLE of type Device
+# that is a child of "dev".
+#
+# device_t bus:  parent bus for the device
+#
+# device_t dev:  begin the scan starting with this device's handle.
+#   Specify NULL to begin the scan at the ACPI root.
+# 
+# int max_depth:  number of levels to traverse (i.e., 1 means just the
+#   immediate children.
+#
+# acpi_scan_cb_t user_fn:  called for each child handle
+#
+# void *arg:  argument to pass to the callback function
+#
+# Returns:  AE_OK or an error value, based on the callback return value
 #
-METHOD ACPI_STATUS walk_namespace {
+METHOD ACPI_STATUS scan_children {
 	device_t	bus;
 	device_t	dev;
-	ACPI_OBJECT_TYPE type;
-	UINT32		max_depth;
-	ACPI_WALK_CALLBACK user_fn;
-	void		*context;
-	void		**ret;
+	int		max_depth;
+	acpi_scan_cb_t	user_fn;
+	void		*arg;
 };

==== //depot/projects/netperf_socket/sys/dev/aic7xxx/aic79xx_osm.c#2 (text+ko) ====

@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/aic7xxx/aic79xx_osm.c,v 1.16 2003/12/17 00:02:09 gibbs Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/aic7xxx/aic79xx_osm.c,v 1.17 2004/07/15 08:26:00 phk Exp $");
 
 #include <dev/aic7xxx/aic79xx_osm.h>
 #include <dev/aic7xxx/aic79xx_inline.h>
@@ -1540,6 +1540,7 @@
 ahd_modevent(module_t mod, int type, void *data)
 {
 	/* XXX Deal with busy status on unload. */
+	/* XXX Deal with unknown events */
 	return 0;
 }
   

==== //depot/projects/netperf_socket/sys/dev/aic7xxx/aic7xxx_osm.c#2 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/aic7xxx/aic7xxx_osm.c,v 1.39 2003/12/17 00:02:10 gibbs Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/aic7xxx/aic7xxx_osm.c,v 1.40 2004/07/15 08:26:00 phk Exp $");
 
 #include <dev/aic7xxx/aic7xxx_osm.h>
 #include <dev/aic7xxx/aic7xxx_inline.h>
@@ -1663,6 +1663,7 @@
 ahc_modevent(module_t mod, int type, void *data)
 {
 	/* XXX Deal with busy status on unload. */
+	/* XXX Deal with unknown events */
 	return 0;
 }
   

==== //depot/projects/netperf_socket/sys/dev/bktr/bktr_mem.c#4 (text+ko) ====

@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bktr/bktr_mem.c,v 1.10 2004/06/11 18:47:44 schweikh Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bktr/bktr_mem.c,v 1.11 2004/07/15 08:26:00 phk Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -88,6 +88,7 @@
 		printf("bktr_mem: memory holder cannot be unloaded\n");
 		return EBUSY;
 	default:
+		return EOPNOTSUPP;
 		break;
 	}
 	return (0);

==== //depot/projects/netperf_socket/sys/dev/cx/if_cx.c#13 (text+ko) ====

@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/cx/if_cx.c,v 1.26 2004/07/11 15:18:37 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/cx/if_cx.c,v 1.27 2004/07/15 20:47:37 phk Exp $");
 
 #include <sys/param.h>
 
@@ -1640,7 +1640,7 @@
 		cx_set_rts (d->chan, 0);
 		ttydtrwaitstart(d->tty);
 	}
-	ttyclose (d->tty);
+	tty_close (d->tty);
 	splx (s);
 	d->callout = 0;
 

==== //depot/projects/netperf_socket/sys/dev/cy/cy.c#12 (text+ko) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/cy/cy.c,v 1.158 2004/07/11 15:18:37 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/cy/cy.c,v 1.159 2004/07/15 20:47:37 phk Exp $");
 
 #include "opt_compat.h"
 
@@ -786,7 +786,7 @@
 	ttyld_close(tp, flag);
 	disc_optim(tp, &tp->t_termios, com);
 	comhardclose(com);
-	ttyclose(tp);
+	tty_close(tp);
 	siosettimeout();
 	splx(s);
 #ifdef broken /* session holds a ref to the tty; can't deallocate */

==== //depot/projects/netperf_socket/sys/dev/dcons/dcons.c#9 (text+ko) ====

@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  * 
  * $Id: dcons.c,v 1.65 2003/10/24 03:24:55 simokawa Exp $
- * $FreeBSD: src/sys/dev/dcons/dcons.c,v 1.14 2004/07/13 09:41:45 simokawa Exp $
+ * $FreeBSD: src/sys/dev/dcons/dcons.c,v 1.16 2004/07/15 20:47:37 phk Exp $
  */
 
 #include <sys/param.h>
@@ -230,7 +230,7 @@
 	tp = dev->si_tty;
 	if (tp->t_state & TS_ISOPEN) {
 		ttyld_close(tp, flag);
-		ttyclose(tp);
+		tty_close(tp);
 	}
 
 	return (0);
@@ -597,7 +597,7 @@
 	if (tp->t_state & TS_ISOPEN) {
 		printf("dcons: still opened\n");
 		ttyld_close(tp, 0);
-		ttyclose(tp);
+		tty_close(tp);
 	}
 	/* XXX
 	 * must wait until all device are closed.
@@ -651,6 +651,9 @@
 		break;
 	case MOD_SHUTDOWN:
 		break;
+	default:
+		err = EOPNOTSUPP;
+		break;
 	}
 	return(err);
 }

==== //depot/projects/netperf_socket/sys/dev/digi/digi.c#13 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/digi/digi.c,v 1.53 2004/07/13 19:36:58 phk Exp $
+ * $FreeBSD: src/sys/dev/digi/digi.c,v 1.54 2004/07/15 20:47:37 phk Exp $
  */
 
 /*-
@@ -893,7 +893,7 @@
 	ttyld_close(tp, flag);
 	ttyldoptim(tp);
 	digihardclose(port);
-	ttyclose(tp);
+	tty_close(tp);
 	if (--sc->opencnt == 0)
 		splx(s);
 	return (0);

==== //depot/projects/netperf_socket/sys/dev/fb/fb.c#3 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/fb/fb.c,v 1.31 2004/02/21 21:10:42 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/fb/fb.c,v 1.32 2004/07/15 08:26:00 phk Exp $");
 
 #include "opt_fb.h"
 
@@ -386,6 +386,8 @@
 	case MOD_UNLOAD: 
 		printf("fb module unload - not possible for this module type\n"); 
 		return EINVAL; 
+	default:
+		return EOPNOTSUPP;
 	} 
 	return 0; 
 } 

==== //depot/projects/netperf_socket/sys/dev/fb/splashreg.h#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/fb/splashreg.h,v 1.5 2000/04/29 13:33:18 peter Exp $
+ * $FreeBSD: src/sys/dev/fb/splashreg.h,v 1.6 2004/07/15 08:26:01 phk Exp $
  */
 
 #ifndef _DEV_FB_SPLASHREG_H_
@@ -55,6 +55,7 @@
 		case MOD_UNLOAD:				\
 			return splash_unregister(&sw);		\
 		default:					\
+			return EOPNOTSUPP;			\
 			break;					\
 		}						\
 		return 0;					\
@@ -76,6 +77,7 @@
 		case MOD_UNLOAD:				\
 			return splash_unregister(&sw);		\
 		default:					\
+			return EOPNOTSUPP;			\
 			break;					\
 		}						\
 		return 0;					\

==== //depot/projects/netperf_socket/sys/dev/fdc/fdc.c#6 (text+ko) ====

@@ -49,7 +49,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/fdc/fdc.c,v 1.280 2004/07/14 07:04:17 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/fdc/fdc.c,v 1.281 2004/07/15 16:39:40 njl Exp $");
 
 #include "opt_fdc.h"
 
@@ -241,7 +241,6 @@
 static int fd_sense_drive_status(fdc_p, int *);
 static int fd_sense_int(fdc_p, int *, int *);
 static int fd_read_status(fdc_p);
-static void fdc_add_child(device_t, const char *, int);
 static int fd_probe(device_t);
 static int fd_attach(device_t);
 static int fd_detach(device_t);
@@ -517,29 +516,38 @@
 	device_t dev;
 
 	dev = fdc->fdc_dev;
+	if (fdc->fdc_intr) {
+		BUS_TEARDOWN_INTR(device_get_parent(dev), dev, fdc->res_irq,
+		    fdc->fdc_intr);
+		fdc->fdc_intr = NULL;
+	}
 	if (fdc->res_irq != 0) {
 		bus_deactivate_resource(dev, SYS_RES_IRQ, fdc->rid_irq,
 					fdc->res_irq);
 		bus_release_resource(dev, SYS_RES_IRQ, fdc->rid_irq,
 				     fdc->res_irq);
+		fdc->res_irq = NULL;
 	}
 	if (fdc->res_ctl != 0) {
 		bus_deactivate_resource(dev, SYS_RES_IOPORT, fdc->rid_ctl,
 					fdc->res_ctl);
 		bus_release_resource(dev, SYS_RES_IOPORT, fdc->rid_ctl,
 				     fdc->res_ctl);
+		fdc->res_ctl = NULL;
 	}
 	if (fdc->res_ioport != 0) {
 		bus_deactivate_resource(dev, SYS_RES_IOPORT, fdc->rid_ioport,
 					fdc->res_ioport);
 		bus_release_resource(dev, SYS_RES_IOPORT, fdc->rid_ioport,
 				     fdc->res_ioport);
+		fdc->res_ioport = NULL;
 	}
 	if (fdc->res_drq != 0) {
 		bus_deactivate_resource(dev, SYS_RES_DRQ, fdc->rid_drq,
 					fdc->res_drq);
 		bus_release_resource(dev, SYS_RES_DRQ, fdc->rid_drq,
 				     fdc->res_drq);
+		fdc->res_ioport = NULL;
 	}
 }
 
@@ -613,14 +621,6 @@
 	/* reset controller, turn motor off */
 	fdout_wr(fdc, 0);
 
-	if ((fdc->flags & FDC_ATTACHED) == 0) {
-		device_printf(dev, "already unloaded\n");
-		return (0);
-	}
-	fdc->flags &= ~FDC_ATTACHED;
-
-	BUS_TEARDOWN_INTR(device_get_parent(dev), dev, fdc->res_irq,
-			  fdc->fdc_intr);
 	fdc_release_resources(fdc);
 	return (0);
 }
@@ -628,38 +628,36 @@
 /*
  * Add a child device to the fdc controller.  It will then be probed etc.
  */
-static void
+device_t
 fdc_add_child(device_t dev, const char *name, int unit)
 {
-	int	fdu, flags;
+	int flags;
 	struct fdc_ivars *ivar;
 	device_t child;

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list