From owner-svn-src-stable@FreeBSD.ORG Sun Mar 14 13:07:41 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E0C01065674; Sun, 14 Mar 2010 13:07:41 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D7ED8FC13; Sun, 14 Mar 2010 13:07:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2ED7efP048270; Sun, 14 Mar 2010 13:07:40 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2ED7eID048268; Sun, 14 Mar 2010 13:07:40 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201003141307.o2ED7eID048268@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 14 Mar 2010 13:07:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205150 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2010 13:07:41 -0000 Author: jilles Date: Sun Mar 14 13:07:40 2010 New Revision: 205150 URL: http://svn.freebsd.org/changeset/base/205150 Log: MFC r204410: Include terminated threads in ps's process cpu time field. When a kinfo_proc is filled, first fill_kinfo_proc_only() fills in ki_runtime using p->p_rux.rux_runtime (all cpu time used by the process including terminated threads). If information for a specific thread is requested, fill_kinfo_thread() then overwrites this with the thread's td->td_runtime (good). If not, fill_kinfo_aggregate() overwrote it with the sum of all threads' td->td_runtime which does not include terminated threads. This affects ps(1)'s TIME field, not its %CPU field nor anything in top(1). Modified: stable/8/sys/kern/kern_proc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/kern_proc.c ============================================================================== --- stable/8/sys/kern/kern_proc.c Sun Mar 14 13:05:48 2010 (r205149) +++ stable/8/sys/kern/kern_proc.c Sun Mar 14 13:07:40 2010 (r205150) @@ -675,11 +675,9 @@ fill_kinfo_aggregate(struct proc *p, str kp->ki_estcpu = 0; kp->ki_pctcpu = 0; - kp->ki_runtime = 0; FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); kp->ki_pctcpu += sched_pctcpu(td); - kp->ki_runtime += cputick2usec(td->td_runtime); kp->ki_estcpu += td->td_estcpu; thread_unlock(td); } From owner-svn-src-stable@FreeBSD.ORG Sun Mar 14 13:32:41 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13A1B106567D; Sun, 14 Mar 2010 13:32:41 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 033378FC18; Sun, 14 Mar 2010 13:32:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2EDWexx053781; Sun, 14 Mar 2010 13:32:40 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2EDWeqG053779; Sun, 14 Mar 2010 13:32:40 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201003141332.o2EDWeqG053779@svn.freebsd.org> From: Gavin Atkinson Date: Sun, 14 Mar 2010 13:32:40 +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: r205152 - stable/7/sys/compat/linprocfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2010 13:32:41 -0000 Author: gavin Date: Sun Mar 14 13:32:40 2010 New Revision: 205152 URL: http://svn.freebsd.org/changeset/base/205152 Log: Merge r183385 from head (by cognet) Advertise bit 26 as sse2. PR: kern/130724 Approved by: cognet Modified: stable/7/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/7/sys/compat/linprocfs/linprocfs.c Sun Mar 14 13:29:09 2010 (r205151) +++ stable/7/sys/compat/linprocfs/linprocfs.c Sun Mar 14 13:32:40 2010 (r205152) @@ -222,7 +222,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) "sep", "sep", "mtrr", "pge", "mca", "cmov", "pat", "pse36", "pn", "b19", "b20", "b21", "mmxext", "mmx", "fxsr", - "xmm", "b26", "b27", "b28", "b29", + "xmm", "sse2", "b27", "b28", "b29", "3dnowext", "3dnow" }; From owner-svn-src-stable@FreeBSD.ORG Sun Mar 14 16:03:36 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80273106564A; Sun, 14 Mar 2010 16:03:36 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 66F578FC0C; Sun, 14 Mar 2010 16:03:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2EG3apo087359; Sun, 14 Mar 2010 16:03:36 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2EG3akZ087355; Sun, 14 Mar 2010 16:03:36 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201003141603.o2EG3akZ087355@svn.freebsd.org> From: Gavin Atkinson Date: Sun, 14 Mar 2010 16:03: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: r205156 - stable/7/bin/cp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2010 16:03:36 -0000 Author: gavin Date: Sun Mar 14 16:03:36 2010 New Revision: 205156 URL: http://svn.freebsd.org/changeset/base/205156 Log: Merge r202461 from head: Implement an "-x" option to cp(1), for compatibility with Linux and feature parity with du(1) and similar: When set, cp(1) will not traverse mount points. PR: bin/88056 Initial patch by: Graham J Lee Modified: stable/7/bin/cp/cp.1 stable/7/bin/cp/cp.c stable/7/bin/cp/utils.c Directory Properties: stable/7/bin/cp/ (props changed) Modified: stable/7/bin/cp/cp.1 ============================================================================== --- stable/7/bin/cp/cp.1 Sun Mar 14 15:49:04 2010 (r205155) +++ stable/7/bin/cp/cp.1 Sun Mar 14 16:03:36 2010 (r205156) @@ -32,7 +32,7 @@ .\" @(#)cp.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd October 27, 2006 +.Dd January 17, 2010 .Dt CP 1 .Os .Sh NAME @@ -45,7 +45,7 @@ .Op Fl H | Fl L | Fl P .Oc .Op Fl f | i | n -.Op Fl alpv +.Op Fl alpvx .Ar source_file target_file .Nm .Oo @@ -53,7 +53,7 @@ .Op Fl H | Fl L | Fl P .Oc .Op Fl f | i | n -.Op Fl alpv +.Op Fl alpvx .Ar source_file ... target_directory .Sh DESCRIPTION In the first synopsis form, the @@ -183,6 +183,8 @@ permissions. Cause .Nm to be verbose, showing files as they are copied. +.It Fl x +File system mount points are not traversed. .El .Pp For each destination file that already exists, its contents are Modified: stable/7/bin/cp/cp.c ============================================================================== --- stable/7/bin/cp/cp.c Sun Mar 14 15:49:04 2010 (r205155) +++ stable/7/bin/cp/cp.c Sun Mar 14 16:03:36 2010 (r205156) @@ -101,8 +101,9 @@ main(int argc, char *argv[]) int Hflag, Lflag, Pflag, ch, fts_options, r, have_trailing_slash; char *target; + fts_options = FTS_NOCHDIR | FTS_PHYSICAL; Hflag = Lflag = Pflag = 0; - while ((ch = getopt(argc, argv, "HLPRafilnprv")) != -1) + while ((ch = getopt(argc, argv, "HLPRafilnprvx")) != -1) switch (ch) { case 'H': Hflag = 1; @@ -150,6 +151,9 @@ main(int argc, char *argv[]) case 'v': vflag = 1; break; + case 'x': + fts_options |= FTS_XDEV; + break; default: usage(); break; @@ -160,7 +164,6 @@ main(int argc, char *argv[]) if (argc < 2) usage(); - fts_options = FTS_NOCHDIR | FTS_PHYSICAL; if (Rflag && rflag) errx(1, "the -R and -r options may not be specified together"); if (rflag) Modified: stable/7/bin/cp/utils.c ============================================================================== --- stable/7/bin/cp/utils.c Sun Mar 14 15:49:04 2010 (r205155) +++ stable/7/bin/cp/utils.c Sun Mar 14 16:03:36 2010 (r205156) @@ -429,8 +429,8 @@ usage(void) { (void)fprintf(stderr, "%s\n%s\n", -"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file target_file", -" cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file ... " +"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file target_file", +" cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file ... " "target_directory"); exit(EX_USAGE); } From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 15:33:33 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DAFA106566B; Mon, 15 Mar 2010 15:33:33 +0000 (UTC) (envelope-from bruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 417D78FC15; Mon, 15 Mar 2010 15:33:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FFXXXB002005; Mon, 15 Mar 2010 15:33:33 GMT (envelope-from bruno@svn.freebsd.org) Received: (from bruno@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FFXX6m002003; Mon, 15 Mar 2010 15:33:33 GMT (envelope-from bruno@svn.freebsd.org) Message-Id: <201003151533.o2FFXX6m002003@svn.freebsd.org> From: Bruno Ducrot Date: Mon, 15 Mar 2010 15:33:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205168 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 15:33:33 -0000 Author: bruno Date: Mon Mar 15 15:33:32 2010 New Revision: 205168 URL: http://svn.freebsd.org/changeset/base/205168 Log: MFC r204519: Deliver siginfo when signal is generated by thr_kill(2) (SI_USER with properly filled si_uid and si_pid). PR: 141956 Modified: stable/8/sys/kern/kern_thr.c Modified: stable/8/sys/kern/kern_thr.c ============================================================================== --- stable/8/sys/kern/kern_thr.c Mon Mar 15 14:20:16 2010 (r205167) +++ stable/8/sys/kern/kern_thr.c Mon Mar 15 15:33:32 2010 (r205168) @@ -303,12 +303,18 @@ int thr_kill(struct thread *td, struct thr_kill_args *uap) /* long id, int sig */ { + ksiginfo_t ksi; struct thread *ttd; struct proc *p; int error; p = td->td_proc; error = 0; + ksiginfo_init(&ksi); + ksi.ksi_signo = uap->sig; + ksi.ksi_code = SI_USER; + ksi.ksi_pid = p->p_pid; + ksi.ksi_uid = td->td_ucred->cr_ruid; PROC_LOCK(p); if (uap->id == -1) { if (uap->sig != 0 && !_SIG_VALID(uap->sig)) { @@ -320,7 +326,7 @@ thr_kill(struct thread *td, struct thr_k error = 0; if (uap->sig == 0) break; - tdsignal(p, ttd, uap->sig, NULL); + tdsignal(p, ttd, uap->sig, &ksi); } } } @@ -336,7 +342,7 @@ thr_kill(struct thread *td, struct thr_k else if (!_SIG_VALID(uap->sig)) error = EINVAL; else - tdsignal(p, ttd, uap->sig, NULL); + tdsignal(p, ttd, uap->sig, &ksi); } PROC_UNLOCK(p); return (error); @@ -346,6 +352,7 @@ int thr_kill2(struct thread *td, struct thr_kill2_args *uap) /* pid_t pid, long id, int sig */ { + ksiginfo_t ksi; struct thread *ttd; struct proc *p; int error; @@ -362,6 +369,11 @@ thr_kill2(struct thread *td, struct thr_ error = p_cansignal(td, p, uap->sig); if (error == 0) { + ksiginfo_init(&ksi); + ksi.ksi_signo = uap->sig; + ksi.ksi_code = SI_USER; + ksi.ksi_pid = td->td_proc->p_pid; + ksi.ksi_uid = td->td_ucred->cr_ruid; if (uap->id == -1) { if (uap->sig != 0 && !_SIG_VALID(uap->sig)) { error = EINVAL; @@ -372,7 +384,8 @@ thr_kill2(struct thread *td, struct thr_ error = 0; if (uap->sig == 0) break; - tdsignal(p, ttd, uap->sig, NULL); + tdsignal(p, ttd, uap->sig, + &ksi); } } } @@ -388,7 +401,7 @@ thr_kill2(struct thread *td, struct thr_ else if (!_SIG_VALID(uap->sig)) error = EINVAL; else - tdsignal(p, ttd, uap->sig, NULL); + tdsignal(p, ttd, uap->sig, &ksi); } } PROC_UNLOCK(p); From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 16:39:52 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E5AB1065670; Mon, 15 Mar 2010 16:39:52 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C48F8FC1B; Mon, 15 Mar 2010 16:39:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FGdq31016676; Mon, 15 Mar 2010 16:39:52 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FGdq54016674; Mon, 15 Mar 2010 16:39:52 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201003151639.o2FGdq54016674@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 15 Mar 2010 16:39:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205171 - stable/8/usr.bin/xlint/lint1 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 16:39:52 -0000 Author: jh Date: Mon Mar 15 16:39:52 2010 New Revision: 205171 URL: http://svn.freebsd.org/changeset/base/205171 Log: MFC r204872: Pass the correct size to memset(). PR: bin/128094 Modified: stable/8/usr.bin/xlint/lint1/scan.l Directory Properties: stable/8/usr.bin/xlint/ (props changed) Modified: stable/8/usr.bin/xlint/lint1/scan.l ============================================================================== --- stable/8/usr.bin/xlint/lint1/scan.l Mon Mar 15 16:06:52 2010 (r205170) +++ stable/8/usr.bin/xlint/lint1/scan.l Mon Mar 15 16:39:52 2010 (r205171) @@ -319,7 +319,7 @@ allocsb(void) if ((sb = malloc(sizeof (sbuf_t))) == NULL) nomem(); } - (void)memset(sb, 0, sizeof (sb)); + (void)memset(sb, 0, sizeof (*sb)); return (sb); } From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 17:52:56 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36BA21065673; Mon, 15 Mar 2010 17:52:56 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 229BC8FC1B; Mon, 15 Mar 2010 17:52:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FHquNl033005; Mon, 15 Mar 2010 17:52:56 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FHqu2L032992; Mon, 15 Mar 2010 17:52:56 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201003151752.o2FHqu2L032992@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 15 Mar 2010 17:52:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205174 - stable/8/release/picobsd/floppy.tree X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 17:52:56 -0000 Author: luigi Date: Mon Mar 15 17:52:55 2010 New Revision: 205174 URL: http://svn.freebsd.org/changeset/base/205174 Log: wrong name for this file... Added: - copied unchanged from r205079, stable/8/release/picobsd/floppy.tree/sbin Directory Properties: stable/8/release/picobsd/floppy.tree/dhclient-script (props changed) Deleted: stable/8/release/picobsd/floppy.tree/sbin Copied: stable/8/release/picobsd/floppy.tree/dhclient-script (from r205079, stable/8/release/picobsd/floppy.tree/sbin) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/release/picobsd/floppy.tree/dhclient-script Mon Mar 15 17:52:55 2010 (r205174, copy of r205079, stable/8/release/picobsd/floppy.tree/sbin) @@ -0,0 +1,384 @@ +#!/bin/sh +# +# $OpenBSD: dhclient-script,v 1.6 2004/05/06 18:22:41 claudio Exp $ +# $FreeBSD$ +# +# Copyright (c) 2003 Kenneth R Westerback +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# + +ARP=/usr/sbin/arp +HOSTNAME=/bin/hostname +IFCONFIG='/sbin/ifconfig -n' + +LOCALHOST=127.0.0.1 + +if [ -x /usr/bin/logger ]; then + LOGGER="/usr/bin/logger -s -p user.notice -t dhclient" +else + LOGGER=echo +fi + +# +# Helper functions that implement common actions. +# + +check_hostname() { + current_hostname=`$HOSTNAME` + if [ -z "$current_hostname" ]; then + $LOGGER "New Hostname ($interface): $new_host_name" + $HOSTNAME $new_host_name + elif [ "$current_hostname" = "$old_host_name" -a \ + "$new_host_name" != "$old_host_name" ]; then + $LOGGER "New Hostname ($interface): $new_host_name" + $HOSTNAME $new_host_name + fi +} + +arp_flush() { + arp -an -i $interface | \ + sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' | \ + sh >/dev/null 2>&1 +} + +delete_old_address() { + eval "$IFCONFIG $interface inet -alias $old_ip_address $medium" +} + +add_new_address() { + eval "$IFCONFIG $interface \ + inet $new_ip_address \ + netmask $new_subnet_mask \ + broadcast $new_broadcast_address \ + $medium" + + $LOGGER "New IP Address ($interface): $new_ip_address" + $LOGGER "New Subnet Mask ($interface): $new_subnet_mask" + $LOGGER "New Broadcast Address ($interface): $new_broadcast_address" + $LOGGER "New Routers ($interface): $new_routers" +} + +delete_old_alias() { + if [ -n "$alias_ip_address" ]; then + $IFCONFIG $interface inet -alias $alias_ip_address > /dev/null 2>&1 + #route delete $alias_ip_address $LOCALHOST > /dev/null 2>&1 + fi +} + +add_new_alias() { + if [ -n "$alias_ip_address" ]; then + $IFCONFIG $interface inet alias $alias_ip_address netmask \ + $alias_subnet_mask + #route add $alias_ip_address $LOCALHOST + fi +} + +fill_classless_routes() { + set $1 + while [ $# -ge 5 ]; do + if [ $1 -eq 0 ]; then + route="default" + elif [ $1 -le 8 ]; then + route="$2.0.0.0/$1" + shift + elif [ $1 -le 16 ]; then + route="$2.$3.0.0/$1" + shift; shift + elif [ $1 -le 24 ]; then + route="$2.$3.$4.0/$1" + shift; shift; shift + else + route="$2.$3.$4.$5/$1" + shift; shift; shift; shift + fi + shift + router="$1.$2.$3.$4" + classless_routes="$classless_routes $route $router" + shift; shift; shift; shift + done +} + +delete_old_routes() { + #route delete "$old_ip_address" $LOCALHOST >/dev/null 2>&1 + if [ -n "$old_classless_routes" ]; then + fill_classless_routes "$old_classless_routes" + set $classless_routes + while [ $# -gt 1 ]; do + route delete "$1" "$2" + shift; shift + done + return 0; + fi + + # If we supported multiple default routes, we'd be removing each + # one here. We don't so just delete the default route if it's + # through our interface. + if is_default_interface; then + route delete default >/dev/null 2>&1 + fi + + if [ -n "$old_static_routes" ]; then + set $old_static_routes + while [ $# -gt 1 ]; do + route delete "$1" "$2" + shift; shift + done + fi + + arp_flush +} + +add_new_routes() { + #route add $new_ip_address $LOCALHOST >/dev/null 2>&1 + + # RFC 3442: If the DHCP server returns both a Classless Static + # Routes option and a Router option, the DHCP client MUST ignore + # the Router option. + # + # DHCP clients that support this option (Classless Static Routes) + # MUST NOT install the routes specified in the Static Routes + # option (option code 33) if both a Static Routes option and the + # Classless Static Routes option are provided. + + if [ -n "$new_classless_routes" ]; then + fill_classless_routes "$new_classless_routes" + $LOGGER "New Classless Static Routes ($interface): $classless_routes" + set $classless_routes + while [ $# -gt 1 ]; do + if [ "0.0.0.0" = "$2" ]; then + route add "$1" -iface "$interface" + else + route add "$1" "$2" + fi + shift; shift + done + return + fi + + for router in $new_routers; do + if is_default_interface; then + + if [ "$new_ip_address" = "$router" ]; then + route add default -iface $router >/dev/null 2>&1 + else + route add default $router >/dev/null 2>&1 + fi + fi + # 2nd and subsequent default routers error out, so explicitly + # stop processing the list after the first one. + break + done + + if [ -n "$new_static_routes" ]; then + $LOGGER "New Static Routes ($interface): $new_static_routes" + set $new_static_routes + while [ $# -gt 1 ]; do + route add $1 $2 + shift; shift + done + fi +} + +add_new_resolv_conf() { + # XXX Old code did not create/update resolv.conf unless both + # $new_domain_name and $new_domain_name_servers were provided. PR + # #3135 reported some ISP's only provide $new_domain_name_servers and + # thus broke the script. This code creates the resolv.conf if either + # are provided. + + local tmpres=/var/run/resolv.conf.${interface} + rm -f $tmpres + + if [ -n "$new_domain_name" ]; then + echo "search $new_domain_name" >>$tmpres + fi + + if [ -n "$new_domain_name_servers" ]; then + for nameserver in $new_domain_name_servers; do + echo "nameserver $nameserver" >>$tmpres + done + fi + + if [ -f $tmpres ]; then + if [ -f /etc/resolv.conf.tail ]; then + cat /etc/resolv.conf.tail >>$tmpres + fi + + # When resolv.conf is not changed actually, we don't + # need to update it. + # If /usr is not mounted yet, we cannot use cmp, then + # the following test fails. In such case, we simply + # ignore an error and do update resolv.conf. + if cmp -s $tmpres /etc/resolv.conf; then + rm -f $tmpres + return 0 + fi 2>/dev/null + + # In case (e.g. during OpenBSD installs) /etc/resolv.conf + # is a symbolic link, take care to preserve the link and write + # the new data in the correct location. + + if [ -f /etc/resolv.conf ]; then + cat /etc/resolv.conf > /etc/resolv.conf.save + fi + cat $tmpres > /etc/resolv.conf + rm -f $tmpres + + # Try to ensure correct ownership and permissions. + chown -RL root:wheel /etc/resolv.conf + chmod -RL 644 /etc/resolv.conf + + return 0 + fi + + return 1 +} + +# Must be used on exit. Invokes the local dhcp client exit hooks, if any. +exit_with_hooks() { + exit_status=$1 + if [ -f /etc/dhclient-exit-hooks ]; then + . /etc/dhclient-exit-hooks + fi + # probably should do something with exit status of the local script + exit $exit_status +} + +# Get the interface with the current ipv4 default route on it using only +# commands that are available prior to /usr being mounted. +is_default_interface() +{ + routeget="`route -n get -inet default`" + oldifs="$IFS" + IFS=" +" + defif= + for line in $routeget ; do + case $line in + *interface:*) + defif=${line##*: } + ;; + esac + done + IFS=${oldifs} + + if [ -z "$defif" -o "$defif" = "$interface" ]; then + return 0 + else + return 1 + fi +} + +# +# Start of active code. +# + +# Invoke the local dhcp client enter hooks, if they exist. +if [ -f /etc/dhclient-enter-hooks ]; then + exit_status=0 + . /etc/dhclient-enter-hooks + # allow the local script to abort processing of this state + # local script must set exit_status variable to nonzero. + if [ $exit_status -ne 0 ]; then + exit $exit_status + fi +fi + +case $reason in +MEDIUM) + eval "$IFCONFIG $interface $medium" + eval "$IFCONFIG $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1 + sleep 1 + ;; + +PREINIT) + delete_old_alias + $IFCONFIG $interface inet alias 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255 up + ;; + +ARPCHECK|ARPSEND) + ;; + +BOUND|RENEW|REBIND|REBOOT) + check_hostname + if [ -n "$old_ip_address" ]; then + if [ "$old_ip_address" != "$alias_ip_address" ]; then + delete_old_alias + fi + if [ "$old_ip_address" != "$new_ip_address" ]; then + delete_old_address + delete_old_routes + fi + fi + if [ "$reason" = BOUND ] || \ + [ "$reason" = REBOOT ] || \ + [ -z "$old_ip_address" ] || \ + [ "$old_ip_address" != "$new_ip_address" ]; then + add_new_address + add_new_routes + fi + if [ "$new_ip_address" != "$alias_ip_address" ]; then + add_new_alias + fi + if is_default_interface; then + add_new_resolv_conf + fi + ;; + +EXPIRE|FAIL) + delete_old_alias + if [ -n "$old_ip_address" ]; then + delete_old_address + delete_old_routes + fi + if [ -x $ARP ]; then + $ARP -d -a -i $interface + fi + # XXX Why add alias we just deleted above? + add_new_alias + if is_default_interface; then + if [ -f /etc/resolv.conf.save ]; then + cat /etc/resolv.conf.save > /etc/resolv.conf + fi + fi + ;; + +TIMEOUT) + delete_old_alias + add_new_address + sleep 1 + if [ -n "$new_routers" ]; then + $LOGGER "New Routers ($interface): $new_routers" + set "$new_routers" + if ping -q -c 1 -t 1 "$1"; then + if [ "$new_ip_address" != "$alias_ip_address" ]; then + add_new_alias + fi + add_new_routes + if ! is_default_interface; then + exit_with_hooks 0 + fi + if add_new_resolv_conf; then + exit_with_hooks 0 + fi + fi + fi + eval "$IFCONFIG $interface inet -alias $new_ip_address $medium" + delete_old_routes + exit_with_hooks 1 + ;; +esac + +exit_with_hooks 0 From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 17:54:01 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6053106567B; Mon, 15 Mar 2010 17:54:01 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2C468FC34; Mon, 15 Mar 2010 17:54:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FHs1wf033289; Mon, 15 Mar 2010 17:54:01 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FHs1bK033287; Mon, 15 Mar 2010 17:54:01 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201003151754.o2FHs1bK033287@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 15 Mar 2010 17:54:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205175 - in stable/8/release/picobsd/floppy.tree: . sbin X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 17:54:01 -0000 Author: luigi Date: Mon Mar 15 17:54:01 2010 New Revision: 205175 URL: http://svn.freebsd.org/changeset/base/205175 Log: and wrong place too! Added: stable/8/release/picobsd/floppy.tree/sbin/ stable/8/release/picobsd/floppy.tree/sbin/dhclient-script - copied unchanged from r205174, stable/8/release/picobsd/floppy.tree/dhclient-script Deleted: stable/8/release/picobsd/floppy.tree/dhclient-script Copied: stable/8/release/picobsd/floppy.tree/sbin/dhclient-script (from r205174, stable/8/release/picobsd/floppy.tree/dhclient-script) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/release/picobsd/floppy.tree/sbin/dhclient-script Mon Mar 15 17:54:01 2010 (r205175, copy of r205174, stable/8/release/picobsd/floppy.tree/dhclient-script) @@ -0,0 +1,384 @@ +#!/bin/sh +# +# $OpenBSD: dhclient-script,v 1.6 2004/05/06 18:22:41 claudio Exp $ +# $FreeBSD$ +# +# Copyright (c) 2003 Kenneth R Westerback +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# + +ARP=/usr/sbin/arp +HOSTNAME=/bin/hostname +IFCONFIG='/sbin/ifconfig -n' + +LOCALHOST=127.0.0.1 + +if [ -x /usr/bin/logger ]; then + LOGGER="/usr/bin/logger -s -p user.notice -t dhclient" +else + LOGGER=echo +fi + +# +# Helper functions that implement common actions. +# + +check_hostname() { + current_hostname=`$HOSTNAME` + if [ -z "$current_hostname" ]; then + $LOGGER "New Hostname ($interface): $new_host_name" + $HOSTNAME $new_host_name + elif [ "$current_hostname" = "$old_host_name" -a \ + "$new_host_name" != "$old_host_name" ]; then + $LOGGER "New Hostname ($interface): $new_host_name" + $HOSTNAME $new_host_name + fi +} + +arp_flush() { + arp -an -i $interface | \ + sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' | \ + sh >/dev/null 2>&1 +} + +delete_old_address() { + eval "$IFCONFIG $interface inet -alias $old_ip_address $medium" +} + +add_new_address() { + eval "$IFCONFIG $interface \ + inet $new_ip_address \ + netmask $new_subnet_mask \ + broadcast $new_broadcast_address \ + $medium" + + $LOGGER "New IP Address ($interface): $new_ip_address" + $LOGGER "New Subnet Mask ($interface): $new_subnet_mask" + $LOGGER "New Broadcast Address ($interface): $new_broadcast_address" + $LOGGER "New Routers ($interface): $new_routers" +} + +delete_old_alias() { + if [ -n "$alias_ip_address" ]; then + $IFCONFIG $interface inet -alias $alias_ip_address > /dev/null 2>&1 + #route delete $alias_ip_address $LOCALHOST > /dev/null 2>&1 + fi +} + +add_new_alias() { + if [ -n "$alias_ip_address" ]; then + $IFCONFIG $interface inet alias $alias_ip_address netmask \ + $alias_subnet_mask + #route add $alias_ip_address $LOCALHOST + fi +} + +fill_classless_routes() { + set $1 + while [ $# -ge 5 ]; do + if [ $1 -eq 0 ]; then + route="default" + elif [ $1 -le 8 ]; then + route="$2.0.0.0/$1" + shift + elif [ $1 -le 16 ]; then + route="$2.$3.0.0/$1" + shift; shift + elif [ $1 -le 24 ]; then + route="$2.$3.$4.0/$1" + shift; shift; shift + else + route="$2.$3.$4.$5/$1" + shift; shift; shift; shift + fi + shift + router="$1.$2.$3.$4" + classless_routes="$classless_routes $route $router" + shift; shift; shift; shift + done +} + +delete_old_routes() { + #route delete "$old_ip_address" $LOCALHOST >/dev/null 2>&1 + if [ -n "$old_classless_routes" ]; then + fill_classless_routes "$old_classless_routes" + set $classless_routes + while [ $# -gt 1 ]; do + route delete "$1" "$2" + shift; shift + done + return 0; + fi + + # If we supported multiple default routes, we'd be removing each + # one here. We don't so just delete the default route if it's + # through our interface. + if is_default_interface; then + route delete default >/dev/null 2>&1 + fi + + if [ -n "$old_static_routes" ]; then + set $old_static_routes + while [ $# -gt 1 ]; do + route delete "$1" "$2" + shift; shift + done + fi + + arp_flush +} + +add_new_routes() { + #route add $new_ip_address $LOCALHOST >/dev/null 2>&1 + + # RFC 3442: If the DHCP server returns both a Classless Static + # Routes option and a Router option, the DHCP client MUST ignore + # the Router option. + # + # DHCP clients that support this option (Classless Static Routes) + # MUST NOT install the routes specified in the Static Routes + # option (option code 33) if both a Static Routes option and the + # Classless Static Routes option are provided. + + if [ -n "$new_classless_routes" ]; then + fill_classless_routes "$new_classless_routes" + $LOGGER "New Classless Static Routes ($interface): $classless_routes" + set $classless_routes + while [ $# -gt 1 ]; do + if [ "0.0.0.0" = "$2" ]; then + route add "$1" -iface "$interface" + else + route add "$1" "$2" + fi + shift; shift + done + return + fi + + for router in $new_routers; do + if is_default_interface; then + + if [ "$new_ip_address" = "$router" ]; then + route add default -iface $router >/dev/null 2>&1 + else + route add default $router >/dev/null 2>&1 + fi + fi + # 2nd and subsequent default routers error out, so explicitly + # stop processing the list after the first one. + break + done + + if [ -n "$new_static_routes" ]; then + $LOGGER "New Static Routes ($interface): $new_static_routes" + set $new_static_routes + while [ $# -gt 1 ]; do + route add $1 $2 + shift; shift + done + fi +} + +add_new_resolv_conf() { + # XXX Old code did not create/update resolv.conf unless both + # $new_domain_name and $new_domain_name_servers were provided. PR + # #3135 reported some ISP's only provide $new_domain_name_servers and + # thus broke the script. This code creates the resolv.conf if either + # are provided. + + local tmpres=/var/run/resolv.conf.${interface} + rm -f $tmpres + + if [ -n "$new_domain_name" ]; then + echo "search $new_domain_name" >>$tmpres + fi + + if [ -n "$new_domain_name_servers" ]; then + for nameserver in $new_domain_name_servers; do + echo "nameserver $nameserver" >>$tmpres + done + fi + + if [ -f $tmpres ]; then + if [ -f /etc/resolv.conf.tail ]; then + cat /etc/resolv.conf.tail >>$tmpres + fi + + # When resolv.conf is not changed actually, we don't + # need to update it. + # If /usr is not mounted yet, we cannot use cmp, then + # the following test fails. In such case, we simply + # ignore an error and do update resolv.conf. + if cmp -s $tmpres /etc/resolv.conf; then + rm -f $tmpres + return 0 + fi 2>/dev/null + + # In case (e.g. during OpenBSD installs) /etc/resolv.conf + # is a symbolic link, take care to preserve the link and write + # the new data in the correct location. + + if [ -f /etc/resolv.conf ]; then + cat /etc/resolv.conf > /etc/resolv.conf.save + fi + cat $tmpres > /etc/resolv.conf + rm -f $tmpres + + # Try to ensure correct ownership and permissions. + chown -RL root:wheel /etc/resolv.conf + chmod -RL 644 /etc/resolv.conf + + return 0 + fi + + return 1 +} + +# Must be used on exit. Invokes the local dhcp client exit hooks, if any. +exit_with_hooks() { + exit_status=$1 + if [ -f /etc/dhclient-exit-hooks ]; then + . /etc/dhclient-exit-hooks + fi + # probably should do something with exit status of the local script + exit $exit_status +} + +# Get the interface with the current ipv4 default route on it using only +# commands that are available prior to /usr being mounted. +is_default_interface() +{ + routeget="`route -n get -inet default`" + oldifs="$IFS" + IFS=" +" + defif= + for line in $routeget ; do + case $line in + *interface:*) + defif=${line##*: } + ;; + esac + done + IFS=${oldifs} + + if [ -z "$defif" -o "$defif" = "$interface" ]; then + return 0 + else + return 1 + fi +} + +# +# Start of active code. +# + +# Invoke the local dhcp client enter hooks, if they exist. +if [ -f /etc/dhclient-enter-hooks ]; then + exit_status=0 + . /etc/dhclient-enter-hooks + # allow the local script to abort processing of this state + # local script must set exit_status variable to nonzero. + if [ $exit_status -ne 0 ]; then + exit $exit_status + fi +fi + +case $reason in +MEDIUM) + eval "$IFCONFIG $interface $medium" + eval "$IFCONFIG $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1 + sleep 1 + ;; + +PREINIT) + delete_old_alias + $IFCONFIG $interface inet alias 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255 up + ;; + +ARPCHECK|ARPSEND) + ;; + +BOUND|RENEW|REBIND|REBOOT) + check_hostname + if [ -n "$old_ip_address" ]; then + if [ "$old_ip_address" != "$alias_ip_address" ]; then + delete_old_alias + fi + if [ "$old_ip_address" != "$new_ip_address" ]; then + delete_old_address + delete_old_routes + fi + fi + if [ "$reason" = BOUND ] || \ + [ "$reason" = REBOOT ] || \ + [ -z "$old_ip_address" ] || \ + [ "$old_ip_address" != "$new_ip_address" ]; then + add_new_address + add_new_routes + fi + if [ "$new_ip_address" != "$alias_ip_address" ]; then + add_new_alias + fi + if is_default_interface; then + add_new_resolv_conf + fi + ;; + +EXPIRE|FAIL) + delete_old_alias + if [ -n "$old_ip_address" ]; then + delete_old_address + delete_old_routes + fi + if [ -x $ARP ]; then + $ARP -d -a -i $interface + fi + # XXX Why add alias we just deleted above? + add_new_alias + if is_default_interface; then + if [ -f /etc/resolv.conf.save ]; then + cat /etc/resolv.conf.save > /etc/resolv.conf + fi + fi + ;; + +TIMEOUT) + delete_old_alias + add_new_address + sleep 1 + if [ -n "$new_routers" ]; then + $LOGGER "New Routers ($interface): $new_routers" + set "$new_routers" + if ping -q -c 1 -t 1 "$1"; then + if [ "$new_ip_address" != "$alias_ip_address" ]; then + add_new_alias + fi + add_new_routes + if ! is_default_interface; then + exit_with_hooks 0 + fi + if add_new_resolv_conf; then + exit_with_hooks 0 + fi + fi + fi + eval "$IFCONFIG $interface inet -alias $new_ip_address $medium" + delete_old_routes + exit_with_hooks 1 + ;; +esac + +exit_with_hooks 0 From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 18:22:20 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 535341065676; Mon, 15 Mar 2010 18:22:20 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 41F278FC26; Mon, 15 Mar 2010 18:22:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FIMKh3039794; Mon, 15 Mar 2010 18:22:20 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FIMKcN039792; Mon, 15 Mar 2010 18:22:20 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201003151822.o2FIMKcN039792@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 15 Mar 2010 18:22:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205180 - stable/8/sys/dev/fb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 18:22:20 -0000 Author: jkim Date: Mon Mar 15 18:22:19 2010 New Revision: 205180 URL: http://svn.freebsd.org/changeset/base/205180 Log: MFC: r204235 Fix FBIO_ADPINFO ioctl on amd64. Modified: stable/8/sys/dev/fb/fb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/fb/fb.c ============================================================================== --- stable/8/sys/dev/fb/fb.c Mon Mar 15 18:20:51 2010 (r205179) +++ stable/8/sys/dev/fb/fb.c Mon Mar 15 18:22:19 2010 (r205180) @@ -653,7 +653,7 @@ fb_commonioctl(video_adapter_t *adp, u_l ((video_adapter_info_t *)arg)->va_mem_base = adp->va_mem_base; ((video_adapter_info_t *)arg)->va_mem_size = adp->va_mem_size; ((video_adapter_info_t *)arg)->va_window -#ifdef __i386__ +#if defined(__amd64__) || defined(__i386__) = vtophys(adp->va_window); #else = adp->va_window; @@ -665,8 +665,8 @@ fb_commonioctl(video_adapter_t *adp, u_l ((video_adapter_info_t *)arg)->va_window_orig = adp->va_window_orig; ((video_adapter_info_t *)arg)->va_unused0 -#ifdef __i386__ - = (adp->va_buffer) ? vtophys(adp->va_buffer) : 0; +#if defined(__amd64__) || defined(__i386__) + = adp->va_buffer != 0 ? vtophys(adp->va_buffer) : 0; #else = adp->va_buffer; #endif From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 18:32:58 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14A841065676; Mon, 15 Mar 2010 18:32:58 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 024258FC1B; Mon, 15 Mar 2010 18:32:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FIWvJ7042314; Mon, 15 Mar 2010 18:32:57 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FIWvhg042311; Mon, 15 Mar 2010 18:32:57 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201003151832.o2FIWvhg042311@svn.freebsd.org> From: Marius Strobl Date: Mon, 15 Mar 2010 18:32:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205183 - stable/8/lib/libc/sparc64/fpu X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 18:32:58 -0000 Author: marius Date: Mon Mar 15 18:32:57 2010 New Revision: 205183 URL: http://svn.freebsd.org/changeset/base/205183 Log: MFC: r204974, r205002 - The OPSZ macro actually only does the right thing for int32 and int64 operands but not for double and extended double ones. Instead of trying to fix the macro just nuke it and unroll the loops in the correct way though as extended double operands turn out to be the only special case. - For FxTO{s,d,q} the source operand is int64 so rs2 has to be re-decoded after setting type accordingly as it's generally decoded using the low 2 bits as the type, which are 0 for these three instructions. - Similarly, in case of F{s,d,q}TOx the target is int64 so rd has to be re-decoded using not only the operand mask appropriate for int64 but also the correct register number encoding. - Use const where appropriate. - Wrap long lines. Submitted by: Peter Jeremy (partly) Modified: stable/8/lib/libc/sparc64/fpu/fpu.c stable/8/lib/libc/sparc64/fpu/fpu_emu.h Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/sparc64/fpu/fpu.c ============================================================================== --- stable/8/lib/libc/sparc64/fpu/fpu.c Mon Mar 15 18:27:51 2010 (r205182) +++ stable/8/lib/libc/sparc64/fpu/fpu.c Mon Mar 15 18:32:57 2010 (r205183) @@ -97,7 +97,7 @@ __FBSDID("$FreeBSD$"); #define X8(x) X4(x),X4(x) #define X16(x) X8(x),X8(x) -static char cx_to_trapx[] = { +static const char cx_to_trapx[] = { X1(FSR_NX), X2(FSR_DZ), X4(FSR_UF), @@ -113,7 +113,8 @@ int __fpe_debug = 0; #endif #endif /* FPU_DEBUG */ -static int __fpu_execute(struct utrapframe *, struct fpemu *, u_int32_t, u_long); +static int __fpu_execute(struct utrapframe *, struct fpemu *, u_int32_t, + u_long); /* * Need to use an fpstate on the stack; we could switch, so we cannot safely @@ -169,7 +170,7 @@ __fpu_exception(struct utrapframe *uf) void __fpu_dumpfpn(struct fpn *fp) { - static char *class[] = { + static const char *const class[] = { "SNAN", "QNAN", "ZERO", "NUM", "INF" }; @@ -181,15 +182,11 @@ __fpu_dumpfpn(struct fpn *fp) } #endif -static int opmask[] = {0, 0, 1, 3}; +static const int opmask[] = {0, 0, 1, 3, 1}; /* Decode 5 bit register field depending on the type. */ #define RN_DECODE(tp, rn) \ - ((tp == FTYPE_DBL || tp == FTYPE_EXT ? INSFPdq_RN((rn)) : (rn)) & \ - ~opmask[tp]) - -/* Operand size in 32-bit registers. */ -#define OPSZ(tp) ((tp) == FTYPE_LNG ? 2 : (1 << (tp))) + ((tp) >= FTYPE_DBL ? INSFPdq_RN(rn) & ~opmask[tp] : (rn)) /* * Helper for forming the below case statements. Build only the op3 and opf @@ -209,8 +206,6 @@ static void __fpu_mov(struct fpemu *fe, int type, int rd, int rs2, u_int32_t nand, u_int32_t xor) { - u_int64_t tmp64; - int i; if (type == FTYPE_INT || type == FTYPE_SNG) __fpu_setreg(rd, (__fpu_getreg(rs2) & ~nand) ^ xor); @@ -219,13 +214,10 @@ __fpu_mov(struct fpemu *fe, int type, in * Need to use the double versions to be able to access * the upper 32 fp registers. */ - for (i = 0; i < OPSZ(type); i += 2, rd += 2, rs2 += 2) { - tmp64 = __fpu_getreg64(rs2); - if (i == 0) - tmp64 = (tmp64 & ~((u_int64_t)nand << 32)) ^ - ((u_int64_t)xor << 32); - __fpu_setreg64(rd, tmp64); - } + __fpu_setreg64(rd, (__fpu_getreg64(rs2) & + ~((u_int64_t)nand << 32)) ^ ((u_int64_t)xor << 32)); + if (type == FTYPE_EXT) + __fpu_setreg64(rd + 2, __fpu_getreg64(rs2 + 2)); } } @@ -271,17 +263,17 @@ __fpu_cmpck(struct fpemu *fe) * multiply two integers this way. */ static int -__fpu_execute(struct utrapframe *uf, struct fpemu *fe, u_int32_t insn, u_long tstate) +__fpu_execute(struct utrapframe *uf, struct fpemu *fe, u_int32_t insn, + u_long tstate) { struct fpn *fp; int opf, rs1, rs2, rd, type, mask, cx, cond; u_long reg, fsr; u_int space[4]; - int i; /* * `Decode' and execute instruction. Start with no exceptions. - * The type of any opf opcode is in the bottom two bits, so we + * The type of almost any OPF opcode is in the bottom two bits, so we * squish them out here. */ opf = insn & (IF_MASK(IF_F3_OP3_SHIFT, IF_F3_OP3_BITS) | @@ -359,7 +351,7 @@ __fpu_execute(struct utrapframe *uf, str __fpu_explode(fe, &fe->fe_f2, type, rs2); __fpu_compare(fe, 1, IF_F3_CC(insn)); return (__fpu_cmpck(fe)); - case FOP(INS2_FPop1, INSFP1_FMOV): /* these should all be pretty obvious */ + case FOP(INS2_FPop1, INSFP1_FMOV): __fpu_mov(fe, type, rd, rs2, 0, 0); return (0); case FOP(INS2_FPop1, INSFP1_FNEG): @@ -410,6 +402,7 @@ __fpu_execute(struct utrapframe *uf, str case FOP(INS2_FPop1, INSFP1_FxTOd): case FOP(INS2_FPop1, INSFP1_FxTOq): type = FTYPE_LNG; + rs2 = RN_DECODE(type, IF_F3_RS2(insn)); __fpu_explode(fe, fp = &fe->fe_f1, type, rs2); /* sneaky; depends on instruction encoding */ type = (IF_F3_OPF(insn) >> 2) & 3; @@ -418,8 +411,7 @@ __fpu_execute(struct utrapframe *uf, str case FOP(INS2_FPop1, INSFP1_FTOx): __fpu_explode(fe, fp = &fe->fe_f1, type, rs2); type = FTYPE_LNG; - mask = 1; /* needs 2 registers */ - rd = IF_F3_RD(insn) & ~mask; + rd = RN_DECODE(type, IF_F3_RD(insn)); break; case FOP(INS2_FPop1, INSFP1_FTOs): case FOP(INS2_FPop1, INSFP1_FTOd): @@ -457,10 +449,10 @@ __fpu_execute(struct utrapframe *uf, str if (type == FTYPE_INT || type == FTYPE_SNG) __fpu_setreg(rd, space[0]); else { - for (i = 0; i < OPSZ(type); i += 2) { - __fpu_setreg64(rd + i, ((u_int64_t)space[i] << 32) | - space[i + 1]); - } + __fpu_setreg64(rd, ((u_int64_t)space[0] << 32) | space[1]); + if (type == FTYPE_EXT) + __fpu_setreg64(rd + 2, + ((u_int64_t)space[2] << 32) | space[3]); } return (0); /* success */ } Modified: stable/8/lib/libc/sparc64/fpu/fpu_emu.h ============================================================================== --- stable/8/lib/libc/sparc64/fpu/fpu_emu.h Mon Mar 15 18:27:51 2010 (r205182) +++ stable/8/lib/libc/sparc64/fpu/fpu_emu.h Mon Mar 15 18:32:57 2010 (r205183) @@ -140,7 +140,7 @@ struct fpn { #define FTYPE_SNG INSFP_s #define FTYPE_DBL INSFP_d #define FTYPE_EXT INSFP_q -#define FTYPE_LNG -1 +#define FTYPE_LNG 4 /* * Emulator state. From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 18:33:24 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17BA2106566B; Mon, 15 Mar 2010 18:33:24 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 057D98FC0A; Mon, 15 Mar 2010 18:33:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FIXNVM042463; Mon, 15 Mar 2010 18:33:23 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FIXNnb042460; Mon, 15 Mar 2010 18:33:23 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201003151833.o2FIXNnb042460@svn.freebsd.org> From: Marius Strobl Date: Mon, 15 Mar 2010 18:33: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: r205184 - stable/7/lib/libc/sparc64/fpu X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 18:33:24 -0000 Author: marius Date: Mon Mar 15 18:33:23 2010 New Revision: 205184 URL: http://svn.freebsd.org/changeset/base/205184 Log: MFC: r204974, r205002 - The OPSZ macro actually only does the right thing for int32 and int64 operands but not for double and extended double ones. Instead of trying to fix the macro just nuke it and unroll the loops in the correct way though as extended double operands turn out to be the only special case. - For FxTO{s,d,q} the source operand is int64 so rs2 has to be re-decoded after setting type accordingly as it's generally decoded using the low 2 bits as the type, which are 0 for these three instructions. - Similarly, in case of F{s,d,q}TOx the target is int64 so rd has to be re-decoded using not only the operand mask appropriate for int64 but also the correct register number encoding. - Use const where appropriate. - Wrap long lines. Submitted by: Peter Jeremy (partly) Modified: stable/7/lib/libc/sparc64/fpu/fpu.c stable/7/lib/libc/sparc64/fpu/fpu_emu.h Directory Properties: stable/7/lib/libc/ (props changed) stable/7/lib/libc/stdtime/ (props changed) Modified: stable/7/lib/libc/sparc64/fpu/fpu.c ============================================================================== --- stable/7/lib/libc/sparc64/fpu/fpu.c Mon Mar 15 18:32:57 2010 (r205183) +++ stable/7/lib/libc/sparc64/fpu/fpu.c Mon Mar 15 18:33:23 2010 (r205184) @@ -97,7 +97,7 @@ __FBSDID("$FreeBSD$"); #define X8(x) X4(x),X4(x) #define X16(x) X8(x),X8(x) -static char cx_to_trapx[] = { +static const char cx_to_trapx[] = { X1(FSR_NX), X2(FSR_DZ), X4(FSR_UF), @@ -113,7 +113,8 @@ int __fpe_debug = 0; #endif #endif /* FPU_DEBUG */ -static int __fpu_execute(struct utrapframe *, struct fpemu *, u_int32_t, u_long); +static int __fpu_execute(struct utrapframe *, struct fpemu *, u_int32_t, + u_long); /* * Need to use an fpstate on the stack; we could switch, so we cannot safely @@ -169,7 +170,7 @@ __fpu_exception(struct utrapframe *uf) void __fpu_dumpfpn(struct fpn *fp) { - static char *class[] = { + static const char *const class[] = { "SNAN", "QNAN", "ZERO", "NUM", "INF" }; @@ -181,15 +182,11 @@ __fpu_dumpfpn(struct fpn *fp) } #endif -static int opmask[] = {0, 0, 1, 3}; +static const int opmask[] = {0, 0, 1, 3, 1}; /* Decode 5 bit register field depending on the type. */ #define RN_DECODE(tp, rn) \ - ((tp == FTYPE_DBL || tp == FTYPE_EXT ? INSFPdq_RN((rn)) : (rn)) & \ - ~opmask[tp]) - -/* Operand size in 32-bit registers. */ -#define OPSZ(tp) ((tp) == FTYPE_LNG ? 2 : (1 << (tp))) + ((tp) >= FTYPE_DBL ? INSFPdq_RN(rn) & ~opmask[tp] : (rn)) /* * Helper for forming the below case statements. Build only the op3 and opf @@ -209,8 +206,6 @@ static void __fpu_mov(struct fpemu *fe, int type, int rd, int rs2, u_int32_t nand, u_int32_t xor) { - u_int64_t tmp64; - int i; if (type == FTYPE_INT || type == FTYPE_SNG) __fpu_setreg(rd, (__fpu_getreg(rs2) & ~nand) ^ xor); @@ -219,13 +214,10 @@ __fpu_mov(struct fpemu *fe, int type, in * Need to use the double versions to be able to access * the upper 32 fp registers. */ - for (i = 0; i < OPSZ(type); i += 2, rd += 2, rs2 += 2) { - tmp64 = __fpu_getreg64(rs2); - if (i == 0) - tmp64 = (tmp64 & ~((u_int64_t)nand << 32)) ^ - ((u_int64_t)xor << 32); - __fpu_setreg64(rd, tmp64); - } + __fpu_setreg64(rd, (__fpu_getreg64(rs2) & + ~((u_int64_t)nand << 32)) ^ ((u_int64_t)xor << 32)); + if (type == FTYPE_EXT) + __fpu_setreg64(rd + 2, __fpu_getreg64(rs2 + 2)); } } @@ -271,17 +263,17 @@ __fpu_cmpck(struct fpemu *fe) * multiply two integers this way. */ static int -__fpu_execute(struct utrapframe *uf, struct fpemu *fe, u_int32_t insn, u_long tstate) +__fpu_execute(struct utrapframe *uf, struct fpemu *fe, u_int32_t insn, + u_long tstate) { struct fpn *fp; int opf, rs1, rs2, rd, type, mask, cx, cond; u_long reg, fsr; u_int space[4]; - int i; /* * `Decode' and execute instruction. Start with no exceptions. - * The type of any opf opcode is in the bottom two bits, so we + * The type of almost any OPF opcode is in the bottom two bits, so we * squish them out here. */ opf = insn & (IF_MASK(IF_F3_OP3_SHIFT, IF_F3_OP3_BITS) | @@ -359,7 +351,7 @@ __fpu_execute(struct utrapframe *uf, str __fpu_explode(fe, &fe->fe_f2, type, rs2); __fpu_compare(fe, 1, IF_F3_CC(insn)); return (__fpu_cmpck(fe)); - case FOP(INS2_FPop1, INSFP1_FMOV): /* these should all be pretty obvious */ + case FOP(INS2_FPop1, INSFP1_FMOV): __fpu_mov(fe, type, rd, rs2, 0, 0); return (0); case FOP(INS2_FPop1, INSFP1_FNEG): @@ -410,6 +402,7 @@ __fpu_execute(struct utrapframe *uf, str case FOP(INS2_FPop1, INSFP1_FxTOd): case FOP(INS2_FPop1, INSFP1_FxTOq): type = FTYPE_LNG; + rs2 = RN_DECODE(type, IF_F3_RS2(insn)); __fpu_explode(fe, fp = &fe->fe_f1, type, rs2); /* sneaky; depends on instruction encoding */ type = (IF_F3_OPF(insn) >> 2) & 3; @@ -418,8 +411,7 @@ __fpu_execute(struct utrapframe *uf, str case FOP(INS2_FPop1, INSFP1_FTOx): __fpu_explode(fe, fp = &fe->fe_f1, type, rs2); type = FTYPE_LNG; - mask = 1; /* needs 2 registers */ - rd = IF_F3_RD(insn) & ~mask; + rd = RN_DECODE(type, IF_F3_RD(insn)); break; case FOP(INS2_FPop1, INSFP1_FTOs): case FOP(INS2_FPop1, INSFP1_FTOd): @@ -457,10 +449,10 @@ __fpu_execute(struct utrapframe *uf, str if (type == FTYPE_INT || type == FTYPE_SNG) __fpu_setreg(rd, space[0]); else { - for (i = 0; i < OPSZ(type); i += 2) { - __fpu_setreg64(rd + i, ((u_int64_t)space[i] << 32) | - space[i + 1]); - } + __fpu_setreg64(rd, ((u_int64_t)space[0] << 32) | space[1]); + if (type == FTYPE_EXT) + __fpu_setreg64(rd + 2, + ((u_int64_t)space[2] << 32) | space[3]); } return (0); /* success */ } Modified: stable/7/lib/libc/sparc64/fpu/fpu_emu.h ============================================================================== --- stable/7/lib/libc/sparc64/fpu/fpu_emu.h Mon Mar 15 18:32:57 2010 (r205183) +++ stable/7/lib/libc/sparc64/fpu/fpu_emu.h Mon Mar 15 18:33:23 2010 (r205184) @@ -140,7 +140,7 @@ struct fpn { #define FTYPE_SNG INSFP_s #define FTYPE_DBL INSFP_d #define FTYPE_EXT INSFP_q -#define FTYPE_LNG -1 +#define FTYPE_LNG 4 /* * Emulator state. From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 18:33:33 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14E2F106566B; Mon, 15 Mar 2010 18:33:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 029F78FC19; Mon, 15 Mar 2010 18:33:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FIXW2U042533; Mon, 15 Mar 2010 18:33:32 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FIXWf4042530; Mon, 15 Mar 2010 18:33:32 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201003151833.o2FIXWf4042530@svn.freebsd.org> From: Marius Strobl Date: Mon, 15 Mar 2010 18:33:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205185 - stable/6/lib/libc/sparc64/fpu X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 18:33:33 -0000 Author: marius Date: Mon Mar 15 18:33:32 2010 New Revision: 205185 URL: http://svn.freebsd.org/changeset/base/205185 Log: MFC: r204974, r205002 - The OPSZ macro actually only does the right thing for int32 and int64 operands but not for double and extended double ones. Instead of trying to fix the macro just nuke it and unroll the loops in the correct way though as extended double operands turn out to be the only special case. - For FxTO{s,d,q} the source operand is int64 so rs2 has to be re-decoded after setting type accordingly as it's generally decoded using the low 2 bits as the type, which are 0 for these three instructions. - Similarly, in case of F{s,d,q}TOx the target is int64 so rd has to be re-decoded using not only the operand mask appropriate for int64 but also the correct register number encoding. - Use const where appropriate. - Wrap long lines. Submitted by: Peter Jeremy (partly) Modified: stable/6/lib/libc/sparc64/fpu/fpu.c stable/6/lib/libc/sparc64/fpu/fpu_emu.h Directory Properties: stable/6/lib/libc/ (props changed) Modified: stable/6/lib/libc/sparc64/fpu/fpu.c ============================================================================== --- stable/6/lib/libc/sparc64/fpu/fpu.c Mon Mar 15 18:33:23 2010 (r205184) +++ stable/6/lib/libc/sparc64/fpu/fpu.c Mon Mar 15 18:33:32 2010 (r205185) @@ -101,7 +101,7 @@ __FBSDID("$FreeBSD$"); #define X8(x) X4(x),X4(x) #define X16(x) X8(x),X8(x) -static char cx_to_trapx[] = { +static const char cx_to_trapx[] = { X1(FSR_NX), X2(FSR_DZ), X4(FSR_UF), @@ -117,7 +117,8 @@ int __fpe_debug = 0; #endif #endif /* FPU_DEBUG */ -static int __fpu_execute(struct utrapframe *, struct fpemu *, u_int32_t, u_long); +static int __fpu_execute(struct utrapframe *, struct fpemu *, u_int32_t, + u_long); /* * Need to use an fpstate on the stack; we could switch, so we cannot safely @@ -173,7 +174,7 @@ __fpu_exception(struct utrapframe *uf) void __fpu_dumpfpn(struct fpn *fp) { - static char *class[] = { + static const char *const class[] = { "SNAN", "QNAN", "ZERO", "NUM", "INF" }; @@ -185,15 +186,11 @@ __fpu_dumpfpn(struct fpn *fp) } #endif -static int opmask[] = {0, 0, 1, 3}; +static const int opmask[] = {0, 0, 1, 3, 1}; /* Decode 5 bit register field depending on the type. */ #define RN_DECODE(tp, rn) \ - ((tp == FTYPE_DBL || tp == FTYPE_EXT ? INSFPdq_RN((rn)) : (rn)) & \ - ~opmask[tp]) - -/* Operand size in 32-bit registers. */ -#define OPSZ(tp) ((tp) == FTYPE_LNG ? 2 : (1 << (tp))) + ((tp) >= FTYPE_DBL ? INSFPdq_RN(rn) & ~opmask[tp] : (rn)) /* * Helper for forming the below case statements. Build only the op3 and opf @@ -213,8 +210,6 @@ static void __fpu_mov(struct fpemu *fe, int type, int rd, int rs2, u_int32_t nand, u_int32_t xor) { - u_int64_t tmp64; - int i; if (type == FTYPE_INT || type == FTYPE_SNG) __fpu_setreg(rd, (__fpu_getreg(rs2) & ~nand) ^ xor); @@ -223,13 +218,10 @@ __fpu_mov(struct fpemu *fe, int type, in * Need to use the double versions to be able to access * the upper 32 fp registers. */ - for (i = 0; i < OPSZ(type); i += 2, rd += 2, rs2 += 2) { - tmp64 = __fpu_getreg64(rs2); - if (i == 0) - tmp64 = (tmp64 & ~((u_int64_t)nand << 32)) ^ - ((u_int64_t)xor << 32); - __fpu_setreg64(rd, tmp64); - } + __fpu_setreg64(rd, (__fpu_getreg64(rs2) & + ~((u_int64_t)nand << 32)) ^ ((u_int64_t)xor << 32)); + if (type == FTYPE_EXT) + __fpu_setreg64(rd + 2, __fpu_getreg64(rs2 + 2)); } } @@ -275,17 +267,17 @@ __fpu_cmpck(struct fpemu *fe) * multiply two integers this way. */ static int -__fpu_execute(struct utrapframe *uf, struct fpemu *fe, u_int32_t insn, u_long tstate) +__fpu_execute(struct utrapframe *uf, struct fpemu *fe, u_int32_t insn, + u_long tstate) { struct fpn *fp; int opf, rs1, rs2, rd, type, mask, cx, cond; u_long reg, fsr; u_int space[4]; - int i; /* * `Decode' and execute instruction. Start with no exceptions. - * The type of any opf opcode is in the bottom two bits, so we + * The type of almost any OPF opcode is in the bottom two bits, so we * squish them out here. */ opf = insn & (IF_MASK(IF_F3_OP3_SHIFT, IF_F3_OP3_BITS) | @@ -363,7 +355,7 @@ __fpu_execute(struct utrapframe *uf, str __fpu_explode(fe, &fe->fe_f2, type, rs2); __fpu_compare(fe, 1, IF_F3_CC(insn)); return (__fpu_cmpck(fe)); - case FOP(INS2_FPop1, INSFP1_FMOV): /* these should all be pretty obvious */ + case FOP(INS2_FPop1, INSFP1_FMOV): __fpu_mov(fe, type, rd, rs2, 0, 0); return (0); case FOP(INS2_FPop1, INSFP1_FNEG): @@ -414,6 +406,7 @@ __fpu_execute(struct utrapframe *uf, str case FOP(INS2_FPop1, INSFP1_FxTOd): case FOP(INS2_FPop1, INSFP1_FxTOq): type = FTYPE_LNG; + rs2 = RN_DECODE(type, IF_F3_RS2(insn)); __fpu_explode(fe, fp = &fe->fe_f1, type, rs2); /* sneaky; depends on instruction encoding */ type = (IF_F3_OPF(insn) >> 2) & 3; @@ -422,8 +415,7 @@ __fpu_execute(struct utrapframe *uf, str case FOP(INS2_FPop1, INSFP1_FTOx): __fpu_explode(fe, fp = &fe->fe_f1, type, rs2); type = FTYPE_LNG; - mask = 1; /* needs 2 registers */ - rd = IF_F3_RD(insn) & ~mask; + rd = RN_DECODE(type, IF_F3_RD(insn)); break; case FOP(INS2_FPop1, INSFP1_FTOs): case FOP(INS2_FPop1, INSFP1_FTOd): @@ -461,10 +453,10 @@ __fpu_execute(struct utrapframe *uf, str if (type == FTYPE_INT || type == FTYPE_SNG) __fpu_setreg(rd, space[0]); else { - for (i = 0; i < OPSZ(type); i += 2) { - __fpu_setreg64(rd + i, ((u_int64_t)space[i] << 32) | - space[i + 1]); - } + __fpu_setreg64(rd, ((u_int64_t)space[0] << 32) | space[1]); + if (type == FTYPE_EXT) + __fpu_setreg64(rd + 2, + ((u_int64_t)space[2] << 32) | space[3]); } return (0); /* success */ } Modified: stable/6/lib/libc/sparc64/fpu/fpu_emu.h ============================================================================== --- stable/6/lib/libc/sparc64/fpu/fpu_emu.h Mon Mar 15 18:33:23 2010 (r205184) +++ stable/6/lib/libc/sparc64/fpu/fpu_emu.h Mon Mar 15 18:33:32 2010 (r205185) @@ -149,7 +149,7 @@ struct fpn { #define FTYPE_SNG INSFP_s #define FTYPE_DBL INSFP_d #define FTYPE_EXT INSFP_q -#define FTYPE_LNG -1 +#define FTYPE_LNG 4 /* * Emulator state. From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 19:04:44 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72894106566C; Mon, 15 Mar 2010 19:04:44 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 610FB8FC0C; Mon, 15 Mar 2010 19:04:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FJ4ip0049548; Mon, 15 Mar 2010 19:04:44 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FJ4iVn049545; Mon, 15 Mar 2010 19:04:44 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201003151904.o2FJ4iVn049545@svn.freebsd.org> From: Marius Strobl Date: Mon, 15 Mar 2010 19:04:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205186 - stable/8/sys/dev/mii X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 19:04:44 -0000 Author: marius Date: Mon Mar 15 19:04:44 2010 New Revision: 205186 URL: http://svn.freebsd.org/changeset/base/205186 Log: MFC: r204144 Add support for BCM54K2 found in combination with Apple K2 GMAC. Submitted by: Andreas Tobler Obtained from: OpenBSD Modified: stable/8/sys/dev/mii/brgphy.c stable/8/sys/dev/mii/miidevs Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/mii/brgphy.c ============================================================================== --- stable/8/sys/dev/mii/brgphy.c Mon Mar 15 18:33:32 2010 (r205185) +++ stable/8/sys/dev/mii/brgphy.c Mon Mar 15 19:04:44 2010 (r205186) @@ -104,6 +104,7 @@ static void brgphy_reset(struct mii_soft static void brgphy_enable_loopback(struct mii_softc *); static void bcm5401_load_dspcode(struct mii_softc *); static void bcm5411_load_dspcode(struct mii_softc *); +static void bcm54k2_load_dspcode(struct mii_softc *); static void brgphy_fixup_5704_a0_bug(struct mii_softc *); static void brgphy_fixup_adc_bug(struct mii_softc *); static void brgphy_fixup_adjust_trim(struct mii_softc *); @@ -117,6 +118,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM, BCM5400), MII_PHY_DESC(xxBROADCOM, BCM5401), MII_PHY_DESC(xxBROADCOM, BCM5411), + MII_PHY_DESC(xxBROADCOM, BCM54K2), MII_PHY_DESC(xxBROADCOM, BCM5701), MII_PHY_DESC(xxBROADCOM, BCM5703), MII_PHY_DESC(xxBROADCOM, BCM5704), @@ -415,6 +417,9 @@ brgphy_service(struct mii_softc *sc, str case MII_MODEL_xxBROADCOM_BCM5411: bcm5411_load_dspcode(sc); break; + case MII_MODEL_xxBROADCOM_BCM54K2: + bcm54k2_load_dspcode(sc); + break; } break; case MII_OUI_xxBROADCOM_ALT1: @@ -730,6 +735,24 @@ bcm5411_load_dspcode(struct mii_softc *s PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); } +void +bcm54k2_load_dspcode(struct mii_softc *sc) +{ + static const struct { + int reg; + uint16_t val; + } dspcode[] = { + { 4, 0x01e1 }, + { 9, 0x0300 }, + { 0, 0 }, + }; + int i; + + for (i = 0; dspcode[i].reg != 0; i++) + PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); + +} + static void brgphy_fixup_5704_a0_bug(struct mii_softc *sc) { @@ -932,6 +955,9 @@ brgphy_reset(struct mii_softc *sc) case MII_MODEL_xxBROADCOM_BCM5411: bcm5411_load_dspcode(sc); break; + case MII_MODEL_xxBROADCOM_BCM54K2: + bcm54k2_load_dspcode(sc); + break; } break; case MII_OUI_xxBROADCOM_ALT1: Modified: stable/8/sys/dev/mii/miidevs ============================================================================== --- stable/8/sys/dev/mii/miidevs Mon Mar 15 18:33:32 2010 (r205185) +++ stable/8/sys/dev/mii/miidevs Mon Mar 15 19:04:44 2010 (r205186) @@ -145,6 +145,7 @@ model xxBROADCOM BCM5703 0x0016 BCM5703 model xxBROADCOM BCM5704 0x0019 BCM5704 10/100/1000baseTX PHY model xxBROADCOM BCM5705 0x001a BCM5705 10/100/1000baseTX PHY model xxBROADCOM BCM5750 0x0018 BCM5750 10/100/1000baseTX PHY +model xxBROADCOM BCM54K2 0x002e BCM54K2 10/100/1000baseTX PHY model xxBROADCOM BCM5714 0x0034 BCM5714 10/100/1000baseTX PHY model xxBROADCOM BCM5780 0x0035 BCM5780 10/100/1000baseTX PHY model xxBROADCOM BCM5708C 0x0036 BCM5708C 10/100/1000baseTX PHY From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 19:04:51 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9B18106577B; Mon, 15 Mar 2010 19:04:51 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A89278FC16; Mon, 15 Mar 2010 19:04:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FJ4pfH049588; Mon, 15 Mar 2010 19:04:51 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FJ4pUU049585; Mon, 15 Mar 2010 19:04:51 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201003151904.o2FJ4pUU049585@svn.freebsd.org> From: Marius Strobl Date: Mon, 15 Mar 2010 19:04:51 +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: r205187 - stable/7/sys/dev/mii X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 19:04:51 -0000 Author: marius Date: Mon Mar 15 19:04:51 2010 New Revision: 205187 URL: http://svn.freebsd.org/changeset/base/205187 Log: MFC: r204144 Add support for BCM54K2 found in combination with Apple K2 GMAC. Submitted by: Andreas Tobler Obtained from: OpenBSD Modified: stable/7/sys/dev/mii/brgphy.c stable/7/sys/dev/mii/miidevs Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/mii/brgphy.c ============================================================================== --- stable/7/sys/dev/mii/brgphy.c Mon Mar 15 19:04:44 2010 (r205186) +++ stable/7/sys/dev/mii/brgphy.c Mon Mar 15 19:04:51 2010 (r205187) @@ -104,6 +104,7 @@ static void brgphy_reset(struct mii_soft static void brgphy_enable_loopback(struct mii_softc *); static void bcm5401_load_dspcode(struct mii_softc *); static void bcm5411_load_dspcode(struct mii_softc *); +static void bcm54k2_load_dspcode(struct mii_softc *); static void brgphy_fixup_5704_a0_bug(struct mii_softc *); static void brgphy_fixup_adc_bug(struct mii_softc *); static void brgphy_fixup_adjust_trim(struct mii_softc *); @@ -117,6 +118,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM, BCM5400), MII_PHY_DESC(xxBROADCOM, BCM5401), MII_PHY_DESC(xxBROADCOM, BCM5411), + MII_PHY_DESC(xxBROADCOM, BCM54K2), MII_PHY_DESC(xxBROADCOM, BCM5701), MII_PHY_DESC(xxBROADCOM, BCM5703), MII_PHY_DESC(xxBROADCOM, BCM5704), @@ -415,6 +417,9 @@ brgphy_service(struct mii_softc *sc, str case MII_MODEL_xxBROADCOM_BCM5411: bcm5411_load_dspcode(sc); break; + case MII_MODEL_xxBROADCOM_BCM54K2: + bcm54k2_load_dspcode(sc); + break; } break; case MII_OUI_xxBROADCOM_ALT1: @@ -718,6 +723,24 @@ bcm5411_load_dspcode(struct mii_softc *s PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); } +void +bcm54k2_load_dspcode(struct mii_softc *sc) +{ + static const struct { + int reg; + uint16_t val; + } dspcode[] = { + { 4, 0x01e1 }, + { 9, 0x0300 }, + { 0, 0 }, + }; + int i; + + for (i = 0; dspcode[i].reg != 0; i++) + PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); + +} + static void brgphy_fixup_5704_a0_bug(struct mii_softc *sc) { @@ -920,6 +943,9 @@ brgphy_reset(struct mii_softc *sc) case MII_MODEL_xxBROADCOM_BCM5411: bcm5411_load_dspcode(sc); break; + case MII_MODEL_xxBROADCOM_BCM54K2: + bcm54k2_load_dspcode(sc); + break; } break; case MII_OUI_xxBROADCOM_ALT1: Modified: stable/7/sys/dev/mii/miidevs ============================================================================== --- stable/7/sys/dev/mii/miidevs Mon Mar 15 19:04:44 2010 (r205186) +++ stable/7/sys/dev/mii/miidevs Mon Mar 15 19:04:51 2010 (r205187) @@ -140,6 +140,7 @@ model xxBROADCOM BCM5703 0x0016 BCM5703 model xxBROADCOM BCM5704 0x0019 BCM5704 10/100/1000baseTX PHY model xxBROADCOM BCM5705 0x001a BCM5705 10/100/1000baseTX PHY model xxBROADCOM BCM5750 0x0018 BCM5750 10/100/1000baseTX PHY +model xxBROADCOM BCM54K2 0x002e BCM54K2 10/100/1000baseTX PHY model xxBROADCOM BCM5714 0x0034 BCM5714 10/100/1000baseTX PHY model xxBROADCOM BCM5780 0x0035 BCM5780 10/100/1000baseTX PHY model xxBROADCOM BCM5708C 0x0036 BCM5708C 10/100/1000baseTX PHY From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 19:04:56 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1D84106564A; Mon, 15 Mar 2010 19:04:56 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A60A18FC17; Mon, 15 Mar 2010 19:04:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FJ4uDo049657; Mon, 15 Mar 2010 19:04:56 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FJ4uT3049654; Mon, 15 Mar 2010 19:04:56 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201003151904.o2FJ4uT3049654@svn.freebsd.org> From: Marius Strobl Date: Mon, 15 Mar 2010 19:04:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205188 - stable/6/sys/dev/mii X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 19:04:57 -0000 Author: marius Date: Mon Mar 15 19:04:56 2010 New Revision: 205188 URL: http://svn.freebsd.org/changeset/base/205188 Log: MFC: r204144 Add support for BCM54K2 found in combination with Apple K2 GMAC. Submitted by: Andreas Tobler Obtained from: OpenBSD Modified: stable/6/sys/dev/mii/brgphy.c stable/6/sys/dev/mii/miidevs Directory Properties: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/dev/mii/brgphy.c ============================================================================== --- stable/6/sys/dev/mii/brgphy.c Mon Mar 15 19:04:51 2010 (r205187) +++ stable/6/sys/dev/mii/brgphy.c Mon Mar 15 19:04:56 2010 (r205188) @@ -104,6 +104,7 @@ static void brgphy_reset(struct mii_soft static void brgphy_enable_loopback(struct mii_softc *); static void bcm5401_load_dspcode(struct mii_softc *); static void bcm5411_load_dspcode(struct mii_softc *); +static void bcm54k2_load_dspcode(struct mii_softc *); static void brgphy_fixup_5704_a0_bug(struct mii_softc *); static void brgphy_fixup_adc_bug(struct mii_softc *); static void brgphy_fixup_adjust_trim(struct mii_softc *); @@ -117,6 +118,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM, BCM5400), MII_PHY_DESC(xxBROADCOM, BCM5401), MII_PHY_DESC(xxBROADCOM, BCM5411), + MII_PHY_DESC(xxBROADCOM, BCM54K2), MII_PHY_DESC(xxBROADCOM, BCM5701), MII_PHY_DESC(xxBROADCOM, BCM5703), MII_PHY_DESC(xxBROADCOM, BCM5704), @@ -418,6 +420,9 @@ brgphy_service(struct mii_softc *sc, str case MII_MODEL_xxBROADCOM_BCM5411: bcm5411_load_dspcode(sc); break; + case MII_MODEL_xxBROADCOM_BCM54K2: + bcm54k2_load_dspcode(sc); + break; } break; case MII_OUI_xxBROADCOM_ALT1: @@ -717,6 +722,24 @@ bcm5411_load_dspcode(struct mii_softc *s PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); } +void +bcm54k2_load_dspcode(struct mii_softc *sc) +{ + static const struct { + int reg; + uint16_t val; + } dspcode[] = { + { 4, 0x01e1 }, + { 9, 0x0300 }, + { 0, 0 }, + }; + int i; + + for (i = 0; dspcode[i].reg != 0; i++) + PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); + +} + static void brgphy_fixup_5704_a0_bug(struct mii_softc *sc) { @@ -917,6 +940,9 @@ brgphy_reset(struct mii_softc *sc) case MII_MODEL_xxBROADCOM_BCM5411: bcm5411_load_dspcode(sc); break; + case MII_MODEL_xxBROADCOM_BCM54K2: + bcm54k2_load_dspcode(sc); + break; } break; case MII_OUI_xxBROADCOM_ALT1: Modified: stable/6/sys/dev/mii/miidevs ============================================================================== --- stable/6/sys/dev/mii/miidevs Mon Mar 15 19:04:51 2010 (r205187) +++ stable/6/sys/dev/mii/miidevs Mon Mar 15 19:04:56 2010 (r205188) @@ -131,6 +131,7 @@ model xxBROADCOM BCM5703 0x0016 BCM5703 model xxBROADCOM BCM5704 0x0019 BCM5704 10/100/1000baseTX PHY model xxBROADCOM BCM5705 0x001a BCM5705 10/100/1000baseTX PHY model xxBROADCOM BCM5750 0x0018 BCM5750 10/100/1000baseTX PHY +model xxBROADCOM BCM54K2 0x002e BCM54K2 10/100/1000baseTX PHY model xxBROADCOM BCM5714 0x0034 BCM5714 10/100/1000baseTX PHY model xxBROADCOM BCM5780 0x0035 BCM5780 10/100/1000baseTX PHY model xxBROADCOM BCM5708C 0x0036 BCM5708C 10/100/1000baseTX PHY From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 19:13:37 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E3DB1065672; Mon, 15 Mar 2010 19:13:37 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D1538FC16; Mon, 15 Mar 2010 19:13:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FJDbFt051710; Mon, 15 Mar 2010 19:13:37 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FJDbZD051708; Mon, 15 Mar 2010 19:13:37 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201003151913.o2FJDbZD051708@svn.freebsd.org> From: Marius Strobl Date: Mon, 15 Mar 2010 19:13:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205189 - stable/8/sys/dev/gem X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 19:13:37 -0000 Author: marius Date: Mon Mar 15 19:13:36 2010 New Revision: 205189 URL: http://svn.freebsd.org/changeset/base/205189 Log: MFC: r204222 According to the Linux sungem driver, in case of Apple (K2) GMACs GEM_MIF_CONFIG_MDI0 cannot be trusted when the firmware has powered down the chip so the internal transceiver has to be hardcoded. This is also in line with the AppleGMACEthernet driver, which just doesn't distinguish between internal/external transceiver and MDIO/MDI1 respectively in the first place. Tested by: Andreas Tobler Modified: stable/8/sys/dev/gem/if_gem.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/gem/if_gem.c ============================================================================== --- stable/8/sys/dev/gem/if_gem.c Mon Mar 15 19:04:56 2010 (r205188) +++ stable/8/sys/dev/gem/if_gem.c Mon Mar 15 19:13:36 2010 (r205189) @@ -297,8 +297,11 @@ gem_attach(struct gem_softc *sc) /* * Fall back on an internal PHY if no external PHY was found. + * Note that with Apple (K2) GMACs GEM_MIF_CONFIG_MDI0 can't be + * trusted when the firmware has powered down the chip. */ - if (error != 0 && (v & GEM_MIF_CONFIG_MDI0) != 0) { + if (error != 0 && + ((v & GEM_MIF_CONFIG_MDI0) != 0 || GEM_IS_APPLE(sc))) { v &= ~GEM_MIF_CONFIG_PHY_SEL; GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v); switch (sc->sc_variant) { From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 19:13:49 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9915106564A; Mon, 15 Mar 2010 19:13:49 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 929D38FC19; Mon, 15 Mar 2010 19:13:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FJDnWi051782; Mon, 15 Mar 2010 19:13:49 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FJDnor051780; Mon, 15 Mar 2010 19:13:49 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201003151913.o2FJDnor051780@svn.freebsd.org> From: Marius Strobl Date: Mon, 15 Mar 2010 19:13:49 +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: r205190 - stable/7/sys/dev/gem X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 19:13:50 -0000 Author: marius Date: Mon Mar 15 19:13:49 2010 New Revision: 205190 URL: http://svn.freebsd.org/changeset/base/205190 Log: MFC: r204222 According to the Linux sungem driver, in case of Apple (K2) GMACs GEM_MIF_CONFIG_MDI0 cannot be trusted when the firmware has powered down the chip so the internal transceiver has to be hardcoded. This is also in line with the AppleGMACEthernet driver, which just doesn't distinguish between internal/external transceiver and MDIO/MDI1 respectively in the first place. Tested by: Andreas Tobler Modified: stable/7/sys/dev/gem/if_gem.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/gem/if_gem.c ============================================================================== --- stable/7/sys/dev/gem/if_gem.c Mon Mar 15 19:13:36 2010 (r205189) +++ stable/7/sys/dev/gem/if_gem.c Mon Mar 15 19:13:49 2010 (r205190) @@ -297,8 +297,11 @@ gem_attach(struct gem_softc *sc) /* * Fall back on an internal PHY if no external PHY was found. + * Note that with Apple (K2) GMACs GEM_MIF_CONFIG_MDI0 can't be + * trusted when the firmware has powered down the chip. */ - if (error != 0 && (v & GEM_MIF_CONFIG_MDI0) != 0) { + if (error != 0 && + ((v & GEM_MIF_CONFIG_MDI0) != 0 || GEM_IS_APPLE(sc))) { v &= ~GEM_MIF_CONFIG_PHY_SEL; GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v); switch (sc->sc_variant) { From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 19:13:53 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 348E6106566C; Mon, 15 Mar 2010 19:13:53 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23C4F8FC08; Mon, 15 Mar 2010 19:13:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FJDrmM051817; Mon, 15 Mar 2010 19:13:53 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FJDr3L051815; Mon, 15 Mar 2010 19:13:53 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201003151913.o2FJDr3L051815@svn.freebsd.org> From: Marius Strobl Date: Mon, 15 Mar 2010 19:13:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205191 - stable/6/sys/dev/gem X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 19:13:53 -0000 Author: marius Date: Mon Mar 15 19:13:52 2010 New Revision: 205191 URL: http://svn.freebsd.org/changeset/base/205191 Log: MFC: r204222 According to the Linux sungem driver, in case of Apple (K2) GMACs GEM_MIF_CONFIG_MDI0 cannot be trusted when the firmware has powered down the chip so the internal transceiver has to be hardcoded. This is also in line with the AppleGMACEthernet driver, which just doesn't distinguish between internal/external transceiver and MDIO/MDI1 respectively in the first place. Tested by: Andreas Tobler Modified: stable/6/sys/dev/gem/if_gem.c Directory Properties: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/dev/gem/if_gem.c ============================================================================== --- stable/6/sys/dev/gem/if_gem.c Mon Mar 15 19:13:49 2010 (r205190) +++ stable/6/sys/dev/gem/if_gem.c Mon Mar 15 19:13:52 2010 (r205191) @@ -298,8 +298,11 @@ gem_attach(struct gem_softc *sc) /* * Fall back on an internal PHY if no external PHY was found. + * Note that with Apple (K2) GMACs GEM_MIF_CONFIG_MDI0 can't be + * trusted when the firmware has powered down the chip. */ - if (error != 0 && (v & GEM_MIF_CONFIG_MDI0) != 0) { + if (error != 0 && + ((v & GEM_MIF_CONFIG_MDI0) != 0 || GEM_IS_APPLE(sc))) { v &= ~GEM_MIF_CONFIG_PHY_SEL; GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v); switch (sc->sc_variant) { From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 19:51:25 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55D22106566B; Mon, 15 Mar 2010 19:51:25 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2ACD98FC18; Mon, 15 Mar 2010 19:51:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FJpPHU060182; Mon, 15 Mar 2010 19:51:25 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FJpP8Y060179; Mon, 15 Mar 2010 19:51:25 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201003151951.o2FJpP8Y060179@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 15 Mar 2010 19:51:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205192 - in stable/8/sys/arm/mv: . kirkwood X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 19:51:25 -0000 Author: raj Date: Mon Mar 15 19:51:24 2010 New Revision: 205192 URL: http://svn.freebsd.org/changeset/base/205192 Log: MFC r204764 Provide correct TCLK value for Kirkwood A1 silicon revision. While there improve SOC ID output accordingly. Obtained from: Semihalf Modified: stable/8/sys/arm/mv/common.c stable/8/sys/arm/mv/kirkwood/kirkwood.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/arm/mv/common.c ============================================================================== --- stable/8/sys/arm/mv/common.c Mon Mar 15 19:13:52 2010 (r205191) +++ stable/8/sys/arm/mv/common.c Mon Mar 15 19:51:24 2010 (r205192) @@ -261,6 +261,8 @@ soc_identify(void) rev = "Z0"; else if (r == 2) rev = "A0"; + else if (r == 3) + rev = "A1"; break; case MV_DEV_MV78100_Z0: dev = "Marvell MV78100 Z0"; Modified: stable/8/sys/arm/mv/kirkwood/kirkwood.c ============================================================================== --- stable/8/sys/arm/mv/kirkwood/kirkwood.c Mon Mar 15 19:13:52 2010 (r205191) +++ stable/8/sys/arm/mv/kirkwood/kirkwood.c Mon Mar 15 19:51:24 2010 (r205192) @@ -176,11 +176,11 @@ get_tclk(void) /* * On Kirkwood TCLK is not configurable and depends on silicon * revision: - * - A0 has TCLK hardcoded to 200 MHz. + * - A0 and A1 have TCLK hardcoded to 200 MHz. * - Z0 and others have TCLK hardcoded to 166 MHz. */ soc_id(&dev, &rev); - if (dev == MV_DEV_88F6281 && rev == 2) + if (dev == MV_DEV_88F6281 && (rev == 2 || rev == 3)) return (TCLK_200MHZ); return (TCLK_166MHZ); From owner-svn-src-stable@FreeBSD.ORG Mon Mar 15 19:59:16 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6442106566B; Mon, 15 Mar 2010 19:59:16 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA0298FC18; Mon, 15 Mar 2010 19:59:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FJxGST061942; Mon, 15 Mar 2010 19:59:16 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2FJxGHI061939; Mon, 15 Mar 2010 19:59:16 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201003151959.o2FJxGHI061939@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 15 Mar 2010 19:59:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205193 - stable/8/sys/arm/arm X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 19:59:17 -0000 Author: raj Date: Mon Mar 15 19:59:16 2010 New Revision: 205193 URL: http://svn.freebsd.org/changeset/base/205193 Log: MFC r205028 Fix ARM cache handling yet more. 1) vm_machdep.c: remove the dangling allocations so they do not un-necessarily turn off the cache upon consecutive access. 2) busdma_machdep.c: remove the same amount than shadow mapped. Reported by: Maks Verver Submitted by: Mark Tinguely Reviewed by: Grzegorz Bernacki Modified: stable/8/sys/arm/arm/busdma_machdep.c stable/8/sys/arm/arm/vm_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/arm/arm/busdma_machdep.c ============================================================================== --- stable/8/sys/arm/arm/busdma_machdep.c Mon Mar 15 19:51:24 2010 (r205192) +++ stable/8/sys/arm/arm/busdma_machdep.c Mon Mar 15 19:59:16 2010 (r205193) @@ -649,7 +649,8 @@ bus_dmamem_free(bus_dma_tag_t dmat, void KASSERT(map->allocbuffer == vaddr, ("Trying to freeing the wrong DMA buffer")); vaddr = map->origbuffer; - arm_unmap_nocache(map->allocbuffer, dmat->maxsize); + arm_unmap_nocache(map->allocbuffer, + dmat->maxsize + ((vm_offset_t)vaddr & PAGE_MASK)); } if (dmat->maxsize <= PAGE_SIZE && dmat->alignment < dmat->maxsize && Modified: stable/8/sys/arm/arm/vm_machdep.c ============================================================================== --- stable/8/sys/arm/arm/vm_machdep.c Mon Mar 15 19:51:24 2010 (r205192) +++ stable/8/sys/arm/arm/vm_machdep.c Mon Mar 15 19:59:16 2010 (r205193) @@ -171,6 +171,9 @@ sf_buf_free(struct sf_buf *sf) if (sf->ref_count == 0) { TAILQ_INSERT_TAIL(&sf_buf_freelist, sf, free_entry); nsfbufsused--; + pmap_kremove(sf->kva); + sf->m = NULL; + LIST_REMOVE(sf, list_entry); if (sf_buf_alloc_want > 0) wakeup_one(&sf_buf_freelist); } @@ -502,9 +505,12 @@ arm_unmap_nocache(void *addr, vm_size_t size = round_page(size); i = (raddr - arm_nocache_startaddr) / (PAGE_SIZE); - for (; size > 0; size -= PAGE_SIZE, i++) + for (; size > 0; size -= PAGE_SIZE, i++) { arm_nocache_allocated[i / BITS_PER_INT] &= ~(1 << (i % BITS_PER_INT)); + pmap_kremove(raddr); + raddr += PAGE_SIZE; + } } #ifdef ARM_USE_SMALL_ALLOC From owner-svn-src-stable@FreeBSD.ORG Tue Mar 16 05:13:20 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF7581065672; Tue, 16 Mar 2010 05:13:20 +0000 (UTC) (envelope-from joerg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE58C8FC16; Tue, 16 Mar 2010 05:13:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2G5DKD4084002; Tue, 16 Mar 2010 05:13:20 GMT (envelope-from joerg@svn.freebsd.org) Received: (from joerg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2G5DKUM084000; Tue, 16 Mar 2010 05:13:20 GMT (envelope-from joerg@svn.freebsd.org) Message-Id: <201003160513.o2G5DKUM084000@svn.freebsd.org> From: Joerg Wunsch Date: Tue, 16 Mar 2010 05:13:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205206 - stable/8/usr.sbin/powerd X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2010 05:13:21 -0000 Author: joerg Date: Tue Mar 16 05:13:20 2010 New Revision: 205206 URL: http://svn.freebsd.org/changeset/base/205206 Log: r205170: then -> than Modified: stable/8/usr.sbin/powerd/powerd.8 Directory Properties: stable/8/usr.sbin/powerd/ (props changed) Modified: stable/8/usr.sbin/powerd/powerd.8 ============================================================================== --- stable/8/usr.sbin/powerd/powerd.8 Tue Mar 16 04:36:11 2010 (r205205) +++ stable/8/usr.sbin/powerd/powerd.8 Tue Mar 16 05:13:20 2010 (r205206) @@ -58,7 +58,7 @@ the system appears idle and increasing i It offers a good balance between a small performance loss for greatly increased power savings. Hiadaptive mode is like adaptive mode, but tuned for systems where -performance and interactivity are more important then power consumption. +performance and interactivity are more important than power consumption. It increases frequency faster, reduces the frequency less aggressively and will maintain full frequency for longer. The default mode is adaptive for battery power and hiadaptive for the rest. From owner-svn-src-stable@FreeBSD.ORG Wed Mar 17 07:26:00 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DFDD106564A; Wed, 17 Mar 2010 07:26:00 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8184D8FC15; Wed, 17 Mar 2010 07:26:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2H7Q0lA033702; Wed, 17 Mar 2010 07:26:00 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2H7Q013033699; Wed, 17 Mar 2010 07:26:00 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201003170726.o2H7Q013033699@svn.freebsd.org> From: Doug Barton Date: Wed, 17 Mar 2010 07:26:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205245 - stable/8/usr.sbin/mergemaster X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2010 07:26:00 -0000 Author: dougb Date: Wed Mar 17 07:26:00 2010 New Revision: 205245 URL: http://svn.freebsd.org/changeset/base/205245 Log: MFC r205145: Make it more clear in the docs that -a is not compatible with -iFU, and enforce this in the code. Apparently a lot of users mistakenly combine -a with these flags and are then mystified that no changes were made. While I'm here, fix a trailing space in mergemaster.8 Modified: stable/8/usr.sbin/mergemaster/mergemaster.8 stable/8/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/8/usr.sbin/mergemaster/ (props changed) Modified: stable/8/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- stable/8/usr.sbin/mergemaster/mergemaster.8 Wed Mar 17 07:16:27 2010 (r205244) +++ stable/8/usr.sbin/mergemaster/mergemaster.8 Wed Mar 17 07:26:00 2010 (r205245) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 2010 +.Dd March 13, 2010 .Dt MERGEMASTER 8 .Os .Sh NAME @@ -32,7 +32,8 @@ .Nd merge configuration files, et al during an upgrade .Sh SYNOPSIS .Nm -.Op Fl scrvahipFCPU +.Op Fl scrvhpCP +.Op Fl a|iFU .Op Fl m Ar /path/to/sources .Op Fl t Ar /path/to/temp/root .Op Fl d @@ -168,7 +169,7 @@ and therefore can override both files. When the comparison is done if there are any files remaining in the temproot directory they will be listed, and if the .Fl a -option is not in use the user will be given the option of +option is not in use the user will be given the option of deleting the temproot directory. If there are no files remaining in the temproot directory it will be deleted. @@ -206,9 +207,11 @@ If the directory exists, it creates a new one in a previously non-existent directory. This option unsets the verbose flag, -but other than -.Fl U -it is compatible with all other options. +and is not compatible with +.Fl i , +.Fl F , +or +.Fl U . Setting .Fl a makes Modified: stable/8/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/8/usr.sbin/mergemaster/mergemaster.sh Wed Mar 17 07:16:27 2010 (r205244) +++ stable/8/usr.sbin/mergemaster/mergemaster.sh Wed Mar 17 07:26:00 2010 (r205245) @@ -15,7 +15,7 @@ PATH=/bin:/usr/bin:/usr/sbin display_usage () { VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` echo "mergemaster version ${VERSION_NUMBER}" - echo 'Usage: mergemaster [-scrvahipFCPU]' + echo 'Usage: mergemaster [-scrvhpCP] [-a|[-iFU]]' echo ' [-m /path] [-t /path] [-d] [-u N] [-w N] [-A arch] [-D /path]' echo "Options:" echo " -s Strict comparison (diff every pair of files)" @@ -337,6 +337,18 @@ while getopts ":ascrvhipCPm:t:du:w:D:A:F esac done +if [ -n "$AUTO_RUN" ]; then + if [ -n "$FREEBSD_ID" -o -n "$AUTO_UPGRADE" -o -n "$AUTO_INSTALL" ]; then + echo '' + echo "*** You have included the -a option along with one or more options" + echo ' that indicate that you wish mergemaster to actually make updates' + echo ' (-F, -U, or -i), however these options are not compatible.' + echo ' Please read mergemaster(8) for more information.' + echo '' + exit 1 + fi +fi + # Assign the location of the mtree database # MTREEDB=${MTREEDB:-${DESTDIR}/var/db} From owner-svn-src-stable@FreeBSD.ORG Wed Mar 17 07:27:00 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53168106566B; Wed, 17 Mar 2010 07:27:00 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 25F7B8FC14; Wed, 17 Mar 2010 07:27:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2H7R01e033978; Wed, 17 Mar 2010 07:27:00 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2H7R0k4033975; Wed, 17 Mar 2010 07:27:00 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201003170727.o2H7R0k4033975@svn.freebsd.org> From: Doug Barton Date: Wed, 17 Mar 2010 07:27:00 +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: r205246 - stable/7/usr.sbin/mergemaster X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2010 07:27:00 -0000 Author: dougb Date: Wed Mar 17 07:26:59 2010 New Revision: 205246 URL: http://svn.freebsd.org/changeset/base/205246 Log: MFC r205145: Make it more clear in the docs that -a is not compatible with -iFU, and enforce this in the code. Apparently a lot of users mistakenly combine -a with these flags and are then mystified that no changes were made. While I'm here, fix a trailing space in mergemaster.8 Modified: stable/7/usr.sbin/mergemaster/mergemaster.8 stable/7/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/7/usr.sbin/mergemaster/ (props changed) Modified: stable/7/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- stable/7/usr.sbin/mergemaster/mergemaster.8 Wed Mar 17 07:26:00 2010 (r205245) +++ stable/7/usr.sbin/mergemaster/mergemaster.8 Wed Mar 17 07:26:59 2010 (r205246) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 2010 +.Dd March 13, 2010 .Dt MERGEMASTER 8 .Os .Sh NAME @@ -32,7 +32,8 @@ .Nd merge configuration files, et al during an upgrade .Sh SYNOPSIS .Nm -.Op Fl scrvahipFCPU +.Op Fl scrvhpCP +.Op Fl a|iFU .Op Fl m Ar /path/to/sources .Op Fl t Ar /path/to/temp/root .Op Fl d @@ -168,7 +169,7 @@ and therefore can override both files. When the comparison is done if there are any files remaining in the temproot directory they will be listed, and if the .Fl a -option is not in use the user will be given the option of +option is not in use the user will be given the option of deleting the temproot directory. If there are no files remaining in the temproot directory it will be deleted. @@ -206,9 +207,11 @@ If the directory exists, it creates a new one in a previously non-existent directory. This option unsets the verbose flag, -but other than -.Fl U -it is compatible with all other options. +and is not compatible with +.Fl i , +.Fl F , +or +.Fl U . Setting .Fl a makes Modified: stable/7/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/7/usr.sbin/mergemaster/mergemaster.sh Wed Mar 17 07:26:00 2010 (r205245) +++ stable/7/usr.sbin/mergemaster/mergemaster.sh Wed Mar 17 07:26:59 2010 (r205246) @@ -15,7 +15,7 @@ PATH=/bin:/usr/bin:/usr/sbin display_usage () { VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` echo "mergemaster version ${VERSION_NUMBER}" - echo 'Usage: mergemaster [-scrvahipFCPU]' + echo 'Usage: mergemaster [-scrvhpCP] [-a|[-iFU]]' echo ' [-m /path] [-t /path] [-d] [-u N] [-w N] [-A arch] [-D /path]' echo "Options:" echo " -s Strict comparison (diff every pair of files)" @@ -337,6 +337,18 @@ while getopts ":ascrvhipCPm:t:du:w:D:A:F esac done +if [ -n "$AUTO_RUN" ]; then + if [ -n "$FREEBSD_ID" -o -n "$AUTO_UPGRADE" -o -n "$AUTO_INSTALL" ]; then + echo '' + echo "*** You have included the -a option along with one or more options" + echo ' that indicate that you wish mergemaster to actually make updates' + echo ' (-F, -U, or -i), however these options are not compatible.' + echo ' Please read mergemaster(8) for more information.' + echo '' + exit 1 + fi +fi + # Assign the location of the mtree database # MTREEDB=${MTREEDB:-${DESTDIR}/var/db} From owner-svn-src-stable@FreeBSD.ORG Wed Mar 17 09:52:26 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB944106567A; Wed, 17 Mar 2010 09:52:26 +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 DA0308FC13; Wed, 17 Mar 2010 09:52:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2H9qQwv066028; Wed, 17 Mar 2010 09:52:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2H9qQVS066026; Wed, 17 Mar 2010 09:52:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201003170952.o2H9qQVS066026@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 17 Mar 2010 09:52:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205249 - stable/8/tools/regression/posixsem X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2010 09:52:27 -0000 Author: kib Date: Wed Mar 17 09:52:26 2010 New Revision: 205249 URL: http://svn.freebsd.org/changeset/base/205249 Log: MFC r205148: Make it compile on LP64 arches. Modified: stable/8/tools/regression/posixsem/posixsem.c Directory Properties: stable/8/tools/regression/posixsem/ (props changed) Modified: stable/8/tools/regression/posixsem/posixsem.c ============================================================================== --- stable/8/tools/regression/posixsem/posixsem.c Wed Mar 17 08:56:13 2010 (r205248) +++ stable/8/tools/regression/posixsem/posixsem.c Wed Mar 17 09:52:26 2010 (r205249) @@ -1239,7 +1239,8 @@ exhaust_unnamed_sems(void) return; } - if (child_worker(exhaust_unnamed_child, (void *)nsems_max, &stat)) + if (child_worker(exhaust_unnamed_child, (void *)(uintptr_t)nsems_max, + &stat)) return; errno = CSTAT_ERROR(stat); switch (CSTAT_CLASS(stat)) { @@ -1293,7 +1294,8 @@ exhaust_named_sems(void) return; } - if (child_worker(exhaust_named_child, (void *)nsems_max, &stat) < 0) + if (child_worker(exhaust_named_child, (void *)(uintptr_t)nsems_max, + &stat) < 0) return; errno = CSTAT_ERROR(stat); switch (CSTAT_CLASS(stat)) { @@ -1351,7 +1353,8 @@ fdlimit_unnamed_sems(void) int nsems_max, stat; nsems_max = 10; - if (child_worker(fdlimit_unnamed_child, (void *)nsems_max, &stat)) + if (child_worker(fdlimit_unnamed_child, (void *)(uintptr_t)nsems_max, + &stat)) return; errno = CSTAT_ERROR(stat); switch (CSTAT_CLASS(stat)) { @@ -1395,7 +1398,8 @@ fdlimit_named_sems(void) int i, nsems_max, stat; nsems_max = 10; - if (child_worker(fdlimit_named_child, (void *)nsems_max, &stat) < 0) + if (child_worker(fdlimit_named_child, (void *)(uintptr_t)nsems_max, + &stat) < 0) return; errno = CSTAT_ERROR(stat); switch (CSTAT_CLASS(stat)) { From owner-svn-src-stable@FreeBSD.ORG Wed Mar 17 20:16:28 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 615D4106566B; Wed, 17 Mar 2010 20:16:28 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 502598FC16; Wed, 17 Mar 2010 20:16:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2HKGSRp005749; Wed, 17 Mar 2010 20:16:28 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2HKGSt1005747; Wed, 17 Mar 2010 20:16:28 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201003172016.o2HKGSt1005747@svn.freebsd.org> From: Gavin Atkinson Date: Wed, 17 Mar 2010 20:16:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205256 - stable/8/usr.bin/find X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2010 20:16:28 -0000 Author: gavin Date: Wed Mar 17 20:16:28 2010 New Revision: 205256 URL: http://svn.freebsd.org/changeset/base/205256 Log: Merge r203865 from head: The -newerXB option was being interpreted the same as the -newerXm option as a check for F_TIME2_B was missing. Fix this. PR: bin/138245 Submitted by: "David E. Cross" Modified: stable/8/usr.bin/find/function.c Directory Properties: stable/8/usr.bin/find/ (props changed) Modified: stable/8/usr.bin/find/function.c ============================================================================== --- stable/8/usr.bin/find/function.c Wed Mar 17 20:13:09 2010 (r205255) +++ stable/8/usr.bin/find/function.c Wed Mar 17 20:16:28 2010 (r205256) @@ -1165,6 +1165,8 @@ c_newer(OPTION *option, char ***argvp) new->t_data = sb.st_ctime; else if (option->flags & F_TIME2_A) new->t_data = sb.st_atime; + else if (option->flags & F_TIME2_B) + new->t_data = sb.st_birthtime; else new->t_data = sb.st_mtime; } From owner-svn-src-stable@FreeBSD.ORG Wed Mar 17 20:17:25 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 825DD1065677; Wed, 17 Mar 2010 20:17:25 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70F9A8FC0C; Wed, 17 Mar 2010 20:17:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2HKHPLS006002; Wed, 17 Mar 2010 20:17:25 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2HKHPZs006000; Wed, 17 Mar 2010 20:17:25 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201003172017.o2HKHPZs006000@svn.freebsd.org> From: Gavin Atkinson Date: Wed, 17 Mar 2010 20:17:25 +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: r205257 - stable/7/usr.bin/find X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2010 20:17:25 -0000 Author: gavin Date: Wed Mar 17 20:17:25 2010 New Revision: 205257 URL: http://svn.freebsd.org/changeset/base/205257 Log: Merge r203865 from head: The -newerXB option was being interpreted the same as the -newerXm option as a check for F_TIME2_B was missing. Fix this. PR: bin/138245 Submitted by: "David E. Cross" Modified: stable/7/usr.bin/find/function.c Directory Properties: stable/7/usr.bin/find/ (props changed) Modified: stable/7/usr.bin/find/function.c ============================================================================== --- stable/7/usr.bin/find/function.c Wed Mar 17 20:16:28 2010 (r205256) +++ stable/7/usr.bin/find/function.c Wed Mar 17 20:17:25 2010 (r205257) @@ -1122,6 +1122,8 @@ c_newer(OPTION *option, char ***argvp) new->t_data = sb.st_ctime; else if (option->flags & F_TIME2_A) new->t_data = sb.st_atime; + else if (option->flags & F_TIME2_B) + new->t_data = sb.st_birthtime; else new->t_data = sb.st_mtime; } From owner-svn-src-stable@FreeBSD.ORG Wed Mar 17 20:27:36 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39F471065672; Wed, 17 Mar 2010 20:27:36 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E5138FC20; Wed, 17 Mar 2010 20:27:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2HKRZ8a008356; Wed, 17 Mar 2010 20:27:35 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2HKRZhj008354; Wed, 17 Mar 2010 20:27:35 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201003172027.o2HKRZhj008354@svn.freebsd.org> From: Gavin Atkinson Date: Wed, 17 Mar 2010 20:27:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205259 - stable/8/sbin/growfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2010 20:27:36 -0000 Author: gavin Date: Wed Mar 17 20:27:35 2010 New Revision: 205259 URL: http://svn.freebsd.org/changeset/base/205259 Log: Merge r203835 from head: When growing a UFS1 filesystem, we need to initialise all inodes in any new cylinder groups that are created. When the filesystem is first created, newfs always initialises the first two blocks of inodes, and then in the UFS1 case will also initialise the remaining inode blocks. The changes in growfs.c 1.23 broke the initialisation of all inodes, seemingly based on this implementation detail in newfs(8). The result was that instead of initialising all inodes, we would actually end up initialising all but the first two blocks of inodes. If the filesystem was grown into empty (all-zeros) space then the resulting filesystem was fine, however when grown onto non-zeroed space the filesystem produced would appear to have massive corruption on the first fsck after growing. A test case for this problem can be found in the PR audit trail. Fix this by once again initialising all inodes in the UFS1 case. PR: bin/115174 Submitted by: "Nate Eldredge" Reviewed by: mjacob Modified: stable/8/sbin/growfs/growfs.c Directory Properties: stable/8/sbin/growfs/ (props changed) Modified: stable/8/sbin/growfs/growfs.c ============================================================================== --- stable/8/sbin/growfs/growfs.c Wed Mar 17 20:23:14 2010 (r205258) +++ stable/8/sbin/growfs/growfs.c Wed Mar 17 20:27:35 2010 (r205259) @@ -445,13 +445,11 @@ initcg(int cylno, time_t utime, int fso, acg.cg_cs.cs_nifree--; } /* - * XXX Newfs writes out two blocks of initialized inodes - * unconditionally. Should we check here to make sure that they - * were actually written? + * For the old file system, we have to initialize all the inodes. */ if (sblock.fs_magic == FS_UFS1_MAGIC) { bzero(iobuf, sblock.fs_bsize); - for (i = 2 * sblock.fs_frag; i < sblock.fs_ipg / INOPF(&sblock); + for (i = 0; i < sblock.fs_ipg / INOPF(&sblock); i += sblock.fs_frag) { dp1 = (struct ufs1_dinode *)iobuf; #ifdef FSIRAND From owner-svn-src-stable@FreeBSD.ORG Wed Mar 17 20:30:38 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FFD8106566B; Wed, 17 Mar 2010 20:30:38 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D82A78FC16; Wed, 17 Mar 2010 20:30:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2HKUbxK009057; Wed, 17 Mar 2010 20:30:37 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2HKUbcD009055; Wed, 17 Mar 2010 20:30:37 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201003172030.o2HKUbcD009055@svn.freebsd.org> From: Gavin Atkinson Date: Wed, 17 Mar 2010 20:30:37 +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: r205260 - stable/7/sbin/growfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2010 20:30:38 -0000 Author: gavin Date: Wed Mar 17 20:30:37 2010 New Revision: 205260 URL: http://svn.freebsd.org/changeset/base/205260 Log: Merge r201401 from head: Remove dead code. This section of code is only run in the (sblock.fs_magic == FS_UFS1_MAGIC) case, so the check within the loop is redundant. Merge 203835 from head: When growing a UFS1 filesystem, we need to initialise all inodes in any new cylinder groups that are created. When the filesystem is first created, newfs always initialises the first two blocks of inodes, and then in the UFS1 case will also initialise the remaining inode blocks. The changes in growfs.c 1.23 broke the initialisation of all inodes, seemingly based on this implementation detail in newfs(8). The result was that instead of initialising all inodes, we would actually end up initialising all but the first two blocks of inodes. If the filesystem was grown into empty (all-zeros) space then the resulting filesystem was fine, however when grown onto non-zeroed space the filesystem produced would appear to have massive corruption on the first fsck after growing. A test case for this problem can be found in the PR audit trail. Fix this by once again initialising all inodes in the UFS1 case. PR: bin/115174 Submitted by: "Nate Eldredge" Reviewed by: mjacob Modified: stable/7/sbin/growfs/growfs.c Directory Properties: stable/7/sbin/growfs/ (props changed) Modified: stable/7/sbin/growfs/growfs.c ============================================================================== --- stable/7/sbin/growfs/growfs.c Wed Mar 17 20:27:35 2010 (r205259) +++ stable/7/sbin/growfs/growfs.c Wed Mar 17 20:30:37 2010 (r205260) @@ -375,7 +375,6 @@ initcg(int cylno, time_t utime, int fso, long blkno, start; ufs2_daddr_t i, cbase, dmax; struct ufs1_dinode *dp1; - struct ufs2_dinode *dp2; struct csum *cs; uint d, dupper, dlower; @@ -446,25 +445,18 @@ initcg(int cylno, time_t utime, int fso, acg.cg_cs.cs_nifree--; } /* - * XXX Newfs writes out two blocks of initialized inodes - * unconditionally. Should we check here to make sure that they - * were actually written? + * For the old file system, we have to initialize all the inodes. */ if (sblock.fs_magic == FS_UFS1_MAGIC) { bzero(iobuf, sblock.fs_bsize); - for (i = 2 * sblock.fs_frag; i < sblock.fs_ipg / INOPF(&sblock); + for (i = 0; i < sblock.fs_ipg / INOPF(&sblock); i += sblock.fs_frag) { dp1 = (struct ufs1_dinode *)iobuf; - dp2 = (struct ufs2_dinode *)iobuf; #ifdef FSIRAND - for (j = 0; j < INOPB(&sblock); j++) - if (sblock.fs_magic == FS_UFS1_MAGIC) { - dp1->di_gen = random(); - dp1++; - } else { - dp2->di_gen = random(); - dp2++; - } + for (j = 0; j < INOPB(&sblock); j++) { + dp1->di_gen = random(); + dp1++; + } #endif wtfs(fsbtodb(&sblock, cgimin(&sblock, cylno) + i), sblock.fs_bsize, iobuf, fso, Nflag); From owner-svn-src-stable@FreeBSD.ORG Wed Mar 17 20:32:14 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3999D106566C; Wed, 17 Mar 2010 20:32:14 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D5508FC18; Wed, 17 Mar 2010 20:32:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2HKWE2R009461; Wed, 17 Mar 2010 20:32:14 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2HKWDbL009459; Wed, 17 Mar 2010 20:32:13 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201003172032.o2HKWDbL009459@svn.freebsd.org> From: Gavin Atkinson Date: Wed, 17 Mar 2010 20:32:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205261 - stable/6/sbin/growfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2010 20:32:14 -0000 Author: gavin Date: Wed Mar 17 20:32:13 2010 New Revision: 205261 URL: http://svn.freebsd.org/changeset/base/205261 Log: Merge r201401 from head: Remove dead code. This section of code is only run in the (sblock.fs_magic == FS_UFS1_MAGIC) case, so the check within the loop is redundant. Merge 203835 from head: When growing a UFS1 filesystem, we need to initialise all inodes in any new cylinder groups that are created. When the filesystem is first created, newfs always initialises the first two blocks of inodes, and then in the UFS1 case will also initialise the remaining inode blocks. The changes in growfs.c 1.23 broke the initialisation of all inodes, seemingly based on this implementation detail in newfs(8). The result was that instead of initialising all inodes, we would actually end up initialising all but the first two blocks of inodes. If the filesystem was grown into empty (all-zeros) space then the resulting filesystem was fine, however when grown onto non-zeroed space the filesystem produced would appear to have massive corruption on the first fsck after growing. A test case for this problem can be found in the PR audit trail. Fix this by once again initialising all inodes in the UFS1 case. PR: bin/115174 Submitted by: "Nate Eldredge" Reviewed by: mjacob Modified: stable/6/sbin/growfs/growfs.c Directory Properties: stable/6/sbin/growfs/ (props changed) Modified: stable/6/sbin/growfs/growfs.c ============================================================================== --- stable/6/sbin/growfs/growfs.c Wed Mar 17 20:30:37 2010 (r205260) +++ stable/6/sbin/growfs/growfs.c Wed Mar 17 20:32:13 2010 (r205261) @@ -376,7 +376,6 @@ initcg(int cylno, time_t utime, int fso, long d, dlower, dupper, blkno, start; ufs2_daddr_t i, cbase, dmax; struct ufs1_dinode *dp1; - struct ufs2_dinode *dp2; struct csum *cs; if (iobuf == NULL && (iobuf = malloc(sblock.fs_bsize)) == NULL) { @@ -446,25 +445,18 @@ initcg(int cylno, time_t utime, int fso, acg.cg_cs.cs_nifree--; } /* - * XXX Newfs writes out two blocks of initialized inodes - * unconditionally. Should we check here to make sure that they - * were actually written? + * For the old file system, we have to initialize all the inodes. */ if (sblock.fs_magic == FS_UFS1_MAGIC) { bzero(iobuf, sblock.fs_bsize); - for (i = 2 * sblock.fs_frag; i < sblock.fs_ipg / INOPF(&sblock); + for (i = 0; i < sblock.fs_ipg / INOPF(&sblock); i += sblock.fs_frag) { dp1 = (struct ufs1_dinode *)iobuf; - dp2 = (struct ufs2_dinode *)iobuf; #ifdef FSIRAND - for (j = 0; j < INOPB(&sblock); j++) - if (sblock.fs_magic == FS_UFS1_MAGIC) { - dp1->di_gen = random(); - dp1++; - } else { - dp2->di_gen = random(); - dp2++; - } + for (j = 0; j < INOPB(&sblock); j++) { + dp1->di_gen = random(); + dp1++; + } #endif wtfs(fsbtodb(&sblock, cgimin(&sblock, cylno) + i), sblock.fs_bsize, iobuf, fso, Nflag); From owner-svn-src-stable@FreeBSD.ORG Wed Mar 17 20:39:21 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9792106566B; Wed, 17 Mar 2010 20:39:21 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 971E78FC0A; Wed, 17 Mar 2010 20:39:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2HKdLMO011118; Wed, 17 Mar 2010 20:39:21 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2HKdL5i011115; Wed, 17 Mar 2010 20:39:21 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201003172039.o2HKdL5i011115@svn.freebsd.org> From: Gavin Atkinson Date: Wed, 17 Mar 2010 20:39:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205262 - in stable/8: share/man/man4 sys/dev/acpi_support X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2010 20:39:21 -0000 Author: gavin Date: Wed Mar 17 20:39:21 2010 New Revision: 205262 URL: http://svn.freebsd.org/changeset/base/205262 Log: Merge r203622 from head: Add support for a few more Sony-specific ACPI features (default display brightness, wired LAN power and bass gain), and update the description of one previously unknown feature (display contrast). While here, expand on a comment and remove two defines left over from an old version of the code. Also update man page to document the above changes, and correct grammar. PR: kern/127581 Modified: stable/8/share/man/man4/acpi_sony.4 stable/8/sys/dev/acpi_support/acpi_sony.c Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/share/man/man4/acpi_sony.4 ============================================================================== --- stable/8/share/man/man4/acpi_sony.4 Wed Mar 17 20:32:13 2010 (r205261) +++ stable/8/share/man/man4/acpi_sony.4 Wed Mar 17 20:39:21 2010 (r205262) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 14, 2005 +.Dd February 7, 2010 .Dt ACPI_SONY 4 i386 .Os .Sh NAME @@ -48,15 +48,24 @@ acpi_sony_load="YES" The .Nm driver provides support for the notebook controller in Sony laptops. +Note that not all features will work on all laptop models. .Sh SYSCTLS -The following sysctl is currently implemented: +The following sysctl nodes are currently implemented: .Bl -tag -width indent .It Va dev.acpi_sony.0.brightness Current brightness level of the display. +.It Va dev.acpi_sony.0.brightness_default +Default brightness level of the display (survives reboot). +.It Va dev.acpi_sony.0.contrast +Current contrast level of the display. +.It Va dev.acpi_sony.0.bass_gain +Enable or disable the Bass Gain feature. .It Va dev.acpi_sony.0.cdp Turns the CD power on or off. .It Va dev.acpi_sony.0.azp Turns the audio power on or off. +.It Va dev.acpi_sony.0.lnp +Turns the wired network interface power on or off. .El .Sh SEE ALSO .Xr acpi 4 , Modified: stable/8/sys/dev/acpi_support/acpi_sony.c ============================================================================== --- stable/8/sys/dev/acpi_support/acpi_sony.c Wed Mar 17 20:32:13 2010 (r205261) +++ stable/8/sys/dev/acpi_support/acpi_sony.c Wed Mar 17 20:39:21 2010 (r205262) @@ -42,14 +42,21 @@ __FBSDID("$FreeBSD$"); #define _COMPONENT ACPI_OEM ACPI_MODULE_NAME("Sony") -#define ACPI_SONY_GET_BRIGHTNESS "GBRT" -#define ACPI_SONY_SET_BRIGHTNESS "SBRT" #define ACPI_SONY_GET_PID "GPID" /* * SNY5001 + * This is the ACPI handle for the "Sony Notebook Control" driver under + * Windows. + * It provides several methods within the ACPI namespace, including: * [GS]BRT [GS]PBR [GS]CTR [GS]PCR [GS]CMI [CDPW GCDP]? GWDP PWAK PWRN * + * SNY6001 + * This is the ACPI handle for the "Sony Programmable I/O" driver under + * Windows. + * It is not yet supported by this driver, but provides control over the + * power to the bluetooth, built-in camera and HSDPA modem devices in some + * laptops, and also allows some control of the fan speed. */ struct acpi_sony_softc { @@ -63,14 +70,17 @@ static struct acpi_sony_name_list char *comment; } acpi_sony_oids[] = { { "brightness", "GBRT", "SBRT", "Display Brightness"}, - { "ctr", "GCTR", "SCTR", "??"}, + { "brightness_default", "GPBR", "SPBR", "Default Display Brightness"}, + { "contrast", "GCTR", "SCTR", "Display Contrast"}, + { "bass_gain", "GMGB", "SMGB", "Multimedia Bass Gain"}, { "pcr", "GPCR", "SPCR", "???"}, #if 0 - { "cmi", "GCMI", "SCMI", "????"}, + { "cmi", "GCMI", "SCMI", "???"}, #endif - { "wdp", "GWDP", NULL, "?????"}, + { "wdp", "GWDP", NULL, "???"}, { "cdp", "GCDP", "CDPW", "CD Power"}, /*shares [\GL03]&0x8 flag*/ { "azp", "GAZP", "AZPW", "Audio Power"}, + { "lnp", "GLNP", "LNPW", "LAN Power"}, { NULL, NULL, NULL } }; From owner-svn-src-stable@FreeBSD.ORG Wed Mar 17 21:11:48 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0B84106564A; Wed, 17 Mar 2010 21:11:48 +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 8F6848FC28; Wed, 17 Mar 2010 21:11:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2HLBmnL018536; Wed, 17 Mar 2010 21:11:48 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2HLBmNZ018534; Wed, 17 Mar 2010 21:11:48 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201003172111.o2HLBmNZ018534@svn.freebsd.org> From: Xin LI Date: Wed, 17 Mar 2010 21:11:48 +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: r205265 - stable/7/include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2010 21:11:48 -0000 Author: delphij Date: Wed Mar 17 21:11:48 2010 New Revision: 205265 URL: http://svn.freebsd.org/changeset/base/205265 Log: MFC 178256: Add prototype for fdopendir(). Requested by: naddy Modified: stable/7/include/dirent.h Directory Properties: stable/7/include/ (props changed) Modified: stable/7/include/dirent.h ============================================================================== --- stable/7/include/dirent.h Wed Mar 17 21:10:09 2010 (r205264) +++ stable/7/include/dirent.h Wed Mar 17 21:11:48 2010 (r205265) @@ -100,6 +100,7 @@ int getdents(int, char *, int); int getdirentries(int, char *, int, long *); #endif DIR *opendir(const char *); +DIR *fdopendir(int); struct dirent * readdir(DIR *); #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500 From owner-svn-src-stable@FreeBSD.ORG Wed Mar 17 21:19:30 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1DB81065679; Wed, 17 Mar 2010 21:19:30 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFD738FC15; Wed, 17 Mar 2010 21:19:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2HLJUnW020368; Wed, 17 Mar 2010 21:19:30 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2HLJURW020365; Wed, 17 Mar 2010 21:19:30 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201003172119.o2HLJURW020365@svn.freebsd.org> From: Gavin Atkinson Date: Wed, 17 Mar 2010 21:19: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: r205267 - in stable/7: share/man/man4/man4.i386 sys/dev/acpi_support X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2010 21:19:31 -0000 Author: gavin Date: Wed Mar 17 21:19:30 2010 New Revision: 205267 URL: http://svn.freebsd.org/changeset/base/205267 Log: Merge r203622 from head: Add support for a few more Sony-specific ACPI features (default display brightness, wired LAN power and bass gain), and update the description of one previously unknown feature (display contrast). While here, expand on a comment and remove two defines left over from an old version of the code. Also update man page to document the above changes, and correct grammar. PR: kern/127581 Modified: stable/7/share/man/man4/man4.i386/acpi_sony.4 stable/7/sys/dev/acpi_support/acpi_sony.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/share/man/man4/man4.i386/acpi_sony.4 ============================================================================== --- stable/7/share/man/man4/man4.i386/acpi_sony.4 Wed Mar 17 21:18:28 2010 (r205266) +++ stable/7/share/man/man4/man4.i386/acpi_sony.4 Wed Mar 17 21:19:30 2010 (r205267) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 14, 2005 +.Dd February 7, 2010 .Dt ACPI_SONY 4 i386 .Os .Sh NAME @@ -48,13 +48,22 @@ acpi_sony_load="YES" The .Nm driver provides support for the notebook controller in Sony laptops. +Note that not all features will work on all laptop models. .Sh SYSCTLS -The following sysctl is currently implemented: +The following sysctl nodes are currently implemented: .Bl -tag -width indent .It Va dev.acpi_sony.0.brightness Current brightness level of the display. +.It Va dev.acpi_sony.0.brightness_default +Default brightness level of the display (survives reboot). +.It Va dev.acpi_sony.0.contrast +Current contrast level of the display. +.It Va dev.acpi_sony.0.bass_gain +Enable or disable the Bass Gain feature. .It Va dev.acpi_sony.0.cdp Turns the CD power on or off. +.It Va dev.acpi_sony.0.lnp +Turns the wired network interface power on or off. .El .Sh SEE ALSO .Xr acpi 4 , Modified: stable/7/sys/dev/acpi_support/acpi_sony.c ============================================================================== --- stable/7/sys/dev/acpi_support/acpi_sony.c Wed Mar 17 21:18:28 2010 (r205266) +++ stable/7/sys/dev/acpi_support/acpi_sony.c Wed Mar 17 21:19:30 2010 (r205267) @@ -40,14 +40,21 @@ __FBSDID("$FreeBSD$"); #define _COMPONENT ACPI_OEM ACPI_MODULE_NAME("Sony") -#define ACPI_SONY_GET_BRIGHTNESS "GBRT" -#define ACPI_SONY_SET_BRIGHTNESS "SBRT" #define ACPI_SONY_GET_PID "GPID" /* * SNY5001 + * This is the ACPI handle for the "Sony Notebook Control" driver under + * Windows. + * It provides several methods within the ACPI namespace, including: * [GS]BRT [GS]PBR [GS]CTR [GS]PCR [GS]CMI [CDPW GCDP]? GWDP PWAK PWRN * + * SNY6001 + * This is the ACPI handle for the "Sony Programmable I/O" driver under + * Windows. + * It is not yet supported by this driver, but provides control over the + * power to the bluetooth, built-in camera and HSDPA modem devices in some + * laptops, and also allows some control of the fan speed. */ struct acpi_sony_softc { @@ -61,13 +68,16 @@ static struct acpi_sony_name_list char *comment; } acpi_sony_oids[] = { { "brightness", "GBRT", "SBRT", "Display Brightness"}, - { "ctr", "GCTR", "SCTR", "??"}, + { "brightness_default", "GPBR", "SPBR", "Default Display Brightness"}, + { "contrast", "GCTR", "SCTR", "Display Contrast"}, + { "bass_gain", "GMGB", "SMGB", "Multimedia Bass Gain"}, { "pcr", "GPCR", "SPCR", "???"}, #if 0 - { "cmi", "GCMI", "SCMI", "????"}, + { "cmi", "GCMI", "SCMI", "???"}, #endif - { "wdp", "GWDP", NULL, "?????"}, + { "wdp", "GWDP", NULL, "???"}, { "cdp", "GCDP", "CDPW", "CD Power"}, /*shares [\GL03]&0x8 flag*/ + { "lnp", "GLNP", "LNPW", "LAN Power"}, { NULL, NULL, NULL } }; From owner-svn-src-stable@FreeBSD.ORG Thu Mar 18 11:53:32 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A327E1065677; Thu, 18 Mar 2010 11:53:32 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91ED28FC0C; Thu, 18 Mar 2010 11:53:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2IBrWe3014474; Thu, 18 Mar 2010 11:53:32 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2IBrWUq014472; Thu, 18 Mar 2010 11:53:32 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201003181153.o2IBrWUq014472@svn.freebsd.org> From: Rafal Jaworowski Date: Thu, 18 Mar 2010 11:53:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205278 - stable/8/sys/arm/arm X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 11:53:32 -0000 Author: raj Date: Thu Mar 18 11:53:32 2010 New Revision: 205278 URL: http://svn.freebsd.org/changeset/base/205278 Log: MFC r205027 Let detailed info about CPU features print on Marvell Sheeva CPU as well. Provide missing entry in the cpu_classes[]. Reported by: Maks Verver Modified: stable/8/sys/arm/arm/identcpu.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/arm/arm/identcpu.c ============================================================================== --- stable/8/sys/arm/arm/identcpu.c Thu Mar 18 11:06:38 2010 (r205277) +++ stable/8/sys/arm/arm/identcpu.c Thu Mar 18 11:53:32 2010 (r205278) @@ -343,6 +343,7 @@ const struct cpu_classtab cpu_classes[] { "SA-1", "CPU_SA110" }, /* CPU_CLASS_SA1 */ { "XScale", "CPU_XSCALE_..." }, /* CPU_CLASS_XSCALE */ { "ARM11J", "CPU_ARM11" }, /* CPU_CLASS_ARM11J */ + { "Marvell", "CPU_MARVELL" }, /* CPU_CLASS_MARVELL */ }; /* @@ -418,6 +419,7 @@ identify_arm_cpu(void) case CPU_CLASS_SA1: case CPU_CLASS_XSCALE: case CPU_CLASS_ARM11J: + case CPU_CLASS_MARVELL: if ((ctrl & CPU_CONTROL_DC_ENABLE) == 0) printf(" DC disabled"); else From owner-svn-src-stable@FreeBSD.ORG Thu Mar 18 16:55:48 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 547391065672; Thu, 18 Mar 2010 16:55:48 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 429E48FC17; Thu, 18 Mar 2010 16:55:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2IGtlNu081358; Thu, 18 Mar 2010 16:55:47 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2IGtlgE081356; Thu, 18 Mar 2010 16:55:47 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201003181655.o2IGtlgE081356@svn.freebsd.org> From: Rui Paulo Date: Thu, 18 Mar 2010 16:55:47 +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: r205282 - stable/7/sys/net80211 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 16:55:48 -0000 Author: rpaulo Date: Thu Mar 18 16:55:47 2010 New Revision: 205282 URL: http://svn.freebsd.org/changeset/base/205282 Log: Fix HTCAP's SM power save bits to match the ones in HEAD. PR: 144476 Submitted by: Alexander Egorenkov Modified: stable/7/sys/net80211/ieee80211.h Modified: stable/7/sys/net80211/ieee80211.h ============================================================================== --- stable/7/sys/net80211/ieee80211.h Thu Mar 18 15:28:17 2010 (r205281) +++ stable/7/sys/net80211/ieee80211.h Thu Mar 18 16:55:47 2010 (r205282) @@ -531,10 +531,10 @@ struct ieee80211_ie_htcap { #define IEEE80211_HTCAP_LDPC 0x0001 /* LDPC supported */ #define IEEE80211_HTCAP_CHWIDTH40 0x0002 /* 20/40 supported */ #define IEEE80211_HTCAP_SMPS 0x000c /* SM Power Save mode */ -#define IEEE80211_HTCAP_SMPS_OFF 0x0000 /* none (static mode) */ +#define IEEE80211_HTCAP_SMPS_OFF 0x000c /* disabled */ #define IEEE80211_HTCAP_SMPS_DYNAMIC 0x0004 /* send RTS first */ /* NB: SMPS value 2 is reserved */ -#define IEEE80211_HTCAP_SMPS_ENA 0x000c /* enabled */ +#define IEEE80211_HTCAP_SMPS_ENA 0x0000 /* enabled (static mode) */ #define IEEE80211_HTCAP_GREENFIELD 0x0010 /* Greenfield supported */ #define IEEE80211_HTCAP_SHORTGI20 0x0020 /* Short GI in 20MHz */ #define IEEE80211_HTCAP_SHORTGI40 0x0040 /* Short GI in 40MHz */ From owner-svn-src-stable@FreeBSD.ORG Thu Mar 18 17:00:44 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD98A106567E; Thu, 18 Mar 2010 17:00:44 +0000 (UTC) (envelope-from mlaier@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BAAAB8FC13; Thu, 18 Mar 2010 17:00:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2IH0iAm082526; Thu, 18 Mar 2010 17:00:44 GMT (envelope-from mlaier@svn.freebsd.org) Received: (from mlaier@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2IH0iJF082519; Thu, 18 Mar 2010 17:00:44 GMT (envelope-from mlaier@svn.freebsd.org) Message-Id: <201003181700.o2IH0iJF082519@svn.freebsd.org> From: Max Laier Date: Thu, 18 Mar 2010 17:00:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205283 - in stable/8/sys: dev/cxgb dev/e1000 dev/ixgbe dev/mxge net X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 17:00:44 -0000 Author: mlaier Date: Thu Mar 18 17:00:44 2010 New Revision: 205283 URL: http://svn.freebsd.org/changeset/base/205283 Log: MFC r203834 and r205197: Make ALTQ work for drbr consumers. Modified: stable/8/sys/dev/cxgb/cxgb_sge.c stable/8/sys/dev/e1000/if_em.c stable/8/sys/dev/e1000/if_igb.c stable/8/sys/dev/ixgbe/ixgbe.c stable/8/sys/dev/mxge/if_mxge.c stable/8/sys/net/if_var.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- stable/8/sys/dev/cxgb/cxgb_sge.c Thu Mar 18 16:55:47 2010 (r205282) +++ stable/8/sys/dev/cxgb/cxgb_sge.c Thu Mar 18 17:00:44 2010 (r205283) @@ -228,6 +228,8 @@ static uint8_t flit_desc_map[] = { #define TXQ_LOCK(qs) mtx_lock(&(qs)->lock) #define TXQ_UNLOCK(qs) mtx_unlock(&(qs)->lock) #define TXQ_RING_EMPTY(qs) drbr_empty((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr) +#define TXQ_RING_NEEDS_ENQUEUE(qs) \ + drbr_needs_enqueue((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr) #define TXQ_RING_FLUSH(qs) drbr_flush((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr) #define TXQ_RING_DEQUEUE_COND(qs, func, arg) \ drbr_dequeue_cond((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr, func, arg) @@ -1712,7 +1714,7 @@ cxgb_transmit_locked(struct ifnet *ifp, * - there is space in hardware transmit queue */ if (check_pkt_coalesce(qs) == 0 && - TXQ_RING_EMPTY(qs) && avail > 4) { + !TXQ_RING_NEEDS_ENQUEUE(qs) && avail > 4) { if (t3_encap(qs, &m)) { if (m != NULL && (error = drbr_enqueue(ifp, br, m)) != 0) Modified: stable/8/sys/dev/e1000/if_em.c ============================================================================== --- stable/8/sys/dev/e1000/if_em.c Thu Mar 18 16:55:47 2010 (r205282) +++ stable/8/sys/dev/e1000/if_em.c Thu Mar 18 17:00:44 2010 (r205283) @@ -1032,7 +1032,7 @@ em_mq_start_locked(struct ifnet *ifp, st || (!adapter->link_active)) { error = drbr_enqueue(ifp, adapter->br, m); return (error); - } else if (drbr_empty(ifp, adapter->br) && + } else if (!drbr_needs_enqueue(ifp, adapter->br) && (adapter->num_tx_desc_avail > EM_TX_OP_THRESHOLD)) { if ((error = em_xmit(adapter, &m)) != 0) { if (m != NULL) Modified: stable/8/sys/dev/e1000/if_igb.c ============================================================================== --- stable/8/sys/dev/e1000/if_igb.c Thu Mar 18 16:55:47 2010 (r205282) +++ stable/8/sys/dev/e1000/if_igb.c Thu Mar 18 17:00:44 2010 (r205283) @@ -853,7 +853,7 @@ igb_mq_start_locked(struct ifnet *ifp, s goto process; /* If nothing queued go right to xmit */ - if (drbr_empty(ifp, txr->br)) { + if (!drbr_needs_enqueue(ifp, txr->br)) { if ((err = igb_xmit(txr, &m)) != 0) { if (m != NULL) err = drbr_enqueue(ifp, txr->br, m); Modified: stable/8/sys/dev/ixgbe/ixgbe.c ============================================================================== --- stable/8/sys/dev/ixgbe/ixgbe.c Thu Mar 18 16:55:47 2010 (r205282) +++ stable/8/sys/dev/ixgbe/ixgbe.c Thu Mar 18 17:00:44 2010 (r205283) @@ -768,7 +768,7 @@ ixgbe_mq_start_locked(struct ifnet *ifp, goto process; /* If nothing queued go right to xmit */ - if (drbr_empty(ifp, txr->br)) { + if (!drbr_needs_enqueue(ifp, txr->br)) { if (ixgbe_xmit(txr, &m)) { if (m && (err = drbr_enqueue(ifp, txr->br, m)) != 0) return (err); Modified: stable/8/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/8/sys/dev/mxge/if_mxge.c Thu Mar 18 16:55:47 2010 (r205282) +++ stable/8/sys/dev/mxge/if_mxge.c Thu Mar 18 17:00:44 2010 (r205283) @@ -2249,7 +2249,7 @@ mxge_transmit_locked(struct mxge_slice_s return (err); } - if (drbr_empty(ifp, tx->br) && + if (!drbr_needs_enqueue(ifp, tx->br) && ((tx->mask - (tx->req - tx->done)) > tx->max_desc)) { /* let BPF see it */ BPF_MTAP(ifp, m); Modified: stable/8/sys/net/if_var.h ============================================================================== --- stable/8/sys/net/if_var.h Thu Mar 18 16:55:47 2010 (r205282) +++ stable/8/sys/net/if_var.h Thu Mar 18 17:00:44 2010 (r205283) @@ -602,12 +602,8 @@ drbr_flush(struct ifnet *ifp, struct buf struct mbuf *m; #ifdef ALTQ - if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { - while (!IFQ_IS_EMPTY(&ifp->if_snd)) { - IFQ_DRV_DEQUEUE(&ifp->if_snd, m); - m_freem(m); - } - } + if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) + IFQ_PURGE(&ifp->if_snd); #endif while ((m = buf_ring_dequeue_sc(br)) != NULL) m_freem(m); @@ -628,7 +624,7 @@ drbr_dequeue(struct ifnet *ifp, struct b struct mbuf *m; if (ALTQ_IS_ENABLED(&ifp->if_snd)) { - IFQ_DRV_DEQUEUE(&ifp->if_snd, m); + IFQ_DEQUEUE(&ifp->if_snd, m); return (m); } #endif @@ -641,11 +637,15 @@ drbr_dequeue_cond(struct ifnet *ifp, str { struct mbuf *m; #ifdef ALTQ - /* - * XXX need to evaluate / requeue - */ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) { - IFQ_DRV_DEQUEUE(&ifp->if_snd, m); + if (ALTQ_IS_ENABLED(&ifp->if_snd)) { + IFQ_LOCK(&ifp->if_snd); + IFQ_POLL_NOLOCK(&ifp->if_snd, m); + if (m != NULL && func(m, arg) == 0) { + IFQ_UNLOCK(&ifp->if_snd); + return (NULL); + } + IFQ_DEQUEUE_NOLOCK(&ifp->if_snd, m); + IFQ_UNLOCK(&ifp->if_snd); return (m); } #endif @@ -661,12 +661,22 @@ drbr_empty(struct ifnet *ifp, struct buf { #ifdef ALTQ if (ALTQ_IS_ENABLED(&ifp->if_snd)) - return (IFQ_DRV_IS_EMPTY(&ifp->if_snd)); + return (IFQ_IS_EMPTY(&ifp->if_snd)); #endif return (buf_ring_empty(br)); } static __inline int +drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br) +{ +#ifdef ALTQ + if (ALTQ_IS_ENABLED(&ifp->if_snd)) + return (1); +#endif + return (!buf_ring_empty(br)); +} + +static __inline int drbr_inuse(struct ifnet *ifp, struct buf_ring *br) { #ifdef ALTQ From owner-svn-src-stable@FreeBSD.ORG Thu Mar 18 18:35:28 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAE171065676; Thu, 18 Mar 2010 18:35:28 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D8AA58FC22; Thu, 18 Mar 2010 18:35:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2IIZSvb003549; Thu, 18 Mar 2010 18:35:28 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2IIZSvt003547; Thu, 18 Mar 2010 18:35:28 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003181835.o2IIZSvt003547@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 18 Mar 2010 18:35:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205284 - stable/8/sys/dev/bge X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 18:35:29 -0000 Author: yongari Date: Thu Mar 18 18:35:28 2010 New Revision: 205284 URL: http://svn.freebsd.org/changeset/base/205284 Log: MFC r202821-202822. r202821: Fix a long standing ASF heartbeat sending bug. The initial implementation of heartbeat interval was 2 but there was typo which caused the heartbeat is sent approximately every 5 seconds. This caused unintended controller reset by firmware because firmware thought OS was crashed. Submitted by: Floris Bos < info <> je-eigen-domein dot nl > Tested by: Andrzej Tobola < ato <> iem dot pw dot edu dot pl > r202822: Use new handshake command for BCM5750 or new controllers. Modified: stable/8/sys/dev/bge/if_bge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Thu Mar 18 17:00:44 2010 (r205283) +++ stable/8/sys/dev/bge/if_bge.c Thu Mar 18 18:35:28 2010 (r205284) @@ -2744,9 +2744,8 @@ bge_attach(device_t dev) & BGE_HWCFG_ASF) { sc->bge_asf_mode |= ASF_ENABLE; sc->bge_asf_mode |= ASF_STACKUP; - if (sc->bge_asicrev == BGE_ASICREV_BCM5750) { + if (BGE_IS_575X_PLUS(sc)) sc->bge_asf_mode |= ASF_NEW_HANDSHAKE; - } } } @@ -3677,7 +3676,7 @@ bge_asf_driver_up(struct bge_softc *sc) if (sc->bge_asf_count) sc->bge_asf_count --; else { - sc->bge_asf_count = 5; + sc->bge_asf_count = 2; bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW, BGE_FW_DRV_ALIVE); bge_writemem_ind(sc, BGE_SOFTWARE_GENNCOMM_FW_LEN, 4); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 18 18:38:54 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A0A4106564A; Thu, 18 Mar 2010 18:38:54 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17EB88FC14; Thu, 18 Mar 2010 18:38:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2IIcrVG004326; Thu, 18 Mar 2010 18:38:53 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2IIcrtX004324; Thu, 18 Mar 2010 18:38:53 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003181838.o2IIcrtX004324@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 18 Mar 2010 18:38: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: r205285 - stable/7/sys/dev/bge X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 18:38:54 -0000 Author: yongari Date: Thu Mar 18 18:38:53 2010 New Revision: 205285 URL: http://svn.freebsd.org/changeset/base/205285 Log: MFC r202821-202822. r202821: Fix a long standing ASF heartbeat sending bug. The initial implementation of heartbeat interval was 2 but there was typo which caused the heartbeat is sent approximately every 5 seconds. This caused unintended controller reset by firmware because firmware thought OS was crashed. Submitted by: Floris Bos < info <> je-eigen-domein dot nl > Tested by: Andrzej Tobola < ato <> iem dot pw dot edu dot pl > r202822: Use new handshake command for BCM5750 or new controllers. Modified: stable/7/sys/dev/bge/if_bge.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Thu Mar 18 18:35:28 2010 (r205284) +++ stable/7/sys/dev/bge/if_bge.c Thu Mar 18 18:38:53 2010 (r205285) @@ -2744,9 +2744,8 @@ bge_attach(device_t dev) & BGE_HWCFG_ASF) { sc->bge_asf_mode |= ASF_ENABLE; sc->bge_asf_mode |= ASF_STACKUP; - if (sc->bge_asicrev == BGE_ASICREV_BCM5750) { + if (BGE_IS_575X_PLUS(sc)) sc->bge_asf_mode |= ASF_NEW_HANDSHAKE; - } } } @@ -3673,7 +3672,7 @@ bge_asf_driver_up(struct bge_softc *sc) if (sc->bge_asf_count) sc->bge_asf_count --; else { - sc->bge_asf_count = 5; + sc->bge_asf_count = 2; bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW, BGE_FW_DRV_ALIVE); bge_writemem_ind(sc, BGE_SOFTWARE_GENNCOMM_FW_LEN, 4); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 18 18:44:09 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F2CC1065670; Thu, 18 Mar 2010 18:44:09 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D1C38FC19; Thu, 18 Mar 2010 18:44:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2IIi8dd005546; Thu, 18 Mar 2010 18:44:08 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2IIi8n0005544; Thu, 18 Mar 2010 18:44:08 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003181844.o2IIi8n0005544@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 18 Mar 2010 18:44:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205286 - stable/8/sys/dev/pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 18:44:09 -0000 Author: yongari Date: Thu Mar 18 18:44:08 2010 New Revision: 205286 URL: http://svn.freebsd.org/changeset/base/205286 Log: MFC r203355: Add more bit definitions to PCI express device control and device status register. Modified: stable/8/sys/dev/pci/pcireg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/pci/pcireg.h ============================================================================== --- stable/8/sys/dev/pci/pcireg.h Thu Mar 18 18:38:53 2010 (r205285) +++ stable/8/sys/dev/pci/pcireg.h Thu Mar 18 18:44:08 2010 (r205286) @@ -605,9 +605,17 @@ #define PCIR_EXPRESS_DEVICE_CAP 0x4 #define PCIM_EXP_CAP_MAX_PAYLOAD 0x0007 #define PCIR_EXPRESS_DEVICE_CTL 0x8 +#define PCIM_EXP_CTL_RELAXED_ORD_ENABLE 0x0010 #define PCIM_EXP_CTL_MAX_PAYLOAD 0x00e0 +#define PCIM_EXP_CTL_NOSNOOP_ENABLE 0x0800 #define PCIM_EXP_CTL_MAX_READ_REQUEST 0x7000 #define PCIR_EXPRESS_DEVICE_STA 0xa +#define PCIM_EXP_STA_CORRECTABLE_ERROR 0x0001 +#define PCIM_EXP_STA_NON_FATAL_ERROR 0x0002 +#define PCIM_EXP_STA_FATAL_ERROR 0x0004 +#define PCIM_EXP_STA_UNSUPPORTED_REQ 0x0008 +#define PCIM_EXP_STA_AUX_POWER 0x0010 +#define PCIM_EXP_STA_TRANSACTION_PND 0x0020 #define PCIR_EXPRESS_LINK_CAP 0xc #define PCIM_LINK_CAP_MAX_SPEED 0x0000000f #define PCIM_LINK_CAP_MAX_WIDTH 0x000003f0 From owner-svn-src-stable@FreeBSD.ORG Thu Mar 18 18:45:45 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECFEC106566C; Thu, 18 Mar 2010 18:45:45 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAF988FC1F; Thu, 18 Mar 2010 18:45:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2IIjjq6005970; Thu, 18 Mar 2010 18:45:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2IIjjFt005968; Thu, 18 Mar 2010 18:45:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003181845.o2IIjjFt005968@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 18 Mar 2010 18:45:45 +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: r205287 - stable/7/sys/dev/pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 18:45:46 -0000 Author: yongari Date: Thu Mar 18 18:45:45 2010 New Revision: 205287 URL: http://svn.freebsd.org/changeset/base/205287 Log: MFC r203355: Add more bit definitions to PCI express device control and device status register. Modified: stable/7/sys/dev/pci/pcireg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/pci/pcireg.h ============================================================================== --- stable/7/sys/dev/pci/pcireg.h Thu Mar 18 18:44:08 2010 (r205286) +++ stable/7/sys/dev/pci/pcireg.h Thu Mar 18 18:45:45 2010 (r205287) @@ -605,9 +605,17 @@ #define PCIR_EXPRESS_DEVICE_CAP 0x4 #define PCIM_EXP_CAP_MAX_PAYLOAD 0x0007 #define PCIR_EXPRESS_DEVICE_CTL 0x8 +#define PCIM_EXP_CTL_RELAXED_ORD_ENABLE 0x0010 #define PCIM_EXP_CTL_MAX_PAYLOAD 0x00e0 +#define PCIM_EXP_CTL_NOSNOOP_ENABLE 0x0800 #define PCIM_EXP_CTL_MAX_READ_REQUEST 0x7000 #define PCIR_EXPRESS_DEVICE_STA 0xa +#define PCIM_EXP_STA_CORRECTABLE_ERROR 0x0001 +#define PCIM_EXP_STA_NON_FATAL_ERROR 0x0002 +#define PCIM_EXP_STA_FATAL_ERROR 0x0004 +#define PCIM_EXP_STA_UNSUPPORTED_REQ 0x0008 +#define PCIM_EXP_STA_AUX_POWER 0x0010 +#define PCIM_EXP_STA_TRANSACTION_PND 0x0020 #define PCIR_EXPRESS_LINK_CAP 0xc #define PCIM_LINK_CAP_MAX_SPEED 0x0000000f #define PCIM_LINK_CAP_MAX_WIDTH 0x000003f0 From owner-svn-src-stable@FreeBSD.ORG Thu Mar 18 18:50:20 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B52A106564A; Thu, 18 Mar 2010 18:50:20 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 793628FC22; Thu, 18 Mar 2010 18:50:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2IIoKGT007012; Thu, 18 Mar 2010 18:50:20 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2IIoKho007010; Thu, 18 Mar 2010 18:50:20 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003181850.o2IIoKho007010@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 18 Mar 2010 18:50:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205288 - stable/8/sys/dev/bge X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 18:50:20 -0000 Author: yongari Date: Thu Mar 18 18:50:20 2010 New Revision: 205288 URL: http://svn.freebsd.org/changeset/base/205288 Log: MFC r203358,203716: r203358: PCI express device status register has W1C feature. Writing 0 has no effect. Make sure to clear error bits by writing 1. [1] While I'm here use predefined value instead of hardcodig magic vlaue. Submitted by: msaitoh at NetBSD [1] r203716: Move device specific flag configuration to attach routine. The softc obtained in device probe wouldn't be the same one used in device attach. Drivers should not assume any values stored in softc structure in probe routine will be available for its attach routine. Modified: stable/8/sys/dev/bge/if_bge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Thu Mar 18 18:45:45 2010 (r205287) +++ stable/8/sys/dev/bge/if_bge.c Thu Mar 18 18:50:20 2010 (r205288) @@ -1993,10 +1993,6 @@ bge_probe(device_t dev) snprintf(buf, 96, "%s, %sASIC rev. %#08x", model, br != NULL ? "" : "unknown ", id); device_set_desc_copy(dev, buf); - if (pci_get_subvendor(dev) == DELL_VENDORID) - sc->bge_flags |= BGE_FLAG_NO_3LED; - if (did == BCOM_DEVICEID_BCM5755M) - sc->bge_flags |= BGE_FLAG_ADJUST_TRIM; return (0); } t++; @@ -2607,6 +2603,10 @@ bge_attach(device_t dev) sc->bge_flags |= BGE_FLAG_ADC_BUG; if (sc->bge_chipid == BGE_CHIPID_BCM5704_A0) sc->bge_flags |= BGE_FLAG_5704_A0_BUG; + if (pci_get_subvendor(dev) == DELL_VENDORID) + sc->bge_flags |= BGE_FLAG_NO_3LED; + if (pci_get_device(dev) == BCOM_DEVICEID_BCM5755M) + sc->bge_flags |= BGE_FLAG_ADJUST_TRIM; if (BGE_IS_5705_PLUS(sc) && !(sc->bge_flags & BGE_FLAG_ADJUST_TRIM)) { if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || @@ -3136,14 +3136,17 @@ bge_reset(struct bge_softc *sc) devctl = pci_read_config(dev, sc->bge_expcap + PCIR_EXPRESS_DEVICE_CTL, 2); /* Clear enable no snoop and disable relaxed ordering. */ - devctl &= ~(0x0010 | 0x0800); + devctl &= ~(PCIM_EXP_CTL_RELAXED_ORD_ENABLE | + PCIM_EXP_CTL_NOSNOOP_ENABLE); /* Set PCIE max payload size to 128. */ devctl &= ~PCIM_EXP_CTL_MAX_PAYLOAD; pci_write_config(dev, sc->bge_expcap + PCIR_EXPRESS_DEVICE_CTL, devctl, 2); /* Clear error status. */ pci_write_config(dev, sc->bge_expcap + PCIR_EXPRESS_DEVICE_STA, - 0, 2); + PCIM_EXP_STA_CORRECTABLE_ERROR | + PCIM_EXP_STA_NON_FATAL_ERROR | PCIM_EXP_STA_FATAL_ERROR | + PCIM_EXP_STA_UNSUPPORTED_REQ, 2); } /* Reset some of the PCI state that got zapped by reset. */ From owner-svn-src-stable@FreeBSD.ORG Thu Mar 18 18:52:19 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BACC106566C; Thu, 18 Mar 2010 18:52:19 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F3378FC0C; Thu, 18 Mar 2010 18:52:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2IIqJRw007537; Thu, 18 Mar 2010 18:52:19 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2IIqJCT007535; Thu, 18 Mar 2010 18:52:19 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003181852.o2IIqJCT007535@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 18 Mar 2010 18:52:19 +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: r205289 - stable/7/sys/dev/bge X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 18:52:19 -0000 Author: yongari Date: Thu Mar 18 18:52:18 2010 New Revision: 205289 URL: http://svn.freebsd.org/changeset/base/205289 Log: MFC r203358,203716: r203358: PCI express device status register has W1C feature. Writing 0 has no effect. Make sure to clear error bits by writing 1. [1] While I'm here use predefined value instead of hardcodig magic vlaue. Submitted by: msaitoh at NetBSD [1] r203716: Move device specific flag configuration to attach routine. The softc obtained in device probe wouldn't be the same one used in device attach. Drivers should not assume any values stored in softc structure in probe routine will be available for its attach routine. Modified: stable/7/sys/dev/bge/if_bge.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Thu Mar 18 18:50:20 2010 (r205288) +++ stable/7/sys/dev/bge/if_bge.c Thu Mar 18 18:52:18 2010 (r205289) @@ -1993,10 +1993,6 @@ bge_probe(device_t dev) snprintf(buf, 96, "%s, %sASIC rev. %#08x", model, br != NULL ? "" : "unknown ", id); device_set_desc_copy(dev, buf); - if (pci_get_subvendor(dev) == DELL_VENDORID) - sc->bge_flags |= BGE_FLAG_NO_3LED; - if (did == BCOM_DEVICEID_BCM5755M) - sc->bge_flags |= BGE_FLAG_ADJUST_TRIM; return (0); } t++; @@ -2607,6 +2603,10 @@ bge_attach(device_t dev) sc->bge_flags |= BGE_FLAG_ADC_BUG; if (sc->bge_chipid == BGE_CHIPID_BCM5704_A0) sc->bge_flags |= BGE_FLAG_5704_A0_BUG; + if (pci_get_subvendor(dev) == DELL_VENDORID) + sc->bge_flags |= BGE_FLAG_NO_3LED; + if (pci_get_device(dev) == BCOM_DEVICEID_BCM5755M) + sc->bge_flags |= BGE_FLAG_ADJUST_TRIM; if (BGE_IS_5705_PLUS(sc) && !(sc->bge_flags & BGE_FLAG_ADJUST_TRIM)) { if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || @@ -3136,14 +3136,17 @@ bge_reset(struct bge_softc *sc) devctl = pci_read_config(dev, sc->bge_expcap + PCIR_EXPRESS_DEVICE_CTL, 2); /* Clear enable no snoop and disable relaxed ordering. */ - devctl &= ~(0x0010 | 0x0800); + devctl &= ~(PCIM_EXP_CTL_RELAXED_ORD_ENABLE | + PCIM_EXP_CTL_NOSNOOP_ENABLE); /* Set PCIE max payload size to 128. */ devctl &= ~PCIM_EXP_CTL_MAX_PAYLOAD; pci_write_config(dev, sc->bge_expcap + PCIR_EXPRESS_DEVICE_CTL, devctl, 2); /* Clear error status. */ pci_write_config(dev, sc->bge_expcap + PCIR_EXPRESS_DEVICE_STA, - 0, 2); + PCIM_EXP_STA_CORRECTABLE_ERROR | + PCIM_EXP_STA_NON_FATAL_ERROR | PCIM_EXP_STA_FATAL_ERROR | + PCIM_EXP_STA_UNSUPPORTED_REQ, 2); } /* Reset some of the PCI state that got zapped by reset. */ From owner-svn-src-stable@FreeBSD.ORG Thu Mar 18 18:58:25 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26BC510657AE; Thu, 18 Mar 2010 18:58:25 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13E6D8FC19; Thu, 18 Mar 2010 18:58:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2IIwOUA009009; Thu, 18 Mar 2010 18:58:24 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2IIwOnv009007; Thu, 18 Mar 2010 18:58:24 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003181858.o2IIwOnv009007@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 18 Mar 2010 18:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205291 - stable/8/sys/dev/msk X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 18:58:25 -0000 Author: yongari Date: Thu Mar 18 18:58:24 2010 New Revision: 205291 URL: http://svn.freebsd.org/changeset/base/205291 Log: MFC r202826-202827,204146 r202826: s/Mhz/MHz/g Submitted by: N.J. Mann njm dot me dot uk > r202827: Yukon Ultra2 has 125MHz clock. r204146: Correct inversed programming of ethernet hardware address on big-endian architecture. Submitted by: C. Jayachandran (initial version) Modified: stable/8/sys/dev/msk/if_msk.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/msk/if_msk.c ============================================================================== --- stable/8/sys/dev/msk/if_msk.c Thu Mar 18 18:58:17 2010 (r205290) +++ stable/8/sys/dev/msk/if_msk.c Thu Mar 18 18:58:24 2010 (r205291) @@ -1699,15 +1699,15 @@ mskc_attach(device_t dev) switch (sc->msk_hw_id) { case CHIP_ID_YUKON_EC: - sc->msk_clock = 125; /* 125 Mhz */ + sc->msk_clock = 125; /* 125 MHz */ sc->msk_pflags |= MSK_FLAG_JUMBO; break; case CHIP_ID_YUKON_EC_U: - sc->msk_clock = 125; /* 125 Mhz */ + sc->msk_clock = 125; /* 125 MHz */ sc->msk_pflags |= MSK_FLAG_JUMBO | MSK_FLAG_JUMBO_NOCSUM; break; case CHIP_ID_YUKON_EX: - sc->msk_clock = 125; /* 125 Mhz */ + sc->msk_clock = 125; /* 125 MHz */ sc->msk_pflags |= MSK_FLAG_JUMBO | MSK_FLAG_DESCV2 | MSK_FLAG_AUTOTX_CSUM; /* @@ -1725,11 +1725,11 @@ mskc_attach(device_t dev) sc->msk_pflags |= MSK_FLAG_JUMBO_NOCSUM; break; case CHIP_ID_YUKON_FE: - sc->msk_clock = 100; /* 100 Mhz */ + sc->msk_clock = 100; /* 100 MHz */ sc->msk_pflags |= MSK_FLAG_FASTETHER; break; case CHIP_ID_YUKON_FE_P: - sc->msk_clock = 50; /* 50 Mhz */ + sc->msk_clock = 50; /* 50 MHz */ sc->msk_pflags |= MSK_FLAG_FASTETHER | MSK_FLAG_DESCV2 | MSK_FLAG_AUTOTX_CSUM; if (sc->msk_hw_rev == CHIP_REV_YU_FE_P_A0) { @@ -1748,15 +1748,15 @@ mskc_attach(device_t dev) } break; case CHIP_ID_YUKON_XL: - sc->msk_clock = 156; /* 156 Mhz */ + sc->msk_clock = 156; /* 156 MHz */ sc->msk_pflags |= MSK_FLAG_JUMBO; break; case CHIP_ID_YUKON_UL_2: - sc->msk_clock = 156; /* 156 Mhz */ + sc->msk_clock = 125; /* 125 MHz */ sc->msk_pflags |= MSK_FLAG_JUMBO; break; default: - sc->msk_clock = 156; /* 156 Mhz */ + sc->msk_clock = 156; /* 156 MHz */ break; } @@ -3715,10 +3715,10 @@ msk_init_locked(struct msk_if_softc *sc_ struct msk_softc *sc; struct ifnet *ifp; struct mii_data *mii; - uint16_t eaddr[ETHER_ADDR_LEN / 2]; + uint8_t *eaddr; uint16_t gmac; uint32_t reg; - int error, i; + int error; MSK_IF_LOCK_ASSERT(sc_if); @@ -3787,14 +3787,20 @@ msk_init_locked(struct msk_if_softc *sc_ GMAC_WRITE_2(sc, sc_if->msk_port, GM_SERIAL_MODE, gmac); /* Set station address. */ - bcopy(IF_LLADDR(ifp), eaddr, ETHER_ADDR_LEN); - for (i = 0; i < ETHER_ADDR_LEN /2; i++) - GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_1L + i * 4, - eaddr[i]); - for (i = 0; i < ETHER_ADDR_LEN /2; i++) - GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_2L + i * 4, - eaddr[i]); - + eaddr = IF_LLADDR(ifp); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_1L, + eaddr[0] | (eaddr[1] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_1M, + eaddr[2] | (eaddr[3] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_1H, + eaddr[4] | (eaddr[5] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_2L, + eaddr[0] | (eaddr[1] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_2M, + eaddr[2] | (eaddr[3] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_2H, + eaddr[4] | (eaddr[5] << 8)); + /* Disable interrupts for counter overflows. */ GMAC_WRITE_2(sc, sc_if->msk_port, GM_TX_IRQ_MSK, 0); GMAC_WRITE_2(sc, sc_if->msk_port, GM_RX_IRQ_MSK, 0); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 18 19:00:38 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C5241065675; Thu, 18 Mar 2010 19:00:38 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39DD28FC16; Thu, 18 Mar 2010 19:00:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2IJ0c3q009633; Thu, 18 Mar 2010 19:00:38 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2IJ0cOE009631; Thu, 18 Mar 2010 19:00:38 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003181900.o2IJ0cOE009631@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 18 Mar 2010 19:00: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: r205293 - stable/7/sys/dev/msk X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 19:00:38 -0000 Author: yongari Date: Thu Mar 18 19:00:37 2010 New Revision: 205293 URL: http://svn.freebsd.org/changeset/base/205293 Log: MFC r202826-202827,204146 r202826: s/Mhz/MHz/g Submitted by: N.J. Mann njm dot me dot uk > r202827: Yukon Ultra2 has 125MHz clock. r204146: Correct inversed programming of ethernet hardware address on big-endian architecture. Submitted by: C. Jayachandran (initial version) Modified: stable/7/sys/dev/msk/if_msk.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/msk/if_msk.c ============================================================================== --- stable/7/sys/dev/msk/if_msk.c Thu Mar 18 19:00:35 2010 (r205292) +++ stable/7/sys/dev/msk/if_msk.c Thu Mar 18 19:00:37 2010 (r205293) @@ -1699,15 +1699,15 @@ mskc_attach(device_t dev) switch (sc->msk_hw_id) { case CHIP_ID_YUKON_EC: - sc->msk_clock = 125; /* 125 Mhz */ + sc->msk_clock = 125; /* 125 MHz */ sc->msk_pflags |= MSK_FLAG_JUMBO; break; case CHIP_ID_YUKON_EC_U: - sc->msk_clock = 125; /* 125 Mhz */ + sc->msk_clock = 125; /* 125 MHz */ sc->msk_pflags |= MSK_FLAG_JUMBO | MSK_FLAG_JUMBO_NOCSUM; break; case CHIP_ID_YUKON_EX: - sc->msk_clock = 125; /* 125 Mhz */ + sc->msk_clock = 125; /* 125 MHz */ sc->msk_pflags |= MSK_FLAG_JUMBO | MSK_FLAG_DESCV2 | MSK_FLAG_AUTOTX_CSUM; /* @@ -1725,11 +1725,11 @@ mskc_attach(device_t dev) sc->msk_pflags |= MSK_FLAG_JUMBO_NOCSUM; break; case CHIP_ID_YUKON_FE: - sc->msk_clock = 100; /* 100 Mhz */ + sc->msk_clock = 100; /* 100 MHz */ sc->msk_pflags |= MSK_FLAG_FASTETHER; break; case CHIP_ID_YUKON_FE_P: - sc->msk_clock = 50; /* 50 Mhz */ + sc->msk_clock = 50; /* 50 MHz */ sc->msk_pflags |= MSK_FLAG_FASTETHER | MSK_FLAG_DESCV2 | MSK_FLAG_AUTOTX_CSUM; if (sc->msk_hw_rev == CHIP_REV_YU_FE_P_A0) { @@ -1748,15 +1748,15 @@ mskc_attach(device_t dev) } break; case CHIP_ID_YUKON_XL: - sc->msk_clock = 156; /* 156 Mhz */ + sc->msk_clock = 156; /* 156 MHz */ sc->msk_pflags |= MSK_FLAG_JUMBO; break; case CHIP_ID_YUKON_UL_2: - sc->msk_clock = 156; /* 156 Mhz */ + sc->msk_clock = 125; /* 125 MHz */ sc->msk_pflags |= MSK_FLAG_JUMBO; break; default: - sc->msk_clock = 156; /* 156 Mhz */ + sc->msk_clock = 156; /* 156 MHz */ break; } @@ -3715,10 +3715,10 @@ msk_init_locked(struct msk_if_softc *sc_ struct msk_softc *sc; struct ifnet *ifp; struct mii_data *mii; - uint16_t eaddr[ETHER_ADDR_LEN / 2]; + uint8_t *eaddr; uint16_t gmac; uint32_t reg; - int error, i; + int error; MSK_IF_LOCK_ASSERT(sc_if); @@ -3787,14 +3787,20 @@ msk_init_locked(struct msk_if_softc *sc_ GMAC_WRITE_2(sc, sc_if->msk_port, GM_SERIAL_MODE, gmac); /* Set station address. */ - bcopy(IF_LLADDR(ifp), eaddr, ETHER_ADDR_LEN); - for (i = 0; i < ETHER_ADDR_LEN /2; i++) - GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_1L + i * 4, - eaddr[i]); - for (i = 0; i < ETHER_ADDR_LEN /2; i++) - GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_2L + i * 4, - eaddr[i]); - + eaddr = IF_LLADDR(ifp); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_1L, + eaddr[0] | (eaddr[1] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_1M, + eaddr[2] | (eaddr[3] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_1H, + eaddr[4] | (eaddr[5] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_2L, + eaddr[0] | (eaddr[1] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_2M, + eaddr[2] | (eaddr[3] << 8)); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_SRC_ADDR_2H, + eaddr[4] | (eaddr[5] << 8)); + /* Disable interrupts for counter overflows. */ GMAC_WRITE_2(sc, sc_if->msk_port, GM_TX_IRQ_MSK, 0); GMAC_WRITE_2(sc, sc_if->msk_port, GM_RX_IRQ_MSK, 0); From owner-svn-src-stable@FreeBSD.ORG Thu Mar 18 19:04:04 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9BAB106566B; Thu, 18 Mar 2010 19:04:04 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D6E48FC18; Thu, 18 Mar 2010 19:04:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2IJ44Kj010450; Thu, 18 Mar 2010 19:04:04 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2IJ44Jl010447; Thu, 18 Mar 2010 19:04:04 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003181904.o2IJ44Jl010447@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 18 Mar 2010 19:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205294 - stable/8/sys/net X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 19:04:04 -0000 Author: yongari Date: Thu Mar 18 19:04:04 2010 New Revision: 205294 URL: http://svn.freebsd.org/changeset/base/205294 Log: MFC r204149: Add TSO support on VLANs. Intentionally separated IFCAP_VLAN_HWTSO from IFCAP_VLAN_HWTAGGING. I think some hardwares may be able to TSO over VLAN without VLAN hardware tagging. Driver changes and userland support will follow. Modified: stable/8/sys/net/if.h stable/8/sys/net/if_vlan.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/net/if.h ============================================================================== --- stable/8/sys/net/if.h Thu Mar 18 19:00:37 2010 (r205293) +++ stable/8/sys/net/if.h Thu Mar 18 19:04:04 2010 (r205294) @@ -218,6 +218,7 @@ struct if_data { #define IFCAP_TOE6 0x08000 /* interface can offload TCP6 */ #define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */ #define IFCAP_POLLING_NOCOUNT 0x20000 /* polling ticks cannot be fragmented */ +#define IFCAP_VLAN_HWTSO 0x40000 /* can do IFCAP_TSO on VLANs */ #define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) #define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6) Modified: stable/8/sys/net/if_vlan.c ============================================================================== --- stable/8/sys/net/if_vlan.c Thu Mar 18 19:00:37 2010 (r205293) +++ stable/8/sys/net/if_vlan.c Thu Mar 18 19:04:04 2010 (r205294) @@ -1275,11 +1275,26 @@ vlan_capabilities(struct ifvlan *ifv) if (p->if_capenable & IFCAP_VLAN_HWCSUM && p->if_capenable & IFCAP_VLAN_HWTAGGING) { ifp->if_capenable = p->if_capenable & IFCAP_HWCSUM; - ifp->if_hwassist = p->if_hwassist; + ifp->if_hwassist = p->if_hwassist & (CSUM_IP | CSUM_TCP | + CSUM_UDP | CSUM_SCTP | CSUM_IP_FRAGS | CSUM_FRAGMENT); } else { ifp->if_capenable = 0; ifp->if_hwassist = 0; } + /* + * If the parent interface can do TSO on VLANs then + * propagate the hardware-assisted flag. TSO on VLANs + * does not necessarily require hardware VLAN tagging. + */ + if (p->if_capabilities & IFCAP_VLAN_HWTSO) + ifp->if_capabilities |= p->if_capabilities & IFCAP_TSO; + if (p->if_capenable & IFCAP_VLAN_HWTSO) { + ifp->if_capenable |= p->if_capenable & IFCAP_TSO; + ifp->if_hwassist |= p->if_hwassist & CSUM_TSO; + } else { + ifp->if_capenable &= ~(p->if_capenable & IFCAP_TSO); + ifp->if_hwassist &= ~(p->if_hwassist & CSUM_TSO); + } } static void From owner-svn-src-stable@FreeBSD.ORG Thu Mar 18 19:10:03 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BB3A106564A; Thu, 18 Mar 2010 19:10:03 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F2958FC13; Thu, 18 Mar 2010 19:10:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2IJA3cM011806; Thu, 18 Mar 2010 19:10:03 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2IJA3f0011802; Thu, 18 Mar 2010 19:10:03 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003181910.o2IJA3f0011802@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 18 Mar 2010 19:10:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205295 - stable/8/sbin/ifconfig X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 19:10:03 -0000 Author: yongari Date: Thu Mar 18 19:10:03 2010 New Revision: 205295 URL: http://svn.freebsd.org/changeset/base/205295 Log: MFC r204150: Add TSO support on VLAN in fconfig(8). Modified: stable/8/sbin/ifconfig/ifconfig.8 stable/8/sbin/ifconfig/ifconfig.c stable/8/sbin/ifconfig/ifvlan.c Directory Properties: stable/8/sbin/ifconfig/ (props changed) Modified: stable/8/sbin/ifconfig/ifconfig.8 ============================================================================== --- stable/8/sbin/ifconfig/ifconfig.8 Thu Mar 18 19:04:04 2010 (r205294) +++ stable/8/sbin/ifconfig/ifconfig.8 Thu Mar 18 19:10:03 2010 (r205295) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd January 26, 2010 +.Dd February 20, 2010 .Dt IFCONFIG 8 .Os .Sh NAME @@ -408,20 +408,20 @@ they support in their capabilities. is a synonym for enabling all available WOL mechanisms. To disable WOL use .Fl wol . -.It Cm vlanmtu , vlanhwtag, vlanhwfilter +.It Cm vlanmtu , vlanhwtag, vlanhwfilter, vlanhwtso If the driver offers user-configurable VLAN support, enable -reception of extended frames, tag processing in hardware, or -frame filtering in hardware, +reception of extended frames, tag processing in hardware, +frame filtering in hardware, or TSO on VLAN, respectively. Note that this must be issued on a physical interface associated with .Xr vlan 4 , not on a .Xr vlan 4 interface itself. -.It Fl vlanmtu , vlanhwtag, vlanhwfilter +.It Fl vlanmtu , vlanhwtag, vlanhwfilter, vlanhwtso If the driver offers user-configurable VLAN support, disable -reception of extended frames, tag processing in hardware, or -frame filtering in hardware, +reception of extended frames, tag processing in hardware, +frame filtering in hardware, or TSO on VLAN, respectively. .It Cm vnet Ar jail Move the interface to the Modified: stable/8/sbin/ifconfig/ifconfig.c ============================================================================== --- stable/8/sbin/ifconfig/ifconfig.c Thu Mar 18 19:04:04 2010 (r205294) +++ stable/8/sbin/ifconfig/ifconfig.c Thu Mar 18 19:10:03 2010 (r205295) @@ -865,7 +865,7 @@ unsetifdescr(const char *val, int value, #define IFCAPBITS \ "\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \ "\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \ -"\21VLAN_HWFILTER" +"\21VLAN_HWFILTER\23VLAN_HWTSO" /* * Print the status of the interface. If an address family was Modified: stable/8/sbin/ifconfig/ifvlan.c ============================================================================== --- stable/8/sbin/ifconfig/ifvlan.c Thu Mar 18 19:04:04 2010 (r205294) +++ stable/8/sbin/ifconfig/ifvlan.c Thu Mar 18 19:10:03 2010 (r205295) @@ -181,6 +181,8 @@ static struct cmd vlan_cmds[] = { DEF_CMD("-vlanhwtag", -IFCAP_VLAN_HWTAGGING, setifcap), DEF_CMD("vlanhwfilter", IFCAP_VLAN_HWFILTER, setifcap), DEF_CMD("-vlanhwfilter", -IFCAP_VLAN_HWFILTER, setifcap), + DEF_CMD("-vlanhwtso", -IFCAP_VLAN_HWTSO, setifcap), + DEF_CMD("vlanhwtso", IFCAP_VLAN_HWTSO, setifcap), }; static struct afswtch af_vlan = { .af_name = "af_vlan", From owner-svn-src-stable@FreeBSD.ORG Fri Mar 19 00:18:54 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3192F106564A; Fri, 19 Mar 2010 00:18:54 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EF6A8FC18; Fri, 19 Mar 2010 00:18:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2J0IrgN081191; Fri, 19 Mar 2010 00:18:54 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2J0IroV081190; Fri, 19 Mar 2010 00:18:53 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003190018.o2J0IroV081190@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 19 Mar 2010 00:18: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: r205301 - stable/7/sys/dev/bce X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2010 00:18:54 -0000 Author: yongari Date: Fri Mar 19 00:18:53 2010 New Revision: 205301 URL: http://svn.freebsd.org/changeset/base/205301 Log: MFC r194781: - Added code to read bootcode firwmare version. - Created dedicated shared memory access routines. Modified: stable/7/sys/dev/bce/if_bce.c stable/7/sys/dev/bce/if_bcereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bce/if_bce.c ============================================================================== --- stable/7/sys/dev/bce/if_bce.c Thu Mar 18 21:00:53 2010 (r205300) +++ stable/7/sys/dev/bce/if_bce.c Fri Mar 19 00:18:53 2010 (r205301) @@ -329,6 +329,8 @@ static void bce_breakpoint (struct bce /****************************************************************************/ static u32 bce_reg_rd_ind (struct bce_softc *, u32); static void bce_reg_wr_ind (struct bce_softc *, u32, u32); +static void bce_shmem_wr (struct bce_softc *, u32, u32); +static u32 bce_shmem_rd (struct bce_softc *, u32); static void bce_ctx_wr (struct bce_softc *, u32, u32, u32); static int bce_miibus_read_reg (device_t, int, int); static int bce_miibus_write_reg (device_t, int, int, int); @@ -574,6 +576,8 @@ bce_probe(device_t dev) static void bce_print_adapter_info(struct bce_softc *sc) { + int i = 0; + DBENTER(BCE_VERBOSE_LOAD); BCE_PRINTF("ASIC (0x%08X); ", sc->bce_chipid); @@ -596,19 +600,33 @@ bce_print_adapter_info(struct bce_softc } /* Firmware version and device features. */ - printf("B/C (0x%08X); Flags( ", sc->bce_bc_ver); + printf("B/C (%s); Flags (", sc->bce_bc_ver); + #ifdef BCE_JUMBO_HDRSPLIT printf("SPLT "); + i++; #endif - if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) - printf("MFW "); - if (sc->bce_flags & BCE_USING_MSI_FLAG) - printf("MSI "); - if (sc->bce_flags & BCE_USING_MSIX_FLAG) - printf("MSI-X "); - if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) - printf("2.5G "); - printf(")\n"); + if (sc->bce_flags & BCE_USING_MSI_FLAG) { + if (i > 0) printf("|"); + printf("MSI"); i++; + } + + if (sc->bce_flags & BCE_USING_MSIX_FLAG) { + if (i > 0) printf("|"); + printf("MSI-X "); i++; + } + + if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) { + if (i > 0) printf("|"); + printf("2.5G"); i++; + } + + if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { + if (i > 0) printf("|"); + printf("MFW); MFW (%s)\n", sc->bce_mfw_ver); + } else { + printf(")\n"); + } DBEXIT(BCE_VERBOSE_LOAD); } @@ -847,13 +865,50 @@ bce_attach(device_t dev) __FUNCTION__, sc->bce_shmem_base); /* Fetch the bootcode revision. */ - sc->bce_bc_ver = REG_RD_IND(sc, sc->bce_shmem_base + - BCE_DEV_INFO_BC_REV); + val = bce_shmem_rd(sc, BCE_DEV_INFO_BC_REV); + for (int i = 0, j = 0; i < 3; i++) { + u8 num; + + num = (u8) (val >> (24 - (i * 8))); + for (int k = 100, skip0 = 1; k >= 1; num %= k, k /= 10) { + if (num >= k || !skip0 || k == 1) { + sc->bce_bc_ver[j++] = (num / k) + '0'; + skip0 = 0; + } + } + if (i != 2) + sc->bce_bc_ver[j++] = '.'; + } + + /* Check if any management firwmare is running. */ + val = bce_shmem_rd(sc, BCE_PORT_FEATURE); + if (val & BCE_PORT_FEATURE_ASF_ENABLED) { + sc->bce_flags |= BCE_MFW_ENABLE_FLAG; + + /* Allow time for firmware to enter the running state. */ + for (int i = 0; i < 30; i++) { + val = bce_shmem_rd(sc, BCE_BC_STATE_CONDITION); + if (val & BCE_CONDITION_MFW_RUN_MASK) + break; + DELAY(10000); + } + } - /* Check if any management firmware is running. */ - val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_PORT_FEATURE); - if (val & (BCE_PORT_FEATURE_ASF_ENABLED | BCE_PORT_FEATURE_IMD_ENABLED)) - sc->bce_flags |= BCE_MFW_ENABLE_FLAG; + /* Check the current bootcode state. */ + val = bce_shmem_rd(sc, BCE_BC_STATE_CONDITION); + val &= BCE_CONDITION_MFW_RUN_MASK; + if (val != BCE_CONDITION_MFW_RUN_UNKNOWN && + val != BCE_CONDITION_MFW_RUN_NONE) { + u32 addr = bce_shmem_rd(sc, BCE_MFW_VER_PTR); + int i = 0; + + for (int j = 0; j < 3; j++) { + val = bce_reg_rd_ind(sc, addr + j * 4); + val = bswap32(val); + memcpy(&sc->bce_mfw_ver[i], &val, 4); + i += 4; + } + } /* Get PCI bus information (speed and type). */ val = REG_RD(sc, BCE_PCICFG_MISC_STATUS); @@ -967,10 +1022,8 @@ bce_attach(device_t dev) bce_get_media(sc); /* Store data needed by PHY driver for backplane applications */ - sc->bce_shared_hw_cfg = REG_RD_IND(sc, sc->bce_shmem_base + - BCE_SHARED_HW_CFG_CONFIG); - sc->bce_port_hw_cfg = REG_RD_IND(sc, sc->bce_shmem_base + - BCE_PORT_HW_CFG_CONFIG); + sc->bce_shared_hw_cfg = bce_shmem_rd(sc, BCE_SHARED_HW_CFG_CONFIG); + sc->bce_port_hw_cfg = bce_shmem_rd(sc, BCE_PORT_HW_CFG_CONFIG); /* Allocate DMA memory resources. */ if (bce_dma_alloc(dev)) { @@ -1293,6 +1346,36 @@ bce_reg_wr_ind(struct bce_softc *sc, u32 } +/****************************************************************************/ +/* Shared memory write. */ +/* */ +/* Writes NetXtreme II shared memory region. */ +/* */ +/* Returns: */ +/* Nothing. */ +/****************************************************************************/ +static void +bce_shmem_wr(struct bce_softc *sc, u32 offset, u32 val) +{ + bce_reg_wr_ind(sc, sc->bce_shmem_base + offset, val); +} + + +/****************************************************************************/ +/* Shared memory read. */ +/* */ +/* Reads NetXtreme II shared memory region. */ +/* */ +/* Returns: */ +/* The 32 bit value read. */ +/****************************************************************************/ +static u32 +bce_shmem_rd(struct bce_softc *sc, u32 offset) +{ + return (bce_reg_rd_ind(sc, sc->bce_shmem_base + offset)); +} + + #ifdef BCE_DEBUG /****************************************************************************/ /* Context memory read. */ @@ -2094,7 +2177,7 @@ bce_init_nvram(struct bce_softc *sc) bce_init_nvram_get_flash_size: /* Write the flash config data to the shared memory interface. */ - val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_SHARED_HW_CFG_CONFIG2); + val = bce_shmem_rd(sc, BCE_SHARED_HW_CFG_CONFIG2); val &= BCE_SHARED_HW_CFG2_NVM_SIZE_MASK; if (val) sc->bce_flash_size = val; @@ -2583,8 +2666,7 @@ bce_get_media(struct bce_softc *sc) sc->bce_flags |= BCE_NO_WOL_FLAG; if (BCE_CHIP_NUM(sc) != BCE_CHIP_NUM_5706) { sc->bce_phy_addr = 2; - val = REG_RD_IND(sc, sc->bce_shmem_base + - BCE_SHARED_HW_CFG_CONFIG); + val = bce_shmem_rd(sc, BCE_SHARED_HW_CFG_CONFIG); if (val & BCE_SHARED_HW_CFG_PHY_2_5G) { sc->bce_phy_flags |= BCE_PHY_2_5G_CAPABLE_FLAG; DBPRINT(sc, BCE_INFO_LOAD, "Found 2.5Gb capable adapter\n"); @@ -3487,12 +3569,12 @@ bce_fw_sync(struct bce_softc *sc, u32 ms msg_data); /* Send the message to the bootcode driver mailbox. */ - REG_WR_IND(sc, sc->bce_shmem_base + BCE_DRV_MB, msg_data); + bce_shmem_wr(sc, BCE_DRV_MB, msg_data); /* Wait for the bootcode to acknowledge the message. */ for (i = 0; i < FW_ACK_TIME_OUT_MS; i++) { /* Check for a response in the bootcode firmware mailbox. */ - val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_FW_MB); + val = bce_shmem_rd(sc, BCE_FW_MB); if ((val & BCE_FW_MSG_ACK) == (msg_data & BCE_DRV_MSG_SEQ)) break; DELAY(1000); @@ -3509,7 +3591,7 @@ bce_fw_sync(struct bce_softc *sc, u32 ms msg_data &= ~BCE_DRV_MSG_CODE; msg_data |= BCE_DRV_MSG_CODE_FW_TIMEOUT; - REG_WR_IND(sc, sc->bce_shmem_base + BCE_DRV_MB, msg_data); + bce_shmem_wr(sc, BCE_DRV_MB, msg_data); sc->bce_fw_timed_out = 1; rc = EBUSY; @@ -4309,10 +4391,8 @@ bce_get_mac_addr(struct bce_softc *sc) * shared memory for speed. */ - mac_hi = REG_RD_IND(sc, sc->bce_shmem_base + - BCE_PORT_HW_CFG_MAC_UPPER); - mac_lo = REG_RD_IND(sc, sc->bce_shmem_base + - BCE_PORT_HW_CFG_MAC_LOWER); + mac_hi = bce_shmem_rd(sc, BCE_PORT_HW_CFG_MAC_UPPER); + mac_lo = bce_shmem_rd(sc, BCE_PORT_HW_CFG_MAC_LOWER); if ((mac_lo == 0) && (mac_hi == 0)) { BCE_PRINTF("%s(%d): Invalid Ethernet address!\n", @@ -4467,8 +4547,7 @@ bce_reset(struct bce_softc *sc, u32 rese goto bce_reset_exit; /* Set a firmware reminder that this is a soft reset. */ - REG_WR_IND(sc, sc->bce_shmem_base + BCE_DRV_RESET_SIGNATURE, - BCE_DRV_RESET_SIGNATURE_MAGIC); + bce_shmem_wr(sc, BCE_DRV_RESET_SIGNATURE, BCE_DRV_RESET_SIGNATURE_MAGIC); /* Dummy read to force the chip to complete all current transactions. */ val = REG_RD(sc, BCE_MISC_ID); @@ -4735,7 +4814,7 @@ bce_blockinit(struct bce_softc *sc) REG_WR(sc, BCE_HC_COMMAND, BCE_HC_COMMAND_CLR_STAT_NOW); /* Verify that bootcode is running. */ - reg = REG_RD_IND(sc, sc->bce_shmem_base + BCE_DEV_INFO_SIGNATURE); + reg = bce_shmem_rd(sc, BCE_DEV_INFO_SIGNATURE); DBRUNIF(DB_RANDOMTRUE(bootcode_running_failure_sim_control), BCE_PRINTF("%s(%d): Simulating bootcode failure.\n", @@ -7470,7 +7549,7 @@ bce_pulse(void *xsc) /* Tell the firmware that the driver is still running. */ msg = (u32) ++sc->bce_fw_drv_pulse_wr_seq; - REG_WR_IND(sc, sc->bce_shmem_base + BCE_DRV_PULSE_MB, msg); + bce_shmem_wr(sc, BCE_DRV_PULSE_MB, msg); /* Schedule the next pulse. */ callout_reset(&sc->bce_pulse_callout, hz, bce_pulse, sc); @@ -9824,7 +9903,7 @@ bce_dump_hw_state(struct bce_softc *sc) " Hardware State " "----------------------------\n"); - BCE_PRINTF("0x%08X - bootcode version\n", sc->bce_bc_ver); + BCE_PRINTF("%s - bootcode version\n", sc->bce_bc_ver); val = REG_RD(sc, BCE_MISC_ENABLE_STATUS_BITS); BCE_PRINTF("0x%08X - (0x%06X) misc_enable_status_bits\n", @@ -9949,21 +10028,21 @@ bce_dump_bc_state(struct bce_softc *sc) " Bootcode State " "----------------------------\n"); - BCE_PRINTF("0x%08X - bootcode version\n", sc->bce_bc_ver); + BCE_PRINTF("%s - bootcode version\n", sc->bce_bc_ver); - val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_BC_RESET_TYPE); + val = bce_shmem_rd(sc, BCE_BC_RESET_TYPE); BCE_PRINTF("0x%08X - (0x%06X) reset_type\n", val, BCE_BC_RESET_TYPE); - val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_BC_STATE); + val = bce_shmem_rd(sc, BCE_BC_STATE); BCE_PRINTF("0x%08X - (0x%06X) state\n", val, BCE_BC_STATE); - val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_BC_CONDITION); + val = bce_shmem_rd(sc, BCE_BC_CONDITION); BCE_PRINTF("0x%08X - (0x%06X) condition\n", val, BCE_BC_CONDITION); - val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_BC_STATE_DEBUG_CMD); + val = bce_shmem_rd(sc, BCE_BC_STATE_DEBUG_CMD); BCE_PRINTF("0x%08X - (0x%06X) debug_cmd\n", val, BCE_BC_STATE_DEBUG_CMD); Modified: stable/7/sys/dev/bce/if_bcereg.h ============================================================================== --- stable/7/sys/dev/bce/if_bcereg.h Thu Mar 18 21:00:53 2010 (r205300) +++ stable/7/sys/dev/bce/if_bcereg.h Fri Mar 19 00:18:53 2010 (r205301) @@ -996,6 +996,8 @@ struct flash_spec { #define BCE_PORT_FEATURE_MBA_VLAN_TAG_MASK 0xffff #define BCE_PORT_FEATURE_MBA_VLAN_ENABLE 0x10000 +#define BCE_MFW_VER_PTR 0x00000014c + #define BCE_BC_STATE_RESET_TYPE 0x000001c0 #define BCE_BC_STATE_RESET_TYPE_SIG 0x00005254 #define BCE_BC_STATE_RESET_TYPE_SIG_MASK 0x0000ffff @@ -1051,7 +1053,13 @@ struct flash_spec { #define BCE_BC_STATE_ERR_NO_RXP (BCE_BC_STATE_SIGN | 0x0600) #define BCE_BC_STATE_ERR_TOO_MANY_RBUF (BCE_BC_STATE_SIGN | 0x0700) -#define BCE_BC_CONDITION 0x000001c8 +#define BCE_BC_STATE_CONDITION 0x000001c8 +#define BCE_CONDITION_MFW_RUN_UNKNOWN 0x00000000 +#define BCE_CONDITION_MFW_RUN_IPMI 0x00002000 +#define BCE_CONDITION_MFW_RUN_UMP 0x00004000 +#define BCE_CONDITION_MFW_RUN_NCSI 0x00006000 +#define BCE_CONDITION_MFW_RUN_NONE 0x0000e000 +#define BCE_CONDITION_MFW_RUN_MASK 0x0000e000 #define BCE_BC_STATE_DEBUG_CMD 0x1dc #define BCE_BC_STATE_BC_DBG_CMD_SIGNATURE 0x42440000 @@ -6454,7 +6462,8 @@ struct bce_softc char * bce_name; /* Name string */ /* Tracks the version of bootcode firmware. */ - u32 bce_bc_ver; + char bce_bc_ver[32]; + char bce_mfw_ver[32]; /* Tracks the state of the firmware. 0 = Running while any */ /* other value indicates that the firmware is not responding. */ From owner-svn-src-stable@FreeBSD.ORG Fri Mar 19 00:26:46 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7505106564A; Fri, 19 Mar 2010 00:26:45 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 952D18FC08; Fri, 19 Mar 2010 00:26:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2J0Qj3J083012; Fri, 19 Mar 2010 00:26:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2J0QjHW083009; Fri, 19 Mar 2010 00:26:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003190026.o2J0QjHW083009@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 19 Mar 2010 00:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205303 - stable/8/sys/dev/bce X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2010 00:26:46 -0000 Author: yongari Date: Fri Mar 19 00:26:45 2010 New Revision: 205303 URL: http://svn.freebsd.org/changeset/base/205303 Log: MFC r202717: - Added a workaround for NC-SI management firmware that would allow frames to be accepted while the driver is resetting the hardware. This failure is generally observed when broadcast frames are received during driver load and will generate "Unable to write CTX memory" errors. - Small changes to driver flags display. PR: kern/135836, kern/140684 Modified: stable/8/sys/dev/bce/if_bce.c stable/8/sys/dev/bce/if_bcereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bce/if_bce.c ============================================================================== --- stable/8/sys/dev/bce/if_bce.c Fri Mar 19 00:19:55 2010 (r205302) +++ stable/8/sys/dev/bce/if_bce.c Fri Mar 19 00:26:45 2010 (r205303) @@ -371,6 +371,9 @@ static void bce_release_resources (struc static int bce_fw_sync (struct bce_softc *, u32); static void bce_load_rv2p_fw (struct bce_softc *, u32 *, u32, u32); static void bce_load_cpu_fw (struct bce_softc *, struct cpu_reg *, struct fw_info *); +static void bce_start_cpu (struct bce_softc *, struct cpu_reg *); +static void bce_halt_cpu (struct bce_softc *, struct cpu_reg *); +static void bce_start_rxp_cpu (struct bce_softc *); static void bce_init_rxp_cpu (struct bce_softc *); static void bce_init_txp_cpu (struct bce_softc *); static void bce_init_tpat_cpu (struct bce_softc *); @@ -603,9 +606,10 @@ bce_print_adapter_info(struct bce_softc printf("B/C (%s); Flags (", sc->bce_bc_ver); #ifdef BCE_JUMBO_HDRSPLIT - printf("SPLT "); + printf("SPLT"); i++; #endif + if (sc->bce_flags & BCE_USING_MSI_FLAG) { if (i > 0) printf("|"); printf("MSI"); i++; @@ -613,7 +617,7 @@ bce_print_adapter_info(struct bce_softc if (sc->bce_flags & BCE_USING_MSIX_FLAG) { if (i > 0) printf("|"); - printf("MSI-X "); i++; + printf("MSI-X"); i++; } if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) { @@ -2976,6 +2980,7 @@ bce_dma_map_addr(void *arg, bus_dma_segm /* |PG Buffers | none | none | none | none | */ /* |TX Buffers | none | none | none | none | */ /* |Chain Pages(1) | 4KiB | 4KiB | 4KiB | 4KiB | */ +/* |Context Memory | | | | | */ /* +-----------------+----------+----------+----------+----------+ */ /* */ /* (1) Must align with CPU page size (BCM_PAGE_SZIE). */ @@ -3665,15 +3670,10 @@ bce_load_cpu_fw(struct bce_softc *sc, st struct fw_info *fw) { u32 offset; - u32 val; DBENTER(BCE_VERBOSE_RESET); - /* Halt the CPU. */ - val = REG_RD_IND(sc, cpu_reg->mode); - val |= cpu_reg->mode_value_halt; - REG_WR_IND(sc, cpu_reg->mode, val); - REG_WR_IND(sc, cpu_reg->state, cpu_reg->state_value_clear); + bce_halt_cpu(sc, cpu_reg); /* Load the Text area. */ offset = cpu_reg->spad_base + (fw->text_addr - cpu_reg->mips_view_base); @@ -3726,9 +3726,28 @@ bce_load_cpu_fw(struct bce_softc *sc, st } } - /* Clear the pre-fetch instruction. */ - REG_WR_IND(sc, cpu_reg->inst, 0); - REG_WR_IND(sc, cpu_reg->pc, fw->start_addr); + /* Clear the pre-fetch instruction and set the FW start address. */ + REG_WR_IND(sc, cpu_reg->inst, 0); + REG_WR_IND(sc, cpu_reg->pc, fw->start_addr); + + DBEXIT(BCE_VERBOSE_RESET); +} + + +/****************************************************************************/ +/* Starts the RISC processor. */ +/* */ +/* Assumes the CPU starting address has already been set. */ +/* */ +/* Returns: */ +/* Nothing. */ +/****************************************************************************/ +static void +bce_start_cpu(struct bce_softc *sc, struct cpu_reg *cpu_reg) +{ + u32 val; + + DBENTER(BCE_VERBOSE_RESET); /* Start the CPU. */ val = REG_RD_IND(sc, cpu_reg->mode); @@ -3741,6 +3760,62 @@ bce_load_cpu_fw(struct bce_softc *sc, st /****************************************************************************/ +/* Halts the RISC processor. */ +/* */ +/* Returns: */ +/* Nothing. */ +/****************************************************************************/ +static void +bce_halt_cpu(struct bce_softc *sc, struct cpu_reg *cpu_reg) +{ + u32 val; + + DBENTER(BCE_VERBOSE_RESET); + + /* Halt the CPU. */ + val = REG_RD_IND(sc, cpu_reg->mode); + val |= cpu_reg->mode_value_halt; + REG_WR_IND(sc, cpu_reg->mode, val); + REG_WR_IND(sc, cpu_reg->state, cpu_reg->state_value_clear); + + DBEXIT(BCE_VERBOSE_RESET); +} + + +/****************************************************************************/ +/* Initialize the RX CPU. */ +/* */ +/* Returns: */ +/* Nothing. */ +/****************************************************************************/ +static void +bce_start_rxp_cpu(struct bce_softc *sc) +{ + struct cpu_reg cpu_reg; + + DBENTER(BCE_VERBOSE_RESET); + + cpu_reg.mode = BCE_RXP_CPU_MODE; + cpu_reg.mode_value_halt = BCE_RXP_CPU_MODE_SOFT_HALT; + cpu_reg.mode_value_sstep = BCE_RXP_CPU_MODE_STEP_ENA; + cpu_reg.state = BCE_RXP_CPU_STATE; + cpu_reg.state_value_clear = 0xffffff; + cpu_reg.gpr0 = BCE_RXP_CPU_REG_FILE; + cpu_reg.evmask = BCE_RXP_CPU_EVENT_MASK; + cpu_reg.pc = BCE_RXP_CPU_PROGRAM_COUNTER; + cpu_reg.inst = BCE_RXP_CPU_INSTRUCTION; + cpu_reg.bp = BCE_RXP_CPU_HW_BREAKPOINT; + cpu_reg.spad_base = BCE_RXP_SCRATCH; + cpu_reg.mips_view_base = 0x8000000; + + DBPRINT(sc, BCE_INFO_RESET, "Starting RX firmware.\n"); + bce_start_cpu(sc, &cpu_reg); + + DBEXIT(BCE_VERBOSE_RESET); +} + + +/****************************************************************************/ /* Initialize the RX CPU. */ /* */ /* Returns: */ @@ -3833,6 +3908,8 @@ bce_init_rxp_cpu(struct bce_softc *sc) DBPRINT(sc, BCE_INFO_RESET, "Loading RX firmware.\n"); bce_load_cpu_fw(sc, &cpu_reg, &fw); + /* Delay RXP start until initialization is complete. */ + DBEXIT(BCE_VERBOSE_RESET); } @@ -3929,6 +4006,7 @@ bce_init_txp_cpu(struct bce_softc *sc) DBPRINT(sc, BCE_INFO_RESET, "Loading TX firmware.\n"); bce_load_cpu_fw(sc, &cpu_reg, &fw); + bce_start_cpu(sc, &cpu_reg); DBEXIT(BCE_VERBOSE_RESET); } @@ -4026,6 +4104,7 @@ bce_init_tpat_cpu(struct bce_softc *sc) DBPRINT(sc, BCE_INFO_RESET, "Loading TPAT firmware.\n"); bce_load_cpu_fw(sc, &cpu_reg, &fw); + bce_start_cpu(sc, &cpu_reg); DBEXIT(BCE_VERBOSE_RESET); } @@ -4123,6 +4202,7 @@ bce_init_cp_cpu(struct bce_softc *sc) DBPRINT(sc, BCE_INFO_RESET, "Loading CP firmware.\n"); bce_load_cpu_fw(sc, &cpu_reg, &fw); + bce_start_cpu(sc, &cpu_reg); DBEXIT(BCE_VERBOSE_RESET); } @@ -4220,6 +4300,7 @@ bce_init_com_cpu(struct bce_softc *sc) DBPRINT(sc, BCE_INFO_RESET, "Loading COM firmware.\n"); bce_load_cpu_fw(sc, &cpu_reg, &fw); + bce_start_cpu(sc, &cpu_reg); DBEXIT(BCE_VERBOSE_RESET); } @@ -4665,6 +4746,12 @@ bce_chipinit(struct bce_softc *sc) /* Initialize the on-boards CPUs */ bce_init_cpus(sc); + /* Enable management frames (NC-SI) to flow to the MCP. */ + if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { + val = REG_RD(sc, BCE_RPM_MGMT_PKT_CTRL) | BCE_RPM_MGMT_PKT_CTRL_MGMT_EN; + REG_WR(sc, BCE_RPM_MGMT_PKT_CTRL, val); + } + /* Prepare NVRAM for access. */ if (bce_init_nvram(sc)) { rc = ENODEV; @@ -4845,6 +4932,15 @@ bce_blockinit(struct bce_softc *sc) /* Enable link state change interrupt generation. */ REG_WR(sc, BCE_HC_ATTN_BITS_ENABLE, STATUS_ATTN_BITS_LINK_STATE); + /* Enable the RXP. */ + bce_start_rxp_cpu(sc); + + /* Disable management frames (NC-SI) from flowing to the MCP. */ + if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { + val = REG_RD(sc, BCE_RPM_MGMT_PKT_CTRL) & ~BCE_RPM_MGMT_PKT_CTRL_MGMT_EN; + REG_WR(sc, BCE_RPM_MGMT_PKT_CTRL, val); + } + /* Enable all remaining blocks in the MAC. */ if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) || (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) @@ -5851,22 +5947,29 @@ bce_rx_intr(struct bce_softc *sc) DBRUN(sc->debug_rx_mbuf_alloc--); sc->free_rx_bd++; - /* - * Frames received on the NetXteme II are prepended with an - * l2_fhdr structure which provides status information about - * the received frame (including VLAN tags and checksum info). - * The frames are also automatically adjusted to align the IP - * header (i.e. two null bytes are inserted before the Ethernet - * header). As a result the data DMA'd by the controller into - * the mbuf is as follows: - * - * +---------+-----+---------------------+-----+ - * | l2_fhdr | pad | packet data | FCS | - * +---------+-----+---------------------+-----+ - * - * The l2_fhdr needs to be checked and skipped and the FCS needs - * to be stripped before sending the packet up the stack. - */ + if(m0 == NULL) { + DBPRINT(sc, BCE_EXTREME_RECV, "%s(): Oops! Empty mbuf pointer " + "found in sc->rx_mbuf_ptr[0x%04X]!\n", + __FUNCTION__, sw_rx_cons_idx); + goto bce_rx_int_next_rx; + } + + /* + * Frames received on the NetXteme II are prepended with an + * l2_fhdr structure which provides status information about + * the received frame (including VLAN tags and checksum info). + * The frames are also automatically adjusted to align the IP + * header (i.e. two null bytes are inserted before the Ethernet + * header). As a result the data DMA'd by the controller into + * the mbuf is as follows: + * + * +---------+-----+---------------------+-----+ + * | l2_fhdr | pad | packet data | FCS | + * +---------+-----+---------------------+-----+ + * + * The l2_fhdr needs to be checked and skipped and the FCS needs + * to be stripped before sending the packet up the stack. + */ l2fhdr = mtod(m0, struct l2_fhdr *); /* Get the packet data + FCS length and the status. */ @@ -6387,6 +6490,7 @@ bce_init_locked(struct bce_softc *sc) bce_ifmedia_upd_locked(ifp); + /* Let the OS know the driver is up and running. */ ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -10038,9 +10142,9 @@ bce_dump_bc_state(struct bce_softc *sc) BCE_PRINTF("0x%08X - (0x%06X) state\n", val, BCE_BC_STATE); - val = bce_shmem_rd(sc, BCE_BC_CONDITION); + val = bce_shmem_rd(sc, BCE_BC_STATE_CONDITION); BCE_PRINTF("0x%08X - (0x%06X) condition\n", - val, BCE_BC_CONDITION); + val, BCE_BC_STATE_CONDITION); val = bce_shmem_rd(sc, BCE_BC_STATE_DEBUG_CMD); BCE_PRINTF("0x%08X - (0x%06X) debug_cmd\n", Modified: stable/8/sys/dev/bce/if_bcereg.h ============================================================================== --- stable/8/sys/dev/bce/if_bcereg.h Fri Mar 19 00:19:55 2010 (r205302) +++ stable/8/sys/dev/bce/if_bcereg.h Fri Mar 19 00:26:45 2010 (r205303) @@ -3715,6 +3715,10 @@ struct l2_fhdr { #define BCE_RPM_CONFIG_SORT_VECT_VAL (0xfL<<4) #define BCE_RPM_CONFIG_IGNORE_VLAN (1L<<31) +#define BCE_RPM_MGMT_PKT_CTRL 0x0000180c +#define BCE_RPM_MGMT_PKT_CTRL_MGMT_DISCARD_EN (1L<<30) +#define BCE_RPM_MGMT_PKT_CTRL_MGMT_EN (1L<<31) + #define BCE_RPM_VLAN_MATCH0 0x00001810 #define BCE_RPM_VLAN_MATCH0_RPM_VLAN_MTCH0_VALUE (0xfffL<<0) From owner-svn-src-stable@FreeBSD.ORG Fri Mar 19 00:29:52 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C0001065670; Fri, 19 Mar 2010 00:29:52 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59ED98FC14; Fri, 19 Mar 2010 00:29:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2J0Tqv2083708; Fri, 19 Mar 2010 00:29:52 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2J0Tqko083705; Fri, 19 Mar 2010 00:29:52 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003190029.o2J0Tqko083705@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 19 Mar 2010 00:29:52 +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: r205304 - stable/7/sys/dev/bce X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2010 00:29:52 -0000 Author: yongari Date: Fri Mar 19 00:29:52 2010 New Revision: 205304 URL: http://svn.freebsd.org/changeset/base/205304 Log: MFC r202717: - Added a workaround for NC-SI management firmware that would allow frames to be accepted while the driver is resetting the hardware. This failure is generally observed when broadcast frames are received during driver load and will generate "Unable to write CTX memory" errors. - Small changes to driver flags display. PR: kern/135836, kern/140684 Modified: stable/7/sys/dev/bce/if_bce.c stable/7/sys/dev/bce/if_bcereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bce/if_bce.c ============================================================================== --- stable/7/sys/dev/bce/if_bce.c Fri Mar 19 00:26:45 2010 (r205303) +++ stable/7/sys/dev/bce/if_bce.c Fri Mar 19 00:29:52 2010 (r205304) @@ -371,6 +371,9 @@ static void bce_release_resources (struc static int bce_fw_sync (struct bce_softc *, u32); static void bce_load_rv2p_fw (struct bce_softc *, u32 *, u32, u32); static void bce_load_cpu_fw (struct bce_softc *, struct cpu_reg *, struct fw_info *); +static void bce_start_cpu (struct bce_softc *, struct cpu_reg *); +static void bce_halt_cpu (struct bce_softc *, struct cpu_reg *); +static void bce_start_rxp_cpu (struct bce_softc *); static void bce_init_rxp_cpu (struct bce_softc *); static void bce_init_txp_cpu (struct bce_softc *); static void bce_init_tpat_cpu (struct bce_softc *); @@ -603,9 +606,10 @@ bce_print_adapter_info(struct bce_softc printf("B/C (%s); Flags (", sc->bce_bc_ver); #ifdef BCE_JUMBO_HDRSPLIT - printf("SPLT "); + printf("SPLT"); i++; #endif + if (sc->bce_flags & BCE_USING_MSI_FLAG) { if (i > 0) printf("|"); printf("MSI"); i++; @@ -613,7 +617,7 @@ bce_print_adapter_info(struct bce_softc if (sc->bce_flags & BCE_USING_MSIX_FLAG) { if (i > 0) printf("|"); - printf("MSI-X "); i++; + printf("MSI-X"); i++; } if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) { @@ -2976,6 +2980,7 @@ bce_dma_map_addr(void *arg, bus_dma_segm /* |PG Buffers | none | none | none | none | */ /* |TX Buffers | none | none | none | none | */ /* |Chain Pages(1) | 4KiB | 4KiB | 4KiB | 4KiB | */ +/* |Context Memory | | | | | */ /* +-----------------+----------+----------+----------+----------+ */ /* */ /* (1) Must align with CPU page size (BCM_PAGE_SZIE). */ @@ -3665,15 +3670,10 @@ bce_load_cpu_fw(struct bce_softc *sc, st struct fw_info *fw) { u32 offset; - u32 val; DBENTER(BCE_VERBOSE_RESET); - /* Halt the CPU. */ - val = REG_RD_IND(sc, cpu_reg->mode); - val |= cpu_reg->mode_value_halt; - REG_WR_IND(sc, cpu_reg->mode, val); - REG_WR_IND(sc, cpu_reg->state, cpu_reg->state_value_clear); + bce_halt_cpu(sc, cpu_reg); /* Load the Text area. */ offset = cpu_reg->spad_base + (fw->text_addr - cpu_reg->mips_view_base); @@ -3726,9 +3726,28 @@ bce_load_cpu_fw(struct bce_softc *sc, st } } - /* Clear the pre-fetch instruction. */ - REG_WR_IND(sc, cpu_reg->inst, 0); - REG_WR_IND(sc, cpu_reg->pc, fw->start_addr); + /* Clear the pre-fetch instruction and set the FW start address. */ + REG_WR_IND(sc, cpu_reg->inst, 0); + REG_WR_IND(sc, cpu_reg->pc, fw->start_addr); + + DBEXIT(BCE_VERBOSE_RESET); +} + + +/****************************************************************************/ +/* Starts the RISC processor. */ +/* */ +/* Assumes the CPU starting address has already been set. */ +/* */ +/* Returns: */ +/* Nothing. */ +/****************************************************************************/ +static void +bce_start_cpu(struct bce_softc *sc, struct cpu_reg *cpu_reg) +{ + u32 val; + + DBENTER(BCE_VERBOSE_RESET); /* Start the CPU. */ val = REG_RD_IND(sc, cpu_reg->mode); @@ -3741,6 +3760,62 @@ bce_load_cpu_fw(struct bce_softc *sc, st /****************************************************************************/ +/* Halts the RISC processor. */ +/* */ +/* Returns: */ +/* Nothing. */ +/****************************************************************************/ +static void +bce_halt_cpu(struct bce_softc *sc, struct cpu_reg *cpu_reg) +{ + u32 val; + + DBENTER(BCE_VERBOSE_RESET); + + /* Halt the CPU. */ + val = REG_RD_IND(sc, cpu_reg->mode); + val |= cpu_reg->mode_value_halt; + REG_WR_IND(sc, cpu_reg->mode, val); + REG_WR_IND(sc, cpu_reg->state, cpu_reg->state_value_clear); + + DBEXIT(BCE_VERBOSE_RESET); +} + + +/****************************************************************************/ +/* Initialize the RX CPU. */ +/* */ +/* Returns: */ +/* Nothing. */ +/****************************************************************************/ +static void +bce_start_rxp_cpu(struct bce_softc *sc) +{ + struct cpu_reg cpu_reg; + + DBENTER(BCE_VERBOSE_RESET); + + cpu_reg.mode = BCE_RXP_CPU_MODE; + cpu_reg.mode_value_halt = BCE_RXP_CPU_MODE_SOFT_HALT; + cpu_reg.mode_value_sstep = BCE_RXP_CPU_MODE_STEP_ENA; + cpu_reg.state = BCE_RXP_CPU_STATE; + cpu_reg.state_value_clear = 0xffffff; + cpu_reg.gpr0 = BCE_RXP_CPU_REG_FILE; + cpu_reg.evmask = BCE_RXP_CPU_EVENT_MASK; + cpu_reg.pc = BCE_RXP_CPU_PROGRAM_COUNTER; + cpu_reg.inst = BCE_RXP_CPU_INSTRUCTION; + cpu_reg.bp = BCE_RXP_CPU_HW_BREAKPOINT; + cpu_reg.spad_base = BCE_RXP_SCRATCH; + cpu_reg.mips_view_base = 0x8000000; + + DBPRINT(sc, BCE_INFO_RESET, "Starting RX firmware.\n"); + bce_start_cpu(sc, &cpu_reg); + + DBEXIT(BCE_VERBOSE_RESET); +} + + +/****************************************************************************/ /* Initialize the RX CPU. */ /* */ /* Returns: */ @@ -3833,6 +3908,8 @@ bce_init_rxp_cpu(struct bce_softc *sc) DBPRINT(sc, BCE_INFO_RESET, "Loading RX firmware.\n"); bce_load_cpu_fw(sc, &cpu_reg, &fw); + /* Delay RXP start until initialization is complete. */ + DBEXIT(BCE_VERBOSE_RESET); } @@ -3929,6 +4006,7 @@ bce_init_txp_cpu(struct bce_softc *sc) DBPRINT(sc, BCE_INFO_RESET, "Loading TX firmware.\n"); bce_load_cpu_fw(sc, &cpu_reg, &fw); + bce_start_cpu(sc, &cpu_reg); DBEXIT(BCE_VERBOSE_RESET); } @@ -4026,6 +4104,7 @@ bce_init_tpat_cpu(struct bce_softc *sc) DBPRINT(sc, BCE_INFO_RESET, "Loading TPAT firmware.\n"); bce_load_cpu_fw(sc, &cpu_reg, &fw); + bce_start_cpu(sc, &cpu_reg); DBEXIT(BCE_VERBOSE_RESET); } @@ -4123,6 +4202,7 @@ bce_init_cp_cpu(struct bce_softc *sc) DBPRINT(sc, BCE_INFO_RESET, "Loading CP firmware.\n"); bce_load_cpu_fw(sc, &cpu_reg, &fw); + bce_start_cpu(sc, &cpu_reg); DBEXIT(BCE_VERBOSE_RESET); } @@ -4220,6 +4300,7 @@ bce_init_com_cpu(struct bce_softc *sc) DBPRINT(sc, BCE_INFO_RESET, "Loading COM firmware.\n"); bce_load_cpu_fw(sc, &cpu_reg, &fw); + bce_start_cpu(sc, &cpu_reg); DBEXIT(BCE_VERBOSE_RESET); } @@ -4665,6 +4746,12 @@ bce_chipinit(struct bce_softc *sc) /* Initialize the on-boards CPUs */ bce_init_cpus(sc); + /* Enable management frames (NC-SI) to flow to the MCP. */ + if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { + val = REG_RD(sc, BCE_RPM_MGMT_PKT_CTRL) | BCE_RPM_MGMT_PKT_CTRL_MGMT_EN; + REG_WR(sc, BCE_RPM_MGMT_PKT_CTRL, val); + } + /* Prepare NVRAM for access. */ if (bce_init_nvram(sc)) { rc = ENODEV; @@ -4845,6 +4932,15 @@ bce_blockinit(struct bce_softc *sc) /* Enable link state change interrupt generation. */ REG_WR(sc, BCE_HC_ATTN_BITS_ENABLE, STATUS_ATTN_BITS_LINK_STATE); + /* Enable the RXP. */ + bce_start_rxp_cpu(sc); + + /* Disable management frames (NC-SI) from flowing to the MCP. */ + if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { + val = REG_RD(sc, BCE_RPM_MGMT_PKT_CTRL) & ~BCE_RPM_MGMT_PKT_CTRL_MGMT_EN; + REG_WR(sc, BCE_RPM_MGMT_PKT_CTRL, val); + } + /* Enable all remaining blocks in the MAC. */ if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) || (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) @@ -5851,22 +5947,29 @@ bce_rx_intr(struct bce_softc *sc) DBRUN(sc->debug_rx_mbuf_alloc--); sc->free_rx_bd++; - /* - * Frames received on the NetXteme II are prepended with an - * l2_fhdr structure which provides status information about - * the received frame (including VLAN tags and checksum info). - * The frames are also automatically adjusted to align the IP - * header (i.e. two null bytes are inserted before the Ethernet - * header). As a result the data DMA'd by the controller into - * the mbuf is as follows: - * - * +---------+-----+---------------------+-----+ - * | l2_fhdr | pad | packet data | FCS | - * +---------+-----+---------------------+-----+ - * - * The l2_fhdr needs to be checked and skipped and the FCS needs - * to be stripped before sending the packet up the stack. - */ + if(m0 == NULL) { + DBPRINT(sc, BCE_EXTREME_RECV, "%s(): Oops! Empty mbuf pointer " + "found in sc->rx_mbuf_ptr[0x%04X]!\n", + __FUNCTION__, sw_rx_cons_idx); + goto bce_rx_int_next_rx; + } + + /* + * Frames received on the NetXteme II are prepended with an + * l2_fhdr structure which provides status information about + * the received frame (including VLAN tags and checksum info). + * The frames are also automatically adjusted to align the IP + * header (i.e. two null bytes are inserted before the Ethernet + * header). As a result the data DMA'd by the controller into + * the mbuf is as follows: + * + * +---------+-----+---------------------+-----+ + * | l2_fhdr | pad | packet data | FCS | + * +---------+-----+---------------------+-----+ + * + * The l2_fhdr needs to be checked and skipped and the FCS needs + * to be stripped before sending the packet up the stack. + */ l2fhdr = mtod(m0, struct l2_fhdr *); /* Get the packet data + FCS length and the status. */ @@ -6387,6 +6490,7 @@ bce_init_locked(struct bce_softc *sc) bce_ifmedia_upd_locked(ifp); + /* Let the OS know the driver is up and running. */ ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -10038,9 +10142,9 @@ bce_dump_bc_state(struct bce_softc *sc) BCE_PRINTF("0x%08X - (0x%06X) state\n", val, BCE_BC_STATE); - val = bce_shmem_rd(sc, BCE_BC_CONDITION); + val = bce_shmem_rd(sc, BCE_BC_STATE_CONDITION); BCE_PRINTF("0x%08X - (0x%06X) condition\n", - val, BCE_BC_CONDITION); + val, BCE_BC_STATE_CONDITION); val = bce_shmem_rd(sc, BCE_BC_STATE_DEBUG_CMD); BCE_PRINTF("0x%08X - (0x%06X) debug_cmd\n", Modified: stable/7/sys/dev/bce/if_bcereg.h ============================================================================== --- stable/7/sys/dev/bce/if_bcereg.h Fri Mar 19 00:26:45 2010 (r205303) +++ stable/7/sys/dev/bce/if_bcereg.h Fri Mar 19 00:29:52 2010 (r205304) @@ -3712,6 +3712,10 @@ struct l2_fhdr { #define BCE_RPM_CONFIG_SORT_VECT_VAL (0xfL<<4) #define BCE_RPM_CONFIG_IGNORE_VLAN (1L<<31) +#define BCE_RPM_MGMT_PKT_CTRL 0x0000180c +#define BCE_RPM_MGMT_PKT_CTRL_MGMT_DISCARD_EN (1L<<30) +#define BCE_RPM_MGMT_PKT_CTRL_MGMT_EN (1L<<31) + #define BCE_RPM_VLAN_MATCH0 0x00001810 #define BCE_RPM_VLAN_MATCH0_RPM_VLAN_MTCH0_VALUE (0xfffL<<0) From owner-svn-src-stable@FreeBSD.ORG Fri Mar 19 10:26:00 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16963106564A; Fri, 19 Mar 2010 10:26:00 +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 DE9DC8FC13; Fri, 19 Mar 2010 10:25:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2JAPxw3019440; Fri, 19 Mar 2010 10:25:59 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2JAPxN6019438; Fri, 19 Mar 2010 10:25:59 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201003191025.o2JAPxN6019438@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 19 Mar 2010 10:25:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205313 - stable/8/bin/ps X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2010 10:26:00 -0000 Author: kib Date: Fri Mar 19 10:25:59 2010 New Revision: 205313 URL: http://svn.freebsd.org/changeset/base/205313 Log: MFC r204755: Update the list of the process flags. Note that the lists of pending signals for process and its threads are distinct. Modified: stable/8/bin/ps/ps.1 Directory Properties: stable/8/bin/ps/ (props changed) Modified: stable/8/bin/ps/ps.1 ============================================================================== --- stable/8/bin/ps/ps.1 Fri Mar 19 09:53:25 2010 (r205312) +++ stable/8/bin/ps/ps.1 Fri Mar 19 10:25:59 2010 (r205313) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd July 9, 2009 +.Dd March 5, 2010 .Dt PS 1 .Os .Sh NAME @@ -284,11 +284,10 @@ The percentage of real memory used by th The flags associated with the process as in the include file .In sys/proc.h : -.Bl -column P_STOPPED_SINGLE 0x4000000 +.Bl -column P_SINGLE_BOUNDARY 0x40000000 .It Dv "P_ADVLOCK" Ta No "0x00001 Process may hold a POSIX advisory lock" .It Dv "P_CONTROLT" Ta No "0x00002 Has a controlling terminal" .It Dv "P_KTHREAD" Ta No "0x00004 Kernel thread" -.It Dv "P_NOLOAD" Ta No "0x00008 Ignore during load avg calculations" .It Dv "P_PPWAIT" Ta No "0x00010 Parent is waiting for child to exec/exit" .It Dv "P_PROFIL" Ta No "0x00020 Has started profiling" .It Dv "P_STOPPROF" Ta No "0x00040 Has thread in requesting to stop prof" @@ -305,8 +304,14 @@ the include file .It Dv "P_STOPPED_SINGLE" Ta No "0x80000 Only one thread can continue" .It Dv "P_PROTECTED" Ta No "0x100000 Do not kill on memory overcommit" .It Dv "P_SIGEVENT" Ta No "0x200000 Process pending signals changed" +.It Dv "P_SINGLE_BOUNDARY" Ta No "0x400000 Threads should suspend at user boundary" +.It Dv "P_HWPMC" Ta No "0x800000 Process is using HWPMCs" .It Dv "P_JAILED" Ta No "0x1000000 Process is in jail" .It Dv "P_INEXEC" Ta No "0x4000000 Process is in execve()" +.It Dv "P_STATCHILD" Ta No "0x8000000 Child process stopped or exited" +.It Dv "P_INMEM" Ta No "0x10000000 Loaded into memory" +.It Dv "P_SWAPPINGOUT" Ta No "0x20000000 Process is being swapped out" +.It Dv "P_SWAPPINGIN" Ta No "0x40000000 Process is being swapped in" .El .It Cm label The MAC label of the process. @@ -615,6 +620,13 @@ wait channel (as a symbolic name) .It Cm xstat exit or stop status (valid only for stopped or zombie process) .El +.Pp +Note that the +.Cm pending +column displays bitmask of signals pending in the process queue when +.Fl H +option is not specified, otherwise the per-thread queue of pending signals +is shown. .Sh ENVIRONMENT The following environment variables affect the execution of .Nm : From owner-svn-src-stable@FreeBSD.ORG Fri Mar 19 10:28:49 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6234B106564A; Fri, 19 Mar 2010 10:28:49 +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 5082D8FC17; Fri, 19 Mar 2010 10:28:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2JASnnj020115; Fri, 19 Mar 2010 10:28:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2JASnBf020113; Fri, 19 Mar 2010 10:28:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201003191028.o2JASnBf020113@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 19 Mar 2010 10:28:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205314 - stable/8/tools/regression/aio/aiotest X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2010 10:28:49 -0000 Author: kib Date: Fri Mar 19 10:28:49 2010 New Revision: 205314 URL: http://svn.freebsd.org/changeset/base/205314 Log: MFC r205224: Add missing headers. Modified: stable/8/tools/regression/aio/aiotest/aiotest.c Directory Properties: stable/8/tools/regression/aio/aiotest/ (props changed) Modified: stable/8/tools/regression/aio/aiotest/aiotest.c ============================================================================== --- stable/8/tools/regression/aio/aiotest/aiotest.c Fri Mar 19 10:25:59 2010 (r205313) +++ stable/8/tools/regression/aio/aiotest/aiotest.c Fri Mar 19 10:28:49 2010 (r205314) @@ -40,14 +40,17 @@ #include #include +#include #include #include #include #include #include +#include #include #include +#include #include #include #include From owner-svn-src-stable@FreeBSD.ORG Fri Mar 19 10:33:46 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E90151065672; Fri, 19 Mar 2010 10:33:45 +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 D67B78FC0C; Fri, 19 Mar 2010 10:33:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2JAXjWe021275; Fri, 19 Mar 2010 10:33:45 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2JAXjrm021269; Fri, 19 Mar 2010 10:33:45 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201003191033.o2JAXjrm021269@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 19 Mar 2010 10:33:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205315 - in stable/8/tools/regression/mqueue: mqtest1 mqtest2 mqtest3 mqtest4 mqtest5 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2010 10:33:46 -0000 Author: kib Date: Fri Mar 19 10:33:45 2010 New Revision: 205315 URL: http://svn.freebsd.org/changeset/base/205315 Log: MFC r205225: Add missing headers. While there, arrange headers alphabetically. Modified: stable/8/tools/regression/mqueue/mqtest1/mqtest1.c stable/8/tools/regression/mqueue/mqtest2/mqtest2.c stable/8/tools/regression/mqueue/mqtest3/mqtest3.c stable/8/tools/regression/mqueue/mqtest4/mqtest4.c stable/8/tools/regression/mqueue/mqtest5/mqtest5.c Directory Properties: stable/8/tools/regression/mqueue/mqtest1/ (props changed) stable/8/tools/regression/mqueue/mqtest2/ (props changed) stable/8/tools/regression/mqueue/mqtest3/ (props changed) stable/8/tools/regression/mqueue/mqtest4/ (props changed) stable/8/tools/regression/mqueue/mqtest5/ (props changed) Modified: stable/8/tools/regression/mqueue/mqtest1/mqtest1.c ============================================================================== --- stable/8/tools/regression/mqueue/mqtest1/mqtest1.c Fri Mar 19 10:28:49 2010 (r205314) +++ stable/8/tools/regression/mqueue/mqtest1/mqtest1.c Fri Mar 19 10:33:45 2010 (r205315) @@ -1,10 +1,11 @@ /* $FreeBSD$ */ -#include -#include +#include +#include #include +#include #include -#include +#include #define MQNAME "/mytstqueue1" Modified: stable/8/tools/regression/mqueue/mqtest2/mqtest2.c ============================================================================== --- stable/8/tools/regression/mqueue/mqtest2/mqtest2.c Fri Mar 19 10:28:49 2010 (r205314) +++ stable/8/tools/regression/mqueue/mqtest2/mqtest2.c Fri Mar 19 10:33:45 2010 (r205315) @@ -1,8 +1,13 @@ /* $FreeBSD$ */ -#include -#include + +#include +#include +#include #include +#include #include +#include +#include #include #define MQNAME "/mytstqueue2" Modified: stable/8/tools/regression/mqueue/mqtest3/mqtest3.c ============================================================================== --- stable/8/tools/regression/mqueue/mqtest3/mqtest3.c Fri Mar 19 10:28:49 2010 (r205314) +++ stable/8/tools/regression/mqueue/mqtest3/mqtest3.c Fri Mar 19 10:33:45 2010 (r205315) @@ -1,10 +1,15 @@ /* $FreeBSD$ */ -#include -#include + +#include +#include +#include +#include #include +#include #include +#include +#include #include -#include #define MQNAME "/mytstqueue3" #define LOOPS 1000 Modified: stable/8/tools/regression/mqueue/mqtest4/mqtest4.c ============================================================================== --- stable/8/tools/regression/mqueue/mqtest4/mqtest4.c Fri Mar 19 10:28:49 2010 (r205314) +++ stable/8/tools/regression/mqueue/mqtest4/mqtest4.c Fri Mar 19 10:33:45 2010 (r205315) @@ -1,11 +1,16 @@ /* $FreeBSD$ */ -#include -#include + +#include +#include +#include +#include +#include #include +#include #include +#include +#include #include -#include -#include #define MQNAME "/mytstqueue4" #define LOOPS 1000 Modified: stable/8/tools/regression/mqueue/mqtest5/mqtest5.c ============================================================================== --- stable/8/tools/regression/mqueue/mqtest5/mqtest5.c Fri Mar 19 10:28:49 2010 (r205314) +++ stable/8/tools/regression/mqueue/mqtest5/mqtest5.c Fri Mar 19 10:33:45 2010 (r205315) @@ -1,12 +1,16 @@ /* $FreeBSD$ */ -#include -#include + +#include +#include +#include +#include +#include #include +#include #include +#include +#include #include -#include -#include -#include #define MQNAME "/mytstqueue5" #define LOOPS 1000 From owner-svn-src-stable@FreeBSD.ORG Fri Mar 19 12:04:57 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A713106564A; Fri, 19 Mar 2010 12:04:57 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 387888FC3E; Fri, 19 Mar 2010 12:04:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2JC4u08041968; Fri, 19 Mar 2010 12:04:56 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2JC4uIx041966; Fri, 19 Mar 2010 12:04:56 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201003191204.o2JC4uIx041966@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 19 Mar 2010 12:04: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: r205330 - stable/7/lib/libc/stdio X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2010 12:04:57 -0000 Author: jh Date: Fri Mar 19 12:04:56 2010 New Revision: 205330 URL: http://svn.freebsd.org/changeset/base/205330 Log: MFC r204447: In _gettemp(), check that the length of the path doesn't exceed MAXPATHLEN. Otherwise the path name (or part of it) may not fit to carrybuf causing a buffer overflow. PR: bin/140228 Modified: stable/7/lib/libc/stdio/mktemp.c Directory Properties: stable/7/lib/libc/ (props changed) stable/7/lib/libc/stdtime/ (props changed) Modified: stable/7/lib/libc/stdio/mktemp.c ============================================================================== --- stable/7/lib/libc/stdio/mktemp.c Fri Mar 19 11:59:02 2010 (r205329) +++ stable/7/lib/libc/stdio/mktemp.c Fri Mar 19 12:04:56 2010 (r205330) @@ -116,6 +116,10 @@ _gettemp(path, doopen, domkdir, slen) for (trv = path; *trv != '\0'; ++trv) ; + if (trv - path >= MAXPATHLEN) { + errno = ENAMETOOLONG; + return (0); + } trv -= slen; suffp = trv; --trv; From owner-svn-src-stable@FreeBSD.ORG Fri Mar 19 12:07:29 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1648B106567E; Fri, 19 Mar 2010 12:07:29 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 048998FC0A; Fri, 19 Mar 2010 12:07:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2JC7SOr042582; Fri, 19 Mar 2010 12:07:28 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2JC7SUI042580; Fri, 19 Mar 2010 12:07:28 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201003191207.o2JC7SUI042580@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 19 Mar 2010 12:07:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205331 - stable/6/lib/libc/stdio X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2010 12:07:29 -0000 Author: jh Date: Fri Mar 19 12:07:28 2010 New Revision: 205331 URL: http://svn.freebsd.org/changeset/base/205331 Log: MFC r204447: In _gettemp(), check that the length of the path doesn't exceed MAXPATHLEN. Otherwise the path name (or part of it) may not fit to carrybuf causing a buffer overflow. PR: bin/140228 Modified: stable/6/lib/libc/stdio/mktemp.c Directory Properties: stable/6/lib/libc/ (props changed) Modified: stable/6/lib/libc/stdio/mktemp.c ============================================================================== --- stable/6/lib/libc/stdio/mktemp.c Fri Mar 19 12:04:56 2010 (r205330) +++ stable/6/lib/libc/stdio/mktemp.c Fri Mar 19 12:07:28 2010 (r205331) @@ -120,6 +120,10 @@ _gettemp(path, doopen, domkdir, slen) for (trv = path; *trv != '\0'; ++trv) ; + if (trv - path >= MAXPATHLEN) { + errno = ENAMETOOLONG; + return (0); + } trv -= slen; suffp = trv; --trv; From owner-svn-src-stable@FreeBSD.ORG Fri Mar 19 22:39:27 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB909106566B; Fri, 19 Mar 2010 22:39:27 +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 C8B2F8FC0A; Fri, 19 Mar 2010 22:39:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2JMdRsU085364; Fri, 19 Mar 2010 22:39:27 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2JMdRQs085360; Fri, 19 Mar 2010 22:39:27 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201003192239.o2JMdRQs085360@svn.freebsd.org> From: Attilio Rao Date: Fri, 19 Mar 2010 22:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205349 - stable/6/sys/vm X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2010 22:39:28 -0000 Author: attilio Date: Fri Mar 19 22:39:27 2010 New Revision: 205349 URL: http://svn.freebsd.org/changeset/base/205349 Log: MFC 181019, 183474, 191277, and 191626: - Move the code for doing out-of-memory grass from vm_pageout_scan() into the separate function vm_pageout_oom(). Supply a parameter for vm_pageout_oom() describing a reason for the call. - Call vm_pageout_oom() from the swp_pager_meta_build() when swap zone is exhausted. - In both pageout oom handler and vm_daemon, acquire the reference to the vmspace of the examined process instead of directly accessing its vmspace, that may change. Also, as an optimization, check for P_INEXEC flag before examining the process. Sponsored by: Sandvine Incorporated Reviewed by: emaste Modified: stable/6/sys/vm/swap_pager.c stable/6/sys/vm/vm_pageout.c stable/6/sys/vm/vm_pageout.h Directory Properties: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/vm/swap_pager.c ============================================================================== --- stable/6/sys/vm/swap_pager.c Fri Mar 19 21:29:30 2010 (r205348) +++ stable/6/sys/vm/swap_pager.c Fri Mar 19 22:39:27 2010 (r205349) @@ -1680,7 +1680,7 @@ swp_pager_meta_build(vm_object_t object, { struct swblock *swap; struct swblock **pswap; - int idx; + int dummy, idx; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); /* @@ -1720,9 +1720,12 @@ retry: if (swap == NULL) { mtx_unlock(&swhash_mtx); VM_OBJECT_UNLOCK(object); - if (uma_zone_exhausted(swap_zone)) + if (uma_zone_exhausted(swap_zone)) { printf("swap zone exhausted, increase kern.maxswzone\n"); - VM_WAIT; + vm_pageout_oom(VM_OOM_SWAPZ); + tsleep(&dummy, PVM, "swzonex", 10); + } else + VM_WAIT; VM_OBJECT_LOCK(object); goto retry; } Modified: stable/6/sys/vm/vm_pageout.c ============================================================================== --- stable/6/sys/vm/vm_pageout.c Fri Mar 19 21:29:30 2010 (r205348) +++ stable/6/sys/vm/vm_pageout.c Fri Mar 19 22:39:27 2010 (r205349) @@ -711,9 +711,6 @@ vm_pageout_scan(int pass) struct vm_page marker; int page_shortage, maxscan, pcount; int addl_page_shortage, addl_page_shortage_init; - struct proc *p, *bigproc; - struct thread *td; - vm_offset_t size, bigsize; vm_object_t object; int actcount, cache_cur, cache_first_failure; static int cache_last_free; @@ -1246,7 +1243,23 @@ unlock_and_continue: * doing this on the first pass in order to give ourselves a * chance to flush out dirty vnode-backed pages and to allow * active pages to be moved to the inactive queue and reclaimed. - * + */ + if (pass != 0 && + ((swap_pager_avail < 64 && vm_page_count_min()) || + (swap_pager_full && vm_paging_target() > 0))) + vm_pageout_oom(VM_OOM_MEM); +} + + +void +vm_pageout_oom(int shortage) +{ + struct proc *p, *bigproc; + vm_offset_t size, bigsize; + struct thread *td; + struct vmspace *vm; + + /* * We keep the process bigproc locked once we find it to keep anyone * from messing with it; however, there is a possibility of * deadlock if process B is bigproc and one of it's child processes @@ -1254,77 +1267,81 @@ unlock_and_continue: * lock while walking this list. To avoid this, we don't block on * the process lock but just skip a process if it is already locked. */ - if (pass != 0 && - ((swap_pager_avail < 64 && vm_page_count_min()) || - (swap_pager_full && vm_paging_target() > 0))) { - bigproc = NULL; - bigsize = 0; - sx_slock(&allproc_lock); - FOREACH_PROC_IN_SYSTEM(p) { - int breakout; + bigproc = NULL; + bigsize = 0; + sx_slock(&allproc_lock); + FOREACH_PROC_IN_SYSTEM(p) { + int breakout; - if (PROC_TRYLOCK(p) == 0) - continue; - /* - * If this is a system or protected process, skip it. - */ - if ((p->p_flag & P_SYSTEM) || (p->p_pid == 1) || - (p->p_flag & P_PROTECTED) || - ((p->p_pid < 48) && (swap_pager_avail != 0))) { - PROC_UNLOCK(p); - continue; - } - /* - * If the process is in a non-running type state, - * don't touch it. Check all the threads individually. - */ - mtx_lock_spin(&sched_lock); - breakout = 0; - FOREACH_THREAD_IN_PROC(p, td) { - if (!TD_ON_RUNQ(td) && - !TD_IS_RUNNING(td) && - !TD_IS_SLEEPING(td)) { - breakout = 1; - break; - } - } - if (breakout) { - mtx_unlock_spin(&sched_lock); - PROC_UNLOCK(p); - continue; - } - mtx_unlock_spin(&sched_lock); - /* - * get the process size - */ - if (!vm_map_trylock_read(&p->p_vmspace->vm_map)) { - PROC_UNLOCK(p); - continue; + if (PROC_TRYLOCK(p) == 0) + continue; + /* + * If this is a system or protected process, skip it. + */ + if ((p->p_flag & (P_INEXEC | P_PROTECTED | P_SYSTEM)) || + (p->p_pid == 1) || + ((p->p_pid < 48) && (swap_pager_avail != 0))) { + PROC_UNLOCK(p); + continue; + } + /* + * If the process is in a non-running type state, + * don't touch it. Check all the threads individually. + */ + mtx_lock_spin(&sched_lock); + breakout = 0; + FOREACH_THREAD_IN_PROC(p, td) { + if (!TD_ON_RUNQ(td) && + !TD_IS_RUNNING(td) && + !TD_IS_SLEEPING(td)) { + breakout = 1; + break; } - size = vmspace_swap_count(p->p_vmspace); - vm_map_unlock_read(&p->p_vmspace->vm_map); - size += vmspace_resident_count(p->p_vmspace); - /* - * if the this process is bigger than the biggest one - * remember it. - */ - if (size > bigsize) { - if (bigproc != NULL) - PROC_UNLOCK(bigproc); - bigproc = p; - bigsize = size; - } else - PROC_UNLOCK(p); } - sx_sunlock(&allproc_lock); - if (bigproc != NULL) { - killproc(bigproc, "out of swap space"); - mtx_lock_spin(&sched_lock); - sched_nice(bigproc, PRIO_MIN); + if (breakout) { mtx_unlock_spin(&sched_lock); - PROC_UNLOCK(bigproc); - wakeup(&cnt.v_free_count); + PROC_UNLOCK(p); + continue; + } + mtx_unlock_spin(&sched_lock); + /* + * get the process size + */ + vm = vmspace_acquire_ref(p); + if (vm == NULL) { + PROC_UNLOCK(p); + continue; } + if (!vm_map_trylock_read(&vm->vm_map)) { + vmspace_free(vm); + PROC_UNLOCK(p); + continue; + } + size = vmspace_swap_count(vm); + vm_map_unlock_read(&vm->vm_map); + if (shortage == VM_OOM_MEM) + size += vmspace_resident_count(vm); + vmspace_free(vm); + /* + * if the this process is bigger than the biggest one + * remember it. + */ + if (size > bigsize) { + if (bigproc != NULL) + PROC_UNLOCK(bigproc); + bigproc = p; + bigsize = size; + } else + PROC_UNLOCK(p); + } + sx_sunlock(&allproc_lock); + if (bigproc != NULL) { + killproc(bigproc, "out of swap space"); + mtx_lock_spin(&sched_lock); + sched_nice(bigproc, PRIO_MIN); + mtx_unlock_spin(&sched_lock); + PROC_UNLOCK(bigproc); + wakeup(&cnt.v_free_count); } } @@ -1595,6 +1612,7 @@ vm_daemon() struct rlimit rsslim; struct proc *p; struct thread *td; + struct vmspace *vm; int breakout, swapout_flags; while (TRUE) { @@ -1619,7 +1637,7 @@ vm_daemon() * looked at this process, skip it. */ PROC_LOCK(p); - if (p->p_flag & (P_SYSTEM | P_WEXIT)) { + if (p->p_flag & (P_INEXEC | P_SYSTEM | P_WEXIT)) { PROC_UNLOCK(p); continue; } @@ -1656,13 +1674,17 @@ vm_daemon() */ if ((p->p_sflag & PS_INMEM) == 0) limit = 0; /* XXX */ + vm = vmspace_acquire_ref(p); PROC_UNLOCK(p); + if (vm == NULL) + continue; - size = vmspace_resident_count(p->p_vmspace); + size = vmspace_resident_count(vm); if (limit >= 0 && size >= limit) { vm_pageout_map_deactivate_pages( - &p->p_vmspace->vm_map, limit); + &vm->vm_map, limit); } + vmspace_free(vm); } sx_sunlock(&allproc_lock); } Modified: stable/6/sys/vm/vm_pageout.h ============================================================================== --- stable/6/sys/vm/vm_pageout.h Fri Mar 19 21:29:30 2010 (r205348) +++ stable/6/sys/vm/vm_pageout.h Fri Mar 19 22:39:27 2010 (r205349) @@ -83,6 +83,9 @@ extern int vm_pageout_page_count; #define VM_SWAP_NORMAL 1 #define VM_SWAP_IDLE 2 +#define VM_OOM_MEM 1 +#define VM_OOM_SWAPZ 2 + /* * Exported routines. */ @@ -99,5 +102,6 @@ extern void vm_waitpfault(void); #ifdef _KERNEL int vm_pageout_flush(vm_page_t *, int, int); +void vm_pageout_oom(int shortage); #endif #endif /* _VM_VM_PAGEOUT_H_ */ From owner-svn-src-stable@FreeBSD.ORG Sat Mar 20 14:49:44 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE83C106566B; Sat, 20 Mar 2010 14:49:44 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9C6C8FC16; Sat, 20 Mar 2010 14:49:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2KEni1Y003259; Sat, 20 Mar 2010 14:49:44 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2KEnip8003255; Sat, 20 Mar 2010 14:49:44 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201003201449.o2KEnip8003255@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 20 Mar 2010 14:49:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205373 - in stable/8: share/man/man4/man4.powerpc sys/powerpc/powermac X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2010 14:49:44 -0000 Author: nwhitehorn Date: Sat Mar 20 14:49:44 2010 New Revision: 205373 URL: http://svn.freebsd.org/changeset/base/205373 Log: MFC r204082,204179,204180,204218,204241,204247,204270,204692: Provide thermal management and monitoring features in smu(4). This allows fan control and thermal monitoring on SMU-based Apple G5 machines, as well as an led(4) interface to control the sleep LED. Added: stable/8/share/man/man4/man4.powerpc/smu.4 - copied, changed from r204241, head/share/man/man4/man4.powerpc/smu.4 Modified: stable/8/share/man/man4/man4.powerpc/Makefile stable/8/sys/powerpc/powermac/smu.c Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/share/man/man4/man4.powerpc/Makefile ============================================================================== --- stable/8/share/man/man4/man4.powerpc/Makefile Sat Mar 20 14:42:16 2010 (r205372) +++ stable/8/share/man/man4/man4.powerpc/Makefile Sat Mar 20 14:49:44 2010 (r205373) @@ -7,6 +7,7 @@ MAN= adb.4 \ cuda.4 \ pmu.4 \ powermac_nvram.4 \ + smu.4 \ snd_ai2s.4 \ snd_davbus.4 \ tsec.4 Copied and modified: stable/8/share/man/man4/man4.powerpc/smu.4 (from r204241, head/share/man/man4/man4.powerpc/smu.4) ============================================================================== --- head/share/man/man4/man4.powerpc/smu.4 Tue Feb 23 04:56:06 2010 (r204241, copy source) +++ stable/8/share/man/man4/man4.powerpc/smu.4 Sat Mar 20 14:49:44 2010 (r205373) @@ -41,7 +41,7 @@ kernel configuration file: .Sh DESCRIPTION The .Nm -driver provides support for the System Management Unit (PMU) found in many +driver provides support for the System Management Unit (SMU) found in many Apple G5 systems. This includes most Power Macintosh G5 and all iMac G5 systems. .Pp @@ -75,6 +75,9 @@ The following sysctls can be used to con power management behavior and to examine current system power and thermal conditions. .Bl -tag -width indent +.It Va dev.smu.%d.server_mode +Restart after power failure behavior (1 causes system to reboot after power +cut, 0 causes system to remain off). .It Va dev.smu.%d.target_temp Target system temperature, in degrees Celsius. The .Nm @@ -112,7 +115,7 @@ annunciator interface at The .Nm device driver appeared in -.Fx 9.0 . +.Fx 8.0 . .Sh AUTHORS .An -nosplit The Modified: stable/8/sys/powerpc/powermac/smu.c ============================================================================== --- stable/8/sys/powerpc/powermac/smu.c Sat Mar 20 14:42:16 2010 (r205372) +++ stable/8/sys/powerpc/powermac/smu.c Sat Mar 20 14:49:44 2010 (r205373) @@ -34,21 +34,53 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include +#include #include #include +#include #include +#include #include +#include #include #include #include struct smu_cmd { - uint8_t cmd; + volatile uint8_t cmd; uint8_t len; uint8_t data[254]; + + STAILQ_ENTRY(smu_cmd) cmd_q; +}; + +STAILQ_HEAD(smu_cmdq, smu_cmd); + +struct smu_fan { + cell_t reg; + cell_t min_rpm; + cell_t max_rpm; + cell_t unmanaged_rpm; + char location[32]; + + int old_style; + int setpoint; +}; + +struct smu_sensor { + cell_t reg; + char location[32]; + enum { + SMU_CURRENT_SENSOR, + SMU_VOLTAGE_SENSOR, + SMU_POWER_SENSOR, + SMU_TEMP_SENSOR + } type; }; struct smu_softc { @@ -62,9 +94,40 @@ struct smu_softc { bus_space_tag_t sc_bt; bus_space_handle_t sc_mailbox; - struct smu_cmd *sc_cmd; + struct smu_cmd *sc_cmd, *sc_cur_cmd; bus_addr_t sc_cmd_phys; bus_dmamap_t sc_cmd_dmamap; + struct smu_cmdq sc_cmdq; + + struct smu_fan *sc_fans; + int sc_nfans; + struct smu_sensor *sc_sensors; + int sc_nsensors; + + int sc_doorbellirqid; + struct resource *sc_doorbellirq; + void *sc_doorbellirqcookie; + + struct proc *sc_fanmgt_proc; + time_t sc_lastuserchange; + + /* Calibration data */ + uint16_t sc_cpu_diode_scale; + int16_t sc_cpu_diode_offset; + + uint16_t sc_cpu_volt_scale; + int16_t sc_cpu_volt_offset; + uint16_t sc_cpu_curr_scale; + int16_t sc_cpu_curr_offset; + + uint16_t sc_slots_pow_scale; + int16_t sc_slots_pow_offset; + + /* Thermal management parameters */ + int sc_target_temp; /* Default 55 C */ + int sc_critical_temp; /* Default 90 C */ + + struct cdev *sc_leddev; }; /* regular bus attachment functions */ @@ -77,6 +140,18 @@ static int smu_attach(device_t); static void smu_cpufreq_pre_change(device_t, const struct cf_level *level); static void smu_cpufreq_post_change(device_t, const struct cf_level *level); +/* utility functions */ +static int smu_run_cmd(device_t dev, struct smu_cmd *cmd, int wait); +static int smu_get_datablock(device_t dev, int8_t id, uint8_t *buf, + size_t len); +static void smu_attach_fans(device_t dev, phandle_t fanroot); +static void smu_attach_sensors(device_t dev, phandle_t sensroot); +static void smu_fan_management_proc(void *xdev); +static void smu_manage_fans(device_t smu); +static void smu_set_sleepled(void *xdev, int onoff); +static int smu_server_mode(SYSCTL_HANDLER_ARGS); +static void smu_doorbell_intr(void *xdev); + /* where to find the doorbell GPIO */ static device_t smu_doorbell = NULL; @@ -97,11 +172,43 @@ static driver_t smu_driver = { static devclass_t smu_devclass; DRIVER_MODULE(smu, nexus, smu_driver, smu_devclass, 0, 0); +MALLOC_DEFINE(M_SMU, "smu", "SMU Sensor Information"); -#define SMU_MAILBOX 0x860c +#define SMU_MAILBOX 0x8000860c +#define SMU_FANMGT_INTERVAL 1000 /* ms */ /* Command types */ -#define SMU_POWER 0xaa +#define SMU_ADC 0xd8 +#define SMU_FAN 0x4a +#define SMU_I2C 0x9a +#define SMU_I2C_SIMPLE 0x00 +#define SMU_I2C_NORMAL 0x01 +#define SMU_I2C_COMBINED 0x02 +#define SMU_MISC 0xee +#define SMU_MISC_GET_DATA 0x02 +#define SMU_MISC_LED_CTRL 0x04 +#define SMU_POWER 0xaa +#define SMU_POWER_EVENTS 0x8f +#define SMU_PWR_GET_POWERUP 0x00 +#define SMU_PWR_SET_POWERUP 0x01 +#define SMU_PWR_CLR_POWERUP 0x02 + +/* Power event types */ +#define SMU_WAKEUP_KEYPRESS 0x01 +#define SMU_WAKEUP_AC_INSERT 0x02 +#define SMU_WAKEUP_AC_CHANGE 0x04 +#define SMU_WAKEUP_RING 0x10 + +/* Data blocks */ +#define SMU_CPUTEMP_CAL 0x18 +#define SMU_CPUVOLT_CAL 0x21 +#define SMU_SLOTPW_CAL 0x78 + +/* Partitions */ +#define SMU_PARTITION 0x3e +#define SMU_PARTITION_LATEST 0x01 +#define SMU_PARTITION_BASE 0x02 +#define SMU_PARTITION_UPDATE 0x03 static int smu_probe(device_t dev) @@ -127,10 +234,14 @@ static int smu_attach(device_t dev) { struct smu_softc *sc; + phandle_t node, child; + uint8_t data[12]; sc = device_get_softc(dev); mtx_init(&sc->sc_mtx, "smu", NULL, MTX_DEF); + sc->sc_cur_cmd = NULL; + sc->sc_doorbellirqid = -1; /* * Map the mailbox area. This should be determined from firmware, @@ -139,7 +250,7 @@ smu_attach(device_t dev) bus_dma_tag_create(NULL, 16, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, PAGE_SIZE, 1, PAGE_SIZE, 0, NULL, NULL, &(sc->sc_dmatag)); - sc->sc_bt = &bs_be_tag; + sc->sc_bt = &bs_le_tag; bus_space_map(sc->sc_bt, SMU_MAILBOX, 4, 0, &sc->sc_mailbox); /* @@ -150,6 +261,7 @@ smu_attach(device_t dev) BUS_DMA_ZERO, &sc->sc_cmd_dmamap); bus_dmamap_load(sc->sc_dmatag, sc->sc_cmd_dmamap, sc->sc_cmd, PAGE_SIZE, smu_phys_callback, sc, 0); + STAILQ_INIT(&sc->sc_cmdq); /* * Set up handlers to change CPU voltage when CPU frequency is changed. @@ -159,51 +271,241 @@ smu_attach(device_t dev) EVENTHANDLER_REGISTER(cpufreq_post_change, smu_cpufreq_post_change, dev, EVENTHANDLER_PRI_ANY); + /* + * Detect and attach child devices. + */ + node = ofw_bus_get_node(dev); + for (child = OF_child(node); child != 0; child = OF_peer(child)) { + char name[32]; + memset(name, 0, sizeof(name)); + OF_getprop(child, "name", name, sizeof(name)); + + if (strncmp(name, "rpm-fans", 9) == 0 || + strncmp(name, "fans", 5) == 0) + smu_attach_fans(dev, child); + + if (strncmp(name, "sensors", 8) == 0) + smu_attach_sensors(dev, child); + } + + /* + * Collect calibration constants. + */ + smu_get_datablock(dev, SMU_CPUTEMP_CAL, data, sizeof(data)); + sc->sc_cpu_diode_scale = (data[4] << 8) + data[5]; + sc->sc_cpu_diode_offset = (data[6] << 8) + data[7]; + + smu_get_datablock(dev, SMU_CPUVOLT_CAL, data, sizeof(data)); + sc->sc_cpu_volt_scale = (data[4] << 8) + data[5]; + sc->sc_cpu_volt_offset = (data[6] << 8) + data[7]; + sc->sc_cpu_curr_scale = (data[8] << 8) + data[9]; + sc->sc_cpu_curr_offset = (data[10] << 8) + data[11]; + + smu_get_datablock(dev, SMU_SLOTPW_CAL, data, sizeof(data)); + sc->sc_slots_pow_scale = (data[4] << 8) + data[5]; + sc->sc_slots_pow_offset = (data[6] << 8) + data[7]; + + /* + * Set up simple-minded thermal management. + */ + sc->sc_target_temp = 55; + sc->sc_critical_temp = 90; + + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "target_temp", CTLTYPE_INT | CTLFLAG_RW, &sc->sc_target_temp, + sizeof(int), "Target temperature (C)"); + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "critical_temp", CTLTYPE_INT | CTLFLAG_RW, + &sc->sc_critical_temp, sizeof(int), "Critical temperature (C)"); + + kproc_create(smu_fan_management_proc, dev, &sc->sc_fanmgt_proc, + RFHIGHPID, 0, "smu_thermal"); + + /* + * Set up LED interface + */ + sc->sc_leddev = led_create(smu_set_sleepled, dev, "sleepled"); + + /* + * Reset on power loss behavior + */ + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "server_mode", CTLTYPE_INT | CTLFLAG_RW, dev, 0, + smu_server_mode, "I", "Enable reboot after power failure"); + + /* + * Set up doorbell interrupt. + */ + sc->sc_doorbellirqid = 0; + sc->sc_doorbellirq = bus_alloc_resource_any(smu_doorbell, SYS_RES_IRQ, + &sc->sc_doorbellirqid, RF_ACTIVE); + bus_setup_intr(smu_doorbell, sc->sc_doorbellirq, + INTR_TYPE_MISC | INTR_MPSAFE, NULL, smu_doorbell_intr, dev, + &sc->sc_doorbellirqcookie); + powerpc_config_intr(rman_get_start(sc->sc_doorbellirq), + INTR_TRIGGER_EDGE, INTR_POLARITY_LOW); + return (0); } -static int -smu_run_cmd(device_t dev, struct smu_cmd *cmd) +static void +smu_send_cmd(device_t dev, struct smu_cmd *cmd) { struct smu_softc *sc; - int doorbell_ack, result; sc = device_get_softc(dev); - mtx_lock(&sc->sc_mtx); + mtx_assert(&sc->sc_mtx, MA_OWNED); + + powerpc_pow_enabled = 0; /* SMU cannot work if we go to NAP */ + sc->sc_cur_cmd = cmd; /* Copy the command to the mailbox */ - memcpy(sc->sc_cmd, cmd, sizeof(*cmd)); + sc->sc_cmd->cmd = cmd->cmd; + sc->sc_cmd->len = cmd->len; + memcpy(sc->sc_cmd->data, cmd->data, sizeof(cmd->data)); bus_dmamap_sync(sc->sc_dmatag, sc->sc_cmd_dmamap, BUS_DMASYNC_PREWRITE); bus_space_write_4(sc->sc_bt, sc->sc_mailbox, 0, sc->sc_cmd_phys); - /* Invalidate the cacheline it is in -- SMU bypasses the cache */ - __asm __volatile("dcbst 0,%0; sync" :: "r"(sc->sc_cmd): "memory"); + /* Flush the cacheline it is in -- SMU bypasses the cache */ + __asm __volatile("sync; dcbf 0,%0; sync" :: "r"(sc->sc_cmd): "memory"); /* Ring SMU doorbell */ macgpio_write(smu_doorbell, GPIO_DDR_OUTPUT); +} - /* Wait for the doorbell GPIO to go high, signaling completion */ - do { - /* XXX: timeout */ - DELAY(50); - doorbell_ack = macgpio_read(smu_doorbell); - } while (!doorbell_ack); +static void +smu_doorbell_intr(void *xdev) +{ + device_t smu; + struct smu_softc *sc; + int doorbell_ack; + + smu = xdev; + doorbell_ack = macgpio_read(smu_doorbell); + sc = device_get_softc(smu); + + if (doorbell_ack != (GPIO_DDR_OUTPUT | GPIO_LEVEL_RO | GPIO_DATA)) + return; + + mtx_lock(&sc->sc_mtx); + + if (sc->sc_cur_cmd == NULL) /* spurious */ + goto done; /* Check result. First invalidate the cache again... */ __asm __volatile("dcbf 0,%0; sync" :: "r"(sc->sc_cmd) : "memory"); bus_dmamap_sync(sc->sc_dmatag, sc->sc_cmd_dmamap, BUS_DMASYNC_POSTREAD); + sc->sc_cur_cmd->cmd = sc->sc_cmd->cmd; + sc->sc_cur_cmd->len = sc->sc_cmd->len; + memcpy(sc->sc_cur_cmd->data, sc->sc_cmd->data, + sizeof(sc->sc_cmd->data)); + wakeup(sc->sc_cur_cmd); + sc->sc_cur_cmd = NULL; + powerpc_pow_enabled = 1; + + done: + /* Queue next command if one is pending */ + if (STAILQ_FIRST(&sc->sc_cmdq) != NULL) { + sc->sc_cur_cmd = STAILQ_FIRST(&sc->sc_cmdq); + STAILQ_REMOVE_HEAD(&sc->sc_cmdq, cmd_q); + smu_send_cmd(smu, sc->sc_cur_cmd); + } + + mtx_unlock(&sc->sc_mtx); +} + +static int +smu_run_cmd(device_t dev, struct smu_cmd *cmd, int wait) +{ + struct smu_softc *sc; + uint8_t cmd_code; + int error; + + sc = device_get_softc(dev); + cmd_code = cmd->cmd; + + mtx_lock(&sc->sc_mtx); + if (sc->sc_cur_cmd != NULL) { + STAILQ_INSERT_TAIL(&sc->sc_cmdq, cmd, cmd_q); + } else + smu_send_cmd(dev, cmd); + mtx_unlock(&sc->sc_mtx); + + if (!wait) + return (0); + + if (sc->sc_doorbellirqid < 0) { + /* Poll if the IRQ has not been set up yet */ + do { + DELAY(50); + smu_doorbell_intr(dev); + } while (sc->sc_cur_cmd != NULL); + } else { + /* smu_doorbell_intr will wake us when the command is ACK'ed */ + error = tsleep(cmd, 0, "smu", 800 * hz / 1000); + if (error != 0) + smu_doorbell_intr(dev); /* One last chance */ + + if (error != 0) { + mtx_lock(&sc->sc_mtx); + if (cmd->cmd == cmd_code) { /* Never processed */ + /* Abort this command if we timed out */ + if (sc->sc_cur_cmd == cmd) + sc->sc_cur_cmd = NULL; + else + STAILQ_REMOVE(&sc->sc_cmdq, cmd, smu_cmd, + cmd_q); + mtx_unlock(&sc->sc_mtx); + return (error); + } + error = 0; + mtx_unlock(&sc->sc_mtx); + } + } + /* SMU acks the command by inverting the command bits */ - if (sc->sc_cmd->cmd == ~cmd->cmd) - result = 0; + if (cmd->cmd == ((~cmd_code) & 0xff)) + error = 0; else - result = EIO; + error = EIO; - mtx_unlock(&sc->sc_mtx); + return (error); +} + +static int +smu_get_datablock(device_t dev, int8_t id, uint8_t *buf, size_t len) +{ + struct smu_cmd cmd; + uint8_t addr[4]; - return (result); + cmd.cmd = SMU_PARTITION; + cmd.len = 2; + cmd.data[0] = SMU_PARTITION_LATEST; + cmd.data[1] = id; + + smu_run_cmd(dev, &cmd, 1); + + addr[0] = addr[1] = 0; + addr[2] = cmd.data[0]; + addr[3] = cmd.data[1]; + + cmd.cmd = SMU_MISC; + cmd.len = 7; + cmd.data[0] = SMU_MISC_GET_DATA; + cmd.data[1] = sizeof(addr); + memcpy(&cmd.data[2], addr, sizeof(addr)); + cmd.data[6] = len; + + smu_run_cmd(dev, &cmd, 1); + memcpy(buf, cmd.data, len); + return (0); } static void @@ -222,7 +524,7 @@ smu_slew_cpu_voltage(device_t dev, int t cmd.data[6] = 1; cmd.data[7] = to; - smu_run_cmd(dev, &cmd); + smu_run_cmd(dev, &cmd, 1); } static void @@ -286,3 +588,458 @@ doorbell_attach(device_t dev) smu_doorbell = dev; return (0); } + +/* + * Sensor and fan management + */ + +static int +smu_fan_set_rpm(device_t smu, struct smu_fan *fan, int rpm) +{ + struct smu_cmd cmd; + int error; + + cmd.cmd = SMU_FAN; + error = EIO; + + /* Clamp to allowed range */ + rpm = max(fan->min_rpm, rpm); + rpm = min(fan->max_rpm, rpm); + + /* + * Apple has two fan control mechanisms. We can't distinguish + * them except by seeing if the new one fails. If the new one + * fails, use the old one. + */ + + if (!fan->old_style) { + cmd.len = 4; + cmd.data[0] = 0x30; + cmd.data[1] = fan->reg; + cmd.data[2] = (rpm >> 8) & 0xff; + cmd.data[3] = rpm & 0xff; + + error = smu_run_cmd(smu, &cmd, 1); + if (error) + fan->old_style = 1; + } + + if (fan->old_style) { + cmd.len = 14; + cmd.data[0] = 0; + cmd.data[1] = 1 << fan->reg; + cmd.data[2 + 2*fan->reg] = (rpm >> 8) & 0xff; + cmd.data[3 + 2*fan->reg] = rpm & 0xff; + error = smu_run_cmd(smu, &cmd, 1); + } + + if (error == 0) + fan->setpoint = rpm; + + return (error); +} + +static int +smu_fan_read_rpm(device_t smu, struct smu_fan *fan) +{ + struct smu_cmd cmd; + + cmd.cmd = SMU_FAN; + cmd.len = 1; + cmd.data[0] = 1; + + smu_run_cmd(smu, &cmd, 1); + + return ((cmd.data[fan->reg*2+1] << 8) | cmd.data[fan->reg*2+2]); +} + +static int +smu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS) +{ + device_t smu; + struct smu_softc *sc; + struct smu_fan *fan; + int rpm, error; + + smu = arg1; + sc = device_get_softc(smu); + fan = &sc->sc_fans[arg2]; + + rpm = smu_fan_read_rpm(smu, fan); + error = sysctl_handle_int(oidp, &rpm, 0, req); + + if (error || !req->newptr) + return (error); + + sc->sc_lastuserchange = time_uptime; + + return (smu_fan_set_rpm(smu, fan, rpm)); +} + +static void +smu_attach_fans(device_t dev, phandle_t fanroot) +{ + struct smu_fan *fan; + struct smu_softc *sc; + struct sysctl_oid *oid, *fanroot_oid; + struct sysctl_ctx_list *ctx; + phandle_t child; + char type[32], sysctl_name[32]; + int i; + + sc = device_get_softc(dev); + sc->sc_nfans = 0; + + for (child = OF_child(fanroot); child != 0; child = OF_peer(child)) + sc->sc_nfans++; + + if (sc->sc_nfans == 0) { + device_printf(dev, "WARNING: No fans detected!\n"); + return; + } + + sc->sc_fans = malloc(sc->sc_nfans * sizeof(struct smu_fan), M_SMU, + M_WAITOK | M_ZERO); + + fan = sc->sc_fans; + sc->sc_nfans = 0; + + ctx = device_get_sysctl_ctx(dev); + fanroot_oid = SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "fans", + CTLFLAG_RD, 0, "SMU Fan Information"); + + for (child = OF_child(fanroot); child != 0; child = OF_peer(child)) { + OF_getprop(child, "device_type", type, sizeof(type)); + if (strcmp(type, "fan-rpm-control") != 0) + continue; + + fan->old_style = 0; + OF_getprop(child, "reg", &fan->reg, sizeof(cell_t)); + OF_getprop(child, "min-value", &fan->min_rpm, sizeof(cell_t)); + OF_getprop(child, "max-value", &fan->max_rpm, sizeof(cell_t)); + + if (OF_getprop(child, "unmanaged-value", &fan->unmanaged_rpm, + sizeof(cell_t)) != sizeof(cell_t)) + fan->unmanaged_rpm = fan->max_rpm; + + fan->setpoint = smu_fan_read_rpm(dev, fan); + + OF_getprop(child, "location", fan->location, + sizeof(fan->location)); + + /* Add sysctls */ + for (i = 0; i < strlen(fan->location); i++) { + sysctl_name[i] = tolower(fan->location[i]); + if (isspace(sysctl_name[i])) + sysctl_name[i] = '_'; + } + sysctl_name[i] = 0; + + oid = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(fanroot_oid), + OID_AUTO, sysctl_name, CTLFLAG_RD, 0, "Fan Information"); + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "minrpm", + CTLTYPE_INT | CTLFLAG_RD, &fan->min_rpm, sizeof(cell_t), + "Minimum allowed RPM"); + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "maxrpm", + CTLTYPE_INT | CTLFLAG_RD, &fan->max_rpm, sizeof(cell_t), + "Maximum allowed RPM"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "rpm", + CTLTYPE_INT | CTLFLAG_RW, dev, sc->sc_nfans, + smu_fanrpm_sysctl, "I", "Fan RPM"); + + fan++; + sc->sc_nfans++; + } +} + +static int +smu_sensor_read(device_t smu, struct smu_sensor *sens, int *val) +{ + struct smu_cmd cmd; + struct smu_softc *sc; + int64_t value; + int error; + + cmd.cmd = SMU_ADC; + cmd.len = 1; + cmd.data[0] = sens->reg; + error = 0; + + error = smu_run_cmd(smu, &cmd, 1); + if (error != 0) + return (error); + + sc = device_get_softc(smu); + value = (cmd.data[0] << 8) | cmd.data[1]; + + switch (sens->type) { + case SMU_TEMP_SENSOR: + value *= sc->sc_cpu_diode_scale; + value >>= 3; + value += ((int64_t)sc->sc_cpu_diode_offset) << 9; + value <<= 1; + + /* Convert from 16.16 fixed point degC into integer C. */ + value >>= 16; + break; + case SMU_VOLTAGE_SENSOR: + value *= sc->sc_cpu_volt_scale; + value += sc->sc_cpu_volt_offset; + value <<= 4; + + /* Convert from 16.16 fixed point V into mV. */ + value *= 15625; + value /= 1024; + value /= 1000; + break; + case SMU_CURRENT_SENSOR: + value *= sc->sc_cpu_curr_scale; + value += sc->sc_cpu_curr_offset; + value <<= 4; + + /* Convert from 16.16 fixed point A into mA. */ + value *= 15625; + value /= 1024; + value /= 1000; + break; + case SMU_POWER_SENSOR: + value *= sc->sc_slots_pow_scale; + value += sc->sc_slots_pow_offset; + value <<= 4; + + /* Convert from 16.16 fixed point W into mW. */ + value *= 15625; + value /= 1024; + value /= 1000; + break; + } + + *val = value; + return (0); +} + +static int +smu_sensor_sysctl(SYSCTL_HANDLER_ARGS) +{ + device_t smu; + struct smu_softc *sc; + struct smu_sensor *sens; + int value, error; + + smu = arg1; + sc = device_get_softc(smu); + sens = &sc->sc_sensors[arg2]; + + error = smu_sensor_read(smu, sens, &value); + if (error != 0) + return (error); + + error = sysctl_handle_int(oidp, &value, 0, req); + + return (error); +} + +static void +smu_attach_sensors(device_t dev, phandle_t sensroot) +{ + struct smu_sensor *sens; + struct smu_softc *sc; + struct sysctl_oid *sensroot_oid; + struct sysctl_ctx_list *ctx; + phandle_t child; + char type[32]; + int i; + + sc = device_get_softc(dev); + sc->sc_nsensors = 0; + + for (child = OF_child(sensroot); child != 0; child = OF_peer(child)) + sc->sc_nsensors++; + + if (sc->sc_nsensors == 0) { + device_printf(dev, "WARNING: No sensors detected!\n"); + return; + } + + sc->sc_sensors = malloc(sc->sc_nsensors * sizeof(struct smu_sensor), + M_SMU, M_WAITOK | M_ZERO); + + sens = sc->sc_sensors; + sc->sc_nsensors = 0; + + ctx = device_get_sysctl_ctx(dev); + sensroot_oid = SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "sensors", + CTLFLAG_RD, 0, "SMU Sensor Information"); + + for (child = OF_child(sensroot); child != 0; child = OF_peer(child)) { + char sysctl_name[40], sysctl_desc[40]; + const char *units; + + OF_getprop(child, "device_type", type, sizeof(type)); + + if (strcmp(type, "current-sensor") == 0) { + sens->type = SMU_CURRENT_SENSOR; + units = "mA"; + } else if (strcmp(type, "temp-sensor") == 0) { + sens->type = SMU_TEMP_SENSOR; + units = "C"; + } else if (strcmp(type, "voltage-sensor") == 0) { + sens->type = SMU_VOLTAGE_SENSOR; + units = "mV"; + } else if (strcmp(type, "power-sensor") == 0) { + sens->type = SMU_POWER_SENSOR; + units = "mW"; + } else { + continue; + } + + OF_getprop(child, "reg", &sens->reg, sizeof(cell_t)); + OF_getprop(child, "location", sens->location, + sizeof(sens->location)); + + for (i = 0; i < strlen(sens->location); i++) { + sysctl_name[i] = tolower(sens->location[i]); + if (isspace(sysctl_name[i])) + sysctl_name[i] = '_'; + } + sysctl_name[i] = 0; + + sprintf(sysctl_desc,"%s (%s)", sens->location, units); + + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(sensroot_oid), OID_AUTO, + sysctl_name, CTLTYPE_INT | CTLFLAG_RD, dev, sc->sc_nsensors, + smu_sensor_sysctl, "I", sysctl_desc); + + sens++; + sc->sc_nsensors++; + } +} + +static void +smu_fan_management_proc(void *xdev) +{ + device_t smu = xdev; + + while(1) { + smu_manage_fans(smu); + pause("smu", SMU_FANMGT_INTERVAL * hz / 1000); + } +} + +static void +smu_manage_fans(device_t smu) +{ + struct smu_softc *sc; + int i, maxtemp, temp, factor, error; + + sc = device_get_softc(smu); + + maxtemp = 0; + for (i = 0; i < sc->sc_nsensors; i++) { + if (sc->sc_sensors[i].type != SMU_TEMP_SENSOR) + continue; + + error = smu_sensor_read(smu, &sc->sc_sensors[i], &temp); + if (error == 0 && temp > maxtemp) + maxtemp = temp; + } + + if (maxtemp < 10) { /* Bail if no good sensors */ + for (i = 0; i < sc->sc_nfans; i++) + smu_fan_set_rpm(smu, &sc->sc_fans[i], + sc->sc_fans[i].unmanaged_rpm); + return; + } + + if (maxtemp > sc->sc_critical_temp) { + device_printf(smu, "WARNING: Current system temperature (%d C) " + "exceeds critical temperature (%d C)! Shutting down!\n", + maxtemp, sc->sc_critical_temp); + shutdown_nice(RB_POWEROFF); + } + + if (maxtemp - sc->sc_target_temp > 20) + device_printf(smu, "WARNING: Current system temperature (%d C) " + "more than 20 degrees over target temperature (%d C)!\n", + maxtemp, sc->sc_target_temp); + + if (time_uptime - sc->sc_lastuserchange < 3) { + /* + * If we have heard from a user process in the last 3 seconds, + * go away. + */ + + return; + } + + if (maxtemp - sc->sc_target_temp > 4) + factor = 110; + else if (maxtemp - sc->sc_target_temp > 1) + factor = 105; + else if (sc->sc_target_temp - maxtemp > 4) + factor = 90; + else if (sc->sc_target_temp - maxtemp > 1) + factor = 95; + else + factor = 100; + + for (i = 0; i < sc->sc_nfans; i++) + smu_fan_set_rpm(smu, &sc->sc_fans[i], + (sc->sc_fans[i].setpoint * factor) / 100); +} + +static void +smu_set_sleepled(void *xdev, int onoff) +{ + static struct smu_cmd cmd; + device_t smu = xdev; + + cmd.cmd = SMU_MISC; + cmd.len = 3; + cmd.data[0] = SMU_MISC_LED_CTRL; + cmd.data[1] = 0; + cmd.data[2] = onoff; + + smu_run_cmd(smu, &cmd, 0); +} + +static int +smu_server_mode(SYSCTL_HANDLER_ARGS) +{ + struct smu_cmd cmd; + u_int server_mode; + device_t smu = arg1; + int error; + + cmd.cmd = SMU_POWER_EVENTS; + cmd.len = 1; + cmd.data[0] = SMU_PWR_GET_POWERUP; + + error = smu_run_cmd(smu, &cmd, 1); + + if (error) + return (error); + + server_mode = (cmd.data[1] & SMU_WAKEUP_AC_INSERT) ? 1 : 0; + + error = sysctl_handle_int(oidp, &server_mode, 0, req); + + if (error || !req->newptr) + return (error); + + if (server_mode == 1) + cmd.data[0] = SMU_PWR_SET_POWERUP; + else if (server_mode == 0) + cmd.data[0] = SMU_PWR_CLR_POWERUP; + else + return (EINVAL); + + cmd.len = 3; + cmd.data[1] = 0; + cmd.data[2] = SMU_WAKEUP_AC_INSERT; + + return (smu_run_cmd(smu, &cmd, 1)); +} + From owner-svn-src-stable@FreeBSD.ORG Sat Mar 20 14:55:22 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DE59106564A; Sat, 20 Mar 2010 14:55:22 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B32D8FC0C; Sat, 20 Mar 2010 14:55:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2KEtMet004610; Sat, 20 Mar 2010 14:55:22 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2KEtMjn004607; Sat, 20 Mar 2010 14:55:22 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201003201455.o2KEtMjn004607@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 20 Mar 2010 14:55:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205375 - in stable/8/sys/powerpc: aim booke X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2010 14:55:22 -0000 Author: nwhitehorn Date: Sat Mar 20 14:55:22 2010 New Revision: 205375 URL: http://svn.freebsd.org/changeset/base/205375 Log: MFC r204903: Place interrupt handling in a critical section and remove double counting in incrementing the interrupt nesting level. This fixes a number of bugs in which the interrupt thread could be preempted by an IPI, indefinitely delaying acknowledgement of the interrupt to the PIC, causing interrupt starvation and hangs. Reported by: linimon Reviewed by: marcel, jhb Modified: stable/8/sys/powerpc/aim/interrupt.c stable/8/sys/powerpc/booke/interrupt.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/aim/interrupt.c ============================================================================== --- stable/8/sys/powerpc/aim/interrupt.c Sat Mar 20 14:53:52 2010 (r205374) +++ stable/8/sys/powerpc/aim/interrupt.c Sat Mar 20 14:55:22 2010 (r205375) @@ -80,15 +80,17 @@ powerpc_interrupt(struct trapframe *fram switch (framep->exc) { case EXC_EXI: - atomic_add_int(&td->td_intr_nesting_level, 1); + critical_enter(); PIC_DISPATCH(pic, framep); - atomic_subtract_int(&td->td_intr_nesting_level, 1); + critical_exit(); break; case EXC_DECR: + critical_enter(); atomic_add_int(&td->td_intr_nesting_level, 1); decr_intr(framep); atomic_subtract_int(&td->td_intr_nesting_level, 1); + critical_exit(); break; default: Modified: stable/8/sys/powerpc/booke/interrupt.c ============================================================================== --- stable/8/sys/powerpc/booke/interrupt.c Sat Mar 20 14:53:52 2010 (r205374) +++ stable/8/sys/powerpc/booke/interrupt.c Sat Mar 20 14:55:22 2010 (r205375) @@ -118,9 +118,11 @@ powerpc_decr_interrupt(struct trapframe struct thread *td; td = PCPU_GET(curthread); + critical_enter(); atomic_add_int(&td->td_intr_nesting_level, 1); decr_intr(framep); atomic_subtract_int(&td->td_intr_nesting_level, 1); + critical_exit(); } /* @@ -129,10 +131,8 @@ powerpc_decr_interrupt(struct trapframe void powerpc_extr_interrupt(struct trapframe *framep) { - struct thread *td; - td = PCPU_GET(curthread); - atomic_add_int(&td->td_intr_nesting_level, 1); + critical_enter(); PIC_DISPATCH(pic, framep); - atomic_subtract_int(&td->td_intr_nesting_level, 1); + critical_exit(); } From owner-svn-src-stable@FreeBSD.ORG Sat Mar 20 15:05:44 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC232106566C; Sat, 20 Mar 2010 15:05:44 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 984078FC08; Sat, 20 Mar 2010 15:05:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2KF5iCJ007027; Sat, 20 Mar 2010 15:05:44 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2KF5iX2007024; Sat, 20 Mar 2010 15:05:44 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201003201505.o2KF5iX2007024@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 20 Mar 2010 15:05:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205377 - stable/8/sys/powerpc/aim X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2010 15:05:44 -0000 Author: nwhitehorn Date: Sat Mar 20 15:05:44 2010 New Revision: 205377 URL: http://svn.freebsd.org/changeset/base/205377 Log: Fix a bug where pages being removed from memory entirely no longer have PVOs, and so the modified state of the page can no longer be communicated to the VM layer, causing pages not to be flushed to swap when needed, in turn causing memory corruption. Also make several correctness adjustments to I-Cache synchronization and TLB invalidation for 64-bit Book-S CPUs. Obtained from: projects/ppc64 Discussed with: grehan Modified: stable/8/sys/powerpc/aim/mmu_oea.c stable/8/sys/powerpc/aim/mmu_oea64.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/aim/mmu_oea.c ============================================================================== --- stable/8/sys/powerpc/aim/mmu_oea.c Sat Mar 20 14:57:24 2010 (r205376) +++ stable/8/sys/powerpc/aim/mmu_oea.c Sat Mar 20 15:05:44 2010 (r205377) @@ -1729,6 +1729,10 @@ moea_remove_all(mmu_t mmu, vm_page_t m) moea_pvo_remove(pvo, -1); PMAP_UNLOCK(pmap); } + if ((m->flags & PG_WRITEABLE) && moea_is_modified(mmu, m)) { + moea_attr_clear(m, LPTE_CHG); + vm_page_dirty(m); + } vm_page_flag_clear(m, PG_WRITEABLE); } @@ -2203,10 +2207,8 @@ moea_query_bit(vm_page_t m, int ptebit) struct pvo_entry *pvo; struct pte *pt; -#if 0 if (moea_attr_fetch(m) & ptebit) return (TRUE); -#endif LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) { MOEA_PVO_CHECK(pvo); /* sanity check */ Modified: stable/8/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- stable/8/sys/powerpc/aim/mmu_oea64.c Sat Mar 20 14:57:24 2010 (r205376) +++ stable/8/sys/powerpc/aim/mmu_oea64.c Sat Mar 20 15:05:44 2010 (r205377) @@ -172,6 +172,7 @@ va_to_vsid(pmap_t pm, vm_offset_t va) return ((pm->pm_sr[(uintptr_t)va >> ADDR_SR_SHFT]) & SR_VSID_MASK); } +#define PTESYNC() __asm __volatile("ptesync"); #define TLBSYNC() __asm __volatile("tlbsync; ptesync"); #define SYNC() __asm __volatile("sync"); #define EIEIO() __asm __volatile("eieio"); @@ -194,6 +195,7 @@ TLBIE(pmap_t pmap, vm_offset_t va) { vpn = (uint64_t)(va & ADDR_PIDX); if (pmap != NULL) vpn |= (va_to_vsid(pmap,va) << 28); + vpn &= ~(0xffffULL << 48); vpn_hi = (uint32_t)(vpn >> 32); vpn_lo = (uint32_t)vpn; @@ -201,8 +203,7 @@ TLBIE(pmap_t pmap, vm_offset_t va) { mtx_lock_spin(&tlbie_mutex); __asm __volatile("\ mfmsr %0; \ - clrldi %1,%0,49; \ - mtmsr %1; \ + mr %1, %0; \ insrdi %1,%5,1,0; \ mtmsrd %1; \ ptesync; \ @@ -215,7 +216,8 @@ TLBIE(pmap_t pmap, vm_offset_t va) { eieio; \ tlbsync; \ ptesync;" - : "=r"(msr), "=r"(scratch) : "r"(vpn_hi), "r"(vpn_lo), "r"(32), "r"(1)); + : "=r"(msr), "=r"(scratch) : "r"(vpn_hi), "r"(vpn_lo), "r"(32), "r"(1) + : "memory"); mtx_unlock_spin(&tlbie_mutex); } @@ -226,13 +228,13 @@ TLBIE(pmap_t pmap, vm_offset_t va) { #define VSID_TO_SR(vsid) ((vsid) & 0xf) #define VSID_TO_HASH(vsid) (((vsid) >> 4) & 0xfffff) -#define PVO_PTEGIDX_MASK 0x007 /* which PTEG slot */ -#define PVO_PTEGIDX_VALID 0x008 /* slot is valid */ -#define PVO_WIRED 0x010 /* PVO entry is wired */ -#define PVO_MANAGED 0x020 /* PVO entry is managed */ -#define PVO_BOOTSTRAP 0x080 /* PVO entry allocated during +#define PVO_PTEGIDX_MASK 0x007UL /* which PTEG slot */ +#define PVO_PTEGIDX_VALID 0x008UL /* slot is valid */ +#define PVO_WIRED 0x010UL /* PVO entry is wired */ +#define PVO_MANAGED 0x020UL /* PVO entry is managed */ +#define PVO_BOOTSTRAP 0x080UL /* PVO entry allocated during bootstrap */ -#define PVO_FAKE 0x100 /* fictitious phys page */ +#define PVO_FAKE 0x100UL /* fictitious phys page */ #define PVO_VADDR(pvo) ((pvo)->pvo_vaddr & ~ADDR_POFF) #define PVO_ISFAKE(pvo) ((pvo)->pvo_vaddr & PVO_FAKE) #define PVO_PTEGIDX_GET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_MASK) @@ -512,23 +514,6 @@ moea64_attr_save(vm_page_t m, u_int64_t m->md.mdpg_attrs |= ptebit; } -static __inline int -moea64_pte_compare(const struct lpte *pt, const struct lpte *pvo_pt) -{ - if (pt->pte_hi == pvo_pt->pte_hi) - return (1); - - return (0); -} - -static __inline int -moea64_pte_match(struct lpte *pt, uint64_t vsid, vm_offset_t va, int which) -{ - return (pt->pte_hi & ~LPTE_VALID) == - ((vsid << LPTE_VSID_SHIFT) | - ((uint64_t)(va >> ADDR_API_SHFT64) & LPTE_API) | which); -} - static __inline void moea64_pte_create(struct lpte *pt, uint64_t vsid, vm_offset_t va, uint64_t pte_lo) @@ -583,7 +568,7 @@ moea64_pte_set(struct lpte *pt, struct l pt->pte_lo = pvo_pt->pte_lo; EIEIO(); pt->pte_hi = pvo_pt->pte_hi; - SYNC(); + PTESYNC(); moea64_pte_valid++; } @@ -602,7 +587,6 @@ moea64_pte_unset(struct lpte *pt, struct * Invalidate the pte. */ pt->pte_hi &= ~LPTE_VALID; - TLBIE(pmap,va); /* @@ -621,6 +605,8 @@ moea64_pte_change(struct lpte *pt, struc */ moea64_pte_unset(pt, pvo_pt, pmap, va); moea64_pte_set(pt, pvo_pt); + if (pmap == kernel_pmap) + isync(); } static __inline uint64_t @@ -701,7 +687,7 @@ moea64_bridge_cpu_bootstrap(mmu_t mmup, for (i = 0; i < 16; i++) { mtsrin(i << ADDR_SR_SHFT, kernel_pmap->pm_sr[i]); } - __asm __volatile ("sync; mtsdr1 %0; isync" + __asm __volatile ("ptesync; mtsdr1 %0; isync" :: "r"((u_int)moea64_pteg_table | (32 - cntlzw(moea64_pteg_mask >> 11)))); tlbia(); @@ -1135,7 +1121,7 @@ void moea64_set_scratchpage_pa(int which EIEIO(); moea64_scratchpage_pte[which]->pte_hi |= LPTE_VALID; - TLBIE(kernel_pmap, moea64_scratchpage_va[which]); + PTESYNC(); isync(); } void @@ -1155,8 +1141,6 @@ moea64_copy_page(mmu_t mmu, vm_page_t ms kcopy((void *)moea64_scratchpage_va[0], (void *)moea64_scratchpage_va[1], PAGE_SIZE); - __syncicache((void *)moea64_scratchpage_va[1],PAGE_SIZE); - mtx_unlock(&moea64_scratchpage_mtx); } @@ -1174,8 +1158,6 @@ moea64_zero_page_area(mmu_t mmu, vm_page moea64_set_scratchpage_pa(0,pa); bzero((caddr_t)moea64_scratchpage_va[0] + off, size); - __syncicache((void *)moea64_scratchpage_va[0],PAGE_SIZE); - mtx_unlock(&moea64_scratchpage_mtx); } @@ -1266,9 +1248,6 @@ moea64_enter_locked(pmap_t pmap, vm_offs error = moea64_pvo_enter(pmap, zone, pvo_head, va, VM_PAGE_TO_PHYS(m), pte_lo, pvo_flags); - if (pmap == kernel_pmap) - TLBIE(pmap, va); - /* * Flush the page from the instruction cache if this page is * mapped executable and cacheable. @@ -1281,6 +1260,7 @@ moea64_enter_locked(pmap_t pmap, vm_offs static void moea64_syncicache(pmap_t pmap, vm_offset_t va, vm_offset_t pa) { + /* * This is much trickier than on older systems because * we can't sync the icache on physical addresses directly @@ -1441,8 +1421,6 @@ moea64_uma_page_alloc(uma_zone_t zone, i &moea64_pvo_kunmanaged, va, VM_PAGE_TO_PHYS(m), LPTE_M, PVO_WIRED | PVO_BOOTSTRAP); - TLBIE(kernel_pmap, va); - if (needed_lock) PMAP_UNLOCK(kernel_pmap); @@ -1531,7 +1509,7 @@ moea64_remove_write(mmu_t mmu, vm_page_t lo |= pvo->pvo_pte.lpte.pte_lo; pvo->pvo_pte.lpte.pte_lo &= ~LPTE_CHG; moea64_pte_change(pt, &pvo->pvo_pte.lpte, - pvo->pvo_pmap, pvo->pvo_vaddr); + pvo->pvo_pmap, PVO_VADDR(pvo)); } UNLOCK_TABLE(); } @@ -1590,8 +1568,6 @@ moea64_kenter(mmu_t mmu, vm_offset_t va, &moea64_pvo_kunmanaged, va, pa, pte_lo, PVO_WIRED | VM_PROT_EXECUTE); - TLBIE(kernel_pmap, va); - if (error != 0 && error != ENOENT) panic("moea64_kenter: failed to enter va %#x pa %#x: %d", va, pa, error); @@ -1823,7 +1799,7 @@ moea64_protect(mmu_t mmu, pmap_t pm, vm_ */ if (pt != NULL) { moea64_pte_change(pt, &pvo->pvo_pte.lpte, - pvo->pvo_pmap, pvo->pvo_vaddr); + pvo->pvo_pmap, PVO_VADDR(pvo)); if ((pvo->pvo_pte.lpte.pte_lo & (LPTE_I | LPTE_G | LPTE_NOEXEC)) == 0) { moea64_syncicache(pm, sva, @@ -1926,6 +1902,10 @@ moea64_remove_all(mmu_t mmu, vm_page_t m moea64_pvo_remove(pvo, -1); PMAP_UNLOCK(pmap); } + if ((m->flags & PG_WRITEABLE) && moea64_is_modified(mmu, m)) { + moea64_attr_clear(m, LPTE_CHG); + vm_page_dirty(m); + } vm_page_flag_clear(m, PG_WRITEABLE); } @@ -2106,7 +2086,7 @@ moea64_pvo_enter(pmap_t pm, uma_zone_t z first = 1; LIST_INSERT_HEAD(pvo_head, pvo, pvo_vlink); - if (pvo->pvo_pte.lpte.pte_lo & PVO_WIRED) + if (pvo->pvo_vaddr & PVO_WIRED) pm->pm_stats.wired_count++; pm->pm_stats.resident_count++; @@ -2121,6 +2101,9 @@ moea64_pvo_enter(pmap_t pm, uma_zone_t z moea64_pte_overflow++; } + if (pm == kernel_pmap) + isync(); + UNLOCK_TABLE(); return (first ? ENOENT : 0); @@ -2139,7 +2122,7 @@ moea64_pvo_remove(struct pvo_entry *pvo, pt = moea64_pvo_to_pte(pvo, pteidx); if (pt != NULL) { moea64_pte_unset(pt, &pvo->pvo_pte.lpte, pvo->pvo_pmap, - pvo->pvo_vaddr); + PVO_VADDR(pvo)); PVO_PTEGIDX_CLR(pvo); } else { moea64_pte_overflow--; @@ -2150,7 +2133,7 @@ moea64_pvo_remove(struct pvo_entry *pvo, * Update our statistics. */ pvo->pvo_pmap->pm_stats.resident_count--; - if (pvo->pvo_pte.lpte.pte_lo & PVO_WIRED) + if (pvo->pvo_vaddr & PVO_WIRED) pvo->pvo_pmap->pm_stats.wired_count--; /* @@ -2177,7 +2160,7 @@ moea64_pvo_remove(struct pvo_entry *pvo, */ LIST_REMOVE(pvo, pvo_olink); if (!(pvo->pvo_vaddr & PVO_BOOTSTRAP)) - uma_zfree(pvo->pvo_vaddr & PVO_MANAGED ? moea64_mpvo_zone : + uma_zfree((pvo->pvo_vaddr & PVO_MANAGED) ? moea64_mpvo_zone : moea64_upvo_zone, pvo); moea64_pvo_entries--; moea64_pvo_remove_calls++; @@ -2236,8 +2219,8 @@ moea64_pvo_to_pte(const struct pvo_entry int ptegidx; uint64_t vsid; - vsid = va_to_vsid(pvo->pvo_pmap, pvo->pvo_vaddr); - ptegidx = va_to_pteg(vsid, pvo->pvo_vaddr); + vsid = va_to_vsid(pvo->pvo_pmap, PVO_VADDR(pvo)); + ptegidx = va_to_pteg(vsid, PVO_VADDR(pvo)); pteidx = moea64_pvo_pte_index(pvo, ptegidx); } @@ -2324,10 +2307,8 @@ moea64_query_bit(vm_page_t m, u_int64_t struct pvo_entry *pvo; struct lpte *pt; -#if 0 if (moea64_attr_fetch(m) & ptebit) return (TRUE); -#endif LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) { MOEA_PVO_CHECK(pvo); /* sanity check */ From owner-svn-src-stable@FreeBSD.ORG Sat Mar 20 15:15:54 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98618106566B; Sat, 20 Mar 2010 15:15:54 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84CD98FC1F; Sat, 20 Mar 2010 15:15:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2KFFs3a009318; Sat, 20 Mar 2010 15:15:54 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2KFFsBL009311; Sat, 20 Mar 2010 15:15:54 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201003201515.o2KFFsBL009311@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 20 Mar 2010 15:15:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205378 - in stable/8/sys/powerpc: aim include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2010 15:15:54 -0000 Author: nwhitehorn Date: Sat Mar 20 15:15:54 2010 New Revision: 205378 URL: http://svn.freebsd.org/changeset/base/205378 Log: MFC r204128: Reduce KVA pressure on OEA64 systems running in bridge mode by mapping UMA segments at their physical addresses instead of into KVA. This emulates the direct mapping behavior of OEA32 in an ad-hoc way. To make this work properly required sharing the entire kernel PMAP with Open Firmware, so ofw_pmap is transformed into a stub on 64-bit CPUs. Also implement some more tweaks to get more mileage out of our limited amount of KVA, principally by extending KVA into segment 16 until the beginning of the first OFW mapping. Reported by: linimon Modified: stable/8/sys/powerpc/aim/machdep.c stable/8/sys/powerpc/aim/mmu_oea.c stable/8/sys/powerpc/aim/mmu_oea64.c stable/8/sys/powerpc/aim/uma_machdep.c stable/8/sys/powerpc/include/sr.h stable/8/sys/powerpc/include/vmparam.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/aim/machdep.c ============================================================================== --- stable/8/sys/powerpc/aim/machdep.c Sat Mar 20 15:05:44 2010 (r205377) +++ stable/8/sys/powerpc/aim/machdep.c Sat Mar 20 15:15:54 2010 (r205378) @@ -198,6 +198,11 @@ cpu_startup(void *dummy) ptoa(physmem) / 1048576); realmem = physmem; + if (bootverbose) + printf("available KVA = %zd (%zd MB)\n", + virtual_end - virtual_avail, + (virtual_end - virtual_avail) / 1048576); + /* * Display any holes after the first chunk of extended memory. */ Modified: stable/8/sys/powerpc/aim/mmu_oea.c ============================================================================== --- stable/8/sys/powerpc/aim/mmu_oea.c Sat Mar 20 15:05:44 2010 (r205377) +++ stable/8/sys/powerpc/aim/mmu_oea.c Sat Mar 20 15:15:54 2010 (r205378) @@ -909,7 +909,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k * Set the start and end of kva. */ virtual_avail = VM_MIN_KERNEL_ADDRESS; - virtual_end = VM_MAX_KERNEL_ADDRESS; + virtual_end = VM_MAX_SAFE_KERNEL_ADDRESS; /* * Allocate a kernel stack with a guard page for thread0 and map it @@ -2419,7 +2419,7 @@ moea_unmapdev(mmu_t mmu, vm_offset_t va, * If this is outside kernel virtual space, then it's a * battable entry and doesn't require unmapping */ - if ((va >= VM_MIN_KERNEL_ADDRESS) && (va <= VM_MAX_KERNEL_ADDRESS)) { + if ((va >= VM_MIN_KERNEL_ADDRESS) && (va <= virtual_end)) { base = trunc_page(va); offset = va & PAGE_MASK; size = roundup(offset + size, PAGE_SIZE); Modified: stable/8/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- stable/8/sys/powerpc/aim/mmu_oea64.c Sat Mar 20 15:05:44 2010 (r205377) +++ stable/8/sys/powerpc/aim/mmu_oea64.c Sat Mar 20 15:15:54 2010 (r205378) @@ -297,9 +297,6 @@ struct pvo_head moea64_pvo_unmanaged = uma_zone_t moea64_upvo_zone; /* zone for pvo entries for unmanaged pages */ uma_zone_t moea64_mpvo_zone; /* zone for pvo entries for managed pages */ -vm_offset_t pvo_allocator_start; -vm_offset_t pvo_allocator_end; - #define BPVO_POOL_SIZE 327680 static struct pvo_entry *moea64_bpvo_pool; static int moea64_bpvo_pool_index = 0; @@ -699,6 +696,7 @@ moea64_add_ofw_mappings(mmu_t mmup, phan struct ofw_map translations[sz/sizeof(struct ofw_map)]; register_t msr; vm_offset_t off; + vm_paddr_t pa_base; int i, ofw_mappings; bzero(translations, sz); @@ -720,33 +718,18 @@ moea64_add_ofw_mappings(mmu_t mmup, phan if (translations[i].om_pa_hi) panic("OFW translations above 32-bit boundary!"); + pa_base = translations[i].om_pa_lo; + /* Now enter the pages for this mapping */ - /* - * Lock the ofw pmap. pmap_kenter(), which we use for the - * pages the kernel also needs, does its own locking. - */ - PMAP_LOCK(&ofw_pmap); DISABLE_TRANS(msr); for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) { - struct vm_page m; - - /* Map low memory mappings into the kernel pmap, too. - * These are typically mappings made by the loader, - * so we need them if we want to keep executing. */ - - if (translations[i].om_va + off < SEGMENT_LENGTH) - moea64_kenter(mmup, translations[i].om_va + off, - translations[i].om_va + off); - - m.phys_addr = translations[i].om_pa_lo + off; - moea64_enter_locked(&ofw_pmap, - translations[i].om_va + off, &m, VM_PROT_ALL, 1); + moea64_kenter(mmup, translations[i].om_va + off, + pa_base + off); ofw_mappings++; } ENABLE_TRANS(msr); - PMAP_UNLOCK(&ofw_pmap); } } @@ -926,8 +909,8 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o */ moea64_pinit(mmup, &ofw_pmap); - ofw_pmap.pm_sr[KERNEL_SR] = kernel_pmap->pm_sr[KERNEL_SR]; - ofw_pmap.pm_sr[KERNEL2_SR] = kernel_pmap->pm_sr[KERNEL2_SR]; + for (i = 0; i < 16; i++) + ofw_pmap.pm_sr[i] = kernel_pmap->pm_sr[i]; if ((chosen = OF_finddevice("/chosen")) == -1) panic("moea64_bootstrap: can't find /chosen"); @@ -965,15 +948,20 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o * Set the start and end of kva. */ virtual_avail = VM_MIN_KERNEL_ADDRESS; - virtual_end = VM_MAX_KERNEL_ADDRESS; + virtual_end = VM_MAX_SAFE_KERNEL_ADDRESS; /* - * Allocate some stupid buffer regions. + * Figure out how far we can extend virtual_end into segment 16 + * without running into existing mappings. Segment 16 is guaranteed + * to contain neither RAM nor devices (at least on Apple hardware), + * but will generally contain some OFW mappings we should not + * step on. */ - pvo_allocator_start = virtual_avail; - virtual_avail += SEGMENT_LENGTH/4; - pvo_allocator_end = virtual_avail; + PMAP_LOCK(kernel_pmap); + while (moea64_pvo_find_va(kernel_pmap, virtual_end+1, NULL) == NULL) + virtual_end += PAGE_SIZE; + PMAP_UNLOCK(kernel_pmap); /* * Allocate some things for page zeroing @@ -1014,26 +1002,20 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o * Allocate virtual address space for the message buffer. */ pa = msgbuf_phys = moea64_bootstrap_alloc(MSGBUF_SIZE, PAGE_SIZE); - msgbufp = (struct msgbuf *)virtual_avail; - va = virtual_avail; - virtual_avail += round_page(MSGBUF_SIZE); - while (va < virtual_avail) { - moea64_kenter(mmup, va, pa); + msgbufp = (struct msgbuf *)msgbuf_phys; + while (pa - msgbuf_phys < MSGBUF_SIZE) { + moea64_kenter(mmup, pa, pa); pa += PAGE_SIZE; - va += PAGE_SIZE; } /* * Allocate virtual address space for the dynamic percpu area. */ pa = moea64_bootstrap_alloc(DPCPU_SIZE, PAGE_SIZE); - dpcpu = (void *)virtual_avail; - va = virtual_avail; - virtual_avail += DPCPU_SIZE; - while (va < virtual_avail) { - moea64_kenter(mmup, va, pa); + dpcpu = (void *)pa; + while (pa - (vm_offset_t)dpcpu < DPCPU_SIZE) { + moea64_kenter(mmup, pa, pa); pa += PAGE_SIZE; - va += PAGE_SIZE; } dpcpu_init(dpcpu, 0); } @@ -1411,14 +1393,10 @@ moea64_uma_page_alloc(uma_zone_t zone, i break; } - va = pvo_allocator_start; - pvo_allocator_start += PAGE_SIZE; - - if (pvo_allocator_start >= pvo_allocator_end) - panic("Ran out of PVO allocator buffer space!"); + va = VM_PAGE_TO_PHYS(m); moea64_pvo_enter(kernel_pmap, moea64_upvo_zone, - &moea64_pvo_kunmanaged, va, VM_PAGE_TO_PHYS(m), LPTE_M, + &moea64_pvo_kunmanaged, va, VM_PAGE_TO_PHYS(m), LPTE_M, PVO_WIRED | PVO_BOOTSTRAP); if (needed_lock) @@ -1556,10 +1534,12 @@ moea64_kenter(mmu_t mmu, vm_offset_t va, uint64_t pte_lo; int error; +#if 0 if (!pmap_bootstrapped) { - if (va >= VM_MIN_KERNEL_ADDRESS && va < VM_MAX_KERNEL_ADDRESS) + if (va >= VM_MIN_KERNEL_ADDRESS && va < virtual_end) panic("Trying to enter an address in KVA -- %#x!\n",pa); } +#endif pte_lo = moea64_calc_wimg(pa); Modified: stable/8/sys/powerpc/aim/uma_machdep.c ============================================================================== --- stable/8/sys/powerpc/aim/uma_machdep.c Sat Mar 20 15:05:44 2010 (r205377) +++ stable/8/sys/powerpc/aim/uma_machdep.c Sat Mar 20 15:15:54 2010 (r205378) @@ -56,13 +56,6 @@ uma_small_alloc(uma_zone_t zone, int byt vm_page_t m; int pflags; - if (!hw_direct_map) { - *flags = UMA_SLAB_KMEM; - va = (void *)kmem_malloc(kmem_map, bytes, wait); - - return va; - } - *flags = UMA_SLAB_PRIV; if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT) pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED; @@ -82,6 +75,10 @@ uma_small_alloc(uma_zone_t zone, int byt } va = (void *) VM_PAGE_TO_PHYS(m); + + if (!hw_direct_map) + pmap_kenter((vm_offset_t)va, VM_PAGE_TO_PHYS(m)); + if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) bzero(va, PAGE_SIZE); atomic_add_int(&hw_uma_mdpages, 1); @@ -94,13 +91,11 @@ uma_small_free(void *mem, int size, u_in { vm_page_t m; - if (!hw_direct_map) { - kmem_free(kmem_map, (vm_offset_t)mem, size); - - return; - } + if (!hw_direct_map) + pmap_remove(kernel_pmap,(vm_offset_t)mem, + (vm_offset_t)mem + PAGE_SIZE); - m = PHYS_TO_VM_PAGE((u_int32_t)mem); + m = PHYS_TO_VM_PAGE((vm_offset_t)mem); m->wire_count--; vm_page_free(m); atomic_subtract_int(&cnt.v_wire_count, 1); Modified: stable/8/sys/powerpc/include/sr.h ============================================================================== --- stable/8/sys/powerpc/include/sr.h Sat Mar 20 15:05:44 2010 (r205377) +++ stable/8/sys/powerpc/include/sr.h Sat Mar 20 15:15:54 2010 (r205378) @@ -45,6 +45,7 @@ #define USER_SR 12 #define KERNEL_SR 13 #define KERNEL2_SR 14 +#define KERNEL3_SR 15 #define KERNEL_VSIDBITS 0xfffff #define KERNEL_SEGMENT (0xfffff0 + KERNEL_SR) #define KERNEL2_SEGMENT (0xfffff0 + KERNEL2_SR) Modified: stable/8/sys/powerpc/include/vmparam.h ============================================================================== --- stable/8/sys/powerpc/include/vmparam.h Sat Mar 20 15:05:44 2010 (r205377) +++ stable/8/sys/powerpc/include/vmparam.h Sat Mar 20 15:15:54 2010 (r205378) @@ -98,7 +98,8 @@ #define KERNBASE 0x00100000 /* start of kernel virtual */ #define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)(KERNEL_SR << ADDR_SR_SHFT)) -#define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + 2*SEGMENT_LENGTH - 1) +#define VM_MAX_SAFE_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + 2*SEGMENT_LENGTH -1) +#define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + 3*SEGMENT_LENGTH - 1) /* * Use the direct-mapped BAT registers for UMA small allocs. This @@ -106,13 +107,6 @@ */ #define UMA_MD_SMALL_ALLOC -/* - * On 64-bit systems in bridge mode, we have no direct map, so we fake - * the small_alloc() calls. But we need the VM to be in a reasonable - * state first. - */ -#define UMA_MD_SMALL_ALLOC_NEEDS_VM - #else /* From owner-svn-src-stable@FreeBSD.ORG Sat Mar 20 15:19:57 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACE23106564A; Sat, 20 Mar 2010 15:19:57 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A3FB8FC12; Sat, 20 Mar 2010 15:19:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2KFJvxD010248; Sat, 20 Mar 2010 15:19:57 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2KFJvuY010245; Sat, 20 Mar 2010 15:19:57 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201003201519.o2KFJvuY010245@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 20 Mar 2010 15:19:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205379 - in stable/8/sys/powerpc: aim include X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2010 15:19:57 -0000 Author: nwhitehorn Date: Sat Mar 20 15:19:57 2010 New Revision: 205379 URL: http://svn.freebsd.org/changeset/base/205379 Log: MFC r204268: Close a race involving the OEA64 scratchpage. When the scratch page's physical address is changed, there is a brief window during which its PTE is invalid. Since moea64_set_scratchpage_pa() does not and cannot hold the page table lock, it was possible for another CPU to insert a new PTE into the scratch page's PTEG slot during this interval, corrupting both mappings. Solve this by creating a new flag, LPTE_LOCKED, such that moea64_pte_insert will avoid claiming locked PTEG slots even if they are invalid. This change also incorporates some additional paranoia added to solve things I thought might be this bug. Reported by: linimon Modified: stable/8/sys/powerpc/aim/mmu_oea64.c stable/8/sys/powerpc/include/pte.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- stable/8/sys/powerpc/aim/mmu_oea64.c Sat Mar 20 15:15:54 2010 (r205378) +++ stable/8/sys/powerpc/aim/mmu_oea64.c Sat Mar 20 15:19:57 2010 (r205379) @@ -227,6 +227,7 @@ TLBIE(pmap_t pmap, vm_offset_t va) { #define VSID_MAKE(sr, hash) ((sr) | (((hash) & 0xfffff) << 4)) #define VSID_TO_SR(vsid) ((vsid) & 0xf) #define VSID_TO_HASH(vsid) (((vsid) >> 4) & 0xfffff) +#define VSID_HASH_MASK 0x0000007fffffffffULL #define PVO_PTEGIDX_MASK 0x007UL /* which PTEG slot */ #define PVO_PTEGIDX_VALID 0x008UL /* slot is valid */ @@ -458,9 +459,9 @@ MMU_DEF(oea64_bridge_mmu); static __inline u_int va_to_pteg(uint64_t vsid, vm_offset_t addr) { - u_int hash; + uint64_t hash; - hash = vsid ^ (((uint64_t)addr & ADDR_PIDX) >> + hash = (vsid & VSID_HASH_MASK) ^ (((uint64_t)addr & ADDR_PIDX) >> ADDR_PIDX_SHFT); return (hash & moea64_pteg_mask); } @@ -979,6 +980,7 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o moea64_scratchpage_va[i],&j); moea64_scratchpage_pte[i] = moea64_pvo_to_pte( moea64_scratchpage_pvo[i],j); + moea64_scratchpage_pte[i]->pte_hi |= LPTE_LOCKED; UNLOCK_TABLE(); } @@ -1090,8 +1092,10 @@ moea64_zero_page(mmu_t mmu, vm_page_t m) static __inline void moea64_set_scratchpage_pa(int which, vm_offset_t pa) { + mtx_assert(&moea64_scratchpage_mtx, MA_OWNED); + moea64_scratchpage_pvo[which]->pvo_pte.lpte.pte_lo &= - (~LPTE_WIMG & ~LPTE_RPGN); + ~(LPTE_WIMG | LPTE_RPGN); moea64_scratchpage_pvo[which]->pvo_pte.lpte.pte_lo |= moea64_calc_wimg(pa) | (uint64_t)pa; @@ -2149,18 +2153,16 @@ moea64_pvo_remove(struct pvo_entry *pvo, static __inline int moea64_pvo_pte_index(const struct pvo_entry *pvo, int ptegidx) { - int pteidx; /* * We can find the actual pte entry without searching by grabbing - * the PTEG index from 3 unused bits in pte_lo[11:9] and by + * the PTEG index from 3 unused bits in pvo_vaddr and by * noticing the HID bit. */ - pteidx = ptegidx * 8 + PVO_PTEGIDX_GET(pvo); if (pvo->pvo_pte.lpte.pte_hi & LPTE_HID) - pteidx ^= moea64_pteg_mask * 8; + ptegidx ^= moea64_pteg_mask; - return (pteidx); + return ((ptegidx << 3) | PVO_PTEGIDX_GET(pvo)); } static struct pvo_entry * @@ -2257,7 +2259,8 @@ moea64_pte_insert(u_int ptegidx, struct * First try primary hash. */ for (pt = moea64_pteg_table[ptegidx].pt, i = 0; i < 8; i++, pt++) { - if ((pt->pte_hi & LPTE_VALID) == 0) { + if ((pt->pte_hi & LPTE_VALID) == 0 && + (pt->pte_hi & LPTE_LOCKED) == 0) { pvo_pt->pte_hi &= ~LPTE_HID; moea64_pte_set(pt, pvo_pt); return (i); @@ -2270,7 +2273,8 @@ moea64_pte_insert(u_int ptegidx, struct ptegidx ^= moea64_pteg_mask; for (pt = moea64_pteg_table[ptegidx].pt, i = 0; i < 8; i++, pt++) { - if ((pt->pte_hi & LPTE_VALID) == 0) { + if ((pt->pte_hi & LPTE_VALID) == 0 && + (pt->pte_hi & LPTE_LOCKED) == 0) { pvo_pt->pte_hi |= LPTE_HID; moea64_pte_set(pt, pvo_pt); return (i); Modified: stable/8/sys/powerpc/include/pte.h ============================================================================== --- stable/8/sys/powerpc/include/pte.h Sat Mar 20 15:15:54 2010 (r205378) +++ stable/8/sys/powerpc/include/pte.h Sat Mar 20 15:19:57 2010 (r205379) @@ -95,6 +95,7 @@ struct lpteg { /* High quadword: */ #define LPTE_VSID_SHIFT 12 #define LPTE_API 0x0000000000000F80ULL +#define LPTE_LOCKED 0x0000000000000008ULL #define LPTE_BIG 0x0000000000000004ULL /* 4kb/16Mb page */ #define LPTE_HID 0x0000000000000002ULL #define LPTE_VALID 0x0000000000000001ULL From owner-svn-src-stable@FreeBSD.ORG Sat Mar 20 15:21:14 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FC86106566B; Sat, 20 Mar 2010 15:21:14 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 333358FC25; Sat, 20 Mar 2010 15:21:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2KFLEDf010596; Sat, 20 Mar 2010 15:21:14 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2KFLE6o010594; Sat, 20 Mar 2010 15:21:14 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201003201521.o2KFLE6o010594@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 20 Mar 2010 15:21:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205380 - stable/8/sys/powerpc/aim X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2010 15:21:14 -0000 Author: nwhitehorn Date: Sat Mar 20 15:21:13 2010 New Revision: 205380 URL: http://svn.freebsd.org/changeset/base/205380 Log: MFC r204269: Use dcbz instead of word stores for page zeroing, providing a factor of 3-4 speedup. Modified: stable/8/sys/powerpc/aim/mmu_oea64.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- stable/8/sys/powerpc/aim/mmu_oea64.c Sat Mar 20 15:19:57 2010 (r205379) +++ stable/8/sys/powerpc/aim/mmu_oea64.c Sat Mar 20 15:21:13 2010 (r205380) @@ -1075,15 +1075,6 @@ moea64_change_wiring(mmu_t mmu, pmap_t p } /* - * Zero a page of physical memory by temporarily mapping it into the tlb. - */ -void -moea64_zero_page(mmu_t mmu, vm_page_t m) -{ - moea64_zero_page_area(mmu,m,0,PAGE_SIZE); -} - -/* * This goes through and sets the physical address of our * special scratch PTE to the PA we want to zero or copy. Because * of locking issues (this can get called in pvo_enter() by @@ -1147,6 +1138,27 @@ moea64_zero_page_area(mmu_t mmu, vm_page mtx_unlock(&moea64_scratchpage_mtx); } +/* + * Zero a page of physical memory by temporarily mapping it + */ +void +moea64_zero_page(mmu_t mmu, vm_page_t m) +{ + vm_offset_t pa = VM_PAGE_TO_PHYS(m); + vm_offset_t off; + + if (!moea64_initialized) + panic("moea64_zero_page: can't zero pa %#x", pa); + + mtx_lock(&moea64_scratchpage_mtx); + + moea64_set_scratchpage_pa(0,pa); + for (off = 0; off < PAGE_SIZE; off += cacheline_size) + __asm __volatile("dcbz 0,%0" :: + "r"(moea64_scratchpage_va[0] + off)); + mtx_unlock(&moea64_scratchpage_mtx); +} + void moea64_zero_page_idle(mmu_t mmu, vm_page_t m) { From owner-svn-src-stable@FreeBSD.ORG Sat Mar 20 15:23:06 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E320C1065686; Sat, 20 Mar 2010 15:23:06 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D0FAB8FC1A; Sat, 20 Mar 2010 15:23:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2KFN6gw011096; Sat, 20 Mar 2010 15:23:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2KFN6OG011094; Sat, 20 Mar 2010 15:23:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201003201523.o2KFN6OG011094@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 20 Mar 2010 15:23:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205381 - stable/8/sys/powerpc/aim X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2010 15:23:07 -0000 Author: nwhitehorn Date: Sat Mar 20 15:23:06 2010 New Revision: 205381 URL: http://svn.freebsd.org/changeset/base/205381 Log: MFC r204296: Provide an implementation of pmap_dev_direct_mapped() on OEA64. This is required in order to be able to mmap the running kernel, which is turn required to avoid fstat returning gibberish. Modified: stable/8/sys/powerpc/aim/mmu_oea64.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- stable/8/sys/powerpc/aim/mmu_oea64.c Sat Mar 20 15:21:13 2010 (r205380) +++ stable/8/sys/powerpc/aim/mmu_oea64.c Sat Mar 20 15:23:06 2010 (r205381) @@ -2408,7 +2408,22 @@ moea64_clear_bit(vm_page_t m, u_int64_t boolean_t moea64_dev_direct_mapped(mmu_t mmu, vm_offset_t pa, vm_size_t size) { - return (EFAULT); + struct pvo_entry *pvo; + vm_offset_t ppa; + int error = 0; + + PMAP_LOCK(kernel_pmap); + for (ppa = pa & ~ADDR_POFF; ppa < pa + size; ppa += PAGE_SIZE) { + pvo = moea64_pvo_find_va(kernel_pmap, ppa, NULL); + if (pvo == NULL || + (pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) != ppa) { + error = EFAULT; + break; + } + } + PMAP_UNLOCK(kernel_pmap); + + return (error); } boolean_t From owner-svn-src-stable@FreeBSD.ORG Sat Mar 20 15:27:02 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C27A106564A; Sat, 20 Mar 2010 15:27:02 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FB908FC0C; Sat, 20 Mar 2010 15:27:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2KFR2c0012210; Sat, 20 Mar 2010 15:27:02 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2KFR25l012208; Sat, 20 Mar 2010 15:27:02 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201003201527.o2KFR25l012208@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 20 Mar 2010 15:27:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205382 - stable/8/sys/powerpc/aim X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2010 15:27:02 -0000 Author: nwhitehorn Date: Sat Mar 20 15:27:01 2010 New Revision: 205382 URL: http://svn.freebsd.org/changeset/base/205382 Log: MFC r204297: Move the OEA64 scratchpage to the end of KVA from the beginning, and set its PVO to map physical address 0 instead of kernelstart. This fixes a situation in which a user process could attempt to return this address via KVM, have it fault while being modified, and then panic the kernel because (a) it is supposed to map a valid address and (b) it lies in the no-fault region between VM_MIN_KERNEL_ADDRESS and virtual_avail. While here, move msgbuf and dpcpu back into regular KVA space for consistency with other implementations. Modified: stable/8/sys/powerpc/aim/mmu_oea64.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- stable/8/sys/powerpc/aim/mmu_oea64.c Sat Mar 20 15:23:06 2010 (r205381) +++ stable/8/sys/powerpc/aim/mmu_oea64.c Sat Mar 20 15:27:01 2010 (r205382) @@ -970,10 +970,10 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o mtx_init(&moea64_scratchpage_mtx, "pvo zero page", NULL, MTX_DEF); for (i = 0; i < 2; i++) { - moea64_scratchpage_va[i] = virtual_avail; - virtual_avail += PAGE_SIZE; + moea64_scratchpage_va[i] = (virtual_end+1) - PAGE_SIZE; + virtual_end -= PAGE_SIZE; - moea64_kenter(mmup,moea64_scratchpage_va[i],kernelstart); + moea64_kenter(mmup,moea64_scratchpage_va[i],0); LOCK_TABLE(); moea64_scratchpage_pvo[i] = moea64_pvo_find_va(kernel_pmap, @@ -1004,20 +1004,25 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o * Allocate virtual address space for the message buffer. */ pa = msgbuf_phys = moea64_bootstrap_alloc(MSGBUF_SIZE, PAGE_SIZE); - msgbufp = (struct msgbuf *)msgbuf_phys; - while (pa - msgbuf_phys < MSGBUF_SIZE) { - moea64_kenter(mmup, pa, pa); + msgbufp = (struct msgbuf *)virtual_avail; + va = virtual_avail; + virtual_avail += round_page(MSGBUF_SIZE); + while (va < virtual_avail) { + moea64_kenter(mmup, va, pa); pa += PAGE_SIZE; + va += PAGE_SIZE; } /* * Allocate virtual address space for the dynamic percpu area. */ pa = moea64_bootstrap_alloc(DPCPU_SIZE, PAGE_SIZE); - dpcpu = (void *)pa; - while (pa - (vm_offset_t)dpcpu < DPCPU_SIZE) { - moea64_kenter(mmup, pa, pa); + dpcpu = (void *)virtual_avail; + virtual_avail += DPCPU_SIZE; + while (va < virtual_avail) { + moea64_kenter(mmup, va, pa); pa += PAGE_SIZE; + va += PAGE_SIZE; } dpcpu_init(dpcpu, 0); } From owner-svn-src-stable@FreeBSD.ORG Sat Mar 20 15:28:41 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2076C106566B; Sat, 20 Mar 2010 15:28:41 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7DD08FC0A; Sat, 20 Mar 2010 15:28:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2KFSdl1012717; Sat, 20 Mar 2010 15:28:39 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2KFSdlh012713; Sat, 20 Mar 2010 15:28:39 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201003201528.o2KFSdlh012713@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 20 Mar 2010 15:28:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205383 - stable/8/libexec/rtld-elf/powerpc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2010 15:28:41 -0000 Author: nwhitehorn Date: Sat Mar 20 15:28:39 2010 New Revision: 205383 URL: http://svn.freebsd.org/changeset/base/205383 Log: MFC r204211: Support the extended PLT format used when objects have more than 8192 PLT relocations on PPC32. Modified: stable/8/libexec/rtld-elf/powerpc/reloc.c stable/8/libexec/rtld-elf/powerpc/rtld_machdep.h stable/8/libexec/rtld-elf/powerpc/rtld_start.S Directory Properties: stable/8/libexec/rtld-elf/ (props changed) Modified: stable/8/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- stable/8/libexec/rtld-elf/powerpc/reloc.c Sat Mar 20 15:27:01 2010 (r205382) +++ stable/8/libexec/rtld-elf/powerpc/reloc.c Sat Mar 20 15:28:39 2010 (r205383) @@ -47,6 +47,13 @@ ((u_int32_t)(x) + 0x10000) : (u_int32_t)(x)) >> 16) #define _ppc_la(x) ((u_int32_t)(x) & 0xffff) +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#define max(a,b) (((a) > (b)) ? (a) : (b)) + +#define PLT_EXTENDED_BEGIN (1 << 13) +#define JMPTAB_BASE(N) (18 + N*2 + ((N > PLT_EXTENDED_BEGIN) ? \ + (N - PLT_EXTENDED_BEGIN)*2 : 0)) + /* * Process the R_PPC_COPY relocations */ @@ -313,7 +320,6 @@ done: return (r); } - /* * Initialise a PLT slot to the resolving trampoline */ @@ -321,27 +327,43 @@ static int reloc_plt_object(Obj_Entry *obj, const Elf_Rela *rela) { Elf_Word *where = (Elf_Word *)(obj->relocbase + rela->r_offset); - Elf_Addr *pltresolve; + Elf_Addr *pltresolve, *pltlongresolve, *jmptab; Elf_Addr distance; + int N = obj->pltrelasize / sizeof(Elf_Rela); int reloff; reloff = rela - obj->pltrela; - if ((reloff < 0) || (reloff >= 0x8000)) { + if (reloff < 0) return (-1); - } - pltresolve = obj->pltgot + 8; + pltlongresolve = obj->pltgot + 5; + pltresolve = pltlongresolve + 5; distance = (Elf_Addr)pltresolve - (Elf_Addr)(where + 1); dbg(" reloc_plt_object: where=%p,pltres=%p,reloff=%x,distance=%x", (void *)where, (void *)pltresolve, reloff, distance); - /* li r11,reloff */ - /* b pltresolve */ - where[0] = 0x39600000 | reloff; - where[1] = 0x48000000 | (distance & 0x03fffffc); + if (reloff < PLT_EXTENDED_BEGIN) { + /* li r11,reloff */ + /* b pltresolve */ + where[0] = 0x39600000 | reloff; + where[1] = 0x48000000 | (distance & 0x03fffffc); + } else { + jmptab = obj->pltgot + JMPTAB_BASE(N); + jmptab[reloff] = (u_int)pltlongresolve; + + /* lis r11,jmptab[reloff]@ha */ + /* lwzu r12,jmptab[reloff]@l(r11) */ + /* mtctr r12 */ + /* bctr */ + where[0] = 0x3d600000 | _ppc_ha(&jmptab[reloff]); + where[1] = 0x858b0000 | _ppc_la(&jmptab[reloff]); + where[2] = 0x7d8903a6; + where[3] = 0x4e800420; + } + /* * The icache will be sync'd in init_pltgot, which is called @@ -453,25 +475,28 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr int N = obj->pltrelasize / sizeof(Elf_Rela); int reloff = rela - obj->pltrela; - if ((reloff < 0) || (reloff >= 0x8000)) { + if (reloff < 0) return (-1); - } pltcall = obj->pltgot; - dbg(" reloc_jmpslot: indir, reloff=%d, N=%d\n", + dbg(" reloc_jmpslot: indir, reloff=%x, N=%x\n", reloff, N); - jmptab = obj->pltgot + 18 + N * 2; + jmptab = obj->pltgot + JMPTAB_BASE(N); jmptab[reloff] = target; - distance = (Elf_Addr)pltcall - (Elf_Addr)(wherep + 1); + if (reloff < PLT_EXTENDED_BEGIN) { + /* for extended PLT entries, we keep the old code */ + + distance = (Elf_Addr)pltcall - (Elf_Addr)(wherep + 1); - /* li r11,reloff */ - /* b pltcall # use indirect pltcall routine */ - wherep[0] = 0x39600000 | reloff; - wherep[1] = 0x48000000 | (distance & 0x03fffffc); - __syncicache(wherep, 8); + /* li r11,reloff */ + /* b pltcall # use indirect pltcall routine */ + wherep[0] = 0x39600000 | reloff; + wherep[1] = 0x48000000 | (distance & 0x03fffffc); + __syncicache(wherep, 8); + } } return (target); @@ -481,13 +506,14 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr /* * Setup the plt glue routines. */ -#define PLTCALL_SIZE 20 -#define PLTRESOLVE_SIZE 24 +#define PLTCALL_SIZE 20 +#define PLTLONGRESOLVE_SIZE 20 +#define PLTRESOLVE_SIZE 24 void init_pltgot(Obj_Entry *obj) { - Elf_Word *pltcall, *pltresolve; + Elf_Word *pltcall, *pltresolve, *pltlongresolve; Elf_Word *jmptab; int N = obj->pltrelasize / sizeof(Elf_Rela); @@ -524,18 +550,27 @@ init_pltgot(Obj_Entry *obj) * of the jumptable into the absolute-call assembler code so it * can determine this address. */ - jmptab = pltcall + 18 + N * 2; + jmptab = obj->pltgot + JMPTAB_BASE(N); pltcall[1] |= _ppc_ha(jmptab); /* addis 11,11,jmptab@ha */ pltcall[2] |= _ppc_la(jmptab); /* lwz 11,jmptab@l(11) */ /* - * Skip down 32 bytes into the initial reserved area and copy + * Skip down 20 bytes into the initial reserved area and copy * in the standard resolving assembler call. Into this assembler, * insert the absolute address of the _rtld_bind_start routine * and the address of the relocation object. + * + * We place pltlongresolve first, so it can fix up its arguments + * and then fall through to the regular PLT resolver. */ - pltresolve = obj->pltgot + 8; + pltlongresolve = obj->pltgot + 5; + + memcpy(pltlongresolve, _rtld_powerpc_pltlongresolve, + PLTLONGRESOLVE_SIZE); + pltlongresolve[0] |= _ppc_ha(jmptab); /* lis 12,jmptab@ha */ + pltlongresolve[1] |= _ppc_la(jmptab); /* addi 12,12,jmptab@l */ + pltresolve = pltlongresolve + PLTLONGRESOLVE_SIZE/sizeof(uint32_t); memcpy(pltresolve, _rtld_powerpc_pltresolve, PLTRESOLVE_SIZE); pltresolve[0] |= _ppc_ha(_rtld_bind_start); pltresolve[1] |= _ppc_la(_rtld_bind_start); Modified: stable/8/libexec/rtld-elf/powerpc/rtld_machdep.h ============================================================================== --- stable/8/libexec/rtld-elf/powerpc/rtld_machdep.h Sat Mar 20 15:27:01 2010 (r205382) +++ stable/8/libexec/rtld-elf/powerpc/rtld_machdep.h Sat Mar 20 15:28:39 2010 (r205383) @@ -57,6 +57,7 @@ void _rtld_bind_start(void); * PLT functions. Not really correct prototypes, but the * symbol values are needed. */ +void _rtld_powerpc_pltlongresolve(void); void _rtld_powerpc_pltresolve(void); void _rtld_powerpc_pltcall(void); Modified: stable/8/libexec/rtld-elf/powerpc/rtld_start.S ============================================================================== --- stable/8/libexec/rtld-elf/powerpc/rtld_start.S Sat Mar 20 15:27:01 2010 (r205382) +++ stable/8/libexec/rtld-elf/powerpc/rtld_start.S Sat Mar 20 15:28:39 2010 (r205383) @@ -163,6 +163,12 @@ _ENTRY(_rtld_bind_start) * The ELF object is shifted into %r11, and _rtld_bind_start is called * to complete the binding. */ +_ENTRY(_rtld_powerpc_pltlongresolve) + lis %r12,0 # lis 12,jmptab@ha + addi %r12,%r12,0 # addi 12,12,jmptab@l + subf %r11,%r12,%r11 # reloff + li %r12,2 + srw %r11,%r11,%r12 # index = reloff/sizeof(Elf_Addr) _ENTRY(_rtld_powerpc_pltresolve) lis %r12,0 # lis 12,_rtld_bind_start@ha addi %r12,%r12,0 # addi 12,12,_rtld_bind_start@l From owner-svn-src-stable@FreeBSD.ORG Sat Mar 20 16:33:56 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26CFC106564A; Sat, 20 Mar 2010 16:33:56 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from adsum.doit.wisc.edu (adsum.doit.wisc.edu [144.92.197.210]) by mx1.freebsd.org (Postfix) with ESMTP id ED1B28FC15; Sat, 20 Mar 2010 16:33:55 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth1.wiscmail.wisc.edu by smtpauth1.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0KZL0040078G7400@smtpauth1.wiscmail.wisc.edu>; Sat, 20 Mar 2010 10:33:52 -0500 (CDT) Received: from comporellon.tachypleus.net (adsl-76-208-68-235.dsl.mdsnwi.sbcglobal.net [76.208.68.235]) by smtpauth1.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0KZL00AQ278EDY50@smtpauth1.wiscmail.wisc.edu>; Sat, 20 Mar 2010 10:33:51 -0500 (CDT) Date: Sat, 20 Mar 2010 10:33:49 -0500 From: Nathan Whitehorn In-reply-to: <201003201505.o2KF5iX2007024@svn.freebsd.org> To: Nathan Whitehorn Message-id: <4BA4EADD.9030606@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=76.208.68.235 X-Spam-PmxInfo: Server=avs-14, Version=5.5.5.374460, Antispam-Engine: 2.7.1.369594, Antispam-Data: 2010.3.20.152725, SenderIP=76.208.68.235 References: <201003201505.o2KF5iX2007024@svn.freebsd.org> User-Agent: Thunderbird 2.0.0.23 (X11/20100206) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r205377 - stable/8/sys/powerpc/aim X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2010 16:33:56 -0000 Nathan Whitehorn wrote: > Author: nwhitehorn > Date: Sat Mar 20 15:05:44 2010 > New Revision: 205377 > URL: http://svn.freebsd.org/changeset/base/205377 > > Log: > Fix a bug where pages being removed from memory entirely no longer have > PVOs, and so the modified state of the page can no longer be communicated > to the VM layer, causing pages not to be flushed to swap when needed, in > turn causing memory corruption. Also make several correctness adjustments > to I-Cache synchronization and TLB invalidation for 64-bit Book-S CPUs. > This was an MFC of r204042. -Nathan From owner-svn-src-stable@FreeBSD.ORG Sat Mar 20 23:50:56 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51F8D106564A; Sat, 20 Mar 2010 23:50:56 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40B5E8FC08; Sat, 20 Mar 2010 23:50:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2KNouN2024607; Sat, 20 Mar 2010 23:50:56 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2KNouvH024605; Sat, 20 Mar 2010 23:50:56 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201003202350.o2KNouvH024605@svn.freebsd.org> From: Ken Smith Date: Sat, 20 Mar 2010 23:50: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: r205400 - stable/7 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2010 23:50:56 -0000 Author: kensmith Date: Sat Mar 20 23:50:55 2010 New Revision: 205400 URL: http://svn.freebsd.org/changeset/base/205400 Log: Guess at the date the 7.3-RELEASE builds will be finished and everything will be in place for the announcement. Modified: stable/7/UPDATING Modified: stable/7/UPDATING ============================================================================== --- stable/7/UPDATING Sat Mar 20 23:00:43 2010 (r205399) +++ stable/7/UPDATING Sat Mar 20 23:50:55 2010 (r205400) @@ -8,6 +8,9 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20100323: + FreeBSD 7.3-RELEASE + 20091129: PECOFF image activator support removed.