From owner-svn-src-user@FreeBSD.ORG Tue Nov 9 22:16:48 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 771CE1065670; Tue, 9 Nov 2010 22:16:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6178A8FC0A; Tue, 9 Nov 2010 22:16:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA9MGmFt053953; Tue, 9 Nov 2010 22:16:48 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA9MGmv3053939; Tue, 9 Nov 2010 22:16:48 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201011092216.oA9MGmv3053939@svn.freebsd.org> From: Warner Losh Date: Tue, 9 Nov 2010 22:16:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215062 - in user/imp/tbemd: . contrib/top sys/amd64/include sys/arm/include sys/fs/nwfs sys/i386/include sys/i386/xen sys/ia64/ia64 sys/ia64/include sys/kern sys/mips/include sys/pc98/... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2010 22:16:48 -0000 Author: imp Date: Tue Nov 9 22:16:47 2010 New Revision: 215062 URL: http://svn.freebsd.org/changeset/base/215062 Log: merge from currnet @215061 Added: user/imp/tbemd/sys/x86/include/mptable.h - copied unchanged from r215061, head/sys/x86/include/mptable.h Deleted: user/imp/tbemd/sys/amd64/include/mptable.h user/imp/tbemd/sys/amd64/include/mutex.h user/imp/tbemd/sys/arm/include/mutex.h user/imp/tbemd/sys/i386/include/mptable.h user/imp/tbemd/sys/i386/include/mutex.h user/imp/tbemd/sys/ia64/include/mutex.h user/imp/tbemd/sys/mips/include/mutex.h user/imp/tbemd/sys/pc98/include/mptable.h user/imp/tbemd/sys/pc98/include/mutex.h user/imp/tbemd/sys/powerpc/include/mutex.h user/imp/tbemd/sys/sparc64/include/mutex.h user/imp/tbemd/sys/sun4v/include/mutex.h Modified: user/imp/tbemd/ObsoleteFiles.inc user/imp/tbemd/sys/fs/nwfs/nwfs_vnops.c user/imp/tbemd/sys/i386/xen/mptable.c user/imp/tbemd/sys/ia64/ia64/db_machdep.c user/imp/tbemd/sys/ia64/ia64/genassym.c user/imp/tbemd/sys/ia64/ia64/machdep.c user/imp/tbemd/sys/kern/kern_mutex.c user/imp/tbemd/sys/powerpc/booke/locore.S user/imp/tbemd/sys/sys/mutex.h user/imp/tbemd/sys/ufs/ufs/ufs_vnops.c user/imp/tbemd/sys/x86/x86/mptable.c user/imp/tbemd/sys/x86/x86/mptable_pci.c Directory Properties: user/imp/tbemd/ (props changed) user/imp/tbemd/cddl/contrib/opensolaris/ (props changed) user/imp/tbemd/contrib/bind9/ (props changed) user/imp/tbemd/contrib/binutils/ (props changed) user/imp/tbemd/contrib/bzip2/ (props changed) user/imp/tbemd/contrib/ee/ (props changed) user/imp/tbemd/contrib/expat/ (props changed) user/imp/tbemd/contrib/file/ (props changed) user/imp/tbemd/contrib/gdb/ (props changed) user/imp/tbemd/contrib/gdtoa/ (props changed) user/imp/tbemd/contrib/gnu-sort/ (props changed) user/imp/tbemd/contrib/groff/ (props changed) user/imp/tbemd/contrib/less/ (props changed) user/imp/tbemd/contrib/libpcap/ (props changed) user/imp/tbemd/contrib/llvm/ (props changed) user/imp/tbemd/contrib/llvm/tools/clang/ (props changed) user/imp/tbemd/contrib/ncurses/ (props changed) user/imp/tbemd/contrib/netcat/ (props changed) user/imp/tbemd/contrib/ntp/ (props changed) user/imp/tbemd/contrib/one-true-awk/ (props changed) user/imp/tbemd/contrib/openbsm/ (props changed) user/imp/tbemd/contrib/openpam/ (props changed) user/imp/tbemd/contrib/pf/ (props changed) user/imp/tbemd/contrib/sendmail/ (props changed) user/imp/tbemd/contrib/tcpdump/ (props changed) user/imp/tbemd/contrib/tcsh/ (props changed) user/imp/tbemd/contrib/top/ (props changed) user/imp/tbemd/contrib/top/install-sh (props changed) user/imp/tbemd/contrib/tzcode/stdtime/ (props changed) user/imp/tbemd/contrib/tzcode/zic/ (props changed) user/imp/tbemd/contrib/tzdata/ (props changed) user/imp/tbemd/contrib/wpa/ (props changed) user/imp/tbemd/contrib/xz/ (props changed) user/imp/tbemd/crypto/openssh/ (props changed) user/imp/tbemd/crypto/openssl/ (props changed) user/imp/tbemd/lib/libc/ (props changed) user/imp/tbemd/lib/libc/stdtime/ (props changed) user/imp/tbemd/lib/libutil/ (props changed) user/imp/tbemd/lib/libz/ (props changed) user/imp/tbemd/sbin/ (props changed) user/imp/tbemd/sbin/ipfw/ (props changed) user/imp/tbemd/share/zoneinfo/ (props changed) user/imp/tbemd/sys/ (props changed) user/imp/tbemd/sys/amd64/include/xen/ (props changed) user/imp/tbemd/sys/cddl/contrib/opensolaris/ (props changed) user/imp/tbemd/sys/contrib/dev/acpica/ (props changed) user/imp/tbemd/sys/contrib/pf/ (props changed) user/imp/tbemd/sys/contrib/x86emu/ (props changed) user/imp/tbemd/sys/dev/xen/xenpci/ (props changed) user/imp/tbemd/usr.bin/calendar/ (props changed) user/imp/tbemd/usr.bin/csup/ (props changed) user/imp/tbemd/usr.bin/procstat/ (props changed) user/imp/tbemd/usr.sbin/zic/ (props changed) Modified: user/imp/tbemd/ObsoleteFiles.inc ============================================================================== --- user/imp/tbemd/ObsoleteFiles.inc Tue Nov 9 22:09:22 2010 (r215061) +++ user/imp/tbemd/ObsoleteFiles.inc Tue Nov 9 22:16:47 2010 (r215062) @@ -14,6 +14,10 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20101109: headers moved to machine/ to x86/ +.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" +OLD_FILES+=usr/include/machine/mptable.h +.endif # 20101101: headers moved to machine/ to x86/ .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" OLD_FILES+=usr/include/machine/apicreg.h Modified: user/imp/tbemd/sys/fs/nwfs/nwfs_vnops.c ============================================================================== --- user/imp/tbemd/sys/fs/nwfs/nwfs_vnops.c Tue Nov 9 22:09:22 2010 (r215061) +++ user/imp/tbemd/sys/fs/nwfs/nwfs_vnops.c Tue Nov 9 22:16:47 2010 (r215062) @@ -39,8 +39,6 @@ #include #include -#include - #include #include #include Modified: user/imp/tbemd/sys/i386/xen/mptable.c ============================================================================== --- user/imp/tbemd/sys/i386/xen/mptable.c Tue Nov 9 22:09:22 2010 (r215061) +++ user/imp/tbemd/sys/i386/xen/mptable.c Tue Nov 9 22:16:47 2010 (r215062) @@ -38,11 +38,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include -#include #include #include Modified: user/imp/tbemd/sys/ia64/ia64/db_machdep.c ============================================================================== --- user/imp/tbemd/sys/ia64/ia64/db_machdep.c Tue Nov 9 22:09:22 2010 (r215061) +++ user/imp/tbemd/sys/ia64/ia64/db_machdep.c Tue Nov 9 22:16:47 2010 (r215062) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: user/imp/tbemd/sys/ia64/ia64/genassym.c ============================================================================== --- user/imp/tbemd/sys/ia64/ia64/genassym.c Tue Nov 9 22:09:22 2010 (r215061) +++ user/imp/tbemd/sys/ia64/ia64/genassym.c Tue Nov 9 22:16:47 2010 (r215062) @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include Modified: user/imp/tbemd/sys/ia64/ia64/machdep.c ============================================================================== --- user/imp/tbemd/sys/ia64/ia64/machdep.c Tue Nov 9 22:09:22 2010 (r215061) +++ user/imp/tbemd/sys/ia64/ia64/machdep.c Tue Nov 9 22:16:47 2010 (r215062) @@ -88,7 +88,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: user/imp/tbemd/sys/kern/kern_mutex.c ============================================================================== --- user/imp/tbemd/sys/kern/kern_mutex.c Tue Nov 9 22:09:22 2010 (r215061) +++ user/imp/tbemd/sys/kern/kern_mutex.c Tue Nov 9 22:16:47 2010 (r215062) @@ -200,7 +200,7 @@ _mtx_lock_flags(struct mtx *m, int opts, WITNESS_CHECKORDER(&m->lock_object, opts | LOP_NEWORDER | LOP_EXCLUSIVE, file, line, NULL); - _get_sleep_lock(m, curthread, opts, file, line); + __mtx_lock(m, curthread, opts, file, line); LOCK_LOG_LOCK("LOCK", &m->lock_object, opts, m->mtx_recurse, file, line); WITNESS_LOCK(&m->lock_object, opts | LOP_EXCLUSIVE, file, line); @@ -224,7 +224,7 @@ _mtx_unlock_flags(struct mtx *m, int opt if (m->mtx_recurse == 0) LOCKSTAT_PROFILE_RELEASE_LOCK(LS_MTX_UNLOCK_RELEASE, m); - _rel_sleep_lock(m, curthread, opts, file, line); + __mtx_unlock(m, curthread, opts, file, line); } void @@ -243,7 +243,7 @@ _mtx_lock_spin_flags(struct mtx *m, int m->lock_object.lo_name, file, line)); WITNESS_CHECKORDER(&m->lock_object, opts | LOP_NEWORDER | LOP_EXCLUSIVE, file, line, NULL); - _get_spin_lock(m, curthread, opts, file, line); + __mtx_lock_spin(m, curthread, opts, file, line); LOCK_LOG_LOCK("LOCK", &m->lock_object, opts, m->mtx_recurse, file, line); WITNESS_LOCK(&m->lock_object, opts | LOP_EXCLUSIVE, file, line); @@ -264,7 +264,7 @@ _mtx_unlock_spin_flags(struct mtx *m, in line); mtx_assert(m, MA_OWNED); - _rel_spin_lock(m); + __mtx_unlock_spin(m); } /* @@ -293,7 +293,7 @@ _mtx_trylock(struct mtx *m, int opts, co atomic_set_ptr(&m->mtx_lock, MTX_RECURSED); rval = 1; } else - rval = _obtain_lock(m, (uintptr_t)curthread); + rval = _mtx_obtain_lock(m, (uintptr_t)curthread); LOCK_LOG_TRY("LOCK", &m->lock_object, opts, rval, file, line); if (rval) { @@ -355,7 +355,7 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t "_mtx_lock_sleep: %s contested (lock=%p) at %s:%d", m->lock_object.lo_name, (void *)m->mtx_lock, file, line); - while (!_obtain_lock(m, tid)) { + while (!_mtx_obtain_lock(m, tid)) { #ifdef KDTRACE_HOOKS spin_cnt++; #endif @@ -511,7 +511,7 @@ _mtx_lock_spin(struct mtx *m, uintptr_t CTR1(KTR_LOCK, "_mtx_lock_spin: %p spinning", m); lock_profile_obtain_lock_failed(&m->lock_object, &contested, &waittime); - while (!_obtain_lock(m, tid)) { + while (!_mtx_obtain_lock(m, tid)) { /* Give interrupts a chance while we spin. */ spinlock_exit(); @@ -569,7 +569,7 @@ retry: m->lock_object.lo_name, file, line)); WITNESS_CHECKORDER(&m->lock_object, opts | LOP_NEWORDER | LOP_EXCLUSIVE, file, line, NULL); - while (!_obtain_lock(m, tid)) { + while (!_mtx_obtain_lock(m, tid)) { #ifdef KDTRACE_HOOKS spin_cnt++; #endif @@ -597,7 +597,7 @@ retry: } if (m == td->td_lock) break; - _rel_spin_lock(m); /* does spinlock_exit() */ + __mtx_unlock_spin(m); /* does spinlock_exit() */ #ifdef KDTRACE_HOOKS spin_cnt++; #endif @@ -673,7 +673,7 @@ _mtx_unlock_sleep(struct mtx *m, int opt CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p contested", m); MPASS(ts != NULL); turnstile_broadcast(ts, TS_EXCLUSIVE_QUEUE); - _release_lock_quick(m); + _mtx_release_lock_quick(m); /* * This turnstile is now no longer associated with the mutex. We can @@ -685,7 +685,7 @@ _mtx_unlock_sleep(struct mtx *m, int opt /* * All the unlocking of MTX_SPIN locks is done inline. - * See the _rel_spin_lock() macro for the details. + * See the __mtx_unlock_spin() macro for the details. */ /* Modified: user/imp/tbemd/sys/powerpc/booke/locore.S ============================================================================== --- user/imp/tbemd/sys/powerpc/booke/locore.S Tue Nov 9 22:09:22 2010 (r215061) +++ user/imp/tbemd/sys/powerpc/booke/locore.S Tue Nov 9 22:16:47 2010 (r215062) @@ -28,8 +28,6 @@ #include "assym.s" -#include - #include #include #include Modified: user/imp/tbemd/sys/sys/mutex.h ============================================================================== --- user/imp/tbemd/sys/sys/mutex.h Tue Nov 9 22:09:22 2010 (r215061) +++ user/imp/tbemd/sys/sys/mutex.h Tue Nov 9 22:16:47 2010 (r215062) @@ -32,7 +32,6 @@ #ifndef _SYS_MUTEX_H_ #define _SYS_MUTEX_H_ -#ifndef LOCORE #include #include #include @@ -43,12 +42,6 @@ #include #include #include -#endif /* _KERNEL_ */ -#endif /* !LOCORE */ - -#include - -#ifdef _KERNEL /* * Mutex types and options passed to mtx_init(). MTX_QUIET and MTX_DUPOK @@ -83,8 +76,6 @@ #endif /* _KERNEL */ -#ifndef LOCORE - /* * XXX: Friendly reminder to fix things in MP code that is presently being * XXX: worked on. @@ -137,68 +128,59 @@ void _thread_lock_flags(struct thread *, #define mtx_recurse lock_object.lo_data -/* - * We define our machine-independent (unoptimized) mutex micro-operations - * here, if they are not already defined in the machine-dependent mutex.h - */ +/* Very simple operations on mtx_lock. */ /* Try to obtain mtx_lock once. */ -#ifndef _obtain_lock -#define _obtain_lock(mp, tid) \ +#define _mtx_obtain_lock(mp, tid) \ atomic_cmpset_acq_ptr(&(mp)->mtx_lock, MTX_UNOWNED, (tid)) -#endif /* Try to release mtx_lock if it is unrecursed and uncontested. */ -#ifndef _release_lock -#define _release_lock(mp, tid) \ +#define _mtx_release_lock(mp, tid) \ atomic_cmpset_rel_ptr(&(mp)->mtx_lock, (tid), MTX_UNOWNED) -#endif /* Release mtx_lock quickly, assuming we own it. */ -#ifndef _release_lock_quick -#define _release_lock_quick(mp) \ +#define _mtx_release_lock_quick(mp) \ atomic_store_rel_ptr(&(mp)->mtx_lock, MTX_UNOWNED) -#endif /* - * Obtain a sleep lock inline, or call the "hard" function if we can't get it - * easy. + * Full lock operations that are suitable to be inlined in non-debug + * kernels. If the lock cannot be acquired or released trivially then + * the work is deferred to another function. */ -#ifndef _get_sleep_lock -#define _get_sleep_lock(mp, tid, opts, file, line) do { \ + +/* Lock a normal mutex. */ +#define __mtx_lock(mp, tid, opts, file, line) do { \ uintptr_t _tid = (uintptr_t)(tid); \ - if (!_obtain_lock((mp), _tid)) \ + \ + if (!_mtx_obtain_lock((mp), _tid)) \ _mtx_lock_sleep((mp), _tid, (opts), (file), (line)); \ else \ LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_MTX_LOCK_ACQUIRE, \ mp, 0, 0, (file), (line)); \ } while (0) -#endif /* - * Obtain a spin lock inline, or call the "hard" function if we can't get it - * easy. For spinlocks, we handle recursion inline (it turns out that function - * calls can be significantly expensive on some architectures). - * Since spin locks are not _too_ common, inlining this code is not too big - * a deal. + * Lock a spin mutex. For spinlocks, we handle recursion inline (it + * turns out that function calls can be significantly expensive on + * some architectures). Since spin locks are not _too_ common, + * inlining this code is not too big a deal. */ -#ifndef _get_spin_lock #ifdef SMP -#define _get_spin_lock(mp, tid, opts, file, line) do { \ +#define __mtx_lock_spin(mp, tid, opts, file, line) do { \ uintptr_t _tid = (uintptr_t)(tid); \ + \ spinlock_enter(); \ - if (!_obtain_lock((mp), _tid)) { \ + if (!_mtx_obtain_lock((mp), _tid)) { \ if ((mp)->mtx_lock == _tid) \ (mp)->mtx_recurse++; \ - else { \ + else \ _mtx_lock_spin((mp), _tid, (opts), (file), (line)); \ - } \ } else \ LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_MTX_SPIN_LOCK_ACQUIRE, \ mp, 0, 0, (file), (line)); \ } while (0) #else /* SMP */ -#define _get_spin_lock(mp, tid, opts, file, line) do { \ +#define __mtx_lock_spin(mp, tid, opts, file, line) do { \ uintptr_t _tid = (uintptr_t)(tid); \ \ spinlock_enter(); \ @@ -206,49 +188,42 @@ void _thread_lock_flags(struct thread *, (mp)->mtx_recurse++; \ else { \ KASSERT((mp)->mtx_lock == MTX_UNOWNED, ("corrupt spinlock")); \ - (mp)->mtx_lock = _tid; \ + (mp)->mtx_lock = _tid; \ } \ } while (0) #endif /* SMP */ -#endif -/* - * Release a sleep lock inline, or call the "hard" function if we can't do it - * easy. - */ -#ifndef _rel_sleep_lock -#define _rel_sleep_lock(mp, tid, opts, file, line) do { \ +/* Unlock a normal mutex. */ +#define __mtx_unlock(mp, tid, opts, file, line) do { \ uintptr_t _tid = (uintptr_t)(tid); \ \ - if (!_release_lock((mp), _tid)) \ + if (!_mtx_release_lock((mp), _tid)) \ _mtx_unlock_sleep((mp), (opts), (file), (line)); \ } while (0) -#endif /* - * For spinlocks, we can handle everything inline, as it's pretty simple and - * a function call would be too expensive (at least on some architectures). - * Since spin locks are not _too_ common, inlining this code is not too big - * a deal. + * Unlock a spin mutex. For spinlocks, we can handle everything + * inline, as it's pretty simple and a function call would be too + * expensive (at least on some architectures). Since spin locks are + * not _too_ common, inlining this code is not too big a deal. * * Since we always perform a spinlock_enter() when attempting to acquire a * spin lock, we need to always perform a matching spinlock_exit() when * releasing a spin lock. This includes the recursion cases. */ -#ifndef _rel_spin_lock #ifdef SMP -#define _rel_spin_lock(mp) do { \ +#define __mtx_unlock_spin(mp) do { \ if (mtx_recursed((mp))) \ (mp)->mtx_recurse--; \ else { \ LOCKSTAT_PROFILE_RELEASE_LOCK(LS_MTX_SPIN_UNLOCK_RELEASE, \ mp); \ - _release_lock_quick((mp)); \ + _mtx_release_lock_quick((mp)); \ } \ spinlock_exit(); \ } while (0) #else /* SMP */ -#define _rel_spin_lock(mp) do { \ +#define __mtx_unlock_spin(mp) do { \ if (mtx_recursed((mp))) \ (mp)->mtx_recurse--; \ else { \ @@ -259,7 +234,6 @@ void _thread_lock_flags(struct thread *, spinlock_exit(); \ } while (0) #endif /* SMP */ -#endif /* * Exported lock manipulation interface. @@ -336,13 +310,13 @@ extern struct mtx_pool *mtxpool_sleep; _mtx_unlock_spin_flags((m), (opts), LOCK_FILE, LOCK_LINE) #else /* LOCK_DEBUG == 0 && !MUTEX_NOINLINE */ #define mtx_lock_flags(m, opts) \ - _get_sleep_lock((m), curthread, (opts), LOCK_FILE, LOCK_LINE) + __mtx_lock((m), curthread, (opts), LOCK_FILE, LOCK_LINE) #define mtx_unlock_flags(m, opts) \ - _rel_sleep_lock((m), curthread, (opts), LOCK_FILE, LOCK_LINE) + __mtx_unlock((m), curthread, (opts), LOCK_FILE, LOCK_LINE) #define mtx_lock_spin_flags(m, opts) \ - _get_spin_lock((m), curthread, (opts), LOCK_FILE, LOCK_LINE) + __mtx_lock_spin((m), curthread, (opts), LOCK_FILE, LOCK_LINE) #define mtx_unlock_spin_flags(m, opts) \ - _rel_spin_lock((m)) + __mtx_unlock_spin((m)) #endif /* LOCK_DEBUG > 0 || MUTEX_NOINLINE */ #define mtx_trylock_flags(m, opts) \ @@ -451,5 +425,4 @@ struct mtx_args { #define MTX_NETWORK_LOCK "network driver" #endif /* _KERNEL */ -#endif /* !LOCORE */ #endif /* _SYS_MUTEX_H_ */ Modified: user/imp/tbemd/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- user/imp/tbemd/sys/ufs/ufs/ufs_vnops.c Tue Nov 9 22:09:22 2010 (r215061) +++ user/imp/tbemd/sys/ufs/ufs/ufs_vnops.c Tue Nov 9 22:16:47 2010 (r215062) @@ -61,8 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include #include /* XXX */ Copied: user/imp/tbemd/sys/x86/include/mptable.h (from r215061, head/sys/x86/include/mptable.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/imp/tbemd/sys/x86/include/mptable.h Tue Nov 9 22:16:47 2010 (r215062, copy of r215061, head/sys/x86/include/mptable.h) @@ -0,0 +1,146 @@ +/*- + * Copyright (c) 1996, by Steve Passe + * 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, this list of conditions and the following disclaimer. + * 2. The name of the developer may NOT be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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$ + */ + +#ifndef __MACHINE_MPTABLE_H__ +#define __MACHINE_MPTABLE_H__ + +enum busTypes { + NOBUS = 0, + EISA = 3, + ISA = 6, + MCA = 9, + PCI = 13, + MAX_BUSTYPE = 18, + UNKNOWN_BUSTYPE = 0xff +}; + +/* MP Floating Pointer Structure */ +typedef struct MPFPS { + char signature[4]; + u_int32_t pap; + u_char length; + u_char spec_rev; + u_char checksum; + u_char config_type; + u_char mpfb2; + u_char mpfb3; + u_char mpfb4; + u_char mpfb5; +} *mpfps_t; + +#define MPFB2_IMCR_PRESENT 0x80 +#define MPFB2_MUL_CLK_SRCS 0x40 + +/* MP Configuration Table Header */ +typedef struct MPCTH { + char signature[4]; + u_short base_table_length; + u_char spec_rev; + u_char checksum; + u_char oem_id[8]; + u_char product_id[12]; + u_int32_t oem_table_pointer; + u_short oem_table_size; + u_short entry_count; + u_int32_t apic_address; + u_short extended_table_length; + u_char extended_table_checksum; + u_char reserved; +} *mpcth_t; + +#define MPCT_ENTRY_PROCESSOR 0 +#define MPCT_ENTRY_BUS 1 +#define MPCT_ENTRY_IOAPIC 2 +#define MPCT_ENTRY_INT 3 +#define MPCT_ENTRY_LOCAL_INT 4 + +typedef struct PROCENTRY { + u_char type; + u_char apic_id; + u_char apic_version; + u_char cpu_flags; + u_long cpu_signature; + u_long feature_flags; + u_long reserved1; + u_long reserved2; +} *proc_entry_ptr; + +#define PROCENTRY_FLAG_EN 0x01 +#define PROCENTRY_FLAG_BP 0x02 + +typedef struct BUSENTRY { + u_char type; + u_char bus_id; + char bus_type[6]; +} *bus_entry_ptr; + +typedef struct IOAPICENTRY { + u_char type; + u_char apic_id; + u_char apic_version; + u_char apic_flags; + u_int32_t apic_address; +} *io_apic_entry_ptr; + +#define IOAPICENTRY_FLAG_EN 0x01 + +typedef struct INTENTRY { + u_char type; + u_char int_type; + u_short int_flags; + u_char src_bus_id; + u_char src_bus_irq; + u_char dst_apic_id; + u_char dst_apic_int; +} *int_entry_ptr; + +#define INTENTRY_TYPE_INT 0 +#define INTENTRY_TYPE_NMI 1 +#define INTENTRY_TYPE_SMI 2 +#define INTENTRY_TYPE_EXTINT 3 + +#define INTENTRY_FLAGS_POLARITY 0x3 +#define INTENTRY_FLAGS_POLARITY_CONFORM 0x0 +#define INTENTRY_FLAGS_POLARITY_ACTIVEHI 0x1 +#define INTENTRY_FLAGS_POLARITY_ACTIVELO 0x3 +#define INTENTRY_FLAGS_TRIGGER 0xc +#define INTENTRY_FLAGS_TRIGGER_CONFORM 0x0 +#define INTENTRY_FLAGS_TRIGGER_EDGE 0x4 +#define INTENTRY_FLAGS_TRIGGER_LEVEL 0xc + +/* descriptions of MP basetable entries */ +typedef struct BASETABLE_ENTRY { + u_char type; + u_char length; + char name[16]; +} basetable_entry; + +#ifdef _KERNEL +int mptable_pci_probe_table(int bus); +int mptable_pci_route_interrupt(device_t pcib, device_t dev, int pin); +#endif +#endif /* !__MACHINE_MPTABLE_H__ */ Modified: user/imp/tbemd/sys/x86/x86/mptable.c ============================================================================== --- user/imp/tbemd/sys/x86/x86/mptable.c Tue Nov 9 22:09:22 2010 (r215061) +++ user/imp/tbemd/sys/x86/x86/mptable.c Tue Nov 9 22:16:47 2010 (r215062) @@ -39,11 +39,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include -#include #include #include Modified: user/imp/tbemd/sys/x86/x86/mptable_pci.c ============================================================================== --- user/imp/tbemd/sys/x86/x86/mptable_pci.c Tue Nov 9 22:09:22 2010 (r215061) +++ user/imp/tbemd/sys/x86/x86/mptable_pci.c Tue Nov 9 22:16:47 2010 (r215062) @@ -44,8 +44,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include -#include #include #include "pcib_if.h"