From owner-svn-src-stable-7@FreeBSD.ORG Sun May 31 06:58:35 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95BE21065738; Sun, 31 May 2009 06:58:35 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 80B3F8FC29; Sun, 31 May 2009 06:58:35 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4V6wZsL032347; Sun, 31 May 2009 06:58:35 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4V6wZjH032344; Sun, 31 May 2009 06:58:35 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200905310658.n4V6wZjH032344@svn.freebsd.org> From: Dmitry Chagin Date: Sun, 31 May 2009 06:58:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193152 - in stable/7/sys: . amd64/linux32 compat/linux contrib/pf dev/ath/ath_hal dev/cxgb i386/linux X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 May 2009 06:58:36 -0000 Author: dchagin Date: Sun May 31 06:58:35 2009 New Revision: 193152 URL: http://svn.freebsd.org/changeset/base/193152 Log: MFC r191719: Reimplement futexes. Old implemention used Giant to protect the kernel data structures, but at the same time called malloc(M_WAITOK), that could cause the calling thread to sleep and lost Giant protection. User-visible result was the missed wakeup. New implementation uses one sx lock per futex. The sx protects the futex structures and allows to sleep while copyin or copyout are performed. Unlike linux, we return EINVAL when FUTEX_CMP_REQUEUE operation is requested and either caller specified futexes are equial or second futex already exists. This is acceptable since the situation can only occur from the application error, and glibc falls back to old FUTEX_WAKE operation when FUTEX_CMP_REQUEUE returns an error. Approved by: kib (mentor) Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/linux32/linux32_sysvec.c stable/7/sys/compat/linux/linux_futex.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/i386/linux/linux_sysvec.c Modified: stable/7/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/7/sys/amd64/linux32/linux32_sysvec.c Sun May 31 06:37:47 2009 (r193151) +++ stable/7/sys/amd64/linux32/linux32_sysvec.c Sun May 31 06:58:35 2009 (r193152) @@ -127,7 +127,7 @@ static void exec_linux_setregs(struct th static void linux32_fixlimit(struct rlimit *rl, int which); extern LIST_HEAD(futex_list, futex) futex_list; -extern struct sx futex_sx; +extern struct mtx futex_mtx; static eventhandler_tag linux_exit_tag; static eventhandler_tag linux_schedtail_tag; @@ -1121,7 +1121,7 @@ linux_elf_modevent(module_t mod, int typ mtx_init(&emul_lock, "emuldata lock", NULL, MTX_DEF); sx_init(&emul_shared_lock, "emuldata->shared lock"); LIST_INIT(&futex_list); - sx_init(&futex_sx, "futex protection lock"); + mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit, NULL, 1000); linux_schedtail_tag = EVENTHANDLER_REGISTER(schedtail, @@ -1154,7 +1154,7 @@ linux_elf_modevent(module_t mod, int typ linux_device_unregister_handler(*ldhp); mtx_destroy(&emul_lock); sx_destroy(&emul_shared_lock); - sx_destroy(&futex_sx); + mtx_destroy(&futex_mtx); EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag); EVENTHANDLER_DEREGISTER(schedtail, linux_schedtail_tag); EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag); Modified: stable/7/sys/compat/linux/linux_futex.c ============================================================================== --- stable/7/sys/compat/linux/linux_futex.c Sun May 31 06:37:47 2009 (r193151) +++ stable/7/sys/compat/linux/linux_futex.c Sun May 31 06:58:35 2009 (r193152) @@ -62,419 +62,284 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex. #include #include +MALLOC_DEFINE(M_FUTEX, "futex", "Linux futexes"); +MALLOC_DEFINE(M_FUTEX_WP, "futex wp", "Linux futexes wp"); + struct futex; struct waiting_proc { - struct thread *wp_t; - struct futex *wp_new_futex; + uint32_t wp_flags; + struct futex *wp_futex; TAILQ_ENTRY(waiting_proc) wp_list; }; + struct futex { - void *f_uaddr; - int f_refcount; + struct sx f_lck; + uint32_t *f_uaddr; + uint32_t f_refcount; LIST_ENTRY(futex) f_list; TAILQ_HEAD(lf_waiting_proc, waiting_proc) f_waiting_proc; }; LIST_HEAD(futex_list, futex) futex_list; -struct sx futex_sx; /* this protects the LIST of futexes */ - -#define FUTEX_LOCK sx_xlock(&futex_sx) -#define FUTEX_UNLOCK sx_xunlock(&futex_sx) -#define FUTEX_LOCKED 1 -#define FUTEX_UNLOCKED 0 - -#define FUTEX_SYSTEM_LOCK mtx_lock(&Giant) -#define FUTEX_SYSTEM_UNLOCK mtx_unlock(&Giant) - -static struct futex *futex_get(void *, int); -static void futex_put(struct futex *); -static int futex_sleep(struct futex *, struct thread *, unsigned long); -static int futex_wake(struct futex *, int, struct futex *, int); -static int futex_atomic_op(struct thread *td, int encoded_op, caddr_t uaddr); +#define FUTEX_LOCK(f) sx_xlock(&(f)->f_lck) +#define FUTEX_UNLOCK(f) sx_xunlock(&(f)->f_lck) +#define FUTEX_INIT(f) sx_init_flags(&(f)->f_lck, "ftlk", 0) +#define FUTEX_DESTROY(f) sx_destroy(&(f)->f_lck) +#define FUTEX_ASSERT_LOCKED(f) sx_assert(&(f)->f_lck, SA_XLOCKED) + +struct mtx futex_mtx; /* protects the futex list */ +#define FUTEXES_LOCK mtx_lock(&futex_mtx) +#define FUTEXES_UNLOCK mtx_unlock(&futex_mtx) + +/* flags for futex_get() */ +#define FUTEX_CREATE_WP 0x1 /* create waiting_proc */ +#define FUTEX_DONTCREATE 0x2 /* don't create futex if not exists */ +#define FUTEX_DONTEXISTS 0x4 /* return EINVAL if futex exists */ + +/* wp_flags */ +#define FUTEX_WP_REQUEUED 0x1 /* wp requeued - wp moved from wp_list + * of futex where thread sleep to wp_list + * of another futex. + */ +#define FUTEX_WP_REMOVED 0x2 /* wp is woken up and removed from futex + * wp_list to prevent double wakeup. + */ /* support.s */ -int futex_xchgl(int oparg, caddr_t uaddr, int *oldval); -int futex_addl(int oparg, caddr_t uaddr, int *oldval); -int futex_orl(int oparg, caddr_t uaddr, int *oldval); -int futex_andl(int oparg, caddr_t uaddr, int *oldval); -int futex_xorl(int oparg, caddr_t uaddr, int *oldval); +int futex_xchgl(int oparg, uint32_t *uaddr, int *oldval); +int futex_addl(int oparg, uint32_t *uaddr, int *oldval); +int futex_orl(int oparg, uint32_t *uaddr, int *oldval); +int futex_andl(int oparg, uint32_t *uaddr, int *oldval); +int futex_xorl(int oparg, uint32_t *uaddr, int *oldval); -int -linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args) +static void +futex_put(struct futex *f, struct waiting_proc *wp) { - int val; - int ret; - struct l_timespec timeout = {0, 0}; - int error = 0; - struct futex *f; - struct futex *newf; - int timeout_hz; - struct timeval tv = {0, 0}; - struct futex *f2; - int op_ret; - struct linux_emuldata *em; - -#ifdef DEBUG - if (ldebug(sys_futex)) - printf(ARGS(futex, "%p, %i, %i, *, %p, %i"), args->uaddr, args->op, - args->val, args->uaddr2, args->val3); -#endif - - /* - * Our implementation provides only privates futexes. Most of the apps - * should use private futexes but don't claim so. Therefore we treat - * all futexes as private by clearing the FUTEX_PRIVATE_FLAG. It works - * in most cases (ie. when futexes are not shared on file descriptor - * or between different processes.). - */ - args->op = (args->op & ~LINUX_FUTEX_PRIVATE_FLAG); - switch (args->op) { - case LINUX_FUTEX_WAIT: - FUTEX_SYSTEM_LOCK; - - if ((error = copyin(args->uaddr, - &val, sizeof(val))) != 0) { - FUTEX_SYSTEM_UNLOCK; - return error; - } - - if (val != args->val) { - FUTEX_SYSTEM_UNLOCK; - return EWOULDBLOCK; - } - - if (args->timeout != NULL) { - if ((error = copyin(args->timeout, - &timeout, sizeof(timeout))) != 0) { - FUTEX_SYSTEM_UNLOCK; - return error; - } - } - -#ifdef DEBUG - if (ldebug(sys_futex)) - printf("FUTEX_WAIT %d: val = %d, uaddr = %p, " - "*uaddr = %d, timeout = %d.%09lu\n", - td->td_proc->p_pid, args->val, - args->uaddr, val, timeout.tv_sec, - (unsigned long)timeout.tv_nsec); -#endif - tv.tv_usec = timeout.tv_sec * 1000000 + timeout.tv_nsec / 1000; - timeout_hz = tvtohz(&tv); - - if (timeout.tv_sec == 0 && timeout.tv_nsec == 0) - timeout_hz = 0; - /* - * If the user process requests a non null timeout, - * make sure we do not turn it into an infinite - * timeout because timeout_hz gets null. - * - * We use a minimal timeout of 1/hz. Maybe it would - * make sense to just return ETIMEDOUT without sleeping. - */ - if (((timeout.tv_sec != 0) || (timeout.tv_nsec != 0)) && - (timeout_hz == 0)) - timeout_hz = 1; - - - f = futex_get(args->uaddr, FUTEX_UNLOCKED); - ret = futex_sleep(f, td, timeout_hz); - futex_put(f); - -#ifdef DEBUG - if (ldebug(sys_futex)) - printf("FUTEX_WAIT %d: uaddr = %p, " - "ret = %d\n", td->td_proc->p_pid, args->uaddr, ret); -#endif - - FUTEX_SYSTEM_UNLOCK; - switch (ret) { - case EWOULDBLOCK: /* timeout */ - return ETIMEDOUT; - break; - case EINTR: /* signal */ - return EINTR; - break; - case 0: /* FUTEX_WAKE received */ -#ifdef DEBUG - if (ldebug(sys_futex)) - printf("FUTEX_WAIT %d: uaddr = %p, " - "got FUTEX_WAKE\n", - td->td_proc->p_pid, args->uaddr); -#endif - return 0; - break; - default: -#ifdef DEBUG - if (ldebug(sys_futex)) - printf("FUTEX_WAIT: unexpected ret = %d\n", - ret); -#endif - break; - } - - /* NOTREACHED */ - break; - - case LINUX_FUTEX_WAKE: - FUTEX_SYSTEM_LOCK; - - /* - * XXX: Linux is able to cope with different addresses - * corresponding to the same mapped memory in the sleeping - * and waker process(es). - */ -#ifdef DEBUG - if (ldebug(sys_futex)) - printf("FUTEX_WAKE %d: uaddr = %p, val = %d\n", - td->td_proc->p_pid, args->uaddr, args->val); -#endif - f = futex_get(args->uaddr, FUTEX_UNLOCKED); - td->td_retval[0] = futex_wake(f, args->val, NULL, 0); - futex_put(f); - - FUTEX_SYSTEM_UNLOCK; - break; - - case LINUX_FUTEX_CMP_REQUEUE: - FUTEX_SYSTEM_LOCK; + FUTEX_ASSERT_LOCKED(f); + if (wp != NULL) { + if ((wp->wp_flags & FUTEX_WP_REMOVED) == 0) + TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list); + free(wp, M_FUTEX_WP); + } - if ((error = copyin(args->uaddr, - &val, sizeof(val))) != 0) { - FUTEX_SYSTEM_UNLOCK; - return error; - } + FUTEXES_LOCK; + if (--f->f_refcount == 0) { + LIST_REMOVE(f, f_list); + FUTEXES_UNLOCK; + FUTEX_UNLOCK(f); - if (val != args->val3) { - FUTEX_SYSTEM_UNLOCK; - return EAGAIN; - } + FUTEX_DESTROY(f); + free(f, M_FUTEX); + return; + } - f = futex_get(args->uaddr, FUTEX_UNLOCKED); - newf = futex_get(args->uaddr2, FUTEX_UNLOCKED); - td->td_retval[0] = futex_wake(f, args->val, newf, - (int)(unsigned long)args->timeout); - futex_put(f); - futex_put(newf); + FUTEXES_UNLOCK; + FUTEX_UNLOCK(f); +} - FUTEX_SYSTEM_UNLOCK; - break; +static int +futex_get0(uint32_t *uaddr, struct futex **newf, uint32_t flags) +{ + struct futex *f, *tmpf; - case LINUX_FUTEX_WAKE_OP: - FUTEX_SYSTEM_LOCK; -#ifdef DEBUG - if (ldebug(sys_futex)) - printf("FUTEX_WAKE_OP: %d: uaddr = %p, op = %d, " - "val = %x, uaddr2 = %p, val3 = %x\n", - td->td_proc->p_pid, args->uaddr, args->op, - args->val, args->uaddr2, args->val3); -#endif - f = futex_get(args->uaddr, FUTEX_UNLOCKED); - f2 = futex_get(args->uaddr2, FUTEX_UNLOCKED); + *newf = tmpf = NULL; - /* - * This function returns positive number as results and - * negative as errors - */ - op_ret = futex_atomic_op(td, args->val3, args->uaddr2); -#ifdef DEBUG - if (ldebug(sys_futex)) - printf("futex_atomic_op ret %d\n", op_ret); -#endif - if (op_ret < 0) { - /* XXX: We don't handle the EFAULT yet. */ - if (op_ret != -EFAULT) { - futex_put(f); - futex_put(f2); - FUTEX_SYSTEM_UNLOCK; - return (-op_ret); +retry: + FUTEXES_LOCK; + LIST_FOREACH(f, &futex_list, f_list) { + if (f->f_uaddr == uaddr) { + if (tmpf != NULL) { + FUTEX_UNLOCK(tmpf); + FUTEX_DESTROY(tmpf); + free(tmpf, M_FUTEX); + } + if (flags & FUTEX_DONTEXISTS) { + FUTEXES_UNLOCK; + return (EINVAL); } - futex_put(f); - futex_put(f2); - - FUTEX_SYSTEM_UNLOCK; - return (EFAULT); - } - - ret = futex_wake(f, args->val, NULL, 0); - futex_put(f); - if (op_ret > 0) { - op_ret = 0; /* - * Linux abuses the address of the timespec parameter - * as the number of retries. + * Increment refcount of the found futex to + * prevent it from deallocation before FUTEX_LOCK() */ - op_ret += futex_wake(f2, - (int)(unsigned long)args->timeout, NULL, 0); - ret += op_ret; - } - futex_put(f2); - td->td_retval[0] = ret; - - FUTEX_SYSTEM_UNLOCK; - break; - - case LINUX_FUTEX_LOCK_PI: - /* not yet implemented */ - return (ENOSYS); + ++f->f_refcount; + FUTEXES_UNLOCK; - case LINUX_FUTEX_UNLOCK_PI: - /* not yet implemented */ - return (ENOSYS); + FUTEX_LOCK(f); + *newf = f; + return (0); + } + } - case LINUX_FUTEX_TRYLOCK_PI: - /* not yet implemented */ - return (ENOSYS); + if (flags & FUTEX_DONTCREATE) { + FUTEXES_UNLOCK; + return (0); + } - case LINUX_FUTEX_REQUEUE: + if (tmpf == NULL) { + FUTEXES_UNLOCK; + tmpf = malloc(sizeof(*tmpf), M_FUTEX, M_WAITOK | M_ZERO); + tmpf->f_uaddr = uaddr; + tmpf->f_refcount = 1; + FUTEX_INIT(tmpf); + TAILQ_INIT(&tmpf->f_waiting_proc); /* - * Glibc does not use this operation since Jun 2004 (2.3.3), - * as it is racy and replaced by FUTEX_CMP_REQUEUE operation. - * Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when - * FUTEX_REQUEUE returned EINVAL. + * Lock the new futex before an insert into the futex_list + * to prevent futex usage by other. */ - em = em_find(td->td_proc, EMUL_DONTLOCK); - if (em->used_requeue == 0) { - printf("linux(%s (%d)) sys_futex: " - "unsupported futex_requeue op\n", - td->td_proc->p_comm, td->td_proc->p_pid); - em->used_requeue = 1; - } - return (EINVAL); - - default: - printf("linux_sys_futex: unknown op %d\n", - args->op); - return (ENOSYS); + FUTEX_LOCK(tmpf); + goto retry; } + + LIST_INSERT_HEAD(&futex_list, tmpf, f_list); + FUTEXES_UNLOCK; + + *newf = tmpf; return (0); } -static struct futex * -futex_get(void *uaddr, int locked) +static int +futex_get(uint32_t *uaddr, struct waiting_proc **wp, struct futex **f, + uint32_t flags) { - struct futex *f; + int error; - if (locked == FUTEX_UNLOCKED) - FUTEX_LOCK; - LIST_FOREACH(f, &futex_list, f_list) { - if (f->f_uaddr == uaddr) { - f->f_refcount++; - if (locked == FUTEX_UNLOCKED) - FUTEX_UNLOCK; - return f; - } + if (flags & FUTEX_CREATE_WP) { + *wp = malloc(sizeof(struct waiting_proc), M_FUTEX_WP, M_WAITOK); + (*wp)->wp_flags = 0; + } + error = futex_get0(uaddr, f, flags); + if (error) { + if (flags & FUTEX_CREATE_WP) + free(*wp, M_FUTEX_WP); + return (error); + } + if (flags & FUTEX_CREATE_WP) { + TAILQ_INSERT_HEAD(&(*f)->f_waiting_proc, *wp, wp_list); + (*wp)->wp_futex = *f; } - f = malloc(sizeof(*f), M_LINUX, M_WAITOK); - f->f_uaddr = uaddr; - f->f_refcount = 1; - TAILQ_INIT(&f->f_waiting_proc); - LIST_INSERT_HEAD(&futex_list, f, f_list); - if (locked == FUTEX_UNLOCKED) - FUTEX_UNLOCK; - - return f; + return (error); } -static void -futex_put(f) - struct futex *f; +static int +futex_sleep(struct futex *f, struct waiting_proc *wp, unsigned long timeout) { - FUTEX_LOCK; - f->f_refcount--; - if (f->f_refcount == 0) { - LIST_REMOVE(f, f_list); - free(f, M_LINUX); + int error; + + FUTEX_ASSERT_LOCKED(f); + error = sx_sleep(wp, &f->f_lck, PCATCH, "futex", timeout); + if (wp->wp_flags & FUTEX_WP_REQUEUED) { + KASSERT(f != wp->wp_futex, ("futex != wp_futex")); + futex_put(f, NULL); + f = wp->wp_futex; + FUTEX_LOCK(f); } - FUTEX_UNLOCK; - return; + futex_put(f, wp); + return (error); } static int -futex_sleep(struct futex *f, struct thread *td, unsigned long timeout) +futex_wake(struct futex *f, int n) { - struct waiting_proc *wp; - int ret; - - wp = malloc(sizeof(*wp), M_LINUX, M_WAITOK); - wp->wp_t = td; - wp->wp_new_futex = NULL; - FUTEX_LOCK; - TAILQ_INSERT_TAIL(&f->f_waiting_proc, wp, wp_list); - FUTEX_UNLOCK; - -#ifdef DEBUG - if (ldebug(sys_futex)) - printf("FUTEX --> %d tlseep timeout = %ld\n", - td->td_proc->p_pid, timeout); -#endif - ret = tsleep(wp, PCATCH | PZERO, "linuxfutex", timeout); -#ifdef DEBUG - if (ldebug(sys_futex)) - printf("FUTEX -> %d tsleep returns %d\n", - td->td_proc->p_pid, ret); -#endif + struct waiting_proc *wp, *wpt; + int count = 0; - FUTEX_LOCK; - TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list); - FUTEX_UNLOCK; - - /* if we got woken up in futex_wake */ - if ((ret == 0) && (wp->wp_new_futex != NULL)) { - /* suspend us on the new futex */ - ret = futex_sleep(wp->wp_new_futex, td, timeout); - /* and release the old one */ - futex_put(wp->wp_new_futex); + FUTEX_ASSERT_LOCKED(f); + TAILQ_FOREACH_SAFE(wp, &f->f_waiting_proc, wp_list, wpt) { + wp->wp_flags |= FUTEX_WP_REMOVED; + TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list); + wakeup_one(wp); + if (++count == n) + break; } - free(wp, M_LINUX); - - return ret; + return (count); } static int -futex_wake(struct futex *f, int n, struct futex *newf, int n2) +futex_requeue(struct futex *f, int n, struct futex *f2, int n2) { - struct waiting_proc *wp; - int count; + struct waiting_proc *wp, *wpt; + int count = 0; - /* - * Linux is very strange it wakes up N threads for - * all operations BUT requeue ones where its N+1 - * mimic this. - */ - count = newf ? 0 : 1; + FUTEX_ASSERT_LOCKED(f); + FUTEX_ASSERT_LOCKED(f2); - FUTEX_LOCK; - TAILQ_FOREACH(wp, &f->f_waiting_proc, wp_list) { - if (count <= n) { + TAILQ_FOREACH_SAFE(wp, &f->f_waiting_proc, wp_list, wpt) { + if (++count <= n) { + wp->wp_flags |= FUTEX_WP_REMOVED; + TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list); wakeup_one(wp); - count++; } else { - if (newf != NULL) { - /* futex_put called after tsleep */ - wp->wp_new_futex = futex_get(newf->f_uaddr, - FUTEX_LOCKED); - wakeup_one(wp); - if (count - n >= n2) - break; - } + wp->wp_flags |= FUTEX_WP_REQUEUED; + /* Move wp to wp_list of f2 futex */ + TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list); + TAILQ_INSERT_HEAD(&f2->f_waiting_proc, wp, wp_list); + + /* + * Thread which sleeps on wp after waking should + * acquire f2 lock, so increment refcount of f2 to + * prevent it from premature deallocation. + */ + wp->wp_futex = f2; + FUTEXES_LOCK; + ++f2->f_refcount; + FUTEXES_UNLOCK; + if (count - n >= n2) + break; } } - FUTEX_UNLOCK; - return count; + return (count); +} + +static int +futex_wait(struct futex *f, struct waiting_proc *wp, struct l_timespec *ts) +{ + struct l_timespec timeout = {0, 0}; + struct timeval tv = {0, 0}; + int timeout_hz; + int error; + + if (ts != NULL) { + error = copyin(ts, &timeout, sizeof(timeout)); + if (error) + return (error); + } + + tv.tv_usec = timeout.tv_sec * 1000000 + timeout.tv_nsec / 1000; + timeout_hz = tvtohz(&tv); + + if (timeout.tv_sec == 0 && timeout.tv_nsec == 0) + timeout_hz = 0; + + /* + * If the user process requests a non null timeout, + * make sure we do not turn it into an infinite + * timeout because timeout_hz gets null. + * + * We use a minimal timeout of 1/hz. Maybe it would + * make sense to just return ETIMEDOUT without sleeping. + */ + if (((timeout.tv_sec != 0) || (timeout.tv_nsec != 0)) && + (timeout_hz == 0)) + timeout_hz = 1; + + error = futex_sleep(f, wp, timeout_hz); + if (error == EWOULDBLOCK) + error = ETIMEDOUT; + + return (error); } static int -futex_atomic_op(struct thread *td, int encoded_op, caddr_t uaddr) +futex_atomic_op(struct thread *td, int encoded_op, uint32_t *uaddr) { int op = (encoded_op >> 28) & 7; int cmp = (encoded_op >> 24) & 15; @@ -536,14 +401,237 @@ futex_atomic_op(struct thread *td, int e } int +linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args) +{ + int op_ret, val, ret, nrwake; + struct linux_emuldata *em; + struct waiting_proc *wp; + struct futex *f, *f2; + int error = 0; + + /* + * Our implementation provides only privates futexes. Most of the apps + * should use private futexes but don't claim so. Therefore we treat + * all futexes as private by clearing the FUTEX_PRIVATE_FLAG. It works + * in most cases (ie. when futexes are not shared on file descriptor + * or between different processes.). + */ + args->op = (args->op & ~LINUX_FUTEX_PRIVATE_FLAG); + + switch (args->op) { + case LINUX_FUTEX_WAIT: + +#ifdef DEBUG + if (ldebug(sys_futex)) + printf(ARGS(sys_futex, "futex_wait val %d uaddr %p"), + args->val, args->uaddr); +#endif + error = futex_get(args->uaddr, &wp, &f, FUTEX_CREATE_WP); + if (error) + return (error); + error = copyin(args->uaddr, &val, sizeof(val)); + if (error) { + futex_put(f, wp); + return (error); + } + if (val != args->val) { +#ifdef DEBUG + if (ldebug(sys_futex)) + printf(ARGS(sys_futex, "futex_wait uaddr %p WHOOPS %d != %d"), + args->uaddr, args->val, val); +#endif + futex_put(f, wp); + return (EWOULDBLOCK); + } + + error = futex_wait(f, wp, args->timeout); + break; + + case LINUX_FUTEX_WAKE: + + /* + * XXX: Linux is able to cope with different addresses + * corresponding to the same mapped memory in the sleeping + * and waker process(es). + */ +#ifdef DEBUG + if (ldebug(sys_futex)) + printf(ARGS(sys_futex, "futex_wake val %d uaddr %p"), + args->val, args->uaddr); +#endif + error = futex_get(args->uaddr, NULL, &f, FUTEX_DONTCREATE); + if (error) + return (error); + if (f == NULL) { + td->td_retval[0] = 0; + return (error);; + } + td->td_retval[0] = futex_wake(f, args->val); + futex_put(f, NULL); + break; + + case LINUX_FUTEX_CMP_REQUEUE: + +#ifdef DEBUG + if (ldebug(sys_futex)) + printf(ARGS(sys_futex, "futex_cmp_requeue uaddr %p " + "val %d val3 %d uaddr2 %p val2 %d"), + args->uaddr, args->val, args->val3, args->uaddr2, + (int)(unsigned long)args->timeout); +#endif + + /* + * Linux allows this, we would not, it is an incorrect + * usage of declared ABI, so return EINVAL. + */ + if (args->uaddr == args->uaddr2) + return (EINVAL); + error = futex_get0(args->uaddr, &f, 0); + if (error) + return (error); + + /* + * To avoid deadlocks return EINVAL if second futex + * exists at this time. Otherwise create the new futex + * and ignore false positive LOR which thus happens. + * + * Glibc fall back to FUTEX_WAKE in case of any error + * returned by FUTEX_CMP_REQUEUE. + */ + error = futex_get0(args->uaddr2, &f2, FUTEX_DONTEXISTS); + if (error) { + futex_put(f, NULL); + return (error); + } + error = copyin(args->uaddr, &val, sizeof(val)); + if (error) { + futex_put(f2, NULL); + futex_put(f, NULL); + return (error); + } + if (val != args->val3) { +#ifdef DEBUG + if (ldebug(sys_futex)) + printf(ARGS(sys_futex, "futex_cmp_requeue WHOOPS" + " VAL %d != UVAL %d"), args->val, val); +#endif + futex_put(f2, NULL); + futex_put(f, NULL); + return (EAGAIN); + } + + nrwake = (int)(unsigned long)args->timeout; + td->td_retval[0] = futex_requeue(f, args->val, f2, nrwake); + futex_put(f2, NULL); + futex_put(f, NULL); + break; + + case LINUX_FUTEX_WAKE_OP: + +#ifdef DEBUG + if (ldebug(sys_futex)) + printf(ARGS(sys_futex, "futex_wake_op " + "uaddr %p op %d val %x uaddr2 %p val3 %x"), + args->uaddr, args->op, args->val, + args->uaddr2, args->val3); +#endif + error = futex_get0(args->uaddr, &f, 0); + if (error) + return (error); + if (args->uaddr != args->uaddr2) + error = futex_get0(args->uaddr2, &f2, 0); + if (error) { + futex_put(f, NULL); + return (error); + } + + /* + * This function returns positive number as results and + * negative as errors + */ + op_ret = futex_atomic_op(td, args->val3, args->uaddr2); + + if (op_ret < 0) { + /* XXX: We don't handle the EFAULT yet. */ + if (op_ret != -EFAULT) { + if (f2 != NULL) + futex_put(f2, NULL); + futex_put(f, NULL); + return (-op_ret); + } + if (f2 != NULL) + futex_put(f2, NULL); + futex_put(f, NULL); + return (EFAULT); + } + + ret = futex_wake(f, args->val); + + if (op_ret > 0) { + op_ret = 0; + nrwake = (int)(unsigned long)args->timeout; + + if (f2 != NULL) + op_ret += futex_wake(f2, nrwake); + else + op_ret += futex_wake(f, nrwake); + ret += op_ret; + + } + if (f2 != NULL) + futex_put(f2, NULL); + futex_put(f, NULL); + td->td_retval[0] = ret; + break; + + case LINUX_FUTEX_LOCK_PI: + /* not yet implemented */ + return (ENOSYS); + + case LINUX_FUTEX_UNLOCK_PI: + /* not yet implemented */ + return (ENOSYS); + + case LINUX_FUTEX_TRYLOCK_PI: + /* not yet implemented */ + return (ENOSYS); + + case LINUX_FUTEX_REQUEUE: + + /* + * Glibc does not use this operation since version 2.3.3, + * as it is racy and replaced by FUTEX_CMP_REQUEUE operation. + * Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when + * FUTEX_REQUEUE returned EINVAL. + */ + em = em_find(td->td_proc, EMUL_DONTLOCK); + if (em->used_requeue == 0) { + printf("linux(%s (%d)) sys_futex: " + "unsupported futex_requeue op\n", + td->td_proc->p_comm, td->td_proc->p_pid); + em->used_requeue = 1; + } + return (EINVAL); + + default: + printf("linux_sys_futex: unknown op %d\n", args->op); + return (ENOSYS); + } + + return (error); +} + +int linux_set_robust_list(struct thread *td, struct linux_set_robust_list_args *args) { struct linux_emuldata *em; -#ifdef DEBUG +#ifdef DEBUG if (ldebug(set_robust_list)) - printf(ARGS(set_robust_list, "")); + printf(ARGS(set_robust_list, "head %p len %d"), + args->head, args->len); #endif + if (args->len != sizeof(struct linux_robust_list_head)) return (EINVAL); @@ -598,16 +686,16 @@ linux_get_robust_list(struct thread *td, } static int -handle_futex_death(void *uaddr, pid_t pid, int pi) +handle_futex_death(struct proc *p, uint32_t *uaddr, int pi) { - int uval, nval, mval; + uint32_t uval, nval, mval; struct futex *f; + int error; retry: if (copyin(uaddr, &uval, 4)) return (EFAULT); - - if ((uval & FUTEX_TID_MASK) == pid) { + if ((uval & FUTEX_TID_MASK) == p->p_pid) { mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED; nval = casuword32(uaddr, uval, mval); @@ -618,8 +706,14 @@ retry: goto retry; if (!pi && (uval & FUTEX_WAITERS)) { - f = futex_get(uaddr, FUTEX_UNLOCKED); - futex_wake(f, 1, NULL, 0); + error = futex_get(uaddr, NULL, &f, + FUTEX_DONTCREATE); + if (error) + return (error); + if (f != NULL) { + futex_wake(f, 1); + futex_put(f, NULL); + } } } @@ -671,10 +765,8 @@ release_futexes(struct proc *p) rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi); if (entry != pending) - if (handle_futex_death((char *)entry + futex_offset, - p->p_pid, pi)) + if (handle_futex_death(p, (uint32_t *)entry + futex_offset, pi)) return; - if (rc) return; @@ -688,6 +780,5 @@ release_futexes(struct proc *p) } if (pending) - handle_futex_death((char *) pending + futex_offset, - p->p_pid, pip); + handle_futex_death(p, (uint32_t *)pending + futex_offset, pip); } Modified: stable/7/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/7/sys/i386/linux/linux_sysvec.c Sun May 31 06:37:47 2009 (r193151) +++ stable/7/sys/i386/linux/linux_sysvec.c Sun May 31 06:58:35 2009 (r193152) @@ -111,7 +111,7 @@ static int linux_szplatform; const char *linux_platform; extern LIST_HEAD(futex_list, futex) futex_list; -extern struct sx futex_sx; +extern struct mtx futex_mtx; static eventhandler_tag linux_exit_tag; static eventhandler_tag linux_schedtail_tag; @@ -1091,7 +1091,7 @@ linux_elf_modevent(module_t mod, int typ mtx_init(&emul_lock, "emuldata lock", NULL, MTX_DEF); sx_init(&emul_shared_lock, "emuldata->shared lock"); LIST_INIT(&futex_list); - sx_init(&futex_sx, "futex protection lock"); + mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit, NULL, 1000); linux_schedtail_tag = EVENTHANDLER_REGISTER(schedtail, linux_schedtail, @@ -1125,7 +1125,7 @@ linux_elf_modevent(module_t mod, int typ linux_device_unregister_handler(*ldhp); mtx_destroy(&emul_lock); sx_destroy(&emul_shared_lock); - sx_destroy(&futex_sx); + mtx_destroy(&futex_mtx); EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag); EVENTHANDLER_DEREGISTER(schedtail, linux_schedtail_tag); EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag); From owner-svn-src-stable-7@FreeBSD.ORG Sun May 31 18:06:13 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38D061065673; Sun, 31 May 2009 18:06:13 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 25E4A8FC18; Sun, 31 May 2009 18:06:13 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4VI6D5t050937; Sun, 31 May 2009 18:06:13 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4VI6Dk9050936; Sun, 31 May 2009 18:06:13 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905311806.n4VI6Dk9050936@svn.freebsd.org> From: Ed Schouten Date: Sun, 31 May 2009 18:06:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193180 - in stable/7/share/man: . man3 man4 man5 man7 man8 man9 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 May 2009 18:06:13 -0000 Author: ed Date: Sun May 31 18:06:12 2009 New Revision: 193180 URL: http://svn.freebsd.org/changeset/base/193180 Log: MFC r190855: Add C++ operators to operator(7) manual page. Submitted by: Christoph Mallon Modified: stable/7/share/man/ (props changed) stable/7/share/man/man3/ (props changed) stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/igb.4 (props changed) stable/7/share/man/man5/ (props changed) stable/7/share/man/man7/ (props changed) stable/7/share/man/man7/operator.7 stable/7/share/man/man8/ (props changed) stable/7/share/man/man9/ (props changed) Modified: stable/7/share/man/man7/operator.7 ============================================================================== --- stable/7/share/man/man7/operator.7 Sun May 31 18:03:06 2009 (r193179) +++ stable/7/share/man/man7/operator.7 Sun May 31 18:06:12 2009 (r193180) @@ -32,19 +32,20 @@ .\" @(#)operator.7 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd January 22, 2003 +.Dd April 8, 2009 .Dt OPERATOR 7 .Os .Sh NAME .Nm operator -.Nd C operator precedence and order of evaluation +.Nd C and C++ operator precedence and order of evaluation .Sh DESCRIPTION .Bd -ragged -offset indent -compact -.Bl -column "= += -= *= /= %= <<= >>= &= ^= |=" +.Bl -column "! ~ ++ -- - (type) * & sizeof new delete" .It Sy "Operator Associativity" .It "-------- -------------" .It "() [] -> . left to right" -.It "! ~ ++ -- - (type) * & sizeof right to left" +.It "! ~ ++ -- - (type) * & sizeof new delete right to left" +.It "->* .* left to right .It "* / % left to right" .It "+ - left to right" .It "<< >> left to right" @@ -56,7 +57,8 @@ .It "&& left to right" .It "|| left to right" .It "?: right to left" -.It "= += -= *= /= %= <<= >>= &= ^= |= right to left" +.It "= += -= *= /= %= <<= >>= &= ^= |= throw right to left" +.It "?: (C++, third operand) right to left" .It ", left to right" .El .Ed From owner-svn-src-stable-7@FreeBSD.ORG Sun May 31 18:14:25 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D0E81065672; Sun, 31 May 2009 18:14:25 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0ADDF8FC0A; Sun, 31 May 2009 18:14:25 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4VIEOlH051321; Sun, 31 May 2009 18:14:24 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4VIEOGV051320; Sun, 31 May 2009 18:14:24 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905311814.n4VIEOGV051320@svn.freebsd.org> From: Ed Schouten Date: Sun, 31 May 2009 18:14:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193182 - stable/7/share/misc X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 May 2009 18:14:25 -0000 Author: ed Date: Sun May 31 18:14:24 2009 New Revision: 193182 URL: http://svn.freebsd.org/changeset/base/193182 Log: Correct the previous commit. Also merge the operator file in share/misc, that is also part of r190855. Modified: stable/7/share/misc/ (props changed) stable/7/share/misc/iso639 (props changed) stable/7/share/misc/operator Modified: stable/7/share/misc/operator ============================================================================== --- stable/7/share/misc/operator Sun May 31 18:06:46 2009 (r193181) +++ stable/7/share/misc/operator Sun May 31 18:14:24 2009 (r193182) @@ -1,19 +1,21 @@ -Operator Associativity ------------------------------------------------------ -() [] -> . left to right -! ~ ++ -- - (type) * & sizeof right to left -* / % left to right -+ - left to right -<< >> left to right -< <= > >= left to right -== != left to right -& left to right -^ left to right -| left to right -&& left to right -|| left to right -?: right to left -= += -= *= /= %= <<= >>= &= ^= |= right to left -, left to right +Operator Associativity +------------------------------------------------------------- +() [] -> . left to right +! ~ ++ -- - (type) * & sizeof new delete right to left +->* .* left to right +* / % left to right ++ - left to right +<< >> left to right +< <= > >= left to right +== != left to right +& left to right +^ left to right +| left to right +&& left to right +|| left to right +?: right to left += += -= *= /= %= <<= >>= &= ^= |= throw right to left +?: (C++, third operand) right to left +, left to right $FreeBSD$ From owner-svn-src-stable-7@FreeBSD.ORG Mon Jun 1 04:44:43 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBDE7106564A; Mon, 1 Jun 2009 04:44:43 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B810C8FC08; Mon, 1 Jun 2009 04:44:43 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n514ih5r064101; Mon, 1 Jun 2009 04:44:43 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n514ihPS064097; Mon, 1 Jun 2009 04:44:43 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200906010444.n514ihPS064097@svn.freebsd.org> From: Dmitry Chagin Date: Mon, 1 Jun 2009 04:44:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193196 - in stable/7/sys: . amd64/linux32 compat/linux contrib/pf dev/ath/ath_hal dev/cxgb i386/linux X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jun 2009 04:44:44 -0000 Author: dchagin Date: Mon Jun 1 04:44:43 2009 New Revision: 193196 URL: http://svn.freebsd.org/changeset/base/193196 Log: MFC r191741: Move extern variable definitions to the header file. Approved by: kib (mentor) Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/linux32/linux32_sysvec.c stable/7/sys/compat/linux/linux_futex.c stable/7/sys/compat/linux/linux_futex.h stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/i386/linux/linux_sysvec.c Modified: stable/7/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/7/sys/amd64/linux32/linux32_sysvec.c Mon Jun 1 02:37:06 2009 (r193195) +++ stable/7/sys/amd64/linux32/linux32_sysvec.c Mon Jun 1 04:44:43 2009 (r193196) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -126,9 +127,6 @@ static void exec_linux_setregs(struct th u_long stack, u_long ps_strings); static void linux32_fixlimit(struct rlimit *rl, int which); -extern LIST_HEAD(futex_list, futex) futex_list; -extern struct mtx futex_mtx; - static eventhandler_tag linux_exit_tag; static eventhandler_tag linux_schedtail_tag; static eventhandler_tag linux_exec_tag; Modified: stable/7/sys/compat/linux/linux_futex.c ============================================================================== --- stable/7/sys/compat/linux/linux_futex.c Mon Jun 1 02:37:06 2009 (r193195) +++ stable/7/sys/compat/linux/linux_futex.c Mon Jun 1 04:44:43 2009 (r193196) @@ -81,7 +81,7 @@ struct futex { TAILQ_HEAD(lf_waiting_proc, waiting_proc) f_waiting_proc; }; -LIST_HEAD(futex_list, futex) futex_list; +struct futex_list futex_list; #define FUTEX_LOCK(f) sx_xlock(&(f)->f_lck) #define FUTEX_UNLOCK(f) sx_xunlock(&(f)->f_lck) Modified: stable/7/sys/compat/linux/linux_futex.h ============================================================================== --- stable/7/sys/compat/linux/linux_futex.h Mon Jun 1 02:37:06 2009 (r193195) +++ stable/7/sys/compat/linux/linux_futex.h Mon Jun 1 04:44:43 2009 (r193196) @@ -36,6 +36,9 @@ #ifndef _LINUX_FUTEX_H #define _LINUX_FUTEX_H +extern LIST_HEAD(futex_list, futex) futex_list; +extern struct mtx futex_mtx; + #define LINUX_FUTEX_WAIT 0 #define LINUX_FUTEX_WAKE 1 #define LINUX_FUTEX_FD 2 /* unused */ Modified: stable/7/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/7/sys/i386/linux/linux_sysvec.c Mon Jun 1 02:37:06 2009 (r193195) +++ stable/7/sys/i386/linux/linux_sysvec.c Mon Jun 1 04:44:43 2009 (r193196) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -110,9 +111,6 @@ static register_t *linux_copyout_strings static int linux_szplatform; const char *linux_platform; -extern LIST_HEAD(futex_list, futex) futex_list; -extern struct mtx futex_mtx; - static eventhandler_tag linux_exit_tag; static eventhandler_tag linux_schedtail_tag; static eventhandler_tag linux_exec_tag; From owner-svn-src-stable-7@FreeBSD.ORG Mon Jun 1 05:48:30 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A7F61065670; Mon, 1 Jun 2009 05:48:30 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 787168FC30; Mon, 1 Jun 2009 05:48:30 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n515mUFn065635; Mon, 1 Jun 2009 05:48:30 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n515mUF3065634; Mon, 1 Jun 2009 05:48:30 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200906010548.n515mUF3065634@svn.freebsd.org> From: Maxim Konovalov Date: Mon, 1 Jun 2009 05:48:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193200 - stable/7/sbin/geom/class/journal X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jun 2009 05:48:30 -0000 Author: maxim Date: Mon Jun 1 05:48:30 2009 New Revision: 193200 URL: http://svn.freebsd.org/changeset/base/193200 Log: MFC r192747: fix typo in the example. Modified: stable/7/sbin/geom/class/journal/gjournal.8 Modified: stable/7/sbin/geom/class/journal/gjournal.8 ============================================================================== --- stable/7/sbin/geom/class/journal/gjournal.8 Mon Jun 1 05:37:13 2009 (r193199) +++ stable/7/sbin/geom/class/journal/gjournal.8 Mon Jun 1 05:48:30 2009 (r193200) @@ -219,7 +219,7 @@ allows this (i.e., if the last sector is .Bd -literal -offset indent umount /dev/da0s1d gjournal label da0s1d da0s1e && \e - tunefs -J enable -n disable da01sd.journal && \e + tunefs -J enable -n disable da0s1d.journal && \e mount -o async /dev/da0s1d.journal /mnt || \e mount /dev/da0s1d /mnt .Ed From owner-svn-src-stable-7@FreeBSD.ORG Mon Jun 1 10:49:08 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C885106564A; Mon, 1 Jun 2009 10:49:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7890A8FC21; Mon, 1 Jun 2009 10:49:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n51An8nx076618; Mon, 1 Jun 2009 10:49:08 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n51An8ew076617; Mon, 1 Jun 2009 10:49:08 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906011049.n51An8ew076617@svn.freebsd.org> From: Xin LI Date: Mon, 1 Jun 2009 10:49:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193220 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/bce dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jun 2009 10:49:09 -0000 Author: delphij Date: Mon Jun 1 10:49:08 2009 New Revision: 193220 URL: http://svn.freebsd.org/changeset/base/193220 Log: DMA synchronization fixes: - In bce_rx_intr(), use BUS_DMASYNC_POSTREAD instead of BUS_DMASYNC_POSTWRITE, as we want to "read" from the rx page chain pages. - Document why we need to do PREWRITE after we have updated the rx page chain pages. - In bce_intr(), use BUS_DMASYNC_POSTREAD and BUS_DMASYNC_PREREAD when before and after CPU "reading" the status block. - Adjust some nearby style mismatches/etc. Pointed out by: yongari Approved by: davidch (no objection) but bugs are mine :) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/bce/if_bce.c stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/dev/bce/if_bce.c ============================================================================== --- stable/7/sys/dev/bce/if_bce.c Mon Jun 1 10:41:38 2009 (r193219) +++ stable/7/sys/dev/bce/if_bce.c Mon Jun 1 10:49:08 2009 (r193220) @@ -4884,7 +4884,7 @@ bce_get_rx_buf(struct bce_softc *sc, str KASSERT(nsegs == 1, ("%s(): Too many segments returned (%d)!", __FUNCTION__, nsegs)); - /* ToDo: Do we need bus_dmamap_sync(,,BUS_DMASYNC_PREWRITE) here? */ + /* ToDo: Do we need bus_dmamap_sync(,,BUS_DMASYNC_PREREAD) here? */ /* Setup the rx_bd for the segment. */ rxbd = &sc->rx_bd_chain[RX_PAGE(*chain_prod)][RX_IDX(*chain_prod)]; @@ -4993,7 +4993,7 @@ bce_get_pg_buf(struct bce_softc *sc, str goto bce_get_pg_buf_exit; } - /* ToDo: Do we need bus_dmamap_sync(,,BUS_DMASYNC_PREWRITE) here? */ + /* ToDo: Do we need bus_dmamap_sync(,,BUS_DMASYNC_PREREAD) here? */ /* * The page chain uses the same rx_bd data structure @@ -5270,13 +5270,11 @@ bce_init_rx_chain(struct bce_softc *sc) rxbd->rx_bd_haddr_lo = htole32(BCE_ADDR_LO(sc->rx_bd_chain_paddr[j])); } -/* Fill up the RX chain. */ + /* Fill up the RX chain. */ bce_fill_rx_chain(sc); for (i = 0; i < RX_PAGES; i++) { - bus_dmamap_sync( - sc->rx_bd_chain_tag, - sc->rx_bd_chain_map[i], + bus_dmamap_sync(sc->rx_bd_chain_tag, sc->rx_bd_chain_map[i], BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); } @@ -5447,9 +5445,7 @@ bce_init_pg_chain(struct bce_softc *sc) bce_fill_pg_chain(sc); for (i = 0; i < PG_PAGES; i++) { - bus_dmamap_sync( - sc->pg_bd_chain_tag, - sc->pg_bd_chain_map[i], + bus_dmamap_sync(sc->pg_bd_chain_tag, sc->pg_bd_chain_map[i], BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); } @@ -5732,13 +5728,13 @@ bce_rx_intr(struct bce_softc *sc) /* Prepare the RX chain pages to be accessed by the host CPU. */ for (int i = 0; i < RX_PAGES; i++) bus_dmamap_sync(sc->rx_bd_chain_tag, - sc->rx_bd_chain_map[i], BUS_DMASYNC_POSTWRITE); + sc->rx_bd_chain_map[i], BUS_DMASYNC_POSTREAD); #ifdef ZERO_COPY_SOCKETS /* Prepare the page chain pages to be accessed by the host CPU. */ for (int i = 0; i < PG_PAGES; i++) bus_dmamap_sync(sc->pg_bd_chain_tag, - sc->pg_bd_chain_map[i], BUS_DMASYNC_POSTWRITE); + sc->pg_bd_chain_map[i], BUS_DMASYNC_POSTREAD); #endif /* Get the hardware's view of the RX consumer index. */ @@ -5765,9 +5761,8 @@ bce_rx_intr(struct bce_softc *sc) sw_rx_cons_idx = RX_CHAIN_IDX(sw_rx_cons); /* Unmap the mbuf from DMA space. */ - bus_dmamap_sync(sc->rx_mbuf_tag, - sc->rx_mbuf_map[sw_rx_cons_idx], - BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->rx_mbuf_tag, sc->rx_mbuf_map[sw_rx_cons_idx], + BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->rx_mbuf_tag, sc->rx_mbuf_map[sw_rx_cons_idx]); @@ -6011,6 +6006,7 @@ bce_rx_int_next_rx: sc->rx_cons = sw_rx_cons; bce_fill_rx_chain(sc); + /* Prepare the page chain pages to be accessed by the NIC. */ for (int i = 0; i < RX_PAGES; i++) bus_dmamap_sync(sc->rx_bd_chain_tag, sc->rx_bd_chain_map[i], BUS_DMASYNC_PREWRITE); @@ -7023,8 +7019,9 @@ bce_intr(void *xsc) DBRUN(sc->interrupts_generated++); + /* Synchnorize before we read from interface's status block */ bus_dmamap_sync(sc->status_tag, sc->status_map, - BUS_DMASYNC_POSTWRITE); + BUS_DMASYNC_POSTREAD); /* * If the hardware status block index @@ -7112,7 +7109,7 @@ bce_intr(void *xsc) } bus_dmamap_sync(sc->status_tag, sc->status_map, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD); /* Re-enable interrupts. */ bce_enable_intr(sc, 0); From owner-svn-src-stable-7@FreeBSD.ORG Mon Jun 1 16:15:10 2009 Return-Path: Delivered-To: svn-src-stable-7@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA6921065688; Mon, 1 Jun 2009 16:15:10 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from mail-gw0.york.ac.uk (mail-gw0.york.ac.uk [144.32.128.245]) by mx1.freebsd.org (Postfix) with ESMTP id 477288FC26; Mon, 1 Jun 2009 16:15:10 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from mail-gw7.york.ac.uk (mail-gw7.york.ac.uk [144.32.129.30]) by mail-gw0.york.ac.uk (8.13.6/8.13.6) with ESMTP id n51FiMUX029668; Mon, 1 Jun 2009 16:44:22 +0100 (BST) Received: from buffy-128.york.ac.uk ([144.32.128.160] helo=buffy.york.ac.uk) by mail-gw7.york.ac.uk with esmtps (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1MB9gU-0007GV-7g; Mon, 01 Jun 2009 16:44:22 +0100 Received: from buffy.york.ac.uk (localhost [127.0.0.1]) by buffy.york.ac.uk (8.14.3/8.14.3) with ESMTP id n51FiLNX073040; Mon, 1 Jun 2009 16:44:21 +0100 (BST) (envelope-from gavin@FreeBSD.org) Received: (from ga9@localhost) by buffy.york.ac.uk (8.14.3/8.14.3/Submit) id n51FiL2k073038; Mon, 1 Jun 2009 16:44:21 +0100 (BST) (envelope-from gavin@FreeBSD.org) X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson To: Xin LI In-Reply-To: <200906011049.n51An8ew076617@svn.freebsd.org> References: <200906011049.n51An8ew076617@svn.freebsd.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Mon, 01 Jun 2009 16:44:21 +0100 Message-Id: <1243871061.57113.3.camel@buffy.york.ac.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.22.2 FreeBSD GNOME Team Port X-York-MailScanner: Found to be clean X-York-MailScanner-From: gavin@freebsd.org Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-7@FreeBSD.org Subject: Re: svn commit: r193220 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/bce dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jun 2009 16:15:11 -0000 On Mon, 2009-06-01 at 10:49 +0000, Xin LI wrote: > Author: delphij > Date: Mon Jun 1 10:49:08 2009 > New Revision: 193220 > URL: http://svn.freebsd.org/changeset/base/193220 > > Log: > DMA synchronization fixes: > [snip] > - In bce_intr(), use BUS_DMASYNC_POSTREAD and > BUS_DMASYNC_PREREAD when before and after CPU "reading" > the status block. > - Adjust some nearby style mismatches/etc. Is it possible that these changes will fix the issues reported with bce(4) on amd64? For example, amd64/134788? Thanks, Gavin From owner-svn-src-stable-7@FreeBSD.ORG Mon Jun 1 22:09:42 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76CE51065676; Mon, 1 Jun 2009 22:09:42 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 643058FC08; Mon, 1 Jun 2009 22:09:42 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n51M9gDG094162; Mon, 1 Jun 2009 22:09:42 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n51M9gTU094161; Mon, 1 Jun 2009 22:09:42 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906012209.n51M9gTU094161@svn.freebsd.org> From: Kip Macy Date: Mon, 1 Jun 2009 22:09:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193282 - stable/7/sys/libkern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jun 2009 22:09:43 -0000 Author: kmacy Date: Mon Jun 1 22:09:42 2009 New Revision: 193282 URL: http://svn.freebsd.org/changeset/base/193282 Log: memmove is defined in support.S on arm - don't compile in Modified: stable/7/sys/libkern/memmove.c Modified: stable/7/sys/libkern/memmove.c ============================================================================== --- stable/7/sys/libkern/memmove.c Mon Jun 1 22:05:08 2009 (r193281) +++ stable/7/sys/libkern/memmove.c Mon Jun 1 22:09:42 2009 (r193282) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include +#if !defined(__arm__) void * memmove(void *dest, const void *src, size_t n) { @@ -36,3 +37,4 @@ memmove(void *dest, const void *src, siz bcopy(src, dest, n); return (dest); } +#endif From owner-svn-src-stable-7@FreeBSD.ORG Mon Jun 1 23:27:39 2009 Return-Path: Delivered-To: svn-src-stable-7@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B788D106566C; Mon, 1 Jun 2009 23:27:39 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from sippysoft.com (gk1.360sip.com [72.236.70.240]) by mx1.freebsd.org (Postfix) with ESMTP id 7A63D8FC2B; Mon, 1 Jun 2009 23:27:39 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from [192.168.1.38] (S0106001372fd1e07.vs.shawcable.net [70.71.171.106]) (authenticated bits=0) by sippysoft.com (8.14.3/8.14.3) with ESMTP id n51N0Gwg049130 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Jun 2009 16:00:17 -0700 (PDT) (envelope-from sobomax@FreeBSD.org) Message-ID: <4A245D67.8020908@FreeBSD.org> Date: Mon, 01 Jun 2009 15:59:51 -0700 From: Maxim Sobolev Organization: Sippy Software, Inc. User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Attilio Rao References: <200905302327.n4UNRmxV022733@svn.freebsd.org> In-Reply-To: <200905302327.n4UNRmxV022733@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-7@FreeBSD.org Subject: Re: svn: stable/7: lib/libc/i386/stdlib lib/libc/i386/string lib/libc_r/arch/amd64 lib/libc_r/arch/i386 lib/libstand/i386 lib/msun/amd64 lib/msun/i387 lib/msun/ia64 tools/KSE/ksetes... X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jun 2009 23:27:40 -0000 Attilio Rao wrote: > Author: attilio > Date: Sat May 30 23:27:48 2009 > New Revision: 193134 > URL: http://svn.freebsd.org/changeset/base/193134 > > Log: > MFC r192760: > Use the END() macro appropriately in order to improve debugging for > tools (Valgrind mainly). > > Modified: stable/7/lib/libc/i386/stdlib/ldiv.S > ============================================================================== > --- stable/7/lib/libc/i386/stdlib/ldiv.S Sat May 30 23:01:27 2009 (r193133) > +++ stable/7/lib/libc/i386/stdlib/ldiv.S Sat May 30 23:27:48 2009 (r193134) > @@ -40,3 +40,4 @@ ENTRY(ldiv) > movl %edx,8(%esp) > ret > END(ldiv) > +END(ldiv) > > Modified: stable/7/lib/libc/i386/string/wcscmp.S > ============================================================================== > --- stable/7/lib/libc/i386/string/wcscmp.S Sat May 30 23:01:27 2009 (r193133) > +++ stable/7/lib/libc/i386/string/wcscmp.S Sat May 30 23:27:48 2009 (r193134) > @@ -78,3 +78,4 @@ no0: subl (%esi),%eax > popl %edi > ret > END(wcscmp) > +END(wcscmp) Are those double-ENDs intentional? -Maxim From owner-svn-src-stable-7@FreeBSD.ORG Mon Jun 1 23:53:15 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4D3A10656F9; Mon, 1 Jun 2009 23:53:15 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B20508FC08; Mon, 1 Jun 2009 23:53:15 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n51NrFCG096365; Mon, 1 Jun 2009 23:53:15 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n51NrFAd096363; Mon, 1 Jun 2009 23:53:15 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200906012353.n51NrFAd096363@svn.freebsd.org> From: Attilio Rao Date: Mon, 1 Jun 2009 23:53:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193286 - in stable/7/lib/libc/i386: stdlib string X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jun 2009 23:53:16 -0000 Author: attilio Date: Mon Jun 1 23:53:15 2009 New Revision: 193286 URL: http://svn.freebsd.org/changeset/base/193286 Log: Remove double-inserted END() macros. Reported by: sobomax Modified: stable/7/lib/libc/i386/stdlib/ldiv.S stable/7/lib/libc/i386/string/wcscmp.S Modified: stable/7/lib/libc/i386/stdlib/ldiv.S ============================================================================== --- stable/7/lib/libc/i386/stdlib/ldiv.S Mon Jun 1 22:47:59 2009 (r193285) +++ stable/7/lib/libc/i386/stdlib/ldiv.S Mon Jun 1 23:53:15 2009 (r193286) @@ -40,4 +40,3 @@ ENTRY(ldiv) movl %edx,8(%esp) ret END(ldiv) -END(ldiv) Modified: stable/7/lib/libc/i386/string/wcscmp.S ============================================================================== --- stable/7/lib/libc/i386/string/wcscmp.S Mon Jun 1 22:47:59 2009 (r193285) +++ stable/7/lib/libc/i386/string/wcscmp.S Mon Jun 1 23:53:15 2009 (r193286) @@ -78,4 +78,3 @@ no0: subl (%esi),%eax popl %edi ret END(wcscmp) -END(wcscmp) From owner-svn-src-stable-7@FreeBSD.ORG Tue Jun 2 00:13:48 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DC0A1065670; Tue, 2 Jun 2009 00:13:48 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-fx0-f163.google.com (mail-fx0-f163.google.com [209.85.220.163]) by mx1.freebsd.org (Postfix) with ESMTP id 759C68FC16; Tue, 2 Jun 2009 00:13:46 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by fxm7 with SMTP id 7so1445219fxm.43 for ; Mon, 01 Jun 2009 17:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=2ZCYm54BQ0CMWCbDy+lmrFuny2kpuK4S5KxWHEok81M=; b=JTtbhU0E6k1tyxUfC4oNQXsZndU1tR7+idywPm78lloyktgvDAJqFceAhdod3/koZ2 pKuihvD/aOnA6gLgBHNpmZmRTjMO245h9Ajs1lmsr4MYkLDNNCtBoO4rwlwCCMb6m6nf AQFMHgp7RjQV5hqwO9pVXuQNCttiS2GZaKIPw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=oYfvuGvQTI4oCuPYozIxkax3jqX53rXpjc5ESftT2y6LvmUVLvaee5XSJ0y8HAh7Ro cWO0kSDlHenQBs20qJ83puKsmxlWxmrWDGa1R/MrhxgbdR6F21rg070eswPlUIVK3fKw GvIQrmRE4gJyu0H9vW7gLTKNb0dmhGlV9mRO0= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.223.123.129 with SMTP id p1mr3492894far.29.1243900272538; Mon, 01 Jun 2009 16:51:12 -0700 (PDT) In-Reply-To: <4A245D67.8020908@FreeBSD.org> References: <200905302327.n4UNRmxV022733@svn.freebsd.org> <4A245D67.8020908@FreeBSD.org> Date: Tue, 2 Jun 2009 01:51:12 +0200 X-Google-Sender-Auth: 0a3c555864d2268e Message-ID: <3bbf2fe10906011651qdce77a2ya4ac09922308217d@mail.gmail.com> From: Attilio Rao To: Maxim Sobolev Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn: stable/7: lib/libc/i386/stdlib lib/libc/i386/string lib/libc_r/arch/amd64 lib/libc_r/arch/i386 lib/libstand/i386 lib/msun/amd64 lib/msun/i387 lib/msun/ia64 tools/KSE/ksetes... X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2009 00:13:48 -0000 2009/6/2 Maxim Sobolev : > Attilio Rao wrote: >> >> Author: attilio >> Date: Sat May 30 23:27:48 2009 >> New Revision: 193134 >> URL: http://svn.freebsd.org/changeset/base/193134 >> >> Log: >> MFC r192760: >> Use the END() macro appropriately in order to improve debugging for >> tools (Valgrind mainly). >> >> Modified: stable/7/lib/libc/i386/stdlib/ldiv.S >> >> ============================================================================== >> --- stable/7/lib/libc/i386/stdlib/ldiv.S Sat May 30 23:01:27 2009 >> (r193133) >> +++ stable/7/lib/libc/i386/stdlib/ldiv.S Sat May 30 23:27:48 2009 >> (r193134) >> @@ -40,3 +40,4 @@ ENTRY(ldiv) >> movl %edx,8(%esp) >> ret >> END(ldiv) >> +END(ldiv) >> >> Modified: stable/7/lib/libc/i386/string/wcscmp.S >> >> ============================================================================== >> --- stable/7/lib/libc/i386/string/wcscmp.S Sat May 30 23:01:27 2009 >> (r193133) >> +++ stable/7/lib/libc/i386/string/wcscmp.S Sat May 30 23:27:48 2009 >> (r193134) >> @@ -78,3 +78,4 @@ no0: subl (%esi),%eax >> popl %edi >> ret >> END(wcscmp) >> +END(wcscmp) > > Are those double-ENDs intentional? No, thanks for catching them. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-stable-7@FreeBSD.ORG Tue Jun 2 04:44:38 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 747491065674; Tue, 2 Jun 2009 04:44:38 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 614548FC14; Tue, 2 Jun 2009 04:44:38 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n524iceG002691; Tue, 2 Jun 2009 04:44:38 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n524icjH002690; Tue, 2 Jun 2009 04:44:38 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200906020444.n524icjH002690@svn.freebsd.org> From: Dmitry Chagin Date: Tue, 2 Jun 2009 04:44:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193295 - in stable/7/sys: . compat/linux contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2009 04:44:39 -0000 Author: dchagin Date: Tue Jun 2 04:44:38 2009 New Revision: 193295 URL: http://svn.freebsd.org/changeset/base/193295 Log: MFC r191742,r191871: Linux socketpair() call expects explicit specified protocol for AF_LOCAL domain unlike FreeBSD which expects 0 in this case. Return EAFNOSUPPORT in case when the incorrect domain argument is specified. Return EPROTONOSUPPORT instead of passing values that are not 0 to the BSD layer. Approved by: kib (mentor) Modified: stable/7/sys/ (props changed) stable/7/sys/compat/linux/linux_socket.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/compat/linux/linux_socket.c ============================================================================== --- stable/7/sys/compat/linux/linux_socket.c Tue Jun 2 04:35:44 2009 (r193294) +++ stable/7/sys/compat/linux/linux_socket.c Tue Jun 2 04:44:38 2009 (r193295) @@ -812,11 +812,21 @@ linux_socketpair(struct thread *td, stru } */ bsd_args; bsd_args.domain = linux_to_bsd_domain(args->domain); - if (bsd_args.domain == -1) - return (EINVAL); + if (bsd_args.domain != PF_LOCAL) + return (EAFNOSUPPORT); bsd_args.type = args->type; - bsd_args.protocol = args->protocol; + if (args->protocol != 0 && args->protocol != PF_UNIX) + + /* + * Use of PF_UNIX as protocol argument is not right, + * but Linux does it. + * Do not map PF_UNIX as its Linux value is identical + * to FreeBSD one. + */ + return (EPROTONOSUPPORT); + else + bsd_args.protocol = 0; bsd_args.rsv = (int *)PTRIN(args->rsv); return (socketpair(td, &bsd_args)); } From owner-svn-src-stable-7@FreeBSD.ORG Tue Jun 2 04:47:28 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F0161065676; Tue, 2 Jun 2009 04:47:28 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C4CE8FC14; Tue, 2 Jun 2009 04:47:28 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n524lSnb002834; Tue, 2 Jun 2009 04:47:28 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n524lSau002833; Tue, 2 Jun 2009 04:47:28 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200906020447.n524lSau002833@svn.freebsd.org> From: Dmitry Chagin Date: Tue, 2 Jun 2009 04:47:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193297 - in stable/7/sys: . compat/linux contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2009 04:47:29 -0000 Author: dchagin Date: Tue Jun 2 04:47:28 2009 New Revision: 193297 URL: http://svn.freebsd.org/changeset/base/193297 Log: MFC r191875: Return EAFNOSUPPORT instead of EINVAL in case when the incorrect or unsupported domain argument to linux_socket() is specified. Approved by: kib (mentor) Modified: stable/7/sys/ (props changed) stable/7/sys/compat/linux/linux_socket.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/compat/linux/linux_socket.c ============================================================================== --- stable/7/sys/compat/linux/linux_socket.c Tue Jun 2 04:45:56 2009 (r193296) +++ stable/7/sys/compat/linux/linux_socket.c Tue Jun 2 04:47:28 2009 (r193297) @@ -556,7 +556,7 @@ linux_socket(struct thread *td, struct l bsd_args.type = args->type; bsd_args.domain = linux_to_bsd_domain(args->domain); if (bsd_args.domain == -1) - return (EINVAL); + return (EAFNOSUPPORT); retval_socket = socket(td, &bsd_args); if (bsd_args.type == SOCK_RAW From owner-svn-src-stable-7@FreeBSD.ORG Tue Jun 2 09:25:57 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05B2B1065696; Tue, 2 Jun 2009 09:25:57 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E6DB38FC27; Tue, 2 Jun 2009 09:25:56 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n529Punm008529; Tue, 2 Jun 2009 09:25:56 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n529PuA5008528; Tue, 2 Jun 2009 09:25:56 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200906020925.n529PuA5008528@svn.freebsd.org> From: Brian Somers Date: Tue, 2 Jun 2009 09:25:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193304 - in stable/7/share/examples: . ppp X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2009 09:25:57 -0000 Author: brian Date: Tue Jun 2 09:25:56 2009 New Revision: 193304 URL: http://svn.freebsd.org/changeset/base/193304 Log: MFC: Mention the danger of running programs using ``!''. PR: 112481 Modified: stable/7/share/examples/ (props changed) stable/7/share/examples/ppp/ppp.linkup.sample Modified: stable/7/share/examples/ppp/ppp.linkup.sample ============================================================================== --- stable/7/share/examples/ppp/ppp.linkup.sample Tue Jun 2 08:02:27 2009 (r193303) +++ stable/7/share/examples/ppp/ppp.linkup.sample Tue Jun 2 09:25:56 2009 (r193304) @@ -30,11 +30,16 @@ MYADDR: 192.244.176.32: add 192.244.176.0 0 HISADDR -#You may want to execute a script after connecting. This script can do +# You may want to execute a script after connecting. This script can do # nice things such as kick off "sendmail -q", "popclient my.isp" and # "slurp -d news". It can be passed MYADDR, HISADDR and INTERFACE # as arguments too - useful for informing a DNS of your assigned IP. # +# NOTE: It's vital that you use ``!bg'' rather than ``!'' if the program +# you're running will take some time or will require network +# connectivity. Using ``!'' will delay ppp 'till the completion +# of the program being run! +# # You may also want some sound effects.... # pmdemand: From owner-svn-src-stable-7@FreeBSD.ORG Tue Jun 2 12:06:12 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FC421065887; Tue, 2 Jun 2009 12:06:12 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: from zibbi.meraka.csir.co.za (zibbi.meraka.csir.co.za [IPv6:2001:4200:7000:2::1]) by mx1.freebsd.org (Postfix) with ESMTP id C0A978FC26; Tue, 2 Jun 2009 12:06:11 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: by zibbi.meraka.csir.co.za (Postfix, from userid 3973) id 385C633C6A; Tue, 2 Jun 2009 14:06:08 +0200 (SAST) Date: Tue, 2 Jun 2009 14:06:08 +0200 From: John Hay To: src-committers@freebsd.org Message-ID: <20090602120608.GA98052@zibbi.meraka.csir.co.za> References: <200906012209.n51M9gTU094161@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200906012209.n51M9gTU094161@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn2cvs down? was: svn commit: r193282 - stable/7/sys/libkern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2009 12:06:16 -0000 Hi Guys, Is there something wrong with the svn to cvs gateway? At least this commit has not pitched on the cvs side. Who should one contact about it? John -- John Hay -- John.Hay@meraka.csir.co.za / jhay@FreeBSD.org On Mon, Jun 01, 2009 at 10:09:42PM +0000, Kip Macy wrote: > Author: kmacy > Date: Mon Jun 1 22:09:42 2009 > New Revision: 193282 > URL: http://svn.freebsd.org/changeset/base/193282 > > Log: > memmove is defined in support.S on arm - don't compile in > > Modified: > stable/7/sys/libkern/memmove.c > > Modified: stable/7/sys/libkern/memmove.c > ============================================================================== > --- stable/7/sys/libkern/memmove.c Mon Jun 1 22:05:08 2009 (r193281) > +++ stable/7/sys/libkern/memmove.c Mon Jun 1 22:09:42 2009 (r193282) > @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); > > #include > > +#if !defined(__arm__) > void * > memmove(void *dest, const void *src, size_t n) > { > @@ -36,3 +37,4 @@ memmove(void *dest, const void *src, siz > bcopy(src, dest, n); > return (dest); > } > +#endif From owner-svn-src-stable-7@FreeBSD.ORG Tue Jun 2 22:01:47 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6647410656A8; Tue, 2 Jun 2009 22:01:47 +0000 (UTC) (envelope-from peter@wemm.org) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.30]) by mx1.freebsd.org (Postfix) with ESMTP id E35818FC08; Tue, 2 Jun 2009 22:01:46 +0000 (UTC) (envelope-from peter@wemm.org) Received: by yw-out-2324.google.com with SMTP id 9so4501003ywe.13 for ; Tue, 02 Jun 2009 15:01:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.251.6 with SMTP id y6mr331382anh.44.1243978794236; Tue, 02 Jun 2009 14:39:54 -0700 (PDT) In-Reply-To: <20090602120608.GA98052@zibbi.meraka.csir.co.za> References: <200906012209.n51M9gTU094161@svn.freebsd.org> <20090602120608.GA98052@zibbi.meraka.csir.co.za> Date: Tue, 2 Jun 2009 14:39:54 -0700 Message-ID: From: Peter Wemm To: John Hay Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn2cvs down? was: svn commit: r193282 - stable/7/sys/libkern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2009 22:01:48 -0000 On Tue, Jun 2, 2009 at 5:06 AM, John Hay wrote: > Hi Guys, > > Is there something wrong with the svn to cvs gateway? At least this > commit has not pitched on the cvs side. Who should one contact about > it? > > John > -- > John Hay -- John.Hay@meraka.csir.co.za / jhay@FreeBSD.org > > On Mon, Jun 01, 2009 at 10:09:42PM +0000, Kip Macy wrote: >> Author: kmacy >> Date: Mon Jun =A01 22:09:42 2009 >> New Revision: 193282 >> URL: http://svn.freebsd.org/changeset/base/193282 >> >> Log: >> =A0 memmove is defined in support.S on arm - don't compile in >> >> Modified: >> =A0 stable/7/sys/libkern/memmove.c >> >> Modified: stable/7/sys/libkern/memmove.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- stable/7/sys/libkern/memmove.c =A0 =A0Mon Jun =A01 22:05:08 2009 =A0= =A0 =A0 =A0(r193281) >> +++ stable/7/sys/libkern/memmove.c =A0 =A0Mon Jun =A01 22:09:42 2009 =A0= =A0 =A0 =A0(r193282) >> @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); >> >> =A0#include >> >> +#if !defined(__arm__) >> =A0void * >> =A0memmove(void *dest, const void *src, size_t n) >> =A0{ >> @@ -36,3 +37,4 @@ memmove(void *dest, const void *src, siz >> =A0 =A0 =A0 bcopy(src, dest, n); >> =A0 =A0 =A0 return (dest); >> =A0} >> +#endif > > It should be fixed now. I fixed another problem with a previously-missed revision as well. --=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell From owner-svn-src-stable-7@FreeBSD.ORG Tue Jun 2 23:30:03 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B4A510656F4; Tue, 2 Jun 2009 23:30:03 +0000 (UTC) (envelope-from davidch@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD7408FC1F; Tue, 2 Jun 2009 23:30:02 +0000 (UTC) (envelope-from davidch@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n52NU2sg031572; Tue, 2 Jun 2009 23:30:02 GMT (envelope-from davidch@svn.freebsd.org) Received: (from davidch@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n52NU2Qe031570; Tue, 2 Jun 2009 23:30:02 GMT (envelope-from davidch@svn.freebsd.org) Message-Id: <200906022330.n52NU2Qe031570@svn.freebsd.org> From: David Christensen Date: Tue, 2 Jun 2009 23:30:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193358 - stable/7/sys/dev/mii X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2009 23:30:06 -0000 Author: davidch Date: Tue Jun 2 23:30:02 2009 New Revision: 193358 URL: http://svn.freebsd.org/changeset/base/193358 Log: - MFC BCM5709 PHY code to fix fix ukphy attachment and PHY write timeout errors. Modified: stable/7/sys/dev/mii/brgphy.c stable/7/sys/dev/mii/miidevs Modified: stable/7/sys/dev/mii/brgphy.c ============================================================================== --- stable/7/sys/dev/mii/brgphy.c Tue Jun 2 22:52:58 2009 (r193357) +++ stable/7/sys/dev/mii/brgphy.c Tue Jun 2 23:30:02 2009 (r193358) @@ -74,7 +74,7 @@ struct brgphy_softc { int serdes_flags; /* Keeps track of the serdes type used */ #define BRGPHY_5706S 0x0001 #define BRGPHY_5708S 0x0002 - int bce_phy_flags; /* PHY flags transferred from the MAC driver */ + int bce_phy_flags; /* PHY flags transferred from the MAC driver */ }; static device_method_t brgphy_methods[] = { @@ -131,7 +131,9 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM_ALT1, BCM5755), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5787), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5708S), + MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709CAX), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5722), + MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709C), MII_PHY_DESC(BROADCOM2, BCM5906), MII_PHY_END }; @@ -243,6 +245,7 @@ brgphy_attach(device_t dev) brgphy_reset(sc); + /* Read the PHY's capabilities. */ sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; if (sc->mii_capabilities & BMSR_EXTSTAT) sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); @@ -279,7 +282,7 @@ brgphy_attach(device_t dev) ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, sc->mii_inst), BRGPHY_S1000 | BRGPHY_BMCR_FDX); printf("1000baseSX-FDX, "); - /* 2.5G support is a software enabled feature on the 5708S */ + /* 2.5G support is a software enabled feature on the 5708S and 5709S. */ if (bce_sc && (bce_sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG)) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_2500_SX, IFM_FDX, sc->mii_inst), 0); printf("2500baseSX-FDX, "); @@ -426,6 +429,7 @@ brgphy_setmedia(struct mii_softc *sc, in struct brgphy_softc *bsc = (struct brgphy_softc *)sc; int bmcr = 0, gig; + /* Calculate the value for the BMCR register. */ switch (IFM_SUBTYPE(media)) { case IFM_2500_SX: break; @@ -441,6 +445,8 @@ brgphy_setmedia(struct mii_softc *sc, in bmcr = BRGPHY_S10; break; } + + /* Calculate duplex settings for 1000BasetT/1000BaseX. */ if ((media & IFM_GMASK) == IFM_FDX) { bmcr |= BRGPHY_BMCR_FDX; gig = BRGPHY_1000CTL_AFD; @@ -448,18 +454,27 @@ brgphy_setmedia(struct mii_softc *sc, in gig = BRGPHY_1000CTL_AHD; } + /* Force loopback to disconnect PHY for Ethernet medium. */ brgphy_enable_loopback(sc); + + /* Disable 1000BaseT advertisements. */ PHY_WRITE(sc, BRGPHY_MII_1000CTL, 0); - PHY_WRITE(sc, BRGPHY_MII_BMCR, bmcr); + /* Disable 10/100 advertisements. */ PHY_WRITE(sc, BRGPHY_MII_ANAR, BRGPHY_SEL_TYPE); + /* Write forced link speed. */ + PHY_WRITE(sc, BRGPHY_MII_BMCR, bmcr); + /* If 10/100 only then configuration is complete. */ if ((IFM_SUBTYPE(media) != IFM_1000_T) && (IFM_SUBTYPE(media) != IFM_1000_SX)) goto brgphy_setmedia_exit; + /* Set duplex speed advertisement for 1000BaseT/1000BaseX. */ PHY_WRITE(sc, BRGPHY_MII_1000CTL, gig); + /* Restart auto-negotiation for 1000BaseT/1000BaseX. */ PHY_WRITE(sc, BRGPHY_MII_BMCR, bmcr | BRGPHY_BMCR_AUTOEN | BRGPHY_BMCR_STARTNEG); + /* If not 5701 PHY then configuration is complete. */ if (bsc->mii_model != MII_MODEL_xxBROADCOM_BCM5701) goto brgphy_setmedia_exit; @@ -477,6 +492,7 @@ brgphy_setmedia(struct mii_softc *sc, in PHY_WRITE(sc, BRGPHY_MII_1000CTL, gig | BRGPHY_1000CTL_MSE); } + brgphy_setmedia_exit: return; } @@ -563,7 +579,6 @@ brgphy_status(struct mii_softc *sc) PHY_WRITE(sc, BRGPHY_5708S_BLOCK_ADDR, BRGPHY_5708S_DIG_PG0); xstat = PHY_READ(sc, BRGPHY_5708S_PG0_1000X_STAT1); - /* Todo: Create #defines for hard coded values */ switch (xstat & BRGPHY_5708S_PG0_1000X_STAT1_SPEED_MASK) { case BRGPHY_5708S_PG0_1000X_STAT1_SPEED_10: mii->mii_media_active |= IFM_10_FL; break; @@ -598,6 +613,7 @@ brgphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_FLAG0; } } + /* Todo: Add support for fiber settings too. */ #endif @@ -638,6 +654,7 @@ brgphy_mii_phy_auto(struct mii_softc *sc } + /* Enable loopback to force the link down. */ static void brgphy_enable_loopback(struct mii_softc *sc) @@ -814,6 +831,20 @@ brgphy_fixup_jitter_bug(struct mii_softc PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); } + +static void +brgphy_fixup_disable_early_dac(struct mii_softc *sc) +{ + uint32_t val; + + PHY_WRITE(sc, BRGPHY_MII_DSP_ADDR_REG, 0x0f08); + val = PHY_READ(sc, BRGPHY_MII_DSP_RW_PORT); + val &= ~(1 << 8); + PHY_WRITE(sc, BRGPHY_MII_DSP_RW_PORT, val); + +} + + static void brgphy_ethernet_wirespeed(struct mii_softc *sc) { @@ -825,6 +856,7 @@ brgphy_ethernet_wirespeed(struct mii_sof PHY_WRITE(sc, BRGPHY_MII_AUXCTL, val | (1 << 15) | (1 << 4)); } + static void brgphy_jumbo_settings(struct mii_softc *sc, u_long mtu) { @@ -866,9 +898,10 @@ brgphy_reset(struct mii_softc *sc) struct bce_softc *bce_sc = NULL; struct ifnet *ifp; + /* Perform a standard PHY reset. */ mii_phy_reset(sc); - /* Handle any PHY specific procedures to finish the reset. */ + /* Handle any PHY specific procedures following the reset. */ switch (bsc->mii_oui) { case MII_OUI_BROADCOM: break; @@ -935,7 +968,7 @@ brgphy_reset(struct mii_softc *sc) } else if (bce_sc) { if (BCE_CHIP_NUM(bce_sc) == BCE_CHIP_NUM_5708 && - BCE_CHIP_BOND_ID(bce_sc) & BCE_CHIP_BOND_ID_SERDES_BIT) { + (bce_sc->bce_phy_flags & BCE_PHY_SERDES_FLAG)) { /* Store autoneg capabilities/results in digital block (Page 0) */ PHY_WRITE(sc, BRGPHY_5708S_BLOCK_ADDR, BRGPHY_5708S_DIG3_PG2); @@ -983,6 +1016,13 @@ brgphy_reset(struct mii_softc *sc) PHY_WRITE(sc, BRGPHY_5708S_BLOCK_ADDR, BRGPHY_5708S_DIG_PG0); } + } else if (BCE_CHIP_NUM(bce_sc) == BCE_CHIP_NUM_5709) { + if ((BCE_CHIP_REV(bce_sc) == BCE_CHIP_REV_Ax) || + (BCE_CHIP_REV(bce_sc) == BCE_CHIP_REV_Bx)) + brgphy_fixup_disable_early_dac(sc); + + brgphy_jumbo_settings(sc, ifp->if_mtu); + brgphy_ethernet_wirespeed(sc); } else { brgphy_fixup_ber_bug(sc); brgphy_jumbo_settings(sc, ifp->if_mtu); Modified: stable/7/sys/dev/mii/miidevs ============================================================================== --- stable/7/sys/dev/mii/miidevs Tue Jun 2 22:52:58 2009 (r193357) +++ stable/7/sys/dev/mii/miidevs Tue Jun 2 23:30:02 2009 (r193358) @@ -146,7 +146,9 @@ model xxBROADCOM BCM5708C 0x0036 BCM5708 model xxBROADCOM_ALT1 BCM5755 0x000c BCM5755 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5787 0x000e BCM5787 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5708S 0x0015 BCM5708S 1000/2500BaseSX PHY +model xxBROADCOM_ALT1 BCM5709CAX 0x002c BCM5709C(AX) 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5722 0x002d BCM5722 10/100/1000baseTX PHY +model xxBROADCOM_ALT1 BCM5709C 0x003c BCM5709C 10/100/1000baseTX PHY model BROADCOM2 BCM5906 0x0004 BCM5906 10/100baseTX PHY /* Cicada Semiconductor PHYs (now owned by Vitesse?) */ From owner-svn-src-stable-7@FreeBSD.ORG Wed Jun 3 08:05:54 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3970A1065670; Wed, 3 Jun 2009 08:05:54 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 251E18FC1C; Wed, 3 Jun 2009 08:05:54 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5385sY2042777; Wed, 3 Jun 2009 08:05:54 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5385rE5042763; Wed, 3 Jun 2009 08:05:53 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200906030805.n5385rE5042763@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 3 Jun 2009 08:05:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193367 - stable/7/share/zoneinfo X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jun 2009 08:05:54 -0000 Author: edwin Date: Wed Jun 3 08:05:53 2009 New Revision: 193367 URL: http://svn.freebsd.org/changeset/base/193367 Log: MFC of tzdata2009h: - Fix coordinates of Africa/Gaborone, Pacific/Noumea, Pacific/Tongatapu, Europe/Vatican - Fix URLs (=3D -> = etc) - Jordan doesn't go at last Friday of March 00:00 but no last Thursday of March 24:00 - Specifically state license for the data: public domain Modified: stable/7/share/zoneinfo/ (props changed) stable/7/share/zoneinfo/africa stable/7/share/zoneinfo/antarctica stable/7/share/zoneinfo/asia stable/7/share/zoneinfo/australasia stable/7/share/zoneinfo/backward stable/7/share/zoneinfo/etcetera stable/7/share/zoneinfo/europe stable/7/share/zoneinfo/factory stable/7/share/zoneinfo/leapseconds stable/7/share/zoneinfo/northamerica stable/7/share/zoneinfo/southamerica stable/7/share/zoneinfo/systemv stable/7/share/zoneinfo/zone.tab Modified: stable/7/share/zoneinfo/africa ============================================================================== --- stable/7/share/zoneinfo/africa Wed Jun 3 04:10:22 2009 (r193366) +++ stable/7/share/zoneinfo/africa Wed Jun 3 08:05:53 2009 (r193367) @@ -1,5 +1,7 @@ -# @(#)africa 8.19 #
+# @(#)africa	8.21
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
@@ -241,18 +243,18 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 # The following appeared in Red Hat bugzilla[1] (edited):
 #
 # > $ zdump -v /usr/share/zoneinfo/Africa/Cairo | grep 2009
-# > /usr/share/zoneinfo/Africa/Cairo  Thu Apr 23 21:59:59 2009 UTC =3D Thu =
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Apr 23 21:59:59 2009 UTC = Thu =
 # Apr 23
-# > 23:59:59 2009 EET isdst=3D0 gmtoff=3D7200
-# > /usr/share/zoneinfo/Africa/Cairo  Thu Apr 23 22:00:00 2009 UTC =3D Fri =
+# > 23:59:59 2009 EET isdst=0 gmtoff=7200
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Apr 23 22:00:00 2009 UTC = Fri =
 # Apr 24
-# > 01:00:00 2009 EEST isdst=3D1 gmtoff=3D10800
-# > /usr/share/zoneinfo/Africa/Cairo  Thu Aug 27 20:59:59 2009 UTC =3D Thu =
+# > 01:00:00 2009 EEST isdst=1 gmtoff=10800
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Aug 27 20:59:59 2009 UTC = Thu =
 # Aug 27
-# > 23:59:59 2009 EEST isdst=3D1 gmtoff=3D10800
-# > /usr/share/zoneinfo/Africa/Cairo  Thu Aug 27 21:00:00 2009 UTC =3D Thu =
+# > 23:59:59 2009 EEST isdst=1 gmtoff=10800
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Aug 27 21:00:00 2009 UTC = Thu =
 # Aug 27
-# > 23:00:00 2009 EET isdst=3D0 gmtoff=3D7200
+# > 23:00:00 2009 EET isdst=0 gmtoff=7200
 #
 # > end date should be Thu Sep 24 2009 (Last Thursday in September at 23:59=
 # :59)
@@ -260,11 +262,11 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 #
 # timeanddate[2] and another site I've found[3] also support that.
 #
-# [1] 
-# https://bugzilla.redhat.com/show_bug.cgi?id=3D492263
+# [1] 
+# https://bugzilla.redhat.com/show_bug.cgi?id=492263
 # 
-# [2] 
-# http://www.timeanddate.com/worldclock/clockchange.html?n=3D53
+# [2] 
+# http://www.timeanddate.com/worldclock/clockchange.html?n=53
 # 
 # [3] 
 # http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
@@ -477,8 +479,8 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 
 # From Riad M. Hossen Ally (2008-08-03):
 # The Government of Mauritius weblink
-# 
-# http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=3D4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD
+# 
+# http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD
 # 
 # Cabinet Decision of July 18th, 2008 states as follows:
 #

Modified: stable/7/share/zoneinfo/antarctica
==============================================================================
--- stable/7/share/zoneinfo/antarctica	Wed Jun  3 04:10:22 2009	(r193366)
+++ stable/7/share/zoneinfo/antarctica	Wed Jun  3 08:05:53 2009	(r193367)
@@ -1,5 +1,7 @@
-# @(#)antarctica	8.4
 # 
+# @(#)antarctica	8.5
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # From Paul Eggert (1999-11-15):
 # To keep things manageable, we list only locations occupied year-round; see

Modified: stable/7/share/zoneinfo/asia
==============================================================================
--- stable/7/share/zoneinfo/asia	Wed Jun  3 04:10:22 2009	(r193366)
+++ stable/7/share/zoneinfo/asia	Wed Jun  3 08:05:53 2009	(r193367)
@@ -1,5 +1,7 @@
-# @(#)asia	8.30
 # 
+# @(#)asia	8.32
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
@@ -1107,7 +1109,7 @@ Rule	Jordan	1995	1998	-	Sep	Fri>=15	0:00
 Rule	Jordan	1999	only	-	Jul	 1	0:00s	1:00	S
 Rule	Jordan	1999	2002	-	Sep	lastFri	0:00s	0	-
 Rule	Jordan	2000	2001	-	Mar	lastThu	0:00s	1:00	S
-Rule	Jordan	2002	max	-	Mar	lastFri	0:00s	1:00	S
+Rule	Jordan	2002	max	-	Mar	lastThu	24:00	1:00	S
 Rule	Jordan	2003	only	-	Oct	24	0:00s	0	-
 Rule	Jordan	2004	only	-	Oct	15	0:00s	0	-
 Rule	Jordan	2005	only	-	Sep	lastFri	0:00s	0	-

Modified: stable/7/share/zoneinfo/australasia
==============================================================================
--- stable/7/share/zoneinfo/australasia	Wed Jun  3 04:10:22 2009	(r193366)
+++ stable/7/share/zoneinfo/australasia	Wed Jun  3 08:05:53 2009	(r193367)
@@ -1,5 +1,7 @@
-# @(#)australasia	8.9
 # 
+# @(#)australasia	8.11
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # This file also includes Pacific islands.
 
@@ -1119,6 +1121,27 @@ Zone	Pacific/Wallis	12:15:20 -	LMT	1901
 # From Paul Eggert (2007-07-23):
 # See "southeast Australia" above for 2008 and later.
 
+# From Steffen Thorsen (2009-04-28):
+# According to the official press release, South Australia's extended daylight 
+# saving period will continue with the same rules as used during the 2008-2009 
+# summer (southern hemisphere).
+# 
+# From
+# 
+# http://www.safework.sa.gov.au/uploaded_files/DaylightDatesSet.pdf
+# 
+# The extended daylight saving period that South Australia has been trialling 
+# for over the last year is now set to be ongoing.
+# Daylight saving will continue to start on the first Sunday in October each 
+# year and finish on the first Sunday in April the following year.
+# Industrial Relations Minister, Paul Caica, says this provides South Australia 
+# with a consistent half hour time difference with NSW, Victoria, Tasmania and 
+# the ACT for all 52 weeks of the year...
+# 
+# We have a wrap-up here:
+# 
+# http://www.timeanddate.com/news/time/south-australia-extends-dst.html
+# 
 ###############################################################################
 
 # New Zealand

Modified: stable/7/share/zoneinfo/backward
==============================================================================
--- stable/7/share/zoneinfo/backward	Wed Jun  3 04:10:22 2009	(r193366)
+++ stable/7/share/zoneinfo/backward	Wed Jun  3 08:05:53 2009	(r193367)
@@ -1,4 +1,7 @@
-# @(#)backward	8.7
+# 
+# @(#)backward	8.8
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # This file provides links between current names for time zones
 # and their old names.  Many names changed in late 1993.

Modified: stable/7/share/zoneinfo/etcetera
==============================================================================
--- stable/7/share/zoneinfo/etcetera	Wed Jun  3 04:10:22 2009	(r193366)
+++ stable/7/share/zoneinfo/etcetera	Wed Jun  3 08:05:53 2009	(r193367)
@@ -1,4 +1,7 @@
-# @(#)etcetera	8.1
+# 
+# @(#)etcetera	8.2
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # These entries are mostly present for historical reasons, so that
 # people in areas not otherwise covered by the tz files could "zic -l"

Modified: stable/7/share/zoneinfo/europe
==============================================================================
--- stable/7/share/zoneinfo/europe	Wed Jun  3 04:10:22 2009	(r193366)
+++ stable/7/share/zoneinfo/europe	Wed Jun  3 08:05:53 2009	(r193367)
@@ -1,5 +1,7 @@
-# @(#)europe	8.20
 # 
+# @(#)europe	8.21
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to

Modified: stable/7/share/zoneinfo/factory
==============================================================================
--- stable/7/share/zoneinfo/factory	Wed Jun  3 04:10:22 2009	(r193366)
+++ stable/7/share/zoneinfo/factory	Wed Jun  3 08:05:53 2009	(r193367)
@@ -1,4 +1,7 @@
-# @(#)factory	8.1
+# 
+# @(#)factory	8.2
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # For companies who don't want to put time zone specification in
 # their installation procedures.  When users run date, they'll get the message.

Modified: stable/7/share/zoneinfo/leapseconds
==============================================================================
--- stable/7/share/zoneinfo/leapseconds	Wed Jun  3 04:10:22 2009	(r193366)
+++ stable/7/share/zoneinfo/leapseconds	Wed Jun  3 08:05:53 2009	(r193367)
@@ -1,4 +1,7 @@
-# @(#)leapseconds	8.6
+# 
+# @(#)leapseconds	8.8
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # Allowance for leapseconds added to each timezone file.
 

Modified: stable/7/share/zoneinfo/northamerica
==============================================================================
--- stable/7/share/zoneinfo/northamerica	Wed Jun  3 04:10:22 2009	(r193366)
+++ stable/7/share/zoneinfo/northamerica	Wed Jun  3 08:05:53 2009	(r193367)
@@ -1,5 +1,7 @@
-# @(#)northamerica	8.27
 # 
+# @(#)northamerica	8.28
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # also includes Central America and the Caribbean
 

Modified: stable/7/share/zoneinfo/southamerica
==============================================================================
--- stable/7/share/zoneinfo/southamerica	Wed Jun  3 04:10:22 2009	(r193366)
+++ stable/7/share/zoneinfo/southamerica	Wed Jun  3 08:05:53 2009	(r193367)
@@ -1,5 +1,7 @@
-# @(#)southamerica	8.34
 # 
+# @(#)southamerica	8.36
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
@@ -674,8 +676,8 @@ Zone	America/La_Paz	-4:32:36 -	LMT	1890
 
 # From Rodrigo Severo (2008-06-24):
 # Just correcting the URL:
-# 
-# https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=3Ddo&secao=3D1&pagina=3D1&data=3D25/04/2008
+# 
+# https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=do&secao=1&pagina=1&data=25/04/2008
 # 
 #
 # As a result of the above Decree I believe the America/Rio_Branco

Modified: stable/7/share/zoneinfo/systemv
==============================================================================
--- stable/7/share/zoneinfo/systemv	Wed Jun  3 04:10:22 2009	(r193366)
+++ stable/7/share/zoneinfo/systemv	Wed Jun  3 08:05:53 2009	(r193367)
@@ -1,4 +1,7 @@
-# @(#)systemv	8.1
+# 
+# @(#)systemv	8.2
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # Old rules, should the need arise.
 # No attempt is made to handle Newfoundland, since it cannot be expressed

Modified: stable/7/share/zoneinfo/zone.tab
==============================================================================
--- stable/7/share/zoneinfo/zone.tab	Wed Jun  3 04:10:22 2009	(r193366)
+++ stable/7/share/zoneinfo/zone.tab	Wed Jun  3 08:05:53 2009	(r193367)
@@ -1,4 +1,7 @@
-# @(#)zone.tab	8.26
+# 
+# @(#)zone.tab	8.28
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 #
 # TZ zone descriptions
 #
@@ -101,7 +104,7 @@ BR	-0640-06952	America/Eirunepe	W Amazon
 BR	-0958-06748	America/Rio_Branco	Acre
 BS	+2505-07721	America/Nassau
 BT	+2728+08939	Asia/Thimphu
-BW	-2545+02555	Africa/Gaborone
+BW	-2439+02555	Africa/Gaborone
 BY	+5354+02734	Europe/Minsk
 BZ	+1730-08812	America/Belize
 CA	+4734-05243	America/St_Johns	Newfoundland Time, including SE Labrador
@@ -285,7 +288,7 @@ MY	+0310+10142	Asia/Kuala_Lumpur	peninsu
 MY	+0133+11020	Asia/Kuching	Sabah & Sarawak
 MZ	-2558+03235	Africa/Maputo
 NA	-2234+01706	Africa/Windhoek
-NC	-2216+16530	Pacific/Noumea
+NC	-2216+16627	Pacific/Noumea
 NE	+1331+00207	Africa/Niamey
 NF	-2903+16758	Pacific/Norfolk
 NG	+0627+00324	Africa/Lagos
@@ -365,7 +368,7 @@ TK	-0922-17114	Pacific/Fakaofo
 TL	-0833+12535	Asia/Dili
 TM	+3757+05823	Asia/Ashgabat
 TN	+3648+01011	Africa/Tunis
-TO	-2110+17510	Pacific/Tongatapu
+TO	-2110-17510	Pacific/Tongatapu
 TR	+4101+02858	Europe/Istanbul
 TT	+1039-06131	America/Port_of_Spain
 TV	-0831+17913	Pacific/Funafuti
@@ -409,7 +412,7 @@ US	+211825-1575130	Pacific/Honolulu	Hawa
 UY	-3453-05611	America/Montevideo
 UZ	+3940+06648	Asia/Samarkand	west Uzbekistan
 UZ	+4120+06918	Asia/Tashkent	east Uzbekistan
-VA	+4154+01227	Europe/Vatican
+VA	+415408+0122711	Europe/Vatican
 VC	+1309-06114	America/St_Vincent
 VE	+1030-06656	America/Caracas
 VG	+1827-06437	America/Tortola

From owner-svn-src-stable-7@FreeBSD.ORG  Wed Jun  3 23:01:14 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 08898106566B;
	Wed,  3 Jun 2009 23:01:14 +0000 (UTC) (envelope-from gnn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E8AC58FC17;
	Wed,  3 Jun 2009 23:01:13 +0000 (UTC) (envelope-from gnn@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n53N1Dw4069745;
	Wed, 3 Jun 2009 23:01:13 GMT (envelope-from gnn@svn.freebsd.org)
Received: (from gnn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n53N1D6t069743;
	Wed, 3 Jun 2009 23:01:13 GMT (envelope-from gnn@svn.freebsd.org)
Message-Id: <200906032301.n53N1D6t069743@svn.freebsd.org>
From: "George V. Neville-Neil" 
Date: Wed, 3 Jun 2009 23:01:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193410 - in stable/7/sys: . dev/cxgb dev/cxgb/common
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 03 Jun 2009 23:01:14 -0000

Author: gnn
Date: Wed Jun  3 23:01:13 2009
New Revision: 193410
URL: http://svn.freebsd.org/changeset/base/193410

Log:
  MFC of 186282
  
  Check in the actual module recognition code for the Chelsio
  driver.
  
  Obtained from:	Chelsio Inc.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/dev/cxgb/common/cxgb_ael1002.c
  stable/7/sys/dev/cxgb/cxgb_main.c

Modified: stable/7/sys/dev/cxgb/common/cxgb_ael1002.c
==============================================================================
--- stable/7/sys/dev/cxgb/common/cxgb_ael1002.c	Wed Jun  3 22:54:27 2009	(r193409)
+++ stable/7/sys/dev/cxgb/common/cxgb_ael1002.c	Wed Jun  3 23:01:13 2009	(r193410)
@@ -75,6 +75,74 @@ struct reg_val {
 	unsigned short set_bits;
 };
 
+static int ael2005_i2c_rd(struct cphy *phy, int dev_addr, int word_addr);
+
+static int get_module_type (struct cphy *phy, int hint)
+{
+	int v;
+
+	v = hint ? hint : ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 0);
+	if (v < 0)
+		return v;
+
+	if (v == 0x3) {
+		/* SFP: see SFF-8472 for below */
+		v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 3);
+		if (v < 0)
+			return v;
+
+		if (v == 0x1)
+			return phy_modtype_twinax;
+		if (v == 0x10)
+			return phy_modtype_sr;
+		if (v == 0x20)
+			return phy_modtype_lr;
+		if (v == 0x40)
+			return phy_modtype_lrm;
+
+		v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 6);
+		if (v < 0)
+			return v;
+		if (v != 4)
+			return phy_modtype_unknown;
+
+		v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 10);
+		if (v < 0)
+			return v;
+
+		if (v & 0x80) {
+			v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 0x12);
+			if (v < 0)
+				return v;
+			return v > 10 ? phy_modtype_twinax_long :
+			    phy_modtype_twinax;
+		}
+	} else if (v == 0x6) {
+		/* XFP: See INF-8077i for details. */
+
+		v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 127);
+		if (v < 0)
+			return v;
+
+		if (v != 1) {
+			/* XXX: set page select to table 1 yourself */
+			return phy_modtype_unknown;
+		}
+
+		v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 131);
+		if (v < 0)
+			return v;
+		if (v == 0x10)
+			return phy_modtype_lrm;
+		if (v == 0x40)
+			return phy_modtype_lr;
+		if (v == 0x80)
+			return phy_modtype_sr;
+	}
+
+	return phy_modtype_unknown;
+}
+
 static int set_phy_regs(struct cphy *phy, const struct reg_val *rv)
 {
 	int err;
@@ -111,6 +179,18 @@ static int ael1002_power_down(struct cph
 	return err;
 }
 
+static int ael1002_get_module_type(struct cphy *phy, int delay_ms)
+{
+	int v;
+
+	if (delay_ms)
+		msleep(delay_ms);
+
+	v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 0);
+
+	return v == -ETIMEDOUT ? phy_modtype_none : get_module_type(phy, v);
+}
+
 static int ael1002_reset(struct cphy *phy, int wait)
 {
 	int err;
@@ -123,6 +203,11 @@ static int ael1002_reset(struct cphy *ph
 	    (err = t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, AEL1002_LB_EN,
 				       0, 1 << 5)))
 		return err;
+
+	err = ael1002_get_module_type(phy, 300);
+	if (err >= 0)
+		phy->modtype = err;
+
 	return 0;
 }
 
@@ -186,10 +271,17 @@ static struct cphy_ops ael1002_ops = {
 int t3_ael1002_phy_prep(struct cphy *phy, adapter_t *adapter, int phy_addr,
 			const struct mdio_ops *mdio_ops)
 {
+	int err;
+
 	cphy_init(phy, adapter, phy_addr, &ael1002_ops, mdio_ops,
 		  SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE,
 		  "10GBASE-R");
 	ael100x_txon(phy);
+
+	err = ael1002_get_module_type(phy, 0);
+	if (err >= 0)
+		phy->modtype = err;
+
 	return 0;
 }
 
@@ -987,7 +1079,7 @@ static int ael2005_i2c_rd(struct cphy *p
 	return -ETIMEDOUT;
 }
 
-static int get_module_type(struct cphy *phy, int delay_ms)
+static int ael2005_get_module_type(struct cphy *phy, int delay_ms)
 {
 	int v;
 	unsigned int stat;
@@ -1002,36 +1094,8 @@ static int get_module_type(struct cphy *
 	if (delay_ms)
 		msleep(delay_ms);
 
-	/* see SFF-8472 for below */
-	v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 3);
-	if (v < 0)
-		return v;
-
-	if (v == 0x10)
-		return phy_modtype_sr;
-	if (v == 0x20)
-		return phy_modtype_lr;
-	if (v == 0x40)
-		return phy_modtype_lrm;
-
-	v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 6);
-	if (v < 0)
-		return v;
-	if (v != 4)
-		goto unknown;
-
-	v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 10);
-	if (v < 0)
-		return v;
+	return get_module_type(phy, 0);
 
-	if (v & 0x80) {
-		v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 0x12);
-		if (v < 0)
-			return v;
-		return v > 10 ? phy_modtype_twinax_long : phy_modtype_twinax;
-	}
-unknown:
-	return phy_modtype_unknown;
 }
 
 static int ael2005_intr_enable(struct cphy *phy)
@@ -1088,7 +1152,7 @@ static int ael2005_reset(struct cphy *ph
 
 	msleep(50);
 
-	err = get_module_type(phy, 0);
+	err = ael2005_get_module_type(phy, 0);
 	if (err < 0)
 		return err;
 	phy->modtype = (u8)err;
@@ -1126,7 +1190,7 @@ static int ael2005_intr_handler(struct c
 			return ret;
 
 		/* modules have max 300 ms init time after hot plug */
-		ret = get_module_type(phy, 300);
+		ret = ael2005_get_module_type(phy, 300);
 		if (ret < 0)
 			return ret;
 
@@ -1180,10 +1244,16 @@ static struct cphy_ops ael2005_ops = {
 int t3_ael2005_phy_prep(struct cphy *phy, adapter_t *adapter, int phy_addr,
 			const struct mdio_ops *mdio_ops)
 {
+	int err;
 	cphy_init(phy, adapter, phy_addr, &ael2005_ops, mdio_ops,
 		  SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE |
 		  SUPPORTED_IRQ, "10GBASE-R");
 	msleep(125);
+
+	err = ael2005_get_module_type(phy, 0);
+	if (err >= 0)
+		phy->modtype = err;
+
 	return t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, AEL_OPT_SETTINGS, 0,
 				   1 << 5);
 }

Modified: stable/7/sys/dev/cxgb/cxgb_main.c
==============================================================================
--- stable/7/sys/dev/cxgb/cxgb_main.c	Wed Jun  3 22:54:27 2009	(r193409)
+++ stable/7/sys/dev/cxgb/cxgb_main.c	Wed Jun  3 23:01:13 2009	(r193410)
@@ -98,6 +98,7 @@ static void cxgb_stop_locked(struct port
 static void cxgb_set_rxmode(struct port_info *);
 static int cxgb_ioctl(struct ifnet *, unsigned long, caddr_t);
 static int cxgb_media_change(struct ifnet *);
+static int cxgb_ifm_type(int);
 static void cxgb_media_status(struct ifnet *, struct ifmediareq *);
 static int setup_sge_qsets(adapter_t *);
 static void cxgb_async_intr(void *);
@@ -1011,7 +1012,7 @@ cxgb_port_attach(device_t dev)
 	} else if (!strcmp(p->phy.desc, "10GBASE-SR")) {
 		media_flags = IFM_ETHER | IFM_10G_SR | IFM_FDX;
 	} else if (!strcmp(p->phy.desc, "10GBASE-R")) {
-		media_flags = IFM_ETHER | IFM_10G_LR | IFM_FDX;
+		media_flags = cxgb_ifm_type(p->phy.modtype);
 	} else if (!strcmp(p->phy.desc, "10/100/1000BASE-T")) {
 		ifmedia_add(&p->media, IFM_ETHER | IFM_10_T, 0, NULL);
 		ifmedia_add(&p->media, IFM_ETHER | IFM_10_T | IFM_FDX,
@@ -1027,6 +1028,9 @@ cxgb_port_attach(device_t dev)
 		/*
 		 * XXX: This is not very accurate.  Fix when common code
 		 * returns more specific value - eg 1000BASE-SX, LX, etc.
+		 *
+		 * XXX: In the meantime, don't lie. Consider setting IFM_AUTO
+		 * instead of SX.
 		 */
 		media_flags = IFM_ETHER | IFM_1000_SX | IFM_FDX;
 	} else {
@@ -1034,7 +1038,13 @@ cxgb_port_attach(device_t dev)
 		return (ENXIO);
 	}
 	if (media_flags) {
-		ifmedia_add(&p->media, media_flags, 0, NULL);
+		/*
+		 * Note the modtype on which we based our flags.  If modtype
+		 * changes, we'll redo the ifmedia for this ifp.  modtype may
+		 * change when transceivers are plugged in/out, and in other
+		 * situations.
+		 */
+		ifmedia_add(&p->media, media_flags, p->phy.modtype, NULL);
 		ifmedia_set(&p->media, media_flags);
 	} else {
 		ifmedia_add(&p->media, IFM_ETHER | IFM_AUTO, 0, NULL);
@@ -1875,7 +1885,7 @@ cxgb_init_locked(struct port_info *p)
 	cxgb_link_start(p);
 	t3_link_changed(sc, p->port_id);
 #endif
-	ifp->if_baudrate = p->link_config.speed * 1000000;
+	ifp->if_baudrate = IF_Mbps(p->link_config.speed);
 
 	device_printf(sc->dev, "enabling interrupts on port=%d\n", p->port_id);
 	t3_port_intr_enable(sc, p->port_id);
@@ -2033,7 +2043,9 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l
 		break;
 	case SIOCSIFMEDIA:
 	case SIOCGIFMEDIA:
+		PORT_LOCK(p);
 		error = ifmedia_ioctl(ifp, ifr, &p->media, command);
+		PORT_UNLOCK(p);
 		break;
 	case SIOCSIFCAP:
 		PORT_LOCK(p);
@@ -2107,10 +2119,64 @@ cxgb_media_change(struct ifnet *ifp)
 	return (ENXIO);
 }
 
+/*
+ * Translates from phy->modtype to IFM_TYPE.
+ */
+static int
+cxgb_ifm_type(int phymod)
+{
+	int rc = IFM_ETHER | IFM_FDX;
+
+	switch (phymod) {
+	case phy_modtype_sr:
+		rc |= IFM_10G_SR;
+		break;
+	case phy_modtype_lr:
+		rc |= IFM_10G_LR;
+		break;
+	case phy_modtype_lrm:
+#ifdef IFM_10G_LRM
+		rc |= IFM_10G_LRM;
+#endif
+		break;
+	case phy_modtype_twinax:
+#ifdef IFM_10G_TWINAX
+		rc |= IFM_10G_TWINAX;
+#endif
+		break;
+	case phy_modtype_twinax_long:
+#ifdef IFM_10G_TWINAX_LONG
+		rc |= IFM_10G_TWINAX_LONG;
+#endif
+		break;
+	case phy_modtype_none:
+		rc = IFM_ETHER | IFM_NONE;
+		break;
+	case phy_modtype_unknown:
+		break;
+	}
+
+	return (rc);
+}
+
 static void
 cxgb_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
 {
 	struct port_info *p = ifp->if_softc;
+	struct ifmedia_entry *cur = p->media.ifm_cur;
+	int m;
+
+	if (cur->ifm_data != p->phy.modtype) { 
+		/* p->media about to be rebuilt, must hold lock */
+		PORT_LOCK_ASSERT_OWNED(p);
+
+		m = cxgb_ifm_type(p->phy.modtype);
+		ifmedia_removeall(&p->media);
+		ifmedia_add(&p->media, m, p->phy.modtype, NULL); 
+		ifmedia_set(&p->media, m);
+		cur = p->media.ifm_cur; /* ifmedia_set modified ifm_cur */
+		ifmr->ifm_current = m;
+	}
 
 	ifmr->ifm_status = IFM_AVALID;
 	ifmr->ifm_active = IFM_ETHER;
@@ -2130,6 +2196,9 @@ cxgb_media_status(struct ifnet *ifp, str
 	case 1000:
 		ifmr->ifm_active |= IFM_1000_T;
 		break;
+	case 10000:
+		ifmr->ifm_active |= IFM_SUBTYPE(cur->ifm_media);
+		break;
 	}
 	
 	if (p->link_config.duplex)
@@ -2181,7 +2250,7 @@ check_link_status(adapter_t *sc)
 
 		if (!(p->phy.caps & SUPPORTED_IRQ)) 
 			t3_link_changed(sc, i);
-		p->ifp->if_baudrate = p->link_config.speed * 1000000;
+		p->ifp->if_baudrate = IF_Mbps(p->link_config.speed);
 	}
 }
 

From owner-svn-src-stable-7@FreeBSD.ORG  Thu Jun  4 15:10:29 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C3B081065675;
	Thu,  4 Jun 2009 15:10:29 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 950F18FC17;
	Thu,  4 Jun 2009 15:10:29 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n54FATUj095612;
	Thu, 4 Jun 2009 15:10:29 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n54FAT8i095611;
	Thu, 4 Jun 2009 15:10:29 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200906041510.n54FAT8i095611@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 4 Jun 2009 15:10:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193438 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb kern
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 04 Jun 2009 15:10:30 -0000

Author: kib
Date: Thu Jun  4 15:10:29 2009
New Revision: 193438
URL: http://svn.freebsd.org/changeset/base/193438

Log:
  MFC r192094:
  Do not advance req->oldidx when sysctl_old_user returning an
  error due to copyout failure or short buffer.
  
  MFC r192144:
  Revert r192094. The revision caused problems for sysctl(3) consumers
  that expect that oldlen is filled with required buffer length even when
  supplied buffer is too short and returned error is ENOMEM.
  
  Redo the fix for kern.proc.filedesc, by reverting the req->oldidx when
  remaining buffer space is too short for the current kinfo_file structure.
  Also, only ignore ENOMEM. We have to convert ENOMEM to no error condition
  to keep existing interface for the sysctl, though.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/kern/kern_descrip.c

Modified: stable/7/sys/kern/kern_descrip.c
==============================================================================
--- stable/7/sys/kern/kern_descrip.c	Thu Jun  4 14:49:27 2009	(r193437)
+++ stable/7/sys/kern/kern_descrip.c	Thu Jun  4 15:10:29 2009	(r193438)
@@ -2866,6 +2866,7 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER
 	struct file *fp;
 	struct proc *p;
 	int vfslocked;
+	size_t oldidx;
 
 	name = (int *)arg1;
 	if ((p = pfind((pid_t)name[0])) == NULL)
@@ -3032,14 +3033,26 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER
 		    strlen(kif->kf_path) + 1;
 		kif->kf_structsize = roundup(kif->kf_structsize,
 		    sizeof(uint64_t));
+		oldidx = req->oldidx;
 		error = SYSCTL_OUT(req, kif, kif->kf_structsize);
-		if (error)
+		if (error) {
+			if (error == ENOMEM) {
+				/*
+				 * The hack to keep the ABI of sysctl
+				 * kern.proc.filedesc intact, but not
+				 * to account a partially copied
+				 * kinfo_file into the oldidx.
+				 */
+				req->oldidx = oldidx;
+				error = 0;
+			}
 			break;
+		}
 	}
 	FILEDESC_SUNLOCK(fdp);
 	fddrop(fdp);
 	free(kif, M_TEMP);
-	return (0);
+	return (error);
 }
 
 static SYSCTL_NODE(_kern_proc, KERN_PROC_FILEDESC, filedesc, CTLFLAG_RD,

From owner-svn-src-stable-7@FreeBSD.ORG  Thu Jun  4 17:55:43 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 42738106564A;
	Thu,  4 Jun 2009 17:55:43 +0000 (UTC)
	(envelope-from brueffer@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2FFFB8FC15;
	Thu,  4 Jun 2009 17:55:43 +0000 (UTC)
	(envelope-from brueffer@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n54HthtL099253;
	Thu, 4 Jun 2009 17:55:43 GMT (envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n54HthMl099252;
	Thu, 4 Jun 2009 17:55:43 GMT (envelope-from brueffer@svn.freebsd.org)
Message-Id: <200906041755.n54HthMl099252@svn.freebsd.org>
From: Christian Brueffer 
Date: Thu, 4 Jun 2009 17:55:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193444 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb dev/iir
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 04 Jun 2009 17:55:43 -0000

Author: brueffer
Date: Thu Jun  4 17:55:42 2009
New Revision: 193444
URL: http://svn.freebsd.org/changeset/base/193444

Log:
  MFC: r192097
  
  Compare the correct variable against NULL.
  
  Reviewed by:	scottl
  Found with:	Coverity Prevent(tm)
  CID:		821

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/dev/iir/iir_pci.c

Modified: stable/7/sys/dev/iir/iir_pci.c
==============================================================================
--- stable/7/sys/dev/iir/iir_pci.c	Thu Jun  4 17:12:50 2009	(r193443)
+++ stable/7/sys/dev/iir/iir_pci.c	Thu Jun  4 17:55:42 2009	(r193444)
@@ -202,7 +202,7 @@ iir_pci_attach(device_t dev)
     rid = 0;
     irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
                                  RF_ACTIVE | RF_SHAREABLE);
-    if (io == NULL) {
+    if (irq == NULL) {
         device_printf(dev, "can't find IRQ value\n");
         error = ENOMEM;
         goto err;

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Jun  5 11:55:33 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 036D7106566C;
	Fri,  5 Jun 2009 11:55:33 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E2F608FC17;
	Fri,  5 Jun 2009 11:55:32 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55BtWu7024659;
	Fri, 5 Jun 2009 11:55:32 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55BtWqS024658;
	Fri, 5 Jun 2009 11:55:32 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200906051155.n55BtWqS024658@svn.freebsd.org>
From: Edwin Groothuis 
Date: Fri, 5 Jun 2009 11:55:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193493 - stable/7/games/fortune/datfiles
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 05 Jun 2009 11:55:35 -0000

Author: edwin
Date: Fri Jun  5 11:55:32 2009
New Revision: 193493
URL: http://svn.freebsd.org/changeset/base/193493

Log:
  MFC of r179459 and r187110:
  
  Remove a quote about the instant-workstation, this port
  has been removed ages ago.
  
  netcat is "now" in base, so point people at nc(1) instead of the port.
  
  PR:		docs/124166

Modified:
  stable/7/games/fortune/datfiles/freebsd-tips   (contents, props changed)

Modified: stable/7/games/fortune/datfiles/freebsd-tips
==============================================================================
--- stable/7/games/fortune/datfiles/freebsd-tips	Fri Jun  5 09:46:00 2009	(r193492)
+++ stable/7/games/fortune/datfiles/freebsd-tips	Fri Jun  5 11:55:32 2009	(r193493)
@@ -215,8 +215,8 @@ Over quota?  "du -s * | sort -n " will g
 directory sizes.
 		-- David Scheidt 
 %
-ports/net/netcat port is useful not only for redirecting input/output
-to TCP or UDP connections, but also for proxying them with inetd(8).
+nc(1) (or netcat) is useful not only for redirecting input/output to
+TCP or UDP connections, but also for proxying them with inetd(8).
 %
 sh (the default Bourne shell in FreeBSD) supports command-line editing.  Just
 ``set -o emacs'' or ``set -o vi'' to enable it.
@@ -402,16 +402,6 @@ install it by doing
 as root.  This will install a collection of packages that is appropriate for
 running a "generic" server.
 %
-You can get a good standard workstation install by using the
-instant-workstation port/package.  If you have ports installed, you can
-install it by doing
-
-	# cd /usr/ports/misc/instant-workstation
-	# make install && make clean
-
-as root.  This will install a collection of packages that is convenient to
-have on a workstation.
-%
 You can install extra packages for FreeBSD by using the ports system.
 If you have installed it, you can download, compile, and install software by
 just typing

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Jun  5 12:00:55 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D4F401065697;
	Fri,  5 Jun 2009 12:00:55 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BE6478FC0C;
	Fri,  5 Jun 2009 12:00:55 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55C0t5q024833;
	Fri, 5 Jun 2009 12:00:55 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55C0tRj024830;
	Fri, 5 Jun 2009 12:00:55 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200906051200.n55C0tRj024830@svn.freebsd.org>
From: Kip Macy 
Date: Fri, 5 Jun 2009 12:00:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193494 - in stable/7/sys/boot: . i386 i386/loader
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 05 Jun 2009 12:00:59 -0000

Author: kmacy
Date: Fri Jun  5 12:00:55 2009
New Revision: 193494
URL: http://svn.freebsd.org/changeset/base/193494

Log:
  roll zfs loader support under MK_ZFS to enable / disable consistently

Modified:
  stable/7/sys/boot/Makefile
  stable/7/sys/boot/i386/Makefile
  stable/7/sys/boot/i386/loader/Makefile

Modified: stable/7/sys/boot/Makefile
==============================================================================
--- stable/7/sys/boot/Makefile	Fri Jun  5 11:55:32 2009	(r193493)
+++ stable/7/sys/boot/Makefile	Fri Jun  5 12:00:55 2009	(r193494)
@@ -17,7 +17,7 @@ SUBDIR+=		efi
 SUBDIR+=		ofw
 .endif
 
-.if defined(LOADER_ZFS_SUPPORT)
+.if ${MK_ZFS} != "no"
 SUBDIR+=		zfs
 .endif
 

Modified: stable/7/sys/boot/i386/Makefile
==============================================================================
--- stable/7/sys/boot/i386/Makefile	Fri Jun  5 11:55:32 2009	(r193493)
+++ stable/7/sys/boot/i386/Makefile	Fri Jun  5 12:00:55 2009	(r193494)
@@ -3,7 +3,7 @@
 SUBDIR=		mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot \
 		kgzldr libi386 libfirewire loader
 
-.if defined(LOADER_ZFS_SUPPORT)
+.if ${MK_ZFS} != "no"
 SUBDIR+=		zfsboot gptzfsboot
 .endif
 

Modified: stable/7/sys/boot/i386/loader/Makefile
==============================================================================
--- stable/7/sys/boot/i386/loader/Makefile	Fri Jun  5 11:55:32 2009	(r193493)
+++ stable/7/sys/boot/i386/loader/Makefile	Fri Jun  5 12:00:55 2009	(r193494)
@@ -15,8 +15,7 @@ CFLAGS+=	-DLOADER_FIREWIRE_SUPPORT
 LIBFIREWIRE=	${.OBJDIR}/../libfirewire/libfirewire.a
 .endif
 
-# Put LOADER_ZFS_SUPPORT=yes in /etc/make.conf for ZFS support
-.if defined(LOADER_ZFS_SUPPORT)
+.if ${MK_ZFS} != "no"
 CFLAGS+=	-DLOADER_ZFS_SUPPORT
 LIBZFS=		${.OBJDIR}/../../zfs/libzfsboot.a
 .endif

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Jun  5 12:14:44 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 025151065674;
	Fri,  5 Jun 2009 12:14:44 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E3B968FC13;
	Fri,  5 Jun 2009 12:14:43 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55CEhaD025121;
	Fri, 5 Jun 2009 12:14:43 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55CEhgJ025118;
	Fri, 5 Jun 2009 12:14:43 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200906051214.n55CEhgJ025118@svn.freebsd.org>
From: Kip Macy 
Date: Fri, 5 Jun 2009 12:14:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193495 - in stable/7/sys/boot: . i386 i386/loader
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 05 Jun 2009 12:14:44 -0000

Author: kmacy
Date: Fri Jun  5 12:14:43 2009
New Revision: 193495
URL: http://svn.freebsd.org/changeset/base/193495

Log:
  reverse previous commit ...

Modified:
  stable/7/sys/boot/Makefile
  stable/7/sys/boot/i386/Makefile
  stable/7/sys/boot/i386/loader/Makefile

Modified: stable/7/sys/boot/Makefile
==============================================================================
--- stable/7/sys/boot/Makefile	Fri Jun  5 12:00:55 2009	(r193494)
+++ stable/7/sys/boot/Makefile	Fri Jun  5 12:14:43 2009	(r193495)
@@ -17,7 +17,7 @@ SUBDIR+=		efi
 SUBDIR+=		ofw
 .endif
 
-.if ${MK_ZFS} != "no"
+.if defined(LOADER_ZFS_SUPPORT)
 SUBDIR+=		zfs
 .endif
 

Modified: stable/7/sys/boot/i386/Makefile
==============================================================================
--- stable/7/sys/boot/i386/Makefile	Fri Jun  5 12:00:55 2009	(r193494)
+++ stable/7/sys/boot/i386/Makefile	Fri Jun  5 12:14:43 2009	(r193495)
@@ -3,7 +3,7 @@
 SUBDIR=		mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot \
 		kgzldr libi386 libfirewire loader
 
-.if ${MK_ZFS} != "no"
+.if defined(LOADER_ZFS_SUPPORT)
 SUBDIR+=		zfsboot gptzfsboot
 .endif
 

Modified: stable/7/sys/boot/i386/loader/Makefile
==============================================================================
--- stable/7/sys/boot/i386/loader/Makefile	Fri Jun  5 12:00:55 2009	(r193494)
+++ stable/7/sys/boot/i386/loader/Makefile	Fri Jun  5 12:14:43 2009	(r193495)
@@ -15,7 +15,8 @@ CFLAGS+=	-DLOADER_FIREWIRE_SUPPORT
 LIBFIREWIRE=	${.OBJDIR}/../libfirewire/libfirewire.a
 .endif
 
-.if ${MK_ZFS} != "no"
+# Put LOADER_ZFS_SUPPORT=yes in /etc/make.conf for ZFS support
+.if defined(LOADER_ZFS_SUPPORT)
 CFLAGS+=	-DLOADER_ZFS_SUPPORT
 LIBZFS=		${.OBJDIR}/../../zfs/libzfsboot.a
 .endif

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Jun  5 15:57:08 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4B6A91065670;
	Fri,  5 Jun 2009 15:57:08 +0000 (UTC) (envelope-from gnn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 301458FC17;
	Fri,  5 Jun 2009 15:57:08 +0000 (UTC) (envelope-from gnn@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55Fv7jo030519;
	Fri, 5 Jun 2009 15:57:07 GMT (envelope-from gnn@svn.freebsd.org)
Received: (from gnn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55Fv7ct030518;
	Fri, 5 Jun 2009 15:57:07 GMT (envelope-from gnn@svn.freebsd.org)
Message-Id: <200906051557.n55Fv7ct030518@svn.freebsd.org>
From: "George V. Neville-Neil" 
Date: Fri, 5 Jun 2009 15:57:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193515 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 05 Jun 2009 15:57:08 -0000

Author: gnn
Date: Fri Jun  5 15:57:07 2009
New Revision: 193515
URL: http://svn.freebsd.org/changeset/base/193515

Log:
  MFC of 185506 and 185508
  
  Proper fix for tracking ifnet statistics
  
  Update internal mac stats every time the tick task is called
  if we don't do this "netstat -w 1" will frequently see negative
  differences in packets sent

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/dev/cxgb/cxgb_main.c

Modified: stable/7/sys/dev/cxgb/cxgb_main.c
==============================================================================
--- stable/7/sys/dev/cxgb/cxgb_main.c	Fri Jun  5 15:32:41 2009	(r193514)
+++ stable/7/sys/dev/cxgb/cxgb_main.c	Fri Jun  5 15:57:07 2009	(r193515)
@@ -2305,7 +2305,7 @@ cxgb_tick(void *arg)
 	if(sc->flags & CXGB_SHUTDOWN)
 		return;
 
-	taskqueue_enqueue(sc->tq, &sc->tick_task);
+	taskqueue_enqueue(sc->tq, &sc->tick_task);	
 	callout_reset(&sc->cxgb_tick_ch, CXGB_TICKS(sc), cxgb_tick, sc);
 }
 
@@ -2323,6 +2323,7 @@ cxgb_tick_handler(void *arg, int count)
 	if (p->linkpoll_period)
 		check_link_status(sc);
 
+	
 	sc->check_task_cnt++;
 
 	/*
@@ -2334,17 +2335,59 @@ cxgb_tick_handler(void *arg, int count)
 	if (p->rev == T3_REV_B2 && p->nports < 4 && sc->open_device_map) 
 		check_t3b2_mac(sc);
 
-	/* Update MAC stats if it's time to do so */
-	if (!p->linkpoll_period ||
-	    (sc->check_task_cnt * p->linkpoll_period) / 10 >=
-	    p->stats_update_period) {
-		for_each_port(sc, i) {
-			struct port_info *port = &sc->port[i];
-			PORT_LOCK(port);
-			t3_mac_update_stats(&port->mac);
-			PORT_UNLOCK(port);
-		}
-		sc->check_task_cnt = 0;
+	for (i = 0; i < sc->params.nports; i++) {
+		struct port_info *pi = &sc->port[i];
+		struct ifnet *ifp = pi->ifp;
+		struct mac_stats *mstats = &pi->mac.stats;
+		PORT_LOCK(pi);
+		t3_mac_update_stats(&pi->mac);
+		PORT_UNLOCK(pi);
+
+		
+		ifp->if_opackets =
+		    mstats->tx_frames_64 +
+		    mstats->tx_frames_65_127 +
+		    mstats->tx_frames_128_255 +
+		    mstats->tx_frames_256_511 +
+		    mstats->tx_frames_512_1023 +
+		    mstats->tx_frames_1024_1518 +
+		    mstats->tx_frames_1519_max;
+		
+		ifp->if_ipackets =
+		    mstats->rx_frames_64 +
+		    mstats->rx_frames_65_127 +
+		    mstats->rx_frames_128_255 +
+		    mstats->rx_frames_256_511 +
+		    mstats->rx_frames_512_1023 +
+		    mstats->rx_frames_1024_1518 +
+		    mstats->rx_frames_1519_max;
+
+		ifp->if_obytes = mstats->tx_octets;
+		ifp->if_ibytes = mstats->rx_octets;
+		ifp->if_omcasts = mstats->tx_mcast_frames;
+		ifp->if_imcasts = mstats->rx_mcast_frames;
+		
+		ifp->if_collisions =
+		    mstats->tx_total_collisions;
+
+		ifp->if_iqdrops = mstats->rx_cong_drops;
+		
+		ifp->if_oerrors =
+		    mstats->tx_excess_collisions +
+		    mstats->tx_underrun +
+		    mstats->tx_len_errs +
+		    mstats->tx_mac_internal_errs +
+		    mstats->tx_excess_deferral +
+		    mstats->tx_fcs_errs;
+		ifp->if_ierrors =
+		    mstats->rx_jabber +
+		    mstats->rx_data_errs +
+		    mstats->rx_sequence_errs +
+		    mstats->rx_runt + 
+		    mstats->rx_too_long +
+		    mstats->rx_mac_internal_errs +
+		    mstats->rx_short +
+		    mstats->rx_fcs_errs;
 	}
 }
 

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Jun  5 17:06:28 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EDD14106573A;
	Fri,  5 Jun 2009 17:06:27 +0000 (UTC) (envelope-from gnn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B46DC8FC15;
	Fri,  5 Jun 2009 17:06:27 +0000 (UTC) (envelope-from gnn@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55H6R7s032202;
	Fri, 5 Jun 2009 17:06:27 GMT (envelope-from gnn@svn.freebsd.org)
Received: (from gnn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55H6Rvb032201;
	Fri, 5 Jun 2009 17:06:27 GMT (envelope-from gnn@svn.freebsd.org)
Message-Id: <200906051706.n55H6Rvb032201@svn.freebsd.org>
From: "George V. Neville-Neil" 
Date: Fri, 5 Jun 2009 17:06:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193523 - in stable/7/sys: . contrib/pf dev/cxgb
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 05 Jun 2009 17:06:30 -0000

Author: gnn
Date: Fri Jun  5 17:06:27 2009
New Revision: 193523
URL: http://svn.freebsd.org/changeset/base/193523

Log:
  MFC 185655
  
  Re submit code to print the part and serial number for Chelsio cards.
  The original code was accidentally removed in another commit.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Jun  5 22:23:34 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 56E32106566B;
	Fri,  5 Jun 2009 22:23:34 +0000 (UTC) (envelope-from gnn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 417F78FC13;
	Fri,  5 Jun 2009 22:23:34 +0000 (UTC) (envelope-from gnn@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55MNYMF039901;
	Fri, 5 Jun 2009 22:23:34 GMT (envelope-from gnn@svn.freebsd.org)
Received: (from gnn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55MNYUu039895;
	Fri, 5 Jun 2009 22:23:34 GMT (envelope-from gnn@svn.freebsd.org)
Message-Id: <200906052223.n55MNYUu039895@svn.freebsd.org>
From: "George V. Neville-Neil" 
Date: Fri, 5 Jun 2009 22:23:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193539 - in stable/7/sys: . conf contrib/pf
	dev/ath/ath_hal dev/cxgb dev/cxgb/common modules/cxgb/cxgb_t3fw
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 05 Jun 2009 22:23:34 -0000

Author: gnn
Date: Fri Jun  5 22:23:33 2009
New Revision: 193539
URL: http://svn.freebsd.org/changeset/base/193539

Log:
  MFC of 189643
  
  Update the Chelsio driver to the latest bits from Chelsio
  
  Firmware upgraded to 7.1.0 (from 5.0.0).
  T3C EEPROM and SRAM added; Code to update eeprom/sram fixed.
  fl_empty and rx_fifo_ovfl counters can be observed via sysctl.
  Two new cxgbtool commands to get uP logic analyzer info and uP IOQs
  Synced up with Chelsio's "common code" (as of 03/03/09)

Added:
  stable/7/sys/dev/cxgb/t3c_protocol_sram.h
     - copied unchanged from r189643, head/sys/dev/cxgb/t3c_protocol_sram.h
  stable/7/sys/dev/cxgb/t3c_tp_eeprom.h
     - copied unchanged from r189643, head/sys/dev/cxgb/t3c_tp_eeprom.h
Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/conf/kern.pre.mk
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/dev/cxgb/common/cxgb_ael1002.c
  stable/7/sys/dev/cxgb/common/cxgb_common.h
  stable/7/sys/dev/cxgb/common/cxgb_t3_cpl.h
  stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c
  stable/7/sys/dev/cxgb/common/cxgb_xgmac.c
  stable/7/sys/dev/cxgb/cxgb_adapter.h
  stable/7/sys/dev/cxgb/cxgb_ioctl.h
  stable/7/sys/dev/cxgb/cxgb_main.c
  stable/7/sys/dev/cxgb/cxgb_sge.c
  stable/7/sys/dev/cxgb/cxgb_t3fw.c
  stable/7/sys/dev/cxgb/cxgb_t3fw.h
  stable/7/sys/modules/cxgb/cxgb_t3fw/Makefile

Modified: stable/7/sys/conf/kern.pre.mk
==============================================================================
--- stable/7/sys/conf/kern.pre.mk	Fri Jun  5 22:21:10 2009	(r193538)
+++ stable/7/sys/conf/kern.pre.mk	Fri Jun  5 22:23:33 2009	(r193539)
@@ -80,6 +80,9 @@ INCLUDES+= -I$S/gnu/fs/xfs/FreeBSD -I$S/
 # ...  and OpenSolaris
 INCLUDES+= -I$S/contrib/opensolaris/compat
 
+# ... and the same for cxgb
+INCLUDES+= -I$S/dev/cxgb
+
 .endif
 
 CFLAGS=	${COPTFLAGS} ${C_DIALECT} ${DEBUG} ${CWARNFLAGS}

Modified: stable/7/sys/dev/cxgb/common/cxgb_ael1002.c
==============================================================================
--- stable/7/sys/dev/cxgb/common/cxgb_ael1002.c	Fri Jun  5 22:21:10 2009	(r193538)
+++ stable/7/sys/dev/cxgb/common/cxgb_ael1002.c	Fri Jun  5 22:23:33 2009	(r193539)
@@ -1,6 +1,6 @@
 /**************************************************************************
 
-Copyright (c) 2007-2008, Chelsio Inc.
+Copyright (c) 2007-2009, Chelsio Inc.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -64,7 +64,17 @@ enum {
 enum { edc_none, edc_sr, edc_twinax };
 
 /* PHY module I2C device address */
-#define MODULE_DEV_ADDR 0xa0
+enum {
+	MODULE_DEV_ADDR	= 0xa0,
+	SFF_DEV_ADDR	= 0xa2,
+};
+
+/* PHY transceiver type */
+enum {
+	phy_transtype_unknown = 0,
+	phy_transtype_sfp     = 3,
+	phy_transtype_xfp     = 6,
+};		
 
 #define AEL2005_MODDET_IRQ 4
 
@@ -75,73 +85,7 @@ struct reg_val {
 	unsigned short set_bits;
 };
 
-static int ael2005_i2c_rd(struct cphy *phy, int dev_addr, int word_addr);
-
-static int get_module_type (struct cphy *phy, int hint)
-{
-	int v;
-
-	v = hint ? hint : ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 0);
-	if (v < 0)
-		return v;
-
-	if (v == 0x3) {
-		/* SFP: see SFF-8472 for below */
-		v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 3);
-		if (v < 0)
-			return v;
-
-		if (v == 0x1)
-			return phy_modtype_twinax;
-		if (v == 0x10)
-			return phy_modtype_sr;
-		if (v == 0x20)
-			return phy_modtype_lr;
-		if (v == 0x40)
-			return phy_modtype_lrm;
-
-		v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 6);
-		if (v < 0)
-			return v;
-		if (v != 4)
-			return phy_modtype_unknown;
-
-		v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 10);
-		if (v < 0)
-			return v;
-
-		if (v & 0x80) {
-			v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 0x12);
-			if (v < 0)
-				return v;
-			return v > 10 ? phy_modtype_twinax_long :
-			    phy_modtype_twinax;
-		}
-	} else if (v == 0x6) {
-		/* XFP: See INF-8077i for details. */
-
-		v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 127);
-		if (v < 0)
-			return v;
-
-		if (v != 1) {
-			/* XXX: set page select to table 1 yourself */
-			return phy_modtype_unknown;
-		}
-
-		v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 131);
-		if (v < 0)
-			return v;
-		if (v == 0x10)
-			return phy_modtype_lrm;
-		if (v == 0x40)
-			return phy_modtype_lr;
-		if (v == 0x80)
-			return phy_modtype_sr;
-	}
-
-	return phy_modtype_unknown;
-}
+static int get_module_type(struct cphy *phy);
 
 static int set_phy_regs(struct cphy *phy, const struct reg_val *rv)
 {
@@ -168,6 +112,110 @@ static void ael100x_txon(struct cphy *ph
 	msleep(30);
 }
 
+static int ael_i2c_rd(struct cphy *phy, int dev_addr, int word_addr)
+{
+	int i, err;
+	unsigned int stat, data;
+
+	err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL_I2C_CTRL,
+			 (dev_addr << 8) | (1 << 8) | word_addr);
+	if (err)
+		return err;
+
+	for (i = 0; i < 200; i++) {
+		msleep(1);
+		err = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL_I2C_STAT, &stat);
+		if (err)
+			return err;
+		if ((stat & 3) == 1) {
+			err = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL_I2C_DATA,
+					&data);
+			if (err)
+				return err;
+			return data >> 8;
+		}
+	}
+	CH_WARN(phy->adapter, "PHY %u I2C read of addr %u timed out\n",
+		phy->addr, word_addr);
+	return -ETIMEDOUT;
+}
+
+static int ael_i2c_wr(struct cphy *phy, int dev_addr, int word_addr, int data)
+{
+	int i, err;
+	unsigned int stat;
+
+	err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL_I2C_DATA, data);
+	if (err)
+		return err;
+
+	err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL_I2C_CTRL,
+			 (dev_addr << 8) | word_addr);
+	if (err)
+		return err;
+
+	for (i = 0; i < 200; i++) {
+		msleep(1);
+		err = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL_I2C_STAT, &stat);
+		if (err)
+			return err;
+		if ((stat & 3) == 1)
+			return 0;
+	}
+	CH_WARN(phy->adapter, "PHY %u I2C Write of addr %u timed out\n",
+		phy->addr, word_addr);
+	return -ETIMEDOUT;
+}
+
+static int get_phytrans_type(struct cphy *phy)
+{
+	int v;
+
+	v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 0);
+	if (v < 0)
+		return phy_transtype_unknown;
+
+	return v;
+}
+
+static int ael_laser_down(struct cphy *phy, int enable)
+{
+	int v, dev_addr;
+
+	v = get_phytrans_type(phy);
+	if (v < 0)
+		return v;
+
+	if (v == phy_transtype_sfp) {
+		/* Check SFF Soft TX disable is supported */
+		v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 93);
+		if (v < 0)
+			return v;
+
+		v &= 0x40;
+		if (!v)
+			return v;
+
+		dev_addr = SFF_DEV_ADDR;	
+	} else if (v == phy_transtype_xfp)
+		dev_addr = MODULE_DEV_ADDR;
+	else
+		return v;
+
+	v = ael_i2c_rd(phy, dev_addr, 110);
+	if (v < 0)
+		return v;
+
+	if (enable)
+		v |= 0x40;
+	else
+		v &= ~0x40;
+
+	v = ael_i2c_wr(phy, dev_addr, 110, v);
+
+	return v;
+}
+
 static int ael1002_power_down(struct cphy *phy, int enable)
 {
 	int err;
@@ -186,9 +234,9 @@ static int ael1002_get_module_type(struc
 	if (delay_ms)
 		msleep(delay_ms);
 
-	v = ael2005_i2c_rd(phy, MODULE_DEV_ADDR, 0);
+	v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 0);
 
-	return v == -ETIMEDOUT ? phy_modtype_none : get_module_type(phy, v);
+	return v == -ETIMEDOUT ? phy_modtype_none : get_module_type(phy);
 }
 
 static int ael1002_reset(struct cphy *phy, int wait)
@@ -277,6 +325,7 @@ int t3_ael1002_phy_prep(struct cphy *phy
 		  SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE,
 		  "10GBASE-R");
 	ael100x_txon(phy);
+	ael_laser_down(phy, 0);
 
 	err = ael1002_get_module_type(phy, 0);
 	if (err >= 0)
@@ -287,31 +336,38 @@ int t3_ael1002_phy_prep(struct cphy *phy
 
 static int ael1006_reset(struct cphy *phy, int wait)
 {
-	u32 gpio_out;
-	t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait);
-	/* Hack to reset the phy correctly */
-	/* Read out the current value */
-	gpio_out = t3_read_reg(phy->adapter, A_T3DBG_GPIO_EN);
-	/* Reset the phy */
-	gpio_out &= ~F_GPIO6_OUT_VAL;
-	t3_write_reg(phy->adapter, A_T3DBG_GPIO_EN, gpio_out); 
+	int err;
+
+	err = t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait);
+	if (err)
+		return err;
+
+	t3_set_reg_field(phy->adapter, A_T3DBG_GPIO_EN, 
+			 F_GPIO6_OUT_VAL, 0);
+
+	msleep(125);
+
+	t3_set_reg_field(phy->adapter, A_T3DBG_GPIO_EN, 
+			 F_GPIO6_OUT_VAL, F_GPIO6_OUT_VAL);
+
+	msleep(125);
+
+	err = t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait);
+	if (err)
+		return err;
+
 	msleep(125);
-	/* Take the phy out of reset */
-	gpio_out |= F_GPIO6_OUT_VAL;
-	t3_write_reg(phy->adapter, A_T3DBG_GPIO_EN, gpio_out);
+
+	err = t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 1, 1);
+	if (err)
+		return err;
+	
 	msleep(125);
-	t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait);
 
-       /* Phy loopback work around for ael1006 */
-       /* Soft reset phy by toggling loopback  */
-       msleep(125);
-       /* Put phy into local loopback */
-       t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 0, 1);
-       msleep(125);
-       /* Take phy out of local loopback */
-       t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 1, 0);
+	err = t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 1, 0);
 
-	return 0;
+	return err;
+	   
 }
 
 static int ael1006_power_down(struct cphy *phy, int enable)
@@ -1051,53 +1107,71 @@ static int ael2005_setup_twinax_edc(stru
 	return err;
 }
 
-static int ael2005_i2c_rd(struct cphy *phy, int dev_addr, int word_addr)
+static int get_module_type(struct cphy *phy)
 {
-	int i, err;
-	unsigned int stat, data;
+	int v;
 
-	err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL_I2C_CTRL,
-			 (dev_addr << 8) | (1 << 8) | word_addr);
-	if (err)
-		return err;
+	v = get_phytrans_type(phy);
+	if (v == phy_transtype_sfp) {
+		/* SFP: see SFF-8472 for below */
 
-	for (i = 0; i < 5; i++) {
-		msleep(1);
-		err = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL_I2C_STAT, &stat);
-		if (err)
-			return err;
-		if ((stat & 3) == 1) {
-			err = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL_I2C_DATA,
-					&data);
-			if (err)
-				return err;
-			return data >> 8;
-		}
-	}
-	CH_WARN(phy->adapter, "PHY %u I2C read of addr %u timed out\n",
-		phy->addr, word_addr);
-	return -ETIMEDOUT;
-}
+		v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 3);
+		if (v < 0)
+			return v;
 
-static int ael2005_get_module_type(struct cphy *phy, int delay_ms)
-{
-	int v;
-	unsigned int stat;
+		if (v == 0x1)
+			return phy_modtype_twinax;
+		if (v == 0x10)
+			return phy_modtype_sr;
+		if (v == 0x20)
+			return phy_modtype_lr;
+		if (v == 0x40)
+			return phy_modtype_lrm;
 
-	v = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL2005_GPIO_CTRL, &stat);
-	if (v)
-		return v;
+		v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 6);
+		if (v < 0)
+			return v;
+		if (v != 4)
+			return phy_modtype_unknown;
 
-	if (stat & (1 << 8))			/* module absent */
-		return phy_modtype_none;
+		v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 10);
+		if (v < 0)
+			return v;
 
-	if (delay_ms)
-		msleep(delay_ms);
+		if (v & 0x80) {
+			v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 0x12);
+			if (v < 0)
+				return v;
+			return v > 10 ? phy_modtype_twinax_long :
+			    phy_modtype_twinax;
+		}
+	} else if (v == phy_transtype_xfp) {
+		/* XFP: See INF-8077i for details. */
+
+		v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 127);
+		if (v < 0)
+			return v;
+
+		if (v != 1) {
+			/* XXX: set page select to table 1 yourself */
+			return phy_modtype_unknown;
+		}
 
-	return get_module_type(phy, 0);
+		v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 131);
+		if (v < 0)
+			return v;
+		if (v == 0x10)
+			return phy_modtype_lrm;
+		if (v == 0x40)
+			return phy_modtype_lr;
+		if (v == 0x80)
+			return phy_modtype_sr;
+	}
 
+	return phy_modtype_unknown;
 }
 
+
 static int ael2005_intr_enable(struct cphy *phy)
 {
 	int err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL2005_GPIO_CTRL, 0x200);
@@ -1116,6 +1190,24 @@ static int ael2005_intr_clear(struct cph
 	return err ? err : t3_phy_lasi_intr_clear(phy);
 }
 
+static int ael2005_get_module_type(struct cphy *phy, int delay_ms)
+{
+	int v;
+	unsigned int stat;
+
+	v = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL2005_GPIO_CTRL, &stat);
+	if (v)
+		return v;
+
+	if (stat & (1 << 8))			/* module absent */
+		return phy_modtype_none;
+
+	if (delay_ms)
+		msleep(delay_ms);
+
+	return get_module_type(phy);
+}
+
 static int ael2005_reset(struct cphy *phy, int wait)
 {
 	static struct reg_val regs0[] = {
@@ -1211,7 +1303,13 @@ static int ael2005_intr_handler(struct c
 	}
 
 	ret = t3_phy_lasi_intr_handler(phy);
-	return ret < 0 ? ret : ret + cause;
+	if (ret < 0)
+		return ret;
+
+	ret |= cause;
+	if (!ret)
+		ret |= cphy_cause_link_change;
+	return ret;
 }
 
 #ifdef C99_NOT_SUPPORTED
@@ -1249,6 +1347,7 @@ int t3_ael2005_phy_prep(struct cphy *phy
 		  SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE |
 		  SUPPORTED_IRQ, "10GBASE-R");
 	msleep(125);
+	ael_laser_down(phy, 0);
 
 	err = ael2005_get_module_type(phy, 0);
 	if (err >= 0)
@@ -1339,7 +1438,7 @@ static int xaui_direct_get_link_status(s
 {
 	if (link_ok) {
 		unsigned int status;
-		
+
 		status = t3_read_reg(phy->adapter,
 				     XGM_REG(A_XGM_SERDES_STAT0, phy->addr)) |
 			 t3_read_reg(phy->adapter,

Modified: stable/7/sys/dev/cxgb/common/cxgb_common.h
==============================================================================
--- stable/7/sys/dev/cxgb/common/cxgb_common.h	Fri Jun  5 22:21:10 2009	(r193538)
+++ stable/7/sys/dev/cxgb/common/cxgb_common.h	Fri Jun  5 22:23:33 2009	(r193539)
@@ -1,6 +1,6 @@
 /**************************************************************************
 
-Copyright (c) 2007-2008, Chelsio Inc.
+Copyright (c) 2007-2009, Chelsio Inc.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -96,12 +96,22 @@ enum {
 	    (((x) >> S_TP_VERSION_MICRO) & M_TP_VERSION_MICRO)
 
 enum {
-	FW_VERSION_MAJOR = 5,
-	FW_VERSION_MINOR = 0,
+	FW_VERSION_MAJOR = 7,
+	FW_VERSION_MINOR = 1,
 	FW_VERSION_MICRO = 0
 };
 
 enum {
+	LA_CTRL = 0x80,
+	LA_DATA = 0x84,
+	LA_ENTRIES = 512
+};
+
+enum {
+	IOQ_ENTRIES = 7
+};
+
+enum {
 	SGE_QSETS = 8,            /* # of SGE Tx/Rx/RspQ sets */
 	SGE_RXQ_PER_SET = 2,      /* # of Rx queues per set */
 	SGE_TXQ_PER_SET = 3       /* # of Tx queues per set */
@@ -147,8 +157,6 @@ struct adapter_info {
 	unsigned char          nports0;        /* # of ports on channel 0 */
 	unsigned char          nports1;        /* # of ports on channel 1 */
 	unsigned char          phy_base_addr;  /* MDIO PHY base address */
-	unsigned char          mdien:1;
-	unsigned char          mdiinv:1;
 	unsigned int           gpio_out;       /* GPIO output settings */
 	unsigned char gpio_intr[MAX_PHYINTRS]; /* GPIO PHY IRQ pins */
 	unsigned long          caps;           /* adapter capabilities */
@@ -235,6 +243,8 @@ struct mac_stats {
 
 	unsigned long num_toggled; /* # times toggled TxEn due to stuck TX */
 	unsigned long num_resets;  /* # times reset due to stuck TX */
+
+	unsigned long link_faults;  /* # detected link faults */
 };
 
 struct tp_mib_stats {
@@ -349,6 +359,14 @@ struct vpd_params {
 	unsigned short xauicfg[2];
 };
 
+struct generic_vpd {
+	u32 offset;
+	u32 len;
+	u8 *data;
+};
+
+enum { MAX_VPD_BYTES = 32000 };
+
 struct pci_params {
 	unsigned int   vpd_cap_addr;
 	unsigned int   pcie_cap_addr;
@@ -682,6 +700,8 @@ int t3_phy_lasi_intr_handler(struct cphy
 void t3_intr_enable(adapter_t *adapter);
 void t3_intr_disable(adapter_t *adapter);
 void t3_intr_clear(adapter_t *adapter);
+void t3_xgm_intr_enable(adapter_t *adapter, int idx);
+void t3_xgm_intr_disable(adapter_t *adapter, int idx);
 void t3_port_intr_enable(adapter_t *adapter, int idx);
 void t3_port_intr_disable(adapter_t *adapter, int idx);
 void t3_port_intr_clear(adapter_t *adapter, int idx);
@@ -689,29 +709,34 @@ int t3_slow_intr_handler(adapter_t *adap
 int t3_phy_intr_handler(adapter_t *adapter);
 
 void t3_link_changed(adapter_t *adapter, int port_id);
+void t3_link_fault(adapter_t *adapter, int port_id);
 int t3_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc);
 const struct adapter_info *t3_get_adapter_info(unsigned int board_id);
 int t3_seeprom_read(adapter_t *adapter, u32 addr, u32 *data);
 int t3_seeprom_write(adapter_t *adapter, u32 addr, u32 data);
 int t3_seeprom_wp(adapter_t *adapter, int enable);
+int t3_get_vpd_len(adapter_t *adapter, struct generic_vpd *vpd);
+int t3_read_vpd(adapter_t *adapter, struct generic_vpd *vpd);
 int t3_read_flash(adapter_t *adapter, unsigned int addr, unsigned int nwords,
 		  u32 *data, int byte_oriented);
 int t3_get_tp_version(adapter_t *adapter, u32 *vers);
-int t3_check_tpsram_version(adapter_t *adapter, int *must_load);
+int t3_check_tpsram_version(adapter_t *adapter);
 int t3_check_tpsram(adapter_t *adapter, const u8 *tp_ram, unsigned int size);
 int t3_load_fw(adapter_t *adapter, const u8 *fw_data, unsigned int size);
 int t3_get_fw_version(adapter_t *adapter, u32 *vers);
-int t3_check_fw_version(adapter_t *adapter, int *must_load);
+int t3_check_fw_version(adapter_t *adapter);
 int t3_load_boot(adapter_t *adapter, u8 *fw_data, unsigned int size);
 int t3_init_hw(adapter_t *adapter, u32 fw_params);
 void mac_prep(struct cmac *mac, adapter_t *adapter, int index);
 void early_hw_init(adapter_t *adapter, const struct adapter_info *ai);
+int t3_reset_adapter(adapter_t *adapter);
 int t3_prep_adapter(adapter_t *adapter, const struct adapter_info *ai, int reset);
 int t3_reinit_adapter(adapter_t *adap);
 void t3_led_ready(adapter_t *adapter);
 void t3_fatal_err(adapter_t *adapter);
 void t3_set_vlan_accel(adapter_t *adapter, unsigned int ports, int on);
 void t3_enable_filters(adapter_t *adap);
+void t3_disable_filters(adapter_t *adap);
 void t3_tp_set_offload_mode(adapter_t *adap, int enable);
 void t3_config_rss(adapter_t *adapter, unsigned int rss_config, const u8 *cpus,
 		   const u16 *rspq);
@@ -728,6 +753,8 @@ int t3_mc7_bd_read(struct mc7 *mc7, unsi
 
 int t3_mac_reset(struct cmac *mac);
 void t3b_pcs_reset(struct cmac *mac);
+void t3_mac_disable_exact_filters(struct cmac *mac);
+void t3_mac_enable_exact_filters(struct cmac *mac);
 int t3_mac_enable(struct cmac *mac, int which);
 int t3_mac_disable(struct cmac *mac, int which);
 int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu);
@@ -758,6 +785,8 @@ void t3_get_cong_cntl_tab(adapter_t *ada
 			  unsigned short incr[NMTUS][NCCTRL_WIN]);
 void t3_config_trace_filter(adapter_t *adapter, const struct trace_params *tp,
 			    int filter_index, int invert, int enable);
+void t3_query_trace_filter(adapter_t *adapter, struct trace_params *tp,
+			   int filter_index, int *inverted, int *enabled);
 int t3_config_sched(adapter_t *adap, unsigned int kbps, int sched);
 int t3_set_sched_ipg(adapter_t *adap, int sched, unsigned int ipg);
 void t3_get_tx_sched(adapter_t *adap, unsigned int sched, unsigned int *kbps,
@@ -767,6 +796,10 @@ void t3_set_pace_tbl(adapter_t *adap, un
 		     unsigned int start, unsigned int n);
 #endif
 
+int t3_get_up_la(adapter_t *adapter, u32 *stopped, u32 *index,
+		 u32 *size, void *data);
+int t3_get_up_ioqs(adapter_t *adapter, u32 *size, void *data);
+
 void t3_sge_prep(adapter_t *adap, struct sge_params *p);
 void t3_sge_init(adapter_t *adap, struct sge_params *p);
 int t3_sge_init_ecntxt(adapter_t *adapter, unsigned int id, int gts_enable,
@@ -803,6 +836,11 @@ int t3_vsc7323_enable(adapter_t *adap, i
 int t3_vsc7323_disable(adapter_t *adap, int port, int which);
 const struct mac_stats *t3_vsc7323_update_stats(struct cmac *mac);
 
+int t3_mi1_read(adapter_t *adapter, int phy_addr, int mmd_addr, int reg_addr,
+		unsigned int *valp);
+int t3_mi1_write(adapter_t *adapter, int phy_addr, int mmd_addr, int reg_addr,
+		 unsigned int val);
+
 int t3_mv88e1xxx_phy_prep(struct cphy *phy, adapter_t *adapter, int phy_addr,
 			  const struct mdio_ops *mdio_ops);
 int t3_vsc8211_phy_prep(struct cphy *phy, adapter_t *adapter, int phy_addr,

Modified: stable/7/sys/dev/cxgb/common/cxgb_t3_cpl.h
==============================================================================
--- stable/7/sys/dev/cxgb/common/cxgb_t3_cpl.h	Fri Jun  5 22:21:10 2009	(r193538)
+++ stable/7/sys/dev/cxgb/common/cxgb_t3_cpl.h	Fri Jun  5 22:23:33 2009	(r193539)
@@ -1,6 +1,6 @@
 /**************************************************************************
 
-Copyright (c) 2007, Chelsio Inc.
+Copyright (c) 2007-2009 Chelsio Inc.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -273,6 +273,14 @@ struct work_request_hdr {
 #define V_WR_FLUSH(x)	((x) << S_WR_FLUSH)
 #define F_WR_FLUSH	V_WR_FLUSH(1U)
 
+#define S_WR_CHN	18
+#define V_WR_CHN(x)	((x) << S_WR_CHN)
+#define F_WR_CHN	V_WR_CHN(1U)
+
+#define S_WR_CHN_VLD	19
+#define V_WR_CHN_VLD(x)	((x) << S_WR_CHN_VLD)
+#define F_WR_CHN_VLD	V_WR_CHN_VLD(1U)
+
 #define S_WR_DATATYPE    20
 #define V_WR_DATATYPE(x) ((x) << S_WR_DATATYPE)
 #define F_WR_DATATYPE    V_WR_DATATYPE(1U)

Modified: stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c
==============================================================================
--- stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c	Fri Jun  5 22:21:10 2009	(r193538)
+++ stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c	Fri Jun  5 22:23:33 2009	(r193539)
@@ -1,6 +1,6 @@
 /**************************************************************************
 
-Copyright (c) 2007, Chelsio Inc.
+Copyright (c) 2007-2009, Chelsio Inc.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -197,21 +197,18 @@ int t3_mc7_bd_read(struct mc7 *mc7, unsi
 static void mi1_init(adapter_t *adap, const struct adapter_info *ai)
 {
         u32 clkdiv = adap->params.vpd.cclk / (2 * adap->params.vpd.mdc) - 1;
-        u32 val = F_PREEN | V_MDIINV(ai->mdiinv) | V_MDIEN(ai->mdien) |
-		  V_CLKDIV(clkdiv);
+        u32 val = F_PREEN | V_CLKDIV(clkdiv);
 
-	if (!(ai->caps & SUPPORTED_10000baseT_Full))
-		val |= V_ST(1);
         t3_write_reg(adap, A_MI1_CFG, val);
 }
 
 #define MDIO_ATTEMPTS 20
 
 /*
- * MI1 read/write operations for direct-addressed PHYs.
+ * MI1 read/write operations for clause 22 PHYs.
  */
-static int mi1_read(adapter_t *adapter, int phy_addr, int mmd_addr,
-		    int reg_addr, unsigned int *valp)
+int t3_mi1_read(adapter_t *adapter, int phy_addr, int mmd_addr,
+		int reg_addr, unsigned int *valp)
 {
 	int ret;
 	u32 addr = V_REGADDR(reg_addr) | V_PHYADDR(phy_addr);
@@ -220,6 +217,7 @@ static int mi1_read(adapter_t *adapter, 
 		return -EINVAL;
 
 	MDIO_LOCK(adapter);
+	t3_set_reg_field(adapter, A_MI1_CFG, V_ST(M_ST), V_ST(1));
 	t3_write_reg(adapter, A_MI1_ADDR, addr);
 	t3_write_reg(adapter, A_MI1_OP, V_MDI_OP(2));
 	ret = t3_wait_op_done(adapter, A_MI1_OP, F_BUSY, 0, MDIO_ATTEMPTS, 10);
@@ -229,8 +227,8 @@ static int mi1_read(adapter_t *adapter, 
 	return ret;
 }
 
-static int mi1_write(adapter_t *adapter, int phy_addr, int mmd_addr,
-		     int reg_addr, unsigned int val)
+int t3_mi1_write(adapter_t *adapter, int phy_addr, int mmd_addr,
+		 int reg_addr, unsigned int val)
 {
 	int ret;
 	u32 addr = V_REGADDR(reg_addr) | V_PHYADDR(phy_addr);
@@ -239,6 +237,7 @@ static int mi1_write(adapter_t *adapter,
 		return -EINVAL;
 
 	MDIO_LOCK(adapter);
+	t3_set_reg_field(adapter, A_MI1_CFG, V_ST(M_ST), V_ST(1));
 	t3_write_reg(adapter, A_MI1_ADDR, addr);
 	t3_write_reg(adapter, A_MI1_DATA, val);
 	t3_write_reg(adapter, A_MI1_OP, V_MDI_OP(1));
@@ -248,12 +247,12 @@ static int mi1_write(adapter_t *adapter,
 }
 
 static struct mdio_ops mi1_mdio_ops = {
-	mi1_read,
-	mi1_write
+	t3_mi1_read,
+	t3_mi1_write
 };
 
 /*
- * MI1 read/write operations for indirect-addressed PHYs.
+ * MI1 read/write operations for clause 45 PHYs.
  */
 static int mi1_ext_read(adapter_t *adapter, int phy_addr, int mmd_addr,
 			int reg_addr, unsigned int *valp)
@@ -262,6 +261,7 @@ static int mi1_ext_read(adapter_t *adapt
 	u32 addr = V_REGADDR(mmd_addr) | V_PHYADDR(phy_addr);
 
 	MDIO_LOCK(adapter);
+	t3_set_reg_field(adapter, A_MI1_CFG, V_ST(M_ST), 0);
 	t3_write_reg(adapter, A_MI1_ADDR, addr);
 	t3_write_reg(adapter, A_MI1_DATA, reg_addr);
 	t3_write_reg(adapter, A_MI1_OP, V_MDI_OP(0));
@@ -284,6 +284,7 @@ static int mi1_ext_write(adapter_t *adap
 	u32 addr = V_REGADDR(mmd_addr) | V_PHYADDR(phy_addr);
 
 	MDIO_LOCK(adapter);
+	t3_set_reg_field(adapter, A_MI1_CFG, V_ST(M_ST), 0);
 	t3_write_reg(adapter, A_MI1_ADDR, addr);
 	t3_write_reg(adapter, A_MI1_DATA, reg_addr);
 	t3_write_reg(adapter, A_MI1_OP, V_MDI_OP(0));
@@ -488,32 +489,32 @@ int t3_phy_lasi_intr_handler(struct cphy
 }
 
 static struct adapter_info t3_adap_info[] = {
-	{ 1, 1, 0, 0, 0,
+	{ 1, 1, 0,
 	  F_GPIO2_OEN | F_GPIO4_OEN |
 	  F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, { S_GPIO3, S_GPIO5 }, 0,
 	  &mi1_mdio_ops, "Chelsio PE9000" },
-	{ 1, 1, 0, 0, 0,
+	{ 1, 1, 0,
 	  F_GPIO2_OEN | F_GPIO4_OEN |
 	  F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, { S_GPIO3, S_GPIO5 }, 0,
 	  &mi1_mdio_ops, "Chelsio T302" },
-	{ 1, 0, 0, 0, 0,
+	{ 1, 0, 0,
 	  F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN |
 	  F_GPIO11_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL,
 	  { 0 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
 	  &mi1_mdio_ext_ops, "Chelsio T310" },
-	{ 1, 1, 0, 0, 0,
+	{ 1, 1, 0,
 	  F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN |
 	  F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL |
 	  F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL,
 	  { S_GPIO9, S_GPIO3 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
 	  &mi1_mdio_ext_ops, "Chelsio T320" },
-	{ 4, 0, 0, 0, 0,
+	{ 4, 0, 0,
 	  F_GPIO5_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO5_OUT_VAL |
 	  F_GPIO6_OUT_VAL | F_GPIO7_OUT_VAL,
 	  { S_GPIO1, S_GPIO2, S_GPIO3, S_GPIO4 }, SUPPORTED_AUI,
 	  &mi1_mdio_ops, "Chelsio T304" },
 	{ 0 },
-	{ 1, 0, 0, 0, 0,
+	{ 1, 0, 0,
 	  F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO6_OEN | F_GPIO7_OEN |
 	  F_GPIO10_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL,
 	  { S_GPIO9 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
@@ -750,16 +751,17 @@ enum {
 	SF_ERASE_SECTOR = 0xd8,    /* erase sector */
 
 	FW_FLASH_BOOT_ADDR = 0x70000, /* start address of FW in flash */
-	OLD_FW_VERS_ADDR = 0x77ffc,   /* flash address holding FW version */
 	FW_VERS_ADDR = 0x7fffc,    /* flash address holding FW version */
+	FW_VERS_ADDR_PRE8 = 0x77ffc,/* flash address holding FW version pre8 */
 	FW_MIN_SIZE = 8,           /* at least version and csum */
 	FW_MAX_SIZE = FW_VERS_ADDR - FW_FLASH_BOOT_ADDR,
+	FW_MAX_SIZE_PRE8 = FW_VERS_ADDR_PRE8 - FW_FLASH_BOOT_ADDR,
 
 	BOOT_FLASH_BOOT_ADDR = 0x0,/* start address of boot image in flash */
 	BOOT_SIGNATURE = 0xaa55,   /* signature of BIOS boot ROM */
 	BOOT_SIZE_INC = 512,       /* image size measured in 512B chunks */
 	BOOT_MIN_SIZE = sizeof(boot_header_t), /* at least basic header */
-	BOOT_MAX_SIZE = 0xff*BOOT_SIZE_INC /* 1 byte * length increment  */
+	BOOT_MAX_SIZE = 1024*BOOT_SIZE_INC /* 1 byte * length increment  */
 };
 
 /**
@@ -888,7 +890,7 @@ int t3_read_flash(adapter_t *adapter, un
  *	at the given address.
  *	If @byte_oriented is set the write data is stored as a 32-bit
  *	big-endian array, otherwise in the processor's native endianess.
- *	
+ *
  */
 static int t3_write_flash(adapter_t *adapter, unsigned int addr,
 			  unsigned int n, const u8 *data,
@@ -949,7 +951,7 @@ int t3_get_tp_version(adapter_t *adapter
 			      1, 1, 5, 1);
 	if (ret)
 		return ret;
-	
+
 	*vers = t3_read_reg(adapter, A_TP_EMBED_OP_FIELD1);
 
 	return 0;
@@ -960,7 +962,7 @@ int t3_get_tp_version(adapter_t *adapter
  *	@adapter: the adapter
  *
  */
-int t3_check_tpsram_version(adapter_t *adapter, int *must_load)
+int t3_check_tpsram_version(adapter_t *adapter)
 {
 	int ret;
 	u32 vers;
@@ -969,26 +971,19 @@ int t3_check_tpsram_version(adapter_t *a
 	if (adapter->params.rev == T3_REV_A)
 		return 0;
 
-	*must_load = 1;
 
 	ret = t3_get_tp_version(adapter, &vers);
 	if (ret)
 		return ret;
-	
+
 	vers = t3_read_reg(adapter, A_TP_EMBED_OP_FIELD1);
 
 	major = G_TP_VERSION_MAJOR(vers);
 	minor = G_TP_VERSION_MINOR(vers);
 
-	if (major == TP_VERSION_MAJOR && minor == TP_VERSION_MINOR) 
+	if (major == TP_VERSION_MAJOR && minor == TP_VERSION_MINOR)
 		return 0;
-
-	if (major != TP_VERSION_MAJOR)
-		CH_ERR(adapter, "found wrong TP version (%u.%u), "
-		       "driver needs version %d.%d\n", major, minor,
-		       TP_VERSION_MAJOR, TP_VERSION_MINOR);
 	else {
-		*must_load = 0;
 		CH_ERR(adapter, "found wrong TP version (%u.%u), "
 		       "driver compiled for version %d.%d\n", major, minor,
 		       TP_VERSION_MAJOR, TP_VERSION_MINOR);
@@ -997,7 +992,7 @@ int t3_check_tpsram_version(adapter_t *a
 }
 
 /**
- *	t3_check_tpsram - check if provided protocol SRAM 
+ *	t3_check_tpsram - check if provided protocol SRAM
  *			  is compatible with this driver
  *	@adapter: the adapter
  *	@tp_sram: the firmware image to write
@@ -1034,16 +1029,17 @@ enum fw_version_type {
  *	@adapter: the adapter
  *	@vers: where to place the version
  *
- *	Reads the FW version from flash.
+ *	Reads the FW version from flash. Note that we had to move the version
+ *	due to FW size. If we don't find a valid FW version in the new location
+ *	we fall back and read the old location.
  */
 int t3_get_fw_version(adapter_t *adapter, u32 *vers)
 {
 	int ret = t3_read_flash(adapter, FW_VERS_ADDR, 1, vers, 0);
-
 	if (!ret && *vers != 0xffffffff)
 		return 0;
 	else
-		return t3_read_flash(adapter, OLD_FW_VERS_ADDR, 1, vers, 0);
+		return t3_read_flash(adapter, FW_VERS_ADDR_PRE8, 1, vers, 0);
 }
 
 /**
@@ -1053,13 +1049,12 @@ int t3_get_fw_version(adapter_t *adapter
  *	Checks if an adapter's FW is compatible with the driver.  Returns 0
  *	if the versions are compatible, a negative error otherwise.
  */
-int t3_check_fw_version(adapter_t *adapter, int *must_load)
+int t3_check_fw_version(adapter_t *adapter)
 {
 	int ret;
 	u32 vers;
 	unsigned int type, major, minor;
 
-	*must_load = 1;
 	ret = t3_get_fw_version(adapter, &vers);
 	if (ret)
 		return ret;
@@ -1072,16 +1067,11 @@ int t3_check_fw_version(adapter_t *adapt
 	    minor == FW_VERSION_MINOR)
 		return 0;
 
-	if (major != FW_VERSION_MAJOR)
-		CH_ERR(adapter, "found wrong FW version(%u.%u), "
-		       "driver needs version %u.%u\n", major, minor,
-		       FW_VERSION_MAJOR, FW_VERSION_MINOR);
-	else if ((int)minor < FW_VERSION_MINOR) {
-		*must_load = 0;
+	else if (major != FW_VERSION_MAJOR || minor < FW_VERSION_MINOR)
 		CH_WARN(adapter, "found old FW minor version(%u.%u), "
 		        "driver compiled for version %u.%u\n", major, minor,
 			FW_VERSION_MAJOR, FW_VERSION_MINOR);
-	} else {
+	else {
 		CH_WARN(adapter, "found newer FW version(%u.%u), "
 		        "driver compiled for version %u.%u\n", major, minor,
 			FW_VERSION_MAJOR, FW_VERSION_MINOR);
@@ -1126,7 +1116,7 @@ static int t3_flash_erase_sectors(adapte
  */
 int t3_load_fw(adapter_t *adapter, const u8 *fw_data, unsigned int size)
 {
-	u32 csum;
+	u32 version, csum, fw_version_addr;
 	unsigned int i;
 	const u32 *p = (const u32 *)fw_data;
 	int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16;
@@ -1136,6 +1126,16 @@ int t3_load_fw(adapter_t *adapter, const
 	if (size - 8 > FW_MAX_SIZE)
 		return -EFBIG;
 
+	version = ntohl(*(const u32 *)(fw_data + size - 8));
+	if (G_FW_VERSION_MAJOR(version) < 8) {
+
+		fw_version_addr = FW_VERS_ADDR_PRE8;
+
+		if (size - 8 > FW_MAX_SIZE_PRE8)
+			return -EFBIG;
+	} else
+		fw_version_addr = FW_VERS_ADDR;
+
 	for (csum = 0, i = 0; i < size / sizeof(csum); i++)
 		csum += ntohl(p[i]);
 	if (csum != 0xffffffff) {
@@ -1161,7 +1161,7 @@ int t3_load_fw(adapter_t *adapter, const
 		size -= chunk_size;
 	}
 
-	ret = t3_write_flash(adapter, FW_VERS_ADDR, 4, fw_data, 1);
+	ret = t3_write_flash(adapter, fw_version_addr, 4, fw_data, 1);
 out:
 	if (ret)
 		CH_ERR(adapter, "firmware download failed, error %d\n", ret);
@@ -1255,6 +1255,39 @@ int t3_cim_ctl_blk_read(adapter_t *adap,
 	return ret;
 }
 
+static void t3_gate_rx_traffic(struct cmac *mac, u32 *rx_cfg,
+			       u32 *rx_hash_high, u32 *rx_hash_low)
+{
+	/* stop Rx unicast traffic */
+	t3_mac_disable_exact_filters(mac);
+
+	/* stop broadcast, multicast, promiscuous mode traffic */
+	*rx_cfg = t3_read_reg(mac->adapter, A_XGM_RX_CFG);
+	t3_set_reg_field(mac->adapter, A_XGM_RX_CFG, 
+			 F_ENHASHMCAST | F_DISBCAST | F_COPYALLFRAMES,
+			 F_DISBCAST);
+
+	*rx_hash_high = t3_read_reg(mac->adapter, A_XGM_RX_HASH_HIGH);
+	t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH, 0);
+
+	*rx_hash_low = t3_read_reg(mac->adapter, A_XGM_RX_HASH_LOW);
+	t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW, 0);
+
+	/* Leave time to drain max RX fifo */
+	msleep(1);
+}
+
+static void t3_open_rx_traffic(struct cmac *mac, u32 rx_cfg,
+			       u32 rx_hash_high, u32 rx_hash_low)
+{
+	t3_mac_enable_exact_filters(mac);
+	t3_set_reg_field(mac->adapter, A_XGM_RX_CFG, 
+			 F_ENHASHMCAST | F_DISBCAST | F_COPYALLFRAMES,
+			 rx_cfg);
+	t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH, rx_hash_high);
+	t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW, rx_hash_low);
+}
+
 /**
  *	t3_link_changed - handle interface link changes

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

From owner-svn-src-stable-7@FreeBSD.ORG  Sat Jun  6 02:17:33 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 760CF106564A;
	Sat,  6 Jun 2009 02:17:33 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 626BE8FC22;
	Sat,  6 Jun 2009 02:17:33 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n562HXL5045263;
	Sat, 6 Jun 2009 02:17:33 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n562HXWt045262;
	Sat, 6 Jun 2009 02:17:33 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200906060217.n562HXWt045262@svn.freebsd.org>
From: Edwin Groothuis 
Date: Sat, 6 Jun 2009 02:17:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193561 - stable/7/usr.bin/calendar/calendars
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 06 Jun 2009 02:17:34 -0000

Author: edwin
Date: Sat Jun  6 02:17:33 2009
New Revision: 193561
URL: http://svn.freebsd.org/changeset/base/193561

Log:
  MFC of r193462:
  
  [patch] calendar.music: Chuck Berry was born in St. Louis, Missouri, not Califor
  nia
  
      The /usr/bin/calendar program reports that Chuck Berry was born
      in San Jose California but he was not born in California.
  
      Chuck Berry was born in St. Louis, Missouri in 1926 on October 18.
  
      http://www.chuckberry.com/about/bio.htm
      http://www.khaldea.com/charts/chuckberry.shtml
      http://en.wikipedia.org/wiki/Chuck_Berry
  
  PR:             conf/128215
  Submitted by:   comet--berkeley (aka Pablo Picasso) 

Modified:
  stable/7/usr.bin/calendar/calendars/   (props changed)
  stable/7/usr.bin/calendar/calendars/calendar.music

Modified: stable/7/usr.bin/calendar/calendars/calendar.music
==============================================================================
--- stable/7/usr.bin/calendar/calendars/calendar.music	Sat Jun  6 02:17:11 2009	(r193560)
+++ stable/7/usr.bin/calendar/calendars/calendar.music	Sat Jun  6 02:17:33 2009	(r193561)
@@ -182,7 +182,7 @@
 10/16	Bob Weir (Grateful Dead) is born in San Francisco, 1947
 10/17	"Hair" opens at New York's Public Theater, 1967
 10/17	Frederic Chopin dies in Paris, France, 1849
-10/18	Chuck Berry is born in San Jose, California, 1926
+10/18	Chuck Berry is born in St. Louis, Missouri, 1926
 10/20	Three members of Lynyrd Skynyrd die in a plane crash, 1977
 10/21	Jesus Christ Super Star debuted on Broadway, 1971
 10/22	Franz Liszt born, 1811

From owner-svn-src-stable-7@FreeBSD.ORG  Sat Jun  6 02:26:25 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 17AD3106566C;
	Sat,  6 Jun 2009 02:26:25 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DD4938FC14;
	Sat,  6 Jun 2009 02:26:24 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n562QO6Z045514;
	Sat, 6 Jun 2009 02:26:24 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n562QNbV045511;
	Sat, 6 Jun 2009 02:26:23 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200906060226.n562QNbV045511@svn.freebsd.org>
From: Edwin Groothuis 
Date: Sat, 6 Jun 2009 02:26:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193562 - stable/7/games/fortune/datfiles
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 06 Jun 2009 02:26:26 -0000

Author: edwin
Date: Sat Jun  6 02:26:23 2009
New Revision: 193562
URL: http://svn.freebsd.org/changeset/base/193562

Log:
  MFC of r193464, r193467
  
  [patch] fortune(6): George Bernard Shaw quote fix
  [patch] fortune(6): file not Y2.01K compliant
  
  PR:		conf/129860, conf/131469
  Submitted by:	Alan Amesbury , John Hein 

Modified:
  stable/7/games/fortune/datfiles/   (props changed)
  stable/7/games/fortune/datfiles/fortunes
  stable/7/games/fortune/datfiles/fortunes-o.real
  stable/7/games/fortune/datfiles/freebsd-tips   (props changed)

Modified: stable/7/games/fortune/datfiles/fortunes
==============================================================================
--- stable/7/games/fortune/datfiles/fortunes	Sat Jun  6 02:17:33 2009	(r193561)
+++ stable/7/games/fortune/datfiles/fortunes	Sat Jun  6 02:26:23 2009	(r193562)
@@ -48239,9 +48239,9 @@ beat their head on the keyboard.  After 
 		-- Harry Skelton
 %
 The seven deadly sins ... Food, clothing, firing, rent, taxes,
-respectability and children.  Nothing can lift those seven milestones
-from man's neck but money; and the spirit cannot soar until the
-milestones are lifted.
+respectability and children.  Nothing can lift those seven millstones
+from Man's neck but money; and the spirit cannot soar until the
+millstones are lifted.
 		-- George Bernard Shaw
 %
 The seven eyes of Ningauble the Wizard floated back to his hood as he

Modified: stable/7/games/fortune/datfiles/fortunes-o.real
==============================================================================
--- stable/7/games/fortune/datfiles/fortunes-o.real	Sat Jun  6 02:17:33 2009	(r193561)
+++ stable/7/games/fortune/datfiles/fortunes-o.real	Sat Jun  6 02:26:23 2009	(r193562)
@@ -4242,7 +4242,7 @@ Apple owners do it with mice!
 APPOINTMENT BOOK:
 	The reference of last resort when trying to duck undesired
 	invitations ("Gee, the soonest I can pencil you in is
-	December, 2009"), or when trying to figure out what the hell
+	December, 2039"), or when trying to figure out what the hell
 	it was you did during the past year.
 %
 Approximately 80% of our air pollution stems from hydrocarbons

From owner-svn-src-stable-7@FreeBSD.ORG  Sat Jun  6 10:55:12 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 05E9B106566B;
	Sat,  6 Jun 2009 10:55:12 +0000 (UTC)
	(envelope-from dchagin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DDB8C8FC12;
	Sat,  6 Jun 2009 10:55:11 +0000 (UTC)
	(envelope-from dchagin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n56AtBB9059399;
	Sat, 6 Jun 2009 10:55:11 GMT (envelope-from dchagin@svn.freebsd.org)
Received: (from dchagin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n56AtBIJ059395;
	Sat, 6 Jun 2009 10:55:11 GMT (envelope-from dchagin@svn.freebsd.org)
Message-Id: <200906061055.n56AtBIJ059395@svn.freebsd.org>
From: Dmitry Chagin 
Date: Sat, 6 Jun 2009 10:55:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193580 - in stable/7/sys: . amd64/linux32 compat/linux
	contrib/pf dev/ath/ath_hal dev/cxgb i386/linux
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 06 Jun 2009 10:55:12 -0000

Author: dchagin
Date: Sat Jun  6 10:55:11 2009
New Revision: 193580
URL: http://svn.freebsd.org/changeset/base/193580

Log:
  MFC r191876:
  To avoid excessive code duplication move MI definitions to the MI
  header file. As it is defined in Linux.
  
  Approved by:	kib (mentor)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/amd64/linux32/linux.h
  stable/7/sys/compat/linux/linux_ioctl.c
  stable/7/sys/compat/linux/linux_socket.h
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/i386/linux/linux.h

Modified: stable/7/sys/amd64/linux32/linux.h
==============================================================================
--- stable/7/sys/amd64/linux32/linux.h	Sat Jun  6 09:37:55 2009	(r193579)
+++ stable/7/sys/amd64/linux32/linux.h	Sat Jun  6 10:55:11 2009	(r193580)
@@ -663,14 +663,6 @@ union l_semun {
 #define	LINUX_SENDMSG		16
 #define	LINUX_RECVMSG		17
 
-#define	LINUX_AF_UNSPEC		0
-#define	LINUX_AF_UNIX		1
-#define	LINUX_AF_INET		2
-#define	LINUX_AF_AX25		3
-#define	LINUX_AF_IPX		4
-#define	LINUX_AF_APPLETALK	5
-#define	LINUX_AF_INET6		10
-
 #define	LINUX_SOL_SOCKET	1
 #define	LINUX_SOL_IP		0
 #define	LINUX_SOL_IPX		256

Modified: stable/7/sys/compat/linux/linux_ioctl.c
==============================================================================
--- stable/7/sys/compat/linux/linux_ioctl.c	Sat Jun  6 09:37:55 2009	(r193579)
+++ stable/7/sys/compat/linux/linux_ioctl.c	Sat Jun  6 10:55:11 2009	(r193580)
@@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 
 CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ);

Modified: stable/7/sys/compat/linux/linux_socket.h
==============================================================================
--- stable/7/sys/compat/linux/linux_socket.h	Sat Jun  6 09:37:55 2009	(r193579)
+++ stable/7/sys/compat/linux/linux_socket.h	Sat Jun  6 10:55:11 2009	(r193580)
@@ -49,4 +49,14 @@
 #define LINUX_MSG_ERRQUEUE	0x2000
 #define LINUX_MSG_NOSIGNAL	0x4000
 
+/* Supported address families */
+
+#define	LINUX_AF_UNSPEC		0
+#define	LINUX_AF_UNIX		1
+#define	LINUX_AF_INET		2
+#define	LINUX_AF_AX25		3
+#define	LINUX_AF_IPX		4
+#define	LINUX_AF_APPLETALK	5
+#define	LINUX_AF_INET6		10
+
 #endif /* _LINUX_SOCKET_H_ */

Modified: stable/7/sys/i386/linux/linux.h
==============================================================================
--- stable/7/sys/i386/linux/linux.h	Sat Jun  6 09:37:55 2009	(r193579)
+++ stable/7/sys/i386/linux/linux.h	Sat Jun  6 10:55:11 2009	(r193580)
@@ -634,14 +634,6 @@ union l_semun {
 #define	LINUX_SENDMSG		16
 #define	LINUX_RECVMSG		17
 
-#define	LINUX_AF_UNSPEC		0
-#define	LINUX_AF_UNIX		1
-#define	LINUX_AF_INET		2
-#define	LINUX_AF_AX25		3
-#define	LINUX_AF_IPX		4
-#define	LINUX_AF_APPLETALK	5
-#define	LINUX_AF_INET6		10
-
 #define	LINUX_SOL_SOCKET	1
 #define	LINUX_SOL_IP		0
 #define	LINUX_SOL_IPX		256

From owner-svn-src-stable-7@FreeBSD.ORG  Sat Jun  6 10:59:37 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2BF65106566C;
	Sat,  6 Jun 2009 10:59:37 +0000 (UTC)
	(envelope-from dchagin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0E9D58FC14;
	Sat,  6 Jun 2009 10:59:37 +0000 (UTC)
	(envelope-from dchagin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n56AxarI059532;
	Sat, 6 Jun 2009 10:59:36 GMT (envelope-from dchagin@svn.freebsd.org)
Received: (from dchagin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n56AxalK059531;
	Sat, 6 Jun 2009 10:59:36 GMT (envelope-from dchagin@svn.freebsd.org)
Message-Id: <200906061059.n56AxalK059531@svn.freebsd.org>
From: Dmitry Chagin 
Date: Sat, 6 Jun 2009 10:59:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193581 - in stable/7/sys: . compat/linux contrib/pf
	dev/ath/ath_hal dev/cxgb
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 06 Jun 2009 10:59:37 -0000

Author: dchagin
Date: Sat Jun  6 10:59:36 2009
New Revision: 193581
URL: http://svn.freebsd.org/changeset/base/193581

Log:
  MFC r191887:
  Add KTR(9) tracing for futex emulation.
  
  Approved by:	kib (mentor)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/compat/linux/linux_futex.c
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)

Modified: stable/7/sys/compat/linux/linux_futex.c
==============================================================================
--- stable/7/sys/compat/linux/linux_futex.c	Sat Jun  6 10:55:11 2009	(r193580)
+++ stable/7/sys/compat/linux/linux_futex.c	Sat Jun  6 10:59:36 2009	(r193581)
@@ -43,6 +43,7 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -61,6 +62,7 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.
 #endif
 #include 
 #include 
+#include 
 
 MALLOC_DEFINE(M_FUTEX, "futex", "Linux futexes");
 MALLOC_DEFINE(M_FUTEX_WP, "futex wp", "Linux futexes wp");
@@ -131,11 +133,15 @@ futex_put(struct futex *f, struct waitin
 		FUTEXES_UNLOCK;
 		FUTEX_UNLOCK(f);
 
+		LINUX_CTR2(sys_futex, "futex_put destroy uaddr %p ref %d",
+		    f->f_uaddr, f->f_refcount);
 		FUTEX_DESTROY(f);
 		free(f, M_FUTEX);
 		return;
 	}
 
+	LINUX_CTR2(sys_futex, "futex_put uaddr %p ref %d",
+	    f->f_uaddr, f->f_refcount);
 	FUTEXES_UNLOCK;
 	FUTEX_UNLOCK(f);
 }
@@ -170,12 +176,15 @@ retry:
 
 			FUTEX_LOCK(f);
 			*newf = f;
+			LINUX_CTR2(sys_futex, "futex_get uaddr %p ref %d",
+			    uaddr, f->f_refcount);
 			return (0);
 		}
 	}
 
 	if (flags & FUTEX_DONTCREATE) {
 		FUTEXES_UNLOCK;
+		LINUX_CTR1(sys_futex, "futex_get uaddr %p null", uaddr);
 		return (0);
 	}
 
@@ -198,6 +207,8 @@ retry:
 	LIST_INSERT_HEAD(&futex_list, tmpf, f_list);
 	FUTEXES_UNLOCK;
 
+	LINUX_CTR2(sys_futex, "futex_get uaddr %p ref %d new",
+	    uaddr, tmpf->f_refcount);
 	*newf = tmpf;
 	return (0);
 }
@@ -232,13 +243,21 @@ futex_sleep(struct futex *f, struct wait
 	int error;
 
 	FUTEX_ASSERT_LOCKED(f);
+	LINUX_CTR4(sys_futex, "futex_sleep enter uaddr %p wp %p timo %ld ref %d",
+	    f->f_uaddr, wp, timeout, f->f_refcount);
 	error = sx_sleep(wp, &f->f_lck, PCATCH, "futex", timeout);
 	if (wp->wp_flags & FUTEX_WP_REQUEUED) {
 		KASSERT(f != wp->wp_futex, ("futex != wp_futex"));
+		LINUX_CTR5(sys_futex, "futex_sleep out error %d uaddr %p w"
+		    " %p requeued uaddr %p ref %d",
+		    error, f->f_uaddr, wp, wp->wp_futex->f_uaddr,
+		    wp->wp_futex->f_refcount);
 		futex_put(f, NULL);
 		f = wp->wp_futex;
 		FUTEX_LOCK(f);
-	}
+	} else
+		LINUX_CTR3(sys_futex, "futex_sleep out error %d uaddr %p wp %p",
+		    error, f->f_uaddr, wp);
 
 	futex_put(f, wp);
 	return (error);
@@ -252,6 +271,8 @@ futex_wake(struct futex *f, int n)
 
 	FUTEX_ASSERT_LOCKED(f);
 	TAILQ_FOREACH_SAFE(wp, &f->f_waiting_proc, wp_list, wpt) {
+		LINUX_CTR3(sys_futex, "futex_wake uaddr %p wp %p ref %d",
+		    f->f_uaddr, wp, f->f_refcount);
 		wp->wp_flags |= FUTEX_WP_REMOVED;
 		TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
 		wakeup_one(wp);
@@ -273,10 +294,14 @@ futex_requeue(struct futex *f, int n, st
 
 	TAILQ_FOREACH_SAFE(wp, &f->f_waiting_proc, wp_list, wpt) {
 		if (++count <= n) {
+			LINUX_CTR2(sys_futex, "futex_req_wake uaddr %p wp %p",
+			    f->f_uaddr, wp);
 			wp->wp_flags |= FUTEX_WP_REMOVED;
 			TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
 			wakeup_one(wp);
 		} else {
+			LINUX_CTR3(sys_futex, "futex_requeue uaddr %p wp %p to %p",
+			    f->f_uaddr, wp, f2->f_uaddr);
 			wp->wp_flags |= FUTEX_WP_REQUEUED;
 			/* Move wp to wp_list of f2 futex */
 			TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
@@ -421,6 +446,8 @@ linux_sys_futex(struct thread *td, struc
 	switch (args->op) {
 	case LINUX_FUTEX_WAIT:
 
+		LINUX_CTR2(sys_futex, "WAIT val %d uaddr %p",
+		    args->val, args->uaddr);
 #ifdef DEBUG
 		if (ldebug(sys_futex))
 			printf(ARGS(sys_futex, "futex_wait val %d uaddr %p"),
@@ -431,15 +458,14 @@ linux_sys_futex(struct thread *td, struc
 			return (error);
 		error = copyin(args->uaddr, &val, sizeof(val));
 		if (error) {
+			LINUX_CTR1(sys_futex, "WAIT copyin failed %d",
+			    error);
 			futex_put(f, wp);
 			return (error);
 		}
 		if (val != args->val) {
-#ifdef DEBUG
-			if (ldebug(sys_futex))
-				printf(ARGS(sys_futex, "futex_wait uaddr %p WHOOPS %d != %d"),
-				    args->uaddr, args->val, val);
-#endif
+			LINUX_CTR3(sys_futex, "WAIT uaddr %p val %d != uval %d",
+			    args->uaddr, args->val, val);
 			futex_put(f, wp);
 			return (EWOULDBLOCK);
 		}
@@ -449,6 +475,9 @@ linux_sys_futex(struct thread *td, struc
 
 	case LINUX_FUTEX_WAKE:
 
+		LINUX_CTR2(sys_futex, "WAKE val %d uaddr %p",
+		    args->val, args->uaddr);
+
 		/*
 		 * XXX: Linux is able to cope with different addresses
 		 * corresponding to the same mapped memory in the sleeping
@@ -472,6 +501,11 @@ linux_sys_futex(struct thread *td, struc
 
 	case LINUX_FUTEX_CMP_REQUEUE:
 
+		LINUX_CTR5(sys_futex, "CMP_REQUEUE uaddr %p "
+		    "val %d val3 %d uaddr2 %p val2 %d",
+		    args->uaddr, args->val, args->val3, args->uaddr2,
+		    (int)(unsigned long)args->timeout);
+
 #ifdef DEBUG
 		if (ldebug(sys_futex))
 			printf(ARGS(sys_futex, "futex_cmp_requeue uaddr %p "
@@ -505,16 +539,15 @@ linux_sys_futex(struct thread *td, struc
 		}
 		error = copyin(args->uaddr, &val, sizeof(val));
 		if (error) {
+			LINUX_CTR1(sys_futex, "CMP_REQUEUE copyin failed %d",
+			    error);
 			futex_put(f2, NULL);
 			futex_put(f, NULL);
 			return (error);
 		}
 		if (val != args->val3) {
-#ifdef DEBUG
-			if (ldebug(sys_futex))
-				printf(ARGS(sys_futex, "futex_cmp_requeue WHOOPS"
-				    " VAL %d != UVAL %d"), args->val, val);
-#endif
+			LINUX_CTR2(sys_futex, "CMP_REQUEUE val %d != uval %d",
+			    args->val, val);
 			futex_put(f2, NULL);
 			futex_put(f, NULL);
 			return (EAGAIN);
@@ -528,6 +561,11 @@ linux_sys_futex(struct thread *td, struc
 
 	case LINUX_FUTEX_WAKE_OP:
 
+		LINUX_CTR5(sys_futex, "WAKE_OP "
+		    "uaddr %p op %d val %x uaddr2 %p val3 %x",
+		    args->uaddr, args->op, args->val,
+		    args->uaddr2, args->val3);
+
 #ifdef DEBUG
 		if (ldebug(sys_futex))
 			printf(ARGS(sys_futex, "futex_wake_op "