Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Jun 2011 14:03:11 +0000 (UTC)
From:      Andreas Tobler <andreast@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r223503 - in projects/pseries: amd64/ia32 amd64/include amd64/pci boot/common boot/i386/libi386 boot/i386/zfsboot cam/ata cam/scsi cddl/contrib/opensolaris/uts/common/sys compat/freebsd...
Message-ID:  <201106241403.p5OE3BqB057097@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andreast
Date: Fri Jun 24 14:03:10 2011
New Revision: 223503
URL: http://svn.freebsd.org/changeset/base/223503

Log:
  MFC.

Added:
  projects/pseries/dev/usb/template/usb_template_audio.c
     - copied unchanged from r223501, head/sys/dev/usb/template/usb_template_audio.c
  projects/pseries/dev/usb/template/usb_template_kbd.c
     - copied unchanged from r223501, head/sys/dev/usb/template/usb_template_kbd.c
  projects/pseries/dev/usb/template/usb_template_modem.c
     - copied unchanged from r223501, head/sys/dev/usb/template/usb_template_modem.c
  projects/pseries/dev/usb/template/usb_template_mouse.c
     - copied unchanged from r223501, head/sys/dev/usb/template/usb_template_mouse.c
  projects/pseries/fs/nfsclient/nfs_clkdtrace.c
     - copied unchanged from r223501, head/sys/fs/nfsclient/nfs_clkdtrace.c
  projects/pseries/fs/nfsclient/nfs_kdtrace.h
     - copied unchanged from r223501, head/sys/fs/nfsclient/nfs_kdtrace.h
  projects/pseries/modules/dtrace/dtnfscl/
     - copied from r223501, head/sys/modules/dtrace/dtnfscl/
  projects/pseries/powerpc/ps3/ohci_ps3.c
     - copied unchanged from r223501, head/sys/powerpc/ps3/ohci_ps3.c
  projects/pseries/powerpc/ps3/ps3disk.c
     - copied unchanged from r223501, head/sys/powerpc/ps3/ps3disk.c
  projects/pseries/x86/include/pci_cfgreg.h
     - copied unchanged from r223501, head/sys/x86/include/pci_cfgreg.h
  projects/pseries/x86/pci/pci_bus.c
     - copied unchanged from r223501, head/sys/x86/pci/pci_bus.c
Deleted:
  projects/pseries/amd64/pci/pci_bus.c
  projects/pseries/i386/pci/pci_bus.c
Modified:
  projects/pseries/amd64/ia32/ia32_sigtramp.S
  projects/pseries/amd64/include/pci_cfgreg.h
  projects/pseries/boot/common/load_elf_obj.c
  projects/pseries/boot/i386/libi386/biosacpi.c
  projects/pseries/boot/i386/zfsboot/zfsldr.S
  projects/pseries/cam/ata/ata_da.c
  projects/pseries/cam/ata/ata_xpt.c
  projects/pseries/cam/scsi/scsi_xpt.c
  projects/pseries/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h
  projects/pseries/compat/freebsd32/freebsd32_misc.c
  projects/pseries/compat/freebsd32/freebsd32_proto.h
  projects/pseries/compat/freebsd32/freebsd32_syscall.h
  projects/pseries/compat/freebsd32/freebsd32_syscalls.c
  projects/pseries/compat/freebsd32/freebsd32_sysent.c
  projects/pseries/compat/freebsd32/syscalls.master
  projects/pseries/compat/linprocfs/linprocfs.c
  projects/pseries/conf/files
  projects/pseries/conf/files.amd64
  projects/pseries/conf/files.i386
  projects/pseries/conf/files.pc98
  projects/pseries/conf/files.powerpc
  projects/pseries/dev/acpica/acpi.c
  projects/pseries/dev/acpica/acpi_cpu.c
  projects/pseries/dev/acpica/acpi_pci.c
  projects/pseries/dev/acpica/acpi_pcib_acpi.c
  projects/pseries/dev/acpica/acpi_resource.c
  projects/pseries/dev/acpica/acpivar.h
  projects/pseries/dev/ath/ah_osdep.c
  projects/pseries/dev/ath/ath_hal/ah.h
  projects/pseries/dev/ath/ath_hal/ah_internal.h
  projects/pseries/dev/ath/ath_hal/ah_regdomain.c
  projects/pseries/dev/ath/ath_hal/ar5210/ar5210_attach.c
  projects/pseries/dev/ath/ath_hal/ar5210/ar5210_beacon.c
  projects/pseries/dev/ath/ath_hal/ar5211/ar5211_attach.c
  projects/pseries/dev/ath/ath_hal/ar5211/ar5211_beacon.c
  projects/pseries/dev/ath/ath_hal/ar5211/ar5211_xmit.c
  projects/pseries/dev/ath/ath_hal/ar5212/ar5112.c
  projects/pseries/dev/ath/ath_hal/ar5212/ar5212_attach.c
  projects/pseries/dev/ath/ath_hal/ar5212/ar5212_beacon.c
  projects/pseries/dev/ath/ath_hal/ar5212/ar5212_xmit.c
  projects/pseries/dev/ath/ath_hal/ar5312/ar5312_attach.c
  projects/pseries/dev/ath/ath_hal/ar5416/ar2133.c
  projects/pseries/dev/ath/ath_hal/ar5416/ar5416_attach.c
  projects/pseries/dev/ath/ath_hal/ar5416/ar5416_beacon.c
  projects/pseries/dev/ath/ath_hal/ar5416/ar5416_misc.c
  projects/pseries/dev/ath/ath_hal/ar5416/ar5416_xmit.c
  projects/pseries/dev/ath/ath_hal/ar9001/ar9130_attach.c
  projects/pseries/dev/ath/ath_hal/ar9001/ar9160_attach.c
  projects/pseries/dev/ath/ath_hal/ar9002/ar9280_attach.c
  projects/pseries/dev/ath/ath_hal/ar9002/ar9285_attach.c
  projects/pseries/dev/ath/ath_hal/ar9002/ar9287_attach.c
  projects/pseries/dev/ath/if_ath.c
  projects/pseries/dev/ath/if_ath_sysctl.c
  projects/pseries/dev/ath/if_ath_sysctl.h
  projects/pseries/dev/atkbdc/atkbd.c
  projects/pseries/dev/cardbus/cardbus_cis.c
  projects/pseries/dev/dc/if_dc.c
  projects/pseries/dev/e1000/if_igb.c
  projects/pseries/dev/e1000/if_igb.h
  projects/pseries/dev/firewire/fwohci.c
  projects/pseries/dev/pccbb/pccbb.c
  projects/pseries/dev/pccbb/pccbb_pci.c
  projects/pseries/dev/pci/pci.c
  projects/pseries/dev/sound/usb/uaudio.c
  projects/pseries/dev/usb/input/atp.c
  projects/pseries/dev/usb/input/uhid.c
  projects/pseries/dev/usb/net/if_aue.c
  projects/pseries/dev/usb/net/if_axe.c
  projects/pseries/dev/usb/net/if_cdce.c
  projects/pseries/dev/usb/net/if_cue.c
  projects/pseries/dev/usb/net/if_ipheth.c
  projects/pseries/dev/usb/net/if_kue.c
  projects/pseries/dev/usb/net/if_mos.c
  projects/pseries/dev/usb/net/if_rue.c
  projects/pseries/dev/usb/net/if_udav.c
  projects/pseries/dev/usb/net/uhso.c
  projects/pseries/dev/usb/serial/u3g.c
  projects/pseries/dev/usb/serial/uark.c
  projects/pseries/dev/usb/serial/ubsa.c
  projects/pseries/dev/usb/serial/uchcom.c
  projects/pseries/dev/usb/serial/ucycom.c
  projects/pseries/dev/usb/serial/uftdi.c
  projects/pseries/dev/usb/serial/ugensa.c
  projects/pseries/dev/usb/serial/uipaq.c
  projects/pseries/dev/usb/serial/ulpt.c
  projects/pseries/dev/usb/serial/umcs.c
  projects/pseries/dev/usb/serial/umct.c
  projects/pseries/dev/usb/serial/umodem.c
  projects/pseries/dev/usb/serial/umoscom.c
  projects/pseries/dev/usb/serial/uplcom.c
  projects/pseries/dev/usb/serial/uslcom.c
  projects/pseries/dev/usb/serial/uvisor.c
  projects/pseries/dev/usb/serial/uvscom.c
  projects/pseries/dev/usb/storage/umass.c
  projects/pseries/dev/usb/template/usb_template.c
  projects/pseries/dev/usb/template/usb_template.h
  projects/pseries/dev/usb/template/usb_template_cdce.c
  projects/pseries/dev/usb/template/usb_template_msc.c
  projects/pseries/dev/usb/template/usb_template_mtp.c
  projects/pseries/dev/usb/usb_hub.c
  projects/pseries/dev/usb/usb_ioctl.h
  projects/pseries/dev/usb/usb_lookup.c
  projects/pseries/dev/usb/usbdevs
  projects/pseries/dev/usb/usbdi.h
  projects/pseries/dev/usb/wlan/if_rum.c
  projects/pseries/dev/usb/wlan/if_run.c
  projects/pseries/dev/usb/wlan/if_uath.c
  projects/pseries/dev/usb/wlan/if_upgt.c
  projects/pseries/dev/usb/wlan/if_ural.c
  projects/pseries/dev/usb/wlan/if_urtw.c
  projects/pseries/dev/usb/wlan/if_zyd.c
  projects/pseries/dev/vr/if_vr.c
  projects/pseries/dev/vr/if_vrreg.h
  projects/pseries/dev/xl/if_xl.c
  projects/pseries/fs/nfs/nfs_commonkrpc.c
  projects/pseries/fs/nfs/nfsport.h
  projects/pseries/fs/nfs/nfsproto.h
  projects/pseries/fs/nfsclient/nfs_clbio.c
  projects/pseries/fs/nfsclient/nfs_clkrpc.c
  projects/pseries/fs/nfsclient/nfs_clnode.c
  projects/pseries/fs/nfsclient/nfs_clport.c
  projects/pseries/fs/nfsclient/nfs_clsubs.c
  projects/pseries/fs/nfsclient/nfs_clvnops.c
  projects/pseries/fs/nfsserver/nfs_nfsdcache.c
  projects/pseries/fs/nfsserver/nfs_nfsdkrpc.c
  projects/pseries/fs/nfsserver/nfs_nfsdserv.c
  projects/pseries/fs/nfsserver/nfs_nfsdsocket.c
  projects/pseries/geom/part/g_part_bsd.c
  projects/pseries/i386/include/param.h
  projects/pseries/i386/include/pci_cfgreg.h
  projects/pseries/ia64/conf/NOTES
  projects/pseries/ia64/ia64/busdma_machdep.c
  projects/pseries/ia64/ia64/machdep.c
  projects/pseries/ia64/ia64/pmap.c
  projects/pseries/ia64/include/ia64_cpu.h
  projects/pseries/kern/imgact_aout.c
  projects/pseries/kern/kern_clocksource.c
  projects/pseries/kern/sys_process.c
  projects/pseries/kgssapi/gss_impl.c
  projects/pseries/modules/Makefile
  projects/pseries/modules/cxgbe/if_cxgbe/Makefile
  projects/pseries/modules/dtrace/Makefile
  projects/pseries/modules/dtrace/dtraceall/dtraceall.c
  projects/pseries/modules/kgssapi_krb5/Makefile
  projects/pseries/modules/nfscl/Makefile
  projects/pseries/modules/nfscommon/Makefile
  projects/pseries/modules/usb/template/Makefile
  projects/pseries/net/if_gre.c
  projects/pseries/net/if_gre.h
  projects/pseries/net/route.c
  projects/pseries/net/route.h
  projects/pseries/net80211/ieee80211_ht.c
  projects/pseries/net80211/ieee80211_var.h
  projects/pseries/netgraph/bluetooth/drivers/ubt/ng_ubt.c
  projects/pseries/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c
  projects/pseries/netgraph/ng_ether.c
  projects/pseries/netinet/if_ether.c
  projects/pseries/netinet/ipfw/ip_dn_io.c
  projects/pseries/netinet/ipfw/ip_fw_pfil.c
  projects/pseries/netinet/libalias/alias_db.c
  projects/pseries/netinet/libalias/alias_ftp.c
  projects/pseries/netinet/libalias/alias_local.h
  projects/pseries/netinet/libalias/libalias.3
  projects/pseries/netinet/sctp.h
  projects/pseries/netinet/sctp_uio.h
  projects/pseries/netinet/sctp_usrreq.c
  projects/pseries/netinet/tcp_output.c
  projects/pseries/nfsclient/nfs_krpc.c
  projects/pseries/nfsserver/nfs_srvkrpc.c
  projects/pseries/powerpc/aim/copyinout.c
  projects/pseries/powerpc/aim/locore32.S
  projects/pseries/powerpc/aim/locore64.S
  projects/pseries/powerpc/aim/machdep.c
  projects/pseries/powerpc/aim/mmu_oea64.c
  projects/pseries/powerpc/aim/mp_cpudep.c
  projects/pseries/powerpc/aim/swtch32.S
  projects/pseries/powerpc/aim/swtch64.S
  projects/pseries/powerpc/aim/trap.c
  projects/pseries/powerpc/aim/trap_subr32.S
  projects/pseries/powerpc/aim/trap_subr64.S
  projects/pseries/powerpc/booke/copyinout.c
  projects/pseries/powerpc/booke/interrupt.c
  projects/pseries/powerpc/booke/trap.c
  projects/pseries/powerpc/include/pcpu.h
  projects/pseries/powerpc/ofw/ofwcall32.S
  projects/pseries/powerpc/powerpc/db_trace.c
  projects/pseries/powerpc/powerpc/mp_machdep.c
  projects/pseries/powerpc/ps3/if_glc.c
  projects/pseries/powerpc/ps3/ps3-hvcall.h
  projects/pseries/powerpc/ps3/ps3-hvcall.master
  projects/pseries/powerpc/ps3/ps3bus.c
  projects/pseries/powerpc/ps3/ps3bus.h
  projects/pseries/powerpc/ps3/ps3pic.c
  projects/pseries/rpc/rpc_generic.c
  projects/pseries/rpc/rpcsec_gss.h
  projects/pseries/sparc64/include/tsb.h
  projects/pseries/sparc64/include/vmparam.h
  projects/pseries/sparc64/sparc64/intr_machdep.c
  projects/pseries/sparc64/sparc64/mp_machdep.c
  projects/pseries/sparc64/sparc64/pmap.c
  projects/pseries/sparc64/sparc64/tlb.c
  projects/pseries/sys/diskpc98.h
  projects/pseries/sys/dtrace_bsd.h
  projects/pseries/sys/param.h
  projects/pseries/sys/systm.h
  projects/pseries/ufs/ffs/ffs_alloc.c
  projects/pseries/ufs/ffs/ffs_extern.h
  projects/pseries/ufs/ffs/ffs_snapshot.c
  projects/pseries/ufs/ffs/ffs_softdep.c
  projects/pseries/vm/vm_fault.c
  projects/pseries/vm/vm_page.c
  projects/pseries/vm/vm_page.h
  projects/pseries/x86/x86/tsc.c
Directory Properties:
  projects/pseries/   (props changed)
  projects/pseries/amd64/include/xen/   (props changed)
  projects/pseries/boot/   (props changed)
  projects/pseries/boot/i386/efi/   (props changed)
  projects/pseries/boot/ia64/efi/   (props changed)
  projects/pseries/boot/ia64/ski/   (props changed)
  projects/pseries/boot/powerpc/boot1.chrp/   (props changed)
  projects/pseries/boot/powerpc/ofw/   (props changed)
  projects/pseries/cddl/contrib/opensolaris/   (props changed)
  projects/pseries/conf/   (props changed)
  projects/pseries/contrib/dev/acpica/   (props changed)
  projects/pseries/contrib/octeon-sdk/   (props changed)
  projects/pseries/contrib/pf/   (props changed)
  projects/pseries/contrib/x86emu/   (props changed)

Modified: projects/pseries/amd64/ia32/ia32_sigtramp.S
==============================================================================
--- projects/pseries/amd64/ia32/ia32_sigtramp.S	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/amd64/ia32/ia32_sigtramp.S	Fri Jun 24 14:03:10 2011	(r223503)
@@ -79,8 +79,20 @@ ia32_osigcode:
 	jmp	1b
 
 
+/*
+ * The lcall $7,$0 emulator cannot use the call gate that does an
+ * inter-privilege transition. The reason is that the call gate
+ * does not disable interrupts, and, before the swapgs is
+ * executed, we would have a window where the ring 0 code is
+ * executed with the wrong gsbase.
+ *
+ * Instead, reflect the lcall $7,$0 back to ring 3 trampoline
+ * which sets up the frame for int $0x80.
+ */
 	ALIGN_TEXT
 lcall_tramp:
+	cmpl	$SYS_vfork,%eax
+	je	2f
 	pushl	%ebp
 	movl	%esp,%ebp
 	pushl	0x24(%ebp) /* arg 6 */
@@ -91,8 +103,19 @@ lcall_tramp:
 	pushl	0x10(%ebp) /* arg 1 */
 	pushl	0xc(%ebp) /* gap */
 	int	$0x80
-	leave
+	leavel
+1:
 	lretl
+2:
+	/*
+	 * vfork handling is special and relies on the libc stub saving
+	 * the return ip in %ecx.  If vfork failed, then there is no
+	 * child which can corrupt the frame created by call gate.
+	 */
+	int	$0x80
+	jb	1b
+	addl	$8,%esp
+	jmpl	*%ecx
 #endif
 
 	ALIGN_TEXT

Modified: projects/pseries/amd64/include/pci_cfgreg.h
==============================================================================
--- projects/pseries/amd64/include/pci_cfgreg.h	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/amd64/include/pci_cfgreg.h	Fri Jun 24 14:03:10 2011	(r223503)
@@ -1,43 +1,6 @@
 /*-
- * Copyright (c) 1997, Stefan Esser <se@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice unmodified, this list of conditions, and the following
- *    disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (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$
- *
+ * This file is in the public domain.
  */
+/* $FreeBSD$ */
 
-#define CONF1_ADDR_PORT    0x0cf8
-#define CONF1_DATA_PORT    0x0cfc
-
-#define CONF1_ENABLE       0x80000000ul
-#define CONF1_ENABLE_CHK   0x80000000ul
-#define CONF1_ENABLE_MSK   0x7f000000ul
-#define CONF1_ENABLE_CHK1  0xff000001ul
-#define CONF1_ENABLE_MSK1  0x80000001ul
-#define CONF1_ENABLE_RES1  0x80000000ul
-
-int		pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus);
-int		pci_cfgregopen(void);
-u_int32_t	pci_cfgregread(int bus, int slot, int func, int reg, int bytes);
-void		pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes);
+#include <x86/pci_cfgreg.h>

Modified: projects/pseries/boot/common/load_elf_obj.c
==============================================================================
--- projects/pseries/boot/common/load_elf_obj.c	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/boot/common/load_elf_obj.c	Fri Jun 24 14:03:10 2011	(r223503)
@@ -196,7 +196,7 @@ static int
 __elfN(obj_loadimage)(struct preloaded_file *fp, elf_file_t ef, u_int64_t off)
 {
 	Elf_Ehdr *hdr;
-	Elf_Shdr *shdr;
+	Elf_Shdr *shdr, *cshdr, *lshdr;
 	vm_offset_t firstaddr, lastaddr;
 	int i, nsym, res, ret, shdrbytes, symstrindex;
 
@@ -294,12 +294,35 @@ __elfN(obj_loadimage)(struct preloaded_f
 	/* Clear the whole area, including bss regions. */
 	kern_bzero(firstaddr, lastaddr - firstaddr);
 
-	/* Now read it all in. */
-	for (i = 0; i < hdr->e_shnum; i++) {
-		if (shdr[i].sh_addr == 0 || shdr[i].sh_type == SHT_NOBITS)
-			continue;
-		if (kern_pread(ef->fd, (vm_offset_t)shdr[i].sh_addr,
-		    shdr[i].sh_size, (off_t)shdr[i].sh_offset) != 0) {
+	/* Figure section with the lowest file offset we haven't loaded yet. */
+	for (cshdr = NULL; /* none */; /* none */)
+	{
+		/*
+		 * Find next section to load. The complexity of this loop is
+		 * O(n^2), but with  the number of sections being typically
+		 * small, we do not care.
+		 */
+		lshdr = cshdr;
+
+		for (i = 0; i < hdr->e_shnum; i++) {
+			if (shdr[i].sh_addr == 0 ||
+			    shdr[i].sh_type == SHT_NOBITS)
+				continue;
+			/* Skip sections that were loaded already. */
+			if (lshdr != NULL &&
+			    lshdr->sh_offset >= shdr[i].sh_offset)
+				continue;
+			/* Find section with smallest offset. */
+			if (cshdr == lshdr ||
+			    cshdr->sh_offset > shdr[i].sh_offset)
+				cshdr = &shdr[i];
+		}
+
+		if (cshdr == lshdr)
+			break;
+
+		if (kern_pread(ef->fd, (vm_offset_t)cshdr->sh_addr,
+		    cshdr->sh_size, (off_t)cshdr->sh_offset) != 0) {
 			printf("\nelf" __XSTRING(__ELF_WORD_SIZE)
 			    "_obj_loadimage: read failed\n");
 			goto out;

Modified: projects/pseries/boot/i386/libi386/biosacpi.c
==============================================================================
--- projects/pseries/boot/i386/libi386/biosacpi.c	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/boot/i386/libi386/biosacpi.c	Fri Jun 24 14:03:10 2011	(r223503)
@@ -61,7 +61,7 @@ biosacpi_detect(void)
 	return;
 
     /* export values from the RSDP */
-    sprintf(buf, "%p", VTOP(rsdp));
+    sprintf(buf, "%u", VTOP(rsdp));
     setenv("hint.acpi.0.rsdp", buf, 1);
     revision = rsdp->Revision;
     if (revision == 0)

Modified: projects/pseries/boot/i386/zfsboot/zfsldr.S
==============================================================================
--- projects/pseries/boot/i386/zfsboot/zfsldr.S	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/boot/i386/zfsboot/zfsldr.S	Fri Jun 24 14:03:10 2011	(r223503)
@@ -16,7 +16,6 @@
  */
 
 /* Memory Locations */
-		.set MEM_REL,0x700		# Relocation address
 		.set MEM_ARG,0x900		# Arguments
 		.set MEM_ORG,0x7c00		# Origin
 		.set MEM_BUF,0x8000		# Load area
@@ -91,26 +90,18 @@ main:		cld				# String ops inc
 		mov %cx,%ss			# Set up
 		mov $start,%sp			#  stack
 /*
- * Relocate ourself to MEM_REL.  Since %cx == 0, the inc %ch sets
- * %cx == 0x100.
- */
-		mov %sp,%si			# Source
-		mov $MEM_REL,%di		# Destination
-		incb %ch			# Word count
-		rep				# Copy
-		movsw				#  code
-/*
  * If we are on a hard drive, then load the MBR and look for the first
  * FreeBSD slice.  We use the fake partition entry below that points to
  * the MBR when we call nread.  The first pass looks for the first active
  * FreeBSD slice.  The second pass looks for the first non-active FreeBSD
  * slice if the first one fails.
  */
-		mov $part4,%si			# Partition
+		mov $part4,%si			# Dummy partition
 		cmpb $0x80,%dl			# Hard drive?
 		jb main.4			# No
-		movb $0x1,%dh			# Block count
-		callw nread			# Read MBR
+		xor %eax,%eax			# Read MBR
+		movl $MEM_BUF,%ebx		#  from first
+		callw nread			#  sector
 		mov $0x1,%cx	 		# Two passes
 main.1: 	mov $MEM_BUF+PRT_OFF,%si	# Partition table
 		movb $0x1,%dh			# Partition
@@ -139,52 +130,51 @@ main.4: 	xor %dx,%dx			# Partition:drive
 /*
  * Ok, we have a slice and drive in %dx now, so use that to locate and
  * load boot2.  %si references the start of the slice we are looking
- * for, so go ahead and load up the 64 sectors starting at sector 1024
+ * for, so go ahead and load up the 128 sectors starting at sector 1024
  * (i.e. after the two vdev labels).  We don't have do anything fancy
  * here to allow for an extra copy of boot1 and a partition table
  * (compare to this section of the UFS bootstrap) so we just load it
- * all at 0x8000. The first part of boot2 is BTX, which wants to run
+ * all at 0x9000. The first part of boot2 is BTX, which wants to run
  * at 0x9000. The boot2.bin binary starts right after the end of BTX,
  * so we have to figure out where the start of it is and then move the
- * binary to 0xc000. After we have moved the client, we relocate BTX
- * itself to 0x9000 - doing it in this order means that none of the
- * memcpy regions overlap which would corrupt the copy.  Normally, BTX
- * clients start at MEM_USR, or 0xa000, but when we use btxld to
- * create zfsboot2, we use an entry point of 0x2000.  That entry point is
- * relative to MEM_USR; thus boot2.bin starts at 0xc000.
+ * binary to 0xc000.  Normally, BTX clients start at MEM_USR, or 0xa000,
+ * but when we use btxld to create zfsboot2, we use an entry point of
+ * 0x2000.  That entry point is relative to MEM_USR; thus boot2.bin
+ * starts at 0xc000.
  *
  * The load area and the target area for the client overlap so we have
  * to use a decrementing string move. We also play segment register
  * games with the destination address for the move so that the client
  * can be larger than 16k (which would overflow the zero segment since
- * the client starts at 0xc000). Relocating BTX is easy since the load
- * area and target area do not overlap.
+ * the client starts at 0xc000).
  */
 main.5: 	mov %dx,MEM_ARG			# Save args
-		movb $NSECT,%dh			# Sector count
+		mov $NSECT,%cx			# Sector count
 		movl $1024,%eax			# Offset to boot2
-		callw nread.1			# Read disk
-main.6:		mov $MEM_BUF,%si		# BTX (before reloc)
-		mov 0xa(%si),%bx		# Get BTX length and set
+		mov $MEM_BTX,%ebx		# Destination buffer
+main.6:		pushal				# Save params
+		callw nread			# Read disk
+		popal				# Restore
+		incl %eax			# Advance to
+		add $SIZ_SEC,%ebx		#  next sector
+		loop main.6			# If not last, read another
+		mov MEM_BTX+0xa,%bx		# Get BTX length
 		mov $NSECT*SIZ_SEC-1,%di	# Size of load area (less one)
-		mov %di,%si			# End of load
-		add $MEM_BUF,%si		#  area
+		mov %di,%si			# End of load area, 0x9000 rel
 		sub %bx,%di			# End of client, 0xc000 rel
 		mov %di,%cx			# Size of
 		inc %cx				#  client
+		mov $(MEM_BTX)>>4,%dx		# Segment
+		mov %dx,%ds			#   addressing 0x9000
 		mov $(MEM_USR+2*SIZ_PAG)>>4,%dx	# Segment
 		mov %dx,%es			#   addressing 0xc000
 		std				# Move with decrement
 		rep				# Relocate
 		movsb				#  client
-		mov %ds,%dx			# Back to
-		mov %dx,%es			#  zero segment
-		mov $MEM_BUF,%si		# BTX (before reloc)
-		mov $MEM_BTX,%di		# BTX
-		mov %bx,%cx			# Get BTX length
-		cld				# Increment this time
-		rep				# Relocate
-		movsb				#  BTX
+		cld				# Back to increment
+		xor %dx,%dx			# Back
+		mov %ds,%dx			#  to zero
+		mov %dx,%es			#  segment
 
 /*
  * Enable A20 so we can access memory above 1 meg.
@@ -211,32 +201,35 @@ seta20.3:	sti				# Enable interrupts
 
 /*
  * Trampoline used to call read from within zfsldr.  Sets up an EDD
- * packet on the stack and passes it to read.
+ * packet on the stack and passes it to read.  We assume that the
+ * destination address is always segment-aligned.
  *
  * %eax		- int     - LBA to read in relative to partition start
+ * %ebx		- ptr	  - destination address
  * %dl		- byte    - drive to read from
- * %dh		- byte    - num sectors to read
  * %si		- ptr     - MBR partition entry
  */
-nread:		xor %eax,%eax			# Sector offset in partition
-nread.1:	xor %ecx,%ecx			# Get
+nread:		xor %ecx,%ecx			# Get
 		addl 0x8(%si),%eax		#  LBA
 		adc $0,%ecx
 		pushl %ecx			# Starting absolute block
 		pushl %eax			#  block number
-		push %es			# Address of
-		push $MEM_BUF			#  transfer buffer
-		xor %ax,%ax			# Number of
-		movb %dh,%al			#  blocks to
-		push %ax			#  transfer
+		shr $4,%ebx			# Convert to segment
+		push %bx			# Address of
+		push $0				#  transfer buffer
+		push $0x1			# Read 1 sector
 		push $0x10			# Size of packet
 		mov %sp,%bp			# Packet pointer
 		callw read			# Read from disk
+		jc nread.1			# If error, fail
 		lea 0x10(%bp),%sp		# Clear stack
-		jnc return			# If success, return
-		mov $msg_read,%si		# Otherwise, set the error
-						#  message and fall through to
-						#  the error routine
+		ret				# If success, return
+nread.1:	mov %ah,%al			# Format
+		mov $read_err,%di		#  error
+		call hex8			#  code
+		mov $msg_read,%si		# Set the error message and
+						#  fall through to the error
+						#  routine
 /*
  * Print out the error message pointed to by %ds:(%si) followed
  * by a prompt, wait for a keypress, and then reboot the machine.
@@ -259,14 +252,6 @@ putstr: 	lodsb				# Get char
 		jne putstr.0			# No
 
 /*
- * Overused return code.  ereturn is used to return an error from the
- * read function.  Since we assume putstr succeeds, we (ab)use the
- * same code when we return from putstr.
- */
-ereturn:	movb $0x1,%ah			# Invalid
-		stc				#  argument
-return: 	retw				# To caller
-/*
  * Reads sectors from the disk.  If EDD is enabled, then check if it is
  * installed and use it if it is.  If it is not installed or not enabled, then
  * fall back to using CHS.  Since we use a LBA, if we are using CHS, we have to
@@ -294,14 +279,30 @@ read:		cmpb $0x80,%dl			# Hard drive?
 		retw				# To caller
 read.1:		mov $msg_chs,%si
 		jmp error
-msg_chs:	.asciz "CHS not supported"
+
+/*
+ * AL to hex, saving the result to [EDI].
+ */
+hex8:		push %ax			# Save
+		shrb $0x4,%al			# Do upper
+		call hex8.1			#  4
+		pop %ax				# Restore
+hex8.1: 	andb $0xf,%al			# Get lower 4
+		cmpb $0xa,%al			# Convert
+		sbbb $0x69,%al			#  to hex
+		das				#  digit
+		orb $0x20,%al			# To lower case
+		stosb				# Save char
+		ret				# (Recursive)
 
 /* Messages */
 
-msg_read:	.asciz "Read"
-msg_part:	.asciz "Boot"
+msg_chs:	.asciz "CHS not supported"
+msg_read:	.ascii "Read error: "
+read_err:	.asciz "XX"
+msg_part:	.asciz "Boot error"
 
-prompt: 	.asciz " error\r\n"
+prompt: 	.asciz "\r\n"
 
 		.org PRT_OFF,0x90
 

Modified: projects/pseries/cam/ata/ata_da.c
==============================================================================
--- projects/pseries/cam/ata/ata_da.c	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/cam/ata/ata_da.c	Fri Jun 24 14:03:10 2011	(r223503)
@@ -818,7 +818,7 @@ adagetattr(struct bio *bp)
 	int ret = -1;
 	struct cam_periph *periph;
 
-	if (bp->bio_disk == NULL || bp->bio_disk->d_drv1)
+	if (bp->bio_disk == NULL || bp->bio_disk->d_drv1 == NULL)
 		return ENXIO;
 	periph = (struct cam_periph *)bp->bio_disk->d_drv1;
 	if (periph->path == NULL)

Modified: projects/pseries/cam/ata/ata_xpt.c
==============================================================================
--- projects/pseries/cam/ata/ata_xpt.c	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/cam/ata/ata_xpt.c	Fri Jun 24 14:03:10 2011	(r223503)
@@ -1601,6 +1601,34 @@ ata_device_transport(struct cam_path *pa
 }
 
 static void
+ata_dev_advinfo(union ccb *start_ccb)
+{
+	struct cam_ed *device;
+	struct ccb_dev_advinfo *cdai;
+	off_t amt; 
+
+	start_ccb->ccb_h.status = CAM_REQ_INVALID;
+	device = start_ccb->ccb_h.path->device;
+	cdai = &start_ccb->cdai;
+	switch(cdai->buftype) {
+	case CDAI_TYPE_SERIAL_NUM:
+		if (cdai->flags & CDAI_FLAG_STORE)
+			break;
+		start_ccb->ccb_h.status = CAM_REQ_CMP;
+		cdai->provsiz = device->serial_num_len;
+		if (device->serial_num_len == 0)
+			break;
+		amt = device->serial_num_len;
+		if (cdai->provsiz > cdai->bufsiz)
+			amt = cdai->bufsiz;
+		memcpy(cdai->buf, device->serial_num, amt);
+		break;
+	default:
+		break;
+	}
+}
+
+static void
 ata_action(union ccb *start_ccb)
 {
 
@@ -1650,7 +1678,13 @@ ata_action(union ccb *start_ccb)
 			xpt_done(start_ccb);
 			break;
 		}
-		/* FALLTHROUGH */
+		xpt_action_default(start_ccb);
+		break;
+	}
+	case XPT_DEV_ADVINFO:
+	{
+		ata_dev_advinfo(start_ccb);
+		break;
 	}
 	default:
 		xpt_action_default(start_ccb);

Modified: projects/pseries/cam/scsi/scsi_xpt.c
==============================================================================
--- projects/pseries/cam/scsi/scsi_xpt.c	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/cam/scsi/scsi_xpt.c	Fri Jun 24 14:03:10 2011	(r223503)
@@ -2440,12 +2440,13 @@ scsi_dev_advinfo(union ccb *start_ccb)
 	struct ccb_dev_advinfo *cdai;
 	off_t amt;
 
+	start_ccb->ccb_h.status = CAM_REQ_INVALID;
 	device = start_ccb->ccb_h.path->device;
 	cdai = &start_ccb->cdai;
 	switch(cdai->buftype) {
 	case CDAI_TYPE_SCSI_DEVID:
 		if (cdai->flags & CDAI_FLAG_STORE)
-			break;
+			return;
 		cdai->provsiz = device->device_id_len;
 		if (device->device_id_len == 0)
 			break;
@@ -2456,7 +2457,7 @@ scsi_dev_advinfo(union ccb *start_ccb)
 		break;
 	case CDAI_TYPE_SERIAL_NUM:
 		if (cdai->flags & CDAI_FLAG_STORE)
-			break;
+			return;
 		cdai->provsiz = device->serial_num_len;
 		if (device->serial_num_len == 0)
 			break;
@@ -2490,7 +2491,7 @@ scsi_dev_advinfo(union ccb *start_ccb)
 		}
 		break;
 	default:
-		break;
+		return;
 	}
 	start_ccb->ccb_h.status = CAM_REQ_CMP;
 

Modified: projects/pseries/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h
==============================================================================
--- projects/pseries/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h	Fri Jun 24 14:03:10 2011	(r223503)
@@ -65,7 +65,7 @@ typedef long ctf_id_t;
  * filling in ctf_sect_t structures and passing them to ctf_bufopen():
  */
 typedef struct ctf_sect {
-	char *cts_name;		/* section name (if any) */
+	const char *cts_name;	/* section name (if any) */
 	ulong_t cts_type;	/* section type (ELF SHT_... value) */
 	ulong_t cts_flags;	/* section flags (ELF SHF_... value) */
 #if defined(sun)

Modified: projects/pseries/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- projects/pseries/compat/freebsd32/freebsd32_misc.c	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/compat/freebsd32/freebsd32_misc.c	Fri Jun 24 14:03:10 2011	(r223503)
@@ -1416,6 +1416,19 @@ freebsd32_pwrite(struct thread *td, stru
 	return (pwrite(td, &ap));
 }
 
+#ifdef COMPAT_43
+int
+ofreebsd32_lseek(struct thread *td, struct ofreebsd32_lseek_args *uap)
+{
+	struct lseek_args nuap;
+
+	nuap.fd = uap->fd;
+	nuap.offset = uap->offset;
+	nuap.whence = uap->whence;
+	return (lseek(td, &nuap));
+}
+#endif
+
 int
 freebsd32_lseek(struct thread *td, struct freebsd32_lseek_args *uap)
 {

Modified: projects/pseries/compat/freebsd32/freebsd32_proto.h
==============================================================================
--- projects/pseries/compat/freebsd32/freebsd32_proto.h	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/compat/freebsd32/freebsd32_proto.h	Fri Jun 24 14:03:10 2011	(r223503)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 223166 2011-06-16 22:05:56Z kib 
  */
 
 #ifndef _FREEBSD32_SYSPROTO_H_
@@ -690,6 +690,11 @@ int	freebsd32_posix_fallocate(struct thr
 #if !defined(PAD64_REQUIRED) && defined(__powerpc__)
 #define PAD64_REQUIRED
 #endif
+struct ofreebsd32_lseek_args {
+	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+	char offset_l_[PADL_(int)]; int offset; char offset_r_[PADR_(int)];
+	char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];
+};
 struct ofreebsd32_stat_args {
 	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
 	char ub_l_[PADL_(struct ostat32 *)]; struct ostat32 * ub; char ub_r_[PADR_(struct ostat32 *)];
@@ -747,6 +752,7 @@ struct ofreebsd32_getdirentries_args {
 #ifdef PAD64_REQUIRED
 #else
 #endif
+int	ofreebsd32_lseek(struct thread *, struct ofreebsd32_lseek_args *);
 int	ofreebsd32_stat(struct thread *, struct ofreebsd32_stat_args *);
 int	ofreebsd32_lstat(struct thread *, struct ofreebsd32_lstat_args *);
 int	ofreebsd32_sigaction(struct thread *, struct ofreebsd32_sigaction_args *);
@@ -923,6 +929,7 @@ int	freebsd7_freebsd32_shmctl(struct thr
 
 #define	FREEBSD32_SYS_AUE_freebsd32_wait4	AUE_WAIT4
 #define	FREEBSD32_SYS_AUE_freebsd4_freebsd32_getfsstat	AUE_GETFSSTAT
+#define	FREEBSD32_SYS_AUE_ofreebsd32_lseek	AUE_LSEEK
 #define	FREEBSD32_SYS_AUE_freebsd32_recvmsg	AUE_RECVMSG
 #define	FREEBSD32_SYS_AUE_freebsd32_sendmsg	AUE_SENDMSG
 #define	FREEBSD32_SYS_AUE_freebsd32_recvfrom	AUE_RECVFROM

Modified: projects/pseries/compat/freebsd32/freebsd32_syscall.h
==============================================================================
--- projects/pseries/compat/freebsd32/freebsd32_syscall.h	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/compat/freebsd32/freebsd32_syscall.h	Fri Jun 24 14:03:10 2011	(r223503)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 223166 2011-06-16 22:05:56Z kib 
  */
 
 #define	FREEBSD32_SYS_syscall	0
@@ -25,7 +25,7 @@
 #define	FREEBSD32_SYS_chown	16
 #define	FREEBSD32_SYS_break	17
 #define	FREEBSD32_SYS_freebsd4_freebsd32_getfsstat	18
-				/* 19 is obsolete olseek */
+				/* 19 is old freebsd32_lseek */
 #define	FREEBSD32_SYS_getpid	20
 #define	FREEBSD32_SYS_mount	21
 #define	FREEBSD32_SYS_unmount	22

Modified: projects/pseries/compat/freebsd32/freebsd32_syscalls.c
==============================================================================
--- projects/pseries/compat/freebsd32/freebsd32_syscalls.c	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/compat/freebsd32/freebsd32_syscalls.c	Fri Jun 24 14:03:10 2011	(r223503)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 223166 2011-06-16 22:05:56Z kib 
  */
 
 const char *freebsd32_syscallnames[] = {
@@ -29,7 +29,7 @@ const char *freebsd32_syscallnames[] = {
 	"chown",			/* 16 = chown */
 	"break",			/* 17 = break */
 	"compat4.freebsd32_getfsstat",		/* 18 = freebsd4 freebsd32_getfsstat */
-	"obs_olseek",			/* 19 = obsolete olseek */
+	"compat.freebsd32_lseek",		/* 19 = old freebsd32_lseek */
 	"getpid",			/* 20 = getpid */
 	"mount",			/* 21 = mount */
 	"unmount",			/* 22 = unmount */

Modified: projects/pseries/compat/freebsd32/freebsd32_sysent.c
==============================================================================
--- projects/pseries/compat/freebsd32/freebsd32_sysent.c	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/compat/freebsd32/freebsd32_sysent.c	Fri Jun 24 14:03:10 2011	(r223503)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 223166 2011-06-16 22:05:56Z kib 
  */
 
 #include "opt_compat.h"
@@ -66,7 +66,7 @@ struct sysent freebsd32_sysent[] = {
 	{ AS(chown_args), (sy_call_t *)chown, AUE_CHOWN, NULL, 0, 0, 0, SY_THR_STATIC },	/* 16 = chown */
 	{ AS(obreak_args), (sy_call_t *)obreak, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 17 = break */
 	{ compat4(AS(freebsd4_freebsd32_getfsstat_args),freebsd32_getfsstat), AUE_GETFSSTAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 18 = freebsd4 freebsd32_getfsstat */
-	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 19 = obsolete olseek */
+	{ compat(AS(ofreebsd32_lseek_args),freebsd32_lseek), AUE_LSEEK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 19 = old freebsd32_lseek */
 	{ 0, (sy_call_t *)getpid, AUE_GETPID, NULL, 0, 0, 0, SY_THR_STATIC },		/* 20 = getpid */
 	{ AS(mount_args), (sy_call_t *)mount, AUE_MOUNT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 21 = mount */
 	{ AS(unmount_args), (sy_call_t *)unmount, AUE_UMOUNT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 22 = unmount */

Modified: projects/pseries/compat/freebsd32/syscalls.master
==============================================================================
--- projects/pseries/compat/freebsd32/syscalls.master	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/compat/freebsd32/syscalls.master	Fri Jun 24 14:03:10 2011	(r223503)
@@ -89,7 +89,8 @@
 18	AUE_GETFSSTAT	COMPAT4	{ int freebsd32_getfsstat( \
 				    struct statfs32 *buf, long bufsize, \
 				    int flags); }
-19	AUE_LSEEK	OBSOL	olseek
+19	AUE_LSEEK	COMPAT	{ int freebsd32_lseek(int fd, int offset, \
+				    int whence); }
 20	AUE_GETPID	NOPROTO	{ pid_t getpid(void); }
 21	AUE_MOUNT	NOPROTO	{ int mount(char *type, char *path, \
 				    int flags, caddr_t data); }

Modified: projects/pseries/compat/linprocfs/linprocfs.c
==============================================================================
--- projects/pseries/compat/linprocfs/linprocfs.c	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/compat/linprocfs/linprocfs.c	Fri Jun 24 14:03:10 2011	(r223503)
@@ -1049,6 +1049,15 @@ linprocfs_doproccmdline(PFS_FILL_ARGS)
 		PROC_UNLOCK(p);
 		return (ret);
 	}
+
+	/*
+	 * Mimic linux behavior and pass only processes with usermode
+	 * address space as valid.  Return zero silently otherwize.
+	 */
+	if (p->p_vmspace == &vmspace0) {
+		PROC_UNLOCK(p);
+		return (0);
+	}
 	if (p->p_args != NULL) {
 		sbuf_bcpy(sb, p->p_args->ar_args, p->p_args->ar_length);
 		PROC_UNLOCK(p);
@@ -1073,6 +1082,15 @@ linprocfs_doprocenviron(PFS_FILL_ARGS)
 		PROC_UNLOCK(p);
 		return (ret);
 	}
+
+	/*
+	 * Mimic linux behavior and pass only processes with usermode
+	 * address space as valid.  Return zero silently otherwize.
+	 */
+	if (p->p_vmspace == &vmspace0) {
+		PROC_UNLOCK(p);
+		return (0);
+	}
 	PROC_UNLOCK(p);
 
 	ret = linprocfs_doargv(td, p, sb, ps_string_env);

Modified: projects/pseries/conf/files
==============================================================================
--- projects/pseries/conf/files	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/conf/files	Fri Jun 24 14:03:10 2011	(r223503)
@@ -1991,8 +1991,12 @@ dev/usb/quirk/usb_quirk.c	optional usb
 #
 # USB templates
 #
-dev/usb/template/usb_template.c	optional usb_template
+dev/usb/template/usb_template.c		optional usb_template
+dev/usb/template/usb_template_audio.c	optional usb_template
 dev/usb/template/usb_template_cdce.c	optional usb_template
+dev/usb/template/usb_template_kbd.c	optional usb_template
+dev/usb/template/usb_template_modem.c	optional usb_template
+dev/usb/template/usb_template_mouse.c	optional usb_template
 dev/usb/template/usb_template_msc.c	optional usb_template
 dev/usb/template/usb_template_mtp.c	optional usb_template
 #

Modified: projects/pseries/conf/files.amd64
==============================================================================
--- projects/pseries/conf/files.amd64	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/conf/files.amd64	Fri Jun 24 14:03:10 2011	(r223503)
@@ -128,7 +128,6 @@ amd64/amd64/trap.c		standard
 amd64/amd64/uio_machdep.c	standard
 amd64/amd64/uma_machdep.c	standard
 amd64/amd64/vm_machdep.c	standard
-amd64/pci/pci_bus.c		optional	pci
 amd64/pci/pci_cfgreg.c		optional	pci
 crypto/aesni/aesencdec_amd64.S	optional aesni
 crypto/aesni/aeskeys_amd64.S	optional aesni
@@ -315,7 +314,8 @@ x86/isa/isa.c			standard
 x86/isa/isa_dma.c		standard
 x86/isa/nmi.c			standard
 x86/isa/orm.c			optional	isa
-x86/pci/qpi.c			standard
+x86/pci/pci_bus.c		optional	pci
+x86/pci/qpi.c			optional	pci
 x86/x86/busdma_machdep.c	standard
 x86/x86/dump_machdep.c		standard
 x86/x86/io_apic.c		standard

Modified: projects/pseries/conf/files.i386
==============================================================================
--- projects/pseries/conf/files.i386	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/conf/files.i386	Fri Jun 24 14:03:10 2011	(r223503)
@@ -352,7 +352,6 @@ i386/linux/linux_support.s	optional comp
 	dependency 	"linux_assym.h"
 i386/linux/linux_sysent.c	optional compat_linux
 i386/linux/linux_sysvec.c	optional compat_linux
-i386/pci/pci_bus.c		optional pci
 i386/pci/pci_cfgreg.c		optional pci
 i386/pci/pci_pir.c		optional pci 
 i386/svr4/svr4_locore.s		optional compat_svr4	\
@@ -405,7 +404,8 @@ x86/isa/isa.c			optional isa
 x86/isa/isa_dma.c		optional isa
 x86/isa/nmi.c			standard
 x86/isa/orm.c			optional isa
-x86/pci/qpi.c			standard
+x86/pci/pci_bus.c		optional pci
+x86/pci/qpi.c			optional pci
 x86/x86/busdma_machdep.c	standard
 x86/x86/dump_machdep.c		standard
 x86/x86/io_apic.c		optional apic

Modified: projects/pseries/conf/files.pc98
==============================================================================
--- projects/pseries/conf/files.pc98	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/conf/files.pc98	Fri Jun 24 14:03:10 2011	(r223503)
@@ -199,7 +199,6 @@ i386/linux/linux_support.s	optional comp
 	dependency 	"linux_assym.h"
 i386/linux/linux_sysent.c	optional compat_linux
 i386/linux/linux_sysvec.c	optional compat_linux
-i386/pci/pci_bus.c		optional pci
 i386/pci/pci_cfgreg.c		optional pci
 i386/pci/pci_pir.c		optional pci
 i386/svr4/svr4_locore.s		optional compat_svr4	\
@@ -249,6 +248,7 @@ pc98/pc98/pc98_machdep.c	standard
 x86/isa/atpic.c			optional atpic	
 x86/isa/clock.c			standard
 x86/isa/isa.c			optional isa
+x86/pci/pci_bus.c		optional pci
 x86/x86/busdma_machdep.c	standard
 x86/x86/dump_machdep.c		standard
 x86/x86/io_apic.c		optional apic

Modified: projects/pseries/conf/files.powerpc
==============================================================================
--- projects/pseries/conf/files.powerpc	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/conf/files.powerpc	Fri Jun 24 14:03:10 2011	(r223503)
@@ -203,11 +203,13 @@ powerpc/powerpc/syncicache.c	standard
 powerpc/powerpc/sys_machdep.c	standard
 powerpc/powerpc/uio_machdep.c	standard
 powerpc/ps3/ehci_ps3.c		optional	ps3 ehci
+powerpc/ps3/ohci_ps3.c		optional	ps3 ohci
 powerpc/ps3/if_glc.c		optional	ps3 glc
 powerpc/ps3/mmu_ps3.c		optional	ps3
 powerpc/ps3/platform_ps3.c	optional	ps3
 powerpc/ps3/ps3ata.c		optional	ps3 ps3ata
 powerpc/ps3/ps3bus.c		optional	ps3
+powerpc/ps3/ps3disk.c		optional	ps3
 powerpc/ps3/ps3pic.c		optional	ps3
 powerpc/ps3/ps3_syscons.c	optional	ps3 sc
 powerpc/ps3/ps3-hvcall.S	optional	ps3 sc

Modified: projects/pseries/dev/acpica/acpi.c
==============================================================================
--- projects/pseries/dev/acpica/acpi.c	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/dev/acpica/acpi.c	Fri Jun 24 14:03:10 2011	(r223503)
@@ -151,6 +151,7 @@ static ACPI_STATUS acpi_sleep_disable(st
 static ACPI_STATUS acpi_EnterSleepState(struct acpi_softc *sc, int state);
 static void	acpi_shutdown_final(void *arg, int howto);
 static void	acpi_enable_fixed_events(struct acpi_softc *sc);
+static BOOLEAN	acpi_has_hid(ACPI_HANDLE handle);
 static int	acpi_wake_sleep_prep(ACPI_HANDLE handle, int sstate);
 static int	acpi_wake_run_prep(ACPI_HANDLE handle, int sstate);
 static int	acpi_wake_prep_walk(int sstate);
@@ -1855,6 +1856,13 @@ acpi_probe_child(ACPI_HANDLE handle, UIN
 		break;
 	    if (acpi_parse_prw(handle, &prw) == 0)
 		AcpiSetupGpeForWake(handle, prw.gpe_handle, prw.gpe_bit);
+
+	    /*
+	     * Ignore devices that do not have a _HID or _CID.  They should
+	     * be discovered by other buses (e.g. the PCI bus driver).
+	     */
+	    if (!acpi_has_hid(handle))
+		break;
 	    /* FALLTHROUGH */
 	case ACPI_TYPE_PROCESSOR:
 	case ACPI_TYPE_THERMAL:
@@ -2043,6 +2051,30 @@ acpi_BatteryIsPresent(device_t dev)
 }
 
 /*
+ * Returns true if a device has at least one valid device ID.
+ */
+static BOOLEAN
+acpi_has_hid(ACPI_HANDLE h)
+{
+    ACPI_DEVICE_INFO	*devinfo;
+    BOOLEAN		ret;
+
+    if (h == NULL ||
+	ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo)))
+	return (FALSE);
+
+    ret = FALSE;
+    if ((devinfo->Valid & ACPI_VALID_HID) != 0)
+	ret = TRUE;
+    else if ((devinfo->Valid & ACPI_VALID_CID) != 0)
+	if (devinfo->CompatibleIdList.Count > 0)
+	    ret = TRUE;
+
+    AcpiOsFree(devinfo);
+    return (ret);
+}
+
+/*
  * Match a HID string against a handle
  */
 BOOLEAN

Modified: projects/pseries/dev/acpica/acpi_cpu.c
==============================================================================
--- projects/pseries/dev/acpica/acpi_cpu.c	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/dev/acpica/acpi_cpu.c	Fri Jun 24 14:03:10 2011	(r223503)
@@ -856,6 +856,10 @@ acpi_cpu_cx_list(struct acpi_cpu_softc *
 	sbuf_printf(&sb, "C%d/%d ", i + 1, sc->cpu_cx_states[i].trans_lat);
 	if (sc->cpu_cx_states[i].type < ACPI_STATE_C3)
 	    sc->cpu_non_c3 = i;
+#ifndef __ia64__
+	else
+	    cpu_can_deep_sleep = 1;
+#endif
     }
     sbuf_trim(&sb);
     sbuf_finish(&sb);

Modified: projects/pseries/dev/acpica/acpi_pci.c
==============================================================================
--- projects/pseries/dev/acpica/acpi_pci.c	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/dev/acpica/acpi_pci.c	Fri Jun 24 14:03:10 2011	(r223503)
@@ -209,38 +209,24 @@ acpi_pci_update_device(ACPI_HANDLE handl
 	device_t child;
 
 	/*
-	 * Lookup and remove the unused device that acpi0 creates when it walks
-	 * the namespace creating devices.
+	 * Occasionally a PCI device may show up as an ACPI device
+	 * with a _HID.  (For example, the TabletPC TC1000 has a
+	 * second PCI-ISA bridge that has a _HID for an
+	 * acpi_sysresource device.)  In that case, leave ACPI-CA's
+	 * device data pointing at the ACPI-enumerated device.
 	 */
 	child = acpi_get_device(handle);
 	if (child != NULL) {
-		if (device_is_alive(child)) {
-			/*
-			 * The TabletPC TC1000 has a second PCI-ISA bridge
-			 * that has a _HID for an acpi_sysresource device.
-			 * In that case, leave ACPI-CA's device data pointing
-			 * at the ACPI-enumerated device.
-			 */
-			device_printf(child,
-			    "Conflicts with PCI device %d:%d:%d\n",
-			    pci_get_bus(pci_child), pci_get_slot(pci_child),
-			    pci_get_function(pci_child));
-			return;
-		}
 		KASSERT(device_get_parent(child) ==
 		    devclass_get_device(devclass_find("acpi"), 0),
 		    ("%s: child (%s)'s parent is not acpi0", __func__,
 		    acpi_name(handle)));
-		device_delete_child(device_get_parent(child), child);
+		return;
 	}
 
 	/*
 	 * Update ACPI-CA to use the PCI enumerated device_t for this handle.
 	 */
-	status = AcpiDetachData(handle, acpi_fake_objhandler);
-	if (ACPI_FAILURE(status))
-		printf("WARNING: Unable to detach object data from %s - %s\n",
-		    acpi_name(handle), AcpiFormatException(status));
 	status = AcpiAttachData(handle, acpi_fake_objhandler, pci_child);
 	if (ACPI_FAILURE(status))
 		printf("WARNING: Unable to attach object data to %s - %s\n",

Modified: projects/pseries/dev/acpica/acpi_pcib_acpi.c
==============================================================================
--- projects/pseries/dev/acpica/acpi_pcib_acpi.c	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/dev/acpica/acpi_pcib_acpi.c	Fri Jun 24 14:03:10 2011	(r223503)
@@ -357,32 +357,14 @@ acpi_pcib_map_msi(device_t pcib, device_
 	return (PCIB_MAP_MSI(device_get_parent(bus), dev, irq, addr, data));
 }
 
-static u_long acpi_host_mem_start = 0x80000000;
-TUNABLE_ULONG("hw.acpi.host_mem_start", &acpi_host_mem_start);
-
 struct resource *
 acpi_pcib_acpi_alloc_resource(device_t dev, device_t child, int type, int *rid,
     u_long start, u_long end, u_long count, u_int flags)
 {
-    /*
-     * If no memory preference is given, use upper 32MB slot most
-     * bioses use for their memory window.  Typically other bridges
-     * before us get in the way to assert their preferences on memory.
-     * Hardcoding like this sucks, so a more MD/MI way needs to be
-     * found to do it.  This is typically only used on older laptops
-     * that don't have pci busses behind pci bridge, so assuming > 32MB
-     * is likely OK.
-     *
-     * PCI-PCI bridges may allocate smaller ranges for their windows,
-     * but the heuristics here should apply to those, so we allow
-     * several different end addresses.
-     */
-    if (type == SYS_RES_MEMORY && start == 0UL && (end == ~0UL ||
-	end == 0xffffffff))
-	start = acpi_host_mem_start;
-    if (type == SYS_RES_IOPORT && start == 0UL && (end == ~0UL ||
-	end == 0xffff || end == 0xffffffff))
-	start = 0x1000;
+
+#if defined(__i386__) || defined(__amd64__)
+    start = hostb_alloc_start(type, start, end, count);
+#endif
     return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
 	count, flags));
 }

Modified: projects/pseries/dev/acpica/acpi_resource.c
==============================================================================
--- projects/pseries/dev/acpica/acpi_resource.c	Fri Jun 24 13:58:56 2011	(r223502)
+++ projects/pseries/dev/acpica/acpi_resource.c	Fri Jun 24 14:03:10 2011	(r223503)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/bus.h>
+#include <sys/limits.h>
 #include <sys/malloc.h>
 #include <sys/module.h>
 
@@ -139,6 +140,249 @@ acpi_config_intr(device_t dev, ACPI_RESO
 	INTR_POLARITY_HIGH : INTR_POLARITY_LOW);
 }
 
+struct acpi_resource_context {
+    struct acpi_parse_resource_set *set;
+    device_t	dev;
+    void	*context;
+};
+
+#ifdef ACPI_DEBUG_OUTPUT
+static const char *
+acpi_address_range_name(UINT8 ResourceType)
+{
+    static char buf[16];
+
+    switch (ResourceType) {
+    case ACPI_MEMORY_RANGE:
+	    return ("Memory");
+    case ACPI_IO_RANGE:
+	    return ("IO");
+    case ACPI_BUS_NUMBER_RANGE:
+	    return ("Bus Number");
+    default:
+	    snprintf(buf, sizeof(buf), "type %u", ResourceType);
+	    return (buf);
+    }
+}
+#endif
+	    
+static ACPI_STATUS
+acpi_parse_resource(ACPI_RESOURCE *res, void *context)
+{
+    struct acpi_parse_resource_set *set;
+    struct acpi_resource_context *arc;
+    UINT64 min, max, length, gran;
+    const char *name;
+    device_t dev;
+
+    arc = context;
+    dev = arc->dev;
+    set = arc->set;
+
+    switch (res->Type) {
+    case ACPI_RESOURCE_TYPE_END_TAG:
+	ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "EndTag\n"));
+	break;
+    case ACPI_RESOURCE_TYPE_FIXED_IO:
+	if (res->Data.FixedIo.AddressLength <= 0)
+	    break;
+	ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "FixedIo 0x%x/%d\n",
+	    res->Data.FixedIo.Address, res->Data.FixedIo.AddressLength));
+	set->set_ioport(dev, arc->context, res->Data.FixedIo.Address,
+	    res->Data.FixedIo.AddressLength);
+	break;
+    case ACPI_RESOURCE_TYPE_IO:
+	if (res->Data.Io.AddressLength <= 0)
+	    break;
+	if (res->Data.Io.Minimum == res->Data.Io.Maximum) {
+	    ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Io 0x%x/%d\n",
+		res->Data.Io.Minimum, res->Data.Io.AddressLength));
+	    set->set_ioport(dev, arc->context, res->Data.Io.Minimum,
+		res->Data.Io.AddressLength);
+	} else {
+	    ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Io 0x%x-0x%x/%d\n",
+		res->Data.Io.Minimum, res->Data.Io.Maximum,
+		res->Data.Io.AddressLength));
+	    set->set_iorange(dev, arc->context, res->Data.Io.Minimum,
+		res->Data.Io.Maximum, res->Data.Io.AddressLength,
+		res->Data.Io.Alignment);
+	}
+	break;
+    case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
+	if (res->Data.FixedMemory32.AddressLength <= 0)
+	    break;
+	ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "FixedMemory32 0x%x/%d\n",
+	    res->Data.FixedMemory32.Address,
+	    res->Data.FixedMemory32.AddressLength));
+	set->set_memory(dev, arc->context, res->Data.FixedMemory32.Address, 
+	    res->Data.FixedMemory32.AddressLength);
+	break;
+    case ACPI_RESOURCE_TYPE_MEMORY32:
+	if (res->Data.Memory32.AddressLength <= 0)
+	    break;
+	if (res->Data.Memory32.Minimum == res->Data.Memory32.Maximum) {
+	    ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Memory32 0x%x/%d\n",
+		res->Data.Memory32.Minimum, res->Data.Memory32.AddressLength));
+	    set->set_memory(dev, arc->context, res->Data.Memory32.Minimum,
+		res->Data.Memory32.AddressLength);
+	} else {
+	    ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Memory32 0x%x-0x%x/%d\n",
+		res->Data.Memory32.Minimum, res->Data.Memory32.Maximum,
+		res->Data.Memory32.AddressLength));
+	    set->set_memoryrange(dev, arc->context, res->Data.Memory32.Minimum,
+		res->Data.Memory32.Maximum, res->Data.Memory32.AddressLength,
+		res->Data.Memory32.Alignment);
+	}

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106241403.p5OE3BqB057097>