From owner-p4-projects@FreeBSD.ORG Wed Aug 11 18:26:14 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 93691106639A; Wed, 11 Aug 2010 18:26:14 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 469B71065EC6 for ; Wed, 11 Aug 2010 18:26:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id A26B18FC1B for ; Wed, 11 Aug 2010 18:26:07 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o7BIQ7tj084340 for ; Wed, 11 Aug 2010 18:26:07 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o7BIQ7J8084334 for perforce@freebsd.org; Wed, 11 Aug 2010 18:26:07 GMT (envelope-from jhb@freebsd.org) Date: Wed, 11 Aug 2010 18:26:07 GMT Message-Id: <201008111826.o7BIQ7J8084334@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 182192 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2010 18:26:14 -0000 http://p4web.freebsd.org/@@182192?ac=10 Change 182192 by jhb@jhb_jhbbsd on 2010/08/10 15:52:55 IFC @182191 Affected files ... .. //depot/projects/smpng/share/man/man9/mbuf.9#2 integrate .. //depot/projects/smpng/sys/amd64/amd64/mp_machdep.c#68 integrate .. //depot/projects/smpng/sys/amd64/amd64/tsc.c#9 integrate .. //depot/projects/smpng/sys/amd64/ia32/ia32_signal.c#30 integrate .. //depot/projects/smpng/sys/boot/zfs/zfsimpl.c#9 integrate .. //depot/projects/smpng/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c#13 integrate .. //depot/projects/smpng/sys/compat/freebsd32/freebsd32.h#11 integrate .. //depot/projects/smpng/sys/compat/freebsd32/freebsd32_misc.c#70 integrate .. //depot/projects/smpng/sys/compat/x86bios/x86bios.c#8 integrate .. //depot/projects/smpng/sys/conf/files#264 integrate .. //depot/projects/smpng/sys/conf/files.i386#138 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/changes.txt#8 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/common/adisasm.c#14 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/common/dmextern.c#5 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/compiler/aslcompiler.h#12 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/compiler/aslglobal.h#11 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/compiler/aslmain.c#11 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/compiler/aslstartup.c#4 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/debugger/dbcmds.c#7 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/debugger/dbinput.c#5 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/events/evxfevnt.c#6 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/executer/exfldio.c#5 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/executer/exprep.c#4 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/include/acdebug.h#5 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/include/acdisasm.h#6 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/include/acglobal.h#8 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/include/aclocal.h#8 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/include/acobject.h#6 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/include/acpiosxf.h#4 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/include/acpixf.h#8 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/include/actypes.h#7 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/include/acutils.h#6 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/osunixxf.c#12 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/utilities/uteval.c#4 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/utilities/utglobal.c#8 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/utilities/utinit.c#4 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/utilities/utmutex.c#3 integrate .. //depot/projects/smpng/sys/contrib/dev/acpica/utilities/utosi.c#1 branch .. //depot/projects/smpng/sys/contrib/dev/acpica/utilities/utxface.c#4 integrate .. //depot/projects/smpng/sys/dev/acpica/Osd/OsdHardware.c#25 integrate .. //depot/projects/smpng/sys/dev/acpica/Osd/OsdMemory.c#14 integrate .. //depot/projects/smpng/sys/dev/acpica/acpi_ec.c#53 integrate .. //depot/projects/smpng/sys/dev/alc/if_alc.c#8 integrate .. //depot/projects/smpng/sys/dev/alc/if_alcreg.h#3 integrate .. //depot/projects/smpng/sys/dev/alc/if_alcvar.h#2 integrate .. //depot/projects/smpng/sys/dev/ath/ath_hal/ar5416/ar5416.ini#3 integrate .. //depot/projects/smpng/sys/dev/ath/if_ath.c#89 integrate .. //depot/projects/smpng/sys/dev/e1000/if_igb.c#24 integrate .. //depot/projects/smpng/sys/dev/fb/vesa.c#10 integrate .. //depot/projects/smpng/sys/dev/iicbus/iic.h#6 integrate .. //depot/projects/smpng/sys/dev/iscsi/initiator/isc_cam.c#5 integrate .. //depot/projects/smpng/sys/dev/iscsi/initiator/isc_sm.c#4 integrate .. //depot/projects/smpng/sys/dev/iscsi/initiator/isc_soc.c#6 integrate .. //depot/projects/smpng/sys/dev/iscsi/initiator/isc_subr.c#4 integrate .. //depot/projects/smpng/sys/dev/iscsi/initiator/iscsi.c#5 integrate .. //depot/projects/smpng/sys/dev/iscsi/initiator/iscsi.h#3 integrate .. //depot/projects/smpng/sys/dev/iscsi/initiator/iscsi_subr.c#3 integrate .. //depot/projects/smpng/sys/dev/iscsi/initiator/iscsivar.h#3 integrate .. //depot/projects/smpng/sys/dev/mii/atphy.c#4 integrate .. //depot/projects/smpng/sys/dev/mii/e1000phy.c#25 integrate .. //depot/projects/smpng/sys/dev/mii/miidevs#42 integrate .. //depot/projects/smpng/sys/dev/ste/if_ste.c#7 integrate .. //depot/projects/smpng/sys/dev/usb/serial/uplcom.c#15 integrate .. //depot/projects/smpng/sys/dev/usb/serial/uslcom.c#12 integrate .. //depot/projects/smpng/sys/dev/usb/usbdevs#156 integrate .. //depot/projects/smpng/sys/fs/coda/coda.h#3 integrate .. //depot/projects/smpng/sys/fs/coda/coda_venus.c#6 integrate .. //depot/projects/smpng/sys/fs/coda/coda_vnops.c#10 integrate .. //depot/projects/smpng/sys/i386/i386/mp_machdep.c#129 integrate .. //depot/projects/smpng/sys/i386/i386/tsc.c#15 integrate .. //depot/projects/smpng/sys/ia64/ia32/ia32_signal.c#7 integrate .. //depot/projects/smpng/sys/kern/init_main.c#88 integrate .. //depot/projects/smpng/sys/kern/kern_cons.c#4 integrate .. //depot/projects/smpng/sys/kern/kern_jail.c#83 integrate .. //depot/projects/smpng/sys/kern/kern_ktrace.c#72 integrate .. //depot/projects/smpng/sys/kern/subr_smp.c#63 integrate .. //depot/projects/smpng/sys/kern/uipc_socket.c#138 integrate .. //depot/projects/smpng/sys/kern/vfs_bio.c#132 integrate .. //depot/projects/smpng/sys/kern/vfs_cluster.c#52 integrate .. //depot/projects/smpng/sys/mips/include/cpuregs.h#6 integrate .. //depot/projects/smpng/sys/mips/include/pte.h#6 integrate .. //depot/projects/smpng/sys/mips/mips/locore.S#6 integrate .. //depot/projects/smpng/sys/mips/mips/mpboot.S#4 integrate .. //depot/projects/smpng/sys/mips/mips/pmap.c#22 integrate .. //depot/projects/smpng/sys/modules/acpi/acpi/Makefile#25 integrate .. //depot/projects/smpng/sys/modules/x86bios/Makefile#3 integrate .. //depot/projects/smpng/sys/netinet/ip_carp.c#42 integrate .. //depot/projects/smpng/sys/netinet/libalias/alias_db.c#12 integrate .. //depot/projects/smpng/sys/netinet6/in6_proto.c#37 integrate .. //depot/projects/smpng/sys/sparc64/include/cache.h#17 integrate .. //depot/projects/smpng/sys/sparc64/include/smp.h#29 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/cache.c#20 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/genassym.c#49 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/mem.c#19 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/mp_exception.S#8 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/mp_machdep.c#43 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/pmap.c#89 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/tick.c#26 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/uio_machdep.c#7 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/vm_machdep.c#56 integrate .. //depot/projects/smpng/sys/teken/teken_subr.h#5 integrate Differences ... ==== //depot/projects/smpng/share/man/man9/mbuf.9#2 (text+ko) ==== @@ -22,9 +22,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man9/mbuf.9,v 1.67 2008/03/25 09:39:02 ru Exp $ +.\" $FreeBSD: src/share/man/man9/mbuf.9,v 1.68 2010/08/07 13:26:08 des Exp $ .\" -.Dd March 25, 2008 +.Dd August 7, 2010 .Dt MBUF 9 .Os .\" @@ -211,7 +211,7 @@ #define M_EOR 0x0004 /* end of record */ #define M_RDONLY 0x0008 /* associated data marked read-only */ #define M_PROTO1 0x0010 /* protocol-specific */ -#define M_PROTO2 0x0020 /* protocol-specific */ +#define M_PROTO2 0x0020 /* protocol-specific */ #define M_PROTO3 0x0040 /* protocol-specific */ #define M_PROTO4 0x0080 /* protocol-specific */ #define M_PROTO5 0x0100 /* protocol-specific */ @@ -238,6 +238,22 @@ #define MT_OOBDATA 15 /* expedited data */ .Ed .Pp +The available external buffer types are defined as follows: +.Bd -literal +/* external buffer types */ +#define EXT_CLUSTER 1 /* mbuf cluster */ +#define EXT_SFBUF 2 /* sendfile(2)'s sf_bufs */ +#define EXT_JUMBOP 3 /* jumbo cluster 4096 bytes */ +#define EXT_JUMBO9 4 /* jumbo cluster 9216 bytes */ +#define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */ +#define EXT_PACKET 6 /* mbuf+cluster from packet zone */ +#define EXT_MBUF 7 /* external mbuf reference (M_IOVEC) */ +#define EXT_NET_DRV 100 /* custom ext_buf provided by net driver(s) */ +#define EXT_MOD_TYPE 200 /* custom module's ext_buf type */ +#define EXT_DISPOSABLE 300 /* can throw this buffer away w/page flipping */ +#define EXT_EXTREF 400 /* has externally maintained ref_cnt ptr */ +.Ed +.Pp If the .Dv M_PKTHDR flag is set, a @@ -383,6 +399,43 @@ See .Fn MGET for details. +.It Fn MEXTADD mbuf buf size free opt_arg1 opt_arg2 flags type +Associate externally managed data with +.Fa mbuf . +Any internal data contained in the mbuf will be discarded, and the +.Dv M_EXT flag will be set. +The +.Fa buf +and +.Fa size +arguments are the address and length, respectively, of the data. +The +.Fa free +argument points to a function which will be called to free the data +when the mbuf is freed; it is only used if +.Fa type +is +.Dv EXT_EXTREF . +The +.Fa opt_arg1 +and +.Fa opt_arg2 +arguments will be passed unmodified to +.Fa free . +The +.Fa flags +argument specifies additional +.Vt mbuf +flags; it is not necessary to specify +.Dv M_EXT . +Finally, the +.Fa type +argument specifies the type of external data, which controls how it +will be disposed of when the +.Vt mbuf +is freed. +In most cases, the correct value is +.Dv EXT_EXTREF . .It Fn MCLGET mbuf how Allocate and attach an .Vt mbuf cluster ==== //depot/projects/smpng/sys/amd64/amd64/mp_machdep.c#68 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.322 2010/08/06 15:36:59 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.323 2010/08/09 20:25:06 attilio Exp $"); #include "opt_cpu.h" #include "opt_kstack_pages.h" @@ -1087,6 +1087,30 @@ mtx_unlock_spin(&smp_ipi_mtx); } +/* + * Send an IPI to specified CPU handling the bitmap logic. + */ +static void +ipi_send_cpu(int cpu, u_int ipi) +{ + u_int bitmap, old_pending, new_pending; + + KASSERT(cpu_apic_ids[cpu] != -1, ("IPI to non-existent CPU %d", cpu)); + + if (IPI_IS_BITMAPED(ipi)) { + bitmap = 1 << ipi; + ipi = IPI_BITMAP_VECTOR; + do { + old_pending = cpu_ipi_pending[cpu]; + new_pending = old_pending | bitmap; + } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu], + old_pending, new_pending)); + if (old_pending) + return; + } + lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]); +} + void smp_cache_flush(void) { @@ -1210,14 +1234,6 @@ ipi_selected(cpumask_t cpus, u_int ipi) { int cpu; - u_int bitmap = 0; - u_int old_pending; - u_int new_pending; - - if (IPI_IS_BITMAPED(ipi)) { - bitmap = 1 << ipi; - ipi = IPI_BITMAP_VECTOR; - } /* * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit @@ -1231,20 +1247,7 @@ while ((cpu = ffs(cpus)) != 0) { cpu--; cpus &= ~(1 << cpu); - - KASSERT(cpu_apic_ids[cpu] != -1, - ("IPI to non-existent CPU %d", cpu)); - - if (bitmap) { - do { - old_pending = cpu_ipi_pending[cpu]; - new_pending = old_pending | bitmap; - } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu], - old_pending, new_pending)); - if (old_pending) - continue; - } - lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]); + ipi_send_cpu(cpu, ipi); } } @@ -1254,15 +1257,7 @@ void ipi_cpu(int cpu, u_int ipi) { - u_int bitmap = 0; - u_int old_pending; - u_int new_pending; - if (IPI_IS_BITMAPED(ipi)) { - bitmap = 1 << ipi; - ipi = IPI_BITMAP_VECTOR; - } - /* * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit * of help in order to understand what is the source. @@ -1272,18 +1267,7 @@ atomic_set_int(&ipi_nmi_pending, 1 << cpu); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); - KASSERT(cpu_apic_ids[cpu] != -1, ("IPI to non-existent CPU %d", cpu)); - - if (bitmap) { - do { - old_pending = cpu_ipi_pending[cpu]; - new_pending = old_pending | bitmap; - } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu], - old_pending, new_pending)); - if (old_pending) - return; - } - lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]); + ipi_send_cpu(cpu, ipi); } /* ==== //depot/projects/smpng/sys/amd64/amd64/tsc.c#9 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/tsc.c,v 1.209 2008/10/21 00:38:00 jkim Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/tsc.c,v 1.210 2010/08/08 20:34:53 dwmalone Exp $"); #include "opt_clock.h" @@ -222,7 +222,7 @@ } SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_QUAD | CTLFLAG_RW, - 0, sizeof(u_int), sysctl_machdep_tsc_freq, "QU", ""); + 0, 0, sysctl_machdep_tsc_freq, "QU", ""); static unsigned tsc_get_timecount(struct timecounter *tc) ==== //depot/projects/smpng/sys/amd64/ia32/ia32_signal.c#30 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/ia32/ia32_signal.c,v 1.30 2010/06/30 18:03:42 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/ia32/ia32_signal.c,v 1.31 2010/08/07 11:57:13 kib Exp $"); #include "opt_compat.h" @@ -391,7 +391,7 @@ } regs->tf_rsp = (uintptr_t)sfp; - regs->tf_rip = FREEBSD32_PS_STRINGS - sz_freebsd4_ia32_sigcode; + regs->tf_rip = p->p_sysent->sv_psstrings - sz_freebsd4_ia32_sigcode; regs->tf_rflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucode32sel; regs->tf_ss = _udatasel; @@ -512,7 +512,7 @@ } regs->tf_rsp = (uintptr_t)sfp; - regs->tf_rip = FREEBSD32_PS_STRINGS - *(p->p_sysent->sv_szsigcode); + regs->tf_rip = p->p_sysent->sv_psstrings - *(p->p_sysent->sv_szsigcode); regs->tf_rflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucode32sel; regs->tf_ss = _udatasel; ==== //depot/projects/smpng/sys/boot/zfs/zfsimpl.c#9 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/boot/zfs/zfsimpl.c,v 1.10 2010/05/28 07:34:20 avg Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/zfs/zfsimpl.c,v 1.11 2010/08/09 06:36:11 mm Exp $"); /* * Stand-alone ZFS file reader. @@ -328,6 +328,9 @@ size_t psize; int rc; + if (!vdev->v_phys_read) + return (EIO); + if (bp) { psize = BP_GET_PSIZE(bp); } else { ==== //depot/projects/smpng/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c#13 (text+ko) ==== @@ -357,7 +357,7 @@ * quota on things *under* (ie. contained by) * the thing they own. */ - if (dsl_prop_get_integer(name, "zoned", &zoned, + if (dsl_prop_get_integer(name, "jailed", &zoned, setpoint)) return (EPERM); if (!zoned || strlen(name) <= strlen(setpoint)) ==== //depot/projects/smpng/sys/compat/freebsd32/freebsd32.h#11 (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/compat/freebsd32/freebsd32.h,v 1.13 2010/04/21 19:32:00 kib Exp $ + * $FreeBSD: src/sys/compat/freebsd32/freebsd32.h,v 1.14 2010/08/07 11:53:38 kib Exp $ */ #ifndef _COMPAT_FREEBSD32_FREEBSD32_H_ @@ -157,6 +157,24 @@ unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32)); }; +struct ostat32 { + __uint16_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + __uint16_t st_uid; + __uint16_t st_gid; + __uint16_t st_rdev; + __int32_t st_size; + struct timespec32 st_atim; + struct timespec32 st_mtim; + struct timespec32 st_ctim; + __int32_t st_blksize; + __int32_t st_blocks; + u_int32_t st_flags; + __uint32_t st_gen; +}; + struct jail32_v0 { u_int32_t version; uint32_t path; ==== //depot/projects/smpng/sys/compat/freebsd32/freebsd32_misc.c#70 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.113 2010/08/04 14:38:20 kib Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.114 2010/08/07 11:57:13 kib Exp $"); #include "opt_compat.h" #include "opt_inet.h" @@ -2541,7 +2541,8 @@ execpath_len = strlen(imgp->execpath) + 1; else execpath_len = 0; - arginfo = (struct freebsd32_ps_strings *)FREEBSD32_PS_STRINGS; + arginfo = (struct freebsd32_ps_strings *)curproc->p_sysent-> + sv_psstrings; szsigcode = *(imgp->proc->p_sysent->sv_szsigcode); destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE - roundup(execpath_len, sizeof(char *)) - ==== //depot/projects/smpng/sys/compat/x86bios/x86bios.c#8 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/x86bios/x86bios.c,v 1.23 2010/08/06 15:24:37 jkim Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/x86bios/x86bios.c,v 1.30 2010/08/10 15:22:48 jkim Exp $"); #include "opt_x86bios.h" @@ -58,6 +58,13 @@ #define X86BIOS_MEM_SIZE 0x00100000 /* 1M */ +#define X86BIOS_TRACE(h, n, r) do { \ + printf(__STRING(h) \ + " (ax=0x%04x bx=0x%04x cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n",\ + (n), (r)->R_AX, (r)->R_BX, (r)->R_CX, (r)->R_DX, \ + (r)->R_ES, (r)->R_DI); \ +} while (0) + static struct mtx x86bios_lock; SYSCTL_NODE(_debug, OID_AUTO, x86bios, CTLFLAG_RD, NULL, "x86bios debugging"); @@ -112,44 +119,49 @@ void * x86bios_alloc(uint32_t *offset, size_t size, int flags) { - vm_offset_t addr; + void *vaddr; int i; - addr = (vm_offset_t)contigmalloc(size, M_DEVBUF, flags, 0, - X86BIOS_MEM_SIZE, PAGE_SIZE, 0); - if (addr != 0) { - *offset = vtophys(addr); + if (offset == NULL || size == 0) + return (NULL); + vaddr = contigmalloc(size, M_DEVBUF, flags, 0, X86BIOS_MEM_SIZE, + PAGE_SIZE, 0); + if (vaddr != NULL) { + *offset = vtophys(vaddr); mtx_lock(&x86bios_lock); for (i = 0; i < atop(round_page(size)); i++) vm86_addpage(&x86bios_vmc, atop(*offset) + i, - addr + ptoa(i)); + (vm_offset_t)vaddr + ptoa(i)); mtx_unlock(&x86bios_lock); } - return ((void *)addr); + return (vaddr); } void x86bios_free(void *addr, size_t size) { - int i, last; + vm_paddr_t paddr; + int i, nfree; + if (addr == NULL || size == 0) + return; + paddr = vtophys(addr); + if (paddr >= X86BIOS_MEM_SIZE || (paddr & PAGE_MASK) != 0) + return; mtx_lock(&x86bios_lock); - for (i = 0, last = -1; i < x86bios_vmc.npages; i++) - if (x86bios_vmc.pmap[i].kva >= (vm_offset_t)addr && - x86bios_vmc.pmap[i].kva < (vm_offset_t)addr + size) { - bzero(&x86bios_vmc.pmap[i], - sizeof(x86bios_vmc.pmap[i])); - last = i; - } - if (last < 0) { + for (i = 0; i < x86bios_vmc.npages; i++) + if (x86bios_vmc.pmap[i].kva == (vm_offset_t)addr) + break; + if (i >= x86bios_vmc.npages) { mtx_unlock(&x86bios_lock); return; } - if (last == x86bios_vmc.npages - 1) { - x86bios_vmc.npages -= atop(round_page(size)); - for (i = x86bios_vmc.npages - 1; - i >= 0 && x86bios_vmc.pmap[i].kva == 0; i--) + nfree = atop(round_page(size)); + bzero(x86bios_vmc.pmap + i, sizeof(*x86bios_vmc.pmap) * nfree); + if (i + nfree == x86bios_vmc.npages) { + x86bios_vmc.npages -= nfree; + while (--i >= 0 && x86bios_vmc.pmap[i].kva == 0) x86bios_vmc.npages--; } mtx_unlock(&x86bios_lock); @@ -169,10 +181,7 @@ struct vm86frame vmf; if (x86bios_trace_call) - printf("Calling 0x%05x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - (seg << 4) + off, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Calling 0x%06x, (seg << 4) + off, regs); bzero(&vmf, sizeof(vmf)); x86bios_emu2vmf((struct x86emu_regs *)regs, &vmf); @@ -184,17 +193,14 @@ x86bios_vmf2emu(&vmf, (struct x86emu_regs *)regs); if (x86bios_trace_call) - printf("Exiting 0x%05x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - (seg << 4) + off, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Exiting 0x%06x, (seg << 4) + off, regs); } uint32_t x86bios_get_intr(int intno) { - return (readl(x86bios_offset(intno * 4))); + return (readl(BIOS_PADDRTOVADDR(intno * 4))); } void @@ -203,10 +209,7 @@ struct vm86frame vmf; if (x86bios_trace_int) - printf("Calling int 0x%x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - intno, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Calling INT 0x%02x, intno, regs); bzero(&vmf, sizeof(vmf)); x86bios_emu2vmf((struct x86emu_regs *)regs, &vmf); @@ -216,10 +219,7 @@ x86bios_vmf2emu(&vmf, (struct x86emu_regs *)regs); if (x86bios_trace_int) - printf("Exiting int 0x%x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - intno, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Exiting INT 0x%02x, intno, regs); } void * @@ -266,7 +266,7 @@ #define X86BIOS_RAM_BASE 0x00001000 #define X86BIOS_ROM_BASE 0x000a0000 -#define X86BIOS_ROM_SIZE (X86BIOS_MEM_SIZE - (uint32_t)x86bios_rom_phys) +#define X86BIOS_ROM_SIZE (X86BIOS_MEM_SIZE - x86bios_rom_phys) #define X86BIOS_SEG_SIZE X86BIOS_PAGE_SIZE #define X86BIOS_PAGES (X86BIOS_MEM_SIZE / X86BIOS_PAGE_SIZE) @@ -424,10 +424,12 @@ x86bios_emu_inb(struct x86emu *emu, uint16_t port) { +#ifndef X86BIOS_NATIVE_ARCH if (port == 0xb2) /* APM scratch register */ return (0); if (port >= 0x80 && port < 0x88) /* POST status register */ return (0); +#endif return (iodev_read_1(port)); } @@ -437,10 +439,10 @@ { uint16_t val; +#ifndef X86BIOS_NATIVE_ARCH if (port >= 0x80 && port < 0x88) /* POST status register */ return (0); -#ifndef X86BIOS_NATIVE_ARCH if ((port & 1) != 0) { val = iodev_read_1(port); val |= iodev_read_1(port + 1) << 8; @@ -456,10 +458,10 @@ { uint32_t val; +#ifndef X86BIOS_NATIVE_ARCH if (port >= 0x80 && port < 0x88) /* POST status register */ return (0); -#ifndef X86BIOS_NATIVE_ARCH if ((port & 1) != 0) { val = iodev_read_1(port); val |= iodev_read_2(port + 1) << 8; @@ -478,10 +480,12 @@ x86bios_emu_outb(struct x86emu *emu, uint16_t port, uint8_t val) { +#ifndef X86BIOS_NATIVE_ARCH if (port == 0xb2) /* APM scratch register */ return; if (port >= 0x80 && port < 0x88) /* POST status register */ return; +#endif iodev_write_1(port, val); } @@ -490,10 +494,10 @@ x86bios_emu_outw(struct x86emu *emu, uint16_t port, uint16_t val) { +#ifndef X86BIOS_NATIVE_ARCH if (port >= 0x80 && port < 0x88) /* POST status register */ return; -#ifndef X86BIOS_NATIVE_ARCH if ((port & 1) != 0) { iodev_write_1(port, val); iodev_write_1(port + 1, val >> 8); @@ -506,10 +510,10 @@ x86bios_emu_outl(struct x86emu *emu, uint16_t port, uint32_t val) { +#ifndef X86BIOS_NATIVE_ARCH if (port >= 0x80 && port < 0x88) /* POST status register */ return; -#ifndef X86BIOS_NATIVE_ARCH if ((port & 1) != 0) { iodev_write_1(port, val); iodev_write_2(port + 1, val >> 8); @@ -548,12 +552,13 @@ if (offset == NULL || size == 0) return (NULL); - vaddr = contigmalloc(size, M_DEVBUF, flags, X86BIOS_RAM_BASE, x86bios_rom_phys, X86BIOS_PAGE_SIZE, 0); if (vaddr != NULL) { *offset = vtophys(vaddr); + mtx_lock(&x86bios_lock); x86bios_set_pages((vm_offset_t)vaddr, *offset, size); + mtx_unlock(&x86bios_lock); } return (vaddr); @@ -566,14 +571,14 @@ if (addr == NULL || size == 0) return; - paddr = vtophys(addr); if (paddr < X86BIOS_RAM_BASE || paddr >= x86bios_rom_phys || paddr % X86BIOS_PAGE_SIZE != 0) return; - + mtx_lock(&x86bios_lock); bzero(x86bios_map + paddr / X86BIOS_PAGE_SIZE, sizeof(*x86bios_map) * howmany(size, X86BIOS_PAGE_SIZE)); + mtx_unlock(&x86bios_lock); contigfree(addr, size, M_DEVBUF); } @@ -590,29 +595,22 @@ x86bios_call(struct x86regs *regs, uint16_t seg, uint16_t off) { - if (x86bios_map == NULL) - return; - if (x86bios_trace_call) - printf("Calling 0x%05x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - (seg << 4) + off, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Calling 0x%06x, (seg << 4) + off, regs); - mtx_lock_spin(&x86bios_lock); + mtx_lock(&x86bios_lock); memcpy(&x86bios_emu.x86, regs, sizeof(*regs)); x86bios_fault = 0; + spinlock_enter(); x86emu_exec_call(&x86bios_emu, seg, off); + spinlock_exit(); memcpy(regs, &x86bios_emu.x86, sizeof(*regs)); - mtx_unlock_spin(&x86bios_lock); + mtx_unlock(&x86bios_lock); if (x86bios_trace_call) { - printf("Exiting 0x%05x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - (seg << 4) + off, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Exiting 0x%06x, (seg << 4) + off, regs); if (x86bios_fault) - printf("Page fault at 0x%05x from 0x%04x:0x%04x.\n", + printf("Page fault at 0x%06x from 0x%04x:0x%04x.\n", x86bios_fault_addr, x86bios_fault_cs, x86bios_fault_ip); } @@ -635,29 +633,22 @@ if (intno < 0 || intno > 255) return; - if (x86bios_map == NULL) - return; - if (x86bios_trace_int) - printf("Calling int 0x%x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - intno, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Calling INT 0x%02x, intno, regs); - mtx_lock_spin(&x86bios_lock); + mtx_lock(&x86bios_lock); memcpy(&x86bios_emu.x86, regs, sizeof(*regs)); x86bios_fault = 0; + spinlock_enter(); x86emu_exec_intr(&x86bios_emu, intno); + spinlock_exit(); memcpy(regs, &x86bios_emu.x86, sizeof(*regs)); - mtx_unlock_spin(&x86bios_lock); + mtx_unlock(&x86bios_lock); if (x86bios_trace_int) { - printf("Exiting int 0x%x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - intno, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Exiting INT 0x%02x, intno, regs); if (x86bios_fault) - printf("Page fault at 0x%05x from 0x%04x:0x%04x.\n", + printf("Page fault at 0x%06x from 0x%04x:0x%04x.\n", x86bios_fault_addr, x86bios_fault_cs, x86bios_fault_ip); } @@ -674,6 +665,7 @@ x86bios_unmap_mem(void) { + free(x86bios_map, M_DEVBUF); if (x86bios_ivt != NULL) #ifdef X86BIOS_NATIVE_ARCH pmap_unmapdev((vm_offset_t)x86bios_ivt, X86BIOS_IVT_SIZE); @@ -690,6 +682,9 @@ x86bios_map_mem(void) { + x86bios_map = malloc(sizeof(*x86bios_map) * X86BIOS_PAGES, M_DEVBUF, + M_WAITOK | M_ZERO); + #ifdef X86BIOS_NATIVE_ARCH x86bios_ivt = pmap_mapbios(X86BIOS_IVT_BASE, X86BIOS_IVT_SIZE); @@ -721,22 +716,30 @@ X86BIOS_RAM_BASE, x86bios_rom_phys, X86BIOS_PAGE_SIZE, 0); x86bios_seg_phys = vtophys(x86bios_seg); + x86bios_set_pages((vm_offset_t)x86bios_ivt, X86BIOS_IVT_BASE, + X86BIOS_IVT_SIZE); + x86bios_set_pages((vm_offset_t)x86bios_rom, x86bios_rom_phys, + X86BIOS_ROM_SIZE); + x86bios_set_pages((vm_offset_t)x86bios_seg, x86bios_seg_phys, + X86BIOS_SEG_SIZE); + if (bootverbose) { - printf("x86bios: IVT 0x%06x-0x%06x at %p\n", - X86BIOS_IVT_BASE, X86BIOS_IVT_SIZE + X86BIOS_IVT_BASE - 1, + printf("x86bios: IVT 0x%06jx-0x%06jx at %p\n", + (vm_paddr_t)X86BIOS_IVT_BASE, + (vm_paddr_t)X86BIOS_IVT_SIZE + X86BIOS_IVT_BASE - 1, x86bios_ivt); - printf("x86bios: SSEG 0x%06x-0x%06x at %p\n", - (uint32_t)x86bios_seg_phys, - X86BIOS_SEG_SIZE + (uint32_t)x86bios_seg_phys - 1, + printf("x86bios: SSEG 0x%06jx-0x%06jx at %p\n", + x86bios_seg_phys, + (vm_paddr_t)X86BIOS_SEG_SIZE + x86bios_seg_phys - 1, x86bios_seg); if (x86bios_rom_phys < X86BIOS_ROM_BASE) - printf("x86bios: EBDA 0x%06x-0x%06x at %p\n", - (uint32_t)x86bios_rom_phys, X86BIOS_ROM_BASE - 1, + printf("x86bios: EBDA 0x%06jx-0x%06jx at %p\n", + x86bios_rom_phys, (vm_paddr_t)X86BIOS_ROM_BASE - 1, x86bios_rom); - printf("x86bios: ROM 0x%06x-0x%06x at %p\n", - X86BIOS_ROM_BASE, X86BIOS_MEM_SIZE - X86BIOS_SEG_SIZE - 1, - (void *)((vm_offset_t)x86bios_rom + X86BIOS_ROM_BASE - - (vm_offset_t)x86bios_rom_phys)); + printf("x86bios: ROM 0x%06jx-0x%06jx at %p\n", + (vm_paddr_t)X86BIOS_ROM_BASE, + (vm_paddr_t)X86BIOS_MEM_SIZE - X86BIOS_SEG_SIZE - 1, + (caddr_t)x86bios_rom + X86BIOS_ROM_BASE - x86bios_rom_phys); } return (0); @@ -752,20 +755,11 @@ { int i; + mtx_init(&x86bios_lock, "x86bios lock", NULL, MTX_DEF); + if (x86bios_map_mem() != 0) return (ENOMEM); - mtx_init(&x86bios_lock, "x86bios lock", NULL, MTX_SPIN); - - x86bios_map = malloc(sizeof(*x86bios_map) * X86BIOS_PAGES, M_DEVBUF, - M_WAITOK | M_ZERO); - x86bios_set_pages((vm_offset_t)x86bios_ivt, X86BIOS_IVT_BASE, - X86BIOS_IVT_SIZE); - x86bios_set_pages((vm_offset_t)x86bios_rom, x86bios_rom_phys, - X86BIOS_ROM_SIZE); - x86bios_set_pages((vm_offset_t)x86bios_seg, x86bios_seg_phys, - X86BIOS_SEG_SIZE); - bzero(&x86bios_emu, sizeof(x86bios_emu)); x86bios_emu.emu_rdb = x86bios_emu_rdb; @@ -791,18 +785,8 @@ static int x86bios_uninit(void) { - vm_offset_t *map = x86bios_map; - mtx_lock_spin(&x86bios_lock); - if (x86bios_map != NULL) { - free(x86bios_map, M_DEVBUF); - x86bios_map = NULL; - } - mtx_unlock_spin(&x86bios_lock); - - if (map != NULL) - x86bios_unmap_mem(); - + x86bios_unmap_mem(); mtx_destroy(&x86bios_lock); return (0); ==== //depot/projects/smpng/sys/conf/files#264 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.1526 2010/07/25 17:55:57 rpaulo Exp $ +# $FreeBSD: src/sys/conf/files,v 1.1528 2010/08/08 08:43:01 bschmidt Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -285,6 +285,7 @@ contrib/dev/acpica/utilities/utmisc.c optional acpi contrib/dev/acpica/utilities/utmutex.c optional acpi contrib/dev/acpica/utilities/utobject.c optional acpi +contrib/dev/acpica/utilities/utosi.c optional acpi contrib/dev/acpica/utilities/utresrc.c optional acpi contrib/dev/acpica/utilities/utstate.c optional acpi contrib/dev/acpica/utilities/utxface.c optional acpi @@ -1858,7 +1859,7 @@ dev/wi/if_wi_pci.c optional wi pci dev/wl/if_wl.c optional wl isa wpifw.c optional wpifw \ - compile-with "${AWK} -f $S/tools/fw_stub.awk wpi.fw:wpifw:2144 -lintel_wpi -mwpi -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk wpi.fw:wpifw:2144 -mwpi -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "wpifw.c" wpifw.fwo optional wpifw \ ==== //depot/projects/smpng/sys/conf/files.i386#138 (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.649 2010/07/27 20:40:46 jhb Exp $ +# $FreeBSD: src/sys/conf/files.i386,v 1.650 2010/08/08 06:18:05 jkim Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -369,10 +369,9 @@ dev/fb/boot_font.c optional xboxfb i386/xbox/pic16l.s optional xbox # -# x86 real mode BIOS emulator, required by atkbdc/dpms/vesa +# x86 real mode BIOS support, required by atkbdc/dpms/vesa # compat/x86bios/x86bios.c optional x86bios | atkbd | dpms | vesa -contrib/x86emu/x86emu.c optional x86bios | atkbd | dpms | vesa # # x86 shared code between IA32, AMD64 and PC98 architectures # ==== //depot/projects/smpng/sys/contrib/dev/acpica/changes.txt#8 (text+ko) ==== @@ -1,8 +1,69 @@ ---------------------------------------- +06 August 2010. Summary of changes for version 20100806: + +1) ACPI CA Core Subsystem: + +Designed and implemented a new host interface to the _OSI support code. This +will allow the host to dynamically add or remove multiple _OSI strings, as +well as install an optional handler that is called for each _OSI invocation. +Also added a new AML debugger command, 'osi' to display and modify the global +_OSI string table, and test support in the AcpiExec utility. See the ACPICA +reference manual for full details. Lin Ming, Bob Moore. ACPICA BZ 836. +New Functions: + AcpiInstallInterface - Add an _OSI string. + AcpiRemoveInterface - Delete an _OSI string. + AcpiInstallInterfaceHandler - Install optional _OSI handler. +Obsolete Functions: + AcpiOsValidateInterface - no longer used. +New Files: + source/components/utilities/utosi.c + +Re-introduced the support to enable multi-byte transfers for Embedded +Controller (EC) operation regions. A reported problem was found to be a bug +in the host OS, not in the multi-byte support. Previously, the maximum data +size passed to the EC operation region handler was a single byte. There are +often EC Fields larger than one byte that need to be transferred, and it is +useful for the EC driver to lock these as a single transaction. This change +enables single transfers larger than 8 bits. This effectively changes the +access to the EC space from ByteAcc to AnyAcc, and will probably require +changes to the host OS Embedded Controller driver to enable 16/32/64/256-bit +transfers in addition to 8-bit transfers. Alexey Starikovskiy, Lin Ming. + +Fixed a problem with the prototype for AcpiOsReadPciConfiguration. The +prototype in acpiosxf.h had the output value pointer as a (void *). +It should be a (UINT64 *). This may affect some host OSL code. + +Fixed a couple problems with the recently modified Linux makefiles for iASL +and AcpiExec. These new makefiles place the generated object files in the +local directory so that there can be no collisions between the files that are +shared between them that are compiled with different options. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The >>> TRUNCATED FOR MAIL (1000 lines) <<<