From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 00:13:25 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7E501065673; Sun, 23 Nov 2008 00:13:25 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B39308FC14; Sun, 23 Nov 2008 00:13:25 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAN0DPgm033135; Sun, 23 Nov 2008 00:13:25 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAN0DPs5033133; Sun, 23 Nov 2008 00:13:25 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200811230013.mAN0DPs5033133@svn.freebsd.org> From: Kip Macy Date: Sun, 23 Nov 2008 00:13:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185191 - head/sys/dev/cxgb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 00:13:25 -0000 Author: kmacy Date: Sun Nov 23 00:13:25 2008 New Revision: 185191 URL: http://svn.freebsd.org/changeset/base/185191 Log: intr_machdep.h breaks build on some arches and is not needed Modified: head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Sat Nov 22 23:48:33 2008 (r185190) +++ head/sys/dev/cxgb/cxgb_main.c Sun Nov 23 00:13:25 2008 (r185191) @@ -82,10 +82,6 @@ __FBSDID("$FreeBSD$"); #include #endif -#ifdef IFNET_MULTIQUEUE -#include -#endif - static int cxgb_setup_msix(adapter_t *, int); static void cxgb_teardown_msix(adapter_t *); static void cxgb_init(void *); From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 00:16:10 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90CDD1065670; Sun, 23 Nov 2008 00:16:10 +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 7B6228FC0C; Sun, 23 Nov 2008 00:16:10 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAN0GAKX033235; Sun, 23 Nov 2008 00:16:10 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAN0GA7x033233; Sun, 23 Nov 2008 00:16:10 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811230016.mAN0GA7x033233@svn.freebsd.org> From: Xin LI Date: Sun, 23 Nov 2008 00:16:10 +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: r185192 - in stable/7/sbin/geom: . class/part misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 00:16:10 -0000 Author: delphij Date: Sun Nov 23 00:16:10 2008 New Revision: 185192 URL: http://svn.freebsd.org/changeset/base/185192 Log: MFC r185038,185044,185046: Automatically pad gptboot, style for include files, use humanize_number() for consistency and reduce code duplication. Approved by: re (kib) Modified: stable/7/sbin/geom/ (props changed) stable/7/sbin/geom/class/part/ (props changed) stable/7/sbin/geom/class/part/Makefile stable/7/sbin/geom/class/part/geom_part.c stable/7/sbin/geom/misc/ (props changed) Modified: stable/7/sbin/geom/class/part/Makefile ============================================================================== --- stable/7/sbin/geom/class/part/Makefile Sun Nov 23 00:13:25 2008 (r185191) +++ stable/7/sbin/geom/class/part/Makefile Sun Nov 23 00:16:10 2008 (r185192) @@ -4,6 +4,8 @@ CLASS= part +LDADD= -lutil + WARNS?= 4 .include Modified: stable/7/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/7/sbin/geom/class/part/geom_part.c Sun Nov 23 00:13:25 2008 (r185191) +++ stable/7/sbin/geom/class/part/geom_part.c Sun Nov 23 00:16:10 2008 (r185192) @@ -27,19 +27,21 @@ #include __FBSDID("$FreeBSD$"); -#include -#include -#include -#include +#include + +#include #include +#include #include -#include -#include #include +#include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include "core/geom.h" #include "misc/subr.h" @@ -202,21 +204,12 @@ find_provider(struct ggeom *gp, unsigned } static const char * -fmtsize(long double rawsz) +fmtsize(int64_t rawsz) { - static char buf[32]; - static const char *sfx[] = { "B", "KB", "MB", "GB", "TB" }; - long double sz; - int sfxidx; - - sfxidx = 0; - sz = (long double)rawsz; - while (sfxidx < 4 && sz > 1099.0) { - sz /= 1000; - sfxidx++; - } + static char buf[5]; - sprintf(buf, "%.1Lf%s", sz, sfx[sfxidx]); + humanize_number(buf, sizeof(buf), rawsz, "", HN_AUTOSCALE, + HN_B | HN_NOSPACE | HN_DECIMAL); return (buf); } @@ -386,6 +379,8 @@ gpart_write_partcode(struct gctl_req *re struct ggeom *gp; struct gprovider *pp; const char *s; + char *buf; + off_t bsize; int error, fd; s = gctl_get_ascii(req, "class"); @@ -421,8 +416,21 @@ gpart_write_partcode(struct gctl_req *re errx(EXIT_FAILURE, "%s: not enough space", dsf); if (lseek(fd, 0, SEEK_SET) != 0) err(EXIT_FAILURE, "%s", dsf); - if (write(fd, code, size) != size) + + /* + * When writing to a disk device, the write must be + * sector aligned and not write to any partial sectors, + * so round up the buffer size to the next sector and zero it. + */ + bsize = (size + pp->lg_sectorsize - 1) / + pp->lg_sectorsize * pp->lg_sectorsize; + buf = calloc(1, bsize); + if (buf == NULL) + err(EXIT_FAILURE, "%s", dsf); + bcopy(code, buf, size); + if (write(fd, buf, bsize) != bsize) err(EXIT_FAILURE, "%s", dsf); + free(buf); close(fd); } else errx(EXIT_FAILURE, "invalid partition index"); From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 00:20:51 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA2941065673; Sun, 23 Nov 2008 00:20:51 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A705B8FC14; Sun, 23 Nov 2008 00:20:51 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAN0KpPZ033358; Sun, 23 Nov 2008 00:20:51 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAN0KpYQ033357; Sun, 23 Nov 2008 00:20:51 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200811230020.mAN0KpYQ033357@svn.freebsd.org> From: Kip Macy Date: Sun, 23 Nov 2008 00:20:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185193 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 00:20:51 -0000 Author: kmacy Date: Sun Nov 23 00:20:51 2008 New Revision: 185193 URL: http://svn.freebsd.org/changeset/base/185193 Log: buf_ring_peek should return NULL if the ring is empty rather than whatever happened to be at cons_tail last time it was in use Modified: head/sys/sys/buf_ring.h Modified: head/sys/sys/buf_ring.h ============================================================================== --- head/sys/sys/buf_ring.h Sun Nov 23 00:16:10 2008 (r185192) +++ head/sys/sys/buf_ring.h Sun Nov 23 00:20:51 2008 (r185193) @@ -216,7 +216,10 @@ buf_ring_peek(struct buf_ring *br) panic("lock not held on single consumer dequeue"); #endif mb(); - return (br->br_ring[br->br_cons_tail]); + if (br->br_cons_head == br->br_prod_tail) + return (NULL); + + return (br->br_ring[br->br_cons_head]); } static __inline int From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 00:22:53 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2654B1065670; Sun, 23 Nov 2008 00:22:53 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 137CA8FC1A; Sun, 23 Nov 2008 00:22:53 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAN0Mqfl033442; Sun, 23 Nov 2008 00:22:52 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAN0MqFc033441; Sun, 23 Nov 2008 00:22:52 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200811230022.mAN0MqFc033441@svn.freebsd.org> From: Kip Macy Date: Sun, 23 Nov 2008 00:22:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185194 - head/sys/dev/cxgb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 00:22:53 -0000 Author: kmacy Date: Sun Nov 23 00:22:52 2008 New Revision: 185194 URL: http://svn.freebsd.org/changeset/base/185194 Log: work around periodic leak on queue overrun by enabling coalescing of packets in to work requests by default Modified: head/sys/dev/cxgb/cxgb_multiq.c Modified: head/sys/dev/cxgb/cxgb_multiq.c ============================================================================== --- head/sys/dev/cxgb/cxgb_multiq.c Sun Nov 23 00:20:51 2008 (r185193) +++ head/sys/dev/cxgb/cxgb_multiq.c Sun Nov 23 00:22:52 2008 (r185194) @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); extern int txq_fills; int multiq_tx_enable = 1; -int coalesce_tx_enable = 0; +int coalesce_tx_enable = 1; int wakeup_tx_thread = 0; extern struct sysctl_oid_list sysctl__hw_cxgb_children; From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 00:51:59 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A920D1065675 for ; Sun, 23 Nov 2008 00:51:59 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.239]) by mx1.freebsd.org (Postfix) with ESMTP id 3B58A8FC17 for ; Sun, 23 Nov 2008 00:51:59 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so1486623rvf.43 for ; Sat, 22 Nov 2008 16:51:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=lKEAw7e8JqSm0WAUsuKXP9fzu/HHRKJn1a+Yi3sL0uE=; b=MgT8tWQpD3YpYumh50OhEzjBajLSQzVn81QZZ0QTXhymv66u6c5azMXth7Sc6j3Ty/ K0zT532g7ukm3rCSUecIaByYouG/ttuTyFBL/Tlo1nloSNQii9+FC4Tqhkb+26Q1zBLT p/kjocBv/N27LKZ49BH1+B0VkvQ7VKd3/DnDE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=c1hcx4yi+Cj0Chu7sVieD/6wfT9k5BguBM9a+6/XH7vKWMqjI6hHy4kSMthL9/Eekx psebW4LW4Ik19+oym7jUOrneVR1yw77m8fCPMT1U3LIcJ5htxy98RvZMqshbCUpCWSz9 1PK5sQLJbkbvOehAdjARKexeN1Gm8bbL6EbBc= Received: by 10.140.226.13 with SMTP id y13mr1080583rvg.93.1227401518818; Sat, 22 Nov 2008 16:51:58 -0800 (PST) Received: by 10.141.153.21 with HTTP; Sat, 22 Nov 2008 16:51:58 -0800 (PST) Message-ID: <3c1674c90811221651u338294frcdbd99b386733851@mail.gmail.com> Date: Sun, 23 Nov 2008 00:51:58 +0000 From: "Kip Macy" Sender: mat.macy@gmail.com To: "Scott Long" In-Reply-To: <4928910B.1020403@samsco.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811220555.mAM5tuIJ007781@svn.freebsd.org> <20081122112949.GA6408@deviant.kiev.zoral.com.ua> <3c1674c90811221326m41e229f7p6abbc0eb473e900e@mail.gmail.com> <49288222.5060205@samsco.org> <20081122221953.GO6408@deviant.kiev.zoral.com.ua> <4928910B.1020403@samsco.org> X-Google-Sender-Auth: 59032d0dbbefb2b4 Cc: Kostik Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185162 - in head: . sys/amd64/include sys/arm/include sys/conf sys/dev/bce sys/dev/cxgb sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/mxge sys/dev/nxge sys/i386/include sys/i386/in... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 00:51:59 -0000 On Sat, Nov 22, 2008 at 11:08 PM, Scott Long wrote: > Kostik Belousov wrote: >> >> On Sat, Nov 22, 2008 at 03:05:22PM -0700, Scott Long wrote: >>> >>> A neat hack would be for the kernel linker to scan the text and do a >>> drop-in replacement of the opcode that is appropriate for the platform. >>> I can't see how a CPU_XXX definition would work because it's just a >>> compile time construct, one that can be included with any kernel >>> compile. >> >> Yes, it is possible to do that. Less drastic change is to directly >> check features. I moved slow code to separate section to eliminate >> unconditional jump in fast path. >> Only compile-tested. >> > > As long as it works, I think it's a step in the right direction; I'm > assuming that cpu_feature is a symbol filled in at runtime and not a > macro for the cpuid instruction, right? > > Scott > i386/include/md_var.h: <..> extern u_int cpu_exthigh; extern u_int cpu_feature; extern u_int cpu_feature2; extern u_int amd_feature; extern u_int amd_feature2; <...> I'm not thrilled with it, but we can revisit the issue if it makes a measurable difference on someone's workload. Thanks, Kip -- If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 01:51:14 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 626B61065679; Sun, 23 Nov 2008 01:51:14 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56C588FC1F; Sun, 23 Nov 2008 01:51:14 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAN1pE36036578; Sun, 23 Nov 2008 01:51:14 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAN1pEmh036577; Sun, 23 Nov 2008 01:51:14 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200811230151.mAN1pEmh036577@svn.freebsd.org> From: Sam Leffler Date: Sun, 23 Nov 2008 01:51:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185197 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 01:51:14 -0000 Author: sam Date: Sun Nov 23 01:51:14 2008 New Revision: 185197 URL: http://svn.freebsd.org/changeset/base/185197 Log: correct sorting Modified: head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Sun Nov 23 00:27:16 2008 (r185196) +++ head/sys/net80211/ieee80211_var.h Sun Nov 23 01:51:14 2008 (r185197) @@ -478,9 +478,9 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_FEXT_TSN 0x00000020 /* CONF: TSN enabled */ #define IEEE80211_FEXT_SCANREQ 0x00000040 /* STATUS: scan req params */ #define IEEE80211_FEXT_RESUME 0x00000080 /* STATUS: start on resume */ -#define IEEE80211_FEXT_DFS 0x00000800 /* CONF: DFS enabled */ #define IEEE80211_FEXT_NONERP_PR 0x00000200 /* STATUS: non-ERP sta present*/ #define IEEE80211_FEXT_SWBMISS 0x00000400 /* CONF: do bmiss in s/w */ +#define IEEE80211_FEXT_DFS 0x00000800 /* CONF: DFS enabled */ #define IEEE80211_FEXT_DOTD 0x00001000 /* CONF: 11d enabled */ /* NB: immutable: should be set only when creating a vap */ #define IEEE80211_FEXT_WDSLEGACY 0x00010000 /* CONF: legacy WDS operation */ From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 07:30:08 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 650FC1065672; Sun, 23 Nov 2008 07:30:08 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E5438FC0A; Sun, 23 Nov 2008 07:30:08 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAN7U8ga043933; Sun, 23 Nov 2008 07:30:08 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAN7U8fN043930; Sun, 23 Nov 2008 07:30:08 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200811230730.mAN7U8fN043930@svn.freebsd.org> From: Kip Macy Date: Sun, 23 Nov 2008 07:30:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185199 - head/sys/dev/cxgb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 07:30:08 -0000 Author: kmacy Date: Sun Nov 23 07:30:07 2008 New Revision: 185199 URL: http://svn.freebsd.org/changeset/base/185199 Log: Add backward compatibility ifdefs for non-multiq kernels Modified: head/sys/dev/cxgb/cxgb_config.h head/sys/dev/cxgb/cxgb_main.c head/sys/dev/cxgb/cxgb_osdep.h Modified: head/sys/dev/cxgb/cxgb_config.h ============================================================================== --- head/sys/dev/cxgb/cxgb_config.h Sun Nov 23 05:39:49 2008 (r185198) +++ head/sys/dev/cxgb/cxgb_config.h Sun Nov 23 07:30:07 2008 (r185199) @@ -33,6 +33,8 @@ $FreeBSD$ #define _CXGB_CONFIG_H_ #define CONFIG_CHELSIO_T3_CORE -#define IFNET_MULTIQUEUE +#if __FreeBSD_version > 800053 +#define IFNET_MULTIQUEUE +#endif #endif Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Sun Nov 23 05:39:49 2008 (r185198) +++ head/sys/dev/cxgb/cxgb_main.c Sun Nov 23 07:30:07 2008 (r185199) @@ -946,8 +946,9 @@ cxgb_port_attach(device_t dev) } ether_ifattach(ifp, p->hw_addr); - +#ifdef IFNET_MULTIQUEUE ifp->if_transmit = cxgb_pcpu_transmit; +#endif /* * Only default to jumbo frames on 10GigE */ Modified: head/sys/dev/cxgb/cxgb_osdep.h ============================================================================== --- head/sys/dev/cxgb/cxgb_osdep.h Sun Nov 23 05:39:49 2008 (r185198) +++ head/sys/dev/cxgb/cxgb_osdep.h Sun Nov 23 07:30:07 2008 (r185199) @@ -117,6 +117,30 @@ struct t3_mbuf_hdr { #define TOE_SUPPORTED #endif +#if __FreeBSD_version < 800054 +#if defined (__GNUC__) + #if #cpu(i386) || defined __i386 || defined i386 || defined __i386__ || #cpu(x86_64) || defined __x86_64__ + #define mb() __asm__ __volatile__ ("mfence;": : :"memory") + #define wmb() __asm__ __volatile__ ("sfence;": : :"memory") + #define rmb() __asm__ __volatile__ ("lfence;": : :"memory") + #elif #cpu(sparc64) || defined sparc64 || defined __sparcv9 + #define mb() __asm__ __volatile__ ("membar #MemIssue": : :"memory") + #define wmb() mb() + #define rmb() mb() + #elif #cpu(sparc) || defined sparc || defined __sparc__ + #define mb() __asm__ __volatile__ ("stbar;": : :"memory") + #define wmb() mb() + #define rmb() mb() +#else + #define wmb() mb() + #define rmb() mb() + #define mb() /* XXX just to make this compile */ + #endif +#else + #error "unknown compiler" +#endif +#endif + #define __read_mostly __attribute__((__section__(".data.read_mostly"))) /* From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 10:39:16 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B63B1065670 for ; Sun, 23 Nov 2008 10:39:16 +0000 (UTC) (envelope-from softsearch@gmail.com) Received: from mail-ew0-f21.google.com (mail-ew0-f21.google.com [209.85.219.21]) by mx1.freebsd.org (Postfix) with ESMTP id 0C7658FC1D for ; Sun, 23 Nov 2008 10:39:15 +0000 (UTC) (envelope-from softsearch@gmail.com) Received: by ewy14 with SMTP id 14so44418ewy.19 for ; Sun, 23 Nov 2008 02:39:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:reply-to :organization:x-priority:message-id:to:cc:subject:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=1h8ikFPDHp6aH5davQLjYSx6sD52xSJOiHOIWf6n4Hc=; b=kFN6jYmeWETZeVQIh37zqMQKg4pLidm+il9zL7aeptvWfZUF4tABfiyJqCBjpHc95L 1j+qV8Wwygq4tp7SWdhuFBCpyke2YeCqAUkysNu92+DHVKYrR38I7nnvtMXeBSlFNfV8 2hRryY+2VwE4knChojiGqSVYn4f7he3yLc2II= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:reply-to:organization:x-priority:message-id:to:cc:subject :in-reply-to:references:mime-version:content-type :content-transfer-encoding; b=vPpb3h7lniQEG/QYgDRjv7wg88mXqfOeO/MDZfJd1DBgeyKOTolYdPRXAalb40dtya FD4iRPAFKXgnxuigfaGlgrzbSTNApfQJhmUWl9QWi3WUVLGwFaTEAYYXiFoX/dMAAzAt 1X6vmsmes7HHRQA+DSptIvs9Dq4qN5Ni/eqZw= Received: by 10.210.128.5 with SMTP id a5mr2525258ebd.30.1227435356493; Sun, 23 Nov 2008 02:15:56 -0800 (PST) Received: from ?192.168.1.100? ([81.200.127.6]) by mx.google.com with ESMTPS id 7sm1735918eyb.44.2008.11.23.02.15.54 (version=SSLv3 cipher=OTHER); Sun, 23 Nov 2008 02:15:55 -0800 (PST) Date: Sun, 23 Nov 2008 13:15:54 +0300 From: Michael Monashev Organization: SoftSearch.ru X-Priority: 3 (Normal) Message-ID: <1195578581.20081123131554@gmail.com> To: Konstantin Belousov In-Reply-To: <200811222108.mAML8P10029225@svn.freebsd.org> References: <200811222108.mAML8P10029225@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=Windows-1251 Content-Transfer-Encoding: 8bit Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r185185 - stable/7 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Michael Monashev List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 10:39:16 -0000 Hi. "/usr/src/Makefile.inc1", line 675: warning: Missing closing parenthesis for exists() KB> +.if ${MK_KERBEROS} != "no" KB> + cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} KB> +.endif -- Michael From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 12:34:38 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1658D1065672; Sun, 23 Nov 2008 12:34:38 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from publicd.ub.mng.net (publicd.ub.mng.net [202.179.0.88]) by mx1.freebsd.org (Postfix) with ESMTP id C6C858FC0C; Sun, 23 Nov 2008 12:34:37 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from [202.179.21.135] (helo=devil.micom.mng.net) by publicd.ub.mng.net with esmtpa (Exim 4.69 (FreeBSD)) (envelope-from ) id 1L4DnQ-0006l7-7R; Sun, 23 Nov 2008 20:10:36 +0800 Message-ID: <4929483B.9070404@micom.mng.net> Date: Sun, 23 Nov 2008 20:10:35 +0800 From: Ganbold User-Agent: Thunderbird 2.0.0.17 (X11/20081020) MIME-Version: 1.0 To: Alexander Motin References: <200811221655.mAMGttpJ023528@svn.freebsd.org> In-Reply-To: <200811221655.mAMGttpJ023528@svn.freebsd.org> X-Enigmail-Version: 0.95.7 OpenPGP: id=78F6425E Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185183 - head/sys/netgraph X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 12:34:38 -0000 Alexander Motin wrote: > Author: mav > Date: Sat Nov 22 16:55:55 2008 > New Revision: 185183 > URL: http://svn.freebsd.org/changeset/base/185183 > > Log: > Remove unused variable. > > Found with: Coverity Prevent(tm) > CID: 3682 > > Modified: > head/sys/netgraph/ng_socket.c > > Modified: head/sys/netgraph/ng_socket.c > ============================================================================== > --- head/sys/netgraph/ng_socket.c Sat Nov 22 16:40:12 2008 (r185182) > +++ head/sys/netgraph/ng_socket.c Sat Nov 22 16:55:55 2008 (r185183) > @@ -259,9 +259,8 @@ ngc_send(struct socket *so, int flags, s > if (msg->header.typecookie == NGM_GENERIC_COOKIE && > msg->header.cmd == NGM_MKPEER) { > struct ngm_mkpeer *const mkp = (struct ngm_mkpeer *) msg->data; > - struct ng_type *type; > > - if ((type = ng_findtype(mkp->type)) == NULL) { > + if (ng_findtype(mkp->type) == NULL) { > char filename[NG_TYPESIZ + 3]; > int fileid; > > @@ -275,7 +274,7 @@ ngc_send(struct socket *so, int flags, s > } > > /* See if type has been loaded successfully. */ > - if ((type = ng_findtype(mkp->type)) == NULL) { > + if (ng_findtype(mkp->type) == NULL) { > free(msg, M_NETGRAPH_MSG); > (void)kern_kldunload(curthread, fileid, > LINKER_UNLOAD_NORMAL); > Thanks, what a coincident :) I have sent exactly same patch to rwatson@ and glebius@ yesterday night :) Ganbold > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > > > > -- Old Grandad is dead but his spirits live on. From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 13:03:44 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79789106564A; Sun, 23 Nov 2008 13:03:44 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E8B38FC08; Sun, 23 Nov 2008 13:03:44 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAND3iqS052238; Sun, 23 Nov 2008 13:03:44 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAND3iIV052236; Sun, 23 Nov 2008 13:03:44 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811231303.mAND3iIV052236@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Nov 2008 13:03:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185200 - head/bin/df X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 13:03:44 -0000 Author: pjd Date: Sun Nov 23 13:03:44 2008 New Revision: 185200 URL: http://svn.freebsd.org/changeset/base/185200 Log: Implement -T option as found in Linux df(1). When given, file system type will be included in output. Reviewed and tested by: keramida MFC after: 2 weeks Modified: head/bin/df/df.1 head/bin/df/df.c Modified: head/bin/df/df.1 ============================================================================== --- head/bin/df/df.1 Sun Nov 23 07:30:07 2008 (r185199) +++ head/bin/df/df.1 Sun Nov 23 13:03:44 2008 (r185200) @@ -29,7 +29,7 @@ .\" @(#)df.1 8.3 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd April 22, 2004 +.Dd November 23, 2008 .Dt DF 1 .Os .Sh NAME @@ -38,7 +38,7 @@ .Sh SYNOPSIS .Nm .Op Fl b | g | H | h | k | m | P -.Op Fl aciln +.Op Fl acilnT .Op Fl t Ar type .Op Ar file | filesystem ... .Sh DESCRIPTION @@ -140,6 +140,8 @@ The .Xr lsvfs 1 command can be used to find out the types of file systems that are available on the system. +.It Fl T +Include file system type. .El .Sh ENVIRONMENT .Bl -tag -width BLOCKSIZE Modified: head/bin/df/df.c ============================================================================== --- head/bin/df/df.c Sun Nov 23 07:30:07 2008 (r185199) +++ head/bin/df/df.c Sun Nov 23 13:03:44 2008 (r185200) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); /* Maximum widths of various fields. */ struct maxwidths { int mntfrom; + int fstype; int total; int used; int avail; @@ -93,7 +94,7 @@ imax(int a, int b) return (a > b ? a : b); } -static int aflag = 0, cflag, hflag, iflag, kflag, lflag = 0, nflag; +static int aflag = 0, cflag, hflag, iflag, kflag, lflag = 0, nflag, Tflag; static struct ufs_args mdev; int @@ -115,7 +116,7 @@ main(int argc, char *argv[]) totalbuf.f_bsize = DEV_BSIZE; strlcpy(totalbuf.f_mntfromname, "total", MNAMELEN); vfslist = NULL; - while ((ch = getopt(argc, argv, "abcgHhiklmnPt:")) != -1) + while ((ch = getopt(argc, argv, "abcgHhiklmnPt:T")) != -1) switch (ch) { case 'a': aflag = 1; @@ -176,6 +177,9 @@ main(int argc, char *argv[]) fstype = optarg; vfslist = makevfslist(optarg); break; + case 'T': + Tflag = 1; + break; case '?': default: usage(); @@ -391,6 +395,7 @@ prtstat(struct statfs *sfsp, struct maxw if (++timesthrough == 1) { mwp->mntfrom = imax(mwp->mntfrom, (int)strlen("Filesystem")); + mwp->fstype = imax(mwp->fstype, (int)strlen("Type")); if (hflag) { header = " Size"; mwp->total = mwp->used = mwp->avail = @@ -402,8 +407,10 @@ prtstat(struct statfs *sfsp, struct maxw mwp->used = imax(mwp->used, (int)strlen("Used")); mwp->avail = imax(mwp->avail, (int)strlen("Avail")); - (void)printf("%-*s %-*s %*s %*s Capacity", - mwp->mntfrom, "Filesystem", mwp->total, header, + (void)printf("%-*s", mwp->mntfrom, "Filesystem"); + if (Tflag) + (void)printf(" %-*s", mwp->fstype, "Type"); + (void)printf(" %-*s %*s %*s Capacity", mwp->total, header, mwp->used, "Used", mwp->avail, "Avail"); if (iflag) { mwp->iused = imax(mwp->iused, (int)strlen(" iused")); @@ -414,6 +421,8 @@ prtstat(struct statfs *sfsp, struct maxw (void)printf(" Mounted on\n"); } (void)printf("%-*s", mwp->mntfrom, sfsp->f_mntfromname); + if (Tflag) + (void)printf(" %-*s", mwp->fstype, sfsp->f_fstypename); used = sfsp->f_blocks - sfsp->f_bfree; availblks = sfsp->f_bavail + used; if (hflag) { @@ -468,6 +477,7 @@ update_maxwidths(struct maxwidths *mwp, getbsize(&dummy, &blocksize); mwp->mntfrom = imax(mwp->mntfrom, (int)strlen(sfsp->f_mntfromname)); + mwp->fstype = imax(mwp->fstype, (int)strlen(sfsp->f_fstypename)); mwp->total = imax(mwp->total, int64width( fsbtoblk((int64_t)sfsp->f_blocks, sfsp->f_bsize, blocksize))); mwp->used = imax(mwp->used, @@ -505,7 +515,7 @@ usage(void) { (void)fprintf(stderr, -"usage: df [-b | -g | -H | -h | -k | -m | -P] [-aciln] [-t type] [file | filesystem ...]\n"); +"usage: df [-b | -g | -H | -h | -k | -m | -P] [-acilnT] [-t type] [file | filesystem ...]\n"); exit(EX_USAGE); } From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 14:02:06 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2D991065677; Sun, 23 Nov 2008 14:02:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5E698FC1A; Sun, 23 Nov 2008 14:02:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANE268j053595; Sun, 23 Nov 2008 14:02:06 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANE26bB053594; Sun, 23 Nov 2008 14:02:06 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811231402.mANE26bB053594@svn.freebsd.org> From: Alexander Motin Date: Sun, 23 Nov 2008 14:02:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185201 - head/sys/dev/mmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 14:02:06 -0000 Author: mav Date: Sun Nov 23 14:02:06 2008 New Revision: 185201 URL: http://svn.freebsd.org/changeset/base/185201 Log: Improve detach handling: close races, flush queue. Modified: head/sys/dev/mmc/mmcsd.c Modified: head/sys/dev/mmc/mmcsd.c ============================================================================== --- head/sys/dev/mmc/mmcsd.c Sun Nov 23 13:03:44 2008 (r185200) +++ head/sys/dev/mmc/mmcsd.c Sun Nov 23 14:02:06 2008 (r185201) @@ -184,9 +184,10 @@ mmcsd_detach(device_t dev) msleep(sc, &sc->sc_mtx, PRIBIO, "detach", 0); MMCSD_UNLOCK(sc); + /* Flush the request queue. */ + bioq_flush(&sc->bio_queue, NULL, ENXIO); /* kill disk */ disk_destroy(sc->disk); - /* XXX destroy anything in queue */ MMCSD_LOCK_DESTROY(sc); @@ -212,9 +213,14 @@ mmcsd_strategy(struct bio *bp) sc = (struct mmcsd_softc *)bp->bio_disk->d_drv1; MMCSD_LOCK(sc); - bioq_disksort(&sc->bio_queue, bp); - wakeup(sc); - MMCSD_UNLOCK(sc); + if (sc->running > 0) { + bioq_disksort(&sc->bio_queue, bp); + wakeup(sc); + MMCSD_UNLOCK(sc); + } else { + MMCSD_UNLOCK(sc); + biofinish(bp, NULL, ENXIO); + } } static daddr_t @@ -380,18 +386,16 @@ mmcsd_task(void *arg) device_t dev; dev = sc->dev; - while (sc->running) { + while (1) { MMCSD_LOCK(sc); do { - bp = bioq_first(&sc->bio_queue); + if (sc->running == 0) + goto out; + bp = bioq_takefirst(&sc->bio_queue); if (bp == NULL) msleep(sc, &sc->sc_mtx, PRIBIO, "jobqueue", 0); - } while (bp == NULL && sc->running); - if (bp) - bioq_remove(&sc->bio_queue, bp); + } while (bp == NULL); MMCSD_UNLOCK(sc); - if (!sc->running) - break; if (bp->bio_cmd != BIO_READ && mmc_get_read_only(dev)) { bp->bio_error = EROFS; bp->bio_resid = bp->bio_bcount; @@ -419,9 +423,8 @@ mmcsd_task(void *arg) } biodone(bp); } - +out: /* tell parent we're done */ - MMCSD_LOCK(sc); sc->running = -1; wakeup(sc); MMCSD_UNLOCK(sc); From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 14:32:40 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D92C61065670; Sun, 23 Nov 2008 14:32:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF0908FC1A; Sun, 23 Nov 2008 14:32:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANEWeS9054270; Sun, 23 Nov 2008 14:32:40 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANEWeeD054269; Sun, 23 Nov 2008 14:32:40 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811231432.mANEWeeD054269@svn.freebsd.org> From: Alexander Motin Date: Sun, 23 Nov 2008 14:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185202 - head/sys/dev/mmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 14:32:41 -0000 Author: mav Date: Sun Nov 23 14:32:40 2008 New Revision: 185202 URL: http://svn.freebsd.org/changeset/base/185202 Log: Report card erase sector size as disk stripe size. Modified: head/sys/dev/mmc/mmcsd.c Modified: head/sys/dev/mmc/mmcsd.c ============================================================================== --- head/sys/dev/mmc/mmcsd.c Sun Nov 23 14:02:06 2008 (r185201) +++ head/sys/dev/mmc/mmcsd.c Sun Nov 23 14:32:40 2008 (r185202) @@ -135,6 +135,8 @@ mmcsd_attach(device_t dev) d->d_maxsize = 4*1024*1024; /* Maximum defined SD card AU size. */ d->d_sectorsize = mmc_get_sector_size(dev); d->d_mediasize = mmc_get_media_size(dev) * d->d_sectorsize; + d->d_stripeoffset = 0; + d->d_stripesize = mmc_get_erase_sector(dev) * d->d_sectorsize; d->d_unit = device_get_unit(dev); d->d_flags = DISKFLAG_CANDELETE; /* From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 15:41:48 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 130B81065677; Sun, 23 Nov 2008 15:41:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 75E838FC13; Sun, 23 Nov 2008 15:41:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L4H5k-000BRQ-Au; Sun, 23 Nov 2008 17:41:44 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mANFffbe029375 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 23 Nov 2008 17:41:41 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mANFfflW097257; Sun, 23 Nov 2008 17:41:41 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mANFfcmK097255; Sun, 23 Nov 2008 17:41:39 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 23 Nov 2008 17:41:38 +0200 From: Kostik Belousov To: Kip Macy Message-ID: <20081123154138.GS6408@deviant.kiev.zoral.com.ua> References: <200811220555.mAM5tuIJ007781@svn.freebsd.org> <20081122112949.GA6408@deviant.kiev.zoral.com.ua> <3c1674c90811221326m41e229f7p6abbc0eb473e900e@mail.gmail.com> <49288222.5060205@samsco.org> <20081122221953.GO6408@deviant.kiev.zoral.com.ua> <4928910B.1020403@samsco.org> <3c1674c90811221651u338294frcdbd99b386733851@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PkEWctFf+8E2rcii" Content-Disposition: inline In-Reply-To: <3c1674c90811221651u338294frcdbd99b386733851@mail.gmail.com> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L4H5k-000BRQ-Au 78d97c7b57b95958248a240275b3fe44 X-Terabit: YES Cc: svn-src-head@freebsd.org, Scott Long , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r185162 - in head: . sys/amd64/include sys/arm/include sys/conf sys/dev/bce sys/dev/cxgb sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/mxge sys/dev/nxge sys/i386/include sys/i386/in... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 15:41:48 -0000 --PkEWctFf+8E2rcii Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 23, 2008 at 12:51:58AM +0000, Kip Macy wrote: > On Sat, Nov 22, 2008 at 11:08 PM, Scott Long wrote: > > Kostik Belousov wrote: > >> > >> On Sat, Nov 22, 2008 at 03:05:22PM -0700, Scott Long wrote: > >>> > >>> A neat hack would be for the kernel linker to scan the text and do a > >>> drop-in replacement of the opcode that is appropriate for the platfor= m. > >>> I can't see how a CPU_XXX definition would work because it's just a > >>> compile time construct, one that can be included with any kernel > >>> compile. > >> > >> Yes, it is possible to do that. Less drastic change is to directly > >> check features. I moved slow code to separate section to eliminate > >> unconditional jump in fast path. > >> Only compile-tested. > >> > > > > As long as it works, I think it's a step in the right direction; I'm > > assuming that cpu_feature is a symbol filled in at runtime and not a > > macro for the cpuid instruction, right? > > > > Scott > > >=20 > i386/include/md_var.h: > <..> > extern u_int cpu_exthigh; > extern u_int cpu_feature; > extern u_int cpu_feature2; > extern u_int amd_feature; > extern u_int amd_feature2; > <...> >=20 > I'm not thrilled with it, but we can revisit the issue if it makes a > measurable difference on someone's workload. Below is the updated patch. It includes changes made after private comments by bde@ and uses symbolic definitions for the bits in the features words. I thought about accessing a per-CPU word for serialized instruction in the slow path, but decided that it does not beneficial. diff --git a/sys/conf/ldscript.i386 b/sys/conf/ldscript.i386 index a94f32f..49d9636 100644 --- a/sys/conf/ldscript.i386 +++ b/sys/conf/ldscript.i386 @@ -45,6 +45,7 @@ SECTIONS .text : { *(.text) + *(.text.offpath) *(.stub) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) diff --git a/sys/dev/iir/iir.c b/sys/dev/iir/iir.c index cbcb449..a01b685 100644 --- a/sys/dev/iir/iir.c +++ b/sys/dev/iir/iir.c @@ -403,7 +403,7 @@ iir_init(struct gdt_softc *gdt) gdt->oem_name[7]=3D'\0'; } else { /* Old method, based on PCI ID */ - if (gdt->sc_vendor =3D=3D INTEL_VENDOR_ID) + if (gdt->sc_vendor =3D=3D INTEL_VENDOR_ID_IIR) strcpy(gdt->oem_name,"Intel "); else=20 strcpy(gdt->oem_name,"ICP "); @@ -1447,7 +1447,7 @@ iir_action( struct cam_sim *sim, union ccb *ccb ) (bus =3D=3D gdt->sc_virt_bus ? 127 : gdt->sc_bus_id[bus]= ); cpi->base_transfer_speed =3D 3300; strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); - if (gdt->sc_vendor =3D=3D INTEL_VENDOR_ID) + if (gdt->sc_vendor =3D=3D INTEL_VENDOR_ID_IIR) strncpy(cpi->hba_vid, "Intel Corp.", HBA_IDLEN); else strncpy(cpi->hba_vid, "ICP vortex ", HBA_IDLEN); diff --git a/sys/dev/iir/iir.h b/sys/dev/iir/iir.h index dca493d..dbae7d2 100644 --- a/sys/dev/iir/iir.h +++ b/sys/dev/iir/iir.h @@ -63,7 +63,7 @@ #define GDT_DEVICE_ID_MAX 0x2ff #define GDT_DEVICE_ID_NEWRX 0x300 =20 -#define INTEL_VENDOR_ID 0x8086 +#define INTEL_VENDOR_ID_IIR 0x8086 #define INTEL_DEVICE_ID_IIR 0x600 =20 #define GDT_MAXBUS 6 /* XXX Why not 5? */ diff --git a/sys/dev/iir/iir_ctrl.c b/sys/dev/iir/iir_ctrl.c index e5fbac9..2af2aad 100644 --- a/sys/dev/iir/iir_ctrl.c +++ b/sys/dev/iir/iir_ctrl.c @@ -278,7 +278,7 @@ iir_ioctl(struct cdev *dev, u_long cmd, caddr_t cmdarg,= int flags, d_thread_t * return (ENXIO); /* only RP controllers */ p->ext_type =3D 0x6000 | gdt->sc_device; - if (gdt->sc_vendor =3D=3D INTEL_VENDOR_ID) { + if (gdt->sc_vendor =3D=3D INTEL_VENDOR_ID_IIR) { p->oem_id =3D OEM_ID_INTEL; p->type =3D 0xfd; /* new -> subdevice into ext_type */ diff --git a/sys/dev/iir/iir_pci.c b/sys/dev/iir/iir_pci.c index 528b7d7..0f420a1 100644 --- a/sys/dev/iir/iir_pci.c +++ b/sys/dev/iir/iir_pci.c @@ -164,7 +164,7 @@ MODULE_DEPEND(iir, cam, 1, 1, 1); static int iir_pci_probe(device_t dev) { - if (pci_get_vendor(dev) =3D=3D INTEL_VENDOR_ID && + if (pci_get_vendor(dev) =3D=3D INTEL_VENDOR_ID_IIR && pci_get_device(dev) =3D=3D INTEL_DEVICE_ID_IIR) { device_set_desc(dev, "Intel Integrated RAID Controller"); return (BUS_PROBE_DEFAULT); diff --git a/sys/dev/ixgb/if_ixgb.c b/sys/dev/ixgb/if_ixgb.c index c1d6858..df2f51a 100644 --- a/sys/dev/ixgb/if_ixgb.c +++ b/sys/dev/ixgb/if_ixgb.c @@ -72,8 +72,8 @@ char ixgb_copyright[] =3D "Copyright (c) 2001-= 2004 Intel Corporation."; static ixgb_vendor_info_t ixgb_vendor_info_array[] =3D { /* Intel(R) PRO/10000 Network Connection */ - {INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX, PCI_ANY_ID, PCI_ANY_ID, 0}, - {INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX_SR, PCI_ANY_ID, PCI_ANY_ID, 0}, + {INTEL_VENDOR_ID_IXGB, IXGB_DEVICE_ID_82597EX, PCI_ANY_ID, PCI_ANY_ID, 0}, + {INTEL_VENDOR_ID_IXGB, IXGB_DEVICE_ID_82597EX_SR, PCI_ANY_ID, PCI_ANY_ID,= 0}, /* required last entry */ {0, 0, 0, 0, 0} }; diff --git a/sys/dev/ixgb/ixgb_ids.h b/sys/dev/ixgb/ixgb_ids.h index a224f63..aa7dab8 100644 --- a/sys/dev/ixgb/ixgb_ids.h +++ b/sys/dev/ixgb/ixgb_ids.h @@ -40,7 +40,7 @@ ** The Device and Vendor IDs for 10 Gigabit MACs **********************************************************************/ =20 -#define INTEL_VENDOR_ID 0x8086 +#define INTEL_VENDOR_ID_IXGB 0x8086 #define INTEL_SUBVENDOR_ID 0x8086 =20 =20 diff --git a/sys/i386/include/atomic.h b/sys/i386/include/atomic.h index f6bcf0c..dbdc945 100644 --- a/sys/i386/include/atomic.h +++ b/sys/i386/include/atomic.h @@ -32,21 +32,47 @@ #error this file needs sys/cdefs.h as a prerequisite #endif =20 - -#if defined(I686_CPU) -#define mb() __asm__ __volatile__ ("mfence;": : :"memory") -#define wmb() __asm__ __volatile__ ("sfence;": : :"memory") -#define rmb() __asm__ __volatile__ ("lfence;": : :"memory") -#else -/* - * do we need a serializing instruction? - */ -#define mb() -#define wmb() -#define rmb() +#if defined(_KERNEL) +#include +#include +#define mb() __asm __volatile( \ + "testl %0,cpu_feature \n\ + je 2f \n\ + mfence \n\ +1: \n\ + .section .text.offpath \n\ +2: lock \n\ + addl $0,cpu_feature \n\ + jmp 1b \n\ + .text \n\ +" \ + : : "i"(CPUID_SSE2) : "memory") +#define wmb() __asm __volatile( \ + "testl %0,cpu_feature \n\ + je 2f \n\ + sfence \n\ +1: \n\ + .section .text.offpath \n\ +2: lock \n\ + addl $0,cpu_feature \n\ + jmp 1b \n\ + .text \n\ +" \ + : : "i"(CPUID_XMM) : "memory") +#define rmb() __asm __volatile( \ + "testl %0,cpu_feature \n\ + je 2f \n\ + lfence \n\ +1: \n\ + .section .text.offpath \n\ +2: lock \n\ + addl $0,cpu_feature \n\ + jmp 1b \n\ + .text \n\ +" \ + : : "i"(CPUID_SSE2) : "memory") #endif =20 - /* * Various simple operations on memory, each of which is atomic in the * presence of interrupts and multiple processors. --PkEWctFf+8E2rcii Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkkpebIACgkQC3+MBN1Mb4gTugCeLELBS+EYwgiZhaY4hQ/Csh/o 5G8AoNMkU0eT4Wj6c5/tSIFyYpZOLM8u =R8rE -----END PGP SIGNATURE----- --PkEWctFf+8E2rcii-- From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 16:08:36 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77C7C1065674; Sun, 23 Nov 2008 16:08:36 +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 69DAE8FC14; Sun, 23 Nov 2008 16:08:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANG8aee056632; Sun, 23 Nov 2008 16:08:36 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANG8aPg056631; Sun, 23 Nov 2008 16:08:36 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811231608.mANG8aPg056631@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 23 Nov 2008 16:08: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: r185210 - in stable/7/sys: . modules/cxgb vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 16:08:36 -0000 Author: kib Date: Sun Nov 23 16:08:36 2008 New Revision: 185210 URL: http://svn.freebsd.org/changeset/base/185210 Log: MFC r185012: Instead of forcing vn_start_write() to reset mp back to NULL for the failed calls with non-NULL vp, explicitely clear mp after failure. Approved by: re (kensmith) PR: 123768 Modified: stable/7/sys/ (props changed) stable/7/sys/modules/cxgb/ (props changed) stable/7/sys/vm/vm_pageout.c Modified: stable/7/sys/vm/vm_pageout.c ============================================================================== --- stable/7/sys/vm/vm_pageout.c Sun Nov 23 16:06:41 2008 (r185209) +++ stable/7/sys/vm/vm_pageout.c Sun Nov 23 16:08:36 2008 (r185210) @@ -947,8 +947,7 @@ rescan0: vp = object->handle; if (vp->v_type == VREG && vn_start_write(vp, &mp, V_NOWAIT) != 0) { - KASSERT(mp == NULL, - ("vm_pageout_scan: mp != NULL")); + mp = NULL; ++pageout_lock_miss; if (object->flags & OBJ_MIGHTBEDIRTY) vnodes_skipped++; From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 17:10:05 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CF30106564A; Sun, 23 Nov 2008 17:10:05 +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 3E0B38FC19; Sun, 23 Nov 2008 17:10:05 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANHA5p2057969; Sun, 23 Nov 2008 17:10:05 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANHA5bx057968; Sun, 23 Nov 2008 17:10:05 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200811231710.mANHA5bx057968@svn.freebsd.org> From: Marius Strobl Date: Sun, 23 Nov 2008 17:10:05 +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: r185212 - stable/7/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 17:10:05 -0000 Author: marius Date: Sun Nov 23 17:10:04 2008 New Revision: 185212 URL: http://svn.freebsd.org/changeset/base/185212 Log: MFC: r185004 - For maximum flexibility, sparc64 supports BUS_DMA_COHERENT also with bus_dmamap_create() and not only bus_dmamem_alloc() so move the description of this flag up accordingly in order to document this fact. While at it, refine this description with an application example. - Reword the description of BUS_DMA_NOCACHE as this flag is also implemented on sparc64. Approved by: re (kib) Modified: stable/7/share/man/man9/ (props changed) stable/7/share/man/man9/bus_dma.9 Modified: stable/7/share/man/man9/bus_dma.9 ============================================================================== --- stable/7/share/man/man9/bus_dma.9 Sun Nov 23 16:44:49 2008 (r185211) +++ stable/7/share/man/man9/bus_dma.9 Sun Nov 23 17:10:04 2008 (r185212) @@ -60,7 +60,7 @@ .\" $FreeBSD$ .\" $NetBSD: bus_dma.9,v 1.25 2002/10/14 13:43:16 wiz Exp $ .\" -.Dd March 6, 2007 +.Dd November 16, 2008 .Dt BUS_DMA 9 .Os .Sh NAME @@ -474,9 +474,23 @@ Arguments are as follows: .It Fa dmat DMA tag. .It Fa flags -The value of this argument is currently undefined and should be -specified as -.Ql 0 . +Are as follows: +.Bl -tag -width ".Dv BUS_DMA_COHERENT" +.It Dv BUS_DMA_COHERENT +Attempt to map the memory loaded with this map such that cache sync +operations are as cheap as possible. +This flag is typically set on maps when the memory loaded with these will +be accessed by both a CPU and a DMA engine, frequently such as control data +and as opposed to streamable data such as receive and transmit buffers. +Use of this flag does not remove the requirement of using +.Fn bus_dmamap_sync , +but it may reduce the cost of performing these operations. +For +.Fn bus_dmamap_create , +the +.Dv BUS_DMA_COHERENT +flag is currently implemented on sparc64. +.El .It Fa mapp Pointer to a .Vt bus_dmamap_t @@ -542,9 +556,11 @@ and instead should return immediately wi The allocated memory will not be cached in the processor caches. All memory accesses appear on the bus and are executed without reordering. -Currently the flag is implemented for i386 and amd64 architectures -only, where it results in the Strong Uncacheable -PAT to be set for the allocated virtual address range. +On the amd64 and i386 architectures this flag results in the +Strong Uncacheable PAT to be set for the allocated virtual address range. +The +.Dv BUS_DMA_NOCACHE +flag is currently implemented on amd64, i386 and sparc64. .El .El .Pp @@ -749,16 +765,15 @@ If resources are not available, .Dv ENOMEM is returned. .It Dv BUS_DMA_COHERENT -Attempt to map this memory such that cache sync operations are -as cheap as possible. -This flag is typically set on memory that will be accessed by both -a CPU and a DMA engine, frequently. -Use of this flag does not remove the requirement of using -bus_dmamap_sync, but it may reduce the cost of performing -these operations. -The +Attempt to map this memory in a coherent fashion. +See +.Fn bus_dmamap_create +above for a description of this flag. +For +.Fn bus_dmamem_alloc , +the .Dv BUS_DMA_COHERENT -flag is currently implemented on sparc64 and arm. +flag is currently implemented on arm and sparc64. .It Dv BUS_DMA_ZERO Causes the allocated memory to be set to all zeros. .El From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 17:34:00 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 376B3106567C; Sun, 23 Nov 2008 17:34:00 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27DE78FC17; Sun, 23 Nov 2008 17:34:00 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANHY0vk058472; Sun, 23 Nov 2008 17:34:00 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANHY0Q1058471; Sun, 23 Nov 2008 17:34:00 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811231734.mANHY0Q1058471@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 23 Nov 2008 17:34:00 +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: r185213 - stable/6/sys/dev/puc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 17:34:00 -0000 Author: marcel Date: Sun Nov 23 17:33:59 2008 New Revision: 185213 URL: http://svn.freebsd.org/changeset/base/185213 Log: Correct the Device ID of the NetMos quad UART. PR: 128931 Approved by: re (kensmith) Modified: stable/6/sys/dev/puc/pucdata.c Modified: stable/6/sys/dev/puc/pucdata.c ============================================================================== --- stable/6/sys/dev/puc/pucdata.c Sun Nov 23 17:10:04 2008 (r185212) +++ stable/6/sys/dev/puc/pucdata.c Sun Nov 23 17:33:59 2008 (r185213) @@ -955,7 +955,7 @@ const struct puc_device_description puc_ /* NetMos 4S0P PCI: 4S, 0P */ { "NetMos NM9845 Quad UART", - { 0x9710, 0x9845, 0, 0x0014 }, + { 0x9710, 0x9845, 0, 0x0004 }, { 0xffff, 0xffff, 0, 0xffff }, { { PUC_PORT_TYPE_COM, 0x10, 0x00, COM_FREQ }, From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 17:50:44 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84346106567C; Sun, 23 Nov 2008 17:50:44 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout013.mac.com (asmtpout013.mac.com [17.148.16.88]) by mx1.freebsd.org (Postfix) with ESMTP id 6E9198FC13; Sun, 23 Nov 2008 17:50:44 +0000 (UTC) (envelope-from xcllnt@mac.com) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=US-ASCII; format=flowed Received: from [192.168.1.95] (209-128-86-226.BAYAREA.NET [209.128.86.226]) by asmtp013.mac.com (Sun Java(tm) System Messaging Server 6.3-7.03 (built Aug 7 2008; 32bit)) with ESMTPSA id <0KAS00MKDS8HAQ00@asmtp013.mac.com>; Sun, 23 Nov 2008 09:50:44 -0800 (PST) Message-id: <441DF4B4-CD86-4769-A6D3-27D1010E1DE0@mac.com> From: Marcel Moolenaar To: Xin LI In-reply-to: <200811230016.mAN0GA7x033233@svn.freebsd.org> Date: Sun, 23 Nov 2008 09:50:41 -0800 References: <200811230016.mAN0GA7x033233@svn.freebsd.org> X-Mailer: Apple Mail (2.929.2) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r185192 - in stable/7/sbin/geom: . class/part misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 17:50:44 -0000 On Nov 22, 2008, at 4:16 PM, Xin LI wrote: > Author: delphij > Date: Sun Nov 23 00:16:10 2008 > New Revision: 185192 > URL: http://svn.freebsd.org/changeset/base/185192 > > Log: > MFC r185038,185044,185046: Thanks! -- Marcel Moolenaar xcllnt@mac.com From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 18:39:09 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B3F31065675; Sun, 23 Nov 2008 18:39:09 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 19FD58FC1B; Sun, 23 Nov 2008 18:39:09 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANId9xr059892; Sun, 23 Nov 2008 18:39:09 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANId9FA059891; Sun, 23 Nov 2008 18:39:09 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811231839.mANId9FA059891@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 23 Nov 2008 18:39:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185214 - in releng/6.4/sys: . dev/puc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 18:39:09 -0000 Author: marcel Date: Sun Nov 23 18:39:08 2008 New Revision: 185214 URL: http://svn.freebsd.org/changeset/base/185214 Log: MF stable/6: Correct the Device ID of the NetMos quad UART. PR: 128931 Approved by: re (kensmith) Modified: releng/6.4/sys/ (props changed) releng/6.4/sys/dev/puc/pucdata.c Modified: releng/6.4/sys/dev/puc/pucdata.c ============================================================================== --- releng/6.4/sys/dev/puc/pucdata.c Sun Nov 23 17:33:59 2008 (r185213) +++ releng/6.4/sys/dev/puc/pucdata.c Sun Nov 23 18:39:08 2008 (r185214) @@ -955,7 +955,7 @@ const struct puc_device_description puc_ /* NetMos 4S0P PCI: 4S, 0P */ { "NetMos NM9845 Quad UART", - { 0x9710, 0x9845, 0, 0x0014 }, + { 0x9710, 0x9845, 0, 0x0004 }, { 0xffff, 0xffff, 0, 0xffff }, { { PUC_PORT_TYPE_COM, 0x10, 0x00, COM_FREQ }, From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 19:50:21 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32F881065675; Sun, 23 Nov 2008 19:50:21 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 207A18FC13; Sun, 23 Nov 2008 19:50:21 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANJoLkQ061810; Sun, 23 Nov 2008 19:50:21 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANJoLqJ061809; Sun, 23 Nov 2008 19:50:21 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811231950.mANJoLqJ061809@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Nov 2008 19:50:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185216 - head/tools/regression/fstest/tests X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 19:50:21 -0000 Author: pjd Date: Sun Nov 23 19:50:20 2008 New Revision: 185216 URL: http://svn.freebsd.org/changeset/base/185216 Log: fstest for Linux: - Use /dev/urandom, it is more portable. - Implement todo() function which allows to mark known failures. Modified: head/tools/regression/fstest/tests/misc.sh Modified: head/tools/regression/fstest/tests/misc.sh ============================================================================== --- head/tools/regression/fstest/tests/misc.sh Sun Nov 23 19:43:45 2008 (r185215) +++ head/tools/regression/fstest/tests/misc.sh Sun Nov 23 19:50:20 2008 (r185216) @@ -27,7 +27,12 @@ expect() if [ $? -eq 0 ]; then echo "ok ${ntest}" else - echo "not ok ${ntest} - tried '$*', expected ${e}, got ${r}" + if [ -z "${todomsg}" ]; then + echo "not ok ${ntest} - tried '$*', expected ${e}, got ${r}" + else + echo "not ok ${ntest} # TODO ${todomsg}" + todomsg="" + fi fi ntest=`expr $ntest + 1` } @@ -43,7 +48,12 @@ jexpect() if [ $? -eq 0 ]; then echo "ok ${ntest}" else - echo "not ok ${ntest} - tried '$*', expected ${e}, got ${r}" + if [ -z "${todomsg}" ]; then + echo "not ok ${ntest} - tried '$*', expected ${e}, got ${r}" + else + echo "not ok ${ntest} # TODO ${todomsg}" + todomsg="" + fi fi ntest=`expr $ntest + 1` } @@ -53,14 +63,27 @@ test_check() if [ $* ]; then echo "ok ${ntest}" else - echo "not ok ${ntest}" + if [ -z "${todomsg}" ]; then + echo "not ok ${ntest}" + else + echo "not ok ${ntest} # TODO ${todomsg}" + todomsg="" + fi fi ntest=`expr $ntest + 1` } +todo() +{ + echo "${os}" | grep -iq "${1}" + if [ $? -eq 0 ]; then + todomsg="${2}" + fi +} + namegen() { - echo "fstest_`dd if=/dev/random bs=1k count=1 2>/dev/null | openssl md5`" + echo "fstest_`dd if=/dev/urandom bs=1k count=1 2>/dev/null | openssl md5`" } quick_exit() From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 19:52:57 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 059311065670; Sun, 23 Nov 2008 19:52:57 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E6A368FC0C; Sun, 23 Nov 2008 19:52:56 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANJqu1q061984; Sun, 23 Nov 2008 19:52:56 GMT (envelope-from keramida@svn.freebsd.org) Received: (from keramida@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANJqucM061983; Sun, 23 Nov 2008 19:52:56 GMT (envelope-from keramida@svn.freebsd.org) Message-Id: <200811231952.mANJqucM061983@svn.freebsd.org> From: Giorgos Keramidas Date: Sun, 23 Nov 2008 19:52:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185217 - head/share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 19:52:57 -0000 Author: keramida (doc committer) Date: Sun Nov 23 19:52:56 2008 New Revision: 185217 URL: http://svn.freebsd.org/changeset/base/185217 Log: Enhance the explanation of using filesystem-specific mount options in /etc/fstab. We do support passing special options on a per filesystem type basis, like `-u UID -g GID' for mount_msdosfs, but the syntax of these options in fstab is non-obvious and a lot of users have asked about it. PR: docs/128816 Submitted by: Roland Smith, rsmith at xs4all dot nl MFC after: 2 days Modified: head/share/man/man5/fstab.5 Modified: head/share/man/man5/fstab.5 ============================================================================== --- head/share/man/man5/fstab.5 Sun Nov 23 19:50:20 2008 (r185216) +++ head/share/man/man5/fstab.5 Sun Nov 23 19:52:56 2008 (r185217) @@ -32,7 +32,7 @@ .\" @(#)fstab.5 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd February 11, 2008 +.Dd November 23, 2008 .Dt FSTAB 5 .Os .Sh NAME @@ -91,8 +91,7 @@ describes the mount options associated w It is formatted as a comma separated list of options. It contains at least the type of mount (see .Fa fs_type -below) plus any additional options -appropriate to the file system type. +below) plus any additional options appropriate to the file system type. See the options flag .Pq Fl o in the @@ -100,6 +99,32 @@ in the page and the file system specific page, such as .Xr mount_nfs 8 , for additional options that may be specified. +All options that can be given to the file system specific mount commands +can be used in +.Nm +as well. +They just need to be formatted a bit differently. +The arguments of the +.Fl o +option can be used without the preceding +.Fl o +flag. +Other options need both the file system specific flag and its argument, +separated by an equal sign. +For example, mounting an +.Xr msdosfs 5 +filesystem, the options +.Bd -literal -offset indent +-o sync -o noatime -m 644 -M 755 -u foo -g bar +.Ed +.Pp +should be written as +.Bd -literal -offset indent +sync,noatime,-m=644,-M=755,-u=foo,-g=bar +.Ed +.Pp +in the option field of +.Nm . .Pp If the options ``userquota'' and/or ``groupquota'' are specified, the file system is automatically processed by the From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 19:56:10 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FA041065670; Sun, 23 Nov 2008 19:56:10 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D4DF8FC1D; Sun, 23 Nov 2008 19:56:10 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANJuAEW062272; Sun, 23 Nov 2008 19:56:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANJuA9M062271; Sun, 23 Nov 2008 19:56:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811231956.mANJuA9M062271@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Nov 2008 19:56:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185218 - head/tools/regression/fstest X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 19:56:10 -0000 Author: pjd Date: Sun Nov 23 19:56:09 2008 New Revision: 185218 URL: http://svn.freebsd.org/changeset/base/185218 Log: Detect operating system automatically. Modified: head/tools/regression/fstest/Makefile Modified: head/tools/regression/fstest/Makefile ============================================================================== --- head/tools/regression/fstest/Makefile Sun Nov 23 19:52:56 2008 (r185217) +++ head/tools/regression/fstest/Makefile Sun Nov 23 19:56:09 2008 (r185218) @@ -1,10 +1,26 @@ # $FreeBSD$ -CFLAGS+=-DHAS_LCHMOD -CFLAGS+=-DHAS_CHFLAGS -CFLAGS+=-DHAS_LCHFLAGS -#CFLAGS+=-DHAS_TRUNCATE64 -#CFLAGS+=-DHAS_STAT64 +OSTYPE=$(shell uname) + +ifeq "${OSTYPE}" "FreeBSD" +CFLAGS += -D__OS_FreeBSD__ +CFLAGS += -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS +endif + +ifeq "${OSTYPE}" "SunOS" +CFLAGS += -D__OS_Solaris__ +CFLAGS += -DHAS_TRUNCATE64 -DHAS_STAT64 +endif + +ifeq "${OSTYPE}" "Darwin" +CFLAGS += -D__OS_Darwin__ +CFLAGS += -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS +endif + +ifeq "${OSTYPE}" "Linux" +CFLAGS += -D__OS_Linux__ +CFLAGS += -D_GNU_SOURCE +endif all: fstest From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 19:56:40 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF44C1065672; Sun, 23 Nov 2008 19:56:40 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC8F98FC25; Sun, 23 Nov 2008 19:56:40 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANJueF7062316; Sun, 23 Nov 2008 19:56:40 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANJueje062314; Sun, 23 Nov 2008 19:56:40 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811231956.mANJueje062314@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Nov 2008 19:56:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185219 - head/tools/regression/fstest X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 19:56:40 -0000 Author: pjd Date: Sun Nov 23 19:56:40 2008 New Revision: 185219 URL: http://svn.freebsd.org/changeset/base/185219 Log: Add support for pathconf(2). Modified: head/tools/regression/fstest/fstest.c Modified: head/tools/regression/fstest/fstest.c ============================================================================== --- head/tools/regression/fstest/fstest.c Sun Nov 23 19:56:09 2008 (r185218) +++ head/tools/regression/fstest/fstest.c Sun Nov 23 19:56:40 2008 (r185219) @@ -75,6 +75,7 @@ enum action { ACTION_TRUNCATE, ACTION_STAT, ACTION_LSTAT, + ACTION_PATHCONF }; #define TYPE_NONE 0x0000 @@ -116,6 +117,7 @@ static struct syscall_desc syscalls[] = { "truncate", ACTION_TRUNCATE, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, { "stat", ACTION_STAT, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, { "lstat", ACTION_LSTAT, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, + { "pathconf", ACTION_PATHCONF, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, { NULL, -1, { TYPE_NONE } } }; @@ -209,6 +211,27 @@ static struct flag chflags_flags[] = { }; #endif +struct name { + int n_name; + char *n_str; +}; + +static struct name pathconf_names[] = { +#ifdef _PC_LINK_MAX + { _PC_LINK_MAX, "_PC_LINK_MAX" }, +#endif +#ifdef _PC_NAME_MAX + { _PC_NAME_MAX, "_PC_NAME_MAX" }, +#endif +#ifdef _PC_PATH_MAX + { _PC_PATH_MAX, "_PC_PATH_MAX" }, +#endif +#ifdef _PC_SYMLINK_MAX + { _PC_SYMLINK_MAX, "_PC_SYMLINK_MAX" }, +#endif + { 0, NULL } +}; + static const char *err2str(int error); static void @@ -264,6 +287,18 @@ flags2str(struct flag *tflags, long long } #endif +static int +str2name(struct name *names, char *name) +{ + unsigned int i; + + for (i = 0; names[i].n_str != NULL; i++) { + if (strcmp(names[i].n_str, name) == 0) + return (names[i].n_name); + } + return (-1); +} + static struct syscall_desc * find_syscall(const char *name) { @@ -357,7 +392,7 @@ call_syscall(struct syscall_desc *scall, long long flags; unsigned int i; char *endp; - int rval; + int name, rval; union { char *str; long long num; @@ -484,6 +519,27 @@ call_syscall(struct syscall_desc *scall, return (i); } break; + case ACTION_PATHCONF: + { + long lrval; + + name = str2name(pathconf_names, STR(1)); + if (name == -1) { + fprintf(stderr, "unknown name %s", STR(1)); + exit(1); + } + errno = 0; + lrval = pathconf(STR(0), name); + if (lrval == -1 && errno == 0) { + printf("unlimited\n"); + return (i); + } else if (lrval >= 0) { + printf("%ld\n", lrval); + return (i); + } + rval = -1; + break; + } default: fprintf(stderr, "unsupported syscall\n"); exit(1); From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 19:57:16 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5F191065673; Sun, 23 Nov 2008 19:57:16 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A39108FC21; Sun, 23 Nov 2008 19:57:16 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANJvG8I062368; Sun, 23 Nov 2008 19:57:16 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANJvG2o062367; Sun, 23 Nov 2008 19:57:16 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811231957.mANJvG2o062367@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Nov 2008 19:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185220 - head/tools/regression/fstest/tests/open X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 19:57:16 -0000 Author: pjd Date: Sun Nov 23 19:57:16 2008 New Revision: 185220 URL: http://svn.freebsd.org/changeset/base/185220 Log: Shorter version. Modified: head/tools/regression/fstest/tests/open/16.t Modified: head/tools/regression/fstest/tests/open/16.t ============================================================================== --- head/tools/regression/fstest/tests/open/16.t Sun Nov 23 19:56:40 2008 (r185219) +++ head/tools/regression/fstest/tests/open/16.t Sun Nov 23 19:57:16 2008 (r185220) @@ -12,18 +12,8 @@ n0=`namegen` n1=`namegen` expect 0 symlink ${n0} ${n1} -case "${os}" in -SunOS) - expect ELOOP open ${n1} O_RDONLY,O_CREAT,O_NOFOLLOW 0644 - expect ELOOP open ${n1} O_RDONLY,O_NOFOLLOW - expect ELOOP open ${n1} O_WRONLY,O_NOFOLLOW - expect ELOOP open ${n1} O_RDWR,O_NOFOLLOW - ;; -*) - expect EMLINK open ${n1} O_RDONLY,O_CREAT,O_NOFOLLOW 0644 - expect EMLINK open ${n1} O_RDONLY,O_NOFOLLOW - expect EMLINK open ${n1} O_WRONLY,O_NOFOLLOW - expect EMLINK open ${n1} O_RDWR,O_NOFOLLOW - ;; -esac +expect "EMLINK|ELOOP" open ${n1} O_RDONLY,O_CREAT,O_NOFOLLOW 0644 +expect "EMLINK|ELOOP" open ${n1} O_RDONLY,O_NOFOLLOW +expect "EMLINK|ELOOP" open ${n1} O_WRONLY,O_NOFOLLOW +expect "EMLINK|ELOOP" open ${n1} O_RDWR,O_NOFOLLOW expect 0 unlink ${n1} From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 19:58:26 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95EF3106564A; Sun, 23 Nov 2008 19:58:26 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 832F88FC1A; Sun, 23 Nov 2008 19:58:26 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANJwQe8062438; Sun, 23 Nov 2008 19:58:26 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANJwQuF062437; Sun, 23 Nov 2008 19:58:26 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811231958.mANJwQuF062437@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Nov 2008 19:58:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185221 - head/tools/regression/fstest/tests/rmdir X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 19:58:26 -0000 Author: pjd Date: Sun Nov 23 19:58:26 2008 New Revision: 185221 URL: http://svn.freebsd.org/changeset/base/185221 Log: FreeBSD's way of handling rmdir("..") is not POSIX-compilant. Modified: head/tools/regression/fstest/tests/rmdir/12.t Modified: head/tools/regression/fstest/tests/rmdir/12.t ============================================================================== --- head/tools/regression/fstest/tests/rmdir/12.t Sun Nov 23 19:57:16 2008 (r185220) +++ head/tools/regression/fstest/tests/rmdir/12.t Sun Nov 23 19:58:26 2008 (r185221) @@ -1,7 +1,7 @@ #!/bin/sh # $FreeBSD$ -desc="rmdir returns EINVAL if the last component of the path is '.' or '..'" +desc="rmdir returns EINVAL if the last component of the path is '.' and EEXIST or ENOTEMPTY if the last component of the path is '..'" dir=`dirname $0` . ${dir}/../misc.sh @@ -14,13 +14,7 @@ n1=`namegen` expect 0 mkdir ${n0} 0755 expect 0 mkdir ${n0}/${n1} 0755 expect EINVAL rmdir ${n0}/${n1}/. -case "${os}" in -FreeBSD) - expect EINVAL rmdir ${n0}/${n1}/.. - ;; -*) - expect EEXIST rmdir ${n0}/${n1}/.. - ;; -esac +todo FreeBSD "According to POSIX: EEXIST or ENOTEMPTY - The path argument names a directory that is not an empty directory, or there are hard links to the directory other than dot or a single entry in dot-dot." +expect "ENOTEMPTY|EEXIST" rmdir ${n0}/${n1}/.. expect 0 rmdir ${n0}/${n1} expect 0 rmdir ${n0} From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 20:02:15 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2585A10656D2; Sun, 23 Nov 2008 20:02:15 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 12B9E8FC17; Sun, 23 Nov 2008 20:02:15 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANK2EkR062622; Sun, 23 Nov 2008 20:02:14 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANK2EWx062621; Sun, 23 Nov 2008 20:02:14 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811232002.mANK2EWx062621@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Nov 2008 20:02:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185223 - head/tools/regression/fstest/tests X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 20:02:15 -0000 Author: pjd Date: Sun Nov 23 20:02:14 2008 New Revision: 185223 URL: http://svn.freebsd.org/changeset/base/185223 Log: fstest for Linux: Automatically detect file system type. Modified: head/tools/regression/fstest/tests/conf Modified: head/tools/regression/fstest/tests/conf ============================================================================== --- head/tools/regression/fstest/tests/conf Sun Nov 23 19:59:42 2008 (r185222) +++ head/tools/regression/fstest/tests/conf Sun Nov 23 20:02:14 2008 (r185223) @@ -4,5 +4,29 @@ # Known operating systems: FreeBSD, SunOS, Linux os=`uname` -# Known file systems: UFS, ZFS, other -fs="UFS" +case "${os}" in +FreeBSD|Darwin) + #fs=`df -T . | tail -1 | awk '{print $2}'` + pattern="`df . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'`" + fs=`mount | egrep "^${pattern}" | awk -F '[(,]' '{print $2}'` + ;; +Solaris) + pattern="`df -k . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'`" + fs=`mount -v | egrep "^${pattern}" | awk '{print $5}'` + ;; +Linux) + fs=`df -PT . | tail -1 | awk '{print $2}'` + ;; +*) + echo "Unsupported operating system ${os}." >/dev/stderr + exit 1 + ;; +esac + +# If we cannot figure out file system type, define it here. +#fs="UFS" + +if [ -z "${fs}" ]; then + echo "Cannot figure out file system type, define it by hand." >/dev/stderr + exit 1 +fi From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 20:02:58 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 821FE1065670; Sun, 23 Nov 2008 20:02:58 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FD918FC1D; Sun, 23 Nov 2008 20:02:58 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANK2w6x062673; Sun, 23 Nov 2008 20:02:58 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANK2wjR062672; Sun, 23 Nov 2008 20:02:58 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <200811232002.mANK2wjR062672@svn.freebsd.org> From: Hiroki Sato Date: Sun, 23 Nov 2008 20:02:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185224 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 20:02:58 -0000 Author: hrs Date: Sun Nov 23 20:02:58 2008 New Revision: 185224 URL: http://svn.freebsd.org/changeset/base/185224 Log: vn_fullpath(9) does not assume vp is locked by the caller now. Modified: head/share/man/man9/vn_fullpath.9 Modified: head/share/man/man9/vn_fullpath.9 ============================================================================== --- head/share/man/man9/vn_fullpath.9 Sun Nov 23 20:02:14 2008 (r185223) +++ head/share/man/man9/vn_fullpath.9 Sun Nov 23 20:02:58 2008 (r185224) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 11, 2004 +.Dd November 23, 2008 .Dt VN_FULLPATH 9 .Os .Sh NAME @@ -46,7 +46,7 @@ The function makes a .Dq "best effort" attempt to generate a string pathname for -the passed (locked) vnode; the resulting path, if any, will be relative to +the passed vnode; the resulting path, if any, will be relative to the root directory of the process associated with the passed thread pointer. The .Fn vn_fullpath @@ -73,7 +73,7 @@ The thread performing the call; this poi the process and its file descriptor structure, in order to identify the root vnode to use. .It Fa vp -The vnode to search for; must be locked by the caller. +The vnode to search for. No need to be locked by the caller. .It Fa retbuf Pointer to a .Vt "char *" From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 20:03:58 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E9871065674; Sun, 23 Nov 2008 20:03:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B33E8FC1D; Sun, 23 Nov 2008 20:03:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANK3wjq062738; Sun, 23 Nov 2008 20:03:58 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANK3wtT062736; Sun, 23 Nov 2008 20:03:58 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811232003.mANK3wtT062736@svn.freebsd.org> From: Alexander Motin Date: Sun, 23 Nov 2008 20:03:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185225 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 20:03:58 -0000 Author: mav Date: Sun Nov 23 20:03:58 2008 New Revision: 185225 URL: http://svn.freebsd.org/changeset/base/185225 Log: Strictly differentiate digital and analog PCM devices according to codec nodes capabilities. Add "Analog"/"Digital" marks to the pcm device names. I hope it will help new users easier accept concept of several PCM devices and understand exact purposes of that devices. Modified: head/sys/dev/sound/pci/hda/hdac.c head/sys/dev/sound/pci/hda/hdac_private.h Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Sun Nov 23 20:02:58 2008 (r185224) +++ head/sys/dev/sound/pci/hda/hdac.c Sun Nov 23 20:03:58 2008 (r185225) @@ -4291,6 +4291,7 @@ hdac_audio_as_parse(struct hdac_devinfo for (i = 0; i < max; i++) { as[i].hpredir = -1; as[i].chan = -1; + as[i].digital = 1; } /* Scan associations skipping as=0. */ @@ -4345,6 +4346,8 @@ hdac_audio_as_parse(struct hdac_devinfo __func__, w->nid, j); as[cnt].enable = 0; } + if (!HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap)) + as[cnt].digital = 0; /* Headphones with seq=15 may mean redirection. */ if (type == HDA_CONFIG_DEFAULTCONF_DEVICE_HP_OUT && seq == 15) @@ -5075,13 +5078,8 @@ hdac_audio_bind_as(struct hdac_devinfo * as[j].chan = free; devinfo->codec->sc->chans[free].as = j; - if (as[j].dir == HDA_CTL_IN) { - devinfo->codec->sc->chans[free].dir = PCMDIR_REC; - devinfo->function.audio.reccnt++; - } else { - devinfo->codec->sc->chans[free].dir = PCMDIR_PLAY; - devinfo->function.audio.playcnt++; - } + devinfo->codec->sc->chans[free].dir = + (as[j].dir == HDA_CTL_IN) ? PCMDIR_REC : PCMDIR_PLAY; hdac_pcmchannel_setup(&devinfo->codec->sc->chans[free]); free++; } @@ -6214,6 +6212,82 @@ hdac_pcmchannel_setup(struct hdac_chan * } static void +hdac_create_pcms(struct hdac_devinfo *devinfo) +{ + struct hdac_softc *sc = devinfo->codec->sc; + struct hdac_audio_as *as = devinfo->function.audio.as; + int i, j, apdev = 0, ardev = 0, dpdev = 0, drdev = 0; + + for (i = 0; i < devinfo->function.audio.ascnt; i++) { + if (as[i].enable == 0) + continue; + if (as[i].dir == HDA_CTL_IN) { + if (as[i].digital) + drdev++; + else + ardev++; + } else { + if (as[i].digital) + dpdev++; + else + apdev++; + } + } + devinfo->function.audio.num_devs = + max(ardev, apdev) + max(drdev, dpdev); + devinfo->function.audio.devs = + (struct hdac_pcm_devinfo *)malloc( + devinfo->function.audio.num_devs * sizeof(struct hdac_pcm_devinfo), + M_HDAC, M_ZERO | M_NOWAIT); + if (devinfo->function.audio.devs == NULL) { + device_printf(sc->dev, + "Unable to allocate memory for devices\n"); + return; + } + for (i = 0; i < devinfo->function.audio.num_devs; i++) { + devinfo->function.audio.devs[i].index = i; + devinfo->function.audio.devs[i].devinfo = devinfo; + devinfo->function.audio.devs[i].play = -1; + devinfo->function.audio.devs[i].rec = -1; + devinfo->function.audio.devs[i].digital = 2; + } + for (i = 0; i < devinfo->function.audio.ascnt; i++) { + if (as[i].enable == 0) + continue; + for (j = 0; j < devinfo->function.audio.num_devs; j++) { + if (devinfo->function.audio.devs[j].digital != 2 && + devinfo->function.audio.devs[j].digital != + as[i].digital) + continue; + if (as[i].dir == HDA_CTL_IN) { + if (devinfo->function.audio.devs[j].rec >= 0) + continue; + devinfo->function.audio.devs[j].rec + = as[i].chan; + } else { + if (devinfo->function.audio.devs[j].play >= 0) + continue; + devinfo->function.audio.devs[j].play + = as[i].chan; + } + sc->chans[as[i].chan].pdevinfo = + &devinfo->function.audio.devs[j]; + devinfo->function.audio.devs[j].digital = + as[i].digital; + break; + } + } + for (i = 0; i < devinfo->function.audio.num_devs; i++) { + struct hdac_pcm_devinfo *pdevinfo = + &devinfo->function.audio.devs[i]; + pdevinfo->dev = + device_add_child(sc->dev, "pcm", -1); + device_set_ivars(pdevinfo->dev, + (void *)pdevinfo); + } +} + +static void hdac_dump_ctls(struct hdac_pcm_devinfo *pdevinfo, const char *banner, uint32_t flag) { struct hdac_devinfo *devinfo = pdevinfo->devinfo; @@ -7063,7 +7137,7 @@ hdac_attach2(void *arg) struct hdac_audio_ctl *ctl; uint32_t quirks_on, quirks_off; int codec_index, fg_index; - int i, pdev, rdev, dmaalloc = 0; + int i, dmaalloc = 0; struct hdac_devinfo *devinfo; sc = (struct hdac_softc *)arg; @@ -7245,53 +7319,10 @@ hdac_attach2(void *arg) dmaalloc = 1; } - i = devinfo->function.audio.playcnt; - if (devinfo->function.audio.reccnt > i) - i = devinfo->function.audio.reccnt; - devinfo->function.audio.devs = - (struct hdac_pcm_devinfo *)malloc( - sizeof(struct hdac_pcm_devinfo) * i, - M_HDAC, M_ZERO | M_NOWAIT); - if (devinfo->function.audio.devs == NULL) { - device_printf(sc->dev, - "Unable to allocate memory for devices\n"); - continue; - } - devinfo->function.audio.num_devs = i; - for (i = 0; i < devinfo->function.audio.num_devs; i++) { - devinfo->function.audio.devs[i].index = i; - devinfo->function.audio.devs[i].devinfo = devinfo; - devinfo->function.audio.devs[i].play = -1; - devinfo->function.audio.devs[i].rec = -1; - } - pdev = 0; - rdev = 0; - for (i = 0; i < devinfo->function.audio.ascnt; i++) { - if (devinfo->function.audio.as[i].enable == 0) - continue; - if (devinfo->function.audio.as[i].dir == - HDA_CTL_IN) { - devinfo->function.audio.devs[rdev].rec - = devinfo->function.audio.as[i].chan; - sc->chans[devinfo->function.audio.as[i].chan].pdevinfo = - &devinfo->function.audio.devs[rdev]; - rdev++; - } else { - devinfo->function.audio.devs[pdev].play - = devinfo->function.audio.as[i].chan; - sc->chans[devinfo->function.audio.as[i].chan].pdevinfo = - &devinfo->function.audio.devs[pdev]; - pdev++; - } - } - for (i = 0; i < devinfo->function.audio.num_devs; i++) { - struct hdac_pcm_devinfo *pdevinfo = - &devinfo->function.audio.devs[i]; - pdevinfo->dev = - device_add_child(sc->dev, "pcm", -1); - device_set_ivars(pdevinfo->dev, - (void *)pdevinfo); - } + HDA_BOOTHVERBOSE( + device_printf(sc->dev, "Creating PCM devices...\n"); + ); + hdac_create_pcms(devinfo); HDA_BOOTVERBOSE( if (devinfo->function.audio.quirks != 0) { @@ -7636,9 +7667,10 @@ hdac_pcm_probe(device_t dev) (struct hdac_pcm_devinfo *)device_get_ivars(dev); char buf[128]; - snprintf(buf, sizeof(buf), "HDA %s PCM #%d", + snprintf(buf, sizeof(buf), "HDA %s PCM #%d %s", hdac_codec_name(pdevinfo->devinfo->codec), - pdevinfo->index); + pdevinfo->index, + pdevinfo->digital?"Digital":"Analog"); device_set_desc_copy(dev, buf); return (0); } Modified: head/sys/dev/sound/pci/hda/hdac_private.h ============================================================================== --- head/sys/dev/sound/pci/hda/hdac_private.h Sun Nov 23 20:02:58 2008 (r185224) +++ head/sys/dev/sound/pci/hda/hdac_private.h Sun Nov 23 20:03:58 2008 (r185225) @@ -220,6 +220,7 @@ struct hdac_audio_as { u_char dir; u_char pincnt; u_char fakeredir; + u_char digital; nid_t hpredir; nid_t pins[16]; nid_t dacs[16]; @@ -236,6 +237,7 @@ struct hdac_pcm_devinfo { u_char right[SOUND_MIXER_NRDEVICES]; int chan_size; int chan_blkcnt; + u_char digital; }; /**************************************************************************** @@ -262,7 +264,6 @@ struct hdac_devinfo { struct hdac_audio_as *as; uint32_t quirks; uint32_t gpio; - int playcnt, reccnt; struct hdac_pcm_devinfo *devs; int num_devs; } audio; From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 20:05:12 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B1551065677; Sun, 23 Nov 2008 20:05:12 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58DCB8FC17; Sun, 23 Nov 2008 20:05:12 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANK5CLs062806; Sun, 23 Nov 2008 20:05:12 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANK5Cpo062805; Sun, 23 Nov 2008 20:05:12 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <200811232005.mANK5Cpo062805@svn.freebsd.org> From: Hiroki Sato Date: Sun, 23 Nov 2008 20:05:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185226 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 20:05:12 -0000 Author: hrs Date: Sun Nov 23 20:05:12 2008 New Revision: 185226 URL: http://svn.freebsd.org/changeset/base/185226 Log: Remove vfs_mountedon(9) manual page. The vfs_mountedon(9) has been removed since 2004. Deleted: head/share/man/man9/vfs_mountedon.9 Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sun Nov 23 20:03:58 2008 (r185225) +++ head/share/man/man9/Makefile Sun Nov 23 20:05:12 2008 (r185226) @@ -256,7 +256,6 @@ MAN= accept_filter.9 \ VFS_MOUNT.9 \ vfs_mount.9 \ vfs_mountedfrom.9 \ - vfs_mountedon.9 \ VFS_QUOTACTL.9 \ VFS_ROOT.9 \ vfs_rootmountalloc.9 \ From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 20:07:01 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66DA81065670; Sun, 23 Nov 2008 20:07:01 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52F318FC12; Sun, 23 Nov 2008 20:07:01 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANK71S3062890; Sun, 23 Nov 2008 20:07:01 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANK71Ha062880; Sun, 23 Nov 2008 20:07:01 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811232007.mANK71Ha062880@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Nov 2008 20:07:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185227 - in head/tools/regression/fstest/tests: chown link open rename truncate unlink X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 20:07:01 -0000 Author: pjd Date: Sun Nov 23 20:07:00 2008 New Revision: 185227 URL: http://svn.freebsd.org/changeset/base/185227 Log: fstest for Linux: - Use -- when needed so Linux getopt(3) won't get confused. - Follow POSIX more closely. Submitted by: Szabolcs Szakacsits Modified: head/tools/regression/fstest/tests/chown/00.t head/tools/regression/fstest/tests/chown/05.t head/tools/regression/fstest/tests/chown/07.t head/tools/regression/fstest/tests/link/00.t head/tools/regression/fstest/tests/open/23.t head/tools/regression/fstest/tests/rename/19.t head/tools/regression/fstest/tests/rename/21.t head/tools/regression/fstest/tests/truncate/13.t head/tools/regression/fstest/tests/unlink/08.t Modified: head/tools/regression/fstest/tests/chown/00.t ============================================================================== --- head/tools/regression/fstest/tests/chown/00.t Sun Nov 23 20:05:12 2008 (r185226) +++ head/tools/regression/fstest/tests/chown/00.t Sun Nov 23 20:07:00 2008 (r185227) @@ -61,7 +61,7 @@ expect 0 unlink ${n1} expect 0 create ${n0} 0644 expect 0 chown ${n0} 65534 65533 expect 65534,65533 lstat ${n0} uid,gid -expect 0 -u 65534 -g 65532,65531 chown ${n0} -1 65532 +expect 0 -u 65534 -g 65532,65531 -- chown ${n0} -1 65532 expect 65534,65532 lstat ${n0} uid,gid expect 0 -u 65534 -g 65532,65531 chown ${n0} 65534 65531 expect 65534,65531 lstat ${n0} uid,gid @@ -72,17 +72,17 @@ expect 0 unlink ${n0} # 39 expect 0 create ${n0} 0644 expect 0 chown ${n0} 65534 65533 -expect 0 -u 65532 -g 65531 chown ${n0} -1 -1 +expect 0 -u 65532 -g 65531 -- chown ${n0} -1 -1 expect 0 unlink ${n0} -# when super-user calls chown(2), set-uid and set-gid bits are not removed. +# when super-user calls chown(2), set-uid and set-gid bits may be removed. # 43 expect 0 create ${n0} 0644 expect 0 chown ${n0} 65534 65533 expect 0 chmod ${n0} 06555 expect 06555 lstat ${n0} mode expect 0 chown ${n0} 65532 65531 -expect 06555 lstat ${n0} mode +expect "06555|0555" lstat ${n0} mode expect 0 unlink ${n0} # 50 expect 0 create ${n0} 0644 @@ -90,7 +90,7 @@ expect 0 chown ${n0} 0 0 expect 0 chmod ${n0} 06555 expect 06555 lstat ${n0} mode expect 0 chown ${n0} 65534 65533 -expect 06555 lstat ${n0} mode +expect "06555|0555" lstat ${n0} mode expect 0 unlink ${n0} # 57 expect 0 create ${n0} 0644 @@ -98,11 +98,11 @@ expect 0 chown ${n0} 65534 65533 expect 0 chmod ${n0} 06555 expect 06555 lstat ${n0} mode expect 0 chown ${n0} 0 0 -expect 06555 lstat ${n0} mode +expect "06555|0555" lstat ${n0} mode expect 0 unlink ${n0} -# when non-super-user calls chown(2) successfully, set-uid and set-gid bits are -# removed, except when both uid and gid are equal to -1. +# when non-super-user calls chown(2) successfully, set-uid and set-gid bits may +# be removed, except when both uid and gid are equal to -1. # 64 expect 0 create ${n0} 0644 expect 0 chown ${n0} 65534 65533 @@ -112,12 +112,12 @@ expect 0 -u 65534 -g 65533,65532 chown $ expect 0555,65534,65532 lstat ${n0} mode,uid,gid expect 0 chmod ${n0} 06555 expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 65533 +expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 65533 expect 0555,65534,65533 lstat ${n0} mode,uid,gid expect 0 chmod ${n0} 06555 expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 -1 -expect 06555,65534,65533 lstat ${n0} mode,uid,gid +expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 -1 +expect "06555,65534,65533|0555,65534,65533" lstat ${n0} mode,uid,gid expect 0 unlink ${n0} # 79 expect 0 mkdir ${n0} 0755 @@ -125,14 +125,14 @@ expect 0 chown ${n0} 65534 65533 expect 0 chmod ${n0} 06555 expect 06555 lstat ${n0} mode expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532 -expect 0555,65534,65532 lstat ${n0} mode,uid,gid +expect "0555,65534,65532|06555,65534,65532" lstat ${n0} mode,uid,gid expect 0 chmod ${n0} 06555 expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 65533 -expect 0555,65534,65533 lstat ${n0} mode,uid,gid +expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 65533 +expect "0555,65534,65533|06555,65534,65533" lstat ${n0} mode,uid,gid expect 0 chmod ${n0} 06555 expect 06555 lstat ${n0} mode -expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 -1 +expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 -1 expect 06555,65534,65533 lstat ${n0} mode,uid,gid expect 0 rmdir ${n0} # 94 @@ -145,11 +145,11 @@ if supported lchmod; then expect 0555,65534,65532 lstat ${n0} mode,uid,gid expect 0 lchmod ${n0} 06555 expect 06555 lstat ${n0} mode - expect 0 -u 65534 -g 65533,65532 lchown ${n0} -1 65533 + expect 0 -u 65534 -g 65533,65532 -- lchown ${n0} -1 65533 expect 0555,65534,65533 lstat ${n0} mode,uid,gid expect 0 lchmod ${n0} 06555 expect 06555 lstat ${n0} mode - expect 0 -u 65534 -g 65533,65532 lchown ${n0} -1 -1 + expect 0 -u 65534 -g 65533,65532 -- lchown ${n0} -1 -1 expect 06555,65534,65533 lstat ${n0} mode,uid,gid expect 0 unlink ${n0} fi @@ -236,7 +236,7 @@ expect 0 unlink ${n0} expect 0 create ${n0} 0644 ctime1=`${fstest} stat ${n0} ctime` sleep 1 -expect 0 chown ${n0} -1 -1 +expect 0 -- chown ${n0} -1 -1 ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} @@ -244,7 +244,7 @@ expect 0 unlink ${n0} expect 0 mkdir ${n0} 0644 ctime1=`${fstest} stat ${n0} ctime` sleep 1 -expect 0 chown ${n0} -1 -1 +expect 0 -- chown ${n0} -1 -1 ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -eq $ctime2 expect 0 rmdir ${n0} @@ -252,7 +252,7 @@ expect 0 rmdir ${n0} expect 0 mkfifo ${n0} 0644 ctime1=`${fstest} stat ${n0} ctime` sleep 1 -expect 0 chown ${n0} -1 -1 +expect 0 -- chown ${n0} -1 -1 ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} @@ -260,7 +260,7 @@ expect 0 unlink ${n0} expect 0 symlink ${n1} ${n0} ctime1=`${fstest} lstat ${n0} ctime` sleep 1 -expect 0 lchown ${n0} -1 -1 +expect 0 -- lchown ${n0} -1 -1 ctime2=`${fstest} lstat ${n0} ctime` test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} @@ -270,7 +270,7 @@ expect 0 unlink ${n0} expect 0 create ${n0} 0644 ctime1=`${fstest} stat ${n0} ctime` sleep 1 -expect EPERM -u 65534 chown ${n0} 65534 -1 +expect EPERM -u 65534 -- chown ${n0} 65534 -1 ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} @@ -278,7 +278,7 @@ expect 0 unlink ${n0} expect 0 mkdir ${n0} 0755 ctime1=`${fstest} stat ${n0} ctime` sleep 1 -expect EPERM -u 65534 -g 65534 chown ${n0} -1 65534 +expect EPERM -u 65534 -g 65534 -- chown ${n0} -1 65534 ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -eq $ctime2 expect 0 rmdir ${n0} Modified: head/tools/regression/fstest/tests/chown/05.t ============================================================================== --- head/tools/regression/fstest/tests/chown/05.t Sun Nov 23 20:05:12 2008 (r185226) +++ head/tools/regression/fstest/tests/chown/05.t Sun Nov 23 20:07:00 2008 (r185227) @@ -18,13 +18,13 @@ cd ${n0} expect 0 mkdir ${n1} 0755 expect 0 chown ${n1} 65534 65534 expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644 -expect 0 -u 65534 -g 65533,65534 chown ${n1}/${n2} -1 65533 +expect 0 -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65533 expect 65534,65533 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid expect 0 chmod ${n1} 0644 -expect EACCES -u 65534 -g 65533,65534 chown ${n1}/${n2} -1 65534 +expect EACCES -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65534 expect 0 chmod ${n1} 0755 expect 65534,65533 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid -expect 0 -u 65534 -g 65533,65534 chown ${n1}/${n2} -1 65534 +expect 0 -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65534 expect 65534,65534 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} expect 0 rmdir ${n1} Modified: head/tools/regression/fstest/tests/chown/07.t ============================================================================== --- head/tools/regression/fstest/tests/chown/07.t Sun Nov 23 20:05:12 2008 (r185226) +++ head/tools/regression/fstest/tests/chown/07.t Sun Nov 23 20:07:00 2008 (r185227) @@ -21,7 +21,7 @@ expect 0 -u 65534 -g 65534 create ${n1}/ expect EPERM -u 65534 -g 65534 chown ${n1}/${n2} 65533 65533 expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65534 65534 expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65533 65533 -expect EPERM -u 65534 -g 65534 chown ${n1}/${n2} -1 65533 +expect EPERM -u 65534 -g 65534 -- chown ${n1}/${n2} -1 65533 expect 0 unlink ${n1}/${n2} expect 0 rmdir ${n1} cd ${cdir} Modified: head/tools/regression/fstest/tests/link/00.t ============================================================================== --- head/tools/regression/fstest/tests/link/00.t Sun Nov 23 20:05:12 2008 (r185226) +++ head/tools/regression/fstest/tests/link/00.t Sun Nov 23 20:07:00 2008 (r185227) @@ -118,7 +118,7 @@ expect 0 unlink ${n1} # unsuccessful link(2) does not update ctime. expect 0 create ${n0} 0644 -expect 0 chown ${n0} 65534 -1 +expect 0 -- chown ${n0} 65534 -1 ctime1=`${fstest} stat ${n0} ctime` dctime1=`${fstest} stat . ctime` dmtime1=`${fstest} stat . mtime` @@ -133,7 +133,7 @@ test_check $dctime1 -eq $dmtime2 expect 0 unlink ${n0} expect 0 mkfifo ${n0} 0644 -expect 0 chown ${n0} 65534 -1 +expect 0 -- chown ${n0} 65534 -1 ctime1=`${fstest} stat ${n0} ctime` dctime1=`${fstest} stat . ctime` dmtime1=`${fstest} stat . mtime` Modified: head/tools/regression/fstest/tests/open/23.t ============================================================================== --- head/tools/regression/fstest/tests/open/23.t Sun Nov 23 20:05:12 2008 (r185226) +++ head/tools/regression/fstest/tests/open/23.t Sun Nov 23 20:07:00 2008 (r185227) @@ -1,7 +1,7 @@ #!/bin/sh # $FreeBSD$ -desc="open returns EINVAL when an attempt was made to open a descriptor with an illegal combination of O_RDONLY, O_WRONLY, and O_RDWR" +desc="open may return EINVAL when an attempt was made to open a descriptor with an illegal combination of O_RDONLY, O_WRONLY, and O_RDWR" dir=`dirname $0` . ${dir}/../misc.sh @@ -11,6 +11,6 @@ echo "1..4" n0=`namegen` expect 0 create ${n0} 0644 -expect EINVAL open ${n0} O_WRONLY,O_RDWR -expect EINVAL open ${n0} O_RDONLY,O_WRONLY,O_RDWR +expect "0|EINVAL" open ${n0} O_WRONLY,O_RDWR +expect "0|EINVAL" open ${n0} O_RDONLY,O_WRONLY,O_RDWR expect 0 unlink ${n0} Modified: head/tools/regression/fstest/tests/rename/19.t ============================================================================== --- head/tools/regression/fstest/tests/rename/19.t Sun Nov 23 20:05:12 2008 (r185226) +++ head/tools/regression/fstest/tests/rename/19.t Sun Nov 23 20:07:00 2008 (r185227) @@ -1,7 +1,7 @@ #!/bin/sh # $FreeBSD$ -desc="rename returns EINVAL when an attempt is made to rename '.' or '..'" +desc="rename returns EINVAL/EBUSY when an attempt is made to rename '.' or '..'" dir=`dirname $0` . ${dir}/../misc.sh @@ -15,8 +15,8 @@ n2=`namegen` expect 0 mkdir ${n0} 0755 expect 0 mkdir ${n0}/${n1} 0755 -expect EINVAL rename ${n0}/${n1}/. ${n2} -expect EINVAL rename ${n0}/${n1}/.. ${n2} +expect "EINVAL|EBUSY" rename ${n0}/${n1}/. ${n2} +expect "EINVAL|EBUSY" rename ${n0}/${n1}/.. ${n2} expect 0 rmdir ${n0}/${n1} expect 0 rmdir ${n0} Modified: head/tools/regression/fstest/tests/rename/21.t ============================================================================== --- head/tools/regression/fstest/tests/rename/21.t Sun Nov 23 20:05:12 2008 (r185226) +++ head/tools/regression/fstest/tests/rename/21.t Sun Nov 23 20:07:00 2008 (r185227) @@ -6,7 +6,7 @@ desc="write access to subdirectory is re dir=`dirname $0` . ${dir}/../misc.sh -echo "1..13" +echo "1..15" n0=`namegen` n1=`namegen` @@ -18,23 +18,28 @@ expect 0 mkdir ${n3} 0777 cdir=`pwd` # Check that write permission on containing directory (${n2}) is enough -# to rename subdirectory (${n0}). +# to rename subdirectory (${n0}). If we rename directory write access +# to this directory may also be required. expect 0 mkdir ${n2}/${n0} 0700 -expect 0 -u 65534 -g 65534 rename ${n2}/${n0} ${n2}/${n1} +expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n0} ${n2}/${n1} +expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n1} ${n2}/${n0} # Check that write permission on containing directory (${n2}) is not enough # to move subdirectory (${n0}) from that directory. -expect EACCES -u 65534 -g 65534 rename ${n2}/${n1} ${n3}/${n0} - -expect 0 rmdir ${n2}/${n1} -expect ENOENT rmdir ${n2}/${n1} +# Actually POSIX says that write access to ${n2} and ${n3} may be enough +# to move ${n0} from ${n2} to ${n3}. +expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n1} + +expect 0 rmdir ${n2}/${n0} +expect ENOENT rmdir ${n2}/${n0} +expect ENOENT rmdir ${n3}/${n1} # Check that write permission on containing directory (${n2}) is enough # to move file (${n0}) from that directory. expect 0 create ${n2}/${n0} 0755 -expect 0 -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n0} +expect 0 -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n1} -expect 0 unlink ${n3}/${n0} +expect 0 unlink ${n3}/${n1} expect ENOENT unlink ${n2}/${n0} expect 0 rmdir ${n3} Modified: head/tools/regression/fstest/tests/truncate/13.t ============================================================================== --- head/tools/regression/fstest/tests/truncate/13.t Sun Nov 23 20:05:12 2008 (r185226) +++ head/tools/regression/fstest/tests/truncate/13.t Sun Nov 23 20:07:00 2008 (r185227) @@ -11,6 +11,6 @@ echo "1..4" n0=`namegen` expect 0 create ${n0} 0644 -expect EINVAL truncate ${n0} -1 -expect EINVAL truncate ${n0} -999999 +expect EINVAL -- truncate ${n0} -1 +expect EINVAL -- truncate ${n0} -999999 expect 0 unlink ${n0} Modified: head/tools/regression/fstest/tests/unlink/08.t ============================================================================== --- head/tools/regression/fstest/tests/unlink/08.t Sun Nov 23 20:05:12 2008 (r185226) +++ head/tools/regression/fstest/tests/unlink/08.t Sun Nov 23 20:07:00 2008 (r185227) @@ -1,7 +1,7 @@ #!/bin/sh # $FreeBSD$ -desc="unlink returns EPERM if the named file is a directory" +desc="unlink may return EPERM if the named file is a directory" dir=`dirname $0` . ${dir}/../misc.sh @@ -11,13 +11,5 @@ echo "1..3" n0=`namegen` expect 0 mkdir ${n0} 0755 -case "${os}:${fs}" in -SunOS:UFS) - expect 0 unlink ${n0} - expect ENOENT rmdir ${n0} - ;; -*) - expect EPERM unlink ${n0} - expect 0 rmdir ${n0} - ;; -esac +expect "0|EPERM" unlink ${n0} +expect "0|ENOENT" rmdir ${n0} From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 20:14:20 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FC9B106564A; Sun, 23 Nov 2008 20:14:20 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1CE968FC12; Sun, 23 Nov 2008 20:14:20 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANKEKwD063067; Sun, 23 Nov 2008 20:14:20 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANKEKM0063066; Sun, 23 Nov 2008 20:14:20 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811232014.mANKEKM0063066@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Nov 2008 20:14:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185228 - head/sys/cddl/compat/opensolaris/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 20:14:20 -0000 Author: pjd Date: Sun Nov 23 20:14:19 2008 New Revision: 185228 URL: http://svn.freebsd.org/changeset/base/185228 Log: Don't use PRIV_ROOT. Here we check if user can share ZFS file system, so PRIV_NFS_DAEMON seems best choice. Discussed with: rwatson Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Sun Nov 23 20:07:00 2008 (r185227) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Sun Nov 23 20:14:19 2008 (r185228) @@ -41,8 +41,7 @@ int secpolicy_nfs(struct ucred *cred) { - /* TODO: Change PRIV_ROOT! */ - return (priv_check_cred(cred, PRIV_ROOT, 0)); + return (priv_check_cred(cred, PRIV_NFS_DAEMON, 0)); } int From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 20:14:42 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 926B410657C1 for ; Sun, 23 Nov 2008 20:14:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 33C968FC0C for ; Sun, 23 Nov 2008 20:14:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L4LLs-0002Lo-82; Sun, 23 Nov 2008 22:14:40 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mANKESiH044812 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 23 Nov 2008 22:14:28 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mANKES8n011034; Sun, 23 Nov 2008 22:14:28 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mANKESoq011032; Sun, 23 Nov 2008 22:14:28 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 23 Nov 2008 22:14:28 +0200 From: Kostik Belousov To: Michael Monashev Message-ID: <20081123201428.GW6408@deviant.kiev.zoral.com.ua> References: <200811222108.mAML8P10029225@svn.freebsd.org> <1195578581.20081123131554@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0zDq8CFkxn2hi9iJ" Content-Disposition: inline In-Reply-To: <1195578581.20081123131554@gmail.com> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L4LLs-0002Lo-82 3b8ae8ec1389f37472ffcc93d43f1272 X-Terabit: YES Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r185185 - stable/7 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 20:14:42 -0000 --0zDq8CFkxn2hi9iJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 23, 2008 at 01:15:54PM +0300, Michael Monashev wrote: > Hi. >=20 > "/usr/src/Makefile.inc1", line 675: warning: Missing closing parenthesis = for exists() >=20 > KB> +.if ${MK_KERBEROS} !=3D "no" > KB> + cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} > KB> +.endif I guessed that you got the message above during either buildworld or installworld. I rechecked buildworld/installworld on amd64 RELENG_7 and it seems that both operations proceed smoothly. The line 675 reported is far away from the block 465-468 that was added by the commit. I suspect that you may have some local problems, and you need to provide more details if you want to get a help. --0zDq8CFkxn2hi9iJ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkkpuaMACgkQC3+MBN1Mb4iOXQCglnCsxo/5HPqUGTaBO1b6vUZz ZxUAn2vpZ/FcUDOPMzdCbj4saf63pQUD =3QaP -----END PGP SIGNATURE----- --0zDq8CFkxn2hi9iJ-- From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 20:17:17 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D955106564A; Sun, 23 Nov 2008 20:17:17 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59D758FC13; Sun, 23 Nov 2008 20:17:17 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANKHH4V063159; Sun, 23 Nov 2008 20:17:17 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANKHHHU063156; Sun, 23 Nov 2008 20:17:17 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811232017.mANKHHHU063156@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Nov 2008 20:17:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185229 - in head/tools/regression/fstest/tests: chown rename unlink X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 20:17:17 -0000 Author: pjd Date: Sun Nov 23 20:17:17 2008 New Revision: 185229 URL: http://svn.freebsd.org/changeset/base/185229 Log: Mark all the places where Linux is not POSIX-compilant. Tested on ext3. Modified: head/tools/regression/fstest/tests/chown/00.t head/tools/regression/fstest/tests/rename/21.t head/tools/regression/fstest/tests/unlink/08.t Modified: head/tools/regression/fstest/tests/chown/00.t ============================================================================== --- head/tools/regression/fstest/tests/chown/00.t Sun Nov 23 20:14:19 2008 (r185228) +++ head/tools/regression/fstest/tests/chown/00.t Sun Nov 23 20:17:17 2008 (r185229) @@ -238,6 +238,7 @@ ctime1=`${fstest} stat ${n0} ctime` sleep 1 expect 0 -- chown ${n0} -1 -1 ctime2=`${fstest} stat ${n0} ctime` +todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated." test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} # 158 @@ -246,6 +247,7 @@ ctime1=`${fstest} stat ${n0} ctime` sleep 1 expect 0 -- chown ${n0} -1 -1 ctime2=`${fstest} stat ${n0} ctime` +todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated." test_check $ctime1 -eq $ctime2 expect 0 rmdir ${n0} # 162 @@ -254,6 +256,7 @@ ctime1=`${fstest} stat ${n0} ctime` sleep 1 expect 0 -- chown ${n0} -1 -1 ctime2=`${fstest} stat ${n0} ctime` +todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated." test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} # 166 @@ -262,6 +265,7 @@ ctime1=`${fstest} lstat ${n0} ctime` sleep 1 expect 0 -- lchown ${n0} -1 -1 ctime2=`${fstest} lstat ${n0} ctime` +todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated." test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} Modified: head/tools/regression/fstest/tests/rename/21.t ============================================================================== --- head/tools/regression/fstest/tests/rename/21.t Sun Nov 23 20:14:19 2008 (r185228) +++ head/tools/regression/fstest/tests/rename/21.t Sun Nov 23 20:17:17 2008 (r185229) @@ -37,9 +37,12 @@ expect ENOENT rmdir ${n3}/${n1} # Check that write permission on containing directory (${n2}) is enough # to move file (${n0}) from that directory. expect 0 create ${n2}/${n0} 0755 +todo Linux "According to POSIX, write access to ${n2}/${n0} and (if exists) ${n3}/${n1} may be required if ${n0} and (if exists) ${n1} are directories, not regular files." expect 0 -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n1} +todo Linux "According to POSIX, write access to ${n2}/${n0} and (if exists) ${n3}/${n1} may be required if ${n0} and (if exists) ${n1} are directories, not regular files." expect 0 unlink ${n3}/${n1} +todo Linux "According to POSIX, write access to ${n2}/${n0} and (if exists) ${n3}/${n1} may be required if ${n0} and (if exists) ${n1} are directories, not regular files." expect ENOENT unlink ${n2}/${n0} expect 0 rmdir ${n3} Modified: head/tools/regression/fstest/tests/unlink/08.t ============================================================================== --- head/tools/regression/fstest/tests/unlink/08.t Sun Nov 23 20:14:19 2008 (r185228) +++ head/tools/regression/fstest/tests/unlink/08.t Sun Nov 23 20:17:17 2008 (r185229) @@ -11,5 +11,6 @@ echo "1..3" n0=`namegen` expect 0 mkdir ${n0} 0755 +todo Linux "According to POSIX: EPERM - The file named by path is a directory, and either the calling process does not have appropriate privileges, or the implementation prohibits using unlink() on directories." expect "0|EPERM" unlink ${n0} expect "0|ENOENT" rmdir ${n0} From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 20:19:35 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADDAF1065672; Sun, 23 Nov 2008 20:19:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AFC98FC25; Sun, 23 Nov 2008 20:19:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANKJZtw063241; Sun, 23 Nov 2008 20:19:35 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANKJZRh063240; Sun, 23 Nov 2008 20:19:35 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811232019.mANKJZRh063240@svn.freebsd.org> From: Alexander Motin Date: Sun, 23 Nov 2008 20:19:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185230 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 20:19:35 -0000 Author: mav Date: Sun Nov 23 20:19:35 2008 New Revision: 185230 URL: http://svn.freebsd.org/changeset/base/185230 Log: Do not use soft PCM volume for digital outputs to allow SPDIF AC3 bypass to work. Soft PCM volume (and vchans) unable to bypass AC3 stream now. Modified: head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Sun Nov 23 20:17:17 2008 (r185229) +++ head/sys/dev/sound/pci/hda/hdac.c Sun Nov 23 20:19:35 2008 (r185230) @@ -83,7 +83,7 @@ #include "mixer_if.h" -#define HDA_DRV_TEST_REV "20081122_0117" +#define HDA_DRV_TEST_REV "20081123_0118" SND_DECLARE_FILE("$FreeBSD$"); @@ -3549,8 +3549,8 @@ hdac_audio_ctl_ossmixer_init(struct snd_ } } - /* Declare soft PCM and master volume if needed. */ - if (pdevinfo->play >= 0) { + /* Declare soft PCM volume if needed. */ + if (pdevinfo->play >= 0 && !pdevinfo->digital) { ctl = NULL; if ((mask & SOUND_MASK_PCM) == 0 || (devinfo->function.audio.quirks & HDA_QUIRK_SOFTPCMVOL)) { @@ -3580,8 +3580,12 @@ hdac_audio_ctl_ossmixer_init(struct snd_ (softpcmvol == 1) ? "Forcing" : "Enabling"); ); } + } - if ((mask & SOUND_MASK_VOLUME) == 0) { + /* Declare master volume if needed. */ + if (pdevinfo->play >= 0) { + if ((mask & (SOUND_MASK_VOLUME | SOUND_MASK_PCM)) == + SOUND_MASK_PCM) { mask |= SOUND_MASK_VOLUME; mix_setparentchild(m, SOUND_MIXER_VOLUME, SOUND_MASK_PCM); From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 20:23:58 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 250181065675; Sun, 23 Nov 2008 20:23:58 +0000 (UTC) (envelope-from stefanf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 127CC8FC26; Sun, 23 Nov 2008 20:23:58 +0000 (UTC) (envelope-from stefanf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANKNvaX063434; Sun, 23 Nov 2008 20:23:57 GMT (envelope-from stefanf@svn.freebsd.org) Received: (from stefanf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANKNv1B063433; Sun, 23 Nov 2008 20:23:57 GMT (envelope-from stefanf@svn.freebsd.org) Message-Id: <200811232023.mANKNv1B063433@svn.freebsd.org> From: Stefan Farfeleder Date: Sun, 23 Nov 2008 20:23:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185231 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 20:23:58 -0000 Author: stefanf Date: Sun Nov 23 20:23:57 2008 New Revision: 185231 URL: http://svn.freebsd.org/changeset/base/185231 Log: Fix $? at the first command of a function. The previous exit status was saved twice and thus lost. Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sun Nov 23 20:19:35 2008 (r185230) +++ head/bin/sh/eval.c Sun Nov 23 20:23:57 2008 (r185231) @@ -791,6 +791,7 @@ evalcommand(union node *cmd, int flags, for (sp = varlist.list ; sp ; sp = sp->next) mklocal(sp->text); funcnest++; + exitstatus = oexitstatus; if (flags & EV_TESTED) evaltree(cmdentry.u.func, EV_TESTED); else From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 20:27:03 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C7261065673; Sun, 23 Nov 2008 20:27:03 +0000 (UTC) (envelope-from stefanf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 598A88FC22; Sun, 23 Nov 2008 20:27:03 +0000 (UTC) (envelope-from stefanf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANKR3DG063560; Sun, 23 Nov 2008 20:27:03 GMT (envelope-from stefanf@svn.freebsd.org) Received: (from stefanf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANKR3Ea063559; Sun, 23 Nov 2008 20:27:03 GMT (envelope-from stefanf@svn.freebsd.org) Message-Id: <200811232027.mANKR3Ea063559@svn.freebsd.org> From: Stefan Farfeleder Date: Sun, 23 Nov 2008 20:27:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185232 - head/tools/regression/bin/sh/parameters X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 20:27:03 -0000 Author: stefanf Date: Sun Nov 23 20:27:03 2008 New Revision: 185232 URL: http://svn.freebsd.org/changeset/base/185232 Log: Add a test for r185231. Added: head/tools/regression/bin/sh/parameters/ head/tools/regression/bin/sh/parameters/exitstatus1.0 (contents, props changed) Added: head/tools/regression/bin/sh/parameters/exitstatus1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/parameters/exitstatus1.0 Sun Nov 23 20:27:03 2008 (r185232) @@ -0,0 +1,9 @@ +# $FreeBSD$ +f() { + [ $? = $1 ] || exit 1 +} + +true +f 0 +false +f 1 From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 21:01:28 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E51D106564A; Sun, 23 Nov 2008 21:01:28 +0000 (UTC) (envelope-from dwmalone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B8898FC08; Sun, 23 Nov 2008 21:01:28 +0000 (UTC) (envelope-from dwmalone@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANL1SA0064276; Sun, 23 Nov 2008 21:01:28 GMT (envelope-from dwmalone@svn.freebsd.org) Received: (from dwmalone@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANL1S1P064275; Sun, 23 Nov 2008 21:01:28 GMT (envelope-from dwmalone@svn.freebsd.org) Message-Id: <200811232101.mANL1S1P064275@svn.freebsd.org> From: David Malone Date: Sun, 23 Nov 2008 21:01:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185233 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 21:01:28 -0000 Author: dwmalone Date: Sun Nov 23 21:01:28 2008 New Revision: 185233 URL: http://svn.freebsd.org/changeset/base/185233 Log: Make the new CCEQ macro a little more like the old one - first do the comparison between c and val and then compare val to _POSIX_VDISABLE. This avoids comparing c (which is usually of type char) to _POSIX_VDISABLE (which has value 0xff and may not be representable as a char). Reviewed by: ed Modified: head/sys/sys/termios.h Modified: head/sys/sys/termios.h ============================================================================== --- head/sys/sys/termios.h Sun Nov 23 20:27:03 2008 (r185232) +++ head/sys/sys/termios.h Sun Nov 23 21:01:28 2008 (r185233) @@ -234,7 +234,7 @@ struct termios { #ifndef _KERNEL #ifndef _POSIX_SOURCE -#define CCEQ(val, c) ((c) != _POSIX_VDISABLE && (c) == (val)) +#define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE) #endif /* From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 21:05:23 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F148106578D; Sun, 23 Nov 2008 21:05:23 +0000 (UTC) (envelope-from dwmalone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C8348FC0C; Sun, 23 Nov 2008 21:05:23 +0000 (UTC) (envelope-from dwmalone@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANL5MFa064403; Sun, 23 Nov 2008 21:05:22 GMT (envelope-from dwmalone@svn.freebsd.org) Received: (from dwmalone@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANL5MSh064402; Sun, 23 Nov 2008 21:05:22 GMT (envelope-from dwmalone@svn.freebsd.org) Message-Id: <200811232105.mANL5MSh064402@svn.freebsd.org> From: David Malone Date: Sun, 23 Nov 2008 21:05:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185234 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 21:05:23 -0000 Author: dwmalone Date: Sun Nov 23 21:05:22 2008 New Revision: 185234 URL: http://svn.freebsd.org/changeset/base/185234 Log: It's possible that the dump device has gone away after it was configured, change the message to let people know this is a possibility. I've slightly changed the message from the one submitted by Pekka to keep the printf on one line. Submitted by: Pekka Savola Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Sun Nov 23 21:01:28 2008 (r185233) +++ head/sys/kern/kern_shutdown.c Sun Nov 23 21:05:22 2008 (r185234) @@ -238,7 +238,7 @@ doadump(void) * Give them a clue as to why they can't dump. */ if (dumper.dumper == NULL) { - printf("Cannot dump. No dump device defined.\n"); + printf("Cannot dump. Device not defined or unavailable.\n"); return; } From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 23:04:29 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73F2F1065670; Sun, 23 Nov 2008 23:04:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 61C538FC18; Sun, 23 Nov 2008 23:04:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANN4TAG066846; Sun, 23 Nov 2008 23:04:29 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANN4TMu066845; Sun, 23 Nov 2008 23:04:29 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811232304.mANN4TMu066845@svn.freebsd.org> From: Warner Losh Date: Sun, 23 Nov 2008 23:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185235 - head/sys/dev/fdc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 23:04:29 -0000 Author: imp Date: Sun Nov 23 23:04:28 2008 New Revision: 185235 URL: http://svn.freebsd.org/changeset/base/185235 Log: Eliminate an unused variable reported by coverity Submitted by: Ganbold Modified: head/sys/dev/fdc/fdc_pccard.c Modified: head/sys/dev/fdc/fdc_pccard.c ============================================================================== --- head/sys/dev/fdc/fdc_pccard.c Sun Nov 23 21:05:22 2008 (r185234) +++ head/sys/dev/fdc/fdc_pccard.c Sun Nov 23 23:04:28 2008 (r185235) @@ -85,10 +85,8 @@ fdc_pccard_alloc_resources(device_t dev, static int fdc_pccard_probe(device_t dev) { - const struct pccard_product *pp; - - if ((pp = pccard_product_lookup(dev, fdc_pccard_products, - sizeof(fdc_pccard_products[0]), NULL)) != NULL) { + if (pccard_product_lookup(dev, fdc_pccard_products, + sizeof(fdc_pccard_products[0]), NULL) != NULL) { device_set_desc(dev, "PC Card Floppy"); return (0); } From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 23:19:31 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEFDB10656D7; Sun, 23 Nov 2008 23:19:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9339E8FC0C; Sun, 23 Nov 2008 23:19:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANNJVTY067155; Sun, 23 Nov 2008 23:19:31 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANNJVZV067154; Sun, 23 Nov 2008 23:19:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811232319.mANNJVZV067154@svn.freebsd.org> From: Alexander Motin Date: Sun, 23 Nov 2008 23:19:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185236 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 23:19:31 -0000 Author: mav Date: Sun Nov 23 23:19:31 2008 New Revision: 185236 URL: http://svn.freebsd.org/changeset/base/185236 Log: Remove DELAY() on hdac_audio_commit(). I don't see the reason why it is needed. Modified: head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Sun Nov 23 23:04:28 2008 (r185235) +++ head/sys/dev/sound/pci/hda/hdac.c Sun Nov 23 23:19:31 2008 (r185236) @@ -6035,7 +6035,6 @@ hdac_audio_commit(struct hdac_devinfo *d val), cad); } - DELAY(1000); } } From owner-svn-src-all@FreeBSD.ORG Sun Nov 23 23:26:13 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C31E106564A; Sun, 23 Nov 2008 23:26:13 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 19AAE8FC13; Sun, 23 Nov 2008 23:26:13 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mANNQCns067325; Sun, 23 Nov 2008 23:26:12 GMT (envelope-from scf@svn.freebsd.org) Received: (from scf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mANNQCLp067323; Sun, 23 Nov 2008 23:26:12 GMT (envelope-from scf@svn.freebsd.org) Message-Id: <200811232326.mANNQCLp067323@svn.freebsd.org> From: Sean Farley Date: Sun, 23 Nov 2008 23:26:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185237 - head/lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 23:26:13 -0000 Author: scf Date: Sun Nov 23 23:26:12 2008 New Revision: 185237 URL: http://svn.freebsd.org/changeset/base/185237 Log: Fixed style issues with variable ordering and naming, spacing and parentheses. Fixed alignment issue in gr_dup() in its assignment of gr_mem using a struct to force alignment without performing alignment mathematics. This was noticed recently with libutil was built with WARNS=6 on platform such as sparc64. Added checks to gr_dup(), gr_equal() and gr_make() to prevent segfaults when examining struct group's with the struct members pointing to NULL's. With fix of alignment issue, restore WARNS?=6. Reviewed by: des MFC after: 1 week Modified: head/lib/libutil/Makefile head/lib/libutil/gr_util.c Modified: head/lib/libutil/Makefile ============================================================================== --- head/lib/libutil/Makefile Sun Nov 23 23:19:31 2008 (r185236) +++ head/lib/libutil/Makefile Sun Nov 23 23:26:12 2008 (r185237) @@ -8,14 +8,14 @@ SHLIBDIR?= /lib LIB= util SHLIB_MAJOR= 7 -SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c \ +SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c gr_util.c \ hexdump.c humanize_number.c kld.c login.c login_auth.c login_cap.c \ login_class.c login_crypt.c login_ok.c login_times.c login_tty.c \ logout.c logwtmp.c pidfile.c property.c pty.c pw_util.c realhostname.c \ stub.c trimdomain.c uucplock.c INCS= libutil.h login_cap.h -#WARNS?= 6 +WARNS?= 6 CFLAGS+= -DLIBC_SCCS Modified: head/lib/libutil/gr_util.c ============================================================================== --- head/lib/libutil/gr_util.c Sun Nov 23 23:19:31 2008 (r185236) +++ head/lib/libutil/gr_util.c Sun Nov 23 23:26:12 2008 (r185237) @@ -37,7 +37,12 @@ __FBSDID("$FreeBSD$"); #include #include -static const char GroupLineFormat[] = "%s:%s:%ju:"; +struct group_storage { + struct group gr; + char *members[]; +}; + +static const char group_line_format[] = "%s:%s:%ju:"; /* * Compares two struct group's. @@ -45,38 +50,48 @@ static const char GroupLineFormat[] = "% int gr_equal(const struct group *gr1, const struct group *gr2) { - int gr1Ndx; - int gr2Ndx; - bool equal; + int gr1_ndx; + int gr2_ndx; bool found; /* Check that the non-member information is the same. */ - equal = strcmp(gr1->gr_name, gr2->gr_name) == 0 && - strcmp(gr1->gr_passwd, gr2->gr_passwd) == 0 && - gr1->gr_gid == gr2->gr_gid; + if (gr1->gr_name == NULL || gr2->gr_name == NULL) { + if (gr1->gr_name != gr2->gr_name) + return (false); + } else if (strcmp(gr1->gr_name, gr2->gr_name) != 0) + return (false); + if (gr1->gr_passwd == NULL || gr2->gr_passwd == NULL) { + if (gr1->gr_passwd != gr2->gr_passwd) + return (false); + } else if (strcmp(gr1->gr_passwd, gr2->gr_passwd) != 0) + return (false); + if (gr1->gr_gid != gr2->gr_gid) + return (false); /* Check all members in both groups. */ - if (equal) { - for (found = false, gr1Ndx = 0; gr1->gr_mem[gr1Ndx] != NULL; - gr1Ndx++) { - for (gr2Ndx = 0; gr2->gr_mem[gr2Ndx] != NULL; gr2Ndx++) - if (strcmp(gr1->gr_mem[gr1Ndx], - gr2->gr_mem[gr2Ndx]) == 0) { + if (gr1->gr_mem == NULL || gr2->gr_mem == NULL) { + if (gr1->gr_mem != gr2->gr_mem) + return (false); + } else { + for (found = false, gr1_ndx = 0; gr1->gr_mem[gr1_ndx] != NULL; + gr1_ndx++) { + for (gr2_ndx = 0; gr2->gr_mem[gr2_ndx] != NULL; + gr2_ndx++) + if (strcmp(gr1->gr_mem[gr1_ndx], + gr2->gr_mem[gr2_ndx]) == 0) { found = true; break; } - if (! found) { - equal = false; - break; - } + if (!found) + return (false); } /* Check that group2 does not have more members than group1. */ - if (gr2->gr_mem[gr1Ndx] != NULL) - equal = false; + if (gr2->gr_mem[gr1_ndx] != NULL) + return (false); } - return (equal); + return (true); } /* @@ -86,27 +101,30 @@ char * gr_make(const struct group *gr) { char *line; - size_t lineSize; + size_t line_size; int ndx; /* Calculate the length of the group line. */ - lineSize = snprintf(NULL, 0, GroupLineFormat, gr->gr_name, + line_size = snprintf(NULL, 0, group_line_format, gr->gr_name, gr->gr_passwd, (uintmax_t)gr->gr_gid) + 1; - for (ndx = 0; gr->gr_mem[ndx] != NULL; ndx++) - lineSize += strlen(gr->gr_mem[ndx]) + 1; - if (ndx > 0) - lineSize--; + if (gr->gr_mem != NULL) { + for (ndx = 0; gr->gr_mem[ndx] != NULL; ndx++) + line_size += strlen(gr->gr_mem[ndx]) + 1; + if (ndx > 0) + line_size--; + } /* Create the group line and fill it. */ - if ((line = malloc(lineSize)) == NULL) + if ((line = malloc(line_size)) == NULL) return (NULL); - lineSize = snprintf(line, lineSize, GroupLineFormat, gr->gr_name, + line_size = snprintf(line, line_size, group_line_format, gr->gr_name, gr->gr_passwd, (uintmax_t)gr->gr_gid); - for (ndx = 0; gr->gr_mem[ndx] != NULL; ndx++) { - strcat(line, gr->gr_mem[ndx]); - if (gr->gr_mem[ndx + 1] != NULL) - strcat(line, ","); - } + if (gr->gr_mem != NULL) + for (ndx = 0; gr->gr_mem[ndx] != NULL; ndx++) { + strcat(line, gr->gr_mem[ndx]); + if (gr->gr_mem[ndx + 1] != NULL) + strcat(line, ","); + } return (line); } @@ -117,47 +135,48 @@ gr_make(const struct group *gr) struct group * gr_dup(const struct group *gr) { + char *dst; size_t len; - struct group *ngr; + struct group_storage *gs; int ndx; - int numMem; + int num_mem; - /* Calculate size of group. */ - len = sizeof(*gr) + - (gr->gr_name != NULL ? strlen(gr->gr_name) + 1 : 0) + - (gr->gr_passwd != NULL ? strlen(gr->gr_passwd) + 1 : 0); - numMem = 0; + /* Calculate size of the group. */ + len = sizeof(*gs); + if (gr->gr_name != NULL) + len += strlen(gr->gr_name) + 1; + if (gr->gr_passwd != NULL) + len += strlen(gr->gr_passwd) + 1; if (gr->gr_mem != NULL) { - for (; gr->gr_mem[numMem] != NULL; numMem++) - len += strlen(gr->gr_mem[numMem]) + 1; - len += (numMem + 1) * sizeof(*gr->gr_mem); - } + for (num_mem = 0; gr->gr_mem[num_mem] != NULL; num_mem++) + len += strlen(gr->gr_mem[num_mem]) + 1; + len += (num_mem + 1) * sizeof(*gr->gr_mem); + } else + num_mem = -1; /* Create new group and copy old group into it. */ - if ((ngr = calloc(1, len)) == NULL) + if ((gs = calloc(1, len)) == NULL) return (NULL); - len = sizeof(*ngr); - ngr->gr_gid = gr->gr_gid; + dst = (char *)&gs->members[num_mem + 1]; if (gr->gr_name != NULL) { - ngr->gr_name = (char *)ngr + len; - len += sprintf(ngr->gr_name, "%s", gr->gr_name) + 1; + gs->gr.gr_name = dst; + dst = stpcpy(gs->gr.gr_name, gr->gr_name) + 1; } if (gr->gr_passwd != NULL) { - ngr->gr_passwd = (char *)ngr + len; - len += sprintf(ngr->gr_passwd, "%s", gr->gr_passwd) + 1; + gs->gr.gr_passwd = dst; + dst = stpcpy(gs->gr.gr_passwd, gr->gr_passwd) + 1; } + gs->gr.gr_gid = gr->gr_gid; if (gr->gr_mem != NULL) { - ngr->gr_mem = (char **)((char *)ngr + len); - len += (numMem + 1) * sizeof(*ngr->gr_mem); - for (ndx = 0; gr->gr_mem[ndx] != NULL; ndx++) { - ngr->gr_mem[ndx] = (char *)ngr + len; - len += sprintf(ngr->gr_mem[ndx], "%s", - gr->gr_mem[ndx]) + 1; + gs->gr.gr_mem = gs->members; + for (ndx = 0; ndx < num_mem; ndx++) { + gs->gr.gr_mem[ndx] = dst; + dst = stpcpy(gs->gr.gr_mem[ndx], gr->gr_mem[ndx]) + 1; } - ngr->gr_mem[ndx] = NULL; + gs->gr.gr_mem[ndx] = NULL; } - return (ngr); + return (&gs->gr); } /* @@ -190,15 +209,18 @@ __gr_scan(char *line, struct group *gr) return (false); line = loc + 1; gr->gr_mem = NULL; - if (*line != '\0') { - ndx = 0; + ndx = 0; + do { + gr->gr_mem = reallocf(gr->gr_mem, sizeof(*gr->gr_mem) * + (ndx + 1)); + if (gr->gr_mem == NULL) + return (false); + + /* Skip locations without members (i.e., empty string). */ do { - if ((gr->gr_mem = reallocf(gr->gr_mem, - sizeof(*gr->gr_mem) * (ndx + 1))) == NULL) - return (false); gr->gr_mem[ndx] = strsep(&line, ","); - } while (gr->gr_mem[ndx++] != NULL); - } + } while (gr->gr_mem[ndx] != NULL && *gr->gr_mem[ndx] == '\0'); + } while (gr->gr_mem[ndx++] != NULL); return (true); } @@ -210,19 +232,19 @@ struct group * gr_scan(const char *line) { struct group gr; - char *lineCopy; - struct group *newGr; + char *line_copy; + struct group *new_gr; - if ((lineCopy = strdup(line)) == NULL) + if ((line_copy = strdup(line)) == NULL) return (NULL); - if (!__gr_scan(lineCopy, &gr)) { - free(lineCopy); + if (!__gr_scan(line_copy, &gr)) { + free(line_copy); return (NULL); } - newGr = gr_dup(&gr); - free(lineCopy); + new_gr = gr_dup(&gr); + free(line_copy); if (gr.gr_mem != NULL) free(gr.gr_mem); - return (newGr); + return (new_gr); } From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 00:52:26 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA1E61065670; Mon, 24 Nov 2008 00:52:26 +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 A376B8FC0A; Mon, 24 Nov 2008 00:52:26 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAO0qQpc069102; Mon, 24 Nov 2008 00:52:26 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAO0qQ3H069096; Mon, 24 Nov 2008 00:52:26 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811240052.mAO0qQ3H069096@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 24 Nov 2008 00:52:26 +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: r185238 - in stable/7/sys: . amd64/conf boot/forth conf dev/ale i386/conf modules modules/ale modules/cxgb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 00:52:26 -0000 Author: yongari Date: Mon Nov 24 00:52:26 2008 New Revision: 185238 URL: http://svn.freebsd.org/changeset/base/185238 Log: MFC r184870: Add ale(4), a driver for Atheros AR8121/AR8113/AR8114 PCIe ethernet controller. The controller is also known as L1E(AR8121) and L2E(AR8113/AR8114). Unlike its predecessor Attansic L1, AR8121/AR8113/AR8114 uses completely different Rx logic such that it requires separate driver. Datasheet for AR81xx is not available to open source driver writers but it shares large part of Tx and PHY logic of L1. I still don't understand some part of register meaning and some MAC statistics counters but the driver seems to have no critical issues for performance and stability. The AR81xx requires copy operation to pass received frames to upper stack such that ale(4) consumes a lot of CPU cycles than that of other controller. A couple of silicon bugs also adds more CPU cycles to address the known hardware bug. However, if you have fast CPU you can still saturate the link. Currently ale(4) supports the following hardware features. - MSI. - TCP Segmentation offload. - Hardware VLAN tag insertion/stripping with checksum offload. - Tx TCP/UDP checksum offload and Rx IP/TCP/UDP checksum offload. - Tx/Rx interrupt moderation. - Hardware statistics counters. - Jumbo frame. - WOL. AR81xx PCIe ethernet controllers are mainly found on ASUS EeePC or P5Q series of ASUS motherboards. Special thanks to Jeremy Chadwick who sent the hardware to me. Without his donation writing a driver for AR81xx would never have been possible. Big thanks to all people who reported feedback or tested patches. HW donated by: koitsu Tested by: bsam, Joao Barros gmail DOT com > Jan Henrik Sylvester janh DOT de > Ivan Brawley < ivan <> brawley DOT id DOT au >, CURRENT ML Approved by: re (kib) Note, GENERIC kernel does NOT include ale(4) but users can still kldload it. It was requested by re. Added: stable/7/sys/dev/ale/ - copied from r184870, head/sys/dev/ale/ stable/7/sys/modules/ale/ - copied from r184870, head/sys/modules/ale/ Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/conf/GENERIC stable/7/sys/boot/forth/loader.conf stable/7/sys/conf/NOTES stable/7/sys/conf/files stable/7/sys/i386/conf/GENERIC stable/7/sys/modules/Makefile stable/7/sys/modules/cxgb/ (props changed) Modified: stable/7/sys/amd64/conf/GENERIC ============================================================================== --- stable/7/sys/amd64/conf/GENERIC Sun Nov 23 23:26:12 2008 (r185237) +++ stable/7/sys/amd64/conf/GENERIC Mon Nov 24 00:52:26 2008 (r185238) @@ -194,6 +194,7 @@ device vx # 3Com 3c590, 3c595 (``Vorte # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support device age # Attansic/Atheros L1 Gigabit Ethernet +#device ale # Atheros AR8121/AR8113/AR8114 Ethernet device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet device bfe # Broadcom BCM440x 10/100 Ethernet device bge # Broadcom BCM570xx Gigabit Ethernet Modified: stable/7/sys/boot/forth/loader.conf ============================================================================== --- stable/7/sys/boot/forth/loader.conf Sun Nov 23 23:26:12 2008 (r185237) +++ stable/7/sys/boot/forth/loader.conf Mon Nov 24 00:52:26 2008 (r185238) @@ -208,6 +208,7 @@ pf_load="NO" # packet filter miibus_load="NO" # miibus support, needed for some drivers if_age_load="NO" # Attansic/Atheros L1 Gigabit Ethernet +if_ale_load="NO" # Atheros AR8121/AR8113/AR8114 Ethernet if_an_load="NO" # Aironet 4500/4800 802.11 wireless NICs if_ar_load="NO" # Digi SYNC/570i if_arl_load="NO" # Aironet Arlan 655 wireless network adapter Modified: stable/7/sys/conf/NOTES ============================================================================== --- stable/7/sys/conf/NOTES Sun Nov 23 23:26:12 2008 (r185237) +++ stable/7/sys/conf/NOTES Mon Nov 24 00:52:26 2008 (r185238) @@ -1724,6 +1724,7 @@ device miibus # Harris (Intersil) Chipset with PCnetMobile firmware by AMD. # age: Support for gigabit ethernet adapters based on the Attansic/Atheros # L1 PCI express gigabit ethernet controllers. +# ale: Support for Atheros AR8121/AR8113/AR8114 PCIe ethernet controllers. # bce: Broadcom NetXtreme II (BCM5706/BCM5708) PCI/PCIe Gigabit Ethernet # adapters. # bfe: Broadcom BCM4401 Ethernet adapter. @@ -1868,6 +1869,7 @@ device xe # PCI Ethernet NICs that use the common MII bus controller code. device ae # Attansic/Atheros L2 FastEthernet device age # Attansic/Atheros L1 Gigabit Ethernet +device ale # Atheros AR8121/AR8113/AR8114 Ethernet device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet device bfe # Broadcom BCM440x 10/100 Ethernet device bge # Broadcom BCM570xx Gigabit Ethernet Modified: stable/7/sys/conf/files ============================================================================== --- stable/7/sys/conf/files Sun Nov 23 23:26:12 2008 (r185237) +++ stable/7/sys/conf/files Mon Nov 24 00:52:26 2008 (r185238) @@ -446,6 +446,7 @@ dev/aic7xxx/aic7xxx.c optional ahc dev/aic7xxx/aic7xxx_93cx6.c optional ahc dev/aic7xxx/aic7xxx_osm.c optional ahc dev/aic7xxx/aic7xxx_pci.c optional ahc pci +dev/ale/if_ale.c optional ale pci dev/amd/amd.c optional amd dev/amr/amr.c optional amr dev/amr/amr_cam.c optional amr Modified: stable/7/sys/i386/conf/GENERIC ============================================================================== --- stable/7/sys/i386/conf/GENERIC Sun Nov 23 23:26:12 2008 (r185237) +++ stable/7/sys/i386/conf/GENERIC Mon Nov 24 00:52:26 2008 (r185238) @@ -204,6 +204,7 @@ device vx # 3Com 3c590, 3c595 (``Vorte # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support device age # Attansic/Atheros L1 Gigabit Ethernet +#device ale # Atheros AR8121/AR8113/AR8114 Ethernet device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet device bfe # Broadcom BCM440x 10/100 Ethernet device bge # Broadcom BCM570xx Gigabit Ethernet Modified: stable/7/sys/modules/Makefile ============================================================================== --- stable/7/sys/modules/Makefile Sun Nov 23 23:26:12 2008 (r185237) +++ stable/7/sys/modules/Makefile Mon Nov 24 00:52:26 2008 (r185238) @@ -17,6 +17,7 @@ SUBDIR= ${_3dfx} \ aic7xxx \ aio \ ${_amd} \ + ale \ amr \ ${_an} \ ${_aout} \ From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 00:56:20 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0540106564A; Mon, 24 Nov 2008 00:56: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 DB8FF8FC16; Mon, 24 Nov 2008 00:56:20 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAO0uJWF069239; Mon, 24 Nov 2008 00:56:19 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAO0uJDJ069238; Mon, 24 Nov 2008 00:56:19 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811240056.mAO0uJDJ069238@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 24 Nov 2008 00:56: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: r185239 - stable/7/usr.sbin/sysinstall X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 00:56:21 -0000 Author: yongari Date: Mon Nov 24 00:56:19 2008 New Revision: 185239 URL: http://svn.freebsd.org/changeset/base/185239 Log: MFC r184871: Add ale(4) to the list of supported network interface. Approved by: re (kib) Modified: stable/7/usr.sbin/sysinstall/ (props changed) stable/7/usr.sbin/sysinstall/devices.c Modified: stable/7/usr.sbin/sysinstall/devices.c ============================================================================== --- stable/7/usr.sbin/sysinstall/devices.c Mon Nov 24 00:52:26 2008 (r185238) +++ stable/7/usr.sbin/sysinstall/devices.c Mon Nov 24 00:56:19 2008 (r185239) @@ -95,6 +95,7 @@ static struct _devname { SERIAL("cuad%d", "%s on device %s (COM%d)", 16), NETWORK("ae", "Attansic/Atheros L2 FastEthernet"), NETWORK("age", "Attansic/Atheros L1 Gigabit Ethernet"), + NETWORK("ale", "Atheros AR8121/AR8113/AR8114 PCIe Ethernet"), NETWORK("an", "Aironet 4500/4800 802.11 wireless adapter"), NETWORK("ath", "Atheros IEEE 802.11 wireless adapter"), NETWORK("aue", "ADMtek USB Ethernet adapter"), From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 01:00:37 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6034C1065673; Mon, 24 Nov 2008 01:00:37 +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 499DF8FC0C; Mon, 24 Nov 2008 01:00:37 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAO10bLJ069414; Mon, 24 Nov 2008 01:00:37 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAO10b9M069409; Mon, 24 Nov 2008 01:00:37 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811240100.mAO10b9M069409@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 24 Nov 2008 01:00: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: r185240 - stable/7/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 01:00:37 -0000 Author: yongari Date: Mon Nov 24 01:00:36 2008 New Revision: 185240 URL: http://svn.freebsd.org/changeset/base/185240 Log: MFC r184872-184873: Add ale(4) man page and hook up ale(4) to the build. Also add Xr to appropriate man pages. Approved by: re (kib) Added: stable/7/share/man/man4/ale.4 - copied unchanged from r184872, head/share/man/man4/ale.4 Modified: stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/Makefile stable/7/share/man/man4/altq.4 stable/7/share/man/man4/igb.4 (props changed) stable/7/share/man/man4/miibus.4 stable/7/share/man/man4/vlan.4 Modified: stable/7/share/man/man4/Makefile ============================================================================== --- stable/7/share/man/man4/Makefile Mon Nov 24 00:56:19 2008 (r185239) +++ stable/7/share/man/man4/Makefile Mon Nov 24 01:00:36 2008 (r185240) @@ -16,6 +16,7 @@ MAN= aac.4 \ ahc.4 \ ahd.4 \ aio.4 \ + ale.4 \ altq.4 \ amd.4 \ ${_amdsmb.4} \ Copied: stable/7/share/man/man4/ale.4 (from r184872, head/share/man/man4/ale.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/share/man/man4/ale.4 Mon Nov 24 01:00:36 2008 (r185240, copy of r184872, head/share/man/man4/ale.4) @@ -0,0 +1,162 @@ +.\" Copyright (c) 2008 Pyun YongHyeon +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 12, 2008 +.Dt ALE 4 +.Os +.Sh NAME +.Nm ale +.Nd Atheros AR8121/AR8113/AR8114 Gigabit/Fast Ethernet driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device miibus" +.Cd "device ale" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_ale_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +device driver provides support for Atheros AR8121 PCI Express +Gigabit Ethernet controller and Atheros AR8113/AR8114 PCI +Express Fast Ethernet controllers. +.Pp +All LOMs supported by the +.Nm +driver have TCP/UDP/IP checksum offload for both receive and transmit, +TCP segmentation offload (TSO), hardware VLAN tag stripping/insertion +features, Wake On Lan (WOL) and an interrupt coalescing/moderation +mechanism as well as a 64-bit multicast hash filter. +.Pp +The AR8121 also supports Jumbo Frames (up to 8132 bytes), which can +be configured via the interface MTU setting. +Selecting an MTU larger than 1500 bytes with the +.Xr ifconfig 8 +utility configures the adapter to receive and transmit Jumbo Frames. +.Pp +The +.Nm +driver supports the following media types: +.Bl -tag -width ".Cm 10baseT/UTP" +.It Cm autoselect +Enable autoselection of the media type and options. +The user can manually override +the autoselected mode by adding media options to +.Xr rc.conf 5 . +.It Cm 10baseT/UTP +Set 10Mbps operation. +.It Cm 100baseTX +Set 100Mbps (Fast Ethernet) operation. +.It Cm 1000baseTX +Set 1000baseTX operation over twisted pair. +.El +.Pp +The +.Nm +driver supports the following media options: +.Bl -tag -width ".Cm full-duplex" +.It Cm full-duplex +Force full duplex operation. +.It Cm half-duplex +Force half duplex operation. +.El +.Pp +For more information on configuring this device, see +.Xr ifconfig 8 . +.Sh HARDWARE +The +.Nm +device driver provides support for the following Ethernet controllers: +.Pp +.Bl -bullet -compact +.It +Atheros AR8113 PCI Express Fast Ethernet controller +.It +Atheros AR8114 PCI Express Fast Ethernet controller +.It +Atheros AR8121 PCI Express Gigabit Ethernet controller +.El +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width "xxxxxx" +.It Va hw.ale.msi_disable +This tunable disables MSI support on the Ethernet hardware. +The default value is 0. +.It Va hw.ale.msix_disable +This tunable disables MSI-X support on the Ethernet hardware. +The default value is 0. +.El +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables: +.Bl -tag -width "xxxxxx" +.It Va dev.ale.%d.int_rx_mod +Maximum amount of time to delay receive interrupt processing in +units of 1us. +The accepted range is 0 to 130000, the default is 30(30us). +Value 0 completely disables the interrupt moderation. +.It Va dev.ale.%d.int_tx_mod +Maximum amount of time to delay transmit interrupt processing in +units of 1us. +The accepted range is 0 to 130000, the default is 1000(1ms). +Value 0 completely disables the interrupt moderation. +.It Va dev.ale.%d.process_limit +Maximum amount of Rx frames to be processed in the event loop before +rescheduling a taskqueue. +The accepted range is 32 to 255, the default value is 128 events. +The interface does not need to be brought down and up again before +a change takes effect. +.El +.Sh SEE ALSO +.Xr altq 4 , +.Xr arp 4 , +.Xr miibus 4 , +.Xr netintro 4 , +.Xr ng_ether 4 , +.Xr vlan 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +driver was written by +.An Pyun YongHyeon +.Aq yongari@FreeBSD.org . +It first appeared in +.Fx 7.1 . Modified: stable/7/share/man/man4/altq.4 ============================================================================== --- stable/7/share/man/man4/altq.4 Mon Nov 24 00:56:19 2008 (r185239) +++ stable/7/share/man/man4/altq.4 Mon Nov 24 01:00:36 2008 (r185240) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 27, 2008 +.Dd November 12, 2008 .Dt ALTQ 4 .Os .Sh NAME @@ -116,6 +116,7 @@ are required to use a certain network ca .Nm . They have been applied to the following hardware drivers: .Xr age 4 , +.Xr ale 4 , .Xr an 4 , .Xr ath 4 , .Xr aue 4 , Modified: stable/7/share/man/man4/miibus.4 ============================================================================== --- stable/7/share/man/man4/miibus.4 Mon Nov 24 00:56:19 2008 (r185239) +++ stable/7/share/man/man4/miibus.4 Mon Nov 24 01:00:36 2008 (r185240) @@ -8,7 +8,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 20, 2008 +.Dd November 12, 2008 .Dt MIIBUS 4 .Os .Sh NAME @@ -47,6 +47,8 @@ interface: .Bl -tag -compact -width ".Xr fxp 4" .It Xr age 4 Attansic/Atheros L1 Gigabit Ethernet +.It Xr ale 4 +Atheros AR8121/AR8113/AR8114 PCIe Ethernet .It Xr aue 4 ADMtek USB Ethernet .It Xr axe 4 @@ -125,6 +127,7 @@ and but as a result are not well behaved newbus device drivers. .Sh SEE ALSO .Xr age 4 , +.Xr ale 4 , .Xr arp 4 , .Xr aue 4 , .Xr axe 4 , Modified: stable/7/share/man/man4/vlan.4 ============================================================================== --- stable/7/share/man/man4/vlan.4 Mon Nov 24 00:56:19 2008 (r185239) +++ stable/7/share/man/man4/vlan.4 Mon Nov 24 01:00:36 2008 (r185240) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 27, 2008 +.Dd November 12, 2008 .Dt VLAN 4 .Os .Sh NAME @@ -124,6 +124,7 @@ By now, the list of physical interfaces in the hardware is limited to the following devices: .Xr ae 4 , .Xr age 4 , +.Xr ale 4 , .Xr bce 4 , .Xr bge 4 , .Xr cxgb 4 , From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 01:10:46 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 525F11065674; Mon, 24 Nov 2008 01:10:46 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from publicd.ub.mng.net (publicd.ub.mng.net [202.179.0.88]) by mx1.freebsd.org (Postfix) with ESMTP id 03A2A8FC0C; Mon, 24 Nov 2008 01:10:45 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from [202.179.0.164] (helo=daemon.micom.mng.net) by publicd.ub.mng.net with esmtpa (Exim 4.69 (FreeBSD)) (envelope-from ) id 1L4PyN-000AQK-Lg; Mon, 24 Nov 2008 09:10:43 +0800 Message-ID: <4929FF13.7070009@micom.mng.net> Date: Mon, 24 Nov 2008 09:10:43 +0800 From: Ganbold User-Agent: Thunderbird 2.0.0.12 (X11/20080415) MIME-Version: 1.0 To: Warner Losh References: <200811232304.mANN4TMu066845@svn.freebsd.org> In-Reply-To: <200811232304.mANN4TMu066845@svn.freebsd.org> X-Enigmail-Version: 0.95.6 OpenPGP: id=78F6425E Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185235 - head/sys/dev/fdc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 01:10:46 -0000 Warner Losh wrote: > Author: imp > Date: Sun Nov 23 23:04:28 2008 > New Revision: 185235 > URL: http://svn.freebsd.org/changeset/base/185235 > > Log: > Eliminate an unused variable reported by coverity > > Submitted by: Ganbold > > Modified: > head/sys/dev/fdc/fdc_pccard.c > > Modified: head/sys/dev/fdc/fdc_pccard.c > ============================================================================== > --- head/sys/dev/fdc/fdc_pccard.c Sun Nov 23 21:05:22 2008 (r185234) > +++ head/sys/dev/fdc/fdc_pccard.c Sun Nov 23 23:04:28 2008 (r185235) > @@ -85,10 +85,8 @@ fdc_pccard_alloc_resources(device_t dev, > static int > fdc_pccard_probe(device_t dev) > { > - const struct pccard_product *pp; > - > - if ((pp = pccard_product_lookup(dev, fdc_pccard_products, > - sizeof(fdc_pccard_products[0]), NULL)) != NULL) { > + if (pccard_product_lookup(dev, fdc_pccard_products, > + sizeof(fdc_pccard_products[0]), NULL) != NULL) { > device_set_desc(dev, "PC Card Floppy"); > return (0); > } > Thanks :) Ganbold > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > > > > -- Cheer Up! Things are getting worse at a slower rate. From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 01:26:22 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE9611065670; Mon, 24 Nov 2008 01:26:22 +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 B96378FC1A; Mon, 24 Nov 2008 01:26:22 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAO1QMWI069947; Mon, 24 Nov 2008 01:26:22 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAO1QMMN069945; Mon, 24 Nov 2008 01:26:22 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811240126.mAO1QMMN069945@svn.freebsd.org> From: Xin LI Date: Mon, 24 Nov 2008 01:26:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185241 - in head/release/doc/en_US.ISO8859-1: hardware relnotes X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 01:26:22 -0000 Author: delphij Date: Mon Nov 24 01:26:22 2008 New Revision: 185241 URL: http://svn.freebsd.org/changeset/base/185241 Log: Document ale(4). Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.sgml Mon Nov 24 01:00:36 2008 (r185240) +++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml Mon Nov 24 01:26:22 2008 (r185241) @@ -664,6 +664,8 @@ &hwlist.age; + &hwlist.ale; + &hwlist.aue; &hwlist.axe; Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Mon Nov 24 01:00:36 2008 (r185240) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Mon Nov 24 01:26:22 2008 (r185241) @@ -225,6 +225,9 @@ Network Interface Support + The &man.ale.4; driver has been added to provide support + for Atheros AR8121/AR8113/AR8114 Gigabit/Fast Ethernet controllers. + The &man.em.4; driver has been split into two drivers with some common parts. The &man.em.4; driver will continue to support adapters up to the 82575, as well as new From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 01:31:11 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2BAC1065673; Mon, 24 Nov 2008 01:31:10 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE6B18FC14; Mon, 24 Nov 2008 01:31:10 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAO1VAJs070077; Mon, 24 Nov 2008 01:31:10 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAO1VAge070075; Mon, 24 Nov 2008 01:31:10 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200811240131.mAO1VAge070075@svn.freebsd.org> From: Sam Leffler Date: Mon, 24 Nov 2008 01:31:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185242 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 01:31:11 -0000 Author: sam Date: Mon Nov 24 01:31:10 2008 New Revision: 185242 URL: http://svn.freebsd.org/changeset/base/185242 Log: nuke special handling of RXORN interrupt; the hal marks the FATAL bit in the interrupt status when RXORN is hit and the chip requires a reset so our special handling was causing useless resets Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Nov 24 01:26:22 2008 (r185241) +++ head/sys/dev/ath/if_ath.c Mon Nov 24 01:31:10 2008 (r185242) @@ -131,7 +131,6 @@ static int ath_media_change(struct ifnet static void ath_watchdog(struct ifnet *); static int ath_ioctl(struct ifnet *, u_long, caddr_t); static void ath_fatal_proc(void *, int); -static void ath_rxorn_proc(void *, int); static void ath_bmiss_vap(struct ieee80211vap *); static void ath_bmiss_proc(void *, int); static int ath_keyset(struct ath_softc *, const struct ieee80211_key *, @@ -409,7 +408,6 @@ ath_attach(u_int16_t devid, struct ath_s "%s taskq", ifp->if_xname); TASK_INIT(&sc->sc_rxtask, 0, ath_rx_proc, sc); - TASK_INIT(&sc->sc_rxorntask, 0, ath_rxorn_proc, sc); TASK_INIT(&sc->sc_bmisstask, 0, ath_bmiss_proc, sc); TASK_INIT(&sc->sc_bstucktask,0, ath_bstuck_proc, sc); @@ -1184,10 +1182,6 @@ ath_intr(void *arg) sc->sc_stats.ast_hardware++; ath_hal_intrset(ah, 0); /* disable intr's until reset */ ath_fatal_proc(sc, 0); - } else if (status & HAL_INT_RXORN) { - sc->sc_stats.ast_rxorn++; - ath_hal_intrset(ah, 0); /* disable intr's until reset */ - taskqueue_enqueue(sc->sc_tq, &sc->sc_rxorntask); } else { if (status & HAL_INT_SWBA) { /* @@ -1234,6 +1228,10 @@ ath_intr(void *arg) ath_hal_mibevent(ah, &sc->sc_halstats); ath_hal_intrset(ah, sc->sc_imask); } + if (status & HAL_INT_RXORN) { + /* NB: hal marks HAL_INT_FATAL when RXORN is fatal */ + sc->sc_stats.ast_rxorn++; + } } } @@ -1263,16 +1261,6 @@ ath_fatal_proc(void *arg, int pending) } static void -ath_rxorn_proc(void *arg, int pending) -{ - struct ath_softc *sc = arg; - struct ifnet *ifp = sc->sc_ifp; - - if_printf(ifp, "rx FIFO overrun; resetting\n"); - ath_reset(ifp); -} - -static void ath_bmiss_vap(struct ieee80211vap *vap) { struct ath_softc *sc = vap->iv_ic->ic_ifp->if_softc; Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Nov 24 01:26:22 2008 (r185241) +++ head/sys/dev/ath/if_athvar.h Mon Nov 24 01:31:10 2008 (r185242) @@ -302,7 +302,6 @@ struct ath_softc { struct mbuf *sc_rxpending; /* pending receive data */ u_int32_t *sc_rxlink; /* link ptr in last RX desc */ struct task sc_rxtask; /* rx int processing */ - struct task sc_rxorntask; /* rxorn int processing */ u_int8_t sc_defant; /* current default antenna */ u_int8_t sc_rxotherant; /* rx's on non-default antenna*/ u_int64_t sc_lastrx; /* tsf at last rx'd frame */ From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 01:34:56 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCCB8106564A; Mon, 24 Nov 2008 01:34:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A7C0E8FC16; Mon, 24 Nov 2008 01:34:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAO1YuCL070216; Mon, 24 Nov 2008 01:34:56 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAO1YuxA070214; Mon, 24 Nov 2008 01:34:56 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200811240134.mAO1YuxA070214@svn.freebsd.org> From: Sam Leffler Date: Mon, 24 Nov 2008 01:34:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185243 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 01:34:56 -0000 Author: sam Date: Mon Nov 24 01:34:56 2008 New Revision: 185243 URL: http://svn.freebsd.org/changeset/base/185243 Log: print the extended tx/rx descriptor for 5416 and later parts Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Nov 24 01:31:10 2008 (r185242) +++ head/sys/dev/ath/if_ath.c Mon Nov 24 01:34:56 2008 (r185243) @@ -274,8 +274,10 @@ TUNABLE_INT("hw.ath.debug", &ath_debug); if (sc->sc_debug & ATH_DEBUG_KEYCACHE) \ ath_keyprint(sc, __func__, ix, hk, mac); \ } while (0) -static void ath_printrxbuf(const struct ath_buf *bf, u_int ix, int); -static void ath_printtxbuf(const struct ath_buf *bf, u_int qnum, u_int ix, int done); +static void ath_printrxbuf(struct ath_softc *, const struct ath_buf *bf, + u_int ix, int); +static void ath_printtxbuf(struct ath_softc *, const struct ath_buf *bf, + u_int qnum, u_int ix, int done); #else #define IFF_DUMPPKTS(sc, m) \ ((sc->sc_ifp->if_flags & (IFF_DEBUG|IFF_LINK2)) == (IFF_DEBUG|IFF_LINK2)) @@ -4016,7 +4018,7 @@ ath_rx_proc(void *arg, int npending) bf->bf_daddr, PA2DESC(sc, ds->ds_link), rs); #ifdef ATH_DEBUG if (sc->sc_debug & ATH_DEBUG_RECV_DESC) - ath_printrxbuf(bf, 0, status == HAL_OK); + ath_printrxbuf(sc, bf, 0, status == HAL_OK); #endif if (status == HAL_EINPROGRESS) break; @@ -5015,7 +5017,8 @@ ath_tx_processq(struct ath_softc *sc, st status = ath_hal_txprocdesc(ah, ds, ts); #ifdef ATH_DEBUG if (sc->sc_debug & ATH_DEBUG_XMIT_DESC) - ath_printtxbuf(bf, txq->axq_qnum, 0, status == HAL_OK); + ath_printtxbuf(sc, bf, txq->axq_qnum, 0, + status == HAL_OK); #endif if (status == HAL_EINPROGRESS) { ATH_TXQ_UNLOCK(txq); @@ -5234,7 +5237,7 @@ ath_tx_draintxq(struct ath_softc *sc, st if (sc->sc_debug & ATH_DEBUG_RESET) { struct ieee80211com *ic = sc->sc_ifp->if_l2com; - ath_printtxbuf(bf, txq->axq_qnum, ix, + ath_printtxbuf(sc, bf, txq->axq_qnum, ix, ath_hal_txprocdesc(ah, bf->bf_desc, &bf->bf_status.ds_txstat) == HAL_OK); ieee80211_dump_pkt(ic, mtod(bf->bf_m, caddr_t), @@ -5302,7 +5305,7 @@ ath_draintxq(struct ath_softc *sc) if (sc->sc_debug & ATH_DEBUG_RESET) { struct ath_buf *bf = STAILQ_FIRST(&sc->sc_bbuf); if (bf != NULL && bf->bf_m != NULL) { - ath_printtxbuf(bf, sc->sc_bhalq, 0, + ath_printtxbuf(sc, bf, sc->sc_bhalq, 0, ath_hal_txprocdesc(ah, bf->bf_desc, &bf->bf_status.ds_txstat) == HAL_OK); ieee80211_dump_pkt(ifp->if_l2com, mtod(bf->bf_m, caddr_t), @@ -5343,7 +5346,7 @@ ath_stoprecv(struct ath_softc *sc) HAL_STATUS status = ath_hal_rxprocdesc(ah, ds, bf->bf_daddr, PA2DESC(sc, ds->ds_link), rs); if (status == HAL_OK || (sc->sc_debug & ATH_DEBUG_FATAL)) - ath_printrxbuf(bf, ix, status == HAL_OK); + ath_printrxbuf(sc, bf, ix, status == HAL_OK); ix++; } } @@ -6253,9 +6256,11 @@ ath_setcurmode(struct ath_softc *sc, enu #ifdef ATH_DEBUG static void -ath_printrxbuf(const struct ath_buf *bf, u_int ix, int done) +ath_printrxbuf(struct ath_softc *sc, const struct ath_buf *bf, + u_int ix, int done) { const struct ath_rx_status *rs = &bf->bf_status.ds_rxstat; + struct ath_hal *ah = sc->sc_ah; const struct ath_desc *ds; int i; @@ -6267,13 +6272,21 @@ ath_printrxbuf(const struct ath_buf *bf, !done ? "" : (rs->rs_status == 0) ? " *" : " !", ds->ds_ctl0, ds->ds_ctl1, ds->ds_hw[0], ds->ds_hw[1]); + if (ah->ah_magic == 0x20065416) { + printf(" %08x %08x %08x %08x %08x %08x %08x\n", + ds->ds_hw[2], ds->ds_hw[3], ds->ds_hw[4], + ds->ds_hw[5], ds->ds_hw[6], ds->ds_hw[7], + ds->ds_hw[8]); + } } } static void -ath_printtxbuf(const struct ath_buf *bf, u_int qnum, u_int ix, int done) +ath_printtxbuf(struct ath_softc *sc, const struct ath_buf *bf, + u_int qnum, u_int ix, int done) { const struct ath_tx_status *ts = &bf->bf_status.ds_txstat; + struct ath_hal *ah = sc->sc_ah; const struct ath_desc *ds; int i; @@ -6286,6 +6299,16 @@ ath_printtxbuf(const struct ath_buf *bf, !done ? "" : (ts->ts_status == 0) ? " *" : " !", ds->ds_ctl0, ds->ds_ctl1, ds->ds_hw[0], ds->ds_hw[1], ds->ds_hw[2], ds->ds_hw[3]); + if (ah->ah_magic == 0x20065416) { + printf(" %08x %08x %08x %08x %08x %08x %08x %08x\n", + ds->ds_hw[4], ds->ds_hw[5], ds->ds_hw[6], + ds->ds_hw[7], ds->ds_hw[8], ds->ds_hw[9], + ds->ds_hw[10],ds->ds_hw[11]); + printf(" %08x %08x %08x %08x %08x %08x %08x %08x\n", + ds->ds_hw[12],ds->ds_hw[13],ds->ds_hw[14], + ds->ds_hw[15],ds->ds_hw[16],ds->ds_hw[17], + ds->ds_hw[18], ds->ds_hw[19]); + } } } #endif /* ATH_DEBUG */ From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 02:21:50 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9D1B1065670; Mon, 24 Nov 2008 02:21:50 +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 A3C5E8FC0A; Mon, 24 Nov 2008 02:21:50 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAO2LoFu071231; Mon, 24 Nov 2008 02:21:50 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAO2LoTY071230; Mon, 24 Nov 2008 02:21:50 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811240221.mAO2LoTY071230@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 24 Nov 2008 02:21:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185244 - head/sys/dev/msk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 02:21:50 -0000 Author: yongari Date: Mon Nov 24 02:21:50 2008 New Revision: 185244 URL: http://svn.freebsd.org/changeset/base/185244 Log: Save the value read from TX queue CSR, so we don't test against a stale one. Submitted by: sephe Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon Nov 24 01:34:56 2008 (r185243) +++ head/sys/dev/msk/if_msk.c Mon Nov 24 02:21:50 2008 (r185244) @@ -3966,7 +3966,7 @@ msk_stop(struct msk_if_softc *sc_if) if ((val & (BMU_STOP | BMU_IDLE)) == 0) { CSR_WRITE_4(sc, Q_ADDR(sc_if->msk_txq, Q_CSR), BMU_STOP); - CSR_READ_4(sc, Q_ADDR(sc_if->msk_txq, Q_CSR)); + val = CSR_READ_4(sc, Q_ADDR(sc_if->msk_txq, Q_CSR)); } else break; DELAY(1); From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 08:11:33 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 792DB1065672; Mon, 24 Nov 2008 08:11:33 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 648F78FC08; Mon, 24 Nov 2008 08:11:33 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAO8BXrO078935; Mon, 24 Nov 2008 08:11:33 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAO8BXG6078934; Mon, 24 Nov 2008 08:11:33 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200811240811.mAO8BXG6078934@svn.freebsd.org> From: Joseph Koshy Date: Mon, 24 Nov 2008 08:11:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185246 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 08:11:33 -0000 Author: jkoshy Date: Mon Nov 24 08:11:33 2008 New Revision: 185246 URL: http://svn.freebsd.org/changeset/base/185246 Log: - Document the rules used to determine when spellings of events are equivalent. - Reorder text to make the manual page more coherent. Modified: head/lib/libpmc/pmc.3 Modified: head/lib/libpmc/pmc.3 ============================================================================== --- head/lib/libpmc/pmc.3 Mon Nov 24 06:47:27 2008 (r185245) +++ head/lib/libpmc/pmc.3 Mon Nov 24 08:11:33 2008 (r185246) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 16, 2008 +.Dd November 24, 2008 .Os .Dt PMC 3 .Sh NAME @@ -446,6 +446,29 @@ optional parameters modifying the semant being probed. Event names are PMC architecture dependent, but the PMC library defines machine independent aliases for commonly used events. +.Pp +Event specifiers spellings are case-insensitive and space characters, +periods, underscores and hyphens are considered equivalent to each other. +Thus the event specifiers +.Qq "Example Event" , +.Qq "example-event" , +and +.Qq "EXAMPLE_EVENT" +are equivalent. +.Ss PMC Architecture Dependent Events +PMC architecture dependent event specifiers are described in the +following manual pages: +.Bl -column " PMC_CLASS_TSC " "MANUAL PAGE " +.It Em "PMC Class" Ta Em "Manual Page" +.It Li PMC_CLASS_IAF Ta Xr pmc.iaf 3 +.It Li PMC_CLASS_IAP Ta Xr pmc.atom 3 , Xr pmc.core 3 , Xr pmc.core2 3 +.It Li PMC_CLASS_K7 Ta Xr pmc.k7 3 +.It Li PMC_CLASS_K8 Ta Xr pmc.k8 3 +.It Li PMC_CLASS_P4 Ta Xr pmc.p4 3 +.It Li PMC_CLASS_P5 Ta Xr pmc.p5 3 +.It Li PMC_CLASS_P6 Ta Xr pmc.p6 3 +.It Li PMC_CLASS_TSC Ta Xr pmc.tsc 3 +.El .Ss Event Name Aliases Event name aliases are PMC-independent names for commonly used events. The following aliases are known to this version of the @@ -472,21 +495,6 @@ Measure the number of interrupts seen. Measure the number of cycles the processor is not in a halted or sleep state. .El -.Pp -.Ss PMC Architecture Dependent Events -PMC architecture dependent event specifiers are described in the -following manual pages: -.Bl -column " PMC_CLASS_TSC " "MANUAL PAGE " -.It Em "PMC Class" Ta Em "Manual Page" -.It Li PMC_CLASS_IAF Ta Xr pmc.iaf 3 -.It Li PMC_CLASS_IAP Ta Xr pmc.atom 3 , Xr pmc.core 3 , Xr pmc.core2 3 -.It Li PMC_CLASS_K7 Ta Xr pmc.k7 3 -.It Li PMC_CLASS_K8 Ta Xr pmc.k8 3 -.It Li PMC_CLASS_P4 Ta Xr pmc.p4 3 -.It Li PMC_CLASS_P5 Ta Xr pmc.p5 3 -.It Li PMC_CLASS_P6 Ta Xr pmc.p6 3 -.It Li PMC_CLASS_TSC Ta Xr pmc.tsc 3 -.El .Sh COMPATIBILITY The interface between the .Nm pmc From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 08:14:02 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A7C7106564A; Mon, 24 Nov 2008 08:14:02 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 264788FC12; Mon, 24 Nov 2008 08:14:02 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAO8E2C6079021; Mon, 24 Nov 2008 08:14:02 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAO8E1vE079018; Mon, 24 Nov 2008 08:14:01 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200811240814.mAO8E1vE079018@svn.freebsd.org> From: Joseph Koshy Date: Mon, 24 Nov 2008 08:14:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185247 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 08:14:02 -0000 Author: jkoshy Date: Mon Nov 24 08:14:01 2008 New Revision: 185247 URL: http://svn.freebsd.org/changeset/base/185247 Log: Correction: these PMCs do not support a "umask" modifier. Modified: head/lib/libpmc/pmc.atom.3 head/lib/libpmc/pmc.core.3 head/lib/libpmc/pmc.core2.3 Modified: head/lib/libpmc/pmc.atom.3 ============================================================================== --- head/lib/libpmc/pmc.atom.3 Mon Nov 24 08:11:33 2008 (r185246) +++ head/lib/libpmc/pmc.atom.3 Mon Nov 24 08:14:01 2008 (r185247) @@ -108,9 +108,6 @@ qualifier. .It Li os Configure the PMC to count events happening at processor privilege level 0. -.It Li umask= Ns Ar value -This qualifier is used to further qualify the event selected (see -below). .It Li usr Configure the PMC to count events occurring at privilege levels 1, 2 or 3. Modified: head/lib/libpmc/pmc.core.3 ============================================================================== --- head/lib/libpmc/pmc.core.3 Mon Nov 24 08:11:33 2008 (r185246) +++ head/lib/libpmc/pmc.core.3 Mon Nov 24 08:14:01 2008 (r185247) @@ -100,9 +100,6 @@ qualifier. .It Li os Configure the PMC to count events happening at processor privilege level 0. -.It Li umask= Ns Ar value -This qualifier is used to further qualify the event selected (see -below). .It Li usr Configure the PMC to count events occurring at privilege levels 1, 2 or 3. Modified: head/lib/libpmc/pmc.core2.3 ============================================================================== --- head/lib/libpmc/pmc.core2.3 Mon Nov 24 08:11:33 2008 (r185246) +++ head/lib/libpmc/pmc.core2.3 Mon Nov 24 08:14:01 2008 (r185247) @@ -106,9 +106,6 @@ qualifier. .It Li os Configure the PMC to count events happening at processor privilege level 0. -.It Li umask= Ns Ar value -This qualifier is used to further qualify the event selected (see -below). .It Li usr Configure the PMC to count events occurring at privilege levels 1, 2 or 3. From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 11:07:29 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C94E106564A; Mon, 24 Nov 2008 11:07:27 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63C4B8FC21; Mon, 24 Nov 2008 11:07:27 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOB7R1g084953; Mon, 24 Nov 2008 11:07:27 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOB7RlQ084952; Mon, 24 Nov 2008 11:07:27 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811241107.mAOB7RlQ084952@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 24 Nov 2008 11:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185248 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 11:07:29 -0000 Author: pjd Date: Mon Nov 24 11:07:25 2008 New Revision: 185248 URL: http://svn.freebsd.org/changeset/base/185248 Log: The Big ZFS Update is done. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Mon Nov 24 08:14:01 2008 (r185247) +++ svnadmin/conf/sizelimit.conf Mon Nov 24 11:07:25 2008 (r185248) @@ -17,4 +17,3 @@ #peter 3141592 #grog #kan -pjd 10485760 From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 11:22:26 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71F24106564A; Mon, 24 Nov 2008 11:22:26 +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 610298FC18; Mon, 24 Nov 2008 11:22:26 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOBMQqE085871; Mon, 24 Nov 2008 11:22:26 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOBMQr1085870; Mon, 24 Nov 2008 11:22:26 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811241122.mAOBMQr1085870@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 24 Nov 2008 11:22:26 +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: r185249 - in stable/7/sys: . dev/vr modules/cxgb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 11:22:26 -0000 Author: yongari Date: Mon Nov 24 11:22:25 2008 New Revision: 185249 URL: http://svn.freebsd.org/changeset/base/185249 Log: MFC r185014: Fix typo. It restuled in activating unwanted Rx filtering as well as resetting Rx threshold configuration. Submitted by: Joost Mulders < Joost.Mulders <> Sun DOT COM > Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/dev/vr/if_vr.c stable/7/sys/modules/cxgb/ (props changed) Modified: stable/7/sys/dev/vr/if_vr.c ============================================================================== --- stable/7/sys/dev/vr/if_vr.c Mon Nov 24 11:07:25 2008 (r185248) +++ stable/7/sys/dev/vr/if_vr.c Mon Nov 24 11:22:25 2008 (r185249) @@ -465,7 +465,8 @@ vr_set_filter(struct vr_softc *sc) ifp = sc->vr_ifp; rxfilt = CSR_READ_1(sc, VR_RXCFG); - rxfilt = ~(VR_RXCFG_RX_PROMISC | VR_RXCFG_RX_BROAD | VR_RXCFG_RX_MULTI); + rxfilt &= ~(VR_RXCFG_RX_PROMISC | VR_RXCFG_RX_BROAD | + VR_RXCFG_RX_MULTI); if (ifp->if_flags & IFF_BROADCAST) rxfilt |= VR_RXCFG_RX_BROAD; if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 11:23:14 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0BB51065670; Mon, 24 Nov 2008 11:23:14 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B18FE8FC08; Mon, 24 Nov 2008 11:23:14 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOBNEk7085925; Mon, 24 Nov 2008 11:23:14 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOBNEa8085924; Mon, 24 Nov 2008 11:23:14 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200811241123.mAOBNEa8085924@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 24 Nov 2008 11:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185250 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 11:23:14 -0000 Author: des Date: Mon Nov 24 11:23:14 2008 New Revision: 185250 URL: http://svn.freebsd.org/changeset/base/185250 Log: Change the universe target to warn the user for every world or kernel that fails. The error message includes a reference to the relevant log file. Approved by: phk MFC after: 1 week Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Mon Nov 24 11:22:25 2008 (r185249) +++ head/Makefile Mon Nov 24 11:23:14 2008 (r185250) @@ -292,22 +292,28 @@ universe: universe_${target} universe_${target}: .if !defined(MAKE_JUST_KERNELS) @echo ">> ${target} started on `LC_ALL=C date`" - -cd ${.CURDIR} && ${MAKE} ${JFLAG} buildworld \ + @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ + ${MAKE} ${JFLAG} buildworld \ TARGET=${target} \ - __MAKE_CONF=/dev/null \ - > _.${target}.buildworld 2>&1 + > _.${target}.buildworld 2>&1 || \ + echo "${target} world failed," \ + "check _.${target}.buildworld for details") @echo ">> ${target} buildworld completed on `LC_ALL=C date`" .endif .if exists(${.CURDIR}/sys/${target}/conf/NOTES) - -cd ${.CURDIR}/sys/${target}/conf && ${MAKE} LINT \ - > ${.CURDIR}/_.${target}.makeLINT 2>&1 + @(cd ${.CURDIR}/sys/${target}/conf && env __MAKE_CONF=/dev/null \ + ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \ + echo "${target} 'make LINT' failed," \ + "check _.${target}.makeLINT for details") .endif .for kernel in ${KERNCONFS} - -cd ${.CURDIR} && ${MAKE} ${JFLAG} buildkernel \ + @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ + ${MAKE} ${JFLAG} buildkernel \ TARGET=${target} \ KERNCONF=${kernel} \ - __MAKE_CONF=/dev/null \ - > _.${target}.${kernel} 2>&1 + > _.${target}.${kernel} 2>&1 || \ + echo "${target} ${kernel} kernel failed," \ + "check _.${target}.${kernel} for details") .endfor @echo ">> ${target} completed on `LC_ALL=C date`" .endfor From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 13:49:50 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C72C1065673; Mon, 24 Nov 2008 13:49:50 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 4E3D48FC1B; Mon, 24 Nov 2008 13:49:50 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 5CC6B6D449; Mon, 24 Nov 2008 13:49:49 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 4081A844AD; Mon, 24 Nov 2008 14:49:49 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Sean Farley References: <200811232326.mANNQCLp067323@svn.freebsd.org> Date: Mon, 24 Nov 2008 14:49:49 +0100 In-Reply-To: <200811232326.mANNQCLp067323@svn.freebsd.org> (Sean Farley's message of "Sun, 23 Nov 2008 23:26:12 +0000 (UTC)") Message-ID: <86wsetfd36.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185237 - head/lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 13:49:50 -0000 Sean Farley writes: > Log: > Fixed style issues with variable ordering and naming, spacing and > parentheses. >=20=20=20 > Fixed alignment issue in gr_dup() in its assignment of gr_mem using a > struct to force alignment without performing alignment mathematics. Th= is > was noticed recently with libutil was built with WARNS=3D6 on platform = such > as sparc64. >=20=20=20 > Added checks to gr_dup(), gr_equal() and gr_make() to prevent segfaults > when examining struct group's with the struct members pointing to NULL'= s. >=20=20=20 > With fix of alignment issue, restore WARNS?=3D6. Good work, thank you! DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 16:32:39 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6217A1065677; Mon, 24 Nov 2008 16:32:39 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5404C8FC13; Mon, 24 Nov 2008 16:32:39 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOGWdY1092112; Mon, 24 Nov 2008 16:32:39 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOGWd1X092111; Mon, 24 Nov 2008 16:32:39 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811241632.mAOGWd1X092111@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 24 Nov 2008 16:32:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185251 - head/tools/regression/fstest/tests X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 16:32:39 -0000 Author: pjd Date: Mon Nov 24 16:32:39 2008 New Revision: 185251 URL: http://svn.freebsd.org/changeset/base/185251 Log: Include TODO messages even if tests succeeds, so we can detect when something suddenly started to work. Modified: head/tools/regression/fstest/tests/misc.sh Modified: head/tools/regression/fstest/tests/misc.sh ============================================================================== --- head/tools/regression/fstest/tests/misc.sh Mon Nov 24 11:23:14 2008 (r185250) +++ head/tools/regression/fstest/tests/misc.sh Mon Nov 24 16:32:39 2008 (r185251) @@ -25,15 +25,19 @@ expect() r=`${fstest} $* 2>/dev/null | tail -1` echo "${r}" | egrep '^'${e}'$' >/dev/null 2>&1 if [ $? -eq 0 ]; then - echo "ok ${ntest}" + if [ -z "${todomsg}" ]; then + echo "ok ${ntest}" + else + echo "ok ${ntest} # TODO ${todomsg}" + fi else if [ -z "${todomsg}" ]; then echo "not ok ${ntest} - tried '$*', expected ${e}, got ${r}" else echo "not ok ${ntest} # TODO ${todomsg}" - todomsg="" fi fi + todomsg="" ntest=`expr $ntest + 1` } @@ -46,30 +50,38 @@ jexpect() r=`jail -s ${s} / fstest 127.0.0.1 /bin/sh -c "cd ${d} && ${fstest} $* 2>/dev/null" | tail -1` echo "${r}" | egrep '^'${e}'$' >/dev/null 2>&1 if [ $? -eq 0 ]; then - echo "ok ${ntest}" + if [ -z "${todomsg}" ]; then + echo "ok ${ntest}" + else + echo "ok ${ntest} # TODO ${todomsg}" + fi else if [ -z "${todomsg}" ]; then echo "not ok ${ntest} - tried '$*', expected ${e}, got ${r}" else echo "not ok ${ntest} # TODO ${todomsg}" - todomsg="" fi fi + todomsg="" ntest=`expr $ntest + 1` } test_check() { if [ $* ]; then - echo "ok ${ntest}" + if [ -z "${todomsg}" ]; then + echo "ok ${ntest}" + else + echo "ok ${ntest} # TODO ${todomsg}" + fi else if [ -z "${todomsg}" ]; then echo "not ok ${ntest}" else echo "not ok ${ntest} # TODO ${todomsg}" - todomsg="" fi fi + todomsg="" ntest=`expr $ntest + 1` } From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 16:33:23 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55E5F1065676; Mon, 24 Nov 2008 16:33:23 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 47C498FC22; Mon, 24 Nov 2008 16:33:23 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOGXNj5092179; Mon, 24 Nov 2008 16:33:23 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOGXN24092178; Mon, 24 Nov 2008 16:33:23 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811241633.mAOGXN24092178@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 24 Nov 2008 16:33:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185252 - head/tools/regression/fstest/tests/rename X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 16:33:23 -0000 Author: pjd Date: Mon Nov 24 16:33:23 2008 New Revision: 185252 URL: http://svn.freebsd.org/changeset/base/185252 Log: This actually works on Linux, I just had wrong directory permission. Found by: trasz Modified: head/tools/regression/fstest/tests/rename/21.t Modified: head/tools/regression/fstest/tests/rename/21.t ============================================================================== --- head/tools/regression/fstest/tests/rename/21.t Mon Nov 24 16:32:39 2008 (r185251) +++ head/tools/regression/fstest/tests/rename/21.t Mon Nov 24 16:33:23 2008 (r185252) @@ -37,14 +37,10 @@ expect ENOENT rmdir ${n3}/${n1} # Check that write permission on containing directory (${n2}) is enough # to move file (${n0}) from that directory. expect 0 create ${n2}/${n0} 0755 -todo Linux "According to POSIX, write access to ${n2}/${n0} and (if exists) ${n3}/${n1} may be required if ${n0} and (if exists) ${n1} are directories, not regular files." expect 0 -u 65534 -g 65534 rename ${n2}/${n0} ${n3}/${n1} -todo Linux "According to POSIX, write access to ${n2}/${n0} and (if exists) ${n3}/${n1} may be required if ${n0} and (if exists) ${n1} are directories, not regular files." expect 0 unlink ${n3}/${n1} -todo Linux "According to POSIX, write access to ${n2}/${n0} and (if exists) ${n3}/${n1} may be required if ${n0} and (if exists) ${n1} are directories, not regular files." expect ENOENT unlink ${n2}/${n0} expect 0 rmdir ${n3} expect 0 rmdir ${n2} - From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 17:34:01 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 219D7106564A; Mon, 24 Nov 2008 17:34:01 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13C9D8FC0A; Mon, 24 Nov 2008 17:34:01 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOHY0Vx093431; Mon, 24 Nov 2008 17:34:00 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOHY0Gw093429; Mon, 24 Nov 2008 17:34:00 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200811241734.mAOHY0Gw093429@svn.freebsd.org> From: Sam Leffler Date: Mon, 24 Nov 2008 17:34:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185253 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 17:34:01 -0000 Author: sam Date: Mon Nov 24 17:34:00 2008 New Revision: 185253 URL: http://svn.freebsd.org/changeset/base/185253 Log: use consistent style Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Nov 24 16:33:23 2008 (r185252) +++ head/sys/net/if.c Mon Nov 24 17:34:00 2008 (r185253) @@ -736,8 +736,7 @@ if_detach(struct ifnet *ifp) INIT_VNET_NET(ifp->if_vnet); struct ifaddr *ifa; struct radix_node_head *rnh; - int s; - int i; + int s, i, j; struct domain *dp; struct ifnet *iter; int found = 0; @@ -809,14 +808,13 @@ if_detach(struct ifnet *ifp) * to this interface...oh well... */ for (i = 1; i <= AF_MAX; i++) { - int j; - for (j = 0; j < rt_numfibs; j++) { - if ((rnh = V_rt_tables[j][i]) == NULL) - continue; - RADIX_NODE_HEAD_LOCK(rnh); - (void) rnh->rnh_walktree(rnh, if_rtdel, ifp); - RADIX_NODE_HEAD_UNLOCK(rnh); - } + for (j = 0; j < rt_numfibs; j++) { + if ((rnh = V_rt_tables[j][i]) == NULL) + continue; + RADIX_NODE_HEAD_LOCK(rnh); + (void) rnh->rnh_walktree(rnh, if_rtdel, ifp); + RADIX_NODE_HEAD_UNLOCK(rnh); + } } /* Announce that the interface is gone. */ From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 17:39:40 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47B161065670; Mon, 24 Nov 2008 17:39:40 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 35B238FC13; Mon, 24 Nov 2008 17:39:40 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOHdetu093567; Mon, 24 Nov 2008 17:39:40 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOHdeiR093565; Mon, 24 Nov 2008 17:39:40 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200811241739.mAOHdeiR093565@svn.freebsd.org> From: Colin Percival Date: Mon, 24 Nov 2008 17:39: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: r185254 - head/sys/dev/random releng/6.3 releng/6.3/sys/conf releng/6.3/sys/dev/random releng/6.4 releng/6.4/sys/dev/random releng/7.0 releng/7.0/sys/conf releng/7.0/sys/dev/random stab... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 17:39:40 -0000 Author: cperciva Date: Mon Nov 24 17:39:39 2008 New Revision: 185254 URL: http://svn.freebsd.org/changeset/base/185254 Log: Make sure arc4random(9) is properly seeded when /etc/rc.d/initrandom returns. Approved by: so (cperciva) Approved by: re (kensmith) Security: FreeBSD-SA-08:11.arc4random Modified: stable/7/sys/dev/random/randomdev.c stable/7/sys/dev/random/randomdev_soft.c Changes in other areas also in this revision: Modified: head/sys/dev/random/randomdev.c head/sys/dev/random/randomdev_soft.c releng/6.3/UPDATING releng/6.3/sys/conf/newvers.sh releng/6.3/sys/dev/random/randomdev.c releng/6.3/sys/dev/random/randomdev_soft.c releng/6.4/UPDATING releng/6.4/sys/dev/random/randomdev.c releng/6.4/sys/dev/random/randomdev_soft.c releng/7.0/UPDATING releng/7.0/sys/conf/newvers.sh releng/7.0/sys/dev/random/randomdev.c releng/7.0/sys/dev/random/randomdev_soft.c stable/6/sys/dev/random/randomdev.c stable/6/sys/dev/random/randomdev_soft.c Modified: stable/7/sys/dev/random/randomdev.c ============================================================================== --- stable/7/sys/dev/random/randomdev.c Mon Nov 24 17:34:00 2008 (r185253) +++ stable/7/sys/dev/random/randomdev.c Mon Nov 24 17:39:39 2008 (r185254) @@ -90,6 +90,7 @@ random_close(struct cdev *dev __unused, && (securelevel_gt(td->td_ucred, 0) == 0)) { (*random_systat.reseed)(); random_systat.seeded = 1; + arc4rand(NULL, 0, 1); /* Reseed arc4random as well. */ } return (0); Modified: stable/7/sys/dev/random/randomdev_soft.c ============================================================================== --- stable/7/sys/dev/random/randomdev_soft.c Mon Nov 24 17:34:00 2008 (r185253) +++ stable/7/sys/dev/random/randomdev_soft.c Mon Nov 24 17:39:39 2008 (r185254) @@ -61,6 +61,7 @@ random_harvest_internal(u_int64_t, const u_int, u_int, enum esource); static int random_yarrow_poll(int event,struct thread *td); static int random_yarrow_block(int flag); +static void random_yarrow_flush_reseed(void); struct random_systat random_yarrow = { .ident = "Software, Yarrow", @@ -70,7 +71,7 @@ struct random_systat random_yarrow = { .read = random_yarrow_read, .write = random_yarrow_write, .poll = random_yarrow_poll, - .reseed = random_yarrow_reseed, + .reseed = random_yarrow_flush_reseed, .seeded = 1, }; @@ -96,7 +97,7 @@ static struct entropyfifo emptyfifo; /* Harvested entropy */ static struct entropyfifo harvestfifo[ENTROPYSOURCE]; -/* <0 to end the kthread, 0 to let it run */ +/* <0 to end the kthread, 0 to let it run, 1 to flush the harvest queues */ static int random_kthread_control = 0; static struct proc *random_kthread_proc; @@ -241,7 +242,7 @@ random_kthread(void *arg __unused) local_count = 0; /* Process until told to stop */ - for (; random_kthread_control == 0;) { + for (; random_kthread_control >= 0;) { active = 0; @@ -276,6 +277,13 @@ random_kthread(void *arg __unused) KASSERT(local_count == 0, ("random_kthread: local_count %d", local_count)); + /* + * If a queue flush was commanded, it has now happened, + * and we can mark this by resetting the command. + */ + if (random_kthread_control == 1) + random_kthread_control = 0; + /* Found nothing, so don't belabour the issue */ if (!active) pause("-", hz / 10); @@ -400,3 +408,15 @@ random_yarrow_block(int flag) return error; } + +/* Helper routine to perform explicit reseeds */ +static void +random_yarrow_flush_reseed(void) +{ + /* Command a entropy queue flush and wait for it to finish */ + random_kthread_control = 1; + while (random_kthread_control) + pause("-", hz / 10); + + random_yarrow_reseed(); +} From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 17:39:40 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7767D106564A; Mon, 24 Nov 2008 17:39:40 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 664DE8FC1D; Mon, 24 Nov 2008 17:39:40 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOHdex0093574; Mon, 24 Nov 2008 17:39:40 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOHdeOC093572; Mon, 24 Nov 2008 17:39:40 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200811241739.mAOHdeOC093572@svn.freebsd.org> From: Colin Percival Date: Mon, 24 Nov 2008 17:39:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185254 - head/sys/dev/random releng/6.3 releng/6.3/sys/conf releng/6.3/sys/dev/random releng/6.4 releng/6.4/sys/dev/random releng/7.0 releng/7.0/sys/conf releng/7.0/sys/dev/random stab... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 17:39:40 -0000 Author: cperciva Date: Mon Nov 24 17:39:39 2008 New Revision: 185254 URL: http://svn.freebsd.org/changeset/base/185254 Log: Make sure arc4random(9) is properly seeded when /etc/rc.d/initrandom returns. Approved by: so (cperciva) Approved by: re (kensmith) Security: FreeBSD-SA-08:11.arc4random Modified: head/sys/dev/random/randomdev.c head/sys/dev/random/randomdev_soft.c Changes in other areas also in this revision: Modified: releng/6.3/UPDATING releng/6.3/sys/conf/newvers.sh releng/6.3/sys/dev/random/randomdev.c releng/6.3/sys/dev/random/randomdev_soft.c releng/6.4/UPDATING releng/6.4/sys/dev/random/randomdev.c releng/6.4/sys/dev/random/randomdev_soft.c releng/7.0/UPDATING releng/7.0/sys/conf/newvers.sh releng/7.0/sys/dev/random/randomdev.c releng/7.0/sys/dev/random/randomdev_soft.c stable/6/sys/dev/random/randomdev.c stable/6/sys/dev/random/randomdev_soft.c stable/7/sys/dev/random/randomdev.c stable/7/sys/dev/random/randomdev_soft.c Modified: head/sys/dev/random/randomdev.c ============================================================================== --- head/sys/dev/random/randomdev.c Mon Nov 24 17:34:00 2008 (r185253) +++ head/sys/dev/random/randomdev.c Mon Nov 24 17:39:39 2008 (r185254) @@ -90,6 +90,7 @@ random_close(struct cdev *dev __unused, && (securelevel_gt(td->td_ucred, 0) == 0)) { (*random_systat.reseed)(); random_systat.seeded = 1; + arc4rand(NULL, 0, 1); /* Reseed arc4random as well. */ } return (0); Modified: head/sys/dev/random/randomdev_soft.c ============================================================================== --- head/sys/dev/random/randomdev_soft.c Mon Nov 24 17:34:00 2008 (r185253) +++ head/sys/dev/random/randomdev_soft.c Mon Nov 24 17:39:39 2008 (r185254) @@ -61,6 +61,7 @@ random_harvest_internal(u_int64_t, const u_int, u_int, enum esource); static int random_yarrow_poll(int event,struct thread *td); static int random_yarrow_block(int flag); +static void random_yarrow_flush_reseed(void); struct random_systat random_yarrow = { .ident = "Software, Yarrow", @@ -70,7 +71,7 @@ struct random_systat random_yarrow = { .read = random_yarrow_read, .write = random_yarrow_write, .poll = random_yarrow_poll, - .reseed = random_yarrow_reseed, + .reseed = random_yarrow_flush_reseed, .seeded = 1, }; @@ -96,7 +97,7 @@ static struct entropyfifo emptyfifo; /* Harvested entropy */ static struct entropyfifo harvestfifo[ENTROPYSOURCE]; -/* <0 to end the kthread, 0 to let it run */ +/* <0 to end the kthread, 0 to let it run, 1 to flush the harvest queues */ static int random_kthread_control = 0; static struct proc *random_kthread_proc; @@ -241,7 +242,7 @@ random_kthread(void *arg __unused) local_count = 0; /* Process until told to stop */ - for (; random_kthread_control == 0;) { + for (; random_kthread_control >= 0;) { active = 0; @@ -276,6 +277,13 @@ random_kthread(void *arg __unused) KASSERT(local_count == 0, ("random_kthread: local_count %d", local_count)); + /* + * If a queue flush was commanded, it has now happened, + * and we can mark this by resetting the command. + */ + if (random_kthread_control == 1) + random_kthread_control = 0; + /* Found nothing, so don't belabour the issue */ if (!active) pause("-", hz / 10); @@ -400,3 +408,15 @@ random_yarrow_block(int flag) return error; } + +/* Helper routine to perform explicit reseeds */ +static void +random_yarrow_flush_reseed(void) +{ + /* Command a entropy queue flush and wait for it to finish */ + random_kthread_control = 1; + while (random_kthread_control) + pause("-", hz / 10); + + random_yarrow_reseed(); +} From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 17:39:41 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 130DD1065673; Mon, 24 Nov 2008 17:39:41 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00C2D8FC1E; Mon, 24 Nov 2008 17:39:41 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOHdeG4093590; Mon, 24 Nov 2008 17:39:40 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOHde9Q093579; Mon, 24 Nov 2008 17:39:40 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200811241739.mAOHde9Q093579@svn.freebsd.org> From: Colin Percival Date: Mon, 24 Nov 2008 17:39:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185254 - head/sys/dev/random releng/6.3 releng/6.3/sys/conf releng/6.3/sys/dev/random releng/6.4 releng/6.4/sys/dev/random releng/7.0 releng/7.0/sys/conf releng/7.0/sys/dev/random stab... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 17:39:41 -0000 Author: cperciva Date: Mon Nov 24 17:39:39 2008 New Revision: 185254 URL: http://svn.freebsd.org/changeset/base/185254 Log: Make sure arc4random(9) is properly seeded when /etc/rc.d/initrandom returns. Approved by: so (cperciva) Approved by: re (kensmith) Security: FreeBSD-SA-08:11.arc4random Modified: releng/6.3/UPDATING releng/6.3/sys/conf/newvers.sh releng/6.3/sys/dev/random/randomdev.c releng/6.3/sys/dev/random/randomdev_soft.c releng/6.4/UPDATING releng/6.4/sys/dev/random/randomdev.c releng/6.4/sys/dev/random/randomdev_soft.c releng/7.0/UPDATING releng/7.0/sys/conf/newvers.sh releng/7.0/sys/dev/random/randomdev.c releng/7.0/sys/dev/random/randomdev_soft.c Changes in other areas also in this revision: Modified: head/sys/dev/random/randomdev.c head/sys/dev/random/randomdev_soft.c stable/6/sys/dev/random/randomdev.c stable/6/sys/dev/random/randomdev_soft.c stable/7/sys/dev/random/randomdev.c stable/7/sys/dev/random/randomdev_soft.c Modified: releng/6.3/UPDATING ============================================================================== --- releng/6.3/UPDATING Mon Nov 24 17:34:00 2008 (r185253) +++ releng/6.3/UPDATING Mon Nov 24 17:39:39 2008 (r185254) @@ -8,6 +8,10 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20081124: p6 FreeBSD-SA-08:11.arc4random + Make sure arc4random(9) is properly seeded when /etc/rc.d/initrandom + returns. + 20081002: p5 FreeBSD-SA-08:10.nd6 Default to ignoring potentially evil IPv6 Neighbor Solicitation messages. Modified: releng/6.3/sys/conf/newvers.sh ============================================================================== --- releng/6.3/sys/conf/newvers.sh Mon Nov 24 17:34:00 2008 (r185253) +++ releng/6.3/sys/conf/newvers.sh Mon Nov 24 17:39:39 2008 (r185254) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="6.3" -BRANCH="RELEASE-p5" +BRANCH="RELEASE-p6" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/6.3/sys/dev/random/randomdev.c ============================================================================== --- releng/6.3/sys/dev/random/randomdev.c Mon Nov 24 17:34:00 2008 (r185253) +++ releng/6.3/sys/dev/random/randomdev.c Mon Nov 24 17:39:39 2008 (r185254) @@ -89,6 +89,7 @@ random_close(struct cdev *dev __unused, && (securelevel_gt(td->td_ucred, 0) == 0)) { (*random_systat.reseed)(); random_systat.seeded = 1; + arc4rand(NULL, 0, 1); /* Reseed arc4random as well. */ } return (0); Modified: releng/6.3/sys/dev/random/randomdev_soft.c ============================================================================== --- releng/6.3/sys/dev/random/randomdev_soft.c Mon Nov 24 17:34:00 2008 (r185253) +++ releng/6.3/sys/dev/random/randomdev_soft.c Mon Nov 24 17:39:39 2008 (r185254) @@ -61,6 +61,7 @@ random_harvest_internal(u_int64_t, const u_int, u_int, enum esource); static int random_yarrow_poll(int event,struct thread *td); static int random_yarrow_block(int flag); +static void random_yarrow_flush_reseed(void); struct random_systat random_yarrow = { .ident = "Software, Yarrow", @@ -70,7 +71,7 @@ struct random_systat random_yarrow = { .read = random_yarrow_read, .write = random_yarrow_write, .poll = random_yarrow_poll, - .reseed = random_yarrow_reseed, + .reseed = random_yarrow_flush_reseed, .seeded = 1, }; @@ -96,7 +97,7 @@ static struct entropyfifo emptyfifo; /* Harvested entropy */ static struct entropyfifo harvestfifo[ENTROPYSOURCE]; -/* <0 to end the kthread, 0 to let it run */ +/* <0 to end the kthread, 0 to let it run, 1 to flush the harvest queues */ static int random_kthread_control = 0; static struct proc *random_kthread_proc; @@ -247,7 +248,7 @@ random_kthread(void *arg __unused) local_count = 0; /* Process until told to stop */ - for (; random_kthread_control == 0;) { + for (; random_kthread_control >= 0;) { active = 0; @@ -282,6 +283,13 @@ random_kthread(void *arg __unused) KASSERT(local_count == 0, ("random_kthread: local_count %d", local_count)); + /* + * If a queue flush was commanded, it has now happened, + * and we can mark this by resetting the command. + */ + if (random_kthread_control == 1) + random_kthread_control = 0; + /* Found nothing, so don't belabour the issue */ if (!active) tsleep(&harvestfifo, 0, "-", hz / 10); @@ -406,3 +414,15 @@ random_yarrow_block(int flag) return error; } + +/* Helper routine to perform explicit reseeds */ +static void +random_yarrow_flush_reseed(void) +{ + /* Command a entropy queue flush and wait for it to finish */ + random_kthread_control = 1; + while (random_kthread_control) + tsleep(&harvestfifo, 0, "-", hz / 10); + + random_yarrow_reseed(); +} Modified: releng/6.4/UPDATING ============================================================================== --- releng/6.4/UPDATING Mon Nov 24 17:34:00 2008 (r185253) +++ releng/6.4/UPDATING Mon Nov 24 17:39:39 2008 (r185254) @@ -8,6 +8,10 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20081124: FreeBSD-SA-08:11.arc4random + Make sure arc4random(9) is properly seeded when /etc/rc.d/initrandom + returns. + 20080904: ntpd upgraded to 4.2.4p5. Modified: releng/6.4/sys/dev/random/randomdev.c ============================================================================== --- releng/6.4/sys/dev/random/randomdev.c Mon Nov 24 17:34:00 2008 (r185253) +++ releng/6.4/sys/dev/random/randomdev.c Mon Nov 24 17:39:39 2008 (r185254) @@ -89,6 +89,7 @@ random_close(struct cdev *dev __unused, && (securelevel_gt(td->td_ucred, 0) == 0)) { (*random_systat.reseed)(); random_systat.seeded = 1; + arc4rand(NULL, 0, 1); /* Reseed arc4random as well. */ } return (0); Modified: releng/6.4/sys/dev/random/randomdev_soft.c ============================================================================== --- releng/6.4/sys/dev/random/randomdev_soft.c Mon Nov 24 17:34:00 2008 (r185253) +++ releng/6.4/sys/dev/random/randomdev_soft.c Mon Nov 24 17:39:39 2008 (r185254) @@ -61,6 +61,7 @@ random_harvest_internal(u_int64_t, const u_int, u_int, enum esource); static int random_yarrow_poll(int event,struct thread *td); static int random_yarrow_block(int flag); +static void random_yarrow_flush_reseed(void); struct random_systat random_yarrow = { .ident = "Software, Yarrow", @@ -70,7 +71,7 @@ struct random_systat random_yarrow = { .read = random_yarrow_read, .write = random_yarrow_write, .poll = random_yarrow_poll, - .reseed = random_yarrow_reseed, + .reseed = random_yarrow_flush_reseed, .seeded = 1, }; @@ -96,7 +97,7 @@ static struct entropyfifo emptyfifo; /* Harvested entropy */ static struct entropyfifo harvestfifo[ENTROPYSOURCE]; -/* <0 to end the kthread, 0 to let it run */ +/* <0 to end the kthread, 0 to let it run, 1 to flush the harvest queues */ static int random_kthread_control = 0; static struct proc *random_kthread_proc; @@ -247,7 +248,7 @@ random_kthread(void *arg __unused) local_count = 0; /* Process until told to stop */ - for (; random_kthread_control == 0;) { + for (; random_kthread_control >= 0;) { active = 0; @@ -282,6 +283,13 @@ random_kthread(void *arg __unused) KASSERT(local_count == 0, ("random_kthread: local_count %d", local_count)); + /* + * If a queue flush was commanded, it has now happened, + * and we can mark this by resetting the command. + */ + if (random_kthread_control == 1) + random_kthread_control = 0; + /* Found nothing, so don't belabour the issue */ if (!active) tsleep(&harvestfifo, 0, "-", hz / 10); @@ -406,3 +414,15 @@ random_yarrow_block(int flag) return error; } + +/* Helper routine to perform explicit reseeds */ +static void +random_yarrow_flush_reseed(void) +{ + /* Command a entropy queue flush and wait for it to finish */ + random_kthread_control = 1; + while (random_kthread_control) + tsleep(&harvestfifo, 0, "-", hz / 10); + + random_yarrow_reseed(); +} Modified: releng/7.0/UPDATING ============================================================================== --- releng/7.0/UPDATING Mon Nov 24 17:34:00 2008 (r185253) +++ releng/7.0/UPDATING Mon Nov 24 17:39:39 2008 (r185254) @@ -8,6 +8,10 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20081124: p6 FreeBSD-SA-08:11.arc4random + Make sure arc4random(9) is properly seeded when /etc/rc.d/initrandom + returns. + 20081002: p5 FreeBSD-SA-08:10.nd6 Default to ignoring potentially evil IPv6 Neighbor Solicitation messages. Modified: releng/7.0/sys/conf/newvers.sh ============================================================================== --- releng/7.0/sys/conf/newvers.sh Mon Nov 24 17:34:00 2008 (r185253) +++ releng/7.0/sys/conf/newvers.sh Mon Nov 24 17:39:39 2008 (r185254) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="7.0" -BRANCH="RELEASE-p5" +BRANCH="RELEASE-p6" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/7.0/sys/dev/random/randomdev.c ============================================================================== --- releng/7.0/sys/dev/random/randomdev.c Mon Nov 24 17:34:00 2008 (r185253) +++ releng/7.0/sys/dev/random/randomdev.c Mon Nov 24 17:39:39 2008 (r185254) @@ -90,6 +90,7 @@ random_close(struct cdev *dev __unused, && (securelevel_gt(td->td_ucred, 0) == 0)) { (*random_systat.reseed)(); random_systat.seeded = 1; + arc4rand(NULL, 0, 1); /* Reseed arc4random as well. */ } return (0); Modified: releng/7.0/sys/dev/random/randomdev_soft.c ============================================================================== --- releng/7.0/sys/dev/random/randomdev_soft.c Mon Nov 24 17:34:00 2008 (r185253) +++ releng/7.0/sys/dev/random/randomdev_soft.c Mon Nov 24 17:39:39 2008 (r185254) @@ -61,6 +61,7 @@ random_harvest_internal(u_int64_t, const u_int, u_int, enum esource); static int random_yarrow_poll(int event,struct thread *td); static int random_yarrow_block(int flag); +static void random_yarrow_flush_reseed(void); struct random_systat random_yarrow = { .ident = "Software, Yarrow", @@ -70,7 +71,7 @@ struct random_systat random_yarrow = { .read = random_yarrow_read, .write = random_yarrow_write, .poll = random_yarrow_poll, - .reseed = random_yarrow_reseed, + .reseed = random_yarrow_flush_reseed, .seeded = 1, }; @@ -96,7 +97,7 @@ static struct entropyfifo emptyfifo; /* Harvested entropy */ static struct entropyfifo harvestfifo[ENTROPYSOURCE]; -/* <0 to end the kthread, 0 to let it run */ +/* <0 to end the kthread, 0 to let it run, 1 to flush the harvest queues */ static int random_kthread_control = 0; static struct proc *random_kthread_proc; @@ -241,7 +242,7 @@ random_kthread(void *arg __unused) local_count = 0; /* Process until told to stop */ - for (; random_kthread_control == 0;) { + for (; random_kthread_control >= 0;) { active = 0; @@ -276,6 +277,13 @@ random_kthread(void *arg __unused) KASSERT(local_count == 0, ("random_kthread: local_count %d", local_count)); + /* + * If a queue flush was commanded, it has now happened, + * and we can mark this by resetting the command. + */ + if (random_kthread_control == 1) + random_kthread_control = 0; + /* Found nothing, so don't belabour the issue */ if (!active) pause("-", hz / 10); @@ -400,3 +408,15 @@ random_yarrow_block(int flag) return error; } + +/* Helper routine to perform explicit reseeds */ +static void +random_yarrow_flush_reseed(void) +{ + /* Command a entropy queue flush and wait for it to finish */ + random_kthread_control = 1; + while (random_kthread_control) + pause("-", hz / 10); + + random_yarrow_reseed(); +} From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 17:39:41 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43C891065674; Mon, 24 Nov 2008 17:39:41 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 31E408FC1F; Mon, 24 Nov 2008 17:39:41 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOHdfkJ093597; Mon, 24 Nov 2008 17:39:41 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOHdfVU093595; Mon, 24 Nov 2008 17:39:41 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200811241739.mAOHdfVU093595@svn.freebsd.org> From: Colin Percival Date: Mon, 24 Nov 2008 17:39:41 +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: r185254 - head/sys/dev/random releng/6.3 releng/6.3/sys/conf releng/6.3/sys/dev/random releng/6.4 releng/6.4/sys/dev/random releng/7.0 releng/7.0/sys/conf releng/7.0/sys/dev/random stab... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 17:39:41 -0000 Author: cperciva Date: Mon Nov 24 17:39:39 2008 New Revision: 185254 URL: http://svn.freebsd.org/changeset/base/185254 Log: Make sure arc4random(9) is properly seeded when /etc/rc.d/initrandom returns. Approved by: so (cperciva) Approved by: re (kensmith) Security: FreeBSD-SA-08:11.arc4random Modified: stable/6/sys/dev/random/randomdev.c stable/6/sys/dev/random/randomdev_soft.c Changes in other areas also in this revision: Modified: head/sys/dev/random/randomdev.c head/sys/dev/random/randomdev_soft.c releng/6.3/UPDATING releng/6.3/sys/conf/newvers.sh releng/6.3/sys/dev/random/randomdev.c releng/6.3/sys/dev/random/randomdev_soft.c releng/6.4/UPDATING releng/6.4/sys/dev/random/randomdev.c releng/6.4/sys/dev/random/randomdev_soft.c releng/7.0/UPDATING releng/7.0/sys/conf/newvers.sh releng/7.0/sys/dev/random/randomdev.c releng/7.0/sys/dev/random/randomdev_soft.c stable/7/sys/dev/random/randomdev.c stable/7/sys/dev/random/randomdev_soft.c Modified: stable/6/sys/dev/random/randomdev.c ============================================================================== --- stable/6/sys/dev/random/randomdev.c Mon Nov 24 17:34:00 2008 (r185253) +++ stable/6/sys/dev/random/randomdev.c Mon Nov 24 17:39:39 2008 (r185254) @@ -89,6 +89,7 @@ random_close(struct cdev *dev __unused, && (securelevel_gt(td->td_ucred, 0) == 0)) { (*random_systat.reseed)(); random_systat.seeded = 1; + arc4rand(NULL, 0, 1); /* Reseed arc4random as well. */ } return (0); Modified: stable/6/sys/dev/random/randomdev_soft.c ============================================================================== --- stable/6/sys/dev/random/randomdev_soft.c Mon Nov 24 17:34:00 2008 (r185253) +++ stable/6/sys/dev/random/randomdev_soft.c Mon Nov 24 17:39:39 2008 (r185254) @@ -61,6 +61,7 @@ random_harvest_internal(u_int64_t, const u_int, u_int, enum esource); static int random_yarrow_poll(int event,struct thread *td); static int random_yarrow_block(int flag); +static void random_yarrow_flush_reseed(void); struct random_systat random_yarrow = { .ident = "Software, Yarrow", @@ -70,7 +71,7 @@ struct random_systat random_yarrow = { .read = random_yarrow_read, .write = random_yarrow_write, .poll = random_yarrow_poll, - .reseed = random_yarrow_reseed, + .reseed = random_yarrow_flush_reseed, .seeded = 1, }; @@ -96,7 +97,7 @@ static struct entropyfifo emptyfifo; /* Harvested entropy */ static struct entropyfifo harvestfifo[ENTROPYSOURCE]; -/* <0 to end the kthread, 0 to let it run */ +/* <0 to end the kthread, 0 to let it run, 1 to flush the harvest queues */ static int random_kthread_control = 0; static struct proc *random_kthread_proc; @@ -247,7 +248,7 @@ random_kthread(void *arg __unused) local_count = 0; /* Process until told to stop */ - for (; random_kthread_control == 0;) { + for (; random_kthread_control >= 0;) { active = 0; @@ -282,6 +283,13 @@ random_kthread(void *arg __unused) KASSERT(local_count == 0, ("random_kthread: local_count %d", local_count)); + /* + * If a queue flush was commanded, it has now happened, + * and we can mark this by resetting the command. + */ + if (random_kthread_control == 1) + random_kthread_control = 0; + /* Found nothing, so don't belabour the issue */ if (!active) tsleep(&harvestfifo, 0, "-", hz / 10); @@ -406,3 +414,15 @@ random_yarrow_block(int flag) return error; } + +/* Helper routine to perform explicit reseeds */ +static void +random_yarrow_flush_reseed(void) +{ + /* Command a entropy queue flush and wait for it to finish */ + random_kthread_control = 1; + while (random_kthread_control) + tsleep(&harvestfifo, 0, "-", hz / 10); + + random_yarrow_reseed(); +} From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 19:00:57 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0D071065673; Mon, 24 Nov 2008 19:00:57 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E29C88FC12; Mon, 24 Nov 2008 19:00:57 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOJ0vsx095280; Mon, 24 Nov 2008 19:00:57 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOJ0vB6095278; Mon, 24 Nov 2008 19:00:57 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <200811241900.mAOJ0vB6095278@svn.freebsd.org> From: Andrew Gallatin Date: Mon, 24 Nov 2008 19:00:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185255 - head/sys/dev/mxge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 19:00:58 -0000 Author: gallatin Date: Mon Nov 24 19:00:57 2008 New Revision: 185255 URL: http://svn.freebsd.org/changeset/base/185255 Log: Restore sfence semantics in mxge after the introduction of a global mfence based mb() in r185162 Modified: head/sys/dev/mxge/if_mxge.c head/sys/dev/mxge/if_mxge_var.h Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Mon Nov 24 17:39:39 2008 (r185254) +++ head/sys/dev/mxge/if_mxge.c Mon Nov 24 19:00:57 2008 (r185255) @@ -731,9 +731,9 @@ mxge_load_firmware_helper(mxge_softc_t * mxge_pio_copy(sc->sram + MXGE_FW_OFFSET + i, inflate_buffer + i, min(256U, (unsigned)(fw_len - i))); - mb(); + wmb(); dummy = *sc->sram; - mb(); + wmb(); } *limit = fw_len; @@ -766,7 +766,7 @@ mxge_dummy_rdma(mxge_softc_t *sc, int en /* clear confirmation addr */ confirm = (volatile uint32_t *)sc->cmd; *confirm = 0; - mb(); + wmb(); /* send an rdma command to the PCIe engine, and wait for the response in the confirmation address. The firmware should @@ -788,9 +788,9 @@ mxge_dummy_rdma(mxge_softc_t *sc, int en submit = (volatile char *)(sc->sram + MXGEFW_BOOT_DUMMY_RDMA); mxge_pio_copy(submit, buf, 64); - mb(); + wmb(); DELAY(1000); - mb(); + wmb(); i = 0; while (*confirm != 0xffffffff && i < 20) { DELAY(1000); @@ -828,7 +828,7 @@ mxge_send_cmd(mxge_softc_t *sc, uint32_t buf->response_addr.high = htobe32(dma_high); mtx_lock(&sc->cmd_mtx); response->result = 0xffffffff; - mb(); + wmb(); mxge_pio_copy((volatile void *)cmd_addr, buf, sizeof (*buf)); /* wait up to 20ms */ @@ -836,7 +836,7 @@ mxge_send_cmd(mxge_softc_t *sc, uint32_t for (sleep_total = 0; sleep_total < 20; sleep_total++) { bus_dmamap_sync(sc->cmd_dma.dmat, sc->cmd_dma.map, BUS_DMASYNC_POSTREAD); - mb(); + wmb(); switch (be32toh(response->result)) { case 0: data->data0 = be32toh(response->data); @@ -964,7 +964,7 @@ mxge_load_firmware(mxge_softc_t *sc, int /* clear confirmation addr */ confirm = (volatile uint32_t *)sc->cmd; *confirm = 0; - mb(); + wmb(); /* send a reload command to the bootstrap MCP, and wait for the response in the confirmation address. The firmware should write a -1 there to indicate it is alive and well @@ -989,9 +989,9 @@ mxge_load_firmware(mxge_softc_t *sc, int submit = (volatile char *)(sc->sram + MXGEFW_BOOT_HANDOFF); mxge_pio_copy(submit, buf, 64); - mb(); + wmb(); DELAY(1000); - mb(); + wmb(); i = 0; while (*confirm != 0xffffffff && i < 20) { DELAY(1000*10); @@ -1652,7 +1652,7 @@ mxge_submit_req_backwards(mxge_tx_ring_t idx = (starting_slot + cnt) & tx->mask; mxge_pio_copy(&tx->lanai[idx], &src[cnt], sizeof(*src)); - mb(); + wmb(); } } @@ -1678,14 +1678,14 @@ mxge_submit_req(mxge_tx_ring_t *tx, mcp_ last_flags = src->flags; src->flags = 0; - mb(); + wmb(); dst = dstp = &tx->lanai[idx]; srcp = src; if ((idx + cnt) < tx->mask) { for (i = 0; i < (cnt - 1); i += 2) { mxge_pio_copy(dstp, srcp, 2 * sizeof(*src)); - mb(); /* force write every 32 bytes */ + wmb(); /* force write every 32 bytes */ srcp += 2; dstp += 2; } @@ -1698,7 +1698,7 @@ mxge_submit_req(mxge_tx_ring_t *tx, mcp_ if (i < cnt) { /* submit the first request */ mxge_pio_copy(dstp, srcp, sizeof(*src)); - mb(); /* barrier before setting valid flag */ + wmb(); /* barrier before setting valid flag */ } /* re-write the last 32-bits with the valid flags */ @@ -1709,7 +1709,7 @@ mxge_submit_req(mxge_tx_ring_t *tx, mcp_ dst_ints+=3; *dst_ints = *src_ints; tx->req += cnt; - mb(); + wmb(); } #if IFCAP_TSO4 @@ -2128,12 +2128,12 @@ mxge_submit_8rx(volatile mcp_kreq_ether_ low = src->addr_low; src->addr_low = 0xffffffff; mxge_pio_copy(dst, src, 4 * sizeof (*src)); - mb(); + wmb(); mxge_pio_copy(dst + 4, src + 4, 4 * sizeof (*src)); - mb(); + wmb(); src->addr_low = low; dst->addr_low = low; - mb(); + wmb(); } static int @@ -2688,7 +2688,7 @@ mxge_intr(void *arg) send_done_count = be32toh(stats->send_done_count); } if (sc->legacy_irq && mxge_deassert_wait) - mb(); + wmb(); } while (*((volatile uint8_t *) &stats->valid)); if (__predict_false(stats->stats_updated)) { @@ -3337,7 +3337,7 @@ mxge_close(mxge_softc_t *sc) callout_stop(&sc->co_hdl); sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; old_down_cnt = sc->down_cnt; - mb(); + wmb(); err = mxge_send_cmd(sc, MXGEFW_CMD_ETHERNET_DOWN, &cmd); if (err) { device_printf(sc->dev, "Couldn't bring down link\n"); @@ -3346,7 +3346,7 @@ mxge_close(mxge_softc_t *sc) /* wait for down irq */ DELAY(10 * sc->intr_coal_delay); } - mb(); + wmb(); if (old_down_cnt == sc->down_cnt) { device_printf(sc->dev, "never got down irq\n"); } Modified: head/sys/dev/mxge/if_mxge_var.h ============================================================================== --- head/sys/dev/mxge/if_mxge_var.h Mon Nov 24 17:39:39 2008 (r185254) +++ head/sys/dev/mxge/if_mxge_var.h Mon Nov 24 19:00:57 2008 (r185255) @@ -283,13 +283,13 @@ struct mxge_media_type #if defined (__GNUC__) #if #cpu(i386) || defined __i386 || defined i386 || defined __i386__ || #cpu(x86_64) || defined __x86_64__ - #define mb() __asm__ __volatile__ ("sfence;": : :"memory") + #define wmb() __asm__ __volatile__ ("sfence;": : :"memory") #elif #cpu(sparc64) || defined sparc64 || defined __sparcv9 - #define mb() __asm__ __volatile__ ("membar #MemIssue": : :"memory") + #define wmb() __asm__ __volatile__ ("membar #MemIssue": : :"memory") #elif #cpu(sparc) || defined sparc || defined __sparc__ - #define mb() __asm__ __volatile__ ("stbar;": : :"memory") + #define wmb() __asm__ __volatile__ ("stbar;": : :"memory") #else - #define mb() /* XXX just to make this compile */ + #define wmb() /* XXX just to make this compile */ #endif #else #error "unknown compiler" From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 19:28:53 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 508841065670; Mon, 24 Nov 2008 19:28:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 436808FC34; Mon, 24 Nov 2008 19:28:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOJSrqb095854; Mon, 24 Nov 2008 19:28:53 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOJSrq0095853; Mon, 24 Nov 2008 19:28:53 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <200811241928.mAOJSrq0095853@svn.freebsd.org> From: Ed Maste Date: Mon, 24 Nov 2008 19:28:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185256 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 19:28:53 -0000 Author: emaste Date: Mon Nov 24 19:28:52 2008 New Revision: 185256 URL: http://svn.freebsd.org/changeset/base/185256 Log: Correct typo in comment: thier -> their Modified: head/sys/kern/vfs_export.c Modified: head/sys/kern/vfs_export.c ============================================================================== --- head/sys/kern/vfs_export.c Mon Nov 24 19:00:57 2008 (r185255) +++ head/sys/kern/vfs_export.c Mon Nov 24 19:28:52 2008 (r185256) @@ -401,7 +401,7 @@ vfs_setpublicfs(struct mount *mp, struct /* * Used by the filesystems to determine if a given network address - * (passed in 'nam') is present in thier exports list, returns a pointer + * (passed in 'nam') is present in their exports list, returns a pointer * to struct netcred so that the filesystem can examine it for * access rights (read/write/etc). */ From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 19:52:20 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D5E51065673; Mon, 24 Nov 2008 19:52:20 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EBBD8FC17; Mon, 24 Nov 2008 19:52:20 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOJqKjR096360; Mon, 24 Nov 2008 19:52:20 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOJqKX1096359; Mon, 24 Nov 2008 19:52:20 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200811241952.mAOJqKX1096359@svn.freebsd.org> From: Christian Brueffer Date: Mon, 24 Nov 2008 19:52:20 +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: r185257 - stable/7/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 19:52:20 -0000 Author: brueffer Date: Mon Nov 24 19:52:19 2008 New Revision: 185257 URL: http://svn.freebsd.org/changeset/base/185257 Log: MFC r184523 - Add one more supported adapter - Fix a couple of typos Approved by: re (kensmith) Modified: stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/igb.4 (props changed) stable/7/share/man/man4/zyd.4 Modified: stable/7/share/man/man4/zyd.4 ============================================================================== --- stable/7/share/man/man4/zyd.4 Mon Nov 24 19:28:52 2008 (r185256) +++ stable/7/share/man/man4/zyd.4 Mon Nov 24 19:52:19 2008 (r185257) @@ -32,7 +32,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd September 6, 2007 +.Dd November 1, 2008 .Dt ZYD 4 .Os .Sh NAME @@ -103,7 +103,7 @@ driver: .It Airlink+ AWLL3025 .It Airlink 101 AWLL3026 .It AOpen 802.11g WL54 -.It Asus A9T integrated wirless +.It Asus A9T integrated wireless .It Asus WL-159g .It Belkin F5D7050 v.4000 .It Billion BiPAC 3011G @@ -117,6 +117,7 @@ driver: .It Linksys WUSBF54G .It Longshine LCS-8131G3 .It MSI US54SE +.It MyTek MWU-201 USB adapter .It Philips SNU5600 .It Planet WL-U356 .It Planex GW-US54GZ @@ -143,7 +144,7 @@ driver: .El .Sh EXAMPLES The following -examples configures zyd0 to join whatever network is available on boot, +example configures zyd0 to join whatever network is available on boot, using WEP key .Dq 0x1deadbeef1 , channel 11: From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 20:05:15 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05A451065674; Mon, 24 Nov 2008 20:05:15 +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 EAC978FC17; Mon, 24 Nov 2008 20:05:14 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOK5E4x096676; Mon, 24 Nov 2008 20:05:14 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOK5EFj096674; Mon, 24 Nov 2008 20:05:14 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811242005.mAOK5EFj096674@svn.freebsd.org> From: Xin LI Date: Mon, 24 Nov 2008 20:05:14 +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: r185258 - in stable/7/release/doc/en_US.ISO8859-1: hardware relnotes X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 20:05:15 -0000 Author: delphij Date: Mon Nov 24 20:05:14 2008 New Revision: 185258 URL: http://svn.freebsd.org/changeset/base/185258 Log: MFC: Document ale(4), mention that it is not present in GENERIC kernel for this release. Approved by: re (blackend) Modified: stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml stable/7/release/doc/en_US.ISO8859-1/relnotes/article.sgml Modified: stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml Mon Nov 24 19:52:19 2008 (r185257) +++ stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml Mon Nov 24 20:05:14 2008 (r185258) @@ -615,6 +615,8 @@ Ethernet Interfaces + &hwlist.ale; + &hwlist.aue; &hwlist.axe; Modified: stable/7/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- stable/7/release/doc/en_US.ISO8859-1/relnotes/article.sgml Mon Nov 24 19:52:19 2008 (r185257) +++ stable/7/release/doc/en_US.ISO8859-1/relnotes/article.sgml Mon Nov 24 20:05:14 2008 (r185258) @@ -198,6 +198,11 @@ Network Interface Support + The &man.ale.4; driver has been added to provide support + for Atheros AR8121/AR8113/AR8114 Gigabit/Fast Ethernet controllers. + This driver is not enabled in GENERIC + kernels for this release. + The &man.em.4; driver has been split into two drivers with some common parts. The &man.em.4; driver will continue to support adapters up to the 82575, as well as new From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 20:40:03 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B79CF1065679 for ; Mon, 24 Nov 2008 20:40:03 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.229]) by mx1.freebsd.org (Postfix) with ESMTP id 4116E8FC26 for ; Mon, 24 Nov 2008 20:40:03 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so2168453rvf.43 for ; Mon, 24 Nov 2008 12:40:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=c8+H+VH88eKHzeLdaaOA1PSfQDkT9QF569uaZsZE2Lc=; b=OVpjen03OSRxL/iGJW4BTD/2WChueBikykM/nRWa9Q/E+6fjC9AwhkiwDq+IBabUE5 tc/9yNLgza9+ZqXC8K2V0aSEoIgvrhzkBn758D72T7YOawEgxRX0mspoT7iQy65ptn1V +dOvcnYVT3NbhgA91Y4a51H+SehOnvYppit9o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=xSy9LAVTcDDC90K7V5F6IfjZhv0r3qkVq5juAJ7WmAX8sTxk9MS3HXZDEyjlDllpG/ Yy3wAqvhkR6neaRWQMe2epHGHv0Nec20/nRl6lIfyMJPiiCBEu2fjs2ZoYQysM6En+2v lFJgQewbsaPw3ttLdgDMZAhqTxUpkqxPMwHUI= Received: by 10.141.107.13 with SMTP id j13mr2028954rvm.279.1227559203124; Mon, 24 Nov 2008 12:40:03 -0800 (PST) Received: by 10.141.153.21 with HTTP; Mon, 24 Nov 2008 12:40:03 -0800 (PST) Message-ID: <3c1674c90811241240x3b643fe0uca8026a4358df0b7@mail.gmail.com> Date: Mon, 24 Nov 2008 20:40:03 +0000 From: "Matthew Macy" To: "Andrew Gallatin" In-Reply-To: <200811241900.mAOJ0vB6095278@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811241900.mAOJ0vB6095278@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185255 - head/sys/dev/mxge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 20:40:03 -0000 Sorry about that. There are about half a dozen different drivers with their own definitions. Since you use Linux naming I overlooked the fact that you defined it differently. -Kip On Mon, Nov 24, 2008 at 7:00 PM, Andrew Gallatin wrote: > Author: gallatin > Date: Mon Nov 24 19:00:57 2008 > New Revision: 185255 > URL: http://svn.freebsd.org/changeset/base/185255 > > Log: > Restore sfence semantics in mxge after the introduction > of a global mfence based mb() in r185162 > > Modified: > head/sys/dev/mxge/if_mxge.c > head/sys/dev/mxge/if_mxge_var.h > > Modified: head/sys/dev/mxge/if_mxge.c > ============================================================================== > --- head/sys/dev/mxge/if_mxge.c Mon Nov 24 17:39:39 2008 (r185254) > +++ head/sys/dev/mxge/if_mxge.c Mon Nov 24 19:00:57 2008 (r185255) > @@ -731,9 +731,9 @@ mxge_load_firmware_helper(mxge_softc_t * > mxge_pio_copy(sc->sram + MXGE_FW_OFFSET + i, > inflate_buffer + i, > min(256U, (unsigned)(fw_len - i))); > - mb(); > + wmb(); > dummy = *sc->sram; > - mb(); > + wmb(); > } > > *limit = fw_len; > @@ -766,7 +766,7 @@ mxge_dummy_rdma(mxge_softc_t *sc, int en > /* clear confirmation addr */ > confirm = (volatile uint32_t *)sc->cmd; > *confirm = 0; > - mb(); > + wmb(); > > /* send an rdma command to the PCIe engine, and wait for the > response in the confirmation address. The firmware should > @@ -788,9 +788,9 @@ mxge_dummy_rdma(mxge_softc_t *sc, int en > submit = (volatile char *)(sc->sram + MXGEFW_BOOT_DUMMY_RDMA); > > mxge_pio_copy(submit, buf, 64); > - mb(); > + wmb(); > DELAY(1000); > - mb(); > + wmb(); > i = 0; > while (*confirm != 0xffffffff && i < 20) { > DELAY(1000); > @@ -828,7 +828,7 @@ mxge_send_cmd(mxge_softc_t *sc, uint32_t > buf->response_addr.high = htobe32(dma_high); > mtx_lock(&sc->cmd_mtx); > response->result = 0xffffffff; > - mb(); > + wmb(); > mxge_pio_copy((volatile void *)cmd_addr, buf, sizeof (*buf)); > > /* wait up to 20ms */ > @@ -836,7 +836,7 @@ mxge_send_cmd(mxge_softc_t *sc, uint32_t > for (sleep_total = 0; sleep_total < 20; sleep_total++) { > bus_dmamap_sync(sc->cmd_dma.dmat, > sc->cmd_dma.map, BUS_DMASYNC_POSTREAD); > - mb(); > + wmb(); > switch (be32toh(response->result)) { > case 0: > data->data0 = be32toh(response->data); > @@ -964,7 +964,7 @@ mxge_load_firmware(mxge_softc_t *sc, int > /* clear confirmation addr */ > confirm = (volatile uint32_t *)sc->cmd; > *confirm = 0; > - mb(); > + wmb(); > /* send a reload command to the bootstrap MCP, and wait for the > response in the confirmation address. The firmware should > write a -1 there to indicate it is alive and well > @@ -989,9 +989,9 @@ mxge_load_firmware(mxge_softc_t *sc, int > > submit = (volatile char *)(sc->sram + MXGEFW_BOOT_HANDOFF); > mxge_pio_copy(submit, buf, 64); > - mb(); > + wmb(); > DELAY(1000); > - mb(); > + wmb(); > i = 0; > while (*confirm != 0xffffffff && i < 20) { > DELAY(1000*10); > @@ -1652,7 +1652,7 @@ mxge_submit_req_backwards(mxge_tx_ring_t > idx = (starting_slot + cnt) & tx->mask; > mxge_pio_copy(&tx->lanai[idx], > &src[cnt], sizeof(*src)); > - mb(); > + wmb(); > } > } > > @@ -1678,14 +1678,14 @@ mxge_submit_req(mxge_tx_ring_t *tx, mcp_ > > last_flags = src->flags; > src->flags = 0; > - mb(); > + wmb(); > dst = dstp = &tx->lanai[idx]; > srcp = src; > > if ((idx + cnt) < tx->mask) { > for (i = 0; i < (cnt - 1); i += 2) { > mxge_pio_copy(dstp, srcp, 2 * sizeof(*src)); > - mb(); /* force write every 32 bytes */ > + wmb(); /* force write every 32 bytes */ > srcp += 2; > dstp += 2; > } > @@ -1698,7 +1698,7 @@ mxge_submit_req(mxge_tx_ring_t *tx, mcp_ > if (i < cnt) { > /* submit the first request */ > mxge_pio_copy(dstp, srcp, sizeof(*src)); > - mb(); /* barrier before setting valid flag */ > + wmb(); /* barrier before setting valid flag */ > } > > /* re-write the last 32-bits with the valid flags */ > @@ -1709,7 +1709,7 @@ mxge_submit_req(mxge_tx_ring_t *tx, mcp_ > dst_ints+=3; > *dst_ints = *src_ints; > tx->req += cnt; > - mb(); > + wmb(); > } > > #if IFCAP_TSO4 > @@ -2128,12 +2128,12 @@ mxge_submit_8rx(volatile mcp_kreq_ether_ > low = src->addr_low; > src->addr_low = 0xffffffff; > mxge_pio_copy(dst, src, 4 * sizeof (*src)); > - mb(); > + wmb(); > mxge_pio_copy(dst + 4, src + 4, 4 * sizeof (*src)); > - mb(); > + wmb(); > src->addr_low = low; > dst->addr_low = low; > - mb(); > + wmb(); > } > > static int > @@ -2688,7 +2688,7 @@ mxge_intr(void *arg) > send_done_count = be32toh(stats->send_done_count); > } > if (sc->legacy_irq && mxge_deassert_wait) > - mb(); > + wmb(); > } while (*((volatile uint8_t *) &stats->valid)); > > if (__predict_false(stats->stats_updated)) { > @@ -3337,7 +3337,7 @@ mxge_close(mxge_softc_t *sc) > callout_stop(&sc->co_hdl); > sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; > old_down_cnt = sc->down_cnt; > - mb(); > + wmb(); > err = mxge_send_cmd(sc, MXGEFW_CMD_ETHERNET_DOWN, &cmd); > if (err) { > device_printf(sc->dev, "Couldn't bring down link\n"); > @@ -3346,7 +3346,7 @@ mxge_close(mxge_softc_t *sc) > /* wait for down irq */ > DELAY(10 * sc->intr_coal_delay); > } > - mb(); > + wmb(); > if (old_down_cnt == sc->down_cnt) { > device_printf(sc->dev, "never got down irq\n"); > } > > Modified: head/sys/dev/mxge/if_mxge_var.h > ============================================================================== > --- head/sys/dev/mxge/if_mxge_var.h Mon Nov 24 17:39:39 2008 (r185254) > +++ head/sys/dev/mxge/if_mxge_var.h Mon Nov 24 19:00:57 2008 (r185255) > @@ -283,13 +283,13 @@ struct mxge_media_type > > #if defined (__GNUC__) > #if #cpu(i386) || defined __i386 || defined i386 || defined __i386__ || #cpu(x86_64) || defined __x86_64__ > - #define mb() __asm__ __volatile__ ("sfence;": : :"memory") > + #define wmb() __asm__ __volatile__ ("sfence;": : :"memory") > #elif #cpu(sparc64) || defined sparc64 || defined __sparcv9 > - #define mb() __asm__ __volatile__ ("membar #MemIssue": : :"memory") > + #define wmb() __asm__ __volatile__ ("membar #MemIssue": : :"memory") > #elif #cpu(sparc) || defined sparc || defined __sparc__ > - #define mb() __asm__ __volatile__ ("stbar;": : :"memory") > + #define wmb() __asm__ __volatile__ ("stbar;": : :"memory") > #else > - #define mb() /* XXX just to make this compile */ > + #define wmb() /* XXX just to make this compile */ > #endif > #else > #error "unknown compiler" > -- If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 21:01:20 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42E051065672; Mon, 24 Nov 2008 21:01:20 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.freebsd.org (Postfix) with ESMTP id 06F8A8FC1C; Mon, 24 Nov 2008 21:01:19 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from [172.31.193.10] (cpe-075-177-134-250.nc.res.rr.com [75.177.134.250]) (authenticated bits=0) by duke.cs.duke.edu (8.14.2/8.14.2) with ESMTP id mAOL17tY014777 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 24 Nov 2008 16:01:19 -0500 (EST) X-DKIM: Sendmail DKIM Filter v2.5.3 duke.cs.duke.edu mAOL17tY014777 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cs.duke.edu; s=mail; t=1227560479; bh=+4mtEjC1luV+Wge9L60ocAgcmKHgBs0Vex4KuL29+PU=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=yS3gZtG94Hnj V5COKVajO5gx9EhaiZn3GU0ne31lKzQ9sS5qrUXV2oVr08TwG6LHJuXlq9CYmFfIC7z Q/Kw/WFGh+hV4IllJl/YjhHxGwl8QaDqJ9gGtgCh7PzGxl+gys8YibSffqaoZRMsU8b RJxEIy27Oro4dv8RRSUot24rs= Message-ID: <492B160C.9060401@cs.duke.edu> Date: Mon, 24 Nov 2008 16:01:00 -0500 From: Andrew Gallatin User-Agent: Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 To: Matthew Macy References: <200811241900.mAOJ0vB6095278@svn.freebsd.org> <3c1674c90811241240x3b643fe0uca8026a4358df0b7@mail.gmail.com> In-Reply-To: <3c1674c90811241240x3b643fe0uca8026a4358df0b7@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Andrew Gallatin , src-committers@FreeBSD.org Subject: Re: svn commit: r185255 - head/sys/dev/mxge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 21:01:20 -0000 Matthew Macy wrote: > Sorry about that. There are about half a dozen different drivers with > their own definitions. Since you use Linux naming I overlooked the > fact that you defined it differently. No problem. I just wanted to return the object code to what has gone through q/a. :) Drew From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 21:09:05 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E512A106567E; Mon, 24 Nov 2008 21:09:05 +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 CB6BD8FC08; Mon, 24 Nov 2008 21:09:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOL95KP098290; Mon, 24 Nov 2008 21:09:05 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOL95vh098288; Mon, 24 Nov 2008 21:09:05 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200811242109.mAOL95vh098288@svn.freebsd.org> From: Xin LI Date: Mon, 24 Nov 2008 21:09:05 +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: r185261 - in stable/7/release/doc/zh_CN.GB2312: hardware relnotes X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 21:09:06 -0000 Author: delphij Date: Mon Nov 24 21:09:05 2008 New Revision: 185261 URL: http://svn.freebsd.org/changeset/base/185261 Log: MFen rev 185258: Document ale(4). Approved by: re (blackend) Modified: stable/7/release/doc/zh_CN.GB2312/hardware/article.sgml stable/7/release/doc/zh_CN.GB2312/relnotes/article.sgml Modified: stable/7/release/doc/zh_CN.GB2312/hardware/article.sgml ============================================================================== --- stable/7/release/doc/zh_CN.GB2312/hardware/article.sgml Mon Nov 24 21:08:43 2008 (r185260) +++ stable/7/release/doc/zh_CN.GB2312/hardware/article.sgml Mon Nov 24 21:09:05 2008 (r185261) @@ -392,7 +392,7 @@ - + @@ -183,6 +183,11 @@ ÍøÂç½Ó¿ÚÖ§³Ö + ÐÂÔöÁËÓÃÓÚÖ§³Ö + Atheros AR8121/AR8113/AR8114 ǧÕ×/°ÙÕ×ÒÔÌ«Íø¿ØÖÆÆ÷µÄ &man.ale.4; Çý¶¯³ÌÐò¡£ + ÔÚÕâÒ»°æ±¾ÖÐµÄ GENERIC + ÄÚºËÖÐĬÈϲ¢²»°üº¬´ËÇý¶¯¡£ + ½« &man.em.4; Çý¶¯³ÌÐò·Ö²ð³ÉÁËÁ½¸ö¹²Ïí²¿·Ö´úÂëµÄÇý¶¯³ÌÐò¡£ &man.em.4; Çý¶¯³ÌÐò½«¼ÌÐøÖ§³Ö¸ßÖÁ 82575 µÄÍø¿¨ÒÔ¼°ÐµÄÕë¶Ô¿Í»§»ú/×ÀÃæµÄÍø¿¨¡£ ÐÂÔöµÄ &man.igb.4; Çý¶¯³ÌÐòÔòÓÃÓÚÖ§³ÖеķþÎñÆ÷Íø¿¨¡£ From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 21:18:40 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 695EC1065672; Mon, 24 Nov 2008 21:18:40 +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 5BBAB8FC13; Mon, 24 Nov 2008 21:18:40 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOLIeXE098581; Mon, 24 Nov 2008 21:18:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOLIemj098580; Mon, 24 Nov 2008 21:18:40 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200811242118.mAOLIemj098580@svn.freebsd.org> From: Marius Strobl Date: Mon, 24 Nov 2008 21:18:40 +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: r185263 - stable/6/sys/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 21:18:40 -0000 Author: marius Date: Mon Nov 24 21:18:40 2008 New Revision: 185263 URL: http://svn.freebsd.org/changeset/base/185263 Log: Revert r182461 except for the introduction of the DC_HAS_BROKEN_RXSTATE() macro for the upcoming release as doing MII-operations on DM9102A while the link is up has turned out to occasionally cause panics. This again prevents the link state form ever being checked once it's up, which is considered less worse than the panics tough. Approved by: re (kensmith) Modified: stable/6/sys/pci/if_dc.c Modified: stable/6/sys/pci/if_dc.c ============================================================================== --- stable/6/sys/pci/if_dc.c Mon Nov 24 21:10:08 2008 (r185262) +++ stable/6/sys/pci/if_dc.c Mon Nov 24 21:18:40 2008 (r185263) @@ -2916,12 +2916,8 @@ dc_tick(void *xsc) if (sc->dc_link == 0) mii_tick(mii); } else { - /* - * For NICs which never report DC_RXSTATE_WAIT, we - * have to bite the bullet... - */ - if ((DC_HAS_BROKEN_RXSTATE(sc) || (CSR_READ_4(sc, - DC_ISR) & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT) && + r = CSR_READ_4(sc, DC_ISR); + if ((r & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT && sc->dc_cdata.dc_tx_cnt == 0) { mii_tick(mii); if (!(mii->mii_media_status & IFM_ACTIVE)) From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 21:26:26 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE0691065670; Mon, 24 Nov 2008 21:26:26 +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 C113B8FC13; Mon, 24 Nov 2008 21:26:26 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAOLQQcW098788; Mon, 24 Nov 2008 21:26:26 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAOLQQBL098787; Mon, 24 Nov 2008 21:26:26 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200811242126.mAOLQQBL098787@svn.freebsd.org> From: Marius Strobl Date: Mon, 24 Nov 2008 21:26:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185264 - in releng/6.4/sys: . pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 21:26:26 -0000 Author: marius Date: Mon Nov 24 21:26:26 2008 New Revision: 185264 URL: http://svn.freebsd.org/changeset/base/185264 Log: MF stable/6: r185263 Revert r182461 except for the introduction of the DC_HAS_BROKEN_RXSTATE() macro for the upcoming release as doing MII-operations on DM9102A while the link is up has turned out to occasionally cause panics. This again prevents the link state form ever being checked once it's up, which is considered less worse than the panics though. Approved by: re (kensmith) Modified: releng/6.4/sys/ (props changed) releng/6.4/sys/pci/if_dc.c Modified: releng/6.4/sys/pci/if_dc.c ============================================================================== --- releng/6.4/sys/pci/if_dc.c Mon Nov 24 21:18:40 2008 (r185263) +++ releng/6.4/sys/pci/if_dc.c Mon Nov 24 21:26:26 2008 (r185264) @@ -2916,12 +2916,8 @@ dc_tick(void *xsc) if (sc->dc_link == 0) mii_tick(mii); } else { - /* - * For NICs which never report DC_RXSTATE_WAIT, we - * have to bite the bullet... - */ - if ((DC_HAS_BROKEN_RXSTATE(sc) || (CSR_READ_4(sc, - DC_ISR) & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT) && + r = CSR_READ_4(sc, DC_ISR); + if ((r & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT && sc->dc_cdata.dc_tx_cnt == 0) { mii_tick(mii); if (!(mii->mii_media_status & IFM_ACTIVE)) From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 22:30:48 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A70381065673 for ; Mon, 24 Nov 2008 22:30:48 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.29]) by mx1.freebsd.org (Postfix) with ESMTP id 540CF8FC19 for ; Mon, 24 Nov 2008 22:30:48 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by yw-out-2324.google.com with SMTP id 9so943269ywe.13 for ; Mon, 24 Nov 2008 14:30:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=BAkSsm05knhhSecAweLrihmfjm8Pik7zyrXWgI1bfFc=; b=f138MjnB7EGubl4mYNfL+JKJgZ80QlVhOSiTStzNfVHWXEfxlMsYWkKHfc7iccgHtR 1Z16UQosXsodde80MTgKmwKoa342cKEXeEs9Exp9grU2wmy29mFgq6Ex6rF2DcPQVhzw 2uBkXOJgzKTpZzI0znaAM4B8/Do+92I6jd15A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=Ezrd3djr9t2auBhNl+Tipry8XeIvmvpKNdltwVqboRFUKJttCFTSm3kKT6t2t/261s wM2WcTX25jUEKemPeKLvItrmI1ZP1CrYC+1CvChSWGLk2ToeehgBMDpG/+w+7UK1KrdT CEPaFtZFl4LeYEBVtZH99ScYJ+8dovqqu4Q/Y= Received: by 10.142.12.14 with SMTP id 14mr1853097wfl.203.1227563972454; Mon, 24 Nov 2008 13:59:32 -0800 (PST) Received: from ?192.168.10.3? (adsl-76-254-6-199.dsl.pltn13.sbcglobal.net [76.254.6.199]) by mx.google.com with ESMTPS id 28sm5717245wfd.14.2008.11.24.13.59.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 24 Nov 2008 13:59:31 -0800 (PST) Message-Id: <51761B1A-17DD-493A-8F2F-FEA8AFCC17DB@gmail.com> From: Garrett Cooper To: Doug Rabson In-Reply-To: <200811221424.mAMEOtVt020067@svn.freebsd.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Date: Mon, 24 Nov 2008 14:03:07 -0800 References: <200811221424.mAMEOtVt020067@svn.freebsd.org> X-Mailer: Apple Mail (2.929.2) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185175 - in head/sys/boot: i386 i386/gptzfsboot zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 22:30:48 -0000 On Nov 22, 2008, at 6:24 AM, Doug Rabson wrote: > Author: dfr > Date: Sat Nov 22 14:24:55 2008 > New Revision: 185175 > URL: http://svn.freebsd.org/changeset/base/185175 > > Log: > Fix amd64 build and re-enable gptzfsboot. > > Modified: > head/sys/boot/i386/Makefile > head/sys/boot/i386/gptzfsboot/Makefile > head/sys/boot/zfs/Makefile > > Modified: head/sys/boot/i386/Makefile > = > = > = > = > = > = > = > = > ====================================================================== > --- head/sys/boot/i386/Makefile Sat Nov 22 13:33:06 2008 (r185174) > +++ head/sys/boot/i386/Makefile Sat Nov 22 14:24:55 2008 (r185175) > @@ -1,7 +1,7 @@ > # $FreeBSD$ > > SUBDIR= mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot zfsboot \ > - kgzldr libi386 libfirewire loader > + gptzfsboot kgzldr libi386 libfirewire loader > > # special boot programs, 'self-extracting boot2+loader' > SUBDIR+= pxeldr > > Modified: head/sys/boot/i386/gptzfsboot/Makefile > = > = > = > = > = > = > = > = > ====================================================================== > --- head/sys/boot/i386/gptzfsboot/Makefile Sat Nov 22 13:33:06 2008 > (r185174) > +++ head/sys/boot/i386/gptzfsboot/Makefile Sat Nov 22 14:24:55 2008 > (r185175) > @@ -65,7 +65,7 @@ gptzfsboot.out: ${BTXCRT} zfsboot.o sio. > zfsboot.o: ${.CURDIR}/../../zfs/zfsimpl.c > > .if ${MACHINE_ARCH} == "amd64" > -beforedepend gptzfsboot.o: machine > +beforedepend zfsboot.o: machine > CLEANFILES+= machine > machine: > ln -sf ${.CURDIR}/../../../i386/include machine > > Modified: head/sys/boot/zfs/Makefile > = > = > = > = > = > = > = > = > ====================================================================== > --- head/sys/boot/zfs/Makefile Sat Nov 22 13:33:06 2008 (r185174) > +++ head/sys/boot/zfs/Makefile Sat Nov 22 14:24:55 2008 (r185175) > @@ -9,10 +9,20 @@ CFLAGS+= -I${.CURDIR}/../common -I${.CUR > CFLAGS+= -I${.CURDIR}/../../../lib/libstand > CFLAGS+= -I${.CURDIR}/../../cddl/boot/zfs > > -# XXX need arch-specific bootstrap CFLAGS here > -# > -CFLAGS+= -ffreestanding -mpreferred-stack-boundary=2 \ > - -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 > +CFLAGS+= -ffreestanding > +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" > +CFLAGS+= -mpreferred-stack-boundary=2 > +CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 > +.endif > +.if ${MACHINE_ARCH} == "i386" > +CFLAGS+= -mno-sse3 > +.endif > +.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "arm" > +CFLAGS+= -msoft-float > +.endif > +.if ${MACHINE_ARCH} == "amd64" > +CFLAGS+= -m32 -march=i386 > +.endif > > CFLAGS+= -Wformat -Wall What about http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/129059 ? I didn't realize that gptzfsboot wasn't available for amd64. -Garrett From owner-svn-src-all@FreeBSD.ORG Mon Nov 24 22:50:09 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D442C1065688; Mon, 24 Nov 2008 22:50:09 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from itchy.rabson.org (unknown [IPv6:2002:50b1:e8f2:1::143]) by mx1.freebsd.org (Postfix) with ESMTP id 91EC18FC12; Mon, 24 Nov 2008 22:50:09 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from [IPv6:2001:470:909f:1:21b:63ff:feb8:5abc] (unknown [IPv6:2001:470:909f:1:21b:63ff:feb8:5abc]) by itchy.rabson.org (Postfix) with ESMTP id A61183FAA; Mon, 24 Nov 2008 22:50:08 +0000 (GMT) Message-Id: From: Doug Rabson To: Garrett Cooper In-Reply-To: <51761B1A-17DD-493A-8F2F-FEA8AFCC17DB@gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Date: Mon, 24 Nov 2008 22:50:08 +0000 References: <200811221424.mAMEOtVt020067@svn.freebsd.org> <51761B1A-17DD-493A-8F2F-FEA8AFCC17DB@gmail.com> X-Mailer: Apple Mail (2.929.2) Cc: svn-src-head@freebsd.org, Doug Rabson , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r185175 - in head/sys/boot: i386 i386/gptzfsboot zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 22:50:10 -0000 On 24 Nov 2008, at 22:03, Garrett Cooper wrote: >> > > What about http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/129059 ? I'll take a look at that, thanks. > > I didn't realize that gptzfsboot wasn't available for amd64. The amd64 kernel shares the i386 boot code and the ZFS boot code should work fine on amd64. From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 00:13:27 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8004E1065672; Tue, 25 Nov 2008 00:13:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70C4A8FC17; Tue, 25 Nov 2008 00:13:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP0DRpB002244; Tue, 25 Nov 2008 00:13:27 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP0DQDL002217; Tue, 25 Nov 2008 00:13:26 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811250013.mAP0DQDL002217@svn.freebsd.org> From: Warner Losh Date: Tue, 25 Nov 2008 00:13:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185265 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 00:13:27 -0000 Author: imp Date: Tue Nov 25 00:13:26 2008 New Revision: 185265 URL: http://svn.freebsd.org/changeset/base/185265 Log: Tweak the disclaimer section of the license to match COPYRIGHT, for better or worse. Ok'd by folks that have additional copyrights to the files in cases where there's joint authorship. Modified: head/sys/arm/at91/at91.c head/sys/arm/at91/at91_mci.c head/sys/arm/at91/at91_mcireg.h head/sys/arm/at91/at91_pdcreg.h head/sys/arm/at91/at91_pio.c head/sys/arm/at91/at91_pioreg.h head/sys/arm/at91/at91_piovar.h head/sys/arm/at91/at91_pmc.c head/sys/arm/at91/at91_pmcreg.h head/sys/arm/at91/at91_pmcvar.h head/sys/arm/at91/at91_rtc.c head/sys/arm/at91/at91_rtcreg.h head/sys/arm/at91/at91_spi.c head/sys/arm/at91/at91_spireg.h head/sys/arm/at91/at91_ssc.c head/sys/arm/at91/at91_sscreg.h head/sys/arm/at91/at91_st.c head/sys/arm/at91/at91_streg.h head/sys/arm/at91/at91_twi.c head/sys/arm/at91/at91_twiio.h head/sys/arm/at91/at91_twireg.h head/sys/arm/at91/at91_usartreg.h head/sys/arm/at91/at91rm92reg.h head/sys/arm/at91/at91var.h head/sys/arm/at91/uart_bus_at91usart.c head/sys/arm/at91/uart_cpu_at91rm9200usart.c head/sys/arm/at91/uart_dev_at91usart.c Modified: head/sys/arm/at91/at91.c ============================================================================== --- head/sys/arm/at91/at91.c Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91.c Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include Modified: head/sys/arm/at91/at91_mci.c ============================================================================== --- head/sys/arm/at91/at91_mci.c Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_mci.c Tue Nov 25 00:13:26 2008 (r185265) @@ -11,16 +11,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include Modified: head/sys/arm/at91/at91_mcireg.h ============================================================================== --- head/sys/arm/at91/at91_mcireg.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_mcireg.h Tue Nov 25 00:13:26 2008 (r185265) @@ -11,16 +11,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/at91_pdcreg.h ============================================================================== --- head/sys/arm/at91/at91_pdcreg.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_pdcreg.h Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/at91_pio.c ============================================================================== --- head/sys/arm/at91/at91_pio.c Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_pio.c Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include Modified: head/sys/arm/at91/at91_pioreg.h ============================================================================== --- head/sys/arm/at91/at91_pioreg.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_pioreg.h Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/at91_piovar.h ============================================================================== --- head/sys/arm/at91/at91_piovar.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_piovar.h Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/at91_pmc.c ============================================================================== --- head/sys/arm/at91/at91_pmc.c Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_pmc.c Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include "opt_at91.h" Modified: head/sys/arm/at91/at91_pmcreg.h ============================================================================== --- head/sys/arm/at91/at91_pmcreg.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_pmcreg.h Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/at91_pmcvar.h ============================================================================== --- head/sys/arm/at91/at91_pmcvar.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_pmcvar.h Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/at91_rtc.c ============================================================================== --- head/sys/arm/at91/at91_rtc.c Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_rtc.c Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include Modified: head/sys/arm/at91/at91_rtcreg.h ============================================================================== --- head/sys/arm/at91/at91_rtcreg.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_rtcreg.h Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/at91_spi.c ============================================================================== --- head/sys/arm/at91/at91_spi.c Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_spi.c Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include Modified: head/sys/arm/at91/at91_spireg.h ============================================================================== --- head/sys/arm/at91/at91_spireg.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_spireg.h Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/at91_ssc.c ============================================================================== --- head/sys/arm/at91/at91_ssc.c Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_ssc.c Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include Modified: head/sys/arm/at91/at91_sscreg.h ============================================================================== --- head/sys/arm/at91/at91_sscreg.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_sscreg.h Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/at91_st.c ============================================================================== --- head/sys/arm/at91/at91_st.c Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_st.c Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include Modified: head/sys/arm/at91/at91_streg.h ============================================================================== --- head/sys/arm/at91/at91_streg.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_streg.h Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/at91_twi.c ============================================================================== --- head/sys/arm/at91/at91_twi.c Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_twi.c Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include Modified: head/sys/arm/at91/at91_twiio.h ============================================================================== --- head/sys/arm/at91/at91_twiio.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_twiio.h Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * $FreeBSD$ */ Modified: head/sys/arm/at91/at91_twireg.h ============================================================================== --- head/sys/arm/at91/at91_twireg.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_twireg.h Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/at91_usartreg.h ============================================================================== --- head/sys/arm/at91/at91_usartreg.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91_usartreg.h Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/at91rm92reg.h ============================================================================== --- head/sys/arm/at91/at91rm92reg.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91rm92reg.h Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/at91var.h ============================================================================== --- head/sys/arm/at91/at91var.h Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/at91var.h Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/uart_bus_at91usart.c ============================================================================== --- head/sys/arm/at91/uart_bus_at91usart.c Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/uart_bus_at91usart.c Tue Nov 25 00:13:26 2008 (r185265) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include "opt_uart.h" Modified: head/sys/arm/at91/uart_cpu_at91rm9200usart.c ============================================================================== --- head/sys/arm/at91/uart_cpu_at91rm9200usart.c Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/uart_cpu_at91rm9200usart.c Tue Nov 25 00:13:26 2008 (r185265) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003 Marcel Moolenaar + * Copyright (c) 2006 M. Warner Losh * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -12,16 +13,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include "opt_uart.h" Modified: head/sys/arm/at91/uart_dev_at91usart.c ============================================================================== --- head/sys/arm/at91/uart_dev_at91usart.c Mon Nov 24 21:26:26 2008 (r185264) +++ head/sys/arm/at91/uart_dev_at91usart.c Tue Nov 25 00:13:26 2008 (r185265) @@ -13,16 +13,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 00:14:14 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3E7B1065672; Tue, 25 Nov 2008 00:14:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D77AC8FC20; Tue, 25 Nov 2008 00:14:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP0EEpO002295; Tue, 25 Nov 2008 00:14:14 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP0EEfp002294; Tue, 25 Nov 2008 00:14:14 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811250014.mAP0EEfp002294@svn.freebsd.org> From: Warner Losh Date: Tue, 25 Nov 2008 00:14:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185266 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 00:14:15 -0000 Author: imp Date: Tue Nov 25 00:14:14 2008 New Revision: 185266 URL: http://svn.freebsd.org/changeset/base/185266 Log: Replace three magic constants with L1_S_SIZE, since that's what is really meant in those places. Modified: head/sys/arm/at91/kb920x_machdep.c Modified: head/sys/arm/at91/kb920x_machdep.c ============================================================================== --- head/sys/arm/at91/kb920x_machdep.c Tue Nov 25 00:13:26 2008 (r185265) +++ head/sys/arm/at91/kb920x_machdep.c Tue Nov 25 00:14:14 2008 (r185266) @@ -312,7 +312,7 @@ initarm(void *arg, void *arg2) pmap_link_l2pt(l1pagetable, ARM_VECTORS_HIGH, &kernel_pt_table[KERNEL_PT_SYS]); for (i = 0; i < KERNEL_PT_KERN_NUM; i++) - pmap_link_l2pt(l1pagetable, KERNBASE + i * 0x100000, + pmap_link_l2pt(l1pagetable, KERNBASE + i * L1_S_SIZE, &kernel_pt_table[KERNEL_PT_KERN + i]); pmap_map_chunk(l1pagetable, KERNBASE, PHYSADDR, (((uint32_t)lastaddr - KERNBASE) + PAGE_SIZE) & ~(PAGE_SIZE - 1), @@ -320,7 +320,7 @@ initarm(void *arg, void *arg2) afterkern = round_page((lastaddr + L1_S_SIZE) & ~(L1_S_SIZE - 1)); for (i = 0; i < KERNEL_PT_AFKERNEL_NUM; i++) { - pmap_link_l2pt(l1pagetable, afterkern + i * 0x00100000, + pmap_link_l2pt(l1pagetable, afterkern + i * L1_S_SIZE, &kernel_pt_table[KERNEL_PT_AFKERNEL + i]); } @@ -406,7 +406,7 @@ initarm(void *arg, void *arg2) arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); - pmap_curmaxkvaddr = afterkern + 0x100000 * (KERNEL_PT_KERN_NUM - 1); + pmap_curmaxkvaddr = afterkern + L1_S_SIZE * (KERNEL_PT_KERN_NUM - 1); /* * ARM_USE_SMALL_ALLOC uses dump_avail, so it must be filled before * calling pmap_bootstrap. From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 00:14:49 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFB6F1065670; Tue, 25 Nov 2008 00:14:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D249A8FC0C; Tue, 25 Nov 2008 00:14:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP0EnwR002344; Tue, 25 Nov 2008 00:14:49 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP0En1D002341; Tue, 25 Nov 2008 00:14:49 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811250014.mAP0En1D002341@svn.freebsd.org> From: Warner Losh Date: Tue, 25 Nov 2008 00:14:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185267 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 00:14:50 -0000 Author: imp Date: Tue Nov 25 00:14:49 2008 New Revision: 185267 URL: http://svn.freebsd.org/changeset/base/185267 Log: Replace disclaimer with the one from COPYRIGHT. Joint authors aggreed to the change. Modified: head/sys/arm/at91/if_ate.c head/sys/arm/at91/if_atereg.h head/sys/arm/at91/ohci_atmelarm.c Modified: head/sys/arm/at91/if_ate.c ============================================================================== --- head/sys/arm/at91/if_ate.c Tue Nov 25 00:14:14 2008 (r185266) +++ head/sys/arm/at91/if_ate.c Tue Nov 25 00:14:49 2008 (r185267) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* TODO: (in no order) Modified: head/sys/arm/at91/if_atereg.h ============================================================================== --- head/sys/arm/at91/if_atereg.h Tue Nov 25 00:14:14 2008 (r185266) +++ head/sys/arm/at91/if_atereg.h Tue Nov 25 00:14:49 2008 (r185267) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* $FreeBSD$ */ Modified: head/sys/arm/at91/ohci_atmelarm.c ============================================================================== --- head/sys/arm/at91/ohci_atmelarm.c Tue Nov 25 00:14:14 2008 (r185266) +++ head/sys/arm/at91/ohci_atmelarm.c Tue Nov 25 00:14:49 2008 (r185267) @@ -10,16 +10,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 00:39:04 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51E251065674; Tue, 25 Nov 2008 00:39:04 +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 448B78FC19; Tue, 25 Nov 2008 00:39:04 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP0d43W002858; Tue, 25 Nov 2008 00:39:04 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP0d4hv002856; Tue, 25 Nov 2008 00:39:04 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200811250039.mAP0d4hv002856@svn.freebsd.org> From: Rui Paulo Date: Tue, 25 Nov 2008 00:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185268 - in head/sys/dev/ata: . chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 00:39:04 -0000 Author: rpaulo Date: Tue Nov 25 00:39:03 2008 New Revision: 185268 URL: http://svn.freebsd.org/changeset/base/185268 Log: Add support for Marvell PATA M88SX6121. PR: 129154 Submitted by: João Barros MFC after: 1 month Modified: head/sys/dev/ata/ata-pci.h head/sys/dev/ata/chipsets/ata-marvell.c Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Tue Nov 25 00:14:49 2008 (r185267) +++ head/sys/dev/ata/ata-pci.h Tue Nov 25 00:39:03 2008 (r185268) @@ -216,6 +216,7 @@ struct ata_connect_task { #define ATA_M88SX6041 0x604111ab #define ATA_M88SX6081 0x608111ab #define ATA_M88SX6101 0x610111ab +#define ATA_M88SX6121 0x612111ab #define ATA_M88SX6145 0x614511ab #define ATA_MICRON_ID 0x1042 Modified: head/sys/dev/ata/chipsets/ata-marvell.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-marvell.c Tue Nov 25 00:14:49 2008 (r185267) +++ head/sys/dev/ata/chipsets/ata-marvell.c Tue Nov 25 00:39:03 2008 (r185268) @@ -103,6 +103,7 @@ ata_marvell_probe(device_t dev) { ATA_M88SX6041, 0, 4, MV_60XX, ATA_SA300, "88SX6041" }, { ATA_M88SX6081, 0, 8, MV_60XX, ATA_SA300, "88SX6081" }, { ATA_M88SX6101, 0, 1, MV_61XX, ATA_UDMA6, "88SX6101" }, + { ATA_M88SX6121, 0, 1, MV_61XX, ATA_UDMA6, "88SX6121" }, { ATA_M88SX6145, 0, 2, MV_61XX, ATA_UDMA6, "88SX6145" }, { 0, 0, 0, 0, 0, 0}}; From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 00:48:05 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBBDF106564A; Tue, 25 Nov 2008 00:48:05 +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 DD8E28FC19; Tue, 25 Nov 2008 00:48:05 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP0m5rC003070; Tue, 25 Nov 2008 00:48:05 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP0m5dI003067; Tue, 25 Nov 2008 00:48:05 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811250048.mAP0m5dI003067@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 25 Nov 2008 00:48:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185269 - head/sys/dev/fxp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 00:48:06 -0000 Author: yongari Date: Tue Nov 25 00:48:05 2008 New Revision: 185269 URL: http://svn.freebsd.org/changeset/base/185269 Log: Whitespace fix. Modified: head/sys/dev/fxp/if_fxp.c head/sys/dev/fxp/if_fxpreg.h head/sys/dev/fxp/if_fxpvar.h Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Tue Nov 25 00:39:03 2008 (r185268) +++ head/sys/dev/fxp/if_fxp.c Tue Nov 25 00:48:05 2008 (r185269) @@ -526,7 +526,7 @@ fxp_attach(device_t dev) * Systems based on the ICH2/ICH2-M chip from Intel, and possibly * some systems based a normal 82559 design, have a defect where * the chip can cause a PCI protocol violation if it receives - * a CU_RESUME command when it is entering the IDLE state. The + * a CU_RESUME command when it is entering the IDLE state. The * workaround is to disable Dynamic Standby Mode, so the chip never * deasserts CLKRUN#, and always remains in an active state. * @@ -805,7 +805,7 @@ fxp_attach(device_t dev) ifp->if_snd.ifq_drv_maxlen = FXP_NTXCB - 1; IFQ_SET_READY(&ifp->if_snd); - /* + /* * Hook our interrupt after all initialization is complete. */ error = bus_setup_intr(dev, sc->fxp_res[1], INTR_TYPE_NET | INTR_MPSAFE, @@ -899,7 +899,7 @@ fxp_detach(device_t dev) struct fxp_softc *sc = device_get_softc(dev); #ifdef DEVICE_POLLING - if (sc->ifp->if_capenable & IFCAP_POLLING) + if (sc->ifp->if_capenable & IFCAP_POLLING) ether_poll_deregister(sc->ifp); #endif @@ -964,7 +964,7 @@ fxp_suspend(device_t dev) FXP_LOCK(sc); fxp_stop(sc); - + sc->suspended = 1; FXP_UNLOCK(sc); @@ -996,7 +996,7 @@ fxp_resume(device_t dev) return (0); } -static void +static void fxp_eeprom_shiftin(struct fxp_softc *sc, int data, int length) { uint16_t reg; @@ -1185,7 +1185,7 @@ fxp_start(struct ifnet *ifp) } /* - * Start packet transmission on the interface. + * Start packet transmission on the interface. * This routine must be called with the softc lock held, and is an * internal entry point only. */ @@ -1511,10 +1511,10 @@ fxp_intr(void *xsc) while ((statack = CSR_READ_1(sc, FXP_CSR_SCB_STATACK)) != 0) { /* * It should not be possible to have all bits set; the - * FXP_SCB_INTR_SWI bit always returns 0 on a read. If + * FXP_SCB_INTR_SWI bit always returns 0 on a read. If * all bits are set, this may indicate that the card has * been physically ejected, so ignore it. - */ + */ if (statack == 0xff) { FXP_UNLOCK(sc); return; @@ -1770,7 +1770,7 @@ fxp_tick(void *xsc) * with external storage to be released in a timely manner rather * than being defered for a potentially long time. This limits * the delay to a maximum of one second. - */ + */ fxp_txeof(sc); /* @@ -2203,11 +2203,11 @@ fxp_ifmedia_upd(struct ifnet *ifp) mii = device_get_softc(sc->miibus); FXP_LOCK(sc); - if (mii->mii_instance) { - struct mii_softc *miisc; - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } + if (mii->mii_instance) { + struct mii_softc *miisc; + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); + } mii_mediachg(mii); FXP_UNLOCK(sc); return (0); @@ -2260,7 +2260,7 @@ fxp_add_rfabuf(struct fxp_softc *sc, str m = oldm; m->m_data = m->m_ext.ext_buf; /* - * return error so the receive loop will + * return error so the receive loop will * not pass the packet to upper layer */ reused_mbuf = EAGAIN; @@ -2688,7 +2688,7 @@ fxp_load_ucode(struct fxp_softc *sc) bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_POSTWRITE); device_printf(sc->dev, "Microcode loaded, int_delay: %d usec bundle_max: %d\n", - sc->tunable_int_delay, + sc->tunable_int_delay, uc->bundle_max_offset == 0 ? 0 : sc->tunable_bundle_max); sc->flags |= FXP_FLAG_UCODE; } @@ -2710,7 +2710,7 @@ sysctl_int_range(SYSCTL_HANDLER_ARGS, in /* * Interrupt delay is expressed in microseconds, a multiplier is used - * to convert this to the appropriate clock ticks before using. + * to convert this to the appropriate clock ticks before using. */ static int sysctl_hw_fxp_int_delay(SYSCTL_HANDLER_ARGS) Modified: head/sys/dev/fxp/if_fxpreg.h ============================================================================== --- head/sys/dev/fxp/if_fxpreg.h Tue Nov 25 00:39:03 2008 (r185268) +++ head/sys/dev/fxp/if_fxpreg.h Tue Nov 25 00:48:05 2008 (r185269) @@ -287,7 +287,7 @@ struct fxp_cb_tx { /* * The following structure isn't actually part of the TxCB, * unless the extended TxCB feature is being used. In this - * case, the first two elements of the structure below are + * case, the first two elements of the structure below are * fetched along with the TxCB. */ union { @@ -420,7 +420,7 @@ struct fxp_stats { }; #define FXP_STATS_DUMP_COMPLETE 0xa005 #define FXP_STATS_DR_COMPLETE 0xa007 - + /* * Serial EEPROM control register bits */ Modified: head/sys/dev/fxp/if_fxpvar.h ============================================================================== --- head/sys/dev/fxp/if_fxpvar.h Tue Nov 25 00:39:03 2008 (r185268) +++ head/sys/dev/fxp/if_fxpvar.h Tue Nov 25 00:48:05 2008 (r185269) @@ -1,13 +1,13 @@ /*- * Copyright (c) 1995, David Greenman * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions - * are met: + * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following - * disclaimer. + * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -86,16 +86,16 @@ /* * Default maximum time, in microseconds, that an interrupt may be delayed - * in an attempt to coalesce interrupts. This is only effective if the Intel + * in an attempt to coalesce interrupts. This is only effective if the Intel * microcode is loaded, and may be changed via either loader tunables or * sysctl. See also the CPUSAVER_DWORD entry in rcvbundl.h. */ #define TUNABLE_INT_DELAY 1000 /* - * Default number of packets that will be bundled, before an interrupt is + * Default number of packets that will be bundled, before an interrupt is * generated. This is only effective if the Intel microcode is loaded, and - * may be changed via either loader tunables or sysctl. This may not be + * may be changed via either loader tunables or sysctl. This may not be * present in all microcode revisions, see also the CPUSAVER_BUNDLE_MAX_DWORD * entry in rcvbundl.h. */ From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 00:48:15 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E718106575B; Tue, 25 Nov 2008 00:48:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9121D8FC1A; Tue, 25 Nov 2008 00:48:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP0mF46003108; Tue, 25 Nov 2008 00:48:15 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP0mFCE003107; Tue, 25 Nov 2008 00:48:15 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811250048.mAP0mFCE003107@svn.freebsd.org> From: Warner Losh Date: Tue, 25 Nov 2008 00:48:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185270 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 00:48:15 -0000 Author: imp Date: Tue Nov 25 00:48:15 2008 New Revision: 185270 URL: http://svn.freebsd.org/changeset/base/185270 Log: Fix various whitespace botches, mostly having them at the end of a line. Modified: head/sys/arm/at91/kb920x_machdep.c Modified: head/sys/arm/at91/kb920x_machdep.c ============================================================================== --- head/sys/arm/at91/kb920x_machdep.c Tue Nov 25 00:48:05 2008 (r185269) +++ head/sys/arm/at91/kb920x_machdep.c Tue Nov 25 00:48:15 2008 (r185270) @@ -38,7 +38,7 @@ * * Machine dependant functions for kernel setup * - * This file needs a lot of work. + * This file needs a lot of work. * * Created : 17/09/94 */ @@ -96,7 +96,7 @@ __FBSDID("$FreeBSD$"); #include #define KERNEL_PT_SYS 0 /* Page table for mapping proc0 zero page */ -#define KERNEL_PT_KERN 1 +#define KERNEL_PT_KERN 1 #define KERNEL_PT_KERN_NUM 22 #define KERNEL_PT_AFKERNEL KERNEL_PT_KERN + KERNEL_PT_KERN_NUM /* L2 table for mapping after kernel */ #define KERNEL_PT_AFKERNEL_NUM 5 @@ -139,7 +139,7 @@ static struct trapframe proc0_tf; /* Static device mappings. */ static const struct pmap_devmap kb920x_devmap[] = { - /* + /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. */ @@ -152,7 +152,7 @@ static const struct pmap_devmap kb920x_d 0xdff00000, 0xfff00000, 0x100000, - VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, /* @@ -172,7 +172,7 @@ static const struct pmap_devmap kb920x_d AT91RM92_OHCI_BASE, AT91RM92_OHCI_PA_BASE, AT91RM92_OHCI_SIZE, - VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, { @@ -190,7 +190,7 @@ ramsize(void) uint32_t *SDRAMC = (uint32_t *)(AT91RM92_BASE + AT91RM92_SDRAMC_BASE); uint32_t cr, mr; int banks, rows, cols, bw; - + cr = SDRAMC[AT91RM92_SDRAMC_CR / 4]; mr = SDRAMC[AT91RM92_SDRAMC_MR / 4]; bw = (mr & AT91RM92_SDRAMC_MR_DBW_16) ? 1 : 2; @@ -282,7 +282,7 @@ initarm(void *arg, void *arg2) kernel_pt_table[loop].pv_va = freemempos - (loop % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) * L2_TABLE_SIZE_REAL; - kernel_pt_table[loop].pv_pa = + kernel_pt_table[loop].pv_pa = kernel_pt_table[loop].pv_va - KERNVIRTADDR + KERNPHYSADDR; } @@ -317,8 +317,7 @@ initarm(void *arg, void *arg2) pmap_map_chunk(l1pagetable, KERNBASE, PHYSADDR, (((uint32_t)lastaddr - KERNBASE) + PAGE_SIZE) & ~(PAGE_SIZE - 1), VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - afterkern = round_page((lastaddr + L1_S_SIZE) & ~(L1_S_SIZE - - 1)); + afterkern = round_page((lastaddr + L1_S_SIZE) & ~(L1_S_SIZE - 1)); for (i = 0; i < KERNEL_PT_AFKERNEL_NUM; i++) { pmap_link_l2pt(l1pagetable, afterkern + i * L1_S_SIZE, &kernel_pt_table[KERNEL_PT_AFKERNEL + i]); @@ -390,12 +389,12 @@ initarm(void *arg, void *arg2) cpu_idcache_wbinv_all(); /* Set stack for exception handlers */ - + data_abort_handler_address = (u_int)data_abort_handler; prefetch_abort_handler_address = (u_int)prefetch_abort_handler; undefined_handler_address = (u_int)undefinedinstruction_bounce; undefined_init(); - + proc_linkup0(&proc0, &thread0); thread0.td_kstack = kernelstack.pv_va; thread0.td_pcb = (struct pcb *) @@ -403,7 +402,7 @@ initarm(void *arg, void *arg2) thread0.td_pcb->pcb_flags = 0; thread0.td_frame = &proc0_tf; pcpup->pc_curpcb = thread0.td_pcb; - + arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); pmap_curmaxkvaddr = afterkern + L1_S_SIZE * (KERNEL_PT_KERN_NUM - 1); @@ -415,16 +414,15 @@ initarm(void *arg, void *arg2) dump_avail[1] = PHYSADDR + memsize; dump_avail[2] = 0; dump_avail[3] = 0; - + pmap_bootstrap(freemempos, KERNVIRTADDR + 3 * memsize, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, MSGBUF_SIZE); mutex_init(); - + i = 0; - #if PHYSADDR != KERNPHYSADDR phys_avail[i++] = PHYSADDR; phys_avail[i++] = KERNPHYSADDR; From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 00:59:12 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0303F1065674; Tue, 25 Nov 2008 00:59:12 +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 E90BA8FC17; Tue, 25 Nov 2008 00:59:11 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP0xBkw003346; Tue, 25 Nov 2008 00:59:11 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP0xBgN003345; Tue, 25 Nov 2008 00:59:11 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811250059.mAP0xBgN003345@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 25 Nov 2008 00:59:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185271 - head/sys/dev/fxp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 00:59:12 -0000 Author: yongari Date: Tue Nov 25 00:59:11 2008 New Revision: 185271 URL: http://svn.freebsd.org/changeset/base/185271 Log: Sort head files and removed ununsed header file. Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Tue Nov 25 00:48:15 2008 (r185270) +++ head/sys/dev/fxp/if_fxp.c Tue Nov 25 00:59:11 2008 (r185271) @@ -40,32 +40,28 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include -#include - /* #include */ #include +#include #include +#include #include +#include #include +#include +#include #include +#include #include #include +#include +#include -#include -#include -#include #include -#include #include -#include -#include - - -#include -#include - #ifdef FXP_IP_CSUM_WAR #include #include From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 01:01:49 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3013E106564A; Tue, 25 Nov 2008 01:01:49 +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 22C318FC16; Tue, 25 Nov 2008 01:01:49 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP11nfQ003461; Tue, 25 Nov 2008 01:01:49 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP11n7J003460; Tue, 25 Nov 2008 01:01:49 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811250101.mAP11n7J003460@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 25 Nov 2008 01:01:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185272 - head/sys/dev/fxp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 01:01:49 -0000 Author: yongari Date: Tue Nov 25 01:01:48 2008 New Revision: 185272 URL: http://svn.freebsd.org/changeset/base/185272 Log: Make fxp(4) build with FXP_IP_CSUM_WAR. Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Tue Nov 25 00:59:11 2008 (r185271) +++ head/sys/dev/fxp/if_fxp.c Tue Nov 25 01:01:48 2008 (r185272) @@ -1315,8 +1315,8 @@ fxp_encap(struct fxp_softc *sc, struct m if (m_head->m_pkthdr.len < 38) { struct ip *ip; m_head->m_data += ETHER_HDR_LEN; - ip = mtod(mb_head, struct ip *); - ip->ip_sum = in_cksum(mb_head, ip->ip_hl << 2); + ip = mtod(m_head, struct ip *); + ip->ip_sum = in_cksum(m_head, ip->ip_hl << 2); m_head->m_data -= ETHER_HDR_LEN; } else { txp->tx_cb->ipcb_ip_activation_high = From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 01:33:16 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87E381065670; Tue, 25 Nov 2008 01:33:16 +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 780BB8FC0A; Tue, 25 Nov 2008 01:33:16 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP1XGhM004082; Tue, 25 Nov 2008 01:33:16 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP1XGPi004081; Tue, 25 Nov 2008 01:33:16 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811250133.mAP1XGPi004081@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 25 Nov 2008 01:33:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185273 - head/sys/dev/fxp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 01:33:16 -0000 Author: yongari Date: Tue Nov 25 01:33:16 2008 New Revision: 185273 URL: http://svn.freebsd.org/changeset/base/185273 Log: Fix Tx/Rx checksum offload ioctl handling and make Rx handler honor checksum offload configuration. Now checksum offload can be controlled by ifconfig(8). While I'm here add an additional check for interface capabilities before applying user's request. Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Tue Nov 25 01:01:48 2008 (r185272) +++ head/sys/dev/fxp/if_fxp.c Tue Nov 25 01:33:16 2008 (r185273) @@ -1558,6 +1558,7 @@ fxp_intr_body(struct fxp_softc *sc, stru struct fxp_rfa *rfa; int rnr = (statack & FXP_SCB_STATACK_RNR) ? 1 : 0; int fxp_rc = 0; + uint16_t status; FXP_LOCK_ASSERT(sc, MA_OWNED); if (rnr) @@ -1635,7 +1636,8 @@ fxp_intr_body(struct fxp_softc *sc, stru } #endif /* DEVICE_POLLING */ - if ((le16toh(rfa->rfa_status) & FXP_RFA_STATUS_C) == 0) + status = le16toh(rfa->rfa_status); + if ((status & FXP_RFA_STATUS_C) == 0) break; /* @@ -1661,14 +1663,14 @@ fxp_intr_body(struct fxp_softc *sc, stru total_len = le16toh(rfa->actual_size) & 0x3fff; if (total_len < sizeof(struct ether_header) || total_len > MCLBYTES - RFA_ALIGNMENT_FUDGE - - sc->rfa_size || - le16toh(rfa->rfa_status) & FXP_RFA_STATUS_CRC) { + sc->rfa_size || status & FXP_RFA_STATUS_CRC) { m_freem(m); continue; } /* Do IP checksum checking. */ - if (le16toh(rfa->rfa_status) & FXP_RFA_STATUS_PARSE) { + if ((ifp->if_capenable & IFCAP_RXCSUM) != 0 && + (status & FXP_RFA_STATUS_PARSE)) { if (rfa->rfax_csum_sts & FXP_RFDX_CS_IP_CSUM_BIT_VALID) m->m_pkthdr.csum_flags |= @@ -2372,7 +2374,7 @@ fxp_ioctl(struct ifnet *ifp, u_long comm struct fxp_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; struct mii_data *mii; - int flag, mask, error = 0; + int flag, mask, error = 0, reinit; switch (command) { case SIOCSIFFLAGS: @@ -2432,6 +2434,7 @@ fxp_ioctl(struct ifnet *ifp, u_long comm break; case SIOCSIFCAP: + reinit = 0; mask = ifp->if_capenable ^ ifr->ifr_reqcap; #ifdef DEVICE_POLLING if (mask & IFCAP_POLLING) { @@ -2454,8 +2457,20 @@ fxp_ioctl(struct ifnet *ifp, u_long comm } } #endif - if (mask & IFCAP_VLAN_MTU) { - FXP_LOCK(sc); + FXP_LOCK(sc); + if ((mask & IFCAP_TXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) + ifp->if_hwassist |= FXP_CSUM_FEATURES; + else + ifp->if_hwassist &= ~FXP_CSUM_FEATURES; + } + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) + ifp->if_capenable ^= IFCAP_RXCSUM; + if ((mask & IFCAP_VLAN_MTU) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_MTU) != 0) { ifp->if_capenable ^= IFCAP_VLAN_MTU; if (sc->revision != FXP_REV_82557) flag = FXP_FLAG_LONG_PKT_EN; @@ -2463,9 +2478,11 @@ fxp_ioctl(struct ifnet *ifp, u_long comm flag = FXP_FLAG_SAVE_BAD; sc->flags ^= flag; if (ifp->if_flags & IFF_UP) - fxp_init_body(sc); - FXP_UNLOCK(sc); + reinit++; } + if (reinit > 0) + fxp_init_body(sc); + FXP_UNLOCK(sc); break; default: From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 01:40:25 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0EAB1065674; Tue, 25 Nov 2008 01:40:25 +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 A0FF68FC18; Tue, 25 Nov 2008 01:40:25 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP1ePx5004250; Tue, 25 Nov 2008 01:40:25 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP1ePKf004249; Tue, 25 Nov 2008 01:40:25 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811250140.mAP1ePKf004249@svn.freebsd.org> From: Ken Smith Date: Tue, 25 Nov 2008 01:40:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185274 - releng/6.4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 01:40:25 -0000 Author: kensmith Date: Tue Nov 25 01:40:25 2008 New Revision: 185274 URL: http://svn.freebsd.org/changeset/base/185274 Log: Predict 6.4-RELEASE date. Approved by: re (implicit) Modified: releng/6.4/UPDATING Modified: releng/6.4/UPDATING ============================================================================== --- releng/6.4/UPDATING Tue Nov 25 01:33:16 2008 (r185273) +++ releng/6.4/UPDATING Tue Nov 25 01:40:25 2008 (r185274) @@ -8,6 +8,9 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20081128: + FreeBSD 6.4-RELEASE + 20081124: FreeBSD-SA-08:11.arc4random Make sure arc4random(9) is properly seeded when /etc/rc.d/initrandom returns. From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 01:41:19 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF59C1065673; Tue, 25 Nov 2008 01:41:19 +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 BF3A68FC0C; Tue, 25 Nov 2008 01:41:19 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP1fJUe004301; Tue, 25 Nov 2008 01:41:19 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP1fJTP004300; Tue, 25 Nov 2008 01:41:19 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811250141.mAP1fJTP004300@svn.freebsd.org> From: Ken Smith Date: Tue, 25 Nov 2008 01:41:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185275 - releng/6.4/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 01:41:19 -0000 Author: kensmith Date: Tue Nov 25 01:41:19 2008 New Revision: 185275 URL: http://svn.freebsd.org/changeset/base/185275 Log: Call ourself 6.4-RELEASE. Approved by: re (implicit) Modified: releng/6.4/sys/conf/newvers.sh Modified: releng/6.4/sys/conf/newvers.sh ============================================================================== --- releng/6.4/sys/conf/newvers.sh Tue Nov 25 01:40:25 2008 (r185274) +++ releng/6.4/sys/conf/newvers.sh Tue Nov 25 01:41:19 2008 (r185275) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="6.4" -BRANCH="RC2" +BRANCH="RELEASE" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 02:05:02 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EC331065674; Tue, 25 Nov 2008 02:05:02 +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 7CD568FC13; Tue, 25 Nov 2008 02:05:02 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP252j4004797; Tue, 25 Nov 2008 02:05:02 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP252Cs004796; Tue, 25 Nov 2008 02:05:02 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811250205.mAP252Cs004796@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 25 Nov 2008 02:05:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185276 - head/sys/dev/fxp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 02:05:02 -0000 Author: yongari Date: Tue Nov 25 02:05:01 2008 New Revision: 185276 URL: http://svn.freebsd.org/changeset/base/185276 Log: Move unarming watchdog timer and pending multicast configuration check to fxp_txeof(). While I'm here unarm watchdog timer only if there are no pending queued Tx requests. Previously the watchdog timer was unarmed whenever Tx interrupt is raised. This could be resulted in hiding root cause of watchdog timeouts. Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Tue Nov 25 01:41:19 2008 (r185275) +++ head/sys/dev/fxp/if_fxp.c Tue Nov 25 02:05:01 2008 (r185276) @@ -1547,6 +1547,11 @@ fxp_txeof(struct fxp_softc *sc) } sc->fxp_desc.tx_first = txp; bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE); + if (sc->tx_queued == 0) { + sc->watchdog_timer = 0; + if (sc->need_mcsetup) + fxp_mc_setup(sc); + } } static void @@ -1587,11 +1592,6 @@ fxp_intr_body(struct fxp_softc *sc, stru if (statack & (FXP_SCB_STATACK_CXTNO | FXP_SCB_STATACK_CNA)) { fxp_txeof(sc); - sc->watchdog_timer = 0; - if (sc->tx_queued == 0) { - if (sc->need_mcsetup) - fxp_mc_setup(sc); - } /* * Try to start more packets transmitting. */ From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 02:15:09 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B66401065670; Tue, 25 Nov 2008 02:15:09 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A49598FC12; Tue, 25 Nov 2008 02:15:09 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP2F9bB005022; Tue, 25 Nov 2008 02:15:09 GMT (envelope-from avatar@svn.freebsd.org) Received: (from avatar@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP2F9EG005021; Tue, 25 Nov 2008 02:15:09 GMT (envelope-from avatar@svn.freebsd.org) Message-Id: <200811250215.mAP2F9EG005021@svn.freebsd.org> From: Tai-hwa Liang Date: Tue, 25 Nov 2008 02:15:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185277 - head/lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 02:15:09 -0000 Author: avatar Date: Tue Nov 25 02:15:09 2008 New Revision: 185277 URL: http://svn.freebsd.org/changeset/base/185277 Log: Fixing !INET6 builds. Modified: head/lib/libutil/realhostname.c Modified: head/lib/libutil/realhostname.c ============================================================================== --- head/lib/libutil/realhostname.c Tue Nov 25 02:05:01 2008 (r185276) +++ head/lib/libutil/realhostname.c Tue Nov 25 02:15:09 2008 (r185277) @@ -100,7 +100,9 @@ realhostname_sa(char *host, size_t hsize { int result, error; char buf[NI_MAXHOST]; +#ifdef INET6 struct sockaddr_in lsin; +#endif result = HOSTNAME_INVALIDADDR; From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 02:19:02 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F5871065673; Tue, 25 Nov 2008 02:19:02 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BCCB8FC12; Tue, 25 Nov 2008 02:19:02 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP2J22d005127; Tue, 25 Nov 2008 02:19:02 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP2J26I005125; Tue, 25 Nov 2008 02:19:02 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <200811250219.mAP2J26I005125@svn.freebsd.org> From: Weongyo Jeong Date: Tue, 25 Nov 2008 02:19:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185278 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 02:19:02 -0000 Author: weongyo Date: Tue Nov 25 02:19:02 2008 New Revision: 185278 URL: http://svn.freebsd.org/changeset/base/185278 Log: - improve AL2230 RF handling when the device type is zd1211. After this patch the RX/TX performance becomes about 17~18 Mbps comparing with the previous whose values were RX 7~8Mbps and TX 13~14Mbps. - improve AL2230 RF handling in zd1211b - support AL2230S RF that PV2000 is renamed to AL2230S - use register ZYD_CR244, ZYD_CR243, ZYD_CR242 when the driver writes values on RF. This routine is more faster than the original one - use private TX lock to avoid LOR at zyd_raw_xmit() - increase TX slots from 1 to 5 - needs to set the channel at IEEE80211_S_AUTH not IEEE80211_S_RUN - detailed error handling. In previous the next command was sent to the device even if there was errors - setting ZYD_MAC_RX_THRESHOLD value should be different between 1211 and 1211b - only try to stop the device at zyd_init_locked() if the device is UPed - do not use MTX_RECURSE - do not try to grap Giant lock when the channel is changing - move the device initialization routines from zyd_attach to zyd_init to give a device full-reset chance to the driver. - code cleanup at zyd_raw_xmit() - simplify zyd_attach() routines - resort functions and clean up variables - DPRINTF style change. - style(9) Reviewed by: sam Modified: head/sys/dev/usb/if_zyd.c head/sys/dev/usb/if_zydreg.h Modified: head/sys/dev/usb/if_zyd.c ============================================================================== --- head/sys/dev/usb/if_zyd.c Tue Nov 25 02:15:09 2008 (r185277) +++ head/sys/dev/usb/if_zyd.c Tue Nov 25 02:19:02 2008 (r185278) @@ -66,14 +66,32 @@ #include #include -#define ZYD_DEBUG #ifdef ZYD_DEBUG -#define DPRINTF(x) do { if (zyddebug > 0) printf x; } while (0) -#define DPRINTFN(n, x) do { if (zyddebug > (n)) printf x; } while (0) -int zyddebug = 0; +SYSCTL_NODE(_hw_usb, OID_AUTO, zyd, CTLFLAG_RW, 0, "ZyDAS zd1211/zd1211b"); +int zyd_debug = 0; +SYSCTL_INT(_hw_usb_zyd, OID_AUTO, debug, CTLFLAG_RW, &zyd_debug, 0, + "control debugging printfs"); +TUNABLE_INT("hw.usb.zyd.debug", &zyd_debug); +enum { + ZYD_DEBUG_XMIT = 0x00000001, /* basic xmit operation */ + ZYD_DEBUG_RECV = 0x00000002, /* basic recv operation */ + ZYD_DEBUG_RESET = 0x00000004, /* reset processing */ + ZYD_DEBUG_INIT = 0x00000008, /* device init */ + ZYD_DEBUG_TX_PROC = 0x00000010, /* tx ISR proc */ + ZYD_DEBUG_RX_PROC = 0x00000020, /* rx ISR proc */ + ZYD_DEBUG_STATE = 0x00000040, /* 802.11 state transitions */ + ZYD_DEBUG_STAT = 0x00000080, /* statistic */ + ZYD_DEBUG_FW = 0x00000100, /* firmware */ + ZYD_DEBUG_ANY = 0xffffffff +}; +#define DPRINTF(sc, m, fmt, ...) do { \ + if (sc->sc_debug & (m)) \ + printf(fmt, __VA_ARGS__); \ +} while (0) #else -#define DPRINTF(x) -#define DPRINTFN(n, x) +#define DPRINTF(sc, m, fmt, ...) do { \ + (void) sc; \ +} while (0) #endif static const struct zyd_phy_pair zyd_def_phy[] = ZYD_DEF_PHY; @@ -144,8 +162,28 @@ static const struct zyd_type { ZYD_ZD1211B_DEV(ZYXEL, M202), ZYD_ZD1211B_DEV(ZYXEL, G220V2), }; -#define zyd_lookup(v, p) \ +#define zyd_lookup(v, p) \ ((const struct zyd_type *)usb_lookup(zyd_devs, v, p)) +#define zyd_read16_m(sc, val, data) do { \ + error = zyd_read16(sc, val, data); \ + if (error != 0) \ + goto fail; \ +} while (0) +#define zyd_write16_m(sc, val, data) do { \ + error = zyd_write16(sc, val, data); \ + if (error != 0) \ + goto fail; \ +} while (0) +#define zyd_read32_m(sc, val, data) do { \ + error = zyd_read32(sc, val, data); \ + if (error != 0) \ + goto fail; \ +} while (0) +#define zyd_write32_m(sc, val, data) do { \ + error = zyd_write32(sc, val, data); \ + if (error != 0) \ + goto fail; \ +} while (0) static device_probe_t zyd_match; static device_attach_t zyd_attach; @@ -156,8 +194,6 @@ static struct ieee80211vap *zyd_vap_crea int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t mac[IEEE80211_ADDR_LEN]); static void zyd_vap_delete(struct ieee80211vap *); -static int zyd_attachhook(struct zyd_softc *); -static int zyd_complete_attach(struct zyd_softc *); static int zyd_open_pipes(struct zyd_softc *); static void zyd_close_pipes(struct zyd_softc *); static int zyd_alloc_tx_list(struct zyd_softc *); @@ -175,38 +211,18 @@ static int zyd_read32(struct zyd_softc * static int zyd_write16(struct zyd_softc *, uint16_t, uint16_t); static int zyd_write32(struct zyd_softc *, uint16_t, uint32_t); static int zyd_rfwrite(struct zyd_softc *, uint32_t); -static void zyd_lock_phy(struct zyd_softc *); -static void zyd_unlock_phy(struct zyd_softc *); -static int zyd_rfmd_init(struct zyd_rf *); -static int zyd_rfmd_switch_radio(struct zyd_rf *, int); -static int zyd_rfmd_set_channel(struct zyd_rf *, uint8_t); -static int zyd_al2230_init(struct zyd_rf *); -static int zyd_al2230_switch_radio(struct zyd_rf *, int); -static int zyd_al2230_set_channel(struct zyd_rf *, uint8_t); -static int zyd_al2230_init_b(struct zyd_rf *); -static int zyd_al7230B_init(struct zyd_rf *); -static int zyd_al7230B_switch_radio(struct zyd_rf *, int); -static int zyd_al7230B_set_channel(struct zyd_rf *, uint8_t); -static int zyd_al2210_init(struct zyd_rf *); -static int zyd_al2210_switch_radio(struct zyd_rf *, int); -static int zyd_al2210_set_channel(struct zyd_rf *, uint8_t); -static int zyd_gct_init(struct zyd_rf *); -static int zyd_gct_switch_radio(struct zyd_rf *, int); -static int zyd_gct_set_channel(struct zyd_rf *, uint8_t); -static int zyd_maxim_init(struct zyd_rf *); -static int zyd_maxim_switch_radio(struct zyd_rf *, int); -static int zyd_maxim_set_channel(struct zyd_rf *, uint8_t); -static int zyd_maxim2_init(struct zyd_rf *); -static int zyd_maxim2_switch_radio(struct zyd_rf *, int); -static int zyd_maxim2_set_channel(struct zyd_rf *, uint8_t); +static int zyd_lock_phy(struct zyd_softc *); +static int zyd_unlock_phy(struct zyd_softc *); static int zyd_rf_attach(struct zyd_softc *, uint8_t); static const char *zyd_rf_name(uint8_t); static int zyd_hw_init(struct zyd_softc *); +static int zyd_read_pod(struct zyd_softc *); static int zyd_read_eeprom(struct zyd_softc *); +static int zyd_get_macaddr(struct zyd_softc *); static int zyd_set_macaddr(struct zyd_softc *, const uint8_t *); static int zyd_set_bssid(struct zyd_softc *, const uint8_t *); static int zyd_switch_radio(struct zyd_softc *, int); -static void zyd_set_led(struct zyd_softc *, int, int); +static int zyd_set_led(struct zyd_softc *, int, int); static void zyd_set_multi(void *); static void zyd_update_mcast(struct ifnet *); static int zyd_set_rxfilter(struct zyd_softc *); @@ -228,13 +244,36 @@ static int zyd_ioctl(struct ifnet *, u_l static void zyd_init_locked(struct zyd_softc *); static void zyd_init(void *); static void zyd_stop(struct zyd_softc *, int); -static int zyd_loadfirmware(struct zyd_softc *, u_char *, size_t); +static int zyd_loadfirmware(struct zyd_softc *); static void zyd_newassoc(struct ieee80211_node *, int); static void zyd_scantask(void *); static void zyd_scan_start(struct ieee80211com *); static void zyd_scan_end(struct ieee80211com *); static void zyd_set_channel(struct ieee80211com *); static void zyd_wakeup(struct zyd_softc *); +static int zyd_rfmd_init(struct zyd_rf *); +static int zyd_rfmd_switch_radio(struct zyd_rf *, int); +static int zyd_rfmd_set_channel(struct zyd_rf *, uint8_t); +static int zyd_al2230_init(struct zyd_rf *); +static int zyd_al2230_switch_radio(struct zyd_rf *, int); +static int zyd_al2230_set_channel(struct zyd_rf *, uint8_t); +static int zyd_al2230_set_channel_b(struct zyd_rf *, uint8_t); +static int zyd_al2230_init_b(struct zyd_rf *); +static int zyd_al7230B_init(struct zyd_rf *); +static int zyd_al7230B_switch_radio(struct zyd_rf *, int); +static int zyd_al7230B_set_channel(struct zyd_rf *, uint8_t); +static int zyd_al2210_init(struct zyd_rf *); +static int zyd_al2210_switch_radio(struct zyd_rf *, int); +static int zyd_al2210_set_channel(struct zyd_rf *, uint8_t); +static int zyd_gct_init(struct zyd_rf *); +static int zyd_gct_switch_radio(struct zyd_rf *, int); +static int zyd_gct_set_channel(struct zyd_rf *, uint8_t); +static int zyd_maxim_init(struct zyd_rf *); +static int zyd_maxim_switch_radio(struct zyd_rf *, int); +static int zyd_maxim_set_channel(struct zyd_rf *, uint8_t); +static int zyd_maxim2_init(struct zyd_rf *); +static int zyd_maxim2_switch_radio(struct zyd_rf *, int); +static int zyd_maxim2_set_channel(struct zyd_rf *, uint8_t); static int zyd_match(device_t dev) @@ -242,68 +281,57 @@ zyd_match(device_t dev) struct usb_attach_arg *uaa = device_get_ivars(dev); if (!uaa->iface) - return UMATCH_NONE; + return (UMATCH_NONE); return (zyd_lookup(uaa->vendor, uaa->product) != NULL) ? - UMATCH_VENDOR_PRODUCT : UMATCH_NONE; -} - -static int -zyd_attachhook(struct zyd_softc *sc) -{ - u_char *firmware; - int len, error; - - if (sc->mac_rev == ZYD_ZD1211) { - firmware = (u_char *)zd1211_firmware; - len = sizeof(zd1211_firmware); - } else { - firmware = (u_char *)zd1211b_firmware; - len = sizeof(zd1211b_firmware); - } - - error = zyd_loadfirmware(sc, firmware, len); - if (error != 0) { - device_printf(sc->sc_dev, - "could not load firmware (error=%d)\n", error); - return error; - } - - sc->sc_flags |= ZYD_FLAG_FWLOADED; - - /* complete the attach process */ - return zyd_complete_attach(sc); + (UMATCH_VENDOR_PRODUCT) : (UMATCH_NONE); } static int zyd_attach(device_t dev) { int error = ENXIO; - struct zyd_softc *sc = device_get_softc(dev); + struct ieee80211com *ic; + struct ifnet *ifp; struct usb_attach_arg *uaa = device_get_ivars(dev); + struct zyd_softc *sc = device_get_softc(dev); usb_device_descriptor_t* ddesc; - struct ifnet *ifp; + uint8_t bands; sc->sc_dev = dev; - - ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); - if (ifp == NULL) { - device_printf(dev, "can not if_alloc()\n"); - return ENXIO; - } - sc->sc_udev = uaa->device; - sc->sc_flags = 0; - sc->mac_rev = zyd_lookup(uaa->vendor, uaa->product)->rev; + sc->sc_macrev = zyd_lookup(uaa->vendor, uaa->product)->rev; +#ifdef ZYD_DEBUG + sc->sc_debug = zyd_debug; +#endif ddesc = usbd_get_device_descriptor(sc->sc_udev); if (UGETW(ddesc->bcdDevice) < 0x4330) { device_printf(dev, "device version mismatch: 0x%x " "(only >= 43.30 supported)\n", UGETW(ddesc->bcdDevice)); - goto bad; + return (ENXIO); + } + + if ((error = zyd_get_macaddr(sc)) != 0) { + device_printf(sc->sc_dev, "could not read EEPROM\n"); + return (ENXIO); } + mtx_init(&sc->sc_txmtx, device_get_nameunit(sc->sc_dev), + MTX_NETWORK_LOCK, MTX_DEF); + usb_init_task(&sc->sc_mcasttask, zyd_set_multi, sc); + usb_init_task(&sc->sc_scantask, zyd_scantask, sc); + usb_init_task(&sc->sc_task, zyd_task, sc); + callout_init(&sc->sc_watchdog_ch, 0); + STAILQ_INIT(&sc->sc_rqh); + + ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); + if (ifp == NULL) { + device_printf(dev, "can not if_alloc()\n"); + error = ENXIO; + goto fail0; + } ifp->if_softc = sc; if_initname(ifp, "zyd", device_get_unit(sc->sc_dev)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | @@ -314,89 +342,18 @@ zyd_attach(device_t dev) IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); IFQ_SET_READY(&ifp->if_snd); - STAILQ_INIT(&sc->sc_rqh); - - error = zyd_attachhook(sc); - if (error != 0) { -bad: - if_free(ifp); - return error; - } - - return 0; -} - -static int -zyd_complete_attach(struct zyd_softc *sc) -{ - struct ifnet *ifp = sc->sc_ifp; - struct ieee80211com *ic = ifp->if_l2com; - usbd_status error; - uint8_t bands; - - mtx_init(&sc->sc_mtx, device_get_nameunit(sc->sc_dev), MTX_NETWORK_LOCK, - MTX_DEF | MTX_RECURSE); - - usb_init_task(&sc->sc_scantask, zyd_scantask, sc); - usb_init_task(&sc->sc_task, zyd_task, sc); - usb_init_task(&sc->sc_mcasttask, zyd_set_multi, sc); - - callout_init(&sc->sc_watchdog_ch, 0); - - error = usbd_set_config_no(sc->sc_udev, ZYD_CONFIG_NO, 1); - if (error != 0) { - device_printf(sc->sc_dev, "setting config no failed\n"); - error = ENXIO; - goto fail; - } - - error = usbd_device2interface_handle(sc->sc_udev, ZYD_IFACE_INDEX, - &sc->sc_iface); - if (error != 0) { - device_printf(sc->sc_dev, "getting interface handle failed\n"); - error = ENXIO; - goto fail; - } - - if ((error = zyd_open_pipes(sc)) != 0) { - device_printf(sc->sc_dev, "could not open pipes\n"); - goto fail; - } - - if ((error = zyd_read_eeprom(sc)) != 0) { - device_printf(sc->sc_dev, "could not read EEPROM\n"); - goto fail; - } - - if ((error = zyd_rf_attach(sc, sc->rf_rev)) != 0) { - device_printf(sc->sc_dev, "could not attach RF, rev 0x%x\n", - sc->rf_rev); - goto fail; - } - - if ((error = zyd_hw_init(sc)) != 0) { - device_printf(sc->sc_dev, "hardware initialization failed\n"); - goto fail; - } - - device_printf(sc->sc_dev, - "HMAC ZD1211%s, FW %02x.%02x, RF %s, PA %x, address %s\n", - (sc->mac_rev == ZYD_ZD1211) ? "": "B", - sc->fw_rev >> 8, sc->fw_rev & 0xff, zyd_rf_name(sc->rf_rev), - sc->pa_rev, ether_sprintf(ic->ic_myaddr)); - - IEEE80211_ADDR_COPY(sc->sc_bssid, ic->ic_myaddr); - + ic = ifp->if_l2com; ic->ic_ifp = ifp; ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ ic->ic_opmode = IEEE80211_M_STA; + IEEE80211_ADDR_COPY(ic->ic_myaddr, sc->sc_bssid); /* set device capabilities */ ic->ic_caps = IEEE80211_C_STA /* station mode */ | IEEE80211_C_MONITOR /* monitor mode */ | IEEE80211_C_SHPREAMBLE /* short preamble supported */ - | IEEE80211_C_SHSLOT /* short slot time supported */ + | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_BGSCAN /* capable of bg scanning */ | IEEE80211_C_WPA /* 802.11i */ ; @@ -420,11 +377,9 @@ zyd_complete_attach(struct zyd_softc *sc bpfattach(ifp, DLT_IEEE802_11_RADIO, sizeof(struct ieee80211_frame) + sizeof(sc->sc_txtap)); - sc->sc_rxtap_len = sizeof(sc->sc_rxtap); sc->sc_rxtap.wr_ihdr.it_len = htole16(sc->sc_rxtap_len); sc->sc_rxtap.wr_ihdr.it_present = htole32(ZYD_RX_RADIOTAP_PRESENT); - sc->sc_txtap_len = sizeof(sc->sc_txtap); sc->sc_txtap.wt_ihdr.it_len = htole16(sc->sc_txtap_len); sc->sc_txtap.wt_ihdr.it_present = htole32(ZYD_TX_RADIOTAP_PRESENT); @@ -434,12 +389,10 @@ zyd_complete_attach(struct zyd_softc *sc usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev); - return error; + return (0); -fail: - mtx_destroy(&sc->sc_mtx); - - return error; +fail0: mtx_destroy(&sc->sc_txmtx); + return (error); } static int @@ -450,31 +403,24 @@ zyd_detach(device_t dev) struct ieee80211com *ic = ifp->if_l2com; if (!device_is_attached(dev)) - return 0; + return (0); - /* protect a race when we have listeners related with the driver. */ - ifp->if_flags &= ~IFF_UP; + /* set a flag to indicate we're detaching. */ + sc->sc_flags |= ZYD_FLAG_DETACHING; zyd_stop(sc, 1); bpfdetach(ifp); ieee80211_ifdetach(ic); - /* set a flag to indicate we're detaching. */ - sc->sc_flags |= ZYD_FLAG_DETACHING; - - usb_rem_task(sc->sc_udev, &sc->sc_scantask); - usb_rem_task(sc->sc_udev, &sc->sc_task); - callout_stop(&sc->sc_watchdog_ch); - zyd_wakeup(sc); zyd_close_pipes(sc); if_free(ifp); - mtx_destroy(&sc->sc_mtx); + mtx_destroy(&sc->sc_txmtx); usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev); - return 0; + return (0); } static struct ieee80211vap * @@ -487,11 +433,11 @@ zyd_vap_create(struct ieee80211com *ic, struct ieee80211vap *vap; if (!TAILQ_EMPTY(&ic->ic_vaps)) /* only one at a time */ - return NULL; + return (NULL); zvp = (struct zyd_vap *) malloc(sizeof(struct zyd_vap), M_80211_VAP, M_NOWAIT | M_ZERO); if (zvp == NULL) - return NULL; + return (NULL); vap = &zvp->vap; /* enable s/w bmiss handling for sta mode */ ieee80211_vap_setup(ic, vap, name, unit, opmode, @@ -507,9 +453,10 @@ zyd_vap_create(struct ieee80211com *ic, 1000 /* 1 sec */); /* complete setup */ - ieee80211_vap_attach(vap, ieee80211_media_change, ieee80211_media_status); + ieee80211_vap_attach(vap, ieee80211_media_change, + ieee80211_media_status); ic->ic_opmode = opmode; - return vap; + return (vap); } static void @@ -532,18 +479,18 @@ zyd_open_pipes(struct zyd_softc *sc) /* interrupt in */ edesc = usbd_get_endpoint_descriptor(sc->sc_iface, 0x83); if (edesc == NULL) - return EINVAL; + return (EINVAL); isize = UGETW(edesc->wMaxPacketSize); if (isize == 0) /* should not happen */ - return EINVAL; + return (EINVAL); - sc->ibuf = malloc(isize, M_USBDEV, M_NOWAIT); - if (sc->ibuf == NULL) - return ENOMEM; + sc->sc_ibuf = malloc(isize, M_USBDEV, M_NOWAIT); + if (sc->sc_ibuf == NULL) + return (ENOMEM); error = usbd_open_pipe_intr(sc->sc_iface, 0x83, USBD_SHORT_XFER_OK, - &sc->zyd_ep[ZYD_ENDPT_IIN], sc, sc->ibuf, isize, zyd_intr, + &sc->sc_ep[ZYD_ENDPT_IIN], sc, sc->sc_ibuf, isize, zyd_intr, USBD_DEFAULT_INTERVAL); if (error != 0) { device_printf(sc->sc_dev, "open rx intr pipe failed: %s\n", @@ -553,7 +500,7 @@ zyd_open_pipes(struct zyd_softc *sc) /* interrupt out (not necessarily an interrupt pipe) */ error = usbd_open_pipe(sc->sc_iface, 0x04, USBD_EXCLUSIVE_USE, - &sc->zyd_ep[ZYD_ENDPT_IOUT]); + &sc->sc_ep[ZYD_ENDPT_IOUT]); if (error != 0) { device_printf(sc->sc_dev, "open tx intr pipe failed: %s\n", usbd_errstr(error)); @@ -562,7 +509,7 @@ zyd_open_pipes(struct zyd_softc *sc) /* bulk in */ error = usbd_open_pipe(sc->sc_iface, 0x82, USBD_EXCLUSIVE_USE, - &sc->zyd_ep[ZYD_ENDPT_BIN]); + &sc->sc_ep[ZYD_ENDPT_BIN]); if (error != 0) { device_printf(sc->sc_dev, "open rx pipe failed: %s\n", usbd_errstr(error)); @@ -571,17 +518,17 @@ zyd_open_pipes(struct zyd_softc *sc) /* bulk out */ error = usbd_open_pipe(sc->sc_iface, 0x01, USBD_EXCLUSIVE_USE, - &sc->zyd_ep[ZYD_ENDPT_BOUT]); + &sc->sc_ep[ZYD_ENDPT_BOUT]); if (error != 0) { device_printf(sc->sc_dev, "open tx pipe failed: %s\n", usbd_errstr(error)); goto fail; } - return 0; + return (0); fail: zyd_close_pipes(sc); - return ENXIO; + return (ENXIO); } static void @@ -590,15 +537,15 @@ zyd_close_pipes(struct zyd_softc *sc) int i; for (i = 0; i < ZYD_ENDPT_CNT; i++) { - if (sc->zyd_ep[i] != NULL) { - usbd_abort_pipe(sc->zyd_ep[i]); - usbd_close_pipe(sc->zyd_ep[i]); - sc->zyd_ep[i] = NULL; + if (sc->sc_ep[i] != NULL) { + usbd_abort_pipe(sc->sc_ep[i]); + usbd_close_pipe(sc->sc_ep[i]); + sc->sc_ep[i] = NULL; } } - if (sc->ibuf != NULL) { - free(sc->ibuf, M_USBDEV); - sc->ibuf = NULL; + if (sc->sc_ibuf != NULL) { + free(sc->sc_ibuf, M_USBDEV); + sc->sc_ibuf = NULL; } } @@ -607,10 +554,10 @@ zyd_alloc_tx_list(struct zyd_softc *sc) { int i, error; - sc->tx_queued = 0; + sc->sc_txqueued = 0; for (i = 0; i < ZYD_TX_LIST_CNT; i++) { - struct zyd_tx_data *data = &sc->tx_data[i]; + struct zyd_tx_data *data = &sc->sc_txdata[i]; data->sc = sc; /* backpointer for callbacks */ @@ -632,10 +579,10 @@ zyd_alloc_tx_list(struct zyd_softc *sc) /* clear Tx descriptor */ bzero(data->buf, sizeof(struct zyd_tx_desc)); } - return 0; + return (0); fail: zyd_free_tx_list(sc); - return error; + return (error); } static void @@ -644,7 +591,7 @@ zyd_free_tx_list(struct zyd_softc *sc) int i; for (i = 0; i < ZYD_TX_LIST_CNT; i++) { - struct zyd_tx_data *data = &sc->tx_data[i]; + struct zyd_tx_data *data = &sc->sc_txdata[i]; if (data->xfer != NULL) { usbd_free_xfer(data->xfer); @@ -663,7 +610,7 @@ zyd_alloc_rx_list(struct zyd_softc *sc) int i, error; for (i = 0; i < ZYD_RX_LIST_CNT; i++) { - struct zyd_rx_data *data = &sc->rx_data[i]; + struct zyd_rx_data *data = &sc->sc_rxdata[i]; data->sc = sc; /* backpointer for callbacks */ @@ -682,10 +629,10 @@ zyd_alloc_rx_list(struct zyd_softc *sc) goto fail; } } - return 0; + return (0); fail: zyd_free_rx_list(sc); - return error; + return (error); } static void @@ -694,7 +641,7 @@ zyd_free_rx_list(struct zyd_softc *sc) int i; for (i = 0; i < ZYD_RX_LIST_CNT; i++) { - struct zyd_rx_data *data = &sc->rx_data[i]; + struct zyd_rx_data *data = &sc->sc_rxdata[i]; if (data->xfer != NULL) { usbd_free_xfer(data->xfer); @@ -711,41 +658,44 @@ zyd_node_alloc(struct ieee80211vap *vap struct zyd_node *zn; zn = malloc(sizeof(struct zyd_node), M_80211_NODE, M_NOWAIT | M_ZERO); - return zn != NULL ? &zn->ni : NULL; + return (zn != NULL) ? (&zn->ni) : (NULL); } static void zyd_task(void *arg) { + int error; struct zyd_softc *sc = arg; struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + struct ieee80211_node *ni = vap->iv_bss; struct zyd_vap *zvp = ZYD_VAP(vap); switch (sc->sc_state) { - case IEEE80211_S_RUN: - { - struct ieee80211_node *ni = vap->iv_bss; - + case IEEE80211_S_AUTH: zyd_set_chan(sc, ic->ic_curchan); + break; + case IEEE80211_S_RUN: + if (vap->iv_opmode == IEEE80211_M_MONITOR) + break; - if (vap->iv_opmode != IEEE80211_M_MONITOR) { - /* turn link LED on */ - zyd_set_led(sc, ZYD_LED1, 1); - - /* make data LED blink upon Tx */ - zyd_write32(sc, sc->fwbase + ZYD_FW_LINK_STATUS, 1); - - IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid); - zyd_set_bssid(sc, sc->sc_bssid); - } + /* turn link LED on */ + error = zyd_set_led(sc, ZYD_LED1, 1); + if (error != 0) + goto fail; + + /* make data LED blink upon Tx */ + zyd_write32_m(sc, sc->sc_fwbase + ZYD_FW_LINK_STATUS, 1); + + IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid); + zyd_set_bssid(sc, sc->sc_bssid); break; - } default: break; } +fail: IEEE80211_LOCK(ic); zvp->newstate(vap, sc->sc_state, sc->sc_arg); if (vap->iv_newstate_cb != NULL) @@ -760,6 +710,10 @@ zyd_newstate(struct ieee80211vap *vap, e struct ieee80211com *ic = vap->iv_ic; struct zyd_softc *sc = ic->ic_ifp->if_softc; + DPRINTF(sc, ZYD_DEBUG_STATE, "%s: %s -> %s\n", __func__, + ieee80211_state_name[vap->iv_state], + ieee80211_state_name[nstate]); + usb_rem_task(sc->sc_udev, &sc->sc_scantask); usb_rem_task(sc->sc_udev, &sc->sc_task); callout_stop(&sc->sc_watchdog_ch); @@ -770,10 +724,10 @@ zyd_newstate(struct ieee80211vap *vap, e if (nstate == IEEE80211_S_INIT) { zvp->newstate(vap, nstate, arg); - return 0; + return (0); } else { usb_add_task(sc->sc_udev, &sc->sc_task, USB_TASKQ_DRIVER); - return EINPROGRESS; + return (EINPROGRESS); } } @@ -783,15 +737,15 @@ zyd_cmd(struct zyd_softc *sc, uint16_t c { usbd_xfer_handle xfer; struct zyd_cmd cmd; - struct rq rq; + struct zyd_rq rq; uint16_t xferflags; usbd_status error; if (sc->sc_flags & ZYD_FLAG_DETACHING) - return ENXIO; + return (ENXIO); if ((xfer = usbd_alloc_xfer(sc->sc_udev)) == NULL) - return ENOMEM; + return (ENOMEM); cmd.code = htole16(code); bcopy(idata, cmd.data, ilen); @@ -806,27 +760,27 @@ zyd_cmd(struct zyd_softc *sc, uint16_t c STAILQ_INSERT_TAIL(&sc->sc_rqh, &rq, rq); } - usbd_setup_xfer(xfer, sc->zyd_ep[ZYD_ENDPT_IOUT], 0, &cmd, + usbd_setup_xfer(xfer, sc->sc_ep[ZYD_ENDPT_IOUT], 0, &cmd, sizeof(uint16_t) + ilen, xferflags, ZYD_INTR_TIMEOUT, NULL); error = usbd_transfer(xfer); if (error != USBD_IN_PROGRESS && error != 0) { device_printf(sc->sc_dev, "could not send command (error=%s)\n", usbd_errstr(error)); (void)usbd_free_xfer(xfer); - return EIO; + return (EIO); } if (!(flags & ZYD_CMD_FLAG_READ)) { (void)usbd_free_xfer(xfer); - return 0; /* write: don't wait for reply */ + return (0); /* write: don't wait for reply */ } /* wait at most one second for command reply */ error = tsleep(odata, PCATCH, "zydcmd", hz); if (error == EWOULDBLOCK) device_printf(sc->sc_dev, "zyd_read sleep timeout\n"); - STAILQ_REMOVE(&sc->sc_rqh, &rq, rq, rq); + STAILQ_REMOVE(&sc->sc_rqh, &rq, zyd_rq, rq); (void)usbd_free_xfer(xfer); - return error; + return (error); } static int @@ -840,7 +794,7 @@ zyd_read16(struct zyd_softc *sc, uint16_ ZYD_CMD_FLAG_READ); if (error == 0) *val = le16toh(tmp.val); - return error; + return (error); } static int @@ -856,7 +810,7 @@ zyd_read32(struct zyd_softc *sc, uint16_ ZYD_CMD_FLAG_READ); if (error == 0) *val = le16toh(tmp[0].val) << 16 | le16toh(tmp[1].val); - return error; + return (error); } static int @@ -887,11 +841,11 @@ static int zyd_rfwrite(struct zyd_softc *sc, uint32_t val) { struct zyd_rf *rf = &sc->sc_rf; - struct zyd_rfwrite req; + struct zyd_rfwrite_cmd req; uint16_t cr203; - int i; + int error, i; - (void)zyd_read16(sc, ZYD_CR203, &cr203); + zyd_read16_m(sc, ZYD_CR203, &cr203); cr203 &= ~(ZYD_RF_IF_LE | ZYD_RF_CLK | ZYD_RF_DATA); req.code = htole16(2); @@ -901,27 +855,47 @@ zyd_rfwrite(struct zyd_softc *sc, uint32 if (val & (1 << (rf->width - 1 - i))) req.bit[i] |= htole16(ZYD_RF_DATA); } - return zyd_cmd(sc, ZYD_CMD_RFCFG, &req, 4 + 2 * rf->width, NULL, 0, 0); + error = zyd_cmd(sc, ZYD_CMD_RFCFG, &req, 4 + 2 * rf->width, NULL, 0, 0); +fail: + return (error); } -static void +static int +zyd_rfwrite_cr(struct zyd_softc *sc, uint32_t val) +{ + int error; + + zyd_write16_m(sc, ZYD_CR244, (val >> 16) & 0xff); + zyd_write16_m(sc, ZYD_CR243, (val >> 8) & 0xff); + zyd_write16_m(sc, ZYD_CR242, (val >> 0) & 0xff); +fail: + return (error); +} + +static int zyd_lock_phy(struct zyd_softc *sc) { + int error; uint32_t tmp; - (void)zyd_read32(sc, ZYD_MAC_MISC, &tmp); + zyd_read32_m(sc, ZYD_MAC_MISC, &tmp); tmp &= ~ZYD_UNLOCK_PHY_REGS; - (void)zyd_write32(sc, ZYD_MAC_MISC, tmp); + zyd_write32_m(sc, ZYD_MAC_MISC, tmp); +fail: + return (error); } -static void +static int zyd_unlock_phy(struct zyd_softc *sc) { + int error; uint32_t tmp; - (void)zyd_read32(sc, ZYD_MAC_MISC, &tmp); + zyd_read32_m(sc, ZYD_MAC_MISC, &tmp); tmp |= ZYD_UNLOCK_PHY_REGS; - (void)zyd_write32(sc, ZYD_MAC_MISC, tmp); + zyd_write32_m(sc, ZYD_MAC_MISC, tmp); +fail: + return (error); } /* @@ -938,43 +912,49 @@ zyd_rfmd_init(struct zyd_rf *rf) /* init RF-dependent PHY registers */ for (i = 0; i < N(phyini); i++) { - error = zyd_write16(sc, phyini[i].reg, phyini[i].val); - if (error != 0) - return error; + zyd_write16_m(sc, phyini[i].reg, phyini[i].val); } /* init RFMD radio */ for (i = 0; i < N(rfini); i++) { if ((error = zyd_rfwrite(sc, rfini[i])) != 0) - return error; + return (error); } - return 0; +fail: + return (error); #undef N } static int zyd_rfmd_switch_radio(struct zyd_rf *rf, int on) { + int error; struct zyd_softc *sc = rf->rf_sc; - (void)zyd_write16(sc, ZYD_CR10, on ? 0x89 : 0x15); - (void)zyd_write16(sc, ZYD_CR11, on ? 0x00 : 0x81); - - return 0; + zyd_write16_m(sc, ZYD_CR10, on ? 0x89 : 0x15); + zyd_write16_m(sc, ZYD_CR11, on ? 0x00 : 0x81); +fail: + return (error); } static int zyd_rfmd_set_channel(struct zyd_rf *rf, uint8_t chan) { + int error; struct zyd_softc *sc = rf->rf_sc; static const struct { uint32_t r1, r2; } rfprog[] = ZYD_RFMD_CHANTABLE; - (void)zyd_rfwrite(sc, rfprog[chan - 1].r1); - (void)zyd_rfwrite(sc, rfprog[chan - 1].r2); + error = zyd_rfwrite(sc, rfprog[chan - 1].r1); + if (error != 0) + goto fail; + error = zyd_rfwrite(sc, rfprog[chan - 1].r2); + if (error != 0) + goto fail; - return 0; +fail: + return (error); } /* @@ -986,22 +966,75 @@ zyd_al2230_init(struct zyd_rf *rf) #define N(a) (sizeof(a) / sizeof((a)[0])) struct zyd_softc *sc = rf->rf_sc; static const struct zyd_phy_pair phyini[] = ZYD_AL2230_PHY; - static const uint32_t rfini[] = ZYD_AL2230_RF; + static const struct zyd_phy_pair phy2230s[] = ZYD_AL2230S_PHY_INIT; + static const struct zyd_phy_pair phypll[] = { + { ZYD_CR251, 0x2f }, { ZYD_CR251, 0x3f }, + { ZYD_CR138, 0x28 }, { ZYD_CR203, 0x06 } + }; + static const uint32_t rfini1[] = ZYD_AL2230_RF_PART1; + static const uint32_t rfini2[] = ZYD_AL2230_RF_PART2; + static const uint32_t rfini3[] = ZYD_AL2230_RF_PART3; int i, error; /* init RF-dependent PHY registers */ - for (i = 0; i < N(phyini); i++) { - error = zyd_write16(sc, phyini[i].reg, phyini[i].val); - if (error != 0) - return error; + for (i = 0; i < N(phyini); i++) + zyd_write16_m(sc, phyini[i].reg, phyini[i].val); + + if (sc->sc_rfrev == ZYD_RF_AL2230S || sc->sc_al2230s != 0) { + for (i = 0; i < N(phy2230s); i++) + zyd_write16_m(sc, phy2230s[i].reg, phy2230s[i].val); } /* init AL2230 radio */ - for (i = 0; i < N(rfini); i++) { - if ((error = zyd_rfwrite(sc, rfini[i])) != 0) - return error; + for (i = 0; i < N(rfini1); i++) { + error = zyd_rfwrite(sc, rfini1[i]); + if (error != 0) + goto fail; + } + + if (sc->sc_rfrev == ZYD_RF_AL2230S || sc->sc_al2230s != 0) + error = zyd_rfwrite(sc, 0x000824); + else + error = zyd_rfwrite(sc, 0x0005a4); + if (error != 0) + goto fail; + + for (i = 0; i < N(rfini2); i++) { + error = zyd_rfwrite(sc, rfini2[i]); + if (error != 0) + goto fail; + } + + for (i = 0; i < N(phypll); i++) + zyd_write16_m(sc, phypll[i].reg, phypll[i].val); + + for (i = 0; i < N(rfini3); i++) { + error = zyd_rfwrite(sc, rfini3[i]); + if (error != 0) + goto fail; } - return 0; +fail: + return (error); +#undef N +} + +static int +zyd_al2230_fini(struct zyd_rf *rf) +{ +#define N(a) (sizeof(a) / sizeof((a)[0])) + int error, i; + struct zyd_softc *sc = rf->rf_sc; + static const struct zyd_phy_pair phy[] = ZYD_AL2230_PHY_FINI_PART1; + + for (i = 0; i < N(phy); i++) + zyd_write16_m(sc, phy[i].reg, phy[i].val); + + if (sc->sc_newphy != 0) + zyd_write16_m(sc, ZYD_CR9, 0xe1); + + zyd_write16_m(sc, ZYD_CR203, 0x6); +fail: + return (error); #undef N } @@ -1010,23 +1043,67 @@ zyd_al2230_init_b(struct zyd_rf *rf) { #define N(a) (sizeof(a) / sizeof((a)[0])) struct zyd_softc *sc = rf->rf_sc; + static const struct zyd_phy_pair phy1[] = ZYD_AL2230_PHY_PART1; + static const struct zyd_phy_pair phy2[] = ZYD_AL2230_PHY_PART2; + static const struct zyd_phy_pair phy3[] = ZYD_AL2230_PHY_PART3; + static const struct zyd_phy_pair phy2230s[] = ZYD_AL2230S_PHY_INIT; static const struct zyd_phy_pair phyini[] = ZYD_AL2230_PHY_B; - static const uint32_t rfini[] = ZYD_AL2230_RF_B; + static const uint32_t rfini_part1[] = ZYD_AL2230_RF_B_PART1; + static const uint32_t rfini_part2[] = ZYD_AL2230_RF_B_PART2; + static const uint32_t rfini_part3[] = ZYD_AL2230_RF_B_PART3; + static const uint32_t zyd_al2230_chtable[][3] = ZYD_AL2230_CHANTABLE; int i, error; + for (i = 0; i < N(phy1); i++) + zyd_write16_m(sc, phy1[i].reg, phy1[i].val); + /* init RF-dependent PHY registers */ - for (i = 0; i < N(phyini); i++) { - error = zyd_write16(sc, phyini[i].reg, phyini[i].val); + for (i = 0; i < N(phyini); i++) + zyd_write16_m(sc, phyini[i].reg, phyini[i].val); + + if (sc->sc_rfrev == ZYD_RF_AL2230S || sc->sc_al2230s != 0) + zyd_write16_m(sc, phy2230s[i].reg, phy2230s[i].val); + + for (i = 0; i < 3; i++) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 02:19:14 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D3711065670; Tue, 25 Nov 2008 02:19:14 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE6048FC16; Tue, 25 Nov 2008 02:19:13 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP2JDJ6005167; Tue, 25 Nov 2008 02:19:13 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP2JDJY005166; Tue, 25 Nov 2008 02:19:13 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <200811250219.mAP2JDJY005166@svn.freebsd.org> From: Hiroki Sato Date: Tue, 25 Nov 2008 02:19:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185279 - releng/6.4/release/doc/en_US.ISO8859-1/relnotes/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 02:19:14 -0000 Author: hrs Date: Tue Nov 25 02:19:13 2008 New Revision: 185279 URL: http://svn.freebsd.org/changeset/base/185279 Log: - Document SA-08:11. - Add missing . - Add more comments about rpc.lockd(8) kernel support. Approved by: re (implicit) Modified: releng/6.4/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml Modified: releng/6.4/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml ============================================================================== --- releng/6.4/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml Tue Nov 25 02:19:02 2008 (r185278) +++ releng/6.4/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml Tue Nov 25 02:19:13 2008 (r185279) @@ -160,13 +160,19 @@ SA-08:09.icmp6 3 September 2008 - Remote kernel panics on IPv6 connections + Remote kernel panics on IPv6 connections SA-08:10.nd6 1 October 2008 - IPv6 Neighbor Discovery Protocol routing vulnerability + IPv6 Neighbor Discovery Protocol routing vulnerability + + + SA-08:11.arc4random + 24 November 2008 + &man.arc4random.9; predictable sequence vulnerability @@ -195,7 +201,8 @@ obtaining locks (allowing multiple clients to use file locking to safely share data). Also, a new kernel option options NFSLOCKD has been added and enabled - by default. + by default. If the kernel support is enabled, &man.rpc.lockd.8; + automatically detects and uses the functionality. From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 02:49:34 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90DBB1065673; Tue, 25 Nov 2008 02:49:34 +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 7D22D8FC12; Tue, 25 Nov 2008 02:49:34 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP2nYMH005860; Tue, 25 Nov 2008 02:49:34 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP2nY57005859; Tue, 25 Nov 2008 02:49:34 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811250249.mAP2nY57005859@svn.freebsd.org> From: Ken Smith Date: Tue, 25 Nov 2008 02:49:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185280 - releng/6.4/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 02:49:34 -0000 Author: kensmith Date: Tue Nov 25 02:49:34 2008 New Revision: 185280 URL: http://svn.freebsd.org/changeset/base/185280 Log: Calling it -RELEASE tiny bit premature, looks like there might be one more loose end. Holding off until at least tomorrow to collect a bit more information. Approved by: re (implicit) Modified: releng/6.4/sys/conf/newvers.sh Modified: releng/6.4/sys/conf/newvers.sh ============================================================================== --- releng/6.4/sys/conf/newvers.sh Tue Nov 25 02:19:13 2008 (r185279) +++ releng/6.4/sys/conf/newvers.sh Tue Nov 25 02:49:34 2008 (r185280) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="6.4" -BRANCH="RELEASE" +BRANCH="RC2" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 02:59:29 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFDB1106564A; Tue, 25 Nov 2008 02:59:29 +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 92AFC8FC08; Tue, 25 Nov 2008 02:59:29 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP2xTYd006099; Tue, 25 Nov 2008 02:59:29 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP2xTTd006098; Tue, 25 Nov 2008 02:59:29 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811250259.mAP2xTTd006098@svn.freebsd.org> From: Ken Smith Date: Tue, 25 Nov 2008 02:59:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185281 - releng/7.1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 02:59:29 -0000 Author: kensmith Date: Tue Nov 25 02:59:29 2008 New Revision: 185281 URL: http://svn.freebsd.org/changeset/base/185281 Log: Create releng/7.1 in preparation for moving into RC phase of 7.1 release cycle. Approved by: re (implicit) Added: releng/7.1/ - copied from r185280, stable/7/ From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 03:04:52 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C312106564A; Tue, 25 Nov 2008 03:04:52 +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 5854B8FC21; Tue, 25 Nov 2008 03:04:52 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP34q0s006412; Tue, 25 Nov 2008 03:04:52 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP34qT3006411; Tue, 25 Nov 2008 03:04:52 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811250304.mAP34qT3006411@svn.freebsd.org> From: Ken Smith Date: Tue, 25 Nov 2008 03:04:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185282 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 03:04:52 -0000 Author: kensmith Date: Tue Nov 25 03:04:51 2008 New Revision: 185282 URL: http://svn.freebsd.org/changeset/base/185282 Log: Turn on approval requirement for releng/7.1. Approved by: core (implicit) Modified: svnadmin/conf/approvers Modified: svnadmin/conf/approvers ============================================================================== --- svnadmin/conf/approvers Tue Nov 25 02:59:29 2008 (r185281) +++ svnadmin/conf/approvers Tue Nov 25 03:04:51 2008 (r185282) @@ -19,7 +19,7 @@ #^head/ re ^stable/7/ re ^stable/6/ re -#^releng/7.1/ re +^releng/7.1/ re ^releng/7.0/ (security-officer|so) ^releng/6.4/ re ^releng/6.[0-3]/ (security-officer|so) From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 03:18:35 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89C171065675; Tue, 25 Nov 2008 03:18:35 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73EC58FC12; Tue, 25 Nov 2008 03:18:35 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP3IZlD006894; Tue, 25 Nov 2008 03:18:35 GMT (envelope-from daichi@svn.freebsd.org) Received: (from daichi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP3IZ11006891; Tue, 25 Nov 2008 03:18:35 GMT (envelope-from daichi@svn.freebsd.org) Message-Id: <200811250318.mAP3IZ11006891@svn.freebsd.org> From: Daichi GOTO Date: Tue, 25 Nov 2008 03:18:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185283 - head/sys/fs/unionfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 03:18:35 -0000 Author: daichi Date: Tue Nov 25 03:18:35 2008 New Revision: 185283 URL: http://svn.freebsd.org/changeset/base/185283 Log: Fixes Unionfs socket issue reported as kern/118346. PR: 118346 Submitted by: Masanori OZAWA Discussed at: devsummit Strassburg, EuroBSDCon2008 Discussed with: rwatson, gnn, hrs MFC after: 2 week Modified: head/sys/fs/unionfs/union.h head/sys/fs/unionfs/union_subr.c head/sys/fs/unionfs/union_vnops.c Modified: head/sys/fs/unionfs/union.h ============================================================================== --- head/sys/fs/unionfs/union.h Tue Nov 25 03:04:51 2008 (r185282) +++ head/sys/fs/unionfs/union.h Tue Nov 25 03:18:35 2008 (r185283) @@ -117,6 +117,7 @@ void unionfs_create_uppervattr_core(stru int unionfs_create_uppervattr(struct unionfs_mount *ump, struct vnode *lvp, struct vattr *uva, struct ucred *cred, struct thread *td); int unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *duvp, struct unionfs_node *unp, struct componentname *cnp, struct thread *td); int unionfs_mkwhiteout(struct vnode *dvp, struct componentname *cnp, struct thread *td, char *path); +int unionfs_relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct componentname *cn, struct thread *td, char *path, int pathlen, u_long nameiop); int unionfs_relookup_for_create(struct vnode *dvp, struct componentname *cnp, struct thread *td); int unionfs_relookup_for_delete(struct vnode *dvp, struct componentname *cnp, struct thread *td); int unionfs_relookup_for_rename(struct vnode *dvp, struct componentname *cnp, struct thread *td); Modified: head/sys/fs/unionfs/union_subr.c ============================================================================== --- head/sys/fs/unionfs/union_subr.c Tue Nov 25 03:04:51 2008 (r185282) +++ head/sys/fs/unionfs/union_subr.c Tue Nov 25 03:18:35 2008 (r185283) @@ -113,10 +113,10 @@ unionfs_get_cached_vnode(struct vnode *u struct unionfs_node *unp; struct vnode *vp; - KASSERT((uvp == NULLVP || uvp->v_type == VDIR || uvp->v_type == VSOCK), - ("unionfs_get_cached_vnode: v_type != VDIR/VSOCK")); - KASSERT((lvp == NULLVP || lvp->v_type == VDIR || lvp->v_type == VSOCK), - ("unionfs_get_cached_vnode: v_type != VDIR/VSOCK")); + KASSERT((uvp == NULLVP || uvp->v_type == VDIR), + ("unionfs_get_cached_vnode: v_type != VDIR")); + KASSERT((lvp == NULLVP || lvp->v_type == VDIR), + ("unionfs_get_cached_vnode: v_type != VDIR")); VI_LOCK(dvp); hd = unionfs_get_hashhead(dvp, path); @@ -150,12 +150,10 @@ unionfs_ins_cached_vnode(struct unionfs_ struct unionfs_node *unp; struct vnode *vp; - KASSERT((uncp->un_uppervp==NULLVP || uncp->un_uppervp->v_type==VDIR || - uncp->un_uppervp->v_type==VSOCK), - ("unionfs_ins_cached_vnode: v_type != VDIR/VSOCK")); - KASSERT((uncp->un_lowervp==NULLVP || uncp->un_lowervp->v_type==VDIR || - uncp->un_lowervp->v_type==VSOCK), - ("unionfs_ins_cached_vnode: v_type != VDIR/VSOCK")); + KASSERT((uncp->un_uppervp==NULLVP || uncp->un_uppervp->v_type==VDIR), + ("unionfs_ins_cached_vnode: v_type != VDIR")); + KASSERT((uncp->un_lowervp==NULLVP || uncp->un_lowervp->v_type==VDIR), + ("unionfs_ins_cached_vnode: v_type != VDIR")); VI_LOCK(dvp); hd = unionfs_get_hashhead(dvp, path); @@ -236,7 +234,7 @@ unionfs_nodeget(struct mount *mp, struct path = NULL; /* check the cache */ - if (path != NULL && dvp != NULLVP && (vt == VDIR || vt == VSOCK)) { + if (path != NULL && dvp != NULLVP && vt == VDIR) { vp = unionfs_get_cached_vnode(uppervp, lowervp, dvp, path); if (vp != NULLVP) { vref(vp); @@ -277,20 +275,9 @@ unionfs_nodeget(struct mount *mp, struct if (lowervp != NULLVP) vref(lowervp); - switch (vt) { - case VDIR: + if (vt == VDIR) unp->un_hashtbl = hashinit(NUNIONFSNODECACHE, M_UNIONFSHASH, &(unp->un_hashmask)); - break; - case VSOCK: - if (uppervp != NULLVP) - vp->v_socket = uppervp->v_socket; - else - vp->v_socket = lowervp->v_socket; - break; - default: - break; - } unp->un_vnode = vp; unp->un_uppervp = uppervp; @@ -314,7 +301,7 @@ unionfs_nodeget(struct mount *mp, struct (lowervp != NULLVP && ump->um_lowervp == lowervp)) vp->v_vflag |= VV_ROOT; - if (path != NULL && dvp != NULLVP && (vt == VDIR || vt == VSOCK)) + if (path != NULL && dvp != NULLVP && vt == VDIR) *vpp = unionfs_ins_cached_vnode(unp, dvp, path); if ((*vpp) != NULLVP) { if (dvp != NULLVP) @@ -540,7 +527,7 @@ unionfs_create_uppervattr(struct unionfs * locked, referenced vnode. If *vpp == dvp then remember that only one * LK_EXCLUSIVE lock is held. */ -static int +int unionfs_relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct componentname *cn, struct thread *td, char *path, int pathlen, u_long nameiop) @@ -748,8 +735,7 @@ unionfs_node_update(struct unionfs_node /* * cache update */ - if (unp->un_path != NULL && dvp != NULLVP && - (vp->v_type == VDIR || vp->v_type == VSOCK)) { + if (unp->un_path != NULL && dvp != NULLVP && vp->v_type == VDIR) { static struct unionfs_node_hashhead *hd; VI_LOCK(dvp); Modified: head/sys/fs/unionfs/union_vnops.c ============================================================================== --- head/sys/fs/unionfs/union_vnops.c Tue Nov 25 03:04:51 2008 (r185282) +++ head/sys/fs/unionfs/union_vnops.c Tue Nov 25 03:18:35 2008 (r185283) @@ -71,6 +71,10 @@ #define UNIONFS_INTERNAL_DEBUG(msg, args...) #endif +#define KASSERT_UNIONFS_VNODE(vp) \ + KASSERT(((vp)->v_op == &unionfs_vnodeops), \ + ("unionfs: it is not unionfs-vnode")) + /* lockmgr lock <-> reverse table */ struct lk_lr_table { int lock; @@ -307,8 +311,27 @@ unionfs_lookup(struct vop_cachedlookup_a error = lerror; if (error != 0) goto unionfs_lookup_out; - error = unionfs_nodeget(dvp->v_mount, uvp, lvp, dvp, &vp, - cnp, td); + /* + * get socket vnode. + */ + if (uvp != NULLVP && uvp->v_type == VSOCK) { + vp = uvp; + vref(vp); + if (cnp->cn_lkflags & LK_TYPE_MASK) + vn_lock(vp, cnp->cn_lkflags | LK_RETRY); + } + else if (lvp != NULLVP && lvp->v_type == VSOCK) { + vp = lvp; + vref(vp); + if (cnp->cn_lkflags & LK_TYPE_MASK) + vn_lock(vp, cnp->cn_lkflags | LK_RETRY); + } + /* + * get unionfs vnode. + */ + else + error = unionfs_nodeget(dvp->v_mount, uvp, lvp, + dvp, &vp, cnp, td); if (error != 0) { UNIONFSDEBUG("unionfs_lookup: Unable to create unionfs vnode."); goto unionfs_lookup_out; @@ -320,7 +343,7 @@ unionfs_lookup(struct vop_cachedlookup_a *(ap->a_vpp) = vp; - if (cnflags & MAKEENTRY) + if ((cnflags & MAKEENTRY) && vp->v_type != VSOCK) cache_enter(dvp, vp, cnp); unionfs_lookup_out: @@ -348,13 +371,21 @@ unionfs_create(struct vop_create_args *a UNIONFS_INTERNAL_DEBUG("unionfs_create: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_dvp); + dunp = VTOUNIONFS(ap->a_dvp); cnp = ap->a_cnp; udvp = dunp->un_uppervp; error = EROFS; if (udvp != NULLVP) { - if ((error = VOP_CREATE(udvp, &vp, cnp, ap->a_vap)) == 0) { + error = VOP_CREATE(udvp, &vp, cnp, ap->a_vap); + if (error != 0) + goto unionfs_create_abort; + + if (vp->v_type == VSOCK) + *(ap->a_vpp) = vp; + else { VOP_UNLOCK(vp, 0); error = unionfs_nodeget(ap->a_dvp->v_mount, vp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, curthread); @@ -362,6 +393,7 @@ unionfs_create(struct vop_create_args *a } } +unionfs_create_abort: UNIONFS_INTERNAL_DEBUG("unionfs_create: leave (%d)\n", error); return (error); @@ -377,6 +409,8 @@ unionfs_whiteout(struct vop_whiteout_arg UNIONFS_INTERNAL_DEBUG("unionfs_whiteout: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_dvp); + dunp = VTOUNIONFS(ap->a_dvp); cnp = ap->a_cnp; udvp = dunp->un_uppervp; @@ -411,13 +445,21 @@ unionfs_mknod(struct vop_mknod_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_mknod: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_dvp); + dunp = VTOUNIONFS(ap->a_dvp); cnp = ap->a_cnp; udvp = dunp->un_uppervp; error = EROFS; if (udvp != NULLVP) { - if ((error = VOP_MKNOD(udvp, &vp, cnp, ap->a_vap)) == 0) { + error = VOP_MKNOD(udvp, &vp, cnp, ap->a_vap); + if (error != 0) + goto unionfs_mknod_abort; + + if (vp->v_type == VSOCK) + *(ap->a_vpp) = vp; + else { VOP_UNLOCK(vp, 0); error = unionfs_nodeget(ap->a_dvp->v_mount, vp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, curthread); @@ -425,6 +467,7 @@ unionfs_mknod(struct vop_mknod_args *ap) } } +unionfs_mknod_abort: UNIONFS_INTERNAL_DEBUG("unionfs_mknod: leave (%d)\n", error); return (error); @@ -444,6 +487,8 @@ unionfs_open(struct vop_open_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_open: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = 0; unp = VTOUNIONFS(ap->a_vp); uvp = unp->un_uppervp; @@ -523,6 +568,8 @@ unionfs_close(struct vop_close_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_close: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + locked = 0; unp = VTOUNIONFS(ap->a_vp); cred = ap->a_cred; @@ -650,6 +697,8 @@ unionfs_access(struct vop_access_args *a UNIONFS_INTERNAL_DEBUG("unionfs_access: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount); unp = VTOUNIONFS(ap->a_vp); uvp = unp->un_uppervp; @@ -727,6 +776,8 @@ unionfs_getattr(struct vop_getattr_args UNIONFS_INTERNAL_DEBUG("unionfs_getattr: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount); uvp = unp->un_uppervp; @@ -777,6 +828,8 @@ unionfs_setattr(struct vop_setattr_args UNIONFS_INTERNAL_DEBUG("unionfs_setattr: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = EROFS; unp = VTOUNIONFS(ap->a_vp); uvp = unp->un_uppervp; @@ -815,6 +868,8 @@ unionfs_read(struct vop_read_args *ap) /* UNIONFS_INTERNAL_DEBUG("unionfs_read: enter\n"); */ + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); tvp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -834,6 +889,8 @@ unionfs_write(struct vop_write_args *ap) /* UNIONFS_INTERNAL_DEBUG("unionfs_write: enter\n"); */ + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); tvp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -853,6 +910,8 @@ unionfs_lease(struct vop_lease_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_lease: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -873,6 +932,8 @@ unionfs_ioctl(struct vop_ioctl_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_ioctl: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY); unp = VTOUNIONFS(ap->a_vp); unionfs_get_node_status(unp, ap->a_td, &unsp); @@ -898,6 +959,8 @@ unionfs_poll(struct vop_poll_args *ap) struct unionfs_node_status *unsp; struct vnode *ovp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY); unp = VTOUNIONFS(ap->a_vp); unionfs_get_node_status(unp, ap->a_td, &unsp); @@ -918,6 +981,8 @@ unionfs_fsync(struct vop_fsync_args *ap) struct unionfs_node_status *unsp; struct vnode *ovp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); unionfs_get_node_status(unp, ap->a_td, &unsp); ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp); @@ -933,36 +998,81 @@ static int unionfs_remove(struct vop_remove_args *ap) { int error; + char *path; struct unionfs_node *dunp; struct unionfs_node *unp; struct unionfs_mount *ump; struct vnode *udvp; struct vnode *uvp; struct vnode *lvp; + struct vnode *vp; struct componentname *cnp; + struct componentname cn; struct thread *td; UNIONFS_INTERNAL_DEBUG("unionfs_remove: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_dvp); + error = 0; dunp = VTOUNIONFS(ap->a_dvp); - unp = VTOUNIONFS(ap->a_vp); udvp = dunp->un_uppervp; - uvp = unp->un_uppervp; - lvp = unp->un_lowervp; cnp = ap->a_cnp; td = curthread; + if (ap->a_vp->v_op != &unionfs_vnodeops) { + if (ap->a_vp->v_type != VSOCK) + return (EINVAL); + ump = NULL; + vp = uvp = lvp = NULLVP; + /* search vnode */ + VOP_UNLOCK(ap->a_vp, 0); + error = unionfs_relookup(udvp, &vp, cnp, &cn, td, + cnp->cn_nameptr, strlen(cnp->cn_nameptr), DELETE); + if (error != 0 && error != ENOENT) { + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY); + return (error); + } + + if (error == 0 && vp == ap->a_vp) { + /* target vnode in upper */ + uvp = vp; + vrele(vp); + path = NULL; + } else { + /* target vnode in lower */ + if (vp != NULLVP) { + if (udvp == vp) + vrele(vp); + else + vput(vp); + } + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY); + lvp = ap->a_vp; + path = ap->a_cnp->cn_nameptr; + } + } else { + ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount); + unp = VTOUNIONFS(ap->a_vp); + uvp = unp->un_uppervp; + lvp = unp->un_lowervp; + path = unp->un_path; + } + if (udvp == NULLVP) return (EROFS); if (uvp != NULLVP) { - ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount); - if (ump->um_whitemode == UNIONFS_WHITE_ALWAYS || lvp != NULLVP) + /* + * XXX: if the vnode type is VSOCK, it will create whiteout + * after remove. + */ + if (ump == NULL || ump->um_whitemode == UNIONFS_WHITE_ALWAYS || + lvp != NULLVP) cnp->cn_flags |= DOWHITEOUT; error = VOP_REMOVE(udvp, uvp, cnp); } else if (lvp != NULLVP) - error = unionfs_mkwhiteout(udvp, cnp, td, unp->un_path); + error = unionfs_mkwhiteout(udvp, cnp, td, path); UNIONFS_INTERNAL_DEBUG("unionfs_remove: leave (%d)\n", error); @@ -983,6 +1093,9 @@ unionfs_link(struct vop_link_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_link: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_tdvp); + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = 0; needrelookup = 0; dunp = VTOUNIONFS(ap->a_tdvp); @@ -1073,7 +1186,10 @@ unionfs_rename(struct vop_rename_args *a /* check for cross device rename */ if (fvp->v_mount != tdvp->v_mount || (tvp != NULLVP && fvp->v_mount != tvp->v_mount)) { - error = EXDEV; + if (fvp->v_op != &unionfs_vnodeops) + error = ENODEV; + else + error = EXDEV; goto unionfs_rename_abort; } @@ -1085,6 +1201,12 @@ unionfs_rename(struct vop_rename_args *a * from/to vnode is unionfs node. */ + KASSERT_UNIONFS_VNODE(fdvp); + KASSERT_UNIONFS_VNODE(fvp); + KASSERT_UNIONFS_VNODE(tdvp); + if (tvp != NULLVP) + KASSERT_UNIONFS_VNODE(tvp); + unp = VTOUNIONFS(fdvp); #ifdef UNIONFS_IDBG_RENAME UNIONFS_INTERNAL_DEBUG("fdvp=%p, ufdvp=%p, lfdvp=%p\n", fdvp, unp->un_uppervp, unp->un_lowervp); @@ -1254,6 +1376,8 @@ unionfs_mkdir(struct vop_mkdir_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_mkdir: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_dvp); + error = EROFS; dunp = VTOUNIONFS(ap->a_dvp); cnp = ap->a_cnp; @@ -1301,6 +1425,9 @@ unionfs_rmdir(struct vop_rmdir_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_rmdir: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_dvp); + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = 0; dunp = VTOUNIONFS(ap->a_dvp); unp = VTOUNIONFS(ap->a_vp); @@ -1353,6 +1480,8 @@ unionfs_symlink(struct vop_symlink_args UNIONFS_INTERNAL_DEBUG("unionfs_symlink: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_dvp); + error = EROFS; dunp = VTOUNIONFS(ap->a_dvp); cnp = ap->a_cnp; @@ -1396,6 +1525,8 @@ unionfs_readdir(struct vop_readdir_args UNIONFS_INTERNAL_DEBUG("unionfs_readdir: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = 0; eofflag = 0; locked = 0; @@ -1543,6 +1674,8 @@ unionfs_readlink(struct vop_readlink_arg UNIONFS_INTERNAL_DEBUG("unionfs_readlink: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -1568,6 +1701,8 @@ unionfs_getwritemount(struct vop_getwrit if (vp == NULLVP || (vp->v_mount->mnt_flag & MNT_RDONLY)) return (EACCES); + KASSERT_UNIONFS_VNODE(vp); + uvp = UNIONFSVPTOUPPERVP(vp); if (uvp == NULLVP && VREG == vp->v_type) uvp = UNIONFSVPTOUPPERVP(VTOUNIONFS(vp)->un_dvp); @@ -1661,6 +1796,8 @@ unionfs_lock(struct vop_lock1_args *ap) struct vnode *uvp; struct vnode *lvp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = 0; uhold = 0; flags = ap->a_flags; @@ -1781,6 +1918,8 @@ unionfs_unlock(struct vop_unlock_args *a struct vnode *uvp; struct unionfs_node *unp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = 0; mtxlkflag = 0; uhold = 0; @@ -1849,6 +1988,8 @@ unionfs_pathconf(struct vop_pathconf_arg struct unionfs_node *unp; struct vnode *vp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -1867,6 +2008,8 @@ unionfs_advlock(struct vop_advlock_args UNIONFS_INTERNAL_DEBUG("unionfs_advlock: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + vp = ap->a_vp; td = curthread; @@ -1917,6 +2060,8 @@ unionfs_strategy(struct vop_strategy_arg struct unionfs_node *unp; struct vnode *vp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -1938,6 +2083,8 @@ unionfs_getacl(struct vop_getacl_args *a struct unionfs_node *unp; struct vnode *vp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -1961,6 +2108,8 @@ unionfs_setacl(struct vop_setacl_args *a UNIONFS_INTERNAL_DEBUG("unionfs_setacl: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = EROFS; unp = VTOUNIONFS(ap->a_vp); uvp = unp->un_uppervp; @@ -1993,6 +2142,8 @@ unionfs_aclcheck(struct vop_aclcheck_arg UNIONFS_INTERNAL_DEBUG("unionfs_aclcheck: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -2011,6 +2162,8 @@ unionfs_openextattr(struct vop_openextat struct vnode *vp; struct vnode *tvp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + vp = ap->a_vp; unp = VTOUNIONFS(vp); tvp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -2041,6 +2194,8 @@ unionfs_closeextattr(struct vop_closeext struct vnode *vp; struct vnode *tvp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + vp = ap->a_vp; unp = VTOUNIONFS(vp); tvp = NULLVP; @@ -2073,6 +2228,8 @@ unionfs_getextattr(struct vop_getextattr struct unionfs_node *unp; struct vnode *vp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = NULLVP; @@ -2099,6 +2256,8 @@ unionfs_setextattr(struct vop_setextattr struct ucred *cred; struct thread *td; + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = EROFS; unp = VTOUNIONFS(ap->a_vp); uvp = unp->un_uppervp; @@ -2158,6 +2317,8 @@ unionfs_listextattr(struct vop_listextat struct unionfs_node *unp; struct vnode *vp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = NULLVP; @@ -2184,6 +2345,8 @@ unionfs_deleteextattr(struct vop_deletee struct ucred *cred; struct thread *td; + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = EROFS; unp = VTOUNIONFS(ap->a_vp); uvp = unp->un_uppervp; @@ -2248,6 +2411,8 @@ unionfs_setlabel(struct vop_setlabel_arg UNIONFS_INTERNAL_DEBUG("unionfs_setlabel: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = EROFS; unp = VTOUNIONFS(ap->a_vp); uvp = unp->un_uppervp; From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 03:49:41 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E7CE1065670; Tue, 25 Nov 2008 03:49:41 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88BEF8FC08; Tue, 25 Nov 2008 03:49:41 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP3nf28007573; Tue, 25 Nov 2008 03:49:41 GMT (envelope-from daichi@svn.freebsd.org) Received: (from daichi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP3nfFX007572; Tue, 25 Nov 2008 03:49:41 GMT (envelope-from daichi@svn.freebsd.org) Message-Id: <200811250349.mAP3nfFX007572@svn.freebsd.org> From: Daichi GOTO Date: Tue, 25 Nov 2008 03:49:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185284 - head/sys/fs/unionfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 03:49:41 -0000 Author: daichi Date: Tue Nov 25 03:49:41 2008 New Revision: 185284 URL: http://svn.freebsd.org/changeset/base/185284 Log: Simplify mode_t check treatment (suggested by trasz). By semantical view, trasz's code is better than prior one. Submitted by: trasz Reviewed by: Masanori OZAWA Modified: head/sys/fs/unionfs/union_vfsops.c Modified: head/sys/fs/unionfs/union_vfsops.c ============================================================================== --- head/sys/fs/unionfs/union_vfsops.c Tue Nov 25 03:18:35 2008 (r185283) +++ head/sys/fs/unionfs/union_vfsops.c Tue Nov 25 03:49:41 2008 (r185284) @@ -67,43 +67,6 @@ static vfs_extattrctl_t unionfs_extattrc static struct vfsops unionfs_vfsops; /* - * Exchange from userland file mode to vmode. - */ -static u_short -mode2vmode(mode_t mode) -{ - u_short ret; - - ret = 0; - - /* other */ - if (mode & S_IXOTH) - ret |= VEXEC >> 6; - if (mode & S_IWOTH) - ret |= VWRITE >> 6; - if (mode & S_IROTH) - ret |= VREAD >> 6; - - /* group */ - if (mode & S_IXGRP) - ret |= VEXEC >> 3; - if (mode & S_IWGRP) - ret |= VWRITE >> 3; - if (mode & S_IRGRP) - ret |= VREAD >> 3; - - /* owner */ - if (mode & S_IXUSR) - ret |= VEXEC; - if (mode & S_IWUSR) - ret |= VWRITE; - if (mode & S_IRUSR) - ret |= VREAD; - - return (ret); -} - -/* * Mount unionfs layer. */ static int @@ -174,7 +137,7 @@ unionfs_domount(struct mount *mp, struct vfs_mount_error(mp, "Invalid udir"); return (EINVAL); } - udir = mode2vmode(udir); + udir &= S_IRWXU | S_IRWXG | S_IRWXO; } if (vfs_getopt(mp->mnt_optnew, "ufile", (void **)&tmp, NULL) == 0) { if (tmp != NULL) @@ -183,7 +146,7 @@ unionfs_domount(struct mount *mp, struct vfs_mount_error(mp, "Invalid ufile"); return (EINVAL); } - ufile = mode2vmode(ufile); + ufile &= S_IRWXU | S_IRWXG | S_IRWXO; } /* check umask, uid and gid */ if (udir == 0 && ufile != 0) From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 04:16:17 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67E73106564A; Tue, 25 Nov 2008 04:16:17 +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 514B58FC12; Tue, 25 Nov 2008 04:16:17 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP4GHTD008253; Tue, 25 Nov 2008 04:16:17 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP4GHaY008250; Tue, 25 Nov 2008 04:16:17 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811250416.mAP4GHaY008250@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 25 Nov 2008 04:16:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185285 - head/sys/dev/fxp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 04:16:17 -0000 Author: yongari Date: Tue Nov 25 04:16:16 2008 New Revision: 185285 URL: http://svn.freebsd.org/changeset/base/185285 Log: - Allow fxp_encap() enqueue failed transmissions and set IFF_DRV_OACTIVE to note resource shortage to upper stack. - Don't count number of mbuf chains. Default 32 DMA segments for a frame is enough for most cases. If bus_dmamap_mbuf_sg fails use m_collapse(9) to collapse the mbuf chain instead of relying on expensive m_defrag(9). - Move bpf handling to fxp_start_body() which is supposed to be more appropriate place. - Always arm watchdog timer whenever a new Tx request is made. Previously fxp(4) used to arm watchdog timer only when FXP_CXINT_THRESH-th Tx request is made. Because fxp(4) does not rely on Tx interrupt to reclaim transmitted mbufs it's better to arm watchdog timer to detect potential lockups. - Add more aggresive Tx buffer reclaiming in fxp_start_body to make room for new Tx requests. Since fxp(4) does not request Tx completion interrupt for every frames it's necessary to clean TXCBs in advance to saturate link. - Make fxp(4) try to start more packets transmitting regardless of interrupt type in fxp_intr_body. Modified: head/sys/dev/fxp/if_fxp.c head/sys/dev/fxp/if_fxpvar.h Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Tue Nov 25 03:49:41 2008 (r185284) +++ head/sys/dev/fxp/if_fxp.c Tue Nov 25 04:16:16 2008 (r185285) @@ -220,7 +220,8 @@ static void fxp_init_body(struct fxp_s static void fxp_tick(void *xsc); static void fxp_start(struct ifnet *ifp); static void fxp_start_body(struct ifnet *ifp); -static int fxp_encap(struct fxp_softc *sc, struct mbuf *m_head); +static int fxp_encap(struct fxp_softc *sc, struct mbuf **m_head); +static void fxp_txeof(struct fxp_softc *sc); static void fxp_stop(struct fxp_softc *sc); static void fxp_release(struct fxp_softc *sc); static int fxp_ioctl(struct ifnet *ifp, u_long command, @@ -1190,7 +1191,7 @@ fxp_start_body(struct ifnet *ifp) { struct fxp_softc *sc = ifp->if_softc; struct mbuf *mb_head; - int error, txqueued; + int txqueued; FXP_LOCK_ASSERT(sc, MA_OWNED); @@ -1202,6 +1203,8 @@ fxp_start_body(struct ifnet *ifp) if (sc->need_mcsetup) return; + if (sc->tx_queued > FXP_NTXCB_HIWAT) + fxp_txeof(sc); /* * We're finished if there is nothing more to add to the list or if * we're all filled up with buffers to transmit. @@ -1219,32 +1222,44 @@ fxp_start_body(struct ifnet *ifp) if (mb_head == NULL) break; - error = fxp_encap(sc, mb_head); - if (error) - break; - txqueued = 1; + if (fxp_encap(sc, &mb_head)) { + if (mb_head == NULL) + break; + IFQ_DRV_PREPEND(&ifp->if_snd, mb_head); + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + } + txqueued++; + /* + * Pass packet to bpf if there is a listener. + */ + BPF_MTAP(ifp, mb_head); } - bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE); /* * We're finished. If we added to the list, issue a RESUME to get DMA * going again if suspended. */ - if (txqueued) { + if (txqueued > 0) { + bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE); fxp_scb_wait(sc); fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_RESUME); + /* + * Set a 5 second timer just in case we don't hear + * from the card again. + */ + sc->watchdog_timer = 5; } } static int -fxp_encap(struct fxp_softc *sc, struct mbuf *m_head) +fxp_encap(struct fxp_softc *sc, struct mbuf **m_head) { struct ifnet *ifp; struct mbuf *m; struct fxp_tx *txp; struct fxp_cb_tx *cbp; bus_dma_segment_t segs[FXP_NTXSEG]; - int chainlen, error, i, nseg; + int error, i, nseg; FXP_LOCK_ASSERT(sc, MA_OWNED); ifp = sc->ifp; @@ -1271,6 +1286,7 @@ fxp_encap(struct fxp_softc *sc, struct m txp->tx_cb->ipcb_ip_activation_high = FXP_IPCB_HARDWAREPARSING_ENABLE; + m = *m_head; /* * Deal with TCP/IP checksum offload. Note that * in order for TCP checksum offload to work, @@ -1279,11 +1295,11 @@ fxp_encap(struct fxp_softc *sc, struct m * in the TCP header. The stack should have * already done this for us. */ - if (m_head->m_pkthdr.csum_flags) { - if (m_head->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + if (m->m_pkthdr.csum_flags) { + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { txp->tx_cb->ipcb_ip_schedule = FXP_IPCB_TCPUDP_CHECKSUM_ENABLE; - if (m_head->m_pkthdr.csum_flags & CSUM_TCP) + if (m->m_pkthdr.csum_flags & CSUM_TCP) txp->tx_cb->ipcb_ip_schedule |= FXP_IPCB_TCP_PACKET; } @@ -1311,13 +1327,13 @@ fxp_encap(struct fxp_softc *sc, struct m * the header sizes/offsets vary. */ - if (m_head->m_pkthdr.csum_flags & CSUM_IP) { - if (m_head->m_pkthdr.len < 38) { + if (m->m_pkthdr.csum_flags & CSUM_IP) { + if (m->m_pkthdr.len < 38) { struct ip *ip; - m_head->m_data += ETHER_HDR_LEN; - ip = mtod(m_head, struct ip *); - ip->ip_sum = in_cksum(m_head, ip->ip_hl << 2); - m_head->m_data -= ETHER_HDR_LEN; + m->m_data += ETHER_HDR_LEN; + ip = mtod(m, struct ip *); + ip->ip_sum = in_cksum(m, ip->ip_hl << 2); + m->m_data -= ETHER_HDR_LEN; } else { txp->tx_cb->ipcb_ip_activation_high = FXP_IPCB_HARDWAREPARSING_ENABLE; @@ -1328,40 +1344,33 @@ fxp_encap(struct fxp_softc *sc, struct m #endif } - chainlen = 0; - for (m = m_head; m != NULL && chainlen <= sc->maxtxseg; m = m->m_next) - chainlen++; - if (chainlen > sc->maxtxseg) { - struct mbuf *mn; - - /* - * We ran out of segments. We have to recopy this - * mbuf chain first. Bail out if we can't get the - * new buffers. - */ - mn = m_defrag(m_head, M_DONTWAIT); - if (mn == NULL) { - m_freem(m_head); - return (-1); - } else { - m_head = mn; + error = bus_dmamap_load_mbuf_sg(sc->fxp_mtag, txp->tx_map, *m_head, + segs, &nseg, 0); + if (error == EFBIG) { + m = m_collapse(*m_head, M_DONTWAIT, sc->maxtxseg); + if (m == NULL) { + m_freem(*m_head); + *m_head = NULL; + return (ENOMEM); + } + *m_head = m; + error = bus_dmamap_load_mbuf_sg(sc->fxp_mtag, txp->tx_map, + *m_head, segs, &nseg, 0); + if (error != 0) { + m_freem(*m_head); + *m_head = NULL; + return (ENOMEM); } - } - - /* - * Go through each of the mbufs in the chain and initialize - * the transmit buffer descriptors with the physical address - * and size of the mbuf. - */ - error = bus_dmamap_load_mbuf_sg(sc->fxp_mtag, txp->tx_map, - m_head, segs, &nseg, 0); - if (error) { - device_printf(sc->dev, "can't map mbuf (error %d)\n", error); - m_freem(m_head); - return (-1); + } else if (error != 0) + return (error); + if (nseg == 0) { + m_freem(*m_head); + *m_head = NULL; + return (EIO); } KASSERT(nseg <= sc->maxtxseg, ("too many DMA segments")); + bus_dmamap_sync(sc->fxp_mtag, txp->tx_map, BUS_DMASYNC_PREWRITE); cbp = txp->tx_cb; for (i = 0; i < nseg; i++) { @@ -1389,24 +1398,17 @@ fxp_encap(struct fxp_softc *sc, struct m } cbp->tbd_number = nseg; - bus_dmamap_sync(sc->fxp_mtag, txp->tx_map, BUS_DMASYNC_PREWRITE); - txp->tx_mbuf = m_head; + txp->tx_mbuf = m; txp->tx_cb->cb_status = 0; txp->tx_cb->byte_count = 0; - if (sc->tx_queued != FXP_CXINT_THRESH - 1) { + if (sc->tx_queued != FXP_CXINT_THRESH - 1) txp->tx_cb->cb_command = htole16(sc->tx_cmd | FXP_CB_COMMAND_SF | FXP_CB_COMMAND_S); - } else { + else txp->tx_cb->cb_command = htole16(sc->tx_cmd | FXP_CB_COMMAND_SF | FXP_CB_COMMAND_S | FXP_CB_COMMAND_I); - /* - * Set a 5 second timer just in case we don't hear - * from the card again. - */ - sc->watchdog_timer = 5; - } txp->tx_cb->tx_threshold = tx_threshold; /* @@ -1439,10 +1441,6 @@ fxp_encap(struct fxp_softc *sc, struct m sc->tx_queued++; - /* - * Pass packet to bpf if there is a listener. - */ - BPF_MTAP(ifp, m_head); return (0); } @@ -1528,8 +1526,10 @@ fxp_intr(void *xsc) static void fxp_txeof(struct fxp_softc *sc) { + struct ifnet *ifp; struct fxp_tx *txp; + ifp = sc->ifp; bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREREAD); for (txp = sc->fxp_desc.tx_first; sc->tx_queued && (le16toh(txp->tx_cb->cb_status) & FXP_CB_STATUS_C) != 0; @@ -1544,6 +1544,7 @@ fxp_txeof(struct fxp_softc *sc) txp->tx_cb->tbd[0].tb_addr = 0; } sc->tx_queued--; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } sc->fxp_desc.tx_first = txp; bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE); @@ -1589,15 +1590,14 @@ fxp_intr_body(struct fxp_softc *sc, stru * packets go out onto the wire for about 5 to 10 seconds * after the interface is ifconfig'ed for the first time. */ - if (statack & (FXP_SCB_STATACK_CXTNO | FXP_SCB_STATACK_CNA)) { + if (statack & (FXP_SCB_STATACK_CXTNO | FXP_SCB_STATACK_CNA)) fxp_txeof(sc); - /* - * Try to start more packets transmitting. - */ - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - fxp_start_body(ifp); - } + /* + * Try to start more packets transmitting. + */ + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + fxp_start_body(ifp); /* * Just return if nothing happened on the receive side. Modified: head/sys/dev/fxp/if_fxpvar.h ============================================================================== --- head/sys/dev/fxp/if_fxpvar.h Tue Nov 25 03:49:41 2008 (r185284) +++ head/sys/dev/fxp/if_fxpvar.h Tue Nov 25 04:16:16 2008 (r185285) @@ -38,6 +38,7 @@ * This must be a power of two. */ #define FXP_NTXCB 128 +#define FXP_NTXCB_HIWAT ((FXP_NTXCB * 7) / 10) /* * Size of the TxCB list. From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 04:33:02 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C10431065670; Tue, 25 Nov 2008 04:33:02 +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 AA7F38FC14; Tue, 25 Nov 2008 04:33:02 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP4X2We008650; Tue, 25 Nov 2008 04:33:02 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP4X2uv008649; Tue, 25 Nov 2008 04:33:02 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811250433.mAP4X2uv008649@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 25 Nov 2008 04:33:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185286 - head/sys/dev/fxp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 04:33:02 -0000 Author: yongari Date: Tue Nov 25 04:33:02 2008 New Revision: 185286 URL: http://svn.freebsd.org/changeset/base/185286 Log: Simplify Tx checksum offload configuration. Also clear CSUM_IP if we've computed IP checksum with software method. Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Tue Nov 25 04:16:16 2008 (r185285) +++ head/sys/dev/fxp/if_fxp.c Tue Nov 25 04:33:02 2008 (r185286) @@ -1295,14 +1295,10 @@ fxp_encap(struct fxp_softc *sc, struct m * in the TCP header. The stack should have * already done this for us. */ - if (m->m_pkthdr.csum_flags) { - if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - txp->tx_cb->ipcb_ip_schedule = - FXP_IPCB_TCPUDP_CHECKSUM_ENABLE; - if (m->m_pkthdr.csum_flags & CSUM_TCP) - txp->tx_cb->ipcb_ip_schedule |= - FXP_IPCB_TCP_PACKET; - } + if (m->m_pkthdr.csum_flags & FXP_CSUM_FEATURES) { + txp->tx_cb->ipcb_ip_schedule = FXP_IPCB_TCPUDP_CHECKSUM_ENABLE; + if (m->m_pkthdr.csum_flags & CSUM_TCP) + txp->tx_cb->ipcb_ip_schedule |= FXP_IPCB_TCP_PACKET; #ifdef FXP_IP_CSUM_WAR /* @@ -1334,6 +1330,7 @@ fxp_encap(struct fxp_softc *sc, struct m ip = mtod(m, struct ip *); ip->ip_sum = in_cksum(m, ip->ip_hl << 2); m->m_data -= ETHER_HDR_LEN; + m->m_pkthdr.csum_flags &= ~CSUM_IP; } else { txp->tx_cb->ipcb_ip_activation_high = FXP_IPCB_HARDWAREPARSING_ENABLE; From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 05:12:19 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80630106564A; Tue, 25 Nov 2008 05:12:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6AE588FC14; Tue, 25 Nov 2008 05:12:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP5CJqx009399; Tue, 25 Nov 2008 05:12:19 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP5CJea009398; Tue, 25 Nov 2008 05:12:19 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811250512.mAP5CJea009398@svn.freebsd.org> From: Warner Losh Date: Tue, 25 Nov 2008 05:12:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185287 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 05:12:19 -0000 Author: imp Date: Tue Nov 25 05:12:19 2008 New Revision: 185287 URL: http://svn.freebsd.org/changeset/base/185287 Log: more silly whitespace changes. Modified: head/sys/arm/at91/kb920x_machdep.c Modified: head/sys/arm/at91/kb920x_machdep.c ============================================================================== --- head/sys/arm/at91/kb920x_machdep.c Tue Nov 25 04:33:02 2008 (r185286) +++ head/sys/arm/at91/kb920x_machdep.c Tue Nov 25 05:12:19 2008 (r185287) @@ -301,6 +301,7 @@ initarm(void *arg, void *arg2) valloc_pages(undstack, UND_STACK_SIZE); valloc_pages(kernelstack, KSTACK_PAGES); valloc_pages(msgbufpv, round_page(MSGBUF_SIZE) / PAGE_SIZE); + /* * Now we start construction of the L1 page table * We start by mapping the L2 page tables into the L1. @@ -341,7 +342,6 @@ initarm(void *arg, void *arg2) pmap_map_chunk(l1pagetable, msgbufpv.pv_va, msgbufpv.pv_pa, MSGBUF_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) { pmap_map_chunk(l1pagetable, kernel_pt_table[loop].pv_va, kernel_pt_table[loop].pv_pa, L2_TABLE_SIZE, @@ -365,7 +365,6 @@ initarm(void *arg, void *arg2) * Since the ARM stacks use STMFD etc. we must set r13 to the top end * of the stack memory. */ - cpu_control(CPU_CONTROL_MMU_ENABLE, CPU_CONTROL_MMU_ENABLE); set_stackptr(PSR_IRQ32_MODE, irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE); @@ -374,8 +373,6 @@ initarm(void *arg, void *arg2) set_stackptr(PSR_UND32_MODE, undstack.pv_va + UND_STACK_SIZE * PAGE_SIZE); - - /* * We must now clean the cache again.... * Cleaning may be done by reading new data to displace any @@ -406,6 +403,7 @@ initarm(void *arg, void *arg2) arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); pmap_curmaxkvaddr = afterkern + L1_S_SIZE * (KERNEL_PT_KERN_NUM - 1); + /* * ARM_USE_SMALL_ALLOC uses dump_avail, so it must be filled before * calling pmap_bootstrap. From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 05:17:39 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4E821065670; Tue, 25 Nov 2008 05:17:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFC128FC0C; Tue, 25 Nov 2008 05:17:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP5Hd9A009535; Tue, 25 Nov 2008 05:17:39 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP5HdiG009534; Tue, 25 Nov 2008 05:17:39 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811250517.mAP5HdiG009534@svn.freebsd.org> From: Warner Losh Date: Tue, 25 Nov 2008 05:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185288 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 05:17:40 -0000 Author: imp Date: Tue Nov 25 05:17:39 2008 New Revision: 185288 URL: http://svn.freebsd.org/changeset/base/185288 Log: Save boot args. Modified: head/sys/arm/at91/kb920x_machdep.c Modified: head/sys/arm/at91/kb920x_machdep.c ============================================================================== --- head/sys/arm/at91/kb920x_machdep.c Tue Nov 25 05:12:19 2008 (r185287) +++ head/sys/arm/at91/kb920x_machdep.c Tue Nov 25 05:17:39 2008 (r185288) @@ -135,6 +135,9 @@ struct pv_addr undstack; struct pv_addr abtstack; struct pv_addr kernelstack; +static void *boot_arg1; +static void *boot_arg2; + static struct trapframe proc0_tf; /* Static device mappings. */ @@ -255,6 +258,8 @@ initarm(void *arg, void *arg2) uint32_t memsize; vm_offset_t lastaddr; + boot_arg1 = arg; + boot_arg2 = arg2; set_cpufuncs(); lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 07:17:12 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 677091065670; Tue, 25 Nov 2008 07:17:12 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 522768FC14; Tue, 25 Nov 2008 07:17:12 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP7HCEG011962; Tue, 25 Nov 2008 07:17:12 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP7HBJb011948; Tue, 25 Nov 2008 07:17:11 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200811250717.mAP7HBJb011948@svn.freebsd.org> From: Scott Long Date: Tue, 25 Nov 2008 07:17:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185289 - in head: sbin/iscontrol sys/dev/iscsi/initiator X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 07:17:12 -0000 Author: scottl Date: Tue Nov 25 07:17:11 2008 New Revision: 185289 URL: http://svn.freebsd.org/changeset/base/185289 Log: Big update to the iSCSI initiator code. Highlights include IPv6 support, many bugs fixes, many more performance improvements. Submitted by: Danny Braniss M sbin/iscontrol/iscsi.conf.5 M sbin/iscontrol/iscontrol.8 M sbin/iscontrol/iscontrol.h M sbin/iscontrol/config.c M sbin/iscontrol/fsm.c M sbin/iscontrol/login.c M sbin/iscontrol/pdu.c M sbin/iscontrol/misc.c M sbin/iscontrol/auth_subr.c M sbin/iscontrol/iscontrol.c M sys/dev/iscsi/initiator/isc_cam.c M sys/dev/iscsi/initiator/iscsi.h M sys/dev/iscsi/initiator/isc_soc.c M sys/dev/iscsi/initiator/iscsi_subr.c M sys/dev/iscsi/initiator/iscsivar.h M sys/dev/iscsi/initiator/isc_subr.c M sys/dev/iscsi/initiator/iscsi.c M sys/dev/iscsi/initiator/isc_sm.c Modified: head/sbin/iscontrol/auth_subr.c head/sbin/iscontrol/config.c head/sbin/iscontrol/fsm.c head/sbin/iscontrol/iscontrol.8 head/sbin/iscontrol/iscontrol.c head/sbin/iscontrol/iscontrol.h head/sbin/iscontrol/iscsi.conf.5 head/sbin/iscontrol/login.c head/sbin/iscontrol/misc.c head/sbin/iscontrol/pdu.c head/sys/dev/iscsi/initiator/isc_cam.c head/sys/dev/iscsi/initiator/isc_sm.c head/sys/dev/iscsi/initiator/isc_soc.c head/sys/dev/iscsi/initiator/isc_subr.c head/sys/dev/iscsi/initiator/iscsi.c head/sys/dev/iscsi/initiator/iscsi.h head/sys/dev/iscsi/initiator/iscsi_subr.c head/sys/dev/iscsi/initiator/iscsivar.h Modified: head/sbin/iscontrol/auth_subr.c ============================================================================== --- head/sbin/iscontrol/auth_subr.c Tue Nov 25 05:17:39 2008 (r185288) +++ head/sbin/iscontrol/auth_subr.c Tue Nov 25 07:17:11 2008 (r185289) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2007 Daniel Braniss + * Copyright (c) 2005-2008 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include "iscsi.h" #include "iscontrol.h" -#include "pdu.h" static int chapMD5(char id, char *cp, char *chapSecret, unsigned char *digest) Modified: head/sbin/iscontrol/config.c ============================================================================== --- head/sbin/iscontrol/config.c Tue Nov 25 05:17:39 2008 (r185288) +++ head/sbin/iscontrol/config.c Tue Nov 25 07:17:11 2008 (r185289) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2007 Daniel Braniss + * Copyright (c) 2005-2008 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sbin/iscontrol/fsm.c ============================================================================== --- head/sbin/iscontrol/fsm.c Tue Nov 25 05:17:39 2008 (r185288) +++ head/sbin/iscontrol/fsm.c Tue Nov 25 07:17:11 2008 (r185289) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2007 Daniel Braniss + * Copyright (c) 2005-2008 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$"); #include "iscsi.h" #include "iscontrol.h" -#include "pdu.h" typedef enum { T1 = 1, @@ -66,38 +65,40 @@ typedef enum { T10, T11, T12, T13, T14, T15, T16, T18 } trans_t; +/* + | now supports IPV6 + | thanks to: + | Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan + | ume@mahoroba.org ume@{,jp.}FreeBSD.org + | http://www.imasy.org/~ume/ + */ static trans_t tcpConnect(isess_t *sess) { isc_opt_t *op = sess->op; - int val, sv_errno; - struct addrinfo *res, hints; - struct sockaddr_in sn; - struct in_addr ipn; - time_t sec; + int val, sv_errno, soc; + struct addrinfo *res, *res0, hints; + char pbuf[10]; debug_called(3); if(sess->flags & (SESS_RECONNECT|SESS_REDIRECT)) { syslog(LOG_INFO, "%s", (sess->flags & SESS_RECONNECT) ? "Reconnect": "Redirected"); - debug(3, "%s", (sess->flags & SESS_RECONNECT) ? "Reconnect": "Redirected"); + debug(1, "%s", (sess->flags & SESS_RECONNECT) ? "Reconnect": "Redirected"); shutdown(sess->soc, SHUT_RDWR); //close(sess->soc); - sleep(5); // XXX: actually should be ? sess->soc = -1; sess->flags &= ~SESS_CONNECTED; if(sess->flags & SESS_REDIRECT) { - if(sess->redirect_cnt++ > MAXREDIRECTS) { - syslog(LOG_WARNING, "too many redirects > %d", MAXREDIRECTS); - return 0; - } + sess->redirect_cnt++; sess->flags |= SESS_RECONNECT; - } - if((sess->flags & SESS_RECONNECT) == 0) - return 0; - + } else + sleep(2); // XXX: actually should be ? +#ifdef notyet + { + time_t sec; // make sure we are not in a loop // XXX: this code has to be tested sec = time(0) - sess->reconnect_time; @@ -117,41 +118,46 @@ tcpConnect(isess_t *sess) return 0; } } - sess->reconnect_cnt++; - // sess->flags &= ~(SESS_RECONNECT|SESS_REDIRECT); } - - if((sess->soc = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - fprintf(stderr, "tcpConnect: socket: %m"); - return 0; +#endif + sess->reconnect_cnt++; } + snprintf(pbuf, sizeof(pbuf), "%d", op->port); memset(&hints, 0, sizeof(hints)); - hints.ai_family = PF_INET; + hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; - - debug(3, "targetAddress=%s port=%d", op->targetAddress, op->port); - if(inet_aton(op->targetAddress, &ipn)) - hints.ai_flags |= AI_NUMERICHOST; - if((val = getaddrinfo(op->targetAddress, NULL, &hints, &res)) != 0) { + debug(1, "targetAddress=%s port=%d", op->targetAddress, op->port); + if((val = getaddrinfo(op->targetAddress, pbuf, &hints, &res0)) != 0) { fprintf(stderr, "getaddrinfo(%s): %s\n", op->targetAddress, gai_strerror(val)); return 0; } - memcpy(&sn, res->ai_addr, sizeof(struct sockaddr_in)); - sn.sin_port = htons(op->port); - freeaddrinfo(res); + sess->flags &= ~SESS_CONNECTED; + sv_errno = 0; + soc = -1; + for(res = res0; res; res = res->ai_next) { + soc = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (soc == -1) + continue; // from Patrick.Guelat@imp.ch: // iscontrol can be called without waiting for the socket entry to time out val = 1; - if(setsockopt(sess->soc, SOL_SOCKET, SO_REUSEADDR, &val, (socklen_t)sizeof(val)) < 0) { + if(setsockopt(soc, SOL_SOCKET, SO_REUSEADDR, &val, (socklen_t)sizeof(val)) < 0) { fprintf(stderr, "Cannot set socket SO_REUSEADDR %d: %s\n\n", errno, strerror(errno)); } - sess->flags &= ~SESS_CONNECTED; + if(connect(soc, res->ai_addr, res->ai_addrlen) == 0) + break; + sv_errno = errno; + close(soc); + soc = -1; + } + freeaddrinfo(res0); + if(soc != -1) { + sess->soc = soc; - if(connect(sess->soc, (struct sockaddr *)&sn, sizeof(struct sockaddr_in)) != -1) { #if 0 struct timeval timeout; @@ -190,21 +196,29 @@ tcpConnect(isess_t *sess) } sess->flags |= SESS_CONNECTED; return T1; - } - sv_errno = errno; + fprintf(stderr, "errno=%d\n", sv_errno); perror("connect"); switch(sv_errno) { case ECONNREFUSED: case ENETUNREACH: case ETIMEDOUT: + if((sess->flags & SESS_REDIRECT) == 0) { + if(strcmp(op->targetAddress, sess->target.address) != 0) { + syslog(LOG_INFO, "reconnecting to original target address"); + free(op->targetAddress); + op->targetAddress = sess->target.address; + op->port = sess->target.port; + op->targetPortalGroupTag = sess->target.pgt; + return T1; + } + } sleep(5); // for now ... return T1; default: return 0; // terminal error } - } int @@ -416,7 +430,6 @@ supervise(isess_t *sess) } else { - if(ioctl(sess->fd, ISCSIRESTART)) { perror("ISCSIRESTART"); return -1; @@ -554,7 +567,10 @@ doLogin(isess_t *sess) return T7; case 2: // initiator terminal error + return 0; case 3: // target terminal error -- could retry ... + sleep(5); + return T7; // lets try default: return 0; } @@ -654,6 +670,9 @@ fsm(isc_opt_t *op) sess->op = op; sess->fd = -1; sess->soc = -1; + sess->target.address = strdup(op->targetAddress); + sess->target.port = op->port; + sess->target.pgt = op->targetPortalGroupTag; sess->flags = SESS_INITIALLOGIN | SESS_INITIALLOGIN1; Modified: head/sbin/iscontrol/iscontrol.8 ============================================================================== --- head/sbin/iscontrol/iscontrol.8 Tue Nov 25 05:17:39 2008 (r185288) +++ head/sbin/iscontrol/iscontrol.8 Tue Nov 25 07:17:11 2008 (r185289) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2007 Daniel Braniss +.\" Copyright (c) 2007-2008 Daniel Braniss .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without Modified: head/sbin/iscontrol/iscontrol.c ============================================================================== --- head/sbin/iscontrol/iscontrol.c Tue Nov 25 05:17:39 2008 (r185288) +++ head/sbin/iscontrol/iscontrol.c Tue Nov 25 07:17:11 2008 (r185289) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Daniel Braniss + * Copyright (c) 2005-2008 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #include "iscsi.h" #include "iscontrol.h" -//#include "pdu.h" #define USAGE "[-v] [-d] [-c config] [-n name] [-t target] " #define OPTIONS "vdc:t:n:" @@ -129,7 +128,7 @@ int main(int cc, char **vv) { int ch, disco; - char *pname, *p, *ta, *kw; + char *pname, *p, *q, *ta, *kw; isc_opt_t *op; FILE *fd; @@ -191,12 +190,18 @@ main(int cc, char **vv) fprintf(stderr, "No target!\n"); goto badu; } - if((p = strchr(op->targetAddress, ':')) != NULL) { + q = op->targetAddress; + if(*q == '[' && (q = strchr(q, ']')) != NULL) { + *q++ = '\0'; + op->targetAddress++; + } else + q = op->targetAddress; + if((p = strchr(q, ':')) != NULL) { *p++ = 0; op->port = atoi(p); p = strchr(p, ','); } - if(p || ((p = strchr(op->targetAddress, ',')) != NULL)) { + if(p || ((p = strchr(q, ',')) != NULL)) { *p++ = 0; op->targetPortalGroupTag = atoi(p); } Modified: head/sbin/iscontrol/iscontrol.h ============================================================================== --- head/sbin/iscontrol/iscontrol.h Tue Nov 25 05:17:39 2008 (r185288) +++ head/sbin/iscontrol/iscontrol.h Tue Nov 25 07:17:11 2008 (r185289) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Daniel Braniss + * Copyright (c) 2005-2008 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,12 @@ int vflag; typedef int auth_t(void *sess); +typedef struct { + char *address; + int port; + int pgt; +} target_t; + typedef struct isess { int flags; #define SESS_CONNECTED BIT(0) @@ -61,6 +67,7 @@ typedef struct isess { isc_opt_t *op; // operational values + target_t target; // the Original target address int fd; // the session fd int soc; // the socket iscsi_cam_t cam; Modified: head/sbin/iscontrol/iscsi.conf.5 ============================================================================== --- head/sbin/iscontrol/iscsi.conf.5 Tue Nov 25 05:17:39 2008 (r185288) +++ head/sbin/iscontrol/iscsi.conf.5 Tue Nov 25 07:17:11 2008 (r185289) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2007 Daniel Braniss +.\" Copyright (c) 2007-2008 Daniel Braniss .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without Modified: head/sbin/iscontrol/login.c ============================================================================== --- head/sbin/iscontrol/login.c Tue Nov 25 05:17:39 2008 (r185288) +++ head/sbin/iscontrol/login.c Tue Nov 25 07:17:11 2008 (r185289) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Daniel Braniss + * Copyright (c) 2005-2008 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include "iscsi.h" #include "iscontrol.h" -#include "pdu.h" static char *status_class1[] = { "Initiator error", @@ -173,16 +172,18 @@ processParams(isess_t *sess, pdu_t *pp) klen = eq - ptr; if(klen > 0) { if(strncmp(ptr, "TargetAddress", klen) == 0) { - char *p, *q; + char *p, *q, *ta = NULL; // TargetAddress=domainname[:port][,portal-group-tag] // XXX: if(op->targetAddress) free(op->targetAddress); q = op->targetAddress = strdup(eq+1); if(*q == '[') { // bracketed IPv6 - if((q = strchr(q, ']')) != NULL) - q++; - else + if((q = strchr(q, ']')) != NULL) { + *q++ = '\0'; + ta = op->targetAddress; + op->targetAddress = strdup(ta+1); + } else q = op->targetAddress; } if((p = strchr(q, ',')) != NULL) { @@ -193,6 +194,8 @@ processParams(isess_t *sess, pdu_t *pp) *p++ = 0; op->port = atoi(p); } + if(ta) + free(ta); } else if(strncmp(ptr, "MaxRecvDataSegmentLength", klen) == 0) { // danny's RFC op->maxXmitDataSegmentLength = strtol(eq+1, (char **)NULL, 0); Modified: head/sbin/iscontrol/misc.c ============================================================================== --- head/sbin/iscontrol/misc.c Tue Nov 25 05:17:39 2008 (r185288) +++ head/sbin/iscontrol/misc.c Tue Nov 25 07:17:11 2008 (r185289) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Daniel Braniss + * Copyright (c) 2005-2008 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sbin/iscontrol/pdu.c ============================================================================== --- head/sbin/iscontrol/pdu.c Tue Nov 25 05:17:39 2008 (r185288) +++ head/sbin/iscontrol/pdu.c Tue Nov 25 07:17:11 2008 (r185289) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Daniel Braniss + * Copyright (c) 2005-2008 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include "iscsi.h" #include "iscontrol.h" -#include "pdu.h" int xmitpdu(isess_t *sess, pdu_t *pp) Modified: head/sys/dev/iscsi/initiator/isc_cam.c ============================================================================== --- head/sys/dev/iscsi/initiator/isc_cam.c Tue Nov 25 05:17:39 2008 (r185288) +++ head/sys/dev/iscsi/initiator/isc_cam.c Tue Nov 25 07:17:11 2008 (r185289) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2007 Daniel Braniss + * Copyright (c) 2005-2008 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -193,6 +193,23 @@ _inq(struct cam_sim *sim, union ccb *ccb cpi->ccb_h.status = CAM_REQ_CMP; } +static __inline int +_scsi_encap(struct cam_sim *sim, union ccb *ccb) +{ + int ret; + +#if __FreeBSD_version < 700000 + ret = scsi_encap(sim, ccb); +#else + struct isc_softc *isp = (struct isc_softc *)cam_sim_softc(sim); + + mtx_unlock(&isp->cam_mtx); + ret = scsi_encap(sim, ccb); + mtx_lock(&isp->cam_mtx); +#endif + return ret; +} + static void ic_action(struct cam_sim *sim, union ccb *ccb) { @@ -281,17 +298,8 @@ ic_action(struct cam_sim *sim, union ccb ccb_h->status = CAM_LUN_INVALID; break; } -#if __FreeBSD_version < 700000 - if(scsi_encap(sim, ccb) != 0) + if(_scsi_encap(sim, ccb) != 0) return; -#else - mtx_unlock(&isp->cam_mtx); - if(scsi_encap(sim, ccb) != 0) { - mtx_lock(&isp->cam_mtx); - return; - } - mtx_lock(&isp->cam_mtx); -#endif break; } @@ -396,7 +404,11 @@ ic_init(struct isc_softc *isp) return ENXIO; } CAM_LOCK(isp); - if(xpt_bus_register(sim, NULL, 0/*bus_number*/) != CAM_SUCCESS) + if(xpt_bus_register(sim, +#if __FreeBSD_version >= 700000 + NULL, +#endif + 0/*bus_number*/) != CAM_SUCCESS) goto bad; if(xpt_create_path(&path, xpt_periph, cam_sim_path(sim), Modified: head/sys/dev/iscsi/initiator/isc_sm.c ============================================================================== --- head/sys/dev/iscsi/initiator/isc_sm.c Tue Nov 25 05:17:39 2008 (r185288) +++ head/sys/dev/iscsi/initiator/isc_sm.c Tue Nov 25 07:17:11 2008 (r185289) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2007 Daniel Braniss + * Copyright (c) 2005-2008 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -174,7 +174,7 @@ _nop_out(isc_session_t *sp) /* | only send a nop if window is closed. */ - if((pq = pdu_alloc(sp->isc, 0)) == NULL) + if((pq = pdu_alloc(sp->isc, M_NOWAIT)) == NULL) // I guess we ran out of resources return; nop_out = &pq->pdu.ipdu.nop_out; @@ -224,7 +224,6 @@ _nop_in(isc_session_t *sp, pduq_t *pq) nop_out = &pp->ipdu.nop_out; nop_out->sn.maxcmd = 0; memset(nop_out->mbz, 0, sizeof(nop_out->mbz)); - (void)isc_qout(sp, pq); //XXX: should check return? return; } @@ -318,27 +317,24 @@ isc_qout(isc_session_t *sp, pduq_t *pq) i_nqueue_csnd(sp, pq); sdebug(5, "enqued: pq=%p", pq); -#ifdef ISC_OWAITING - if(sp->flags & ISC_OWAITING) { - mtx_lock(&sp->io_mtx); // XXX - wakeup(&sp->flags); - mtx_unlock(&sp->io_mtx); // XXX - } -#else + + mtx_lock(&sp->io_mtx); + sp->flags |= ISC_OQNOTEMPTY; + if(sp->flags & ISC_OWAITING) wakeup(&sp->flags); -#endif + mtx_unlock(&sp->io_mtx); + return error; } /* | called when a fullPhase is restarted */ -static int +static void ism_restart(isc_session_t *sp) { int lastcmd; sdebug(2, "restart ..."); - sp->flags |= ISC_SM_HOLD; lastcmd = iscsi_requeue(sp); #if 0 if(lastcmd != sp->sn.cmd) { @@ -346,8 +342,13 @@ ism_restart(isc_session_t *sp) sp->sn.cmd = lastcmd; } #endif - sp->flags &= ~ISC_SM_HOLD; - return 0; + mtx_lock(&sp->io_mtx); + if(sp->flags & ISC_OWAITING) { + wakeup(&sp->flags); + } + mtx_unlock(&sp->io_mtx); + + sdebug(2, "restarted lastcmd=0x%x", lastcmd); } int @@ -367,7 +368,7 @@ ism_fullfeature(struct cdev *dev, int fl error = ic_fullfeature(dev); break; case 2: // restart - error = ism_restart(sp); + ism_restart(sp); break; } return error; @@ -454,32 +455,40 @@ ism_recv(isc_session_t *sp, pduq_t *pq) } } +/* + | go through the out queues looking for work + | if either nothing to do, or window is closed + | return. + */ static int proc_out(isc_session_t *sp) { sn_t *sn = &sp->sn; pduq_t *pq; - int error, ndone = 0; + int error, ndone; int which; debug_called(8); + error = ndone = 0; - while(1) { + while(sp->flags & ISC_LINK_UP) { pdu_t *pp; bhs_t *bhs; - /* | check if there is outstanding work in: - | 1- the Inmediate queue + | 1- the Immediate queue | 2- the R2T queue | 3- the cmd queue, only if the command window allows it. */ which = BIT(0) | BIT(1); - if(SNA_GT(sn->cmd, sn->maxCmd) == 0) + if(SNA_GT(sn->cmd, sn->maxCmd) == 0) // if(sn->maxCmd - sn->smc + 1) > 0 which |= BIT(2); + sdebug(4, "which=%d sn->maxCmd=%d sn->cmd=%d", which, sn->maxCmd, sn->cmd); + if((pq = i_dqueue_snd(sp, which)) == NULL) break; + sdebug(4, "pq=%p", pq); pp = &pq->pdu; bhs = &pp->ipdu.bhs; @@ -510,38 +519,45 @@ proc_out(isc_session_t *sp) // XXX: and now? } - sdebug(5, "opcode=0x%x sn(cmd=0x%x expCmd=0x%x maxCmd=0x%x expStat=0x%x itt=0x%x)", + sdebug(4, "opcode=0x%x sn(cmd=0x%x expCmd=0x%x maxCmd=0x%x expStat=0x%x itt=0x%x)", bhs->opcode, sn->cmd, sn->expCmd, sn->maxCmd, sn->expStat, sn->itt); if(pq->ccb) i_nqueue_hld(sp, pq); - if((error = isc_sendPDU(sp, pq)) == 0) + if((error = isc_sendPDU(sp, pq)) == 0) { ndone++; + if(pq->ccb == NULL) + pdu_free(sp->isc, pq); + } else { xdebug("error=%d ndone=%d opcode=0x%x ccb=%p itt=%x", error, ndone, bhs->opcode, pq->ccb, ntohl(bhs->itt)); - if(error == EPIPE) { - // XXX: better do some error recovery ... + if(pq->ccb) + i_remove_hld(sp, pq); + switch(error) { + case EPIPE: + sp->flags &= ~ISC_LINK_UP; + + case EAGAIN: + xdebug("requed"); + i_rqueue_pdu(sp, pq); break; - } -#if 0 + + default: if(pq->ccb) { - i_remove_hld(sp, pq); - pq->ccb->ccb_h.status |= CAM_UNREC_HBA_ERROR; // some better error? - XPT_DONE(pq->ccb); + xdebug("back to cam"); + pq->ccb->ccb_h.status |= CAM_REQUEUE_REQ; // some better error? + XPT_DONE(sp->isc, pq->ccb); + pdu_free(sp->isc, pq); } - else { - // XXX: now what? - // how do we pass back an error? + else + xdebug("we lost it!"); } -#endif } - if(pq->ccb == NULL || error) - pdu_free(sp->isc, pq); } - return ndone; + return error; } /* @@ -551,42 +567,46 @@ static void ism_proc(void *vp) { isc_session_t *sp = (isc_session_t *)vp; - int odone; + int error; debug_called(8); - sdebug(3, "started"); sp->flags |= ISC_SM_RUNNING; + sdebug(3, "started sp->flags=%x", sp->flags); do { - if(sp->flags & ISC_SM_HOLD) - odone = 0; - else - odone = proc_out(sp); - sdebug(7, "odone=%d", odone); - if(odone == 0) { + if((sp->flags & ISC_HOLD) == 0) { + error = proc_out(sp); + if(error) { + sdebug(3, "error=%d", error); + } + } mtx_lock(&sp->io_mtx); -#ifdef ISC_OWAITING + if((sp->flags & ISC_LINK_UP) == 0) { + wakeup(&sp->soc); + } + + if(!(sp->flags & ISC_OQNOTEMPTY)) { sp->flags |= ISC_OWAITING; -#endif - if((msleep(&sp->flags, &sp->io_mtx, PRIBIO, "isc_proc", hz*30) == EWOULDBLOCK) - && (sp->flags & ISC_CON_RUNNING)) + if(msleep(&sp->flags, &sp->io_mtx, PRIBIO, "isc_proc", hz*30) == EWOULDBLOCK) { + if(sp->flags & ISC_CON_RUNNING) _nop_out(sp); -#ifdef ISC_OWAITING + } sp->flags &= ~ISC_OWAITING; -#endif - mtx_unlock(&sp->io_mtx); } + sp->flags &= ~ISC_OQNOTEMPTY; + mtx_unlock(&sp->io_mtx); } while(sp->flags & ISC_SM_RUN); sp->flags &= ~ISC_SM_RUNNING; + sdebug(3, "dropped ISC_SM_RUNNING"); #if __FreeBSD_version >= 700000 destroy_dev(sp->dev); #endif + wakeup(sp); - sdebug(3, "terminated"); + debug(3, "terminated sp=%p sp->sid=%d", sp, sp->sid); - wakeup(sp); kproc_exit(0); } @@ -695,6 +715,13 @@ isc_add_sysctls(isc_session_t *sp) CTLFLAG_RD, (void *)sp, 0, isc_dump_stats, "A", "statistics"); + + SYSCTL_ADD_INT(&sp->clist, + SYSCTL_CHILDREN(sp->oid), + OID_AUTO, + "douio", + CTLFLAG_RW, + &sp->douio, 0, "enable uio on read"); } void @@ -782,5 +809,6 @@ ism_start(isc_session_t *sp) sp->flags |= ISC_SM_RUN; + debug(4, "starting ism_proc: sp->sid=%d", sp->sid); return kproc_create(ism_proc, sp, &sp->stp, 0, 0, "ism_%d", sp->sid); } Modified: head/sys/dev/iscsi/initiator/isc_soc.c ============================================================================== --- head/sys/dev/iscsi/initiator/isc_soc.c Tue Nov 25 05:17:39 2008 (r185288) +++ head/sys/dev/iscsi/initiator/isc_soc.c Tue Nov 25 07:17:11 2008 (r185289) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2007 Daniel Braniss + * Copyright (c) 2005-2008 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,157 +55,179 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include -#ifndef USE_MBUF +#ifndef NO_USE_MBUF #define USE_MBUF #endif #ifdef USE_MBUF + +static int ou_refcnt = 0; + /* - | a dummy function for freeing external storage for mbuf + | function for freeing external storage for mbuf */ static void -nil_fn(void *a, void *b) +ext_free(void *a, void *b) { + pduq_t *pq = b; + + if(pq->buf != NULL) { + debug(3, "ou_refcnt=%d a=%p b=%p", ou_refcnt, a, pq->buf); + free(pq->buf, M_ISCSI); + pq->buf = NULL; + } } -static int nil_refcnt = 0; -#endif /* USE_MBUF */ int isc_sendPDU(isc_session_t *sp, pduq_t *pq) { + struct mbuf *mh, **mp; pdu_t *pp = &pq->pdu; int len, error; -#ifdef USE_MBUF - struct mbuf *mh, **mp; -#else - struct uio *uio = &pq->uio; - struct iovec *iv; -#endif /* USE_MBUF */ debug_called(8); - -#ifndef USE_MBUF - bzero(uio, sizeof(struct uio)); - uio->uio_rw = UIO_WRITE; - uio->uio_segflg = UIO_SYSSPACE; - uio->uio_td = sp->td; - uio->uio_iov = iv = pq->iov; - - iv->iov_base = &pp->ipdu; - iv->iov_len = sizeof(union ipdu_u); - uio->uio_resid = pq->len; - iv++; -#else /* USE_MBUF */ - /* mbuf for the iSCSI header */ - MGETHDR(mh, M_WAIT, MT_DATA); + /* + | mbuf for the iSCSI header + */ + MGETHDR(mh, M_TRYWAIT, MT_DATA); mh->m_len = mh->m_pkthdr.len = sizeof(union ipdu_u); mh->m_pkthdr.rcvif = NULL; MH_ALIGN(mh, sizeof(union ipdu_u)); bcopy(&pp->ipdu, mh->m_data, sizeof(union ipdu_u)); mh->m_next = NULL; -#endif /* USE_MBUF */ if(sp->hdrDigest) pq->pdu.hdr_dig = sp->hdrDigest(&pp->ipdu, sizeof(union ipdu_u), 0); if(pp->ahs_len) { -#ifndef USE_MBUF - iv->iov_base = pp->ahs; - iv->iov_len = pp->ahs_len; - iv++; -#else /* USE_MBUF */ - /* Add any AHS to the iSCSI hdr mbuf */ - /* XXX Assert: (mh->m_pkthdr.len + pp->ahs_len) < MHLEN */ + /* + | Add any AHS to the iSCSI hdr mbuf + | XXX Assert: (mh->m_pkthdr.len + pp->ahs_len) < MHLEN + */ bcopy(pp->ahs, (mh->m_data + mh->m_len), pp->ahs_len); mh->m_len += pp->ahs_len; mh->m_pkthdr.len += pp->ahs_len; -#endif /* USE_MBUF */ + if(sp->hdrDigest) pq->pdu.hdr_dig = sp->hdrDigest(&pp->ahs, pp->ahs_len, pq->pdu.hdr_dig); } if(sp->hdrDigest) { debug(2, "hdr_dig=%x", pq->pdu.hdr_dig); -#ifndef USE_MBUF - iv->iov_base = &pp->hdr_dig; - iv->iov_len = sizeof(int); - iv++; -#else /* USE_MBUF */ - /* Add header digest to the iSCSI hdr mbuf */ - /* XXX Assert: (mh->m_pkthdr.len + 4) < MHLEN */ + /* + | Add header digest to the iSCSI hdr mbuf + | XXX Assert: (mh->m_pkthdr.len + 4) < MHLEN + */ bcopy(&pp->hdr_dig, (mh->m_data + mh->m_len), sizeof(int)); mh->m_len += sizeof(int); mh->m_pkthdr.len += sizeof(int); -#endif /* USE_MBUF */ } -#ifdef USE_MBUF mp = &mh->m_next; -#endif /* USE_MBUF */ if(pq->pdu.ds) { -#ifndef USE_MBUF - iv->iov_base = pp->ds; - iv->iov_len = pp->ds_len; - while(iv->iov_len & 03) // the specs say it must be int alligned - iv->iov_len++; - iv++; -#else /* USE_MBUF */ struct mbuf *md; int off = 0; len = pp->ds_len; while(len & 03) // the specs say it must be int alligned len++; - - while (len > 0) { + while(len > 0) { int l; - MGET(md, M_WAIT, MT_DATA); - md->m_ext.ref_cnt = &nil_refcnt; + MGET(md, M_TRYWAIT, MT_DATA); + md->m_ext.ref_cnt = &ou_refcnt; l = min(MCLBYTES, len); - MEXTADD(md, pp->ds + off, l, nil_fn, - pp->ds + off, NULL, 0, EXT_EXTREF); + debug(5, "setting ext_free(arg=%p len/l=%d/%d)", pq->buf, len, l); + MEXTADD(md, pp->ds + off, l, ext_free, pp->ds + off, pq, 0, EXT_EXTREF); md->m_len = l; md->m_next = NULL; mh->m_pkthdr.len += l; *mp = md; mp = &md->m_next; - len -= l; off += l; } -#endif /* USE_MBUF */ } if(sp->dataDigest) { -#ifdef USE_MBUF struct mbuf *me; -#endif /* USE_MBUF */ pp->ds_dig = sp->dataDigest(pp->ds, pp->ds_len, 0); -#ifndef USE_MBUF - iv->iov_base = &pp->ds_dig; - iv->iov_len = sizeof(int); - iv++; -#else /* USE_MBUF */ - MGET(me, M_WAIT, MT_DATA); + + MGET(me, M_TRYWAIT, MT_DATA); me->m_len = sizeof(int); MH_ALIGN(mh, sizeof(int)); bcopy(&pp->ds_dig, me->m_data, sizeof(int)); me->m_next = NULL; - mh->m_pkthdr.len += sizeof(int); *mp = me; -#endif /* USE_MBUF */ } + if((error = sosend(sp->soc, NULL, NULL, mh, 0, 0, sp->td)) != 0) { + sdebug(3, "error=%d", error); + return error; + } + sp->stats.nsent++; + getbintime(&sp->stats.t_sent); + return 0; +} +#else /* NO_USE_MBUF */ +int +isc_sendPDU(isc_session_t *sp, pduq_t *pq) +{ + struct uio *uio = &pq->uio; + struct iovec *iv; + pdu_t *pp = &pq->pdu; + int len, error; + + debug_called(8); + + bzero(uio, sizeof(struct uio)); + uio->uio_rw = UIO_WRITE; + uio->uio_segflg = UIO_SYSSPACE; + uio->uio_td = sp->td; + uio->uio_iov = iv = pq->iov; + + iv->iov_base = &pp->ipdu; + iv->iov_len = sizeof(union ipdu_u); + uio->uio_resid = pq->len; + iv++; + if(sp->hdrDigest) + pq->pdu.hdr_dig = sp->hdrDigest(&pp->ipdu, sizeof(union ipdu_u), 0); + if(pp->ahs_len) { + iv->iov_base = pp->ahs; + iv->iov_len = pp->ahs_len; + iv++; -#ifndef USE_MBUF + if(sp->hdrDigest) + pq->pdu.hdr_dig = sp->hdrDigest(&pp->ahs, pp->ahs_len, pq->pdu.hdr_dig); + } + if(sp->hdrDigest) { + debug(2, "hdr_dig=%x", pq->pdu.hdr_dig); + iv->iov_base = &pp->hdr_dig; + iv->iov_len = sizeof(int); + iv++; + } + if(pq->pdu.ds) { + iv->iov_base = pp->ds; + iv->iov_len = pp->ds_len; + while(iv->iov_len & 03) // the specs say it must be int alligned + iv->iov_len++; + iv++; + } + if(sp->dataDigest) { + pp->ds_dig = sp->dataDigest(pp->ds, pp->ds_len, 0); + iv->iov_base = &pp->ds_dig; + iv->iov_len = sizeof(int); + iv++; + } uio->uio_iovcnt = iv - pq->iov; sdebug(5, "opcode=%x iovcnt=%d uio_resid=%d itt=%x", pp->ipdu.bhs.opcode, uio->uio_iovcnt, uio->uio_resid, ntohl(pp->ipdu.bhs.itt)); sdebug(5, "sp=%p sp->soc=%p uio=%p sp->td=%p", sp, sp->soc, uio, sp->td); - do { len = uio->uio_resid; error = sosend(sp->soc, NULL, uio, 0, 0, 0, sp->td); @@ -243,20 +265,12 @@ isc_sendPDU(isc_session_t *sp, pduq_t *p *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 08:04:41 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84AAC106564A; Tue, 25 Nov 2008 08:04:41 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E4DD8FC1A; Tue, 25 Nov 2008 08:04:41 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP84fxH012952; Tue, 25 Nov 2008 08:04:41 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP84el9012939; Tue, 25 Nov 2008 08:04:40 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200811250804.mAP84el9012939@svn.freebsd.org> From: Alfred Perlstein Date: Tue, 25 Nov 2008 08:04:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185290 - in head: lib/libusb20 sys/dev/usb2/core sys/dev/usb2/ethernet sys/dev/usb2/include sys/dev/usb2/quirk sys/dev/usb2/serial sys/modules/usb2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 08:04:41 -0000 Author: alfred Date: Tue Nov 25 08:04:40 2008 New Revision: 185290 URL: http://svn.freebsd.org/changeset/base/185290 Log: src/lib/libusb20/libusb20_compat01.c Fix some issues about re-scanning of the devices. src/lib/libusb20/libusb20_ugen20.c Fix issue about libusb20 having to release the USB transfers before doing a SET_CONFIG, else the kernel will kill the file handle. src/sys/dev/usb2/core/usb2_device. src/sys/dev/usb2/core/usb2_generic.c src/sys/dev/usb2/core/usb2_generic.h Add support for U3G devices. Improve and cleanup FIFO free handling. Improve device re-enumeration. src/sys/dev/usb2/core/usb2_msctest.c src/sys/dev/usb2/core/usb2_msctest.h Fix some problems in the USB Mass Storage Test. Add Huawei vendor specific quirks. src/sys/dev/usb2/core/usb2_request.c Improve device re-enumeration. src/sys/dev/usb2/ethernet/if_aue2.c src/sys/dev/usb2/include/usb2_devid.h src/sys/dev/usb2/include/usb2_devtable.h src/sys/dev/usb2/quirk/usb2_quirk.c Integrate changes from the old USB driver. src/sys/dev/usb2/include/usb2_standard.h Add definition of USB3.0 structures from USB.org. src/sys/dev/usb2/serial/u3g2.c src/sys/dev/usb2/serial/ugensa2.c src/sys/modules/usb2/Makefile src/sys/modules/usb2/serial_3g/Makefile Import U3G driver. Submitted by: Hans Petter Selasky (usb4bsd) Added: head/sys/dev/usb2/serial/u3g2.c (contents, props changed) Modified: head/lib/libusb20/libusb20_compat01.c head/lib/libusb20/libusb20_ugen20.c head/sys/dev/usb2/core/usb2_device.c head/sys/dev/usb2/core/usb2_generic.c head/sys/dev/usb2/core/usb2_generic.h head/sys/dev/usb2/core/usb2_msctest.c head/sys/dev/usb2/core/usb2_msctest.h head/sys/dev/usb2/core/usb2_request.c head/sys/dev/usb2/ethernet/if_aue2.c head/sys/dev/usb2/include/usb2_devid.h head/sys/dev/usb2/include/usb2_devtable.h head/sys/dev/usb2/include/usb2_standard.h head/sys/dev/usb2/quirk/usb2_quirk.c head/sys/dev/usb2/serial/ugensa2.c head/sys/modules/usb2/Makefile Modified: head/lib/libusb20/libusb20_compat01.c ============================================================================== --- head/lib/libusb20/libusb20_compat01.c Tue Nov 25 07:17:11 2008 (r185289) +++ head/lib/libusb20/libusb20_compat01.c Tue Nov 25 08:04:40 2008 (r185290) @@ -177,19 +177,42 @@ usb_open(struct usb_device *dev) if (err) return (NULL); + /* + * Dequeue USB device from backend queue so that it does not get + * freed when the backend is re-scanned: + */ + libusb20_be_dequeue_device(usb_backend, dev->dev); + return (dev->dev); } int -usb_close(usb_dev_handle * dev) +usb_close(usb_dev_handle * udev) { + struct usb_device *dev; int err; - err = libusb20_dev_close((void *)dev); + err = libusb20_dev_close((void *)udev); if (err) return (-1); + if (usb_backend != NULL) { + /* + * Enqueue USB device to backend queue so that it gets freed + * when the backend is re-scanned: + */ + libusb20_be_enqueue_device(usb_backend, (void *)udev); + } else { + /* + * The backend is gone. Free device data so that we + * don't start leaking memory! + */ + dev = usb_device(udev); + libusb20_dev_free((void *)udev); + LIST_DEL(usb_global_bus.devices, dev); + free(dev); + } return (0); } @@ -697,7 +720,8 @@ usb_set_configuration(usb_dev_handle * u /* "bConfigurationValue" not found */ return (-1); } - if ((dev->config + i)->bConfigurationValue == bConfigurationValue) { + if ((dev->config + i)->bConfigurationValue == + bConfigurationValue) { break; } } @@ -821,36 +845,28 @@ usb_find_devices(void) struct libusb20_device *pdev; struct usb_device *udev; struct LIBUSB20_DEVICE_DESC_DECODED *ddesc; - struct libusb20_backend *pold; int err; /* cleanup after last device search */ + /* close all opened devices, if any */ - pold = usb_backend; - - pdev = NULL; - while ((pdev = libusb20_be_device_foreach(pold, pdev))) { - if (!pdev->is_opened) { - /* - * if the device has not been opened we free the - * device data - */ - udev = pdev->priv01Data; - libusb20_be_dequeue_device(pold, pdev); - libusb20_dev_free(pdev); - if (udev != NULL) { - LIST_DEL(usb_global_bus.devices, udev); - free(udev); - } - pdev = NULL; /* restart search */ + while ((pdev = libusb20_be_device_foreach(usb_backend, NULL))) { + udev = pdev->priv01Data; + libusb20_be_dequeue_device(usb_backend, pdev); + libusb20_dev_free(pdev); + if (udev != NULL) { + LIST_DEL(usb_global_bus.devices, udev); + free(udev); } } - /* do a new backend device search */ + /* free old USB backend, if any */ + libusb20_be_free(usb_backend); + + /* do a new backend device search */ usb_backend = libusb20_be_alloc_default(); if (usb_backend == NULL) { - usb_backend = pold; /* restore */ return (-1); } /* iterate all devices */ @@ -904,17 +920,6 @@ usb_find_devices(void) LIST_ADD(usb_global_bus.devices, udev); } - /* move old devices over to the new USB backend */ - - while ((pdev = libusb20_be_device_foreach(pold, pdev))) { - libusb20_be_dequeue_device(pold, pdev); - libusb20_be_enqueue_device(usb_backend, pdev); - } - - /* free old backend, if any */ - - libusb20_be_free(pold); - return (0); /* success */ } Modified: head/lib/libusb20/libusb20_ugen20.c ============================================================================== --- head/lib/libusb20/libusb20_ugen20.c Tue Nov 25 07:17:11 2008 (r185289) +++ head/lib/libusb20/libusb20_ugen20.c Tue Nov 25 08:04:40 2008 (r185290) @@ -307,10 +307,27 @@ ugen20_init_backend(struct libusb20_back return (0); /* success */ } +static void +ugen20_tr_release(struct libusb20_device *pdev) +{ + struct usb2_fs_uninit fs_uninit; + + if (pdev->nTransfer == 0) { + return; + } + /* release all pending USB transfers */ + if (pdev->privBeData != NULL) { + memset(&fs_uninit, 0, sizeof(fs_uninit)); + if (ioctl(pdev->file, USB_FS_UNINIT, &fs_uninit)) { + /* ignore any errors of this kind */ + } + } + return; +} + static int ugen20_tr_renew(struct libusb20_device *pdev) { - struct usb2_fs_uninit fs_uninit; struct usb2_fs_init fs_init; struct usb2_fs_endpoint *pfse; int error; @@ -325,12 +342,7 @@ ugen20_tr_renew(struct libusb20_device * } size = nMaxTransfer * sizeof(*pfse); - if (pdev->privBeData != NULL) { - memset(&fs_uninit, 0, sizeof(fs_uninit)); - if (ioctl(pdev->file, USB_FS_UNINIT, &fs_uninit)) { - /* ignore any errors of this kind */ - } - } else { + if (pdev->privBeData == NULL) { pfse = malloc(size); if (pfse == NULL) { error = LIBUSB20_ERROR_NO_MEM; @@ -338,7 +350,6 @@ ugen20_tr_renew(struct libusb20_device * } pdev->privBeData = pfse; } - /* reset endpoint data */ memset(pdev->privBeData, 0, size); @@ -421,12 +432,11 @@ static int ugen20_close_device(struct libusb20_device *pdev) { struct usb2_fs_uninit fs_uninit; - int error = 0; if (pdev->privBeData) { memset(&fs_uninit, 0, sizeof(fs_uninit)); if (ioctl(pdev->file, USB_FS_UNINIT, &fs_uninit)) { - error = LIBUSB20_ERROR_OTHER; + /* ignore this error */ } free(pdev->privBeData); } @@ -436,7 +446,7 @@ ugen20_close_device(struct libusb20_devi close(pdev->file_ctrl); pdev->file = -1; pdev->file_ctrl = -1; - return (error); + return (0); /* success */ } static void @@ -509,6 +519,9 @@ ugen20_set_config_index(struct libusb20_ { int temp = cfg_index; + /* release all active USB transfers */ + ugen20_tr_release(pdev); + if (ioctl(pdev->file_ctrl, USB_SET_CONFIG, &temp)) { return (LIBUSB20_ERROR_OTHER); } @@ -548,6 +561,9 @@ ugen20_set_alt_index(struct libusb20_dev alt_iface.uai_interface_index = iface_index; alt_iface.uai_alt_index = alt_index; + /* release all active USB transfers */ + ugen20_tr_release(pdev); + if (ioctl(pdev->file_ctrl, USB_SET_ALTINTERFACE, &alt_iface)) { return (LIBUSB20_ERROR_OTHER); } @@ -559,6 +575,9 @@ ugen20_reset_device(struct libusb20_devi { int temp = 0; + /* release all active USB transfers */ + ugen20_tr_release(pdev); + if (ioctl(pdev->file_ctrl, USB_DEVICEENUMERATE, &temp)) { return (LIBUSB20_ERROR_OTHER); } Modified: head/sys/dev/usb2/core/usb2_device.c ============================================================================== --- head/sys/dev/usb2/core/usb2_device.c Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/core/usb2_device.c Tue Nov 25 08:04:40 2008 (r185290) @@ -1605,18 +1605,16 @@ repeat_set_config: * Try to figure out if we have an * auto-install disk there: */ - if (usb2_test_autoinstall(udev, 0) == 0) { + if (usb2_test_autoinstall(udev, 0, 0) == 0) { DPRINTFN(0, "Found possible auto-install " "disk (trying next config)\n"); config_index++; goto repeat_set_config; } } - } else if (UGETW(udev->ddesc.idVendor) == USB_VENDOR_HUAWEI) { - if (usb2_test_huawei(udev, 0) == 0) { - DPRINTFN(0, "Found Huawei auto-install disk!\n"); - err = USB_ERR_STALLED; /* fake an error */ - } + } else if (usb2_test_huawei(udev, &uaa) == 0) { + DPRINTFN(0, "Found Huawei auto-install disk!\n"); + err = USB_ERR_STALLED; /* fake an error */ } } else { err = 0; /* set success */ @@ -2114,38 +2112,23 @@ usb2_fifo_free_wrap(struct usb2_device * */ continue; } - if (f->dev_ep_index == 0) { - /* - * Don't free the generic control endpoint - * yet and make sure that any USB-FS - * activity is stopped! - */ - if (ugen_fs_uninit(f)) { - /* ignore any failures */ - DPRINTFN(10, "udev=%p ugen_fs_uninit() " - "failed! (ignored)\n", udev); - } + if ((f->dev_ep_index == 0) && + (f->fs_xfer == NULL)) { + /* no need to free this FIFO */ continue; } } else if (iface_index == USB_IFACE_INDEX_ANY) { if ((f->methods == &usb2_ugen_methods) && - (f->dev_ep_index == 0) && (flag == 0)) { - /* - * Don't free the generic control endpoint - * yet, but make sure that any USB-FS - * activity is stopped! - */ - if (ugen_fs_uninit(f)) { - /* ignore any failures */ - DPRINTFN(10, "udev=%p ugen_fs_uninit() " - "failed! (ignored)\n", udev); - } + (f->dev_ep_index == 0) && (flag == 0) && + (f->fs_xfer == NULL)) { + /* no need to free this FIFO */ continue; } } else { + /* no need to free this FIFO */ continue; } - /* free the FIFO */ + /* free this FIFO */ usb2_fifo_free(f); } return; Modified: head/sys/dev/usb2/core/usb2_generic.c ============================================================================== --- head/sys/dev/usb2/core/usb2_generic.c Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/core/usb2_generic.c Tue Nov 25 08:04:40 2008 (r185290) @@ -83,7 +83,7 @@ static int usb2_gen_fill_deviceinfo(stru static int ugen_re_enumerate(struct usb2_fifo *f); static int ugen_iface_ioctl(struct usb2_fifo *f, u_long cmd, void *addr, int fflags); static uint8_t ugen_fs_get_complete(struct usb2_fifo *f, uint8_t *pindex); - +static int ugen_fs_uninit(struct usb2_fifo *f); /* structures */ @@ -192,6 +192,7 @@ ugen_close(struct usb2_fifo *f, int ffla if (ugen_fs_uninit(f)) { /* ignore any errors - we are closing */ + DPRINTFN(6, "no FIFOs\n"); } return; } @@ -591,6 +592,12 @@ ugen_set_config(struct usb2_fifo *f, uin /* no change needed */ return (0); } + /* make sure all FIFO's are gone */ + /* else there can be a deadlock */ + if (ugen_fs_uninit(f)) { + /* ignore any errors */ + DPRINTFN(6, "no FIFOs\n"); + } /* change setting - will free generic FIFOs, if any */ if (usb2_set_config_index(f->udev, index)) { return (EIO); @@ -612,6 +619,12 @@ ugen_set_interface(struct usb2_fifo *f, /* not possible in device side mode */ return (ENOTTY); } + /* make sure all FIFO's are gone */ + /* else there can be a deadlock */ + if (ugen_fs_uninit(f)) { + /* ignore any errors */ + DPRINTFN(6, "no FIFOs\n"); + } /* change setting - will free generic FIFOs, if any */ if (usb2_set_alt_interface_index(f->udev, iface_index, alt_index)) { return (EIO); Modified: head/sys/dev/usb2/core/usb2_generic.h ============================================================================== --- head/sys/dev/usb2/core/usb2_generic.h Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/core/usb2_generic.h Tue Nov 25 08:04:40 2008 (r185290) @@ -29,6 +29,5 @@ extern struct usb2_fifo_methods usb2_ugen_methods; int ugen_do_request(struct usb2_fifo *f, struct usb2_ctl_request *ur); -int ugen_fs_uninit(struct usb2_fifo *f); #endif /* _USB2_GENERIC_H_ */ Modified: head/sys/dev/usb2/core/usb2_msctest.c ============================================================================== --- head/sys/dev/usb2/core/usb2_msctest.c Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/core/usb2_msctest.c Tue Nov 25 08:04:40 2008 (r185290) @@ -36,6 +36,7 @@ #include #include #include +#include #define USB_DEBUG_VAR usb2_debug @@ -49,6 +50,7 @@ #include #include #include +#include #include #include @@ -70,8 +72,7 @@ enum { DIR_NONE, }; -#define BULK_SIZE 64 /* dummy */ - +#define BULK_SIZE 64 /* dummy */ /* Command Block Wrapper */ struct bbb_cbw { @@ -169,7 +170,7 @@ static const struct usb2_config bbb_conf .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .mh.bufsize = BULK_SIZE, - .mh.flags = {.proxy_buffer = 1,.short_xfer_ok = 1,}, + .mh.flags = {.proxy_buffer = 1,}, .mh.callback = &bbb_data_write_callback, .mh.timeout = 4 * USB_MS_HZ, /* 4 seconds */ }, @@ -272,6 +273,7 @@ bbb_command_callback(struct usb2_xfer *x USETDW(sc->cbw.dCBWDataTransferLength, sc->data_len); sc->cbw.bCBWFlags = ((sc->dir == DIR_IN) ? CBWFLAGS_IN : CBWFLAGS_OUT); sc->cbw.bCBWLUN = sc->lun; + sc->cbw.bCDBLength = sc->cmd_len; if (sc->cbw.bCDBLength > sizeof(sc->cbw.CBWCDB)) { sc->cbw.bCDBLength = sizeof(sc->cbw.CBWCDB); DPRINTFN(0, "Truncating long command!\n"); @@ -474,7 +476,8 @@ bbb_command_start(struct bbb_transfer *s * Else: Not an auto install disk. *------------------------------------------------------------------------*/ usb2_error_t -usb2_test_autoinstall(struct usb2_device *udev, uint8_t iface_index) +usb2_test_autoinstall(struct usb2_device *udev, uint8_t iface_index, + uint8_t do_eject) { struct usb2_interface *iface; struct usb2_interface_descriptor *id; @@ -534,22 +537,40 @@ usb2_test_autoinstall(struct usb2_device repeat_inquiry: sc->cbw.CBWCDB[0] = 0x12; /* INQUIRY */ + sc->cbw.CBWCDB[1] = 0; + sc->cbw.CBWCDB[2] = 0; + sc->cbw.CBWCDB[3] = 0; + sc->cbw.CBWCDB[4] = 0x24; /* length */ + sc->cbw.CBWCDB[5] = 0; + err = bbb_command_start(sc, DIR_IN, 0, + sc->buffer, 0x24, 6, USB_MS_HZ); - err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, 256, 6, USB_MS_HZ); - if (err) { - err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, 256, 12, USB_MS_HZ); - if (err) { - err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, 256, 16, USB_MS_HZ); - } - } if ((sc->actlen != 0) && (err == 0)) { sid_type = sc->buffer[0] & 0x1F; if (sid_type == 0x05) { /* CD-ROM */ - /* XXX could investigate more */ - return (0); + if (do_eject) { + /* 0: opcode: SCSI START/STOP */ + sc->cbw.CBWCDB[0] = 0x1b; + /* 1: byte2: Not immediate */ + sc->cbw.CBWCDB[1] = 0x00; + /* 2..3: reserved */ + sc->cbw.CBWCDB[2] = 0x00; + sc->cbw.CBWCDB[3] = 0x00; + /* 4: Load/Eject command */ + sc->cbw.CBWCDB[4] = 0x02; + /* 5: control */ + sc->cbw.CBWCDB[5] = 0x00; + err = bbb_command_start(sc, DIR_OUT, 0, + NULL, 0, 6, USB_MS_HZ); + + DPRINTFN(0, "Eject CD command " + "status: %s\n", usb2_errstr(err)); + } + err = 0; + goto done; } - } else if (--timeout) { + } else if ((err != 2) && --timeout) { usb2_pause_mtx(&sc->mtx, USB_MS_HZ); goto repeat_inquiry; } @@ -566,28 +587,136 @@ done: } /* - * Huawei Exxx radio devices have a built in flash disk which is their - * default power up configuration. This allows the device to carry its - * own installation software. - * - * Instead of following the USB spec, and create multiple - * configuration descriptors for this, the devices expects the driver - * to send UF_DEVICE_REMOTE_WAKEUP to endpoint 2 to reset the device, - * so it reprobes, now with the radio exposed. + * NOTE: The entries marked with XXX should be checked for the correct + * speed indication to set the buffer sizes. */ +static const struct usb2_device_id u3g_devs[] = { + /* OEM: Option */ + {USB_VPI(USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3G, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, + {USB_VPI(USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GQUAD, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, + {USB_VPI(USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GPLUS, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, + {USB_VPI(USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAX36, U3GINFO(U3GSP_HSDPA, U3GFL_NONE))}, + {USB_VPI(USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAXHSUPA, U3GINFO(U3GSP_HSDPA, U3GFL_NONE))}, + {USB_VPI(USB_VENDOR_OPTION, USB_PRODUCT_OPTION_VODAFONEMC3G, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, + /* OEM: Qualcomm, Inc. */ + {USB_VPI(USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_ZTE_STOR, U3GINFO(U3GSP_CDMA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_CDMA_MSM, U3GINFO(U3GSP_CDMA, U3GFL_SCSI_EJECT))}, + /* OEM: Huawei */ + {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE, U3GINFO(U3GSP_HSDPA, U3GFL_HUAWEI_INIT))}, + {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E220, U3GINFO(U3GSP_HSPA, U3GFL_HUAWEI_INIT))}, + /* OEM: Novatel */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_CDMA_MODEM, U3GINFO(U3GSP_CDMA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_ES620, U3GINFO(U3GSP_UMTS, U3GFL_SCSI_EJECT))}, /* XXX */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_MC950D, U3GINFO(U3GSP_HSUPA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U720, U3GINFO(U3GSP_UMTS, U3GFL_SCSI_EJECT))}, /* XXX */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U727, U3GINFO(U3GSP_UMTS, U3GFL_SCSI_EJECT))}, /* XXX */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740, U3GINFO(U3GSP_HSDPA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740_2, U3GINFO(U3GSP_HSDPA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U870, U3GINFO(U3GSP_UMTS, U3GFL_SCSI_EJECT))}, /* XXX */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V620, U3GINFO(U3GSP_UMTS, U3GFL_SCSI_EJECT))}, /* XXX */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V640, U3GINFO(U3GSP_UMTS, U3GFL_SCSI_EJECT))}, /* XXX */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V720, U3GINFO(U3GSP_UMTS, U3GFL_SCSI_EJECT))}, /* XXX */ + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V740, U3GINFO(U3GSP_HSDPA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_X950D, U3GINFO(U3GSP_HSUPA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_XU870, U3GINFO(U3GSP_HSDPA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_ZEROCD, U3GINFO(U3GSP_HSUPA, U3GFL_SCSI_EJECT))}, + {USB_VPI(USB_VENDOR_DELL, USB_PRODUCT_DELL_U740, U3GINFO(U3GSP_HSDPA, U3GFL_SCSI_EJECT))}, + /* OEM: Merlin */ + {USB_VPI(USB_VENDOR_MERLIN, USB_PRODUCT_MERLIN_V620, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + /* OEM: Sierra Wireless: */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD580, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD595, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC595U, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC597E, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_C597, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880E, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880U, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881E, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881U, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_EM5625, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5720, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5720_2, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5725, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MINI5725, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD875, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755_2, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755_3, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8765, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC875U, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8775_2, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8780, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8781, U3GINFO(U3GSP_UMTS, U3GFL_NONE))}, /* XXX */ + /* Sierra TruInstaller device ID */ + {USB_VPI(USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_TRUINSTALL, U3GINFO(U3GSP_UMTS, U3GFL_SIERRA_INIT))}, +}; -usb2_error_t -usb2_test_huawei(struct usb2_device *udev, uint8_t iface_index) +static void +u3g_sierra_init(struct usb2_device *udev) { struct usb2_device_request req; + + DPRINTFN(0, "\n"); + + req.bmRequestType = UT_VENDOR; + req.bRequest = UR_SET_INTERFACE; + USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP); + USETW(req.wIndex, UHF_PORT_CONNECTION); + USETW(req.wLength, 0); + + if (usb2_do_request_flags(udev, NULL, &req, + NULL, 0, NULL, USB_MS_HZ)) { + /* ignore any errors */ + } + return; +} + +static void +u3g_huawei_init(struct usb2_device *udev) +{ + struct usb2_device_request req; + + DPRINTFN(0, "\n"); + + req.bmRequestType = UT_WRITE_DEVICE; + req.bRequest = UR_SET_FEATURE; + USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP); + USETW(req.wIndex, UHF_PORT_SUSPEND); + USETW(req.wLength, 0); + + if (usb2_do_request_flags(udev, NULL, &req, + NULL, 0, NULL, USB_MS_HZ)) { + /* ignore any errors */ + } + return; +} + +int +usb2_lookup_huawei(struct usb2_attach_arg *uaa) +{ + /* Calling the lookup function will also set the driver info! */ + return (usb2_lookup_id_by_uaa(u3g_devs, sizeof(u3g_devs), uaa)); +} + +/* + * The following function handles 3G modem devices (E220, Mobile, + * etc.) with auto-install flash disks for Windows/MacOSX on the first + * interface. After some command or some delay they change appearance + * to a modem. + */ +usb2_error_t +usb2_test_huawei(struct usb2_device *udev, struct usb2_attach_arg *uaa) +{ struct usb2_interface *iface; struct usb2_interface_descriptor *id; - usb2_error_t err; + uint32_t flags; if (udev == NULL) { return (USB_ERR_INVAL); } - iface = usb2_get_iface(udev, iface_index); + iface = usb2_get_iface(udev, 0); if (iface == NULL) { return (USB_ERR_INVAL); } @@ -598,15 +727,21 @@ usb2_test_huawei(struct usb2_device *ude if (id->bInterfaceClass != UICLASS_MASS) { return (USB_ERR_INVAL); } - /* Bend it like Beckham */ - req.bmRequestType = UT_WRITE_DEVICE; - req.bRequest = UR_SET_FEATURE; - USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP); - USETW(req.wIndex, 2); - USETW(req.wLength, 0); - - /* We get error at return, but it works */ - err = usb2_do_request_flags(udev, NULL, &req, NULL, 0, NULL, 1 * USB_MS_HZ); + if (usb2_lookup_huawei(uaa)) { + /* no device match */ + return (USB_ERR_INVAL); + } + flags = USB_GET_DRIVER_INFO(uaa); + if (flags & U3GFL_HUAWEI_INIT) { + u3g_huawei_init(udev); + } else if (flags & U3GFL_SCSI_EJECT) { + return (usb2_test_autoinstall(udev, 0, 1)); + } else if (flags & U3GFL_SIERRA_INIT) { + u3g_sierra_init(udev); + } else { + /* no quirks */ + return (USB_ERR_INVAL); + } return (0); /* success */ } Modified: head/sys/dev/usb2/core/usb2_msctest.h ============================================================================== --- head/sys/dev/usb2/core/usb2_msctest.h Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/core/usb2_msctest.h Tue Nov 25 08:04:40 2008 (r185290) @@ -27,7 +27,30 @@ #ifndef _USB2_MSCTEST_H_ #define _USB2_MSCTEST_H_ -usb2_error_t usb2_test_autoinstall(struct usb2_device *udev, uint8_t iface_index); -usb2_error_t usb2_test_huawei(struct usb2_device *udev, uint8_t iface_index); +usb2_error_t usb2_test_autoinstall(struct usb2_device *udev, uint8_t iface_index, uint8_t do_eject); +usb2_error_t usb2_test_huawei(struct usb2_device *udev, struct usb2_attach_arg *uaa); +int usb2_lookup_huawei(struct usb2_attach_arg *uaa); + +/* Huawei specific defines */ + +#define U3GINFO(flag,speed) ((flag)|((speed) * 256)) +#define U3G_GET_SPEED(uaa) (USB_GET_DRIVER_INFO(uaa) / 256) + +#define U3GFL_NONE 0x00 +#define U3GFL_HUAWEI_INIT 0x01 /* Requires init command (Huawei + * cards) */ +#define U3GFL_SCSI_EJECT 0x02 /* Requires SCSI eject command + * (Novatel) */ +#define U3GFL_SIERRA_INIT 0x04 /* Requires init command (Sierra + * cards) */ + +#define U3GSP_GPRS 0 +#define U3GSP_EDGE 1 +#define U3GSP_CDMA 2 +#define U3GSP_UMTS 3 +#define U3GSP_HSDPA 4 +#define U3GSP_HSUPA 5 +#define U3GSP_HSPA 6 +#define U3GSP_MAX 7 #endif /* _USB2_MSCTEST_H_ */ Modified: head/sys/dev/usb2/core/usb2_request.c ============================================================================== --- head/sys/dev/usb2/core/usb2_request.c Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/core/usb2_request.c Tue Nov 25 08:04:40 2008 (r185290) @@ -1325,16 +1325,17 @@ usb2_req_get_config(struct usb2_device * usb2_error_t usb2_req_re_enumerate(struct usb2_device *udev, struct mtx *mtx) { - struct usb2_device_descriptor ddesc; struct usb2_device *parent_hub; usb2_error_t err; uint8_t old_addr; + if (udev->flags.usb2_mode != USB_MODE_HOST) { + return (USB_ERR_INVAL); + } old_addr = udev->address; parent_hub = udev->parent_hub; if (parent_hub == NULL) { - err = USB_ERR_INVAL; - goto done; + return (USB_ERR_INVAL); } err = usb2_req_reset_port(parent_hub, mtx, udev->port_no); if (err) { @@ -1347,6 +1348,9 @@ usb2_req_re_enumerate(struct usb2_device */ udev->address = USB_START_ADDR; + /* reset "bMaxPacketSize" */ + udev->ddesc.bMaxPacketSize = USB_MAX_IPACKET; + /* * Restore device address: */ @@ -1364,7 +1368,15 @@ usb2_req_re_enumerate(struct usb2_device usb2_pause_mtx(mtx, USB_SET_ADDRESS_SETTLE); /* get the device descriptor */ - err = usb2_req_get_device_desc(udev, mtx, &ddesc); + err = usb2_req_get_desc(udev, mtx, &udev->ddesc, + USB_MAX_IPACKET, USB_MAX_IPACKET, 0, UDESC_DEVICE, 0, 0); + if (err) { + DPRINTFN(0, "getting device descriptor " + "at addr %d failed!\n", udev->address); + goto done; + } + /* get the full device descriptor */ + err = usb2_req_get_device_desc(udev, mtx, &udev->ddesc); if (err) { DPRINTFN(0, "addr=%d, getting device " "descriptor failed!\n", old_addr); Modified: head/sys/dev/usb2/ethernet/if_aue2.c ============================================================================== --- head/sys/dev/usb2/ethernet/if_aue2.c Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/ethernet/if_aue2.c Tue Nov 25 08:04:40 2008 (r185290) @@ -736,6 +736,17 @@ aue_probe(device_t dev) if (uaa->info.bIfaceIndex != AUE_IFACE_IDX) { return (ENXIO); } + /* + * Belkin USB Bluetooth dongles of the F8T012xx1 model series + * conflict with older Belkin USB2LAN adapters. Skip if_aue if + * we detect one of the devices that look like Bluetooth + * adapters. + */ + if ((uaa->info.idVendor == USB_VENDOR_BELKIN) && + (uaa->info.idProduct == USB_PRODUCT_BELKIN_F8T012) && + (uaa->info.bcdDevice == 0x0413)) { + return (ENXIO); + } return (usb2_lookup_id_by_uaa(aue_devs, sizeof(aue_devs), uaa)); } Modified: head/sys/dev/usb2/include/usb2_devid.h ============================================================================== --- head/sys/dev/usb2/include/usb2_devid.h Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/include/usb2_devid.h Tue Nov 25 08:04:40 2008 (r185290) @@ -4,7 +4,7 @@ * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * FreeBSD: src/sys/dev/usb/usbdevs,v 1.381 2008/11/02 03:00:36 imp Exp + * FreeBSD: src/sys/dev/usb/usbdevs,v 1.383 2008/11/12 13:58:59 keramida Exp */ /* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */ @@ -939,6 +939,7 @@ #define USB_PRODUCT_BELKIN_F5U103 0x0103 /* F5U103 Serial */ #define USB_PRODUCT_BELKIN_F5U109 0x0109 /* F5U109 Serial */ #define USB_PRODUCT_BELKIN_USB2SCSI 0x0115 /* USB to SCSI */ +#define USB_PRODUCT_BELKIN_F8T012 0x0121 /* F8T012xx1 Bluetooth USB Adapter */ #define USB_PRODUCT_BELKIN_USB2LAN 0x0121 /* USB to LAN */ #define USB_PRODUCT_BELKIN_F5U208 0x0208 /* F5U208 VideoBus II */ #define USB_PRODUCT_BELKIN_F5U237 0x0237 /* F5U237 USB 2.0 7-Port Hub */ @@ -1709,6 +1710,7 @@ #define USB_PRODUCT_MICROSOFT_MN110 0x007a /* 10/100 USB NIC */ #define USB_PRODUCT_MICROSOFT_WLINTELLIMOUSE 0x008c /* Wireless Optical IntelliMouse */ #define USB_PRODUCT_MICROSOFT_WLNOTEBOOK 0x00b9 /* Wireless Optical Mouse (Model 1023) */ +#define USB_PRODUCT_MICROSOFT_COMFORT3000 0x00d1 /* Comfort Optical Mouse 3000 (Model 1043) */ #define USB_PRODUCT_MICROSOFT_WLNOTEBOOK2 0x00e1 /* Wireless Optical Mouse 3000 (Model 1056) */ #define USB_PRODUCT_MICROSOFT_WLNOTEBOOK3 0x00d2 /* Wireless Optical Mouse 3000 (Model 1049) */ #define USB_PRODUCT_MICROSOFT_WLUSBMOUSE 0x00b9 /* Wireless USB Mouse */ Modified: head/sys/dev/usb2/include/usb2_devtable.h ============================================================================== --- head/sys/dev/usb2/include/usb2_devtable.h Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/include/usb2_devtable.h Tue Nov 25 08:04:40 2008 (r185290) @@ -4,7 +4,7 @@ * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * FreeBSD: src/sys/dev/usb/usbdevs,v 1.381 2008/11/02 03:00:36 imp Exp + * FreeBSD: src/sys/dev/usb/usbdevs,v 1.383 2008/11/12 13:58:59 keramida Exp */ /* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */ @@ -1097,6 +1097,12 @@ const struct usb_knowndev usb_knowndevs[ "USB to SCSI", }, { + USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F8T012, + 0, + "Belkin Components", + "F8T012xx1 Bluetooth USB Adapter", + }, + { USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_USB2LAN, 0, "Belkin Components", @@ -4223,6 +4229,12 @@ const struct usb_knowndev usb_knowndevs[ "Wireless Optical Mouse (Model 1023)", }, { + USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_COMFORT3000, + 0, + "Microsoft", + "Comfort Optical Mouse 3000 (Model 1043)", + }, + { USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_WLNOTEBOOK2, 0, "Microsoft", Modified: head/sys/dev/usb2/include/usb2_standard.h ============================================================================== --- head/sys/dev/usb2/include/usb2_standard.h Tue Nov 25 07:17:11 2008 (r185289) +++ head/sys/dev/usb2/include/usb2_standard.h Tue Nov 25 08:04:40 2008 (r185290) @@ -26,6 +26,16 @@ * SUCH DAMAGE. */ +/* + * This file contains standard definitions for the following USB + * protocol versions: + * + * USB v1.0 + * USB v1.1 + * USB v2.0 + * USB v3.0 + */ + #ifndef _USB2_STANDARD_H_ #define _USB2_STANDARD_H_ @@ -133,26 +143,32 @@ struct usb2_device_request { #define UDESC_DEVICE 0x01 #define UDESC_CONFIG 0x02 #define UDESC_STRING 0x03 -#define USB_LANGUAGE_TABLE 0x00 /* Index of the language ID table - * string */ -#define UDESC_INTERFACE 0x04 +#define USB_LANGUAGE_TABLE 0x00 /* language ID string index */ +#define UDESC_INTERFACE 0x04 #define UDESC_ENDPOINT 0x05 #define UDESC_DEVICE_QUALIFIER 0x06 #define UDESC_OTHER_SPEED_CONFIGURATION 0x07 #define UDESC_INTERFACE_POWER 0x08 #define UDESC_OTG 0x09 -#define UDESC_CS_DEVICE 0x21 /* class specific */ -#define UDESC_CS_CONFIG 0x22 -#define UDESC_CS_STRING 0x23 +#define UDESC_DEBUG 0x0A +#define UDESC_IFACE_ASSOC 0x0B /* interface association */ +#define UDESC_BOS 0x0F /* binary object store */ +#define UDESC_DEVICE_CAPABILITY 0x10 +#define UDESC_CS_DEVICE 0x21 /* class specific */ +#define UDESC_CS_CONFIG 0x22 +#define UDESC_CS_STRING 0x23 #define UDESC_CS_INTERFACE 0x24 #define UDESC_CS_ENDPOINT 0x25 #define UDESC_HUB 0x29 +#define UDESC_ENDPOINT_SS_COMP 0x30 /* super speed */ #define UR_SET_DESCRIPTOR 0x07 #define UR_GET_CONFIG 0x08 #define UR_SET_CONFIG 0x09 #define UR_GET_INTERFACE 0x0a #define UR_SET_INTERFACE 0x0b #define UR_SYNCH_FRAME 0x0c +#define UR_SET_SEL 0x30 +#define UR_ISOCH_DELAY 0x31 /* HUB specific request */ #define UR_GET_BUS_STATE 0x02 @@ -160,11 +176,16 @@ struct usb2_device_request { #define UR_RESET_TT 0x09 #define UR_GET_TT_STATE 0x0a #define UR_STOP_TT 0x0b +#define UR_SET_HUB_DEPTH 0x0c +#define UR_GET_PORT_ERR_COUNT 0x0d /* Feature numbers */ #define UF_ENDPOINT_HALT 0 #define UF_DEVICE_REMOTE_WAKEUP 1 #define UF_TEST_MODE 2 +#define UF_U1_ENABLE 0x30 +#define UF_U2_ENABLE 0x31 +#define UF_LTM_ENABLE 0x32 /* HUB specific features */ #define UHF_C_HUB_LOCAL_POWER 0 @@ -174,6 +195,7 @@ struct usb2_device_request { #define UHF_PORT_SUSPEND 2 #define UHF_PORT_OVER_CURRENT 3 #define UHF_PORT_RESET 4 +#define UHF_PORT_LINK_STATE 5 #define UHF_PORT_POWER 8 #define UHF_PORT_LOW_SPEED 9 #define UHF_C_PORT_CONNECTION 16 @@ -184,6 +206,16 @@ struct usb2_device_request { #define UHF_PORT_TEST 21 #define UHF_PORT_INDICATOR 22 +/* SuperSpeed HUB specific features */ +#define UHF_PORT_U1_TIMEOUT 23 +#define UHF_PORT_U2_TIMEOUT 24 +#define UHF_C_PORT_LINK_STATE 25 +#define UHF_C_PORT_CONFIG_ERROR 26 +#define UHF_PORT_REMOTE_WAKE_MASK 27 +#define UHF_BH_PORT_RESET 28 +#define UHF_C_BH_PORT_RESET 29 +#define UHF_FORCE_LINKPM_ACCEPT 30 + struct usb2_descriptor { uByte bLength; uByte bDescriptorType; @@ -195,7 +227,9 @@ struct usb2_device_descriptor { uByte bDescriptorType; uWord bcdUSB; #define UD_USB_2_0 0x0200 -#define UD_IS_USB2(d) (UGETW((d)->bcdUSB) >= UD_USB_2_0) +#define UD_USB_3_0 0x0300 +#define UD_IS_USB2(d) ((d)->bcdUSB[1] == 0x02) +#define UD_IS_USB3(d) ((d)->bcdUSB[1] == 0x03) uByte bDeviceClass; uByte bDeviceSubClass; uByte bDeviceProtocol; @@ -210,6 +244,54 @@ struct usb2_device_descriptor { uByte bNumConfigurations; } __packed; +/* Binary Device Object Store (BOS) */ +struct usb2_bos_descriptor { + uByte bLength; + uByte bDescriptorType; + uWord wTotalLength; + uByte bNumDeviceCaps; +} __packed; + +/* Binary Device Object Store Capability */ +struct usb2_bos_cap_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bDevCapabilityType; +#define USB_DEVCAP_RESERVED 0x00 +#define USB_DEVCAP_WUSB 0x01 +#define USB_DEVCAP_USB2EXT 0x02 +#define USB_DEVCAP_SUPER_SPEED 0x03 +#define USB_DEVCAP_CONTAINER_ID 0x04 + /* data ... */ +} __packed; + +struct usb2_devcap_usb2ext_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bDevCapabilityType; + uByte bmAttributes; +#define USB_V2EXT_LPM 0x02 +} __packed; + +struct usb2_devcap_ss_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bDevCapabilityType; + uByte bmAttributes; + uWord wSpeedsSupported; + uByte bFunctionaltySupport; + uByte bU1DevExitLat; + uByte bU2DevExitLat; +} __packed; + +struct usb2_devcap_container_id_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bDevCapabilityType; + uByte bReserved; + uByte ContainerID; +} __packed; + /* Device class codes */ #define UDCLASS_IN_INTERFACE 0x00 #define UDCLASS_COMM 0x02 @@ -252,6 +334,17 @@ struct usb2_interface_descriptor { uByte iInterface; } __packed; +struct usb2_interface_assoc_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bFirstInterface; + uByte bInterfaceCount; + uByte bFunctionClass; + uByte bFunctionSubClass; + uByte bFunctionProtocol; + uByte iFunction; +} __packed; + /* Interface class codes */ #define UICLASS_UNSPEC 0x00 #define UICLASS_AUDIO 0x01 /* audio */ @@ -372,6 +465,14 @@ struct usb2_endpoint_descriptor { uByte bInterval; } __packed; +struct usb2_endpoint_ss_comp_descriptor { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 09:17:02 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33C781065673; Tue, 25 Nov 2008 09:17:02 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 211828FC14; Tue, 25 Nov 2008 09:17:02 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP9H1d2014544; Tue, 25 Nov 2008 09:17:01 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP9H1aE014543; Tue, 25 Nov 2008 09:17:01 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811250917.mAP9H1aE014543@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Nov 2008 09:17:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185291 - head/sys/modules/usb2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 09:17:02 -0000 Author: bz Date: Tue Nov 25 09:17:01 2008 New Revision: 185291 URL: http://svn.freebsd.org/changeset/base/185291 Log: Unbreak the build until alfred@ is back to fix it correctly. For now disconnect the nonexistent serial_3g. Modified: head/sys/modules/usb2/Makefile Modified: head/sys/modules/usb2/Makefile ============================================================================== --- head/sys/modules/usb2/Makefile Tue Nov 25 08:04:40 2008 (r185290) +++ head/sys/modules/usb2/Makefile Tue Nov 25 09:17:01 2008 (r185291) @@ -57,7 +57,7 @@ SUBDIR += ndis SUBDIR += quirk SUBDIR += scanner SUBDIR += serial -SUBDIR += serial_3g +#SUBDIR += serial_3g SUBDIR += serial_ark SUBDIR += serial_bsa SUBDIR += serial_bser From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 09:49:06 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56864106564A; Tue, 25 Nov 2008 09:49:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 442498FC1C; Tue, 25 Nov 2008 09:49:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAP9n6XM015163; Tue, 25 Nov 2008 09:49:06 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAP9n6wl015162; Tue, 25 Nov 2008 09:49:06 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811250949.mAP9n6wl015162@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Nov 2008 09:49:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185292 - head/sys/netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 09:49:06 -0000 Author: bz Date: Tue Nov 25 09:49:05 2008 New Revision: 185292 URL: http://svn.freebsd.org/changeset/base/185292 Log: Unbreak the build without INET6. Modified: head/sys/netipsec/ipsec.c Modified: head/sys/netipsec/ipsec.c ============================================================================== --- head/sys/netipsec/ipsec.c Tue Nov 25 09:17:01 2008 (r185291) +++ head/sys/netipsec/ipsec.c Tue Nov 25 09:49:05 2008 (r185292) @@ -270,11 +270,13 @@ ipsec_init(void) V_ipsec_integrity = 0; #endif +#ifdef INET6 V_ip6_esp_trans_deflev = IPSEC_LEVEL_USE; V_ip6_esp_net_deflev = IPSEC_LEVEL_USE; V_ip6_ah_trans_deflev = IPSEC_LEVEL_USE; V_ip6_ah_net_deflev = IPSEC_LEVEL_USE; V_ip6_ipsec_ecn = 0; /* ECN ignore(-1)/forbidden(0)/allowed(1) */ +#endif } /* From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 11:25:45 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD93C1065675; Tue, 25 Nov 2008 11:25:45 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67BF68FC1D; Tue, 25 Nov 2008 11:25:45 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPBPjUD018482; Tue, 25 Nov 2008 11:25:45 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPBPj6B018481; Tue, 25 Nov 2008 11:25:45 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200811251125.mAPBPj6B018481@svn.freebsd.org> From: Robert Watson Date: Tue, 25 Nov 2008 11:25:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185293 - head/sys/security/audit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 11:25:45 -0000 Author: rwatson Date: Tue Nov 25 11:25:45 2008 New Revision: 185293 URL: http://svn.freebsd.org/changeset/base/185293 Log: Regularize /* FALLTHROUGH */ comments in the BSM event type switch, and add one that was missing. MFC after: 3 weeks Coverity ID: 3960 Modified: head/sys/security/audit/audit_bsm.c Modified: head/sys/security/audit/audit_bsm.c ============================================================================== --- head/sys/security/audit/audit_bsm.c Tue Nov 25 09:49:05 2008 (r185292) +++ head/sys/security/audit/audit_bsm.c Tue Nov 25 11:25:45 2008 (r185293) @@ -589,7 +589,7 @@ kaudit_to_bsm(struct kaudit_record *kar, tok = au_to_arg32(1, "cmd", ar->ar_arg_cmd); kau_write(rec, tok); } - /* fall thru */ + /* FALLTHROUGH */ case AUE_AUDITON_GETCAR: case AUE_AUDITON_GETCLASS: @@ -662,7 +662,8 @@ kaudit_to_bsm(struct kaudit_record *kar, tok = au_to_arg32(2, "mode", ar->ar_arg_mode); kau_write(rec, tok); } - /* fall through */ + /* FALLTHROUGH */ + case AUE_ACCESS: case AUE_CHDIR: case AUE_CHROOT: @@ -877,7 +878,8 @@ kaudit_to_bsm(struct kaudit_record *kar, tok = au_to_arg32(1, "flags", ar->ar_arg_fflags); kau_write(rec, tok); } - /* fall through */ + /* FALLTHROUGH */ + case AUE_FORK: case AUE_VFORK: if (ARG_IS_VALID(kar, ARG_PID)) { @@ -1013,7 +1015,7 @@ kaudit_to_bsm(struct kaudit_record *kar, tok = au_to_text(ar->ar_arg_text); kau_write(rec, tok); } - /* fall through */ + /* FALLTHROUGH */ case AUE_UMOUNT: UPATH1_VNODE1_TOKENS; @@ -1062,7 +1064,7 @@ kaudit_to_bsm(struct kaudit_record *kar, tok = au_to_arg32(3, "mode", ar->ar_arg_mode); kau_write(rec, tok); } - /* fall through */ + /* FALLTHROUGH */ case AUE_OPEN_R: case AUE_OPEN_RT: @@ -1339,6 +1341,8 @@ kaudit_to_bsm(struct kaudit_record *kar, tok = au_to_arg32(3, "mode", ar->ar_arg_mode); kau_write(rec, tok); } + /* FALLTHROUGH */ + case AUE_SHMUNLINK: if (ARG_IS_VALID(kar, ARG_TEXT)) { tok = au_to_text(ar->ar_arg_text); @@ -1372,7 +1376,7 @@ kaudit_to_bsm(struct kaudit_record *kar, tok = au_to_arg32(4, "value", ar->ar_arg_value); kau_write(rec, tok); } - /* fall through */ + /* FALLTHROUGH */ case AUE_SEMUNLINK: if (ARG_IS_VALID(kar, ARG_TEXT)) { From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 13:35:07 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDD501065672; Tue, 25 Nov 2008 13:35:06 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E07808FC08; Tue, 25 Nov 2008 13:35:06 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPDZ6M8023856; Tue, 25 Nov 2008 13:35:06 GMT (envelope-from takawata@svn.freebsd.org) Received: (from takawata@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPDZ66r023855; Tue, 25 Nov 2008 13:35:06 GMT (envelope-from takawata@svn.freebsd.org) Message-Id: <200811251335.mAPDZ66r023855@svn.freebsd.org> From: Takanori Watanabe Date: Tue, 25 Nov 2008 13:35:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185295 - head/sys/i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 13:35:07 -0000 Author: takawata Date: Tue Nov 25 13:35:06 2008 New Revision: 185295 URL: http://svn.freebsd.org/changeset/base/185295 Log: Core i7 supports invaliant TSC and the presense is presented on this CPUID information, according to recently updated AP485. Modified: head/sys/i386/i386/identcpu.c Modified: head/sys/i386/i386/identcpu.c ============================================================================== --- head/sys/i386/i386/identcpu.c Tue Nov 25 13:33:18 2008 (r185294) +++ head/sys/i386/i386/identcpu.c Tue Nov 25 13:35:06 2008 (r185295) @@ -846,7 +846,8 @@ printcpuinfo(void) * mention the capability. */ if (!tsc_is_invariant && - (strcmp(cpu_vendor, "AuthenticAMD") == 0 && + ((strcmp(cpu_vendor, "AuthenticAMD") == 0 || + (strcmp(cpu_vendor, "GenuineIntel") == 0))&& ((amd_pminfo & AMDPM_TSC_INVARIANT) != 0 || I386_CPU_FAMILY(cpu_id) >= 0x10 || cpu_id == 0x60fb2))) { From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 15:36:15 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82B4A1065675; Tue, 25 Nov 2008 15:36:15 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77CCE8FC1B; Tue, 25 Nov 2008 15:36:15 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPFaFQF027421; Tue, 25 Nov 2008 15:36:15 GMT (envelope-from marcus@svn.freebsd.org) Received: (from marcus@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPFaFJp027420; Tue, 25 Nov 2008 15:36:15 GMT (envelope-from marcus@svn.freebsd.org) Message-Id: <200811251536.mAPFaFJp027420@svn.freebsd.org> From: Joe Marcus Clarke Date: Tue, 25 Nov 2008 15:36:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185298 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 15:36:15 -0000 Author: marcus (doc,ports committer) Date: Tue Nov 25 15:36:15 2008 New Revision: 185298 URL: http://svn.freebsd.org/changeset/base/185298 Log: Move vn_fullpath1() outside of FILEDESC locking. This is being done in advance of teaching vn_fullpath1() how to query file systems for vnode-to-name mappings when cache lookups fail. Thanks to kib for guidance and patience on this process. Reviewed by: kib Approved by: kib Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Tue Nov 25 14:14:58 2008 (r185297) +++ head/sys/kern/vfs_cache.c Tue Nov 25 15:36:15 2008 (r185298) @@ -716,7 +716,8 @@ kern___getcwd(struct thread *td, u_char { char *bp, *tmpbuf; struct filedesc *fdp; - int error; + struct vnode *cdir, *rdir; + int error, vfslocked; if (disablecwd) return (ENODEV); @@ -728,9 +729,18 @@ kern___getcwd(struct thread *td, u_char tmpbuf = malloc(buflen, M_TEMP, M_WAITOK); fdp = td->td_proc->p_fd; FILEDESC_SLOCK(fdp); - error = vn_fullpath1(td, fdp->fd_cdir, fdp->fd_rdir, tmpbuf, - &bp, buflen); + cdir = fdp->fd_cdir; + VREF(cdir); + rdir = fdp->fd_rdir; + VREF(rdir); FILEDESC_SUNLOCK(fdp); + error = vn_fullpath1(td, cdir, rdir, tmpbuf, &bp, buflen); + vfslocked = VFS_LOCK_GIANT(rdir->v_mount); + vrele(rdir); + VFS_UNLOCK_GIANT(vfslocked); + vfslocked = VFS_LOCK_GIANT(cdir->v_mount); + vrele(cdir); + VFS_UNLOCK_GIANT(vfslocked); if (!error) { if (bufseg == UIO_SYSSPACE) @@ -771,7 +781,8 @@ vn_fullpath(struct thread *td, struct vn { char *buf; struct filedesc *fdp; - int error; + struct vnode *rdir; + int error, vfslocked; if (disablefullpath) return (ENODEV); @@ -781,8 +792,13 @@ vn_fullpath(struct thread *td, struct vn buf = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); fdp = td->td_proc->p_fd; FILEDESC_SLOCK(fdp); - error = vn_fullpath1(td, vn, fdp->fd_rdir, buf, retbuf, MAXPATHLEN); + rdir = fdp->fd_rdir; + VREF(rdir); FILEDESC_SUNLOCK(fdp); + error = vn_fullpath1(td, vn, rdir, buf, retbuf, MAXPATHLEN); + vfslocked = VFS_LOCK_GIANT(rdir->v_mount); + vrele(rdir); + VFS_UNLOCK_GIANT(vfslocked); if (!error) *freebuf = buf; From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 16:11:41 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A121A1065672; Tue, 25 Nov 2008 16:11:41 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96FA98FC13; Tue, 25 Nov 2008 16:11:41 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPGBf6a028237; Tue, 25 Nov 2008 16:11:41 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPGBftx028236; Tue, 25 Nov 2008 16:11:41 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200811251611.mAPGBftx028236@svn.freebsd.org> From: Doug Rabson Date: Tue, 25 Nov 2008 16:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185299 - head/sys/modules/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 16:11:41 -0000 Author: dfr Date: Tue Nov 25 16:11:41 2008 New Revision: 185299 URL: http://svn.freebsd.org/changeset/base/185299 Log: Fix standalone module build by generating opt_kgssapi.h. Submitted by: n_hibma Modified: head/sys/modules/nfsserver/Makefile Modified: head/sys/modules/nfsserver/Makefile ============================================================================== --- head/sys/modules/nfsserver/Makefile Tue Nov 25 15:36:15 2008 (r185298) +++ head/sys/modules/nfsserver/Makefile Tue Nov 25 16:11:41 2008 (r185299) @@ -6,6 +6,7 @@ SRCS= vnode_if.h \ nfs_fha.c nfs_serv.c nfs_srvkrpc.c nfs_srvsock.c nfs_srvcache.c \ nfs_srvsubs.c nfs_syscalls.c nfs_common.c \ opt_mac.h \ + opt_kgssapi.h \ opt_nfs.h SRCS+= opt_inet6.h From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 16:38:10 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD8A41065673; Tue, 25 Nov 2008 16:38:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A9618FC25; Tue, 25 Nov 2008 16:38:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPGcAV9028767; Tue, 25 Nov 2008 16:38:10 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPGcAp1028766; Tue, 25 Nov 2008 16:38:10 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811251638.mAPGcAp1028766@svn.freebsd.org> From: Warner Losh Date: Tue, 25 Nov 2008 16:38:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185300 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 16:38:10 -0000 Author: imp Date: Tue Nov 25 16:38:10 2008 New Revision: 185300 URL: http://svn.freebsd.org/changeset/base/185300 Log: Whitespace nit. Modified: head/sys/arm/at91/std.at91 Modified: head/sys/arm/at91/std.at91 ============================================================================== --- head/sys/arm/at91/std.at91 Tue Nov 25 16:11:41 2008 (r185299) +++ head/sys/arm/at91/std.at91 Tue Nov 25 16:38:10 2008 (r185300) @@ -1,6 +1,6 @@ # $FreeBSD$ files "../at91/files.at91" -cpu CPU_ARM9 +cpu CPU_ARM9 makeoptions CONF_CFLAGS=-mcpu=arm9 -options PHYSADDR=0x20000000 +options PHYSADDR=0x20000000 From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 17:27:11 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D082C1065670; Tue, 25 Nov 2008 17:27:11 +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 C5D838FC16; Tue, 25 Nov 2008 17:27:11 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPHRBtT029759; Tue, 25 Nov 2008 17:27:11 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPHRBNt029758; Tue, 25 Nov 2008 17:27:11 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811251727.mAPHRBNt029758@svn.freebsd.org> From: Ken Smith Date: Tue, 25 Nov 2008 17:27:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185301 - stable/7/release X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 17:27:12 -0000 Author: kensmith Date: Tue Nov 25 17:27:11 2008 New Revision: 185301 URL: http://svn.freebsd.org/changeset/base/185301 Log: With the branch for 7.1 done start bumping misc. version numbers from 7.0 to 7.1. Approved by: re (implicit) Modified: stable/7/release/Makefile Modified: stable/7/release/Makefile ============================================================================== --- stable/7/release/Makefile Tue Nov 25 16:38:10 2008 (r185300) +++ stable/7/release/Makefile Tue Nov 25 17:27:11 2008 (r185301) @@ -18,11 +18,11 @@ # Set these, release builder! # # Fixed version: -#BUILDNAME=7.0-STABLE +#BUILDNAME=7.1-STABLE # # Automatic SNAP versioning: DATE != date +%Y%m%d -BASE = 7.0 +BASE = 7.1 BUILDNAME?=${BASE}-${DATE}-SNAP # #CHROOTDIR=/junk/release From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 17:31:45 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92DB5106567A; Tue, 25 Nov 2008 17:31:45 +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 8833A8FC17; Tue, 25 Nov 2008 17:31:45 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPHVjpX029889; Tue, 25 Nov 2008 17:31:45 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPHVjLB029888; Tue, 25 Nov 2008 17:31:45 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811251731.mAPHVjLB029888@svn.freebsd.org> From: Ken Smith Date: Tue, 25 Nov 2008 17:31: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: r185302 - stable/7/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 17:31:45 -0000 Author: kensmith Date: Tue Nov 25 17:31:45 2008 New Revision: 185302 URL: http://svn.freebsd.org/changeset/base/185302 Log: Bump __FreeBSD_version for 7.1. Approved by: re (implicit) Modified: stable/7/sys/sys/param.h Modified: stable/7/sys/sys/param.h ============================================================================== --- stable/7/sys/sys/param.h Tue Nov 25 17:27:11 2008 (r185301) +++ stable/7/sys/sys/param.h Tue Nov 25 17:31:45 2008 (r185302) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 700112 /* Master, propagated to newvers */ +#define __FreeBSD_version 701100 /* Master, propagated to newvers */ #ifndef LOCORE #include From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 17:34:36 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5156B106564A; Tue, 25 Nov 2008 17:34:36 +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 46B1C8FC12; Tue, 25 Nov 2008 17:34:36 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPHYa1n029999; Tue, 25 Nov 2008 17:34:36 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPHYabD029998; Tue, 25 Nov 2008 17:34:36 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811251734.mAPHYabD029998@svn.freebsd.org> From: Ken Smith Date: Tue, 25 Nov 2008 17:34: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: r185303 - stable/7/usr.sbin/pkg_install/add X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 17:34:36 -0000 Author: kensmith Date: Tue Nov 25 17:34:36 2008 New Revision: 185303 URL: http://svn.freebsd.org/changeset/base/185303 Log: Add FreeBSD_version and package directory for 7.1. Approved by: re (implicit) Modified: stable/7/usr.sbin/pkg_install/add/main.c Modified: stable/7/usr.sbin/pkg_install/add/main.c ============================================================================== --- stable/7/usr.sbin/pkg_install/add/main.c Tue Nov 25 17:31:45 2008 (r185302) +++ stable/7/usr.sbin/pkg_install/add/main.c Tue Nov 25 17:34:36 2008 (r185303) @@ -79,6 +79,7 @@ struct { { 602000, 602099, "/packages-6.2-release" }, { 603000, 603099, "/packages-6.3-release" }, { 700000, 700099, "/packages-7.0-release" }, + { 701000, 701099, "/packages-7.1-release" }, { 300000, 399000, "/packages-3-stable" }, { 400000, 499000, "/packages-4-stable" }, { 502100, 502128, "/packages-5-current" }, From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 17:41:35 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B17FC1065672; Tue, 25 Nov 2008 17:41:35 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (farley.org [67.64.95.201]) by mx1.freebsd.org (Postfix) with ESMTP id 7D9828FC20; Tue, 25 Nov 2008 17:41:35 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from thor.farley.org (HPooka@thor.farley.org [192.168.1.5]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id mAPHQx9C020676; Tue, 25 Nov 2008 11:26:59 -0600 (CST) (envelope-from scf@FreeBSD.org) Date: Tue, 25 Nov 2008 11:26:59 -0600 (CST) From: "Sean C. Farley" To: =?ISO-8859-15?Q?Dag-Erling_Sm=F8rgrav?= In-Reply-To: <86wsetfd36.fsf@ds4.des.no> Message-ID: References: <200811232326.mANNQCLp067323@svn.freebsd.org> <86wsetfd36.fsf@ds4.des.no> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="56599777-309033472-1227634019=:3927" X-Spam-Status: No, score=-4.4 required=3.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185237 - head/lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 17:41:35 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --56599777-309033472-1227634019=:3927 Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT On Mon, 24 Nov 2008, Dag-Erling Smørgrav wrote: > Sean Farley writes: >> Log: >> Fixed style issues with variable ordering and naming, spacing and >> parentheses. >> >> Fixed alignment issue in gr_dup() in its assignment of gr_mem using a >> struct to force alignment without performing alignment mathematics. This >> was noticed recently with libutil was built with WARNS=6 on platform such >> as sparc64. >> >> Added checks to gr_dup(), gr_equal() and gr_make() to prevent segfaults >> when examining struct group's with the struct members pointing to NULL's. >> >> With fix of alignment issue, restore WARNS?=6. > > Good work, thank you! You are welcome. Thank you too for the help on the alignment issue and plethora of style questions. :) Sean -- scf@FreeBSD.org --56599777-309033472-1227634019=:3927-- From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 18:29:34 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 272A0106564A; Tue, 25 Nov 2008 18:29:34 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1ABC58FC16; Tue, 25 Nov 2008 18:29:34 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPITYeY031166; Tue, 25 Nov 2008 18:29:34 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPITYCm031163; Tue, 25 Nov 2008 18:29:34 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200811251829.mAPITYCm031163@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 25 Nov 2008 18:29:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185304 - head/tools/regression/acltools X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 18:29:34 -0000 Author: trasz Date: Tue Nov 25 18:29:33 2008 New Revision: 185304 URL: http://svn.freebsd.org/changeset/base/185304 Log: Add tools-level test for POSIX.1e functionality. Approved by: rwatson (mentor) Added: head/tools/regression/acltools/ head/tools/regression/acltools/00.t (contents, props changed) head/tools/regression/acltools/run (contents, props changed) head/tools/regression/acltools/tools-posix.test (contents, props changed) Added: head/tools/regression/acltools/00.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/acltools/00.t Tue Nov 25 18:29:33 2008 (r185304) @@ -0,0 +1,62 @@ +#!/bin/sh +# +# This is a wrapper script to run tools-posix.test. +# +# If any of the tests fails, here is how to debug it: go to +# the directory with problematic filesystem mounted on it, +# and do /path/to/test run /path/to/test tools-posix.test, e.g. +# +# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-posix.test +# +# Output should be obvious. +# +# $FreeBSD$ +# + +echo "1..4" + +if [ `whoami` != "root" ]; then + echo "not ok 1 - you need to be root to run this test." + exit 1 +fi + +TESTDIR=`dirname $0` + +# Set up the test filesystem. +MD=`mdconfig -at swap -s 10m` +MNT=`mktemp -dt acltools` +newfs /dev/$MD > /dev/null +mount -o acls /dev/$MD $MNT +if [ $? -ne 0 ]; then + echo "not ok 1 - mount failed." + exit 1 +fi + +echo "ok 1" + +cd $MNT + +# First, check whether we can crash the kernel by creating too many +# entries. For some reason this won't work in the test file. +touch xxx +i=0; +while :; do i=$(($i+1)); setfacl -m u:$i:rwx xxx 2> /dev/null; if [ $? -ne 0 ]; then break; fi; done +chmod 600 xxx +rm xxx +echo "ok 2" + +perl $TESTDIR/run $TESTDIR/tools-posix.test > /dev/null + +if [ $? -eq 0 ]; then + echo "ok 3" +else + echo "not ok 3" +fi + +cd / +umount -f $MNT +rmdir $MNT +mdconfig -du $MD + +echo "ok 4" + Added: head/tools/regression/acltools/run ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/acltools/run Tue Nov 25 18:29:33 2008 (r185304) @@ -0,0 +1,327 @@ +#!/usr/bin/perl -w -U + +# Copyright (c) 2007, 2008 Andreas Gruenbacher. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions, and the following disclaimer, +# without modification, immediately at the beginning of the file. +# 2. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# Alternatively, this software may be distributed under the terms of the +# GNU Public License ("GPL"). +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# +# Possible improvements: +# +# - distinguish stdout and stderr output +# - add environment variable like assignments +# - run up to a specific line +# - resume at a specific line +# + +use strict; +use FileHandle; +use Getopt::Std; +use POSIX qw(isatty setuid getcwd); +use vars qw($opt_l $opt_v); + +no warnings qw(taint); + +$opt_l = ~0; # a really huge number +getopts('l:v'); + +my ($OK, $FAILED) = ("ok", "failed"); +if (isatty(fileno(STDOUT))) { + $OK = "\033[32m" . $OK . "\033[m"; + $FAILED = "\033[31m\033[1m" . $FAILED . "\033[m"; +} + +sub exec_test($$); +sub process_test($$$$); + +my ($prog, $in, $out) = ([], [], []); +my $prog_line = 0; +my ($tests, $failed) = (0,0); +my $lineno; +my $width = ($ENV{COLUMNS} || 80) >> 1; + +for (;;) { + my $line = <>; $lineno++; + if (defined $line) { + # Substitute %VAR and %{VAR} with environment variables. + $line =~ s[%(\w+)][$ENV{$1}]eg; + $line =~ s[%{(\w+)}][$ENV{$1}]eg; + } + if (defined $line) { + if ($line =~ s/^\s*< ?//) { + push @$in, $line; + } elsif ($line =~ s/^\s*> ?//) { + push @$out, $line; + } else { + process_test($prog, $prog_line, $in, $out); + last if $prog_line >= $opt_l; + + $prog = []; + $prog_line = 0; + } + if ($line =~ s/^\s*\$ ?//) { + $prog = [ map { s/\\(.)/$1/g; $_ } split /(? @$result) ? @$out : @$result; + for (my $n=0; $n < $nmax; $n++) { + my $use_re; + if (defined $out->[$n] && $out->[$n] =~ /^~ /) { + $use_re = 1; + $out->[$n] =~ s/^~ //g; + } + + if (!defined($out->[$n]) || !defined($result->[$n]) || + (!$use_re && $result->[$n] ne $out->[$n]) || + ( $use_re && $result->[$n] !~ /^$out->[$n]/)) { + push @good, ($use_re ? '!~' : '!='); + } + else { + push @good, ($use_re ? '=~' : '=='); + } + } + my $good = !(grep /!/, @good); + $tests++; + $failed++ unless $good; + print $good ? $OK : $FAILED, "\n"; + if (!$good || $opt_v) { + for (my $n=0; $n < $nmax; $n++) { + my $l = defined($out->[$n]) ? $out->[$n] : "~"; + chomp $l; + my $r = defined($result->[$n]) ? $result->[$n] : "~"; + chomp $r; + print sprintf("%-" . ($width-3) . "s %s %s\n", + $r, $good[$n], $l); + } + } +} + + +sub su($) { + my ($user) = @_; + + $user ||= "root"; + + my ($login, $pass, $uid, $gid) = getpwnam($user) + or return [ "su: user $user does not exist\n" ]; + my @groups = (); + my $fh = new FileHandle("/etc/group") + or return [ "opening /etc/group: $!\n" ]; + while (<$fh>) { + chomp; + my ($group, $passwd, $gid, $users) = split /:/; + foreach my $u (split /,/, $users) { + push @groups, $gid + if ($user eq $u); + } + } + $fh->close; + + my $groups = join(" ", ($gid, $gid, @groups)); + #print STDERR "[[$groups]]\n"; + $! = 0; # reset errno + $> = 0; + $( = $gid; + $) = $groups; + if ($!) { + return [ "su: $!\n" ]; + } + if ($uid != 0) { + $> = $uid; + #$< = $uid; + if ($!) { + return [ "su: $prog->[1]: $!\n" ]; + } + } + #print STDERR "[($>,$<)($(,$))]"; + return []; +} + + +sub sg($) { + my ($group) = @_; + + my $gid = getgrnam($group) + or return [ "sg: group $group does not exist\n" ]; + my %groups = map { $_ eq $gid ? () : ($_ => 1) } (split /\s/, $)); + + #print STDERR "<<", join("/", keys %groups), ">>\n"; + my $groups = join(" ", ($gid, $gid, keys %groups)); + #print STDERR "[[$groups]]\n"; + $! = 0; # reset errno + if ($> != 0) { + my $uid = $>; + $> = 0; + $( = $gid; + $) = $groups; + $> = $uid; + } else { + $( = $gid; + $) = $groups; + } + if ($!) { + return [ "sg: $!\n" ]; + } + print STDERR "[($>,$<)($(,$))]"; + return []; +} + + +sub exec_test($$) { + my ($prog, $in) = @_; + local (*IN, *IN_DUP, *IN2, *OUT_DUP, *OUT, *OUT2); + my $needs_shell = (join('', @$prog) =~ /[][|<>"'`\$\*\?]/); + + if ($prog->[0] eq "umask") { + umask oct $prog->[1]; + return []; + } elsif ($prog->[0] eq "cd") { + if (!chdir $prog->[1]) { + return [ "chdir: $prog->[1]: $!\n" ]; + } + $ENV{PWD} = getcwd; + return []; + } elsif ($prog->[0] eq "su") { + return su($prog->[1]); + } elsif ($prog->[0] eq "sg") { + return sg($prog->[1]); + } elsif ($prog->[0] eq "export") { + my ($name, $value) = split /=/, $prog->[1]; + # FIXME: need to evaluate $value, so that things like this will work: + # export dir=$PWD/dir + $ENV{$name} = $value; + return []; + } elsif ($prog->[0] eq "unset") { + delete $ENV{$prog->[1]}; + return []; + } + + pipe *IN2, *OUT + or die "Can't create pipe for reading: $!"; + open *IN_DUP, "<&STDIN" + or *IN_DUP = undef; + open *STDIN, "<&IN2" + or die "Can't duplicate pipe for reading: $!"; + close *IN2; + + open *OUT_DUP, ">&STDOUT" + or die "Can't duplicate STDOUT: $!"; + pipe *IN, *OUT2 + or die "Can't create pipe for writing: $!"; + open *STDOUT, ">&OUT2" + or die "Can't duplicate pipe for writing: $!"; + close *OUT2; + + *STDOUT->autoflush(); + *OUT->autoflush(); + + if (fork()) { + # Server + if (*IN_DUP) { + open *STDIN, "<&IN_DUP" + or die "Can't duplicate STDIN: $!"; + close *IN_DUP + or die "Can't close STDIN duplicate: $!"; + } + open *STDOUT, ">&OUT_DUP" + or die "Can't duplicate STDOUT: $!"; + close *OUT_DUP + or die "Can't close STDOUT duplicate: $!"; + + foreach my $line (@$in) { + #print "> $line"; + print OUT $line; + } + close *OUT + or die "Can't close pipe for writing: $!"; + + my $result = []; + while () { + #print "< $_"; + if ($needs_shell) { + s#^/bin/sh: line \d+: ##; + } + push @$result, $_; + } + return $result; + } else { + # Client + $< = $>; + close IN + or die "Can't close read end for input pipe: $!"; + close OUT + or die "Can't close write end for output pipe: $!"; + close OUT_DUP + or die "Can't close STDOUT duplicate: $!"; + local *ERR_DUP; + open ERR_DUP, ">&STDERR" + or die "Can't duplicate STDERR: $!"; + open STDERR, ">&STDOUT" + or die "Can't join STDOUT and STDERR: $!"; + + if ($needs_shell) { + exec ('/bin/sh', '-c', join(" ", @$prog)); + } else { + exec @$prog; + } + print STDERR $prog->[0], ": $!\n"; + exit; + } +} + Added: head/tools/regression/acltools/tools-posix.test ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/acltools/tools-posix.test Tue Nov 25 18:29:33 2008 (r185304) @@ -0,0 +1,243 @@ +# This is a tools-level test for POSIX.1e ACL functionality. Run it as root +# using ACL-enabled kernel: +# +# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-posix.test +# +# WARNING: Creates files in unsafe way. +# +# $FreeBSD$ + +$ whoami +> root +$ umask 022 + +# Smoke test for getfacl(1). +$ touch xxx +$ getfacl xxx +> # file: xxx +> # owner: root +> # group: wheel +> user::rw- +> group::r-- +> other::r-- + +$ getfacl -q xxx +> user::rw- +> group::r-- +> other::r-- + +$ setfacl -m u:42:r,g:43:w xxx +$ getfacl xxx +> # file: xxx +> # owner: root +> # group: wheel +> user::rw- +> user:42:r-- +> group::r-- +> group:43:-w- +> mask::rw- +> other::r-- + +# Check whether ls correctly marks files with "+". +$ ls -l xxx | cut -d' ' -f1 +> -rw-rw-r--+ + +# Test removing entries. +$ setfacl -x user:42: xxx +$ getfacl xxx +> # file: xxx +> # owner: root +> # group: wheel +> user::rw- +> group::r-- +> group:43:-w- +> mask::rw- +> other::r-- + +$ setfacl -m g:43:r xxx +$ getfacl xxx +> # file: xxx +> # owner: root +> # group: wheel +> user::rw- +> group::r-- +> group:43:r-- +> mask::r-- +> other::r-- + +# Make sure cp without any flags does not copy the ACL. +$ cp xxx yyy +$ ls -l yyy | cut -d' ' -f1 +> -rw-r--r-- + +# Make sure it does with the "-p" flag. +$ rm yyy +$ cp -p xxx yyy +$ getfacl yyy +> # file: yyy +> # owner: root +> # group: wheel +> user::rw- +> group::r-- +> group:43:r-- +> mask::r-- +> other::r-- + +$ rm yyy + +# Test removing entries by... by example? +$ setfacl -m u:42:r,g:43:w xxx +$ setfacl -x u:42: xxx +$ getfacl xxx +> # file: xxx +> # owner: root +> # group: wheel +> user::rw- +> group::r-- +> group:43:-w- +> mask::rw- +> other::r-- + +# Test setfacl -b. +$ setfacl -b xxx +$ getfacl xxx +> # file: xxx +> # owner: root +> # group: wheel +> user::rw- +> group::r-- +> mask::r-- +> other::r-- + +$ ls -l xxx | cut -d' ' -f1 +> -rw-r--r--+ + +$ setfacl -nb xxx +$ getfacl xxx +> # file: xxx +> # owner: root +> # group: wheel +> user::rw- +> group::r-- +> other::r-- + +$ ls -l xxx | cut -d' ' -f1 +> -rw-r--r-- + +# Check setfacl(1) and getfacl(1) with multiple files. +$ touch xxx yyy zzz + +$ ls -l xxx yyy zzz | cut -d' ' -f1 +> -rw-r--r-- +> -rw-r--r-- +> -rw-r--r-- + +$ setfacl -m u:42:x,g:43:w nnn xxx yyy zzz +> setfacl: stat() of nnn failed: No such file or directory + +$ ls -l nnn xxx yyy zzz | cut -d' ' -f1 +> ls: nnn: No such file or directory +> -rw-rwxr--+ +> -rw-rwxr--+ +> -rw-rwxr--+ + +$ getfacl -q nnn xxx yyy zzz +> getfacl: nnn: No such file or directory +> user::rw- +> user:42:--x +> group::r-- +> group:43:-w- +> mask::rwx +> other::r-- +> +> user::rw- +> user:42:--x +> group::r-- +> group:43:-w- +> mask::rwx +> other::r-- +> +> user::rw- +> user:42:--x +> group::r-- +> group:43:-w- +> mask::rwx +> other::r-- + +$ setfacl -b nnn xxx yyy zzz +> setfacl: stat() of nnn failed: No such file or directory + +$ ls -l nnn xxx yyy zzz | cut -d' ' -f1 +> ls: nnn: No such file or directory +> -rw-r--r--+ +> -rw-r--r--+ +> -rw-r--r--+ + +$ rm xxx yyy zzz + +# Check whether chmod actually does what it should do. +$ touch xxx +$ setfacl -m u:42:rwx,g:43:rwx xxx +$ chmod 600 xxx +$ getfacl xxx +> # file: xxx +> # owner: root +> # group: wheel +> user::rw- +> user:42:rwx # effective: --- +> group::r-- # effective: --- +> group:43:rwx # effective: --- +> mask::--- +> other::--- + +$ chmod 060 xxx +$ getfacl xxx +> # file: xxx +> # owner: root +> # group: wheel +> user::--- +> user:42:rwx # effective: rw- +> group::r-- +> group:43:rwx # effective: rw- +> mask::rw- +> other::--- + +# Test default ACLs. +$ umask 022 +$ mkdir ddd +$ getfacl -q ddd +> user::rwx +> group::r-x +> other::r-x + +$ getfacl -dq ddd +$ setfacl -d -m u::rwx,g::rx,o::rx,mask::rwx ddd +$ getfacl -dq ddd +> user::rwx +> group::r-x +> mask::rwx +> other::r-x + +$ setfacl -dm g:42:rwx,u:42:r ddd +$ setfacl -dm g::w ddd +$ getfacl -dq ddd +> user::rwx +> user:42:r-- +> group::-w- +> group:42:rwx +> mask::rwx +> other::r-x + +$ setfacl -dx group:42: ddd +$ getfacl -dq ddd +> user::rwx +> user:42:r-- +> group::-w- +> mask::rw- +> other::r-x + +> # XXX: Test inheritance. + +$ rmdir ddd +$ rm xxx + From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 18:40:40 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91E3D1065670; Tue, 25 Nov 2008 18:40:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84F6D8FC17; Tue, 25 Nov 2008 18:40:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPIeeEa031422; Tue, 25 Nov 2008 18:40:40 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPIeeCH031416; Tue, 25 Nov 2008 18:40:40 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811251840.mAPIeeCH031416@svn.freebsd.org> From: Warner Losh Date: Tue, 25 Nov 2008 18:40:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185305 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 18:40:40 -0000 Author: imp Date: Tue Nov 25 18:40:40 2008 New Revision: 185305 URL: http://svn.freebsd.org/changeset/base/185305 Log: Start to make it easier to add AT91RM9200 based boards: o Copy kb920x_machdep.c to at91_machdep.c o Move board_init to new board_kb920x.c o rename ramsize to at91_ramsize and make it accessible to board_* files. o Delete files.kb920x. We can do this selection with the new boards. o Add a stub for the tsc4370 board init, which will be added in a future commit. o Add new 'devices' at91_board_kb920x and at91_board_tsc4370. More are needed and will be added in future commits. Reviewed by: stass, cognet Added: head/sys/arm/at91/at91_machdep.c (contents, props changed) - copied, changed from r185288, head/sys/arm/at91/kb920x_machdep.c head/sys/arm/at91/at91board.h (contents, props changed) head/sys/arm/at91/board_kb920x.c (contents, props changed) - copied, changed from r185288, head/sys/arm/at91/kb920x_machdep.c Deleted: head/sys/arm/at91/files.kb920x head/sys/arm/at91/kb920x_machdep.c Modified: head/sys/arm/at91/at91var.h head/sys/arm/at91/files.at91 head/sys/arm/at91/std.kb920x Copied and modified: head/sys/arm/at91/at91_machdep.c (from r185288, head/sys/arm/at91/kb920x_machdep.c) ============================================================================== --- head/sys/arm/at91/kb920x_machdep.c Tue Nov 25 05:17:39 2008 (r185288, copy source) +++ head/sys/arm/at91/at91_machdep.c Tue Nov 25 18:40:40 2008 (r185305) @@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -141,7 +142,7 @@ static void *boot_arg2; static struct trapframe proc0_tf; /* Static device mappings. */ -static const struct pmap_devmap kb920x_devmap[] = { +static const struct pmap_devmap at91rm9200_devmap[] = { /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. @@ -187,8 +188,8 @@ static const struct pmap_devmap kb920x_d } }; -static long -ramsize(void) +long +at91_ramsize(void) { uint32_t *SDRAMC = (uint32_t *)(AT91RM92_BASE + AT91RM92_SDRAMC_BASE); uint32_t cr, mr; @@ -203,50 +204,6 @@ ramsize(void) return (1 << (cols + rows + banks + bw)); } -static long -board_init(void) -{ - /* - * Since the USART supports RS-485 multidrop mode, it allows the - * TX pins to float. However, for RS-232 operations, we don't want - * these pins to float. Instead, they should be pulled up to avoid - * mismatches. Linux does something similar when it configures the - * TX lines. This implies that we also allow the RX lines to float - * rather than be in the state they are left in by the boot loader. - * Since they are input pins, I think that this is the right thing - * to do. - */ - - /* PIOA's A periph: Turn USART 0 and 2's TX/RX pins */ - at91_pio_use_periph_a(AT91RM92_PIOA_BASE, - AT91C_PA18_RXD0 | AT91C_PA22_RXD2, 0); - at91_pio_use_periph_a(AT91RM92_PIOA_BASE, - AT91C_PA17_TXD0 | AT91C_PA23_TXD2, 1); - /* PIOA's B periph: Turn USART 3's TX/RX pins */ - at91_pio_use_periph_b(AT91RM92_PIOA_BASE, AT91C_PA6_RXD3, 0); - at91_pio_use_periph_b(AT91RM92_PIOA_BASE, AT91C_PA5_TXD3, 1); -#ifdef AT91_TSC - /* We're using TC0's A1 and A2 input */ - at91_pio_use_periph_b(AT91RM92_PIOA_BASE, - AT91C_PA19_TIOA1 | AT91C_PA21_TIOA2, 0); -#endif - /* PIOB's A periph: Turn USART 1's TX/RX pins */ - at91_pio_use_periph_a(AT91RM92_PIOB_BASE, AT91C_PB21_RXD1, 0); - at91_pio_use_periph_a(AT91RM92_PIOB_BASE, AT91C_PB20_TXD1, 1); - - /* Pin assignment */ -#ifdef AT91_TSC - /* Assert PA24 low -- talk to rubidium */ - at91_pio_use_gpio(AT91RM92_PIOA_BASE, AT91C_PIO_PA24); - at91_pio_gpio_output(AT91RM92_PIOA_BASE, AT91C_PIO_PA24, 0); - at91_pio_gpio_clear(AT91RM92_PIOA_BASE, AT91C_PIO_PA24); - at91_pio_use_gpio(AT91RM92_PIOB_BASE, - AT91C_PIO_PB16 | AT91C_PIO_PB17 | AT91C_PIO_PB18 | AT91C_PIO_PB19); -#endif - - return (ramsize()); -} - void * initarm(void *arg, void *arg2) { @@ -353,7 +310,7 @@ initarm(void *arg, void *arg2) VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); } - pmap_devmap_bootstrap(l1pagetable, kb920x_devmap); + pmap_devmap_bootstrap(l1pagetable, at91rm9200_devmap); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT); setttb(kernel_l1pt.pv_pa); cpu_tlb_flushID(); Added: head/sys/arm/at91/at91board.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/at91/at91board.h Tue Nov 25 18:40:40 2008 (r185305) @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2008 Warner Losh. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $FreeBSD$ */ + +#ifndef _ARM_AT91_AT91BOARD_H_ +#define _ARM_AT91_AT91BOARD_H_ + +/* + * These routines are used by board init routines + */ +long at91_ramsize(void); + +/* + * These routines are expected to be provided by the board files. + */ +long board_init(void); + +#endif /* _ARM_AT91_AT91BOARD_H_ */ Modified: head/sys/arm/at91/at91var.h ============================================================================== --- head/sys/arm/at91/at91var.h Tue Nov 25 18:29:33 2008 (r185304) +++ head/sys/arm/at91/at91var.h Tue Nov 25 18:40:40 2008 (r185305) @@ -43,5 +43,4 @@ struct at91_ivar { struct resource_list resources; }; - #endif /* _AT91VAR_H_ */ Copied and modified: head/sys/arm/at91/board_kb920x.c (from r185288, head/sys/arm/at91/kb920x_machdep.c) ============================================================================== --- head/sys/arm/at91/kb920x_machdep.c Tue Nov 25 05:17:39 2008 (r185288, copy source) +++ head/sys/arm/at91/board_kb920x.c Tue Nov 25 18:40:40 2008 (r185305) @@ -1,9 +1,6 @@ /*- - * Copyright (c) 1994-1998 Mark Brinicombe. - * Copyright (c) 1994 Brini. - * All rights reserved. - * - * This code is derived from software written for Brini by Mark Brinicombe + * Copyright (c) 2005-2008 Olivier Houchard. All rights reserved. + * Copyright (c) 2005-2008 Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -13,197 +10,33 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Brini. - * 4. The name of the company nor the name of the author may be used to - * endorse or promote products derived from this software without specific - * prior written permission. * - * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * RiscBSD kernel project - * - * machdep.c - * - * Machine dependant functions for kernel setup - * - * This file needs a lot of work. - * - * Created : 17/09/94 */ -#include "opt_msgbuf.h" #include "opt_at91.h" #include __FBSDID("$FreeBSD$"); - -#define _ARM32_BUS_DMA_PRIVATE #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include #include #include -#define KERNEL_PT_SYS 0 /* Page table for mapping proc0 zero page */ -#define KERNEL_PT_KERN 1 -#define KERNEL_PT_KERN_NUM 22 -#define KERNEL_PT_AFKERNEL KERNEL_PT_KERN + KERNEL_PT_KERN_NUM /* L2 table for mapping after kernel */ -#define KERNEL_PT_AFKERNEL_NUM 5 - -/* this should be evenly divisable by PAGE_SIZE / L2_TABLE_SIZE_REAL (or 4) */ -#define NUM_KERNEL_PTS (KERNEL_PT_AFKERNEL + KERNEL_PT_AFKERNEL_NUM) - -/* Define various stack sizes in pages */ -#define IRQ_STACK_SIZE 1 -#define ABT_STACK_SIZE 1 -#define UND_STACK_SIZE 1 - -extern u_int data_abort_handler_address; -extern u_int prefetch_abort_handler_address; -extern u_int undefined_handler_address; - -struct pv_addr kernel_pt_table[NUM_KERNEL_PTS]; - -extern void *_end; - -extern int *end; - -struct pcpu __pcpu; -struct pcpu *pcpup = &__pcpu; - -/* Physical and virtual addresses for some global pages */ - -vm_paddr_t phys_avail[10]; -vm_paddr_t dump_avail[4]; -vm_offset_t physical_pages; - -struct pv_addr systempage; -struct pv_addr msgbufpv; -struct pv_addr irqstack; -struct pv_addr undstack; -struct pv_addr abtstack; -struct pv_addr kernelstack; - -static void *boot_arg1; -static void *boot_arg2; - -static struct trapframe proc0_tf; - -/* Static device mappings. */ -static const struct pmap_devmap kb920x_devmap[] = { - /* - * Map the on-board devices VA == PA so that we can access them - * with the MMU on or off. - */ - { - /* - * This at least maps the interrupt controller, the UART - * and the timer. Other devices should use newbus to - * map their memory anyway. - */ - 0xdff00000, - 0xfff00000, - 0x100000, - VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, - }, - /* - * We can't just map the OHCI registers VA == PA, because - * AT91RM92_OHCI_BASE belongs to the userland address space. - * We could just choose a different virtual address, but a better - * solution would probably be to just use pmap_mapdev() to allocate - * KVA, as we don't need the OHCI controller before the vm - * initialization is done. However, the AT91 resource allocation - * system doesn't know how to use pmap_mapdev() yet. - */ - { - /* - * Add the ohci controller, and anything else that might be - * on this chip select for a VA/PA mapping. - */ - AT91RM92_OHCI_BASE, - AT91RM92_OHCI_PA_BASE, - AT91RM92_OHCI_SIZE, - VM_PROT_READ|VM_PROT_WRITE, - PTE_NOCACHE, - }, - { - 0, - 0, - 0, - 0, - 0, - } -}; - -static long -ramsize(void) -{ - uint32_t *SDRAMC = (uint32_t *)(AT91RM92_BASE + AT91RM92_SDRAMC_BASE); - uint32_t cr, mr; - int banks, rows, cols, bw; - - cr = SDRAMC[AT91RM92_SDRAMC_CR / 4]; - mr = SDRAMC[AT91RM92_SDRAMC_MR / 4]; - bw = (mr & AT91RM92_SDRAMC_MR_DBW_16) ? 1 : 2; - banks = (cr & AT91RM92_SDRAMC_CR_NB_4) ? 2 : 1; - rows = ((cr & AT91RM92_SDRAMC_CR_NR_MASK) >> 2) + 11; - cols = (cr & AT91RM92_SDRAMC_CR_NC_MASK) + 8; - return (1 << (cols + rows + banks + bw)); -} - -static long +long board_init(void) { /* @@ -244,200 +77,5 @@ board_init(void) AT91C_PIO_PB16 | AT91C_PIO_PB17 | AT91C_PIO_PB18 | AT91C_PIO_PB19); #endif - return (ramsize()); -} - -void * -initarm(void *arg, void *arg2) -{ - struct pv_addr kernel_l1pt; - int loop, i; - u_int l1pagetable; - vm_offset_t freemempos; - vm_offset_t afterkern; - uint32_t memsize; - vm_offset_t lastaddr; - - boot_arg1 = arg; - boot_arg2 = arg2; - set_cpufuncs(); - lastaddr = fake_preload_metadata(); - pcpu_init(pcpup, 0, sizeof(struct pcpu)); - PCPU_SET(curthread, &thread0); - - freemempos = (lastaddr + PAGE_MASK) & ~PAGE_MASK; - /* Define a macro to simplify memory allocation */ -#define valloc_pages(var, np) \ - alloc_pages((var).pv_va, (np)); \ - (var).pv_pa = (var).pv_va + (KERNPHYSADDR - KERNVIRTADDR); - -#define alloc_pages(var, np) \ - (var) = freemempos; \ - freemempos += (np * PAGE_SIZE); \ - memset((char *)(var), 0, ((np) * PAGE_SIZE)); - - while (((freemempos - L1_TABLE_SIZE) & (L1_TABLE_SIZE - 1)) != 0) - freemempos += PAGE_SIZE; - valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE); - for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) { - if (!(loop % (PAGE_SIZE / L2_TABLE_SIZE_REAL))) { - valloc_pages(kernel_pt_table[loop], - L2_TABLE_SIZE / PAGE_SIZE); - } else { - kernel_pt_table[loop].pv_va = freemempos - - (loop % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) * - L2_TABLE_SIZE_REAL; - kernel_pt_table[loop].pv_pa = - kernel_pt_table[loop].pv_va - KERNVIRTADDR + - KERNPHYSADDR; - } - i++; - } - /* - * Allocate a page for the system page mapped to V0x00000000 - * This page will just contain the system vectors and can be - * shared by all processes. - */ - valloc_pages(systempage, 1); - - /* Allocate stacks for all modes */ - valloc_pages(irqstack, IRQ_STACK_SIZE); - valloc_pages(abtstack, ABT_STACK_SIZE); - valloc_pages(undstack, UND_STACK_SIZE); - valloc_pages(kernelstack, KSTACK_PAGES); - valloc_pages(msgbufpv, round_page(MSGBUF_SIZE) / PAGE_SIZE); - - /* - * Now we start construction of the L1 page table - * We start by mapping the L2 page tables into the L1. - * This means that we can replace L1 mappings later on if necessary - */ - l1pagetable = kernel_l1pt.pv_va; - - /* Map the L2 pages tables in the L1 page table */ - pmap_link_l2pt(l1pagetable, ARM_VECTORS_HIGH, - &kernel_pt_table[KERNEL_PT_SYS]); - for (i = 0; i < KERNEL_PT_KERN_NUM; i++) - pmap_link_l2pt(l1pagetable, KERNBASE + i * L1_S_SIZE, - &kernel_pt_table[KERNEL_PT_KERN + i]); - pmap_map_chunk(l1pagetable, KERNBASE, PHYSADDR, - (((uint32_t)lastaddr - KERNBASE) + PAGE_SIZE) & ~(PAGE_SIZE - 1), - VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - afterkern = round_page((lastaddr + L1_S_SIZE) & ~(L1_S_SIZE - 1)); - for (i = 0; i < KERNEL_PT_AFKERNEL_NUM; i++) { - pmap_link_l2pt(l1pagetable, afterkern + i * L1_S_SIZE, - &kernel_pt_table[KERNEL_PT_AFKERNEL + i]); - } - - /* Map the vector page. */ - pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa, - VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - /* Map the stack pages */ - pmap_map_chunk(l1pagetable, irqstack.pv_va, irqstack.pv_pa, - IRQ_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - pmap_map_chunk(l1pagetable, abtstack.pv_va, abtstack.pv_pa, - ABT_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - pmap_map_chunk(l1pagetable, undstack.pv_va, undstack.pv_pa, - UND_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - pmap_map_chunk(l1pagetable, kernelstack.pv_va, kernelstack.pv_pa, - KSTACK_PAGES * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - - pmap_map_chunk(l1pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa, - L1_TABLE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); - pmap_map_chunk(l1pagetable, msgbufpv.pv_va, msgbufpv.pv_pa, - MSGBUF_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - - for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) { - pmap_map_chunk(l1pagetable, kernel_pt_table[loop].pv_va, - kernel_pt_table[loop].pv_pa, L2_TABLE_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); - } - - pmap_devmap_bootstrap(l1pagetable, kb920x_devmap); - cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT); - setttb(kernel_l1pt.pv_pa); - cpu_tlb_flushID(); - cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)); - cninit(); - memsize = board_init(); - physmem = memsize / PAGE_SIZE; - - /* - * Pages were allocated during the secondary bootstrap for the - * stacks for different CPU modes. - * We must now set the r13 registers in the different CPU modes to - * point to these stacks. - * Since the ARM stacks use STMFD etc. we must set r13 to the top end - * of the stack memory. - */ - cpu_control(CPU_CONTROL_MMU_ENABLE, CPU_CONTROL_MMU_ENABLE); - set_stackptr(PSR_IRQ32_MODE, - irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE); - set_stackptr(PSR_ABT32_MODE, - abtstack.pv_va + ABT_STACK_SIZE * PAGE_SIZE); - set_stackptr(PSR_UND32_MODE, - undstack.pv_va + UND_STACK_SIZE * PAGE_SIZE); - - /* - * We must now clean the cache again.... - * Cleaning may be done by reading new data to displace any - * dirty data in the cache. This will have happened in setttb() - * but since we are boot strapping the addresses used for the read - * may have just been remapped and thus the cache could be out - * of sync. A re-clean after the switch will cure this. - * After booting there are no gross reloations of the kernel thus - * this problem will not occur after initarm(). - */ - cpu_idcache_wbinv_all(); - - /* Set stack for exception handlers */ - - data_abort_handler_address = (u_int)data_abort_handler; - prefetch_abort_handler_address = (u_int)prefetch_abort_handler; - undefined_handler_address = (u_int)undefinedinstruction_bounce; - undefined_init(); - - proc_linkup0(&proc0, &thread0); - thread0.td_kstack = kernelstack.pv_va; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - thread0.td_pcb->pcb_flags = 0; - thread0.td_frame = &proc0_tf; - pcpup->pc_curpcb = thread0.td_pcb; - - arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); - - pmap_curmaxkvaddr = afterkern + L1_S_SIZE * (KERNEL_PT_KERN_NUM - 1); - - /* - * ARM_USE_SMALL_ALLOC uses dump_avail, so it must be filled before - * calling pmap_bootstrap. - */ - dump_avail[0] = PHYSADDR; - dump_avail[1] = PHYSADDR + memsize; - dump_avail[2] = 0; - dump_avail[3] = 0; - - pmap_bootstrap(freemempos, - KERNVIRTADDR + 3 * memsize, - &kernel_l1pt); - msgbufp = (void*)msgbufpv.pv_va; - msgbufinit(msgbufp, MSGBUF_SIZE); - mutex_init(); - - i = 0; -#if PHYSADDR != KERNPHYSADDR - phys_avail[i++] = PHYSADDR; - phys_avail[i++] = KERNPHYSADDR; -#endif - phys_avail[i++] = virtual_avail - KERNVIRTADDR + KERNPHYSADDR; - phys_avail[i++] = PHYSADDR + memsize; - phys_avail[i++] = 0; - phys_avail[i++] = 0; - /* Do basic tuning, hz etc */ - init_param1(); - init_param2(physmem); - kdb_init(); - return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - - sizeof(struct pcb))); + return (at91_ramsize()); } Modified: head/sys/arm/at91/files.at91 ============================================================================== --- head/sys/arm/at91/files.at91 Tue Nov 25 18:29:33 2008 (r185304) +++ head/sys/arm/at91/files.at91 Tue Nov 25 18:40:40 2008 (r185305) @@ -1,6 +1,7 @@ # $FreeBSD$ arm/arm/cpufunc_asm_arm9.S standard arm/arm/irq_dispatch.S standard +arm/at91/at91_machdep.c standard arm/at91/at91.c standard arm/at91/at91_st.c standard arm/at91/at91_mci.c optional at91_mci @@ -18,3 +19,8 @@ arm/at91/ohci_atmelarm.c optional ohci arm/at91/uart_bus_at91usart.c optional uart arm/at91/uart_cpu_at91rm9200usart.c optional uart arm/at91/uart_dev_at91usart.c optional uart +# +# All the boards we support +# +arm/at91/board_kb920x.c optional at91_board_kb920x +arm/at91/board_tsc4370.c optional at91_board_tsc4370 Modified: head/sys/arm/at91/std.kb920x ============================================================================== --- head/sys/arm/at91/std.kb920x Tue Nov 25 18:29:33 2008 (r185304) +++ head/sys/arm/at91/std.kb920x Tue Nov 25 18:40:40 2008 (r185305) @@ -1,9 +1,10 @@ #$FreeBSD$ include "../at91/std.at91" -files "../at91/files.kb920x" options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 makeoptions KERNVIRTADDR=0xc0000000 options KERNPHYSADDR=0x20000000 options KERNVIRTADDR=0xc0000000 + +device at91_board_kb920x From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 18:48:14 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 088921065670; Tue, 25 Nov 2008 18:48:14 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF8618FC14; Tue, 25 Nov 2008 18:48:13 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPImDoK031609; Tue, 25 Nov 2008 18:48:13 GMT (envelope-from ganbold@svn.freebsd.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPImDk3031608; Tue, 25 Nov 2008 18:48:13 GMT (envelope-from ganbold@svn.freebsd.org) Message-Id: <200811251848.mAPImDk3031608@svn.freebsd.org> From: Ganbold Tsagaankhuu Date: Tue, 25 Nov 2008 18:48:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185306 - head/sys/i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 18:48:14 -0000 Author: ganbold (doc committer) Date: Tue Nov 25 18:48:13 2008 New Revision: 185306 URL: http://svn.freebsd.org/changeset/base/185306 Log: Remove unused variable. Found with: Coverity Prevent(tm) CID: 3685 Approved by: scottl Modified: head/sys/i386/i386/intr_machdep.c Modified: head/sys/i386/i386/intr_machdep.c ============================================================================== --- head/sys/i386/i386/intr_machdep.c Tue Nov 25 18:40:40 2008 (r185305) +++ head/sys/i386/i386/intr_machdep.c Tue Nov 25 18:48:13 2008 (r185306) @@ -230,11 +230,8 @@ void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame) { struct intr_event *ie; - struct thread *td; int vector; - td = curthread; - /* * We count software interrupts when we process them. The * code here follows previous practice, but there's an From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 19:05:47 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C2001065672; Tue, 25 Nov 2008 19:05:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B3048FC16; Tue, 25 Nov 2008 19:05:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPJ5ljW032001; Tue, 25 Nov 2008 19:05:47 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPJ5kLX031990; Tue, 25 Nov 2008 19:05:46 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811251905.mAPJ5kLX031990@svn.freebsd.org> From: Warner Losh Date: Tue, 25 Nov 2008 19:05:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185307 - in head/sys/arm: at91 conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 19:05:47 -0000 Author: imp Date: Tue Nov 25 19:05:46 2008 New Revision: 185307 URL: http://svn.freebsd.org/changeset/base/185307 Log: Convert BWCT and HL200 over to new board mechanism as well. The TSC4370 config file wasn't committed to this tree, so I don't know if my changes will work on it or not. Added: head/sys/arm/at91/board_bwct.c - copied, changed from r185305, head/sys/arm/at91/board_kb920x.c head/sys/arm/at91/board_hl200.c - copied, changed from r185305, head/sys/arm/at91/board_kb920x.c head/sys/arm/at91/board_tsc4370.c - copied, changed from r185305, head/sys/arm/at91/board_kb920x.c head/sys/arm/at91/std.bwct (contents, props changed) - copied, changed from r185305, head/sys/arm/at91/std.kb920x head/sys/arm/at91/std.hl200 (contents, props changed) - copied, changed from r185305, head/sys/arm/at91/std.kb920x head/sys/arm/at91/std.tsc4370 (contents, props changed) - copied, changed from r185305, head/sys/arm/at91/std.kb920x Modified: head/sys/arm/at91/board_kb920x.c head/sys/arm/at91/files.at91 head/sys/arm/at91/std.kb920x head/sys/arm/conf/BWCT head/sys/arm/conf/HL200 Copied and modified: head/sys/arm/at91/board_bwct.c (from r185305, head/sys/arm/at91/board_kb920x.c) ============================================================================== --- head/sys/arm/at91/board_kb920x.c Tue Nov 25 18:40:40 2008 (r185305, copy source) +++ head/sys/arm/at91/board_bwct.c Tue Nov 25 19:05:46 2008 (r185307) @@ -24,8 +24,6 @@ * SUCH DAMAGE. */ -#include "opt_at91.h" - #include __FBSDID("$FreeBSD$"); #include @@ -58,24 +56,11 @@ board_init(void) /* PIOA's B periph: Turn USART 3's TX/RX pins */ at91_pio_use_periph_b(AT91RM92_PIOA_BASE, AT91C_PA6_RXD3, 0); at91_pio_use_periph_b(AT91RM92_PIOA_BASE, AT91C_PA5_TXD3, 1); -#ifdef AT91_TSC - /* We're using TC0's A1 and A2 input */ - at91_pio_use_periph_b(AT91RM92_PIOA_BASE, - AT91C_PA19_TIOA1 | AT91C_PA21_TIOA2, 0); -#endif /* PIOB's A periph: Turn USART 1's TX/RX pins */ at91_pio_use_periph_a(AT91RM92_PIOB_BASE, AT91C_PB21_RXD1, 0); at91_pio_use_periph_a(AT91RM92_PIOB_BASE, AT91C_PB20_TXD1, 1); /* Pin assignment */ -#ifdef AT91_TSC - /* Assert PA24 low -- talk to rubidium */ - at91_pio_use_gpio(AT91RM92_PIOA_BASE, AT91C_PIO_PA24); - at91_pio_gpio_output(AT91RM92_PIOA_BASE, AT91C_PIO_PA24, 0); - at91_pio_gpio_clear(AT91RM92_PIOA_BASE, AT91C_PIO_PA24); - at91_pio_use_gpio(AT91RM92_PIOB_BASE, - AT91C_PIO_PB16 | AT91C_PIO_PB17 | AT91C_PIO_PB18 | AT91C_PIO_PB19); -#endif return (at91_ramsize()); } Copied and modified: head/sys/arm/at91/board_hl200.c (from r185305, head/sys/arm/at91/board_kb920x.c) ============================================================================== --- head/sys/arm/at91/board_kb920x.c Tue Nov 25 18:40:40 2008 (r185305, copy source) +++ head/sys/arm/at91/board_hl200.c Tue Nov 25 19:05:46 2008 (r185307) @@ -24,8 +24,6 @@ * SUCH DAMAGE. */ -#include "opt_at91.h" - #include __FBSDID("$FreeBSD$"); #include @@ -49,7 +47,6 @@ board_init(void) * Since they are input pins, I think that this is the right thing * to do. */ - /* PIOA's A periph: Turn USART 0 and 2's TX/RX pins */ at91_pio_use_periph_a(AT91RM92_PIOA_BASE, AT91C_PA18_RXD0 | AT91C_PA22_RXD2, 0); @@ -58,24 +55,9 @@ board_init(void) /* PIOA's B periph: Turn USART 3's TX/RX pins */ at91_pio_use_periph_b(AT91RM92_PIOA_BASE, AT91C_PA6_RXD3, 0); at91_pio_use_periph_b(AT91RM92_PIOA_BASE, AT91C_PA5_TXD3, 1); -#ifdef AT91_TSC - /* We're using TC0's A1 and A2 input */ - at91_pio_use_periph_b(AT91RM92_PIOA_BASE, - AT91C_PA19_TIOA1 | AT91C_PA21_TIOA2, 0); -#endif /* PIOB's A periph: Turn USART 1's TX/RX pins */ at91_pio_use_periph_a(AT91RM92_PIOB_BASE, AT91C_PB21_RXD1, 0); at91_pio_use_periph_a(AT91RM92_PIOB_BASE, AT91C_PB20_TXD1, 1); - /* Pin assignment */ -#ifdef AT91_TSC - /* Assert PA24 low -- talk to rubidium */ - at91_pio_use_gpio(AT91RM92_PIOA_BASE, AT91C_PIO_PA24); - at91_pio_gpio_output(AT91RM92_PIOA_BASE, AT91C_PIO_PA24, 0); - at91_pio_gpio_clear(AT91RM92_PIOA_BASE, AT91C_PIO_PA24); - at91_pio_use_gpio(AT91RM92_PIOB_BASE, - AT91C_PIO_PB16 | AT91C_PIO_PB17 | AT91C_PIO_PB18 | AT91C_PIO_PB19); -#endif - return (at91_ramsize()); } Modified: head/sys/arm/at91/board_kb920x.c ============================================================================== --- head/sys/arm/at91/board_kb920x.c Tue Nov 25 18:48:13 2008 (r185306) +++ head/sys/arm/at91/board_kb920x.c Tue Nov 25 19:05:46 2008 (r185307) @@ -24,8 +24,6 @@ * SUCH DAMAGE. */ -#include "opt_at91.h" - #include __FBSDID("$FreeBSD$"); #include @@ -49,7 +47,6 @@ board_init(void) * Since they are input pins, I think that this is the right thing * to do. */ - /* PIOA's A periph: Turn USART 0 and 2's TX/RX pins */ at91_pio_use_periph_a(AT91RM92_PIOA_BASE, AT91C_PA18_RXD0 | AT91C_PA22_RXD2, 0); @@ -58,24 +55,9 @@ board_init(void) /* PIOA's B periph: Turn USART 3's TX/RX pins */ at91_pio_use_periph_b(AT91RM92_PIOA_BASE, AT91C_PA6_RXD3, 0); at91_pio_use_periph_b(AT91RM92_PIOA_BASE, AT91C_PA5_TXD3, 1); -#ifdef AT91_TSC - /* We're using TC0's A1 and A2 input */ - at91_pio_use_periph_b(AT91RM92_PIOA_BASE, - AT91C_PA19_TIOA1 | AT91C_PA21_TIOA2, 0); -#endif /* PIOB's A periph: Turn USART 1's TX/RX pins */ at91_pio_use_periph_a(AT91RM92_PIOB_BASE, AT91C_PB21_RXD1, 0); at91_pio_use_periph_a(AT91RM92_PIOB_BASE, AT91C_PB20_TXD1, 1); - /* Pin assignment */ -#ifdef AT91_TSC - /* Assert PA24 low -- talk to rubidium */ - at91_pio_use_gpio(AT91RM92_PIOA_BASE, AT91C_PIO_PA24); - at91_pio_gpio_output(AT91RM92_PIOA_BASE, AT91C_PIO_PA24, 0); - at91_pio_gpio_clear(AT91RM92_PIOA_BASE, AT91C_PIO_PA24); - at91_pio_use_gpio(AT91RM92_PIOB_BASE, - AT91C_PIO_PB16 | AT91C_PIO_PB17 | AT91C_PIO_PB18 | AT91C_PIO_PB19); -#endif - return (at91_ramsize()); } Copied and modified: head/sys/arm/at91/board_tsc4370.c (from r185305, head/sys/arm/at91/board_kb920x.c) ============================================================================== --- head/sys/arm/at91/board_kb920x.c Tue Nov 25 18:40:40 2008 (r185305, copy source) +++ head/sys/arm/at91/board_tsc4370.c Tue Nov 25 19:05:46 2008 (r185307) @@ -24,8 +24,6 @@ * SUCH DAMAGE. */ -#include "opt_at91.h" - #include __FBSDID("$FreeBSD$"); #include @@ -58,24 +56,20 @@ board_init(void) /* PIOA's B periph: Turn USART 3's TX/RX pins */ at91_pio_use_periph_b(AT91RM92_PIOA_BASE, AT91C_PA6_RXD3, 0); at91_pio_use_periph_b(AT91RM92_PIOA_BASE, AT91C_PA5_TXD3, 1); -#ifdef AT91_TSC /* We're using TC0's A1 and A2 input */ at91_pio_use_periph_b(AT91RM92_PIOA_BASE, AT91C_PA19_TIOA1 | AT91C_PA21_TIOA2, 0); -#endif /* PIOB's A periph: Turn USART 1's TX/RX pins */ at91_pio_use_periph_a(AT91RM92_PIOB_BASE, AT91C_PB21_RXD1, 0); at91_pio_use_periph_a(AT91RM92_PIOB_BASE, AT91C_PB20_TXD1, 1); /* Pin assignment */ -#ifdef AT91_TSC /* Assert PA24 low -- talk to rubidium */ at91_pio_use_gpio(AT91RM92_PIOA_BASE, AT91C_PIO_PA24); at91_pio_gpio_output(AT91RM92_PIOA_BASE, AT91C_PIO_PA24, 0); at91_pio_gpio_clear(AT91RM92_PIOA_BASE, AT91C_PIO_PA24); at91_pio_use_gpio(AT91RM92_PIOB_BASE, AT91C_PIO_PB16 | AT91C_PIO_PB17 | AT91C_PIO_PB18 | AT91C_PIO_PB19); -#endif return (at91_ramsize()); } Modified: head/sys/arm/at91/files.at91 ============================================================================== --- head/sys/arm/at91/files.at91 Tue Nov 25 18:48:13 2008 (r185306) +++ head/sys/arm/at91/files.at91 Tue Nov 25 19:05:46 2008 (r185307) @@ -22,5 +22,7 @@ arm/at91/uart_dev_at91usart.c optional u # # All the boards we support # +arm/at91/board_bwct.c optional at91_board_bwct +arm/at91/board_hl200.c optional at91_board_hl200 arm/at91/board_kb920x.c optional at91_board_kb920x arm/at91/board_tsc4370.c optional at91_board_tsc4370 Copied and modified: head/sys/arm/at91/std.bwct (from r185305, head/sys/arm/at91/std.kb920x) ============================================================================== --- head/sys/arm/at91/std.kb920x Tue Nov 25 18:40:40 2008 (r185305, copy source) +++ head/sys/arm/at91/std.bwct Tue Nov 25 19:05:46 2008 (r185307) @@ -3,8 +3,8 @@ include "../at91/std.at91" options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 -makeoptions KERNVIRTADDR=0xc0000000 options KERNPHYSADDR=0x20000000 +makeoptions KERNVIRTADDR=0xc0000000 options KERNVIRTADDR=0xc0000000 -device at91_board_kb920x +device at91_board_bwct Copied and modified: head/sys/arm/at91/std.hl200 (from r185305, head/sys/arm/at91/std.kb920x) ============================================================================== --- head/sys/arm/at91/std.kb920x Tue Nov 25 18:40:40 2008 (r185305, copy source) +++ head/sys/arm/at91/std.hl200 Tue Nov 25 19:05:46 2008 (r185307) @@ -1,10 +1,11 @@ #$FreeBSD$ include "../at91/std.at91" -options STARTUP_PAGETABLE_ADDR=0x20800000 -makeoptions KERNPHYSADDR=0x20000000 -makeoptions KERNVIRTADDR=0xc0000000 -options KERNPHYSADDR=0x20000000 -options KERNVIRTADDR=0xc0000000 +options STARTUP_PAGETABLE_ADDR=0x20000000 +makeoptions KERNPHYSADDR=0x20100000 +options KERNPHYSADDR=0x20100000 +makeoptions KERNVIRTADDR=0xc0100000 +options KERNVIRTADDR=0xc0100000 +options AT91C_MASTER_CLOCK=45000000 -device at91_board_kb920x +device at91_board_hl200 Modified: head/sys/arm/at91/std.kb920x ============================================================================== --- head/sys/arm/at91/std.kb920x Tue Nov 25 18:48:13 2008 (r185306) +++ head/sys/arm/at91/std.kb920x Tue Nov 25 19:05:46 2008 (r185307) @@ -3,8 +3,8 @@ include "../at91/std.at91" options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 -makeoptions KERNVIRTADDR=0xc0000000 options KERNPHYSADDR=0x20000000 +makeoptions KERNVIRTADDR=0xc0000000 options KERNVIRTADDR=0xc0000000 device at91_board_kb920x Copied and modified: head/sys/arm/at91/std.tsc4370 (from r185305, head/sys/arm/at91/std.kb920x) ============================================================================== --- head/sys/arm/at91/std.kb920x Tue Nov 25 18:40:40 2008 (r185305, copy source) +++ head/sys/arm/at91/std.tsc4370 Tue Nov 25 19:05:46 2008 (r185307) @@ -7,4 +7,4 @@ makeoptions KERNVIRTADDR=0xc0000000 options KERNPHYSADDR=0x20000000 options KERNVIRTADDR=0xc0000000 -device at91_board_kb920x +device at91_board_tsc4370 Modified: head/sys/arm/conf/BWCT ============================================================================== --- head/sys/arm/conf/BWCT Tue Nov 25 18:48:13 2008 (r185306) +++ head/sys/arm/conf/BWCT Tue Nov 25 19:05:46 2008 (r185307) @@ -22,7 +22,7 @@ ident BWCT options VERBOSE_INIT_ARM options AT91_BWCT -include "../at91/std.kb920x" +include "../at91/std.bwct" #To statically compile in device wiring instead of /boot/device.hints #hints "hints.at91rm9200" Modified: head/sys/arm/conf/HL200 ============================================================================== --- head/sys/arm/conf/HL200 Tue Nov 25 18:48:13 2008 (r185306) +++ head/sys/arm/conf/HL200 Tue Nov 25 19:05:46 2008 (r185307) @@ -1,5 +1,4 @@ -# KB920X -- Custom kernel configuration for the KB9200, 9201 and 9202 -# AT91RM9200 based Hot-e configuration file +# Kernel configuration for the AT91RM9200 based Hot-e configuration file # # For more information on this file, please read the handbook section on # Kernel Configuration Files: @@ -20,23 +19,14 @@ ident HL200 -include "../at91/std.at91" -files "../at91/files.kb920x" - -options STARTUP_PAGETABLE_ADDR=0x20000000 -makeoptions KERNPHYSADDR=0x20100000 -makeoptions KERNVIRTADDR=0xc0100000 -options KERNPHYSADDR=0x20100000 -options KERNVIRTADDR=0xc0100000 +include "../at91/std.hl200" #To statically compile in device wiring instead of /boot/device.hints -#hints "GENERIC.hints" #Default places to look for devices. hints "KB920X.hints" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols options DDB options KDB -options AT91C_MASTER_CLOCK=45000000 options SCHED_4BSD #4BSD scheduler options INET #InterNETworking @@ -46,17 +36,17 @@ options FFS #Berkeley Fast Filesystem #options UFS_ACL #Support for access control lists #options UFS_DIRHASH #Improve performance on big directories #options MD_ROOT #MD is a potential root device -#options MD_ROOT_SIZE=4096 # 3MB ram disk +#options MD_ROOT_SIZE=4096 # 3MB ram disk #options ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\" options NFSCLIENT #Network Filesystem Client #options NFSSERVER #Network Filesystem Server #options NFSLOCKD #Network Lock Manager options NFS_ROOT #NFS usable as /, requires NFSCLIENT -options BOOTP_NFSROOT -options BOOTP -options BOOTP_NFSV3 -options BOOTP_WIRED_TO=ate0 -options BOOTP_COMPAT +options BOOTP_NFSROOT +options BOOTP +options BOOTP_NFSV3 +options BOOTP_WIRED_TO=ate0 +options BOOTP_COMPAT #options MSDOSFS #MSDOS Filesystem #options CD9660 #ISO 9660 Filesystem @@ -124,20 +114,20 @@ device kue # Kawasa device rue # RealTek RTL8150 USB Ethernet device udav # usb serial -device ucom -device uark -device ubsa -device ubser -device uftdi -device uipaq -device uplcom -device uvisor -device uvscom +device ucom +device uark +device ubsa +#device ubser # not yet converted. +device uftdi +device uipaq +device uplcom +device uvisor +device uvscom # SCSI peripherals -device scbus # SCSI bus (required for SCSI) -device da # Direct Access (disks) -device cd # CD -device pass # Passthrough device (direct SCSI access) +device scbus # SCSI bus (required for SCSI) +device da # Direct Access (disks) +device cd # CD +device pass # Passthrough device (direct SCSI access) # Wireless NIC cards device wlan # 802.11 support device wlan_wep # 802.11 WEP support From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 19:06:21 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B86B1065679; Tue, 25 Nov 2008 19:06:21 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C58A8FC08; Tue, 25 Nov 2008 19:06:21 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPJ6LMj032048; Tue, 25 Nov 2008 19:06:21 GMT (envelope-from ganbold@svn.freebsd.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPJ6Lvx032047; Tue, 25 Nov 2008 19:06:21 GMT (envelope-from ganbold@svn.freebsd.org) Message-Id: <200811251906.mAPJ6Lvx032047@svn.freebsd.org> From: Ganbold Tsagaankhuu Date: Tue, 25 Nov 2008 19:06:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185308 - head/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 19:06:21 -0000 Author: ganbold (doc committer) Date: Tue Nov 25 19:06:20 2008 New Revision: 185308 URL: http://svn.freebsd.org/changeset/base/185308 Log: Remove unused variable. Found with: Coverity Prevent(tm) CID: 3678 Approved by: njl Modified: head/sys/dev/acpica/acpi_pcib.c Modified: head/sys/dev/acpica/acpi_pcib.c ============================================================================== --- head/sys/dev/acpica/acpi_pcib.c Tue Nov 25 19:05:46 2008 (r185307) +++ head/sys/dev/acpica/acpi_pcib.c Tue Nov 25 19:06:20 2008 (r185308) @@ -127,7 +127,6 @@ prt_attach_devices(ACPI_PCI_ROUTING_TABL int acpi_pcib_attach(device_t dev, ACPI_BUFFER *prt, int busno) { - device_t child; ACPI_STATUS status; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -157,7 +156,7 @@ acpi_pcib_attach(device_t dev, ACPI_BUFF /* * Attach the PCI bus proper. */ - if ((child = device_add_child(dev, "pci", busno)) == NULL) { + if (device_add_child(dev, "pci", busno) == NULL) { device_printf(device_get_parent(dev), "couldn't attach pci bus\n"); return_VALUE(ENXIO); } From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 19:13:58 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F54C1065672; Tue, 25 Nov 2008 19:13:58 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6EB528FC1C; Tue, 25 Nov 2008 19:13:58 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPJDwOx032242; Tue, 25 Nov 2008 19:13:58 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPJDwrD032237; Tue, 25 Nov 2008 19:13:58 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200811251913.mAPJDwrD032237@svn.freebsd.org> From: Ulf Lilleengen Date: Tue, 25 Nov 2008 19:13:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185309 - head/sys/geom/vinum X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 19:13:58 -0000 Author: lulf Date: Tue Nov 25 19:13:58 2008 New Revision: 185309 URL: http://svn.freebsd.org/changeset/base/185309 Log: - Fix a potential NULL pointer reference. Note that this cannot happen in practice, but it is a good programming practice nontheless and it allows the kernel to not depend on userland correctness. Found with: Coverity Prevent(tm) CID: 655-659, 664-667 Modified: head/sys/geom/vinum/geom_vinum.c head/sys/geom/vinum/geom_vinum_list.c head/sys/geom/vinum/geom_vinum_move.c head/sys/geom/vinum/geom_vinum_rename.c head/sys/geom/vinum/geom_vinum_rm.c Modified: head/sys/geom/vinum/geom_vinum.c ============================================================================== --- head/sys/geom/vinum/geom_vinum.c Tue Nov 25 19:06:20 2008 (r185308) +++ head/sys/geom/vinum/geom_vinum.c Tue Nov 25 19:13:58 2008 (r185309) @@ -165,12 +165,20 @@ gv_create(struct g_geom *gp, struct gctl plexes = gctl_get_paraml(req, "plexes", sizeof(*plexes)); subdisks = gctl_get_paraml(req, "subdisks", sizeof(*subdisks)); drives = gctl_get_paraml(req, "drives", sizeof(*drives)); + if (volumes == NULL || plexes == NULL || subdisks == NULL || + drives == NULL) { + gctl_error(req, "number of objects not given"); + return (-1); + } /* First, handle drive definitions ... */ for (i = 0; i < *drives; i++) { snprintf(buf, sizeof(buf), "drive%d", i); d2 = gctl_get_paraml(req, buf, sizeof(*d2)); - + if (d2 == NULL) { + gctl_error(req, "no drive definition given"); + return (-1); + } d = gv_find_drive(sc, d2->name); if (d != NULL) { gctl_error(req, "drive '%s' is already known", @@ -205,7 +213,10 @@ gv_create(struct g_geom *gp, struct gctl error = 0; snprintf(buf, sizeof(buf), "volume%d", i); v2 = gctl_get_paraml(req, buf, sizeof(*v2)); - + if (v2 == NULL) { + gctl_error(req, "no volume definition given"); + return (-1); + } v = gv_find_vol(sc, v2->name); if (v != NULL) { gctl_error(req, "volume '%s' is already known", @@ -226,7 +237,10 @@ gv_create(struct g_geom *gp, struct gctl error = 0; snprintf(buf, sizeof(buf), "plex%d", i); p2 = gctl_get_paraml(req, buf, sizeof(*p2)); - + if (p2 == NULL) { + gctl_error(req, "no plex definition given"); + return (-1); + } p = gv_find_plex(sc, p2->name); if (p != NULL) { gctl_error(req, "plex '%s' is already known", p->name); @@ -260,7 +274,10 @@ gv_create(struct g_geom *gp, struct gctl error = 0; snprintf(buf, sizeof(buf), "sd%d", i); s2 = gctl_get_paraml(req, buf, sizeof(*s2)); - + if (s2 == NULL) { + gctl_error(req, "no subdisk definition given"); + return (-1); + } s = gv_find_sd(sc, s2->name); if (s != NULL) { gctl_error(req, "subdisk '%s' is already known", @@ -405,7 +422,10 @@ gv_config(struct gctl_req *req, struct g /* Return configuration in string form. */ } else if (!strcmp(verb, "getconfig")) { comment = gctl_get_param(req, "comment", NULL); - + if (comment == NULL) { + gctl_error(req, "no comment parameter given"); + return; + } sb = sbuf_new(NULL, NULL, GV_CFG_LEN, SBUF_FIXEDLEN); gv_format_config(sc, sb, 0, comment); sbuf_finish(sb); Modified: head/sys/geom/vinum/geom_vinum_list.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_list.c Tue Nov 25 19:06:20 2008 (r185308) +++ head/sys/geom/vinum/geom_vinum_list.c Tue Nov 25 19:13:58 2008 (r185309) @@ -62,6 +62,10 @@ gv_list(struct g_geom *gp, struct gctl_r } flags = gctl_get_paraml(req, "flags", sizeof(*flags)); + if (flags == NULL) { + gctl_error(req, "no flags given"); + return; + } sc = gp->softc; @@ -69,6 +73,10 @@ gv_list(struct g_geom *gp, struct gctl_r /* Figure out which command was given. */ cmd = gctl_get_param(req, "cmd", NULL); + if (cmd == NULL) { + gctl_error(req, "no command given"); + return; + } /* List specific objects or everything. */ if (!strcmp(cmd, "list") || !strcmp(cmd, "l")) { Modified: head/sys/geom/vinum/geom_vinum_move.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_move.c Tue Nov 25 19:06:20 2008 (r185308) +++ head/sys/geom/vinum/geom_vinum_move.c Tue Nov 25 19:13:58 2008 (r185309) @@ -56,7 +56,15 @@ gv_move(struct g_geom *gp, struct gctl_r sc = gp->softc; argc = gctl_get_paraml(req, "argc", sizeof(*argc)); + if (argc == NULL) { + gctl_error(req, "no arguments given"); + return; + } flags = gctl_get_paraml(req, "flags", sizeof(*flags)); + if (flags == NULL) { + gctl_error(req, "no flags given"); + return; + } destination = gctl_get_param(req, "destination", NULL); if (destination == NULL) { gctl_error(req, "no destination given"); Modified: head/sys/geom/vinum/geom_vinum_rename.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_rename.c Tue Nov 25 19:06:20 2008 (r185308) +++ head/sys/geom/vinum/geom_vinum_rename.c Tue Nov 25 19:13:58 2008 (r185309) @@ -65,6 +65,10 @@ gv_rename(struct g_geom *gp, struct gctl sc = gp->softc; flags = gctl_get_paraml(req, "flags", sizeof(*flags)); + if (flags == NULL) { + gctl_error(req, "no flags given"); + return; + } newname = gctl_get_param(req, "newname", NULL); if (newname == NULL) { Modified: head/sys/geom/vinum/geom_vinum_rm.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_rm.c Tue Nov 25 19:06:20 2008 (r185308) +++ head/sys/geom/vinum/geom_vinum_rm.c Tue Nov 25 19:13:58 2008 (r185309) @@ -59,13 +59,18 @@ gv_remove(struct g_geom *gp, struct gctl int i, type, err; argc = gctl_get_paraml(req, "argc", sizeof(*argc)); - flags = gctl_get_paraml(req, "flags", sizeof(*flags)); if (argc == NULL || *argc == 0) { gctl_error(req, "no arguments given"); return; } + flags = gctl_get_paraml(req, "flags", sizeof(*flags)); + if (flags == NULL) { + gctl_error(req, "no flags given"); + return; + } + sc = gp->softc; for (i = 0; i < *argc; i++) { From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 19:20:22 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94A4B1065675; Tue, 25 Nov 2008 19:20:22 +0000 (UTC) (envelope-from rink@rink.nu) Received: from mx1.rink.nu (gloom.rink.nu [213.34.49.2]) by mx1.freebsd.org (Postfix) with ESMTP id 522A38FC13; Tue, 25 Nov 2008 19:20:22 +0000 (UTC) (envelope-from rink@rink.nu) Received: from localhost (localhost [127.0.0.1]) by mx1.rink.nu (Postfix) with ESMTP id C85B56D42B; Tue, 25 Nov 2008 20:20:51 +0100 (CET) X-Virus-Scanned: amavisd-new at rink.nu Received: from mx1.rink.nu ([213.34.49.2]) by localhost (gloom.rink.nu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 17B-a0havQh6; Tue, 25 Nov 2008 20:20:48 +0100 (CET) Received: by mx1.rink.nu (Postfix, from userid 1000) id C29366D423; Tue, 25 Nov 2008 20:20:48 +0100 (CET) Date: Tue, 25 Nov 2008 20:20:48 +0100 From: Rink Springer To: Ulf Lilleengen Message-ID: <20081125192048.GA12700@rink.nu> References: <200811251913.mAPJDwrD032237@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200811251913.mAPJDwrD032237@svn.freebsd.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185309 - head/sys/geom/vinum X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 19:20:22 -0000 On Tue, Nov 25, 2008 at 07:13:58PM +0000, Ulf Lilleengen wrote: > Author: lulf > Date: Tue Nov 25 19:13:58 2008 > New Revision: 185309 > URL: http://svn.freebsd.org/changeset/base/185309 > > Log: > - Fix a potential NULL pointer reference. Note that this cannot happen in > practice, but it is a good programming practice nontheless and it allows the > kernel to not depend on userland correctness. If it can't happen in practice, why not just ASSERT on them? This would be useful for debugging, and it basically tells whoever reads the code about the scenario's you are dealing with... -- Rink P.W. Springer - http://rink.nu "Anyway boys, this is America. Just because you get more votes doesn't mean you win." - Fox Mulder From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 19:25:54 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2A3B1065675; Tue, 25 Nov 2008 19:25:54 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B13C48FC0C; Tue, 25 Nov 2008 19:25:54 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPJPskQ032565; Tue, 25 Nov 2008 19:25:54 GMT (envelope-from ganbold@svn.freebsd.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPJPsY6032563; Tue, 25 Nov 2008 19:25:54 GMT (envelope-from ganbold@svn.freebsd.org) Message-Id: <200811251925.mAPJPsY6032563@svn.freebsd.org> From: Ganbold Tsagaankhuu Date: Tue, 25 Nov 2008 19:25:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185310 - in head/sys/cddl/dev: cyclic dtrace/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 19:25:54 -0000 Author: ganbold (doc committer) Date: Tue Nov 25 19:25:54 2008 New Revision: 185310 URL: http://svn.freebsd.org/changeset/base/185310 Log: Remove unused variable. Found with: Coverity Prevent(tm) CID: 3669,3671 Approved by: jb Modified: head/sys/cddl/dev/cyclic/cyclic.c head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Modified: head/sys/cddl/dev/cyclic/cyclic.c ============================================================================== --- head/sys/cddl/dev/cyclic/cyclic.c Tue Nov 25 19:13:58 2008 (r185309) +++ head/sys/cddl/dev/cyclic/cyclic.c Tue Nov 25 19:25:54 2008 (r185310) @@ -1341,12 +1341,11 @@ cyclic_mp_init(void) static void cyclic_uninit(void) { - struct pcpu *pc; cpu_t *c; int id; for (id = 0; id <= mp_maxid; id++) { - if ((pc = pcpu_find(id)) == NULL) + if (pcpu_find(id) == NULL) continue; c = &solaris_cpu[id]; Modified: head/sys/cddl/dev/dtrace/i386/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Tue Nov 25 19:13:58 2008 (r185309) +++ head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Tue Nov 25 19:25:54 2008 (r185310) @@ -403,7 +403,6 @@ dtrace_gethrtime_init(void *arg) { cpumask_t map; int i; - struct pcpu *cp; /* The current CPU is the reference one. */ tsc_skew[curcpu] = 0; @@ -412,7 +411,7 @@ dtrace_gethrtime_init(void *arg) if (i == curcpu) continue; - if ((cp = pcpu_find(i)) == NULL) + if (pcpu_find(i) == NULL) continue; map = 0; From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 19:26:37 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68804106564A; Tue, 25 Nov 2008 19:26:37 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5679F8FC1B; Tue, 25 Nov 2008 19:26:37 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPJQbTt032617; Tue, 25 Nov 2008 19:26:37 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPJQbqY032613; Tue, 25 Nov 2008 19:26:37 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <200811251926.mAPJQbqY032613@svn.freebsd.org> From: Julian Elischer Date: Tue, 25 Nov 2008 19:26: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: r185311 - in stable/7/sys: kern netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 19:26:37 -0000 Author: julian Date: Tue Nov 25 19:26:36 2008 New Revision: 185311 URL: http://svn.freebsd.org/changeset/base/185311 Log: MFC @ 185101 Fix a scope problem in the multiple routing table code that stopped the SO_SETFIB socket option from working correctly. Approved by: re (kensmith, kostik) Obtained from: Ironport Modified: stable/7/sys/kern/uipc_socket.c stable/7/sys/netinet/ip_divert.c stable/7/sys/netinet/ip_output.c stable/7/sys/netinet/raw_ip.c Modified: stable/7/sys/kern/uipc_socket.c ============================================================================== --- stable/7/sys/kern/uipc_socket.c Tue Nov 25 19:25:54 2008 (r185310) +++ stable/7/sys/kern/uipc_socket.c Tue Nov 25 19:26:36 2008 (r185311) @@ -2218,6 +2218,9 @@ sosetopt(struct socket *so, struct socko if ((so->so_proto->pr_domain->dom_family == PF_INET) || (so->so_proto->pr_domain->dom_family == PF_ROUTE)) { so->so_fibnum = optval; + /* Note: ignore error */ + if (so->so_proto && so->so_proto->pr_ctloutput) + (*so->so_proto->pr_ctloutput)(so, sopt); } else { so->so_fibnum = 0; } Modified: stable/7/sys/netinet/ip_divert.c ============================================================================== --- stable/7/sys/netinet/ip_divert.c Tue Nov 25 19:25:54 2008 (r185310) +++ stable/7/sys/netinet/ip_divert.c Tue Nov 25 19:26:36 2008 (r185311) @@ -314,6 +314,7 @@ div_output(struct socket *so, struct mbu */ m->m_pkthdr.rcvif = NULL; m->m_nextpkt = NULL; + M_SETFIB(m, so->so_fibnum); if (control) m_freem(control); /* XXX */ Modified: stable/7/sys/netinet/ip_output.c ============================================================================== --- stable/7/sys/netinet/ip_output.c Tue Nov 25 19:25:54 2008 (r185310) +++ stable/7/sys/netinet/ip_output.c Tue Nov 25 19:26:36 2008 (r185311) @@ -125,8 +125,10 @@ ip_output(struct mbuf *m, struct mbuf *o bzero(ro, sizeof (*ro)); } - if (inp != NULL) + if (inp != NULL) { + M_SETFIB(m, inp->inp_inc.inc_fibnum); INP_LOCK_ASSERT(inp); + } if (opt) { len = 0; @@ -808,6 +810,11 @@ ip_ctloutput(struct socket *so, struct s error = optval = 0; if (sopt->sopt_level != IPPROTO_IP) { + if ((sopt->sopt_level == SOL_SOCKET) && + (sopt->sopt_name == SO_SETFIB)) { + inp->inp_inc.inc_fibnum = so->so_fibnum; + return (0); + } return (EINVAL); } Modified: stable/7/sys/netinet/raw_ip.c ============================================================================== --- stable/7/sys/netinet/raw_ip.c Tue Nov 25 19:25:54 2008 (r185310) +++ stable/7/sys/netinet/raw_ip.c Tue Nov 25 19:26:36 2008 (r185311) @@ -441,8 +441,14 @@ rip_ctloutput(struct socket *so, struct struct inpcb *inp = sotoinpcb(so); int error, optval; - if (sopt->sopt_level != IPPROTO_IP) + if (sopt->sopt_level != IPPROTO_IP) { + if ((sopt->sopt_level == SOL_SOCKET) && + (sopt->sopt_name == SO_SETFIB)) { + inp->inp_inc.inc_fibnum = so->so_fibnum; + return (0); + } return (EINVAL); + } error = 0; switch (sopt->sopt_dir) { From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 19:36:50 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80108106564A; Tue, 25 Nov 2008 19:36:50 +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 635428FC12; Tue, 25 Nov 2008 19:36:50 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPJaoFh032957; Tue, 25 Nov 2008 19:36:50 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPJaoEZ032956; Tue, 25 Nov 2008 19:36:50 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811251936.mAPJaoEZ032956@svn.freebsd.org> From: Ken Smith Date: Tue, 25 Nov 2008 19:36:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185312 - releng/7.1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 19:36:50 -0000 Author: kensmith Date: Tue Nov 25 19:36:50 2008 New Revision: 185312 URL: http://svn.freebsd.org/changeset/base/185312 Log: Change branch used for "make update". Approved by: re (implicit) Modified: releng/7.1/Makefile.inc1 Modified: releng/7.1/Makefile.inc1 ============================================================================== --- releng/7.1/Makefile.inc1 Tue Nov 25 19:26:36 2008 (r185311) +++ releng/7.1/Makefile.inc1 Tue Nov 25 19:36:50 2008 (r185312) @@ -88,7 +88,7 @@ CLEANDIR= cleandir .endif CVS?= cvs -CVSFLAGS?= -r RELENG_7 -P -d -I! +CVSFLAGS?= -r RELENG_7_1 -P -d -I! SUP?= /usr/bin/csup SUPFLAGS?= -g -L 2 .if defined(SUPHOST) From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 19:38:12 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4F691065670; Tue, 25 Nov 2008 19:38:12 +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 D37A38FC0A; Tue, 25 Nov 2008 19:38:12 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPJcCXd033019; Tue, 25 Nov 2008 19:38:12 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPJcCQB033018; Tue, 25 Nov 2008 19:38:12 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811251938.mAPJcCQB033018@svn.freebsd.org> From: Ken Smith Date: Tue, 25 Nov 2008 19:38:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185313 - releng/7.1/release X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 19:38:13 -0000 Author: kensmith Date: Tue Nov 25 19:38:12 2008 New Revision: 185313 URL: http://svn.freebsd.org/changeset/base/185313 Log: Change version number. Approved by: re (implicit) Modified: releng/7.1/release/Makefile Modified: releng/7.1/release/Makefile ============================================================================== --- releng/7.1/release/Makefile Tue Nov 25 19:36:50 2008 (r185312) +++ releng/7.1/release/Makefile Tue Nov 25 19:38:12 2008 (r185313) @@ -18,11 +18,11 @@ # Set these, release builder! # # Fixed version: -#BUILDNAME=7.0-STABLE +#BUILDNAME=7.1-STABLE # # Automatic SNAP versioning: DATE != date +%Y%m%d -BASE = 7.0 +BASE = 7.1 BUILDNAME?=${BASE}-${DATE}-SNAP # #CHROOTDIR=/junk/release From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 19:39:27 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CB79106564A; Tue, 25 Nov 2008 19:39:27 +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 4B8128FC13; Tue, 25 Nov 2008 19:39:27 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPJdRHt033081; Tue, 25 Nov 2008 19:39:27 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPJdRwm033080; Tue, 25 Nov 2008 19:39:27 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811251939.mAPJdRwm033080@svn.freebsd.org> From: Ken Smith Date: Tue, 25 Nov 2008 19:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185314 - releng/7.1/share/examples/cvsup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 19:39:27 -0000 Author: kensmith Date: Tue Nov 25 19:39:27 2008 New Revision: 185314 URL: http://svn.freebsd.org/changeset/base/185314 Log: Update branch tag used for example. Approved by: re (implicit) Modified: releng/7.1/share/examples/cvsup/standard-supfile Modified: releng/7.1/share/examples/cvsup/standard-supfile ============================================================================== --- releng/7.1/share/examples/cvsup/standard-supfile Tue Nov 25 19:38:12 2008 (r185313) +++ releng/7.1/share/examples/cvsup/standard-supfile Tue Nov 25 19:39:27 2008 (r185314) @@ -49,7 +49,7 @@ *default host=CHANGE_THIS.FreeBSD.org *default base=/var/db *default prefix=/usr -*default release=cvs tag=RELENG_7 +*default release=cvs tag=RELENG_7_1 *default delete use-rel-suffix # If you seem to be limited by CPU rather than network or disk bandwidth, try From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 19:45:09 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4D66106564A; Tue, 25 Nov 2008 19:45:09 +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 935BE8FC08; Tue, 25 Nov 2008 19:45:09 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPJj9Um033262; Tue, 25 Nov 2008 19:45:09 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPJj9i6033261; Tue, 25 Nov 2008 19:45:09 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811251945.mAPJj9i6033261@svn.freebsd.org> From: Ken Smith Date: Tue, 25 Nov 2008 19:45:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185315 - releng/7.1/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 19:45:09 -0000 Author: kensmith Date: Tue Nov 25 19:45:09 2008 New Revision: 185315 URL: http://svn.freebsd.org/changeset/base/185315 Log: Adjust __FreeBSD_version for 7.1. Approved by: re (implicit) Modified: releng/7.1/sys/sys/param.h Modified: releng/7.1/sys/sys/param.h ============================================================================== --- releng/7.1/sys/sys/param.h Tue Nov 25 19:39:27 2008 (r185314) +++ releng/7.1/sys/sys/param.h Tue Nov 25 19:45:09 2008 (r185315) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 700112 /* Master, propagated to newvers */ +#define __FreeBSD_version 701000 /* Master, propagated to newvers */ #ifndef LOCORE #include From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 19:46:21 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9BB7106564A; Tue, 25 Nov 2008 19:46:21 +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 97FE48FC1B; Tue, 25 Nov 2008 19:46:21 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPJkLqB033319; Tue, 25 Nov 2008 19:46:21 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPJkLJ0033318; Tue, 25 Nov 2008 19:46:21 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811251946.mAPJkLJ0033318@svn.freebsd.org> From: Ken Smith Date: Tue, 25 Nov 2008 19:46:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185316 - releng/7.1/usr.sbin/pkg_install/add X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 19:46:21 -0000 Author: kensmith Date: Tue Nov 25 19:46:21 2008 New Revision: 185316 URL: http://svn.freebsd.org/changeset/base/185316 Log: Add __FreeBSD_version and package directory for 7.1. Approved by: re (implicit) Modified: releng/7.1/usr.sbin/pkg_install/add/main.c Modified: releng/7.1/usr.sbin/pkg_install/add/main.c ============================================================================== --- releng/7.1/usr.sbin/pkg_install/add/main.c Tue Nov 25 19:45:09 2008 (r185315) +++ releng/7.1/usr.sbin/pkg_install/add/main.c Tue Nov 25 19:46:21 2008 (r185316) @@ -79,6 +79,7 @@ struct { { 602000, 602099, "/packages-6.2-release" }, { 603000, 603099, "/packages-6.3-release" }, { 700000, 700099, "/packages-7.0-release" }, + { 701000, 701099, "/packages-7.1-release" }, { 300000, 399000, "/packages-3-stable" }, { 400000, 499000, "/packages-4-stable" }, { 502100, 502128, "/packages-5-current" }, From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 20:02:47 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82ACF106573B; Tue, 25 Nov 2008 20:02:47 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F4868FC0C; Tue, 25 Nov 2008 20:02:47 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPK2lAt033795; Tue, 25 Nov 2008 20:02:47 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPK2l7j033791; Tue, 25 Nov 2008 20:02:47 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <200811252002.mAPK2l7j033791@svn.freebsd.org> From: Julian Elischer Date: Tue, 25 Nov 2008 20:02:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185317 - in releng/7.1/sys: . kern netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 20:02:47 -0000 Author: julian Date: Tue Nov 25 20:02:47 2008 New Revision: 185317 URL: http://svn.freebsd.org/changeset/base/185317 Log: MFC @ 185101 Fix a scope problem in the multiple routing table code that stopped the SO_SETFIB socket option from working correctly. Approved by: re (kensmith, kostik) Obtained from: Ironport Modified: releng/7.1/sys/ (props changed) releng/7.1/sys/kern/uipc_socket.c releng/7.1/sys/netinet/ip_divert.c releng/7.1/sys/netinet/ip_output.c releng/7.1/sys/netinet/raw_ip.c Modified: releng/7.1/sys/kern/uipc_socket.c ============================================================================== --- releng/7.1/sys/kern/uipc_socket.c Tue Nov 25 19:46:21 2008 (r185316) +++ releng/7.1/sys/kern/uipc_socket.c Tue Nov 25 20:02:47 2008 (r185317) @@ -2218,6 +2218,9 @@ sosetopt(struct socket *so, struct socko if ((so->so_proto->pr_domain->dom_family == PF_INET) || (so->so_proto->pr_domain->dom_family == PF_ROUTE)) { so->so_fibnum = optval; + /* Note: ignore error */ + if (so->so_proto && so->so_proto->pr_ctloutput) + (*so->so_proto->pr_ctloutput)(so, sopt); } else { so->so_fibnum = 0; } Modified: releng/7.1/sys/netinet/ip_divert.c ============================================================================== --- releng/7.1/sys/netinet/ip_divert.c Tue Nov 25 19:46:21 2008 (r185316) +++ releng/7.1/sys/netinet/ip_divert.c Tue Nov 25 20:02:47 2008 (r185317) @@ -314,6 +314,7 @@ div_output(struct socket *so, struct mbu */ m->m_pkthdr.rcvif = NULL; m->m_nextpkt = NULL; + M_SETFIB(m, so->so_fibnum); if (control) m_freem(control); /* XXX */ Modified: releng/7.1/sys/netinet/ip_output.c ============================================================================== --- releng/7.1/sys/netinet/ip_output.c Tue Nov 25 19:46:21 2008 (r185316) +++ releng/7.1/sys/netinet/ip_output.c Tue Nov 25 20:02:47 2008 (r185317) @@ -125,8 +125,10 @@ ip_output(struct mbuf *m, struct mbuf *o bzero(ro, sizeof (*ro)); } - if (inp != NULL) + if (inp != NULL) { + M_SETFIB(m, inp->inp_inc.inc_fibnum); INP_LOCK_ASSERT(inp); + } if (opt) { len = 0; @@ -808,6 +810,11 @@ ip_ctloutput(struct socket *so, struct s error = optval = 0; if (sopt->sopt_level != IPPROTO_IP) { + if ((sopt->sopt_level == SOL_SOCKET) && + (sopt->sopt_name == SO_SETFIB)) { + inp->inp_inc.inc_fibnum = so->so_fibnum; + return (0); + } return (EINVAL); } Modified: releng/7.1/sys/netinet/raw_ip.c ============================================================================== --- releng/7.1/sys/netinet/raw_ip.c Tue Nov 25 19:46:21 2008 (r185316) +++ releng/7.1/sys/netinet/raw_ip.c Tue Nov 25 20:02:47 2008 (r185317) @@ -441,8 +441,14 @@ rip_ctloutput(struct socket *so, struct struct inpcb *inp = sotoinpcb(so); int error, optval; - if (sopt->sopt_level != IPPROTO_IP) + if (sopt->sopt_level != IPPROTO_IP) { + if ((sopt->sopt_level == SOL_SOCKET) && + (sopt->sopt_name == SO_SETFIB)) { + inp->inp_inc.inc_fibnum = so->so_fibnum; + return (0); + } return (EINVAL); + } error = 0; switch (sopt->sopt_dir) { From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 20:14:39 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63A1D1065670; Tue, 25 Nov 2008 20:14:39 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from bene2.itea.ntnu.no (bene2.itea.ntnu.no [IPv6:2001:700:300:3::57]) by mx1.freebsd.org (Postfix) with ESMTP id 98E528FC1C; Tue, 25 Nov 2008 20:14:38 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by bene2.itea.ntnu.no (Postfix) with ESMTP id 3325190003; Tue, 25 Nov 2008 21:14:37 +0100 (CET) Received: from nobby (unknown [IPv6:2001:700:300:3::184]) by bene2.itea.ntnu.no (Postfix) with ESMTP id C153290001; Tue, 25 Nov 2008 21:14:36 +0100 (CET) Date: Tue, 25 Nov 2008 20:14:26 +0100 From: Ulf Lilleengen To: Rink Springer Message-ID: <20081125191426.GA2635@nobby.lan> References: <200811251913.mAPJDwrD032237@svn.freebsd.org> <20081125192048.GA12700@rink.nu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081125192048.GA12700@rink.nu> User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: Debian amavisd-new at bene2.itea.ntnu.no Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185309 - head/sys/geom/vinum X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 20:14:39 -0000 On Tue, Nov 25, 2008 at 08:20:48PM +0100, Rink Springer wrote: > On Tue, Nov 25, 2008 at 07:13:58PM +0000, Ulf Lilleengen wrote: > > Author: lulf > > Date: Tue Nov 25 19:13:58 2008 > > New Revision: 185309 > > URL: http://svn.freebsd.org/changeset/base/185309 > > > > Log: > > - Fix a potential NULL pointer reference. Note that this cannot happen in > > practice, but it is a good programming practice nontheless and it allows the > > kernel to not depend on userland correctness. > > If it can't happen in practice, why not just ASSERT on them? This would > be useful for debugging, and it basically tells whoever reads the code > about the scenario's you are dealing with... > Well, As the last sentence states, I think it's nicer to make the kernel part as independent of the userland part as possible, rather than panicing if the userland part should do an error. Also, reporting such errors back seems to be the common practice if you look at other GEOM classes, and it's good for consistency in a way. -- Ulf Lilleengen From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 20:28:33 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99D701065676; Tue, 25 Nov 2008 20:28:33 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 896808FC0A; Tue, 25 Nov 2008 20:28:33 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPKSXdw034316; Tue, 25 Nov 2008 20:28:33 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPKSXnZ034315; Tue, 25 Nov 2008 20:28:33 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200811252028.mAPKSXnZ034315@svn.freebsd.org> From: Ulf Lilleengen Date: Tue, 25 Nov 2008 20:28:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185318 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 20:28:33 -0000 Author: lulf Date: Tue Nov 25 20:28:33 2008 New Revision: 185318 URL: http://svn.freebsd.org/changeset/base/185318 Log: - Fix a potential NULL pointer reference. Note that this should not happen in practice, but it is a good programming practice and allows the kernel to not depend on userland correctness. - While there, make sizeof usage match the rest of the code. Found with: Coverity Prevent(tm) CID: 660, 662 Modified: head/sys/geom/geom_ccd.c Modified: head/sys/geom/geom_ccd.c ============================================================================== --- head/sys/geom/geom_ccd.c Tue Nov 25 20:02:47 2008 (r185317) +++ head/sys/geom/geom_ccd.c Tue Nov 25 20:28:33 2008 (r185318) @@ -709,8 +709,20 @@ g_ccd_create(struct gctl_req *req, struc g_topology_assert(); unit = gctl_get_paraml(req, "unit", sizeof (*unit)); + if (unit == NULL) { + gctl_error(req, "unit parameter not given"); + return; + } ileave = gctl_get_paraml(req, "ileave", sizeof (*ileave)); + if (ileave == NULL) { + gctl_error(req, "ileave parameter not given"); + return; + } nprovider = gctl_get_paraml(req, "nprovider", sizeof (*nprovider)); + if (nprovider == NULL) { + gctl_error(req, "nprovider parameter not given"); + return; + } /* Check for duplicate unit */ LIST_FOREACH(gp, &mp->geom, geom) { @@ -838,7 +850,11 @@ g_ccd_list(struct gctl_req *req, struct struct g_geom *gp; int i, unit, *up; - up = gctl_get_paraml(req, "unit", sizeof (int)); + up = gctl_get_paraml(req, "unit", sizeof (*up)); + if (up == NULL) { + gctl_error(req, "unit parameter not given"); + return; + } unit = *up; sb = sbuf_new_auto(); LIST_FOREACH(gp, &mp->geom, geom) { From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 21:14:00 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AD731065670; Tue, 25 Nov 2008 21:14:00 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69ECF8FC0A; Tue, 25 Nov 2008 21:14:00 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPLE06S035281; Tue, 25 Nov 2008 21:14:00 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPLE0A9035277; Tue, 25 Nov 2008 21:14:00 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811252114.mAPLE0A9035277@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 25 Nov 2008 21:14:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185319 - in head/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 21:14:00 -0000 Author: pjd Date: Tue Nov 25 21:14:00 2008 New Revision: 185319 URL: http://svn.freebsd.org/changeset/base/185319 Log: Fix locking (file descriptor table and Giant around VFS). Most submitted by: kib Reviewed by: kib Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c head/sys/cddl/compat/opensolaris/sys/vnode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Tue Nov 25 20:28:33 2008 (r185318) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Tue Nov 25 21:14:00 2008 (r185319) @@ -67,17 +67,25 @@ static void * kobj_open_file_vnode(const char *file) { struct thread *td = curthread; + struct filedesc *fd; struct nameidata nd; int error, flags; - if (td->td_proc->p_fd->fd_rdir == NULL) - td->td_proc->p_fd->fd_rdir = rootvnode; - if (td->td_proc->p_fd->fd_cdir == NULL) - td->td_proc->p_fd->fd_cdir = rootvnode; + fd = td->td_proc->p_fd; + FILEDESC_XLOCK(fd); + if (fd->fd_rdir == NULL) { + fd->fd_rdir = rootvnode; + vref(fd->fd_rdir); + } + if (fd->fd_cdir == NULL) { + fd->fd_cdir = rootvnode; + vref(fd->fd_cdir); + } + FILEDESC_XUNLOCK(fd); flags = FREAD; - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, file, td); - error = vn_open_cred(&nd, &flags, 0, curthread->td_ucred, NULL); + NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td); + error = vn_open_cred(&nd, &flags, O_NOFOLLOW, curthread->td_ucred, NULL); NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) return (NULL); @@ -120,13 +128,15 @@ kobj_get_filesize_vnode(struct _buf *fil { struct vnode *vp = file->ptr; struct vattr va; - int error; + int error, vfslocked; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_GETATTR(vp, &va, curthread->td_ucred); VOP_UNLOCK(vp, 0); if (error == 0) *size = (uint64_t)va.va_size; + VFS_UNLOCK_GIANT(vfslocked); return (error); } @@ -159,7 +169,7 @@ kobj_read_file_vnode(struct _buf *file, struct thread *td = curthread; struct uio auio; struct iovec aiov; - int error; + int error, vfslocked; bzero(&aiov, sizeof(aiov)); bzero(&auio, sizeof(auio)); @@ -175,9 +185,11 @@ kobj_read_file_vnode(struct _buf *file, auio.uio_resid = size; auio.uio_td = td; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_READ(vp, &auio, IO_UNIT | IO_SYNC, td->td_ucred); VOP_UNLOCK(vp, 0); + VFS_UNLOCK_GIANT(vfslocked); return (error != 0 ? -1 : size - auio.uio_resid); } @@ -211,9 +223,11 @@ kobj_close_file(struct _buf *file) if (file->mounted) { struct vnode *vp = file->ptr; struct thread *td = curthread; - int flags = FREAD; + int vfslocked; - vn_close(vp, flags, td->td_ucred, td); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vn_close(vp, FREAD, td->td_ucred, td); + VFS_UNLOCK_GIANT(vfslocked); } kmem_free(file, sizeof(*file)); } Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/vnode.h Tue Nov 25 20:28:33 2008 (r185318) +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Tue Nov 25 21:14:00 2008 (r185319) @@ -149,6 +149,7 @@ vn_openat(char *pnamep, enum uio_seg seg int fd) { struct thread *td = curthread; + struct filedesc *fdc; struct nameidata nd; int error, operation; @@ -164,20 +165,26 @@ vn_openat(char *pnamep, enum uio_seg seg } ASSERT(umask == 0); - if (td->td_proc->p_fd->fd_rdir == NULL) - td->td_proc->p_fd->fd_rdir = rootvnode; - if (td->td_proc->p_fd->fd_cdir == NULL) - td->td_proc->p_fd->fd_cdir = rootvnode; + fdc = td->td_proc->p_fd; + FILEDESC_XLOCK(fdc); + if (fdc->fd_rdir == NULL) { + fdc->fd_rdir = rootvnode; + vref(fdc->fd_rdir); + } + if (fdc->fd_cdir == NULL) { + fdc->fd_cdir = rootvnode; + vref(fdc->fd_rdir); + } + FILEDESC_XUNLOCK(fdc); if (startvp != NULL) vref(startvp); - NDINIT_ATVP(&nd, operation, NOFOLLOW | MPSAFE, UIO_SYSSPACE, pnamep, - startvp, td); + NDINIT_ATVP(&nd, operation, MPSAFE, UIO_SYSSPACE, pnamep, startvp, td); + filemode |= O_NOFOLLOW; error = vn_open_cred(&nd, &filemode, createmode, td->td_ucred, NULL); NDFREE(&nd, NDF_ONLY_PNBUF); if (error == 0) { /* We just unlock so we hold a reference. */ - VN_HOLD(nd.ni_vp); VOP_UNLOCK(nd.ni_vp, 0); *vpp = nd.ni_vp; } @@ -248,12 +255,16 @@ drop: static __inline int zfs_vop_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr) { + int error, vfslocked; ASSERT(flag == (FWRITE | FCREAT | FTRUNC | FOFFMAX)); ASSERT(count == 1); ASSERT(offset == 0); - return (vn_close(vp, flag, cr, curthread)); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + error = vn_close(vp, flag, cr, curthread); + VFS_UNLOCK_GIANT(vfslocked); + return (error); } #define VOP_CLOSE(vp, oflags, count, offset, cr, ct) \ zfs_vop_close((vp), (oflags), (count), (offset), (cr)) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Tue Nov 25 20:28:33 2008 (r185318) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Tue Nov 25 21:14:00 2008 (r185319) @@ -154,11 +154,10 @@ out: static void spa_config_write(spa_config_dirent_t *dp, nvlist_t *nvl) { + int oflags = FWRITE | FTRUNC | FCREAT | FOFFMAX; + char *buf, *temp; size_t buflen; - char *buf; vnode_t *vp; - int oflags = FWRITE | FTRUNC | FCREAT | FOFFMAX; - char *temp; /* * If the nvlist is empty (NULL), then remove the old cachefile. @@ -193,7 +192,6 @@ spa_config_write(spa_config_dirent_t *dp (void) vn_rename(temp, dp->scd_path, UIO_SYSSPACE); } (void) VOP_CLOSE(vp, oflags, 1, 0, kcred, NULL); - VN_RELE(vp); } (void) vn_remove(temp, UIO_SYSSPACE, RMFILE); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Tue Nov 25 20:28:33 2008 (r185318) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Tue Nov 25 21:14:00 2008 (r185319) @@ -41,7 +41,7 @@ vdev_file_open(vdev_t *vd, uint64_t *psi vdev_file_t *vf; vnode_t *vp; vattr_t vattr; - int error; + int error, vfslocked; /* * We must have a pathname, and it must be absolute. @@ -75,6 +75,7 @@ vdev_file_open(vdev_t *vd, uint64_t *psi * Make sure it's a regular file. */ if (vp->v_type != VREG) { + (void) VOP_CLOSE(vp, spa_mode, 1, 0, kcred, NULL); vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; return (ENODEV); } @@ -83,10 +84,13 @@ vdev_file_open(vdev_t *vd, uint64_t *psi * Determine the physical size of the file. */ vattr.va_mask = AT_SIZE; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_GETATTR(vp, &vattr, kcred); VOP_UNLOCK(vp, 0); + VFS_UNLOCK_GIANT(vfslocked); if (error) { + (void) VOP_CLOSE(vp, spa_mode, 1, 0, kcred, NULL); vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; return (error); } @@ -101,18 +105,12 @@ static void vdev_file_close(vdev_t *vd) { vdev_file_t *vf = vd->vdev_tsd; - int vfslocked; if (vf == NULL) return; - if (vf->vf_vnode != NULL) { - vfslocked = VFS_LOCK_GIANT(vf->vf_vnode->v_mount); - (void)vn_close(vf->vf_vnode, spa_mode, kcred, curthread); - VN_RELE(vf->vf_vnode); - VFS_UNLOCK_GIANT(vfslocked); - } - + if (vf->vf_vnode != NULL) + (void) VOP_CLOSE(vf->vf_vnode, spa_mode, 1, 0, kcred, NULL); kmem_free(vf, sizeof (vdev_file_t)); vd->vdev_tsd = NULL; } @@ -122,6 +120,7 @@ vdev_file_io_start(zio_t *zio) { vdev_t *vd = zio->io_vd; vdev_file_t *vf = vd->vdev_tsd; + vnode_t *vp = vf->vf_vnode; ssize_t resid; if (zio->io_type == ZIO_TYPE_IOCTL) { @@ -133,7 +132,7 @@ vdev_file_io_start(zio_t *zio) switch (zio->io_cmd) { case DKIOCFLUSHWRITECACHE: - zio->io_error = VOP_FSYNC(vf->vf_vnode, FSYNC | FDSYNC, + zio->io_error = VOP_FSYNC(vp, FSYNC | FDSYNC, kcred, NULL); break; default: @@ -144,9 +143,8 @@ vdev_file_io_start(zio_t *zio) } zio->io_error = vn_rdwr(zio->io_type == ZIO_TYPE_READ ? - UIO_READ : UIO_WRITE, vf->vf_vnode, zio->io_data, - zio->io_size, zio->io_offset, UIO_SYSSPACE, - 0, RLIM64_INFINITY, kcred, &resid); + UIO_READ : UIO_WRITE, vp, zio->io_data, zio->io_size, + zio->io_offset, UIO_SYSSPACE, 0, RLIM64_INFINITY, kcred, &resid); if (resid != 0 && zio->io_error == 0) zio->io_error = ENOSPC; From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 21:54:42 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C94341065670; Tue, 25 Nov 2008 21:54:42 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC8F38FC16; Tue, 25 Nov 2008 21:54:42 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPLsgu4036052; Tue, 25 Nov 2008 21:54:42 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPLsgZo036051; Tue, 25 Nov 2008 21:54:42 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200811252154.mAPLsgZo036051@svn.freebsd.org> From: Maksim Yevmenkin Date: Tue, 25 Nov 2008 21:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185320 - head/usr.sbin/bluetooth/sdpd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 21:54:42 -0000 Author: emax Date: Tue Nov 25 21:54:42 2008 New Revision: 185320 URL: http://svn.freebsd.org/changeset/base/185320 Log: Straighten out those pesky SDP records for the Bluetooth Service Discovery Application Profile. Discussed with: Iain Hibbert of NetBSD plunky at rya dash online dot net MFC after: 3 weeks Modified: head/usr.sbin/bluetooth/sdpd/sd.c Modified: head/usr.sbin/bluetooth/sdpd/sd.c ============================================================================== --- head/usr.sbin/bluetooth/sdpd/sd.c Tue Nov 25 21:14:00 2008 (r185319) +++ head/usr.sbin/bluetooth/sdpd/sd.c Tue Nov 25 21:54:42 2008 (r185320) @@ -52,6 +52,22 @@ sd_profile_create_service_class_id_list( } static int32_t +sd_profile_create_bluetooth_profile_descriptor_list( + uint8_t *buf, uint8_t const * const eob, + uint8_t const *data, uint32_t datalen) +{ + static uint16_t profile_descriptor_list[] = { + SDP_SERVICE_CLASS_SERVICE_DISCOVERY_SERVER, + 0x0100 + }; + + return (common_profile_create_bluetooth_profile_descriptor_list( + buf, eob, + (uint8_t const *) profile_descriptor_list, + sizeof(profile_descriptor_list))); +} + +static int32_t sd_profile_create_service_id( uint8_t *buf, uint8_t const * const eob, uint8_t const *data, uint32_t datalen) @@ -89,25 +105,23 @@ sd_profile_create_protocol_descriptor_li uint8_t *buf, uint8_t const * const eob, uint8_t const *data, uint32_t datalen) { - if (buf + 13 > eob) + if (buf + 12 > eob) return (-1); SDP_PUT8(SDP_DATA_SEQ8, buf); - SDP_PUT8(11, buf); + SDP_PUT8(10, buf); SDP_PUT8(SDP_DATA_SEQ8, buf); - SDP_PUT8(9, buf); - + SDP_PUT8(3, buf); SDP_PUT8(SDP_DATA_UUID16, buf); SDP_PUT16(SDP_UUID_PROTOCOL_L2CAP, buf); - SDP_PUT8(SDP_DATA_UINT16, buf); - SDP_PUT16(NG_L2CAP_PSM_SDP, buf); - - SDP_PUT8(SDP_DATA_UINT16, buf); - SDP_PUT16(1, buf); /* version */ + SDP_PUT8(SDP_DATA_SEQ8, buf); + SDP_PUT8(3, buf); + SDP_PUT8(SDP_DATA_UUID16, buf); + SDP_PUT16(SDP_UUID_PROTOCOL_SDP, buf); - return (13); + return (12); } static int32_t @@ -182,6 +196,8 @@ static attr_t sd_profile_attrs[] = { common_profile_create_service_record_handle }, { SDP_ATTR_SERVICE_CLASS_ID_LIST, sd_profile_create_service_class_id_list }, + { SDP_ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST, + sd_profile_create_bluetooth_profile_descriptor_list }, { SDP_ATTR_SERVICE_ID, sd_profile_create_service_id }, { SDP_ATTR_LANGUAGE_BASE_ATTRIBUTE_ID_LIST, From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 23:05:46 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8EFC106564A; Tue, 25 Nov 2008 23:05:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE4528FC16; Tue, 25 Nov 2008 23:05:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPN5kJ0037504; Tue, 25 Nov 2008 23:05:46 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPN5ksk037503; Tue, 25 Nov 2008 23:05:46 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200811252305.mAPN5ksk037503@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 25 Nov 2008 23:05:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185321 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 23:05:46 -0000 Author: trasz Date: Tue Nov 25 23:05:46 2008 New Revision: 185321 URL: http://svn.freebsd.org/changeset/base/185321 Log: MFp4: We don't support TX_CREATE_ACL_ATTR nor TX_MKDIR_ACL_ATTR; code found in zfs_replay.c will panic if it encounters transactions of this type. Make sure we don't put these into the ZIL. Approved by: rwatson (mentor), pjd Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Tue Nov 25 21:54:42 2008 (r185320) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Tue Nov 25 23:05:46 2008 (r185321) @@ -60,7 +60,11 @@ zfs_log_create_txtype(zil_create_t type, if (vsecp == NULL && !isxvattr) return (TX_CREATE); if (vsecp && isxvattr) +#ifdef TODO return (TX_CREATE_ACL_ATTR); +#else + panic("%s:%u: unsupported condition", __func__, __LINE__); +#endif if (vsecp) return (TX_CREATE_ACL); else @@ -70,7 +74,11 @@ zfs_log_create_txtype(zil_create_t type, if (vsecp == NULL && !isxvattr) return (TX_MKDIR); if (vsecp && isxvattr) +#ifdef TODO return (TX_MKDIR_ACL_ATTR); +#else + panic("%s:%u: unsupported condition", __func__, __LINE__); +#endif if (vsecp) return (TX_MKDIR_ACL); else From owner-svn-src-all@FreeBSD.ORG Tue Nov 25 23:24:29 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 900BB1065674; Tue, 25 Nov 2008 23:24:29 +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 858198FC17; Tue, 25 Nov 2008 23:24:29 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAPNOTdo037928; Tue, 25 Nov 2008 23:24:29 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAPNOTSe037924; Tue, 25 Nov 2008 23:24:29 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200811252324.mAPNOTSe037924@svn.freebsd.org> From: Attilio Rao Date: Tue, 25 Nov 2008 23:24:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185322 - head/usr.sbin/pmcstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 23:24:29 -0000 Author: attilio Date: Tue Nov 25 23:24:29 2008 New Revision: 185322 URL: http://svn.freebsd.org/changeset/base/185322 Log: Add the -m option to pmcstat. This option prints the list of sampled PCs along with the function name, the start and end addresses of this where their live within. Reviewed by: jkoshy Tested by: gnn Sponsored by: Nokia Modified: head/usr.sbin/pmcstat/pmcstat.8 head/usr.sbin/pmcstat/pmcstat.c head/usr.sbin/pmcstat/pmcstat.h head/usr.sbin/pmcstat/pmcstat_log.c Modified: head/usr.sbin/pmcstat/pmcstat.8 ============================================================================== --- head/usr.sbin/pmcstat/pmcstat.8 Tue Nov 25 23:05:46 2008 (r185321) +++ head/usr.sbin/pmcstat/pmcstat.8 Tue Nov 25 23:24:29 2008 (r185322) @@ -48,6 +48,7 @@ .Op Fl d .Op Fl g .Op Fl k Ar kerneldir +.Op Fl m Ar pathname .Op Fl n Ar rate .Op Fl o Ar outputfile .Op Fl p Ar event-spec @@ -232,6 +233,19 @@ This directory specifies where should look for the kernel and its modules. The default is .Pa /boot/kernel . +.It Fl m Ar pathname +Print the sampled PCs with the name, the start and ending addresses +of the function within they live. +The +.Ar pathname +argument is mandatory and indicates where informations will be stored. +If argument +.Ar pathname +is a +.Dq Li - +this information is sent to the output file specified by the +.Fl o +option. .It Fl n Ar rate Set the default sampling rate for subsequent sampling mode PMCs specified on the command line. Modified: head/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- head/usr.sbin/pmcstat/pmcstat.c Tue Nov 25 23:05:46 2008 (r185321) +++ head/usr.sbin/pmcstat/pmcstat.c Tue Nov 25 23:24:29 2008 (r185322) @@ -594,7 +594,7 @@ main(int argc, char **argv) } while ((option = getopt(argc, argv, - "CD:EG:M:NO:P:R:S:Wc:dgk:n:o:p:qr:s:t:vw:z:")) != -1) + "CD:EG:M:NO:P:R:S:Wc:dgk:m:n:o:p:qr:s:t:vw:z:")) != -1) switch (option) { case 'C': /* cumulative values */ use_cumulative_counts = !use_cumulative_counts; @@ -644,6 +644,11 @@ main(int argc, char **argv) args.pa_flags |= FLAG_HAS_KERNELPATH; break; + case 'm': + args.pa_flags |= FLAG_WANTS_MAPPINGS; + graphfilename = optarg; + break; + case 'E': /* log process exit */ do_logprocexit = !do_logprocexit; args.pa_required |= (FLAG_HAS_PROCESS_PMCS | @@ -827,7 +832,8 @@ main(int argc, char **argv) if (argc) /* command line present */ args.pa_flags |= FLAG_HAS_COMMANDLINE; - if (args.pa_flags & (FLAG_DO_GPROF | FLAG_DO_CALLGRAPHS)) + if (args.pa_flags & (FLAG_DO_GPROF | FLAG_DO_CALLGRAPHS | + FLAG_WANTS_MAPPINGS)) args.pa_flags |= FLAG_DO_ANALYSIS; /* @@ -839,6 +845,16 @@ main(int argc, char **argv) errx(EX_USAGE, "ERROR: options -O and -R are mutually " "exclusive."); + /* -m option is allowed with -R only. */ + if (args.pa_flags & FLAG_WANTS_MAPPINGS && args.pa_inputpath == NULL) + errx(EX_USAGE, "ERROR: option -m requires an input file"); + + /* -m option is not allowed combined with -g or -G. */ + if (args.pa_flags & FLAG_WANTS_MAPPINGS && + args.pa_flags & (FLAG_DO_GPROF | FLAG_DO_CALLGRAPHS)) + errx(EX_USAGE, "ERROR: option -m and -g | -G are mutually " + "exclusive"); + if (args.pa_flags & FLAG_READ_LOGFILE) { errmsg = NULL; if (args.pa_flags & FLAG_HAS_COMMANDLINE) @@ -980,6 +996,12 @@ main(int argc, char **argv) "for writing", graphfilename); } } + if (args.pa_flags & FLAG_WANTS_MAPPINGS) { + args.pa_graphfile = fopen(graphfilename, "w"); + if (args.pa_graphfile == NULL) + err(EX_OSERR, "ERROR: cannot open \"%s\" for writing", + graphfilename); + } /* if we've been asked to process a log file, do that and exit */ if (args.pa_flags & FLAG_READ_LOGFILE) { Modified: head/usr.sbin/pmcstat/pmcstat.h ============================================================================== --- head/usr.sbin/pmcstat/pmcstat.h Tue Nov 25 23:05:46 2008 (r185321) +++ head/usr.sbin/pmcstat/pmcstat.h Tue Nov 25 23:24:29 2008 (r185322) @@ -49,6 +49,7 @@ #define FLAG_DO_PRINT 0x00002000 /* -o */ #define FLAG_DO_CALLGRAPHS 0x00004000 /* -G */ #define FLAG_DO_ANALYSIS 0x00008000 /* -g or -G */ +#define FLAG_WANTS_MAPPINGS 0x00010000 /* -m */ #define DEFAULT_SAMPLE_COUNT 65536 #define DEFAULT_WAIT_INTERVAL 5.0 Modified: head/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- head/usr.sbin/pmcstat/pmcstat_log.c Tue Nov 25 23:05:46 2008 (r185321) +++ head/usr.sbin/pmcstat/pmcstat_log.c Tue Nov 25 23:24:29 2008 (r185322) @@ -1969,9 +1969,10 @@ static int pmcstat_analyze_log(struct pmcstat_args *a) { uint32_t cpu, cpuflags; - uintfptr_t pc; + uintfptr_t pc, newpc; pid_t pid; struct pmcstat_image *image; + struct pmcstat_symbol *sym; struct pmcstat_process *pp, *ppnew; struct pmcstat_pcmap *ppm, *ppmtmp; struct pmclog_ev ev; @@ -2085,21 +2086,41 @@ pmcstat_analyze_log(struct pmcstat_args pp = pmcstat_process_lookup(ev.pl_u.pl_cc.pl_pid, PMCSTAT_ALLOCATE); - pmcstat_record_callchain(pp, - ev.pl_u.pl_cc.pl_pmcid, ev.pl_u.pl_cc.pl_npc, - ev.pl_u.pl_cc.pl_pc, - PMC_CALLCHAIN_CPUFLAGS_TO_USERMODE(cpuflags), a); + if ((a->pa_flags & FLAG_WANTS_MAPPINGS) == 0) + pmcstat_record_callchain(pp, + ev.pl_u.pl_cc.pl_pmcid, + ev.pl_u.pl_cc.pl_npc, ev.pl_u.pl_cc.pl_pc, + PMC_CALLCHAIN_CPUFLAGS_TO_USERMODE(cpuflags), a); - if ((a->pa_flags & FLAG_DO_GPROF) == 0) + if ((a->pa_flags & + (FLAG_DO_GPROF | FLAG_WANTS_MAPPINGS)) == 0) break; pc = ev.pl_u.pl_cc.pl_pc[0]; - if ((ppm = pmcstat_process_find_map(pp, pc)) == NULL && - (ppm = pmcstat_process_find_map(pmcstat_kernproc, - pc)) == NULL) { /* unknown offset */ + if (PMC_CALLCHAIN_CPUFLAGS_TO_USERMODE(cpuflags) == 0) + pp = pmcstat_kernproc; + ppm = pmcstat_process_find_map(pp, pc); + if (ppm == NULL) { + + /* Unknown offset. */ pmcstat_stats.ps_samples_unknown_offset++; break; } + if (a->pa_flags & FLAG_WANTS_MAPPINGS) { + image = ppm->ppm_image; + newpc = pc - (ppm->ppm_lowpc + + (image->pi_vaddr - image->pi_start)); + sym = pmcstat_symbol_search(image, newpc); + if (sym == NULL) + break; + fprintf(a->pa_graphfile, "%p %s 0x%jx 0x%jx\n", + (void *)pc, + pmcstat_string_unintern(sym->ps_name), + (uintmax_t)(sym->ps_start + + image->pi_vaddr), (uintmax_t)(sym->ps_end + + image->pi_vaddr)); + break; + } pmcstat_image_increment_bucket(ppm, pc, ev.pl_u.pl_cc.pl_pmcid, a); From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 00:52:44 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24858106564A; Wed, 26 Nov 2008 00:52:44 +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 178CD8FC08; Wed, 26 Nov 2008 00:52:44 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQ0qhXr039643; Wed, 26 Nov 2008 00:52:43 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQ0qhTi039642; Wed, 26 Nov 2008 00:52:43 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811260052.mAQ0qhTi039642@svn.freebsd.org> From: Ken Smith Date: Wed, 26 Nov 2008 00:52:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185323 - releng/6.4/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 00:52:44 -0000 Author: kensmith Date: Wed Nov 26 00:52:43 2008 New Revision: 185323 URL: http://svn.freebsd.org/changeset/base/185323 Log: Going ahead with 6.4-RELEASE now. Approved by: re (implicit) Modified: releng/6.4/sys/conf/newvers.sh Modified: releng/6.4/sys/conf/newvers.sh ============================================================================== --- releng/6.4/sys/conf/newvers.sh Tue Nov 25 23:24:29 2008 (r185322) +++ releng/6.4/sys/conf/newvers.sh Wed Nov 26 00:52:43 2008 (r185323) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="6.4" -BRANCH="RC2" +BRANCH="RELEASE" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 01:09:49 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21508106564A; Wed, 26 Nov 2008 01:09:49 +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 EE6488FC12; Wed, 26 Nov 2008 01:09:48 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQ19mZ5039995; Wed, 26 Nov 2008 01:09:48 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQ19m6A039994; Wed, 26 Nov 2008 01:09:48 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811260109.mAQ19m6A039994@svn.freebsd.org> From: Ken Smith Date: Wed, 26 Nov 2008 01:09:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-release@freebsd.org X-SVN-Group: release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185324 - release/6.4.0 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 01:09:49 -0000 Author: kensmith Date: Wed Nov 26 01:09:48 2008 New Revision: 185324 URL: http://svn.freebsd.org/changeset/base/185324 Log: Copy releng/6.4 to release/6.4.0 in preparation for 6.4-RELEASE. Approved by: re (implicit) Added: release/6.4.0/ - copied from r185323, releng/6.4/ From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 03:48:21 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FAD9106564A; Wed, 26 Nov 2008 03:48:21 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3776F8FC0C; Wed, 26 Nov 2008 03:48:21 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQ3mLeB043371; Wed, 26 Nov 2008 03:48:21 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQ3mLFj043370; Wed, 26 Nov 2008 03:48:21 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200811260348.mAQ3mLFj043370@svn.freebsd.org> From: Joseph Koshy Date: Wed, 26 Nov 2008 03:48:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185326 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 03:48:21 -0000 Author: jkoshy Date: Wed Nov 26 03:48:20 2008 New Revision: 185326 URL: http://svn.freebsd.org/changeset/base/185326 Log: Fix buglets. Modified: head/lib/libpmc/pmc.core.3 Modified: head/lib/libpmc/pmc.core.3 ============================================================================== --- head/lib/libpmc/pmc.core.3 Wed Nov 26 03:14:24 2008 (r185325) +++ head/lib/libpmc/pmc.core.3 Wed Nov 26 03:48:20 2008 (r185326) @@ -353,7 +353,7 @@ unit, excluding L2 writebacks. .It Li Cycles_Div_Busy .Pq Event 14H , Umask 00H The number of cycles the divider is busy. -The event is only only available for on PMC0. +The event is only available on PMC0. .It Li Cycles_Int_Masked .Pq Event C6H , Umask 00H The number of cycles while interrupts were disabled. @@ -655,7 +655,7 @@ The number of SIMD integer saturating in .Pq Event B3H , Umask 08H The number of SIMD integer unpack instructions executed. .It Li SMC_Detected -.Pq Event C3H +.Pq Event C3H , Umask 00H The number of times self-modifying code was detected. .It Li SSE_NTStores_Miss .Pq Event 4BH , Umask 03H From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 05:18:27 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 622EE1065674; Wed, 26 Nov 2008 05:18:27 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A8AF8FC12; Wed, 26 Nov 2008 05:18:27 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQ5IR89045172; Wed, 26 Nov 2008 05:18:27 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQ5IRWN045171; Wed, 26 Nov 2008 05:18:27 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811260518.mAQ5IRWN045171@svn.freebsd.org> From: Marcel Moolenaar Date: Wed, 26 Nov 2008 05:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185327 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 05:18:27 -0000 Author: marcel Date: Wed Nov 26 05:18:27 2008 New Revision: 185327 URL: http://svn.freebsd.org/changeset/base/185327 Log: Allow dumpon to a partition of type FS_UNUSED as well. Modified: head/sys/geom/part/g_part_bsd.c Modified: head/sys/geom/part/g_part_bsd.c ============================================================================== --- head/sys/geom/part/g_part_bsd.c Wed Nov 26 03:48:20 2008 (r185326) +++ head/sys/geom/part/g_part_bsd.c Wed Nov 26 05:18:27 2008 (r185327) @@ -241,9 +241,10 @@ g_part_bsd_dumpto(struct g_part_table *t { struct g_part_bsd_entry *entry; - /* Allow dumping to a swap partition only. */ + /* Allow dumping to a swap partition or an unused partition. */ entry = (struct g_part_bsd_entry *)baseentry; - return ((entry->part.p_fstype == FS_SWAP) ? 1 : 0); + return ((entry->part.p_fstype == FS_UNUSED || + entry->part.p_fstype == FS_SWAP) ? 1 : 0); } static int From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 05:51:50 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3F181065672; Wed, 26 Nov 2008 05:51:50 +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 8D5F98FC1C; Wed, 26 Nov 2008 05:51:50 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQ5pnlB045889; Wed, 26 Nov 2008 05:51:49 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQ5pnTD045888; Wed, 26 Nov 2008 05:51:49 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811260551.mAQ5pnTD045888@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 26 Nov 2008 05:51:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185328 - head/sys/dev/fxp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 05:51:50 -0000 Author: yongari Date: Wed Nov 26 05:51:49 2008 New Revision: 185328 URL: http://svn.freebsd.org/changeset/base/185328 Log: o Introduce a new function, fxp_new_rfabuf which allocates a new Rx buffer and loads DMA map. Also add a function fxp_discard_rfabuf that handles reusing Rx buffer/DMA map. With this change fxp_add_rfabuf just handles appending a new RFA to existing chain. o Initialize mbuf length in fxp_new_rfabuf. o Don't reset rnr and have fxp(4) handle received frames even if it couldn't allocate new Rx buffer. This will make fxp(4) reload updated RFA under rnr case. The rnr would still be reset to 0 if polling is active and fxp(4) processed number of allowed Rx events. o Update if_iqdrops if fxp(4) couldn't allocate Rx buffer. Previously fxp(4) used to try to reuse Rx buffer when new buffer allocation is failed. But fxp(4) didn't take into account loaded DMA map such that the same DMA map was loaded again without unloading the map. There is no reason to unload the loaded map and reload the same map again, just reusing the map is enough. I believe the spare DMA map in softc was introduced to implement this behaviour. Also fxp(4) used to stop Rx processing if once Rx buffer allocation or DMA map load fails which in turn resulted in losing incoming frames under heavy network load. With this change fxp(4) should survive from resource shortage condition. Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Wed Nov 26 05:18:27 2008 (r185327) +++ head/sys/dev/fxp/if_fxp.c Wed Nov 26 05:51:49 2008 (r185328) @@ -227,8 +227,12 @@ static void fxp_release(struct fxp_sof static int fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data); static void fxp_watchdog(struct fxp_softc *sc); -static int fxp_add_rfabuf(struct fxp_softc *sc, - struct fxp_rx *rxp, struct mbuf *oldm); +static void fxp_add_rfabuf(struct fxp_softc *sc, + struct fxp_rx *rxp); +static void fxp_discard_rfabuf(struct fxp_softc *sc, + struct fxp_rx *rxp); +static int fxp_new_rfabuf(struct fxp_softc *sc, + struct fxp_rx *rxp); static int fxp_mc_addrs(struct fxp_softc *sc); static void fxp_mc_setup(struct fxp_softc *sc); static uint16_t fxp_eeprom_getword(struct fxp_softc *sc, int offset, @@ -712,10 +716,11 @@ fxp_attach(device_t dev) device_printf(dev, "can't create DMA map for RX\n"); goto fail; } - if (fxp_add_rfabuf(sc, rxp, NULL) != 0) { + if (fxp_new_rfabuf(sc, rxp) != 0) { error = ENOMEM; goto fail; } + fxp_add_rfabuf(sc, rxp); } /* @@ -1560,7 +1565,6 @@ fxp_intr_body(struct fxp_softc *sc, stru struct fxp_rx *rxp; struct fxp_rfa *rfa; int rnr = (statack & FXP_SCB_STATACK_RNR) ? 1 : 0; - int fxp_rc = 0; uint16_t status; FXP_LOCK_ASSERT(sc, MA_OWNED); @@ -1647,8 +1651,7 @@ fxp_intr_body(struct fxp_softc *sc, stru * If this fails, the old buffer is recycled * instead. */ - fxp_rc = fxp_add_rfabuf(sc, rxp, m); - if (fxp_rc == 0) { + if (fxp_new_rfabuf(sc, rxp) == 0) { int total_len; /* @@ -1700,10 +1703,12 @@ fxp_intr_body(struct fxp_softc *sc, stru FXP_UNLOCK(sc); (*ifp->if_input)(ifp, m); FXP_LOCK(sc); - } else if (fxp_rc == ENOBUFS) { - rnr = 0; - break; + } else { + /* Reuse RFA and loaded DMA map. */ + ifp->if_iqdrops++; + fxp_discard_rfabuf(sc, rxp); } + fxp_add_rfabuf(sc, rxp); } if (rnr) { fxp_scb_wait(sc); @@ -2234,32 +2239,21 @@ fxp_ifmedia_sts(struct ifnet *ifp, struc /* * Add a buffer to the end of the RFA buffer list. * Return 0 if successful, 1 for failure. A failure results in - * adding the 'oldm' (if non-NULL) on to the end of the list - - * tossing out its old contents and recycling it. + * reusing the RFA buffer. * The RFA struct is stuck at the beginning of mbuf cluster and the * data pointer is fixed up to point just past it. */ static int -fxp_add_rfabuf(struct fxp_softc *sc, struct fxp_rx *rxp, struct mbuf *oldm) +fxp_new_rfabuf(struct fxp_softc *sc, struct fxp_rx *rxp) { struct mbuf *m; - struct fxp_rfa *rfa, *p_rfa; - struct fxp_rx *p_rx; + struct fxp_rfa *rfa; bus_dmamap_t tmp_map; - int error, reused_mbuf=0; + int error; m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - if (m == NULL) { - if (oldm == NULL) - return ENOBUFS; - m = oldm; - m->m_data = m->m_ext.ext_buf; - /* - * return error so the receive loop will - * not pass the packet to upper layer - */ - reused_mbuf = EAGAIN; - } + if (m == NULL) + return (ENOBUFS); /* * Move the data pointer up so that the incoming data packet @@ -2278,6 +2272,8 @@ fxp_add_rfabuf(struct fxp_softc *sc, str rfa->rfa_status = 0; rfa->rfa_control = htole16(FXP_RFA_CONTROL_EL); rfa->actual_size = 0; + m->m_len = m->m_pkthdr.len = MCLBYTES - RFA_ALIGNMENT_FUDGE - + sc->rfa_size; /* * Initialize the rest of the RFA. Note that since the RFA @@ -2305,6 +2301,14 @@ fxp_add_rfabuf(struct fxp_softc *sc, str bus_dmamap_sync(sc->fxp_mtag, rxp->rx_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + return (0); +} + +static void +fxp_add_rfabuf(struct fxp_softc *sc, struct fxp_rx *rxp) +{ + struct fxp_rfa *p_rfa; + struct fxp_rx *p_rx; /* * If there are other buffers already on the list, attach this @@ -2324,7 +2328,45 @@ fxp_add_rfabuf(struct fxp_softc *sc, str sc->fxp_desc.rx_head = rxp; } sc->fxp_desc.rx_tail = rxp; - return (reused_mbuf); +} + +static void +fxp_discard_rfabuf(struct fxp_softc *sc, struct fxp_rx *rxp) +{ + struct mbuf *m; + struct fxp_rfa *rfa; + + m = rxp->rx_mbuf; + m->m_data = m->m_ext.ext_buf; + /* + * Move the data pointer up so that the incoming data packet + * will be 32-bit aligned. + */ + m->m_data += RFA_ALIGNMENT_FUDGE; + + /* + * Get a pointer to the base of the mbuf cluster and move + * data start past it. + */ + rfa = mtod(m, struct fxp_rfa *); + m->m_data += sc->rfa_size; + rfa->size = htole16(MCLBYTES - sc->rfa_size - RFA_ALIGNMENT_FUDGE); + + rfa->rfa_status = 0; + rfa->rfa_control = htole16(FXP_RFA_CONTROL_EL); + rfa->actual_size = 0; + + /* + * Initialize the rest of the RFA. Note that since the RFA + * is misaligned, we cannot store values directly. We're thus + * using the le32enc() function which handles endianness and + * is also alignment-safe. + */ + le32enc(&rfa->link_addr, 0xffffffff); + le32enc(&rfa->rbd_addr, 0xffffffff); + + bus_dmamap_sync(sc->fxp_mtag, rxp->rx_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); } static int From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 06:36:53 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB00A1065672; Wed, 26 Nov 2008 06:36:53 +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 95D088FC0A; Wed, 26 Nov 2008 06:36:53 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQ6arBK046760; Wed, 26 Nov 2008 06:36:53 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQ6ardc046758; Wed, 26 Nov 2008 06:36:53 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811260636.mAQ6ardc046758@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 26 Nov 2008 06:36:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185329 - head/sys/dev/fxp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 06:36:53 -0000 Author: yongari Date: Wed Nov 26 06:36:53 2008 New Revision: 185329 URL: http://svn.freebsd.org/changeset/base/185329 Log: Implement Rx checksum offload for 82559 or later controllers. 82559 or later controllers added simple checksum calculation logic in RU. For backward compatibility the computed checksum is appended at the end of the data posted to Rx buffer. This type of simple checksum calculation support had been used on several vendors such as Sun HME/GEM, SysKonnect GENESIS and Marvell Yukon controllers. Because this type of checksum offload support requires parsing of received frame and pseudo checksum calculation with software routine it still consumes more CPU cycles than that of full-fledged checksum offload controller. But it's still better than software checksum calculation. Modified: head/sys/dev/fxp/if_fxp.c head/sys/dev/fxp/if_fxpvar.h Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Wed Nov 26 05:51:49 2008 (r185328) +++ head/sys/dev/fxp/if_fxp.c Wed Nov 26 06:36:53 2008 (r185329) @@ -59,15 +59,15 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include - -#ifdef FXP_IP_CSUM_WAR #include #include #include +#include +#include + +#include #include -#endif +#include #include #include /* for PCIM_CMD_xxx */ @@ -213,6 +213,8 @@ static int fxp_suspend(device_t dev); static int fxp_resume(device_t dev); static void fxp_intr(void *xsc); +static void fxp_rxcsum(struct fxp_softc *sc, struct ifnet *ifp, + struct mbuf *m, uint16_t status, int pos); static void fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp, uint8_t statack, int count); static void fxp_init(void *xsc); @@ -591,6 +593,9 @@ fxp_attach(device_t dev) sc->flags |= FXP_FLAG_SAVE_BAD; } + /* For 82559 or later chips, Rx checksum offload is supported. */ + if (sc->revision >= FXP_REV_82559_A0) + sc->flags |= FXP_FLAG_82559_RXCSUM; /* * Enable use of extended RFDs and TCBs for 82550 * and later chips. Note: we need extended TXCB support @@ -603,6 +608,8 @@ fxp_attach(device_t dev) sc->rfa_size = sizeof (struct fxp_rfa); sc->tx_cmd = FXP_CB_COMMAND_IPCBXMIT; sc->flags |= FXP_FLAG_EXT_RFA; + /* Use extended RFA instead of 82559 checksum mode. */ + sc->flags &= ~FXP_FLAG_82559_RXCSUM; } else { sc->rfa_size = sizeof (struct fxp_rfa) - FXP_RFAX_LEN; sc->tx_cmd = FXP_CB_COMMAND_XMIT; @@ -780,6 +787,11 @@ fxp_attach(device_t dev) ifp->if_capenable |= IFCAP_HWCSUM; } + if (sc->flags & FXP_FLAG_82559_RXCSUM) { + ifp->if_capabilities |= IFCAP_RXCSUM; + ifp->if_capenable |= IFCAP_RXCSUM; + } + #ifdef DEVICE_POLLING /* Inform the world we support polling. */ ifp->if_capabilities |= IFCAP_POLLING; @@ -1558,6 +1570,84 @@ fxp_txeof(struct fxp_softc *sc) } static void +fxp_rxcsum(struct fxp_softc *sc, struct ifnet *ifp, struct mbuf *m, + uint16_t status, int pos) +{ + struct ether_header *eh; + struct ip *ip; + struct udphdr *uh; + int32_t hlen, len, pktlen, temp32; + uint16_t csum, *opts; + + if ((sc->flags & FXP_FLAG_82559_RXCSUM) == 0) { + if ((status & FXP_RFA_STATUS_PARSE) != 0) { + if (status & FXP_RFDX_CS_IP_CSUM_BIT_VALID) + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if (status & FXP_RFDX_CS_IP_CSUM_VALID) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + if ((status & FXP_RFDX_CS_TCPUDP_CSUM_BIT_VALID) && + (status & FXP_RFDX_CS_TCPUDP_CSUM_VALID)) { + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | + CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xffff; + } + } + return; + } + + pktlen = m->m_pkthdr.len; + if (pktlen < sizeof(struct ether_header) + sizeof(struct ip)) + return; + eh = mtod(m, struct ether_header *); + if (eh->ether_type != htons(ETHERTYPE_IP)) + return; + ip = (struct ip *)(eh + 1); + if (ip->ip_v != IPVERSION) + return; + + hlen = ip->ip_hl << 2; + pktlen -= sizeof(struct ether_header); + if (hlen < sizeof(struct ip)) + return; + if (ntohs(ip->ip_len) < hlen) + return; + if (ntohs(ip->ip_len) != pktlen) + return; + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) + return; /* can't handle fragmented packet */ + + switch (ip->ip_p) { + case IPPROTO_TCP: + if (pktlen < (hlen + sizeof(struct tcphdr))) + return; + break; + case IPPROTO_UDP: + if (pktlen < (hlen + sizeof(struct udphdr))) + return; + uh = (struct udphdr *)((caddr_t)ip + hlen); + if (uh->uh_sum == 0) + return; /* no checksum */ + break; + default: + return; + } + /* Extract computed checksum. */ + csum = be16dec(mtod(m, char *) + pos); + /* checksum fixup for IP options */ + len = hlen - sizeof(struct ip); + if (len > 0) { + opts = (uint16_t *)(ip + 1); + for (; len > 0; len -= sizeof(uint16_t), opts++) { + temp32 = csum - *opts; + temp32 = (temp32 >> 16) + (temp32 & 65535); + csum = temp32 & 65535; + } + } + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID; + m->m_pkthdr.csum_data = csum; +} + +static void fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp, uint8_t statack, int count) { @@ -1661,6 +1751,11 @@ fxp_intr_body(struct fxp_softc *sc, stru * of bogus length or CRC errors. */ total_len = le16toh(rfa->actual_size) & 0x3fff; + if ((sc->flags & FXP_FLAG_82559_RXCSUM) != 0 && + (ifp->if_capenable & IFCAP_RXCSUM) != 0) { + /* Adjust for appended checksum bytes. */ + total_len -= 2; + } if (total_len < sizeof(struct ether_header) || total_len > MCLBYTES - RFA_ALIGNMENT_FUDGE - sc->rfa_size || status & FXP_RFA_STATUS_CRC) { @@ -1668,30 +1763,12 @@ fxp_intr_body(struct fxp_softc *sc, stru continue; } - /* Do IP checksum checking. */ - if ((ifp->if_capenable & IFCAP_RXCSUM) != 0 && - (status & FXP_RFA_STATUS_PARSE)) { - if (rfa->rfax_csum_sts & - FXP_RFDX_CS_IP_CSUM_BIT_VALID) - m->m_pkthdr.csum_flags |= - CSUM_IP_CHECKED; - if (rfa->rfax_csum_sts & - FXP_RFDX_CS_IP_CSUM_VALID) - m->m_pkthdr.csum_flags |= - CSUM_IP_VALID; - if ((rfa->rfax_csum_sts & - FXP_RFDX_CS_TCPUDP_CSUM_BIT_VALID) && - (rfa->rfax_csum_sts & - FXP_RFDX_CS_TCPUDP_CSUM_VALID)) { - m->m_pkthdr.csum_flags |= - CSUM_DATA_VALID|CSUM_PSEUDO_HDR; - m->m_pkthdr.csum_data = 0xffff; - } - } - m->m_pkthdr.len = m->m_len = total_len; m->m_pkthdr.rcvif = ifp; + /* Do IP checksum checking. */ + if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) + fxp_rxcsum(sc, ifp, m, status, total_len); /* * Drop locks before calling if_input() since it * may re-enter fxp_start() in the netisr case. @@ -2024,7 +2101,8 @@ fxp_init_body(struct fxp_softc *sc) cbp->ext_rfa = sc->flags & FXP_FLAG_EXT_RFA ? 1 : 0; cbp->mediatype = sc->flags & FXP_FLAG_SERIAL_MEDIA ? 0 : 1; cbp->csma_dis = 0; /* (don't) disable link */ - cbp->tcp_udp_cksum = 0; /* (don't) enable checksum */ + cbp->tcp_udp_cksum = ((sc->flags & FXP_FLAG_82559_RXCSUM) != 0 && + (ifp->if_capenable & IFCAP_RXCSUM) != 0) ? 1 : 0; cbp->vlan_tco = 0; /* (don't) enable vlan wakeup */ cbp->link_wake_en = 0; /* (don't) assert PME# on link change */ cbp->arp_wake_en = 0; /* (don't) assert PME# on arp */ @@ -2506,8 +2584,11 @@ fxp_ioctl(struct ifnet *ifp, u_long comm ifp->if_hwassist &= ~FXP_CSUM_FEATURES; } if ((mask & IFCAP_RXCSUM) != 0 && - (ifp->if_capabilities & IFCAP_RXCSUM) != 0) + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) { ifp->if_capenable ^= IFCAP_RXCSUM; + if ((sc->flags & FXP_FLAG_82559_RXCSUM) != 0) + reinit++; + } if ((mask & IFCAP_VLAN_MTU) != 0 && (ifp->if_capabilities & IFCAP_VLAN_MTU) != 0) { ifp->if_capenable ^= IFCAP_VLAN_MTU; Modified: head/sys/dev/fxp/if_fxpvar.h ============================================================================== --- head/sys/dev/fxp/if_fxpvar.h Wed Nov 26 05:51:49 2008 (r185328) +++ head/sys/dev/fxp/if_fxpvar.h Wed Nov 26 06:36:53 2008 (r185329) @@ -194,6 +194,7 @@ struct fxp_softc { #define FXP_FLAG_DEFERRED_RNR 0x0200 /* DEVICE_POLLING deferred RNR */ #define FXP_FLAG_EXT_RFA 0x0400 /* extended RFDs for csum offload */ #define FXP_FLAG_SAVE_BAD 0x0800 /* save bad pkts: bad size, CRC, etc */ +#define FXP_FLAG_82559_RXCSUM 0x1000 /* 82559 compatible RX checksum */ /* Macros to ease CSR access. */ #define CSR_READ_1(sc, reg) bus_read_1(sc->fxp_res[0], reg) From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 07:36:18 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 100A8106567D; Wed, 26 Nov 2008 07:36:18 +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 F05698FC20; Wed, 26 Nov 2008 07:36:17 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQ7aH3c048007; Wed, 26 Nov 2008 07:36:17 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQ7aHqb048004; Wed, 26 Nov 2008 07:36:17 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811260736.mAQ7aHqb048004@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 26 Nov 2008 07:36:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185330 - head/sys/dev/fxp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 07:36:18 -0000 Author: yongari Date: Wed Nov 26 07:36:17 2008 New Revision: 185330 URL: http://svn.freebsd.org/changeset/base/185330 Log: Implement TSO for 82550/82551 controllers. o Configure controller to use dynamic TBD as TSO requires that operation mode. o Add a dummy TBD to tx_cb_u as TSO can access one more TBD in TSO operation. o Increase a DMA segment size to 4096 to hold a full IP segment with link layer header. o Unlike other TSO capable controllers, 82550/82551 does not modify the first IP packet in TSO operation so driver should create an IP packet with proper header. Subsequent IP packets are generated from the header information in the first IP packet header. Likewise pseudo checksum also should be computed by driver for the first packet. o TSO requires one more TBD to hold total TCP payload. To make code simple for TSO/non-TSO case, increase the index of the first available TBD array. o Remove KASSERT that checks the size of a DMA segment should be less than or equal to MCLBYTES as it's no longer valid in TSO. o Tx threshold and number of TBDs field is used to store MSS in TSO. So don't set the Tx threshold in TSO case. Modified: head/sys/dev/fxp/if_fxp.c head/sys/dev/fxp/if_fxpreg.h head/sys/dev/fxp/if_fxpvar.h Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Wed Nov 26 06:36:53 2008 (r185329) +++ head/sys/dev/fxp/if_fxp.c Wed Nov 26 07:36:17 2008 (r185330) @@ -619,11 +619,15 @@ fxp_attach(device_t dev) * Allocate DMA tags and DMA safe memory. */ sc->maxtxseg = FXP_NTXSEG; - if (sc->flags & FXP_FLAG_EXT_RFA) + sc->maxsegsize = MCLBYTES; + if (sc->flags & FXP_FLAG_EXT_RFA) { sc->maxtxseg--; + sc->maxsegsize = FXP_TSO_SEGSIZE; + } error = bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - MCLBYTES * sc->maxtxseg, sc->maxtxseg, MCLBYTES, 0, + sc->maxsegsize * sc->maxtxseg + sizeof(struct ether_vlan_header), + sc->maxtxseg, sc->maxsegsize, 0, busdma_lock_mutex, &Giant, &sc->fxp_mtag); if (error) { device_printf(dev, "could not allocate dma tag\n"); @@ -780,11 +784,11 @@ fxp_attach(device_t dev) ifp->if_capabilities = ifp->if_capenable = 0; - /* Enable checksum offload for 82550 or better chips */ + /* Enable checksum offload/TSO for 82550 or better chips */ if (sc->flags & FXP_FLAG_EXT_RFA) { - ifp->if_hwassist = FXP_CSUM_FEATURES; - ifp->if_capabilities |= IFCAP_HWCSUM; - ifp->if_capenable |= IFCAP_HWCSUM; + ifp->if_hwassist = FXP_CSUM_FEATURES | CSUM_TSO; + ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4; + ifp->if_capenable |= IFCAP_HWCSUM | IFCAP_TSO4; } if (sc->flags & FXP_FLAG_82559_RXCSUM) { @@ -1275,12 +1279,15 @@ fxp_encap(struct fxp_softc *sc, struct m struct mbuf *m; struct fxp_tx *txp; struct fxp_cb_tx *cbp; + struct tcphdr *tcp; bus_dma_segment_t segs[FXP_NTXSEG]; - int error, i, nseg; + int error, i, nseg, tcp_payload; FXP_LOCK_ASSERT(sc, MA_OWNED); ifp = sc->ifp; + tcp_payload = 0; + tcp = NULL; /* * Get pointer to next available tx desc. */ @@ -1358,6 +1365,75 @@ fxp_encap(struct fxp_softc *sc, struct m #endif } + if (m->m_pkthdr.csum_flags & CSUM_TSO) { + /* + * 82550/82551 requires ethernet/IP/TCP headers must be + * contained in the first active transmit buffer. + */ + struct ether_header *eh; + struct ip *ip; + uint32_t ip_off, poff; + + if (M_WRITABLE(*m_head) == 0) { + /* Get a writable copy. */ + m = m_dup(*m_head, M_DONTWAIT); + m_freem(*m_head); + if (m == NULL) { + *m_head = NULL; + return (ENOBUFS); + } + *m_head = m; + } + ip_off = sizeof(struct ether_header); + m = m_pullup(*m_head, ip_off); + if (m == NULL) { + *m_head = NULL; + return (ENOBUFS); + } + eh = mtod(m, struct ether_header *); + /* Check the existence of VLAN tag. */ + if (eh->ether_type == htons(ETHERTYPE_VLAN)) { + ip_off = sizeof(struct ether_vlan_header); + m = m_pullup(m, ip_off); + if (m == NULL) { + *m_head = NULL; + return (ENOBUFS); + } + } + m = m_pullup(m, ip_off + sizeof(struct ip)); + if (m == NULL) { + *m_head = NULL; + return (ENOBUFS); + } + ip = (struct ip *)(mtod(m, char *) + ip_off); + poff = ip_off + (ip->ip_hl << 2); + m = m_pullup(m, poff + sizeof(struct tcphdr)); + if (m == NULL) { + *m_head = NULL; + return (ENOBUFS); + } + tcp = (struct tcphdr *)(mtod(m, char *) + poff); + m = m_pullup(m, poff + sizeof(struct tcphdr) + tcp->th_off); + if (m == NULL) { + *m_head = NULL; + return (ENOBUFS); + } + + /* + * Since 82550/82551 doesn't modify IP length and pseudo + * checksum in the first frame driver should compute it. + */ + ip->ip_sum = 0; + ip->ip_len = htons(ifp->if_mtu); + tcp->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, + htons(IPPROTO_TCP + (tcp->th_off << 2) + + m->m_pkthdr.tso_segsz)); + /* Compute total TCP payload. */ + tcp_payload = m->m_pkthdr.len - ip_off - (ip->ip_hl << 2); + tcp_payload -= tcp->th_off << 2; + *m_head = m; + } + error = bus_dmamap_load_mbuf_sg(sc->fxp_mtag, txp->tx_map, *m_head, segs, &nseg, 0); if (error == EFBIG) { @@ -1388,7 +1464,6 @@ fxp_encap(struct fxp_softc *sc, struct m cbp = txp->tx_cb; for (i = 0; i < nseg; i++) { - KASSERT(segs[i].ds_len <= MCLBYTES, ("segment size too large")); /* * If this is an 82550/82551, then we're using extended * TxCBs _and_ we're using checksum offload. This means @@ -1403,14 +1478,28 @@ fxp_encap(struct fxp_softc *sc, struct m * the chip is an 82550/82551 or not. */ if (sc->flags & FXP_FLAG_EXT_RFA) { - cbp->tbd[i + 1].tb_addr = htole32(segs[i].ds_addr); - cbp->tbd[i + 1].tb_size = htole32(segs[i].ds_len); + cbp->tbd[i + 2].tb_addr = htole32(segs[i].ds_addr); + cbp->tbd[i + 2].tb_size = htole32(segs[i].ds_len); } else { cbp->tbd[i].tb_addr = htole32(segs[i].ds_addr); cbp->tbd[i].tb_size = htole32(segs[i].ds_len); } } - cbp->tbd_number = nseg; + if (sc->flags & FXP_FLAG_EXT_RFA) { + /* Configure dynamic TBD for 82550/82551. */ + cbp->tbd_number = 0xFF; + cbp->tbd[nseg + 1].tb_size |= htole32(0x8000); + } else + cbp->tbd_number = nseg; + /* Configure TSO. */ + if (m->m_pkthdr.csum_flags & CSUM_TSO) { + cbp->tbd[-1].tb_size = htole32(m->m_pkthdr.tso_segsz << 16); + cbp->tbd[1].tb_size = htole32(tcp_payload << 16); + cbp->ipcb_ip_schedule |= FXP_IPCB_LARGESEND_ENABLE | + FXP_IPCB_IP_CHECKSUM_ENABLE | + FXP_IPCB_TCP_PACKET | + FXP_IPCB_TCPUDP_CHECKSUM_ENABLE; + } txp->tx_mbuf = m; txp->tx_cb->cb_status = 0; @@ -1423,7 +1512,8 @@ fxp_encap(struct fxp_softc *sc, struct m txp->tx_cb->cb_command = htole16(sc->tx_cmd | FXP_CB_COMMAND_SF | FXP_CB_COMMAND_S | FXP_CB_COMMAND_I); - txp->tx_cb->tx_threshold = tx_threshold; + if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0) + txp->tx_cb->tx_threshold = tx_threshold; /* * Advance the end of list forward. @@ -2097,7 +2187,7 @@ fxp_init_body(struct fxp_softc *sc) cbp->disc_short_rx = !prm; /* discard short packets */ cbp->underrun_retry = 1; /* retry mode (once) on DMA underrun */ cbp->two_frames = 0; /* do not limit FIFO to 2 frames */ - cbp->dyn_tbd = 0; /* (no) dynamic TBD mode */ + cbp->dyn_tbd = sc->flags & FXP_FLAG_EXT_RFA ? 1 : 0; cbp->ext_rfa = sc->flags & FXP_FLAG_EXT_RFA ? 1 : 0; cbp->mediatype = sc->flags & FXP_FLAG_SERIAL_MEDIA ? 0 : 1; cbp->csma_dis = 0; /* (don't) disable link */ @@ -2589,6 +2679,14 @@ fxp_ioctl(struct ifnet *ifp, u_long comm if ((sc->flags & FXP_FLAG_82559_RXCSUM) != 0) reinit++; } + if ((mask & IFCAP_TSO4) != 0 && + (ifp->if_capabilities & IFCAP_TSO4) != 0) { + ifp->if_capenable ^= IFCAP_TSO4; + if ((ifp->if_capenable & IFCAP_TSO4) != 0) + ifp->if_hwassist |= CSUM_TSO; + else + ifp->if_hwassist &= ~CSUM_TSO; + } if ((mask & IFCAP_VLAN_MTU) != 0 && (ifp->if_capabilities & IFCAP_VLAN_MTU) != 0) { ifp->if_capenable ^= IFCAP_VLAN_MTU; Modified: head/sys/dev/fxp/if_fxpreg.h ============================================================================== --- head/sys/dev/fxp/if_fxpreg.h Wed Nov 26 06:36:53 2008 (r185329) +++ head/sys/dev/fxp/if_fxpreg.h Wed Nov 26 07:36:17 2008 (r185330) @@ -292,7 +292,7 @@ struct fxp_cb_tx { */ union { struct fxp_ipcb ipcb; - struct fxp_tbd tbd[FXP_NTXSEG]; + struct fxp_tbd tbd[FXP_NTXSEG + 1]; } tx_cb_u; }; Modified: head/sys/dev/fxp/if_fxpvar.h ============================================================================== --- head/sys/dev/fxp/if_fxpvar.h Wed Nov 26 06:36:53 2008 (r185329) +++ head/sys/dev/fxp/if_fxpvar.h Wed Nov 26 07:36:17 2008 (r185330) @@ -41,6 +41,11 @@ #define FXP_NTXCB_HIWAT ((FXP_NTXCB * 7) / 10) /* + * Maximum size of a DMA segment. + */ +#define FXP_TSO_SEGSIZE 4096 + +/* * Size of the TxCB list. */ #define FXP_TXCB_SZ (FXP_NTXCB * sizeof(struct fxp_cb_tx)) @@ -157,6 +162,7 @@ struct fxp_softc { bus_dmamap_t spare_map; /* spare DMA map */ struct fxp_desc_list fxp_desc; /* descriptors management struct */ int maxtxseg; /* maximum # of TX segments */ + int maxsegsize; /* maximum size of a TX segment */ int tx_queued; /* # of active TxCB's */ int need_mcsetup; /* multicast filter needs programming */ struct fxp_stats *fxp_stats; /* Pointer to interface stats */ From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 09:33:11 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79DC21065675; Wed, 26 Nov 2008 09:33:11 +0000 (UTC) (envelope-from bra@fsn.hu) Received: from people.fsn.hu (people.fsn.hu [195.228.252.137]) by mx1.freebsd.org (Postfix) with ESMTP id 69F9F8FC21; Wed, 26 Nov 2008 09:33:09 +0000 (UTC) (envelope-from bra@fsn.hu) Received: from [172.16.129.138] (fw.axelero.hu [195.228.243.120]) by people.fsn.hu (Postfix) with ESMTP id D951D161B3E; Wed, 26 Nov 2008 10:15:58 +0100 (CET) Message-ID: <492D13CE.70001@fsn.hu> Date: Wed, 26 Nov 2008 10:15:58 +0100 From: Attila Nagy User-Agent: Thunderbird 2.0.0.17 (X11/20080925) MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <200811172049.mAHKnUDw092510@svn.freebsd.org> In-Reply-To: <200811172049.mAHKnUDw092510@svn.freebsd.org> X-Stationery: 0.4.8.11 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (people.fsn.hu [0.0.0.0]); Wed, 26 Nov 2008 10:15:59 +0100 (CET) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185029 - in head: cddl/compat/opensolaris/include cddl/compat/opensolaris/misc cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zinject cd... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 09:33:11 -0000 Hello, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Mon Nov 17 20:49:29 2008 > New Revision: 185029 > URL: http://svn.freebsd.org/changeset/base/185029 > > Log: > Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes. > This, and other changes stabilized ZFS by a great level in HEAD. Do you plan to MFC these to 7-STABLE? Thanks, From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 09:46:35 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E44E31065675; Wed, 26 Nov 2008 09:46:35 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE0588FC1D; Wed, 26 Nov 2008 09:46:35 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQ9kZci050510; Wed, 26 Nov 2008 09:46:35 GMT (envelope-from sobomax@svn.freebsd.org) Received: (from sobomax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQ9kZMi050509; Wed, 26 Nov 2008 09:46:35 GMT (envelope-from sobomax@svn.freebsd.org) Message-Id: <200811260946.mAQ9kZMi050509@svn.freebsd.org> From: Maxim Sobolev Date: Wed, 26 Nov 2008 09:46:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185331 - head/sys/i386/cpufreq X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 09:46:36 -0000 Author: sobomax Date: Wed Nov 26 09:46:35 2008 New Revision: 185331 URL: http://svn.freebsd.org/changeset/base/185331 Log: Add Pentium D cores into the list that can't handle 12.5% and 25% throttle. My SMP kernel hangs when one of those is selected by powerd. Errata AA21 here: ftp://download.intel.com/design/PentiumXE/specupdt/31030717.pdf MFC after: 2 weeks Modified: head/sys/i386/cpufreq/p4tcc.c Modified: head/sys/i386/cpufreq/p4tcc.c ============================================================================== --- head/sys/i386/cpufreq/p4tcc.c Wed Nov 26 07:36:17 2008 (r185330) +++ head/sys/i386/cpufreq/p4tcc.c Wed Nov 26 09:46:35 2008 (r185331) @@ -188,9 +188,12 @@ p4tcc_attach(device_t dev) case 0x0a: case 0x12: case 0x13: + case 0x62: /* Pentium D B1: errata AA21 */ + case 0x64: /* Pentium D C1: errata AA21 */ + case 0x65: /* Pentium D D0: errata AA21 */ /* * These CPU models hang when set to 12.5% or 25%. - * See Errata N44 and P18l. + * See Errata N44, P18l and AA21. */ sc->set_count -= 2; break; From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 09:52:44 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE1DB1065674; Wed, 26 Nov 2008 09:52:44 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206045082.chello.pl [87.206.45.82]) by mx1.freebsd.org (Postfix) with ESMTP id 4A2AD8FC08; Wed, 26 Nov 2008 09:52:44 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 5339345685; Wed, 26 Nov 2008 10:52:42 +0100 (CET) Received: from localhost (pjdwl.wheel.pl [10.0.1.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 7E61845683; Wed, 26 Nov 2008 10:52:37 +0100 (CET) Date: Wed, 26 Nov 2008 10:52:41 +0100 From: Pawel Jakub Dawidek To: Attila Nagy Message-ID: <20081126095241.GA3188@garage.freebsd.pl> References: <200811172049.mAHKnUDw092510@svn.freebsd.org> <492D13CE.70001@fsn.hu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="u3/rZRmxL6MmkK24" Content-Disposition: inline In-Reply-To: <492D13CE.70001@fsn.hu> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185029 - in head: cddl/compat/opensolaris/include cddl/compat/opensolaris/misc cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zinject cd... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 09:52:44 -0000 --u3/rZRmxL6MmkK24 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 26, 2008 at 10:15:58AM +0100, Attila Nagy wrote: > Hello, >=20 > Pawel Jakub Dawidek wrote: > >Author: pjd > >Date: Mon Nov 17 20:49:29 2008 > >New Revision: 185029 > >URL: http://svn.freebsd.org/changeset/base/185029 > > > >Log: > > Update ZFS from version 6 to 13 and bring some FreeBSD-specific change= s. > > =20 > This, and other changes stabilized ZFS by a great level in HEAD. > Do you plan to MFC these to 7-STABLE? Yes, but ETA yet. --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --u3/rZRmxL6MmkK24 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFJLRxpForvXbEpPzQRAnSFAJ4sBse0t5gXoS9+sZ7L8J6sBRQU8ACgnRS4 ErSvK/Q7rV3Ee/H4EatPXAw= =iEU9 -----END PGP SIGNATURE----- --u3/rZRmxL6MmkK24-- From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 12:24:18 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD7B11065676; Wed, 26 Nov 2008 12:24:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C23F78FC1A; Wed, 26 Nov 2008 12:24:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQCOIU4055289; Wed, 26 Nov 2008 12:24:18 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQCOIiI055288; Wed, 26 Nov 2008 12:24:18 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811261224.mAQCOIiI055288@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 26 Nov 2008 12:24:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185332 - head/sys/netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 12:24:19 -0000 Author: bz Date: Wed Nov 26 12:24:18 2008 New Revision: 185332 URL: http://svn.freebsd.org/changeset/base/185332 Log: Plug a credential leak in case the inpcb is freed by in6_pcbfree() instead of in_pcbfree(); missed in r183606. Reviewed by: rwatson MFC after: 3 days (instantly for 7.1-RC?) Modified: head/sys/netinet6/in6_pcb.c Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Wed Nov 26 09:46:35 2008 (r185331) +++ head/sys/netinet6/in6_pcb.c Wed Nov 26 12:24:18 2008 (r185332) @@ -442,6 +442,7 @@ in6_pcbfree(struct inpcb *inp) if (inp->inp_moptions != NULL) inp_freemoptions(inp->inp_moptions); inp->inp_vflag = 0; + crfree(inp->inp_cred); #ifdef MAC mac_inpcb_destroy(inp); #endif From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 12:54:31 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDFB61065672; Wed, 26 Nov 2008 12:54:31 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1C638FC18; Wed, 26 Nov 2008 12:54:31 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQCsVdC055944; Wed, 26 Nov 2008 12:54:31 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQCsVQC055942; Wed, 26 Nov 2008 12:54:31 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811261254.mAQCsVQC055942@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 26 Nov 2008 12:54:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185333 - in head/sys: netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 12:54:32 -0000 Author: bz Date: Wed Nov 26 12:54:31 2008 New Revision: 185333 URL: http://svn.freebsd.org/changeset/base/185333 Log: Unify the v4 and v6 versions of pcbdetach and pcbfree as good as possible so that they are easily diffable. No functional changes. Reviewed by: rwatson MFC after: 6 weeks Modified: head/sys/netinet/in_pcb.c head/sys/netinet6/in6_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Wed Nov 26 12:24:18 2008 (r185332) +++ head/sys/netinet/in_pcb.c Wed Nov 26 12:54:31 2008 (r185333) @@ -877,7 +877,7 @@ void in_pcbdetach(struct inpcb *inp) { - KASSERT(inp->inp_socket != NULL, ("in_pcbdetach: inp_socket == NULL")); + KASSERT(inp->inp_socket != NULL, ("%s: inp_socket == NULL", __func__)); inp->inp_socket->so_pcb = NULL; inp->inp_socket = NULL; @@ -892,14 +892,14 @@ in_pcbfree(struct inpcb *inp) { struct inpcbinfo *ipi = inp->inp_pcbinfo; - KASSERT(inp->inp_socket == NULL, ("in_pcbfree: inp_socket != NULL")); + KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__)); INP_INFO_WLOCK_ASSERT(ipi); INP_WLOCK_ASSERT(inp); #ifdef IPSEC ipsec4_delete_pcbpolicy(inp); -#endif /*IPSEC*/ +#endif /* IPSEC */ inp->inp_gencnt = ++ipi->ipi_gencnt; in_pcbremlists(inp); if (inp->inp_options) Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Wed Nov 26 12:24:18 2008 (r185332) +++ head/sys/netinet6/in6_pcb.c Wed Nov 26 12:54:31 2008 (r185333) @@ -414,7 +414,8 @@ void in6_pcbdetach(struct inpcb *inp) { - KASSERT(inp->inp_socket != NULL, ("in6_pcbdetach: inp_socket == NULL")); + KASSERT(inp->inp_socket != NULL, ("%s: inp_socket == NULL", __func__)); + inp->inp_socket->so_pcb = NULL; inp->inp_socket = NULL; } @@ -424,8 +425,9 @@ in6_pcbfree(struct inpcb *inp) { struct inpcbinfo *ipi = inp->inp_pcbinfo; - KASSERT(inp->inp_socket == NULL, ("in6_pcbfree: inp_socket != NULL")); - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); + KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__)); + + INP_INFO_WLOCK_ASSERT(ipi); INP_WLOCK_ASSERT(inp); #ifdef IPSEC @@ -443,6 +445,7 @@ in6_pcbfree(struct inpcb *inp) inp_freemoptions(inp->inp_moptions); inp->inp_vflag = 0; crfree(inp->inp_cred); + #ifdef MAC mac_inpcb_destroy(inp); #endif From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 13:09:46 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 531A5106564A; Wed, 26 Nov 2008 13:09:46 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 36A5C8FC1A; Wed, 26 Nov 2008 13:09:46 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQD9knM056251; Wed, 26 Nov 2008 13:09:46 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQD9k9T056250; Wed, 26 Nov 2008 13:09:46 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200811261309.mAQD9k9T056250@svn.freebsd.org> From: Ulf Lilleengen Date: Wed, 26 Nov 2008 13:09:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185334 - head/sys/fs/cd9660 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 13:09:46 -0000 Author: lulf Date: Wed Nov 26 13:09:45 2008 New Revision: 185334 URL: http://svn.freebsd.org/changeset/base/185334 Log: - Support IEEE_P1282 and IEEE_1282 tags in the rock ridge extensions record. PR: kern/128942 Submitted by: "J.R. Oldroyd" Modified: head/sys/fs/cd9660/cd9660_rrip.c Modified: head/sys/fs/cd9660/cd9660_rrip.c ============================================================================== --- head/sys/fs/cd9660/cd9660_rrip.c Wed Nov 26 12:54:31 2008 (r185333) +++ head/sys/fs/cd9660/cd9660_rrip.c Wed Nov 26 13:09:45 2008 (r185334) @@ -472,8 +472,12 @@ cd9660_rrip_extref(p,ana) ISO_RRIP_EXTREF *p; ISO_RRIP_ANALYZE *ana; { - if (isonum_711(p->len_id) != 10 - || bcmp((char *)p + 8,"RRIP_1991A",10) + if ( ! ((isonum_711(p->len_id) == 10 + && bcmp((char *)p + 8,"RRIP_1991A",10) == 0) + || (isonum_711(p->len_id) == 10 + && bcmp((char *)p + 8,"IEEE_P1282",10) == 0) + || (isonum_711(p->len_id) == 9 + && bcmp((char *)p + 8,"IEEE_1282", 9) == 0)) || isonum_711(p->version) != 1) return 0; ana->fields &= ~ISO_SUSP_EXTREF; From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 13:41:15 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2889106567C; Wed, 26 Nov 2008 13:41:15 +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 A63CD8FC23; Wed, 26 Nov 2008 13:41:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQDfFFa056910; Wed, 26 Nov 2008 13:41:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQDfF3d056909; Wed, 26 Nov 2008 13:41:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811261341.mAQDfF3d056909@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 26 Nov 2008 13:41:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185335 - head/sys/fs/nullfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 13:41:15 -0000 Author: kib Date: Wed Nov 26 13:41:15 2008 New Revision: 185335 URL: http://svn.freebsd.org/changeset/base/185335 Log: In null_lookup(), do the needed cleanup instead of panicing saying the cleanup is needed. Reported by: kris, pho Tested by: pho MFC after: 2 weeks Modified: head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Wed Nov 26 13:09:45 2008 (r185334) +++ head/sys/fs/nullfs/null_vnops.c Wed Nov 26 13:41:15 2008 (r185335) @@ -365,11 +365,10 @@ null_lookup(struct vop_lookup_args *ap) vrele(lvp); } else { error = null_nodeget(dvp->v_mount, lvp, &vp); - if (error) { - /* XXX Cleanup needed... */ - panic("null_nodeget failed"); - } - *ap->a_vpp = vp; + if (error) + vput(lvp); + else + *ap->a_vpp = vp; } } return (error); From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 13:44:11 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AEDA1065673; Wed, 26 Nov 2008 13:44:11 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E4A28FC18; Wed, 26 Nov 2008 13:44:11 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQDiB1w057011; Wed, 26 Nov 2008 13:44:11 GMT (envelope-from ganbold@svn.freebsd.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQDiBOX057010; Wed, 26 Nov 2008 13:44:11 GMT (envelope-from ganbold@svn.freebsd.org) Message-Id: <200811261344.mAQDiBOX057010@svn.freebsd.org> From: Ganbold Tsagaankhuu Date: Wed, 26 Nov 2008 13:44:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185336 - head/sys/dev/patm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 13:44:11 -0000 Author: ganbold (doc committer) Date: Wed Nov 26 13:44:11 2008 New Revision: 185336 URL: http://svn.freebsd.org/changeset/base/185336 Log: Remove unused variable. Found with: Coverity Prevent(tm) CID: 3695,3696 Approved by: harti Modified: head/sys/dev/patm/if_patm_intr.c Modified: head/sys/dev/patm/if_patm_intr.c ============================================================================== --- head/sys/dev/patm/if_patm_intr.c Wed Nov 26 13:41:15 2008 (r185335) +++ head/sys/dev/patm/if_patm_intr.c Wed Nov 26 13:44:11 2008 (r185336) @@ -266,7 +266,7 @@ patm_feed_sbufs(struct patm_softc *sc) { u_int feed; bus_addr_t p0, p1; - void *v0, *v1; + void *v0; uint32_t h0, h1; feed = patm_feed_cnt(sc, 0); @@ -274,7 +274,7 @@ patm_feed_sbufs(struct patm_softc *sc) while (feed > 0) { if ((v0 = mbp_alloc(sc->sbuf_pool, &p0, &h0)) == NULL) break; - if ((v1 = mbp_alloc(sc->sbuf_pool, &p1, &h1)) == NULL) { + if (mbp_alloc(sc->sbuf_pool, &p1, &h1) == NULL) { mbp_free(sc->sbuf_pool, v0); break; } @@ -294,7 +294,7 @@ patm_feed_vbufs(struct patm_softc *sc) { u_int feed; bus_addr_t p0, p1; - void *v0, *v1; + void *v0; uint32_t h0, h1; feed = patm_feed_cnt(sc, 2); @@ -302,7 +302,7 @@ patm_feed_vbufs(struct patm_softc *sc) while (feed > 0) { if ((v0 = mbp_alloc(sc->vbuf_pool, &p0, &h0)) == NULL) break; - if ((v1 = mbp_alloc(sc->vbuf_pool, &p1, &h1)) == NULL) { + if (mbp_alloc(sc->vbuf_pool, &p1, &h1) == NULL) { mbp_free(sc->vbuf_pool, v0); break; } From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 16:38:43 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7410F1065670; Wed, 26 Nov 2008 16:38:43 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F0DD8FC21; Wed, 26 Nov 2008 16:38:43 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQGchEL060482; Wed, 26 Nov 2008 16:38:43 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQGchBM060481; Wed, 26 Nov 2008 16:38:43 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200811261638.mAQGchBM060481@svn.freebsd.org> From: Roman Divacky Date: Wed, 26 Nov 2008 16:38:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185337 - head/sys/compat/linux X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 16:38:43 -0000 Author: rdivacky Date: Wed Nov 26 16:38:43 2008 New Revision: 185337 URL: http://svn.freebsd.org/changeset/base/185337 Log: Document that all the other commands are either identical to the FreeBSD ones or rejected by kern_msgctl(). Found with: Coverity Prevent(tm) CID: 3456 Approved by: kib (mentor) Modified: head/sys/compat/linux/linux_ipc.c Modified: head/sys/compat/linux/linux_ipc.c ============================================================================== --- head/sys/compat/linux/linux_ipc.c Wed Nov 26 13:44:11 2008 (r185336) +++ head/sys/compat/linux/linux_ipc.c Wed Nov 26 16:38:43 2008 (r185337) @@ -672,6 +672,14 @@ linux_msgctl(struct thread *td, struct l return (error); } +/* + * TODO: implement this + * case LINUX_MSG_STAT: + */ + case LINUX_IPC_STAT: + /* NOTHING */ + break; + case LINUX_IPC_SET: error = linux_msqid_pullup(args->cmd & LINUX_IPC_64, &linux_msqid, PTRIN(args->buf)); @@ -679,6 +687,14 @@ linux_msgctl(struct thread *td, struct l return (error); linux_to_bsd_msqid_ds(&linux_msqid, &bsd_msqid); break; + + case LINUX_IPC_RMID: + /* NOTHING */ + break; + + default: + return (EINVAL); + break; } error = kern_msgctl(td, args->msqid, bsd_cmd, &bsd_msqid); From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 17:16:54 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF3DF1065672; Wed, 26 Nov 2008 17:16:54 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5E8C8FC1A; Wed, 26 Nov 2008 17:16:54 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQHGsls061310; Wed, 26 Nov 2008 17:16:54 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQHGsV6061308; Wed, 26 Nov 2008 17:16:54 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <200811261716.mAQHGsV6061308@svn.freebsd.org> From: Nick Hibma Date: Wed, 26 Nov 2008 17:16:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185338 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 17:16:55 -0000 Author: n_hibma Date: Wed Nov 26 17:16:54 2008 New Revision: 185338 URL: http://svn.freebsd.org/changeset/base/185338 Log: - Add the device ID for the HP HS2300 MC8775 clone (michael) - Bugfix: Don't excede static number of ports allowed when iterating over endpoints within an interface. - u3g_speeds contains speeds in baud, not bytes per second, so divide the buffer size by 10. Modified: head/sys/dev/usb/u3g.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/u3g.c ============================================================================== --- head/sys/dev/usb/u3g.c Wed Nov 26 16:38:43 2008 (r185337) +++ head/sys/dev/usb/u3g.c Wed Nov 26 17:16:54 2008 (r185338) @@ -87,8 +87,8 @@ struct ucom_callback u3g_callback = { struct u3g_speeds_s { - u_int32_t ispeed; - u_int32_t ospeed; + u_int32_t ispeed; // Speed in bits per second + u_int32_t ospeed; // Speed in bits per second }; static const struct u3g_speeds_s u3g_speeds[] = { @@ -180,7 +180,8 @@ static const struct u3g_dev_type_s u3g_d {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755_3 }, U3GSP_UMTS, U3GFL_NONE }, // XXX {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8765 }, U3GSP_UMTS, U3GFL_NONE }, // XXX {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC875U }, U3GSP_UMTS, U3GFL_NONE }, // XXX - {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8775_2 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8775_2 }, U3GSP_HSDPA, U3GFL_NONE }, // XXX + {{ USB_VENDOR_HP, USB_PRODUCT_HP_HS2300 }, U3GSP_HSDPA, U3GFL_NONE }, // XXX {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8780 }, U3GSP_UMTS, U3GFL_NONE }, // XXX {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8781 }, U3GSP_UMTS, U3GFL_NONE }, // XXX {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_TRUINSTALL }, U3GSP_UMTS, U3GFL_SIERRA_INIT }, // Sierra TruInstaller device ID @@ -272,7 +273,7 @@ u3g_attach(device_t self) int bulkin_no = -1, bulkout_no = -1; int claim_iface = 0; - for (n = 0; n < id->bNumEndpoints; n++) { + for (n = 0; n < id->bNumEndpoints && portno < U3G_MAXPORTS; n++) { ed = usbd_interface2endpoint_descriptor(uaa->ifaces[i], n); if (ed == NULL) continue; @@ -296,9 +297,9 @@ u3g_attach(device_t self) ucom->sc_bulkin_no = bulkin_no; ucom->sc_bulkout_no = bulkout_no; // Allocate a buffer enough for 10ms worth of data - ucom->sc_ibufsize = u3g_speeds[sc->sc_speed].ispeed/USB_FRAMES_PER_SECOND*10; + ucom->sc_ibufsize = u3g_speeds[sc->sc_speed].ispeed/10/USB_FRAMES_PER_SECOND*10; ucom->sc_ibufsizepad = ucom->sc_ibufsize; - ucom->sc_obufsize = u3g_speeds[sc->sc_speed].ospeed/USB_FRAMES_PER_SECOND*10; + ucom->sc_obufsize = u3g_speeds[sc->sc_speed].ospeed/10/USB_FRAMES_PER_SECOND*10; ucom->sc_opkthdrlen = 0; ucom->sc_callback = &u3g_callback; Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Wed Nov 26 16:38:43 2008 (r185337) +++ head/sys/dev/usb/usbdevs Wed Nov 26 17:16:54 2008 (r185338) @@ -1429,6 +1429,7 @@ product HP P1100 0x3102 Photosmart P110 product HP OJ4215 0x3d11 OfficeJet 4215 product HP HN210E 0x811c Ethernet HN210E product HP2 C500 0x6002 PhotoSmart C500 +product HP HS2300 0x1e1d hs2300 HSDPA (aka MC8775) /* HTC products */ product HTC WINMOBILE 0x00ce HTC USB Sync From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 18:01:21 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E797D1065677; Wed, 26 Nov 2008 18:01:21 +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 D5C948FC16; Wed, 26 Nov 2008 18:01:21 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQI1LHj062261; Wed, 26 Nov 2008 18:01:21 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQI1LRp062260; Wed, 26 Nov 2008 18:01:21 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200811261801.mAQI1LRp062260@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 26 Nov 2008 18:01:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185339 - head/sys/boot/i386/boot0 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 18:01:22 -0000 Author: luigi Date: Wed Nov 26 18:01:21 2008 New Revision: 185339 URL: http://svn.freebsd.org/changeset/base/185339 Log: Pass the pointer to the selected partition in %si to the next stage boot code. The bug was introduced in rev.1.13, and went unnoticed because FreeBSD's boot1 does not use it, but other systems might. (I have been struggling for almost a full day trying to figure out why a syslinux'ed partition would not boot when started with the FreeBSD /boot/boot0, only to realize that the bug was ours!) The space for the two extra bytes (push %si and pop %si) is reclaimed by removing an extra CRLF that is printed before booting. The bug is not a major one but if there is time it might be a good thing to merge it into the upcoming releases. Modified: head/sys/boot/i386/boot0/boot0.S Modified: head/sys/boot/i386/boot0/boot0.S ============================================================================== --- head/sys/boot/i386/boot0/boot0.S Wed Nov 26 17:16:54 2008 (r185338) +++ head/sys/boot/i386/boot0/boot0.S Wed Nov 26 18:01:21 2008 (r185339) @@ -319,8 +319,9 @@ main.15: movw $LOAD,%bx # Address for jc main.10 # If error cmpw $MAGIC,0x1fe(%bx) # Bootable? jne main.10 # No - movw $crlf,%si # Leave some - callw puts # space + pushw %si # Save ptr to selected part. + callw puts # Leave some space + popw %si # Restore, next stage uses it jmp *%bx # Invoke bootstrap /* From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 19:22:09 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22B6E1065673; Wed, 26 Nov 2008 19:22:09 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBB528FC0A; Wed, 26 Nov 2008 19:22:08 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQJM8Fu063959; Wed, 26 Nov 2008 19:22:08 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQJM8bQ063958; Wed, 26 Nov 2008 19:22:08 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200811261922.mAQJM8bQ063958@svn.freebsd.org> From: Peter Wemm Date: Wed, 26 Nov 2008 19:22:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185340 - stable/7/sys/modules/cxgb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 19:22:09 -0000 Author: peter Date: Wed Nov 26 19:22:08 2008 New Revision: 185340 URL: http://svn.freebsd.org/changeset/base/185340 Log: Remove zombie mergeinfo that Julian brought back to life in rev 184739. Submitted by: bz Approved by: re (implicit) Modified: stable/7/sys/modules/cxgb/ (props changed) From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 19:25:14 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96FAD106564A; Wed, 26 Nov 2008 19:25:14 +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 835FD8FC17; Wed, 26 Nov 2008 19:25:14 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQJPELX064087; Wed, 26 Nov 2008 19:25:14 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQJPDRb064060; Wed, 26 Nov 2008 19:25:13 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200811261925.mAQJPDRb064060@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 26 Nov 2008 19:25:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185341 - in head/sys: amd64/amd64 amd64/include dev/coretemp dev/hwpmc i386/cpufreq i386/i386 i386/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 19:25:14 -0000 Author: jkim Date: Wed Nov 26 19:25:13 2008 New Revision: 185341 URL: http://svn.freebsd.org/changeset/base/185341 Log: Introduce cpu_vendor_id and replace a lot of strcmp(cpu_vendor, "..."). Reviewed by: jhb, peter (early amd64 version) Modified: head/sys/amd64/amd64/amd64_mem.c head/sys/amd64/amd64/identcpu.c head/sys/amd64/amd64/initcpu.c head/sys/amd64/amd64/local_apic.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/msi.c head/sys/amd64/include/cputypes.h head/sys/amd64/include/md_var.h head/sys/amd64/include/specialreg.h head/sys/dev/coretemp/coretemp.c head/sys/dev/hwpmc/hwpmc_intel.c head/sys/dev/hwpmc/hwpmc_piv.c head/sys/dev/hwpmc/hwpmc_ppro.c head/sys/dev/hwpmc/hwpmc_x86.c head/sys/i386/cpufreq/est.c head/sys/i386/i386/i686_mem.c head/sys/i386/i386/identcpu.c head/sys/i386/i386/initcpu.c head/sys/i386/i386/k6_mem.c head/sys/i386/i386/local_apic.c head/sys/i386/i386/longrun.c head/sys/i386/i386/mp_machdep.c head/sys/i386/i386/msi.c head/sys/i386/include/cputypes.h head/sys/i386/include/md_var.h head/sys/i386/include/specialreg.h Modified: head/sys/amd64/amd64/amd64_mem.c ============================================================================== --- head/sys/amd64/amd64/amd64_mem.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/amd64/amd64/amd64_mem.c Wed Nov 26 19:25:13 2008 (r185341) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -677,8 +678,8 @@ amd64_mem_drvinit(void *unused) return; if ((cpu_id & 0xf00) != 0x600 && (cpu_id & 0xf00) != 0xf00) return; - if ((strcmp(cpu_vendor, "GenuineIntel") != 0) && - (strcmp(cpu_vendor, "AuthenticAMD") != 0)) + if (cpu_vendor_id != CPU_VENDOR_INTEL && + cpu_vendor_id != CPU_VENDOR_AMD) return; mem_range_softc.mr_op = &amd64_mrops; } Modified: head/sys/amd64/amd64/identcpu.c ============================================================================== --- head/sys/amd64/amd64/identcpu.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/amd64/amd64/identcpu.c Wed Nov 26 19:25:13 2008 (r185341) @@ -69,6 +69,7 @@ void identify_cpu(void); void earlysetcpuclass(void); void panicifcpuunsupported(void); +static u_int find_cpu_vendor_id(void); static void print_AMD_info(void); static void print_AMD_assoc(int i); @@ -95,6 +96,14 @@ static struct { { "Sledgehammer", CPUCLASS_K8 }, /* CPU_SLEDGEHAMMER */ }; +static struct { + char *vendor; + u_int vendor_id; +} cpu_vendors[] = { + { INTEL_VENDOR_ID, CPU_VENDOR_INTEL }, /* GenuineIntel */ + { AMD_VENDOR_ID, CPU_VENDOR_AMD }, /* AuthenticAMD */ +}; + int cpu_cores; int cpu_logical; @@ -122,10 +131,10 @@ printcpuinfo(void) } } - if (strcmp(cpu_vendor, "GenuineIntel") == 0) { + if (cpu_vendor_id == CPU_VENDOR_INTEL) { /* Please make up your mind folks! */ strcat(cpu_model, "EM64T"); - } else if (strcmp(cpu_vendor, "AuthenticAMD") == 0) { + } else if (cpu_vendor_id == CPU_VENDOR_AMD) { /* * Values taken from AMD Processor Recognition * http://www.amd.com/K6/k6docs/pdf/20734g.pdf @@ -165,13 +174,13 @@ printcpuinfo(void) printf("Unknown"); /* will panic below... */ } printf("-class CPU)\n"); - if(*cpu_vendor) - printf(" Origin = \"%s\"",cpu_vendor); - if(cpu_id) + if (*cpu_vendor) + printf(" Origin = \"%s\"", cpu_vendor); + if (cpu_id) printf(" Id = 0x%x", cpu_id); - if (strcmp(cpu_vendor, "GenuineIntel") == 0 || - strcmp(cpu_vendor, "AuthenticAMD") == 0) { + if (cpu_vendor_id == CPU_VENDOR_INTEL || + cpu_vendor_id == CPU_VENDOR_AMD) { printf(" Stepping = %u", cpu_id & 0xf); if (cpu_high > 0) { u_int cmp = 1, htt = 1; @@ -343,8 +352,8 @@ printcpuinfo(void) ); } - if (cpu_feature & CPUID_HTT && strcmp(cpu_vendor, - "AuthenticAMD") == 0) + if ((cpu_feature & CPUID_HTT) && + cpu_vendor_id == CPU_VENDOR_AMD) cpu_feature &= ~CPUID_HTT; /* @@ -352,7 +361,7 @@ printcpuinfo(void) * mention the capability. */ if (!tsc_is_invariant && - (strcmp(cpu_vendor, "AuthenticAMD") == 0 && + (cpu_vendor_id == CPU_VENDOR_AMD && ((amd_pminfo & AMDPM_TSC_INVARIANT) != 0 || AMD64_CPU_FAMILY(cpu_id) >= 0x10 || cpu_id == 0x60fb2))) { @@ -366,10 +375,10 @@ printcpuinfo(void) */ if (cpu_feature & CPUID_HTT) htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16; - if (strcmp(cpu_vendor, "AuthenticAMD") == 0 && + if (cpu_vendor_id == CPU_VENDOR_AMD && (amd_feature2 & AMDID2_CMP)) cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1; - else if (strcmp(cpu_vendor, "GenuineIntel") == 0 && + else if (cpu_vendor_id == CPU_VENDOR_INTEL && (cpu_high >= 4)) { cpuid_count(4, 0, regs); if ((regs[0] & 0x1f) != 0) @@ -391,7 +400,7 @@ printcpuinfo(void) if (!bootverbose) return; - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) + if (cpu_vendor_id == CPU_VENDOR_AMD) print_AMD_info(); } @@ -450,6 +459,7 @@ identify_cpu(void) ((u_int *)&cpu_vendor)[1] = regs[3]; ((u_int *)&cpu_vendor)[2] = regs[2]; cpu_vendor[12] = '\0'; + cpu_vendor_id = find_cpu_vendor_id(); do_cpuid(1, regs); cpu_id = regs[0]; @@ -457,8 +467,8 @@ identify_cpu(void) cpu_feature = regs[3]; cpu_feature2 = regs[2]; - if (strcmp(cpu_vendor, "GenuineIntel") == 0 || - strcmp(cpu_vendor, "AuthenticAMD") == 0) { + if (cpu_vendor_id == CPU_VENDOR_INTEL || + cpu_vendor_id == CPU_VENDOR_AMD) { do_cpuid(0x80000000, regs); cpu_exthigh = regs[0]; } @@ -480,6 +490,17 @@ identify_cpu(void) cpu = CPU_CLAWHAMMER; } +static u_int +find_cpu_vendor_id(void) +{ + int i; + + for (i = 0; i < sizeof(cpu_vendors) / sizeof(cpu_vendors[0]); i++) + if (strcmp(cpu_vendor, cpu_vendors[i].vendor) == 0) + return (cpu_vendors[i].vendor_id); + return (0); +} + static void print_AMD_assoc(int i) { Modified: head/sys/amd64/amd64/initcpu.c ============================================================================== --- head/sys/amd64/amd64/initcpu.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/amd64/amd64/initcpu.c Wed Nov 26 19:25:13 2008 (r185341) @@ -60,6 +60,7 @@ u_int cpu_id; /* Stepping ID */ u_int cpu_procinfo; /* HyperThreading Info / Brand Index / CLFUSH */ u_int cpu_procinfo2; /* Multicore info */ char cpu_vendor[20]; /* CPU Origin code */ +u_int cpu_vendor_id; /* CPU vendor ID */ u_int cpu_fxsr; /* SSE enabled */ u_int cpu_mxcsr_mask; /* Valid bits in mxcsr */ Modified: head/sys/amd64/amd64/local_apic.c ============================================================================== --- head/sys/amd64/amd64/local_apic.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/amd64/amd64/local_apic.c Wed Nov 26 19:25:13 2008 (r185341) @@ -323,7 +323,7 @@ lapic_setup(int boot) /* XXX: Error and thermal LVTs */ - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) { + if (cpu_vendor_id == CPU_VENDOR_AMD) { /* * Detect the presence of C1E capability mostly on latest * dual-cores (or future) k8 family. This feature renders Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/amd64/amd64/mp_machdep.c Wed Nov 26 19:25:13 2008 (r185341) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -374,8 +375,7 @@ cpu_mp_start(void) * First determine if this is an Intel processor which claims * to have hyperthreading support. */ - if ((cpu_feature & CPUID_HTT) && - (strcmp(cpu_vendor, "GenuineIntel") == 0)) { + if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) { /* * If the "deterministic cache parameters" cpuid calls * are available, use them. Modified: head/sys/amd64/amd64/msi.c ============================================================================== --- head/sys/amd64/amd64/msi.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/amd64/amd64/msi.c Wed Nov 26 19:25:13 2008 (r185341) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -211,8 +212,8 @@ msi_init(void) { /* Check if we have a supported CPU. */ - if (!(strcmp(cpu_vendor, "GenuineIntel") == 0 || - strcmp(cpu_vendor, "AuthenticAMD") == 0)) + if (!(cpu_vendor_id == CPU_VENDOR_INTEL || + cpu_vendor_id == CPU_VENDOR_AMD)) return; msi_enabled = 1; Modified: head/sys/amd64/include/cputypes.h ============================================================================== --- head/sys/amd64/include/cputypes.h Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/amd64/include/cputypes.h Wed Nov 26 19:25:13 2008 (r185341) @@ -33,15 +33,21 @@ /* * Classes of processor. */ -#define CPUCLASS_X86 0 /* X86 */ -#define CPUCLASS_K8 1 /* K8 AMD64 class */ +#define CPUCLASS_X86 0 /* X86 */ +#define CPUCLASS_K8 1 /* K8 AMD64 class */ /* * Kinds of processor. */ -#define CPU_X86 0 /* Intel */ -#define CPU_CLAWHAMMER 1 /* AMD Clawhammer */ -#define CPU_SLEDGEHAMMER 2 /* AMD Sledgehammer */ +#define CPU_X86 0 /* Intel */ +#define CPU_CLAWHAMMER 1 /* AMD Clawhammer */ +#define CPU_SLEDGEHAMMER 2 /* AMD Sledgehammer */ + +/* + * Vendors of processor. + */ +#define CPU_VENDOR_AMD 0x1022 /* AMD */ +#define CPU_VENDOR_INTEL 0x8086 /* Intel */ #ifndef LOCORE extern int cpu; Modified: head/sys/amd64/include/md_var.h ============================================================================== --- head/sys/amd64/include/md_var.h Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/amd64/include/md_var.h Wed Nov 26 19:25:13 2008 (r185341) @@ -52,6 +52,7 @@ extern u_int cpu_mxcsr_mask; extern u_int cpu_procinfo; extern u_int cpu_procinfo2; extern char cpu_vendor[]; +extern u_int cpu_vendor_id; extern char kstack[]; extern char sigcode[]; extern int szsigcode; Modified: head/sys/amd64/include/specialreg.h ============================================================================== --- head/sys/amd64/include/specialreg.h Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/amd64/include/specialreg.h Wed Nov 26 19:25:13 2008 (r185341) @@ -196,8 +196,8 @@ /* * CPUID manufacturers identifiers */ -#define INTEL_VENDOR_ID "GenuineIntel" -#define AMD_VENDOR_ID "AuthenticAMD" +#define AMD_VENDOR_ID "AuthenticAMD" +#define INTEL_VENDOR_ID "GenuineIntel" /* * Model-specific registers for the i386 family Modified: head/sys/dev/coretemp/coretemp.c ============================================================================== --- head/sys/dev/coretemp/coretemp.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/dev/coretemp/coretemp.c Wed Nov 26 19:25:13 2008 (r185341) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include struct coretemp_softc { @@ -94,7 +95,7 @@ coretemp_identify(driver_t *driver, devi return; /* Check that CPUID 0x06 is supported and the vendor is Intel.*/ - if (cpu_high < 6 || strcmp(cpu_vendor, "GenuineIntel")) + if (cpu_high < 6 || cpu_vendor_id != CPU_VENDOR_INTEL) return; /* * CPUID 0x06 returns 1 if the processor has on-die thermal Modified: head/sys/dev/hwpmc/hwpmc_intel.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_intel.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/dev/hwpmc/hwpmc_intel.c Wed Nov 26 19:25:13 2008 (r185341) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -79,7 +80,7 @@ pmc_intel_initialize(void) enum pmc_cputype cputype; int error, model, nclasses, ncpus; - KASSERT(strcmp(cpu_vendor, "GenuineIntel") == 0, + KASSERT(cpu_vendor_id == CPU_VENDOR_INTEL, ("[intel,%d] Initializing non-intel processor", __LINE__)); PMCDBG(MDP,INI,0, "intel-initialize cpuid=0x%x", cpu_id); Modified: head/sys/dev/hwpmc/hwpmc_piv.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_piv.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/dev/hwpmc/hwpmc_piv.c Wed Nov 26 19:25:13 2008 (r185341) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -1610,7 +1611,7 @@ pmc_p4_initialize(struct pmc_mdep *md, i struct p4_event_descr *pe; KASSERT(md != NULL, ("[p4,%d] md is NULL", __LINE__)); - KASSERT(strcmp(cpu_vendor, "GenuineIntel") == 0, + KASSERT(cpu_vendor_id == CPU_VENDOR_INTEL, ("[p4,%d] Initializing non-intel processor", __LINE__)); PMCDBG(MDP,INI,1, "%s", "p4-initialize"); Modified: head/sys/dev/hwpmc/hwpmc_ppro.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_ppro.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/dev/hwpmc/hwpmc_ppro.c Wed Nov 26 19:25:13 2008 (r185341) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -779,7 +780,7 @@ pmc_p6_initialize(struct pmc_mdep *md, i { struct pmc_classdep *pcd; - KASSERT(strcmp(cpu_vendor, "GenuineIntel") == 0, + KASSERT(cpu_vendor_id == CPU_VENDOR_INTEL, ("[p6,%d] Initializing non-intel processor", __LINE__)); PMCDBG(MDP,INI,1, "%s", "p6-initialize"); Modified: head/sys/dev/hwpmc/hwpmc_x86.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_x86.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/dev/hwpmc/hwpmc_x86.c Wed Nov 26 19:25:13 2008 (r185341) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -252,9 +253,9 @@ pmc_md_initialize() /* determine the CPU kind */ md = NULL; - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) + if (cpu_vendor_id == CPU_VENDOR_AMD) md = pmc_amd_initialize(); - else if (strcmp(cpu_vendor, "GenuineIntel") == 0) + else if (cpu_vendor_id == CPU_VENDOR_INTEL) md = pmc_intel_initialize(); else KASSERT(0, ("[x86,%d] Unknown vendor", __LINE__)); @@ -270,9 +271,9 @@ pmc_md_initialize() void pmc_md_finalize(struct pmc_mdep *md) { - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) + if (cpu_vendor_id == CPU_VENDOR_AMD) pmc_amd_finalize(md); - else if (strcmp(cpu_vendor, "GenuineIntel") == 0) + else if (cpu_vendor_id == CPU_VENDOR_INTEL) pmc_intel_finalize(md); else KASSERT(0, ("[x86,%d] Unknown vendor", __LINE__)); Modified: head/sys/i386/cpufreq/est.c ============================================================================== --- head/sys/i386/cpufreq/est.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/i386/cpufreq/est.c Wed Nov 26 19:25:13 2008 (r185341) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "cpufreq_if.h" #include +#include #include #include @@ -54,6 +55,10 @@ __FBSDID("$FreeBSD$"); #define MSR_MISC_ENABLE 0x1a0 #define MSR_SS_ENABLE (1<<16) +#ifndef CPU_VENDOR_CENTAUR +#define CPU_VENDOR_CENTAUR 0x111d +#endif + /* Frequency and MSR control values. */ typedef struct { uint16_t freq; @@ -64,7 +69,7 @@ typedef struct { /* Identifying characteristics of a processor and supported frequencies. */ typedef struct { - const char *vendor; + const u_int vendor_id; uint32_t id32; freq_info *freqtab; } cpu_info; @@ -88,12 +93,10 @@ struct est_softc { #define FREQ_INFO(MHz, mV, bus_clk) \ FREQ_INFO_PWR(MHz, mV, bus_clk, CPUFREQ_VAL_UNKNOWN) #define INTEL(tab, zhi, vhi, zlo, vlo, bus_clk) \ - { intel_id, ID32(zhi, vhi, zlo, vlo, bus_clk), tab } + { CPU_VENDOR_INTEL, ID32(zhi, vhi, zlo, vlo, bus_clk), tab } #define CENTAUR(tab, zhi, vhi, zlo, vlo, bus_clk) \ - { centaur_id, ID32(zhi, vhi, zlo, vlo, bus_clk), tab } + { CPU_VENDOR_CENTAUR, ID32(zhi, vhi, zlo, vlo, bus_clk), tab } -const char intel_id[] = "GenuineIntel"; -const char centaur_id[] = "CentaurHauls"; static int msr_info_enabled = 0; TUNABLE_INT("hw.est.msr_info", &msr_info_enabled); @@ -891,7 +894,7 @@ static cpu_info ESTprocs[] = { CENTAUR(C7M_772_ULV, 1200, 844, 400, 796, 100), CENTAUR(C7M_779_ULV, 1000, 796, 400, 796, 100), CENTAUR(C7M_770_ULV, 1000, 844, 400, 796, 100), - { NULL, 0, NULL }, + { 0, 0, NULL }, }; static void est_identify(driver_t *driver, device_t parent); @@ -958,8 +961,8 @@ est_identify(driver_t *driver, device_t return; /* Check that CPUID is supported and the vendor is Intel.*/ - if (cpu_high == 0 || (strcmp(cpu_vendor, intel_id) != 0 && - strcmp(cpu_vendor, centaur_id) != 0)) + if (cpu_high == 0 || (cpu_vendor_id != CPU_VENDOR_INTEL && + cpu_vendor_id != CPU_VENDOR_CENTAUR)) return; /* @@ -1159,7 +1162,7 @@ est_table_info(device_t dev, uint64_t ms /* Find a table which matches (vendor, id32). */ id = msr >> 32; for (p = ESTprocs; p->id32 != 0; p++) { - if (strcmp(p->vendor, cpu_vendor) == 0 && p->id32 == id) + if (p->vendor_id == cpu_vendor_id && p->id32 == id) break; } if (p->id32 == 0) Modified: head/sys/i386/i386/i686_mem.c ============================================================================== --- head/sys/i386/i386/i686_mem.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/i386/i386/i686_mem.c Wed Nov 26 19:25:13 2008 (r185341) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -677,8 +678,8 @@ i686_mem_drvinit(void *unused) return; if ((cpu_id & 0xf00) != 0x600 && (cpu_id & 0xf00) != 0xf00) return; - if ((strcmp(cpu_vendor, "GenuineIntel") != 0) && - (strcmp(cpu_vendor, "AuthenticAMD") != 0)) + if (cpu_vendor_id != CPU_VENDOR_INTEL && + cpu_vendor_id != CPU_VENDOR_AMD) return; mem_range_softc.mr_op = &i686_mrops; } Modified: head/sys/i386/i386/identcpu.c ============================================================================== --- head/sys/i386/i386/identcpu.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/i386/i386/identcpu.c Wed Nov 26 19:25:13 2008 (r185341) @@ -77,6 +77,7 @@ void panicifcpuunsupported(void); static void identifycyrix(void); static void init_exthigh(void); +static u_int find_cpu_vendor_id(void); static void print_AMD_info(void); static void print_INTEL_info(void); static void print_INTEL_TLB(u_int data); @@ -138,6 +139,26 @@ static struct { { "Pentium 4", CPUCLASS_686 }, /* CPU_P4 */ }; +static struct { + char *vendor; + u_int vendor_id; +} cpu_vendors[] = { + { INTEL_VENDOR_ID, CPU_VENDOR_INTEL }, /* GenuineIntel */ + { AMD_VENDOR_ID, CPU_VENDOR_AMD }, /* AuthenticAMD */ + { CENTAUR_VENDOR_ID, CPU_VENDOR_CENTAUR }, /* CentaurHauls */ + { NSC_VENDOR_ID, CPU_VENDOR_NSC }, /* Geode by NSC */ + { CYRIX_VENDOR_ID, CPU_VENDOR_CYRIX }, /* CyrixInstead */ + { TRANSMETA_VENDOR_ID, CPU_VENDOR_TRANSMETA }, /* GenuineTMx86 */ + { SIS_VENDOR_ID, CPU_VENDOR_SIS }, /* SiS SiS SiS */ + { UMC_VENDOR_ID, CPU_VENDOR_UMC }, /* UMC UMC UMC */ + { NEXGEN_VENDOR_ID, CPU_VENDOR_NEXGEN }, /* NexGenDriven */ + { RISE_VENDOR_ID, CPU_VENDOR_RISE }, /* RiseRiseRise */ +#if 0 + /* XXX CPUID 8000_0000h and 8086_0000h, not 0000_0000h */ + { "TransmetaCPU", CPU_VENDOR_TRANSMETA }, +#endif +}; + int cpu_cores; int cpu_logical; @@ -153,12 +174,11 @@ init_exthigh(void) if (done == 0) { if (cpu_high > 0 && - (strcmp(cpu_vendor, "GenuineIntel") == 0 || - strcmp(cpu_vendor, "AuthenticAMD") == 0 || - strcmp(cpu_vendor, "GenuineTMx86") == 0 || - strcmp(cpu_vendor, "TransmetaCPU") == 0 || - strcmp(cpu_vendor, "CentaurHauls") == 0 || - strcmp(cpu_vendor, "Geode by NSC") == 0)) { + (cpu_vendor_id == CPU_VENDOR_INTEL || + cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_TRANSMETA || + cpu_vendor_id == CPU_VENDOR_CENTAUR || + cpu_vendor_id == CPU_VENDOR_NSC)) { do_cpuid(0x80000000, regs); if (regs[0] >= 0x80000000) cpu_exthigh = regs[0]; @@ -189,7 +209,7 @@ printcpuinfo(void) } } - if (strcmp(cpu_vendor, "GenuineIntel") == 0) { + if (cpu_vendor_id == CPU_VENDOR_INTEL) { if ((cpu_id & 0xf00) > 0x300) { u_int brand_index; u_int model; @@ -333,7 +353,7 @@ printcpuinfo(void) cpu_brandtable[brand_index]); } } - } else if (strcmp(cpu_vendor, "AuthenticAMD") == 0) { + } else if (cpu_vendor_id == CPU_VENDOR_AMD) { /* * Values taken from AMD Processor Recognition * http://www.amd.com/K6/k6docs/pdf/20734g.pdf @@ -413,7 +433,7 @@ printcpuinfo(void) enable_K6_wt_alloc(); } #endif - } else if (strcmp(cpu_vendor, "CyrixInstead") == 0) { + } else if (cpu_vendor_id == CPU_VENDOR_CYRIX) { strcpy(cpu_model, "Cyrix "); switch (cpu_id & 0xff0) { case 0x440: @@ -549,7 +569,7 @@ printcpuinfo(void) } break; } - } else if (strcmp(cpu_vendor, "RiseRiseRise") == 0) { + } else if (cpu_vendor_id == CPU_VENDOR_RISE) { strcpy(cpu_model, "Rise "); switch (cpu_id & 0xff0) { case 0x500: @@ -558,7 +578,7 @@ printcpuinfo(void) default: strcat(cpu_model, "Unknown"); } - } else if (strcmp(cpu_vendor, "CentaurHauls") == 0) { + } else if (cpu_vendor_id == CPU_VENDOR_CENTAUR) { switch (cpu_id & 0xff0) { case 0x540: strcpy(cpu_model, "IDT WinChip C6"); @@ -589,9 +609,9 @@ printcpuinfo(void) default: strcpy(cpu_model, "VIA/IDT Unknown"); } - } else if (strcmp(cpu_vendor, "IBM") == 0) { + } else if (cpu_vendor_id == CPU_VENDOR_IBM) { strcpy(cpu_model, "Blue Lightning CPU"); - } else if (strcmp(cpu_vendor, "Geode by NSC") == 0) { + } else if (cpu_vendor_id == CPU_VENDOR_NSC) { switch (cpu_id & 0xfff) { case 0x540: strcpy(cpu_model, "Geode SC1100"); @@ -655,17 +675,16 @@ printcpuinfo(void) if(cpu_id) printf(" Id = 0x%x", cpu_id); - if (strcmp(cpu_vendor, "GenuineIntel") == 0 || - strcmp(cpu_vendor, "AuthenticAMD") == 0 || - strcmp(cpu_vendor, "GenuineTMx86") == 0 || - strcmp(cpu_vendor, "TransmetaCPU") == 0 || - strcmp(cpu_vendor, "RiseRiseRise") == 0 || - strcmp(cpu_vendor, "CentaurHauls") == 0 || - strcmp(cpu_vendor, "Geode by NSC") == 0 || - ((strcmp(cpu_vendor, "CyrixInstead") == 0) && + if (cpu_vendor_id == CPU_VENDOR_INTEL || + cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_TRANSMETA || + cpu_vendor_id == CPU_VENDOR_RISE || + cpu_vendor_id == CPU_VENDOR_CENTAUR || + cpu_vendor_id == CPU_VENDOR_NSC || + (cpu_vendor_id == CPU_VENDOR_CYRIX && ((cpu_id & 0xf00) > 0x500))) { printf(" Stepping = %u", cpu_id & 0xf); - if (strcmp(cpu_vendor, "CyrixInstead") == 0) + if (cpu_vendor_id == CPU_VENDOR_CYRIX) printf(" DIR=0x%04x", cyrix_did); if (cpu_high > 0) { u_int cmp = 1, htt = 1; @@ -837,8 +856,8 @@ printcpuinfo(void) ); } - if (cpu_feature & CPUID_HTT && strcmp(cpu_vendor, - "AuthenticAMD") == 0) + if ((cpu_feature & CPUID_HTT) && + cpu_vendor_id == CPU_VENDOR_AMD) cpu_feature &= ~CPUID_HTT; /* @@ -846,8 +865,8 @@ printcpuinfo(void) * mention the capability. */ if (!tsc_is_invariant && - ((strcmp(cpu_vendor, "AuthenticAMD") == 0 || - (strcmp(cpu_vendor, "GenuineIntel") == 0))&& + ((cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_INTEL) && ((amd_pminfo & AMDPM_TSC_INVARIANT) != 0 || I386_CPU_FAMILY(cpu_id) >= 0x10 || cpu_id == 0x60fb2))) { @@ -861,10 +880,10 @@ printcpuinfo(void) */ if (cpu_feature & CPUID_HTT) htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16; - if (strcmp(cpu_vendor, "AuthenticAMD") == 0 && + if (cpu_vendor_id == CPU_VENDOR_AMD && (amd_feature2 & AMDID2_CMP)) cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1; - else if (strcmp(cpu_vendor, "GenuineIntel") == 0 && + else if (cpu_vendor_id == CPU_VENDOR_INTEL && (cpu_high >= 4)) { cpuid_count(4, 0, regs); if ((regs[0] & 0x1f) != 0) @@ -878,7 +897,7 @@ printcpuinfo(void) printf("\n Logical CPUs per core: %d", cpu_logical); } - } else if (strcmp(cpu_vendor, "CyrixInstead") == 0) { + } else if (cpu_vendor_id == CPU_VENDOR_CYRIX) { printf(" DIR=0x%04x", cyrix_did); printf(" Stepping=%u", (cyrix_did & 0xf000) >> 12); printf(" Revision=%u", (cyrix_did & 0x0f00) >> 8); @@ -887,7 +906,7 @@ printcpuinfo(void) printf("\n CPU cache: write-through mode"); #endif } - if (strcmp(cpu_vendor, "CentaurHauls") == 0) + if (cpu_vendor_id == CPU_VENDOR_CENTAUR) print_via_padlock_info(); /* Avoid ugly blank lines: only print newline when we have to. */ @@ -897,12 +916,11 @@ printcpuinfo(void) if (!bootverbose) return; - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) + if (cpu_vendor_id == CPU_VENDOR_AMD) print_AMD_info(); - else if (strcmp(cpu_vendor, "GenuineIntel") == 0) + else if (cpu_vendor_id == CPU_VENDOR_INTEL) print_INTEL_info(); - else if (strcmp(cpu_vendor, "GenuineTMx86") == 0 || - strcmp(cpu_vendor, "TransmetaCPU") == 0) + else if (cpu_vendor_id == CPU_VENDOR_TRANSMETA) print_transmeta_info(); } @@ -1097,9 +1115,11 @@ finishidentcpu(void) u_char ccr3; u_int regs[4]; + cpu_vendor_id = find_cpu_vendor_id(); + /* Detect AMD features (PTE no-execute bit, 3dnow, 64 bit mode etc) */ - if (strcmp(cpu_vendor, "GenuineIntel") == 0 || - strcmp(cpu_vendor, "AuthenticAMD") == 0) { + if (cpu_vendor_id == CPU_VENDOR_INTEL || + cpu_vendor_id == CPU_VENDOR_AMD) { init_exthigh(); if (cpu_exthigh >= 0x80000001) { do_cpuid(0x80000001, regs); @@ -1114,7 +1134,7 @@ finishidentcpu(void) do_cpuid(0x80000008, regs); cpu_procinfo2 = regs[2]; } - } else if (strcmp(cpu_vendor, "CyrixInstead") == 0) { + } else if (cpu_vendor_id == CPU_VENDOR_CYRIX) { if (cpu == CPU_486) { /* * These conditions are equivalent to: @@ -1124,6 +1144,7 @@ finishidentcpu(void) isblue = identblue(); if (isblue == IDENTBLUE_IBMCPU) { strcpy(cpu_vendor, "IBM"); + cpu_vendor_id = CPU_VENDOR_IBM; cpu = CPU_BLUE; return; } @@ -1197,12 +1218,24 @@ finishidentcpu(void) isblue = identblue(); if (isblue == IDENTBLUE_IBMCPU) { strcpy(cpu_vendor, "IBM"); + cpu_vendor_id = CPU_VENDOR_IBM; cpu = CPU_BLUE; return; } } } +static u_int +find_cpu_vendor_id(void) +{ + int i; + + for (i = 0; i < sizeof(cpu_vendors) / sizeof(cpu_vendors[0]); i++) + if (strcmp(cpu_vendor, cpu_vendors[i].vendor) == 0) + return (cpu_vendors[i].vendor_id); + return (0); +} + static void print_AMD_assoc(int i) { Modified: head/sys/i386/i386/initcpu.c ============================================================================== --- head/sys/i386/i386/initcpu.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/i386/i386/initcpu.c Wed Nov 26 19:25:13 2008 (r185341) @@ -90,6 +90,7 @@ u_int cpu_id = 0; /* Stepping ID */ u_int cpu_procinfo = 0; /* HyperThreading Info / Brand Index / CLFUSH */ u_int cpu_procinfo2 = 0; /* Multicore info */ char cpu_vendor[20] = ""; /* CPU Origin code */ +u_int cpu_vendor_id = 0; /* CPU vendor ID */ SYSCTL_UINT(_hw, OID_AUTO, via_feature_rng, CTLFLAG_RD, &via_feature_rng, 0, "VIA C3/C7 RNG feature available in CPU"); Modified: head/sys/i386/i386/k6_mem.c ============================================================================== --- head/sys/i386/i386/k6_mem.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/i386/i386/k6_mem.c Wed Nov 26 19:25:13 2008 (r185341) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -175,7 +176,7 @@ static void k6_mem_drvinit(void *unused) { - if (strcmp(cpu_vendor, "AuthenticAMD") != 0) + if (cpu_vendor_id != CPU_VENDOR_AMD) return; if ((cpu_id & 0xf00) != 0x500) return; Modified: head/sys/i386/i386/local_apic.c ============================================================================== --- head/sys/i386/i386/local_apic.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/i386/i386/local_apic.c Wed Nov 26 19:25:13 2008 (r185341) @@ -325,7 +325,7 @@ lapic_setup(int boot) /* XXX: Error and thermal LVTs */ - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) { + if (cpu_vendor_id == CPU_VENDOR_AMD) { /* * Detect the presence of C1E capability mostly on latest * dual-cores (or future) k8 family. This feature renders @@ -1073,7 +1073,7 @@ apic_init(void *dummy __unused) * CPUs during early startup. We need to turn the local APIC back * on on such CPUs now. */ - if (cpu == CPU_686 && strcmp(cpu_vendor, "GenuineIntel") == 0 && + if (cpu == CPU_686 && cpu_vendor_id == CPU_VENDOR_INTEL && (cpu_id & 0xff0) == 0x610) { apic_base = rdmsr(MSR_APICBASE); apic_base |= APICBASE_ENABLED; Modified: head/sys/i386/i386/longrun.c ============================================================================== --- head/sys/i386/i386/longrun.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/i386/i386/longrun.c Wed Nov 26 19:25:13 2008 (r185341) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -262,8 +263,8 @@ tmx86_longrun_profile_sysctl(SYSCTL_HAND static void setup_tmx86_longrun(void *dummy __unused) { - if (strcmp(cpu_vendor, "GenuineTMx86") != 0 && - strcmp(cpu_vendor, "TransmetaCPU") != 0) + + if (cpu_vendor_id != CPU_VENDOR_TRANSMETA) return; crusoe_longrun = tmx86_get_longrun_mode(); Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/i386/i386/mp_machdep.c Wed Nov 26 19:25:13 2008 (r185341) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -422,8 +423,7 @@ cpu_mp_start(void) * First determine if this is an Intel processor which claims * to have hyperthreading support. */ - if ((cpu_feature & CPUID_HTT) && - (strcmp(cpu_vendor, "GenuineIntel") == 0)) { + if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) { /* * If the "deterministic cache parameters" cpuid calls * are available, use them. Modified: head/sys/i386/i386/msi.c ============================================================================== --- head/sys/i386/i386/msi.c Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/i386/i386/msi.c Wed Nov 26 19:25:13 2008 (r185341) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -211,8 +212,8 @@ msi_init(void) { /* Check if we have a supported CPU. */ - if (!(strcmp(cpu_vendor, "GenuineIntel") == 0 || - strcmp(cpu_vendor, "AuthenticAMD") == 0)) + if (!(cpu_vendor_id == CPU_VENDOR_INTEL || + cpu_vendor_id == CPU_VENDOR_AMD)) return; msi_enabled = 1; Modified: head/sys/i386/include/cputypes.h ============================================================================== --- head/sys/i386/include/cputypes.h Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/i386/include/cputypes.h Wed Nov 26 19:25:13 2008 (r185341) @@ -33,33 +33,49 @@ /* * Classes of processor. */ -#define CPUCLASS_286 0 -#define CPUCLASS_386 1 -#define CPUCLASS_486 2 -#define CPUCLASS_586 3 -#define CPUCLASS_686 4 +#define CPUCLASS_286 0 +#define CPUCLASS_386 1 +#define CPUCLASS_486 2 +#define CPUCLASS_586 3 +#define CPUCLASS_686 4 /* * Kinds of processor. */ -#define CPU_286 0 /* Intel 80286 */ -#define CPU_386SX 1 /* Intel 80386SX */ -#define CPU_386 2 /* Intel 80386DX */ -#define CPU_486SX 3 /* Intel 80486SX */ -#define CPU_486 4 /* Intel 80486DX */ -#define CPU_586 5 /* Intel P.....m (I hate lawyers; it's TM) */ -#define CPU_486DLC 6 /* Cyrix 486DLC */ -#define CPU_686 7 /* Pentium Pro */ -#define CPU_M1SC 8 /* Cyrix M1sc (aka 5x86) */ -#define CPU_M1 9 /* Cyrix M1 (aka 6x86) */ -#define CPU_BLUE 10 /* IBM BlueLighting CPU */ -#define CPU_M2 11 /* Cyrix M2 (aka enhanced 6x86 with MMX */ -#define CPU_NX586 12 /* NexGen (now AMD) 586 */ -#define CPU_CY486DX 13 /* Cyrix 486S/DX/DX2/DX4 */ -#define CPU_PII 14 /* Intel Pentium II */ -#define CPU_PIII 15 /* Intel Pentium III */ -#define CPU_P4 16 /* Intel Pentium 4 */ -#define CPU_GEODE1100 17 /* NS Geode SC1100 */ +#define CPU_286 0 /* Intel 80286 */ +#define CPU_386SX 1 /* Intel 80386SX */ +#define CPU_386 2 /* Intel 80386DX */ +#define CPU_486SX 3 /* Intel 80486SX */ +#define CPU_486 4 /* Intel 80486DX */ +#define CPU_586 5 /* Intel Pentium */ +#define CPU_486DLC 6 /* Cyrix 486DLC */ +#define CPU_686 7 /* Pentium Pro */ +#define CPU_M1SC 8 /* Cyrix M1sc (aka 5x86) */ +#define CPU_M1 9 /* Cyrix M1 (aka 6x86) */ +#define CPU_BLUE 10 /* IBM BlueLighting CPU */ +#define CPU_M2 11 /* Cyrix M2 (enhanced 6x86 with MMX) */ +#define CPU_NX586 12 /* NexGen (now AMD) 586 */ +#define CPU_CY486DX 13 /* Cyrix 486S/DX/DX2/DX4 */ +#define CPU_PII 14 /* Intel Pentium II */ +#define CPU_PIII 15 /* Intel Pentium III */ +#define CPU_P4 16 /* Intel Pentium 4 */ +#define CPU_GEODE1100 17 /* NS Geode SC1100 */ + +/* + * Vendors of processor. + */ +#define CPU_VENDOR_NSC 0x100b /* NSC */ +#define CPU_VENDOR_IBM 0x1014 /* IBM */ +#define CPU_VENDOR_AMD 0x1022 /* AMD */ +#define CPU_VENDOR_SIS 0x1039 /* SiS */ +#define CPU_VENDOR_UMC 0x1060 /* UMC */ +#define CPU_VENDOR_NEXGEN 0x1074 /* Nexgen */ +#define CPU_VENDOR_CYRIX 0x1078 /* Cyrix */ +#define CPU_VENDOR_IDT 0x111d /* Centaur/IDT/VIA */ +#define CPU_VENDOR_TRANSMETA 0x1279 /* Transmeta */ +#define CPU_VENDOR_INTEL 0x8086 /* Intel */ +#define CPU_VENDOR_RISE 0xdead2bad /* Rise */ +#define CPU_VENDOR_CENTAUR CPU_VENDOR_IDT #ifndef LOCORE extern int cpu; Modified: head/sys/i386/include/md_var.h ============================================================================== --- head/sys/i386/include/md_var.h Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/i386/include/md_var.h Wed Nov 26 19:25:13 2008 (r185341) @@ -59,6 +59,7 @@ extern u_int cpu_mxcsr_mask; extern u_int cpu_procinfo; extern u_int cpu_procinfo2; extern char cpu_vendor[]; +extern u_int cpu_vendor_id; extern u_int cyrix_did; extern char kstack[]; extern char sigcode[]; Modified: head/sys/i386/include/specialreg.h ============================================================================== --- head/sys/i386/include/specialreg.h Wed Nov 26 19:22:08 2008 (r185340) +++ head/sys/i386/include/specialreg.h Wed Nov 26 19:25:13 2008 (r185341) @@ -195,8 +195,16 @@ /* * CPUID manufacturers identifiers */ -#define INTEL_VENDOR_ID "GenuineIntel" -#define AMD_VENDOR_ID "AuthenticAMD" +#define AMD_VENDOR_ID "AuthenticAMD" +#define CENTAUR_VENDOR_ID "CentaurHauls" +#define CYRIX_VENDOR_ID "CyrixInstead" +#define INTEL_VENDOR_ID "GenuineIntel" +#define NEXGEN_VENDOR_ID "NexGenDriven" +#define NSC_VENDOR_ID "Geode by NSC" +#define RISE_VENDOR_ID "RiseRiseRise" +#define SIS_VENDOR_ID "SiS SiS SiS " +#define TRANSMETA_VENDOR_ID "GenuineTMx86" +#define UMC_VENDOR_ID "UMC UMC UMC " /* * Model-specific registers for the i386 family From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 19:29:33 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E82281065672; Wed, 26 Nov 2008 19:29:33 +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 D2EE98FC17; Wed, 26 Nov 2008 19:29:33 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQJTXki064244; Wed, 26 Nov 2008 19:29:33 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQJTXVM064242; Wed, 26 Nov 2008 19:29:33 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200811261929.mAQJTXVM064242@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 26 Nov 2008 19:29:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185343 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 19:29:34 -0000 Author: jkim Date: Wed Nov 26 19:29:33 2008 New Revision: 185343 URL: http://svn.freebsd.org/changeset/base/185343 Log: Use newly introduced cpu_vendor_id to make invariant TSC detection more clearer and merge r185295 to amd64. Modified: head/sys/amd64/amd64/identcpu.c head/sys/i386/i386/identcpu.c Modified: head/sys/amd64/amd64/identcpu.c ============================================================================== --- head/sys/amd64/amd64/identcpu.c Wed Nov 26 19:27:51 2008 (r185342) +++ head/sys/amd64/amd64/identcpu.c Wed Nov 26 19:29:33 2008 (r185343) @@ -360,14 +360,20 @@ printcpuinfo(void) * If this CPU supports P-state invariant TSC then * mention the capability. */ - if (!tsc_is_invariant && - (cpu_vendor_id == CPU_VENDOR_AMD && - ((amd_pminfo & AMDPM_TSC_INVARIANT) != 0 || - AMD64_CPU_FAMILY(cpu_id) >= 0x10 || - cpu_id == 0x60fb2))) { - tsc_is_invariant = 1; - printf("\n TSC: P-state invariant"); + switch (cpu_vendor_id) { + case CPU_VENDOR_AMD: + if ((amd_pminfo & AMDPM_TSC_INVARIANT) || + AMD64_CPU_FAMILY(cpu_id) >= 0x10 || + cpu_id == 0x60fb2) + tsc_is_invariant = 1; + break; + case CPU_VENDOR_INTEL: + if (amd_pminfo & AMDPM_TSC_INVARIANT) + tsc_is_invariant = 1; + break; } + if (tsc_is_invariant) + printf("\n TSC: P-state invariant"); /* * If this CPU supports HTT or CMP then mention the Modified: head/sys/i386/i386/identcpu.c ============================================================================== --- head/sys/i386/i386/identcpu.c Wed Nov 26 19:27:51 2008 (r185342) +++ head/sys/i386/i386/identcpu.c Wed Nov 26 19:29:33 2008 (r185343) @@ -864,15 +864,20 @@ printcpuinfo(void) * If this CPU supports P-state invariant TSC then * mention the capability. */ - if (!tsc_is_invariant && - ((cpu_vendor_id == CPU_VENDOR_AMD || - cpu_vendor_id == CPU_VENDOR_INTEL) && - ((amd_pminfo & AMDPM_TSC_INVARIANT) != 0 || - I386_CPU_FAMILY(cpu_id) >= 0x10 || - cpu_id == 0x60fb2))) { - tsc_is_invariant = 1; - printf("\n TSC: P-state invariant"); + switch (cpu_vendor_id) { + case CPU_VENDOR_AMD: + if ((amd_pminfo & AMDPM_TSC_INVARIANT) || + I386_CPU_FAMILY(cpu_id) >= 0x10 || + cpu_id == 0x60fb2) + tsc_is_invariant = 1; + break; + case CPU_VENDOR_INTEL: + if (amd_pminfo & AMDPM_TSC_INVARIANT) + tsc_is_invariant = 1; + break; } + if (tsc_is_invariant) + printf("\n TSC: P-state invariant"); /* * If this CPU supports HTT or CMP then mention the From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 20:52:27 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C912E1065672; Wed, 26 Nov 2008 20:52:27 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A85948FC12; Wed, 26 Nov 2008 20:52:27 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQKqRxb065926; Wed, 26 Nov 2008 20:52:27 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQKqRN5065921; Wed, 26 Nov 2008 20:52:27 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811262052.mAQKqRN5065921@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 26 Nov 2008 20:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185344 - in head/sys: netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 20:52:28 -0000 Author: bz Date: Wed Nov 26 20:52:26 2008 New Revision: 185344 URL: http://svn.freebsd.org/changeset/base/185344 Log: Remove in6_pcbdetach() as it is exactly the same function as in_pcbdetach() and we don't need the code twice. Reviewed by: rwatson MFC after: 6 weeks (*) (*) possibly need to leave a stub wrapper in 7 to keep the symbol. Modified: head/sys/netinet/tcp_usrreq.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_pcb.h head/sys/netinet6/raw_ip6.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Wed Nov 26 19:29:33 2008 (r185343) +++ head/sys/netinet/tcp_usrreq.c Wed Nov 26 20:52:26 2008 (r185344) @@ -187,24 +187,15 @@ tcp_detach(struct socket *so, struct inp if (inp->inp_vflag & INP_DROPPED) { KASSERT(tp == NULL, ("tcp_detach: INP_TIMEWAIT && " "INP_DROPPED && tp != NULL")); + in_pcbdetach(inp); #ifdef INET6 - if (isipv6) { - in6_pcbdetach(inp); + if (isipv6) in6_pcbfree(inp); - } else { + else #endif - in_pcbdetach(inp); in_pcbfree(inp); -#ifdef INET6 - } -#endif } else { -#ifdef INET6 - if (isipv6) - in6_pcbdetach(inp); - else -#endif - in_pcbdetach(inp); + in_pcbdetach(inp); INP_WUNLOCK(inp); } } else { @@ -220,23 +211,14 @@ tcp_detach(struct socket *so, struct inp if (inp->inp_vflag & INP_DROPPED || tp->t_state < TCPS_SYN_SENT) { tcp_discardcb(tp); + in_pcbdetach(inp); #ifdef INET6 - if (isipv6) { - in6_pcbdetach(inp); + if (isipv6) in6_pcbfree(inp); - } else { + else #endif - in_pcbdetach(inp); in_pcbfree(inp); -#ifdef INET6 - } -#endif } else { -#ifdef INET6 - if (isipv6) - in6_pcbdetach(inp); - else -#endif in_pcbdetach(inp); } } @@ -1496,17 +1478,13 @@ tcp_attach(struct socket *so) inp->inp_vflag |= INP_IPV4; tp = tcp_newtcpcb(inp); if (tp == NULL) { + in_pcbdetach(inp); #ifdef INET6 - if (isipv6) { - in6_pcbdetach(inp); + if (isipv6) in6_pcbfree(inp); - } else { + else #endif - in_pcbdetach(inp); in_pcbfree(inp); -#ifdef INET6 - } -#endif INP_INFO_WUNLOCK(&V_tcbinfo); return (ENOBUFS); } Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Wed Nov 26 19:29:33 2008 (r185343) +++ head/sys/netinet6/in6_pcb.c Wed Nov 26 20:52:26 2008 (r185344) @@ -411,16 +411,6 @@ in6_pcbdisconnect(struct inpcb *inp) } void -in6_pcbdetach(struct inpcb *inp) -{ - - KASSERT(inp->inp_socket != NULL, ("%s: inp_socket == NULL", __func__)); - - inp->inp_socket->so_pcb = NULL; - inp->inp_socket = NULL; -} - -void in6_pcbfree(struct inpcb *inp) { struct inpcbinfo *ipi = inp->inp_pcbinfo; Modified: head/sys/netinet6/in6_pcb.h ============================================================================== --- head/sys/netinet6/in6_pcb.h Wed Nov 26 19:29:33 2008 (r185343) +++ head/sys/netinet6/in6_pcb.h Wed Nov 26 20:52:26 2008 (r185344) @@ -73,7 +73,6 @@ void in6_pcbpurgeif0 __P((struct inpcbin void in6_losing __P((struct inpcb *)); int in6_pcbbind __P((struct inpcb *, struct sockaddr *, struct ucred *)); int in6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct ucred *)); -void in6_pcbdetach __P((struct inpcb *)); void in6_pcbdisconnect __P((struct inpcb *)); void in6_pcbfree __P((struct inpcb *)); int in6_pcbladdr __P((struct inpcb *, struct sockaddr *, Modified: head/sys/netinet6/raw_ip6.c ============================================================================== --- head/sys/netinet6/raw_ip6.c Wed Nov 26 19:29:33 2008 (r185343) +++ head/sys/netinet6/raw_ip6.c Wed Nov 26 20:52:26 2008 (r185344) @@ -604,7 +604,7 @@ rip6_detach(struct socket *so) INP_INFO_WLOCK(&V_ripcbinfo); INP_WLOCK(inp); free(inp->in6p_icmp6filt, M_PCB); - in6_pcbdetach(inp); + in_pcbdetach(inp); in6_pcbfree(inp); INP_INFO_WUNLOCK(&V_ripcbinfo); } Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Wed Nov 26 19:29:33 2008 (r185343) +++ head/sys/netinet6/udp6_usrreq.c Wed Nov 26 20:52:26 2008 (r185344) @@ -900,7 +900,7 @@ udp6_detach(struct socket *so) INP_INFO_WLOCK(&V_udbinfo); INP_WLOCK(inp); - in6_pcbdetach(inp); + in_pcbdetach(inp); in6_pcbfree(inp); INP_INFO_WUNLOCK(&V_udbinfo); } From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 21:05:04 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 840BB106564A; Wed, 26 Nov 2008 21:05:04 +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 6CF3F8FC1B; Wed, 26 Nov 2008 21:05:04 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQL54WR066234; Wed, 26 Nov 2008 21:05:04 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQL54ko066233; Wed, 26 Nov 2008 21:05:04 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200811262105.mAQL54ko066233@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 26 Nov 2008 21:05:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185345 - head/sbin/newfs_msdos X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 21:05:04 -0000 Author: luigi Date: Wed Nov 26 21:05:03 2008 New Revision: 185345 URL: http://svn.freebsd.org/changeset/base/185345 Log: Create a fake geometry (16 heads, 64 sectors) when dealing with a plain file and a geometry is not explicitly supplied through command line or disktab entry. This way you can a FAT image on a file as simply as this: newfs_msdos ./some/file (right now you need a much longer command newfs_msdos -h 32 -u 64 -S 512 -s $total_blocks -o 0 ./some/file Will be merged after 7.1 and 6.4 are released. See also the related PR which suggests a similar change. PR: bin/121182 MFC after: 4 weeks Modified: head/sbin/newfs_msdos/newfs_msdos.c Modified: head/sbin/newfs_msdos/newfs_msdos.c ============================================================================== --- head/sbin/newfs_msdos/newfs_msdos.c Wed Nov 26 20:52:26 2008 (r185344) +++ head/sbin/newfs_msdos/newfs_msdos.c Wed Nov 26 21:05:03 2008 (r185345) @@ -725,9 +725,20 @@ getdiskinfo(int fd, const char *fname, c /* Maybe it's a floppy drive */ if (lp == NULL) { - if (ioctl(fd, DIOCGMEDIASIZE, &ms) == -1) - errx(1, "Cannot get disk size, %s", strerror(errno)); - if (ioctl(fd, FD_GTYPE, &type) != -1) { + if (ioctl(fd, DIOCGMEDIASIZE, &ms) == -1) { + struct stat st; + + bzero(&st, sizeof(st)); + if (fstat(fd, &st)) + err(1, "Cannot get disk size"); + /* create a fake geometry for a file image */ + ms = st.st_size; + dlp.d_secsize = 512; + dlp.d_nsectors = 64; + dlp.d_ntracks = 32; + dlp.d_secperunit = ms / dlp.d_secsize; + lp = &dlp; + } else if (ioctl(fd, FD_GTYPE, &type) != -1) { dlp.d_secsize = 128 << type.secsize; dlp.d_nsectors = type.sectrac; dlp.d_ntracks = type.heads; From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 21:08:52 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40EC71065676 for ; Wed, 26 Nov 2008 21:08:52 +0000 (UTC) (envelope-from max@love2party.net) Received: from mout-xforward.kundenserver.de (mout-xforward.kundenserver.de [212.227.17.5]) by mx1.freebsd.org (Postfix) with ESMTP id C02698FC21 for ; Wed, 26 Nov 2008 21:08:51 +0000 (UTC) (envelope-from max@love2party.net) Received: from vampire.homelinux.org (dslb-088-066-055-067.pools.arcor-ip.net [88.66.55.67]) by mrelayeu.kundenserver.de (node=mrelayeu4) with ESMTP (Nemesis) id 0ML21M-1L5Rcv2QTI-0000Iz; Wed, 26 Nov 2008 22:08:49 +0100 Received: (qmail 75560 invoked from network); 26 Nov 2008 21:08:48 -0000 Received: from fbsd8.laiers.local (192.168.4.151) by laiers.local with SMTP; 26 Nov 2008 21:08:48 -0000 From: Max Laier Organization: FreeBSD To: "Bjoern A. Zeeb" Date: Wed, 26 Nov 2008 22:08:47 +0100 User-Agent: KMail/1.10.1 (FreeBSD/8.0-CURRENT; KDE/4.1.1; i386; ; ) References: <200811262052.mAQKqRN5065921@svn.freebsd.org> In-Reply-To: <200811262052.mAQKqRN5065921@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811262208.48429.max@love2party.net> X-Provags-ID: V01U2FsdGVkX1/tlHnX98E8yZfcf+veKCYGRlz4setSLfrpstP aYmt5C8d/3P2BR2F5ekPL3DeqARcxKJJT1ChpBSeVVbZdJ2aF+ PnbA0VErWFU45KCRHgc3Q== Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185344 - in head/sys: netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 21:08:52 -0000 On Wednesday 26 November 2008 21:52:27 Bjoern A. Zeeb wrote: > Author: bz > Date: Wed Nov 26 20:52:26 2008 > New Revision: 185344 > URL: http://svn.freebsd.org/changeset/base/185344 > > Log: > Remove in6_pcbdetach() as it is exactly the same function > as in_pcbdetach() and we don't need the code twice. > > Reviewed by: rwatson > MFC after: 6 weeks (*) > (*) possibly need to leave a stub wrapper in 7 to keep the symbol. Won't this affect our ability to build INET6, but non INET kernels? Not that we currently could, but if we ever wanted to? -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 21:15:08 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80AB21065677; Wed, 26 Nov 2008 21:15:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27]) by mx1.freebsd.org (Postfix) with ESMTP id 311728FC25; Wed, 26 Nov 2008 21:15:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.str.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 51F7D41C64A; Wed, 26 Nov 2008 22:15:06 +0100 (CET) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([62.111.66.27]) by localhost (amavis.str.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id Ij8SpCstRbW2; Wed, 26 Nov 2008 22:15:06 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id F173041C67B; Wed, 26 Nov 2008 22:15:05 +0100 (CET) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 7A00E4448D5; Wed, 26 Nov 2008 21:14:34 +0000 (UTC) Date: Wed, 26 Nov 2008 21:14:33 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Max Laier In-Reply-To: <200811262208.48429.max@love2party.net> Message-ID: <20081126211242.T61259@maildrop.int.zabbadoz.net> References: <200811262052.mAQKqRN5065921@svn.freebsd.org> <200811262208.48429.max@love2party.net> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185344 - in head/sys: netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 21:15:08 -0000 On Wed, 26 Nov 2008, Max Laier wrote: > On Wednesday 26 November 2008 21:52:27 Bjoern A. Zeeb wrote: >> Author: bz >> Date: Wed Nov 26 20:52:26 2008 >> New Revision: 185344 >> URL: http://svn.freebsd.org/changeset/base/185344 >> >> Log: >> Remove in6_pcbdetach() as it is exactly the same function >> as in_pcbdetach() and we don't need the code twice. >> >> Reviewed by: rwatson >> MFC after: 6 weeks (*) >> (*) possibly need to leave a stub wrapper in 7 to keep the symbol. > > Won't this affect our ability to build INET6, but non INET kernels? Not that > we currently could, but if we ever wanted to? Nope. though maybe for the moment. The point is if you go by that argument you would have to duplicate half of the network stack. The trick will be to hide the IPv4 only parts with #ifdef INET in the next step and compile the common code optional inet || inet6 but I need to check our build foo and it'll be a long way there anyway... -- Bjoern A. Zeeb Stop bit received. Insert coin for new game. From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 21:38:43 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A1E2106564A; Wed, 26 Nov 2008 21:38:43 +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 6147E8FC19; Wed, 26 Nov 2008 21:38:43 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQLchCZ066992; Wed, 26 Nov 2008 21:38:43 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQLchKI066991; Wed, 26 Nov 2008 21:38:43 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200811262138.mAQLchKI066991@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 26 Nov 2008 21:38:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185346 - head/sys/boot/i386/boot0 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 21:38:43 -0000 Author: luigi Date: Wed Nov 26 21:38:43 2008 New Revision: 185346 URL: http://svn.freebsd.org/changeset/base/185346 Log: Fix a typo in previous commit: must call "putn" to print a crlf, instead of "puts" which prints whatever is at %si, followed by a CRLF. It was not noticed during tests because at that point %si points to a partition entry whose first byte is 0x80, which is both a terminator for the string and a non printable character. Submitted by: Christoph Mallon Modified: head/sys/boot/i386/boot0/boot0.S Modified: head/sys/boot/i386/boot0/boot0.S ============================================================================== --- head/sys/boot/i386/boot0/boot0.S Wed Nov 26 21:05:03 2008 (r185345) +++ head/sys/boot/i386/boot0/boot0.S Wed Nov 26 21:38:43 2008 (r185346) @@ -320,7 +320,7 @@ main.15: movw $LOAD,%bx # Address for cmpw $MAGIC,0x1fe(%bx) # Bootable? jne main.10 # No pushw %si # Save ptr to selected part. - callw puts # Leave some space + callw putn # Leave some space popw %si # Restore, next stage uses it jmp *%bx # Invoke bootstrap From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 21:44:58 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A669B1065689; Wed, 26 Nov 2008 21:44:58 +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 8B0028FC28; Wed, 26 Nov 2008 21:44:58 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQLiw65067163; Wed, 26 Nov 2008 21:44:58 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQLiwLG067160; Wed, 26 Nov 2008 21:44:58 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200811262144.mAQLiwLG067160@svn.freebsd.org> From: Attilio Rao Date: Wed, 26 Nov 2008 21:44:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185347 - in head/usr.sbin: . pmcannotate X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 21:44:58 -0000 Author: attilio Date: Wed Nov 26 21:44:57 2008 New Revision: 185347 URL: http://svn.freebsd.org/changeset/base/185347 Log: Import an initial revision of the pmcannotate tool. For further explanations please check this e-mail on freebsd-arch@: http://lists.freebsd.org/pipermail/freebsd-arch/2008-November/008698.html Tested by: gnn Sponsored by: Nokia Added: head/usr.sbin/pmcannotate/ head/usr.sbin/pmcannotate/Makefile (contents, props changed) head/usr.sbin/pmcannotate/pmcannotate.8 (contents, props changed) head/usr.sbin/pmcannotate/pmcannotate.c (contents, props changed) Modified: head/usr.sbin/Makefile Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Wed Nov 26 21:38:43 2008 (r185346) +++ head/usr.sbin/Makefile Wed Nov 26 21:44:57 2008 (r185347) @@ -119,6 +119,7 @@ SUBDIR= ${_ac} \ pciconf \ periodic \ ${_pkg_install} \ + ${_pmcannotate} \ ${_pmccontrol} \ ${_pmcstat} \ ${_pnpinfo} \ @@ -348,6 +349,7 @@ _pkg_install= pkg_install # XXX MK_TOOLCHAIN? .if ${MK_PMC} != "no" +_pmcannotate= pmcannotate _pmccontrol= pmccontrol _pmcstat= pmcstat .endif Added: head/usr.sbin/pmcannotate/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pmcannotate/Makefile Wed Nov 26 21:44:57 2008 (r185347) @@ -0,0 +1,12 @@ +# +# $FreeBSD$ +# + +PROG= pmcannotate +MAN= pmcannotate.8 + +WARNS?= 6 + +SRCS= pmcannotate.c + +.include Added: head/usr.sbin/pmcannotate/pmcannotate.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pmcannotate/pmcannotate.8 Wed Nov 26 21:44:57 2008 (r185347) @@ -0,0 +1,108 @@ +.\" Copyright (c) 2008 Nokia Corporation +.\" All rights reserved. +.\" +.\" This software was developed by Attilio Rao for the IPSO project under +.\" contract to Nokia Corporation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" This software is provided by the authors ``as is'' and +.\" any express or implied warranties, including, but not limited to, the +.\" implied warranties of merchantability and fitness for a particular purpose +.\" are disclaimed. in no event shall the authors be liable +.\" for any direct, indirect, incidental, special, exemplary, or consequential +.\" damages (including, but not limited to, procurement of substitute goods +.\" or services; loss of use, data, or profits; or business interruption) +.\" however caused and on any theory of liability, whether in contract, strict +.\" liability, or tort (including negligence or otherwise) arising in any way +.\" out of the use of this software, even if advised of the possibility of +.\" such damage. +.\" +.\" $FreeBSD$ +.\" +.Dd November 20, 2008 +.Os +.Dt PMCANNOTATE 8 +.Sh NAME +.Nm pmcannotate +.Nd "sources printout with inlined profiling" +.Sh SYNOPSIS +.Nm +.Op Fl a +.Op Fl h +.Op Fl k Ar pathname +.Op Fl l Ar level +.Ar pmcout.out binaryobj +.Sh DESCRIPTION +The +.Nm +utility can produce both C sources or assembly sources of a program with +a line-by-line based profiling. +The profiling informations are retrieved through a +.Xr pmcstat 8 +raw output while the program operations are retrieved through the +.Xr objdump 1 +tool. +.Pp +When calling +.Nm +the raw output is passed through the +.Ar pmcout.out +argument, while the program is passed through the +.Ar binaryobj +argument. +.Pp +As long as +.Nm +relies on +.Xr objdump 1 +and +.Xr pmcstat 8 +to work, it will fail if one of them is not available. +.Sh OPTIONS +The following options are available: +.Bl -tag -width indent +.It Fl a +Shows the program profiling inlined in the assembly code only. +No C informations involving C sources are provided. +.It Fl h +Prints out informations about the usage of the tool. +.It Fl l Ar level +Changes the lower bound (expressed in percentage) for traced functions +that will be printed out in the report. +The default value is 0.5%. +.It Fl k Ar kerneldir +Set the pathname of the kernel directory to argument +.Ar kerneldir . +This directory specifies where +.Nm +should look for the kernel and its modules. +The default is +.Pa /boot/kernel . +.Sh LIMITATIONS +As long as +.Nm +relies on the +.Xr objdump 1 +utility to retrieve the C code, the program needs to be compiled with +debugging options. +Sometimes, in particular with heavy optimization levels, the +.Xr objdump 1 +utility embeds the code of inlining functions directly in the callers, +making an output difficult to read. +The x86 version reports the sampling from pmcstat collecting the following +instruction in regard of the interrupted one. +This means that the samples may be attributed to the line below the one +of interest. +.Sh SEE ALSO +.Xr objdump 1 , +.Xr pmcstat 8 +.Sh AUTHORS +.An Attilio Rao Aq attilio@FreeBSD.org Added: head/usr.sbin/pmcannotate/pmcannotate.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pmcannotate/pmcannotate.c Wed Nov 26 21:44:57 2008 (r185347) @@ -0,0 +1,804 @@ +/*- + * Copyright (c) 2008 Nokia Corporation + * All rights reserved. + * + * This software was developed by Attilio Rao for the IPSO project under + * contract to Nokia Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include + +#include + +#define FNBUFF 161 +#define LNBUFF 161 + +#define TMPPATH "/tmp/pmcannotate.XXXXXX" + +#define FATAL(ptr, x ...) do { \ + fqueue_deleteall(); \ + general_deleteall(); \ + if ((ptr) != NULL) \ + perror(ptr); \ + fprintf(stderr, ##x); \ + remove(tbfl); \ + remove(tofl); \ + exit(EXIT_FAILURE); \ +} while (0) + +#define PERCSAMP(x) ((x) * 100 / totalsamples) + +struct entry { + TAILQ_ENTRY(entry) en_iter; + char *en_name; + uintptr_t en_pc; + uintptr_t en_ostart; + uintptr_t en_oend; + u_int en_nsamples; +}; + +struct aggent { + TAILQ_ENTRY(aggent) ag_fiter; + long ag_offset; + uintptr_t ag_ostart; + uintptr_t ag_oend; + char *ag_name; + u_int ag_nsamples; +}; + +static struct aggent *agg_create(const char *name, u_int nsamples, + uintptr_t start, uintptr_t end); +static void agg_destroy(struct aggent *agg) __unused; +static void asmparse(FILE *fp); +static int cparse(FILE *fp); +static void entry_acqref(struct entry *entry); +static struct entry *entry_create(const char *name, uintptr_t pc, + uintptr_t start, uintptr_t end); +static void entry_destroy(struct entry *entry) __unused; +static void fqueue_compact(float th); +static void fqueue_deleteall(void); +static struct aggent *fqueue_findent_by_name(const char *name); +static int fqueue_getall(const char *bin, char *temp, int asmf); +static int fqueue_insertent(struct entry *entry); +static int fqueue_insertgen(void); +static void general_deleteall(void); +static struct entry *general_findent(uintptr_t pc); +static void general_insertent(struct entry *entry); +static void general_printasm(FILE *fp, struct aggent *agg); +static int general_printc(FILE *fp, struct aggent *agg); +static int printblock(FILE *fp, struct aggent *agg); +static void usage(const char *progname) __dead2; + +static TAILQ_HEAD(, entry) mainlst = TAILQ_HEAD_INITIALIZER(mainlst); +static TAILQ_HEAD(, aggent) fqueue = TAILQ_HEAD_INITIALIZER(fqueue); + +/* + * Use a float value in order to automatically promote operations + * to return a float value rather than use casts. + */ +static float totalsamples; + +/* + * Identifies a string cointaining objdump's assembly printout. + */ +static inline int +isasminline(const char *str) +{ + void *ptr; + int nbytes; + + if (isxdigit(str[1]) == 0) + return (0); + if (sscanf(str, " %p%n", &ptr, &nbytes) != 1) + return (0); + if (str[nbytes] != ':' || isspace(str[nbytes + 1]) == 0) + return (0); + return (1); +} + +/* + * Identifies a string containing objdump's assembly printout + * for a new function. + */ +static inline int +newfunction(const char *str) +{ + char fname[FNBUFF]; + void *ptr; + int nbytes; + + if (isspace(str[0])) + return (0); + if (sscanf(str, "%p <%[^>:]>:%n", &ptr, fname, &nbytes) != 2) + return (0); + return (nbytes); +} + +/* + * Create a new first-level aggregation object for a specified + * function. + */ +static struct aggent * +agg_create(const char *name, u_int nsamples, uintptr_t start, uintptr_t end) +{ + struct aggent *agg; + + agg = calloc(1, sizeof(struct aggent)); + if (agg == NULL) + return (NULL); + agg->ag_name = strdup(name); + if (agg->ag_name == NULL) { + free(agg); + return (NULL); + } + agg->ag_nsamples = nsamples; + agg->ag_ostart = start; + agg->ag_oend = end; + return (agg); +} + +/* + * Destroy a first-level aggregation object for a specified + * function. + */ +static void +agg_destroy(struct aggent *agg) +{ + + free(agg->ag_name); + free(agg); +} + +/* + * Analyze the "objdump -d" output, locate functions and start + * printing out the assembly functions content. + * We do not use newfunction() because we actually need the + * function name in available form, but the heurstic used is + * the same. + */ +static void +asmparse(FILE *fp) +{ + char buffer[LNBUFF], fname[FNBUFF]; + struct aggent *agg; + void *ptr; + + while (fgets(buffer, LNBUFF, fp) != NULL) { + if (isspace(buffer[0])) + continue; + if (sscanf(buffer, "%p <%[^>:]>:", &ptr, fname) != 2) + continue; + agg = fqueue_findent_by_name(fname); + if (agg == NULL) + continue; + agg->ag_offset = ftell(fp); + } + + TAILQ_FOREACH(agg, &fqueue, ag_fiter) { + if (fseek(fp, agg->ag_offset, SEEK_SET) == -1) + return; + printf("Profile trace for function: %s() [%.2f%%]\n", + agg->ag_name, PERCSAMP(agg->ag_nsamples)); + general_printasm(fp, agg); + printf("\n"); + } +} + +/* + * Analyze the "objdump -S" output, locate functions and start + * printing out the C functions content. + * We do not use newfunction() because we actually need the + * function name in available form, but the heurstic used is + * the same. + * In order to maintain the printout sorted, on the first pass it + * simply stores the file offsets in order to fastly moved later + * (when the file is hot-cached also) when the real printout will + * happen. + */ +static int +cparse(FILE *fp) +{ + char buffer[LNBUFF], fname[FNBUFF]; + struct aggent *agg; + void *ptr; + + while (fgets(buffer, LNBUFF, fp) != NULL) { + if (isspace(buffer[0])) + continue; + if (sscanf(buffer, "%p <%[^>:]>:", &ptr, fname) != 2) + continue; + agg = fqueue_findent_by_name(fname); + if (agg == NULL) + continue; + agg->ag_offset = ftell(fp); + } + + TAILQ_FOREACH(agg, &fqueue, ag_fiter) { + if (fseek(fp, agg->ag_offset, SEEK_SET) == -1) + return (-1); + printf("Profile trace for function: %s() [%.2f%%]\n", + agg->ag_name, PERCSAMP(agg->ag_nsamples)); + if (general_printc(fp, agg) == -1) + return (-1); + printf("\n"); + } + return (0); +} + +/* + * Bump the number of samples for any raw entry. + */ +static void +entry_acqref(struct entry *entry) +{ + + entry->en_nsamples++; +} + +/* + * Create a new raw entry object for a specified function. + */ +static struct entry * +entry_create(const char *name, uintptr_t pc, uintptr_t start, uintptr_t end) +{ + struct entry *obj; + + obj = calloc(1, sizeof(struct entry)); + if (obj == NULL) + return (NULL); + obj->en_name = strdup(name); + if (obj->en_name == NULL) { + free(obj); + return (NULL); + } + obj->en_pc = pc; + obj->en_ostart = start; + obj->en_oend = end; + obj->en_nsamples = 1; + return (obj); +} + +/* + * Destroy a raw entry object for a specified function. + */ +static void +entry_destroy(struct entry *entry) +{ + + free(entry->en_name); + free(entry); +} + +/* + * Specify a lower bound in percentage and drop from the + * first-level aggregation queue all the objects with a + * smaller impact. + */ +static void +fqueue_compact(float th) +{ + u_int thi; + struct aggent *agg, *tmpagg; + + if (totalsamples == 0) + return; + + /* Revert the percentage calculation. */ + thi = th * totalsamples / 100; + TAILQ_FOREACH_SAFE(agg, &fqueue, ag_fiter, tmpagg) + if (agg->ag_nsamples < thi) + TAILQ_REMOVE(&fqueue, agg, ag_fiter); +} + +/* + * Flush the first-level aggregates queue. + */ +static void +fqueue_deleteall() +{ + struct aggent *agg; + + while (TAILQ_EMPTY(&fqueue) == 0) { + agg = TAILQ_FIRST(&fqueue); + TAILQ_REMOVE(&fqueue, agg, ag_fiter); + } +} + +/* + * Insert a raw entry into the aggregations queue. + * If the respective first-level aggregation object + * does not exist create it and maintain it sorted + * in respect of the number of samples. + */ +static int +fqueue_insertent(struct entry *entry) +{ + struct aggent *obj, *tmp; + int found; + + found = 0; + TAILQ_FOREACH(obj, &fqueue, ag_fiter) + if (!strcmp(obj->ag_name, entry->en_name)) { + found = 1; + obj->ag_nsamples += entry->en_nsamples; + break; + } + + /* + * If the firt-level aggregation object alredy exist, + * just aggregate the samples and, if needed, resort + * it. + */ + if (found) { + TAILQ_REMOVE(&fqueue, obj, ag_fiter); + found = 0; + TAILQ_FOREACH(tmp, &fqueue, ag_fiter) + if (obj->ag_nsamples > tmp->ag_nsamples) { + found = 1; + break; + } + if (found) + TAILQ_INSERT_BEFORE(tmp, obj, ag_fiter); + else + TAILQ_INSERT_TAIL(&fqueue, obj, ag_fiter); + return (0); + } + + /* + * If the first-level aggregation object does not + * exist, create it and put in the sorted queue. + * If this is the first object, we need to set the + * head of the queue. + */ + obj = agg_create(entry->en_name, entry->en_nsamples, entry->en_ostart, + entry->en_oend); + if (obj == NULL) + return (-1); + if (TAILQ_EMPTY(&fqueue) != 0) { + TAILQ_INSERT_HEAD(&fqueue, obj, ag_fiter); + return (0); + } + TAILQ_FOREACH(tmp, &fqueue, ag_fiter) + if (obj->ag_nsamples > tmp->ag_nsamples) { + found = 1; + break; + } + if (found) + TAILQ_INSERT_BEFORE(tmp, obj, ag_fiter); + else + TAILQ_INSERT_TAIL(&fqueue, obj, ag_fiter); + return (0); +} + +/* + * Lookup a first-level aggregation object by name. + */ +static struct aggent * +fqueue_findent_by_name(const char *name) +{ + struct aggent *obj; + + TAILQ_FOREACH(obj, &fqueue, ag_fiter) + if (!strcmp(obj->ag_name, name)) + return (obj); + return (NULL); +} + +/* + * Return the number of object in the first-level aggregations queue. + */ +static int +fqueue_getall(const char *bin, char *temp, int asmf) +{ + char tmpf[MAXPATHLEN * 2 + 50]; + struct aggent *agg; + uintptr_t start, end; + + if (mkstemp(temp) == -1) + return (-1); + TAILQ_FOREACH(agg, &fqueue, ag_fiter) { + bzero(tmpf, sizeof(tmpf)); + start = agg->ag_ostart; + end = agg->ag_oend; + + /* + * Fix-up the end address in order to show it in the objdump's + * trace. + */ + end++; + if (asmf) + snprintf(tmpf, sizeof(tmpf), + "objdump --start-address=%p " + "--stop-address=%p -d %s >> %s", (void *)start, + (void *)end, bin, temp); + else + snprintf(tmpf, sizeof(tmpf), + "objdump --start-address=%p " + "--stop-address=%p -S %s >> %s", (void *)start, + (void *)end, bin, temp); + if (system(tmpf) != 0) + return (-1); + } + return (0); +} + +/* + * Insert all the raw entries present in the general queue + * into the first-level aggregations queue. + */ +static int +fqueue_insertgen(void) +{ + struct entry *obj; + + TAILQ_FOREACH(obj, &mainlst, en_iter) + if (fqueue_insertent(obj) == -1) + return (-1); + return (0); +} + +/* + * Flush the raw entries general queue. + */ +static void +general_deleteall() +{ + struct entry *obj; + + while (TAILQ_EMPTY(&mainlst) == 0) { + obj = TAILQ_FIRST(&mainlst); + TAILQ_REMOVE(&mainlst, obj, en_iter); + } +} + +/* + * Lookup a raw entry by the PC. + */ +static struct entry * +general_findent(uintptr_t pc) +{ + struct entry *obj; + + TAILQ_FOREACH(obj, &mainlst, en_iter) + if (obj->en_pc == pc) + return (obj); + return (NULL); +} + +/* + * Insert a new raw entry in the general queue. + */ +static void +general_insertent(struct entry *entry) +{ + + TAILQ_INSERT_TAIL(&mainlst, entry, en_iter); +} + +/* + * Printout the body of an "objdump -d" assembly function. + * It does simply stops when a new function is encountered, + * bringing back the file position in order to not mess up + * subsequent analysis. + * C lines and others not recognized are simply skipped. + */ +static void +general_printasm(FILE *fp, struct aggent *agg) +{ + char buffer[LNBUFF]; + struct entry *obj; + int nbytes; + void *ptr; + + while (fgets(buffer, LNBUFF, fp) != NULL) { + if ((nbytes = newfunction(buffer)) != 0) { + fseek(fp, nbytes * -1, SEEK_CUR); + break; + } + if (!isasminline(buffer)) + continue; + if (sscanf(buffer, " %p:", &ptr) != 1) + continue; + obj = general_findent((uintptr_t)ptr); + if (obj == NULL) + printf("\t| %s", buffer); + else + printf("%.2f%%\t| %s", + (float)obj->en_nsamples * 100 / agg->ag_nsamples, + buffer); + } +} + +/* + * Printout the body of an "objdump -S" function. + * It does simply stops when a new function is encountered, + * bringing back the file position in order to not mess up + * subsequent analysis. + * It expect from the starting to the end to find, always, valid blocks + * (see below for an explanation of the "block" concept). + */ +static int +general_printc(FILE *fp, struct aggent *agg) +{ + char buffer[LNBUFF]; + + while (fgets(buffer, LNBUFF, fp) != NULL) { + fseek(fp, strlen(buffer) * -1, SEEK_CUR); + if (newfunction(buffer) != 0) + break; + if (printblock(fp, agg) == -1) + return (-1); + } + return (0); +} + +/* + * Printout a single block inside an "objdump -S" function. + * The block is composed of a first part in C and subsequent translation + * in assembly. + * This code also operates a second-level aggregation packing together + * samples relative to PCs into a (lower bottom) block with their + * C (higher half) counterpart. + */ +static int +printblock(FILE *fp, struct aggent *agg) +{ + char buffer[LNBUFF]; + long lstart; + struct entry *obj; + u_int tnsamples; + int done, nbytes, sentinel; + void *ptr; + + /* + * We expect the first thing of the block is C code, so simply give + * up if asm line is found. + */ + lstart = ftell(fp); + sentinel = 0; + for (;;) { + if (fgets(buffer, LNBUFF, fp) == NULL) + return (0); + if (isasminline(buffer) != 0) + break; + sentinel = 1; + nbytes = newfunction(buffer); + if (nbytes != 0) { + if (fseek(fp, nbytes * -1, SEEK_CUR) == -1) + return (-1); + return (0); + } + } + + /* + * If the sentinel is not set, it means it did not match any + * "high half" for this code so simply give up. + * Operates the second-level aggregation. + */ + tnsamples = 0; + do { + if (sentinel == 0) + return (-1); + if (sscanf(buffer, " %p:", &ptr) != 1) + return (-1); + obj = general_findent((uintptr_t)ptr); + if (obj != NULL) + tnsamples += obj->en_nsamples; + } while (fgets(buffer, LNBUFF, fp) != NULL && isasminline(buffer) != 0); + + /* Rewind to the start of the block in order to start the printout. */ + if (fseek(fp, lstart, SEEK_SET) == -1) + return (-1); + + /* Again the high half of the block rappresenting the C part. */ + done = 0; + while (fgets(buffer, LNBUFF, fp) != NULL && isasminline(buffer) == 0) { + if (tnsamples == 0 || done != 0) + printf("\t| %s", buffer); + else { + done = 1; + printf("%.2f%%\t| %s", + (float)tnsamples * 100 / agg->ag_nsamples, buffer); + } + } + + /* + * Again the low half of the block rappresenting the asm + * translation part. + */ + for (;;) { + if (fgets(buffer, LNBUFF, fp) == NULL) + return (0); + if (isasminline(buffer) == 0) + break; + nbytes = newfunction(buffer); + if (nbytes != 0) { + if (fseek(fp, nbytes * -1, SEEK_CUR) == -1) + return (-1); + return (0); + } + } + if (fseek(fp, strlen(buffer) * -1, SEEK_CUR) == -1) + return (-1); + return (0); +} + +/* + * Helper printout functions. + */ +static void +usage(const char *progname) +{ + + fprintf(stderr, + "usage: %s [-a] [-h] [-k kfile] [-l lb] pmcraw.out binary\n", + progname); + exit(EXIT_SUCCESS); +} + +int +main(int argc, char *argv[]) +{ + char buffer[LNBUFF], fname[FNBUFF], tbfl[] = TMPPATH, tofl[] = TMPPATH; + char tmpf[MAXPATHLEN * 2 + 50]; + float limit; + char *bin, *exec, *kfile, *ofile; + struct entry *obj; + FILE *gfp, *bfp; + void *ptr, *hstart, *hend; + uintptr_t tmppc, ostart, oend; + int cget, asmsrc; + + exec = argv[0]; + ofile = NULL; + bin = NULL; + kfile = NULL; + asmsrc = 0; + limit = 0.5; + while ((cget = getopt(argc, argv, "ahl:k:")) != -1) + switch(cget) { + case 'a': + asmsrc = 1; + break; + case 'k': + kfile = optarg; + break; + case 'l': + limit = (float)atof(optarg); + break; + case 'h': + case '?': + default: + usage(exec); + } + argc -= optind; + argv += optind; + if (argc != 2) + usage(exec); + ofile = argv[0]; + bin = argv[1]; + + if (access(bin, R_OK | F_OK) == -1) + FATAL(exec, "%s: Impossible to locate the binary file\n", + exec); + if (access(ofile, R_OK | F_OK) == -1) + FATAL(exec, "%s: Impossible to locate the pmcstat file\n", + exec); + if (kfile != NULL && access(kfile, R_OK | F_OK) == -1) + FATAL(exec, "%s: Impossible to locate the kernel file\n", + exec); + + bzero(tmpf, sizeof(tmpf)); + if (mkstemp(tofl) == -1) + FATAL(exec, "%s: Impossible to create the tmp file\n", + exec); + if (kfile != NULL) + snprintf(tmpf, sizeof(tmpf), "pmcstat -k %s -R %s -m %s", + kfile, ofile, tofl); + else + snprintf(tmpf, sizeof(tmpf), "pmcstat -R %s -m %s", ofile, + tofl); + if (system(tmpf) != 0) + FATAL(exec, "%s: Impossible to create the tmp file\n", + exec); + + gfp = fopen(tofl, "r"); + if (gfp == NULL) + FATAL(exec, "%s: Impossible to open the map file\n", + exec); + + /* + * Make the collection of raw entries from a pmcstat mapped file. + * The heuristic here wants strings in the form: + * "addr funcname startfaddr endfaddr". + */ + while (fgets(buffer, LNBUFF, gfp) != NULL) { + if (isspace(buffer[0])) + continue; + if (sscanf(buffer, "%p %s %p %p\n", &ptr, fname, + &hstart, &hend) != 4) + FATAL(NULL, + "%s: Invalid scan of function in the map file\n", + exec); + ostart = (uintptr_t)hstart; + oend = (uintptr_t)hend; + tmppc = (uintptr_t)ptr; + totalsamples++; + obj = general_findent(tmppc); + if (obj != NULL) { + entry_acqref(obj); + continue; + } + obj = entry_create(fname, tmppc, ostart, oend); + if (obj == NULL) + FATAL(exec, + "%s: Impossible to create a new object\n", exec); + general_insertent(obj); + } + if (fclose(gfp) == EOF) + FATAL(exec, "%s: Impossible to close the filedesc\n", + exec); + if (remove(tofl) == -1) + FATAL(exec, "%s: Impossible to remove the tmpfile\n", + exec); + + /* + * Remove the loose end objects and feed the first-level aggregation + * queue. + */ + if (fqueue_insertgen() == -1) + FATAL(exec, "%s: Impossible to generate an analysis\n", + exec); + fqueue_compact(limit); + if (fqueue_getall(bin, tbfl, asmsrc) == -1) + FATAL(exec, "%s: Impossible to create the tmp file\n", + exec); + + bfp = fopen(tbfl, "r"); + if (bfp == NULL) + FATAL(exec, "%s: Impossible to open the binary file\n", + exec); + + if (asmsrc != 0) + asmparse(bfp); + else if (cparse(bfp) == -1) + FATAL(NULL, "%s: Invalid format for the C file\n", exec); + if (fclose(bfp) == EOF) + FATAL(exec, "%s: Impossible to close the filedesc\n", + exec); + if (remove(tbfl) == -1) + FATAL(exec, "%s: Impossible to remove the tmpfile\n", + exec); + return (0); +} From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 22:32:09 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 889E71065673; Wed, 26 Nov 2008 22:32:09 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6ADF48FC14; Wed, 26 Nov 2008 22:32:09 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQMW9SV068192; Wed, 26 Nov 2008 22:32:09 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQMW7PQ068162; Wed, 26 Nov 2008 22:32:07 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200811262232.mAQMW7PQ068162@svn.freebsd.org> From: Marko Zec Date: Wed, 26 Nov 2008 22:32:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185348 - in head/sys: kern net netinet netinet6 netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 22:32:09 -0000 Author: zec Date: Wed Nov 26 22:32:07 2008 New Revision: 185348 URL: http://svn.freebsd.org/changeset/base/185348 Log: Merge more of currently non-functional (i.e. resolving to whitespace) macros from p4/vimage branch. Do a better job at enclosing all instantiations of globals scheduled for virtualization in #ifdef VIMAGE_GLOBALS blocks. De-virtualize and mark as const saorder_state_alive and saorder_state_any arrays from ipsec code, given that they are never updated at runtime, so virtualizing them would be pointless. Reviewed by: bz, julian Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation Modified: head/sys/kern/kern_poll.c head/sys/kern/kern_sysctl.c head/sys/net/bpf.c head/sys/net/if.c head/sys/net/if_loop.c head/sys/net/route.c head/sys/netinet/if_ether.c head/sys/netinet/in_pcb.c head/sys/netinet/in_rmx.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_fw_pfil.c head/sys/netinet/ip_output.c head/sys/netinet/tcp_input.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_timewait.c head/sys/netinet/udp_usrreq.c head/sys/netinet/vinet.h head/sys/netinet6/icmp6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_proto.c head/sys/netinet6/in6_rmx.c head/sys/netinet6/in6_src.c head/sys/netinet6/nd6_nbr.c head/sys/netinet6/nd6_rtr.c head/sys/netinet6/raw_ip6.c head/sys/netipsec/ipsec.c head/sys/netipsec/key.c head/sys/netipsec/keysock.c head/sys/netipsec/vipsec.h Modified: head/sys/kern/kern_poll.c ============================================================================== --- head/sys/kern/kern_poll.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/kern/kern_poll.c Wed Nov 26 22:32:07 2008 (r185348) @@ -521,6 +521,7 @@ ether_poll_deregister(struct ifnet *ifp) static int poll_switch(SYSCTL_HANDLER_ARGS) { + INIT_VNET_NET(curvnet); struct ifnet *ifp; int error; int val = polling; Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/kern/kern_sysctl.c Wed Nov 26 22:32:07 2008 (r185348) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -1413,6 +1414,7 @@ userland_sysctl(struct thread *td, int * req.lock = REQ_LOCKED; SYSCTL_LOCK(); + CURVNET_SET(TD_TO_VNET(curthread)); do { req.oldidx = 0; @@ -1423,6 +1425,7 @@ userland_sysctl(struct thread *td, int * if (req.lock == REQ_WIRED && req.validlen > 0) vsunlock(req.oldptr, req.validlen); + CURVNET_RESTORE(); SYSCTL_UNLOCK(); if (error && error != ENOMEM) Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/net/bpf.c Wed Nov 26 22:32:07 2008 (r185348) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -566,7 +567,9 @@ bpf_detachd(struct bpf_d *d) */ if (d->bd_promisc) { d->bd_promisc = 0; + CURVNET_SET(ifp->if_vnet); error = ifpromisc(ifp, 0); + CURVNET_RESTORE(); if (error != 0 && error != ENXIO) { /* * ENXIO can happen if a pccard is unplugged @@ -872,7 +875,9 @@ bpfwrite(struct cdev *dev, struct uio *u #ifdef MAC BPFD_LOCK(d); + CURVNET_SET(ifp->if_vnet); mac_bpfdesc_create_mbuf(d, m); + CURVNET_RESTORE(); if (mc != NULL) mac_bpfdesc_create_mbuf(d, mc); BPFD_UNLOCK(d); @@ -993,6 +998,7 @@ bpfioctl(struct cdev *dev, u_long cmd, c return (EPERM); } } + CURVNET_SET(TD_TO_VNET(td)); switch (cmd) { default: @@ -1322,6 +1328,7 @@ bpfioctl(struct cdev *dev, u_long cmd, c case BIOCROTZBUF: return (bpf_ioctl_rotzbuf(td, d, (struct bpf_zbuf *)addr)); } + CURVNET_RESTORE(); return (error); } Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/net/if.c Wed Nov 26 22:32:07 2008 (r185348) @@ -192,7 +192,6 @@ ifnet_setbyindex(u_short idx, struct ifn struct ifaddr * ifaddr_byindex(u_short idx) { - INIT_VNET_NET(curvnet); struct ifaddr *ifa; IFNET_RLOCK(); Modified: head/sys/net/if_loop.c ============================================================================== --- head/sys/net/if_loop.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/net/if_loop.c Wed Nov 26 22:32:07 2008 (r185348) @@ -105,6 +105,9 @@ IFC_SIMPLE_DECLARE(lo, 1); static void lo_clone_destroy(struct ifnet *ifp) { +#ifdef INVARIANTS + INIT_VNET_NET(ifp->if_vnet); +#endif /* XXX: destroying lo0 will lead to panics. */ KASSERT(V_loif != ifp, ("%s: destroying lo0", __func__)); @@ -141,6 +144,7 @@ lo_clone_create(struct if_clone *ifc, in static int loop_modevent(module_t mod, int type, void *data) { + INIT_VNET_NET(curvnet); switch (type) { case MOD_LOAD: Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/net/route.c Wed Nov 26 22:32:07 2008 (r185348) @@ -145,6 +145,7 @@ SYSCTL_PROC(_net, OID_AUTO, my_fibnum, C static void route_init(void) { + INIT_VNET_INET(curvnet); int table; struct domain *dom; int fam; Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet/if_ether.c Wed Nov 26 22:32:07 2008 (r185348) @@ -89,8 +89,8 @@ static int useloopback; /* use loopback static int arp_proxyall; #endif -SYSCTL_INT(_net_link_ether_inet, OID_AUTO, max_age, CTLFLAG_RW, - &arpt_keep, 0, "ARP entry lifetime in seconds"); +SYSCTL_V_INT(V_NET, vnet_inet, _net_link_ether_inet, OID_AUTO, max_age, + CTLFLAG_RW, arpt_keep, 0, "ARP entry lifetime in seconds"); #define rt_expire rt_rmx.rmx_expire Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet/in_pcb.c Wed Nov 26 22:32:07 2008 (r185348) @@ -120,6 +120,7 @@ int ipport_tcplastcount; static int sysctl_net_ipport_check(SYSCTL_HANDLER_ARGS) { + INIT_VNET_INET(curvnet); int error; error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); @@ -1474,7 +1475,7 @@ inp_apply_all(void (*func)(struct inpcb struct inpcb *inp; INP_INFO_RLOCK(&V_tcbinfo); - LIST_FOREACH(inp, tcbinfo.ipi_listhead, inp_list) { + LIST_FOREACH(inp, V_tcbinfo.ipi_listhead, inp_list) { INP_WLOCK(inp); func(inp, arg); INP_WUNLOCK(inp); Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet/in_rmx.c Wed Nov 26 22:32:07 2008 (r185348) @@ -287,6 +287,7 @@ in_rtqtimo(void *rock) static void in_rtqtimo_one(void *rock) { + INIT_VNET_INET(curvnet); struct radix_node_head *rnh = rock; struct rtqk_arg arg; static time_t last_adjusted_timeout = 0; @@ -341,6 +342,7 @@ in_rtqdrain(void) VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); INIT_VNET_NET(vnet_iter); + for ( fibnum = 0; fibnum < rt_numfibs; fibnum++) { rnh = V_rt_tables[fibnum][AF_INET]; arg.found = arg.killed = 0; Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet/ip_divert.c Wed Nov 26 22:32:07 2008 (r185348) @@ -581,6 +581,7 @@ div_ctlinput(int cmd, struct sockaddr *s static int div_pcblist(SYSCTL_HANDLER_ARGS) { + INIT_VNET_INET(curvnet); int error, i, n; struct inpcb *inp, **inp_list; inp_gen_t gencnt; Modified: head/sys/netinet/ip_fw_pfil.c ============================================================================== --- head/sys/netinet/ip_fw_pfil.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet/ip_fw_pfil.c Wed Nov 26 22:32:07 2008 (r185348) @@ -487,6 +487,7 @@ ipfw6_unhook(void) int ipfw_chg_hook(SYSCTL_HANDLER_ARGS) { + INIT_VNET_IPFW(curvnet); int enable = *(int *)arg1; int error; Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet/ip_output.c Wed Nov 26 22:32:07 2008 (r185348) @@ -791,6 +791,7 @@ done: void in_delayed_cksum(struct mbuf *m) { + INIT_VNET_INET(curvnet); struct ip *ip; u_short csum, offset; Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet/tcp_input.c Wed Nov 26 22:32:07 2008 (r185348) @@ -2986,6 +2986,7 @@ tcp_mss(struct tcpcb *tp, int offer) int isipv6; #endif KASSERT(tp != NULL, ("%s: tp == NULL", __func__)); + INIT_VNET_INET(tp->t_vnet); tcp_mss_update(tp, offer, &metrics, &mtuflags); Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet/tcp_subr.c Wed Nov 26 22:32:07 2008 (r185348) @@ -130,7 +130,7 @@ static int tcp_inflight_stab; static int sysctl_net_inet_tcp_mss_check(SYSCTL_HANDLER_ARGS) { - INIT_VNET_INET(TD_TO_VNET(curthread)); + INIT_VNET_INET(curvnet); int error, new; new = V_tcp_mssdflt; @@ -144,15 +144,16 @@ sysctl_net_inet_tcp_mss_check(SYSCTL_HAN return (error); } -SYSCTL_PROC(_net_inet_tcp, TCPCTL_MSSDFLT, mssdflt, CTLTYPE_INT|CTLFLAG_RW, - &tcp_mssdflt, 0, &sysctl_net_inet_tcp_mss_check, "I", - "Default TCP Maximum Segment Size"); +SYSCTL_V_PROC(V_NET, vnet_inet, _net_inet_tcp, TCPCTL_MSSDFLT, mssdflt, + CTLTYPE_INT|CTLFLAG_RW, tcp_mssdflt, 0, + &sysctl_net_inet_tcp_mss_check, "I", + "Default TCP Maximum Segment Size"); #ifdef INET6 static int sysctl_net_inet_tcp_mss_v6_check(SYSCTL_HANDLER_ARGS) { - INIT_VNET_INET6(TD_TO_VNET(curthread)); + INIT_VNET_INET6(curvnet); int error, new; new = V_tcp_v6mssdflt; @@ -166,9 +167,10 @@ sysctl_net_inet_tcp_mss_v6_check(SYSCTL_ return (error); } -SYSCTL_PROC(_net_inet_tcp, TCPCTL_V6MSSDFLT, v6mssdflt, CTLTYPE_INT|CTLFLAG_RW, - &tcp_v6mssdflt, 0, &sysctl_net_inet_tcp_mss_v6_check, "I", - "Default TCP Maximum Segment Size for IPv6"); +SYSCTL_V_PROC(V_NET, vnet_inet, _net_inet_tcp, TCPCTL_V6MSSDFLT, v6mssdflt, + CTLTYPE_INT|CTLFLAG_RW, tcp_v6mssdflt, 0, + &sysctl_net_inet_tcp_mss_v6_check, "I", + "Default TCP Maximum Segment Size for IPv6"); #endif /* @@ -225,9 +227,9 @@ static int tcp_inflight_debug = 0; SYSCTL_INT(_net_inet_tcp_inflight, OID_AUTO, debug, CTLFLAG_RW, &tcp_inflight_debug, 0, "Debug TCP inflight calculations"); -SYSCTL_PROC(_net_inet_tcp_inflight, OID_AUTO, rttthresh, CTLTYPE_INT|CTLFLAG_RW, - &tcp_inflight_rttthresh, 0, sysctl_msec_to_ticks, "I", - "RTT threshold below which inflight will deactivate itself"); +SYSCTL_V_PROC(V_NET, vnet_inet, _net_inet_tcp_inflight, OID_AUTO, rttthresh, + CTLTYPE_INT|CTLFLAG_RW, tcp_inflight_rttthresh, 0, sysctl_msec_to_ticks, + "I", "RTT threshold below which inflight will deactivate itself"); SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_inflight, OID_AUTO, min, CTLFLAG_RW, tcp_inflight_min, 0, "Lower-bound for TCP inflight window"); @@ -947,6 +949,9 @@ static struct inpcb * tcp_notify(struct inpcb *inp, int error) { struct tcpcb *tp; +#ifdef INVARIANTS + INIT_VNET_INET(inp->inp_vnet); /* V_tcbinfo WLOCK ASSERT */ +#endif INP_INFO_WLOCK_ASSERT(&V_tcbinfo); INP_WLOCK_ASSERT(inp); @@ -1940,6 +1945,7 @@ int tcp_signature_compute(struct mbuf *m, int _unused, int len, int optlen, u_char *buf, u_int direction) { + INIT_VNET_IPSEC(curvnet); union sockaddr_union dst; struct ippseudo ippseudo; MD5_CTX ctx; Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet/tcp_syncache.c Wed Nov 26 22:32:07 2008 (r185348) @@ -105,12 +105,12 @@ static int tcp_syncookiesonly; int tcp_sc_rst_sock_fail; #endif -SYSCTL_INT(_net_inet_tcp, OID_AUTO, syncookies, CTLFLAG_RW, - &tcp_syncookies, 0, +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, syncookies, + CTLFLAG_RW, tcp_syncookies, 0, "Use TCP SYN cookies if the syncache overflows"); -SYSCTL_INT(_net_inet_tcp, OID_AUTO, syncookies_only, CTLFLAG_RW, - &tcp_syncookiesonly, 0, +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, syncookies_only, + CTLFLAG_RW, tcp_syncookiesonly, 0, "Use only TCP SYN cookies"); #ifdef TCP_OFFLOAD_DISABLE @@ -359,11 +359,13 @@ static void syncache_timer(void *xsch) { struct syncache_head *sch = (struct syncache_head *)xsch; - INIT_VNET_INET(sch->sch_vnet); struct syncache *sc, *nsc; int tick = ticks; char *s; + CURVNET_SET(sch->sch_vnet); + INIT_VNET_INET(sch->sch_vnet); + /* NB: syncache_head has already been locked by the callout. */ SCH_LOCK_ASSERT(sch); @@ -412,6 +414,7 @@ syncache_timer(void *xsch) if (!TAILQ_EMPTY(&(sch)->sch_bucket)) callout_reset(&(sch)->sch_timer, (sch)->sch_nextc - tick, syncache_timer, (void *)(sch)); + CURVNET_RESTORE(); } /* @@ -836,7 +839,7 @@ syncache_expand(struct in_conninfo *inc, * B. check that the syncookie is valid. If it is, then * cobble up a fake syncache entry, and return. */ - if (!tcp_syncookies) { + if (!V_tcp_syncookies) { SCH_UNLOCK(sch); if ((s = tcp_log_addrs(inc, th, NULL, NULL))) log(LOG_DEBUG, "%s; %s: Spurious ACK, " @@ -929,6 +932,7 @@ int tcp_offload_syncache_expand(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, struct socket **lsop, struct mbuf *m) { + INIT_VNET_INET(curvnet); int rc; INP_INFO_WLOCK(&V_tcbinfo); @@ -1097,7 +1101,7 @@ _syncache_add(struct in_conninfo *inc, s syncache_drop(sc, sch); sc = uma_zalloc(V_tcp_syncache.zone, M_NOWAIT | M_ZERO); if (sc == NULL) { - if (tcp_syncookies) { + if (V_tcp_syncookies) { bzero(&scs, sizeof(scs)); sc = &scs; } else { @@ -1206,7 +1210,7 @@ _syncache_add(struct in_conninfo *inc, s if ((th->th_flags & (TH_ECE|TH_CWR)) && V_tcp_do_ecn) sc->sc_flags |= SCF_ECN; - if (tcp_syncookies) { + if (V_tcp_syncookies) { syncookie_generate(sch, sc, &flowtmp); #ifdef INET6 if (autoflowlabel) @@ -1225,7 +1229,7 @@ _syncache_add(struct in_conninfo *inc, s * Do a standard 3-way handshake. */ if (TOEPCB_ISSET(sc) || syncache_respond(sc) == 0) { - if (tcp_syncookies && tcp_syncookiesonly && sc != &scs) + if (V_tcp_syncookies && V_tcp_syncookiesonly && sc != &scs) syncache_free(sc); else if (sc != &scs) syncache_insert(sc, sch); /* locks and unlocks sch */ Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet/tcp_timewait.c Wed Nov 26 22:32:07 2008 (r185348) @@ -150,8 +150,8 @@ SYSCTL_PROC(_net_inet_tcp, OID_AUTO, max &maxtcptw, 0, sysctl_maxtcptw, "IU", "Maximum number of compressed TCP TIME_WAIT entries"); -SYSCTL_INT(_net_inet_tcp, OID_AUTO, nolocaltimewait, CTLFLAG_RW, - &nolocaltimewait, 0, +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, nolocaltimewait, + CTLFLAG_RW, nolocaltimewait, 0, "Do not create compressed TCP TIME_WAIT entries for local connections"); void Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet/udp_usrreq.c Wed Nov 26 22:32:07 2008 (r185348) @@ -113,7 +113,8 @@ int udp_log_in_vain = 0; SYSCTL_INT(_net_inet_udp, OID_AUTO, log_in_vain, CTLFLAG_RW, &udp_log_in_vain, 0, "Log all incoming UDP packets"); -SYSCTL_INT(_net_inet_udp, OID_AUTO, blackhole, CTLFLAG_RW, &udp_blackhole, 0, +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_udp, OID_AUTO, blackhole, + CTLFLAG_RW, udp_blackhole, 0, "Do not send port unreachables for refused connects"); u_long udp_sendspace = 9216; /* really max datagram size */ Modified: head/sys/netinet/vinet.h ============================================================================== --- head/sys/netinet/vinet.h Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet/vinet.h Wed Nov 26 22:32:07 2008 (r185348) @@ -89,12 +89,16 @@ struct vnet_inet { struct tcpstat _tcpstat; /* tcp statistics */ struct tcp_hostcache _tcp_hostcache; struct callout _tcp_hc_callout; + struct tcp_syncache _tcp_syncache; + int _tcp_syncookies; + int _tcp_syncookiesonly; + int _tcp_sc_rst_sock_fail; + struct inpcbhead _divcb; struct inpcbinfo _divcbinfo; TAILQ_HEAD(, tcptw) _twq_2msl; - int _tcp_sc_rst_sock_fail; int _tcp_mssdflt; int _tcp_v6mssdflt; int _tcp_minmss; @@ -206,7 +210,6 @@ struct vnet_inet { #define V_arp_maxtries VNET_INET(arp_maxtries) #define V_arp_proxyall VNET_INET(arp_proxyall) #define V_arpt_keep VNET_INET(arpt_keep) -#define V_arpt_prune VNET_INET(arpt_prune) #define V_blackhole VNET_INET(blackhole) #define V_divcb VNET_INET(divcb) #define V_divcbinfo VNET_INET(divcbinfo) Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet6/icmp6.c Wed Nov 26 22:32:07 2008 (r185348) @@ -108,12 +108,13 @@ __FBSDID("$FreeBSD$"); #endif extern struct domain inet6domain; + +#ifdef VIMAGE_GLOBALS extern struct inpcbinfo ripcbinfo; extern struct inpcbhead ripcb; extern int icmp6errppslim; extern int icmp6_nodeinfo; -#ifdef VIMAGE_GLOBALS struct icmp6stat icmp6stat; static int icmp6errpps_count; static struct timeval icmp6errppslim_last; Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet6/in6_ifattach.c Wed Nov 26 22:32:07 2008 (r185348) @@ -65,10 +65,9 @@ __FBSDID("$FreeBSD$"); unsigned long in6_maxmtu; int ip6_auto_linklocal; struct callout in6_tmpaddrtimer_ch; -#endif - extern struct inpcbinfo udbinfo; extern struct inpcbinfo ripcbinfo; +#endif static int get_rand_ifid(struct ifnet *, struct in6_addr *); static int generate_tmp_ifid(u_int8_t *, const u_int8_t *, u_int8_t *); Modified: head/sys/netinet6/in6_proto.c ============================================================================== --- head/sys/netinet6/in6_proto.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet6/in6_proto.c Wed Nov 26 22:32:07 2008 (r185348) @@ -563,6 +563,6 @@ SYSCTL_V_INT(V_NET, vnet_inet6, _net_ine SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_DEBUG, nd6_debug, CTLFLAG_RW, nd6_debug, 0, ""); -SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_ONLINKNSRFC4861, - nd6_onlink_ns_rfc4861, CTLFLAG_RW, &nd6_onlink_ns_rfc4861, 0, +SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_icmp6, ICMPV6CTL_ND6_ONLINKNSRFC4861, + nd6_onlink_ns_rfc4861, CTLFLAG_RW, nd6_onlink_ns_rfc4861, 0, "Accept 'on-link' nd6 NS in compliance with RFC 4861."); Modified: head/sys/netinet6/in6_rmx.c ============================================================================== --- head/sys/netinet6/in6_rmx.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet6/in6_rmx.c Wed Nov 26 22:32:07 2008 (r185348) @@ -225,14 +225,14 @@ static int rtq_minreallyold6; static int rtq_toomany6; #endif -SYSCTL_INT(_net_inet6_ip6, IPV6CTL_RTEXPIRE, rtexpire, - CTLFLAG_RW, &rtq_reallyold6 , 0, ""); +SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RTEXPIRE, + rtexpire, CTLFLAG_RW, rtq_reallyold6 , 0, ""); -SYSCTL_INT(_net_inet6_ip6, IPV6CTL_RTMINEXPIRE, rtminexpire, - CTLFLAG_RW, &rtq_minreallyold6 , 0, ""); +SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RTMINEXPIRE, + rtminexpire, CTLFLAG_RW, rtq_minreallyold6 , 0, ""); -SYSCTL_INT(_net_inet6_ip6, IPV6CTL_RTMAXCACHE, rtmaxcache, - CTLFLAG_RW, &rtq_toomany6 , 0, ""); +SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RTMAXCACHE, + rtmaxcache, CTLFLAG_RW, rtq_toomany6 , 0, ""); /* Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet6/in6_src.c Wed Nov 26 22:32:07 2008 (r185348) @@ -462,7 +462,6 @@ selectroute(struct sockaddr_in6 *dstsock struct ifnet **retifp, struct rtentry **retrt, int clone, int norouteok) { - INIT_VNET_NET(curvnet); INIT_VNET_INET6(curvnet); int error = 0; struct ifnet *ifp = NULL; Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet6/nd6_nbr.c Wed Nov 26 22:32:07 2008 (r185348) @@ -153,7 +153,7 @@ nd6_ns_input(struct mbuf *m, int off, in "(wrong ip6 dst)\n")); goto bad; } - } else if (!nd6_onlink_ns_rfc4861) { + } else if (!V_nd6_onlink_ns_rfc4861) { struct sockaddr_in6 src_sa6; /* Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet6/nd6_rtr.c Wed Nov 26 22:32:07 2008 (r185348) @@ -85,9 +85,9 @@ static void in6_init_address_ltimes __P( static int rt6_deleteroute(struct radix_node *, void *); +#ifdef VIMAGE_GLOBALS extern int nd6_recalc_reachtm_interval; -#ifdef VIMAGE_GLOBALS static struct ifnet *nd6_defifp; int nd6_defifindex; Modified: head/sys/netinet6/raw_ip6.c ============================================================================== --- head/sys/netinet6/raw_ip6.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netinet6/raw_ip6.c Wed Nov 26 22:32:07 2008 (r185348) @@ -112,15 +112,15 @@ __FBSDID("$FreeBSD$"); * Raw interface to IP6 protocol. */ +#ifdef VIMAGE_GLOBALS extern struct inpcbhead ripcb; extern struct inpcbinfo ripcbinfo; -extern u_long rip_sendspace; -extern u_long rip_recvspace; - -#ifdef VIMAGE_GLOBALS struct rip6stat rip6stat; #endif +extern u_long rip_sendspace; +extern u_long rip_recvspace; + /* * Hooks for multicast forwarding. */ @@ -765,7 +765,6 @@ static int rip6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, struct mbuf *control, struct thread *td) { - INIT_VNET_INET(so->so_vnet); struct inpcb *inp; struct sockaddr_in6 tmp; struct sockaddr_in6 *dst; Modified: head/sys/netipsec/ipsec.c ============================================================================== --- head/sys/netipsec/ipsec.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netipsec/ipsec.c Wed Nov 26 22:32:07 2008 (r185348) @@ -2009,7 +2009,7 @@ static void ipsec_attach(void) { SECPOLICY_LOCK_INIT(&V_ip4_def_policy); - ip4_def_policy.refcnt = 1; /* NB: disallow free */ + V_ip4_def_policy.refcnt = 1; /* NB: disallow free */ } SYSINIT(ipsec, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, ipsec_attach, NULL); Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netipsec/key.c Wed Nov 26 22:32:07 2008 (r185348) @@ -189,11 +189,11 @@ static const u_int saorder_state_valid_p static const u_int saorder_state_valid_prefer_new[] = { SADB_SASTATE_MATURE, SADB_SASTATE_DYING, }; -static u_int saorder_state_alive[] = { +static const u_int saorder_state_alive[] = { /* except DEAD */ SADB_SASTATE_MATURE, SADB_SASTATE_DYING, SADB_SASTATE_LARVAL }; -static u_int saorder_state_any[] = { +static const u_int saorder_state_any[] = { SADB_SASTATE_MATURE, SADB_SASTATE_DYING, SADB_SASTATE_LARVAL, SADB_SASTATE_DEAD }; @@ -2699,9 +2699,9 @@ key_delsah(sah) /* searching all SA registerd in the secindex. */ for (stateidx = 0; - stateidx < _ARRAYLEN(V_saorder_state_any); + stateidx < _ARRAYLEN(saorder_state_any); stateidx++) { - u_int state = V_saorder_state_any[stateidx]; + u_int state = saorder_state_any[stateidx]; LIST_FOREACH_SAFE(sav, &sah->savtree[state], chain, nextsav) { if (sav->refcnt == 0) { /* sanity check */ @@ -2985,10 +2985,10 @@ key_getsavbyspi(sah, spi) SAHTREE_LOCK_ASSERT(); /* search all status */ for (stateidx = 0; - stateidx < _ARRAYLEN(V_saorder_state_alive); + stateidx < _ARRAYLEN(saorder_state_alive); stateidx++) { - state = V_saorder_state_alive[stateidx]; + state = saorder_state_alive[stateidx]; LIST_FOREACH(sav, &sah->savtree[state], chain) { /* sanity check */ @@ -4336,6 +4336,7 @@ key_timehandler(void) VNET_ITERATOR_DECL(vnet_iter); time_t now = time_second; + VNET_LIST_RLOCK(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); key_flush_spd(now); @@ -4344,6 +4345,7 @@ key_timehandler(void) key_flush_spacq(now); CURVNET_RESTORE(); } + VNET_LIST_RUNLOCK(); #ifndef IPSEC_DEBUG2 /* do exchange to tick time !! */ @@ -5313,9 +5315,9 @@ key_delete_all(so, m, mhp, proto) /* Delete all non-LARVAL SAs. */ for (stateidx = 0; - stateidx < _ARRAYLEN(V_saorder_state_alive); + stateidx < _ARRAYLEN(saorder_state_alive); stateidx++) { - state = V_saorder_state_alive[stateidx]; + state = saorder_state_alive[stateidx]; if (state == SADB_SASTATE_LARVAL) continue; for (sav = LIST_FIRST(&sah->savtree[state]); @@ -6518,9 +6520,9 @@ key_flush(so, m, mhp) continue; for (stateidx = 0; - stateidx < _ARRAYLEN(V_saorder_state_alive); + stateidx < _ARRAYLEN(saorder_state_alive); stateidx++) { - state = V_saorder_state_any[stateidx]; + state = saorder_state_any[stateidx]; for (sav = LIST_FIRST(&sah->savtree[state]); sav != NULL; sav = nextsav) { @@ -6603,9 +6605,9 @@ key_dump(so, m, mhp) continue; for (stateidx = 0; - stateidx < _ARRAYLEN(V_saorder_state_any); + stateidx < _ARRAYLEN(saorder_state_any); stateidx++) { - state = V_saorder_state_any[stateidx]; + state = saorder_state_any[stateidx]; LIST_FOREACH(sav, &sah->savtree[state], chain) { cnt++; } @@ -6633,9 +6635,9 @@ key_dump(so, m, mhp) } for (stateidx = 0; - stateidx < _ARRAYLEN(V_saorder_state_any); + stateidx < _ARRAYLEN(saorder_state_any); stateidx++) { - state = V_saorder_state_any[stateidx]; + state = saorder_state_any[stateidx]; LIST_FOREACH(sav, &sah->savtree[state], chain) { n = key_setdumpsa(sav, SADB_DUMP, satype, --cnt, mhp->msg->sadb_msg_pid); Modified: head/sys/netipsec/keysock.c ============================================================================== --- head/sys/netipsec/keysock.c Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netipsec/keysock.c Wed Nov 26 22:32:07 2008 (r185348) @@ -76,7 +76,7 @@ static struct key_cb key_cb; struct pfkeystat pfkeystat; #endif -static struct sockaddr key_src = { 2, PF_KEY, }; +static struct sockaddr key_src = { 2, PF_KEY }; static int key_sendup0 __P((struct rawcb *, struct mbuf *, int)); @@ -166,7 +166,7 @@ key_sendup0(rp, m, promisc) V_pfkeystat.in_msgtype[pmsg->sadb_msg_type]++; } - if (!sbappendaddr(&rp->rcb_socket->so_rcv, (struct sockaddr *)&V_key_src, + if (!sbappendaddr(&rp->rcb_socket->so_rcv, (struct sockaddr *)&key_src, m, NULL)) { V_pfkeystat.in_nomem++; m_freem(m); Modified: head/sys/netipsec/vipsec.h ============================================================================== --- head/sys/netipsec/vipsec.h Wed Nov 26 21:44:57 2008 (r185347) +++ head/sys/netipsec/vipsec.h Wed Nov 26 22:32:07 2008 (r185348) @@ -81,8 +81,6 @@ struct vnet_ipsec { int _key_preferred_oldsa; u_int32_t _acq_seq; - u_int _saorder_state_alive[3]; - u_int _saorder_state_any[4]; int _esp_enable; struct espstat _espstat; int _esp_max_ivlen; @@ -98,7 +96,6 @@ struct vnet_ipsec { int _ip6_ah_trans_deflev; int _ip6_ah_net_deflev; int _ip6_ipsec_ecn; - int _ip6_esp_randpad; int _ah_enable; int _ah_cleartos; @@ -109,9 +106,6 @@ struct vnet_ipsec { struct pfkeystat _pfkeystat; struct key_cb _key_cb; - struct sockaddr _key_dst; - struct sockaddr _key_src; - LIST_HEAD(, secpolicy) _sptree[IPSEC_DIR_MAX]; LIST_HEAD(, secashead) _sahtree; LIST_HEAD(, secreg) _regtree[SADB_SATYPE_MAX + 1]; @@ -168,20 +162,16 @@ struct vnet_ipsec { #define V_key_blockacq_lifetime VNET_IPSEC(key_blockacq_lifetime) #define V_key_cb VNET_IPSEC(key_cb) #define V_key_debug_level VNET_IPSEC(key_debug_level) -#define V_key_dst VNET_IPSEC(key_dst) #define V_key_int_random VNET_IPSEC(key_int_random) #define V_key_larval_lifetime VNET_IPSEC(key_larval_lifetime) #define V_key_preferred_oldsa VNET_IPSEC(key_preferred_oldsa) #define V_key_spi_maxval VNET_IPSEC(key_spi_maxval) #define V_key_spi_minval VNET_IPSEC(key_spi_minval) #define V_key_spi_trycnt VNET_IPSEC(key_spi_trycnt) -#define V_key_src VNET_IPSEC(key_src) #define V_pfkeystat VNET_IPSEC(pfkeystat) #define V_policy_id VNET_IPSEC(policy_id) #define V_regtree VNET_IPSEC(regtree) #define V_sahtree VNET_IPSEC(sahtree) -#define V_saorder_state_alive VNET_IPSEC(saorder_state_alive) -#define V_saorder_state_any VNET_IPSEC(saorder_state_any) #define V_spacqtree VNET_IPSEC(spacqtree) #define V_sptree VNET_IPSEC(sptree) From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 22:33:55 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 609F01065672; Wed, 26 Nov 2008 22:33:55 +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 4506E8FC08; Wed, 26 Nov 2008 22:33:55 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQMXtHR068279; Wed, 26 Nov 2008 22:33:55 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQMXte4068278; Wed, 26 Nov 2008 22:33:55 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200811262233.mAQMXte4068278@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 26 Nov 2008 22:33:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185349 - head/sys/i386/cpufreq X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 22:33:55 -0000 Author: jkim Date: Wed Nov 26 22:33:55 2008 New Revision: 185349 URL: http://svn.freebsd.org/changeset/base/185349 Log: Remove an unused variable. Found with: Coverity Prevent(tm) CID: 3677 Modified: head/sys/i386/cpufreq/powernow.c Modified: head/sys/i386/cpufreq/powernow.c ============================================================================== --- head/sys/i386/cpufreq/powernow.c Wed Nov 26 22:32:07 2008 (r185348) +++ head/sys/i386/cpufreq/powernow.c Wed Nov 26 22:33:55 2008 (r185349) @@ -865,7 +865,6 @@ pn_decode_acpi(device_t dev, device_t pe static void pn_identify(driver_t *driver, device_t parent) { - device_t child; if ((amd_pminfo & AMDPM_FID) == 0 || (amd_pminfo & AMDPM_VID) == 0) return; @@ -878,7 +877,7 @@ pn_identify(driver_t *driver, device_t p } if (device_find_child(parent, "powernow", -1) != NULL) return; - if ((child = BUS_ADD_CHILD(parent, 10, "powernow", -1)) == NULL) + if (BUS_ADD_CHILD(parent, 10, "powernow", -1) == NULL) device_printf(parent, "powernow: add child failed\n"); } From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 22:36:35 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFC0A1065670; Wed, 26 Nov 2008 22:36:35 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A32CF8FC18; Wed, 26 Nov 2008 22:36:35 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQMaZVl068358; Wed, 26 Nov 2008 22:36:35 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQMaZsm068357; Wed, 26 Nov 2008 22:36:35 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811262236.mAQMaZsm068357@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 26 Nov 2008 22:36:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185350 - in stable/7/sys: . netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 22:36:35 -0000 Author: bz Date: Wed Nov 26 22:36:35 2008 New Revision: 185350 URL: http://svn.freebsd.org/changeset/base/185350 Log: MFC: r185332 Plug a credential leak in case the inpcb is freed by in6_pcbfree() instead of in_pcbfree(); missed in r183606. Approved by: re (gnn) Modified: stable/7/sys/ (props changed) stable/7/sys/netinet6/in6_pcb.c Modified: stable/7/sys/netinet6/in6_pcb.c ============================================================================== --- stable/7/sys/netinet6/in6_pcb.c Wed Nov 26 22:33:55 2008 (r185349) +++ stable/7/sys/netinet6/in6_pcb.c Wed Nov 26 22:36:35 2008 (r185350) @@ -437,6 +437,7 @@ in6_pcbfree(struct inpcb *inp) if (inp->inp_moptions != NULL) inp_freemoptions(inp->inp_moptions); inp->inp_vflag = 0; + crfree(inp->inp_cred); #ifdef MAC mac_destroy_inpcb(inp); #endif From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 23:31:42 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0D66106564A; Wed, 26 Nov 2008 23:31:42 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98E108FC17; Wed, 26 Nov 2008 23:31:42 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQNVg2P069510; Wed, 26 Nov 2008 23:31:42 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQNVgpo069509; Wed, 26 Nov 2008 23:31:42 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200811262331.mAQNVgpo069509@svn.freebsd.org> From: Peter Wemm Date: Wed, 26 Nov 2008 23:31:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185351 - releng/7.1/sys/modules/cxgb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 23:31:42 -0000 Author: peter Date: Wed Nov 26 23:31:42 2008 New Revision: 185351 URL: http://svn.freebsd.org/changeset/base/185351 Log: Remove a cloned zombie mergeinfo record Submitted by: bz Approved by: re (implicit) Modified: releng/7.1/sys/modules/cxgb/ (props changed) From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 23:41:18 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C211B1065670; Wed, 26 Nov 2008 23:41:18 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1F388FC0C; Wed, 26 Nov 2008 23:41:18 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQNfIqX069727; Wed, 26 Nov 2008 23:41:18 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQNfIID069725; Wed, 26 Nov 2008 23:41:18 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200811262341.mAQNfIID069725@svn.freebsd.org> From: Jack F Vogel Date: Wed, 26 Nov 2008 23:41:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185352 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 23:41:18 -0000 Author: jfv Date: Wed Nov 26 23:41:18 2008 New Revision: 185352 URL: http://svn.freebsd.org/changeset/base/185352 Log: Updated ixgbe driver - version 1.6.2 -This version has header split, and as a result a number of aspects of the code have been improved/simplified. - Interrupt handling refined for performance - Many small bugs fixed along the way MFC after: ASAP - in time for 7.1 Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h head/sys/dev/ixgbe/ixgbe_82598.c head/sys/dev/ixgbe/ixgbe_api.c head/sys/dev/ixgbe/ixgbe_api.h head/sys/dev/ixgbe/ixgbe_common.c head/sys/dev/ixgbe/ixgbe_common.h head/sys/dev/ixgbe/ixgbe_osdep.h head/sys/dev/ixgbe/ixgbe_phy.c head/sys/dev/ixgbe/ixgbe_phy.h head/sys/dev/ixgbe/ixgbe_type.h Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Wed Nov 26 23:31:42 2008 (r185351) +++ head/sys/dev/ixgbe/ixgbe.c Wed Nov 26 23:41:18 2008 (r185352) @@ -36,9 +36,6 @@ #include "opt_device_polling.h" #endif -/* Undefine this if not using CURRENT */ -#define IXGBE_VLAN_EVENTS - #include "ixgbe.h" /********************************************************************* @@ -49,7 +46,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "1.4.7"; +char ixgbe_driver_version[] = "1.6.2"; /********************************************************************* * PCI Device ID Table @@ -65,11 +62,15 @@ static ixgbe_vendor_info_t ixgbe_vendor_ { {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598AF_DUAL_PORT, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598AF_SINGLE_PORT, 0, 0, 0}, - {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598AT_DUAL_PORT, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598EB_CX4, 0, 0, 0}, + {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598AT, 0, 0, 0}, + {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598, 0, 0, 0}, + {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598_DA_DUAL_PORT, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598_CX4_DUAL_PORT, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598EB_XF_LR, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598AT, 0, 0, 0}, + {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM, 0, 0, 0}, + {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598EB_SFP_LOM, 0, 0, 0}, /* required last entry */ {0, 0, 0, 0, 0} }; @@ -128,14 +129,14 @@ static void ixgbe_disable_intr(struc static void ixgbe_update_stats_counters(struct adapter *); static bool ixgbe_txeof(struct tx_ring *); static bool ixgbe_rxeof(struct rx_ring *, int); -static void ixgbe_rx_checksum(struct adapter *, u32, struct mbuf *); +static void ixgbe_rx_checksum(u32, struct mbuf *); static void ixgbe_set_promisc(struct adapter *); static void ixgbe_disable_promisc(struct adapter *); static void ixgbe_set_multi(struct adapter *); static void ixgbe_print_hw_stats(struct adapter *); static void ixgbe_print_debug_info(struct adapter *); static void ixgbe_update_link_status(struct adapter *); -static int ixgbe_get_buf(struct rx_ring *, int); +static int ixgbe_get_buf(struct rx_ring *, int, u8); static int ixgbe_xmit(struct tx_ring *, struct mbuf **); static int ixgbe_sysctl_stats(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_debug(SYSCTL_HANDLER_ARGS); @@ -147,15 +148,20 @@ static void ixgbe_add_rx_process_limit(s const char *, int *, int); static boolean_t ixgbe_tx_ctx_setup(struct tx_ring *, struct mbuf *); static boolean_t ixgbe_tso_setup(struct tx_ring *, struct mbuf *, u32 *); -static void ixgbe_set_ivar(struct adapter *, u16, u8); +static void ixgbe_set_ivar(struct adapter *, u16, u8, s8); static void ixgbe_configure_ivars(struct adapter *); static u8 * ixgbe_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *); -#ifdef IXGBE_VLAN_EVENTS +#ifdef IXGBE_HW_VLAN_SUPPORT static void ixgbe_register_vlan(void *, struct ifnet *, u16); static void ixgbe_unregister_vlan(void *, struct ifnet *, u16); #endif +static void ixgbe_update_aim(struct rx_ring *); + +/* Support for pluggable optic modules */ +static bool ixgbe_sfp_probe(struct adapter *); + /* Legacy (single vector interrupt handler */ static void ixgbe_legacy_irq(void *); @@ -168,9 +174,6 @@ static void ixgbe_msix_link(void *); static void ixgbe_handle_tx(void *context, int pending); static void ixgbe_handle_rx(void *context, int pending); -#ifndef NO_82598_A0_SUPPORT -static void desc_flip(void *); -#endif /********************************************************************* * FreeBSD Device Interface Entry Points @@ -199,12 +202,28 @@ MODULE_DEPEND(ixgbe, ether, 1, 1, 1); ** TUNEABLE PARAMETERS: */ +/* +** These parameters are used in Adaptive +** Interrupt Moderation. The value is set +** into EITR and controls the interrupt +** frequency. They can be modified but +** be careful in tuning them. +*/ +static int ixgbe_enable_aim = TRUE; +TUNABLE_INT("hw.ixgbe.enable_aim", &ixgbe_enable_aim); +static int ixgbe_low_latency = IXGBE_LOW_LATENCY; +TUNABLE_INT("hw.ixgbe.low_latency", &ixgbe_low_latency); +static int ixgbe_ave_latency = IXGBE_LOW_LATENCY; +TUNABLE_INT("hw.ixgbe.ave_latency", &ixgbe_low_latency); +static int ixgbe_bulk_latency = IXGBE_BULK_LATENCY; +TUNABLE_INT("hw.ixgbe.bulk_latency", &ixgbe_bulk_latency); + /* How many packets rxeof tries to clean at a time */ static int ixgbe_rx_process_limit = 100; TUNABLE_INT("hw.ixgbe.rx_process_limit", &ixgbe_rx_process_limit); /* Flow control setting, default to full */ -static int ixgbe_flow_control = 3; +static int ixgbe_flow_control = ixgbe_fc_none; TUNABLE_INT("hw.ixgbe.flow_control", &ixgbe_flow_control); /* @@ -213,7 +232,7 @@ TUNABLE_INT("hw.ixgbe.flow_control", &ix * interface must be reset (down/up) for it * to take effect. */ -static int ixgbe_enable_lro = 0; +static int ixgbe_enable_lro = 1; TUNABLE_INT("hw.ixgbe.enable_lro", &ixgbe_enable_lro); /* @@ -224,12 +243,18 @@ static int ixgbe_enable_msix = 1; TUNABLE_INT("hw.ixgbe.enable_msix", &ixgbe_enable_msix); /* + * Enable RX Header Split + */ +static int ixgbe_rx_hdr_split = 1; +TUNABLE_INT("hw.ixgbe.rx_hdr_split", &ixgbe_rx_hdr_split); + +/* * Number of TX/RX Queues, with 0 setting * it autoconfigures to the number of cpus. */ static int ixgbe_tx_queues = 1; TUNABLE_INT("hw.ixgbe.tx_queues", &ixgbe_tx_queues); -static int ixgbe_rx_queues = 4; +static int ixgbe_rx_queues = 1; TUNABLE_INT("hw.ixgbe.rx_queues", &ixgbe_rx_queues); /* Number of TX descriptors per ring */ @@ -243,9 +268,6 @@ TUNABLE_INT("hw.ixgbe.rxd", &ixgbe_rxd); /* Total number of Interfaces - need for config sanity check */ static int ixgbe_total_ports; -/* Optics type of this interface */ -static int ixgbe_optics; - /********************************************************************* * Device identification routine * @@ -260,11 +282,11 @@ ixgbe_probe(device_t dev) { ixgbe_vendor_info_t *ent; - u_int16_t pci_vendor_id = 0; - u_int16_t pci_device_id = 0; - u_int16_t pci_subvendor_id = 0; - u_int16_t pci_subdevice_id = 0; - char adapter_name[128]; + u16 pci_vendor_id = 0; + u16 pci_device_id = 0; + u16 pci_subvendor_id = 0; + u16 pci_subdevice_id = 0; + char adapter_name[256]; INIT_DEBUGOUT("ixgbe_probe: begin"); @@ -289,41 +311,11 @@ ixgbe_probe(device_t dev) sprintf(adapter_name, "%s, Version - %s", ixgbe_strings[ent->index], ixgbe_driver_version); - switch (pci_device_id) { - case IXGBE_DEV_ID_82598AT_DUAL_PORT : - ixgbe_total_ports += 2; - break; - case IXGBE_DEV_ID_82598_CX4_DUAL_PORT : - ixgbe_optics = IFM_10G_CX4; - ixgbe_total_ports += 2; - break; - case IXGBE_DEV_ID_82598AF_DUAL_PORT : - ixgbe_optics = IFM_10G_SR; - ixgbe_total_ports += 2; - break; - case IXGBE_DEV_ID_82598AF_SINGLE_PORT : - ixgbe_optics = IFM_10G_SR; - ixgbe_total_ports += 1; - break; - case IXGBE_DEV_ID_82598EB_XF_LR : - ixgbe_optics = IFM_10G_LR; - ixgbe_total_ports += 1; - break; - case IXGBE_DEV_ID_82598EB_CX4 : - ixgbe_optics = IFM_10G_CX4; - ixgbe_total_ports += 1; - break; - case IXGBE_DEV_ID_82598AT : - ixgbe_total_ports += 1; - default: - break; - } device_set_desc_copy(dev, adapter_name); return (0); } ent++; } - return (ENXIO); } @@ -342,7 +334,8 @@ ixgbe_attach(device_t dev) { struct adapter *adapter; int error = 0; - u32 ctrl_ext; + u16 pci_device_id; + u32 ctrl_ext; INIT_DEBUGOUT("ixgbe_attach: begin"); @@ -353,6 +346,37 @@ ixgbe_attach(device_t dev) /* Core Lock Init*/ IXGBE_CORE_LOCK_INIT(adapter, device_get_nameunit(dev)); + /* Keep track of number of ports and optics */ + pci_device_id = pci_get_device(dev); + switch (pci_device_id) { + case IXGBE_DEV_ID_82598_CX4_DUAL_PORT : + adapter->optics = IFM_10G_CX4; + ixgbe_total_ports += 2; + break; + case IXGBE_DEV_ID_82598AF_DUAL_PORT : + adapter->optics = IFM_10G_SR; + ixgbe_total_ports += 2; + break; + case IXGBE_DEV_ID_82598AF_SINGLE_PORT : + adapter->optics = IFM_10G_SR; + ixgbe_total_ports += 1; + break; + case IXGBE_DEV_ID_82598EB_XF_LR : + adapter->optics = IFM_10G_LR; + ixgbe_total_ports += 1; + break; + case IXGBE_DEV_ID_82598EB_CX4 : + adapter->optics = IFM_10G_CX4; + ixgbe_total_ports += 1; + break; + case IXGBE_DEV_ID_82598AT : + ixgbe_total_ports += 1; + case IXGBE_DEV_ID_82598_DA_DUAL_PORT : + ixgbe_total_ports += 2; + default: + break; + } + /* SYSCTL APIs */ SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), @@ -374,15 +398,37 @@ ixgbe_attach(device_t dev) OID_AUTO, "enable_lro", CTLTYPE_INT|CTLFLAG_RW, &ixgbe_enable_lro, 1, "Large Receive Offload"); + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "enable_aim", CTLTYPE_INT|CTLFLAG_RW, + &ixgbe_enable_aim, 1, "Interrupt Moderation"); + + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "low_latency", CTLTYPE_INT|CTLFLAG_RW, + &ixgbe_low_latency, 1, "Low Latency"); + + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "ave_latency", CTLTYPE_INT|CTLFLAG_RW, + &ixgbe_ave_latency, 1, "Average Latency"); + + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "bulk_latency", CTLTYPE_INT|CTLFLAG_RW, + &ixgbe_bulk_latency, 1, "Bulk Latency"); + + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "hdr_split", CTLTYPE_INT|CTLFLAG_RW, + &ixgbe_rx_hdr_split, 1, "RX Header Split"); + /* Set up the timer callout */ callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0); /* Determine hardware revision */ ixgbe_identify_hardware(adapter); - /* Indicate to RX setup to use Jumbo Clusters */ - adapter->bigbufs = TRUE; - /* Do base PCI setup - map BAR0 */ if (ixgbe_allocate_pci_resources(adapter)) { device_printf(dev, "Allocation of PCI resources failed\n"); @@ -428,7 +474,20 @@ ixgbe_attach(device_t dev) } /* Initialize the shared code */ - if (ixgbe_init_shared_code(&adapter->hw)) { + error = ixgbe_init_shared_code(&adapter->hw); + if (error == IXGBE_ERR_SFP_NOT_PRESENT) { + /* + ** No optics in this port, set up + ** so the timer routine will probe + ** for later insertion. + */ + adapter->sfp_probe = TRUE; + error = 0; + } else if (error == IXGBE_ERR_SFP_NOT_SUPPORTED) { + device_printf(dev,"Unsupported SFP+ module detected!\n"); + error = EIO; + goto err_late; + } else if (error) { device_printf(dev,"Unable to initialize the shared code\n"); error = EIO; goto err_late; @@ -459,14 +518,14 @@ ixgbe_attach(device_t dev) /* Initialize statistics */ ixgbe_update_stats_counters(adapter); -#ifdef IXGBE_VLAN_EVENTS +#ifdef IXGBE_HW_VLAN_SUPPORT /* Register for VLAN events */ adapter->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, ixgbe_register_vlan, 0, EVENTHANDLER_PRI_FIRST); adapter->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, ixgbe_unregister_vlan, 0, EVENTHANDLER_PRI_FIRST); #endif - + /* let hardware know driver is loaded */ ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT); ctrl_ext |= IXGBE_CTRL_EXT_DRV_LOAD; @@ -521,7 +580,6 @@ ixgbe_detach(device_t dev) if (txr->tq) { taskqueue_drain(txr->tq, &txr->tx_task); taskqueue_free(txr->tq); - txr->tq = NULL; } } @@ -529,22 +587,21 @@ ixgbe_detach(device_t dev) if (rxr->tq) { taskqueue_drain(rxr->tq, &rxr->rx_task); taskqueue_free(rxr->tq); - rxr->tq = NULL; } } -#ifdef IXGBE_VLAN_EVENTS + /* let hardware know driver is unloading */ + ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT); + ctrl_ext &= ~IXGBE_CTRL_EXT_DRV_LOAD; + IXGBE_WRITE_REG(&adapter->hw, IXGBE_CTRL_EXT, ctrl_ext); + +#ifdef IXGBE_HW_VLAN_SUPPORT /* Unregister VLAN events */ if (adapter->vlan_attach != NULL) EVENTHANDLER_DEREGISTER(vlan_config, adapter->vlan_attach); if (adapter->vlan_detach != NULL) EVENTHANDLER_DEREGISTER(vlan_unconfig, adapter->vlan_detach); -#endif - - /* let hardware know driver is unloading */ - ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT); - ctrl_ext &= ~IXGBE_CTRL_EXT_DRV_LOAD; - IXGBE_WRITE_REG(&adapter->hw, IXGBE_CTRL_EXT, ctrl_ext); +#endif ether_ifdetach(adapter->ifp); callout_drain(&adapter->timer); @@ -848,10 +905,13 @@ ixgbe_watchdog(struct adapter *adapter) static void ixgbe_init_locked(struct adapter *adapter) { + struct rx_ring *rxr = adapter->rx_rings; + struct tx_ring *txr = adapter->tx_rings; struct ifnet *ifp = adapter->ifp; device_t dev = adapter->dev; struct ixgbe_hw *hw; - u32 txdctl, rxdctl, mhadd, gpie; + u32 k, txdctl, mhadd, gpie; + u32 rxdctl, rxctrl; INIT_DEBUGOUT("ixgbe_init: begin"); @@ -872,17 +932,16 @@ ixgbe_init_locked(struct adapter *adapte return; } -#ifndef IXGBE_VLAN_EVENTS - /* With events this is done when a vlan registers */ +#ifndef IXGBE_HW_VLAN_SUPPORT if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { - u32 ctrl; + u32 ctrl; + ctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_VLNCTRL); ctrl |= IXGBE_VLNCTRL_VME; ctrl &= ~IXGBE_VLNCTRL_CFIEN; IXGBE_WRITE_REG(&adapter->hw, IXGBE_VLNCTRL, ctrl); } #endif - /* Prepare transmit descriptors and buffers */ if (ixgbe_setup_transmit_structures(adapter)) { device_printf(dev,"Could not setup transmit structures\n"); @@ -892,15 +951,24 @@ ixgbe_init_locked(struct adapter *adapte ixgbe_initialize_transmit_units(adapter); + /* TX irq moderation rate is fixed */ + for (int i = 0; i < adapter->num_tx_queues; i++, txr++) { + IXGBE_WRITE_REG(&adapter->hw, + IXGBE_EITR(txr->msix), ixgbe_ave_latency); + txr->watchdog_timer = FALSE; + } + /* Setup Multicast table */ ixgbe_set_multi(adapter); /* - ** If we are resetting MTU smaller than 2K - ** drop to small RX buffers + ** Determine the correct mbuf pool + ** for doing jumbo/headersplit */ - if (adapter->max_frame_size <= MCLBYTES) - adapter->bigbufs = FALSE; + if (ifp->if_mtu > ETHERMTU) + adapter->rx_mbuf_sz = MJUMPAGESIZE; + else + adapter->rx_mbuf_sz = MCLBYTES; /* Prepare receive descriptors and buffers */ if (ixgbe_setup_receive_structures(adapter)) { @@ -912,10 +980,22 @@ ixgbe_init_locked(struct adapter *adapte /* Configure RX settings */ ixgbe_initialize_receive_units(adapter); + /* RX moderation will be adapted over time, set default */ + for (int i = 0; i < adapter->num_rx_queues; i++, rxr++) { + IXGBE_WRITE_REG(&adapter->hw, + IXGBE_EITR(rxr->msix), ixgbe_low_latency); + } + + /* Set Link moderation */ + IXGBE_WRITE_REG(&adapter->hw, + IXGBE_EITR(adapter->linkvec), IXGBE_LINK_ITR); + gpie = IXGBE_READ_REG(&adapter->hw, IXGBE_GPIE); + /* Enable Fan Failure Interrupt */ if (adapter->hw.phy.media_type == ixgbe_media_type_copper) gpie |= IXGBE_SDP1_GPIEN; + if (adapter->msix) { /* Enable Enhanced MSIX mode */ gpie |= IXGBE_GPIE_MSIX_MODE; @@ -955,12 +1035,29 @@ ixgbe_init_locked(struct adapter *adapte rxdctl |= 0x0020; rxdctl |= IXGBE_RXDCTL_ENABLE; IXGBE_WRITE_REG(&adapter->hw, IXGBE_RXDCTL(i), rxdctl); + for (k = 0; k < 10; k++) { + if (IXGBE_READ_REG(hw, IXGBE_RXDCTL(i)) & + IXGBE_RXDCTL_ENABLE) + break; + else + msec_delay(1); + } + wmb(); + IXGBE_WRITE_REG(hw, IXGBE_RDT(i), adapter->num_rx_desc - 1); } + /* Enable Receive engine */ + rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); + if (adapter->hw.mac.type == ixgbe_mac_82598EB) + rxctrl |= IXGBE_RXCTRL_DMBYPS; + rxctrl |= IXGBE_RXCTRL_RXEN; + IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, rxctrl); + callout_reset(&adapter->timer, hz, ixgbe_local_timer, adapter); /* Set up MSI/X routing */ - ixgbe_configure_ivars(adapter); + if (ixgbe_enable_msix) + ixgbe_configure_ivars(adapter); ixgbe_enable_intr(adapter); @@ -984,7 +1081,7 @@ ixgbe_init(void *arg) /* -** Legacy Deferred Interrupt Handlers +** MSIX Interrupt Handlers */ static void @@ -992,11 +1089,14 @@ ixgbe_handle_rx(void *context, int pendi { struct rx_ring *rxr = context; struct adapter *adapter = rxr->adapter; - u32 loop = 0; + u32 loop = MAX_LOOP; + bool more; - while (loop++ < MAX_INTR) - if (ixgbe_rxeof(rxr, adapter->rx_process_limit) == 0) - break; + do { + more = ixgbe_rxeof(rxr, -1); + } while (loop-- && more); + /* Reenable this interrupt */ + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, rxr->eims); } static void @@ -1005,15 +1105,21 @@ ixgbe_handle_tx(void *context, int pendi struct tx_ring *txr = context; struct adapter *adapter = txr->adapter; struct ifnet *ifp = adapter->ifp; - u32 loop = 0; + u32 loop = MAX_LOOP; + bool more; - IXGBE_TX_LOCK(txr); - while (loop++ < MAX_INTR) - if (ixgbe_txeof(txr) == 0) - break; - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - ixgbe_start_locked(txr, ifp); - IXGBE_TX_UNLOCK(txr); + IXGBE_TX_LOCK(txr); + do { + more = ixgbe_txeof(txr); + } while (loop-- && more); + + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + ixgbe_start_locked(txr, ifp); + + IXGBE_TX_UNLOCK(txr); + + /* Reenable this interrupt */ + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, txr->eims); } @@ -1026,34 +1132,38 @@ ixgbe_handle_tx(void *context, int pendi static void ixgbe_legacy_irq(void *arg) { - u32 reg_eicr; struct adapter *adapter = arg; + struct ixgbe_hw *hw = &adapter->hw; struct tx_ring *txr = adapter->tx_rings; struct rx_ring *rxr = adapter->rx_rings; - struct ixgbe_hw *hw; + u32 reg_eicr; - hw = &adapter->hw; - reg_eicr = IXGBE_READ_REG(&adapter->hw, IXGBE_EICR); - if (reg_eicr == 0) + + reg_eicr = IXGBE_READ_REG(hw, IXGBE_EICR); + + if (reg_eicr == 0) { + ixgbe_enable_intr(adapter); return; + } - if (ixgbe_rxeof(rxr, adapter->rx_process_limit) != 0) + if (ixgbe_rxeof(rxr, adapter->rx_process_limit)) taskqueue_enqueue(rxr->tq, &rxr->rx_task); - if (ixgbe_txeof(txr) != 0) - taskqueue_enqueue(txr->tq, &txr->tx_task); + if (ixgbe_txeof(txr)) + taskqueue_enqueue(txr->tq, &txr->tx_task); /* Check for fan failure */ if ((hw->phy.media_type == ixgbe_media_type_copper) && (reg_eicr & IXGBE_EICR_GPI_SDP1)) { device_printf(adapter->dev, "\nCRITICAL: FAN FAILURE!! " "REPLACE IMMEDIATELY!!\n"); - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, - IXGBE_EICR_GPI_SDP1); + IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EICR_GPI_SDP1); } + /* Link status change */ if (reg_eicr & IXGBE_EICR_LSC) ixgbe_update_link_status(adapter); + ixgbe_enable_intr(adapter); return; } @@ -1067,25 +1177,25 @@ ixgbe_legacy_irq(void *arg) void ixgbe_msix_tx(void *arg) { - struct tx_ring *txr = arg; - struct adapter *adapter = txr->adapter; - u32 loop = 0; + struct tx_ring *txr = arg; + struct adapter *adapter = txr->adapter; + bool more; - ++txr->tx_irq; IXGBE_TX_LOCK(txr); - while (loop++ < MAX_INTR) - if (ixgbe_txeof(txr) == 0) - break; + ++txr->tx_irq; + more = ixgbe_txeof(txr); IXGBE_TX_UNLOCK(txr); - /* Reenable this interrupt */ - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, txr->eims); - + if (more) + taskqueue_enqueue(txr->tq, &txr->tx_task); + else /* Reenable this interrupt */ + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, txr->eims); return; } + /********************************************************************* * - * MSI RX Interrupt Service routine + * MSIX RX Interrupt Service routine * **********************************************************************/ @@ -1093,18 +1203,71 @@ static void ixgbe_msix_rx(void *arg) { struct rx_ring *rxr = arg; - struct adapter *adapter = rxr->adapter; - u32 loop = 0; + struct adapter *adapter = rxr->adapter; + bool more; ++rxr->rx_irq; - while (loop++ < MAX_INTR) - if (ixgbe_rxeof(rxr, adapter->rx_process_limit) == 0) - break; - /* Reenable this interrupt */ - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, rxr->eims); + more = ixgbe_rxeof(rxr, -1); + if (more) + taskqueue_enqueue(rxr->tq, &rxr->rx_task); + else + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, rxr->eims); + /* Update interrupt rate */ + if (ixgbe_enable_aim == TRUE) + ixgbe_update_aim(rxr); return; } +/* +** Routine to do adjust the RX EITR value based on traffic, +** its a simple three state model, but seems to help. +** +** Note that the three EITR values are tuneable using +** sysctl in real time. The feature can be effectively +** nullified by setting them equal. +*/ +#define BULK_THRESHOLD 10000 +#define AVE_THRESHOLD 1600 + +static void +ixgbe_update_aim(struct rx_ring *rxr) +{ + struct adapter *adapter = rxr->adapter; + u32 olditr, newitr; + + /* Update interrupt moderation based on traffic */ + olditr = rxr->eitr_setting; + newitr = olditr; + + /* Idle, don't change setting */ + if (rxr->bytes == 0) + return; + + if (olditr == ixgbe_low_latency) { + if (rxr->bytes > AVE_THRESHOLD) + newitr = ixgbe_ave_latency; + } else if (olditr == ixgbe_ave_latency) { + if (rxr->bytes < AVE_THRESHOLD) + newitr = ixgbe_low_latency; + else if (rxr->bytes > BULK_THRESHOLD) + newitr = ixgbe_bulk_latency; + } else if (olditr == ixgbe_bulk_latency) { + if (rxr->bytes < BULK_THRESHOLD) + newitr = ixgbe_ave_latency; + } + + if (olditr != newitr) { + /* Change interrupt rate */ + rxr->eitr_setting = newitr; + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(rxr->me), + newitr | (newitr << 16)); + } + + rxr->bytes = 0; + return; +} + + static void ixgbe_msix_link(void *arg) { @@ -1164,7 +1327,7 @@ ixgbe_media_status(struct ifnet * ifp, s ifmr->ifm_active |= IFM_1000_T | IFM_FDX; break; case IXGBE_LINK_SPEED_10GB_FULL: - ifmr->ifm_active |= ixgbe_optics | IFM_FDX; + ifmr->ifm_active |= adapter->optics | IFM_FDX; break; } @@ -1220,7 +1383,7 @@ ixgbe_xmit(struct tx_ring *txr, struct m { struct adapter *adapter = txr->adapter; u32 olinfo_status = 0, cmd_type_len = 0; - u32 paylen; + u32 paylen = 0; int i, j, error, nsegs; int first, last = 0; struct mbuf *m_head; @@ -1230,7 +1393,6 @@ ixgbe_xmit(struct tx_ring *txr, struct m union ixgbe_adv_tx_desc *txd = NULL; m_head = *m_headp; - paylen = 0; /* Basic descriptor defines */ cmd_type_len |= IXGBE_ADVTXD_DTYP_DATA; @@ -1274,7 +1436,7 @@ ixgbe_xmit(struct tx_ring *txr, struct m m = m_defrag(*m_headp, M_DONTWAIT); if (m == NULL) { - adapter->mbuf_alloc_failed++; + adapter->mbuf_defrag_failed++; m_freem(*m_headp); *m_headp = NULL; return (ENOBUFS); @@ -1326,6 +1488,11 @@ ixgbe_xmit(struct tx_ring *txr, struct m } else if (ixgbe_tx_ctx_setup(txr, m_head)) olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; + /* Record payload length */ + if (paylen == 0) + olinfo_status |= m_head->m_pkthdr.len << + IXGBE_ADVTXD_PAYLEN_SHIFT; + i = txr->next_avail_tx_desc; for (j = 0; j < nsegs; j++) { bus_size_t seglen; @@ -1346,19 +1513,10 @@ ixgbe_xmit(struct tx_ring *txr, struct m i = 0; txbuf->m_head = NULL; - /* - ** we have to do this inside the loop right now - ** because of the hardware workaround. - */ - if (j == (nsegs -1)) /* Last descriptor gets EOP and RS */ - txd->read.cmd_type_len |= - htole32(IXGBE_TXD_CMD_EOP | IXGBE_TXD_CMD_RS); -#ifndef NO_82598_A0_SUPPORT - if (adapter->hw.revision_id == 0) - desc_flip(txd); -#endif } + txd->read.cmd_type_len |= + htole32(IXGBE_TXD_CMD_EOP | IXGBE_TXD_CMD_RS); txr->tx_avail -= nsegs; txr->next_avail_tx_desc = i; @@ -1375,8 +1533,8 @@ ixgbe_xmit(struct tx_ring *txr, struct m * Advance the Transmit Descriptor Tail (Tdt), this tells the * hardware that this frame is available to transmit. */ + ++txr->total_packets; IXGBE_WRITE_REG(&adapter->hw, IXGBE_TDT(txr->me), i); - ++txr->tx_packets; return (0); xmit_fail: @@ -1504,17 +1662,26 @@ ixgbe_local_timer(void *arg) mtx_assert(&adapter->core_mtx, MA_OWNED); + /* Check for pluggable optics */ + if (adapter->sfp_probe) + if (!ixgbe_sfp_probe(adapter)) + goto out; /* Nothing to do */ + ixgbe_update_link_status(adapter); ixgbe_update_stats_counters(adapter); if (ixgbe_display_debug_stats && ifp->if_drv_flags & IFF_DRV_RUNNING) { ixgbe_print_hw_stats(adapter); } /* - * Each second we check the watchdog + * Each tick we check the watchdog * to protect against hardware hangs. */ ixgbe_watchdog(adapter); +out: + /* Trigger an RX interrupt on all queues */ + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, adapter->rx_mask); + callout_reset(&adapter->timer, hz, ixgbe_local_timer, adapter); } @@ -1701,6 +1868,11 @@ ixgbe_allocate_msix(struct adapter *adap } txr->msix = vector; txr->eims = IXGBE_IVAR_TX_QUEUE(vector); + TASK_INIT(&txr->tx_task, 0, ixgbe_handle_tx, txr); + txr->tq = taskqueue_create_fast("ixgbe_txq", M_NOWAIT, + taskqueue_thread_enqueue, &txr->tq); + taskqueue_start_threads(&txr->tq, 1, PI_NET, "%s txq", + device_get_nameunit(adapter->dev)); } /* RX setup */ @@ -1725,6 +1897,13 @@ ixgbe_allocate_msix(struct adapter *adap } rxr->msix = vector; rxr->eims = IXGBE_IVAR_RX_QUEUE(vector); + /* used in local timer */ + adapter->rx_mask |= rxr->eims; + TASK_INIT(&rxr->rx_task, 0, ixgbe_handle_rx, rxr); + rxr->tq = taskqueue_create_fast("ixgbe_rxq", M_NOWAIT, + taskqueue_thread_enqueue, &rxr->tq); + taskqueue_start_threads(&rxr->tq, 1, PI_NET, "%s rxq", + device_get_nameunit(adapter->dev)); } /* Now for Link changes */ @@ -1759,11 +1938,20 @@ ixgbe_setup_msix(struct adapter *adapter device_t dev = adapter->dev; int rid, want, queues, msgs; + /* Override by tuneable */ + if (ixgbe_enable_msix == 0) + goto msi; + /* First try MSI/X */ - rid = PCIR_BAR(IXGBE_MSIX_BAR); + rid = PCIR_BAR(MSIX_82598_BAR); adapter->msix_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (!adapter->msix_mem) { + rid += 4; /* 82599 maps in higher BAR */ + adapter->msix_mem = bus_alloc_resource_any(dev, + SYS_RES_MEMORY, &rid, RF_ACTIVE); + } + if (!adapter->msix_mem) { /* May not be enabled */ device_printf(adapter->dev, "Unable to map MSIX table \n"); @@ -1773,7 +1961,7 @@ ixgbe_setup_msix(struct adapter *adapter msgs = pci_msix_count(dev); if (msgs == 0) { /* system has msix disabled */ bus_release_resource(dev, SYS_RES_MEMORY, - PCIR_BAR(IXGBE_MSIX_BAR), adapter->msix_mem); + rid, adapter->msix_mem); adapter->msix_mem = NULL; goto msi; } @@ -1853,7 +2041,8 @@ ixgbe_allocate_pci_resources(struct adap static void ixgbe_free_pci_resources(struct adapter * adapter) { - device_t dev = adapter->dev; + device_t dev = adapter->dev; + int rid; /* * Legacy has this set to 0, but we need @@ -1862,6 +2051,8 @@ ixgbe_free_pci_resources(struct adapter if (adapter->msix == 0) adapter->msix = 1; + rid = PCIR_BAR(MSIX_82598_BAR); + /* * First release all the interrupt resources: * notice that since these are just kept @@ -1885,7 +2076,7 @@ ixgbe_free_pci_resources(struct adapter if (adapter->msix_mem != NULL) bus_release_resource(dev, SYS_RES_MEMORY, - PCIR_BAR(IXGBE_MSIX_BAR), adapter->msix_mem); + rid, adapter->msix_mem); if (adapter->pci_mem != NULL) bus_release_resource(dev, SYS_RES_MEMORY, @@ -1920,7 +2111,7 @@ ixgbe_hardware_init(struct adapter *adap } /* Get Hardware Flow Control setting */ - adapter->hw.fc.type = ixgbe_fc_full; + adapter->hw.fc.requested_mode = ixgbe_fc_full; adapter->hw.fc.pause_time = IXGBE_FC_PAUSE; adapter->hw.fc.low_water = IXGBE_FC_LO; adapter->hw.fc.high_water = IXGBE_FC_HI; @@ -1977,8 +2168,7 @@ ixgbe_setup_interface(device_t dev, stru ifp->if_capenable = ifp->if_capabilities; - if ((hw->device_id == IXGBE_DEV_ID_82598AT) || - (hw->device_id == IXGBE_DEV_ID_82598AT_DUAL_PORT)) + if (hw->device_id == IXGBE_DEV_ID_82598AT) ixgbe_setup_link_speed(hw, (IXGBE_LINK_SPEED_10GB_FULL | IXGBE_LINK_SPEED_1GB_FULL), TRUE, TRUE); else @@ -1991,10 +2181,9 @@ ixgbe_setup_interface(device_t dev, stru */ ifmedia_init(&adapter->media, IFM_IMASK, ixgbe_media_change, ixgbe_media_status); - ifmedia_add(&adapter->media, IFM_ETHER | ixgbe_optics | + ifmedia_add(&adapter->media, IFM_ETHER | adapter->optics | IFM_FDX, 0, NULL); - if ((hw->device_id == IXGBE_DEV_ID_82598AT) || - (hw->device_id == IXGBE_DEV_ID_82598AT_DUAL_PORT)) { + if (hw->device_id == IXGBE_DEV_ID_82598AT) { ifmedia_add(&adapter->media, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL); ifmedia_add(&adapter->media, @@ -2095,7 +2284,6 @@ ixgbe_allocate_queues(struct adapter *ad struct tx_ring *txr; struct rx_ring *rxr; int rsize, tsize, error = IXGBE_SUCCESS; - char name_string[16]; int txconf = 0, rxconf = 0; /* First allocate the TX ring struct memory */ @@ -2134,9 +2322,9 @@ ixgbe_allocate_queues(struct adapter *ad txr->me = i; /* Initialize the TX side lock */ - snprintf(name_string, sizeof(name_string), "%s:tx(%d)", + snprintf(txr->mtx_name, sizeof(txr->mtx_name), "%s:tx(%d)", device_get_nameunit(dev), txr->me); - mtx_init(&txr->tx_mtx, name_string, NULL, MTX_DEF); + mtx_init(&txr->tx_mtx, txr->mtx_name, NULL, MTX_DEF); if (ixgbe_dma_malloc(adapter, tsize, &txr->txdma, BUS_DMA_NOWAIT)) { @@ -2169,10 +2357,10 @@ ixgbe_allocate_queues(struct adapter *ad rxr->adapter = adapter; rxr->me = i; - /* Initialize the TX side lock */ - snprintf(name_string, sizeof(name_string), "%s:rx(%d)", + /* Initialize the RX side lock */ + snprintf(rxr->mtx_name, sizeof(rxr->mtx_name), "%s:rx(%d)", device_get_nameunit(dev), rxr->me); - mtx_init(&rxr->rx_mtx, name_string, NULL, MTX_DEF); + mtx_init(&rxr->rx_mtx, rxr->mtx_name, NULL, MTX_DEF); if (ixgbe_dma_malloc(adapter, rsize, &rxr->rxdma, BUS_DMA_NOWAIT)) { @@ -2554,11 +2742,6 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, TXD->seqnum_seed = htole32(0); TXD->mss_l4len_idx = htole32(0); -#ifndef NO_82598_A0_SUPPORT - if (adapter->hw.revision_id == 0) - desc_flip(TXD); -#endif - tx_buffer->m_head = NULL; /* We've consumed the first desc, adjust counters */ @@ -2652,11 +2835,6 @@ ixgbe_tso_setup(struct tx_ring *txr, str TXD->seqnum_seed = htole32(0); tx_buffer->m_head = NULL; -#ifndef NO_82598_A0_SUPPORT - if (adapter->hw.revision_id == 0) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 23:57:23 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA3AA1065673; Wed, 26 Nov 2008 23:57:23 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 99F2B8FC1E; Wed, 26 Nov 2008 23:57:23 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQNvN88070051; Wed, 26 Nov 2008 23:57:23 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQNvNeZ070047; Wed, 26 Nov 2008 23:57:23 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200811262357.mAQNvNeZ070047@svn.freebsd.org> From: Jack F Vogel Date: Wed, 26 Nov 2008 23:57:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185353 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 23:57:23 -0000 Author: jfv Date: Wed Nov 26 23:57:23 2008 New Revision: 185353 URL: http://svn.freebsd.org/changeset/base/185353 Log: This delta is primarily a fix for es2lan devices that will sometimes fail to initialize problem due to a lock contention with management hardware. However, in order to deliver that fix it was necessary to take a shared code update as a whole, and this required scattered changes in the core code to be compatible. The em driver now has VLAN HW support added as the igb driver had previously. MFC after: ASAP - in time for 7.1 RELEASE Modified: head/sys/dev/e1000/e1000_80003es2lan.c head/sys/dev/e1000/e1000_82540.c head/sys/dev/e1000/e1000_82541.c head/sys/dev/e1000/e1000_82542.c head/sys/dev/e1000/e1000_82543.c head/sys/dev/e1000/e1000_82571.c head/sys/dev/e1000/e1000_82575.c head/sys/dev/e1000/e1000_82575.h head/sys/dev/e1000/e1000_api.c head/sys/dev/e1000/e1000_api.h head/sys/dev/e1000/e1000_defines.h head/sys/dev/e1000/e1000_hw.h head/sys/dev/e1000/e1000_ich8lan.c head/sys/dev/e1000/e1000_ich8lan.h head/sys/dev/e1000/e1000_mac.c head/sys/dev/e1000/e1000_mac.h head/sys/dev/e1000/e1000_manage.c head/sys/dev/e1000/e1000_nvm.c head/sys/dev/e1000/e1000_osdep.c head/sys/dev/e1000/e1000_osdep.h head/sys/dev/e1000/e1000_phy.c head/sys/dev/e1000/e1000_phy.h head/sys/dev/e1000/e1000_regs.h head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/e1000_80003es2lan.c ============================================================================== --- head/sys/dev/e1000/e1000_80003es2lan.c Wed Nov 26 23:41:18 2008 (r185352) +++ head/sys/dev/e1000/e1000_80003es2lan.c Wed Nov 26 23:57:23 2008 (r185353) @@ -32,7 +32,9 @@ ******************************************************************************/ /*$FreeBSD$*/ -/* e1000_80003es2lan +/* + * 80003ES2LAN Gigabit Ethernet Controller (Copper) + * 80003ES2LAN Gigabit Ethernet Controller (Serdes) */ #include "e1000_api.h" @@ -41,7 +43,9 @@ static s32 e1000_init_phy_params_80003e static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw); static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw); static s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw); +static s32 e1000_acquire_mac_csr_80003es2lan(struct e1000_hw *hw); static void e1000_release_phy_80003es2lan(struct e1000_hw *hw); +static void e1000_release_mac_csr_80003es2lan(struct e1000_hw *hw); static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw); static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw); static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, @@ -64,6 +68,11 @@ static void e1000_clear_hw_cntrs_80003es static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex); static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw); +static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw); +static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, + u16 *data); +static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, + u16 data); static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw); static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw); static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); @@ -84,8 +93,6 @@ static const u16 e1000_gg82563_cable_len /** * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs. * @hw: pointer to the HW structure - * - * This is a function pointer entry point called by the api module. **/ static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw) { @@ -122,6 +129,8 @@ static s32 e1000_init_phy_params_80003es phy->ops.read_reg = e1000_read_phy_reg_gg82563_80003es2lan; phy->ops.write_reg = e1000_write_phy_reg_gg82563_80003es2lan; + phy->ops.cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan; + /* This can only be done after all function pointers are setup. */ ret_val = e1000_get_phy_id(hw); @@ -138,8 +147,6 @@ out: /** * e1000_init_nvm_params_80003es2lan - Init ESB2 NVM func ptrs. * @hw: pointer to the HW structure - * - * This is a function pointer entry point called by the api module. **/ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) { @@ -197,8 +204,6 @@ static s32 e1000_init_nvm_params_80003es /** * e1000_init_mac_params_80003es2lan - Init ESB2 MAC func ptrs. * @hw: pointer to the HW structure - * - * This is a function pointer entry point called by the api module. **/ static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) { @@ -280,8 +285,6 @@ static s32 e1000_init_mac_params_80003es /* turn on/off LED */ mac->ops.led_on = e1000_led_on_generic; mac->ops.led_off = e1000_led_off_generic; - /* remove device */ - mac->ops.remove_device = e1000_remove_device_generic; /* clear hardware counters */ mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_80003es2lan; /* link info */ @@ -295,8 +298,7 @@ out: * e1000_init_function_pointers_80003es2lan - Init ESB2 func ptrs. * @hw: pointer to the HW structure * - * The only function explicitly called by the api module to initialize - * all function pointers and parameters. + * Called to initialize all function pointers and parameters. **/ void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw) { @@ -305,14 +307,14 @@ void e1000_init_function_pointers_80003e hw->mac.ops.init_params = e1000_init_mac_params_80003es2lan; hw->nvm.ops.init_params = e1000_init_nvm_params_80003es2lan; hw->phy.ops.init_params = e1000_init_phy_params_80003es2lan; + e1000_get_bus_info_pcie_generic(hw); } /** * e1000_acquire_phy_80003es2lan - Acquire rights to access PHY * @hw: pointer to the HW structure * - * A wrapper to acquire access rights to the correct PHY. This is a - * function pointer entry point called by the api module. + * A wrapper to acquire access rights to the correct PHY. **/ static s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw) { @@ -321,8 +323,6 @@ static s32 e1000_acquire_phy_80003es2lan DEBUGFUNC("e1000_acquire_phy_80003es2lan"); mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; - mask |= E1000_SWFW_CSR_SM; - return e1000_acquire_swfw_sync_80003es2lan(hw, mask); } @@ -330,8 +330,7 @@ static s32 e1000_acquire_phy_80003es2lan * e1000_release_phy_80003es2lan - Release rights to access PHY * @hw: pointer to the HW structure * - * A wrapper to release access rights to the correct PHY. This is a - * function pointer entry point called by the api module. + * A wrapper to release access rights to the correct PHY. **/ static void e1000_release_phy_80003es2lan(struct e1000_hw *hw) { @@ -340,7 +339,41 @@ static void e1000_release_phy_80003es2la DEBUGFUNC("e1000_release_phy_80003es2lan"); mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; - mask |= E1000_SWFW_CSR_SM; + e1000_release_swfw_sync_80003es2lan(hw, mask); +} + + +/** + * e1000_acquire_mac_csr_80003es2lan - Acquire rights to access Kumeran register + * @hw: pointer to the HW structure + * + * Acquire the semaphore to access the Kumeran interface. + * + **/ +static s32 e1000_acquire_mac_csr_80003es2lan(struct e1000_hw *hw) +{ + u16 mask; + + DEBUGFUNC("e1000_acquire_mac_csr_80003es2lan"); + + mask = E1000_SWFW_CSR_SM; + + return e1000_acquire_swfw_sync_80003es2lan(hw, mask); +} + +/** + * e1000_release_mac_csr_80003es2lan - Release rights to access Kumeran Register + * @hw: pointer to the HW structure + * + * Release the semaphore used to access the Kumeran interface + **/ +static void e1000_release_mac_csr_80003es2lan(struct e1000_hw *hw) +{ + u16 mask; + + DEBUGFUNC("e1000_release_mac_csr_80003es2lan"); + + mask = E1000_SWFW_CSR_SM; e1000_release_swfw_sync_80003es2lan(hw, mask); } @@ -349,8 +382,7 @@ static void e1000_release_phy_80003es2la * e1000_acquire_nvm_80003es2lan - Acquire rights to access NVM * @hw: pointer to the HW structure * - * Acquire the semaphore to access the EEPROM. This is a function - * pointer entry point called by the api module. + * Acquire the semaphore to access the EEPROM. **/ static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw) { @@ -375,8 +407,7 @@ out: * e1000_release_nvm_80003es2lan - Relinquish rights to access NVM * @hw: pointer to the HW structure * - * Release the semaphore used to access the EEPROM. This is a - * function pointer entry point called by the api module. + * Release the semaphore used to access the EEPROM. **/ static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw) { @@ -400,7 +431,7 @@ static s32 e1000_acquire_swfw_sync_80003 u32 swmask = mask; u32 fwmask = mask << 16; s32 ret_val = E1000_SUCCESS; - s32 i = 0, timeout = 200; + s32 i = 0, timeout = 50; DEBUGFUNC("e1000_acquire_swfw_sync_80003es2lan"); @@ -452,8 +483,8 @@ static void e1000_release_swfw_sync_8000 DEBUGFUNC("e1000_release_swfw_sync_80003es2lan"); - while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS); - /* Empty */ + while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS) + ; /* Empty */ swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); swfw_sync &= ~mask; @@ -468,8 +499,7 @@ static void e1000_release_swfw_sync_8000 * @offset: offset of the register to read * @data: pointer to the data returned from the operation * - * Read the GG82563 PHY register. This is a function pointer entry - * point called by the api module. + * Read the GG82563 PHY register. **/ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, u32 offset, u16 *data) @@ -520,9 +550,8 @@ static s32 e1000_read_phy_reg_gg82563_80 usec_delay(200); - ret_val = e1000_read_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + ret_val = e1000_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, + data); usec_delay(200); e1000_release_phy_80003es2lan(hw); @@ -537,8 +566,7 @@ out: * @offset: offset of the register to read * @data: value to write to the register * - * Write to the GG82563 PHY register. This is a function pointer entry - * point called by the api module. + * Write to the GG82563 PHY register. **/ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, u32 offset, u16 data) @@ -590,8 +618,7 @@ static s32 e1000_write_phy_reg_gg82563_8 usec_delay(200); - ret_val = e1000_write_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, + ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, data); usec_delay(200); @@ -608,8 +635,7 @@ out: * @words: number of words to write * @data: buffer of data to write to the NVM * - * Write "words" of data to the ESB2 NVM. This is a function - * pointer entry point called by the api module. + * Write "words" of data to the ESB2 NVM. **/ static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) @@ -775,10 +801,17 @@ static s32 e1000_get_cable_length_80003e goto out; index = phy_data & GG82563_DSPD_CABLE_LENGTH; - phy->min_cable_length = e1000_gg82563_cable_length_table[index]; - phy->max_cable_length = e1000_gg82563_cable_length_table[index+5]; - phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; + if (index < GG82563_CABLE_LENGTH_TABLE_SIZE + 5) { + phy->min_cable_length = e1000_gg82563_cable_length_table[index]; + phy->max_cable_length = + e1000_gg82563_cable_length_table[index+5]; + + phy->cable_length = (phy->min_cable_length + + phy->max_cable_length) / 2; + } else { + ret_val = E1000_ERR_PHY; + } out: return ret_val; @@ -791,7 +824,6 @@ out: * @duplex: pointer to duplex buffer * * Retrieve the current speed and duplex configuration. - * This is a function pointer entry point called by the api module. **/ static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, u16 *duplex) @@ -804,20 +836,13 @@ static s32 e1000_get_link_up_info_80003e ret_val = e1000_get_speed_and_duplex_copper_generic(hw, speed, duplex); - if (ret_val) - goto out; - if (*speed == SPEED_1000) - ret_val = e1000_cfg_kmrn_1000_80003es2lan(hw); - else - ret_val = e1000_cfg_kmrn_10_100_80003es2lan(hw, - *duplex); + hw->phy.ops.cfg_on_link_up(hw); } else { ret_val = e1000_get_speed_and_duplex_fiber_serdes_generic(hw, speed, duplex); } -out: return ret_val; } @@ -826,7 +851,6 @@ out: * @hw: pointer to the HW structure * * Perform a global reset to the ESB2 controller. - * This is a function pointer entry point called by the api module. **/ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw) { @@ -840,9 +864,8 @@ static s32 e1000_reset_hw_80003es2lan(st * on the last TLP read/write transaction when MAC is reset. */ ret_val = e1000_disable_pcie_master_generic(hw); - if (ret_val) { + if (ret_val) DEBUGOUT("PCI-E Master disable polling has failed.\n"); - } DEBUGOUT("Masking off all interrupts\n"); E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); @@ -855,8 +878,10 @@ static s32 e1000_reset_hw_80003es2lan(st ctrl = E1000_READ_REG(hw, E1000_CTRL); + ret_val = e1000_acquire_phy_80003es2lan(hw); DEBUGOUT("Issuing a global reset to MAC\n"); E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_RST); + e1000_release_phy_80003es2lan(hw); ret_val = e1000_get_auto_rd_done_generic(hw); if (ret_val) @@ -878,7 +903,6 @@ out: * @hw: pointer to the HW structure * * Initialize the hw bits, LED, VFTA, MTA, link and hw counters. - * This is a function pointer entry point called by the api module. **/ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) { @@ -969,9 +993,6 @@ static void e1000_initialize_hw_bits_800 DEBUGFUNC("e1000_initialize_hw_bits_80003es2lan"); - if (hw->mac.disable_hw_init_bits) - goto out; - /* Transmit Descriptor Control 0 */ reg = E1000_READ_REG(hw, E1000_TXDCTL(0)); reg |= (1 << 22); @@ -997,7 +1018,6 @@ static void e1000_initialize_hw_bits_800 reg |= (1 << 28); E1000_WRITE_REG(hw, E1000_TARC(1), reg); -out: return; } @@ -1012,8 +1032,7 @@ static s32 e1000_copper_link_setup_gg825 struct e1000_phy_info *phy = &hw->phy; s32 ret_val; u32 ctrl_ext; - u32 i = 0; - u16 data, data2; + u16 data; DEBUGFUNC("e1000_copper_link_setup_gg82563_80003es2lan"); @@ -1084,20 +1103,20 @@ static s32 e1000_copper_link_setup_gg825 } /* Bypass Rx and Tx FIFO's */ - ret_val = e1000_write_kmrn_reg_generic(hw, + ret_val = e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL, E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS | E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS); if (ret_val) goto out; - ret_val = e1000_read_kmrn_reg_generic(hw, + ret_val = e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, &data); if (ret_val) goto out; data |= E1000_KMRNCTRLSTA_OPMODE_E_IDLE; - ret_val = e1000_write_kmrn_reg_generic(hw, + ret_val = e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, data); if (ret_val) @@ -1129,30 +1148,20 @@ static s32 e1000_copper_link_setup_gg825 /* Enable Electrical Idle on the PHY */ data |= GG82563_PMCR_ENABLE_ELECTRICAL_IDLE; ret_val = hw->phy.ops.write_reg(hw, - GG82563_PHY_PWR_MGMT_CTRL, - data); + GG82563_PHY_PWR_MGMT_CTRL, + data); if (ret_val) goto out; - - do { - ret_val = hw->phy.ops.read_reg(hw, - GG82563_PHY_KMRN_MODE_CTRL, - &data); - if (ret_val) - goto out; - - ret_val = hw->phy.ops.read_reg(hw, - GG82563_PHY_KMRN_MODE_CTRL, - &data2); + ret_val = hw->phy.ops.read_reg(hw, + GG82563_PHY_KMRN_MODE_CTRL, + &data); if (ret_val) goto out; - i++; - } while ((data != data2) && (i < GG82563_MAX_KMRN_RETRY)); data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; ret_val = hw->phy.ops.write_reg(hw, - GG82563_PHY_KMRN_MODE_CTRL, - data); + GG82563_PHY_KMRN_MODE_CTRL, + data); if (ret_val) goto out; @@ -1185,7 +1194,7 @@ out: static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw) { u32 ctrl; - s32 ret_val; + s32 ret_val; u16 reg_data; DEBUGFUNC("e1000_setup_copper_link_80003es2lan"); @@ -1200,26 +1209,26 @@ static s32 e1000_setup_copper_link_80003 * iteration and increase the max iterations when * polling the phy; this fixes erroneous timeouts at 10Mbps. */ - ret_val = e1000_write_kmrn_reg_generic(hw, GG82563_REG(0x34, 4), - 0xFFFF); + ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 4), + 0xFFFF); if (ret_val) goto out; - ret_val = e1000_read_kmrn_reg_generic(hw, GG82563_REG(0x34, 9), - ®_data); + ret_val = e1000_read_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9), + ®_data); if (ret_val) goto out; reg_data |= 0x3F; - ret_val = e1000_write_kmrn_reg_generic(hw, GG82563_REG(0x34, 9), - reg_data); + ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9), + reg_data); if (ret_val) goto out; - ret_val = e1000_read_kmrn_reg_generic(hw, + ret_val = e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, ®_data); if (ret_val) goto out; reg_data |= E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING; - ret_val = e1000_write_kmrn_reg_generic(hw, + ret_val = e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, reg_data); if (ret_val) @@ -1236,6 +1245,40 @@ out: } /** + * e1000_cfg_on_link_up_80003es2lan - es2 link configuration after link-up + * @hw: pointer to the HW structure + * @duplex: current duplex setting + * + * Configure the KMRN interface by applying last minute quirks for + * 10/100 operation. + **/ +static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u16 speed; + u16 duplex; + + DEBUGFUNC("e1000_configure_on_link_up"); + + if (hw->phy.media_type == e1000_media_type_copper) { + + ret_val = e1000_get_speed_and_duplex_copper_generic(hw, + &speed, + &duplex); + if (ret_val) + goto out; + + if (speed == SPEED_1000) + ret_val = e1000_cfg_kmrn_1000_80003es2lan(hw); + else + ret_val = e1000_cfg_kmrn_10_100_80003es2lan(hw, duplex); + } + +out: + return ret_val; +} + +/** * e1000_cfg_kmrn_10_100_80003es2lan - Apply "quirks" for 10/100 operation * @hw: pointer to the HW structure * @duplex: current duplex setting @@ -1253,7 +1296,7 @@ static s32 e1000_cfg_kmrn_10_100_80003es DEBUGFUNC("e1000_configure_kmrn_for_10_100"); reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT; - ret_val = e1000_write_kmrn_reg_generic(hw, + ret_val = e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, reg_data); if (ret_val) @@ -1268,12 +1311,12 @@ static s32 e1000_cfg_kmrn_10_100_80003es do { ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data); + ®_data); if (ret_val) goto out; ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data2); + ®_data2); if (ret_val) goto out; i++; @@ -1307,7 +1350,7 @@ static s32 e1000_cfg_kmrn_1000_80003es2l DEBUGFUNC("e1000_configure_kmrn_for_1000"); reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT; - ret_val = e1000_write_kmrn_reg_generic(hw, + ret_val = e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, reg_data); if (ret_val) @@ -1322,12 +1365,12 @@ static s32 e1000_cfg_kmrn_1000_80003es2l do { ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data); + ®_data); if (ret_val) goto out; ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data2); + ®_data2); if (ret_val) goto out; i++; @@ -1341,6 +1384,75 @@ out: } /** + * e1000_read_kmrn_reg_80003es2lan - Read kumeran register + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data + * + * Acquire semaphore, then read the PHY register at offset + * using the kumeran interface. The information retrieved is stored in data. + * Release the semaphore before exiting. + **/ +s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, u16 *data) +{ + u32 kmrnctrlsta; + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_read_kmrn_reg_80003es2lan"); + + ret_val = e1000_acquire_mac_csr_80003es2lan(hw); + if (ret_val) + goto out; + + kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & + E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; + E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); + + usec_delay(2); + + kmrnctrlsta = E1000_READ_REG(hw, E1000_KMRNCTRLSTA); + *data = (u16)kmrnctrlsta; + + e1000_release_mac_csr_80003es2lan(hw); + +out: + return ret_val; +} + +/** + * e1000_write_kmrn_reg_80003es2lan - Write kumeran register + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset + * + * Acquire semaphore, then write the data to PHY register + * at the offset using the kumeran interface. Release semaphore + * before exiting. + **/ +s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, u16 data) +{ + u32 kmrnctrlsta; + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_write_kmrn_reg_80003es2lan"); + + ret_val = e1000_acquire_mac_csr_80003es2lan(hw); + if (ret_val) + goto out; + + kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & + E1000_KMRNCTRLSTA_OFFSET) | data; + E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); + + usec_delay(2); + + e1000_release_mac_csr_80003es2lan(hw); + +out: + return ret_val; +} + +/** * e1000_read_mac_addr_80003es2lan - Read device MAC address * @hw: pointer to the HW structure **/ @@ -1380,44 +1492,42 @@ static void e1000_power_down_phy_copper_ **/ static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw) { - volatile u32 temp; - DEBUGFUNC("e1000_clear_hw_cntrs_80003es2lan"); e1000_clear_hw_cntrs_base_generic(hw); - temp = E1000_READ_REG(hw, E1000_PRC64); - temp = E1000_READ_REG(hw, E1000_PRC127); - temp = E1000_READ_REG(hw, E1000_PRC255); - temp = E1000_READ_REG(hw, E1000_PRC511); - temp = E1000_READ_REG(hw, E1000_PRC1023); - temp = E1000_READ_REG(hw, E1000_PRC1522); - temp = E1000_READ_REG(hw, E1000_PTC64); - temp = E1000_READ_REG(hw, E1000_PTC127); - temp = E1000_READ_REG(hw, E1000_PTC255); - temp = E1000_READ_REG(hw, E1000_PTC511); - temp = E1000_READ_REG(hw, E1000_PTC1023); - temp = E1000_READ_REG(hw, E1000_PTC1522); - - temp = E1000_READ_REG(hw, E1000_ALGNERRC); - temp = E1000_READ_REG(hw, E1000_RXERRC); - temp = E1000_READ_REG(hw, E1000_TNCRS); - temp = E1000_READ_REG(hw, E1000_CEXTERR); - temp = E1000_READ_REG(hw, E1000_TSCTC); - temp = E1000_READ_REG(hw, E1000_TSCTFC); - - temp = E1000_READ_REG(hw, E1000_MGTPRC); - temp = E1000_READ_REG(hw, E1000_MGTPDC); - temp = E1000_READ_REG(hw, E1000_MGTPTC); - - temp = E1000_READ_REG(hw, E1000_IAC); - temp = E1000_READ_REG(hw, E1000_ICRXOC); - - temp = E1000_READ_REG(hw, E1000_ICRXPTC); - temp = E1000_READ_REG(hw, E1000_ICRXATC); - temp = E1000_READ_REG(hw, E1000_ICTXPTC); - temp = E1000_READ_REG(hw, E1000_ICTXATC); - temp = E1000_READ_REG(hw, E1000_ICTXQEC); - temp = E1000_READ_REG(hw, E1000_ICTXQMTC); - temp = E1000_READ_REG(hw, E1000_ICRXDMTC); + E1000_READ_REG(hw, E1000_PRC64); + E1000_READ_REG(hw, E1000_PRC127); + E1000_READ_REG(hw, E1000_PRC255); + E1000_READ_REG(hw, E1000_PRC511); + E1000_READ_REG(hw, E1000_PRC1023); + E1000_READ_REG(hw, E1000_PRC1522); + E1000_READ_REG(hw, E1000_PTC64); + E1000_READ_REG(hw, E1000_PTC127); + E1000_READ_REG(hw, E1000_PTC255); + E1000_READ_REG(hw, E1000_PTC511); + E1000_READ_REG(hw, E1000_PTC1023); + E1000_READ_REG(hw, E1000_PTC1522); + + E1000_READ_REG(hw, E1000_ALGNERRC); + E1000_READ_REG(hw, E1000_RXERRC); + E1000_READ_REG(hw, E1000_TNCRS); + E1000_READ_REG(hw, E1000_CEXTERR); + E1000_READ_REG(hw, E1000_TSCTC); + E1000_READ_REG(hw, E1000_TSCTFC); + + E1000_READ_REG(hw, E1000_MGTPRC); + E1000_READ_REG(hw, E1000_MGTPDC); + E1000_READ_REG(hw, E1000_MGTPTC); + + E1000_READ_REG(hw, E1000_IAC); + E1000_READ_REG(hw, E1000_ICRXOC); + + E1000_READ_REG(hw, E1000_ICRXPTC); + E1000_READ_REG(hw, E1000_ICRXATC); + E1000_READ_REG(hw, E1000_ICTXPTC); + E1000_READ_REG(hw, E1000_ICTXATC); + E1000_READ_REG(hw, E1000_ICTXQEC); + E1000_READ_REG(hw, E1000_ICTXQMTC); + E1000_READ_REG(hw, E1000_ICRXDMTC); } Modified: head/sys/dev/e1000/e1000_82540.c ============================================================================== --- head/sys/dev/e1000/e1000_82540.c Wed Nov 26 23:41:18 2008 (r185352) +++ head/sys/dev/e1000/e1000_82540.c Wed Nov 26 23:57:23 2008 (r185353) @@ -32,11 +32,15 @@ ******************************************************************************/ /*$FreeBSD$*/ -/* e1000_82540 - * e1000_82545 - * e1000_82546 - * e1000_82545_rev_3 - * e1000_82546_rev_3 +/* + * 82540EM Gigabit Ethernet Controller + * 82540EP Gigabit Ethernet Controller + * 82545EM Gigabit Ethernet Controller (Copper) + * 82545EM Gigabit Ethernet Controller (Fiber) + * 82545GM Gigabit Ethernet Controller + * 82546EB Gigabit Ethernet Controller (Copper) + * 82546EB Gigabit Ethernet Controller (Fiber) + * 82546GB Gigabit Ethernet Controller */ #include "e1000_api.h" @@ -57,8 +61,6 @@ static void e1000_power_down_phy_copper_ /** * e1000_init_phy_params_82540 - Init PHY func ptrs. * @hw: pointer to the HW structure - * - * This is a function pointer entry point called by the api module. **/ static s32 e1000_init_phy_params_82540(struct e1000_hw *hw) { @@ -110,8 +112,6 @@ out: /** * e1000_init_nvm_params_82540 - Init NVM func ptrs. * @hw: pointer to the HW structure - * - * This is a function pointer entry point called by the api module. **/ static s32 e1000_init_nvm_params_82540(struct e1000_hw *hw) { @@ -153,8 +153,6 @@ static s32 e1000_init_nvm_params_82540(s /** * e1000_init_mac_params_82540 - Init MAC func ptrs. * @hw: pointer to the HW structure - * - * This is a function pointer entry point called by the api module. **/ static s32 e1000_init_mac_params_82540(struct e1000_hw *hw) { @@ -189,6 +187,8 @@ static s32 e1000_init_mac_params_82540(s /* bus type/speed/width */ mac->ops.get_bus_info = e1000_get_bus_info_pci_generic; + /* function id */ + mac->ops.set_lan_id = e1000_set_lan_id_multi_port_pci; /* reset */ mac->ops.reset_hw = e1000_reset_hw_82540; /* hw initialization */ @@ -247,8 +247,7 @@ out: * e1000_init_function_pointers_82540 - Init func ptrs. * @hw: pointer to the HW structure * - * The only function explicitly called by the api module to initialize - * all function pointers and parameters. + * Called to initialize all function pointers and parameters. **/ void e1000_init_function_pointers_82540(struct e1000_hw *hw) { @@ -263,8 +262,7 @@ void e1000_init_function_pointers_82540( * e1000_reset_hw_82540 - Reset hardware * @hw: pointer to the HW structure * - * This resets the hardware into a known state. This is a - * function pointer entry point called by the api module. + * This resets the hardware into a known state. **/ static s32 e1000_reset_hw_82540(struct e1000_hw *hw) { @@ -322,8 +320,7 @@ static s32 e1000_reset_hw_82540(struct e * e1000_init_hw_82540 - Initialize hardware * @hw: pointer to the HW structure * - * This inits the hardware readying it for operation. This is a - * function pointer entry point called by the api module. + * This inits the hardware readying it for operation. **/ static s32 e1000_init_hw_82540(struct e1000_hw *hw) { @@ -406,8 +403,7 @@ static s32 e1000_init_hw_82540(struct e1 * Calls the appropriate function to configure the link for auto-neg or forced * speed and duplex. Then we check for link, once link is established calls * to configure collision distance and flow control are called. If link is - * not established, we return -E1000_ERR_PHY (-2). This is a function - * pointer entry point called by the api module. + * not established, we return -E1000_ERR_PHY (-2). **/ static s32 e1000_setup_copper_link_82540(struct e1000_hw *hw) { @@ -454,8 +450,7 @@ out: * Set the output amplitude to the value in the EEPROM and adjust the VCO * speed to improve Bit Error Rate (BER) performance. Configures collision * distance and flow control for fiber and serdes links. Upon successful - * setup, poll for link. This is a function pointer entry point called by - * the api module. + * setup, poll for link. **/ static s32 e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw) { @@ -650,34 +645,32 @@ static void e1000_power_down_phy_copper_ **/ static void e1000_clear_hw_cntrs_82540(struct e1000_hw *hw) { - volatile u32 temp; - DEBUGFUNC("e1000_clear_hw_cntrs_82540"); e1000_clear_hw_cntrs_base_generic(hw); - temp = E1000_READ_REG(hw, E1000_PRC64); - temp = E1000_READ_REG(hw, E1000_PRC127); - temp = E1000_READ_REG(hw, E1000_PRC255); - temp = E1000_READ_REG(hw, E1000_PRC511); - temp = E1000_READ_REG(hw, E1000_PRC1023); - temp = E1000_READ_REG(hw, E1000_PRC1522); - temp = E1000_READ_REG(hw, E1000_PTC64); - temp = E1000_READ_REG(hw, E1000_PTC127); - temp = E1000_READ_REG(hw, E1000_PTC255); - temp = E1000_READ_REG(hw, E1000_PTC511); - temp = E1000_READ_REG(hw, E1000_PTC1023); - temp = E1000_READ_REG(hw, E1000_PTC1522); - - temp = E1000_READ_REG(hw, E1000_ALGNERRC); - temp = E1000_READ_REG(hw, E1000_RXERRC); - temp = E1000_READ_REG(hw, E1000_TNCRS); - temp = E1000_READ_REG(hw, E1000_CEXTERR); - temp = E1000_READ_REG(hw, E1000_TSCTC); - temp = E1000_READ_REG(hw, E1000_TSCTFC); - - temp = E1000_READ_REG(hw, E1000_MGTPRC); - temp = E1000_READ_REG(hw, E1000_MGTPDC); - temp = E1000_READ_REG(hw, E1000_MGTPTC); + E1000_READ_REG(hw, E1000_PRC64); + E1000_READ_REG(hw, E1000_PRC127); + E1000_READ_REG(hw, E1000_PRC255); + E1000_READ_REG(hw, E1000_PRC511); + E1000_READ_REG(hw, E1000_PRC1023); + E1000_READ_REG(hw, E1000_PRC1522); + E1000_READ_REG(hw, E1000_PTC64); + E1000_READ_REG(hw, E1000_PTC127); + E1000_READ_REG(hw, E1000_PTC255); + E1000_READ_REG(hw, E1000_PTC511); + E1000_READ_REG(hw, E1000_PTC1023); + E1000_READ_REG(hw, E1000_PTC1522); + + E1000_READ_REG(hw, E1000_ALGNERRC); + E1000_READ_REG(hw, E1000_RXERRC); + E1000_READ_REG(hw, E1000_TNCRS); + E1000_READ_REG(hw, E1000_CEXTERR); + E1000_READ_REG(hw, E1000_TSCTC); + E1000_READ_REG(hw, E1000_TSCTFC); + + E1000_READ_REG(hw, E1000_MGTPRC); + E1000_READ_REG(hw, E1000_MGTPDC); + E1000_READ_REG(hw, E1000_MGTPTC); } Modified: head/sys/dev/e1000/e1000_82541.c ============================================================================== --- head/sys/dev/e1000/e1000_82541.c Wed Nov 26 23:41:18 2008 (r185352) +++ head/sys/dev/e1000/e1000_82541.c Wed Nov 26 23:57:23 2008 (r185353) @@ -32,10 +32,13 @@ ******************************************************************************/ /*$FreeBSD$*/ -/* e1000_82541 - * e1000_82547 - * e1000_82541_rev_2 - * e1000_82547_rev_2 +/* + * 82541EI Gigabit Ethernet Controller + * 82541ER Gigabit Ethernet Controller + * 82541GI Gigabit Ethernet Controller + * 82541PI Gigabit Ethernet Controller + * 82547EI Gigabit Ethernet Controller + * 82547GI Gigabit Ethernet Controller */ #include "e1000_api.h" @@ -74,18 +77,9 @@ static const u16 e1000_igp_cable_length_ (sizeof(e1000_igp_cable_length_table) / \ sizeof(e1000_igp_cable_length_table[0])) -struct e1000_dev_spec_82541 { - enum e1000_dsp_config dsp_config; - enum e1000_ffe_config ffe_config; - u16 spd_default; - bool phy_init_script; -}; - /** * e1000_init_phy_params_82541 - Init PHY func ptrs. * @hw: pointer to the HW structure - * - * This is a function pointer entry point called by the api module. **/ static s32 e1000_init_phy_params_82541(struct e1000_hw *hw) { @@ -129,8 +123,6 @@ out: /** * e1000_init_nvm_params_82541 - Init NVM func ptrs. * @hw: pointer to the HW structure - * - * This is a function pointer entry point called by the api module. **/ static s32 e1000_init_nvm_params_82541(struct e1000_hw *hw) { @@ -227,13 +219,10 @@ out: /** * e1000_init_mac_params_82541 - Init MAC func ptrs. * @hw: pointer to the HW structure - * - * This is a function pointer entry point called by the api module. **/ static s32 e1000_init_mac_params_82541(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; - s32 ret_val; DEBUGFUNC("e1000_init_mac_params_82541"); @@ -250,6 +239,8 @@ static s32 e1000_init_mac_params_82541(s /* bus type/speed/width */ mac->ops.get_bus_info = e1000_get_bus_info_pci_generic; + /* function id */ + mac->ops.set_lan_id = e1000_set_lan_id_single_port; /* reset */ mac->ops.reset_hw = e1000_reset_hw_82541; /* hw initialization */ @@ -277,25 +268,17 @@ static s32 e1000_init_mac_params_82541(s /* turn on/off LED */ mac->ops.led_on = e1000_led_on_generic; mac->ops.led_off = e1000_led_off_generic; - /* remove device */ - mac->ops.remove_device = e1000_remove_device_generic; /* clear hardware counters */ mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_82541; - hw->dev_spec_size = sizeof(struct e1000_dev_spec_82541); - - /* Device-specific structure allocation */ - ret_val = e1000_alloc_zeroed_dev_spec_struct(hw, hw->dev_spec_size); - - return ret_val; + return E1000_SUCCESS; } /** * e1000_init_function_pointers_82541 - Init func ptrs. * @hw: pointer to the HW structure * - * The only function explicitly called by the api module to initialize - * all function pointers and parameters. + * Called to initialize all function pointers and parameters. **/ void e1000_init_function_pointers_82541(struct e1000_hw *hw) { @@ -310,8 +293,7 @@ void e1000_init_function_pointers_82541( * e1000_reset_hw_82541 - Reset hardware * @hw: pointer to the HW structure * - * This resets the hardware into a known state. This is a - * function pointer entry point called by the api module. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 01:35:02 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E623F1065673; Thu, 27 Nov 2008 01:35:02 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from publicd.ub.mng.net (publicd.ub.mng.net [202.179.0.88]) by mx1.freebsd.org (Postfix) with ESMTP id 70B388FC13; Thu, 27 Nov 2008 01:35:01 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from [202.179.0.164] (helo=daemon.micom.mng.net) by publicd.ub.mng.net with esmtpa (Exim 4.69 (FreeBSD)) (envelope-from ) id 1L5VmV-0005Wd-Kp; Thu, 27 Nov 2008 09:34:59 +0800 Message-ID: <492DF943.3050903@micom.mng.net> Date: Thu, 27 Nov 2008 09:34:59 +0800 From: Ganbold User-Agent: Thunderbird 2.0.0.12 (X11/20080415) MIME-Version: 1.0 To: Jack F Vogel References: <200811262357.mAQNvNeZ070047@svn.freebsd.org> In-Reply-To: <200811262357.mAQNvNeZ070047@svn.freebsd.org> X-Enigmail-Version: 0.95.6 OpenPGP: id=78F6425E Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Jack Vogel Subject: Re: svn commit: r185353 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 01:35:03 -0000 How about infinite loop problem in if_igb.c (mentioned in my previous email, CID: 2232) ? thanks, Ganbold Jack F Vogel wrote: > Author: jfv > Date: Wed Nov 26 23:57:23 2008 > New Revision: 185353 > URL: http://svn.freebsd.org/changeset/base/185353 > > Log: > This delta is primarily a fix for es2lan devices that > will sometimes fail to initialize problem due to a lock > contention with management hardware. However, in order to > deliver that fix it was necessary to take a shared code > update as a whole, and this required scattered changes in > the core code to be compatible. > > The em driver now has VLAN HW support added as the igb > driver had previously. > > MFC after: ASAP - in time for 7.1 RELEASE > > Modified: > head/sys/dev/e1000/e1000_80003es2lan.c > head/sys/dev/e1000/e1000_82540.c > head/sys/dev/e1000/e1000_82541.c > head/sys/dev/e1000/e1000_82542.c > head/sys/dev/e1000/e1000_82543.c > head/sys/dev/e1000/e1000_82571.c > head/sys/dev/e1000/e1000_82575.c > head/sys/dev/e1000/e1000_82575.h > head/sys/dev/e1000/e1000_api.c > head/sys/dev/e1000/e1000_api.h > head/sys/dev/e1000/e1000_defines.h > head/sys/dev/e1000/e1000_hw.h > head/sys/dev/e1000/e1000_ich8lan.c > head/sys/dev/e1000/e1000_ich8lan.h > head/sys/dev/e1000/e1000_mac.c > head/sys/dev/e1000/e1000_mac.h > head/sys/dev/e1000/e1000_manage.c > head/sys/dev/e1000/e1000_nvm.c > head/sys/dev/e1000/e1000_osdep.c > head/sys/dev/e1000/e1000_osdep.h > head/sys/dev/e1000/e1000_phy.c > head/sys/dev/e1000/e1000_phy.h > head/sys/dev/e1000/e1000_regs.h > head/sys/dev/e1000/if_em.c > head/sys/dev/e1000/if_em.h > head/sys/dev/e1000/if_igb.c > > Modified: head/sys/dev/e1000/e1000_80003es2lan.c > ============================================================================== > --- head/sys/dev/e1000/e1000_80003es2lan.c Wed Nov 26 23:41:18 2008 (r185352) > +++ head/sys/dev/e1000/e1000_80003es2lan.c Wed Nov 26 23:57:23 2008 (r185353) > @@ -32,7 +32,9 @@ > ******************************************************************************/ > /*$FreeBSD$*/ > > -/* e1000_80003es2lan > +/* > + * 80003ES2LAN Gigabit Ethernet Controller (Copper) > + * 80003ES2LAN Gigabit Ethernet Controller (Serdes) > */ > > #include "e1000_api.h" > @@ -41,7 +43,9 @@ static s32 e1000_init_phy_params_80003e > static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw); > static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw); > static s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw); > +static s32 e1000_acquire_mac_csr_80003es2lan(struct e1000_hw *hw); > static void e1000_release_phy_80003es2lan(struct e1000_hw *hw); > +static void e1000_release_mac_csr_80003es2lan(struct e1000_hw *hw); > static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw); > static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw); > static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, > @@ -64,6 +68,11 @@ static void e1000_clear_hw_cntrs_80003es > static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); > static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex); > static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw); > +static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw); > +static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, > + u16 *data); > +static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, > + u16 data); > static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw); > static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw); > static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); > @@ -84,8 +93,6 @@ static const u16 e1000_gg82563_cable_len > /** > * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs. > * @hw: pointer to the HW structure > - * > - * This is a function pointer entry point called by the api module. > **/ > static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw) > { > @@ -122,6 +129,8 @@ static s32 e1000_init_phy_params_80003es > phy->ops.read_reg = e1000_read_phy_reg_gg82563_80003es2lan; > phy->ops.write_reg = e1000_write_phy_reg_gg82563_80003es2lan; > > + phy->ops.cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan; > + > /* This can only be done after all function pointers are setup. */ > ret_val = e1000_get_phy_id(hw); > > @@ -138,8 +147,6 @@ out: > /** > * e1000_init_nvm_params_80003es2lan - Init ESB2 NVM func ptrs. > * @hw: pointer to the HW structure > - * > - * This is a function pointer entry point called by the api module. > **/ > static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) > { > @@ -197,8 +204,6 @@ static s32 e1000_init_nvm_params_80003es > /** > * e1000_init_mac_params_80003es2lan - Init ESB2 MAC func ptrs. > * @hw: pointer to the HW structure > - * > - * This is a function pointer entry point called by the api module. > **/ > static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) > { > @@ -280,8 +285,6 @@ static s32 e1000_init_mac_params_80003es > /* turn on/off LED */ > mac->ops.led_on = e1000_led_on_generic; > mac->ops.led_off = e1000_led_off_generic; > - /* remove device */ > - mac->ops.remove_device = e1000_remove_device_generic; > /* clear hardware counters */ > mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_80003es2lan; > /* link info */ > @@ -295,8 +298,7 @@ out: > * e1000_init_function_pointers_80003es2lan - Init ESB2 func ptrs. > * @hw: pointer to the HW structure > * > - * The only function explicitly called by the api module to initialize > - * all function pointers and parameters. > + * Called to initialize all function pointers and parameters. > **/ > void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw) > { > @@ -305,14 +307,14 @@ void e1000_init_function_pointers_80003e > hw->mac.ops.init_params = e1000_init_mac_params_80003es2lan; > hw->nvm.ops.init_params = e1000_init_nvm_params_80003es2lan; > hw->phy.ops.init_params = e1000_init_phy_params_80003es2lan; > + e1000_get_bus_info_pcie_generic(hw); > } > > /** > * e1000_acquire_phy_80003es2lan - Acquire rights to access PHY > * @hw: pointer to the HW structure > * > - * A wrapper to acquire access rights to the correct PHY. This is a > - * function pointer entry point called by the api module. > + * A wrapper to acquire access rights to the correct PHY. > **/ > static s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw) > { > @@ -321,8 +323,6 @@ static s32 e1000_acquire_phy_80003es2lan > DEBUGFUNC("e1000_acquire_phy_80003es2lan"); > > mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; > - mask |= E1000_SWFW_CSR_SM; > - > return e1000_acquire_swfw_sync_80003es2lan(hw, mask); > } > > @@ -330,8 +330,7 @@ static s32 e1000_acquire_phy_80003es2lan > * e1000_release_phy_80003es2lan - Release rights to access PHY > * @hw: pointer to the HW structure > * > - * A wrapper to release access rights to the correct PHY. This is a > - * function pointer entry point called by the api module. > + * A wrapper to release access rights to the correct PHY. > **/ > static void e1000_release_phy_80003es2lan(struct e1000_hw *hw) > { > @@ -340,7 +339,41 @@ static void e1000_release_phy_80003es2la > DEBUGFUNC("e1000_release_phy_80003es2lan"); > > mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; > - mask |= E1000_SWFW_CSR_SM; > + e1000_release_swfw_sync_80003es2lan(hw, mask); > +} > + > + > +/** > + * e1000_acquire_mac_csr_80003es2lan - Acquire rights to access Kumeran register > + * @hw: pointer to the HW structure > + * > + * Acquire the semaphore to access the Kumeran interface. > + * > + **/ > +static s32 e1000_acquire_mac_csr_80003es2lan(struct e1000_hw *hw) > +{ > + u16 mask; > + > + DEBUGFUNC("e1000_acquire_mac_csr_80003es2lan"); > + > + mask = E1000_SWFW_CSR_SM; > + > + return e1000_acquire_swfw_sync_80003es2lan(hw, mask); > +} > + > +/** > + * e1000_release_mac_csr_80003es2lan - Release rights to access Kumeran Register > + * @hw: pointer to the HW structure > + * > + * Release the semaphore used to access the Kumeran interface > + **/ > +static void e1000_release_mac_csr_80003es2lan(struct e1000_hw *hw) > +{ > + u16 mask; > + > + DEBUGFUNC("e1000_release_mac_csr_80003es2lan"); > + > + mask = E1000_SWFW_CSR_SM; > > e1000_release_swfw_sync_80003es2lan(hw, mask); > } > @@ -349,8 +382,7 @@ static void e1000_release_phy_80003es2la > * e1000_acquire_nvm_80003es2lan - Acquire rights to access NVM > * @hw: pointer to the HW structure > * > - * Acquire the semaphore to access the EEPROM. This is a function > - * pointer entry point called by the api module. > + * Acquire the semaphore to access the EEPROM. > **/ > static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw) > { > @@ -375,8 +407,7 @@ out: > * e1000_release_nvm_80003es2lan - Relinquish rights to access NVM > * @hw: pointer to the HW structure > * > - * Release the semaphore used to access the EEPROM. This is a > - * function pointer entry point called by the api module. > + * Release the semaphore used to access the EEPROM. > **/ > static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw) > { > @@ -400,7 +431,7 @@ static s32 e1000_acquire_swfw_sync_80003 > u32 swmask = mask; > u32 fwmask = mask << 16; > s32 ret_val = E1000_SUCCESS; > - s32 i = 0, timeout = 200; > + s32 i = 0, timeout = 50; > > DEBUGFUNC("e1000_acquire_swfw_sync_80003es2lan"); > > @@ -452,8 +483,8 @@ static void e1000_release_swfw_sync_8000 > > DEBUGFUNC("e1000_release_swfw_sync_80003es2lan"); > > - while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS); > - /* Empty */ > + while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS) > + ; /* Empty */ > > swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); > swfw_sync &= ~mask; > @@ -468,8 +499,7 @@ static void e1000_release_swfw_sync_8000 > * @offset: offset of the register to read > * @data: pointer to the data returned from the operation > * > - * Read the GG82563 PHY register. This is a function pointer entry > - * point called by the api module. > + * Read the GG82563 PHY register. > **/ > static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, > u32 offset, u16 *data) > @@ -520,9 +550,8 @@ static s32 e1000_read_phy_reg_gg82563_80 > > usec_delay(200); > > - ret_val = e1000_read_phy_reg_mdic(hw, > - MAX_PHY_REG_ADDRESS & offset, > - data); > + ret_val = e1000_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, > + data); > > usec_delay(200); > e1000_release_phy_80003es2lan(hw); > @@ -537,8 +566,7 @@ out: > * @offset: offset of the register to read > * @data: value to write to the register > * > - * Write to the GG82563 PHY register. This is a function pointer entry > - * point called by the api module. > + * Write to the GG82563 PHY register. > **/ > static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, > u32 offset, u16 data) > @@ -590,8 +618,7 @@ static s32 e1000_write_phy_reg_gg82563_8 > > usec_delay(200); > > - ret_val = e1000_write_phy_reg_mdic(hw, > - MAX_PHY_REG_ADDRESS & offset, > + ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, > data); > > usec_delay(200); > @@ -608,8 +635,7 @@ out: > * @words: number of words to write > * @data: buffer of data to write to the NVM > * > - * Write "words" of data to the ESB2 NVM. This is a function > - * pointer entry point called by the api module. > + * Write "words" of data to the ESB2 NVM. > **/ > static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, > u16 words, u16 *data) > @@ -775,10 +801,17 @@ static s32 e1000_get_cable_length_80003e > goto out; > > index = phy_data & GG82563_DSPD_CABLE_LENGTH; > - phy->min_cable_length = e1000_gg82563_cable_length_table[index]; > - phy->max_cable_length = e1000_gg82563_cable_length_table[index+5]; > > - phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; > + if (index < GG82563_CABLE_LENGTH_TABLE_SIZE + 5) { > + phy->min_cable_length = e1000_gg82563_cable_length_table[index]; > + phy->max_cable_length = > + e1000_gg82563_cable_length_table[index+5]; > + > + phy->cable_length = (phy->min_cable_length + > + phy->max_cable_length) / 2; > + } else { > + ret_val = E1000_ERR_PHY; > + } > > out: > return ret_val; > @@ -791,7 +824,6 @@ out: > * @duplex: pointer to duplex buffer > * > * Retrieve the current speed and duplex configuration. > - * This is a function pointer entry point called by the api module. > **/ > static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, > u16 *duplex) > @@ -804,20 +836,13 @@ static s32 e1000_get_link_up_info_80003e > ret_val = e1000_get_speed_and_duplex_copper_generic(hw, > speed, > duplex); > - if (ret_val) > - goto out; > - if (*speed == SPEED_1000) > - ret_val = e1000_cfg_kmrn_1000_80003es2lan(hw); > - else > - ret_val = e1000_cfg_kmrn_10_100_80003es2lan(hw, > - *duplex); > + hw->phy.ops.cfg_on_link_up(hw); > } else { > ret_val = e1000_get_speed_and_duplex_fiber_serdes_generic(hw, > speed, > duplex); > } > > -out: > return ret_val; > } > > @@ -826,7 +851,6 @@ out: > * @hw: pointer to the HW structure > * > * Perform a global reset to the ESB2 controller. > - * This is a function pointer entry point called by the api module. > **/ > static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw) > { > @@ -840,9 +864,8 @@ static s32 e1000_reset_hw_80003es2lan(st > * on the last TLP read/write transaction when MAC is reset. > */ > ret_val = e1000_disable_pcie_master_generic(hw); > - if (ret_val) { > + if (ret_val) > DEBUGOUT("PCI-E Master disable polling has failed.\n"); > - } > > DEBUGOUT("Masking off all interrupts\n"); > E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); > @@ -855,8 +878,10 @@ static s32 e1000_reset_hw_80003es2lan(st > > ctrl = E1000_READ_REG(hw, E1000_CTRL); > > + ret_val = e1000_acquire_phy_80003es2lan(hw); > DEBUGOUT("Issuing a global reset to MAC\n"); > E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_RST); > + e1000_release_phy_80003es2lan(hw); > > ret_val = e1000_get_auto_rd_done_generic(hw); > if (ret_val) > @@ -878,7 +903,6 @@ out: > * @hw: pointer to the HW structure > * > * Initialize the hw bits, LED, VFTA, MTA, link and hw counters. > - * This is a function pointer entry point called by the api module. > **/ > static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) > { > @@ -969,9 +993,6 @@ static void e1000_initialize_hw_bits_800 > > DEBUGFUNC("e1000_initialize_hw_bits_80003es2lan"); > > - if (hw->mac.disable_hw_init_bits) > - goto out; > - > /* Transmit Descriptor Control 0 */ > reg = E1000_READ_REG(hw, E1000_TXDCTL(0)); > reg |= (1 << 22); > @@ -997,7 +1018,6 @@ static void e1000_initialize_hw_bits_800 > reg |= (1 << 28); > E1000_WRITE_REG(hw, E1000_TARC(1), reg); > > -out: > return; > } > > @@ -1012,8 +1032,7 @@ static s32 e1000_copper_link_setup_gg825 > struct e1000_phy_info *phy = &hw->phy; > s32 ret_val; > u32 ctrl_ext; > - u32 i = 0; > - u16 data, data2; > + u16 data; > > DEBUGFUNC("e1000_copper_link_setup_gg82563_80003es2lan"); > > @@ -1084,20 +1103,20 @@ static s32 e1000_copper_link_setup_gg825 > } > > /* Bypass Rx and Tx FIFO's */ > - ret_val = e1000_write_kmrn_reg_generic(hw, > + ret_val = e1000_write_kmrn_reg_80003es2lan(hw, > E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL, > E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS | > E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS); > if (ret_val) > goto out; > > - ret_val = e1000_read_kmrn_reg_generic(hw, > + ret_val = e1000_read_kmrn_reg_80003es2lan(hw, > E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, > &data); > if (ret_val) > goto out; > data |= E1000_KMRNCTRLSTA_OPMODE_E_IDLE; > - ret_val = e1000_write_kmrn_reg_generic(hw, > + ret_val = e1000_write_kmrn_reg_80003es2lan(hw, > E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, > data); > if (ret_val) > @@ -1129,30 +1148,20 @@ static s32 e1000_copper_link_setup_gg825 > /* Enable Electrical Idle on the PHY */ > data |= GG82563_PMCR_ENABLE_ELECTRICAL_IDLE; > ret_val = hw->phy.ops.write_reg(hw, > - GG82563_PHY_PWR_MGMT_CTRL, > - data); > + GG82563_PHY_PWR_MGMT_CTRL, > + data); > if (ret_val) > goto out; > - > - do { > - ret_val = hw->phy.ops.read_reg(hw, > - GG82563_PHY_KMRN_MODE_CTRL, > - &data); > - if (ret_val) > - goto out; > - > - ret_val = hw->phy.ops.read_reg(hw, > - GG82563_PHY_KMRN_MODE_CTRL, > - &data2); > + ret_val = hw->phy.ops.read_reg(hw, > + GG82563_PHY_KMRN_MODE_CTRL, > + &data); > if (ret_val) > goto out; > - i++; > - } while ((data != data2) && (i < GG82563_MAX_KMRN_RETRY)); > > data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; > ret_val = hw->phy.ops.write_reg(hw, > - GG82563_PHY_KMRN_MODE_CTRL, > - data); > + GG82563_PHY_KMRN_MODE_CTRL, > + data); > > if (ret_val) > goto out; > @@ -1185,7 +1194,7 @@ out: > static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw) > { > u32 ctrl; > - s32 ret_val; > + s32 ret_val; > u16 reg_data; > > DEBUGFUNC("e1000_setup_copper_link_80003es2lan"); > @@ -1200,26 +1209,26 @@ static s32 e1000_setup_copper_link_80003 > * iteration and increase the max iterations when > * polling the phy; this fixes erroneous timeouts at 10Mbps. > */ > - ret_val = e1000_write_kmrn_reg_generic(hw, GG82563_REG(0x34, 4), > - 0xFFFF); > + ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 4), > + 0xFFFF); > if (ret_val) > goto out; > - ret_val = e1000_read_kmrn_reg_generic(hw, GG82563_REG(0x34, 9), > - ®_data); > + ret_val = e1000_read_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9), > + ®_data); > if (ret_val) > goto out; > reg_data |= 0x3F; > - ret_val = e1000_write_kmrn_reg_generic(hw, GG82563_REG(0x34, 9), > - reg_data); > + ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9), > + reg_data); > if (ret_val) > goto out; > - ret_val = e1000_read_kmrn_reg_generic(hw, > + ret_val = e1000_read_kmrn_reg_80003es2lan(hw, > E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, > ®_data); > if (ret_val) > goto out; > reg_data |= E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING; > - ret_val = e1000_write_kmrn_reg_generic(hw, > + ret_val = e1000_write_kmrn_reg_80003es2lan(hw, > E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, > reg_data); > if (ret_val) > @@ -1236,6 +1245,40 @@ out: > } > > /** > + * e1000_cfg_on_link_up_80003es2lan - es2 link configuration after link-up > + * @hw: pointer to the HW structure > + * @duplex: current duplex setting > + * > + * Configure the KMRN interface by applying last minute quirks for > + * 10/100 operation. > + **/ > +static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw) > +{ > + s32 ret_val = E1000_SUCCESS; > + u16 speed; > + u16 duplex; > + > + DEBUGFUNC("e1000_configure_on_link_up"); > + > + if (hw->phy.media_type == e1000_media_type_copper) { > + > + ret_val = e1000_get_speed_and_duplex_copper_generic(hw, > + &speed, > + &duplex); > + if (ret_val) > + goto out; > + > + if (speed == SPEED_1000) > + ret_val = e1000_cfg_kmrn_1000_80003es2lan(hw); > + else > + ret_val = e1000_cfg_kmrn_10_100_80003es2lan(hw, duplex); > + } > + > +out: > + return ret_val; > +} > + > +/** > * e1000_cfg_kmrn_10_100_80003es2lan - Apply "quirks" for 10/100 operation > * @hw: pointer to the HW structure > * @duplex: current duplex setting > @@ -1253,7 +1296,7 @@ static s32 e1000_cfg_kmrn_10_100_80003es > DEBUGFUNC("e1000_configure_kmrn_for_10_100"); > > reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT; > - ret_val = e1000_write_kmrn_reg_generic(hw, > + ret_val = e1000_write_kmrn_reg_80003es2lan(hw, > E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, > reg_data); > if (ret_val) > @@ -1268,12 +1311,12 @@ static s32 e1000_cfg_kmrn_10_100_80003es > > do { > ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, > - ®_data); > + ®_data); > if (ret_val) > goto out; > > ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, > - ®_data2); > + ®_data2); > if (ret_val) > goto out; > i++; > @@ -1307,7 +1350,7 @@ static s32 e1000_cfg_kmrn_1000_80003es2l > DEBUGFUNC("e1000_configure_kmrn_for_1000"); > > reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT; > - ret_val = e1000_write_kmrn_reg_generic(hw, > + ret_val = e1000_write_kmrn_reg_80003es2lan(hw, > E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, > reg_data); > if (ret_val) > @@ -1322,12 +1365,12 @@ static s32 e1000_cfg_kmrn_1000_80003es2l > > do { > ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, > - ®_data); > + ®_data); > if (ret_val) > goto out; > > ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, > - ®_data2); > + ®_data2); > if (ret_val) > goto out; > i++; > @@ -1341,6 +1384,75 @@ out: > } > > /** > + * e1000_read_kmrn_reg_80003es2lan - Read kumeran register > + * @hw: pointer to the HW structure > + * @offset: register offset to be read > + * @data: pointer to the read data > + * > + * Acquire semaphore, then read the PHY register at offset > + * using the kumeran interface. The information retrieved is stored in data. > + * Release the semaphore before exiting. > + **/ > +s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, u16 *data) > +{ > + u32 kmrnctrlsta; > + s32 ret_val = E1000_SUCCESS; > + > + DEBUGFUNC("e1000_read_kmrn_reg_80003es2lan"); > + > + ret_val = e1000_acquire_mac_csr_80003es2lan(hw); > + if (ret_val) > + goto out; > + > + kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & > + E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; > + E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); > + > + usec_delay(2); > + > + kmrnctrlsta = E1000_READ_REG(hw, E1000_KMRNCTRLSTA); > + *data = (u16)kmrnctrlsta; > + > + e1000_release_mac_csr_80003es2lan(hw); > + > +out: > + return ret_val; > +} > + > +/** > + * e1000_write_kmrn_reg_80003es2lan - Write kumeran register > + * @hw: pointer to the HW structure > + * @offset: register offset to write to > + * @data: data to write at register offset > + * > + * Acquire semaphore, then write the data to PHY register > + * at the offset using the kumeran interface. Release semaphore > + * before exiting. > + **/ > +s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, u16 data) > +{ > + u32 kmrnctrlsta; > + s32 ret_val = E1000_SUCCESS; > + > + DEBUGFUNC("e1000_write_kmrn_reg_80003es2lan"); > + > + ret_val = e1000_acquire_mac_csr_80003es2lan(hw); > + if (ret_val) > + goto out; > + > + kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & > + E1000_KMRNCTRLSTA_OFFSET) | data; > + E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); > + > + usec_delay(2); > + > + e1000_release_mac_csr_80003es2lan(hw); > + > +out: > + return ret_val; > +} > + > +/** > * e1000_read_mac_addr_80003es2lan - Read device MAC address > * @hw: pointer to the HW structure > **/ > @@ -1380,44 +1492,42 @@ static void e1000_power_down_phy_copper_ > **/ > static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw) > { > - volatile u32 temp; > - > DEBUGFUNC("e1000_clear_hw_cntrs_80003es2lan"); > > e1000_clear_hw_cntrs_base_generic(hw); > > - temp = E1000_READ_REG(hw, E1000_PRC64); > - temp = E1000_READ_REG(hw, E1000_PRC127); > - temp = E1000_READ_REG(hw, E1000_PRC255); > - temp = E1000_READ_REG(hw, E1000_PRC511); > - temp = E1000_READ_REG(hw, E1000_PRC1023); > - temp = E1000_READ_REG(hw, E1000_PRC1522); > - temp = E1000_READ_REG(hw, E1000_PTC64); > - temp = E1000_READ_REG(hw, E1000_PTC127); > - temp = E1000_READ_REG(hw, E1000_PTC255); > - temp = E1000_READ_REG(hw, E1000_PTC511); > - temp = E1000_READ_REG(hw, E1000_PTC1023); > - temp = E1000_READ_REG(hw, E1000_PTC1522); > - > - temp = E1000_READ_REG(hw, E1000_ALGNERRC); > - temp = E1000_READ_REG(hw, E1000_RXERRC); > - temp = E1000_READ_REG(hw, E1000_TNCRS); > - temp = E1000_READ_REG(hw, E1000_CEXTERR); > - temp = E1000_READ_REG(hw, E1000_TSCTC); > - temp = E1000_READ_REG(hw, E1000_TSCTFC); > - > - temp = E1000_READ_REG(hw, E1000_MGTPRC); > - temp = E1000_READ_REG(hw, E1000_MGTPDC); > - temp = E1000_READ_REG(hw, E1000_MGTPTC); > - > - temp = E1000_READ_REG(hw, E1000_IAC); > - temp = E1000_READ_REG(hw, E1000_ICRXOC); > - > - temp = E1000_READ_REG(hw, E1000_ICRXPTC); > - temp = E1000_READ_REG(hw, E1000_ICRXATC); > - temp = E1000_READ_REG(hw, E1000_ICTXPTC); > - temp = E1000_READ_REG(hw, E1000_ICTXATC); > - temp = E1000_READ_REG(hw, E1000_ICTXQEC); > - temp = E1000_READ_REG(hw, E1000_ICTXQMTC); > - temp = E1000_READ_REG(hw, E1000_ICRXDMTC); > + E1000_READ_REG(hw, E1000_PRC64); > + E1000_READ_REG(hw, E1000_PRC127); > + E1000_READ_REG(hw, E1000_PRC255); > + E1000_READ_REG(hw, E1000_PRC511); > + E1000_READ_REG(hw, E1000_PRC1023); > + E1000_READ_REG(hw, E1000_PRC1522); > + E1000_READ_REG(hw, E1000_PTC64); > + E1000_READ_REG(hw, E1000_PTC127); > + E1000_READ_REG(hw, E1000_PTC255); > + E1000_READ_REG(hw, E1000_PTC511); > + E1000_READ_REG(hw, E1000_PTC1023); > + E1000_READ_REG(hw, E1000_PTC1522); > + > + E1000_READ_REG(hw, E1000_ALGNERRC); > + E1000_READ_REG(hw, E1000_RXERRC); > + E1000_READ_REG(hw, E1000_TNCRS); > + E1000_READ_REG(hw, E1000_CEXTERR); > + E1000_READ_REG(hw, E1000_TSCTC); > + E1000_READ_REG(hw, E1000_TSCTFC); > + > + E1000_READ_REG(hw, E1000_MGTPRC); > + E1000_READ_REG(hw, E1000_MGTPDC); > + E1000_READ_REG(hw, E1000_MGTPTC); > + > + E1000_READ_REG(hw, E1000_IAC); > + E1000_READ_REG(hw, E1000_ICRXOC); > + > + E1000_READ_REG(hw, E1000_ICRXPTC); > + E1000_READ_REG(hw, E1000_ICRXATC); > + E1000_READ_REG(hw, E1000_ICTXPTC); > + E1000_READ_REG(hw, E1000_ICTXATC); > + E1000_READ_REG(hw, E1000_ICTXQEC); > + E1000_READ_REG(hw, E1000_ICTXQMTC); > + E1000_READ_REG(hw, E1000_ICRXDMTC); > } > > Modified: head/sys/dev/e1000/e1000_82540.c > ============================================================================== > --- head/sys/dev/e1000/e1000_82540.c Wed Nov 26 23:41:18 2008 (r185352) > +++ head/sys/dev/e1000/e1000_82540.c Wed Nov 26 23:57:23 2008 (r185353) > @@ -32,11 +32,15 @@ > ******************************************************************************/ > /*$FreeBSD$*/ > > -/* e1000_82540 > - * e1000_82545 > - * e1000_82546 > - * e1000_82545_rev_3 > - * e1000_82546_rev_3 > +/* > + * 82540EM Gigabit Ethernet Controller > + * 82540EP Gigabit Ethernet Controller > + * 82545EM Gigabit Ethernet Controller (Copper) > + * 82545EM Gigabit Ethernet Controller (Fiber) > + * 82545GM Gigabit Ethernet Controller > + * 82546EB Gigabit Ethernet Controller (Copper) > + * 82546EB Gigabit Ethernet Controller (Fiber) > + * 82546GB Gigabit Ethernet Controller > */ > > #include "e1000_api.h" > @@ -57,8 +61,6 @@ static void e1000_power_down_phy_copper_ > /** > * e1000_init_phy_params_82540 - Init PHY func ptrs. > * @hw: pointer to the HW structure > - * > - * This is a function pointer entry point called by the api module. > **/ > static s32 e1000_init_phy_params_82540(struct e1000_hw *hw) > { > @@ -110,8 +112,6 @@ out: > /** > * e1000_init_nvm_params_82540 - Init NVM func ptrs. > * @hw: pointer to the HW structure > - * > - * This is a function pointer entry point called by the api module. > **/ > static s32 e1000_init_nvm_params_82540(struct e1000_hw *hw) > { > @@ -153,8 +153,6 @@ static s32 e1000_init_nvm_params_82540(s > /** > * e1000_init_mac_params_82540 - Init MAC func ptrs. > * @hw: pointer to the HW structure > - * > - * This is a function pointer entry point called by the api module. > **/ > static s32 e1000_init_mac_params_82540(struct e1000_hw *hw) > { > @@ -189,6 +187,8 @@ static s32 e1000_init_mac_params_82540(s > > /* bus type/speed/width */ > mac->ops.get_bus_info = e1000_get_bus_info_pci_generic; > + /* function id */ > + mac->ops.set_lan_id = e1000_set_lan_id_multi_port_pci; > /* reset */ > mac->ops.reset_hw = e1000_reset_hw_82540; > /* hw initialization */ > @@ -247,8 +247,7 @@ out: > * e1000_init_function_pointers_82540 - Init func ptrs. > * @hw: pointer to the HW structure > * > - * The only function explicitly called by the api module to initialize > - * all function pointers and parameters. > + * Called to initialize all function pointers and parameters. > **/ > void e1000_init_function_pointers_82540(struct e1000_hw *hw) > { > @@ -263,8 +262,7 @@ void e1000_init_function_pointers_82540( > * e1000_reset_hw_82540 - Reset hardware > * @hw: pointer to the HW structure > * > - * This resets the hardware into a known state. This is a > - * function pointer entry point called by the api module. > + * This resets the hardware into a known state. > **/ > static s32 e1000_reset_hw_82540(struct e1000_hw *hw) > { > @@ -322,8 +320,7 @@ static s32 e1000_reset_hw_82540(struct e > * e1000_init_hw_82540 - Initialize hardware > * @hw: pointer to the HW structure > * > - * This inits the hardware readying it for operation. This is a > - * function pointer entry point called by the api module. > + * This inits the hardware readying it for operation. > **/ > static s32 e1000_init_hw_82540(struct e1000_hw *hw) > { > @@ -406,8 +403,7 @@ static s32 e1000_init_hw_82540(struct e1 > * Calls the appropriate function to configure the link for auto-neg or forced > * speed and duplex. Then we check for link, once link is established calls > * to configure collision distance and flow control are called. If link is > - * not established, we return -E1000_ERR_PHY (-2). This is a function > - * pointer entry point called by the api module. > + * not established, we return -E1000_ERR_PHY (-2). > **/ > static s32 e1000_setup_copper_link_82540(struct e1000_hw *hw) > { > @@ -454,8 +450,7 @@ out: > * Set the output amplitude to the value in the EEPROM and adjust the VCO > * speed to improve Bit Error Rate (BER) performance. Configures collision > * distance and flow control for fiber and serdes links. Upon successful > - * setup, poll for link. This is a function pointer entry point called by > - * the api module. > + * setup, poll for link. > **/ > static s32 e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw) > { > @@ -650,34 +645,32 @@ static void e1000_power_down_phy_copper_ > **/ > static void e1000_clear_hw_cntrs_82540(struct e1000_hw *hw) > { > - volatile u32 temp; > - > DEBUGFUNC("e1000_clear_hw_cntrs_82540"); > > e1000_clear_hw_cntrs_base_generic(hw); > > - temp = E1000_READ_REG(hw, E1000_PRC64); > - temp = E1000_READ_REG(hw, E1000_PRC127); > - temp = E1000_READ_REG(hw, E1000_PRC255); > - temp = E1000_READ_REG(hw, E1000_PRC511); > - temp = E1000_READ_REG(hw, E1000_PRC1023); > - temp = E1000_READ_REG(hw, E1000_PRC1522); > - temp = E1000_READ_REG(hw, E1000_PTC64); > - temp = E1000_READ_REG(hw, E1000_PTC127); > - temp = E1000_READ_REG(hw, E1000_PTC255); > - temp = E1000_READ_REG(hw, E1000_PTC511); > - temp = E1000_READ_REG(hw, E1000_PTC1023); > - temp = E1000_READ_REG(hw, E1000_PTC1522); > - > - temp = E1000_READ_REG(hw, E1000_ALGNERRC); > - temp = E1000_READ_REG(hw, E1000_RXERRC); > - temp = E1000_READ_REG(hw, E1000_TNCRS); > - temp = E1000_READ_REG(hw, E1000_CEXTERR); > - temp = E1000_READ_REG(hw, E1000_TSCTC); > - temp = E1000_READ_REG(hw, E1000_TSCTFC); > - > - temp = E1000_READ_REG(hw, E1000_MGTPRC); > - temp = E1000_READ_REG(hw, E1000_MGTPDC); > - temp = E1000_READ_REG(hw, E1000_MGTPTC); > + E1000_READ_REG(hw, E1000_PRC64); > + E1000_READ_REG(hw, E1000_PRC127); > + E1000_READ_REG(hw, E1000_PRC255); > + E1000_READ_REG(hw, E1000_PRC511); > + E1000_READ_REG(hw, E1000_PRC1023); > + E1000_READ_REG(hw, E1000_PRC1522); > + E1000_READ_REG(hw, E1000_PTC64); > + E1000_READ_REG(hw, E1000_PTC127); > + E1000_READ_REG(hw, E1000_PTC255); > + E1000_READ_REG(hw, E1000_PTC511); > + E1000_READ_REG(hw, E1000_PTC1023); > + E1000_READ_REG(hw, E1000_PTC1522); > + > + E1000_READ_REG(hw, E1000_ALGNERRC); > + E1000_READ_REG(hw, E1000_RXERRC); > + E1000_READ_REG(hw, E1000_TNCRS); > + E1000_READ_REG(hw, E1000_CEXTERR); > + E1000_READ_REG(hw, E1000_TSCTC); > + E1000_READ_REG(hw, E1000_TSCTFC); > + > + E1000_READ_REG(hw, E1000_MGTPRC); > + E1000_READ_REG(hw, E1000_MGTPDC); > + E1000_READ_REG(hw, E1000_MGTPTC); > } > > > Modified: head/sys/dev/e1000/e1000_82541.c > ============================================================================== > --- head/sys/dev/e1000/e1000_82541.c Wed Nov 26 23:41:18 2008 (r185352) > +++ head/sys/dev/e1000/e1000_82541.c Wed Nov 26 23:57:23 2008 (r185353) > @@ -32,10 +32,13 @@ > ******************************************************************************/ > /*$FreeBSD$*/ > > -/* e1000_82541 > - * e1000_82547 > - * e1000_82541_rev_2 > - * e1000_82547_rev_2 > +/* > + * 82541EI Gigabit Ethernet Controller > + * 82541ER Gigabit Ethernet Controller > + * 82541GI Gigabit Ethernet Controller > + * 82541PI Gigabit Ethernet Controller > + * 82547EI Gigabit Ethernet Controller > + * 82547GI Gigabit Ethernet Controller > */ > > #include "e1000_api.h" > @@ -74,18 +77,9 @@ static const u16 e1000_igp_cable_length_ > (sizeof(e1000_igp_cable_length_table) / \ > sizeof(e1000_igp_cable_length_table[0])) > > -struct e1000_dev_spec_82541 { > - enum e1000_dsp_config dsp_config; > - enum e1000_ffe_config ffe_config; > - u16 spd_default; > - bool phy_init_script; > -}; > - > /** > * e1000_init_phy_params_82541 - Init PHY func ptrs. > * @hw: pointer to the HW structure > - * > - * This is a function pointer entry point called by the api module. > **/ > static s32 e1000_init_phy_params_82541(struct e1000_hw *hw) > { > @@ -129,8 +123,6 @@ out: > /** > * e1000_init_nvm_params_82541 - Init NVM func ptrs. > * @hw: pointer to the HW structure > - * > - * This is a function pointer entry point called by the api module. > **/ > static s32 e1000_init_nvm_params_82541(struct e1000_hw *hw) > { > @@ -227,13 +219,10 @@ out: > /** > * e1000_init_mac_params_82541 - Init MAC func ptrs. > * @hw: pointer to the HW structure > - * > - * This is a function pointer entry point called by the api module. > **/ > static s32 e1000_init_mac_params_82541(struct e1000_hw *hw) > { > struct e1000_mac_info *mac = &hw->mac; > - s32 ret_val; > > DEBUGFUNC("e1000_init_mac_params_82541"); > > @@ -250,6 +239,8 @@ static s32 e1000_init_mac_params_82541(s > > /* bus type/speed/width */ > mac->ops.get_bus_info = e1000_get_bus_info_pci_generic; > + /* function id */ > + mac->ops.set_lan_id = e1000_set_lan_id_single_port; > /* reset */ > mac->ops.reset_hw = e1000_reset_hw_82541; > /* hw initialization */ > @@ -277,25 +268,17 @@ static s32 e1000_init_mac_params_82541(s > /* turn on/off LED */ > mac->ops.led_on = e1000_led_on_generic; > mac->ops.led_off = e1000_led_off_generic; > - /* remove device */ > - mac->ops.remove_device = e1000_remove_device_generic; > /* clear hardware counters */ > mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_82541; > > - hw->dev_spec_size = sizeof(struct e1000_dev_spec_82541); > - > - /* Device-specific structure allocation */ > - ret_val = e1000_alloc_zeroed_dev_spec_struct(hw, hw->dev_spec_size); > - > - return ret_val; > + return E1000_SUCCESS; > } > > /** > * e1000_init_function_pointers_82541 - Init func ptrs. > * @hw: pointer to the HW structure > * > - * The only function explicitly called by the api module to initialize > - * all function pointers and parameters. > + * Called to initialize all function pointers and parameters. > **/ > void e1000_init_function_pointers_82541(struct e1000_hw *hw) > { > @@ -310,8 +293,7 @@ void e1000_init_function_pointers_82541( > * e1000_reset_hw_82541 - Reset hardware > * @hw: pointer to the HW structure > * > - * This resets the hardware into a known state. This is a > - * function pointer entry point called by the api module. > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > > > > -- Having the fewest wants, I am nearest to the gods. -- Socrates From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 01:57:23 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6F851065673; Thu, 27 Nov 2008 01:57:23 +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 C4C2D8FC0C; Thu, 27 Nov 2008 01:57:23 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAR1vNiJ072508; Thu, 27 Nov 2008 01:57:23 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAR1vNpx072505; Thu, 27 Nov 2008 01:57:23 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200811270157.mAR1vNpx072505@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 27 Nov 2008 01:57:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185354 - head/sys/dev/fxp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 01:57:24 -0000 Author: yongari Date: Thu Nov 27 01:57:23 2008 New Revision: 185354 URL: http://svn.freebsd.org/changeset/base/185354 Log: Add basic WOL support for 82550/82551/82558 and 82559 based controllers. ICH based controllers are treated as 82559. 82557, earlier revision of 82558 and 82559ER have no WOL capability. o WOL support requires help of a firmware so add check whether hardware is capable of handling magic frames by reading EEPROM. o Enable accepting WOL frames only when hardware is about to suspend or shutdown. Previously fxp(4) used to allow receipt of magic frame under normal operation mode which could cause hardware hang if magic frame is received by hardware. Datasheet clearly states driver should not allow WOL frames under normal operation mode. o Disable WOL frame reception in device attach so have fxp(4) immunize against system hang which can be triggered by magic packets when the hardware is not in fully initialized state. o Don't reset all hardware configuration data in fxp_stop() otherwise important configuration data is lost and this would reset WOL configuration to default state which in turn cause hardware hang on receipt of magic frames. To fix the issue, preserve hardware configuration data by issuing a selective reset. o Explicitly disable interrupts after issuing selective reset as reset may unmask interrupts. Tested by: Alexey Shuvaev < shuvaev <> physik DOT uni-wuerzburg DOT de > Modified: head/sys/dev/fxp/if_fxp.c head/sys/dev/fxp/if_fxpreg.h head/sys/dev/fxp/if_fxpvar.h Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Wed Nov 26 23:57:23 2008 (r185353) +++ head/sys/dev/fxp/if_fxp.c Thu Nov 27 01:57:23 2008 (r185354) @@ -405,7 +405,7 @@ fxp_attach(device_t dev) uint32_t val; uint16_t data, myea[ETHER_ADDR_LEN / 2]; u_char eaddr[ETHER_ADDR_LEN]; - int i, prefer_iomap; + int i, pmc, prefer_iomap; int error; error = 0; @@ -483,6 +483,17 @@ fxp_attach(device_t dev) sc->revision = pci_get_revid(dev); /* + * Check availability of WOL. 82559ER does not support WOL. + */ + if (sc->revision >= FXP_REV_82558_A4 && + sc->revision != FXP_REV_82559S_A) { + fxp_read_eeprom(sc, &data, 10, 1); + if ((data & 0x20) != 0 && + pci_find_extcap(sc->dev, PCIY_PMG, &pmc) == 0) + sc->flags |= FXP_FLAG_WOLCAP; + } + + /* * Determine whether we must use the 503 serial interface. */ fxp_read_eeprom(sc, &data, 6, 1); @@ -796,6 +807,11 @@ fxp_attach(device_t dev) ifp->if_capenable |= IFCAP_RXCSUM; } + if (sc->flags & FXP_FLAG_WOLCAP) { + ifp->if_capabilities |= IFCAP_WOL_MAGIC; + ifp->if_capenable |= IFCAP_WOL_MAGIC; + } + #ifdef DEVICE_POLLING /* Inform the world we support polling. */ ifp->if_capabilities |= IFCAP_POLLING; @@ -834,6 +850,19 @@ fxp_attach(device_t dev) goto fail; } + /* + * Configure hardware to reject magic frames otherwise + * system will hang on recipt of magic frames. + */ + if ((sc->flags & FXP_FLAG_WOLCAP) != 0) { + FXP_LOCK(sc); + /* Clear wakeup events. */ + CSR_READ_1(sc, FXP_CSR_PMDR); + fxp_init_body(sc); + fxp_stop(sc); + FXP_UNLOCK(sc); + } + fail: if (error) fxp_release(sc); @@ -956,17 +985,13 @@ fxp_detach(device_t dev) static int fxp_shutdown(device_t dev) { - struct fxp_softc *sc = device_get_softc(dev); /* * Make sure that DMA is disabled prior to reboot. Not doing * do could allow DMA to corrupt kernel memory during the * reboot before the driver initializes. */ - FXP_LOCK(sc); - fxp_stop(sc); - FXP_UNLOCK(sc); - return (0); + return (fxp_suspend(dev)); } /* @@ -978,9 +1003,25 @@ static int fxp_suspend(device_t dev) { struct fxp_softc *sc = device_get_softc(dev); + struct ifnet *ifp; + int pmc; + uint16_t pmstat; FXP_LOCK(sc); + ifp = sc->ifp; + if (pci_find_extcap(sc->dev, PCIY_PMG, &pmc) == 0) { + pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2); + pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) { + /* Request PME. */ + pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; + sc->flags |= FXP_FLAG_WOL; + /* Reconfigure hardware to accept magic frames. */ + fxp_init_body(sc); + } + pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + } fxp_stop(sc); sc->suspended = 1; @@ -998,9 +1039,23 @@ fxp_resume(device_t dev) { struct fxp_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc->ifp; + int pmc; + uint16_t pmstat; FXP_LOCK(sc); + if (pci_find_extcap(sc->dev, PCIY_PMG, &pmc) == 0) { + sc->flags &= ~FXP_FLAG_WOL; + pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2); + /* Disable PME and clear PME status. */ + pmstat &= ~PCIM_PSTAT_PMEENABLE; + pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + if ((sc->flags & FXP_FLAG_WOLCAP) != 0) { + /* Clear wakeup events. */ + CSR_READ_1(sc, FXP_CSR_PMDR); + } + } + CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SELECTIVE_RESET); DELAY(10); @@ -2015,11 +2070,13 @@ fxp_stop(struct fxp_softc *sc) callout_stop(&sc->stat_ch); /* - * Issue software reset, which also unloads the microcode. + * Preserve PCI configuration, configure, IA/multicast + * setup and put RU and CU into idle state. */ - sc->flags &= ~FXP_FLAG_UCODE; - CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SOFTWARE_RESET); + CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SELECTIVE_RESET); DELAY(50); + /* Disable interrupts. */ + CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE); /* * Release any xmit buffers. @@ -2099,6 +2156,13 @@ fxp_init_body(struct fxp_softc *sc) */ fxp_stop(sc); + /* + * Issue software reset, which also unloads the microcode. + */ + sc->flags &= ~FXP_FLAG_UCODE; + CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SOFTWARE_RESET); + DELAY(50); + prm = (ifp->if_flags & IFF_PROMISC) ? 1 : 0; /* @@ -2215,8 +2279,7 @@ fxp_init_body(struct fxp_softc *sc) cbp->rcv_crc_xfer = 0; /* (don't) xfer CRC to host */ cbp->long_rx_en = sc->flags & FXP_FLAG_LONG_PKT_EN ? 1 : 0; cbp->ia_wake_en = 0; /* (don't) wake up on address match */ - cbp->magic_pkt_dis = 0; /* (don't) disable magic packet */ - /* must set wake_en in PMCSR also */ + cbp->magic_pkt_dis = sc->flags & FXP_FLAG_WOL ? 0 : 1; cbp->force_fdx = 0; /* (don't) force full duplex */ cbp->fdx_pin_en = 1; /* (enable) FDX# pin */ cbp->multi_ia = 0; /* (don't) accept multiple IAs */ @@ -2687,6 +2750,9 @@ fxp_ioctl(struct ifnet *ifp, u_long comm else ifp->if_hwassist &= ~CSUM_TSO; } + if ((mask & IFCAP_WOL_MAGIC) != 0 && + (ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0) + ifp->if_capenable ^= IFCAP_WOL_MAGIC; if ((mask & IFCAP_VLAN_MTU) != 0 && (ifp->if_capabilities & IFCAP_VLAN_MTU) != 0) { ifp->if_capenable ^= IFCAP_VLAN_MTU; Modified: head/sys/dev/fxp/if_fxpreg.h ============================================================================== --- head/sys/dev/fxp/if_fxpreg.h Wed Nov 26 23:57:23 2008 (r185353) +++ head/sys/dev/fxp/if_fxpreg.h Thu Nov 27 01:57:23 2008 (r185354) @@ -46,6 +46,7 @@ #define FXP_CSR_EEPROMCONTROL 14 /* eeprom control (2 bytes) */ #define FXP_CSR_MDICONTROL 16 /* mdi control (4 bytes) */ #define FXP_CSR_FLOWCONTROL 0x19 /* flow control (2 bytes) */ +#define FXP_CSR_PMDR 0x1B /* power management driver (1 byte) */ #define FXP_CSR_GENCONTROL 0x1C /* general control (1 byte) */ /* Modified: head/sys/dev/fxp/if_fxpvar.h ============================================================================== --- head/sys/dev/fxp/if_fxpvar.h Wed Nov 26 23:57:23 2008 (r185353) +++ head/sys/dev/fxp/if_fxpvar.h Thu Nov 27 01:57:23 2008 (r185354) @@ -201,6 +201,8 @@ struct fxp_softc { #define FXP_FLAG_EXT_RFA 0x0400 /* extended RFDs for csum offload */ #define FXP_FLAG_SAVE_BAD 0x0800 /* save bad pkts: bad size, CRC, etc */ #define FXP_FLAG_82559_RXCSUM 0x1000 /* 82559 compatible RX checksum */ +#define FXP_FLAG_WOLCAP 0x2000 /* WOL capability */ +#define FXP_FLAG_WOL 0x4000 /* WOL active */ /* Macros to ease CSR access. */ #define CSR_READ_1(sc, reg) bus_read_1(sc->fxp_res[0], reg) From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 02:18:44 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 001BE106564A; Thu, 27 Nov 2008 02:18:43 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E83FF8FC18; Thu, 27 Nov 2008 02:18:43 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAR2IhX8072973; Thu, 27 Nov 2008 02:18:43 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAR2Ih2g072971; Thu, 27 Nov 2008 02:18:43 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200811270218.mAR2Ih2g072971@svn.freebsd.org> From: Jack F Vogel Date: Thu, 27 Nov 2008 02:18:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185355 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 02:18:44 -0000 Author: jfv Date: Thu Nov 27 02:18:43 2008 New Revision: 185355 URL: http://svn.freebsd.org/changeset/base/185355 Log: Thanks to the reminder from Ganbold, small fix in the RX failure path for an infinite loop. Problem originally noticed in ixgbe by Jeff Roberson and fixed there. Thanks to everyone involved. Modified: head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Thu Nov 27 01:57:23 2008 (r185354) +++ head/sys/dev/e1000/if_igb.c Thu Nov 27 02:18:43 2008 (r185355) @@ -3490,12 +3490,11 @@ igb_setup_receive_ring(struct rx_ring *r return (0); fail: /* - * We need to clean up any buffers allocated so far - * 'j' is the failing index, decrement it to get the - * last success. + * We need to clean up any buffers allocated + * so far, 'j' is the failing index. */ - for (--j; j < 0; j--) { - rxbuf = &rxr->rx_buffers[j]; + for (int i = 0; i < j; i++) { + rxbuf = &rxr->rx_buffers[i]; if (rxbuf->m_head != NULL) { bus_dmamap_sync(rxr->rxtag, rxbuf->map, BUS_DMASYNC_POSTREAD); @@ -3516,9 +3515,9 @@ static int igb_setup_receive_structures(struct adapter *adapter) { struct rx_ring *rxr = adapter->rx_rings; - int i, j; + int j; - for (i = 0; i < adapter->num_rx_queues; i++, rxr++) + for (j = 0; j < adapter->num_rx_queues; j++, rxr++) if (igb_setup_receive_ring(rxr)) goto fail; @@ -3527,14 +3526,13 @@ fail: /* * Free RX buffers allocated so far, we will only handle * the rings that completed, the failing case will have - * cleaned up for itself. The value of 'i' will be the - * failed ring so we must pre-decrement it. + * cleaned up for itself. Clean up til 'j', the failure. */ - rxr = adapter->rx_rings; - for (--i; i > 0; i--, rxr++) { - for (j = 0; j < adapter->num_rx_desc; j++) { + for (int i = 0; i < j; i++) { + rxr = &adapter->rx_rings[i]; + for (int n = 0; n < adapter->num_rx_desc; n++) { struct igb_buffer *rxbuf; - rxbuf = &rxr->rx_buffers[j]; + rxbuf = &rxr->rx_buffers[n]; if (rxbuf->m_head != NULL) { bus_dmamap_sync(rxr->rxtag, rxbuf->map, BUS_DMASYNC_POSTREAD); From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 02:19:45 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A323106564A; Thu, 27 Nov 2008 02:19:45 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1ECCB8FC1C; Thu, 27 Nov 2008 02:19:45 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAR2JjmK073025; Thu, 27 Nov 2008 02:19:45 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAR2Ji2M073024; Thu, 27 Nov 2008 02:19:44 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200811270219.mAR2Ji2M073024@svn.freebsd.org> From: Jack F Vogel Date: Thu, 27 Nov 2008 02:19:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 02:19:45 -0000 Author: jfv Date: Thu Nov 27 02:19:44 2008 New Revision: 185356 URL: http://svn.freebsd.org/changeset/base/185356 Log: Small nit I just noticed, a pre-decrement should be post. Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Thu Nov 27 02:18:43 2008 (r185355) +++ head/sys/dev/ixgbe/ixgbe.c Thu Nov 27 02:19:44 2008 (r185356) @@ -3244,7 +3244,7 @@ fail: * the rings that completed, the failing case will have * cleaned up for itself. 'j' failed, so its the terminus. */ - for (int i = 0; i < j; ++i) { + for (int i = 0; i < j; i++) { rxr = &adapter->rx_rings[i]; for (int n = 0; n < adapter->num_rx_desc; n++) { struct ixgbe_rx_buf *rxbuf; From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 02:33:14 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 337E21065677; Thu, 27 Nov 2008 02:33:14 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from publicd.ub.mng.net (publicd.ub.mng.net [202.179.0.88]) by mx1.freebsd.org (Postfix) with ESMTP id E27FB8FC20; Thu, 27 Nov 2008 02:33:13 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from [202.179.0.164] (helo=daemon.micom.mng.net) by publicd.ub.mng.net with esmtpa (Exim 4.69 (FreeBSD)) (envelope-from ) id 1L5Wgq-0005qX-DJ; Thu, 27 Nov 2008 10:33:12 +0800 Message-ID: <492E06E7.7060205@micom.mng.net> Date: Thu, 27 Nov 2008 10:33:11 +0800 From: Ganbold User-Agent: Thunderbird 2.0.0.12 (X11/20080415) MIME-Version: 1.0 To: Jack F Vogel References: <200811270218.mAR2Ih2g072971@svn.freebsd.org> In-Reply-To: <200811270218.mAR2Ih2g072971@svn.freebsd.org> X-Enigmail-Version: 0.95.6 OpenPGP: id=78F6425E Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185355 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 02:33:14 -0000 Jack F Vogel wrote: > Author: jfv > Date: Thu Nov 27 02:18:43 2008 > New Revision: 185355 > URL: http://svn.freebsd.org/changeset/base/185355 > > Log: > Thanks to the reminder from Ganbold, small fix in the RX failure > path for an infinite loop. Problem originally noticed in ixgbe > by Jeff Roberson and fixed there. Thanks to everyone involved. > > Modified: > head/sys/dev/e1000/if_igb.c > > Modified: head/sys/dev/e1000/if_igb.c > ============================================================================== > --- head/sys/dev/e1000/if_igb.c Thu Nov 27 01:57:23 2008 (r185354) > +++ head/sys/dev/e1000/if_igb.c Thu Nov 27 02:18:43 2008 (r185355) > @@ -3490,12 +3490,11 @@ igb_setup_receive_ring(struct rx_ring *r > return (0); > fail: > /* > - * We need to clean up any buffers allocated so far > - * 'j' is the failing index, decrement it to get the > - * last success. > + * We need to clean up any buffers allocated > + * so far, 'j' is the failing index. > */ > - for (--j; j < 0; j--) { > - rxbuf = &rxr->rx_buffers[j]; > + for (int i = 0; i < j; i++) { > + rxbuf = &rxr->rx_buffers[i]; > Thanks, it was CID: 2232. Ganbold > if (rxbuf->m_head != NULL) { > bus_dmamap_sync(rxr->rxtag, rxbuf->map, > BUS_DMASYNC_POSTREAD); > @@ -3516,9 +3515,9 @@ static int > igb_setup_receive_structures(struct adapter *adapter) > { > struct rx_ring *rxr = adapter->rx_rings; > - int i, j; > + int j; > > - for (i = 0; i < adapter->num_rx_queues; i++, rxr++) > + for (j = 0; j < adapter->num_rx_queues; j++, rxr++) > if (igb_setup_receive_ring(rxr)) > goto fail; > > @@ -3527,14 +3526,13 @@ fail: > /* > * Free RX buffers allocated so far, we will only handle > * the rings that completed, the failing case will have > - * cleaned up for itself. The value of 'i' will be the > - * failed ring so we must pre-decrement it. > + * cleaned up for itself. Clean up til 'j', the failure. > */ > - rxr = adapter->rx_rings; > - for (--i; i > 0; i--, rxr++) { > - for (j = 0; j < adapter->num_rx_desc; j++) { > + for (int i = 0; i < j; i++) { > + rxr = &adapter->rx_rings[i]; > + for (int n = 0; n < adapter->num_rx_desc; n++) { > struct igb_buffer *rxbuf; > - rxbuf = &rxr->rx_buffers[j]; > + rxbuf = &rxr->rx_buffers[n]; > if (rxbuf->m_head != NULL) { > bus_dmamap_sync(rxr->rxtag, rxbuf->map, > BUS_DMASYNC_POSTREAD); > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > > > > -- Don't abandon hope. Your Captain Midnight decoder ring arrives tomorrow. From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 02:55:35 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF4711065674 for ; Thu, 27 Nov 2008 02:55:35 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from rn-out-0910.google.com (rn-out-0910.google.com [64.233.170.185]) by mx1.freebsd.org (Postfix) with ESMTP id A861A8FC1A for ; Thu, 27 Nov 2008 02:55:35 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: by rn-out-0910.google.com with SMTP id j71so725472rne.12 for ; Wed, 26 Nov 2008 18:55:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=ZhKFAxj23IyTBNUbpceIZ6zeECNCXedTOQV6jk5UMIY=; b=lEYdj6F7gUV0jL76RKjpD+g3mAGnd2RjU92UuKEosc5MLFbF6JDODpOrQiNevrmmy/ I3PtEmGCuQ4M+NOtNYHKGdH3Zvw92m9HXuks9bCE+sEPuacsbWtLidcjbKk5ChgWp/Vb bb3wks05nGPoKvA5PyWwKQSf5R8NGIZa9Wp58= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=x6o1H/2+jskXAlELuU9ZzSZ1tgQxJrJddsLyjjtjLcvMWrextTsGwaphLUIy0S1MuL C3/8n07BsHylvmGA78mDwAFq3GPQWbb7abW/jxXuTqMMYnMTS+7V/HzGHL0GCLDg7kyI j+kAhU6qUcNSLUinosnCwA7LvF9cA7/OH6t0s= Received: by 10.151.111.1 with SMTP id o1mr2328377ybm.224.1227753130288; Wed, 26 Nov 2008 18:32:10 -0800 (PST) Received: from kan.dnsalias.net (c-24-62-106-68.hsd1.ma.comcast.net [24.62.106.68]) by mx.google.com with ESMTPS id m56sm1150472rnd.1.2008.11.26.18.32.09 (version=SSLv3 cipher=RC4-MD5); Wed, 26 Nov 2008 18:32:09 -0800 (PST) Date: Wed, 26 Nov 2008 21:32:04 -0500 From: Alexander Kabaev To: Jack F Vogel Message-ID: <20081126213204.14db9a63@kan.dnsalias.net> In-Reply-To: <200811270219.mAR2Ji2M073024@svn.freebsd.org> References: <200811270219.mAR2Ji2M073024@svn.freebsd.org> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/xwJ66CLH=qBQHy._dxUvhsV"; protocol="application/pgp-signature"; micalg=PGP-SHA1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 02:55:36 -0000 --Sig_/xwJ66CLH=qBQHy._dxUvhsV Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Thu, 27 Nov 2008 02:19:44 +0000 (UTC) Jack F Vogel wrote: > Author: jfv > Date: Thu Nov 27 02:19:44 2008 > New Revision: 185356 > URL: http://svn.freebsd.org/changeset/base/185356 >=20 > Log: > Small nit I just noticed, a pre-decrement should be post. >=20 > Modified: > head/sys/dev/ixgbe/ixgbe.c >=20 > Modified: head/sys/dev/ixgbe/ixgbe.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/ixgbe/ixgbe.c Thu Nov 27 02:18:43 2008 > (r185355) +++ head/sys/dev/ixgbe/ixgbe.c Thu Nov 27 02:19:44 > 2008 (r185356) @@ -3244,7 +3244,7 @@ fail: > * the rings that completed, the failing case will have > * cleaned up for itself. 'j' failed, so its the terminus. > */ > - for (int i =3D 0; i < j; ++i) { > + for (int i =3D 0; i < j; i++) { > rxr =3D &adapter->rx_rings[i]; > for (int n =3D 0; n < adapter->num_rx_desc; n++) { > struct ixgbe_rx_buf *rxbuf; Is C99 construct here intentional? If so, when did we agree on using only C99 compilers on our code base? =20 --=20 Alexander Kabaev --Sig_/xwJ66CLH=qBQHy._dxUvhsV Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iD8DBQFJLgakQ6z1jMm+XZYRAqekAJ9pUNa0z76G7JdZmiaOFZdtPpSougCeJ6cV kYDeSGSBJmyIqBOfv4EWwTo= =GEf0 -----END PGP SIGNATURE----- --Sig_/xwJ66CLH=qBQHy._dxUvhsV-- From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 03:37:46 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4FB01065670; Thu, 27 Nov 2008 03:37:46 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A0AF48FC12; Thu, 27 Nov 2008 03:37:46 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAR3bkxe074790; Thu, 27 Nov 2008 03:37:46 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAR3bkcR074789; Thu, 27 Nov 2008 03:37:46 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200811270337.mAR3bkcR074789@svn.freebsd.org> From: Peter Wemm Date: Thu, 27 Nov 2008 03:37:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185357 - head/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 03:37:46 -0000 Author: peter Date: Thu Nov 27 03:37:46 2008 New Revision: 185357 URL: http://svn.freebsd.org/changeset/base/185357 Log: Don't let ata_completed() dereference a null request->dma pointer to print dma status after a media error. Modified: head/sys/dev/ata/ata-queue.c Modified: head/sys/dev/ata/ata-queue.c ============================================================================== --- head/sys/dev/ata/ata-queue.c Thu Nov 27 02:19:44 2008 (r185356) +++ head/sys/dev/ata/ata-queue.c Thu Nov 27 03:37:46 2008 (r185357) @@ -357,7 +357,7 @@ ata_completed(void *context, int dummy) "\6MEDIA_CHANGED\5NID_NOT_FOUND" "\4MEDIA_CHANGE_REQEST" "\3ABORTED\2NO_MEDIA\1ILLEGAL_LENGTH"); - if ((request->flags & ATA_R_DMA) && + if ((request->flags & ATA_R_DMA) && request->dma && (request->dma->status & ATA_BMSTAT_ERROR)) printf(" dma=0x%02x", request->dma->status); if (!(request->flags & (ATA_R_ATAPI | ATA_R_CONTROL))) From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 04:40:38 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0371B106564A; Thu, 27 Nov 2008 04:40:38 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 023908FC0A; Thu, 27 Nov 2008 04:40:38 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAR4ebfw076056; Thu, 27 Nov 2008 04:40:37 GMT (envelope-from ganbold@svn.freebsd.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAR4ebIw076055; Thu, 27 Nov 2008 04:40:37 GMT (envelope-from ganbold@svn.freebsd.org) Message-Id: <200811270440.mAR4ebIw076055@svn.freebsd.org> From: Ganbold Tsagaankhuu Date: Thu, 27 Nov 2008 04:40:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185358 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 04:40:38 -0000 Author: ganbold (doc committer) Date: Thu Nov 27 04:40:37 2008 New Revision: 185358 URL: http://svn.freebsd.org/changeset/base/185358 Log: Remove unused variable. Found with: Coverity Prevent(tm) CID: 3664 Approved by: kib Modified: head/sys/kern/kern_lockf.c Modified: head/sys/kern/kern_lockf.c ============================================================================== --- head/sys/kern/kern_lockf.c Thu Nov 27 03:37:46 2008 (r185357) +++ head/sys/kern/kern_lockf.c Thu Nov 27 04:40:37 2008 (r185358) @@ -1342,7 +1342,6 @@ static int lf_setlock(struct lockf *state, struct lockf_entry *lock, struct vnode *vp, void **cookiep) { - struct lockf_entry *block; static char lockstr[] = "lockf"; int priority, error; @@ -1362,7 +1361,7 @@ lf_setlock(struct lockf *state, struct l /* * Scan lock list for this file looking for locks that would block us. */ - while ((block = lf_getblock(state, lock))) { + while (lf_getblock(state, lock)) { /* * Free the structure and return if nonblocking. */ From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 05:14:36 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDEF1106564A; Thu, 27 Nov 2008 05:14:36 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DDA498FC16; Thu, 27 Nov 2008 05:14:36 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAR5Eait076810; Thu, 27 Nov 2008 05:14:36 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAR5Ea1n076809; Thu, 27 Nov 2008 05:14:36 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200811270514.mAR5Ea1n076809@svn.freebsd.org> From: Tim Kientzle Date: Thu, 27 Nov 2008 05:14:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185359 - head/usr.bin/tar X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 05:14:37 -0000 Author: kientzle Date: Thu Nov 27 05:14:36 2008 New Revision: 185359 URL: http://svn.freebsd.org/changeset/base/185359 Log: If we're unable to chdir() to a directory that we know exists, that should result in a non-zero return value. In particular, this should address the issue that David Wolfskill ran into with a somewhat flaky NFS mount resulting in a damaged archive even though tar returned success. MFC after: 4 days Modified: head/usr.bin/tar/write.c Modified: head/usr.bin/tar/write.c ============================================================================== --- head/usr.bin/tar/write.c Thu Nov 27 04:40:37 2008 (r185358) +++ head/usr.bin/tar/write.c Thu Nov 27 05:14:36 2008 (r185359) @@ -655,8 +655,10 @@ write_hierarchy(struct bsdtar *bsdtar, s const struct stat *st = NULL, *lst = NULL; int descend; - if (tree_ret == TREE_ERROR_DIR) + if (tree_ret == TREE_ERROR_DIR) { bsdtar_warnc(bsdtar, errno, "%s: Couldn't visit directory", name); + bsdtar->return_value = 1; + } if (tree_ret != TREE_REGULAR) continue; lst = tree_current_lstat(tree); From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 05:49:53 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5209C1065674; Thu, 27 Nov 2008 05:49:53 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D4848FC26; Thu, 27 Nov 2008 05:49:53 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAR5nriY077474; Thu, 27 Nov 2008 05:49:53 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAR5nrYE077471; Thu, 27 Nov 2008 05:49:53 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200811270549.mAR5nrYE077471@svn.freebsd.org> From: Tim Kientzle Date: Thu, 27 Nov 2008 05:49:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185360 - head/usr.bin/tar X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 05:49:53 -0000 Author: kientzle Date: Thu Nov 27 05:49:52 2008 New Revision: 185360 URL: http://svn.freebsd.org/changeset/base/185360 Log: After visiting a subdirectory, we use chdir("..") or fchdir() to return back to the parent. If those fail, we're just dead in the water. Add a new error value TREE_ERROR_FATAL to indicate that directory traversal cannot continue. Have write.c honor that by exiting immediately. MFC after: 30 days Modified: head/usr.bin/tar/tree.c head/usr.bin/tar/tree.h head/usr.bin/tar/write.c Modified: head/usr.bin/tar/tree.c ============================================================================== --- head/usr.bin/tar/tree.c Thu Nov 27 05:14:36 2008 (r185359) +++ head/usr.bin/tar/tree.c Thu Nov 27 05:49:52 2008 (r185360) @@ -227,20 +227,28 @@ tree_open(const char *path) /* * We've finished a directory; ascend back to the parent. */ -static void +static int tree_ascend(struct tree *t) { struct tree_entry *te; + int r = 0; te = t->stack; t->depth--; if (te->flags & isDirLink) { - fchdir(te->fd); + if (fchdir(te->fd) != 0) { + t->tree_errno = errno; + r = TREE_ERROR_FATAL; + } close(te->fd); t->openCount--; } else { - chdir(".."); + if (chdir("..") != 0) { + t->tree_errno = errno; + r = TREE_ERROR_FATAL; + } } + return (r); } /* @@ -272,6 +280,17 @@ int tree_next(struct tree *t) { struct dirent *de = NULL; + int r; + + /* If we're called again after a fatal error, that's an API + * violation. Just crash now. */ + if (t->visit_type == TREE_ERROR_FATAL) { + const char *msg = "Unable to continue traversing" + " directory heirarchy after a fatal error."; + write(2, msg, strlen(msg)); + *(int *)0 = 1; /* Deliberate SEGV; NULL pointer dereference. */ + exit(1); /* In case the SEGV didn't work. */ + } /* Handle the startup case by returning the initial entry. */ if (t->flags & needsReturn) { @@ -327,10 +346,11 @@ tree_next(struct tree *t) t->depth++; t->d = opendir("."); if (t->d == NULL) { - tree_ascend(t); /* Undo "chdir" */ + r = tree_ascend(t); /* Undo "chdir" */ tree_pop(t); t->tree_errno = errno; - return (t->visit_type = TREE_ERROR_DIR); + t->visit_type = r != 0 ? r : TREE_ERROR_DIR; + return (t->visit_type); } t->flags &= ~hasLstat; t->flags &= ~hasStat; @@ -340,11 +360,12 @@ tree_next(struct tree *t) /* We've done everything necessary for the top stack entry. */ if (t->stack->flags & needsPostVisit) { - tree_ascend(t); + r = tree_ascend(t); tree_pop(t); t->flags &= ~hasLstat; t->flags &= ~hasStat; - return (t->visit_type = TREE_POSTASCENT); + t->visit_type = r != 0 ? r : TREE_POSTASCENT; + return (t->visit_type); } } return (t->visit_type = 0); Modified: head/usr.bin/tar/tree.h ============================================================================== --- head/usr.bin/tar/tree.h Thu Nov 27 05:14:36 2008 (r185359) +++ head/usr.bin/tar/tree.h Thu Nov 27 05:49:52 2008 (r185360) @@ -36,8 +36,7 @@ * * Supports very deep logical traversals. The fts package * uses "non-chdir" approach for logical traversals. This * package does use a chdir approach for logical traversals - * and can therefore handle pathnames much longer than - * PATH_MAX. + * and can therefore handle pathnames much longer than PATH_MAX. * * Supports deep physical traversals "out of the box." * Due to the memory optimizations above, there's no need to * limit dir names to 32k. @@ -53,23 +52,31 @@ struct tree *tree_open(const char * /* p void tree_close(struct tree *); /* - * tree_next() returns Zero if there is no next entry, non-zero if there is. - * Note that directories are potentially visited three times. The first - * time as "regular" file. If tree_descend() is invoked at that time, - * the directory is added to a work list and will be visited two more - * times: once just after descending into the directory and again - * just after ascending back to the parent. + * tree_next() returns Zero if there is no next entry, non-zero if + * there is. Note that directories are potentially visited three + * times. Directories are always visited first as part of enumerating + * their parent. If tree_descend() is invoked at that time, the + * directory is added to a work list and will subsequently be visited + * two more times: once just after descending into the directory and + * again just after ascending back to the parent. * - * TREE_ERROR is returned if the descent failed (because the + * TREE_ERROR_DIR is returned if the descent failed (because the * directory couldn't be opened, for instance). This is returned - * instead of TREE_PREVISIT/TREE_POSTVISIT. + * instead of TREE_PREVISIT/TREE_POSTVISIT. TREE_ERROR_DIR is not a + * fatal error, but it does imply that the relevant subtree won't be + * visited. TREE_ERROR_FATAL is returned for an error that left the + * traversal completely hosed. Right now, this is only returned for + * chdir() failures during ascent. */ #define TREE_REGULAR 1 #define TREE_POSTDESCENT 2 #define TREE_POSTASCENT 3 #define TREE_ERROR_DIR -1 +#define TREE_ERROR_FATAL -2 + int tree_next(struct tree *); +/* Errno value associated with the last traversal error. */ int tree_errno(struct tree *); /* @@ -85,7 +92,9 @@ void tree_descend(struct tree *); * Return information about the current entry. */ +/* Current depth in the traversal. */ int tree_current_depth(struct tree *); + /* * The current full pathname, length of the full pathname, * and a name that can be used to access the file. @@ -95,6 +104,7 @@ int tree_current_depth(struct tree *); const char *tree_current_path(struct tree *); size_t tree_current_pathlen(struct tree *); const char *tree_current_access_path(struct tree *); + /* * Request the lstat() or stat() data for the current path. Since the * tree package needs to do some of this anyway, and caches the @@ -103,7 +113,9 @@ const char *tree_current_access_path(str */ const struct stat *tree_current_stat(struct tree *); const struct stat *tree_current_lstat(struct tree *); -/* The following tests may use mechanisms much faster than stat()/lstat(). */ + +/* The following functions use tricks to avoid a certain number of + * stat()/lstat() calls. */ /* "is_physical_dir" is equivalent to S_ISDIR(tree_current_lstat()->st_mode) */ int tree_current_is_physical_dir(struct tree *); /* "is_physical_link" is equivalent to S_ISLNK(tree_current_lstat()->st_mode) */ Modified: head/usr.bin/tar/write.c ============================================================================== --- head/usr.bin/tar/write.c Thu Nov 27 05:14:36 2008 (r185359) +++ head/usr.bin/tar/write.c Thu Nov 27 05:49:52 2008 (r185360) @@ -655,8 +655,13 @@ write_hierarchy(struct bsdtar *bsdtar, s const struct stat *st = NULL, *lst = NULL; int descend; + if (tree_ret == TREE_ERROR_FATAL) + bsdtar_errc(bsdtar, 1, tree_errno(tree), + "%s: Unable to continue traversing directory tree", + name); if (tree_ret == TREE_ERROR_DIR) { - bsdtar_warnc(bsdtar, errno, "%s: Couldn't visit directory", name); + bsdtar_warnc(bsdtar, errno, + "%s: Couldn't visit directory", name); bsdtar->return_value = 1; } if (tree_ret != TREE_REGULAR) From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 06:21:05 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 244191065673; Thu, 27 Nov 2008 06:21:05 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1CEC18FC08; Thu, 27 Nov 2008 06:21:05 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAR6L4vt078109; Thu, 27 Nov 2008 06:21:04 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAR6L4cb078108; Thu, 27 Nov 2008 06:21:04 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200811270621.mAR6L4cb078108@svn.freebsd.org> From: Tim Kientzle Date: Thu, 27 Nov 2008 06:21:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185361 - head/sys/fs/cd9660 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 06:21:05 -0000 Author: kientzle Date: Thu Nov 27 06:21:04 2008 New Revision: 185361 URL: http://svn.freebsd.org/changeset/base/185361 Log: The timezone byte is a signed value, treat it as such. Otherwise, time zone information for time zones west of GMT gets discarded. PR: kern/128934 Submitted by: J.R. Oldroyd MFC after: 4 days Modified: head/sys/fs/cd9660/cd9660_node.c Modified: head/sys/fs/cd9660/cd9660_node.c ============================================================================== --- head/sys/fs/cd9660/cd9660_node.c Thu Nov 27 05:49:52 2008 (r185360) +++ head/sys/fs/cd9660/cd9660_node.c Thu Nov 27 06:21:04 2008 (r185361) @@ -241,7 +241,7 @@ cd9660_tstamp_conv7(pi,pu,ftype) minute = pi[4]; second = pi[5]; if(ftype != ISO_FTYPE_HIGH_SIERRA) - tz = pi[6]; + tz = ((signed char *)pi)[6]; /* Timezone value is signed. */ else /* original high sierra misses timezone data */ tz = 0; From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 07:08:45 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A6DB106564A; Thu, 27 Nov 2008 07:08:45 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id EE2958FC0C; Thu, 27 Nov 2008 07:08:44 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id mAR76JP8094847; Thu, 27 Nov 2008 00:06:19 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Thu, 27 Nov 2008 00:06:21 -0700 (MST) Message-Id: <20081127.000621.1413927847.imp@bsdimp.com> To: kabaev@gmail.com From: "M. Warner Losh" In-Reply-To: <20081126213204.14db9a63@kan.dnsalias.net> References: <200811270219.mAR2Ji2M073024@svn.freebsd.org> <20081126213204.14db9a63@kan.dnsalias.net> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: jfv@FreeBSD.org, svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 07:08:45 -0000 In message: <20081126213204.14db9a63@kan.dnsalias.net> Alexander Kabaev writes: : On Thu, 27 Nov 2008 02:19:44 +0000 (UTC) : Jack F Vogel wrote: : : > Author: jfv : > Date: Thu Nov 27 02:19:44 2008 : > New Revision: 185356 : > URL: http://svn.freebsd.org/changeset/base/185356 : > : > Log: : > Small nit I just noticed, a pre-decrement should be post. : > : > Modified: : > head/sys/dev/ixgbe/ixgbe.c : > : > Modified: head/sys/dev/ixgbe/ixgbe.c : > ============================================================================== : > --- head/sys/dev/ixgbe/ixgbe.c Thu Nov 27 02:18:43 2008 : > (r185355) +++ head/sys/dev/ixgbe/ixgbe.c Thu Nov 27 02:19:44 : > 2008 (r185356) @@ -3244,7 +3244,7 @@ fail: : > * the rings that completed, the failing case will have : > * cleaned up for itself. 'j' failed, so its the terminus. : > */ : > - for (int i = 0; i < j; ++i) { : > + for (int i = 0; i < j; i++) { : > rxr = &adapter->rx_rings[i]; : > for (int n = 0; n < adapter->num_rx_desc; n++) { : > struct ixgbe_rx_buf *rxbuf; : : Is C99 construct here intentional? If so, when did we agree on using : only C99 compilers on our code base? I'm not sure about *THIS* c99 construct, but we've been heavily relying on the field name initializer stuff for a couple of years now. eg: static struct cdevsw lpt_cdevsw = { .d_version = D_VERSION, .d_flags = D_NEEDGIANT, .d_open = lptopen, .d_close = lptclose, .d_read = lptread, .d_write = lptwrite, .d_ioctl = lptioctl, .d_name = LPT_NAME, }; Warner From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 08:03:24 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 651E5106564A; Thu, 27 Nov 2008 08:03:24 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 407118FC08; Thu, 27 Nov 2008 08:03:24 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTP id DCE7546B17; Thu, 27 Nov 2008 03:03:23 -0500 (EST) Date: Thu, 27 Nov 2008 08:03:23 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Max Laier In-Reply-To: <200811262208.48429.max@love2party.net> Message-ID: References: <200811262052.mAQKqRN5065921@svn.freebsd.org> <200811262208.48429.max@love2party.net> User-Agent: Alpine 1.10 (BSF 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, "Bjoern A. Zeeb" , src-committers@freebsd.org Subject: Re: svn commit: r185344 - in head/sys: netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 08:03:24 -0000 On Wed, 26 Nov 2008, Max Laier wrote: > On Wednesday 26 November 2008 21:52:27 Bjoern A. Zeeb wrote: >> Author: bz >> Date: Wed Nov 26 20:52:26 2008 >> New Revision: 185344 >> URL: http://svn.freebsd.org/changeset/base/185344 >> >> Log: >> Remove in6_pcbdetach() as it is exactly the same function >> as in_pcbdetach() and we don't need the code twice. >> >> Reviewed by: rwatson >> MFC after: 6 weeks (*) >> (*) possibly need to leave a stub wrapper in 7 to keep the symbol. > > Won't this affect our ability to build INET6, but non INET kernels? Not > that we currently could, but if we ever wanted to? INET6 already depends on other things in_pcb.c directly, such as in_pcballoc(). The distinction made between struct inpcb and struct in6pcb is artificial, and mostly quite confusing, so we've been gradually eliminating it. It's largely incompatible with the implementation of IPv4 addresses mapped into the IPv6 space, which relies on IPv6 sockets being able to be in IPv4 connection lists, etc. We have long-term plans to eliminate most of the macro aliasing of fields between the one structure. Robert N M Watson Computer Laboratory University of Cambridge From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 08:20:35 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C11DA1065672; Thu, 27 Nov 2008 08:20:35 +0000 (UTC) (envelope-from rdivacky@lev.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id 75AC38FC1A; Thu, 27 Nov 2008 08:20:34 +0000 (UTC) (envelope-from rdivacky@lev.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 8D0479CB181; Thu, 27 Nov 2008 09:16:10 +0100 (CET) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I7Fb+Iq5K5OD; Thu, 27 Nov 2008 09:16:08 +0100 (CET) Received: from lev.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 5BD7E9CB7E8; Thu, 27 Nov 2008 09:16:08 +0100 (CET) Received: (from rdivacky@localhost) by lev.vlakno.cz (8.14.2/8.14.2/Submit) id mAR8G8DF089272; Thu, 27 Nov 2008 09:16:08 +0100 (CET) (envelope-from rdivacky) Date: Thu, 27 Nov 2008 09:16:08 +0100 From: Roman Divacky To: Alexander Kabaev Message-ID: <20081127081607.GA88795@freebsd.org> References: <200811270219.mAR2Ji2M073024@svn.freebsd.org> <20081126213204.14db9a63@kan.dnsalias.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081126213204.14db9a63@kan.dnsalias.net> User-Agent: Mutt/1.4.2.3i Cc: Jack F Vogel , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 08:20:35 -0000 On Wed, Nov 26, 2008 at 09:32:04PM -0500, Alexander Kabaev wrote: > On Thu, 27 Nov 2008 02:19:44 +0000 (UTC) > Jack F Vogel wrote: > > > Author: jfv > > Date: Thu Nov 27 02:19:44 2008 > > New Revision: 185356 > > URL: http://svn.freebsd.org/changeset/base/185356 > > > > Log: > > Small nit I just noticed, a pre-decrement should be post. > > > > Modified: > > head/sys/dev/ixgbe/ixgbe.c > > > > Modified: head/sys/dev/ixgbe/ixgbe.c > > ============================================================================== > > --- head/sys/dev/ixgbe/ixgbe.c Thu Nov 27 02:18:43 2008 > > (r185355) +++ head/sys/dev/ixgbe/ixgbe.c Thu Nov 27 02:19:44 > > 2008 (r185356) @@ -3244,7 +3244,7 @@ fail: > > * the rings that completed, the failing case will have > > * cleaned up for itself. 'j' failed, so its the terminus. > > */ > > - for (int i = 0; i < j; ++i) { > > + for (int i = 0; i < j; i++) { > > rxr = &adapter->rx_rings[i]; > > for (int n = 0; n < adapter->num_rx_desc; n++) { > > struct ixgbe_rx_buf *rxbuf; > > Is C99 construct here intentional? If so, when did we agree on using > only C99 compilers on our code base? kernel has been compiling with c99 for a long time now. World is still c89 but compiles cleanly as c99 as of a few days ago (the zfs update + the sendmail fix) I did not test that the world compiles to a correct code using c99 but I am going to work on that soon. From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 08:42:58 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B549D1065672; Thu, 27 Nov 2008 08:42:58 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A54DC8FC19; Thu, 27 Nov 2008 08:42:58 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAR8gwO7080975; Thu, 27 Nov 2008 08:42:58 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAR8gwi3080974; Thu, 27 Nov 2008 08:42:58 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200811270842.mAR8gwi3080974@svn.freebsd.org> From: Robert Watson Date: Thu, 27 Nov 2008 08:42:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185362 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 08:42:58 -0000 Author: rwatson Date: Thu Nov 27 08:42:58 2008 New Revision: 185362 URL: http://svn.freebsd.org/changeset/base/185362 Log: Revert r184509: don't encourage the use of sysexits.h with err() and errx(),, as there seems to be a general preference against this practice. Suggested by: bde, des, jhb Modified: head/share/man/man9/style.9 Modified: head/share/man/man9/style.9 ============================================================================== --- head/share/man/man9/style.9 Thu Nov 27 06:21:04 2008 (r185361) +++ head/share/man/man9/style.9 Thu Nov 27 08:42:58 2008 (r185362) @@ -716,9 +716,9 @@ or do not roll your own. .Bd -literal if ((four = malloc(sizeof(struct foo))) == NULL) - err(EX_OSERR, NULL); + err(1, (char *)NULL); if ((six = (int *)overflow()) == NULL) - errx(EX_DATAERR, "number overflowed"); + errx(1, "number overflowed"); return (eight); } .Ed From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 08:58:45 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90B761065678; Thu, 27 Nov 2008 08:58:45 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 503558FC16; Thu, 27 Nov 2008 08:58:45 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 54C2C6D449; Thu, 27 Nov 2008 08:58:44 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 345CA8449F; Thu, 27 Nov 2008 09:58:44 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Jack F Vogel References: <200811270219.mAR2Ji2M073024@svn.freebsd.org> Date: Thu, 27 Nov 2008 09:58:44 +0100 In-Reply-To: <200811270219.mAR2Ji2M073024@svn.freebsd.org> (Jack F. Vogel's message of "Thu, 27 Nov 2008 02:19:44 +0000 (UTC)") Message-ID: <86zljl4kaj.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 08:58:45 -0000 Jack F Vogel writes: > Log: > Small nit I just noticed, a pre-decrement should be post. Why? It makes absolutely no difference. (s/decrement/increment/, btw) Personally, I always use pre-{inc,dec}rement when I don't care about the value of the expression, but I guess it's a matter of taste. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 09:00:48 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E95851065672; Thu, 27 Nov 2008 09:00:47 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D715B8FC20; Thu, 27 Nov 2008 09:00:47 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAR90lXu081419; Thu, 27 Nov 2008 09:00:47 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAR90lQH081411; Thu, 27 Nov 2008 09:00:47 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200811270900.mAR90lQH081411@svn.freebsd.org> From: Joseph Koshy Date: Thu, 27 Nov 2008 09:00:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185363 - in head: lib/libpmc sys/amd64/include sys/conf sys/dev/hwpmc sys/i386/include sys/modules/hwpmc sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 09:00:48 -0000 Author: jkoshy Date: Thu Nov 27 09:00:47 2008 New Revision: 185363 URL: http://svn.freebsd.org/changeset/base/185363 Log: - Add support for PMCs in Intel CPUs of Family 6, model 0xE (Core Solo and Core Duo), models 0xF (Core2), model 0x17 (Core2Extreme) and model 0x1C (Atom). In these CPUs, the actual numbers, kinds and widths of PMCs present need to queried at run time. Support for specific "architectural" events also needs to be queried at run time. Model 0xE CPUs support programmable PMCs, subsequent CPUs additionally support "fixed-function" counters. - Use event names that are close to vendor documentation, taking in account that: - events with identical semantics on two or more CPUs in this family can have differing names in vendor documentation, - identical vendor event names may map to differing events across CPUs, - each type of CPU supports a different subset of measurable events. Fixed-function and programmable counters both use the same vendor names for events. The use of a class name prefix ("iaf-" or "iap-" respectively) permits these to be distinguished. - In libpmc, refactor pmc_name_of_event() into a public interface and an internal helper function, for use by log handling code. - Minor code tweaks: staticize a global, freshen a few comments. Tested by: gnn Added: head/lib/libpmc/libpmcinternal.h (contents, props changed) head/sys/dev/hwpmc/hwpmc_core.c (contents, props changed) head/sys/dev/hwpmc/hwpmc_core.h (contents, props changed) Modified: head/lib/libpmc/libpmc.c head/lib/libpmc/pmclog.c head/sys/amd64/include/pmc_mdep.h head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/dev/hwpmc/hwpmc_intel.c head/sys/dev/hwpmc/hwpmc_logging.c head/sys/dev/hwpmc/hwpmc_mod.c head/sys/dev/hwpmc/pmc_events.h head/sys/i386/include/pmc_mdep.h head/sys/modules/hwpmc/Makefile head/sys/sys/param.h head/sys/sys/pmc.h head/sys/sys/pmclog.h Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Thu Nov 27 08:42:58 2008 (r185362) +++ head/lib/libpmc/libpmc.c Thu Nov 27 09:00:47 2008 (r185363) @@ -42,12 +42,18 @@ __FBSDID("$FreeBSD$"); #include #include +#include "libpmcinternal.h" + /* Function prototypes */ #if defined(__i386__) static int k7_allocate_pmc(enum pmc_event _pe, char *_ctrspec, struct pmc_op_pmcallocate *_pmc_config); #endif #if defined(__amd64__) || defined(__i386__) +static int iaf_allocate_pmc(enum pmc_event _pe, char *_ctrspec, + struct pmc_op_pmcallocate *_pmc_config); +static int iap_allocate_pmc(enum pmc_event _pe, char *_ctrspec, + struct pmc_op_pmcallocate *_pmc_config); static int k8_allocate_pmc(enum pmc_event _pe, char *_ctrspec, struct pmc_op_pmcallocate *_pmc_config); static int p4_allocate_pmc(enum pmc_event _pe, char *_ctrspec, @@ -110,19 +116,55 @@ struct pmc_class_descr { #define __PMC_EV(C,N) { #N, PMC_EV_ ## C ## _ ## N }, /* - * PMC_MDEP_TABLE(NAME, CLASS, ADDITIONAL_CLASSES...) + * PMC_CLASSDEP_TABLE(NAME, CLASS) * - * Build an event descriptor table and a list of valid PMC classes. + * Define a table mapping event names and aliases to HWPMC event IDs. */ -#define PMC_MDEP_TABLE(N,C,...) \ +#define PMC_CLASSDEP_TABLE(N, C) \ static const struct pmc_event_descr N##_event_table[] = \ { \ __PMC_EV_##C() \ - }; \ + } + +PMC_CLASSDEP_TABLE(iaf, IAF); +PMC_CLASSDEP_TABLE(k7, K7); +PMC_CLASSDEP_TABLE(k8, K8); +PMC_CLASSDEP_TABLE(p4, P4); +PMC_CLASSDEP_TABLE(p5, P5); +PMC_CLASSDEP_TABLE(p6, P6); + +#undef __PMC_EV_ALIAS +#define __PMC_EV_ALIAS(N,CODE) { N, PMC_EV_##CODE }, + +static const struct pmc_event_descr atom_event_table[] = +{ + __PMC_EV_ALIAS_ATOM() +}; + +static const struct pmc_event_descr core_event_table[] = +{ + __PMC_EV_ALIAS_CORE() +}; + + +static const struct pmc_event_descr core2_event_table[] = +{ + __PMC_EV_ALIAS_CORE2() +}; + +/* + * PMC_MDEP_TABLE(NAME, PRIMARYCLASS, ADDITIONAL_CLASSES...) + * + * Map a CPU to the PMC classes it supports. + */ +#define PMC_MDEP_TABLE(N,C,...) \ static const enum pmc_class N##_pmc_classes[] = { \ PMC_CLASS_##C, __VA_ARGS__ \ } +PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); +PMC_MDEP_TABLE(core, IAP, PMC_CLASS_TSC); +PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(k7, K7, PMC_CLASS_TSC); PMC_MDEP_TABLE(k8, K8, PMC_CLASS_TSC); PMC_MDEP_TABLE(p4, P4, PMC_CLASS_TSC); @@ -135,39 +177,44 @@ static const struct pmc_event_descr tsc_ }; #undef PMC_CLASS_TABLE_DESC -#define PMC_CLASS_TABLE_DESC(N, C) { \ - .pm_evc_name = #N "-", \ - .pm_evc_name_size = sizeof(#N "-") - 1, \ - .pm_evc_class = PMC_CLASS_##C , \ - .pm_evc_event_table = N##_event_table , \ +#define PMC_CLASS_TABLE_DESC(NAME, CLASS, EVENTS, ALLOCATOR) \ +static const struct pmc_class_descr NAME##_class_table_descr = \ + { \ + .pm_evc_name = #CLASS "-", \ + .pm_evc_name_size = sizeof(#CLASS "-") - 1, \ + .pm_evc_class = PMC_CLASS_##CLASS , \ + .pm_evc_event_table = EVENTS##_event_table , \ .pm_evc_event_table_size = \ - PMC_EVENT_TABLE_SIZE(N), \ - .pm_evc_allocate_pmc = N##_allocate_pmc \ + PMC_EVENT_TABLE_SIZE(EVENTS), \ + .pm_evc_allocate_pmc = ALLOCATOR##_allocate_pmc \ } -static const struct pmc_class_descr pmc_class_table[] = -{ +#if defined(__i386__) || defined(__amd64__) +PMC_CLASS_TABLE_DESC(iaf, IAF, iaf, iaf); +PMC_CLASS_TABLE_DESC(atom, IAP, atom, iap); +PMC_CLASS_TABLE_DESC(core, IAP, core, iap); +PMC_CLASS_TABLE_DESC(core2, IAP, core2, iap); +#endif #if defined(__i386__) - PMC_CLASS_TABLE_DESC(k7, K7), +PMC_CLASS_TABLE_DESC(k7, K7, k7, k7); #endif #if defined(__i386__) || defined(__amd64__) - PMC_CLASS_TABLE_DESC(k8, K8), - PMC_CLASS_TABLE_DESC(p4, P4), +PMC_CLASS_TABLE_DESC(k8, K8, k8, k8); +PMC_CLASS_TABLE_DESC(p4, P4, p4, p4); #endif #if defined(__i386__) - PMC_CLASS_TABLE_DESC(p5, P5), - PMC_CLASS_TABLE_DESC(p6, P6), +PMC_CLASS_TABLE_DESC(p5, P5, p5, p5); +PMC_CLASS_TABLE_DESC(p6, P6, p6, p6); #endif #if defined(__i386__) || defined(__amd64__) - PMC_CLASS_TABLE_DESC(tsc, TSC) +PMC_CLASS_TABLE_DESC(tsc, TSC, tsc, tsc); #endif -}; - -static size_t pmc_event_class_table_size = - PMC_TABLE_SIZE(pmc_class_table); #undef PMC_CLASS_TABLE_DESC +static const struct pmc_class_descr **pmc_class_table; +#define PMC_CLASS_TABLE_SIZE cpu_info.pm_nclass + static const enum pmc_class *pmc_mdep_class_list; static size_t pmc_mdep_class_list_size; @@ -371,6 +418,237 @@ k7_allocate_pmc(enum pmc_event pe, char #if defined(__amd64__) || defined(__i386__) /* + * Intel Core (Family 6, Model E) PMCs. + */ + +static struct pmc_event_alias core_aliases[] = { + EV_ALIAS("branches", "iap-br-instr-ret"), + EV_ALIAS("branch-mispredicts", "iap-br-mispred-ret"), + EV_ALIAS("cycles", "tsc-tsc"), + EV_ALIAS("ic-misses", "iap-icache-misses"), + EV_ALIAS("instructions", "iap-instr-ret"), + EV_ALIAS("interrupts", "iap-core-hw-int-rx"), + EV_ALIAS("unhalted-cycles", "iap-unhalted-core-cycles"), + EV_ALIAS(NULL, NULL) +}; + +/* + * Intel Core2 (Family 6, Model F), Core2Extreme (Family 6, Model 17H) + * and Atom (Family 6, model 1CH) PMCs. + */ + +static struct pmc_event_alias core2_aliases[] = { + EV_ALIAS("branches", "iap-br-inst-retired.any"), + EV_ALIAS("branch-mispredicts", "iap-br-inst-retired.mispred"), + EV_ALIAS("cycles", "tsc-tsc"), + EV_ALIAS("ic-misses", "iap-l1i-misses"), + EV_ALIAS("instructions", "iaf-instr-retired.any"), + EV_ALIAS("interrupts", "iap-hw-int-rcv"), + EV_ALIAS("unhalted-cycles", "iaf-cpu-clk-unhalted.core"), + EV_ALIAS(NULL, NULL) +}; +#define atom_aliases core2_aliases + +#define IAF_KW_OS "os" +#define IAF_KW_USR "usr" +#define IAF_KW_ANYTHREAD "anythread" + +/* + * Parse an event specifier for Intel fixed function counters. + */ +static int +iaf_allocate_pmc(enum pmc_event pe, char *ctrspec, + struct pmc_op_pmcallocate *pmc_config) +{ + char *p; + + (void) pe; + + pmc_config->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE); + pmc_config->pm_md.pm_iaf.pm_iaf_flags = 0; + + while ((p = strsep(&ctrspec, ",")) != NULL) { + if (KWMATCH(p, IAF_KW_OS)) + pmc_config->pm_caps |= PMC_CAP_SYSTEM; + else if (KWMATCH(p, IAF_KW_USR)) + pmc_config->pm_caps |= PMC_CAP_USER; + else if (KWMATCH(p, IAF_KW_ANYTHREAD)) + pmc_config->pm_md.pm_iaf.pm_iaf_flags |= IAF_ANY; + else + return (-1); + } + + return (0); +} + +/* + * Core/Core2 support. + */ + +#define IAP_KW_AGENT "agent" +#define IAP_KW_ANYTHREAD "anythread" +#define IAP_KW_CACHESTATE "cachestate" +#define IAP_KW_CMASK "cmask" +#define IAP_KW_CORE "core" +#define IAP_KW_EDGE "edge" +#define IAP_KW_INV "inv" +#define IAP_KW_OS "os" +#define IAP_KW_PREFETCH "prefetch" +#define IAP_KW_SNOOPRESPONSE "snoopresponse" +#define IAP_KW_SNOOPTYPE "snooptype" +#define IAP_KW_TRANSITION "trans" +#define IAP_KW_USR "usr" + +static struct pmc_masks iap_core_mask[] = { + PMCMASK(all, (0x3 << 14)), + PMCMASK(this, (0x1 << 14)), + NULLMASK +}; + +static struct pmc_masks iap_agent_mask[] = { + PMCMASK(this, 0), + PMCMASK(any, (0x1 << 13)), + NULLMASK +}; + +static struct pmc_masks iap_prefetch_mask[] = { + PMCMASK(both, (0x3 << 12)), + PMCMASK(only, (0x1 << 12)), + PMCMASK(exclude, 0), + NULLMASK +}; + +static struct pmc_masks iap_cachestate_mask[] = { + PMCMASK(i, (1 << 8)), + PMCMASK(s, (1 << 9)), + PMCMASK(e, (1 << 10)), + PMCMASK(m, (1 << 11)), + NULLMASK +}; + +static struct pmc_masks iap_snoopresponse_mask[] = { + PMCMASK(clean, (1 << 8)), + PMCMASK(hit, (1 << 9)), + PMCMASK(hitm, (1 << 11)), + NULLMASK +}; + +static struct pmc_masks iap_snooptype_mask[] = { + PMCMASK(cmp2s, (1 << 8)), + PMCMASK(cmp2i, (1 << 9)), + NULLMASK +}; + +static struct pmc_masks iap_transition_mask[] = { + PMCMASK(any, 0x00), + PMCMASK(frequency, 0x10), + NULLMASK +}; + +static int +iap_allocate_pmc(enum pmc_event pe, char *ctrspec, + struct pmc_op_pmcallocate *pmc_config) +{ + char *e, *p, *q; + uint32_t cachestate, evmask; + int count, n; + + pmc_config->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE | + PMC_CAP_QUALIFIER); + pmc_config->pm_md.pm_iap.pm_iap_config = 0; + + cachestate = evmask = 0; + + /* Parse additional modifiers if present */ + while ((p = strsep(&ctrspec, ",")) != NULL) { + + n = 0; + if (KWPREFIXMATCH(p, IAP_KW_CMASK "=")) { + q = strchr(p, '='); + if (*++q == '\0') /* skip '=' */ + return (-1); + count = strtol(q, &e, 0); + if (e == q || *e != '\0') + return (-1); + pmc_config->pm_caps |= PMC_CAP_THRESHOLD; + pmc_config->pm_md.pm_iap.pm_iap_config |= + IAP_CMASK(count); + } else if (KWMATCH(p, IAP_KW_EDGE)) { + pmc_config->pm_caps |= PMC_CAP_EDGE; + } else if (KWMATCH(p, IAP_KW_INV)) { + pmc_config->pm_caps |= PMC_CAP_INVERT; + } else if (KWMATCH(p, IAP_KW_OS)) { + pmc_config->pm_caps |= PMC_CAP_SYSTEM; + } else if (KWMATCH(p, IAP_KW_USR)) { + pmc_config->pm_caps |= PMC_CAP_USER; + } else if (KWMATCH(p, IAP_KW_ANYTHREAD)) { + pmc_config->pm_md.pm_iap.pm_iap_config |= IAP_ANY; + } else if (KWMATCH(p, IAP_KW_CORE)) { + n = pmc_parse_mask(iap_core_mask, p, &evmask); + if (n != 1) + return (-1); + } else if (KWMATCH(p, IAP_KW_AGENT)) { + n = pmc_parse_mask(iap_agent_mask, p, &evmask); + if (n != 1) + return (-1); + } else if (KWMATCH(p, IAP_KW_PREFETCH)) { + n = pmc_parse_mask(iap_prefetch_mask, p, &evmask); + if (n != 1) + return (-1); + } else if (KWMATCH(p, IAP_KW_CACHESTATE)) { + n = pmc_parse_mask(iap_cachestate_mask, p, &cachestate); + } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_CORE && + KWMATCH(p, IAP_KW_TRANSITION)) { + n = pmc_parse_mask(iap_transition_mask, p, &evmask); + if (n != 1) + return (-1); + } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_ATOM || + cpu_info.pm_cputype == PMC_CPU_INTEL_CORE2) { + if (KWMATCH(p, IAP_KW_SNOOPRESPONSE)) { + n = pmc_parse_mask(iap_snoopresponse_mask, p, + &evmask); + } else if (KWMATCH(p, IAP_KW_SNOOPTYPE)) { + n = pmc_parse_mask(iap_snooptype_mask, p, + &evmask); + } else + return (-1); + } else + return (-1); + + if (n < 0) /* Parsing failed. */ + return (-1); + } + + pmc_config->pm_md.pm_iap.pm_iap_config |= evmask; + + /* + * If the event requires a 'cachestate' qualifier but was not + * specified by the user, use a sensible default. + */ + switch (pe) { + case PMC_EV_IAP_EVENT_28H: /* Core, Core2, Atom */ + case PMC_EV_IAP_EVENT_29H: /* Core, Core2, Atom */ + case PMC_EV_IAP_EVENT_2AH: /* Core, Core2, Atom */ + case PMC_EV_IAP_EVENT_2BH: /* Atom, Core2 */ + case PMC_EV_IAP_EVENT_2EH: /* Core, Core2, Atom */ + case PMC_EV_IAP_EVENT_30H: /* Core, Core2, Atom */ + case PMC_EV_IAP_EVENT_32H: /* Core */ + case PMC_EV_IAP_EVENT_40H: /* Core */ + case PMC_EV_IAP_EVENT_41H: /* Core */ + case PMC_EV_IAP_EVENT_42H: /* Core, Core2, Atom */ + case PMC_EV_IAP_EVENT_77H: /* Core */ + if (cachestate == 0) + cachestate = (0xF << 8); + default: + break; + } + + pmc_config->pm_md.pm_iap.pm_iap_config |= cachestate; + + return (0); +} + +/* * AMD K8 PMCs. * * These are very similar to AMD K7 PMCs, but support more kinds of @@ -1704,9 +1982,9 @@ tsc_allocate_pmc(enum pmc_event pe, char /* * Match an event name `name' with its canonical form. - * - * Matches are case insensitive and spaces, underscores and hyphen - * characters are considered to match each other. + * + * Matches are case insensitive and spaces, periods, underscores and + * hyphen characters are considered to match each other. * * Returns 1 for a match, 0 otherwise. */ @@ -1722,13 +2000,14 @@ pmc_match_event_name(const char *name, c for (; (nc = *n) && (cc = *c); n++, c++) { - if (toupper(nc) == cc) + if ((nc == ' ' || nc == '_' || nc == '-' || nc == '.') && + (cc == ' ' || cc == '_' || cc == '-' || cc == '.')) continue; - if ((nc == ' ' || nc == '_' || nc == '-') && - (cc == ' ' || cc == '_' || cc == '-')) + if (toupper(nc) == toupper(cc)) continue; + return (0); } @@ -1750,7 +2029,7 @@ pmc_match_event_class(const char *name, { size_t n; const struct pmc_event_descr *ev; - + ev = pcd->pm_evc_event_table; for (n = 0; n < pcd->pm_evc_event_table_size; n++, ev++) if (pmc_match_event_name(name, ev->pm_ev_name)) @@ -1815,8 +2094,8 @@ pmc_allocate(const char *ctrspec, enum p * search for the event to the specified PMC class. */ ev = NULL; - for (n = 0; n < pmc_event_class_table_size; n++) { - pcd = &pmc_class_table[n]; + for (n = 0; n < PMC_CLASS_TABLE_SIZE; n++) { + pcd = pmc_class_table[n]; if (pmc_mdep_is_compatible_class(pcd->pm_evc_class) && strncasecmp(ctrname, pcd->pm_evc_name, pcd->pm_evc_name_size) == 0) { @@ -1833,8 +2112,8 @@ pmc_allocate(const char *ctrspec, enum p * Otherwise, search for this event in all compatible PMC * classes. */ - for (n = 0; ev == NULL && n < pmc_event_class_table_size; n++) { - pcd = &pmc_class_table[n]; + for (n = 0; ev == NULL && n < PMC_CLASS_TABLE_SIZE; n++) { + pcd = pmc_class_table[n]; if (pmc_mdep_is_compatible_class(pcd->pm_evc_class)) ev = pmc_match_event_class(ctrname, pcd); } @@ -1974,6 +2253,31 @@ pmc_event_names_of_class(enum pmc_class switch (cl) { + case PMC_CLASS_IAF: + ev = iaf_event_table; + count = PMC_EVENT_TABLE_SIZE(iaf); + break; + case PMC_CLASS_IAP: + /* + * Return the most appropriate set of event name + * spellings for the current CPU. + */ + switch (cpu_info.pm_cputype) { + default: + case PMC_CPU_INTEL_ATOM: + ev = atom_event_table; + count = PMC_EVENT_TABLE_SIZE(atom); + break; + case PMC_CPU_INTEL_CORE: + ev = core_event_table; + count = PMC_EVENT_TABLE_SIZE(core); + break; + case PMC_CPU_INTEL_CORE2: + ev = core2_event_table; + count = PMC_EVENT_TABLE_SIZE(core2); + break; + } + break; case PMC_CLASS_TSC: ev = tsc_event_table; count = PMC_EVENT_TABLE_SIZE(tsc); @@ -2095,6 +2399,21 @@ pmc_init(void) for (n = 0; n < cpu_info.pm_nclass; n++) cpu_info.pm_classes[n] = op_cpu_info.pm_classes[n]; + pmc_class_table = malloc(PMC_CLASS_TABLE_SIZE * + sizeof(struct pmc_class_descr *)); + + if (pmc_class_table == NULL) + return (-1); + + + /* + * Fill in the class table. + */ + n = 0; +#if defined(__amd64__) || defined(__i386__) + pmc_class_table[n++] = &tsc_class_table_descr; +#endif + #define PMC_MDEP_INIT(C) do { \ pmc_mdep_event_aliases = C##_aliases; \ pmc_mdep_class_list = C##_pmc_classes; \ @@ -2107,26 +2426,46 @@ pmc_init(void) #if defined(__i386__) case PMC_CPU_AMD_K7: PMC_MDEP_INIT(k7); + pmc_class_table[n] = &k7_class_table_descr; break; case PMC_CPU_INTEL_P5: PMC_MDEP_INIT(p5); + pmc_class_table[n] = &p5_class_table_descr; break; case PMC_CPU_INTEL_P6: /* P6 ... Pentium M CPUs have */ case PMC_CPU_INTEL_PII: /* similar PMCs. */ case PMC_CPU_INTEL_PIII: case PMC_CPU_INTEL_PM: PMC_MDEP_INIT(p6); + pmc_class_table[n] = &p6_class_table_descr; break; #endif #if defined(__amd64__) || defined(__i386__) case PMC_CPU_AMD_K8: PMC_MDEP_INIT(k8); + pmc_class_table[n] = &k8_class_table_descr; + break; + case PMC_CPU_INTEL_ATOM: + PMC_MDEP_INIT(atom); + pmc_class_table[n++] = &iaf_class_table_descr; + pmc_class_table[n] = &atom_class_table_descr; + break; + case PMC_CPU_INTEL_CORE: + PMC_MDEP_INIT(core); + pmc_class_table[n] = &core_class_table_descr; + break; + case PMC_CPU_INTEL_CORE2: + PMC_MDEP_INIT(core2); + pmc_class_table[n++] = &iaf_class_table_descr; + pmc_class_table[n] = &core2_class_table_descr; break; case PMC_CPU_INTEL_PIV: PMC_MDEP_INIT(p4); + pmc_class_table[n] = &p4_class_table_descr; break; #endif + default: /* * Some kind of CPU this version of the library knows nothing @@ -2195,12 +2534,32 @@ pmc_name_of_disposition(enum pmc_disp pd } const char * -pmc_name_of_event(enum pmc_event pe) +_pmc_name_of_event(enum pmc_event pe, enum pmc_cputype cpu) { const struct pmc_event_descr *ev, *evfence; ev = evfence = NULL; - if (pe >= PMC_EV_K7_FIRST && pe <= PMC_EV_K7_LAST) { + if (pe >= PMC_EV_IAF_FIRST && pe <= PMC_EV_IAF_LAST) { + ev = iaf_event_table; + evfence = iaf_event_table + PMC_EVENT_TABLE_SIZE(iaf); + } else if (pe >= PMC_EV_IAP_FIRST && pe <= PMC_EV_IAP_LAST) { + switch (cpu) { + case PMC_CPU_INTEL_ATOM: + ev = atom_event_table; + evfence = atom_event_table + PMC_EVENT_TABLE_SIZE(atom); + break; + case PMC_CPU_INTEL_CORE: + ev = core_event_table; + evfence = core_event_table + PMC_EVENT_TABLE_SIZE(core); + break; + case PMC_CPU_INTEL_CORE2: + ev = core2_event_table; + evfence = core2_event_table + PMC_EVENT_TABLE_SIZE(core2); + break; + default: /* Unknown CPU type. */ + break; + } + } if (pe >= PMC_EV_K7_FIRST && pe <= PMC_EV_K7_LAST) { ev = k7_event_table; evfence = k7_event_table + PMC_EVENT_TABLE_SIZE(k7); } else if (pe >= PMC_EV_K8_FIRST && pe <= PMC_EV_K8_LAST) { @@ -2224,6 +2583,17 @@ pmc_name_of_event(enum pmc_event pe) if (pe == ev->pm_ev_code) return (ev->pm_ev_name); + return (NULL); +} + +const char * +pmc_name_of_event(enum pmc_event pe) +{ + const char *n; + + if ((n = _pmc_name_of_event(pe, cpu_info.pm_cputype)) != NULL) + return (n); + errno = EINVAL; return (NULL); } Added: head/lib/libpmc/libpmcinternal.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libpmc/libpmcinternal.h Thu Nov 27 09:00:47 2008 (r185363) @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2008 Joseph Koshy + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef LIBPMC_INTERNAL_H +#define LIBPMC_INTERNAL_H 1 + +/* + * Prototypes. + */ +const char *_pmc_name_of_event(enum pmc_event _ev, enum pmc_cputype _cpu); + +#endif /* LIBPMC_INTERNAL_H */ Modified: head/lib/libpmc/pmclog.c ============================================================================== --- head/lib/libpmc/pmclog.c Thu Nov 27 08:42:58 2008 (r185362) +++ head/lib/libpmc/pmclog.c Thu Nov 27 09:00:47 2008 (r185363) @@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$"); #include +#include "libpmcinternal.h" + #define PMCLOG_BUFFER_SIZE 4096 /* @@ -363,7 +365,8 @@ pmclog_get_event(void *cookie, char **da PMCLOG_READ32(le,ev->pl_u.pl_a.pl_event); PMCLOG_READ32(le,ev->pl_u.pl_a.pl_flags); if ((ev->pl_u.pl_a.pl_evname = - pmc_name_of_event(ev->pl_u.pl_a.pl_event)) == NULL) + _pmc_name_of_event(ev->pl_u.pl_a.pl_event, ps->ps_arch)) + == NULL) goto error; break; case PMCLOG_TYPE_PMCATTACH: Modified: head/sys/amd64/include/pmc_mdep.h ============================================================================== --- head/sys/amd64/include/pmc_mdep.h Thu Nov 27 08:42:58 2008 (r185362) +++ head/sys/amd64/include/pmc_mdep.h Thu Nov 27 09:00:47 2008 (r185363) @@ -40,6 +40,7 @@ struct pmc_mdep; #endif #include +#include #include #include @@ -51,8 +52,8 @@ struct pmc_mdep; #define PMC_MDEP_CLASS_INDEX_TSC 0 #define PMC_MDEP_CLASS_INDEX_K8 1 #define PMC_MDEP_CLASS_INDEX_P4 1 -#define PMC_MDEP_CLASS_INDEX_IAF 1 -#define PMC_MDEP_CLASS_INDEX_IAP 2 +#define PMC_MDEP_CLASS_INDEX_IAP 1 +#define PMC_MDEP_CLASS_INDEX_IAF 2 /* * On the amd64 platform we support the following PMCs. @@ -66,6 +67,8 @@ struct pmc_mdep; union pmc_md_op_pmcallocate { struct pmc_md_amd_op_pmcallocate pm_amd; + struct pmc_md_iaf_op_pmcallocate pm_iaf; + struct pmc_md_iap_op_pmcallocate pm_iap; struct pmc_md_p4_op_pmcallocate pm_p4; uint64_t __pad[4]; }; @@ -78,6 +81,8 @@ union pmc_md_op_pmcallocate { union pmc_md_pmc { struct pmc_md_amd_pmc pm_amd; + struct pmc_md_iaf_pmc pm_iaf; + struct pmc_md_iap_pmc pm_iap; struct pmc_md_p4_pmc pm_p4; }; Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Thu Nov 27 08:42:58 2008 (r185362) +++ head/sys/conf/files.amd64 Thu Nov 27 09:00:47 2008 (r185363) @@ -189,6 +189,7 @@ dev/hptrr/hptrr_osm_bsd.c optional hptrr dev/hptrr/hptrr_config.c optional hptrr dev/hwpmc/hwpmc_amd.c optional hwpmc dev/hwpmc/hwpmc_intel.c optional hwpmc +dev/hwpmc/hwpmc_core.c optional hwpmc dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Thu Nov 27 08:42:58 2008 (r185362) +++ head/sys/conf/files.i386 Thu Nov 27 09:00:47 2008 (r185363) @@ -187,6 +187,7 @@ dev/hptrr/hptrr_osm_bsd.c optional hptrr dev/hptrr/hptrr_config.c optional hptrr dev/hwpmc/hwpmc_amd.c optional hwpmc dev/hwpmc/hwpmc_intel.c optional hwpmc +dev/hwpmc/hwpmc_core.c optional hwpmc dev/hwpmc/hwpmc_pentium.c optional hwpmc dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_ppro.c optional hwpmc Added: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hwpmc/hwpmc_core.c Thu Nov 27 09:00:47 2008 (r185363) @@ -0,0 +1,1747 @@ +/*- + * Copyright (c) 2008 Joseph Koshy + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Intel Core, Core 2 and Atom PMCs. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include + +#define CORE_CPUID_REQUEST 0xA +#define CORE_CPUID_REQUEST_SIZE 0x4 +#define CORE_CPUID_EAX 0x0 +#define CORE_CPUID_EBX 0x1 +#define CORE_CPUID_ECX 0x2 +#define CORE_CPUID_EDX 0x3 + +#define IAF_PMC_CAPS \ + (PMC_CAP_READ | PMC_CAP_WRITE | PMC_CAP_INTERRUPT) +#define IAF_RI_TO_MSR(RI) ((RI) + (1 << 30)) + +#define IAP_PMC_CAPS (PMC_CAP_INTERRUPT | PMC_CAP_USER | PMC_CAP_SYSTEM | \ + PMC_CAP_EDGE | PMC_CAP_THRESHOLD | PMC_CAP_READ | PMC_CAP_WRITE | \ + PMC_CAP_INVERT | PMC_CAP_QUALIFIER | PMC_CAP_PRECISE) + +/* + * "Architectural" events defined by Intel. The values of these + * symbols correspond to positions in the bitmask returned by + * the CPUID.0AH instruction. + */ +enum core_arch_events { + CORE_AE_BRANCH_INSTRUCTION_RETIRED = 5, + CORE_AE_BRANCH_MISSES_RETIRED = 6, + CORE_AE_INSTRUCTION_RETIRED = 1, + CORE_AE_LLC_MISSES = 4, + CORE_AE_LLC_REFERENCE = 3, + CORE_AE_UNHALTED_REFERENCE_CYCLES = 2, + CORE_AE_UNHALTED_CORE_CYCLES = 0 +}; + +static enum pmc_cputype core_cputype; + +struct core_cpu { + volatile uint32_t pc_resync; + volatile uint32_t pc_iafctrl; /* Fixed function control. */ + volatile uint64_t pc_globalctrl; /* Global control register. */ + struct pmc_hw pc_corepmcs[]; +}; + +static struct core_cpu **core_pcpu; + +static uint32_t core_architectural_events; +static uint64_t core_pmcmask; + +static int core_iaf_ri; /* relative index of fixed counters */ +static int core_iaf_width; +static int core_iaf_npmc; + +static int core_iap_width; +static int core_iap_npmc; + +static int +core_pcpu_noop(struct pmc_mdep *md, int cpu) +{ + (void) md; + (void) cpu; + return (0); +} + +static int +core_pcpu_init(struct pmc_mdep *md, int cpu) +{ + struct pmc_cpu *pc; + struct core_cpu *cc; + struct pmc_hw *phw; + int core_ri, n, npmc; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[iaf,%d] insane cpu number %d", __LINE__, cpu)); + + PMCDBG(MDP,INI,1,"core-init cpu=%d", cpu); + + core_ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_IAP].pcd_ri; + npmc = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_IAP].pcd_num; + + if (core_cputype != PMC_CPU_INTEL_CORE) + npmc += md->pmd_classdep[PMC_MDEP_CLASS_INDEX_IAF].pcd_num; + + cc = malloc(sizeof(struct core_cpu) + npmc * sizeof(struct pmc_hw), + M_PMC, M_WAITOK | M_ZERO); + + core_pcpu[cpu] = cc; + pc = pmc_pcpu[cpu]; + + KASSERT(pc != NULL && cc != NULL, + ("[core,%d] NULL per-cpu structures cpu=%d", __LINE__, cpu)); + + for (n = 0, phw = cc->pc_corepmcs; n < npmc; n++, phw++) { + phw->phw_state = PMC_PHW_FLAG_IS_ENABLED | + PMC_PHW_CPU_TO_STATE(cpu) | + PMC_PHW_INDEX_TO_STATE(n + core_ri); + phw->phw_pmc = NULL; + pc->pc_hwpmcs[n + core_ri] = phw; + } + + return (0); +} + +static int +core_pcpu_fini(struct pmc_mdep *md, int cpu) +{ + int core_ri, n, npmc; + struct pmc_cpu *pc; + struct core_cpu *cc; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[core,%d] insane cpu number (%d)", __LINE__, cpu)); + + PMCDBG(MDP,INI,1,"core-pcpu-fini cpu=%d", cpu); + + if ((cc = core_pcpu[cpu]) == NULL) + return (0); + + core_pcpu[cpu] = NULL; + + pc = pmc_pcpu[cpu]; + + KASSERT(pc != NULL, ("[core,%d] NULL per-cpu %d state", __LINE__, + cpu)); + + npmc = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_IAP].pcd_num; + core_ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_IAP].pcd_ri; + + for (n = 0; n < npmc; n++) + wrmsr(IAP_EVSEL0 + n, 0); + + if (core_cputype != PMC_CPU_INTEL_CORE) { + wrmsr(IAF_CTRL, 0); + npmc += md->pmd_classdep[PMC_MDEP_CLASS_INDEX_IAF].pcd_num; + } + + for (n = 0; n < npmc; n++) + pc->pc_hwpmcs[n + core_ri] = NULL; + + free(cc, M_PMC); + + return (0); +} + +/* + * Fixed function counters. + */ + +static pmc_value_t +iaf_perfctr_value_to_reload_count(pmc_value_t v) +{ + v &= (1ULL << core_iaf_width) - 1; + return (1ULL << core_iaf_width) - v; +} + +static pmc_value_t +iaf_reload_count_to_perfctr_value(pmc_value_t rlc) +{ + return (1ULL << core_iaf_width) - rlc; +} + +static int +iaf_allocate_pmc(int cpu, int ri, struct pmc *pm, + const struct pmc_op_pmcallocate *a) +{ + enum pmc_event ev; + uint32_t caps, flags, validflags; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[core,%d] illegal CPU %d", __LINE__, cpu)); + + PMCDBG(MDP,ALL,1, "iaf-allocate ri=%d reqcaps=0x%x", ri, pm->pm_caps); + + if (ri < 0 || ri > core_iaf_npmc) + return (EINVAL); + + caps = a->pm_caps; + + if (a->pm_class != PMC_CLASS_IAF || + (caps & IAF_PMC_CAPS) != caps) + return (EINVAL); + + ev = pm->pm_event; + if (ev < PMC_EV_IAF_FIRST || ev > PMC_EV_IAF_LAST) + return (EINVAL); + + if (ev == PMC_EV_IAF_INSTR_RETIRED_ANY && ri != 0) + return (EINVAL); + if (ev == PMC_EV_IAF_CPU_CLK_UNHALTED_CORE && ri != 1) + return (EINVAL); + if (ev == PMC_EV_IAF_CPU_CLK_UNHALTED_REF && ri != 2) + return (EINVAL); + + flags = a->pm_md.pm_iaf.pm_iaf_flags; + + validflags = IAF_MASK; + + if (core_cputype != PMC_CPU_INTEL_ATOM) + validflags &= ~IAF_ANY; + + if ((flags & ~validflags) != 0) + return (EINVAL); + + if (caps & PMC_CAP_INTERRUPT) + flags |= IAF_PMI; + if (caps & PMC_CAP_SYSTEM) + flags |= IAF_OS; + if (caps & PMC_CAP_USER) + flags |= IAF_USR; + if ((caps & (PMC_CAP_USER | PMC_CAP_SYSTEM)) == 0) + flags |= (IAF_OS | IAF_USR); + + pm->pm_md.pm_iaf.pm_iaf_ctrl = (flags << (ri * 4)); + + PMCDBG(MDP,ALL,2, "iaf-allocate config=0x%jx", + (uintmax_t) pm->pm_md.pm_iaf.pm_iaf_ctrl); + + return (0); +} + +static int +iaf_config_pmc(int cpu, int ri, struct pmc *pm) +{ + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[core,%d] illegal CPU %d", __LINE__, cpu)); + + KASSERT(ri >= 0 && ri < core_iaf_npmc, + ("[core,%d] illegal row-index %d", __LINE__, ri)); + + PMCDBG(MDP,CFG,1, "iaf-config cpu=%d ri=%d pm=%p", cpu, ri, pm); + + KASSERT(core_pcpu[cpu] != NULL, ("[core,%d] null per-cpu %d", __LINE__, + cpu)); + + core_pcpu[cpu]->pc_corepmcs[ri + core_iaf_ri].phw_pmc = pm; + + return (0); +} + +static int +iaf_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 09:21:38 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 303831065673; Thu, 27 Nov 2008 09:21:38 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 21A2D8FC19; Thu, 27 Nov 2008 09:21:38 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAR9LbDV081844; Thu, 27 Nov 2008 09:21:37 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAR9LbGX081843; Thu, 27 Nov 2008 09:21:37 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200811270921.mAR9LbGX081843@svn.freebsd.org> From: Joseph Koshy Date: Thu, 27 Nov 2008 09:21:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185364 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 09:21:38 -0000 Author: jkoshy Date: Thu Nov 27 09:21:37 2008 New Revision: 185364 URL: http://svn.freebsd.org/changeset/base/185364 Log: Update description of an event. Submitted by: "Verplanke, Edwin" Modified: head/lib/libpmc/pmc.atom.3 Modified: head/lib/libpmc/pmc.atom.3 ============================================================================== --- head/lib/libpmc/pmc.atom.3 Thu Nov 27 09:00:47 2008 (r185363) +++ head/lib/libpmc/pmc.atom.3 Thu Nov 27 09:21:37 2008 (r185364) @@ -557,10 +557,9 @@ The number of snoop responses to bus tra .It Li FP_ASSIST .Pq Event 11H , Umask 01H The number of floating point operations executed that needed -a microcode assist. +a microcode assist, including speculatively executed instructions. .It Li FP_ASSIST.AR .Pq Event 11H , Umask 81H -.\" XXX to be confirmed that this is an at-retirement event The number of floating point operations retired that needed a microcode assist. .It Li FP_COMP_OPS_EXE From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 10:07:41 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4009D1065670; Thu, 27 Nov 2008 10:07:41 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) by mx1.freebsd.org (Postfix) with ESMTP id B4E8B8FC0A; Thu, 27 Nov 2008 10:07:40 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.2/8.14.2) with ESMTP id mAR9UIU4083360; Thu, 27 Nov 2008 12:30:18 +0300 (MSK) (envelope-from marck@rinet.ru) Date: Thu, 27 Nov 2008 12:30:18 +0300 (MSK) From: Dmitry Morozovsky To: Pawel Jakub Dawidek In-Reply-To: <20081126095241.GA3188@garage.freebsd.pl> Message-ID: References: <200811172049.mAHKnUDw092510@svn.freebsd.org> <492D13CE.70001@fsn.hu> <20081126095241.GA3188@garage.freebsd.pl> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0.1 (woozle.rinet.ru [0.0.0.0]); Thu, 27 Nov 2008 12:30:18 +0300 (MSK) Cc: svn-src-head@freebsd.org, Attila Nagy , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185029 - in head: cddl/compat/opensolaris/include cddl/compat/opensolaris/misc cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zinject cd... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 10:07:41 -0000 On Wed, 26 Nov 2008, Pawel Jakub Dawidek wrote: PJD> > > Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes. PJD> > > PJD> > This, and other changes stabilized ZFS by a great level in HEAD. PJD> > Do you plan to MFC these to 7-STABLE? PJD> PJD> Yes, but ETA yet. Great! Would love to test patches to RELENG_7 on two semi_production boxes under load. Thank you! Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 10:20:41 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38F141065673 for ; Thu, 27 Nov 2008 10:20:41 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.153]) by mx1.freebsd.org (Postfix) with ESMTP id BF4228FC08 for ; Thu, 27 Nov 2008 10:20:40 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by fg-out-1718.google.com with SMTP id l26so578679fgb.35 for ; Thu, 27 Nov 2008 02:20:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=Gp9ZgyR5IOHVBiJkFuWTSBTzfQnchgSWX39fyDKzSTk=; b=AIs5KWhKtQQ/IlBOX413HSSrqZ0enOiuO+JEnFF9GW5dPeJp1oVDWLF07r9mfC7f2X Why0DM29OlilaTgMK65PPqltuZt4GezBJy54kOXPZ+IbA/vFhz1pQw8ZF1bBg9xCCpD0 WAQxbpntCoJrrq0vL6wQMMlv2iWe7qr1C9zak= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=YDeOWRvQLgRUa95XqbEoDIsnR0iCYh8BqdJ3FmSUjK0g4KK2ojdDDYqH3KH2gHHrOq BPzCQ1RldBG9k5PMFpLMHfDXnR+ewJxq+75pwLw9gBUgKgDknc0VBWWoDxZoJkYO9GfI XsQpOd3sFpR3IJOJFRtIxiCBPncTLs0RM5/T8= Received: by 10.181.199.11 with SMTP id b11mr2293323bkq.127.1227781239206; Thu, 27 Nov 2008 02:20:39 -0800 (PST) Received: by 10.181.49.2 with HTTP; Thu, 27 Nov 2008 02:20:39 -0800 (PST) Message-ID: <9bbcef730811270220h1a7f812k2ba340737132ff82@mail.gmail.com> Date: Thu, 27 Nov 2008 11:20:39 +0100 From: "Ivan Voras" To: "M. Warner Losh" In-Reply-To: <20081127.000621.1413927847.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811270219.mAR2Ji2M073024@svn.freebsd.org> <20081126213204.14db9a63@kan.dnsalias.net> <20081127.000621.1413927847.imp@bsdimp.com> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 10:20:41 -0000 2008/11/27 M. Warner Losh : > In message: <20081126213204.14db9a63@kan.dnsalias.net> > Alexander Kabaev writes: > : Is C99 construct here intentional? If so, when did we agree on using > : only C99 compilers on our code base? > > I'm not sure about *THIS* c99 construct, but we've been heavily > relying on the field name initializer stuff for a couple of years now. And at least the newer GEOM code also uses c99 variable declarations (not only for initializers - they were c99 from the start). From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 10:29:41 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2906A1065675; Thu, 27 Nov 2008 10:29:41 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id DE2368FC12; Thu, 27 Nov 2008 10:29:40 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id EDF636D43F; Thu, 27 Nov 2008 10:29:39 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id D281F8449F; Thu, 27 Nov 2008 11:29:39 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "Ivan Voras" References: <200811270219.mAR2Ji2M073024@svn.freebsd.org> <20081126213204.14db9a63@kan.dnsalias.net> <20081127.000621.1413927847.imp@bsdimp.com> <9bbcef730811270220h1a7f812k2ba340737132ff82@mail.gmail.com> Date: Thu, 27 Nov 2008 11:29:39 +0100 In-Reply-To: <9bbcef730811270220h1a7f812k2ba340737132ff82@mail.gmail.com> (Ivan Voras's message of "Thu, 27 Nov 2008 11:20:39 +0100") Message-ID: <8663m94g30.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "M. Warner Losh" Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 10:29:41 -0000 "Ivan Voras" writes: > And at least the newer GEOM code also uses c99 variable declarations > (not only for initializers - they were c99 from the start). I'm curious about what you mean with "c99 variable declarations". If you are referring to loop variable declarations, I can only find two cases, both in g_linux_lvm.c. Other than that and mixing declarations with statements (which style(9) explicitly forbids), there is no difference between c89 to c99 as far as variable declarations are concerned. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 10:38:08 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54D3E1065677 for ; Thu, 27 Nov 2008 10:38:08 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.153]) by mx1.freebsd.org (Postfix) with ESMTP id D89768FC21 for ; Thu, 27 Nov 2008 10:38:07 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by fg-out-1718.google.com with SMTP id l26so583805fgb.35 for ; Thu, 27 Nov 2008 02:38:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=8ladPVPuI+zdD/aAtf5q/HOaVG2tNAaYDllHm8k6p/g=; b=c1ybzem/1eopykNRxcXhSAG3rzr7rMHgq0g5EjP6sTKPlWx+xYwxMtmVBjH5PwEXsN 42/erh48iJ5fj6R10SRxmZBUdTLhiFXA9LMnr2UA8dlFanlsbXld/9xG049xCTO5Irx5 r+UN3+i9IMqPD0gwIr9UqlCZX1vg6ZVICxk5I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=CDGinaHMCj68D0j9ZMgLgV5sFRRpMhyB/0AdMIeHKnpMwwL/wTswgBGUujmYmucNW3 SAaog8b9MRWwEJGn7Mi3RHBLrWia32W0OYYv95FiZDHj6tCiuV4j4eUogvjBRKTCIe+N Ab0MJGfzvU+KKaNQJLZ7EVi/oUa2ue68plnhg= Received: by 10.181.141.7 with SMTP id t7mr2327265bkn.10.1227782286057; Thu, 27 Nov 2008 02:38:06 -0800 (PST) Received: by 10.181.49.2 with HTTP; Thu, 27 Nov 2008 02:38:05 -0800 (PST) Message-ID: <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> Date: Thu, 27 Nov 2008 11:38:05 +0100 From: "Ivan Voras" To: "=?UTF-8?Q?Dag-Erling_Sm=C3=B8rgrav?=" In-Reply-To: <8663m94g30.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Content-Disposition: inline References: <200811270219.mAR2Ji2M073024@svn.freebsd.org> <20081126213204.14db9a63@kan.dnsalias.net> <20081127.000621.1413927847.imp@bsdimp.com> <9bbcef730811270220h1a7f812k2ba340737132ff82@mail.gmail.com> <8663m94g30.fsf@ds4.des.no> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 10:38:08 -0000 MjAwOC8xMS8yNyBEYWctRXJsaW5nIFNtw7hyZ3JhdiA8ZGVzQGRlcy5ubz46Cj4gIkl2YW4gVm9y YXMiIDxpdm9yYXNAZ21haWwuY29tPiB3cml0ZXM6Cj4+IEFuZCBhdCBsZWFzdCB0aGUgbmV3ZXIg R0VPTSBjb2RlIGFsc28gdXNlcyBjOTkgdmFyaWFibGUgZGVjbGFyYXRpb25zCj4+IChub3Qgb25s eSBmb3IgaW5pdGlhbGl6ZXJzIC0gdGhleSB3ZXJlIGM5OSBmcm9tIHRoZSBzdGFydCkuCj4KPiBJ J20gY3VyaW91cyBhYm91dCB3aGF0IHlvdSBtZWFuIHdpdGggImM5OSB2YXJpYWJsZSBkZWNsYXJh dGlvbnMiLiAgSWYKPiB5b3UgYXJlIHJlZmVycmluZyB0byBsb29wIHZhcmlhYmxlIGRlY2xhcmF0 aW9ucywgSSBjYW4gb25seSBmaW5kIHR3bwo+IGNhc2VzLCBib3RoIGluIGdfbGludXhfbHZtLmMu ICBPdGhlciB0aGFuIHRoYXQgYW5kIG1peGluZyBkZWNsYXJhdGlvbnMKPiB3aXRoIHN0YXRlbWVu dHMgKHdoaWNoIHN0eWxlKDkpIGV4cGxpY2l0bHkgZm9yYmlkcyksIHRoZXJlIGlzIG5vCj4gZGlm ZmVyZW5jZSBiZXR3ZWVuIGM4OSB0byBjOTkgYXMgZmFyIGFzIHZhcmlhYmxlIGRlY2xhcmF0aW9u cyBhcmUKPiBjb25jZXJuZWQuCgpZZXMsIGJ1dCBub3Qgb25seSBsb29wcyAtIEkgbWVhbiB0aGlu Z3MgbGlrZToKCmlmICgpIHsKICBzdHJ1Y3QgKnNvbWV0aGluZyBhYmM7CiAgaW50IHk7CiAgLi4u Cn0KCllvdSdsbCBwcm9iYWJseSBmaW5kIG15IGNvZGUgaXMgb25lIHRoZSBiaWdnZXN0IHVzZXJz IG9mIHRoaXMgc3R5bGUKYnV0IEkndmUgb25seSBzdGFydGVkIHVzaW5nIGl0IHdoZW4gSSBzYXcg aXQgYWxyZWFkeSB1c2VkLgo= From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 10:43:09 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 255AD106564A; Thu, 27 Nov 2008 10:43:09 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 164BE8FC0C; Thu, 27 Nov 2008 10:43:09 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mARAh81Q084759; Thu, 27 Nov 2008 10:43:08 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mARAh8jV084753; Thu, 27 Nov 2008 10:43:08 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811271043.mARAh8jV084753@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 27 Nov 2008 10:43:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185366 - in head/sys: netinet netinet6 netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 10:43:09 -0000 Author: bz Date: Thu Nov 27 10:43:08 2008 New Revision: 185366 URL: http://svn.freebsd.org/changeset/base/185366 Log: Unify ipsec[46]_delete_pcbpolicy in ipsec_delete_pcbpolicy. Ignoring different names because of macros (in6pcb, in6p_sp) and inp vs. in6p variable name both functions were entirely identical. Reviewed by: rwatson (as part of a larger changeset) MFC after: 6 weeks (*) (*) possibly need to leave a stub wrappers in 7 to keep the symbols. Modified: head/sys/netinet/in_pcb.c head/sys/netinet/sctp_pcb.c head/sys/netinet6/in6_pcb.c head/sys/netipsec/ipsec.c head/sys/netipsec/ipsec.h head/sys/netipsec/ipsec6.h Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Thu Nov 27 10:28:26 2008 (r185365) +++ head/sys/netinet/in_pcb.c Thu Nov 27 10:43:08 2008 (r185366) @@ -899,7 +899,7 @@ in_pcbfree(struct inpcb *inp) INP_WLOCK_ASSERT(inp); #ifdef IPSEC - ipsec4_delete_pcbpolicy(inp); + ipsec_delete_pcbpolicy(inp); #endif /* IPSEC */ inp->inp_gencnt = ++ipi->ipi_gencnt; in_pcbremlists(inp); Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Thu Nov 27 10:28:26 2008 (r185365) +++ head/sys/netinet/sctp_pcb.c Thu Nov 27 10:43:08 2008 (r185366) @@ -3408,7 +3408,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, cnt = 0; if (so) { #ifdef IPSEC - ipsec4_delete_pcbpolicy(ip_pcb); + ipsec_delete_pcbpolicy(ip_pcb); #endif /* IPSEC */ /* Unlocks not needed since the socket is gone now */ Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Thu Nov 27 10:28:26 2008 (r185365) +++ head/sys/netinet6/in6_pcb.c Thu Nov 27 10:43:08 2008 (r185366) @@ -422,7 +422,7 @@ in6_pcbfree(struct inpcb *inp) #ifdef IPSEC if (inp->in6p_sp != NULL) - ipsec6_delete_pcbpolicy(inp); + ipsec_delete_pcbpolicy(inp); #endif /* IPSEC */ inp->inp_gencnt = ++ipi->ipi_gencnt; in_pcbremlists(inp); Modified: head/sys/netipsec/ipsec.c ============================================================================== --- head/sys/netipsec/ipsec.c Thu Nov 27 10:28:26 2008 (r185365) +++ head/sys/netipsec/ipsec.c Thu Nov 27 10:43:08 2008 (r185366) @@ -1216,7 +1216,7 @@ ipsec4_get_policy(inp, request, len, mp) /* delete policy in PCB */ int -ipsec4_delete_pcbpolicy(inp) +ipsec_delete_pcbpolicy(inp) struct inpcb *inp; { IPSEC_ASSERT(inp != NULL, ("null inp")); @@ -1308,27 +1308,6 @@ ipsec6_get_policy(in6p, request, len, mp return ipsec_get_policy(pcb_sp, mp); } - -int -ipsec6_delete_pcbpolicy(in6p) - struct in6pcb *in6p; -{ - IPSEC_ASSERT(in6p != NULL, ("null in6p")); - - if (in6p->in6p_sp == NULL) - return 0; - - if (in6p->in6p_sp->sp_in != NULL) - KEY_FREESP(&in6p->in6p_sp->sp_in); - - if (in6p->in6p_sp->sp_out != NULL) - KEY_FREESP(&in6p->in6p_sp->sp_out); - - ipsec_delpcbpolicy(in6p->in6p_sp); - in6p->in6p_sp = NULL; - - return 0; -} #endif /* Modified: head/sys/netipsec/ipsec.h ============================================================================== --- head/sys/netipsec/ipsec.h Thu Nov 27 10:28:26 2008 (r185365) +++ head/sys/netipsec/ipsec.h Thu Nov 27 10:43:08 2008 (r185366) @@ -380,7 +380,7 @@ extern int ipsec4_set_policy __P((struct caddr_t request, size_t len, struct ucred *cred)); extern int ipsec4_get_policy __P((struct inpcb *inpcb, caddr_t request, size_t len, struct mbuf **mp)); -extern int ipsec4_delete_pcbpolicy __P((struct inpcb *)); +extern int ipsec_delete_pcbpolicy __P((struct inpcb *)); extern int ipsec4_in_reject __P((struct mbuf *, struct inpcb *)); struct secas; Modified: head/sys/netipsec/ipsec6.h ============================================================================== --- head/sys/netipsec/ipsec6.h Thu Nov 27 10:28:26 2008 (r185365) +++ head/sys/netipsec/ipsec6.h Thu Nov 27 10:43:08 2008 (r185366) @@ -50,7 +50,6 @@ extern int ip6_ipsec_ecn; struct inpcb; -extern int ipsec6_delete_pcbpolicy __P((struct inpcb *)); extern int ipsec6_set_policy __P((struct inpcb *inp, int optname, caddr_t request, size_t len, struct ucred *cred)); extern int ipsec6_get_policy From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 10:57:05 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BD751065674 for ; Thu, 27 Nov 2008 10:57:05 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.158]) by mx1.freebsd.org (Postfix) with ESMTP id 8BC578FC14 for ; Thu, 27 Nov 2008 10:57:04 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by fg-out-1718.google.com with SMTP id l26so588941fgb.35 for ; Thu, 27 Nov 2008 02:57:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=VQwK3b6pLQuZQXbSy3P3P5dtXRiwJnPaZxxo1er3zek=; b=s67BHCO7qRNfcXeUKPWWA7iITfvpfnuPv/d5t1tRvSj7Qta3qaIa9OXq91uYmY6TJg SXiLIFKZzSQ7cWlMXw+ntzuQ3sTRI+N8CJzYaFgWJ+bQc5K24avikPNNcisGjWPaVzOq bx22fsWxZoxfwUv+HGfm7qp54LhyFVcUr+RAM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=De+g5QQYigvHkCtuoiW8967J0lDlU6XN97mJaXC6wm0pKeF2Ys4aSVIu6CM2+7BE11 Ks46npWe4o8lWPQgPUiKFb0GtMsfztzfgJEK19CE8JaJjDmdfkgVDmxkdYuBNv0pp7j4 X8Nxqv/R2OrUU52xRdYo82KFhzQ6QjI2wg/jY= Received: by 10.181.48.4 with SMTP id a4mr2327364bkk.6.1227783423272; Thu, 27 Nov 2008 02:57:03 -0800 (PST) Received: by 10.181.49.2 with HTTP; Thu, 27 Nov 2008 02:57:03 -0800 (PST) Message-ID: <9bbcef730811270257v3d8694a5pa79f5976aa04787e@mail.gmail.com> Date: Thu, 27 Nov 2008 11:57:03 +0100 From: "Ivan Voras" To: "Erik Trulsson" In-Reply-To: <20081127104606.GA71968@owl.midgard.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811270219.mAR2Ji2M073024@svn.freebsd.org> <20081126213204.14db9a63@kan.dnsalias.net> <20081127.000621.1413927847.imp@bsdimp.com> <9bbcef730811270220h1a7f812k2ba340737132ff82@mail.gmail.com> <8663m94g30.fsf@ds4.des.no> <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> <20081127104606.GA71968@owl.midgard.homeip.net> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 10:57:05 -0000 2008/11/27 Erik Trulsson : > On Thu, Nov 27, 2008 at 11:38:05AM +0100, Ivan Voras wrote: >> if () { >> struct *something abc; >> int y; >> ... >> } >> >> You'll probably find my code is one the biggest users of this style >> but I've only started using it when I saw it already used. > > That construct is allowed in C89 as well. Great! I always thought this was c99-specific. I'll go ask Google for the documentation. From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 10:58:57 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A9DE1065678; Thu, 27 Nov 2008 10:58:57 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id DC4A48FC14; Thu, 27 Nov 2008 10:58:56 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id DDB0D6D44E; Thu, 27 Nov 2008 10:58:55 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id BF9438449F; Thu, 27 Nov 2008 11:58:55 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "Ivan Voras" References: <200811270219.mAR2Ji2M073024@svn.freebsd.org> <20081126213204.14db9a63@kan.dnsalias.net> <20081127.000621.1413927847.imp@bsdimp.com> <9bbcef730811270220h1a7f812k2ba340737132ff82@mail.gmail.com> <8663m94g30.fsf@ds4.des.no> <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> Date: Thu, 27 Nov 2008 11:58:55 +0100 In-Reply-To: <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> (Ivan Voras's message of "Thu, 27 Nov 2008 11:38:05 +0100") Message-ID: <86tz9t305s.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 10:58:57 -0000 "Ivan Voras" writes: > Dag-Erling Sm=C3=B8rgrav writes: > > I'm curious about what you mean with "c99 variable declarations". [...] > [...] I mean things like: > > if () { > struct *something abc; > int y; > ... > } C has always allowed declaring variables at the top of any block. It is still discouraged by style(9), though. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 11:00:27 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1EB2106564A; Thu, 27 Nov 2008 11:00:27 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au [211.29.132.188]) by mx1.freebsd.org (Postfix) with ESMTP id 231008FC14; Thu, 27 Nov 2008 11:00:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c220-239-227-74.carlnfd1.nsw.optusnet.com.au (c220-239-227-74.carlnfd1.nsw.optusnet.com.au [220.239.227.74]) by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id mARB0Kh8032544 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 27 Nov 2008 22:00:25 +1100 Date: Thu, 27 Nov 2008 22:00:20 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Robert Watson In-Reply-To: <200811270842.mAR8gwi3080974@svn.freebsd.org> Message-ID: <20081127215951.D40031@delplex.bde.org> References: <200811270842.mAR8gwi3080974@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185362 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 11:00:27 -0000 On Thu, 27 Nov 2008, Robert Watson wrote: > Author: rwatson > Date: Thu Nov 27 08:42:58 2008 > New Revision: 185362 > URL: http://svn.freebsd.org/changeset/base/185362 > > Log: > Revert r184509: don't encourage the use of sysexits.h with err() and > errx(),, as there seems to be a general preference against this > practice. > > Suggested by: bde, des, jhb Thanks. Bruce From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 11:08:14 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D759F1065672 for ; Thu, 27 Nov 2008 11:08:14 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from ch-smtp02.sth.basefarm.net (ch-smtp02.sth.basefarm.net [80.76.149.213]) by mx1.freebsd.org (Postfix) with ESMTP id 8D3AF8FC1B for ; Thu, 27 Nov 2008 11:08:14 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from c83-255-48-78.bredband.comhem.se ([83.255.48.78]:56508 helo=falcon.midgard.homeip.net) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1L5eUK-0007gV-8A for svn-src-all@freebsd.org; Thu, 27 Nov 2008 11:52:48 +0100 Received: (qmail 20112 invoked from network); 27 Nov 2008 11:46:06 +0100 Received: from owl.midgard.homeip.net (10.1.5.7) by falcon.midgard.homeip.net with ESMTP; 27 Nov 2008 11:46:06 +0100 Received: (qmail 72001 invoked by uid 1001); 27 Nov 2008 11:46:06 +0100 Date: Thu, 27 Nov 2008 11:46:06 +0100 From: Erik Trulsson To: Ivan Voras Message-ID: <20081127104606.GA71968@owl.midgard.homeip.net> References: <200811270219.mAR2Ji2M073024@svn.freebsd.org> <20081126213204.14db9a63@kan.dnsalias.net> <20081127.000621.1413927847.imp@bsdimp.com> <9bbcef730811270220h1a7f812k2ba340737132ff82@mail.gmail.com> <8663m94g30.fsf@ds4.des.no> <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-IP: 83.255.48.78 X-Scan-Result: No virus found in message 1L5eUK-0007gV-8A. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1L5eUK-0007gV-8A f2750ce953332f4650e9307a308a23b3 Cc: svn-src-head@freebsd.org, Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 11:08:14 -0000 On Thu, Nov 27, 2008 at 11:38:05AM +0100, Ivan Voras wrote: > 2008/11/27 Dag-Erling Sm=F8rgrav : > > "Ivan Voras" writes: > >> And at least the newer GEOM code also uses c99 variable declarations > >> (not only for initializers - they were c99 from the start). > > > > I'm curious about what you mean with "c99 variable declarations". If > > you are referring to loop variable declarations, I can only find two > > cases, both in g_linux_lvm.c. Other than that and mixing declarations > > with statements (which style(9) explicitly forbids), there is no > > difference between c89 to c99 as far as variable declarations are > > concerned. >=20 > Yes, but not only loops - I mean things like: >=20 > if () { > struct *something abc; > int y; > ... > } >=20 > You'll probably find my code is one the biggest users of this style > but I've only started using it when I saw it already used. That construct is allowed in C89 as well. --=20 Erik Trulsson ertr1013@student.uu.se From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 11:28:00 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8238F1065673; Thu, 27 Nov 2008 11:28: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 6DD638FC19; Thu, 27 Nov 2008 11:28:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mARBS08p085866; Thu, 27 Nov 2008 11:28:00 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mARBS0Kw085859; Thu, 27 Nov 2008 11:28:00 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811271128.mARBS0Kw085859@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 27 Nov 2008 11:28:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185369 - in head: lib/libc/gen lib/libthr/thread libexec/rtld-elf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 11:28:00 -0000 Author: kib Date: Thu Nov 27 11:27:59 2008 New Revision: 185369 URL: http://svn.freebsd.org/changeset/base/185369 Log: Add two rtld exported symbols, _rtld_atfork_pre and _rtld_atfork_post. Threading library calls _pre before the fork, allowing the rtld to lock itself to ensure that other threads of the process are out of dynamic linker. _post releases the locks. This allows the rtld to have consistent state in the child. Although child may legitimately call only async-safe functions, the call may need plt relocation resolution, and this requires working rtld. Reported and debugging help by: rink Reviewed by: kan, davidxu MFC after: 1 month (anyway, not before 7.1 is out) Modified: head/lib/libc/gen/Symbol.map head/lib/libc/gen/dlfcn.c head/lib/libthr/thread/thr_fork.c head/libexec/rtld-elf/Symbol.map head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld_lock.c head/libexec/rtld-elf/rtld_lock.h Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Thu Nov 27 11:25:21 2008 (r185368) +++ head/lib/libc/gen/Symbol.map Thu Nov 27 11:27:59 2008 (r185369) @@ -432,6 +432,8 @@ FBSDprivate_1.0 { _spinlock; _spinlock_debug; _spinunlock; + _rtld_atfork_pre; + _rtld_atfork_post; _rtld_error; /* for private use */ _rtld_thread_init; /* for private use */ _err; Modified: head/lib/libc/gen/dlfcn.c ============================================================================== --- head/lib/libc/gen/dlfcn.c Thu Nov 27 11:25:21 2008 (r185368) +++ head/lib/libc/gen/dlfcn.c Thu Nov 27 11:27:59 2008 (r185369) @@ -137,3 +137,15 @@ dl_iterate_phdr(int (*callback)(struct d _rtld_error(sorry); return 0; } + +#pragma weak _rtld_atfork_pre +void +_rtld_atfork_pre(int *locks) +{ +} + +#pragma weak _rtld_atfork_post +void +_rtld_atfork_post(int *locks) +{ +} Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Thu Nov 27 11:25:21 2008 (r185368) +++ head/lib/libthr/thread/thr_fork.c Thu Nov 27 11:27:59 2008 (r185369) @@ -67,6 +67,7 @@ #include "un-namespace.h" #include "libc_private.h" +#include "rtld_lock.h" #include "thr_private.h" __weak_reference(_pthread_atfork, pthread_atfork); @@ -105,6 +106,7 @@ _fork(void) pid_t ret; int errsave; int unlock_malloc; + int rtld_locks[16]; if (!_thr_is_inited()) return (__sys_fork()); @@ -127,6 +129,7 @@ _fork(void) if (_thr_isthreaded() != 0) { unlock_malloc = 1; _malloc_prefork(); + _rtld_atfork_pre(rtld_locks); } else { unlock_malloc = 0; } @@ -167,6 +170,10 @@ _fork(void) /* Ready to continue, unblock signals. */ _thr_signal_unblock(curthread); + if (unlock_malloc) { + _rtld_atfork_post(rtld_locks); + } + /* Run down atfork child handlers. */ TAILQ_FOREACH(af, &_thr_atfork_list, qe) { if (af->child != NULL) @@ -179,8 +186,10 @@ _fork(void) /* Ready to continue, unblock signals. */ _thr_signal_unblock(curthread); - if (unlock_malloc) + if (unlock_malloc) { + _rtld_atfork_post(rtld_locks); _malloc_postfork(); + } /* Run down atfork parent handlers. */ TAILQ_FOREACH(af, &_thr_atfork_list, qe) { Modified: head/libexec/rtld-elf/Symbol.map ============================================================================== --- head/libexec/rtld-elf/Symbol.map Thu Nov 27 11:25:21 2008 (r185368) +++ head/libexec/rtld-elf/Symbol.map Thu Nov 27 11:27:59 2008 (r185369) @@ -21,4 +21,6 @@ FBSDprivate_1.0 { _rtld_thread_init; _rtld_allocate_tls; _rtld_free_tls; + _rtld_atfork_pre; + _rtld_atfork_post; }; Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Thu Nov 27 11:25:21 2008 (r185368) +++ head/libexec/rtld-elf/rtld.c Thu Nov 27 11:27:59 2008 (r185369) @@ -206,6 +206,8 @@ static func_ptr_type exports[] = { (func_ptr_type) &_rtld_allocate_tls, (func_ptr_type) &_rtld_free_tls, (func_ptr_type) &dl_iterate_phdr, + (func_ptr_type) &_rtld_atfork_pre, + (func_ptr_type) &_rtld_atfork_post, NULL }; Modified: head/libexec/rtld-elf/rtld_lock.c ============================================================================== --- head/libexec/rtld-elf/rtld_lock.c Thu Nov 27 11:25:21 2008 (r185368) +++ head/libexec/rtld-elf/rtld_lock.c Thu Nov 27 11:27:59 2008 (r185369) @@ -316,3 +316,19 @@ _rtld_thread_init(struct RtldLockInfo *p thread_mask_set(flags); dbg("_rtld_thread_init: done"); } + +void +_rtld_atfork_pre(int *locks) +{ + + locks[2] = wlock_acquire(rtld_phdr_lock); + locks[0] = rlock_acquire(rtld_bind_lock); +} + +void +_rtld_atfork_post(int *locks) +{ + + rlock_release(rtld_bind_lock, locks[0]); + wlock_release(rtld_phdr_lock, locks[2]); +} Modified: head/libexec/rtld-elf/rtld_lock.h ============================================================================== --- head/libexec/rtld-elf/rtld_lock.h Thu Nov 27 11:25:21 2008 (r185368) +++ head/libexec/rtld-elf/rtld_lock.h Thu Nov 27 11:27:59 2008 (r185369) @@ -44,6 +44,8 @@ struct RtldLockInfo }; extern void _rtld_thread_init(struct RtldLockInfo *); +extern void _rtld_atfork_pre(int *); +extern void _rtld_atfork_post(int *); #ifdef IN_RTLD From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 11:30:59 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C286106564A; Thu, 27 Nov 2008 11:30:59 +0000 (UTC) (envelope-from rink@rink.nu) Received: from mx1.rink.nu (gloom.rink.nu [213.34.49.2]) by mx1.freebsd.org (Postfix) with ESMTP id 470718FC17; Thu, 27 Nov 2008 11:30:58 +0000 (UTC) (envelope-from rink@rink.nu) Received: from localhost (localhost [127.0.0.1]) by mx1.rink.nu (Postfix) with ESMTP id 82A006D439; Thu, 27 Nov 2008 12:31:30 +0100 (CET) X-Virus-Scanned: amavisd-new at rink.nu Received: from mx1.rink.nu ([213.34.49.2]) by localhost (gloom.rink.nu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O979hQkhgp8h; Thu, 27 Nov 2008 12:31:26 +0100 (CET) Received: by mx1.rink.nu (Postfix, from userid 1000) id D95836D42B; Thu, 27 Nov 2008 12:31:26 +0100 (CET) Date: Thu, 27 Nov 2008 12:31:26 +0100 From: Rink Springer To: Konstantin Belousov Message-ID: <20081127113126.GH12700@rink.nu> References: <200811271128.mARBS0Kw085859@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200811271128.mARBS0Kw085859@svn.freebsd.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185369 - in head: lib/libc/gen lib/libthr/thread libexec/rtld-elf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 11:30:59 -0000 On Thu, Nov 27, 2008 at 11:28:00AM +0000, Konstantin Belousov wrote: > Author: kib > Date: Thu Nov 27 11:27:59 2008 > New Revision: 185369 > URL: http://svn.freebsd.org/changeset/base/185369 > > Log: > Add two rtld exported symbols, _rtld_atfork_pre and _rtld_atfork_post. > Threading library calls _pre before the fork, allowing the rtld to > lock itself to ensure that other threads of the process are out of > dynamic linker. _post releases the locks. > > This allows the rtld to have consistent state in the child. Although > child may legitimately call only async-safe functions, the call may > need plt relocation resolution, and this requires working rtld. > > Reported and debugging help by: rink > Reviewed by: kan, davidxu > MFC after: 1 month (anyway, not before 7.1 is out) Thanks! -- Rink P.W. Springer - http://rink.nu "Anyway boys, this is America. Just because you get more votes doesn't mean you win." - Fox Mulder From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 12:04:35 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFCD61065670; Thu, 27 Nov 2008 12:04:35 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B4A58FC1C; Thu, 27 Nov 2008 12:04:35 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mARC4Z5N086594; Thu, 27 Nov 2008 12:04:35 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mARC4Zdd086587; Thu, 27 Nov 2008 12:04:35 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811271204.mARC4Zdd086587@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 27 Nov 2008 12:04:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185370 - in head/sys: netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 12:04:35 -0000 Author: bz Date: Thu Nov 27 12:04:35 2008 New Revision: 185370 URL: http://svn.freebsd.org/changeset/base/185370 Log: Merge in6_pcbfree() into in_pcbfree() which after the previous IPsec change in r185366 only differed in two additonal IPv6 lines. Rather than splattering conditional code everywhere add the v6 check centrally at this single place. Reviewed by: rwatson (as part of a larger changset) MFC after: 6 weeks (*) (*) possibly need to leave a stub wrapper in 7 to keep the symbol. Modified: head/sys/netinet/in_pcb.c head/sys/netinet/tcp_timewait.c head/sys/netinet/tcp_usrreq.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_pcb.h head/sys/netinet6/raw_ip6.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Thu Nov 27 11:27:59 2008 (r185369) +++ head/sys/netinet/in_pcb.c Thu Nov 27 12:04:35 2008 (r185370) @@ -899,10 +899,17 @@ in_pcbfree(struct inpcb *inp) INP_WLOCK_ASSERT(inp); #ifdef IPSEC - ipsec_delete_pcbpolicy(inp); + if (inp->inp_sp != NULL) + ipsec_delete_pcbpolicy(inp); #endif /* IPSEC */ inp->inp_gencnt = ++ipi->ipi_gencnt; in_pcbremlists(inp); +#ifdef INET6 + if (inp->inp_vflag & INP_IPV6PROTO) { + ip6_freepcbopts(inp->in6p_outputopts); + ip6_freemoptions(inp->in6p_moptions); + } +#endif if (inp->inp_options) (void)m_free(inp->inp_options); if (inp->inp_moptions != NULL) Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Thu Nov 27 11:27:59 2008 (r185369) +++ head/sys/netinet/tcp_timewait.c Thu Nov 27 12:04:35 2008 (r185370) @@ -514,14 +514,8 @@ tcp_twclose(struct tcptw *tw, int reuse) */ INP_WUNLOCK(inp); } - } else { -#ifdef INET6 - if (inp->inp_vflag & INP_IPV6PROTO) - in6_pcbfree(inp); - else -#endif - in_pcbfree(inp); - } + } else + in_pcbfree(inp); V_tcpstat.tcps_closed++; crfree(tw->tw_cred); tw->tw_cred = NULL; Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Thu Nov 27 11:27:59 2008 (r185369) +++ head/sys/netinet/tcp_usrreq.c Thu Nov 27 12:04:35 2008 (r185370) @@ -156,9 +156,6 @@ static void tcp_detach(struct socket *so, struct inpcb *inp) { struct tcpcb *tp; -#ifdef INET6 - int isipv6 = INP_CHECK_SOCKAF(so, AF_INET6) != 0; -#endif #ifdef INVARIANTS INIT_VNET_INET(so->so_vnet); #endif @@ -188,12 +185,7 @@ tcp_detach(struct socket *so, struct inp KASSERT(tp == NULL, ("tcp_detach: INP_TIMEWAIT && " "INP_DROPPED && tp != NULL")); in_pcbdetach(inp); -#ifdef INET6 - if (isipv6) - in6_pcbfree(inp); - else -#endif - in_pcbfree(inp); + in_pcbfree(inp); } else { in_pcbdetach(inp); INP_WUNLOCK(inp); @@ -212,15 +204,9 @@ tcp_detach(struct socket *so, struct inp tp->t_state < TCPS_SYN_SENT) { tcp_discardcb(tp); in_pcbdetach(inp); -#ifdef INET6 - if (isipv6) - in6_pcbfree(inp); - else -#endif - in_pcbfree(inp); - } else { - in_pcbdetach(inp); - } + in_pcbfree(inp); + } else + in_pcbdetach(inp); } } @@ -1479,12 +1465,7 @@ tcp_attach(struct socket *so) tp = tcp_newtcpcb(inp); if (tp == NULL) { in_pcbdetach(inp); -#ifdef INET6 - if (isipv6) - in6_pcbfree(inp); - else -#endif - in_pcbfree(inp); + in_pcbfree(inp); INP_INFO_WUNLOCK(&V_tcbinfo); return (ENOBUFS); } Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Thu Nov 27 11:27:59 2008 (r185369) +++ head/sys/netinet6/in6_pcb.c Thu Nov 27 12:04:35 2008 (r185370) @@ -103,12 +103,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef IPSEC -#include -#include -#include -#endif /* IPSEC */ - #include struct in6_addr zeroin6_addr; @@ -410,39 +404,6 @@ in6_pcbdisconnect(struct inpcb *inp) in_pcbrehash(inp); } -void -in6_pcbfree(struct inpcb *inp) -{ - struct inpcbinfo *ipi = inp->inp_pcbinfo; - - KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__)); - - INP_INFO_WLOCK_ASSERT(ipi); - INP_WLOCK_ASSERT(inp); - -#ifdef IPSEC - if (inp->in6p_sp != NULL) - ipsec_delete_pcbpolicy(inp); -#endif /* IPSEC */ - inp->inp_gencnt = ++ipi->ipi_gencnt; - in_pcbremlists(inp); - ip6_freepcbopts(inp->in6p_outputopts); - ip6_freemoptions(inp->in6p_moptions); - /* Check and free IPv4 related resources in case of mapped addr */ - if (inp->inp_options) - (void)m_free(inp->inp_options); - if (inp->inp_moptions != NULL) - inp_freemoptions(inp->inp_moptions); - inp->inp_vflag = 0; - crfree(inp->inp_cred); - -#ifdef MAC - mac_inpcb_destroy(inp); -#endif - INP_WUNLOCK(inp); - uma_zfree(ipi->ipi_zone, inp); -} - struct sockaddr * in6_sockaddr(in_port_t port, struct in6_addr *addr_p) { Modified: head/sys/netinet6/in6_pcb.h ============================================================================== --- head/sys/netinet6/in6_pcb.h Thu Nov 27 11:27:59 2008 (r185369) +++ head/sys/netinet6/in6_pcb.h Thu Nov 27 12:04:35 2008 (r185370) @@ -74,7 +74,6 @@ void in6_losing __P((struct inpcb *)); int in6_pcbbind __P((struct inpcb *, struct sockaddr *, struct ucred *)); int in6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct ucred *)); void in6_pcbdisconnect __P((struct inpcb *)); -void in6_pcbfree __P((struct inpcb *)); int in6_pcbladdr __P((struct inpcb *, struct sockaddr *, struct in6_addr **)); struct inpcb * Modified: head/sys/netinet6/raw_ip6.c ============================================================================== --- head/sys/netinet6/raw_ip6.c Thu Nov 27 11:27:59 2008 (r185369) +++ head/sys/netinet6/raw_ip6.c Thu Nov 27 12:04:35 2008 (r185370) @@ -605,7 +605,7 @@ rip6_detach(struct socket *so) INP_WLOCK(inp); free(inp->in6p_icmp6filt, M_PCB); in_pcbdetach(inp); - in6_pcbfree(inp); + in_pcbfree(inp); INP_INFO_WUNLOCK(&V_ripcbinfo); } Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Thu Nov 27 11:27:59 2008 (r185369) +++ head/sys/netinet6/udp6_usrreq.c Thu Nov 27 12:04:35 2008 (r185370) @@ -901,7 +901,7 @@ udp6_detach(struct socket *so) INP_INFO_WLOCK(&V_udbinfo); INP_WLOCK(inp); in_pcbdetach(inp); - in6_pcbfree(inp); + in_pcbfree(inp); INP_INFO_WUNLOCK(&V_udbinfo); } From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 13:19:43 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 158CE106564A; Thu, 27 Nov 2008 13:19:42 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3CBB8FC1E; Thu, 27 Nov 2008 13:19:42 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mARDJgMg088089; Thu, 27 Nov 2008 13:19:42 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mARDJgem088085; Thu, 27 Nov 2008 13:19:42 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811271319.mARDJgem088085@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 27 Nov 2008 13:19:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185371 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 13:19:43 -0000 Author: bz Date: Thu Nov 27 13:19:42 2008 New Revision: 185371 URL: http://svn.freebsd.org/changeset/base/185371 Log: Replace most INP_CHECK_SOCKAF() uses checking if it is an IPv6 socket by comparing a constant inp vflag. This is expected to help to reduce extra locking. Suggested by: rwatson Reviewed by: rwatson MFC after: 6 weeks Modified: head/sys/netinet/in_pcb.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_usrreq.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Thu Nov 27 12:04:35 2008 (r185370) +++ head/sys/netinet/in_pcb.c Thu Nov 27 13:19:42 2008 (r185371) @@ -1254,8 +1254,7 @@ in_pcblookup_hash(struct inpcbinfo *pcbi return (inp); else if (inp->inp_laddr.s_addr == INADDR_ANY) { #ifdef INET6 - if (INP_CHECK_SOCKAF(inp->inp_socket, - AF_INET6)) + if (inp->inp_vflag & INP_IPV6PROTO) local_wild_mapped = inp; else #endif Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Thu Nov 27 12:04:35 2008 (r185370) +++ head/sys/netinet/tcp_output.c Thu Nov 27 13:19:42 2008 (r185371) @@ -1172,7 +1172,7 @@ timer: { ip->ip_len = m->m_pkthdr.len; #ifdef INET6 - if (INP_CHECK_SOCKAF(so, AF_INET6)) + if (tp->t_inpcb->inp_vflag & INP_IPV6PROTO) ip->ip_ttl = in6_selecthlim(tp->t_inpcb, NULL); #endif /* INET6 */ /* Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Thu Nov 27 12:04:35 2008 (r185370) +++ head/sys/netinet/tcp_usrreq.c Thu Nov 27 13:19:42 2008 (r185371) @@ -1256,7 +1256,7 @@ tcp_ctloutput(struct socket *so, struct INP_WLOCK(inp); if (sopt->sopt_level != IPPROTO_TCP) { #ifdef INET6 - if (INP_CHECK_SOCKAF(so, AF_INET6)) { + if (inp->inp_vflag & INP_IPV6PROTO) { INP_WUNLOCK(inp); error = ip6_ctloutput(so, sopt); } else { @@ -1436,9 +1436,6 @@ tcp_attach(struct socket *so) struct tcpcb *tp; struct inpcb *inp; int error; -#ifdef INET6 - int isipv6 = INP_CHECK_SOCKAF(so, AF_INET6) != 0; -#endif if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { error = soreserve(so, tcp_sendspace, tcp_recvspace); @@ -1455,7 +1452,7 @@ tcp_attach(struct socket *so) } inp = sotoinpcb(so); #ifdef INET6 - if (isipv6) { + if (inp->inp_vflag & INP_IPV6PROTO) { inp->inp_vflag |= INP_IPV6; inp->in6p_hops = -1; /* use kernel default */ } From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 16:41:46 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBDEB1065672; Thu, 27 Nov 2008 16:41:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF0758FC16; Thu, 27 Nov 2008 16:41:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mARGfksK092028; Thu, 27 Nov 2008 16:41:46 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mARGfkuT092027; Thu, 27 Nov 2008 16:41:46 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811271641.mARGfkuT092027@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 27 Nov 2008 16:41:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185372 - in releng/7.1/sys: . netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 16:41:47 -0000 Author: bz Date: Thu Nov 27 16:41:46 2008 New Revision: 185372 URL: http://svn.freebsd.org/changeset/base/185372 Log: MFC: r185332 Plug a credential leak in case the inpcb is freed by in6_pcbfree() instead of in_pcbfree(); missed in r183606. Discussed with: re (kib) Approved by: re (gnn) Reminded by: rwatson (with his re hat?) Modified: releng/7.1/sys/ (props changed) releng/7.1/sys/netinet6/in6_pcb.c Modified: releng/7.1/sys/netinet6/in6_pcb.c ============================================================================== --- releng/7.1/sys/netinet6/in6_pcb.c Thu Nov 27 13:19:42 2008 (r185371) +++ releng/7.1/sys/netinet6/in6_pcb.c Thu Nov 27 16:41:46 2008 (r185372) @@ -437,6 +437,7 @@ in6_pcbfree(struct inpcb *inp) if (inp->inp_moptions != NULL) inp_freemoptions(inp->inp_moptions); inp->inp_vflag = 0; + crfree(inp->inp_cred); #ifdef MAC mac_destroy_inpcb(inp); #endif From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 16:47:26 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 171261065673; Thu, 27 Nov 2008 16:47: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 084F88FC14; Thu, 27 Nov 2008 16:47:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mARGlPbo092183; Thu, 27 Nov 2008 16:47:25 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mARGlP0B092182; Thu, 27 Nov 2008 16:47:25 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811271647.mARGlP0B092182@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 27 Nov 2008 16:47:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185373 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 16:47:26 -0000 Author: kib Date: Thu Nov 27 16:47:25 2008 New Revision: 185373 URL: http://svn.freebsd.org/changeset/base/185373 Log: Explicitely note that destroy_dev() sleeps. Requested by: ed (some time ago), Jaakko Heinonen Modified: head/sys/kern/kern_conf.c Modified: head/sys/kern/kern_conf.c ============================================================================== --- head/sys/kern/kern_conf.c Thu Nov 27 16:41:46 2008 (r185372) +++ head/sys/kern/kern_conf.c Thu Nov 27 16:47:25 2008 (r185373) @@ -862,6 +862,7 @@ void destroy_dev(struct cdev *dev) { + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "destroy_dev"); dev_lock(); destroy_devl(dev); dev_unlock_and_free(); From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 16:50:24 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38FAF106564A; Thu, 27 Nov 2008 16:50:24 +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 2B5A08FC0C; Thu, 27 Nov 2008 16:50:24 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mARGoOZH092273; Thu, 27 Nov 2008 16:50:24 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mARGoNb7092271; Thu, 27 Nov 2008 16:50:23 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200811271650.mARGoNb7092271@svn.freebsd.org> From: Rafal Jaworowski Date: Thu, 27 Nov 2008 16:50:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185374 - head/share/man/man4/man4.arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 16:50:24 -0000 Author: raj Date: Thu Nov 27 16:50:23 2008 New Revision: 185374 URL: http://svn.freebsd.org/changeset/base/185374 Log: Provide manual page for the mge(4) device driver. Added: head/share/man/man4/man4.arm/mge.4 (contents, props changed) Modified: head/share/man/man4/man4.arm/Makefile Modified: head/share/man/man4/man4.arm/Makefile ============================================================================== --- head/share/man/man4/man4.arm/Makefile Thu Nov 27 16:47:25 2008 (r185373) +++ head/share/man/man4/man4.arm/Makefile Thu Nov 27 16:50:23 2008 (r185374) @@ -1,6 +1,6 @@ # $FreeBSD$ -MAN= npe.4 +MAN= mge.4 npe.4 MANSUBDIR=/arm Added: head/share/man/man4/man4.arm/mge.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/man4.arm/mge.4 Thu Nov 27 16:50:23 2008 (r185374) @@ -0,0 +1,160 @@ +.\" +.\" Copyright (c) 2008 Semihalf, Rafal Jaworowski +.\" +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 27, 2008 +.Dt MGE 4 +.Os +.Sh NAME +.Nm mge +.Nd "Marvell Gigabit Ethernet device driver" +.Sh SYNOPSIS +To compile this driver into the kernel, place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device mge" +.Cd "device miibus" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for gigabit Ethernet controller integrated in Marvell +system-on-chip devices. +.Pp +The +.Nm +driver supports the following media types: +.Pp +.Bl -tag -width xxxxxxxxxxxxxxxxxxxx +.It autoselect +Enable autoselection of the media type and options +.It 10baseT/UTP +Set 10Mbps operation +.It 100baseTX +Set 100Mbps operation +.It 1000baseT +Set 1000baseT operation +.El +.Pp +The +.Nm +driver supports the following media options: +.Pp +.Bl -tag -width xxxxxxxxxxxxxxxxxxxx +.It full-duplex +Set full duplex operation +.El +.Pp +The +.Nm +driver supports polled operation when the system is configured with +DEVICE_POLLING kernel option, see +.Xr polling 4 +for more details. +.Pp +The +.Nm +driver supports reception and transmission of extended frames +for +.Xr vlan 4 . +This capability of +.Nm +can be controlled by means of the +.Cm vlanmtu +parameter +to +.Xr ifconfig 8 . +.Pp +The +.Nm +driver supports interrupts coalescing (IC) so that raising a transmit/receive +frame interrupt is delayed, if possible, until a threshold-defined period of +time has elapsed. The following sysctls regulate this behaviour (separately +for each path): +.Bl -tag -width indent +.It Va dev.mge.X.int_coal.rx_time +.It Va dev.mge.X.int_coal.tx_time +.Pp +Value of 0 disables IC on the given path, value greater than zero corresponds +to a real time period and is expressed in units equivalent to 64 ticks of the +MGE clock. Maximum allowed value depends on MGE hardware revision. User +provided values larger than supported will be trimmed to the maximum +supported. More details are available in the reference manual of the device. +.El +.Sh HARDWARE +Gigabit Ethernet controllers built into the following Marvell systems-on-chip +are known to work with the +.Nm +driver: +.Pp +.Bl -bullet -compact +.It +Orion 88F5182 +.It +Orion 88F5281 +.It +Kirkwood 88F6281 (MGE V2) +.It +Discovery MV78100 (MGE V2) +.El +.Pp +There are also Marvell system controllers for PowerPC processors, which +include a variation of this gigabit Ethernet module integrated on chip, and +they should also work with the +.Nm +driver, but this wasn't tested: +.Pp +.Bl -bullet -compact +.It +MV64430 +.It +MV64460, MV64461, MV64462 +.El +.Sh SEE ALSO +.Xr altq 4 , +.Xr arp 4 , +.Xr miibus 4 , +.Xr netintro 4 , +.Xr ng_ether 4 , +.Xr polling 4 , +.Xr vlan 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The base version of +.Nm +device driver was written by +.An Grzegorz Bernacki. +It has been extended with advanced features (polling, interrupt coalescing, +multicast, h/w checksum calculation etc.) by +.An Piotr Ziecik . +This manual page was written by +.An Rafal Jaworowski . From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 16:53:02 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21C891065678; Thu, 27 Nov 2008 16:53:02 +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 153398FC0A; Thu, 27 Nov 2008 16:53:02 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mARGr10P092349; Thu, 27 Nov 2008 16:53:01 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mARGr1ES092348; Thu, 27 Nov 2008 16:53:01 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200811271653.mARGr1ES092348@svn.freebsd.org> From: Rafal Jaworowski Date: Thu, 27 Nov 2008 16:53:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185375 - head/sys/boot/arm/uboot X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 16:53:02 -0000 Author: raj Date: Thu Nov 27 16:53:01 2008 New Revision: 185375 URL: http://svn.freebsd.org/changeset/base/185375 Log: Let ARM loader(8) build with the man page. Modified: head/sys/boot/arm/uboot/Makefile Modified: head/sys/boot/arm/uboot/Makefile ============================================================================== --- head/sys/boot/arm/uboot/Makefile Thu Nov 27 16:50:23 2008 (r185374) +++ head/sys/boot/arm/uboot/Makefile Thu Nov 27 16:53:01 2008 (r185375) @@ -4,7 +4,6 @@ PROG= ubldr NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH} BINDIR?= /boot INSTALLFLAGS= -b -NO_MAN= WARNS?= 1 # Architecture-specific loader code @@ -61,7 +60,7 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I. -CLEANFILES+= vers.c ${PROG}.help +CLEANFILES+= vers.c loader.help CFLAGS+= -ffreestanding @@ -86,11 +85,11 @@ LDADD= ${LIBFICL} ${LIBUBOOT} -lstand vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} -${PROG}.help: help.common help.uboot +loader.help: help.common help.uboot cat ${.ALLSRC} | \ awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} .PATH: ${.CURDIR}/../../forth -FILES= ${PROG}.help +FILES= loader.help .include From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 17:57:32 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 614601065670; Thu, 27 Nov 2008 17:57:32 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 245598FC27; Thu, 27 Nov 2008 17:57:32 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id mARHtVsu008168; Thu, 27 Nov 2008 10:55:31 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Thu, 27 Nov 2008 10:55:34 -0700 (MST) Message-Id: <20081127.105534.188222755.imp@bsdimp.com> To: ivoras@gmail.com From: "M. Warner Losh" In-Reply-To: <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> References: <9bbcef730811270220h1a7f812k2ba340737132ff82@mail.gmail.com> <8663m94g30.fsf@ds4.des.no> <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, des@des.no, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 17:57:32 -0000 In message: <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.co= m> "Ivan Voras" writes: : 2008/11/27 Dag-Erling Sm=F8rgrav : : > "Ivan Voras" writes: : >> And at least the newer GEOM code also uses c99 variable declaratio= ns : >> (not only for initializers - they were c99 from the start). : > : > I'm curious about what you mean with "c99 variable declarations". = If : > you are referring to loop variable declarations, I can only find tw= o : > cases, both in g_linux_lvm.c. Other than that and mixing declarati= ons : > with statements (which style(9) explicitly forbids), there is no : > difference between c89 to c99 as far as variable declarations are : > concerned. : = : Yes, but not only loops - I mean things like: : = : if () { : struct *something abc; : int y; : ... : } : = : You'll probably find my code is one the biggest users of this style : but I've only started using it when I saw it already used. This is a K&R level C construct. It is discouraged in style(9) because it makes it hard to find declarations. However, it is used in the kernel in a number of places. I personally really dislike the style (and yes, I know all the arguments for it). If you really want something that complex inside a block to need block scoped variables, then that really argues for a function oft times... Warner From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 18:22:05 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DDA31065673; Thu, 27 Nov 2008 18:22:05 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 40A958FC0A; Thu, 27 Nov 2008 18:22:04 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id E467E6D449; Thu, 27 Nov 2008 18:22:03 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id C58DF844A7; Thu, 27 Nov 2008 19:22:03 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "M. Warner Losh" References: <9bbcef730811270220h1a7f812k2ba340737132ff82@mail.gmail.com> <8663m94g30.fsf@ds4.des.no> <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> <20081127.105534.188222755.imp@bsdimp.com> Date: Thu, 27 Nov 2008 19:22:03 +0100 In-Reply-To: <20081127.105534.188222755.imp@bsdimp.com> (M. Warner Losh's message of "Thu, 27 Nov 2008 10:55:34 -0700 (MST)") Message-ID: <86ej0x112s.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, ivoras@gmail.com Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 18:22:05 -0000 "M. Warner Losh" writes: > This is a K&R level C construct. > > It is discouraged in style(9) because it makes it hard to find > declarations. However, it is used in the kernel in a number of > places. > > I personally really dislike the style (and yes, I know all the > arguments for it). If you really want something that complex inside a > block to need block scoped variables, then that really argues for a > function oft times... There is one particular situation where it is very convenient: int foo(struct sockaddr *sa) { switch (s->sa_family) { case AF_INET: { struct sockaddr_in *sin =3D (struct sockaddr_in *)sa; /* ... */ break; } case AF_INET6: { struct sockaddr_in6 *sin6 =3D (struct sockaddr_in6 *)sa; /* ... */ break; } case AF_UNIX: { /* you get the idea */ } default: /* ... */ } } DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 18:35:54 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAB5E106564A; Thu, 27 Nov 2008 18:35:54 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id 9FB618FC1B; Thu, 27 Nov 2008 18:35:54 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from trouble.errno.com (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id mARIZpRe075656 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 27 Nov 2008 10:35:51 -0800 (PST) (envelope-from sam@freebsd.org) Message-ID: <492EE887.8080901@freebsd.org> Date: Thu, 27 Nov 2008 10:35:51 -0800 From: Sam Leffler Organization: FreeBSD Project User-Agent: Thunderbird 2.0.0.9 (X11/20071125) MIME-Version: 1.0 To: Ivan Voras References: <200811270219.mAR2Ji2M073024@svn.freebsd.org> <20081126213204.14db9a63@kan.dnsalias.net> <20081127.000621.1413927847.imp@bsdimp.com> <9bbcef730811270220h1a7f812k2ba340737132ff82@mail.gmail.com> <8663m94g30.fsf@ds4.des.no> <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> In-Reply-To: <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-DCC--Metrics: ebb.errno.com; whitelist Cc: svn-src-head@freebsd.org, =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?= , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 18:35:54 -0000 Ivan Voras wrote: > 2008/11/27 Dag-Erling Smørgrav : > >> "Ivan Voras" writes: >> >>> And at least the newer GEOM code also uses c99 variable declarations >>> (not only for initializers - they were c99 from the start). >>> >> I'm curious about what you mean with "c99 variable declarations". If >> you are referring to loop variable declarations, I can only find two >> cases, both in g_linux_lvm.c. Other than that and mixing declarations >> with statements (which style(9) explicitly forbids), there is no >> difference between c89 to c99 as far as variable declarations are >> concerned. >> > > Yes, but not only loops - I mean things like: > > if () { > struct *something abc; > int y; > ... > } > > You'll probably find my code is one the biggest users of this style > but I've only started using it when I saw it already used. > > Repeat after me: "style is a guideline and not a contract". Sam From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 18:50:03 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E9A81065690; Thu, 27 Nov 2008 18:50:03 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id CFA408FC13; Thu, 27 Nov 2008 18:50:02 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id BEBF66D43F; Thu, 27 Nov 2008 18:50:01 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 9B5C28449F; Thu, 27 Nov 2008 19:50:01 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Sam Leffler References: <200811270219.mAR2Ji2M073024@svn.freebsd.org> <20081126213204.14db9a63@kan.dnsalias.net> <20081127.000621.1413927847.imp@bsdimp.com> <9bbcef730811270220h1a7f812k2ba340737132ff82@mail.gmail.com> <8663m94g30.fsf@ds4.des.no> <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> <492EE887.8080901@freebsd.org> Date: Thu, 27 Nov 2008 19:50:01 +0100 In-Reply-To: <492EE887.8080901@freebsd.org> (Sam Leffler's message of "Thu, 27 Nov 2008 10:35:51 -0800") Message-ID: <861vwx0zs6.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ivan Voras Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 18:50:03 -0000 Sam Leffler writes: > Repeat after me: "style is a guideline and not a contract". Hmm, they must have forgotten to send you the paperwork when you joined up :) DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 19:05:25 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14E041065670; Thu, 27 Nov 2008 19:05:25 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 83B108FC08; Thu, 27 Nov 2008 19:05:24 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from igloo.linux.gr (localhost.localdomain [127.0.0.1]) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id mARJ5LK1021091 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 27 Nov 2008 21:05:21 +0200 Received: (from keramida@localhost) by igloo.linux.gr (8.14.3/8.14.3/Submit) id mARJ5L9c021090; Thu, 27 Nov 2008 21:05:21 +0200 X-Authentication-Warning: igloo.linux.gr: keramida set sender to keramida@freebsd.org using -f Date: Thu, 27 Nov 2008 21:05:21 +0200 From: Giorgos Keramidas To: Robert Watson , keramida@freebsd.org Message-ID: <20081127190520.GA19542@igloo.linux.gr> References: <200811270842.mAR8gwi3080974@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200811270842.mAR8gwi3080974@svn.freebsd.org> X-MailScanner-ID: mARJ5LK1021091 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.399, required 5, autolearn=not spam, ALL_TRUSTED -1.80, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@freebsd.org X-Spam-Status: No Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185362 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 19:05:25 -0000 On 2008-11-27 08:42, Robert Watson wrote: > Author: rwatson > Date: Thu Nov 27 08:42:58 2008 > New Revision: 185362 > URL: http://svn.freebsd.org/changeset/base/185362 > > Log: > Revert r184509: don't encourage the use of sysexits.h with err() and > errx(),, as there seems to be a general preference against this > practice. Thanks :) The err.3 manpage needs fixing too then, because it contains EXAMPLES with sysexits.h codes. I'm currently restoring my laptop from backups, so I am a bit reluctant to trust its installation of subversion-freebsd until I have checked that the restore was successful. If you don't get around to fixing the err.3 examples until I'm fully online, I can do it :) From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 20:26:02 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C56031065670; Thu, 27 Nov 2008 20:26:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8C678FC20; Thu, 27 Nov 2008 20:26:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mARKQ26M096368; Thu, 27 Nov 2008 20:26:02 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mARKQ2C2096367; Thu, 27 Nov 2008 20:26:02 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <200811272026.mARKQ2C2096367@svn.freebsd.org> From: Ed Maste Date: Thu, 27 Nov 2008 20:26:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185376 - head/sys/dev/aac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 20:26:02 -0000 Author: emaste Date: Thu Nov 27 20:26:02 2008 New Revision: 185376 URL: http://svn.freebsd.org/changeset/base/185376 Log: Remove duplicate 2610SA entry. Submitted by: jkim Modified: head/sys/dev/aac/aac_pci.c Modified: head/sys/dev/aac/aac_pci.c ============================================================================== --- head/sys/dev/aac/aac_pci.c Thu Nov 27 16:53:01 2008 (r185375) +++ head/sys/dev/aac/aac_pci.c Thu Nov 27 20:26:02 2008 (r185376) @@ -168,8 +168,6 @@ struct aac_ident "ICP ICP9014RO SCSI RAID"}, {0x9005, 0x0285, 0x9005, 0x0294, AAC_HWIF_I960RX, 0, "Adaptec SATA RAID 2026ZCR"}, - {0x9005, 0x0285, 0x103c, 0x3227, AAC_HWIF_I960RX, 0, - "Adaptec SATA RAID 2610SA"}, {0x9005, 0x0285, 0x9005, 0x0296, AAC_HWIF_I960RX, 0, "Adaptec SCSI RAID 2240S"}, {0x9005, 0x0285, 0x9005, 0x0297, AAC_HWIF_I960RX, 0, From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 23:56:44 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0553B1065670 for ; Thu, 27 Nov 2008 23:56:44 +0000 (UTC) (envelope-from ken@mthelicon.com) Received: from hercules.mthelicon.com (hercules.mthelicon.com [IPv6:2001:49f0:2023::2]) by mx1.freebsd.org (Postfix) with ESMTP id B10598FC08 for ; Thu, 27 Nov 2008 23:56:43 +0000 (UTC) (envelope-from ken@mthelicon.com) Received: from feathers.peganest.com ([IPv6:2001:4d48:ad51:32:21b:21ff:fe1c:3ce]) (authenticated bits=0) by hercules.mthelicon.com (8.14.3/8.14.2) with ESMTP id mARNue5A058690 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO) for ; Thu, 27 Nov 2008 23:56:42 GMT (envelope-from ken@mthelicon.com) From: Pegasus Mc Cleaft Organization: Feathers To: svn-src-all@freebsd.org Date: Thu, 27 Nov 2008 23:56:40 +0000 User-Agent: KMail/1.10.1 (FreeBSD/8.0-CURRENT; KDE/4.1.1; amd64; ; ) References: <200811270900.mAR90lQH081411@svn.freebsd.org> In-Reply-To: <200811270900.mAR90lQH081411@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_4OzLJ/WqMLXR6Hq" Message-Id: <200811272356.40101.ken@mthelicon.com> Subject: Re: svn commit: r185363 - in head: lib/libpmc sys/amd64/include sys/conf sys/dev/hwpmc sys/i386/include sys/modules/hwpmc sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 23:56:44 -0000 --Boundary-00=_4OzLJ/WqMLXR6Hq Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thursday 27 November 2008 09:00:47 Joseph Koshy wrote: > Author: jkoshy > Date: Thu Nov 27 09:00:47 2008 > New Revision: 185363 > URL: http://svn.freebsd.org/changeset/base/185363 > > Log: > - Add support for PMCs in Intel CPUs of Family 6, model 0xE (Core Solo > and Core Duo), models 0xF (Core2), model 0x17 (Core2Extreme) and > model 0x1C (Atom). > Joseph, I have tried this on my machine at home and it threw a kernel panic on boot. I cut the section of the dmesg out, if this helps.. If there is anything I can do to help you debug, please let me know. As a point of note, I have removed the hwpmc from the config file and recompiled and the new kernel seems to work ok.. Peg --Boundary-00=_4OzLJ/WqMLXR6Hq Content-Type: text/plain; charset="utf-8"; name="Bang.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Bang.txt" Copyright (c) 1992-2008 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 8.0-CURRENT #5: Thu Nov 27 18:58:57 UTC 2008 ken@feathers.peganest.com:/usr/obj/usr/src/sys/FEATHERS Timecounter "i8254" frequency 1193182 Hz quality 0 CPU: Intel(R) Core(TM)2 Quad CPU Q9450 @ 2.66GHz (3006.01-MHz K8-class CPU) Origin = "GenuineIntel" Id = 0x10677 Stepping = 7 Features=0xbfebfbff Features2=0x8e3fd AMD Features=0x20100800 AMD Features2=0x1 Cores per package: 4 usable memory = 8573272064 (8176 MB) avail memory = 8285847552 (7902 MB) ACPI APIC Table: FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs cpu0 (BSP): APIC ID: 0 cpu1 (AP): APIC ID: 1 cpu2 (AP): APIC ID: 2 cpu3 (AP): APIC ID: 3 ioapic0: Changing APIC ID to 2 ioapic0 irqs 0-23 on motherboard ... ar0: 476928MB status: READY ar0: disk0 READY (master) using ad8 at ata4-master ar0: disk1 READY (mirror) using ad10 at ata5-master SMP: AP CPU #3 Launched! SMP: AP CPU #1 Launched! SMP: AP CPU #2 Launched! Fatal trap 12: page fault while in kernel mode cpuid = 0; apic id = 00 fault virtual address = 0x0 fault code = supervisor read instruction, page not present instruction pointer = 0x8:0x0 stack pointer = 0x10:0xffffffff80f2bc50 frame pointer = 0x10:0xffffffff80f2bcb0 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 0 (swapper) trap number = 12 panic: page fault cpuid = 0 Uptime: 9s Cannot dump. Device not defined or unavailable. Automatic reboot in 15 seconds - press a key on the console to abort Rebooting... cpu_reset: Stopping other CPUs --Boundary-00=_4OzLJ/WqMLXR6Hq-- From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 09:18:38 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72C931065672; Fri, 28 Nov 2008 09:18:38 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 30CBC8FC0C; Fri, 28 Nov 2008 09:18:38 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 3E58D6D43F; Fri, 28 Nov 2008 09:18:37 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 19B03844FF; Fri, 28 Nov 2008 10:18:37 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Joseph Koshy References: <200811270900.mAR90lQH081411@svn.freebsd.org> Date: Fri, 28 Nov 2008 10:18:37 +0100 In-Reply-To: <200811270900.mAR90lQH081411@svn.freebsd.org> (Joseph Koshy's message of "Thu, 27 Nov 2008 09:00:47 +0000 (UTC)") Message-ID: <86ljv4yzrm.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185363 - in head: lib/libpmc sys/amd64/include sys/conf sys/dev/hwpmc sys/i386/include sys/modules/hwpmc sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 09:18:38 -0000 Joseph Koshy writes: > Log: > - Add support for PMCs in Intel CPUs of Family 6, model 0xE (Core Solo > and Core Duo), models 0xF (Core2), model 0x17 (Core2Extreme) and > model 0x1C (Atom). > [...] Broke the pc98 build. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 09:59:20 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EEAB1065670; Fri, 28 Nov 2008 09:59:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 2937B8FC16; Fri, 28 Nov 2008 09:59:19 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-107-119-232.carlnfd1.nsw.optusnet.com.au [122.107.119.232]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id mAS9x5Ob018699 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 28 Nov 2008 20:59:09 +1100 Date: Fri, 28 Nov 2008 20:59:05 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= In-Reply-To: <86ej0x112s.fsf@ds4.des.no> Message-ID: <20081128204657.H1116@besplex.bde.org> References: <9bbcef730811270220h1a7f812k2ba340737132ff82@mail.gmail.com> <8663m94g30.fsf@ds4.des.no> <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> <20081127.105534.188222755.imp@bsdimp.com> <86ej0x112s.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-238254834-1227866345=:1116" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, ivoras@gmail.com, "M. Warner Losh" Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 09:59:20 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-238254834-1227866345=:1116 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 27 Nov 2008, [utf-8] Dag-Erling Sm=C3=B8rgrav wrote: > "M. Warner Losh" writes: >> I personally really dislike the style (and yes, I know all the >> arguments for it). If you really want something that complex inside a >> block to need block scoped variables, then that really argues for a >> function oft times... > > There is one particular situation where it is very convenient: > > int > foo(struct sockaddr *sa) > { > switch (s->sa_family) { > case AF_INET: { > struct sockaddr_in *sin =3D (struct sockaddr_in *)sa; > /* ... */ > break; > } Switch statements are 1 case (the only case?) where the braces needed for non-C99 declarations don't require extra indentation. However, indent(1) doesn't understand this and mangles the above to: int foo(struct sockaddr *sa) { =09switch (s->sa_family) { =09=09case AF_INET:{ =09=09=09struct sockaddr_in *sin =3D (struct sockaddr_in *)sa; =09=09=09/* ... */ =09=09=09break; =09=09} indent(1) has fixed a style bug in the above (the missing blank line after the declarations) but it has introduced 2 (the missing space before "{" and the unwanted indentation). Fixing the other style bug in the above (the initialization in the declaration) is beyond the scope of indent(1). gindent-2.2.9 -npro gives the same style bugs and 1 more (it misformats the comment to a block one, but that may be due to a bad default). Bruce --0-238254834-1227866345=:1116-- From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 12:23:02 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54424106564A; Fri, 28 Nov 2008 12:23:02 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 455CE8FC19; Fri, 28 Nov 2008 12:23:02 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASCN2kH018113; Fri, 28 Nov 2008 12:23:02 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASCN2ZY018112; Fri, 28 Nov 2008 12:23:02 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811281223.mASCN2ZY018112@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Fri, 28 Nov 2008 12:23:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185381 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 12:23:02 -0000 Author: bz Date: Fri Nov 28 12:23:02 2008 New Revision: 185381 URL: http://svn.freebsd.org/changeset/base/185381 Log: Add a reference to hwpmc_core.c most likely missed in r185363 to try to unbreak universe (untested). Modified: head/sys/conf/files.pc98 Modified: head/sys/conf/files.pc98 ============================================================================== --- head/sys/conf/files.pc98 Fri Nov 28 00:48:05 2008 (r185380) +++ head/sys/conf/files.pc98 Fri Nov 28 12:23:02 2008 (r185381) @@ -111,6 +111,7 @@ dev/fb/fb.c optional fb | gdc dev/fe/if_fe_cbus.c optional fe isa dev/hwpmc/hwpmc_amd.c optional hwpmc dev/hwpmc/hwpmc_intel.c optional hwpmc +dev/hwpmc/hwpmc_core.c optional hwpmc dev/hwpmc/hwpmc_pentium.c optional hwpmc dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_ppro.c optional hwpmc From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 13:13:45 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40A591065674; Fri, 28 Nov 2008 13:13:45 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 328818FC1C; Fri, 28 Nov 2008 13:13:45 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASDDj3A019332; Fri, 28 Nov 2008 13:13:45 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASDDjVf019331; Fri, 28 Nov 2008 13:13:45 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200811281313.mASDDjVf019331@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Fri, 28 Nov 2008 13:13:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185382 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 13:13:45 -0000 Author: des Date: Fri Nov 28 13:13:44 2008 New Revision: 185382 URL: http://svn.freebsd.org/changeset/base/185382 Log: missing V_ Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Fri Nov 28 12:23:02 2008 (r185381) +++ head/sys/netinet/tcp_subr.c Fri Nov 28 13:13:44 2008 (r185382) @@ -201,7 +201,7 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_t "Enable tcp_drain routine for extra help when low on mbufs"); SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, pcbcount, - CTLFLAG_RD, tcbinfo.ipi_count, 0, "Number of active PCBs"); + CTLFLAG_RD, V_tcbinfo.ipi_count, 0, "Number of active PCBs"); SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, icmp_may_rst, CTLFLAG_RW, icmp_may_rst, 0, From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 14:53:18 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 530121065673; Fri, 28 Nov 2008 14:53:18 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 461538FC14; Fri, 28 Nov 2008 14:53:18 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASErIV0021768; Fri, 28 Nov 2008 14:53:18 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASErIII021767; Fri, 28 Nov 2008 14:53:18 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200811281453.mASErIII021767@svn.freebsd.org> From: Ed Schouten Date: Fri, 28 Nov 2008 14:53:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185385 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 14:53:18 -0000 Author: ed Date: Fri Nov 28 14:53:18 2008 New Revision: 185385 URL: http://svn.freebsd.org/changeset/base/185385 Log: Fix matching of message queues by name. The mqfs_search() routine uses strncmp() to match message queue objects by name. This is because it can be called from environments where the file name is not null terminated (the VFS for example). Unfortunately it doesn't compare the lengths of the message queue names, which means if a system has "Queue12345", the name "Queue" will also match. I noticed this when a student of mine handed in an exercise using message queues with names "Queue2" and "Queue". Reviewed by: rink Modified: head/sys/kern/uipc_mqueue.c Modified: head/sys/kern/uipc_mqueue.c ============================================================================== --- head/sys/kern/uipc_mqueue.c Fri Nov 28 14:49:26 2008 (r185384) +++ head/sys/kern/uipc_mqueue.c Fri Nov 28 14:53:18 2008 (r185385) @@ -793,7 +793,8 @@ mqfs_search(struct mqfs_node *pd, const sx_assert(&pd->mn_info->mi_lock, SX_LOCKED); LIST_FOREACH(pn, &pd->mn_children, mn_sibling) { - if (strncmp(pn->mn_name, name, len) == 0) + if (strncmp(pn->mn_name, name, len) == 0 && + pn->mn_name[len] == '\0') return (pn); } return (NULL); From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 18:35:15 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C5751065672; Fri, 28 Nov 2008 18:35:15 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C9258FC1E; Fri, 28 Nov 2008 18:35:15 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASIZFIn026461; Fri, 28 Nov 2008 18:35:15 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASIZFQC026460; Fri, 28 Nov 2008 18:35:15 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <200811281835.mASIZFQC026460@svn.freebsd.org> From: "George V. Neville-Neil" Date: Fri, 28 Nov 2008 18:35:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185400 - head/usr.bin/netstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 18:35:15 -0000 Author: gnn Date: Fri Nov 28 18:35:14 2008 New Revision: 185400 URL: http://svn.freebsd.org/changeset/base/185400 Log: Fix a printing problem when using the -L flag to netstat caused by adding the -x flag earlier. Submitted by: Anton Yuzhaninov MFC after: 3 days Modified: head/usr.bin/netstat/inet.c Modified: head/usr.bin/netstat/inet.c ============================================================================== --- head/usr.bin/netstat/inet.c Fri Nov 28 17:17:54 2008 (r185399) +++ head/usr.bin/netstat/inet.c Fri Nov 28 18:35:14 2008 (r185400) @@ -407,19 +407,22 @@ protopr(u_long off, const char *name, in if (Lflag) printf("%-5.5s %-14.14s %-22.22s\n", "Proto", "Listen", "Local Address"); - printf((Aflag && !Wflag) ? - "%-5.5s %-6.6s %-6.6s %-18.18s %-18.18s" : - "%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s", - "Proto", "Recv-Q", "Send-Q", - "Local Address", "Foreign Address"); - if (xflag) - printf("%-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %s\n", - "R-MBUF", "S-MBUF", "R-CLUS", "S-CLUS", - "R-HIWA", "S-HIWA", "R-LOWA", "S-LOWA", - "R-BCNT", "S-BCNT", "R-BMAX", "S-BMAX", - "(state)"); - else - printf("(state)\n"); + else { + printf((Aflag && !Wflag) ? + "%-5.5s %-6.6s %-6.6s %-18.18s %-18.18s" : + "%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s", + "Proto", "Recv-Q", "Send-Q", + "Local Address", "Foreign Address"); + if (xflag) + printf("%-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %s\n", + "R-MBUF", "S-MBUF", "R-CLUS", + "S-CLUS", "R-HIWA", "S-HIWA", + "R-LOWA", "S-LOWA", "R-BCNT", + "S-BCNT", "R-BMAX", "S-BMAX", + "(state)"); + else + printf("(state)\n"); + } first = 0; } if (Lflag && so->so_qlimit == 0) From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 18:55:43 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C95E1065673; Fri, 28 Nov 2008 18:55:43 +0000 (UTC) (envelope-from stefanf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2BF0C8FC13; Fri, 28 Nov 2008 18:55:43 +0000 (UTC) (envelope-from stefanf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASItgwX026888; Fri, 28 Nov 2008 18:55:42 GMT (envelope-from stefanf@svn.freebsd.org) Received: (from stefanf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASItg3X026887; Fri, 28 Nov 2008 18:55:42 GMT (envelope-from stefanf@svn.freebsd.org) Message-Id: <200811281855.mASItg3X026887@svn.freebsd.org> From: Stefan Farfeleder Date: Fri, 28 Nov 2008 18:55:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185401 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 18:55:43 -0000 Author: stefanf Date: Fri Nov 28 18:55:42 2008 New Revision: 185401 URL: http://svn.freebsd.org/changeset/base/185401 Log: Report error messages of the builtins 'type' and 'command -V' to stderr instead of stdout. Noticed by: Zajcev Evgeny Modified: head/bin/sh/exec.c Modified: head/bin/sh/exec.c ============================================================================== --- head/bin/sh/exec.c Fri Nov 28 18:35:14 2008 (r185400) +++ head/bin/sh/exec.c Fri Nov 28 18:55:42 2008 (r185401) @@ -728,9 +728,6 @@ typecmd_impl(int argc, char **argv, int extern char *const parsekwd[]; for (i = 1; i < argc; i++) { - if (cmd != TYPECMD_SMALLV) - out1str(argv[i]); - /* First look at the keywords */ for (pp = (char **)parsekwd; *pp; pp++) if (**pp == *argv[i] && equal(*pp, argv[i])) @@ -740,7 +737,7 @@ typecmd_impl(int argc, char **argv, int if (cmd == TYPECMD_SMALLV) out1fmt("%s\n", argv[i]); else - out1str(" is a shell keyword\n"); + out1fmt("%s is a shell keyword\n", argv[i]); continue; } @@ -749,7 +746,8 @@ typecmd_impl(int argc, char **argv, int if (cmd == TYPECMD_SMALLV) out1fmt("alias %s='%s'\n", argv[i], ap->val); else - out1fmt(" is an alias for %s\n", ap->val); + out1fmt("%s is an alias for %s\n", argv[i], + ap->val); continue; } @@ -775,7 +773,7 @@ typecmd_impl(int argc, char **argv, int if (cmd == TYPECMD_SMALLV) out1fmt("%s\n", name); else - out1fmt(" is%s %s\n", + out1fmt("%s is%s %s\n", argv[i], (cmdp && cmd == TYPECMD_TYPE) ? " a tracked alias for" : "", name); @@ -784,11 +782,12 @@ typecmd_impl(int argc, char **argv, int if (cmd == TYPECMD_SMALLV) out1fmt("%s\n", argv[i]); else - out1fmt(" is %s\n", argv[i]); + out1fmt("%s is %s\n", argv[i], + argv[i]); } else { if (cmd != TYPECMD_SMALLV) - out1fmt(": %s\n", - strerror(errno)); + outfmt(out2, "%s: %s\n", + argv[i], strerror(errno)); error |= 127; } } @@ -798,19 +797,19 @@ typecmd_impl(int argc, char **argv, int if (cmd == TYPECMD_SMALLV) out1fmt("%s\n", argv[i]); else - out1str(" is a shell function\n"); + out1fmt("%s is a shell function\n", argv[i]); break; case CMDBUILTIN: if (cmd == TYPECMD_SMALLV) out1fmt("%s\n", argv[i]); else - out1str(" is a shell builtin\n"); + out1fmt("%s is a shell builtin\n", argv[i]); break; default: if (cmd != TYPECMD_SMALLV) - out1str(": not found\n"); + outfmt(out2, "%s: not found\n", argv[i]); error |= 127; break; } From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 18:59:05 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28D01106564A; Fri, 28 Nov 2008 18:59:05 +0000 (UTC) (envelope-from stefanf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 182208FC17; Fri, 28 Nov 2008 18:59:05 +0000 (UTC) (envelope-from stefanf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASIx4wR026999; Fri, 28 Nov 2008 18:59:04 GMT (envelope-from stefanf@svn.freebsd.org) Received: (from stefanf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASIx44G026998; Fri, 28 Nov 2008 18:59:04 GMT (envelope-from stefanf@svn.freebsd.org) Message-Id: <200811281859.mASIx44G026998@svn.freebsd.org> From: Stefan Farfeleder Date: Fri, 28 Nov 2008 18:59:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185402 - head/tools/regression/bin/sh/builtins X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 18:59:05 -0000 Author: stefanf Date: Fri Nov 28 18:59:04 2008 New Revision: 185402 URL: http://svn.freebsd.org/changeset/base/185402 Log: Update for 185401, errors now go to stderr. Added: head/tools/regression/bin/sh/builtins/type1.0.stderr (props changed) - copied unchanged from r181018, head/tools/regression/bin/sh/builtins/type1.0.stdout Deleted: head/tools/regression/bin/sh/builtins/type1.0.stdout Copied: head/tools/regression/bin/sh/builtins/type1.0.stderr (from r181018, head/tools/regression/bin/sh/builtins/type1.0.stdout) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/type1.0.stderr Fri Nov 28 18:59:04 2008 (r185402, copy of r181018, head/tools/regression/bin/sh/builtins/type1.0.stdout) @@ -0,0 +1,4 @@ +not-here: not found +/not-here: No such file or directory +not-here: not found +/not-here: No such file or directory From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 19:21:11 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 450681065670; Fri, 28 Nov 2008 19:21:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 337978FC14; Fri, 28 Nov 2008 19:21:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASJLB56027443; Fri, 28 Nov 2008 19:21:11 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASJLBjB027442; Fri, 28 Nov 2008 19:21:11 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811281921.mASJLBjB027442@svn.freebsd.org> From: Warner Losh Date: Fri, 28 Nov 2008 19:21:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185403 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 19:21:11 -0000 Author: imp Date: Fri Nov 28 19:21:10 2008 New Revision: 185403 URL: http://svn.freebsd.org/changeset/base/185403 Log: Add missing 'THE'. This was discussed with core@ in the larger context of making this text match the OSL text, but the changes that OSL silently made to the license to approve it haven't been brought back yet. Still working on that issue. We likely should start using the UTF-8 copyright symbol (What © expands to in HTML), but I'm not 100% confident in my ability to tell Emacs to save it like that. And I haven't gotten approval for that change. Approved by: core@ Modified: head/COPYRIGHT Modified: head/COPYRIGHT ============================================================================== --- head/COPYRIGHT Fri Nov 28 18:59:04 2008 (r185402) +++ head/COPYRIGHT Fri Nov 28 19:21:10 2008 (r185403) @@ -15,10 +15,10 @@ are met: notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 19:23:46 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEAD21065670; Fri, 28 Nov 2008 19:23:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCA198FC20; Fri, 28 Nov 2008 19:23:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASJNkol027538; Fri, 28 Nov 2008 19:23:46 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASJNkoO027537; Fri, 28 Nov 2008 19:23:46 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811281923.mASJNkoO027537@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Fri, 28 Nov 2008 19:23:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185404 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 19:23:47 -0000 Author: bz Date: Fri Nov 28 19:23:46 2008 New Revision: 185404 URL: http://svn.freebsd.org/changeset/base/185404 Log: With the permissions of phk@ change the license on kern_jail.c to a 2 clause BSD license. Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Fri Nov 28 19:21:10 2008 (r185403) +++ head/sys/kern/kern_jail.c Fri Nov 28 19:23:46 2008 (r185404) @@ -1,10 +1,26 @@ /*- - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- + * Copyright (c) 1999 Poul-Henning Kamp. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 19:35:48 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4343106564A; Fri, 28 Nov 2008 19:35:48 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 911BB8FC16; Fri, 28 Nov 2008 19:35:48 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASJZmpC027799; Fri, 28 Nov 2008 19:35:48 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASJZm8q027798; Fri, 28 Nov 2008 19:35:48 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200811281935.mASJZm8q027798@svn.freebsd.org> From: Maxim Konovalov Date: Fri, 28 Nov 2008 19:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185405 - head/share/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 19:35:48 -0000 Author: maxim Date: Fri Nov 28 19:35:48 2008 New Revision: 185405 URL: http://svn.freebsd.org/changeset/base/185405 Log: o FreeBSD 6.4-RELEASE added. Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Fri Nov 28 19:23:46 2008 (r185404) +++ head/share/misc/bsd-family-tree Fri Nov 28 19:35:48 2008 (r185405) @@ -217,12 +217,13 @@ FreeBSD 5.2 | | | | | | OpenBSD 4.2 | | | | NetBSD 4.0 | | | FreeBSD 6.3 | | | | - | | | | | - *--FreeBSD | | | DragonFly 1.12.0 - | 7.0 | | | | - | | | | OpenBSD 4.3 | - | V | | | DragonFly 2.0.0 - | | | OpenBSD 4.4 | + | \ | | | | + *--FreeBSD | | | | DragonFly 1.12.0 + | 7.0 | | | | | + | | | | | OpenBSD 4.3 | + | V | | | | DragonFly 2.0.0 + | FreeBSD | | OpenBSD 4.4 | + | 6.4 | | | | | | | | | FreeBSD 8 -current | NetBSD -current OpenBSD -current | | | | | | @@ -488,6 +489,7 @@ FreeBSD 7.0 2008-02-27 [FBD] OpenBSD 4.3 2008-05-01 [OBD] DragonFly 2.0.0 2008-07-21 [DFB] OpenBSD 4.4 2008-11-01 [OBD] +FreeBSD 6.4 2008-11-28 [FBD] Bibliography ------------------------ From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 20:08:48 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76D461065674; Fri, 28 Nov 2008 20:08:48 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F7AF8FC16; Fri, 28 Nov 2008 20:08:48 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASK8m8E028605; Fri, 28 Nov 2008 20:08:48 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASK8l6H028595; Fri, 28 Nov 2008 20:08:47 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200811282008.mASK8l6H028595@svn.freebsd.org> From: Tim Kientzle Date: Fri, 28 Nov 2008 20:08: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: r185408 - in stable/7/lib/libarchive: . test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 20:08:48 -0000 Author: kientzle Date: Fri Nov 28 20:08:47 2008 New Revision: 185408 URL: http://svn.freebsd.org/changeset/base/185408 Log: MFC 182590,182778,182779,184109: Support for certain archive_entry attributes to be explicitly "unset". This fixes a number of issues: * Zip archives with "length at end" can now be extracted correctly, since the Zip extractor can simply mark the size as "unknown." * Extract-to-disk can now accurately handle cases with partial time information (e.g., mtime is known but not atime) * We get more accurate handling of different hardlink extraction cases; sometimes a hardlink entry has definitive size information and sometimes not. Approved by: re Modified: stable/7/lib/libarchive/ (props changed) stable/7/lib/libarchive/archive_entry.c stable/7/lib/libarchive/archive_entry.h stable/7/lib/libarchive/archive_entry_private.h stable/7/lib/libarchive/archive_read_support_format_zip.c stable/7/lib/libarchive/archive_write_disk.c stable/7/lib/libarchive/test/test_entry.c stable/7/lib/libarchive/test/test_read_format_zip.c stable/7/lib/libarchive/test/test_read_format_zip.zip.uu stable/7/lib/libarchive/test/test_write_disk.c stable/7/lib/libarchive/test/test_write_disk_hardlink.c Modified: stable/7/lib/libarchive/archive_entry.c ============================================================================== --- stable/7/lib/libarchive/archive_entry.c Fri Nov 28 19:58:31 2008 (r185407) +++ stable/7/lib/libarchive/archive_entry.c Fri Nov 28 20:08:47 2008 (r185408) @@ -395,8 +395,7 @@ archive_entry_clone(struct archive_entry aes_copy(&entry2->ae_hardlink, &entry->ae_hardlink); aes_copy(&entry2->ae_pathname, &entry->ae_pathname); aes_copy(&entry2->ae_symlink, &entry->ae_symlink); - entry2->ae_hardlinkset = entry->ae_hardlinkset; - entry2->ae_symlinkset = entry->ae_symlinkset; + entry2->ae_set = entry->ae_set; aes_copy(&entry2->ae_uname, &entry->ae_uname); /* Copy ACL data over. */ @@ -455,12 +454,24 @@ archive_entry_atime_nsec(struct archive_ return (entry->ae_stat.aest_atime_nsec); } +int +archive_entry_atime_is_set(struct archive_entry *entry) +{ + return (entry->ae_set & AE_SET_ATIME); +} + time_t archive_entry_ctime(struct archive_entry *entry) { return (entry->ae_stat.aest_ctime); } +int +archive_entry_ctime_is_set(struct archive_entry *entry) +{ + return (entry->ae_set & AE_SET_CTIME); +} + long archive_entry_ctime_nsec(struct archive_entry *entry) { @@ -562,17 +573,17 @@ archive_entry_gname_w(struct archive_ent const char * archive_entry_hardlink(struct archive_entry *entry) { - if (!entry->ae_hardlinkset) - return (NULL); - return (aes_get_mbs(&entry->ae_hardlink)); + if (entry->ae_set & AE_SET_HARDLINK) + return (aes_get_mbs(&entry->ae_hardlink)); + return (NULL); } const wchar_t * archive_entry_hardlink_w(struct archive_entry *entry) { - if (!entry->ae_hardlinkset) - return (NULL); - return (aes_get_wcs(&entry->ae_hardlink)); + if (entry->ae_set & AE_SET_HARDLINK) + return (aes_get_wcs(&entry->ae_hardlink)); + return (NULL); } ino_t @@ -599,6 +610,12 @@ archive_entry_mtime_nsec(struct archive_ return (entry->ae_stat.aest_mtime_nsec); } +int +archive_entry_mtime_is_set(struct archive_entry *entry) +{ + return (entry->ae_set & AE_SET_MTIME); +} + unsigned int archive_entry_nlink(struct archive_entry *entry) { @@ -651,6 +668,12 @@ archive_entry_size(struct archive_entry return (entry->ae_stat.aest_size); } +int +archive_entry_size_is_set(struct archive_entry *entry) +{ + return (entry->ae_set & AE_SET_SIZE); +} + const char * archive_entry_sourcepath(struct archive_entry *entry) { @@ -660,17 +683,17 @@ archive_entry_sourcepath(struct archive_ const char * archive_entry_symlink(struct archive_entry *entry) { - if (!entry->ae_symlinkset) - return (NULL); - return (aes_get_mbs(&entry->ae_symlink)); + if (entry->ae_set & AE_SET_SYMLINK) + return (aes_get_mbs(&entry->ae_symlink)); + return (NULL); } const wchar_t * archive_entry_symlink_w(struct archive_entry *entry) { - if (!entry->ae_symlinkset) - return (NULL); - return (aes_get_wcs(&entry->ae_symlink)); + if (entry->ae_set & AE_SET_SYMLINK) + return (aes_get_wcs(&entry->ae_symlink)); + return (NULL); } uid_t @@ -773,7 +796,9 @@ archive_entry_set_hardlink(struct archiv { aes_set_mbs(&entry->ae_hardlink, target); if (target != NULL) - entry->ae_hardlinkset = 1; + entry->ae_set |= AE_SET_HARDLINK; + else + entry->ae_set &= ~AE_SET_HARDLINK; } void @@ -781,7 +806,9 @@ archive_entry_copy_hardlink(struct archi { aes_copy_mbs(&entry->ae_hardlink, target); if (target != NULL) - entry->ae_hardlinkset = 1; + entry->ae_set |= AE_SET_HARDLINK; + else + entry->ae_set &= ~AE_SET_HARDLINK; } void @@ -789,26 +816,44 @@ archive_entry_copy_hardlink_w(struct arc { aes_copy_wcs(&entry->ae_hardlink, target); if (target != NULL) - entry->ae_hardlinkset = 1; + entry->ae_set |= AE_SET_HARDLINK; + else + entry->ae_set &= ~AE_SET_HARDLINK; } void archive_entry_set_atime(struct archive_entry *entry, time_t t, long ns) { entry->stat_valid = 0; + entry->ae_set |= AE_SET_ATIME; entry->ae_stat.aest_atime = t; entry->ae_stat.aest_atime_nsec = ns; } void +archive_entry_unset_atime(struct archive_entry *entry) +{ + archive_entry_set_atime(entry, 0, 0); + entry->ae_set &= ~AE_SET_ATIME; +} + +void archive_entry_set_ctime(struct archive_entry *entry, time_t t, long ns) { entry->stat_valid = 0; + entry->ae_set |= AE_SET_CTIME; entry->ae_stat.aest_ctime = t; entry->ae_stat.aest_ctime_nsec = ns; } void +archive_entry_unset_ctime(struct archive_entry *entry) +{ + archive_entry_set_ctime(entry, 0, 0); + entry->ae_set &= ~AE_SET_CTIME; +} + +void archive_entry_set_dev(struct archive_entry *entry, dev_t d) { entry->stat_valid = 0; @@ -836,7 +881,7 @@ archive_entry_set_devminor(struct archiv void archive_entry_set_link(struct archive_entry *entry, const char *target) { - if (entry->ae_symlinkset) + if (entry->ae_set & AE_SET_SYMLINK) aes_set_mbs(&entry->ae_symlink, target); else aes_set_mbs(&entry->ae_hardlink, target); @@ -846,7 +891,7 @@ archive_entry_set_link(struct archive_en void archive_entry_copy_link(struct archive_entry *entry, const char *target) { - if (entry->ae_symlinkset) + if (entry->ae_set & AE_SET_SYMLINK) aes_copy_mbs(&entry->ae_symlink, target); else aes_copy_mbs(&entry->ae_hardlink, target); @@ -856,7 +901,7 @@ archive_entry_copy_link(struct archive_e void archive_entry_copy_link_w(struct archive_entry *entry, const wchar_t *target) { - if (entry->ae_symlinkset) + if (entry->ae_set & AE_SET_SYMLINK) aes_copy_wcs(&entry->ae_symlink, target); else aes_copy_wcs(&entry->ae_hardlink, target); @@ -865,7 +910,7 @@ archive_entry_copy_link_w(struct archive int archive_entry_update_link_utf8(struct archive_entry *entry, const char *target) { - if (entry->ae_symlinkset) + if (entry->ae_set & AE_SET_SYMLINK) return (aes_update_utf8(&entry->ae_symlink, target)); else return (aes_update_utf8(&entry->ae_hardlink, target)); @@ -882,11 +927,19 @@ void archive_entry_set_mtime(struct archive_entry *entry, time_t m, long ns) { entry->stat_valid = 0; + entry->ae_set |= AE_SET_MTIME; entry->ae_stat.aest_mtime = m; entry->ae_stat.aest_mtime_nsec = ns; } void +archive_entry_unset_mtime(struct archive_entry *entry) +{ + archive_entry_set_mtime(entry, 0, 0); + entry->ae_set &= ~AE_SET_MTIME; +} + +void archive_entry_set_nlink(struct archive_entry *entry, unsigned int nlink) { entry->stat_valid = 0; @@ -954,6 +1007,14 @@ archive_entry_set_size(struct archive_en { entry->stat_valid = 0; entry->ae_stat.aest_size = s; + entry->ae_set |= AE_SET_SIZE; +} + +void +archive_entry_unset_size(struct archive_entry *entry) +{ + archive_entry_set_size(entry, 0); + entry->ae_set &= ~AE_SET_SIZE; } void @@ -967,7 +1028,9 @@ archive_entry_set_symlink(struct archive { aes_set_mbs(&entry->ae_symlink, linkname); if (linkname != NULL) - entry->ae_symlinkset = 1; + entry->ae_set |= AE_SET_SYMLINK; + else + entry->ae_set &= ~AE_SET_SYMLINK; } void @@ -975,7 +1038,9 @@ archive_entry_copy_symlink(struct archiv { aes_copy_mbs(&entry->ae_symlink, linkname); if (linkname != NULL) - entry->ae_symlinkset = 1; + entry->ae_set |= AE_SET_SYMLINK; + else + entry->ae_set &= ~AE_SET_SYMLINK; } void @@ -983,7 +1048,9 @@ archive_entry_copy_symlink_w(struct arch { aes_copy_wcs(&entry->ae_symlink, linkname); if (linkname != NULL) - entry->ae_symlinkset = 1; + entry->ae_set |= AE_SET_SYMLINK; + else + entry->ae_set &= ~AE_SET_SYMLINK; } void Modified: stable/7/lib/libarchive/archive_entry.h ============================================================================== --- stable/7/lib/libarchive/archive_entry.h Fri Nov 28 19:58:31 2008 (r185407) +++ stable/7/lib/libarchive/archive_entry.h Fri Nov 28 20:08:47 2008 (r185408) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2003-2008 Tim Kientzle * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -152,12 +152,29 @@ __LA_DECL struct archive_entry *archive_ /* * Retrieve fields from an archive_entry. + * + * There are a number of implicit conversions among these fields. For + * example, if a regular string field is set and you read the _w wide + * character field, the entry will implicitly convert narrow-to-wide + * using the current locale. Similarly, dev values are automatically + * updated when you write devmajor or devminor and vice versa. + * + * In addition, fields can be "set" or "unset." Unset string fields + * return NULL, non-string fields have _is_set() functions to test + * whether they've been set. You can "unset" a string field by + * assigning NULL; non-string fields have _unset() functions to + * unset them. + * + * Note: There is one ambiguity in the above; string fields will + * also return NULL when implicit character set conversions fail. + * This is usually what you want. */ - __LA_DECL time_t archive_entry_atime(struct archive_entry *); __LA_DECL long archive_entry_atime_nsec(struct archive_entry *); +__LA_DECL int archive_entry_atime_is_set(struct archive_entry *); __LA_DECL time_t archive_entry_ctime(struct archive_entry *); __LA_DECL long archive_entry_ctime_nsec(struct archive_entry *); +__LA_DECL int archive_entry_ctime_is_set(struct archive_entry *); __LA_DECL dev_t archive_entry_dev(struct archive_entry *); __LA_DECL dev_t archive_entry_devmajor(struct archive_entry *); __LA_DECL dev_t archive_entry_devminor(struct archive_entry *); @@ -175,6 +192,7 @@ __LA_DECL __LA_INO_T archive_entry_ino( __LA_DECL __LA_MODE_T archive_entry_mode(struct archive_entry *); __LA_DECL time_t archive_entry_mtime(struct archive_entry *); __LA_DECL long archive_entry_mtime_nsec(struct archive_entry *); +__LA_DECL int archive_entry_mtime_is_set(struct archive_entry *); __LA_DECL unsigned int archive_entry_nlink(struct archive_entry *); __LA_DECL const char *archive_entry_pathname(struct archive_entry *); __LA_DECL const wchar_t *archive_entry_pathname_w(struct archive_entry *); @@ -183,6 +201,7 @@ __LA_DECL dev_t archive_entry_rdevmajo __LA_DECL dev_t archive_entry_rdevminor(struct archive_entry *); __LA_DECL const char *archive_entry_sourcepath(struct archive_entry *); __LA_DECL int64_t archive_entry_size(struct archive_entry *); +__LA_DECL int archive_entry_size_is_set(struct archive_entry *); __LA_DECL const char *archive_entry_strmode(struct archive_entry *); __LA_DECL const char *archive_entry_symlink(struct archive_entry *); __LA_DECL const wchar_t *archive_entry_symlink_w(struct archive_entry *); @@ -195,10 +214,16 @@ __LA_DECL const wchar_t *archive_entry_u * * Note that string 'set' functions do not copy the string, only the pointer. * In contrast, 'copy' functions do copy the object pointed to. + * + * Note: As of libarchive 2.4, 'set' functions do copy the string and + * are therefore exact synonyms for the 'copy' versions. The 'copy' + * names will be retired in libarchive 3.0. */ __LA_DECL void archive_entry_set_atime(struct archive_entry *, time_t, long); +__LA_DECL void archive_entry_unset_atime(struct archive_entry *); __LA_DECL void archive_entry_set_ctime(struct archive_entry *, time_t, long); +__LA_DECL void archive_entry_unset_ctime(struct archive_entry *); __LA_DECL void archive_entry_set_dev(struct archive_entry *, dev_t); __LA_DECL void archive_entry_set_devmajor(struct archive_entry *, dev_t); __LA_DECL void archive_entry_set_devminor(struct archive_entry *, dev_t); @@ -226,6 +251,7 @@ __LA_DECL void archive_entry_copy_link_w __LA_DECL int archive_entry_update_link_utf8(struct archive_entry *, const char *); __LA_DECL void archive_entry_set_mode(struct archive_entry *, __LA_MODE_T); __LA_DECL void archive_entry_set_mtime(struct archive_entry *, time_t, long); +__LA_DECL void archive_entry_unset_mtime(struct archive_entry *); __LA_DECL void archive_entry_set_nlink(struct archive_entry *, unsigned int); __LA_DECL void archive_entry_set_pathname(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_pathname(struct archive_entry *, const char *); @@ -236,6 +262,7 @@ __LA_DECL void archive_entry_set_rdev(st __LA_DECL void archive_entry_set_rdevmajor(struct archive_entry *, dev_t); __LA_DECL void archive_entry_set_rdevminor(struct archive_entry *, dev_t); __LA_DECL void archive_entry_set_size(struct archive_entry *, int64_t); +__LA_DECL void archive_entry_unset_size(struct archive_entry *); __LA_DECL void archive_entry_copy_sourcepath(struct archive_entry *, const char *); __LA_DECL void archive_entry_set_symlink(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_symlink(struct archive_entry *, const char *); @@ -257,6 +284,7 @@ __LA_DECL int archive_entry_update_uname __LA_DECL const struct stat *archive_entry_stat(struct archive_entry *); __LA_DECL void archive_entry_copy_stat(struct archive_entry *, const struct stat *); + /* * ACL routines. This used to simply store and return text-format ACL * strings, but that proved insufficient for a number of reasons: Modified: stable/7/lib/libarchive/archive_entry_private.h ============================================================================== --- stable/7/lib/libarchive/archive_entry_private.h Fri Nov 28 19:58:31 2008 (r185407) +++ stable/7/lib/libarchive/archive_entry_private.h Fri Nov 28 20:08:47 2008 (r185408) @@ -136,6 +136,14 @@ struct archive_entry { dev_t aest_rdevminor; } ae_stat; + int ae_set; /* bitmap of fields that are currently set */ +#define AE_SET_HARDLINK 1 +#define AE_SET_SYMLINK 2 +#define AE_SET_ATIME 4 +#define AE_SET_CTIME 8 +#define AE_SET_MTIME 16 +#define AE_SET_SIZE 64 + /* * Use aes here so that we get transparent mbs<->wcs conversions. */ @@ -147,8 +155,6 @@ struct archive_entry { struct aes ae_pathname; /* Name of entry */ struct aes ae_symlink; /* symlink contents */ struct aes ae_uname; /* Name of owner */ - unsigned char ae_hardlinkset; - unsigned char ae_symlinkset; /* Not used within libarchive; useful for some clients. */ struct aes ae_sourcepath; /* Path this entry is sourced from. */ Modified: stable/7/lib/libarchive/archive_read_support_format_zip.c ============================================================================== --- stable/7/lib/libarchive/archive_read_support_format_zip.c Fri Nov 28 19:58:31 2008 (r185407) +++ stable/7/lib/libarchive/archive_read_support_format_zip.c Fri Nov 28 20:08:47 2008 (r185408) @@ -444,7 +444,9 @@ zip_read_file_header(struct archive_read archive_entry_set_mtime(entry, zip->mtime, 0); archive_entry_set_ctime(entry, zip->ctime, 0); archive_entry_set_atime(entry, zip->atime, 0); - archive_entry_set_size(entry, zip->uncompressed_size); + /* Set the size only if it's meaningful. */ + if (0 == (zip->flags & ZIP_LENGTH_AT_END)) + archive_entry_set_size(entry, zip->uncompressed_size); zip->entry_bytes_remaining = zip->compressed_size; zip->entry_offset = 0; @@ -573,12 +575,16 @@ archive_read_format_zip_read_data(struct } break; } + if (r != ARCHIVE_OK) + return (r); /* Update checksum */ - if (r == ARCHIVE_OK && *size) { + if (*size) zip->entry_crc32 = crc32(zip->entry_crc32, *buff, *size); - } - return (r); + /* Return EOF immediately if this is a non-regular file. */ + if (AE_IFREG != (zip->mode & AE_IFMT)) + return (ARCHIVE_EOF); + return (ARCHIVE_OK); } /* Modified: stable/7/lib/libarchive/archive_write_disk.c ============================================================================== --- stable/7/lib/libarchive/archive_write_disk.c Fri Nov 28 19:58:31 2008 (r185407) +++ stable/7/lib/libarchive/archive_write_disk.c Fri Nov 28 20:08:47 2008 (r185408) @@ -176,7 +176,7 @@ struct archive_write_disk { int fd; /* Current offset for writing data to the file. */ off_t offset; - /* Maximum size of file. */ + /* Maximum size of file, -1 if unknown. */ off_t filesize; /* Dir we were in before this restore; only for deep paths. */ int restore_pwd; @@ -231,7 +231,8 @@ static int set_time(struct archive_write static struct fixup_entry *sort_dir_list(struct fixup_entry *p); static gid_t trivial_lookup_gid(void *, const char *, gid_t); static uid_t trivial_lookup_uid(void *, const char *, uid_t); - +static ssize_t write_data_block(struct archive_write_disk *, + const char *, size_t, off_t); static struct archive_vtable *archive_write_disk_vtable(void); @@ -337,7 +338,10 @@ _archive_write_header(struct archive *_a a->offset = 0; a->uid = a->user_uid; a->mode = archive_entry_mode(a->entry); - a->filesize = archive_entry_size(a->entry); + if (archive_entry_size_is_set(a->entry)) + a->filesize = archive_entry_size(a->entry); + else + a->filesize = -1; archive_strcpy(&(a->_name_data), archive_entry_pathname(a->entry)); a->name = a->_name_data.s; archive_clear_error(&a->archive); @@ -439,15 +443,25 @@ _archive_write_header(struct archive *_a fe->mode = a->mode; } - if (a->deferred & TODO_TIMES) { + if ((a->deferred & TODO_TIMES) + && (archive_entry_mtime_is_set(entry) + || archive_entry_atime_is_set(entry))) { fe = current_fixup(a, archive_entry_pathname(entry)); fe->fixup |= TODO_TIMES; - fe->mtime = archive_entry_mtime(entry); - fe->mtime_nanos = archive_entry_mtime_nsec(entry); - fe->atime = archive_entry_atime(entry); - fe->atime_nanos = archive_entry_atime_nsec(entry); - if (fe->atime == 0 && fe->atime_nanos == 0) + if (archive_entry_mtime_is_set(entry)) { + fe->mtime = archive_entry_mtime(entry); + fe->mtime_nanos = archive_entry_mtime_nsec(entry); + } else { + fe->mtime = a->start_time; + fe->mtime_nanos = 0; + } + if (archive_entry_atime_is_set(entry)) { + fe->atime = archive_entry_atime(entry); + fe->atime_nanos = archive_entry_atime_nsec(entry); + } else { fe->atime = a->start_time; + fe->atime_nanos = 0; + } } if (a->deferred & TODO_FFLAGS) { @@ -486,89 +500,113 @@ archive_write_disk_set_skip_file(struct } static ssize_t -_archive_write_data_block(struct archive *_a, - const void *buff, size_t size, off_t offset) +write_data_block(struct archive_write_disk *a, + const char *buff, size_t size, off_t offset) { - struct archive_write_disk *a = (struct archive_write_disk *)_a; ssize_t bytes_written = 0; - ssize_t block_size, bytes_to_write; - int r = ARCHIVE_OK; + ssize_t block_size = 0, bytes_to_write; + int r; - __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_DATA, "archive_write_disk_block"); - if (a->fd < 0) { - archive_set_error(&a->archive, 0, "File not open"); + if (a->filesize == 0 || a->fd < 0) { + archive_set_error(&a->archive, 0, + "Attempt to write to an empty file"); return (ARCHIVE_WARN); } - archive_clear_error(&a->archive); if (a->flags & ARCHIVE_EXTRACT_SPARSE) { if ((r = _archive_write_disk_lazy_stat(a)) != ARCHIVE_OK) return (r); block_size = a->pst->st_blksize; - } else - block_size = -1; - - if ((off_t)(offset + size) > a->filesize) { - size = (size_t)(a->filesize - a->offset); - archive_set_error(&a->archive, 0, - "Write request too large"); - r = ARCHIVE_WARN; } + if (a->filesize >= 0 && (off_t)(offset + size) > a->filesize) + size = (size_t)(a->filesize - offset); + /* Write the data. */ while (size > 0) { - if (block_size != -1) { - const char *buf; - - for (buf = buff; size; ++buf, --size, ++offset) { - if (*buf != '\0') + if (block_size == 0) { + bytes_to_write = size; + } else { + /* We're sparsifying the file. */ + const char *p, *end; + off_t block_end; + + /* Skip leading zero bytes. */ + for (p = buff, end = buff + size; p < end; ++p) { + if (*p != '\0') break; } + offset += p - buff; + size -= p - buff; + buff = p; if (size == 0) break; - bytes_to_write = block_size - offset % block_size; - buff = buf; - } else + + /* Calculate next block boundary after offset. */ + block_end + = (offset / block_size) * block_size + block_size; + + /* If the adjusted write would cross block boundary, + * truncate it to the block boundary. */ bytes_to_write = size; + if (offset + bytes_to_write > block_end) + bytes_to_write = block_end - offset; + } + /* Seek if necessary to the specified offset. */ if (offset != a->last_offset) { if (lseek(a->fd, offset, SEEK_SET) < 0) { - archive_set_error(&a->archive, errno, "Seek failed"); + archive_set_error(&a->archive, errno, + "Seek failed"); return (ARCHIVE_FATAL); } } - bytes_written = write(a->fd, buff, size); + bytes_written = write(a->fd, buff, bytes_to_write); if (bytes_written < 0) { archive_set_error(&a->archive, errno, "Write failed"); return (ARCHIVE_WARN); } - buff = (const char *)buff + bytes_written; + buff += bytes_written; size -= bytes_written; offset += bytes_written; a->archive.file_position += bytes_written; a->archive.raw_position += bytes_written; a->last_offset = a->offset = offset; } - a->offset = offset; - return (r); + return (bytes_written); +} + +static ssize_t +_archive_write_data_block(struct archive *_a, + const void *buff, size_t size, off_t offset) +{ + struct archive_write_disk *a = (struct archive_write_disk *)_a; + ssize_t r; + + __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_DATA, "archive_write_disk_block"); + + r = write_data_block(a, buff, size, offset); + + if (r < 0) + return (r); + if ((size_t)r < size) { + archive_set_error(&a->archive, 0, + "Write request too large"); + return (ARCHIVE_WARN); + } + return (ARCHIVE_OK); } static ssize_t _archive_write_data(struct archive *_a, const void *buff, size_t size) { struct archive_write_disk *a = (struct archive_write_disk *)_a; - int r; __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, ARCHIVE_STATE_DATA, "archive_write_data"); - if (a->fd < 0) - return (ARCHIVE_OK); - r = _archive_write_data_block(_a, buff, size, a->offset); - if (r < ARCHIVE_OK) - return (r); - return size; + return (write_data_block(a, buff, size, a->offset)); } static int @@ -584,7 +622,15 @@ _archive_write_finish_entry(struct archi return (ARCHIVE_OK); archive_clear_error(&a->archive); - if (a->last_offset != a->filesize && a->fd >= 0) { + /* Pad or truncate file to the right size. */ + if (a->fd < 0) { + /* There's no file. */ + } else if (a->filesize < 0) { + /* File size is unknown, so we can't set the size. */ + } else if (a->last_offset == a->filesize) { + /* Last write ended at exactly the filesize; we're done. */ + /* Hopefully, this is the common case. */ + } else { if (ftruncate(a->fd, a->filesize) == -1 && a->filesize == 0) { archive_set_error(&a->archive, errno, @@ -601,7 +647,8 @@ _archive_write_finish_entry(struct archi if (a->st.st_size != a->filesize) { const char nul = '\0'; if (lseek(a->fd, a->st.st_size - 1, SEEK_SET) < 0) { - archive_set_error(&a->archive, errno, "Seek failed"); + archive_set_error(&a->archive, errno, + "Seek failed"); return (ARCHIVE_FATAL); } if (write(a->fd, &nul, 1) < 0) { @@ -609,6 +656,7 @@ _archive_write_finish_entry(struct archi "Write to restore size failed"); return (ARCHIVE_FATAL); } + a->pst = NULL; } } @@ -975,7 +1023,7 @@ create_filesystem_object(struct archive_ * If the hardlink does carry data, let the last * archive entry decide ownership. */ - if (r == 0 && a->filesize == 0) { + if (r == 0 && a->filesize <= 0) { a->todo = 0; a->deferred = 0; } if (r == 0 && a->filesize > 0) { @@ -1635,18 +1683,31 @@ set_time(struct archive_write_disk *a) { struct timeval times[2]; - times[1].tv_sec = archive_entry_mtime(a->entry); - times[1].tv_usec = archive_entry_mtime_nsec(a->entry) / 1000; + /* If no time was provided, we're done. */ + if (!archive_entry_atime_is_set(a->entry) + && !archive_entry_mtime_is_set(a->entry)) + return (ARCHIVE_OK); - times[0].tv_sec = archive_entry_atime(a->entry); - times[0].tv_usec = archive_entry_atime_nsec(a->entry) / 1000; + /* We know at least one is set, so... */ + if (archive_entry_mtime_is_set(a->entry)) { + times[1].tv_sec = archive_entry_mtime(a->entry); + times[1].tv_usec = archive_entry_mtime_nsec(a->entry) / 1000; + } else { + times[1].tv_sec = a->start_time; + times[1].tv_usec = 0; + } /* If no atime was specified, use start time instead. */ /* In theory, it would be marginally more correct to use * time(NULL) here, but that would cost us an extra syscall * for little gain. */ - if (times[0].tv_sec == 0 && times[0].tv_usec == 0) + if (archive_entry_atime_is_set(a->entry)) { + times[0].tv_sec = archive_entry_atime(a->entry); + times[0].tv_usec = archive_entry_atime_nsec(a->entry) / 1000; + } else { times[0].tv_sec = a->start_time; + times[0].tv_usec = 0; + } #ifdef HAVE_FUTIMES if (a->fd >= 0 && futimes(a->fd, times) == 0) { @@ -1684,10 +1745,24 @@ set_time(struct archive_write_disk *a) { struct utimbuf times; - times.modtime = archive_entry_mtime(a->entry); - times.actime = archive_entry_atime(a->entry); - if (times.actime == 0) + /* If no time was provided, we're done. */ + if (!archive_entry_atime_is_set(a->entry) + && !archive_entry_mtime_is_set(a->entry)) + return (ARCHIVE_OK); + + /* We know at least one is set, so... */ + /* Set mtime from mtime if set, else start time. */ + if (archive_entry_mtime_is_set(a->entry)) + times.modtime = archive_entry_mtime(a->entry); + else + times.modtime = a->start_time; + + /* Set atime from provided atime, else mtime. */ + if (archive_entry_atime_is_set(a->entry)) + times.actime = archive_entry_atime(a->entry); + else times.actime = a->start_time; + if (!S_ISLNK(a->mode) && utime(a->name, ×) != 0) { archive_set_error(&a->archive, errno, "Can't update time for %s", a->name); Modified: stable/7/lib/libarchive/test/test_entry.c ============================================================================== --- stable/7/lib/libarchive/test/test_entry.c Fri Nov 28 19:58:31 2008 (r185407) +++ stable/7/lib/libarchive/test/test_entry.c Fri Nov 28 20:08:47 2008 (r185408) @@ -69,14 +69,25 @@ DEFINE_TEST(test_entry) * The following tests are ordered alphabetically by the * name of the field. */ + /* atime */ archive_entry_set_atime(e, 13579, 24680); assertEqualInt(archive_entry_atime(e), 13579); assertEqualInt(archive_entry_atime_nsec(e), 24680); + archive_entry_unset_atime(e); + assertEqualInt(archive_entry_atime(e), 0); + assertEqualInt(archive_entry_atime_nsec(e), 0); + assert(!archive_entry_atime_is_set(e)); + /* ctime */ archive_entry_set_ctime(e, 13580, 24681); assertEqualInt(archive_entry_ctime(e), 13580); assertEqualInt(archive_entry_ctime_nsec(e), 24681); + archive_entry_unset_ctime(e); + assertEqualInt(archive_entry_ctime(e), 0); + assertEqualInt(archive_entry_ctime_nsec(e), 0); + assert(!archive_entry_ctime_is_set(e)); + #if ARCHIVE_VERSION_STAMP >= 1009000 /* dev */ archive_entry_set_dev(e, 235); @@ -85,6 +96,7 @@ DEFINE_TEST(test_entry) skipping("archive_entry_dev()"); #endif /* devmajor/devminor are tested specially below. */ + #if ARCHIVE_VERSION_STAMP >= 1009000 /* filetype */ archive_entry_set_filetype(e, AE_IFREG); @@ -92,10 +104,13 @@ DEFINE_TEST(test_entry) #else skipping("archive_entry_filetype()"); #endif + /* fflags are tested specially below */ + /* gid */ archive_entry_set_gid(e, 204); assertEqualInt(archive_entry_gid(e), 204); + /* gname */ archive_entry_set_gname(e, "group"); assertEqualString(archive_entry_gname(e), "group"); @@ -104,6 +119,7 @@ DEFINE_TEST(test_entry) assertEqualWString(archive_entry_gname_w(e), L"wgroup"); memset(wbuff, 0, sizeof(wbuff)); assertEqualWString(archive_entry_gname_w(e), L"wgroup"); + /* hardlink */ archive_entry_set_hardlink(e, "hardlinkname"); assertEqualString(archive_entry_hardlink(e), "hardlinkname"); @@ -158,10 +174,16 @@ DEFINE_TEST(test_entry) /* mode */ archive_entry_set_mode(e, 0123456); assertEqualInt(archive_entry_mode(e), 0123456); + /* mtime */ archive_entry_set_mtime(e, 13581, 24682); assertEqualInt(archive_entry_mtime(e), 13581); assertEqualInt(archive_entry_mtime_nsec(e), 24682); + archive_entry_unset_mtime(e); + assertEqualInt(archive_entry_mtime(e), 0); + assertEqualInt(archive_entry_mtime_nsec(e), 0); + assert(!archive_entry_mtime_is_set(e)); + #if ARCHIVE_VERSION_STAMP >= 1009000 /* nlink */ archive_entry_set_nlink(e, 736); @@ -169,6 +191,7 @@ DEFINE_TEST(test_entry) #else skipping("archive_entry_nlink()"); #endif + /* pathname */ archive_entry_set_pathname(e, "path"); assertEqualString(archive_entry_pathname(e), "path"); @@ -184,6 +207,7 @@ DEFINE_TEST(test_entry) assertEqualWString(archive_entry_pathname_w(e), L"wpath"); memset(wbuff, 0, sizeof(wbuff)); assertEqualWString(archive_entry_pathname_w(e), L"wpath"); + #if ARCHIVE_VERSION_STAMP >= 1009000 /* rdev */ archive_entry_set_rdev(e, 532); @@ -192,9 +216,14 @@ DEFINE_TEST(test_entry) skipping("archive_entry_rdev()"); #endif /* rdevmajor/rdevminor are tested specially below. */ + /* size */ archive_entry_set_size(e, 987654321); assertEqualInt(archive_entry_size(e), 987654321); + archive_entry_unset_size(e); + assertEqualInt(archive_entry_size(e), 0); + assert(!archive_entry_size_is_set(e)); + /* symlink */ archive_entry_set_symlink(e, "symlinkname"); assertEqualString(archive_entry_symlink(e), "symlinkname"); @@ -207,9 +236,11 @@ DEFINE_TEST(test_entry) #endif archive_entry_copy_symlink_w(e, L"wsymlink"); assertEqualWString(archive_entry_symlink_w(e), L"wsymlink"); + /* uid */ archive_entry_set_uid(e, 83); assertEqualInt(archive_entry_uid(e), 83); + /* uname */ archive_entry_set_uname(e, "user"); assertEqualString(archive_entry_uname(e), "user"); Modified: stable/7/lib/libarchive/test/test_read_format_zip.c ============================================================================== --- stable/7/lib/libarchive/test/test_read_format_zip.c Fri Nov 28 19:58:31 2008 (r185407) +++ stable/7/lib/libarchive/test/test_read_format_zip.c Fri Nov 28 20:08:47 2008 (r185408) @@ -25,6 +25,12 @@ #include "test.h" __FBSDID("$FreeBSD$"); +/* + * The reference file for this has been manually tweaked so that: + * * file2 has length-at-end but file1 does not + * * file2 has an invalid CRC + */ + DEFINE_TEST(test_read_format_zip) { const char *refname = "test_read_format_zip.zip"; @@ -57,7 +63,8 @@ DEFINE_TEST(test_read_format_zip) assertA(0 == archive_read_next_header(a, &ae)); assertEqualString("file2", archive_entry_pathname(ae)); assertEqualInt(1179605932, archive_entry_mtime(ae)); - assertEqualInt(18, archive_entry_size(ae)); + failure("file2 has length-at-end, so we shouldn't see a valid size"); + assertEqualInt(0, archive_entry_size_is_set(ae)); failure("file2 has a bad CRC, so reading to end should fail"); assertEqualInt(ARCHIVE_WARN, archive_read_data(a, buff, 19)); assert(0 == memcmp(buff, "hello\nhello\nhello\n", 18)); Modified: stable/7/lib/libarchive/test/test_read_format_zip.zip.uu ============================================================================== --- stable/7/lib/libarchive/test/test_read_format_zip.zip.uu Fri Nov 28 19:58:31 2008 (r185407) +++ stable/7/lib/libarchive/test/test_read_format_zip.zip.uu Fri Nov 28 20:08:47 2008 (r185408) @@ -1,13 +1,14 @@ $FreeBSD$ begin 644 test_read_format_zip.zip -M4$L#!`H``````%EFLS8````````````````$`!4`9&ER+U54"0`#&55/1AE5 -M3T95>`0`Z`/H`U!+`P04````"`!O9K,V.C=F/0H````2````!0`5`&9I;&4Q -M550)``-!54]&K%M/1E5X!`#H`^@#RTC-R%8T$@H````2````!0`5`&9I;&4R550)``.L6T]&K%M/1E5X!`#H`^@#RTC- -MR%8T$@H````2````!0`-```````!````I(%Y```` -H9FEL93)55`4``ZQ;3T95>```4$L%!@`````#``,`OP```+L````````` +M4$L#!`H`"````%EFLS8````````````````$`!4`9&ER+U54"0`#&55/1M19 +M_4A5>`0`Z`/H`U!+!P@```````````````!02P,$%`````@`;V:S-CHW9CT* +M````$@````4`%0!F:6QE,554"0`#055/1L!9_4A5>`0`Z`/H`\M(S`0`Z`/H`\M(S```4$L!`A<#%``(``@`;V:S-CHW9CT*````$@````4`#0`` +M`````0```.V!1P```&9I;&4Q550%``-!54]&57@``%!+`0(7`Q0`"``(`%IJ +MLS8Z-V8]"@```!(````%``T```````$```#M@8D```!F:6QE,E54!0`#K%M/ +;1E5X``!02P4&``````,``P"_````VP`````` ` end Modified: stable/7/lib/libarchive/test/test_write_disk.c ============================================================================== --- stable/7/lib/libarchive/test/test_write_disk.c Fri Nov 28 19:58:31 2008 (r185407) +++ stable/7/lib/libarchive/test/test_write_disk.c Fri Nov 28 20:08:47 2008 (r185408) @@ -84,7 +84,7 @@ static void create_reg_file(struct archi * the entry being a maximum size. */ archive_entry_set_size(ae, sizeof(data)); - archive_entry_set_mtime(ae, 123456789, 0); + archive_entry_set_mtime(ae, 123456789, 0); assertEqualIntA(ad, 0, archive_write_header(ad, ae)); assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data))); assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); @@ -152,6 +152,61 @@ static void create_reg_file2(struct arch free(compare); free(data); } + +static void create_reg_file3(struct archive_entry *ae, const char *msg) +{ + static const char data[]="abcdefghijklmnopqrstuvwxyz"; + struct archive *ad; + struct stat st; + + /* Write the entry to disk. */ + assert((ad = archive_write_disk_new()) != NULL); + failure("%s", msg); + /* Set the size smaller than the data and verify the truncation. */ + archive_entry_set_size(ae, 5); + assertEqualIntA(ad, 0, archive_write_header(ad, ae)); + assertEqualInt(5, archive_write_data(ad, data, sizeof(data))); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); +#if ARCHIVE_VERSION_NUMBER < 2000000 + archive_write_finish(ad); +#else + assertEqualInt(0, archive_write_finish(ad)); +#endif + /* Test the entry on disk. */ + assert(0 == stat(archive_entry_pathname(ae), &st)); + failure("st.st_mode=%o archive_entry_mode(ae)=%o", + st.st_mode, archive_entry_mode(ae)); + assertEqualInt(st.st_mode, (archive_entry_mode(ae) & ~UMASK)); + assertEqualInt(st.st_size, 5); +} + + +static void create_reg_file4(struct archive_entry *ae, const char *msg) +{ + static const char data[]="abcdefghijklmnopqrstuvwxyz"; + struct archive *ad; + struct stat st; + + /* Write the entry to disk. */ + assert((ad = archive_write_disk_new()) != NULL); + /* Leave the size unset. The data should not be truncated. */ + assertEqualIntA(ad, 0, archive_write_header(ad, ae)); + assertEqualInt(ARCHIVE_OK, + archive_write_data_block(ad, data, sizeof(data), 0)); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); +#if ARCHIVE_VERSION_NUMBER < 2000000 + archive_write_finish(ad); +#else + assertEqualInt(0, archive_write_finish(ad)); +#endif + /* Test the entry on disk. */ + assert(0 == stat(archive_entry_pathname(ae), &st)); + failure("st.st_mode=%o archive_entry_mode(ae)=%o", + st.st_mode, archive_entry_mode(ae)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 20:09:49 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 868321065673; Fri, 28 Nov 2008 20:09:49 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FED78FC0C; Fri, 28 Nov 2008 20:09:49 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASK9n71028665; Fri, 28 Nov 2008 20:09:49 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASK9nUL028655; Fri, 28 Nov 2008 20:09:49 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200811282009.mASK9nUL028655@svn.freebsd.org> From: Tim Kientzle Date: Fri, 28 Nov 2008 20:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185409 - in releng/7.1/lib/libarchive: . test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 20:09:49 -0000 Author: kientzle Date: Fri Nov 28 20:09:48 2008 New Revision: 185409 URL: http://svn.freebsd.org/changeset/base/185409 Log: MFC 182590,182778,182779,184109: Support for certain archive_entry attributes to be explicitly "unset". This fixes a number of issues: * Zip archives with "length at end" can now be extracted correctly, since the Zip extractor can simply mark the size as "unknown." * Extract-to-disk can now accurately handle cases with partial time information (e.g., mtime is known but not atime) * We get more accurate handling of different hardlink extraction cases; sometimes a hardlink entry has definitive size information and sometimes not. Approved by: re Modified: releng/7.1/lib/libarchive/ (props changed) releng/7.1/lib/libarchive/archive_entry.c releng/7.1/lib/libarchive/archive_entry.h releng/7.1/lib/libarchive/archive_entry_private.h releng/7.1/lib/libarchive/archive_read_support_format_zip.c releng/7.1/lib/libarchive/archive_write_disk.c releng/7.1/lib/libarchive/test/test_entry.c releng/7.1/lib/libarchive/test/test_read_format_zip.c releng/7.1/lib/libarchive/test/test_read_format_zip.zip.uu releng/7.1/lib/libarchive/test/test_write_disk.c releng/7.1/lib/libarchive/test/test_write_disk_hardlink.c Modified: releng/7.1/lib/libarchive/archive_entry.c ============================================================================== --- releng/7.1/lib/libarchive/archive_entry.c Fri Nov 28 20:08:47 2008 (r185408) +++ releng/7.1/lib/libarchive/archive_entry.c Fri Nov 28 20:09:48 2008 (r185409) @@ -395,8 +395,7 @@ archive_entry_clone(struct archive_entry aes_copy(&entry2->ae_hardlink, &entry->ae_hardlink); aes_copy(&entry2->ae_pathname, &entry->ae_pathname); aes_copy(&entry2->ae_symlink, &entry->ae_symlink); - entry2->ae_hardlinkset = entry->ae_hardlinkset; - entry2->ae_symlinkset = entry->ae_symlinkset; + entry2->ae_set = entry->ae_set; aes_copy(&entry2->ae_uname, &entry->ae_uname); /* Copy ACL data over. */ @@ -455,12 +454,24 @@ archive_entry_atime_nsec(struct archive_ return (entry->ae_stat.aest_atime_nsec); } +int +archive_entry_atime_is_set(struct archive_entry *entry) +{ + return (entry->ae_set & AE_SET_ATIME); +} + time_t archive_entry_ctime(struct archive_entry *entry) { return (entry->ae_stat.aest_ctime); } +int +archive_entry_ctime_is_set(struct archive_entry *entry) +{ + return (entry->ae_set & AE_SET_CTIME); +} + long archive_entry_ctime_nsec(struct archive_entry *entry) { @@ -562,17 +573,17 @@ archive_entry_gname_w(struct archive_ent const char * archive_entry_hardlink(struct archive_entry *entry) { - if (!entry->ae_hardlinkset) - return (NULL); - return (aes_get_mbs(&entry->ae_hardlink)); + if (entry->ae_set & AE_SET_HARDLINK) + return (aes_get_mbs(&entry->ae_hardlink)); + return (NULL); } const wchar_t * archive_entry_hardlink_w(struct archive_entry *entry) { - if (!entry->ae_hardlinkset) - return (NULL); - return (aes_get_wcs(&entry->ae_hardlink)); + if (entry->ae_set & AE_SET_HARDLINK) + return (aes_get_wcs(&entry->ae_hardlink)); + return (NULL); } ino_t @@ -599,6 +610,12 @@ archive_entry_mtime_nsec(struct archive_ return (entry->ae_stat.aest_mtime_nsec); } +int +archive_entry_mtime_is_set(struct archive_entry *entry) +{ + return (entry->ae_set & AE_SET_MTIME); +} + unsigned int archive_entry_nlink(struct archive_entry *entry) { @@ -651,6 +668,12 @@ archive_entry_size(struct archive_entry return (entry->ae_stat.aest_size); } +int +archive_entry_size_is_set(struct archive_entry *entry) +{ + return (entry->ae_set & AE_SET_SIZE); +} + const char * archive_entry_sourcepath(struct archive_entry *entry) { @@ -660,17 +683,17 @@ archive_entry_sourcepath(struct archive_ const char * archive_entry_symlink(struct archive_entry *entry) { - if (!entry->ae_symlinkset) - return (NULL); - return (aes_get_mbs(&entry->ae_symlink)); + if (entry->ae_set & AE_SET_SYMLINK) + return (aes_get_mbs(&entry->ae_symlink)); + return (NULL); } const wchar_t * archive_entry_symlink_w(struct archive_entry *entry) { - if (!entry->ae_symlinkset) - return (NULL); - return (aes_get_wcs(&entry->ae_symlink)); + if (entry->ae_set & AE_SET_SYMLINK) + return (aes_get_wcs(&entry->ae_symlink)); + return (NULL); } uid_t @@ -773,7 +796,9 @@ archive_entry_set_hardlink(struct archiv { aes_set_mbs(&entry->ae_hardlink, target); if (target != NULL) - entry->ae_hardlinkset = 1; + entry->ae_set |= AE_SET_HARDLINK; + else + entry->ae_set &= ~AE_SET_HARDLINK; } void @@ -781,7 +806,9 @@ archive_entry_copy_hardlink(struct archi { aes_copy_mbs(&entry->ae_hardlink, target); if (target != NULL) - entry->ae_hardlinkset = 1; + entry->ae_set |= AE_SET_HARDLINK; + else + entry->ae_set &= ~AE_SET_HARDLINK; } void @@ -789,26 +816,44 @@ archive_entry_copy_hardlink_w(struct arc { aes_copy_wcs(&entry->ae_hardlink, target); if (target != NULL) - entry->ae_hardlinkset = 1; + entry->ae_set |= AE_SET_HARDLINK; + else + entry->ae_set &= ~AE_SET_HARDLINK; } void archive_entry_set_atime(struct archive_entry *entry, time_t t, long ns) { entry->stat_valid = 0; + entry->ae_set |= AE_SET_ATIME; entry->ae_stat.aest_atime = t; entry->ae_stat.aest_atime_nsec = ns; } void +archive_entry_unset_atime(struct archive_entry *entry) +{ + archive_entry_set_atime(entry, 0, 0); + entry->ae_set &= ~AE_SET_ATIME; +} + +void archive_entry_set_ctime(struct archive_entry *entry, time_t t, long ns) { entry->stat_valid = 0; + entry->ae_set |= AE_SET_CTIME; entry->ae_stat.aest_ctime = t; entry->ae_stat.aest_ctime_nsec = ns; } void +archive_entry_unset_ctime(struct archive_entry *entry) +{ + archive_entry_set_ctime(entry, 0, 0); + entry->ae_set &= ~AE_SET_CTIME; +} + +void archive_entry_set_dev(struct archive_entry *entry, dev_t d) { entry->stat_valid = 0; @@ -836,7 +881,7 @@ archive_entry_set_devminor(struct archiv void archive_entry_set_link(struct archive_entry *entry, const char *target) { - if (entry->ae_symlinkset) + if (entry->ae_set & AE_SET_SYMLINK) aes_set_mbs(&entry->ae_symlink, target); else aes_set_mbs(&entry->ae_hardlink, target); @@ -846,7 +891,7 @@ archive_entry_set_link(struct archive_en void archive_entry_copy_link(struct archive_entry *entry, const char *target) { - if (entry->ae_symlinkset) + if (entry->ae_set & AE_SET_SYMLINK) aes_copy_mbs(&entry->ae_symlink, target); else aes_copy_mbs(&entry->ae_hardlink, target); @@ -856,7 +901,7 @@ archive_entry_copy_link(struct archive_e void archive_entry_copy_link_w(struct archive_entry *entry, const wchar_t *target) { - if (entry->ae_symlinkset) + if (entry->ae_set & AE_SET_SYMLINK) aes_copy_wcs(&entry->ae_symlink, target); else aes_copy_wcs(&entry->ae_hardlink, target); @@ -865,7 +910,7 @@ archive_entry_copy_link_w(struct archive int archive_entry_update_link_utf8(struct archive_entry *entry, const char *target) { - if (entry->ae_symlinkset) + if (entry->ae_set & AE_SET_SYMLINK) return (aes_update_utf8(&entry->ae_symlink, target)); else return (aes_update_utf8(&entry->ae_hardlink, target)); @@ -882,11 +927,19 @@ void archive_entry_set_mtime(struct archive_entry *entry, time_t m, long ns) { entry->stat_valid = 0; + entry->ae_set |= AE_SET_MTIME; entry->ae_stat.aest_mtime = m; entry->ae_stat.aest_mtime_nsec = ns; } void +archive_entry_unset_mtime(struct archive_entry *entry) +{ + archive_entry_set_mtime(entry, 0, 0); + entry->ae_set &= ~AE_SET_MTIME; +} + +void archive_entry_set_nlink(struct archive_entry *entry, unsigned int nlink) { entry->stat_valid = 0; @@ -954,6 +1007,14 @@ archive_entry_set_size(struct archive_en { entry->stat_valid = 0; entry->ae_stat.aest_size = s; + entry->ae_set |= AE_SET_SIZE; +} + +void +archive_entry_unset_size(struct archive_entry *entry) +{ + archive_entry_set_size(entry, 0); + entry->ae_set &= ~AE_SET_SIZE; } void @@ -967,7 +1028,9 @@ archive_entry_set_symlink(struct archive { aes_set_mbs(&entry->ae_symlink, linkname); if (linkname != NULL) - entry->ae_symlinkset = 1; + entry->ae_set |= AE_SET_SYMLINK; + else + entry->ae_set &= ~AE_SET_SYMLINK; } void @@ -975,7 +1038,9 @@ archive_entry_copy_symlink(struct archiv { aes_copy_mbs(&entry->ae_symlink, linkname); if (linkname != NULL) - entry->ae_symlinkset = 1; + entry->ae_set |= AE_SET_SYMLINK; + else + entry->ae_set &= ~AE_SET_SYMLINK; } void @@ -983,7 +1048,9 @@ archive_entry_copy_symlink_w(struct arch { aes_copy_wcs(&entry->ae_symlink, linkname); if (linkname != NULL) - entry->ae_symlinkset = 1; + entry->ae_set |= AE_SET_SYMLINK; + else + entry->ae_set &= ~AE_SET_SYMLINK; } void Modified: releng/7.1/lib/libarchive/archive_entry.h ============================================================================== --- releng/7.1/lib/libarchive/archive_entry.h Fri Nov 28 20:08:47 2008 (r185408) +++ releng/7.1/lib/libarchive/archive_entry.h Fri Nov 28 20:09:48 2008 (r185409) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2003-2008 Tim Kientzle * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -152,12 +152,29 @@ __LA_DECL struct archive_entry *archive_ /* * Retrieve fields from an archive_entry. + * + * There are a number of implicit conversions among these fields. For + * example, if a regular string field is set and you read the _w wide + * character field, the entry will implicitly convert narrow-to-wide + * using the current locale. Similarly, dev values are automatically + * updated when you write devmajor or devminor and vice versa. + * + * In addition, fields can be "set" or "unset." Unset string fields + * return NULL, non-string fields have _is_set() functions to test + * whether they've been set. You can "unset" a string field by + * assigning NULL; non-string fields have _unset() functions to + * unset them. + * + * Note: There is one ambiguity in the above; string fields will + * also return NULL when implicit character set conversions fail. + * This is usually what you want. */ - __LA_DECL time_t archive_entry_atime(struct archive_entry *); __LA_DECL long archive_entry_atime_nsec(struct archive_entry *); +__LA_DECL int archive_entry_atime_is_set(struct archive_entry *); __LA_DECL time_t archive_entry_ctime(struct archive_entry *); __LA_DECL long archive_entry_ctime_nsec(struct archive_entry *); +__LA_DECL int archive_entry_ctime_is_set(struct archive_entry *); __LA_DECL dev_t archive_entry_dev(struct archive_entry *); __LA_DECL dev_t archive_entry_devmajor(struct archive_entry *); __LA_DECL dev_t archive_entry_devminor(struct archive_entry *); @@ -175,6 +192,7 @@ __LA_DECL __LA_INO_T archive_entry_ino( __LA_DECL __LA_MODE_T archive_entry_mode(struct archive_entry *); __LA_DECL time_t archive_entry_mtime(struct archive_entry *); __LA_DECL long archive_entry_mtime_nsec(struct archive_entry *); +__LA_DECL int archive_entry_mtime_is_set(struct archive_entry *); __LA_DECL unsigned int archive_entry_nlink(struct archive_entry *); __LA_DECL const char *archive_entry_pathname(struct archive_entry *); __LA_DECL const wchar_t *archive_entry_pathname_w(struct archive_entry *); @@ -183,6 +201,7 @@ __LA_DECL dev_t archive_entry_rdevmajo __LA_DECL dev_t archive_entry_rdevminor(struct archive_entry *); __LA_DECL const char *archive_entry_sourcepath(struct archive_entry *); __LA_DECL int64_t archive_entry_size(struct archive_entry *); +__LA_DECL int archive_entry_size_is_set(struct archive_entry *); __LA_DECL const char *archive_entry_strmode(struct archive_entry *); __LA_DECL const char *archive_entry_symlink(struct archive_entry *); __LA_DECL const wchar_t *archive_entry_symlink_w(struct archive_entry *); @@ -195,10 +214,16 @@ __LA_DECL const wchar_t *archive_entry_u * * Note that string 'set' functions do not copy the string, only the pointer. * In contrast, 'copy' functions do copy the object pointed to. + * + * Note: As of libarchive 2.4, 'set' functions do copy the string and + * are therefore exact synonyms for the 'copy' versions. The 'copy' + * names will be retired in libarchive 3.0. */ __LA_DECL void archive_entry_set_atime(struct archive_entry *, time_t, long); +__LA_DECL void archive_entry_unset_atime(struct archive_entry *); __LA_DECL void archive_entry_set_ctime(struct archive_entry *, time_t, long); +__LA_DECL void archive_entry_unset_ctime(struct archive_entry *); __LA_DECL void archive_entry_set_dev(struct archive_entry *, dev_t); __LA_DECL void archive_entry_set_devmajor(struct archive_entry *, dev_t); __LA_DECL void archive_entry_set_devminor(struct archive_entry *, dev_t); @@ -226,6 +251,7 @@ __LA_DECL void archive_entry_copy_link_w __LA_DECL int archive_entry_update_link_utf8(struct archive_entry *, const char *); __LA_DECL void archive_entry_set_mode(struct archive_entry *, __LA_MODE_T); __LA_DECL void archive_entry_set_mtime(struct archive_entry *, time_t, long); +__LA_DECL void archive_entry_unset_mtime(struct archive_entry *); __LA_DECL void archive_entry_set_nlink(struct archive_entry *, unsigned int); __LA_DECL void archive_entry_set_pathname(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_pathname(struct archive_entry *, const char *); @@ -236,6 +262,7 @@ __LA_DECL void archive_entry_set_rdev(st __LA_DECL void archive_entry_set_rdevmajor(struct archive_entry *, dev_t); __LA_DECL void archive_entry_set_rdevminor(struct archive_entry *, dev_t); __LA_DECL void archive_entry_set_size(struct archive_entry *, int64_t); +__LA_DECL void archive_entry_unset_size(struct archive_entry *); __LA_DECL void archive_entry_copy_sourcepath(struct archive_entry *, const char *); __LA_DECL void archive_entry_set_symlink(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_symlink(struct archive_entry *, const char *); @@ -257,6 +284,7 @@ __LA_DECL int archive_entry_update_uname __LA_DECL const struct stat *archive_entry_stat(struct archive_entry *); __LA_DECL void archive_entry_copy_stat(struct archive_entry *, const struct stat *); + /* * ACL routines. This used to simply store and return text-format ACL * strings, but that proved insufficient for a number of reasons: Modified: releng/7.1/lib/libarchive/archive_entry_private.h ============================================================================== --- releng/7.1/lib/libarchive/archive_entry_private.h Fri Nov 28 20:08:47 2008 (r185408) +++ releng/7.1/lib/libarchive/archive_entry_private.h Fri Nov 28 20:09:48 2008 (r185409) @@ -136,6 +136,14 @@ struct archive_entry { dev_t aest_rdevminor; } ae_stat; + int ae_set; /* bitmap of fields that are currently set */ +#define AE_SET_HARDLINK 1 +#define AE_SET_SYMLINK 2 +#define AE_SET_ATIME 4 +#define AE_SET_CTIME 8 +#define AE_SET_MTIME 16 +#define AE_SET_SIZE 64 + /* * Use aes here so that we get transparent mbs<->wcs conversions. */ @@ -147,8 +155,6 @@ struct archive_entry { struct aes ae_pathname; /* Name of entry */ struct aes ae_symlink; /* symlink contents */ struct aes ae_uname; /* Name of owner */ - unsigned char ae_hardlinkset; - unsigned char ae_symlinkset; /* Not used within libarchive; useful for some clients. */ struct aes ae_sourcepath; /* Path this entry is sourced from. */ Modified: releng/7.1/lib/libarchive/archive_read_support_format_zip.c ============================================================================== --- releng/7.1/lib/libarchive/archive_read_support_format_zip.c Fri Nov 28 20:08:47 2008 (r185408) +++ releng/7.1/lib/libarchive/archive_read_support_format_zip.c Fri Nov 28 20:09:48 2008 (r185409) @@ -444,7 +444,9 @@ zip_read_file_header(struct archive_read archive_entry_set_mtime(entry, zip->mtime, 0); archive_entry_set_ctime(entry, zip->ctime, 0); archive_entry_set_atime(entry, zip->atime, 0); - archive_entry_set_size(entry, zip->uncompressed_size); + /* Set the size only if it's meaningful. */ + if (0 == (zip->flags & ZIP_LENGTH_AT_END)) + archive_entry_set_size(entry, zip->uncompressed_size); zip->entry_bytes_remaining = zip->compressed_size; zip->entry_offset = 0; @@ -573,12 +575,16 @@ archive_read_format_zip_read_data(struct } break; } + if (r != ARCHIVE_OK) + return (r); /* Update checksum */ - if (r == ARCHIVE_OK && *size) { + if (*size) zip->entry_crc32 = crc32(zip->entry_crc32, *buff, *size); - } - return (r); + /* Return EOF immediately if this is a non-regular file. */ + if (AE_IFREG != (zip->mode & AE_IFMT)) + return (ARCHIVE_EOF); + return (ARCHIVE_OK); } /* Modified: releng/7.1/lib/libarchive/archive_write_disk.c ============================================================================== --- releng/7.1/lib/libarchive/archive_write_disk.c Fri Nov 28 20:08:47 2008 (r185408) +++ releng/7.1/lib/libarchive/archive_write_disk.c Fri Nov 28 20:09:48 2008 (r185409) @@ -176,7 +176,7 @@ struct archive_write_disk { int fd; /* Current offset for writing data to the file. */ off_t offset; - /* Maximum size of file. */ + /* Maximum size of file, -1 if unknown. */ off_t filesize; /* Dir we were in before this restore; only for deep paths. */ int restore_pwd; @@ -231,7 +231,8 @@ static int set_time(struct archive_write static struct fixup_entry *sort_dir_list(struct fixup_entry *p); static gid_t trivial_lookup_gid(void *, const char *, gid_t); static uid_t trivial_lookup_uid(void *, const char *, uid_t); - +static ssize_t write_data_block(struct archive_write_disk *, + const char *, size_t, off_t); static struct archive_vtable *archive_write_disk_vtable(void); @@ -337,7 +338,10 @@ _archive_write_header(struct archive *_a a->offset = 0; a->uid = a->user_uid; a->mode = archive_entry_mode(a->entry); - a->filesize = archive_entry_size(a->entry); + if (archive_entry_size_is_set(a->entry)) + a->filesize = archive_entry_size(a->entry); + else + a->filesize = -1; archive_strcpy(&(a->_name_data), archive_entry_pathname(a->entry)); a->name = a->_name_data.s; archive_clear_error(&a->archive); @@ -439,15 +443,25 @@ _archive_write_header(struct archive *_a fe->mode = a->mode; } - if (a->deferred & TODO_TIMES) { + if ((a->deferred & TODO_TIMES) + && (archive_entry_mtime_is_set(entry) + || archive_entry_atime_is_set(entry))) { fe = current_fixup(a, archive_entry_pathname(entry)); fe->fixup |= TODO_TIMES; - fe->mtime = archive_entry_mtime(entry); - fe->mtime_nanos = archive_entry_mtime_nsec(entry); - fe->atime = archive_entry_atime(entry); - fe->atime_nanos = archive_entry_atime_nsec(entry); - if (fe->atime == 0 && fe->atime_nanos == 0) + if (archive_entry_mtime_is_set(entry)) { + fe->mtime = archive_entry_mtime(entry); + fe->mtime_nanos = archive_entry_mtime_nsec(entry); + } else { + fe->mtime = a->start_time; + fe->mtime_nanos = 0; + } + if (archive_entry_atime_is_set(entry)) { + fe->atime = archive_entry_atime(entry); + fe->atime_nanos = archive_entry_atime_nsec(entry); + } else { fe->atime = a->start_time; + fe->atime_nanos = 0; + } } if (a->deferred & TODO_FFLAGS) { @@ -486,89 +500,113 @@ archive_write_disk_set_skip_file(struct } static ssize_t -_archive_write_data_block(struct archive *_a, - const void *buff, size_t size, off_t offset) +write_data_block(struct archive_write_disk *a, + const char *buff, size_t size, off_t offset) { - struct archive_write_disk *a = (struct archive_write_disk *)_a; ssize_t bytes_written = 0; - ssize_t block_size, bytes_to_write; - int r = ARCHIVE_OK; + ssize_t block_size = 0, bytes_to_write; + int r; - __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_DATA, "archive_write_disk_block"); - if (a->fd < 0) { - archive_set_error(&a->archive, 0, "File not open"); + if (a->filesize == 0 || a->fd < 0) { + archive_set_error(&a->archive, 0, + "Attempt to write to an empty file"); return (ARCHIVE_WARN); } - archive_clear_error(&a->archive); if (a->flags & ARCHIVE_EXTRACT_SPARSE) { if ((r = _archive_write_disk_lazy_stat(a)) != ARCHIVE_OK) return (r); block_size = a->pst->st_blksize; - } else - block_size = -1; - - if ((off_t)(offset + size) > a->filesize) { - size = (size_t)(a->filesize - a->offset); - archive_set_error(&a->archive, 0, - "Write request too large"); - r = ARCHIVE_WARN; } + if (a->filesize >= 0 && (off_t)(offset + size) > a->filesize) + size = (size_t)(a->filesize - offset); + /* Write the data. */ while (size > 0) { - if (block_size != -1) { - const char *buf; - - for (buf = buff; size; ++buf, --size, ++offset) { - if (*buf != '\0') + if (block_size == 0) { + bytes_to_write = size; + } else { + /* We're sparsifying the file. */ + const char *p, *end; + off_t block_end; + + /* Skip leading zero bytes. */ + for (p = buff, end = buff + size; p < end; ++p) { + if (*p != '\0') break; } + offset += p - buff; + size -= p - buff; + buff = p; if (size == 0) break; - bytes_to_write = block_size - offset % block_size; - buff = buf; - } else + + /* Calculate next block boundary after offset. */ + block_end + = (offset / block_size) * block_size + block_size; + + /* If the adjusted write would cross block boundary, + * truncate it to the block boundary. */ bytes_to_write = size; + if (offset + bytes_to_write > block_end) + bytes_to_write = block_end - offset; + } + /* Seek if necessary to the specified offset. */ if (offset != a->last_offset) { if (lseek(a->fd, offset, SEEK_SET) < 0) { - archive_set_error(&a->archive, errno, "Seek failed"); + archive_set_error(&a->archive, errno, + "Seek failed"); return (ARCHIVE_FATAL); } } - bytes_written = write(a->fd, buff, size); + bytes_written = write(a->fd, buff, bytes_to_write); if (bytes_written < 0) { archive_set_error(&a->archive, errno, "Write failed"); return (ARCHIVE_WARN); } - buff = (const char *)buff + bytes_written; + buff += bytes_written; size -= bytes_written; offset += bytes_written; a->archive.file_position += bytes_written; a->archive.raw_position += bytes_written; a->last_offset = a->offset = offset; } - a->offset = offset; - return (r); + return (bytes_written); +} + +static ssize_t +_archive_write_data_block(struct archive *_a, + const void *buff, size_t size, off_t offset) +{ + struct archive_write_disk *a = (struct archive_write_disk *)_a; + ssize_t r; + + __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_DATA, "archive_write_disk_block"); + + r = write_data_block(a, buff, size, offset); + + if (r < 0) + return (r); + if ((size_t)r < size) { + archive_set_error(&a->archive, 0, + "Write request too large"); + return (ARCHIVE_WARN); + } + return (ARCHIVE_OK); } static ssize_t _archive_write_data(struct archive *_a, const void *buff, size_t size) { struct archive_write_disk *a = (struct archive_write_disk *)_a; - int r; __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, ARCHIVE_STATE_DATA, "archive_write_data"); - if (a->fd < 0) - return (ARCHIVE_OK); - r = _archive_write_data_block(_a, buff, size, a->offset); - if (r < ARCHIVE_OK) - return (r); - return size; + return (write_data_block(a, buff, size, a->offset)); } static int @@ -584,7 +622,15 @@ _archive_write_finish_entry(struct archi return (ARCHIVE_OK); archive_clear_error(&a->archive); - if (a->last_offset != a->filesize && a->fd >= 0) { + /* Pad or truncate file to the right size. */ + if (a->fd < 0) { + /* There's no file. */ + } else if (a->filesize < 0) { + /* File size is unknown, so we can't set the size. */ + } else if (a->last_offset == a->filesize) { + /* Last write ended at exactly the filesize; we're done. */ + /* Hopefully, this is the common case. */ + } else { if (ftruncate(a->fd, a->filesize) == -1 && a->filesize == 0) { archive_set_error(&a->archive, errno, @@ -601,7 +647,8 @@ _archive_write_finish_entry(struct archi if (a->st.st_size != a->filesize) { const char nul = '\0'; if (lseek(a->fd, a->st.st_size - 1, SEEK_SET) < 0) { - archive_set_error(&a->archive, errno, "Seek failed"); + archive_set_error(&a->archive, errno, + "Seek failed"); return (ARCHIVE_FATAL); } if (write(a->fd, &nul, 1) < 0) { @@ -609,6 +656,7 @@ _archive_write_finish_entry(struct archi "Write to restore size failed"); return (ARCHIVE_FATAL); } + a->pst = NULL; } } @@ -975,7 +1023,7 @@ create_filesystem_object(struct archive_ * If the hardlink does carry data, let the last * archive entry decide ownership. */ - if (r == 0 && a->filesize == 0) { + if (r == 0 && a->filesize <= 0) { a->todo = 0; a->deferred = 0; } if (r == 0 && a->filesize > 0) { @@ -1635,18 +1683,31 @@ set_time(struct archive_write_disk *a) { struct timeval times[2]; - times[1].tv_sec = archive_entry_mtime(a->entry); - times[1].tv_usec = archive_entry_mtime_nsec(a->entry) / 1000; + /* If no time was provided, we're done. */ + if (!archive_entry_atime_is_set(a->entry) + && !archive_entry_mtime_is_set(a->entry)) + return (ARCHIVE_OK); - times[0].tv_sec = archive_entry_atime(a->entry); - times[0].tv_usec = archive_entry_atime_nsec(a->entry) / 1000; + /* We know at least one is set, so... */ + if (archive_entry_mtime_is_set(a->entry)) { + times[1].tv_sec = archive_entry_mtime(a->entry); + times[1].tv_usec = archive_entry_mtime_nsec(a->entry) / 1000; + } else { + times[1].tv_sec = a->start_time; + times[1].tv_usec = 0; + } /* If no atime was specified, use start time instead. */ /* In theory, it would be marginally more correct to use * time(NULL) here, but that would cost us an extra syscall * for little gain. */ - if (times[0].tv_sec == 0 && times[0].tv_usec == 0) + if (archive_entry_atime_is_set(a->entry)) { + times[0].tv_sec = archive_entry_atime(a->entry); + times[0].tv_usec = archive_entry_atime_nsec(a->entry) / 1000; + } else { times[0].tv_sec = a->start_time; + times[0].tv_usec = 0; + } #ifdef HAVE_FUTIMES if (a->fd >= 0 && futimes(a->fd, times) == 0) { @@ -1684,10 +1745,24 @@ set_time(struct archive_write_disk *a) { struct utimbuf times; - times.modtime = archive_entry_mtime(a->entry); - times.actime = archive_entry_atime(a->entry); - if (times.actime == 0) + /* If no time was provided, we're done. */ + if (!archive_entry_atime_is_set(a->entry) + && !archive_entry_mtime_is_set(a->entry)) + return (ARCHIVE_OK); + + /* We know at least one is set, so... */ + /* Set mtime from mtime if set, else start time. */ + if (archive_entry_mtime_is_set(a->entry)) + times.modtime = archive_entry_mtime(a->entry); + else + times.modtime = a->start_time; + + /* Set atime from provided atime, else mtime. */ + if (archive_entry_atime_is_set(a->entry)) + times.actime = archive_entry_atime(a->entry); + else times.actime = a->start_time; + if (!S_ISLNK(a->mode) && utime(a->name, ×) != 0) { archive_set_error(&a->archive, errno, "Can't update time for %s", a->name); Modified: releng/7.1/lib/libarchive/test/test_entry.c ============================================================================== --- releng/7.1/lib/libarchive/test/test_entry.c Fri Nov 28 20:08:47 2008 (r185408) +++ releng/7.1/lib/libarchive/test/test_entry.c Fri Nov 28 20:09:48 2008 (r185409) @@ -69,14 +69,25 @@ DEFINE_TEST(test_entry) * The following tests are ordered alphabetically by the * name of the field. */ + /* atime */ archive_entry_set_atime(e, 13579, 24680); assertEqualInt(archive_entry_atime(e), 13579); assertEqualInt(archive_entry_atime_nsec(e), 24680); + archive_entry_unset_atime(e); + assertEqualInt(archive_entry_atime(e), 0); + assertEqualInt(archive_entry_atime_nsec(e), 0); + assert(!archive_entry_atime_is_set(e)); + /* ctime */ archive_entry_set_ctime(e, 13580, 24681); assertEqualInt(archive_entry_ctime(e), 13580); assertEqualInt(archive_entry_ctime_nsec(e), 24681); + archive_entry_unset_ctime(e); + assertEqualInt(archive_entry_ctime(e), 0); + assertEqualInt(archive_entry_ctime_nsec(e), 0); + assert(!archive_entry_ctime_is_set(e)); + #if ARCHIVE_VERSION_STAMP >= 1009000 /* dev */ archive_entry_set_dev(e, 235); @@ -85,6 +96,7 @@ DEFINE_TEST(test_entry) skipping("archive_entry_dev()"); #endif /* devmajor/devminor are tested specially below. */ + #if ARCHIVE_VERSION_STAMP >= 1009000 /* filetype */ archive_entry_set_filetype(e, AE_IFREG); @@ -92,10 +104,13 @@ DEFINE_TEST(test_entry) #else skipping("archive_entry_filetype()"); #endif + /* fflags are tested specially below */ + /* gid */ archive_entry_set_gid(e, 204); assertEqualInt(archive_entry_gid(e), 204); + /* gname */ archive_entry_set_gname(e, "group"); assertEqualString(archive_entry_gname(e), "group"); @@ -104,6 +119,7 @@ DEFINE_TEST(test_entry) assertEqualWString(archive_entry_gname_w(e), L"wgroup"); memset(wbuff, 0, sizeof(wbuff)); assertEqualWString(archive_entry_gname_w(e), L"wgroup"); + /* hardlink */ archive_entry_set_hardlink(e, "hardlinkname"); assertEqualString(archive_entry_hardlink(e), "hardlinkname"); @@ -158,10 +174,16 @@ DEFINE_TEST(test_entry) /* mode */ archive_entry_set_mode(e, 0123456); assertEqualInt(archive_entry_mode(e), 0123456); + /* mtime */ archive_entry_set_mtime(e, 13581, 24682); assertEqualInt(archive_entry_mtime(e), 13581); assertEqualInt(archive_entry_mtime_nsec(e), 24682); + archive_entry_unset_mtime(e); + assertEqualInt(archive_entry_mtime(e), 0); + assertEqualInt(archive_entry_mtime_nsec(e), 0); + assert(!archive_entry_mtime_is_set(e)); + #if ARCHIVE_VERSION_STAMP >= 1009000 /* nlink */ archive_entry_set_nlink(e, 736); @@ -169,6 +191,7 @@ DEFINE_TEST(test_entry) #else skipping("archive_entry_nlink()"); #endif + /* pathname */ archive_entry_set_pathname(e, "path"); assertEqualString(archive_entry_pathname(e), "path"); @@ -184,6 +207,7 @@ DEFINE_TEST(test_entry) assertEqualWString(archive_entry_pathname_w(e), L"wpath"); memset(wbuff, 0, sizeof(wbuff)); assertEqualWString(archive_entry_pathname_w(e), L"wpath"); + #if ARCHIVE_VERSION_STAMP >= 1009000 /* rdev */ archive_entry_set_rdev(e, 532); @@ -192,9 +216,14 @@ DEFINE_TEST(test_entry) skipping("archive_entry_rdev()"); #endif /* rdevmajor/rdevminor are tested specially below. */ + /* size */ archive_entry_set_size(e, 987654321); assertEqualInt(archive_entry_size(e), 987654321); + archive_entry_unset_size(e); + assertEqualInt(archive_entry_size(e), 0); + assert(!archive_entry_size_is_set(e)); + /* symlink */ archive_entry_set_symlink(e, "symlinkname"); assertEqualString(archive_entry_symlink(e), "symlinkname"); @@ -207,9 +236,11 @@ DEFINE_TEST(test_entry) #endif archive_entry_copy_symlink_w(e, L"wsymlink"); assertEqualWString(archive_entry_symlink_w(e), L"wsymlink"); + /* uid */ archive_entry_set_uid(e, 83); assertEqualInt(archive_entry_uid(e), 83); + /* uname */ archive_entry_set_uname(e, "user"); assertEqualString(archive_entry_uname(e), "user"); Modified: releng/7.1/lib/libarchive/test/test_read_format_zip.c ============================================================================== --- releng/7.1/lib/libarchive/test/test_read_format_zip.c Fri Nov 28 20:08:47 2008 (r185408) +++ releng/7.1/lib/libarchive/test/test_read_format_zip.c Fri Nov 28 20:09:48 2008 (r185409) @@ -25,6 +25,12 @@ #include "test.h" __FBSDID("$FreeBSD$"); +/* + * The reference file for this has been manually tweaked so that: + * * file2 has length-at-end but file1 does not + * * file2 has an invalid CRC + */ + DEFINE_TEST(test_read_format_zip) { const char *refname = "test_read_format_zip.zip"; @@ -57,7 +63,8 @@ DEFINE_TEST(test_read_format_zip) assertA(0 == archive_read_next_header(a, &ae)); assertEqualString("file2", archive_entry_pathname(ae)); assertEqualInt(1179605932, archive_entry_mtime(ae)); - assertEqualInt(18, archive_entry_size(ae)); + failure("file2 has length-at-end, so we shouldn't see a valid size"); + assertEqualInt(0, archive_entry_size_is_set(ae)); failure("file2 has a bad CRC, so reading to end should fail"); assertEqualInt(ARCHIVE_WARN, archive_read_data(a, buff, 19)); assert(0 == memcmp(buff, "hello\nhello\nhello\n", 18)); Modified: releng/7.1/lib/libarchive/test/test_read_format_zip.zip.uu ============================================================================== --- releng/7.1/lib/libarchive/test/test_read_format_zip.zip.uu Fri Nov 28 20:08:47 2008 (r185408) +++ releng/7.1/lib/libarchive/test/test_read_format_zip.zip.uu Fri Nov 28 20:09:48 2008 (r185409) @@ -1,13 +1,14 @@ $FreeBSD$ begin 644 test_read_format_zip.zip -M4$L#!`H``````%EFLS8````````````````$`!4`9&ER+U54"0`#&55/1AE5 -M3T95>`0`Z`/H`U!+`P04````"`!O9K,V.C=F/0H````2````!0`5`&9I;&4Q -M550)``-!54]&K%M/1E5X!`#H`^@#RTC-R%8T$@H````2````!0`5`&9I;&4R550)``.L6T]&K%M/1E5X!`#H`^@#RTC- -MR%8T$@H````2````!0`-```````!````I(%Y```` -H9FEL93)55`4``ZQ;3T95>```4$L%!@`````#``,`OP```+L````````` +M4$L#!`H`"````%EFLS8````````````````$`!4`9&ER+U54"0`#&55/1M19 +M_4A5>`0`Z`/H`U!+!P@```````````````!02P,$%`````@`;V:S-CHW9CT* +M````$@````4`%0!F:6QE,554"0`#055/1L!9_4A5>`0`Z`/H`\M(S`0`Z`/H`\M(S```4$L!`A<#%``(``@`;V:S-CHW9CT*````$@````4`#0`` +M`````0```.V!1P```&9I;&4Q550%``-!54]&57@``%!+`0(7`Q0`"``(`%IJ +MLS8Z-V8]"@```!(````%``T```````$```#M@8D```!F:6QE,E54!0`#K%M/ +;1E5X``!02P4&``````,``P"_````VP`````` ` end Modified: releng/7.1/lib/libarchive/test/test_write_disk.c ============================================================================== --- releng/7.1/lib/libarchive/test/test_write_disk.c Fri Nov 28 20:08:47 2008 (r185408) +++ releng/7.1/lib/libarchive/test/test_write_disk.c Fri Nov 28 20:09:48 2008 (r185409) @@ -84,7 +84,7 @@ static void create_reg_file(struct archi * the entry being a maximum size. */ archive_entry_set_size(ae, sizeof(data)); - archive_entry_set_mtime(ae, 123456789, 0); + archive_entry_set_mtime(ae, 123456789, 0); assertEqualIntA(ad, 0, archive_write_header(ad, ae)); assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data))); assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); @@ -152,6 +152,61 @@ static void create_reg_file2(struct arch free(compare); free(data); } + +static void create_reg_file3(struct archive_entry *ae, const char *msg) +{ + static const char data[]="abcdefghijklmnopqrstuvwxyz"; + struct archive *ad; + struct stat st; + + /* Write the entry to disk. */ + assert((ad = archive_write_disk_new()) != NULL); + failure("%s", msg); + /* Set the size smaller than the data and verify the truncation. */ + archive_entry_set_size(ae, 5); + assertEqualIntA(ad, 0, archive_write_header(ad, ae)); + assertEqualInt(5, archive_write_data(ad, data, sizeof(data))); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); +#if ARCHIVE_VERSION_NUMBER < 2000000 + archive_write_finish(ad); +#else + assertEqualInt(0, archive_write_finish(ad)); +#endif + /* Test the entry on disk. */ + assert(0 == stat(archive_entry_pathname(ae), &st)); + failure("st.st_mode=%o archive_entry_mode(ae)=%o", + st.st_mode, archive_entry_mode(ae)); + assertEqualInt(st.st_mode, (archive_entry_mode(ae) & ~UMASK)); + assertEqualInt(st.st_size, 5); +} + + +static void create_reg_file4(struct archive_entry *ae, const char *msg) +{ + static const char data[]="abcdefghijklmnopqrstuvwxyz"; + struct archive *ad; + struct stat st; + + /* Write the entry to disk. */ + assert((ad = archive_write_disk_new()) != NULL); + /* Leave the size unset. The data should not be truncated. */ + assertEqualIntA(ad, 0, archive_write_header(ad, ae)); + assertEqualInt(ARCHIVE_OK, + archive_write_data_block(ad, data, sizeof(data), 0)); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); +#if ARCHIVE_VERSION_NUMBER < 2000000 + archive_write_finish(ad); +#else + assertEqualInt(0, archive_write_finish(ad)); +#endif + /* Test the entry on disk. */ + assert(0 == stat(archive_entry_pathname(ae), &st)); + failure("st.st_mode=%o archive_entry_mode(ae)=%o", + st.st_mode, archive_entry_mode(ae)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 20:13:24 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 476581065673; Fri, 28 Nov 2008 20:13:24 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 317AF8FC08; Fri, 28 Nov 2008 20:13:24 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASKDOAG028811; Fri, 28 Nov 2008 20:13:24 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASKDORv028810; Fri, 28 Nov 2008 20:13:24 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200811282013.mASKDORv028810@svn.freebsd.org> From: Tim Kientzle Date: Fri, 28 Nov 2008 20:13:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185410 - stable/7/usr.bin/tar X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 20:13:24 -0000 Author: kientzle Date: Fri Nov 28 20:13:23 2008 New Revision: 185410 URL: http://svn.freebsd.org/changeset/base/185410 Log: MFC r185359: Return a non-zero exit code when directories disappear during the filesystem traversal. Tested by: David Wolfskill Approved by: re Modified: stable/7/usr.bin/tar/ (props changed) stable/7/usr.bin/tar/write.c Modified: stable/7/usr.bin/tar/write.c ============================================================================== --- stable/7/usr.bin/tar/write.c Fri Nov 28 20:09:48 2008 (r185409) +++ stable/7/usr.bin/tar/write.c Fri Nov 28 20:13:23 2008 (r185410) @@ -659,8 +659,10 @@ write_hierarchy(struct bsdtar *bsdtar, s const struct stat *st = NULL, *lst = NULL; int descend; - if (tree_ret == TREE_ERROR_DIR) + if (tree_ret == TREE_ERROR_DIR) { bsdtar_warnc(bsdtar, errno, "%s: Couldn't visit directory", name); + bsdtar->return_value = 1; + } if (tree_ret != TREE_REGULAR) continue; lst = tree_current_lstat(tree); From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 20:14:42 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46A6F1065676; Fri, 28 Nov 2008 20:14:42 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 316998FC0A; Fri, 28 Nov 2008 20:14:42 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASKEgCW028883; Fri, 28 Nov 2008 20:14:42 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASKEgBn028882; Fri, 28 Nov 2008 20:14:42 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200811282014.mASKEgBn028882@svn.freebsd.org> From: Tim Kientzle Date: Fri, 28 Nov 2008 20:14:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185411 - releng/7.1/usr.bin/tar X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 20:14:42 -0000 Author: kientzle Date: Fri Nov 28 20:14:41 2008 New Revision: 185411 URL: http://svn.freebsd.org/changeset/base/185411 Log: MFC r185359: Non-zero exit when directories disappear during the filesystem traversal. Tested by: David Wolfskill Approved by: re Modified: releng/7.1/usr.bin/tar/ (props changed) releng/7.1/usr.bin/tar/write.c Modified: releng/7.1/usr.bin/tar/write.c ============================================================================== --- releng/7.1/usr.bin/tar/write.c Fri Nov 28 20:13:23 2008 (r185410) +++ releng/7.1/usr.bin/tar/write.c Fri Nov 28 20:14:41 2008 (r185411) @@ -659,8 +659,10 @@ write_hierarchy(struct bsdtar *bsdtar, s const struct stat *st = NULL, *lst = NULL; int descend; - if (tree_ret == TREE_ERROR_DIR) + if (tree_ret == TREE_ERROR_DIR) { bsdtar_warnc(bsdtar, errno, "%s: Couldn't visit directory", name); + bsdtar->return_value = 1; + } if (tree_ret != TREE_REGULAR) continue; lst = tree_current_lstat(tree); From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 22:06:31 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE048106573C; Fri, 28 Nov 2008 22:06:31 +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 C84908FC17; Fri, 28 Nov 2008 22:06:31 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASM6Vb9031053; Fri, 28 Nov 2008 22:06:31 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASM6Vos031052; Fri, 28 Nov 2008 22:06:31 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811282206.mASM6Vos031052@svn.freebsd.org> From: Ken Smith Date: Fri, 28 Nov 2008 22:06:31 +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: r185414 - stable/6/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 22:06:32 -0000 Author: kensmith Date: Fri Nov 28 22:06:31 2008 New Revision: 185414 URL: http://svn.freebsd.org/changeset/base/185414 Log: 6.4-RELEASE is done so shift stable/6 over to 6.4-STABLE. Approved by: re (implicit) Modified: stable/6/sys/conf/newvers.sh Modified: stable/6/sys/conf/newvers.sh ============================================================================== --- stable/6/sys/conf/newvers.sh Fri Nov 28 20:47:48 2008 (r185413) +++ stable/6/sys/conf/newvers.sh Fri Nov 28 22:06:31 2008 (r185414) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="6.4" -BRANCH="PRERELEASE" +BRANCH="STABLE" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 22:10:16 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFE5C1065672; Fri, 28 Nov 2008 22:10:16 +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 9AF0F8FC24; Fri, 28 Nov 2008 22:10:16 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASMAGB0031167; Fri, 28 Nov 2008 22:10:16 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASMAGT6031166; Fri, 28 Nov 2008 22:10:16 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200811282210.mASMAGT6031166@svn.freebsd.org> From: Ken Smith Date: Fri, 28 Nov 2008 22:10:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185415 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 22:10:16 -0000 Author: kensmith Date: Fri Nov 28 22:10:15 2008 New Revision: 185415 URL: http://svn.freebsd.org/changeset/base/185415 Log: Open stable/6 to normal developer activity. I had originally planned to do that much sooner but wound up holding it this long because of the new world order with SVN. People are still getting used to needing to commit to releng/X.Y in the "post-branch" phase so we needed to be able to diff stable/6 against releng/6.4 to make sure people did that. Once people get a bit more accustomed to SVN we should be able to go back to opening up the stable/X branch sooner in the release cycle. Approved by: core (implicit) Modified: svnadmin/conf/approvers Modified: svnadmin/conf/approvers ============================================================================== --- svnadmin/conf/approvers Fri Nov 28 22:06:31 2008 (r185414) +++ svnadmin/conf/approvers Fri Nov 28 22:10:15 2008 (r185415) @@ -18,7 +18,7 @@ # #^head/ re ^stable/7/ re -^stable/6/ re +#^stable/6/ re ^releng/7.1/ re ^releng/7.0/ (security-officer|so) ^releng/6.4/ re From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 23:30:52 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EA2F1065678; Fri, 28 Nov 2008 23:30:52 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85EBD8FC08; Fri, 28 Nov 2008 23:30:52 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASNUqDM032857; Fri, 28 Nov 2008 23:30:52 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASNUppS032838; Fri, 28 Nov 2008 23:30:51 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200811282330.mASNUppS032838@svn.freebsd.org> From: Marko Zec Date: Fri, 28 Nov 2008 23:30:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185419 - in head/sys: contrib/ipfilter/netinet net netgraph netinet netinet6 netipsec sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 23:30:52 -0000 Author: zec Date: Fri Nov 28 23:30:51 2008 New Revision: 185419 URL: http://svn.freebsd.org/changeset/base/185419 Log: Unhide declarations of network stack virtualization structs from underneath #ifdef VIMAGE blocks. This change introduces some churn in #include ordering and nesting throughout the network stack and drivers but is not expected to cause any additional issues. In the next step this will allow us to instantiate the virtualization container structures and switch from using global variables to their "containerized" counterparts. Reviewed by: bz, julian Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c head/sys/contrib/ipfilter/netinet/mlfk_ipl.c head/sys/net/vnet.h head/sys/netgraph/netgraph.h head/sys/netgraph/ng_base.c head/sys/netgraph/ng_eiface.c head/sys/netinet/in.c head/sys/netinet/ip_id.c head/sys/netinet/ip_input.c head/sys/netinet/ip_var.h head/sys/netinet/tcp_hostcache.c head/sys/netinet/vinet.h head/sys/netinet6/in6_ifattach.c head/sys/netinet6/vinet6.h head/sys/netipsec/keysock.c head/sys/netipsec/keysock.h head/sys/netipsec/vipsec.h head/sys/sys/param.h Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Nov 28 23:30:51 2008 (r185419) @@ -121,7 +121,7 @@ static const char rcsid[] = "@(#)$Id: ip #endif extern int ip_optcopy __P((struct ip *, struct ip *)); -#if (__FreeBSD_version > 460000) +#if (__FreeBSD_version > 460000) && (__FreeBSD_version < 800055) extern int path_mtu_discovery; #endif Modified: head/sys/contrib/ipfilter/netinet/mlfk_ipl.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Fri Nov 28 23:30:51 2008 (r185419) @@ -43,7 +43,9 @@ static int sysctl_ipf_int ( SYSCTL_HANDL static int ipf_modload(void); static int ipf_modunload(void); +#if __FreeBSD_version < 800055 SYSCTL_DECL(_net_inet); +#endif #define SYSCTL_IPF(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \ ptr, val, sysctl_ipf_int, "I", descr); Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/net/vnet.h Fri Nov 28 23:30:51 2008 (r185419) @@ -33,9 +33,10 @@ #ifndef _NET_VNET_H_ #define _NET_VNET_H_ -#ifdef VIMAGE #include "opt_route.h" +#include +#include #include #include #include @@ -66,8 +67,6 @@ struct vnet_net { int _ether_ipfw; }; -#endif - /* * Symbol translation macros */ Modified: head/sys/netgraph/netgraph.h ============================================================================== --- head/sys/netgraph/netgraph.h Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/netgraph/netgraph.h Fri Nov 28 23:30:51 2008 (r185419) @@ -1186,6 +1186,7 @@ typedef void *meta_p; /* Hash related definitions */ #define NG_ID_HASH_SIZE 128 /* most systems wont need even this many */ +#define NG_NAME_HASH_SIZE 128 /* most systems wont need even this many */ /* Virtualization macros */ #define INIT_VNET_NETGRAPH(vnet) \ @@ -1194,6 +1195,16 @@ typedef void *meta_p; #define VNET_NETGRAPH(sym) VSYM(vnet_netgraph, sym) +struct vnet_netgraph { + LIST_HEAD(, ng_node) _ng_ID_hash[NG_ID_HASH_SIZE]; + LIST_HEAD(, ng_node) _ng_name_hash[NG_NAME_HASH_SIZE]; + LIST_HEAD(, ng_node) _ng_nodelist; + ng_ID_t _nextID; + struct unrhdr *_ng_iface_unit; + struct unrhdr *_ng_eiface_unit; + struct unrhdr *_ng_wormhole_unit; +}; + /* Symbol translation macros */ #define V_nextID VNET_NETGRAPH(nextID) #define V_ng_ID_hash VNET_NETGRAPH(ng_ID_hash) Modified: head/sys/netgraph/ng_base.c ============================================================================== --- head/sys/netgraph/ng_base.c Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/netgraph/ng_base.c Fri Nov 28 23:30:51 2008 (r185419) @@ -183,7 +183,6 @@ static struct mtx ng_idhash_mtx; } \ } while (0) -#define NG_NAME_HASH_SIZE 128 /* most systems wont need even this many */ static LIST_HEAD(, ng_node) ng_name_hash[NG_NAME_HASH_SIZE]; static struct mtx ng_namehash_mtx; #define NG_NAMEHASH(NAME, HASH) \ Modified: head/sys/netgraph/ng_eiface.c ============================================================================== --- head/sys/netgraph/ng_eiface.c Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/netgraph/ng_eiface.c Fri Nov 28 23:30:51 2008 (r185419) @@ -447,8 +447,6 @@ ng_eiface_rcvmsg(node_p node, item_p ite caddr_t ptr; int buflen; -#define SA_SIZE(s) ((s)->sa_lensa_len) - /* Determine size of response and allocate it */ buflen = 0; TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) @@ -474,7 +472,6 @@ ng_eiface_rcvmsg(node_p node, item_p ite buflen -= len; } break; -#undef SA_SIZE } default: Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/netinet/in.c Fri Nov 28 23:30:51 2008 (r185419) @@ -70,7 +70,6 @@ static void in_purgemaddrs(struct ifnet static int subnetsarelocal; static int sameprefixcarponly; extern struct inpcbinfo ripcbinfo; -extern struct inpcbinfo udbinfo; #endif SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, subnets_are_local, Modified: head/sys/netinet/ip_id.c ============================================================================== --- head/sys/netinet/ip_id.c Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/netinet/ip_id.c Fri Nov 28 23:30:51 2008 (r185419) @@ -104,7 +104,6 @@ static int sysctl_ip_id_change(SYSCTL_HA MTX_SYSINIT(ip_id_mtx, &ip_id_mtx, "ip_id_mtx", MTX_DEF); -SYSCTL_DECL(_net_inet_ip); SYSCTL_PROC(_net_inet_ip, OID_AUTO, random_id_period, CTLTYPE_INT|CTLFLAG_RW, &array_size, 0, sysctl_ip_id_change, "IU", "IP ID Array size"); SYSCTL_INT(_net_inet_ip, OID_AUTO, random_id_collisions, CTLFLAG_RD, Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/netinet/ip_input.c Fri Nov 28 23:30:51 2008 (r185419) @@ -104,7 +104,7 @@ struct ipstat ipstat; static int ip_rsvp_on; struct socket *ip_rsvpd; int rsvp_on; -static TAILQ_HEAD(ipqhead, ipq) ipq[IPREASS_NHASH]; +static struct ipqhead ipq[IPREASS_NHASH]; static int maxnipq; /* Administrative limit on # reass queues. */ static int maxfragsperpacket; int ipstealth; Modified: head/sys/netinet/ip_var.h ============================================================================== --- head/sys/netinet/ip_var.h Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/netinet/ip_var.h Fri Nov 28 23:30:51 2008 (r185419) @@ -234,18 +234,6 @@ extern struct pfil_head inet_pfil_hook; void in_delayed_cksum(struct mbuf *m); -static __inline uint16_t ip_newid(void); -extern int ip_do_randomid; - -static __inline uint16_t -ip_newid(void) -{ - if (V_ip_do_randomid) - return ip_randomid(); - - return htons(V_ip_id++); -} - #endif /* _KERNEL */ #endif /* !_NETINET_IP_VAR_H_ */ Modified: head/sys/netinet/tcp_hostcache.c ============================================================================== --- head/sys/netinet/tcp_hostcache.c Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/netinet/tcp_hostcache.c Fri Nov 28 23:30:51 2008 (r185419) @@ -98,55 +98,12 @@ __FBSDID("$FreeBSD$"); #include - -TAILQ_HEAD(hc_qhead, hc_metrics); - -struct hc_head { - struct hc_qhead hch_bucket; - u_int hch_length; - struct mtx hch_mtx; -}; - -struct hc_metrics { - /* housekeeping */ - TAILQ_ENTRY(hc_metrics) rmx_q; - struct hc_head *rmx_head; /* head of bucket tail queue */ - struct in_addr ip4; /* IP address */ - struct in6_addr ip6; /* IP6 address */ - /* endpoint specific values for TCP */ - u_long rmx_mtu; /* MTU for this path */ - u_long rmx_ssthresh; /* outbound gateway buffer limit */ - u_long rmx_rtt; /* estimated round trip time */ - u_long rmx_rttvar; /* estimated rtt variance */ - u_long rmx_bandwidth; /* estimated bandwidth */ - u_long rmx_cwnd; /* congestion window */ - u_long rmx_sendpipe; /* outbound delay-bandwidth product */ - u_long rmx_recvpipe; /* inbound delay-bandwidth product */ - /* TCP hostcache internal data */ - int rmx_expire; /* lifetime for object */ - u_long rmx_hits; /* number of hits */ - u_long rmx_updates; /* number of updates */ -}; - /* Arbitrary values */ #define TCP_HOSTCACHE_HASHSIZE 512 #define TCP_HOSTCACHE_BUCKETLIMIT 30 #define TCP_HOSTCACHE_EXPIRE 60*60 /* one hour */ #define TCP_HOSTCACHE_PRUNE 5*60 /* every 5 minutes */ -struct tcp_hostcache { - struct hc_head *hashbase; - uma_zone_t zone; - u_int hashsize; - u_int hashmask; - u_int bucket_limit; - u_int cache_count; - u_int cache_limit; - int expire; - int prune; - int purgeall; -}; - #ifdef VIMAGE_GLOBALS static struct tcp_hostcache tcp_hostcache; static struct callout tcp_hc_callout; Modified: head/sys/netinet/vinet.h ============================================================================== --- head/sys/netinet/vinet.h Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/netinet/vinet.h Fri Nov 28 23:30:51 2008 (r185419) @@ -33,11 +33,12 @@ #ifndef _NETINET_VINET_H_ #define _NETINET_VINET_H_ -#ifdef VIMAGE #include #include #include +#include + #include #include #include @@ -196,8 +197,6 @@ struct vnet_inet { int _icmp_quotelen; int _icmpbmcastecho; }; -#endif - /* * Symbol translation macros @@ -333,4 +332,16 @@ struct vnet_inet { #define V_udpstat VNET_INET(udpstat) #define V_useloopback VNET_INET(useloopback) +static __inline uint16_t ip_newid(void); +extern int ip_do_randomid; + +static __inline uint16_t +ip_newid(void) +{ + if (V_ip_do_randomid) + return ip_randomid(); + + return htons(V_ip_id++); +} + #endif /* !_NETINET_VINET_H_ */ Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/netinet6/in6_ifattach.c Fri Nov 28 23:30:51 2008 (r185419) @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); unsigned long in6_maxmtu; int ip6_auto_linklocal; struct callout in6_tmpaddrtimer_ch; -extern struct inpcbinfo udbinfo; extern struct inpcbinfo ripcbinfo; #endif Modified: head/sys/netinet6/vinet6.h ============================================================================== --- head/sys/netinet6/vinet6.h Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/netinet6/vinet6.h Fri Nov 28 23:30:51 2008 (r185419) @@ -33,7 +33,6 @@ #ifndef _NETINET6_VINET6_H_ #define _NETINET6_VINET6_H_ -#ifdef VIMAGE #include #include #include @@ -154,15 +153,12 @@ struct vnet_inet6 { struct ip6_pktopts _ip6_opts; }; -#endif - #define INIT_VNET_INET6(vnet) \ INIT_FROM_VNET(vnet, VNET_MOD_INET6, struct vnet_inet6, vnet_inet6) #define VNET_INET6(sym) VSYM(vnet_inet6, sym) - /* * Symbol translation macros */ Modified: head/sys/netipsec/keysock.c ============================================================================== --- head/sys/netipsec/keysock.c Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/netipsec/keysock.c Fri Nov 28 23:30:51 2008 (r185419) @@ -66,11 +66,6 @@ #include -struct key_cb { - int key_count; - int any_count; -}; - #ifdef VIMAGE_GLOBALS static struct key_cb key_cb; struct pfkeystat pfkeystat; Modified: head/sys/netipsec/keysock.h ============================================================================== --- head/sys/netipsec/keysock.h Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/netipsec/keysock.h Fri Nov 28 23:30:51 2008 (r185419) @@ -58,6 +58,11 @@ struct pfkeystat { u_quad_t sockerr; /* # of socket related errors */ }; +struct key_cb { + int key_count; + int any_count; +}; + #define KEY_SENDUP_ONE 0 #define KEY_SENDUP_ALL 1 #define KEY_SENDUP_REGISTERED 2 Modified: head/sys/netipsec/vipsec.h ============================================================================== --- head/sys/netipsec/vipsec.h Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/netipsec/vipsec.h Fri Nov 28 23:30:51 2008 (r185419) @@ -33,7 +33,6 @@ #ifndef _NETIPSEC_VIPSEC_H_ #define _NETIPSEC_VIPSEC_H_ -#ifdef VIMAGE #include #include #include @@ -112,7 +111,6 @@ struct vnet_ipsec { LIST_HEAD(, secacq) _acqtree; LIST_HEAD(, secspacq) _spacqtree; }; -#endif /* * Symbol translation macros Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Fri Nov 28 22:27:26 2008 (r185418) +++ head/sys/sys/param.h Fri Nov 28 23:30:51 2008 (r185419) @@ -92,9 +92,13 @@ #include #endif +#ifndef FALSE #define FALSE 0 +#endif +#ifndef TRUE #define TRUE 1 #endif +#endif #ifndef _KERNEL /* Signals. */ From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 23:39:25 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B9DA1065673; Fri, 28 Nov 2008 23:39:25 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84BD68FC08; Fri, 28 Nov 2008 23:39:25 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASNdP6D033048; Fri, 28 Nov 2008 23:39:25 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASNdPds033047; Fri, 28 Nov 2008 23:39:25 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200811282339.mASNdPds033047@svn.freebsd.org> From: Marko Zec Date: Fri, 28 Nov 2008 23:39:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185420 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 23:39:25 -0000 Author: zec Date: Fri Nov 28 23:39:25 2008 New Revision: 185420 URL: http://svn.freebsd.org/changeset/base/185420 Log: Add an essential .h file that skipped from the last commit (r185419). Pointy hat #1 on... Pointed out by: bz Added: head/sys/netinet/tcp_hostcache.h (contents, props changed) Added: head/sys/netinet/tcp_hostcache.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netinet/tcp_hostcache.h Fri Nov 28 23:39:25 2008 (r185420) @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 2002 Andre Oppermann, Internet Business Solutions AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * Many thanks to jlemon for basic structure of tcp_syncache which is being + * followed here. + */ + +#ifndef _NETINET_TCP_HOSTCACHE_H_ +#define _NETINET_TCP_HOSTCACHE_H_ + +TAILQ_HEAD(hc_qhead, hc_metrics); + +struct hc_head { + struct hc_qhead hch_bucket; + u_int hch_length; + struct mtx hch_mtx; +}; + +struct hc_metrics { + /* housekeeping */ + TAILQ_ENTRY(hc_metrics) rmx_q; + struct hc_head *rmx_head; /* head of bucket tail queue */ + struct in_addr ip4; /* IP address */ + struct in6_addr ip6; /* IP6 address */ + /* endpoint specific values for tcp */ + u_long rmx_mtu; /* MTU for this path */ + u_long rmx_ssthresh; /* outbound gateway buffer limit */ + u_long rmx_rtt; /* estimated round trip time */ + u_long rmx_rttvar; /* estimated rtt variance */ + u_long rmx_bandwidth; /* estimated bandwidth */ + u_long rmx_cwnd; /* congestion window */ + u_long rmx_sendpipe; /* outbound delay-bandwidth product */ + u_long rmx_recvpipe; /* inbound delay-bandwidth product */ + /* TCP hostcache internal data */ + int rmx_expire; /* lifetime for object */ + u_long rmx_hits; /* number of hits */ + u_long rmx_updates; /* number of updates */ +}; + +struct tcp_hostcache { + struct hc_head *hashbase; + uma_zone_t zone; + u_int hashsize; + u_int hashmask; + u_int bucket_limit; + u_int cache_count; + u_int cache_limit; + int expire; + int prune; + int purgeall; +}; + +#endif /* !_NETINET_TCP_HOSTCACHE_H_*/ From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 23:44:13 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80DE51065673; Fri, 28 Nov 2008 23:44:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A3698FC13; Fri, 28 Nov 2008 23:44:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mASNiD3a033179; Fri, 28 Nov 2008 23:44:13 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mASNiDXB033178; Fri, 28 Nov 2008 23:44:13 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811282344.mASNiDXB033178@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Fri, 28 Nov 2008 23:44:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185421 - head/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 23:44:13 -0000 Author: bz Date: Fri Nov 28 23:44:13 2008 New Revision: 185421 URL: http://svn.freebsd.org/changeset/base/185421 Log: Renamed the FRAMELEN macro to TRUEPHY_FRAMELEN as for powerpc it seems to be possible to collide with FRAMELEN from machine/frame.h. Found by: zec Modified: head/sys/dev/mii/truephy.c Modified: head/sys/dev/mii/truephy.c ============================================================================== --- head/sys/dev/mii/truephy.c Fri Nov 28 23:39:25 2008 (r185420) +++ head/sys/dev/mii/truephy.c Fri Nov 28 23:44:13 2008 (r185421) @@ -57,7 +57,8 @@ #include "miibus_if.h" -#define FRAMELEN(mtu) (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + (mtu) + ETHER_CRC_LEN) +#define TRUEPHY_FRAMELEN(mtu) \ + (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + (mtu) + ETHER_CRC_LEN) static int truephy_service(struct mii_softc *, struct mii_data *, int); static int truephy_attach(device_t); @@ -298,7 +299,7 @@ truephy_reset(struct mii_softc *sc) mii_phy_reset(sc); - if (FRAMELEN(sc->mii_pdata->mii_ifp->if_mtu) > 2048) { + if (TRUEPHY_FRAMELEN(sc->mii_pdata->mii_ifp->if_mtu) > 2048) { int conf; conf = PHY_READ(sc, TRUEPHY_CONF); From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 02:28:06 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DB741065672; Sat, 29 Nov 2008 02:28:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34F218FC08; Sat, 29 Nov 2008 02:28:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAT2S6ff036291; Sat, 29 Nov 2008 02:28:06 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAT2S6jR036290; Sat, 29 Nov 2008 02:28:06 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811290228.mAT2S6jR036290@svn.freebsd.org> From: Warner Losh Date: Sat, 29 Nov 2008 02:28:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185422 - head/sbin/mount_msdosfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 02:28:06 -0000 Author: imp Date: Sat Nov 29 02:28:05 2008 New Revision: 185422 URL: http://svn.freebsd.org/changeset/base/185422 Log: Noticed the following error message: mount_msdosfs: /dev/cf0s1: : Operation not supported by device and thought I'd fix it to be: mount_msdosfs: /dev/cf0s1: Operation not supported by device Not sure why errmsg isn't getting filled in, or why this error is even happening at all... (fsck_msdosfs is clean, and I can mount this same CF elsewhere). Modified: head/sbin/mount_msdosfs/mount_msdosfs.c Modified: head/sbin/mount_msdosfs/mount_msdosfs.c ============================================================================== --- head/sbin/mount_msdosfs/mount_msdosfs.c Fri Nov 28 23:44:13 2008 (r185421) +++ head/sbin/mount_msdosfs/mount_msdosfs.c Sat Nov 29 02:28:05 2008 (r185422) @@ -218,8 +218,12 @@ main(int argc, char **argv) build_iovec_argf(&iov, &iovlen, "mask", "%u", mask); build_iovec_argf(&iov, &iovlen, "dirmask", "%u", dirmask); - if (nmount(iov, iovlen, mntflags) < 0) - err(1, "%s: %s", dev, errmsg); + if (nmount(iov, iovlen, mntflags) < 0) { + if (errmsg[0]) + err(1, "%s: %s", dev, errmsg); + else + err(1, "%s", dev); + } exit (0); } From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 03:17:30 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 201BF1065672; Sat, 29 Nov 2008 03:17:30 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 069E38FC17; Sat, 29 Nov 2008 03:17:30 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAT3HTvI037472; Sat, 29 Nov 2008 03:17:29 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAT3HTDc037471; Sat, 29 Nov 2008 03:17:29 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200811290317.mAT3HTDc037471@svn.freebsd.org> From: Tim Kientzle Date: Sat, 29 Nov 2008 03:17:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185423 - stable/7/sys/fs/cd9660 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 03:17:30 -0000 Author: kientzle Date: Sat Nov 29 03:17:29 2008 New Revision: 185423 URL: http://svn.freebsd.org/changeset/base/185423 Log: MFC r185361: timezone value is signed PR: kern/128934 Submitted by: J.R. Oldroyd Approved by: re Modified: stable/7/sys/fs/cd9660/cd9660_node.c Modified: stable/7/sys/fs/cd9660/cd9660_node.c ============================================================================== --- stable/7/sys/fs/cd9660/cd9660_node.c Sat Nov 29 02:28:05 2008 (r185422) +++ stable/7/sys/fs/cd9660/cd9660_node.c Sat Nov 29 03:17:29 2008 (r185423) @@ -242,7 +242,7 @@ cd9660_tstamp_conv7(pi,pu,ftype) minute = pi[4]; second = pi[5]; if(ftype != ISO_FTYPE_HIGH_SIERRA) - tz = pi[6]; + tz = ((signed char *)pi)[6]; /* Timezone value is signed. */ else /* original high sierra misses timezone data */ tz = 0; From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 03:21:26 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2ECF31065673; Sat, 29 Nov 2008 03:21:26 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15E588FC0A; Sat, 29 Nov 2008 03:21:26 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAT3LPr1037592; Sat, 29 Nov 2008 03:21:25 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAT3LPHk037591; Sat, 29 Nov 2008 03:21:25 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200811290321.mAT3LPHk037591@svn.freebsd.org> From: Tim Kientzle Date: Sat, 29 Nov 2008 03:21:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185424 - releng/7.1/sys/fs/cd9660 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 03:21:26 -0000 Author: kientzle Date: Sat Nov 29 03:21:25 2008 New Revision: 185424 URL: http://svn.freebsd.org/changeset/base/185424 Log: MFC r185361: Timezone value is signed. PR: kern/128934 Submitted by: J.R. Oldroyd Approved by: re Modified: releng/7.1/sys/fs/cd9660/cd9660_node.c Modified: releng/7.1/sys/fs/cd9660/cd9660_node.c ============================================================================== --- releng/7.1/sys/fs/cd9660/cd9660_node.c Sat Nov 29 03:17:29 2008 (r185423) +++ releng/7.1/sys/fs/cd9660/cd9660_node.c Sat Nov 29 03:21:25 2008 (r185424) @@ -242,7 +242,7 @@ cd9660_tstamp_conv7(pi,pu,ftype) minute = pi[4]; second = pi[5]; if(ftype != ISO_FTYPE_HIGH_SIERRA) - tz = pi[6]; + tz = ((signed char *)pi)[6]; /* Timezone value is signed. */ else /* original high sierra misses timezone data */ tz = 0; From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 05:08:50 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D91A1065670; Sat, 29 Nov 2008 05:08:50 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 03B1F8FC0A; Sat, 29 Nov 2008 05:08:50 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAT58n7c039680; Sat, 29 Nov 2008 05:08:49 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAT58nx1039679; Sat, 29 Nov 2008 05:08:49 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200811290508.mAT58nx1039679@svn.freebsd.org> From: Tim Kientzle Date: Sat, 29 Nov 2008 05:08:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185425 - releng/7.1/sys/fs/cd9660 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 05:08:50 -0000 Author: kientzle Date: Sat Nov 29 05:08:49 2008 New Revision: 185425 URL: http://svn.freebsd.org/changeset/base/185425 Log: MFC r185334: Recognize Rockridge extensions even when the IEEE-standard extension name (as standardized in 1994) is used. PR: kern/128942 Submitted by: J.R. Oldroyd Approved by: re Modified: releng/7.1/sys/fs/cd9660/cd9660_rrip.c Modified: releng/7.1/sys/fs/cd9660/cd9660_rrip.c ============================================================================== --- releng/7.1/sys/fs/cd9660/cd9660_rrip.c Sat Nov 29 03:21:25 2008 (r185424) +++ releng/7.1/sys/fs/cd9660/cd9660_rrip.c Sat Nov 29 05:08:49 2008 (r185425) @@ -467,8 +467,12 @@ cd9660_rrip_extref(p,ana) ISO_RRIP_EXTREF *p; ISO_RRIP_ANALYZE *ana; { - if (isonum_711(p->len_id) != 10 - || bcmp((char *)p + 8,"RRIP_1991A",10) + if ( ! ((isonum_711(p->len_id) == 10 + && bcmp((char *)p + 8,"RRIP_1991A",10) == 0) + || (isonum_711(p->len_id) == 10 + && bcmp((char *)p + 8,"IEEE_P1282",10) == 0) + || (isonum_711(p->len_id) == 9 + && bcmp((char *)p + 8,"IEEE_1282", 9) == 0)) || isonum_711(p->version) != 1) return 0; ana->fields &= ~ISO_SUSP_EXTREF; From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 05:10:30 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CFF31065679; Sat, 29 Nov 2008 05:10:30 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52E168FC13; Sat, 29 Nov 2008 05:10:30 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAT5AUDi039757; Sat, 29 Nov 2008 05:10:30 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAT5AUkb039756; Sat, 29 Nov 2008 05:10:30 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200811290510.mAT5AUkb039756@svn.freebsd.org> From: Tim Kientzle Date: Sat, 29 Nov 2008 05:10: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: r185426 - stable/7/sys/fs/cd9660 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 05:10:30 -0000 Author: kientzle Date: Sat Nov 29 05:10:30 2008 New Revision: 185426 URL: http://svn.freebsd.org/changeset/base/185426 Log: MFC r185334: Recognize Rockridge extensions even when the IEEE-standard extension name (as standardized in 1994) is used. PR: kern/128942 Submitted by: J.R. Oldroyd Approved by: re Modified: stable/7/sys/fs/cd9660/cd9660_rrip.c Modified: stable/7/sys/fs/cd9660/cd9660_rrip.c ============================================================================== --- stable/7/sys/fs/cd9660/cd9660_rrip.c Sat Nov 29 05:08:49 2008 (r185425) +++ stable/7/sys/fs/cd9660/cd9660_rrip.c Sat Nov 29 05:10:30 2008 (r185426) @@ -467,8 +467,12 @@ cd9660_rrip_extref(p,ana) ISO_RRIP_EXTREF *p; ISO_RRIP_ANALYZE *ana; { - if (isonum_711(p->len_id) != 10 - || bcmp((char *)p + 8,"RRIP_1991A",10) + if ( ! ((isonum_711(p->len_id) == 10 + && bcmp((char *)p + 8,"RRIP_1991A",10) == 0) + || (isonum_711(p->len_id) == 10 + && bcmp((char *)p + 8,"IEEE_P1282",10) == 0) + || (isonum_711(p->len_id) == 9 + && bcmp((char *)p + 8,"IEEE_1282", 9) == 0)) || isonum_711(p->version) != 1) return 0; ana->fields &= ~ISO_SUSP_EXTREF; From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 05:16:14 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9CEA106564A; Sat, 29 Nov 2008 05:16:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0BFF8FC14; Sat, 29 Nov 2008 05:16:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAT5GEph039899; Sat, 29 Nov 2008 05:16:14 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAT5GE2d039898; Sat, 29 Nov 2008 05:16:14 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811290516.mAT5GE2d039898@svn.freebsd.org> From: Warner Losh Date: Sat, 29 Nov 2008 05:16:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185427 - head/sys/mips/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 05:16:15 -0000 Author: imp Date: Sat Nov 29 05:16:14 2008 New Revision: 185427 URL: http://svn.freebsd.org/changeset/base/185427 Log: Unbreak mips build by taking first WAG at mb(), wmb() and rmb(). The latter two are likely pessimal... Modified: head/sys/mips/include/atomic.h Modified: head/sys/mips/include/atomic.h ============================================================================== --- head/sys/mips/include/atomic.h Sat Nov 29 05:10:30 2008 (r185426) +++ head/sys/mips/include/atomic.h Sat Nov 29 05:16:14 2008 (r185427) @@ -51,6 +51,10 @@ mips_sync(void) : : : "memory"); } +#define mb() mips_sync() +#define wmb() mips_sync() +#define rmb() mips_sync() + /* * Various simple arithmetic on memory which is atomic in the presence * of interrupts and SMP safe. From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 08:45:20 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF9251065676; Sat, 29 Nov 2008 08:45:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D58988FC12; Sat, 29 Nov 2008 08:45:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAT8jKQR043708; Sat, 29 Nov 2008 08:45:20 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAT8jKm8043707; Sat, 29 Nov 2008 08:45:20 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811290845.mAT8jKm8043707@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 29 Nov 2008 08:45:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185428 - head/sys/modules/powermac_nvram X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 08:45:21 -0000 Author: bz Date: Sat Nov 29 08:45:20 2008 New Revision: 185428 URL: http://svn.freebsd.org/changeset/base/185428 Log: make 'make universe' not complain about In file included from /src/sys/modules/powermac_nvram/../../dev/powermac_nvram/powermac_nvram.c:38: @/dev/ofw/ofw_bus.h:36:24: error: ofw_bus_if.h: No such file or directory I am not sure for how long this had not worked and if it was just the latest vimage commit that had revealed this or if nobody had built universe successfully in a while. Btw, the tinderbox did not complain either so that is probably the reason noone had noticed. Modified: head/sys/modules/powermac_nvram/Makefile Modified: head/sys/modules/powermac_nvram/Makefile ============================================================================== --- head/sys/modules/powermac_nvram/Makefile Sat Nov 29 05:16:14 2008 (r185427) +++ head/sys/modules/powermac_nvram/Makefile Sat Nov 29 08:45:20 2008 (r185428) @@ -5,5 +5,6 @@ KMOD= powermac_nvram SRCS= powermac_nvram.c powermac_nvramvar.h SRCS+= bus_if.h device_if.h +SRCS+= ofw_bus_if.h .include From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 12:32:42 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 931031065670; Sat, 29 Nov 2008 12:32:42 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8820D8FC08; Sat, 29 Nov 2008 12:32:42 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATCWgHQ051068; Sat, 29 Nov 2008 12:32:42 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATCWgY3051067; Sat, 29 Nov 2008 12:32:42 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811291232.mATCWgY3051067@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 29 Nov 2008 12:32:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185430 - head/sys/cddl/compat/opensolaris/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 12:32:42 -0000 Author: pjd Date: Sat Nov 29 12:32:42 2008 New Revision: 185430 URL: http://svn.freebsd.org/changeset/base/185430 Log: MFp4: Remove assertion that is no longer valid - we now use VOP_CLOSE() in more places (ie vdev_file.c). Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/vnode.h Sat Nov 29 12:08:41 2008 (r185429) +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Sat Nov 29 12:32:42 2008 (r185430) @@ -257,7 +257,6 @@ zfs_vop_close(vnode_t *vp, int flag, int { int error, vfslocked; - ASSERT(flag == (FWRITE | FCREAT | FTRUNC | FOFFMAX)); ASSERT(count == 1); ASSERT(offset == 0); From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 12:40:14 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A42EB106564A; Sat, 29 Nov 2008 12:40:14 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A3B68FC08; Sat, 29 Nov 2008 12:40:14 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATCeEmu051277; Sat, 29 Nov 2008 12:40:14 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATCeEd3051276; Sat, 29 Nov 2008 12:40:14 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200811291240.mATCeEd3051276@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 29 Nov 2008 12:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185431 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 12:40:14 -0000 Author: pjd Date: Sat Nov 29 12:40:14 2008 New Revision: 185431 URL: http://svn.freebsd.org/changeset/base/185431 Log: Improve KASSERT() call a bit: - Print flags in hex. - Note that flags can be fine and panic can be due unexpected error condition. - Remove redundant new line character. Eventhough panic message excess 80 characters keep it in one line so it is easier to grep. Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sat Nov 29 12:32:42 2008 (r185430) +++ head/sys/kern/vfs_vnops.c Sat Nov 29 12:40:14 2008 (r185431) @@ -881,7 +881,8 @@ _vn_lock(struct vnode *vp, int flags, ch error = VOP_LOCK1(vp, flags, file, line); flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ KASSERT((flags & LK_RETRY) == 0 || error == 0, - ("LK_RETRY set with incompatible flags %d\n", flags)); + ("LK_RETRY set with incompatible flags (0x%x) or an error occured (%d)", + flags, error)); /* * Callers specify LK_RETRY if they wish to get dead vnodes. * If RETRY is not set, we return ENOENT instead. From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 13:35:00 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B40A106564A; Sat, 29 Nov 2008 13:35: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 63C088FC0C; Sat, 29 Nov 2008 13:35:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATDZ0RF052367; Sat, 29 Nov 2008 13:35:00 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATDYxV4052363; Sat, 29 Nov 2008 13:34:59 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811291334.mATDYxV4052363@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 29 Nov 2008 13:34:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185432 - in head/sys: kern nfsserver sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 13:35:00 -0000 Author: kib Date: Sat Nov 29 13:34:59 2008 New Revision: 185432 URL: http://svn.freebsd.org/changeset/base/185432 Log: In the nfsrv_fhtovp(), after the vfs_getvfs() function found the pointer to the fs, but before a vnode on the fs is locked, unmount may free fs structures, causing access to destroyed data and freed memory. Introduce a vfs_busymp() function that looks up and busies found fs while mountlist_mtx is held. Use it in nfsrv_fhtovp() and in the implementation of the handle syscalls. Two other uses of the vfs_getvfs() in the vfs_subr.c, namely in sysctl_vfs_ctl and vfs_getnewfsid seems to be ok. In particular, sysctl_vfs_ctl is protected by Giant by being a non-sleeping sysctl handler, that prevents Giant-locked unmount code to interfere with it. Noted by: tegge Reviewed by: dfr Tested by: pho MFC after: 1 month Modified: head/sys/kern/vfs_subr.c head/sys/kern/vfs_syscalls.c head/sys/nfsserver/nfs_srvsubs.c head/sys/sys/mount.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sat Nov 29 12:40:14 2008 (r185431) +++ head/sys/kern/vfs_subr.c Sat Nov 29 13:34:59 2008 (r185432) @@ -407,6 +407,32 @@ vfs_getvfs(fsid_t *fsid) } /* + * Lookup a mount point by filesystem identifier, busying it before + * returning. + */ +struct mount * +vfs_busyfs(fsid_t *fsid) +{ + struct mount *mp; + int error; + + mtx_lock(&mountlist_mtx); + TAILQ_FOREACH(mp, &mountlist, mnt_list) { + if (mp->mnt_stat.f_fsid.val[0] == fsid->val[0] && + mp->mnt_stat.f_fsid.val[1] == fsid->val[1]) { + error = vfs_busy(mp, MBF_MNTLSTLOCK); + if (error) { + mtx_unlock(&mountlist_mtx); + return (NULL); + } + return (mp); + } + } + mtx_unlock(&mountlist_mtx); + return ((struct mount *) 0); +} + +/* * Check if a user can access privileged mount options. */ int Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sat Nov 29 12:40:14 2008 (r185431) +++ head/sys/kern/vfs_syscalls.c Sat Nov 29 13:34:59 2008 (r185432) @@ -4382,12 +4382,13 @@ fhopen(td, uap) if (error) return(error); /* find the mount point */ - mp = vfs_getvfs(&fhp.fh_fsid); + mp = vfs_busyfs(&fhp.fh_fsid); if (mp == NULL) return (ESTALE); vfslocked = VFS_LOCK_GIANT(mp); /* now give me my vnode, it gets returned to me locked */ error = VFS_FHTOVP(mp, &fhp.fh_fid, &vp); + vfs_unbusy(mp); if (error) goto out; /* @@ -4520,7 +4521,6 @@ fhopen(td, uap) bad: vput(vp); out: - vfs_rel(mp); VFS_UNLOCK_GIANT(vfslocked); return (error); } @@ -4555,17 +4555,17 @@ fhstat(td, uap) error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t)); if (error) return (error); - if ((mp = vfs_getvfs(&fh.fh_fsid)) == NULL) + if ((mp = vfs_busyfs(&fh.fh_fsid)) == NULL) return (ESTALE); vfslocked = VFS_LOCK_GIANT(mp); - if ((error = VFS_FHTOVP(mp, &fh.fh_fid, &vp))) { - vfs_rel(mp); + error = VFS_FHTOVP(mp, &fh.fh_fid, &vp); + vfs_unbusy(mp); + if (error) { VFS_UNLOCK_GIANT(vfslocked); return (error); } error = vn_stat(vp, &sb, td->td_ucred, NOCRED, td); vput(vp); - vfs_rel(mp); VFS_UNLOCK_GIANT(vfslocked); if (error) return (error); @@ -4615,13 +4615,13 @@ kern_fhstatfs(struct thread *td, fhandle error = priv_check(td, PRIV_VFS_FHSTATFS); if (error) return (error); - if ((mp = vfs_getvfs(&fh.fh_fsid)) == NULL) + if ((mp = vfs_busyfs(&fh.fh_fsid)) == NULL) return (ESTALE); vfslocked = VFS_LOCK_GIANT(mp); error = VFS_FHTOVP(mp, &fh.fh_fid, &vp); if (error) { + vfs_unbusy(mp); VFS_UNLOCK_GIANT(vfslocked); - vfs_rel(mp); return (error); } vput(vp); @@ -4644,7 +4644,7 @@ kern_fhstatfs(struct thread *td, fhandle if (error == 0) *buf = *sp; out: - vfs_rel(mp); + vfs_unbusy(mp); VFS_UNLOCK_GIANT(vfslocked); return (error); } Modified: head/sys/nfsserver/nfs_srvsubs.c ============================================================================== --- head/sys/nfsserver/nfs_srvsubs.c Sat Nov 29 12:40:14 2008 (r185431) +++ head/sys/nfsserver/nfs_srvsubs.c Sat Nov 29 13:34:59 2008 (r185432) @@ -1119,14 +1119,16 @@ nfsrv_fhtovp(fhandle_t *fhp, int lockfla fhp = &nfs_pub.np_handle; } - mp = vfs_getvfs(&fhp->fh_fsid); + mp = vfs_busyfs(&fhp->fh_fsid); if (!mp) return (ESTALE); vfslocked = VFS_LOCK_GIANT(mp); error = VFS_CHECKEXP(mp, nam, &exflags, &credanon, &numsecflavors, &secflavors); - if (error) + if (error) { + vfs_unbusy(mp); goto out; + } if (numsecflavors == 0) { /* * This can happen if the system is running with an @@ -1159,10 +1161,12 @@ nfsrv_fhtovp(fhandle_t *fhp, int lockfla } if (!mountreq) { error = NFSERR_AUTHERR | AUTH_TOOWEAK; + vfs_unbusy(mp); goto out; } } error = VFS_FHTOVP(mp, &fhp->fh_fid, vpp); + vfs_unbusy(mp); if (error) goto out; #ifdef MNT_EXNORESPORT @@ -1196,7 +1200,6 @@ nfsrv_fhtovp(fhandle_t *fhp, int lockfla if (!lockflag) VOP_UNLOCK(*vpp, 0); out: - vfs_rel(mp); if (error) { VFS_UNLOCK_GIANT(vfslocked); } else Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Sat Nov 29 12:40:14 2008 (r185431) +++ head/sys/sys/mount.h Sat Nov 29 13:34:59 2008 (r185432) @@ -717,6 +717,7 @@ int vfs_donmount(struct thread *td, int void vfs_getnewfsid(struct mount *); struct cdev *vfs_getrootfsid(struct mount *); struct mount *vfs_getvfs(fsid_t *); /* return vfs given fsid */ +struct mount *vfs_busyfs(fsid_t *); int vfs_modevent(module_t, int, void *); void vfs_mount_error(struct mount *, const char *, ...); void vfs_mountroot(void); /* mount our root filesystem */ From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 14:20:37 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09CFE1065673; Sat, 29 Nov 2008 14:20:37 +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 020658FC18; Sat, 29 Nov 2008 14:20:37 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATEKaCL053438; Sat, 29 Nov 2008 14:20:36 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATEKa6t053437; Sat, 29 Nov 2008 14:20:36 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200811291420.mATEKa6t053437@svn.freebsd.org> From: Rui Paulo Date: Sat, 29 Nov 2008 14:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185433 - head/sys/dev/asmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 14:20:37 -0000 Author: rpaulo Date: Sat Nov 29 14:20:36 2008 New Revision: 185433 URL: http://svn.freebsd.org/changeset/base/185433 Log: Check for non-existing model DMI string. Submitted by: ganbold Found with: Coverity Prevent(tm) CID: 2434 MFC after: 1 week Modified: head/sys/dev/asmc/asmc.c Modified: head/sys/dev/asmc/asmc.c ============================================================================== --- head/sys/dev/asmc/asmc.c Sat Nov 29 13:34:59 2008 (r185432) +++ head/sys/dev/asmc/asmc.c Sat Nov 29 14:20:36 2008 (r185433) @@ -254,6 +254,9 @@ asmc_match(device_t dev) char *model; model = getenv("smbios.system.product"); + if (model == NULL) + return (NULL); + for (i = 0; asmc_models[i].smc_model; i++) { if (!strncmp(model, asmc_models[i].smc_model, strlen(model))) { freeenv(model); From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 14:26:22 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 675721065670; Sat, 29 Nov 2008 14:26:22 +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 617A98FC08; Sat, 29 Nov 2008 14:26:22 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATEQMKE053592; Sat, 29 Nov 2008 14:26:22 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATEQMN2053591; Sat, 29 Nov 2008 14:26:22 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200811291426.mATEQMN2053591@svn.freebsd.org> From: Rui Paulo Date: Sat, 29 Nov 2008 14:26:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185434 - head/sys/dev/k8temp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 14:26:22 -0000 Author: rpaulo Date: Sat Nov 29 14:26:22 2008 New Revision: 185434 URL: http://svn.freebsd.org/changeset/base/185434 Log: Check the return value of config_intrhook_establish(). Found with: Coverity Prevent(tm) CID: 2115 Modified: head/sys/dev/k8temp/k8temp.c Modified: head/sys/dev/k8temp/k8temp.c ============================================================================== --- head/sys/dev/k8temp/k8temp.c Sat Nov 29 14:20:36 2008 (r185433) +++ head/sys/dev/k8temp/k8temp.c Sat Nov 29 14:26:22 2008 (r185434) @@ -187,7 +187,11 @@ k8temp_attach(device_t dev) */ sc->sc_ich.ich_func = k8temp_intrhook; sc->sc_ich.ich_arg = dev; - config_intrhook_establish(&sc->sc_ich); + if (config_intrhook_establish(&sc->sc_ich) != 0) { + device_printf(dev, "config_intrhook_establish " + "failed!\n"); + return (ENXIO); + } /* * dev.k8temp.N tree. From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 14:32:14 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BED061065670; Sat, 29 Nov 2008 14:32:14 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B48BC8FC16; Sat, 29 Nov 2008 14:32:14 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATEWEZU053754; Sat, 29 Nov 2008 14:32:14 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATEWE2a053742; Sat, 29 Nov 2008 14:32:14 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811291432.mATEWE2a053742@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 29 Nov 2008 14:32:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185435 - in head: lib/libc/sys lib/libkvm share/man/man4 sys/compat/freebsd32 sys/kern sys/net sys/netinet sys/netinet6 sys/security/mac_bsdextended sys/sys usr.bin/cpuset usr.sbin/jai... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 14:32:15 -0000 Author: bz Date: Sat Nov 29 14:32:14 2008 New Revision: 185435 URL: http://svn.freebsd.org/changeset/base/185435 Log: MFp4: Bring in updated jail support from bz_jail branch. This enhances the current jail implementation to permit multiple addresses per jail. In addtion to IPv4, IPv6 is supported as well. Due to updated checks it is even possible to have jails without an IP address at all, which basically gives one a chroot with restricted process view, no networking,.. SCTP support was updated and supports IPv6 in jails as well. Cpuset support permits jails to be bound to specific processor sets after creation. Jails can have an unrestricted (no duplicate protection, etc.) name in addition to the hostname. The jail name cannot be changed from within a jail and is considered to be used for management purposes or as audit-token in the future. DDB 'show jails' command was added to aid debugging. Proper compat support permits 32bit jail binaries to be used on 64bit systems to manage jails. Also backward compatibility was preserved where possible: for jail v1 syscalls, as well as with user space management utilities. Both jail as well as prison version were updated for the new features. A gap was intentionally left as the intermediate versions had been used by various patches floating around the last years. Bump __FreeBSD_version for the afore mentioned and in kernel changes. Special thanks to: - Pawel Jakub Dawidek (pjd) for his multi-IPv4 patches and Olivier Houchard (cognet) for initial single-IPv6 patches. - Jeff Roberson (jeff) and Randall Stewart (rrs) for their help, ideas and review on cpuset and SCTP support. - Robert Watson (rwatson) for lots and lots of help, discussions, suggestions and review of most of the patch at various stages. - John Baldwin (jhb) for his help. - Simon L. Nielsen (simon) as early adopter testing changes on cluster machines as well as all the testers and people who provided feedback the last months on freebsd-jail and other channels. - My employer, CK Software GmbH, for the support so I could work on this. Reviewed by: (see above) MFC after: 3 months (this is just so that I get the mail) X-MFC Before: 7.2-RELEASE if possible Modified: head/lib/libc/sys/cpuset_getaffinity.2 head/lib/libc/sys/jail.2 head/lib/libkvm/kvm_proc.c head/share/man/man4/ddb.4 head/sys/compat/freebsd32/freebsd32.h head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/syscalls.master head/sys/kern/kern_cpuset.c head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c head/sys/kern/kern_jail.c head/sys/kern/uipc_socket.c head/sys/net/if.c head/sys/net/rtsock.c head/sys/netinet/in_pcb.c head/sys/netinet/raw_ip.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_usrreq.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_src.c head/sys/netinet6/raw_ip6.c head/sys/netinet6/udp6_usrreq.c head/sys/security/mac_bsdextended/mac_bsdextended.c head/sys/sys/cpuset.h head/sys/sys/jail.h head/sys/sys/param.h head/usr.bin/cpuset/cpuset.1 head/usr.bin/cpuset/cpuset.c head/usr.sbin/jail/Makefile head/usr.sbin/jail/jail.8 head/usr.sbin/jail/jail.c head/usr.sbin/jexec/Makefile head/usr.sbin/jexec/jexec.8 head/usr.sbin/jexec/jexec.c head/usr.sbin/jls/Makefile head/usr.sbin/jls/jls.8 head/usr.sbin/jls/jls.c Modified: head/lib/libc/sys/cpuset_getaffinity.2 ============================================================================== --- head/lib/libc/sys/cpuset_getaffinity.2 Sat Nov 29 14:26:22 2008 (r185434) +++ head/lib/libc/sys/cpuset_getaffinity.2 Sat Nov 29 14:32:14 2008 (r185435) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 29, 2008 +.Dd November 29, 2008 .Dt CPUSET 2 .Os .Sh NAME @@ -46,7 +46,7 @@ and .Fn cpuset_setaffinity allow the manipulation of sets of CPUs available to processes, threads, -interrupts and other resources. +interrupts, jails and other resources. These functions may manipulate sets of CPUs that contain many processes or per-object anonymous masks that effect only a single object. .Pp Modified: head/lib/libc/sys/jail.2 ============================================================================== --- head/lib/libc/sys/jail.2 Sat Nov 29 14:26:22 2008 (r185434) +++ head/lib/libc/sys/jail.2 Sat Nov 29 14:32:14 2008 (r185435) @@ -8,7 +8,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 3, 2008 +.Dd November 29, 2008 .Dt JAIL 2 .Os .Sh NAME @@ -32,15 +32,20 @@ The argument is a pointer to a structure .Bd -literal -offset indent struct jail { u_int32_t version; - char *path; - char *hostname; - u_int32_t ip_number; + char *path; + char *hostname; + char *jailname; + unsigned int ip4s; + unsigned int ip6s; + struct in_addr *ip4; + struct in6_addr *ip6; }; .Ed .Pp .Dq Li version defines the version of the API in use. -It should be set to zero at this time. +.Dv JAIL_API_VERSION +is defined for the current version. .Pp The .Dq Li path @@ -54,8 +59,24 @@ This can be changed from the inside of the prison. .Pp The -.Dq Li ip_number -can be set to the IP number assigned to the prison. +.Dq Li jailname +pointer is an optional name that can be assigned to the jail +for example for managment purposes. +.Pp +The +.Dq Li ip4s +and +.Dq Li ip6s +give the numbers of IPv4 and IPv6 addresses that will be passed +via their respective pointers. +.Pp +The +.Dq Li ip4 +and +.Dq Li ip6 +pointers can be set to an arrays of IPv4 and IPv6 addresses to be assigned to +the prison, or NULL if none. +IPv4 addresses must be in network byte order. .Pp The .Fn jail_attach Modified: head/lib/libkvm/kvm_proc.c ============================================================================== --- head/lib/libkvm/kvm_proc.c Sat Nov 29 14:26:22 2008 (r185434) +++ head/lib/libkvm/kvm_proc.c Sat Nov 29 14:32:14 2008 (r185435) @@ -54,10 +54,11 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _WANT_PRISON /* make jail.h give us 'struct prison' */ -#include +#include #include #include +#define _WANT_PRISON /* make jail.h give us 'struct prison' */ +#include #include #include #include Modified: head/share/man/man4/ddb.4 ============================================================================== --- head/share/man/man4/ddb.4 Sat Nov 29 14:26:22 2008 (r185434) +++ head/share/man/man4/ddb.4 Sat Nov 29 14:32:14 2008 (r185435) @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 18, 2008 +.Dd November 29, 2008 .Dt DDB 4 .Os .Sh NAME @@ -686,6 +686,15 @@ Dump the interrupt statistics. Show interrupt lines and their respective kernel threads. .\" .Pp +.It Ic show Cm jails +Show the list of +.Xr jail 8 +instances. +In addition to what +.Xr jls 8 +shows, also list kernel internal details. +.\" +.Pp .It Ic show Cm lapic Show information from the local APIC registers for this CPU. .\" Modified: head/sys/compat/freebsd32/freebsd32.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32.h Sat Nov 29 14:26:22 2008 (r185434) +++ head/sys/compat/freebsd32/freebsd32.h Sat Nov 29 14:32:14 2008 (r185435) @@ -153,6 +153,24 @@ struct stat32 { unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32)); }; +struct jail32_v0 { + u_int32_t version; + uint32_t path; + uint32_t hostname; + u_int32_t ip_number; +}; + +struct jail32 { + uint32_t version; + uint32_t path; + uint32_t hostname; + uint32_t jailname; + uint32_t ip4s; + uint32_t ip6s; + uint32_t ip4; + uint32_t ip6; +}; + struct sigaction32 { u_int32_t sa_u; int sa_flags; Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Sat Nov 29 14:26:22 2008 (r185434) +++ head/sys/compat/freebsd32/freebsd32_misc.c Sat Nov 29 14:32:14 2008 (r185435) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2036,6 +2037,66 @@ done2: } int +freebsd32_jail(struct thread *td, struct freebsd32_jail_args *uap) +{ + uint32_t version; + int error; + struct jail j; + + error = copyin(uap->jail, &version, sizeof(uint32_t)); + if (error) + return (error); + switch (version) { + case 0: + { + /* FreeBSD single IPv4 jails. */ + struct jail32_v0 j32_v0; + + bzero(&j, sizeof(struct jail)); + error = copyin(uap->jail, &j32_v0, sizeof(struct jail32_v0)); + if (error) + return (error); + CP(j32_v0, j, version); + PTRIN_CP(j32_v0, j, path); + PTRIN_CP(j32_v0, j, hostname); + j.ip4s = j32_v0.ip_number; + break; + } + + case 1: + /* + * Version 1 was used by multi-IPv4 jail implementations + * that never made it into the official kernel. + */ + return (EINVAL); + + case 2: /* JAIL_API_VERSION */ + { + /* FreeBSD multi-IPv4/IPv6,noIP jails. */ + struct jail32 j32; + + error = copyin(uap->jail, &j32, sizeof(struct jail32)); + if (error) + return (error); + CP(j32, j, version); + PTRIN_CP(j32, j, path); + PTRIN_CP(j32, j, hostname); + PTRIN_CP(j32, j, jailname); + CP(j32, j, ip4s); + CP(j32, j, ip6s); + PTRIN_CP(j32, j, ip4); + PTRIN_CP(j32, j, ip6); + break; + } + + default: + /* Sci-Fi jails are not supported, sorry. */ + return (EINVAL); + } + return (kern_jail(td, &j)); +} + +int freebsd32_sigaction(struct thread *td, struct freebsd32_sigaction_args *uap) { struct sigaction32 s32; Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Sat Nov 29 14:26:22 2008 (r185434) +++ head/sys/compat/freebsd32/syscalls.master Sat Nov 29 14:32:14 2008 (r185435) @@ -572,7 +572,7 @@ off_t *sbytes, int flags); } 337 AUE_NULL NOPROTO { int kldsym(int fileid, int cmd, \ void *data); } -338 AUE_JAIL NOPROTO { int jail(struct jail *jail); } +338 AUE_JAIL STD { int freebsd32_jail(struct jail32 *jail); } 339 AUE_NULL UNIMPL pioctl 340 AUE_SIGPROCMASK NOPROTO { int sigprocmask(int how, \ const sigset_t *set, sigset_t *oset); } Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Sat Nov 29 14:26:22 2008 (r185434) +++ head/sys/kern/kern_cpuset.c Sat Nov 29 14:32:14 2008 (r185435) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* Must come after sys/proc.h */ #include @@ -208,7 +209,7 @@ cpuset_rel_complete(struct cpuset *set) * Find a set based on an id. Returns it with a ref. */ static struct cpuset * -cpuset_lookup(cpusetid_t setid) +cpuset_lookup(cpusetid_t setid, struct thread *td) { struct cpuset *set; @@ -221,6 +222,28 @@ cpuset_lookup(cpusetid_t setid) if (set) cpuset_ref(set); mtx_unlock_spin(&cpuset_lock); + + KASSERT(td != NULL, ("[%s:%d] td is NULL", __func__, __LINE__)); + if (set != NULL && jailed(td->td_ucred)) { + struct cpuset *rset, *jset; + struct prison *pr; + + rset = cpuset_refroot(set); + + pr = td->td_ucred->cr_prison; + mtx_lock(&pr->pr_mtx); + cpuset_ref(pr->pr_cpuset); + jset = pr->pr_cpuset; + mtx_unlock(&pr->pr_mtx); + + if (jset->cs_id != rset->cs_id) { + cpuset_rel(set); + set = NULL; + } + cpuset_rel(jset); + cpuset_rel(rset); + } + return (set); } @@ -412,12 +435,38 @@ cpuset_which(cpuwhich_t which, id_t id, set = cpuset_refbase(curthread->td_cpuset); thread_unlock(curthread); } else - set = cpuset_lookup(id); + set = cpuset_lookup(id, curthread); if (set) { *setp = set; return (0); } return (ESRCH); + case CPU_WHICH_JAIL: + { + /* Find `set' for prison with given id. */ + struct prison *pr; + + sx_slock(&allprison_lock); + pr = prison_find(id); + sx_sunlock(&allprison_lock); + if (pr == NULL) + return (ESRCH); + if (jailed(curthread->td_ucred)) { + if (curthread->td_ucred->cr_prison == pr) { + cpuset_ref(pr->pr_cpuset); + set = pr->pr_cpuset; + } + } else { + cpuset_ref(pr->pr_cpuset); + set = pr->pr_cpuset; + } + mtx_unlock(&pr->pr_mtx); + if (set) { + *setp = set; + return (0); + } + return (ESRCH); + } case CPU_WHICH_IRQ: return (0); default: @@ -664,6 +713,59 @@ cpuset_thread0(void) } /* + * Create a cpuset, which would be cpuset_create() but + * mark the new 'set' as root. + * + * We are not going to reparent the td to it. Use cpuset_reparentproc() for that. + * + * In case of no error, returns the set in *setp locked with a reference. + */ +int +cpuset_create_root(struct thread *td, struct cpuset **setp) +{ + struct cpuset *root; + struct cpuset *set; + int error; + + KASSERT(td != NULL, ("[%s:%d] invalid td", __func__, __LINE__)); + KASSERT(setp != NULL, ("[%s:%d] invalid setp", __func__, __LINE__)); + + thread_lock(td); + root = cpuset_refroot(td->td_cpuset); + thread_unlock(td); + + error = cpuset_create(setp, td->td_cpuset, &root->cs_mask); + cpuset_rel(root); + if (error) + return (error); + + KASSERT(*setp != NULL, ("[%s:%d] cpuset_create returned invalid data", + __func__, __LINE__)); + + /* Mark the set as root. */ + set = *setp; + set->cs_flags |= CPU_SET_ROOT; + + return (0); +} + +int +cpuset_setproc_update_set(struct proc *p, struct cpuset *set) +{ + int error; + + KASSERT(p != NULL, ("[%s:%d] invalid proc", __func__, __LINE__)); + KASSERT(set != NULL, ("[%s:%d] invalid set", __func__, __LINE__)); + + cpuset_ref(set); + error = cpuset_setproc(p->p_pid, set, NULL); + if (error) + return (error); + cpuset_rel(set); + return (0); +} + +/* * This is called once the final set of system cpus is known. Modifies * the root set and all children and mark the root readonly. */ @@ -728,7 +830,7 @@ cpuset_setid(struct thread *td, struct c */ if (uap->which != CPU_WHICH_PID) return (EINVAL); - set = cpuset_lookup(uap->setid); + set = cpuset_lookup(uap->setid, td); if (set == NULL) return (ESRCH); error = cpuset_setproc(uap->id, set, NULL); @@ -767,6 +869,7 @@ cpuset_getid(struct thread *td, struct c PROC_UNLOCK(p); break; case CPU_WHICH_CPUSET: + case CPU_WHICH_JAIL: break; case CPU_WHICH_IRQ: return (EINVAL); @@ -829,6 +932,7 @@ cpuset_getaffinity(struct thread *td, st thread_unlock(ttd); break; case CPU_WHICH_CPUSET: + case CPU_WHICH_JAIL: break; case CPU_WHICH_IRQ: error = EINVAL; @@ -856,6 +960,7 @@ cpuset_getaffinity(struct thread *td, st } break; case CPU_WHICH_CPUSET: + case CPU_WHICH_JAIL: CPU_COPY(&set->cs_mask, mask); break; case CPU_WHICH_IRQ: @@ -936,6 +1041,7 @@ cpuset_setaffinity(struct thread *td, st PROC_UNLOCK(p); break; case CPU_WHICH_CPUSET: + case CPU_WHICH_JAIL: break; case CPU_WHICH_IRQ: error = EINVAL; @@ -958,7 +1064,8 @@ cpuset_setaffinity(struct thread *td, st error = cpuset_setproc(uap->id, NULL, mask); break; case CPU_WHICH_CPUSET: - error = cpuset_which(CPU_WHICH_CPUSET, uap->id, &p, + case CPU_WHICH_JAIL: + error = cpuset_which(uap->which, uap->id, &p, &ttd, &set); if (error == 0) { error = cpuset_modify(set, mask); Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Sat Nov 29 14:26:22 2008 (r185434) +++ head/sys/kern/kern_exit.c Sat Nov 29 14:32:14 2008 (r185435) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -453,6 +454,10 @@ exit1(struct thread *td, int rv) p->p_xstat = rv; p->p_xthread = td; + /* In case we are jailed tell the prison that we are gone. */ + if (jailed(p->p_ucred)) + prison_proc_free(p->p_ucred->cr_prison); + #ifdef KDTRACE_HOOKS /* * Tell the DTrace fasttrap provider about the exit if it Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Sat Nov 29 14:26:22 2008 (r185434) +++ head/sys/kern/kern_fork.c Sat Nov 29 14:32:14 2008 (r185435) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -452,6 +453,11 @@ again: __rangeof(struct proc, p_startzero, p_endzero)); p2->p_ucred = crhold(td->td_ucred); + + /* In case we are jailed tell the prison that we exist. */ + if (jailed(p2->p_ucred)) + prison_proc_hold(p2->p_ucred->cr_prison); + PROC_UNLOCK(p2); /* Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Sat Nov 29 14:26:22 2008 (r185434) +++ head/sys/kern/kern_jail.c Sat Nov 29 14:32:14 2008 (r185435) @@ -1,5 +1,7 @@ /*- - * Copyright (c) 1999 Poul-Henning Kamp. All rights reserved. + * Copyright (c) 1999 Poul-Henning Kamp. + * Copyright (c) 2008 Bjoern A. Zeeb. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,6 +28,9 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ddb.h" +#include "opt_inet.h" +#include "opt_inet6.h" #include "opt_mac.h" #include @@ -54,6 +59,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef DDB +#include +#ifdef INET6 +#include +#endif /* INET6 */ +#endif /* DDB */ #include @@ -70,7 +81,7 @@ SYSCTL_INT(_security_jail, OID_AUTO, set int jail_socket_unixiproute_only = 1; SYSCTL_INT(_security_jail, OID_AUTO, socket_unixiproute_only, CTLFLAG_RW, &jail_socket_unixiproute_only, 0, - "Processes in jail are limited to creating UNIX/IPv4/route sockets only"); + "Processes in jail are limited to creating UNIX/IP/route sockets only"); int jail_sysvipc_allowed = 0; SYSCTL_INT(_security_jail, OID_AUTO, sysvipc_allowed, CTLFLAG_RW, @@ -97,6 +108,11 @@ SYSCTL_INT(_security_jail, OID_AUTO, mou &jail_mount_allowed, 0, "Processes in jail can mount/unmount jail-friendly file systems"); +int jail_max_af_ips = 255; +SYSCTL_INT(_security_jail, OID_AUTO, jail_max_af_ips, CTLFLAG_RW, + &jail_max_af_ips, 0, + "Number of IP addresses a jail may have at most per address family"); + /* allprison, lastprid, and prisoncount are protected by allprison_lock. */ struct prisonlist allprison; struct sx allprison_lock; @@ -106,6 +122,12 @@ int prisoncount = 0; static void init_prison(void *); static void prison_complete(void *context, int pending); static int sysctl_jail_list(SYSCTL_HANDLER_ARGS); +#ifdef INET +static int _prison_check_ip4(struct prison *, struct in_addr *); +#endif +#ifdef INET6 +static int _prison_check_ip6(struct prison *, struct in6_addr *); +#endif static void init_prison(void *data __unused) @@ -117,6 +139,276 @@ init_prison(void *data __unused) SYSINIT(prison, SI_SUB_INTRINSIC, SI_ORDER_ANY, init_prison, NULL); +#ifdef INET +static int +qcmp_v4(const void *ip1, const void *ip2) +{ + in_addr_t iaa, iab; + + /* + * We need to compare in HBO here to get the list sorted as expected + * by the result of the code. Sorting NBO addresses gives you + * interesting results. If you do not understand, do not try. + */ + iaa = ntohl(((const struct in_addr *)ip1)->s_addr); + iab = ntohl(((const struct in_addr *)ip2)->s_addr); + + /* + * Do not simply return the difference of the two numbers, the int is + * not wide enough. + */ + if (iaa > iab) + return (1); + else if (iaa < iab) + return (-1); + else + return (0); +} +#endif + +#ifdef INET6 +static int +qcmp_v6(const void *ip1, const void *ip2) +{ + const struct in6_addr *ia6a, *ia6b; + int i, rc; + + ia6a = (const struct in6_addr *)ip1; + ia6b = (const struct in6_addr *)ip2; + + rc = 0; + for (i=0; rc == 0 && i < sizeof(struct in6_addr); i++) { + if (ia6a->s6_addr[i] > ia6b->s6_addr[i]) + rc = 1; + else if (ia6a->s6_addr[i] < ia6b->s6_addr[i]) + rc = -1; + } + return (rc); +} +#endif + +#if defined(INET) || defined(INET6) +static int +prison_check_conflicting_ips(struct prison *p) +{ + struct prison *pr; + int i; + + sx_assert(&allprison_lock, SX_LOCKED); + + if (p->pr_ip4s == 0 && p->pr_ip6s == 0) + return (0); + + LIST_FOREACH(pr, &allprison, pr_list) { + /* + * Skip 'dying' prisons to avoid problems when + * restarting multi-IP jails. + */ + if (pr->pr_state == PRISON_STATE_DYING) + continue; + + /* + * We permit conflicting IPs if there is no + * more than 1 IP on eeach jail. + * In case there is one duplicate on a jail with + * more than one IP stop checking and return error. + */ +#ifdef INET + if ((p->pr_ip4s >= 1 && pr->pr_ip4s > 1) || + (p->pr_ip4s > 1 && pr->pr_ip4s >= 1)) { + for (i = 0; i < p->pr_ip4s; i++) { + if (_prison_check_ip4(pr, &p->pr_ip4[i])) + return (EINVAL); + } + } +#endif +#ifdef INET6 + if ((p->pr_ip6s >= 1 && pr->pr_ip6s > 1) || + (p->pr_ip6s > 1 && pr->pr_ip6s >= 1)) { + for (i = 0; i < p->pr_ip6s; i++) { + if (_prison_check_ip6(pr, &p->pr_ip6[i])) + return (EINVAL); + } + } +#endif + } + + return (0); +} + +static int +jail_copyin_ips(struct jail *j) +{ +#ifdef INET + struct in_addr *ip4; +#endif +#ifdef INET6 + struct in6_addr *ip6; +#endif + int error, i; + + /* + * Copy in addresses, check for duplicate addresses and do some + * simple 0 and broadcast checks. If users give other bogus addresses + * it is their problem. + * + * IP addresses are all sorted but ip[0] to preserve the primary IP + * address as given from userland. This special IP is used for + * unbound outgoing connections as well for "loopback" traffic. + */ +#ifdef INET + ip4 = NULL; +#endif +#ifdef INET6 + ip6 = NULL; +#endif +#ifdef INET + if (j->ip4s > 0) { + ip4 = (struct in_addr *)malloc(j->ip4s * sizeof(struct in_addr), + M_PRISON, M_WAITOK | M_ZERO); + error = copyin(j->ip4, ip4, j->ip4s * sizeof(struct in_addr)); + if (error) + goto e_free_ip; + /* Sort all but the first IPv4 address. */ + if (j->ip4s > 1) + qsort((ip4 + 1), j->ip4s - 1, + sizeof(struct in_addr), qcmp_v4); + + /* + * We do not have to care about byte order for these checks + * so we will do them in NBO. + */ + for (i=0; iip4s; i++) { + if (ip4[i].s_addr == htonl(INADDR_ANY) || + ip4[i].s_addr == htonl(INADDR_BROADCAST)) { + error = EINVAL; + goto e_free_ip; + } + if ((i+1) < j->ip4s && + (ip4[0].s_addr == ip4[i+1].s_addr || + ip4[i].s_addr == ip4[i+1].s_addr)) { + error = EINVAL; + goto e_free_ip; + } + } + + j->ip4 = ip4; + } +#endif +#ifdef INET6 + if (j->ip6s > 0) { + ip6 = (struct in6_addr *)malloc(j->ip6s * sizeof(struct in6_addr), + M_PRISON, M_WAITOK | M_ZERO); + error = copyin(j->ip6, ip6, j->ip6s * sizeof(struct in6_addr)); + if (error) + goto e_free_ip; + /* Sort all but the first IPv6 address. */ + if (j->ip6s > 1) + qsort((ip6 + 1), j->ip6s - 1, + sizeof(struct in6_addr), qcmp_v6); + for (i=0; iip6s; i++) { + if (IN6_IS_ADDR_UNSPECIFIED(&ip6[i])) { + error = EINVAL; + goto e_free_ip; + } + if ((i+1) < j->ip6s && + (IN6_ARE_ADDR_EQUAL(&ip6[0], &ip6[i+1]) || + IN6_ARE_ADDR_EQUAL(&ip6[i], &ip6[i+1]))) { + error = EINVAL; + goto e_free_ip; + } + } + + j->ip6 = ip6; + } +#endif + return (0); + +e_free_ip: +#ifdef INET6 + free(ip6, M_PRISON); +#endif +#ifdef INET + free(ip4, M_PRISON); +#endif + return (error); +} +#endif /* INET || INET6 */ + +static int +jail_handle_ips(struct jail *j) +{ +#if defined(INET) || defined(INET6) + int error; +#endif + + /* + * Finish conversion for older versions, copyin and setup IPs. + */ + switch (j->version) { + case 0: + { +#ifdef INET + /* FreeBSD single IPv4 jails. */ + struct in_addr *ip4; + + if (j->ip4s == INADDR_ANY || j->ip4s == INADDR_BROADCAST) + return (EINVAL); + ip4 = (struct in_addr *)malloc(sizeof(struct in_addr), + M_PRISON, M_WAITOK | M_ZERO); + + /* + * Jail version 0 still used HBO for the IPv4 address. + */ + ip4->s_addr = htonl(j->ip4s); + j->ip4s = 1; + j->ip4 = ip4; + break; +#else + return (EINVAL); +#endif + } + + case 1: + /* + * Version 1 was used by multi-IPv4 jail implementations + * that never made it into the official kernel. + * We should never hit this here; jail() should catch it. + */ + return (EINVAL); + + case 2: /* JAIL_API_VERSION */ + /* FreeBSD multi-IPv4/IPv6,noIP jails. */ +#if defined(INET) || defined(INET6) +#ifdef INET + if (j->ip4s > jail_max_af_ips) + return (EINVAL); +#else + if (j->ip4s != 0) + return (EINVAL); +#endif +#ifdef INET6 + if (j->ip6s > jail_max_af_ips) + return (EINVAL); +#else + if (j->ip6s != 0) + return (EINVAL); +#endif + error = jail_copyin_ips(j); + if (error) + return (error); +#endif + break; + + default: + /* Sci-Fi jails are not supported, sorry. */ + return (EINVAL); + } + + return (0); +} + + /* * struct jail_args { * struct jail *jail; @@ -125,22 +417,72 @@ SYSINIT(prison, SI_SUB_INTRINSIC, SI_ORD int jail(struct thread *td, struct jail_args *uap) { + uint32_t version; + int error; + struct jail j; + + error = copyin(uap->jail, &version, sizeof(uint32_t)); + if (error) + return (error); + + switch (version) { + case 0: + /* FreeBSD single IPv4 jails. */ + { + struct jail_v0 j0; + + bzero(&j, sizeof(struct jail)); + error = copyin(uap->jail, &j0, sizeof(struct jail_v0)); + if (error) + return (error); + j.version = j0.version; + j.path = j0.path; + j.hostname = j0.hostname; + j.ip4s = j0.ip_number; + break; + } + + case 1: + /* + * Version 1 was used by multi-IPv4 jail implementations + * that never made it into the official kernel. + */ + return (EINVAL); + + case 2: /* JAIL_API_VERSION */ + /* FreeBSD multi-IPv4/IPv6,noIP jails. */ + error = copyin(uap->jail, &j, sizeof(struct jail)); + if (error) + return (error); + break; + + default: + /* Sci-Fi jails are not supported, sorry. */ + return (EINVAL); + } + return (kern_jail(td, &j)); +} + +int +kern_jail(struct thread *td, struct jail *j) +{ struct nameidata nd; struct prison *pr, *tpr; - struct jail j; struct jail_attach_args jaa; int vfslocked, error, tryprid; - error = copyin(uap->jail, &j, sizeof(j)); + KASSERT(j != NULL, ("%s: j is NULL", __func__)); + + /* Handle addresses - convert old structs, copyin, check IPs. */ + error = jail_handle_ips(j); if (error) return (error); - if (j.version != 0) - return (EINVAL); + /* Allocate struct prison and fill it with life. */ pr = malloc(sizeof(*pr), M_PRISON, M_WAITOK | M_ZERO); mtx_init(&pr->pr_mtx, "jail mutex", NULL, MTX_DEF); pr->pr_ref = 1; - error = copyinstr(j.path, &pr->pr_path, sizeof(pr->pr_path), 0); + error = copyinstr(j->path, &pr->pr_path, sizeof(pr->pr_path), NULL); if (error) goto e_killmtx; NDINIT(&nd, LOOKUP, MPSAFE | FOLLOW | LOCKLEAF, UIO_SYSSPACE, @@ -153,16 +495,50 @@ jail(struct thread *td, struct jail_args VOP_UNLOCK(nd.ni_vp, 0); NDFREE(&nd, NDF_ONLY_PNBUF); VFS_UNLOCK_GIANT(vfslocked); - error = copyinstr(j.hostname, &pr->pr_host, sizeof(pr->pr_host), 0); + error = copyinstr(j->hostname, &pr->pr_host, sizeof(pr->pr_host), NULL); if (error) goto e_dropvnref; - pr->pr_ip = j.ip_number; + if (j->jailname != NULL) { + error = copyinstr(j->jailname, &pr->pr_name, + sizeof(pr->pr_name), NULL); + if (error) + goto e_dropvnref; + } + if (j->ip4s > 0) { + pr->pr_ip4 = j->ip4; + pr->pr_ip4s = j->ip4s; + } +#ifdef INET6 + if (j->ip6s > 0) { + pr->pr_ip6 = j->ip6; + pr->pr_ip6s = j->ip6s; + } +#endif pr->pr_linux = NULL; pr->pr_securelevel = securelevel; bzero(&pr->pr_osd, sizeof(pr->pr_osd)); - /* Determine next pr_id and add prison to allprison list. */ + /* + * Pre-set prison state to ALIVE upon cration. This is needed so we + * can later attach the process to it, etc (avoiding another extra + * state for ther process of creation, complicating things). + */ + pr->pr_state = PRISON_STATE_ALIVE; + + /* Allocate a dedicated cpuset for each jail. */ + error = cpuset_create_root(td, &pr->pr_cpuset); + if (error) + goto e_dropvnref; + sx_xlock(&allprison_lock); + /* Make sure we cannot run into problems with ambiguous bind()ings. */ + error = prison_check_conflicting_ips(pr); + if (error) { + sx_xunlock(&allprison_lock); + goto e_dropcpuset; + } + + /* Determine next pr_id and add prison to allprison list. */ tryprid = lastprid + 1; if (tryprid == JAIL_MAX) tryprid = 1; @@ -173,7 +549,7 @@ next: if (tryprid == JAIL_MAX) { sx_xunlock(&allprison_lock); error = EAGAIN; - goto e_dropvnref; + goto e_dropcpuset; } goto next; } @@ -196,6 +572,8 @@ e_dropprref: LIST_REMOVE(pr, pr_list); prisoncount--; sx_xunlock(&allprison_lock); +e_dropcpuset: + cpuset_rel(pr->pr_cpuset); e_dropvnref: vfslocked = VFS_LOCK_GIANT(pr->pr_root->v_mount); vrele(pr->pr_root); @@ -203,6 +581,12 @@ e_dropvnref: e_killmtx: mtx_destroy(&pr->pr_mtx); free(pr, M_PRISON); +#ifdef INET6 + free(j->ip6, M_PRISON); +#endif +#ifdef INET + free(j->ip4, M_PRISON); +#endif return (error); } @@ -238,10 +622,27 @@ jail_attach(struct thread *td, struct ja sx_sunlock(&allprison_lock); return (EINVAL); } + + /* + * Do not allow a process to attach to a prison that is not + * considered to be "ALIVE". + */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 14:34:30 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A7EA106564A; Sat, 29 Nov 2008 14:34:30 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 642148FC13; Sat, 29 Nov 2008 14:34:30 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATEYUJM053851; Sat, 29 Nov 2008 14:34:30 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATEYUxi053847; Sat, 29 Nov 2008 14:34:30 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811291434.mATEYUxi053847@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 29 Nov 2008 14:34:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185436 - head/sys/compat/freebsd32 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 14:34:30 -0000 Author: bz Date: Sat Nov 29 14:34:30 2008 New Revision: 185436 URL: http://svn.freebsd.org/changeset/base/185436 Log: Regen after jail support was added in r185435. Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Sat Nov 29 14:32:14 2008 (r185435) +++ head/sys/compat/freebsd32/freebsd32_proto.h Sat Nov 29 14:34:30 2008 (r185436) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 184789 2008-11-09 10:45:13Z ed + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185435 2008-11-29 14:32:14Z bz */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -235,6 +235,9 @@ struct freebsd32_modstat_args { char modid_l_[PADL_(int)]; int modid; char modid_r_[PADR_(int)]; char stat_l_[PADL_(struct module_stat32 *)]; struct module_stat32 * stat; char stat_r_[PADR_(struct module_stat32 *)]; }; +struct freebsd32_jail_args { + char jail_l_[PADL_(struct jail32 *)]; struct jail32 * jail; char jail_r_[PADR_(struct jail32 *)]; +}; struct freebsd32_sigtimedwait_args { char set_l_[PADL_(const sigset_t *)]; const sigset_t * set; char set_r_[PADR_(const sigset_t *)]; char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)]; @@ -428,6 +431,7 @@ int freebsd32_lutimes(struct thread *, s int freebsd32_preadv(struct thread *, struct freebsd32_preadv_args *); int freebsd32_pwritev(struct thread *, struct freebsd32_pwritev_args *); int freebsd32_modstat(struct thread *, struct freebsd32_modstat_args *); +int freebsd32_jail(struct thread *, struct freebsd32_jail_args *); int freebsd32_sigtimedwait(struct thread *, struct freebsd32_sigtimedwait_args *); int freebsd32_sigwaitinfo(struct thread *, struct freebsd32_sigwaitinfo_args *); int freebsd32_kevent(struct thread *, struct freebsd32_kevent_args *); @@ -641,6 +645,7 @@ int freebsd6_freebsd32_ftruncate(struct #define FREEBSD32_SYS_AUE_freebsd32_preadv AUE_PREADV #define FREEBSD32_SYS_AUE_freebsd32_pwritev AUE_PWRITEV #define FREEBSD32_SYS_AUE_freebsd32_modstat AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_jail AUE_JAIL #define FREEBSD32_SYS_AUE_freebsd32_sigtimedwait AUE_SIGWAIT #define FREEBSD32_SYS_AUE_freebsd32_sigwaitinfo AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_kevent AUE_NULL Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Sat Nov 29 14:32:14 2008 (r185435) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Sat Nov 29 14:34:30 2008 (r185436) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 184789 2008-11-09 10:45:13Z ed + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185435 2008-11-29 14:32:14Z bz */ #define FREEBSD32_SYS_syscall 0 @@ -254,7 +254,7 @@ #define FREEBSD32_SYS_utrace 335 #define FREEBSD32_SYS_freebsd4_freebsd32_sendfile 336 #define FREEBSD32_SYS_kldsym 337 -#define FREEBSD32_SYS_jail 338 +#define FREEBSD32_SYS_freebsd32_jail 338 #define FREEBSD32_SYS_sigprocmask 340 #define FREEBSD32_SYS_sigsuspend 341 #define FREEBSD32_SYS_freebsd4_freebsd32_sigaction 342 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Sat Nov 29 14:32:14 2008 (r185435) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Sat Nov 29 14:34:30 2008 (r185436) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 184789 2008-11-09 10:45:13Z ed + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185435 2008-11-29 14:32:14Z bz */ const char *freebsd32_syscallnames[] = { @@ -345,7 +345,7 @@ const char *freebsd32_syscallnames[] = { "utrace", /* 335 = utrace */ "compat4.freebsd32_sendfile", /* 336 = old freebsd32_sendfile */ "kldsym", /* 337 = kldsym */ - "jail", /* 338 = jail */ + "freebsd32_jail", /* 338 = freebsd32_jail */ "#339", /* 339 = pioctl */ "sigprocmask", /* 340 = sigprocmask */ "sigsuspend", /* 341 = sigsuspend */ Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Sat Nov 29 14:32:14 2008 (r185435) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Sat Nov 29 14:34:30 2008 (r185436) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 184789 2008-11-09 10:45:13Z ed + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 185435 2008-11-29 14:32:14Z bz */ #include "opt_compat.h" @@ -376,7 +376,7 @@ struct sysent freebsd32_sysent[] = { { AS(utrace_args), (sy_call_t *)utrace, AUE_NULL, NULL, 0, 0 }, /* 335 = utrace */ { compat4(AS(freebsd4_freebsd32_sendfile_args),freebsd32_sendfile), AUE_SENDFILE, NULL, 0, 0 }, /* 336 = old freebsd32_sendfile */ { AS(kldsym_args), (sy_call_t *)kldsym, AUE_NULL, NULL, 0, 0 }, /* 337 = kldsym */ - { AS(jail_args), (sy_call_t *)jail, AUE_JAIL, NULL, 0, 0 }, /* 338 = jail */ + { AS(freebsd32_jail_args), (sy_call_t *)freebsd32_jail, AUE_JAIL, NULL, 0, 0 }, /* 338 = freebsd32_jail */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 339 = pioctl */ { AS(sigprocmask_args), (sy_call_t *)sigprocmask, AUE_SIGPROCMASK, NULL, 0, 0 }, /* 340 = sigprocmask */ { AS(sigsuspend_args), (sy_call_t *)sigsuspend, AUE_SIGSUSPEND, NULL, 0, 0 }, /* 341 = sigsuspend */ From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 14:49:57 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10CC21065672; Sat, 29 Nov 2008 14:49:57 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C7EEE8FC13; Sat, 29 Nov 2008 14:49:56 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATEnuUU054183; Sat, 29 Nov 2008 14:49:56 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATEnuIG054182; Sat, 29 Nov 2008 14:49:56 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200811291449.mATEnuIG054182@svn.freebsd.org> From: Robert Watson Date: Sat, 29 Nov 2008 14:49: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: r185437 - in stable/7/contrib/smbfs: . lib/smb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 14:49:57 -0000 Author: rwatson Date: Sat Nov 29 14:49:56 2008 New Revision: 185437 URL: http://svn.freebsd.org/changeset/base/185437 Log: Merge r184567 from head to stable/7: When encoding an smb name, truncate one byte earlier in order than we did previously in order to ensure it fit properly in the bufer when encoded. This prevents a debugging printf from firing if a source or destination host name for an smb mount exceeds 15 characters. Obtained from: Apple, Inc. Approved by: re (kensmith) Modified: stable/7/contrib/smbfs/ (props changed) stable/7/contrib/smbfs/lib/smb/nb_name.c Modified: stable/7/contrib/smbfs/lib/smb/nb_name.c ============================================================================== --- stable/7/contrib/smbfs/lib/smb/nb_name.c Sat Nov 29 14:34:30 2008 (r185436) +++ stable/7/contrib/smbfs/lib/smb/nb_name.c Sat Nov 29 14:49:56 2008 (r185437) @@ -169,7 +169,7 @@ nb_name_encode(struct nb_name *np, u_cha memsetw(cp + 2, NB_NAMELEN - 1, NBENCODE(' ')); cp += NB_ENCNAMELEN; } else { - for (i = 0; *name && i < NB_NAMELEN; i++, cp += 2, name++) + for (i = 0; *name && i < NB_NAMELEN - 1; i++, cp += 2, name++) *(u_short*)cp = NBENCODE(toupper(*name)); i = NB_NAMELEN - i - 1; if (i > 0) { From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 14:55:25 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E9B0106564A; Sat, 29 Nov 2008 14:55:25 +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 3851A8FC14; Sat, 29 Nov 2008 14:55:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATEtOm2054354; Sat, 29 Nov 2008 14:55:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATEtOpD054351; Sat, 29 Nov 2008 14:55:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811291455.mATEtOpD054351@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 29 Nov 2008 14:55:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185438 - head/sys/amd64/linux32 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 14:55:25 -0000 Author: kib Date: Sat Nov 29 14:55:24 2008 New Revision: 185438 URL: http://svn.freebsd.org/changeset/base/185438 Log: Fix iovec32 for linux32/amd64. Add a custom version of copyiniov() to deal with the 32-bit iovec pointers from userland (to be used later). Adjust prototypes for linux_readv() and linux_writev() to use new l_iovec32 definition and to match actual linux code. In particular, use ulong for fd (why ?). Submitted by: dchagin Modified: head/sys/amd64/linux32/linux.h head/sys/amd64/linux32/linux32_machdep.c head/sys/amd64/linux32/syscalls.master Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Sat Nov 29 14:49:56 2008 (r185437) +++ head/sys/amd64/linux32/linux.h Sat Nov 29 14:55:24 2008 (r185438) @@ -885,6 +885,16 @@ struct l_user_desc { (LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES | \ LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD) +struct iovec; + +struct l_iovec32 { + uint32_t iov_base; + l_size_t iov_len; +}; + +int linux32_copyiniov(struct l_iovec32 *iovp32, l_ulong iovcnt, + struct iovec **iovp, int error); + /* robust futexes */ struct linux_robust_list { l_uintptr_t next; Modified: head/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- head/sys/amd64/linux32/linux32_machdep.c Sat Nov 29 14:49:56 2008 (r185437) +++ head/sys/amd64/linux32/linux32_machdep.c Sat Nov 29 14:55:24 2008 (r185438) @@ -232,20 +232,15 @@ linux_execve(struct thread *td, struct l return (error); } -struct iovec32 { - u_int32_t iov_base; - int iov_len; -}; - -CTASSERT(sizeof(struct iovec32) == 8); +CTASSERT(sizeof(struct l_iovec32) == 8); static int -linux32_copyinuio(struct iovec32 *iovp, u_int iovcnt, struct uio **uiop) +linux32_copyinuio(struct l_iovec32 *iovp, l_ulong iovcnt, struct uio **uiop) { - struct iovec32 iov32; + struct l_iovec32 iov32; struct iovec *iov; struct uio *uio; - u_int iovlen; + uint32_t iovlen; int error, i; *uiop = NULL; @@ -255,7 +250,7 @@ linux32_copyinuio(struct iovec32 *iovp, uio = malloc(iovlen + sizeof(*uio), M_IOV, M_WAITOK); iov = (struct iovec *)(uio + 1); for (i = 0; i < iovcnt; i++) { - error = copyin(&iovp[i], &iov32, sizeof(struct iovec32)); + error = copyin(&iovp[i], &iov32, sizeof(struct l_iovec32)); if (error) { free(uio, M_IOV); return (error); @@ -281,6 +276,34 @@ linux32_copyinuio(struct iovec32 *iovp, } int +linux32_copyiniov(struct l_iovec32 *iovp32, l_ulong iovcnt, struct iovec **iovp, + int error) +{ + struct l_iovec32 iov32; + struct iovec *iov; + uint32_t iovlen; + int i; + + *iovp = NULL; + if (iovcnt > UIO_MAXIOV) + return (error); + iovlen = iovcnt * sizeof(struct iovec); + iov = malloc(iovlen, M_IOV, M_WAITOK); + for (i = 0; i < iovcnt; i++) { + error = copyin(&iovp32[i], &iov32, sizeof(struct l_iovec32)); + if (error) { + free(iov, M_IOV); + return (error); + } + iov[i].iov_base = PTRIN(iov32.iov_base); + iov[i].iov_len = iov32.iov_len; + } + *iovp = iov; + return(0); + +} + +int linux_readv(struct thread *td, struct linux_readv_args *uap) { struct uio *auio; Modified: head/sys/amd64/linux32/syscalls.master ============================================================================== --- head/sys/amd64/linux32/syscalls.master Sat Nov 29 14:49:56 2008 (r185437) +++ head/sys/amd64/linux32/syscalls.master Sat Nov 29 14:55:24 2008 (r185438) @@ -252,10 +252,10 @@ 143 AUE_FLOCK NOPROTO { int flock(int fd, int how); } 144 AUE_MSYNC STD { int linux_msync(l_ulong addr, \ l_size_t len, l_int fl); } -145 AUE_READV STD { int linux_readv(int fd, struct iovec32 *iovp, \ - u_int iovcnt); } -146 AUE_WRITEV STD { int linux_writev(int fd, struct iovec32 *iovp, \ - u_int iovcnt); } +145 AUE_READV STD { int linux_readv(l_ulong fd, struct l_iovec32 *iovp, \ + l_ulong iovcnt); } +146 AUE_WRITEV STD { int linux_writev(l_ulong fd, struct l_iovec32 *iovp, \ + l_ulong iovcnt); } 147 AUE_GETSID STD { int linux_getsid(l_pid_t pid); } 148 AUE_NULL STD { int linux_fdatasync(l_uint fd); } 149 AUE_SYSCTL STD { int linux_sysctl( \ From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 14:57:59 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03D3C1065675; Sat, 29 Nov 2008 14:57:59 +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 F1E038FC18; Sat, 29 Nov 2008 14:57:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATEvwwX054445; Sat, 29 Nov 2008 14:57:58 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATEvwng054442; Sat, 29 Nov 2008 14:57:58 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811291457.mATEvwng054442@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 29 Nov 2008 14:57:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185439 - head/sys/amd64/linux32 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 14:57:59 -0000 Author: kib Date: Sat Nov 29 14:57:58 2008 New Revision: 185439 URL: http://svn.freebsd.org/changeset/base/185439 Log: Regenerate Modified: head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_syscall.h head/sys/amd64/linux32/linux32_sysent.c Modified: head/sys/amd64/linux32/linux32_proto.h ============================================================================== --- head/sys/amd64/linux32/linux32_proto.h Sat Nov 29 14:55:24 2008 (r185438) +++ head/sys/amd64/linux32/linux32_proto.h Sat Nov 29 14:57:58 2008 (r185439) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 184789 2008-11-09 10:45:13Z ed + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 185438 2008-11-29 14:55:24Z kib */ #ifndef _LINUX_SYSPROTO_H_ @@ -455,14 +455,14 @@ struct linux_msync_args { char fl_l_[PADL_(l_int)]; l_int fl; char fl_r_[PADR_(l_int)]; }; struct linux_readv_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)]; - char iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)]; + char fd_l_[PADL_(l_ulong)]; l_ulong fd; char fd_r_[PADR_(l_ulong)]; + char iovp_l_[PADL_(struct l_iovec32 *)]; struct l_iovec32 * iovp; char iovp_r_[PADR_(struct l_iovec32 *)]; + char iovcnt_l_[PADL_(l_ulong)]; l_ulong iovcnt; char iovcnt_r_[PADR_(l_ulong)]; }; struct linux_writev_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)]; - char iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)]; + char fd_l_[PADL_(l_ulong)]; l_ulong fd; char fd_r_[PADR_(l_ulong)]; + char iovp_l_[PADL_(struct l_iovec32 *)]; struct l_iovec32 * iovp; char iovp_r_[PADR_(struct l_iovec32 *)]; + char iovcnt_l_[PADL_(l_ulong)]; l_ulong iovcnt; char iovcnt_r_[PADR_(l_ulong)]; }; struct linux_getsid_args { char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; Modified: head/sys/amd64/linux32/linux32_syscall.h ============================================================================== --- head/sys/amd64/linux32/linux32_syscall.h Sat Nov 29 14:55:24 2008 (r185438) +++ head/sys/amd64/linux32/linux32_syscall.h Sat Nov 29 14:57:58 2008 (r185439) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 184789 2008-11-09 10:45:13Z ed + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 185438 2008-11-29 14:55:24Z kib */ #define LINUX_SYS_exit 1 Modified: head/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysent.c Sat Nov 29 14:55:24 2008 (r185438) +++ head/sys/amd64/linux32/linux32_sysent.c Sat Nov 29 14:57:58 2008 (r185439) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 184789 2008-11-09 10:45:13Z ed + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 185438 2008-11-29 14:55:24Z kib */ #include "opt_compat.h" From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 14:58:59 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14B8B1065672; Sat, 29 Nov 2008 14:58:59 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DFAF8FC17; Sat, 29 Nov 2008 14:58:59 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATEwxTm054505; Sat, 29 Nov 2008 14:58:59 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATEwx32054504; Sat, 29 Nov 2008 14:58:59 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200811291458.mATEwx32054504@svn.freebsd.org> From: Robert Watson Date: Sat, 29 Nov 2008 14:58:59 +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: r185440 - stable/7/sys/security/mac_bsdextended X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 14:58:59 -0000 Author: rwatson Date: Sat Nov 29 14:58:58 2008 New Revision: 185440 URL: http://svn.freebsd.org/changeset/base/185440 Log: Merge r184367 from head to stable/7: When the mac_bsdextended policy is unloaded, free rule memory. Obtained from: TrustedBSD Project Approved by: re (kensmith) Modified: stable/7/sys/security/mac_bsdextended/mac_bsdextended.c Modified: stable/7/sys/security/mac_bsdextended/mac_bsdextended.c ============================================================================== --- stable/7/sys/security/mac_bsdextended/mac_bsdextended.c Sat Nov 29 14:57:58 2008 (r185439) +++ stable/7/sys/security/mac_bsdextended/mac_bsdextended.c Sat Nov 29 14:58:58 2008 (r185440) @@ -208,7 +208,12 @@ ugidfw_init(struct mac_policy_conf *mpc) static void ugidfw_destroy(struct mac_policy_conf *mpc) { + int i; + for (i = 0; i < MAC_BSDEXTENDED_MAXRULES; i++) { + if (rules[i] != NULL) + free(rules[i], M_MACBSDEXTENDED); + } mtx_destroy(&ugidfw_mtx); } From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 16:17:39 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A86211065670; Sat, 29 Nov 2008 16:17:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A2F6C8FC16; Sat, 29 Nov 2008 16:17:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATGHdB4056139; Sat, 29 Nov 2008 16:17:39 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATGHdrp056138; Sat, 29 Nov 2008 16:17:39 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811291617.mATGHdrp056138@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 29 Nov 2008 16:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185441 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 16:17:39 -0000 Author: bz Date: Sat Nov 29 16:17:39 2008 New Revision: 185441 URL: http://svn.freebsd.org/changeset/base/185441 Log: Unbreak the no-networks (no INET/6) build that I broke with the commit in r185435. Pointyhat: no, but I could need a ski cap for the winter Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Sat Nov 29 14:58:58 2008 (r185440) +++ head/sys/kern/kern_jail.c Sat Nov 29 16:17:39 2008 (r185441) @@ -532,11 +532,13 @@ kern_jail(struct thread *td, struct jail sx_xlock(&allprison_lock); /* Make sure we cannot run into problems with ambiguous bind()ings. */ +#if defined(INET) || defined(INET6) error = prison_check_conflicting_ips(pr); if (error) { sx_xunlock(&allprison_lock); goto e_dropcpuset; } +#endif /* Determine next pr_id and add prison to allprison list. */ tryprid = lastprid + 1; From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 17:08:05 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05BB01065677; Sat, 29 Nov 2008 17:08:05 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from publicd.ub.mng.net (publicd.ub.mng.net [202.179.0.88]) by mx1.freebsd.org (Postfix) with ESMTP id B32458FC23; Sat, 29 Nov 2008 17:08:04 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from [202.179.21.130] (helo=devil.micom.mng.net) by publicd.ub.mng.net with esmtpa (Exim 4.69 (FreeBSD)) (envelope-from ) id 1L6TIY-000NVi-GP; Sun, 30 Nov 2008 01:08:02 +0800 Message-ID: <493176F1.5070805@micom.mng.net> Date: Sun, 30 Nov 2008 01:08:01 +0800 From: Ganbold User-Agent: Thunderbird 2.0.0.17 (X11/20081020) MIME-Version: 1.0 To: Rui Paulo References: <200811291420.mATEKa6t053437@svn.freebsd.org> In-Reply-To: <200811291420.mATEKa6t053437@svn.freebsd.org> X-Enigmail-Version: 0.95.7 OpenPGP: id=78F6425E Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185433 - head/sys/dev/asmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 17:08:05 -0000 Rui Paulo wrote: > Author: rpaulo > Date: Sat Nov 29 14:20:36 2008 > New Revision: 185433 > URL: http://svn.freebsd.org/changeset/base/185433 > > Log: > Check for non-existing model DMI string. > > Submitted by: ganbold > Found with: Coverity Prevent(tm) > CID: 2434 > MFC after: 1 week > > Modified: > head/sys/dev/asmc/asmc.c > > Modified: head/sys/dev/asmc/asmc.c > ============================================================================== > --- head/sys/dev/asmc/asmc.c Sat Nov 29 13:34:59 2008 (r185432) > +++ head/sys/dev/asmc/asmc.c Sat Nov 29 14:20:36 2008 (r185433) > @@ -254,6 +254,9 @@ asmc_match(device_t dev) > char *model; > > model = getenv("smbios.system.product"); > + if (model == NULL) > + return (NULL); > + > for (i = 0; asmc_models[i].smc_model; i++) { > if (!strncmp(model, asmc_models[i].smc_model, strlen(model))) { > freeenv(model); > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > > > > Thank you. Ganbold -- When a girl can read the handwriting on the wall, she may be in the wrong rest room. From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 17:14:07 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 167C2106564A; Sat, 29 Nov 2008 17:14:07 +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 096468FC08; Sat, 29 Nov 2008 17:14:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATHE69X057378; Sat, 29 Nov 2008 17:14:06 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATHE601057374; Sat, 29 Nov 2008 17:14:06 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811291714.mATHE601057374@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 29 Nov 2008 17:14:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185442 - in head/sys: amd64/linux32 compat/linux i386/linux X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 17:14:07 -0000 Author: kib Date: Sat Nov 29 17:14:06 2008 New Revision: 185442 URL: http://svn.freebsd.org/changeset/base/185442 Log: Make linux_sendmsg() and linux_recvmsg() work on linux32/amd64. Change types used in the linux' struct msghdr and struct cmsghdr definitions to the properly-sized architecture-specific types. Move ancillary data handler from linux_sendit() to linux_sendmsg(). Submitted by: dchagin Modified: head/sys/amd64/linux32/linux.h head/sys/compat/linux/linux_socket.c head/sys/compat/linux/linux_socket.h head/sys/i386/linux/linux.h Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Sat Nov 29 16:17:39 2008 (r185441) +++ head/sys/amd64/linux32/linux.h Sat Nov 29 17:14:06 2008 (r185442) @@ -717,6 +717,22 @@ struct l_sockaddr { char sa_data[14]; } __packed; +struct l_msghdr { + l_uintptr_t msg_name; + l_int msg_namelen; + l_uintptr_t msg_iov; + l_size_t msg_iovlen; + l_uintptr_t msg_control; + l_size_t msg_controllen; + l_uint msg_flags; +}; + +struct l_cmsghdr { + l_size_t cmsg_len; + l_int cmsg_level; + l_int cmsg_type; +}; + struct l_ifmap { l_ulong mem_start; l_ulong mem_end; Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sat Nov 29 16:17:39 2008 (r185441) +++ head/sys/compat/linux/linux_socket.c Sat Nov 29 17:14:06 2008 (r185442) @@ -421,10 +421,62 @@ linux_sa_put(struct osockaddr *osa) } static int +linux_to_bsd_cmsg_type(int cmsg_type) +{ + + switch (cmsg_type) { + case LINUX_SCM_RIGHTS: + return (SCM_RIGHTS); + } + return (-1); +} + +static int +bsd_to_linux_cmsg_type(int cmsg_type) +{ + + switch (cmsg_type) { + case SCM_RIGHTS: + return (LINUX_SCM_RIGHTS); + } + return (-1); +} + + + +static int +linux_to_bsd_msghdr(struct msghdr *bhdr, const struct l_msghdr *lhdr) +{ + if (lhdr->msg_controllen > INT_MAX) + return (ENOBUFS); + + bhdr->msg_name = PTRIN(lhdr->msg_name); + bhdr->msg_namelen = lhdr->msg_namelen; + bhdr->msg_iov = PTRIN(lhdr->msg_iov); + bhdr->msg_iovlen = lhdr->msg_iovlen; + bhdr->msg_control = PTRIN(lhdr->msg_control); + bhdr->msg_controllen = lhdr->msg_controllen; + bhdr->msg_flags = linux_to_bsd_msg_flags(lhdr->msg_flags); + return (0); +} + +static int +bsd_to_linux_msghdr(const struct msghdr *bhdr, struct l_msghdr *lhdr) +{ + lhdr->msg_name = PTROUT(bhdr->msg_name); + lhdr->msg_namelen = bhdr->msg_namelen; + lhdr->msg_iov = PTROUT(bhdr->msg_iov); + lhdr->msg_iovlen = bhdr->msg_iovlen; + lhdr->msg_control = PTROUT(bhdr->msg_control); + lhdr->msg_controllen = bhdr->msg_controllen; + /* msg_flags skipped */ + return (0); +} + +static int linux_sendit(struct thread *td, int s, struct msghdr *mp, int flags, - enum uio_seg segflg) + struct mbuf *control, enum uio_seg segflg) { - struct mbuf *control; struct sockaddr *to; int error; @@ -436,27 +488,9 @@ linux_sendit(struct thread *td, int s, s } else to = NULL; - if (mp->msg_control != NULL) { - struct cmsghdr *cmsg; - - if (mp->msg_controllen < sizeof(struct cmsghdr)) { - error = EINVAL; - goto bad; - } - error = sockargs(&control, mp->msg_control, - mp->msg_controllen, MT_CONTROL); - if (error) - goto bad; - - cmsg = mtod(control, struct cmsghdr *); - cmsg->cmsg_level = linux_to_bsd_sockopt_level(cmsg->cmsg_level); - } else - control = NULL; - error = kern_sendit(td, s, mp, linux_to_bsd_msg_flags(flags), control, segflg); -bad: if (to) free(to, M_SONAME); return (error); @@ -531,7 +565,7 @@ linux_sendto_hdrincl(struct thread *td, aiov[0].iov_base = (char *)packet; aiov[0].iov_len = linux_args->len; error = linux_sendit(td, linux_args->s, &msg, linux_args->flags, - UIO_SYSSPACE); + NULL, UIO_SYSSPACE); goout: free(packet, M_TEMP); return (error); @@ -900,7 +934,8 @@ linux_sendto(struct thread *td, struct l msg.msg_flags = 0; aiov.iov_base = PTRIN(args->msg); aiov.iov_len = args->len; - error = linux_sendit(td, args->s, &msg, args->flags, UIO_USERSPACE); + error = linux_sendit(td, args->s, &msg, args->flags, NULL, + UIO_USERSPACE); return (error); } @@ -962,13 +997,21 @@ struct linux_sendmsg_args { static int linux_sendmsg(struct thread *td, struct linux_sendmsg_args *args) { + struct cmsghdr *cmsg; + struct mbuf *control; struct msghdr msg; + struct l_cmsghdr linux_cmsg; + struct l_cmsghdr *ptr_cmsg; + struct l_msghdr linux_msg; struct iovec *iov; + socklen_t datalen; + void *data; int error; - /* XXXTJR sendmsg is broken on amd64 */ - - error = copyin(PTRIN(args->msg), &msg, sizeof(msg)); + error = copyin(PTRIN(args->msg), &linux_msg, sizeof(linux_msg)); + if (error) + return (error); + error = linux_to_bsd_msghdr(&msg, &linux_msg); if (error) return (error); @@ -981,13 +1024,68 @@ linux_sendmsg(struct thread *td, struct */ if (msg.msg_control != NULL && msg.msg_controllen == 0) msg.msg_control = NULL; + +#ifdef COMPAT_LINUX32 + error = linux32_copyiniov(PTRIN(msg.msg_iov), msg.msg_iovlen, + &iov, EMSGSIZE); +#else error = copyiniov(msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE); +#endif if (error) return (error); + + if (msg.msg_control != NULL) { + error = ENOBUFS; + cmsg = malloc(CMSG_HDRSZ, M_TEMP, M_WAITOK | M_ZERO); + control = m_get(M_WAIT, MT_CONTROL); + if (control == NULL) + goto bad; + ptr_cmsg = LINUX_CMSG_FIRSTHDR(&msg); + + do { + error = copyin(ptr_cmsg, &linux_cmsg, + sizeof(struct l_cmsghdr)); + if (error) + goto bad; + + error = EINVAL; + if (linux_cmsg.cmsg_len < sizeof(struct l_cmsghdr)) + goto bad; + + /* + * Now we support only SCM_RIGHTS, so return EINVAL + * in any other cmsg_type + */ + if ((cmsg->cmsg_type = + linux_to_bsd_cmsg_type(linux_cmsg.cmsg_type)) == -1) + goto bad; + cmsg->cmsg_level = + linux_to_bsd_sockopt_level(linux_cmsg.cmsg_level); + + datalen = linux_cmsg.cmsg_len - L_CMSG_HDRSZ; + cmsg->cmsg_len = CMSG_LEN(datalen); + data = LINUX_CMSG_DATA(ptr_cmsg); + + error = ENOBUFS; + if (!m_append(control, CMSG_HDRSZ, (c_caddr_t) cmsg)) + goto bad; + if (!m_append(control, datalen, (c_caddr_t) data)) + goto bad; + } while ((ptr_cmsg = LINUX_CMSG_NXTHDR(&msg, ptr_cmsg))); + } else { + control = NULL; + cmsg = NULL; + } + msg.msg_iov = iov; msg.msg_flags = 0; - error = linux_sendit(td, args->s, &msg, args->flags, UIO_USERSPACE); + error = linux_sendit(td, args->s, &msg, args->flags, control, + UIO_USERSPACE); + +bad: free(iov, M_IOV); + if (cmsg) + free(cmsg, M_TEMP); return (error); } @@ -1000,44 +1098,132 @@ struct linux_recvmsg_args { static int linux_recvmsg(struct thread *td, struct linux_recvmsg_args *args) { - struct recvmsg_args /* { - int s; - struct msghdr *msg; - int flags; - } */ bsd_args; + struct cmsghdr *cm; struct msghdr msg; - struct cmsghdr *cmsg; + struct l_cmsghdr *linux_cmsg = NULL; + socklen_t datalen, outlen, clen; + struct l_msghdr linux_msg; + struct iovec *iov, *uiov; + struct mbuf *control = NULL; + struct mbuf **controlp; + caddr_t outbuf; + void *data; int error; - /* XXXTJR recvmsg is broken on amd64 */ + error = copyin(PTRIN(args->msg), &linux_msg, sizeof(linux_msg)); + if (error) + return (error); - if ((error = copyin(PTRIN(args->msg), &msg, sizeof (msg)))) + error = linux_to_bsd_msghdr(&msg, &linux_msg); + if (error) return (error); - bsd_args.s = args->s; - bsd_args.msg = PTRIN(args->msg); - bsd_args.flags = linux_to_bsd_msg_flags(args->flags); - if (msg.msg_name) { - linux_to_bsd_sockaddr((struct sockaddr *)msg.msg_name, - msg.msg_namelen); - error = recvmsg(td, &bsd_args); - bsd_to_linux_sockaddr((struct sockaddr *)msg.msg_name); - } else - error = recvmsg(td, &bsd_args); +#ifdef COMPAT_LINUX32 + error = linux32_copyiniov(PTRIN(msg.msg_iov), msg.msg_iovlen, + &iov, EMSGSIZE); +#else + error = copyiniov(msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE); +#endif if (error) return (error); - if (bsd_args.msg->msg_control != NULL && - bsd_args.msg->msg_controllen > 0) { - cmsg = (struct cmsghdr*)bsd_args.msg->msg_control; - cmsg->cmsg_level = bsd_to_linux_sockopt_level(cmsg->cmsg_level); + if (msg.msg_name) { + error = linux_to_bsd_sockaddr((struct sockaddr *)msg.msg_name, + msg.msg_namelen); + if (error) + goto bad; } - error = copyin(PTRIN(args->msg), &msg, sizeof(msg)); + uiov = msg.msg_iov; + msg.msg_iov = iov; + controlp = (msg.msg_control != NULL) ? &control : NULL; + error = kern_recvit(td, args->s, &msg, UIO_USERSPACE, controlp); + msg.msg_iov = uiov; + if (error) + goto bad; + + error = bsd_to_linux_msghdr(&msg, &linux_msg); if (error) - return (error); - if (msg.msg_name && msg.msg_namelen > 2) - error = linux_sa_put(msg.msg_name); + goto bad; + + if (linux_msg.msg_name) { + error = bsd_to_linux_sockaddr((struct sockaddr *) + PTRIN(linux_msg.msg_name)); + if (error) + goto bad; + } + if (linux_msg.msg_name && linux_msg.msg_namelen > 2) { + error = linux_sa_put(PTRIN(linux_msg.msg_name)); + if (error) + goto bad; + } + + if (control) { + + linux_cmsg = malloc(L_CMSG_HDRSZ, M_TEMP, M_WAITOK | M_ZERO); + outbuf = PTRIN(linux_msg.msg_control); + cm = mtod(control, struct cmsghdr *); + outlen = 0; + clen = control->m_len; + + while (cm != NULL) { + + if ((linux_cmsg->cmsg_type = + bsd_to_linux_cmsg_type(cm->cmsg_type)) == -1) + { + error = EINVAL; + goto bad; + } + data = CMSG_DATA(cm); + datalen = (caddr_t)cm + cm->cmsg_len - (caddr_t)data; + + if (outlen + LINUX_CMSG_LEN(datalen) > + linux_msg.msg_controllen) { + if (outlen == 0) { + error = EMSGSIZE; + goto bad; + } else { + linux_msg.msg_flags |= LINUX_MSG_CTRUNC; + goto out; + } + } + + linux_cmsg->cmsg_len = LINUX_CMSG_LEN(datalen); + linux_cmsg->cmsg_level = + bsd_to_linux_sockopt_level(cm->cmsg_level); + + error = copyout(linux_cmsg, outbuf, L_CMSG_HDRSZ); + if (error) + goto bad; + outbuf += L_CMSG_HDRSZ; + + error = copyout(data, outbuf, datalen); + if (error) + goto bad; + + outbuf += LINUX_CMSG_ALIGN(datalen); + outlen += LINUX_CMSG_LEN(datalen); + linux_msg.msg_controllen = outlen; + + if (CMSG_SPACE(datalen) < clen) { + clen -= CMSG_SPACE(datalen); + cm = (struct cmsghdr *) + ((caddr_t)cm + CMSG_SPACE(datalen)); + } else + cm = NULL; + } + } + +out: + error = copyout(&linux_msg, PTRIN(args->msg), sizeof(linux_msg)); + +bad: + free(iov, M_IOV); + if (control != NULL) + m_freem(control); + if (linux_cmsg != NULL) + free(linux_cmsg, M_TEMP); + return (error); } Modified: head/sys/compat/linux/linux_socket.h ============================================================================== --- head/sys/compat/linux/linux_socket.h Sat Nov 29 16:17:39 2008 (r185441) +++ head/sys/compat/linux/linux_socket.h Sat Nov 29 17:14:06 2008 (r185442) @@ -49,4 +49,35 @@ #define LINUX_MSG_ERRQUEUE 0x2000 #define LINUX_MSG_NOSIGNAL 0x4000 +/* Socket-level control message types */ + +#define LINUX_SCM_RIGHTS 0x01 + +/* Ancilliary data object information macros */ + +#define LINUX_CMSG_ALIGN(len) roundup2(len, sizeof(l_ulong)) +#define LINUX_CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + \ + LINUX_CMSG_ALIGN(sizeof(struct l_cmsghdr)))) +#define LINUX_CMSG_SPACE(len) (LINUX_CMSG_ALIGN(sizeof(struct l_cmsghdr)) + \ + LINUX_CMSG_ALIGN(len)) +#define LINUX_CMSG_LEN(len) (LINUX_CMSG_ALIGN(sizeof(struct l_cmsghdr)) + \ + (len)) +#define LINUX_CMSG_FIRSTHDR(msg) \ + ((msg)->msg_controllen >= \ + sizeof(struct l_cmsghdr) ? \ + (struct l_cmsghdr *)((msg)->msg_control) : \ + (struct l_cmsghdr *)(NULL)) +#define LINUX_CMSG_NXTHDR(msg, cmsg) \ + ((((char *)(cmsg) + \ + LINUX_CMSG_ALIGN((cmsg)->cmsg_len) + \ + sizeof(*(cmsg))) > \ + (((char *)(msg)->msg_control) + \ + (msg)->msg_controllen)) ? \ + (struct l_cmsghdr *) NULL : \ + (struct l_cmsghdr *)((char *)(cmsg) + \ + LINUX_CMSG_ALIGN((cmsg)->cmsg_len))) + +#define CMSG_HDRSZ CMSG_LEN(0) +#define L_CMSG_HDRSZ LINUX_CMSG_LEN(0) + #endif /* _LINUX_SOCKET_H_ */ Modified: head/sys/i386/linux/linux.h ============================================================================== --- head/sys/i386/linux/linux.h Sat Nov 29 16:17:39 2008 (r185441) +++ head/sys/i386/linux/linux.h Sat Nov 29 17:14:06 2008 (r185442) @@ -693,6 +693,22 @@ struct l_sockaddr { char sa_data[14]; }; +struct l_msghdr { + l_uintptr_t msg_name; + l_int msg_namelen; + l_uintptr_t msg_iov; + l_size_t msg_iovlen; + l_uintptr_t msg_control; + l_size_t msg_controllen; + l_uint msg_flags; +}; + +struct l_cmsghdr { + l_size_t cmsg_len; + l_int cmsg_level; + l_int cmsg_type; +}; + struct l_ifmap { l_ulong mem_start; l_ulong mem_end; From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 17:33:38 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E2CD1065670; Sat, 29 Nov 2008 17:33:38 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C5518FC0A; Sat, 29 Nov 2008 17:33:38 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATHXcEE057777; Sat, 29 Nov 2008 17:33:38 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATHXcJt057774; Sat, 29 Nov 2008 17:33:38 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200811291733.mATHXcJt057774@svn.freebsd.org> From: Robert Noland Date: Sat, 29 Nov 2008 17:33: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: r185443 - in stable/7/sys: . pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 17:33:38 -0000 Author: rnoland Date: Sat Nov 29 17:33:38 2008 New Revision: 185443 URL: http://svn.freebsd.org/changeset/base/185443 Log: MFC r183555: Correctly handle Intel g33 chips and add support for g45 chips. g33 based chips use a different method of identifying the gtt size. g45 based chips gtt is located in a different area of stolen memory. Approved by: re@ (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/pci/agp_i810.c stable/7/sys/pci/agpreg.h Modified: stable/7/sys/pci/agp_i810.c ============================================================================== --- stable/7/sys/pci/agp_i810.c Sat Nov 29 17:14:06 2008 (r185442) +++ stable/7/sys/pci/agp_i810.c Sat Nov 29 17:33:38 2008 (r185443) @@ -70,6 +70,7 @@ enum { CHIP_I915, /* 915G/915GM */ CHIP_I965, /* G965 */ CHIP_G33, /* G33/Q33/Q35 */ + CHIP_G4X, /* G45/Q45 */ }; /* The i810 through i855 have the registers at BAR 1, and the GATT gets @@ -133,7 +134,7 @@ static const struct agp_i810_match { {0x25628086, CHIP_I830, 0x00020000, "Intel 82845M (845M GMCH) SVGA controller"}, {0x35828086, CHIP_I855, 0x00020000, - "Intel 82852/5"}, + "Intel 82852/855GM SVGA controller"}, {0x25728086, CHIP_I855, 0x00020000, "Intel 82865G (865G GMCH) SVGA controller"}, {0x25828086, CHIP_I915, 0x00020000, @@ -154,18 +155,26 @@ static const struct agp_i810_match { "Intel G965 SVGA controller"}, {0x29928086, CHIP_I965, 0x00020000, "Intel Q965 SVGA controller"}, - {0x29a28086, CHIP_I965, 0x00020000, + {0x29A28086, CHIP_I965, 0x00020000, "Intel G965 SVGA controller"}, - {0x29b28086, CHIP_G33, 0x00020000, + {0x29B28086, CHIP_G33, 0x00020000, "Intel Q35 SVGA controller"}, - {0x29c28086, CHIP_G33, 0x00020000, + {0x29C28086, CHIP_G33, 0x00020000, "Intel G33 SVGA controller"}, - {0x29d28086, CHIP_G33, 0x00020000, + {0x29D28086, CHIP_G33, 0x00020000, "Intel Q33 SVGA controller"}, - {0x2a028086, CHIP_I965, 0x00020000, + {0x2A028086, CHIP_I965, 0x00020000, "Intel GM965 SVGA controller"}, - {0x2a128086, CHIP_I965, 0x00020000, + {0x2A128086, CHIP_I965, 0x00020000, "Intel GME965 SVGA controller"}, + {0x2A428086, CHIP_I965, 0x00020000, + "Intel GM45 SVGA controller"}, + {0x2E028086, CHIP_G4X, 0x00020000, + "Intel 4 Series SVGA controller"}, + {0x2E128086, CHIP_G4X, 0x00020000, + "Intel Q45 SVGA controller"}, + {0x2E228086, CHIP_G4X, 0x00020000, + "Intel G45 SVGA controller"}, {0, 0, 0, NULL} }; @@ -377,6 +386,7 @@ agp_i810_attach(device_t dev) agp_set_aperture_resource(dev, AGP_I915_GMADR); break; case CHIP_I965: + case CHIP_G4X: sc->sc_res_spec = agp_i965_res_spec; agp_set_aperture_resource(dev, AGP_I915_GMADR); break; @@ -476,7 +486,8 @@ agp_i810_attach(device_t dev) gatt->ag_physical = pgtblctl & ~1; } else if (sc->chiptype == CHIP_I855 || sc->chiptype == CHIP_I915 || - sc->chiptype == CHIP_I965 || sc->chiptype == CHIP_G33) { + sc->chiptype == CHIP_I965 || sc->chiptype == CHIP_G33 || + sc->chiptype == CHIP_G4X) { unsigned int gcc1, pgtblctl, stolen, gtt_size; /* Stolen memory is set up at the beginning of the aperture by @@ -491,7 +502,6 @@ agp_i810_attach(device_t dev) gtt_size = 256; break; case CHIP_I965: - case CHIP_G33: switch (bus_read_4(sc->sc_res[0], AGP_I810_PGTBL_CTL) & AGP_I810_PGTBL_SIZE_MASK) { case AGP_I810_PGTBL_SIZE_128KB: @@ -503,6 +513,33 @@ agp_i810_attach(device_t dev) case AGP_I810_PGTBL_SIZE_512KB: gtt_size = 512; break; + case AGP_I965_PGTBL_SIZE_1MB: + gtt_size = 1024; + break; + case AGP_I965_PGTBL_SIZE_2MB: + gtt_size = 2048; + break; + case AGP_I965_PGTBL_SIZE_1_5MB: + gtt_size = 1024 + 512; + break; + default: + device_printf(dev, "Bad PGTBL size\n"); + bus_release_resources(dev, sc->sc_res_spec, + sc->sc_res); + free(gatt, M_AGP); + agp_generic_detach(dev); + return EINVAL; + } + break; + case CHIP_G33: + gcc1 = pci_read_config(sc->bdev, AGP_I855_GCC1, 2); + switch (gcc1 & AGP_G33_MGGC_GGMS_MASK) { + case AGP_G33_MGGC_GGMS_SIZE_1M: + gtt_size = 1024; + break; + case AGP_G33_MGGC_GGMS_SIZE_2M: + gtt_size = 2048; + break; default: device_printf(dev, "Bad PGTBL size\n"); bus_release_resources(dev, sc->sc_res_spec, @@ -512,6 +549,9 @@ agp_i810_attach(device_t dev) return EINVAL; } break; + case CHIP_G4X: + gtt_size = 0; + break; default: device_printf(dev, "Bad chiptype\n"); bus_release_resources(dev, sc->sc_res_spec, @@ -528,28 +568,86 @@ agp_i810_attach(device_t dev) stolen = 1024; break; case AGP_I855_GCC1_GMS_STOLEN_4M: - stolen = 4096; + stolen = 4 * 1024; break; case AGP_I855_GCC1_GMS_STOLEN_8M: - stolen = 8192; + stolen = 8 * 1024; break; case AGP_I855_GCC1_GMS_STOLEN_16M: - stolen = 16384; + stolen = 16 * 1024; break; case AGP_I855_GCC1_GMS_STOLEN_32M: - stolen = 32768; + stolen = 32 * 1024; break; case AGP_I915_GCC1_GMS_STOLEN_48M: - stolen = 49152; + if (sc->chiptype == CHIP_I915 || + sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G33 || + sc->chiptype == CHIP_G4X) { + stolen = 48 * 1024; + } else { + stolen = 0; + } break; case AGP_I915_GCC1_GMS_STOLEN_64M: - stolen = 65536; + if (sc->chiptype == CHIP_I915 || + sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G33 || + sc->chiptype == CHIP_G4X) { + stolen = 64 * 1024; + } else { + stolen = 0; + } break; case AGP_G33_GCC1_GMS_STOLEN_128M: - stolen = 128 * 1024; + if (sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G33 || + sc->chiptype == CHIP_G4X) { + stolen = 128 * 1024; + } else { + stolen = 0; + } break; case AGP_G33_GCC1_GMS_STOLEN_256M: - stolen = 256 * 1024; + if (sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G33 || + sc->chiptype == CHIP_G4X) { + stolen = 256 * 1024; + } else { + stolen = 0; + } + break; + case AGP_G4X_GCC1_GMS_STOLEN_96M: + if (sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G4X) { + stolen = 96 * 1024; + } else { + stolen = 0; + } + break; + case AGP_G4X_GCC1_GMS_STOLEN_160M: + if (sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G4X) { + stolen = 160 * 1024; + } else { + stolen = 0; + } + break; + case AGP_G4X_GCC1_GMS_STOLEN_224M: + if (sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G4X) { + stolen = 224 * 1024; + } else { + stolen = 0; + } + break; + case AGP_G4X_GCC1_GMS_STOLEN_352M: + if (sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G4X) { + stolen = 352 * 1024; + } else { + stolen = 0; + } break; default: device_printf(dev, "unknown memory configuration, " @@ -560,7 +658,11 @@ agp_i810_attach(device_t dev) agp_generic_detach(dev); return EINVAL; } - sc->stolen = (stolen - gtt_size - 4) * 1024 / 4096; + + if (sc->chiptype != CHIP_G4X) + gtt_size += 4; + + sc->stolen = (stolen - gtt_size) * 1024 / 4096; if (sc->stolen > 0) device_printf(dev, "detected %dk stolen memory\n", sc->stolen * 4); device_printf(dev, "aperture size is %dM\n", sc->initial_aperture / 1024 / 1024); Modified: stable/7/sys/pci/agpreg.h ============================================================================== --- stable/7/sys/pci/agpreg.h Sat Nov 29 17:14:06 2008 (r185442) +++ stable/7/sys/pci/agpreg.h Sat Nov 29 17:33:38 2008 (r185443) @@ -215,7 +215,7 @@ #define AGP_I855_GCC1_DEV2 0x08 #define AGP_I855_GCC1_DEV2_ENABLED 0x00 #define AGP_I855_GCC1_DEV2_DISABLED 0x08 -#define AGP_I855_GCC1_GMS 0x70 +#define AGP_I855_GCC1_GMS 0xf0 /* Top bit reserved pre-G33 */ #define AGP_I855_GCC1_GMS_STOLEN_0M 0x00 #define AGP_I855_GCC1_GMS_STOLEN_1M 0x10 #define AGP_I855_GCC1_GMS_STOLEN_4M 0x20 @@ -259,14 +259,28 @@ #define AGP_I965_MSAC_GMASIZE_128 0x00 #define AGP_I965_MSAC_GMASIZE_256 0x02 #define AGP_I965_MSAC_GMASIZE_512 0x06 +#define AGP_I965_PGTBL_SIZE_1MB (3 << 1) +#define AGP_I965_PGTBL_SIZE_2MB (4 << 1) +#define AGP_I965_PGTBL_SIZE_1_5MB (5 << 1) /* * G33 registers */ +#define AGP_G33_MGGC_GGMS_MASK (3 << 8) +#define AGP_G33_MGGC_GGMS_SIZE_1M (1 << 8) +#define AGP_G33_MGGC_GGMS_SIZE_2M (2 << 8) #define AGP_G33_GCC1_GMS_STOLEN_128M 0x80 #define AGP_G33_GCC1_GMS_STOLEN_256M 0x90 /* + * G4X registers + */ +#define AGP_G4X_GCC1_GMS_STOLEN_96M 0xa0 +#define AGP_G4X_GCC1_GMS_STOLEN_160M 0xb0 +#define AGP_G4X_GCC1_GMS_STOLEN_224M 0xc0 +#define AGP_G4X_GCC1_GMS_STOLEN_352M 0xd0 + +/* * NVIDIA nForce/nForce2 registers */ #define AGP_NVIDIA_0_APBASE 0x10 From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 17:36:09 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B833106564A; Sat, 29 Nov 2008 17:36:09 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09A1C8FC16; Sat, 29 Nov 2008 17:36:09 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATHa8Mo057897; Sat, 29 Nov 2008 17:36:08 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATHa81A057895; Sat, 29 Nov 2008 17:36:08 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200811291736.mATHa81A057895@svn.freebsd.org> From: Robert Noland Date: Sat, 29 Nov 2008 17:36:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185445 - in releng/7.1/sys: . pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 17:36:09 -0000 Author: rnoland Date: Sat Nov 29 17:36:08 2008 New Revision: 185445 URL: http://svn.freebsd.org/changeset/base/185445 Log: MFC r183555: Correctly handle Intel g33 chips and add support for g45 chips. g33 based chips use a different method of identifying the gtt size. g45 based chips gtt is located in a different area of stolen memory. Approved by: re@ (kensmith) Modified: releng/7.1/sys/ (props changed) releng/7.1/sys/pci/agp_i810.c releng/7.1/sys/pci/agpreg.h Modified: releng/7.1/sys/pci/agp_i810.c ============================================================================== --- releng/7.1/sys/pci/agp_i810.c Sat Nov 29 17:34:46 2008 (r185444) +++ releng/7.1/sys/pci/agp_i810.c Sat Nov 29 17:36:08 2008 (r185445) @@ -70,6 +70,7 @@ enum { CHIP_I915, /* 915G/915GM */ CHIP_I965, /* G965 */ CHIP_G33, /* G33/Q33/Q35 */ + CHIP_G4X, /* G45/Q45 */ }; /* The i810 through i855 have the registers at BAR 1, and the GATT gets @@ -133,7 +134,7 @@ static const struct agp_i810_match { {0x25628086, CHIP_I830, 0x00020000, "Intel 82845M (845M GMCH) SVGA controller"}, {0x35828086, CHIP_I855, 0x00020000, - "Intel 82852/5"}, + "Intel 82852/855GM SVGA controller"}, {0x25728086, CHIP_I855, 0x00020000, "Intel 82865G (865G GMCH) SVGA controller"}, {0x25828086, CHIP_I915, 0x00020000, @@ -154,18 +155,26 @@ static const struct agp_i810_match { "Intel G965 SVGA controller"}, {0x29928086, CHIP_I965, 0x00020000, "Intel Q965 SVGA controller"}, - {0x29a28086, CHIP_I965, 0x00020000, + {0x29A28086, CHIP_I965, 0x00020000, "Intel G965 SVGA controller"}, - {0x29b28086, CHIP_G33, 0x00020000, + {0x29B28086, CHIP_G33, 0x00020000, "Intel Q35 SVGA controller"}, - {0x29c28086, CHIP_G33, 0x00020000, + {0x29C28086, CHIP_G33, 0x00020000, "Intel G33 SVGA controller"}, - {0x29d28086, CHIP_G33, 0x00020000, + {0x29D28086, CHIP_G33, 0x00020000, "Intel Q33 SVGA controller"}, - {0x2a028086, CHIP_I965, 0x00020000, + {0x2A028086, CHIP_I965, 0x00020000, "Intel GM965 SVGA controller"}, - {0x2a128086, CHIP_I965, 0x00020000, + {0x2A128086, CHIP_I965, 0x00020000, "Intel GME965 SVGA controller"}, + {0x2A428086, CHIP_I965, 0x00020000, + "Intel GM45 SVGA controller"}, + {0x2E028086, CHIP_G4X, 0x00020000, + "Intel 4 Series SVGA controller"}, + {0x2E128086, CHIP_G4X, 0x00020000, + "Intel Q45 SVGA controller"}, + {0x2E228086, CHIP_G4X, 0x00020000, + "Intel G45 SVGA controller"}, {0, 0, 0, NULL} }; @@ -377,6 +386,7 @@ agp_i810_attach(device_t dev) agp_set_aperture_resource(dev, AGP_I915_GMADR); break; case CHIP_I965: + case CHIP_G4X: sc->sc_res_spec = agp_i965_res_spec; agp_set_aperture_resource(dev, AGP_I915_GMADR); break; @@ -476,7 +486,8 @@ agp_i810_attach(device_t dev) gatt->ag_physical = pgtblctl & ~1; } else if (sc->chiptype == CHIP_I855 || sc->chiptype == CHIP_I915 || - sc->chiptype == CHIP_I965 || sc->chiptype == CHIP_G33) { + sc->chiptype == CHIP_I965 || sc->chiptype == CHIP_G33 || + sc->chiptype == CHIP_G4X) { unsigned int gcc1, pgtblctl, stolen, gtt_size; /* Stolen memory is set up at the beginning of the aperture by @@ -491,7 +502,6 @@ agp_i810_attach(device_t dev) gtt_size = 256; break; case CHIP_I965: - case CHIP_G33: switch (bus_read_4(sc->sc_res[0], AGP_I810_PGTBL_CTL) & AGP_I810_PGTBL_SIZE_MASK) { case AGP_I810_PGTBL_SIZE_128KB: @@ -503,6 +513,33 @@ agp_i810_attach(device_t dev) case AGP_I810_PGTBL_SIZE_512KB: gtt_size = 512; break; + case AGP_I965_PGTBL_SIZE_1MB: + gtt_size = 1024; + break; + case AGP_I965_PGTBL_SIZE_2MB: + gtt_size = 2048; + break; + case AGP_I965_PGTBL_SIZE_1_5MB: + gtt_size = 1024 + 512; + break; + default: + device_printf(dev, "Bad PGTBL size\n"); + bus_release_resources(dev, sc->sc_res_spec, + sc->sc_res); + free(gatt, M_AGP); + agp_generic_detach(dev); + return EINVAL; + } + break; + case CHIP_G33: + gcc1 = pci_read_config(sc->bdev, AGP_I855_GCC1, 2); + switch (gcc1 & AGP_G33_MGGC_GGMS_MASK) { + case AGP_G33_MGGC_GGMS_SIZE_1M: + gtt_size = 1024; + break; + case AGP_G33_MGGC_GGMS_SIZE_2M: + gtt_size = 2048; + break; default: device_printf(dev, "Bad PGTBL size\n"); bus_release_resources(dev, sc->sc_res_spec, @@ -512,6 +549,9 @@ agp_i810_attach(device_t dev) return EINVAL; } break; + case CHIP_G4X: + gtt_size = 0; + break; default: device_printf(dev, "Bad chiptype\n"); bus_release_resources(dev, sc->sc_res_spec, @@ -528,28 +568,86 @@ agp_i810_attach(device_t dev) stolen = 1024; break; case AGP_I855_GCC1_GMS_STOLEN_4M: - stolen = 4096; + stolen = 4 * 1024; break; case AGP_I855_GCC1_GMS_STOLEN_8M: - stolen = 8192; + stolen = 8 * 1024; break; case AGP_I855_GCC1_GMS_STOLEN_16M: - stolen = 16384; + stolen = 16 * 1024; break; case AGP_I855_GCC1_GMS_STOLEN_32M: - stolen = 32768; + stolen = 32 * 1024; break; case AGP_I915_GCC1_GMS_STOLEN_48M: - stolen = 49152; + if (sc->chiptype == CHIP_I915 || + sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G33 || + sc->chiptype == CHIP_G4X) { + stolen = 48 * 1024; + } else { + stolen = 0; + } break; case AGP_I915_GCC1_GMS_STOLEN_64M: - stolen = 65536; + if (sc->chiptype == CHIP_I915 || + sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G33 || + sc->chiptype == CHIP_G4X) { + stolen = 64 * 1024; + } else { + stolen = 0; + } break; case AGP_G33_GCC1_GMS_STOLEN_128M: - stolen = 128 * 1024; + if (sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G33 || + sc->chiptype == CHIP_G4X) { + stolen = 128 * 1024; + } else { + stolen = 0; + } break; case AGP_G33_GCC1_GMS_STOLEN_256M: - stolen = 256 * 1024; + if (sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G33 || + sc->chiptype == CHIP_G4X) { + stolen = 256 * 1024; + } else { + stolen = 0; + } + break; + case AGP_G4X_GCC1_GMS_STOLEN_96M: + if (sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G4X) { + stolen = 96 * 1024; + } else { + stolen = 0; + } + break; + case AGP_G4X_GCC1_GMS_STOLEN_160M: + if (sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G4X) { + stolen = 160 * 1024; + } else { + stolen = 0; + } + break; + case AGP_G4X_GCC1_GMS_STOLEN_224M: + if (sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G4X) { + stolen = 224 * 1024; + } else { + stolen = 0; + } + break; + case AGP_G4X_GCC1_GMS_STOLEN_352M: + if (sc->chiptype == CHIP_I965 || + sc->chiptype == CHIP_G4X) { + stolen = 352 * 1024; + } else { + stolen = 0; + } break; default: device_printf(dev, "unknown memory configuration, " @@ -560,7 +658,11 @@ agp_i810_attach(device_t dev) agp_generic_detach(dev); return EINVAL; } - sc->stolen = (stolen - gtt_size - 4) * 1024 / 4096; + + if (sc->chiptype != CHIP_G4X) + gtt_size += 4; + + sc->stolen = (stolen - gtt_size) * 1024 / 4096; if (sc->stolen > 0) device_printf(dev, "detected %dk stolen memory\n", sc->stolen * 4); device_printf(dev, "aperture size is %dM\n", sc->initial_aperture / 1024 / 1024); Modified: releng/7.1/sys/pci/agpreg.h ============================================================================== --- releng/7.1/sys/pci/agpreg.h Sat Nov 29 17:34:46 2008 (r185444) +++ releng/7.1/sys/pci/agpreg.h Sat Nov 29 17:36:08 2008 (r185445) @@ -215,7 +215,7 @@ #define AGP_I855_GCC1_DEV2 0x08 #define AGP_I855_GCC1_DEV2_ENABLED 0x00 #define AGP_I855_GCC1_DEV2_DISABLED 0x08 -#define AGP_I855_GCC1_GMS 0x70 +#define AGP_I855_GCC1_GMS 0xf0 /* Top bit reserved pre-G33 */ #define AGP_I855_GCC1_GMS_STOLEN_0M 0x00 #define AGP_I855_GCC1_GMS_STOLEN_1M 0x10 #define AGP_I855_GCC1_GMS_STOLEN_4M 0x20 @@ -259,14 +259,28 @@ #define AGP_I965_MSAC_GMASIZE_128 0x00 #define AGP_I965_MSAC_GMASIZE_256 0x02 #define AGP_I965_MSAC_GMASIZE_512 0x06 +#define AGP_I965_PGTBL_SIZE_1MB (3 << 1) +#define AGP_I965_PGTBL_SIZE_2MB (4 << 1) +#define AGP_I965_PGTBL_SIZE_1_5MB (5 << 1) /* * G33 registers */ +#define AGP_G33_MGGC_GGMS_MASK (3 << 8) +#define AGP_G33_MGGC_GGMS_SIZE_1M (1 << 8) +#define AGP_G33_MGGC_GGMS_SIZE_2M (2 << 8) #define AGP_G33_GCC1_GMS_STOLEN_128M 0x80 #define AGP_G33_GCC1_GMS_STOLEN_256M 0x90 /* + * G4X registers + */ +#define AGP_G4X_GCC1_GMS_STOLEN_96M 0xa0 +#define AGP_G4X_GCC1_GMS_STOLEN_160M 0xb0 +#define AGP_G4X_GCC1_GMS_STOLEN_224M 0xc0 +#define AGP_G4X_GCC1_GMS_STOLEN_352M 0xd0 + +/* * NVIDIA nForce/nForce2 registers */ #define AGP_NVIDIA_0_APBASE 0x10 From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 18:09:50 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63D7C1065670; Sat, 29 Nov 2008 18:09:50 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C2E08FC16; Sat, 29 Nov 2008 18:09:50 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATI9oDS058649; Sat, 29 Nov 2008 18:09:50 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATI9oat058648; Sat, 29 Nov 2008 18:09:50 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200811291809.mATI9oat058648@svn.freebsd.org> From: Christian Brueffer Date: Sat, 29 Nov 2008 18:09:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185446 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 18:09:50 -0000 Author: brueffer Date: Sat Nov 29 18:09:50 2008 New Revision: 185446 URL: http://svn.freebsd.org/changeset/base/185446 Log: Fix typo. Modified: head/share/man/man4/ale.4 Modified: head/share/man/man4/ale.4 ============================================================================== --- head/share/man/man4/ale.4 Sat Nov 29 17:36:08 2008 (r185445) +++ head/share/man/man4/ale.4 Sat Nov 29 18:09:50 2008 (r185446) @@ -49,7 +49,7 @@ if_ale_load="YES" The .Nm device driver provides support for Atheros AR8121 PCI Express -Gigabit Ethernet controller and Atheros AR8113/AR8114 PCI +Gigabit Ethernet controllers and Atheros AR8113/AR8114 PCI Express Fast Ethernet controllers. .Pp All LOMs supported by the From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 18:21:31 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F4451065727; Sat, 29 Nov 2008 18:21:31 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57F8F8FC19; Sat, 29 Nov 2008 18:21:31 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATILVno058917; Sat, 29 Nov 2008 18:21:31 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATILV9Z058916; Sat, 29 Nov 2008 18:21:31 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200811291821.mATILV9Z058916@svn.freebsd.org> From: Christian Brueffer Date: Sat, 29 Nov 2008 18:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185447 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 18:21:31 -0000 Author: brueffer Date: Sat Nov 29 18:21:31 2008 New Revision: 185447 URL: http://svn.freebsd.org/changeset/base/185447 Log: Add several missing MLINKs. Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sat Nov 29 18:09:50 2008 (r185446) +++ head/share/man/man4/Makefile Sat Nov 29 18:21:31 2008 (r185447) @@ -447,7 +447,10 @@ MAN= aac.4 \ zero.4 \ zyd.4 -MLINKS= agp.4 agpgart.4 +MLINKS= ae.4 if_ae.4 +MLINKS+=age.4 if_age.4 +MLINKS+=agp.4 agpgart.4 +MLINKS+=ale.4 if_ale.4 MLINKS+=altq.4 ALTQ.4 MLINKS+=an.4 if_an.4 MLINKS+=ata.4 acd.4 \ @@ -490,20 +493,24 @@ MLINKS+=hme.4 if_hme.4 MLINKS+=${_hptrr.4} ${_rr232x.4} MLINKS+=idt.4 if_idt.4 MLINKS+=if_bridge.4 bridge.4 +MLINKS+=igb.4 if_igb.4 MLINKS+=ip.4 rawip.4 MLINKS+=ipfirewall.4 ipaccounting.4 \ ipfirewall.4 ipacct.4 \ ipfirewall.4 ipfw.4 MLINKS+=ipw.4 if_ipw.4 MLINKS+=iwi.4 if_iwi.4 +MLINKS+=iwn.4 if_iwn.4 MLINKS+=ixgb.4 if_ixgb.4 MLINKS+=ixgbe.4 if_ixgbe.4 +MLINKS+=jme.4 if_jme.4 MLINKS+=kue.4 if_kue.4 MLINKS+=lagg.4 trunk.4 MLINKS+=le.4 if_le.4 MLINKS+=lge.4 if_lge.4 MLINKS+=lo.4 loop.4 MLINKS+=lp.4 plip.4 +MLINKS+=malo.4 if_malo.4 MLINKS+=md.4 vn.4 MLINKS+=mem.4 kmem.4 MLINKS+=mn.4 if_mn.4 @@ -556,6 +563,7 @@ MLINKS+=tx.4 if_tx.4 MLINKS+=txp.4 if_txp.4 MLINKS+=u3g.4 u3gstub.4 MLINKS+=udav.4 if_udav.4 +MLINKS+=upgt.4 if_upgt.4 MLINKS+=ural.4 if_ural.4 MLINKS+=vge.4 if_vge.4 MLINKS+=vlan.4 if_vlan.4 @@ -567,6 +575,7 @@ MLINKS+=wi.4 if_wi.4 MLINKS+=${_wpi.4} ${_if_wpi.4} MLINKS+=xe.4 if_xe.4 MLINKS+=xl.4 if_xl.4 +MLINKS+=zyd.4 if_zyd.4 .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" _acpi_aiboost.4=acpi_aiboost.4 From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 18:58:21 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BD9C1065672; Sat, 29 Nov 2008 18:58:21 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0759D8FC17; Sat, 29 Nov 2008 18:58:21 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATIwKQQ059717; Sat, 29 Nov 2008 18:58:20 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATIwKej059716; Sat, 29 Nov 2008 18:58:20 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200811291858.mATIwKej059716@svn.freebsd.org> From: Christian Brueffer Date: Sat, 29 Nov 2008 18:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185448 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 18:58:21 -0000 Author: brueffer Date: Sat Nov 29 18:58:20 2008 New Revision: 185448 URL: http://svn.freebsd.org/changeset/base/185448 Log: Bring this a little closer to our manpage style. Modified: head/share/man/man4/upgt.4 Modified: head/share/man/man4/upgt.4 ============================================================================== --- head/share/man/man4/upgt.4 Sat Nov 29 18:21:31 2008 (r185447) +++ head/share/man/man4/upgt.4 Sat Nov 29 18:58:20 2008 (r185448) @@ -49,7 +49,7 @@ .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: April 17 2008 $ +.Dd April 17, 2008 .Os .Dt UPGT 4 .Sh NAME @@ -140,29 +140,43 @@ driver can be configured at runtime with .\"users have to download these files on their own. This driver requires the .Nm upgtfw -be installed before it will work. +firmware be installed before it will work. The firmware files are not publicly available. A package of the firmware which can be installed via .Xr pkg_add 1 -with: +is available: .Bd -literal -offset indent http://weongyo.org/project/upgt/upgt-firmware-2.13.1.0.tar.gz .Ed .Sh HARDWARE -The following adapters should work: +The +.Nm +driver supports USB 2.0 Conexant/Intersil PrismGT series wireless +adapters based on the GW3887 chipset, among them: .Pp -.Bl -tag -width Ds -offset indent -compact -.It Belkin F5D7050 (version 1000) -.It Cohiba Proto Board -.It D-Link DWL-G120 Cohiba -.It FSC Connect2Air E-5400 USB D1700 -.It Gigaset USB Adapter 54 -.It Inventel UR045G -.It Netgear WG111v2 -.It SMC EZ ConnectG SMC2862W-G -.It Sagem XG703A -.It Spinnaker DUT -.It Spinnaker Proto Board +.Bl -bullet -compact +.It +Belkin F5D7050 (version 1000) +.It +Cohiba Proto Board +.It +D-Link DWL-G120 Cohiba +.It +FSC Connect2Air E-5400 USB D1700 +.It +Gigaset USB Adapter 54 +.It +Inventel UR045G +.It +Netgear WG111v2 +.It +SMC EZ ConnectG SMC2862W-G +.It +Sagem XG703A +.It +Spinnaker DUT +.It +Spinnaker Proto Board .El .Sh EXAMPLES Join an existing BSS network (i.e., connect to an access point): From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 19:01:44 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 971051065670; Sat, 29 Nov 2008 19:01:44 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 82D2D8FC0C; Sat, 29 Nov 2008 19:01:44 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATJ1if1059848; Sat, 29 Nov 2008 19:01:44 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATJ1ipl059847; Sat, 29 Nov 2008 19:01:44 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200811291901.mATJ1ipl059847@svn.freebsd.org> From: Christian Brueffer Date: Sat, 29 Nov 2008 19:01:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185449 - head/share/man/man4/man4.arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 19:01:44 -0000 Author: brueffer Date: Sat Nov 29 19:01:44 2008 New Revision: 185449 URL: http://svn.freebsd.org/changeset/base/185449 Log: Add standard MLINKs. Modified: head/share/man/man4/man4.arm/Makefile Modified: head/share/man/man4/man4.arm/Makefile ============================================================================== --- head/share/man/man4/man4.arm/Makefile Sat Nov 29 18:58:20 2008 (r185448) +++ head/share/man/man4/man4.arm/Makefile Sat Nov 29 19:01:44 2008 (r185449) @@ -2,6 +2,9 @@ MAN= mge.4 npe.4 +MLINKS= mge.4 if_mge.4 +MLINKS+=npe.4 if_npe.4 + MANSUBDIR=/arm .include From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 19:31:06 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C936106567E; Sat, 29 Nov 2008 19:31:06 +0000 (UTC) (envelope-from rdivacky@lev.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id C8D5F8FC0A; Sat, 29 Nov 2008 19:31:04 +0000 (UTC) (envelope-from rdivacky@lev.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id A64159CB33B; Sat, 29 Nov 2008 20:26:37 +0100 (CET) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SSVVRszPOler; Sat, 29 Nov 2008 20:26:26 +0100 (CET) Received: from lev.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id E2CFD9CB5BC; Sat, 29 Nov 2008 20:26:25 +0100 (CET) Received: (from rdivacky@localhost) by lev.vlakno.cz (8.14.2/8.14.2/Submit) id mATJQPfO079901; Sat, 29 Nov 2008 20:26:25 +0100 (CET) (envelope-from rdivacky) Date: Sat, 29 Nov 2008 20:26:25 +0100 From: Roman Divacky To: Konstantin Belousov Message-ID: <20081129192625.GA79701@freebsd.org> References: <200811291714.mATHE601057374@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200811291714.mATHE601057374@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185442 - in head/sys: amd64/linux32 compat/linux i386/linux X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 19:31:06 -0000 On Sat, Nov 29, 2008 at 05:14:06PM +0000, Konstantin Belousov wrote: > Author: kib > Date: Sat Nov 29 17:14:06 2008 > New Revision: 185442 > URL: http://svn.freebsd.org/changeset/base/185442 > > Log: > Make linux_sendmsg() and linux_recvmsg() work on linux32/amd64. > Change types used in the linux' struct msghdr and struct cmsghdr > definitions to the properly-sized architecture-specific types. > Move ancillary data handler from linux_sendit() to linux_sendmsg(). > > Submitted by: dchagin no MFC of this and the previous commit? From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 19:33:52 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86CCD106564A for ; Sat, 29 Nov 2008 19:33:52 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.171]) by mx1.freebsd.org (Postfix) with ESMTP id 570B38FC0C for ; Sat, 29 Nov 2008 19:33:52 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: by wf-out-1314.google.com with SMTP id 24so1978782wfg.7 for ; Sat, 29 Nov 2008 11:33:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=6uPqG2tuv8XHkrKDUiCOeQ+9ymMVOEpQpwRZBMlyKgM=; b=wIlcVlV7lfLgt+w/z10R+14aVm/d4kZqgyRmi3lt+kftHsXuGPCf4huZdqVPtp/eW/ LOoucPJCIIrPOvhBkhk0p9GV/SEZYbqN34HBFOgTUO+Vr4BcRMB0e/uQT6BtATdbi87O YtSRtl9TfdA7jpl9tBzr9uvpHUVaiHGJIA+R4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=J8QYggQXbmf1gGAIc1J3AoFwTnvScMaxwdDqvVrO1DDiVLLKvUsZa5BDK5tDjFltxd yOa8C94PVfWksuZyrdg6l26YQlhN+nnYhnfnyAsidefmwr4SPUFnKItonTCSI+Puufpb /Is9nbGfuh2YQ/CLJhOZCErOaentyB3ppLZhA= Received: by 10.143.31.11 with SMTP id i11mr3825535wfj.163.1227985564583; Sat, 29 Nov 2008 11:06:04 -0800 (PST) Received: by 10.143.60.4 with HTTP; Sat, 29 Nov 2008 11:06:04 -0800 (PST) Message-ID: <47d0403c0811291106v702257f6pd5bdc8257a8bf311@mail.gmail.com> Date: Sat, 29 Nov 2008 14:06:04 -0500 From: "Ben Kaduk" To: "Christian Brueffer" In-Reply-To: <200811291858.mATIwKej059716@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811291858.mATIwKej059716@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185448 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 19:33:52 -0000 On Sat, Nov 29, 2008 at 1:58 PM, Christian Brueffer wrote: > Author: brueffer > Date: Sat Nov 29 18:58:20 2008 > New Revision: 185448 > URL: http://svn.freebsd.org/changeset/base/185448 > > Log: > Bring this a little closer to our manpage style. > > Modified: > head/share/man/man4/upgt.4 > > Modified: head/share/man/man4/upgt.4 > ============================================================================== > --- head/share/man/man4/upgt.4 Sat Nov 29 18:21:31 2008 (r185447) > +++ head/share/man/man4/upgt.4 Sat Nov 29 18:58:20 2008 (r185448) > @@ -49,7 +49,7 @@ > .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > .\" SUCH DAMAGE. > .\" > -.Dd $Mdocdate: April 17 2008 $ > +.Dd April 17, 2008 > .Os > .Dt UPGT 4 > .Sh NAME > @@ -140,29 +140,43 @@ driver can be configured at runtime with > .\"users have to download these files on their own. > This driver requires the > .Nm upgtfw > -be installed before it will work. > +firmware be installed before it will work. At the risk of being a pedant, I think the grammar is not quite correct, here -- either "This driver requires that the upgtfw firmware be installed before it will work", or (my preference) "This driver requires the upgtfw firmware to be installed before it will work." -Ben Kaduk From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 19:47:25 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A51D1065670; Sat, 29 Nov 2008 19:47:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 2C18B8FC1E; Sat, 29 Nov 2008 19:47:24 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L6Vml-0001pS-1T; Sat, 29 Nov 2008 21:47:23 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mATJlKoe035197 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 29 Nov 2008 21:47:20 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mATJlKpS018290; Sat, 29 Nov 2008 21:47:20 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mATJlK08018289; Sat, 29 Nov 2008 21:47:20 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 29 Nov 2008 21:47:20 +0200 From: Kostik Belousov To: Roman Divacky Message-ID: <20081129194719.GA3045@deviant.kiev.zoral.com.ua> References: <200811291714.mATHE601057374@svn.freebsd.org> <20081129192625.GA79701@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="liOOAslEiF7prFVr" Content-Disposition: inline In-Reply-To: <20081129192625.GA79701@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L6Vml-0001pS-1T 59cb2037f3673180ea8c9bbfc1d59df5 X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185442 - in head/sys: amd64/linux32 compat/linux i386/linux X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 19:47:25 -0000 --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 29, 2008 at 08:26:25PM +0100, Roman Divacky wrote: > On Sat, Nov 29, 2008 at 05:14:06PM +0000, Konstantin Belousov wrote: > > Author: kib > > Date: Sat Nov 29 17:14:06 2008 > > New Revision: 185442 > > URL: http://svn.freebsd.org/changeset/base/185442 > >=20 > > Log: > > Make linux_sendmsg() and linux_recvmsg() work on linux32/amd64. > > Change types used in the linux' struct msghdr and struct cmsghdr > > definitions to the properly-sized architecture-specific types. > > Move ancillary data handler from linux_sendit() to linux_sendmsg(). > > =20 > > Submitted by: dchagin >=20 > no MFC of this and the previous commit? Discuss this with Dmitry, I worked a commit monkey there (hopefully, I will quit soon). --liOOAslEiF7prFVr Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkkxnEYACgkQC3+MBN1Mb4jqKwCeNcnJkSSe8OxYRxxcmT4I45vO CRgAoNxUKBX+e+1SzvvEG5QWFme1mJ2D =BCTH -----END PGP SIGNATURE----- --liOOAslEiF7prFVr-- From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 20:06:53 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF9841065670; Sat, 29 Nov 2008 20:06:53 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF5928FC14; Sat, 29 Nov 2008 20:06:53 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATK6rRW061204; Sat, 29 Nov 2008 20:06:53 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATK6rRN061202; Sat, 29 Nov 2008 20:06:53 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200811292006.mATK6rRN061202@svn.freebsd.org> From: Tim Kientzle Date: Sat, 29 Nov 2008 20:06:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185450 - head/usr.bin/tar X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 20:06:53 -0000 Author: kientzle Date: Sat Nov 29 20:06:53 2008 New Revision: 185450 URL: http://svn.freebsd.org/changeset/base/185450 Log: When deciding which characters (of a filename, for instance) are safe to print, try to take into account the current locale. This iterates over output strings using mbtowc() to identify multi-byte sequences. If iswprint() claims the corresponding wide character is printable, the original bytes are passed through. Otherwise, we expand characters into C-style \-escape sequences. Submitted by: Michihiro NAKAJIMA MFC after: 30 days Modified: head/usr.bin/tar/config_freebsd.h head/usr.bin/tar/util.c Modified: head/usr.bin/tar/config_freebsd.h ============================================================================== --- head/usr.bin/tar/config_freebsd.h Sat Nov 29 19:01:44 2008 (r185449) +++ head/usr.bin/tar/config_freebsd.h Sat Nov 29 20:06:53 2008 (r185450) @@ -101,6 +101,7 @@ #define HAVE_UNISTD_H 1 #define HAVE_UNSIGNED_LONG_LONG #define HAVE_VPRINTF 1 +#define HAVE_WCTYPE_H 1 #define HAVE_ZLIB_H 1 #undef MAJOR_IN_MKDEV #define STDC_HEADERS 1 Modified: head/usr.bin/tar/util.c ============================================================================== --- head/usr.bin/tar/util.c Sat Nov 29 19:01:44 2008 (r185449) +++ head/usr.bin/tar/util.c Sat Nov 29 20:06:53 2008 (r185450) @@ -46,92 +46,161 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_STRING_H #include #endif +#ifdef HAVE_WCTYPE_H +#include +#else +/* If we don't have wctype, we need to hack up some version of iswprint(). */ +#define iswprint isprint +#endif #include "bsdtar.h" static void bsdtar_vwarnc(struct bsdtar *, int code, const char *fmt, va_list ap); +static size_t bsdtar_expand_char(char *, size_t, char); static const char *strip_components(const char *path, int elements); +/* TODO: Hack up a version of mbtowc for platforms with no wide + * character support at all. I think the following might suffice, + * but it needs careful testing. + * #if !HAVE_MBTOWC + * #define mbtowc(wcp, p, n) ((*wcp = *p), 1) + * #endif + */ + /* * Print a string, taking care with any non-printable characters. + * + * Note that we use a stack-allocated buffer to receive the formatted + * string if we can. This is partly performance (avoiding a call to + * malloc()), partly out of expedience (we have to call vsnprintf() + * before malloc() anyway to find out how big a buffer we need; we may + * as well point that first call at a small local buffer in case it + * works), but mostly for safety (so we can use this to print messages + * about out-of-memory conditions). */ void safe_fprintf(FILE *f, const char *fmt, ...) { - char *buff; - char *buff_heap; - int buff_length; + char fmtbuff_stack[256]; /* Place to format the printf() string. */ + char outbuff[256]; /* Buffer for outgoing characters. */ + char *fmtbuff_heap; /* If fmtbuff_stack is too small, we use malloc */ + char *fmtbuff; /* Pointer to fmtbuff_stack or fmtbuff_heap. */ + int fmtbuff_length; int length; va_list ap; - char *p; + const char *p; unsigned i; - char buff_stack[256]; - char copy_buff[256]; + wchar_t wc; + char try_wc; /* Use a stack-allocated buffer if we can, for speed and safety. */ - buff_heap = NULL; - buff_length = sizeof(buff_stack); - buff = buff_stack; + fmtbuff_heap = NULL; + fmtbuff_length = sizeof(fmtbuff_stack); + fmtbuff = fmtbuff_stack; + /* Try formatting into the stack buffer. */ va_start(ap, fmt); - length = vsnprintf(buff, buff_length, fmt, ap); + length = vsnprintf(fmtbuff, fmtbuff_length, fmt, ap); va_end(ap); - /* If the result is too large, allocate a buffer on the heap. */ - if (length >= buff_length) { - buff_length = length+1; - buff_heap = malloc(buff_length); - /* Failsafe: use the truncated string if malloc fails. */ - if (buff_heap != NULL) { - buff = buff_heap; + + /* If the result was too large, allocate a buffer on the heap. */ + if (length >= fmtbuff_length) { + fmtbuff_length = length+1; + fmtbuff_heap = malloc(fmtbuff_length); + + /* Reformat the result into the heap buffer if we can. */ + if (fmtbuff_heap != NULL) { + fmtbuff = fmtbuff_heap; va_start(ap, fmt); - length = vsnprintf(buff, buff_length, fmt, ap); + length = vsnprintf(fmtbuff, fmtbuff_length, fmt, ap); va_end(ap); + } else { + /* Leave fmtbuff pointing to the truncated + * string in fmtbuff_stack. */ + length = sizeof(fmtbuff_stack) - 1; } } + /* Note: mbrtowc() has a cleaner API, but mbtowc() seems a bit + * more portable, so we use that here instead. */ + mbtowc(NULL, NULL, 0); /* Reset the shift state. */ + /* Write data, expanding unprintable characters. */ - p = buff; + p = fmtbuff; i = 0; + try_wc = 1; while (*p != '\0') { - unsigned char c = *p++; + int n; - if (isprint(c) && c != '\\') - copy_buff[i++] = c; - else { - copy_buff[i++] = '\\'; - switch (c) { - case '\a': copy_buff[i++] = 'a'; break; - case '\b': copy_buff[i++] = 'b'; break; - case '\f': copy_buff[i++] = 'f'; break; - case '\n': copy_buff[i++] = 'n'; break; -#if '\r' != '\n' - /* On some platforms, \n and \r are the same. */ - case '\r': copy_buff[i++] = 'r'; break; -#endif - case '\t': copy_buff[i++] = 't'; break; - case '\v': copy_buff[i++] = 'v'; break; - case '\\': copy_buff[i++] = '\\'; break; - default: - sprintf(copy_buff + i, "%03o", c); - i += 3; + /* Convert to wide char, test if the wide + * char is printable in the current locale. */ + if (try_wc && (n = mbtowc(&wc, p, length)) != -1) { + length -= n; + if (iswprint(wc) && wc != L'\\') { + /* Printable, copy the bytes through. */ + while (n-- > 0) + outbuff[i++] = *p++; + } else { + /* Not printable, format the bytes. */ + while (n-- > 0) + i += bsdtar_expand_char( + outbuff, i, *p++); } + } else { + /* After any conversion failure, don't bother + * trying to convert the rest. */ + i += bsdtar_expand_char(outbuff, i, *p++); + try_wc = 0; } - /* If our temp buffer is full, dump it and keep going. */ - if (i > (sizeof(copy_buff) - 8)) { - copy_buff[i++] = '\0'; - fprintf(f, "%s", copy_buff); + /* If our output buffer is full, dump it and keep going. */ + if (i > (sizeof(outbuff) - 20)) { + outbuff[i++] = '\0'; + fprintf(f, "%s", outbuff); i = 0; } } - copy_buff[i++] = '\0'; - fprintf(f, "%s", copy_buff); + outbuff[i++] = '\0'; + fprintf(f, "%s", outbuff); + + /* If we allocated a heap-based formatting buffer, free it now. */ + if (fmtbuff_heap != NULL) + free(fmtbuff_heap); +} + +/* + * Render an arbitrary sequence of bytes into printable ASCII characters. + */ +static size_t +bsdtar_expand_char(char *buff, size_t offset, char c) +{ + size_t i = offset; + + if (isprint(c) && c != '\\') + buff[i++] = c; + else { + buff[i++] = '\\'; + switch (c) { + case '\a': buff[i++] = 'a'; break; + case '\b': buff[i++] = 'b'; break; + case '\f': buff[i++] = 'f'; break; + case '\n': buff[i++] = 'n'; break; +#if '\r' != '\n' + /* On some platforms, \n and \r are the same. */ + case '\r': buff[i++] = 'r'; break; +#endif + case '\t': buff[i++] = 't'; break; + case '\v': buff[i++] = 'v'; break; + case '\\': buff[i++] = '\\'; break; + default: + sprintf(buff + i, "%03o", 0xFF & (int)c); + i += 3; + } + } - /* If we allocated a heap-based buffer, free it now. */ - if (buff_heap != NULL) - free(buff_heap); + return (i - offset); } static void From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 20:16:53 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6557B1065670; Sat, 29 Nov 2008 20:16:53 +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 5717B8FC0C; Sat, 29 Nov 2008 20:16:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATKGreO061418; Sat, 29 Nov 2008 20:16:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATKGrZM061417; Sat, 29 Nov 2008 20:16:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811292016.mATKGrZM061417@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 29 Nov 2008 20:16:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185451 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 20:16:53 -0000 Author: kib Date: Sat Nov 29 20:16:53 2008 New Revision: 185451 URL: http://svn.freebsd.org/changeset/base/185451 Log: Third argument to the vi_mmap_t function is vm_paddr_t *. MFC after: 3 days Modified: head/sys/dev/fb/s3_pci.c Modified: head/sys/dev/fb/s3_pci.c ============================================================================== --- head/sys/dev/fb/s3_pci.c Sat Nov 29 20:06:53 2008 (r185450) +++ head/sys/dev/fb/s3_pci.c Sat Nov 29 20:16:53 2008 (r185451) @@ -389,7 +389,7 @@ s3lfb_blank_display(video_adapter_t *adp } static int -s3lfb_mmap(video_adapter_t *adp, vm_offset_t offset, vm_offset_t *paddr, +s3lfb_mmap(video_adapter_t *adp, vm_offset_t offset, vm_paddr_t *paddr, int prot) { return (*prevvidsw->mmap)(adp, offset, paddr, prot); From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 20:22:03 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71EC21065670; Sat, 29 Nov 2008 20:22:03 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 628918FC16; Sat, 29 Nov 2008 20:22:03 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATKM3cJ061559; Sat, 29 Nov 2008 20:22:03 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATKM3uY061556; Sat, 29 Nov 2008 20:22:03 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200811292022.mATKM3uY061556@svn.freebsd.org> From: Tim Kientzle Date: Sat, 29 Nov 2008 20:22:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185452 - in head/usr.bin/cpio: . test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 20:22:03 -0000 Author: kientzle Date: Sat Nov 29 20:22:02 2008 New Revision: 185452 URL: http://svn.freebsd.org/changeset/base/185452 Log: Format the output of -itv for real. In particular: * Lookup uname/gname if not provided by the archive (I copied the uname/gname lookup cache from bsdtar) * Format device number instead of size for device nodes * Format date. There's still a few improvements that I could copy from bsdtar, especially the locale-aware safe_fprintf() code and the locale-aware setup for day_first date formatting. (And, of course, I need to think through a clean way to push this stuff down into libarchive.) Thanks to Peter Wemm for reminding me of this overlooked TODO item. Modified: head/usr.bin/cpio/cpio.c head/usr.bin/cpio/cpio.h head/usr.bin/cpio/test/test_option_tv.stdout.uu Modified: head/usr.bin/cpio/cpio.c ============================================================================== --- head/usr.bin/cpio/cpio.c Sat Nov 29 20:16:53 2008 (r185451) +++ head/usr.bin/cpio/cpio.c Sat Nov 29 20:22:02 2008 (r185452) @@ -41,6 +41,12 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_FCNTL_H #include #endif +#ifdef HAVE_GRP_H +#include +#endif +#ifdef HAVE_PWD_H +#include +#endif #ifdef HAVE_STDARG_H #include #endif @@ -58,11 +64,32 @@ __FBSDID("$FreeBSD$"); #include "cpio.h" #include "matching.h" +/* Fixed size of uname/gname caches. */ +#define name_cache_size 101 + +struct name_cache { + int probes; + int hits; + size_t size; + struct { + id_t id; + char *name; + } cache[name_cache_size]; +}; + static int copy_data(struct archive *, struct archive *); static const char *cpio_rename(const char *name); static int entry_to_archive(struct cpio *, struct archive_entry *); static int file_to_archive(struct cpio *, const char *); +static void free_cache(struct name_cache *cache); +static void list_item_verbose(struct cpio *, struct archive_entry *); static void long_help(void); +static const char *lookup_gname(struct cpio *, gid_t gid); +static int lookup_gname_helper(struct cpio *, + const char **name, id_t gid); +static const char *lookup_uname(struct cpio *, uid_t uid); +static int lookup_uname_helper(struct cpio *, + const char **name, id_t uid); static void mode_in(struct cpio *); static void mode_list(struct cpio *); static void mode_out(struct cpio *); @@ -271,6 +298,8 @@ main(int argc, char *argv[]) "Must specify at least one of -i, -o, or -p"); } + free_cache(cpio->gname_cache); + free_cache(cpio->uname_cache); return (0); } @@ -805,18 +834,9 @@ mode_list(struct cpio *cpio) } if (excluded(cpio, archive_entry_pathname(entry))) continue; - if (cpio->verbose) { - /* TODO: uname/gname lookups */ - /* TODO: Clean this up. */ - fprintf(stdout, - "%s%3d %8s%8s " CPIO_FILESIZE_PRINTF " %s\n", - archive_entry_strmode(entry), - archive_entry_nlink(entry), - archive_entry_uname(entry), - archive_entry_gname(entry), - (CPIO_FILESIZE_TYPE)archive_entry_size(entry), - archive_entry_pathname(entry)); - } else + if (cpio->verbose) + list_item_verbose(cpio, entry); + else fprintf(stdout, "%s\n", archive_entry_pathname(entry)); } r = archive_read_close(a); @@ -832,6 +852,73 @@ mode_list(struct cpio *cpio) exit(0); } +/* + * Display information about the current file. + * + * The format here roughly duplicates the output of 'ls -l'. + * This is based on SUSv2, where 'tar tv' is documented as + * listing additional information in an "unspecified format," + * and 'pax -l' is documented as using the same format as 'ls -l'. + */ +static void +list_item_verbose(struct cpio *cpio, struct archive_entry *entry) +{ + char size[32]; + char date[32]; + const char *uname, *gname; + FILE *out = stdout; + const struct stat *st; + const char *fmt; + time_t tim; + static time_t now; + + st = archive_entry_stat(entry); + + if (!now) + time(&now); + + /* Use uname if it's present, else uid. */ + uname = archive_entry_uname(entry); + if (uname == NULL) + uname = lookup_uname(cpio, archive_entry_uid(entry)); + + /* Use gname if it's present, else gid. */ + gname = archive_entry_gname(entry); + if (gname == NULL) + gname = lookup_gname(cpio, archive_entry_gid(entry)); + + /* Print device number or file size. */ + if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode)) { + snprintf(size, sizeof(size), "%lu,%lu", + (unsigned long)major(st->st_rdev), + (unsigned long)minor(st->st_rdev)); /* ls(1) also casts here. */ + } else { + snprintf(size, sizeof(size), CPIO_FILESIZE_PRINTF, + (CPIO_FILESIZE_TYPE)st->st_size); + } + + /* Format the time using 'ls -l' conventions. */ + tim = (time_t)st->st_mtime; + if (abs(tim - now) > (365/2)*86400) + fmt = cpio->day_first ? "%e %b %Y" : "%b %e %Y"; + else + fmt = cpio->day_first ? "%e %b %H:%M" : "%b %e %H:%M"; + strftime(date, sizeof(date), fmt, localtime(&tim)); + + fprintf(out, "%s%3d %-8s %-8s %8s %12s %s", + archive_entry_strmode(entry), + archive_entry_nlink(entry), + uname, gname, size, date, + archive_entry_pathname(entry)); + + /* Extra information for links. */ + if (archive_entry_hardlink(entry)) /* Hard link */ + fprintf(out, " link to %s", archive_entry_hardlink(entry)); + else if (archive_entry_symlink(entry)) /* Symbolic link */ + fprintf(out, " -> %s", archive_entry_symlink(entry)); + fprintf(out, "\n"); +} + static void mode_pass(struct cpio *cpio, const char *destdir) { @@ -1040,3 +1127,123 @@ process_lines_free(struct line_reader *l free(lr->pathname); free(lr); } + +static void +free_cache(struct name_cache *cache) +{ + size_t i; + + if (cache != NULL) { + for (i = 0; i < cache->size; i++) + free(cache->cache[i].name); + free(cache); + } +} + +/* + * Lookup uname/gname from uid/gid, return NULL if no match. + */ +static const char * +lookup_name(struct cpio *cpio, struct name_cache **name_cache_variable, + int (*lookup_fn)(struct cpio *, const char **, id_t), id_t id) +{ + char asnum[16]; + struct name_cache *cache; + const char *name; + int slot; + + + if (*name_cache_variable == NULL) { + *name_cache_variable = malloc(sizeof(struct name_cache)); + if (*name_cache_variable == NULL) + cpio_errc(1, ENOMEM, "No more memory"); + memset(*name_cache_variable, 0, sizeof(struct name_cache)); + (*name_cache_variable)->size = name_cache_size; + } + + cache = *name_cache_variable; + cache->probes++; + + slot = id % cache->size; + if (cache->cache[slot].name != NULL) { + if (cache->cache[slot].id == id) { + cache->hits++; + return (cache->cache[slot].name); + } + free(cache->cache[slot].name); + cache->cache[slot].name = NULL; + } + + if (lookup_fn(cpio, &name, id) == 0) { + if (name == NULL || name[0] == '\0') { + /* If lookup failed, format it as a number. */ + snprintf(asnum, sizeof(asnum), "%u", (unsigned)id); + name = asnum; + } + cache->cache[slot].name = strdup(name); + if (cache->cache[slot].name != NULL) { + cache->cache[slot].id = id; + return (cache->cache[slot].name); + } + /* + * Conveniently, NULL marks an empty slot, so + * if the strdup() fails, we've just failed to + * cache it. No recovery necessary. + */ + } + return (NULL); +} + +static const char * +lookup_uname(struct cpio *cpio, uid_t uid) +{ + return (lookup_name(cpio, &cpio->uname_cache, + &lookup_uname_helper, (id_t)uid)); +} + +static int +lookup_uname_helper(struct cpio *cpio, const char **name, id_t id) +{ + struct passwd *pwent; + + (void)cpio; /* UNUSED */ + + errno = 0; + pwent = getpwuid((uid_t)id); + if (pwent == NULL) { + *name = NULL; + if (errno != 0) + cpio_warnc(errno, "getpwuid(%d) failed", id); + return (errno); + } + + *name = pwent->pw_name; + return (0); +} + +static const char * +lookup_gname(struct cpio *cpio, gid_t gid) +{ + return (lookup_name(cpio, &cpio->gname_cache, + &lookup_gname_helper, (id_t)gid)); +} + +static int +lookup_gname_helper(struct cpio *cpio, const char **name, id_t id) +{ + struct group *grent; + + (void)cpio; /* UNUSED */ + + errno = 0; + grent = getgrgid((gid_t)id); + if (grent == NULL) { + *name = NULL; + if (errno != 0) + cpio_warnc(errno, "getgrgid(%d) failed", id); + return (errno); + } + + *name = grent->gr_name; + return (0); +} Modified: head/usr.bin/cpio/cpio.h ============================================================================== --- head/usr.bin/cpio/cpio.h Sat Nov 29 20:16:53 2008 (r185451) +++ head/usr.bin/cpio/cpio.h Sat Nov 29 20:22:02 2008 (r185452) @@ -65,6 +65,7 @@ struct cpio { char *pass_destpath; int uid_override; int gid_override; + int day_first; /* true if locale prefers day/mon */ /* If >= 0, then close this when done. */ int fd; @@ -76,6 +77,9 @@ struct cpio { int return_value; /* Value returned by main() */ struct archive_entry_linkresolver *linkresolver; + struct name_cache *uname_cache; + struct name_cache *gname_cache; + /* Work data. */ struct matching *matching; char *buff; Modified: head/usr.bin/cpio/test/test_option_tv.stdout.uu ============================================================================== --- head/usr.bin/cpio/test/test_option_tv.stdout.uu Sat Nov 29 20:16:53 2008 (r185451) +++ head/usr.bin/cpio/test/test_option_tv.stdout.uu Sat Nov 29 20:22:02 2008 (r185452) @@ -1,5 +1,6 @@ $FreeBSD$ begin 644 test_option_tv.stdout -G+7)W+7(M+7(M+2`@(#$@("`H;G5L;"D@("AN=6QL*2`P(&9I;&4* +M+7)W+7(M+7(M+2`@(#$@=&EM("`@("`@=&EM("`@("`@("`@("`@(#`@1&5C +/(#,Q("`Q.38Y(&9I;&4* ` end From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 21:20:08 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12F6B1065676; Sat, 29 Nov 2008 21:20:08 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 075DE8FC13; Sat, 29 Nov 2008 21:20:08 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATLK7so062711; Sat, 29 Nov 2008 21:20:07 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATLK7iR062710; Sat, 29 Nov 2008 21:20:07 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811292120.mATLK7iR062710@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 29 Nov 2008 21:20:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185454 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 21:20:08 -0000 Author: marcel Date: Sat Nov 29 21:20:07 2008 New Revision: 185454 URL: http://svn.freebsd.org/changeset/base/185454 Log: Parse the error string returned by the kernel. The format is: [ ] So, rather than printing the error: gpart: 22 scheme 'gpt' gpart(8) now prints: gpart: scheme 'gpt': invalid argument Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Sat Nov 29 20:55:11 2008 (r185453) +++ head/sbin/geom/class/part/geom_part.c Sat Nov 29 21:20:07 2008 (r185454) @@ -63,10 +63,11 @@ static char index_param[] = "index"; static char partcode_param[] = "partcode"; static void gpart_bootcode(struct gctl_req *, unsigned int); +static void gpart_issue(struct gctl_req *, unsigned int); static void gpart_show(struct gctl_req *, unsigned int); struct g_command PUBSYM(class_commands)[] = { - { "add", 0, NULL, { + { "add", 0, gpart_issue, { { 'b', "start", NULL, G_TYPE_STRING }, { 's', "size", NULL, G_TYPE_STRING }, { 't', "type", NULL, G_TYPE_STRING }, @@ -84,25 +85,25 @@ struct g_command PUBSYM(class_commands)[ G_OPT_SENTINEL }, "geom", NULL }, - { "commit", 0, NULL, G_NULL_OPTS, "geom", NULL }, - { "create", 0, NULL, { + { "commit", 0, gpart_issue, G_NULL_OPTS, "geom", NULL }, + { "create", 0, gpart_issue, { { 's', "scheme", NULL, G_TYPE_STRING }, { 'n', "entries", optional, G_TYPE_STRING }, { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, "provider", NULL }, - { "delete", 0, NULL, { + { "delete", 0, gpart_issue, { { 'i', index_param, NULL, G_TYPE_STRING }, { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, "geom", NULL }, - { "destroy", 0, NULL, { + { "destroy", 0, gpart_issue, { { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, "geom", NULL }, - { "modify", 0, NULL, { + { "modify", 0, gpart_issue, { { 'i', index_param, NULL, G_TYPE_STRING }, { 'l', "label", optional, G_TYPE_STRING }, { 't', "type", optional, G_TYPE_STRING }, @@ -110,7 +111,7 @@ struct g_command PUBSYM(class_commands)[ G_OPT_SENTINEL }, "geom", NULL }, - { "set", 0, NULL, { + { "set", 0, gpart_issue, { { 'a', "attrib", NULL, G_TYPE_STRING }, { 'i', index_param, NULL, G_TYPE_STRING }, { 'f', "flags", flags, G_TYPE_STRING }, @@ -123,8 +124,8 @@ struct g_command PUBSYM(class_commands)[ G_OPT_SENTINEL }, NULL, "[-lr] [geom ...]" }, - { "undo", 0, NULL, G_NULL_OPTS, "geom", NULL }, - { "unset", 0, NULL, { + { "undo", 0, gpart_issue, G_NULL_OPTS, "geom", NULL }, + { "unset", 0, gpart_issue, { { 'a', "attrib", NULL, G_TYPE_STRING }, { 'i', index_param, NULL, G_TYPE_STRING }, { 'f', "flags", flags, G_TYPE_STRING }, @@ -446,7 +447,7 @@ gpart_write_partcode(struct gctl_req *re } static void -gpart_bootcode(struct gctl_req *req, unsigned int fl __unused) +gpart_bootcode(struct gctl_req *req, unsigned int fl) { const char *s; char *sp; @@ -501,9 +502,33 @@ gpart_bootcode(struct gctl_req *req, uns errx(EXIT_FAILURE, "no -b nor -p"); } - if (bootcode != NULL) { - s = gctl_issue(req); - if (s != NULL) - errx(EXIT_FAILURE, "%s", s); - } + if (bootcode != NULL) + gpart_issue(req, fl); +} + +static void +gpart_issue(struct gctl_req *req, unsigned int fl __unused) +{ + char buf[4096]; + char *errmsg; + const char *errstr; + int error; + + bzero(buf, sizeof(buf)); + gctl_rw_param(req, "output", sizeof(buf), buf); + errstr = gctl_issue(req); + gctl_free(req); + if (errstr == NULL || errstr[0] == '\0') { + if (buf[0] != '\0') + printf("%s", buf); + exit(EXIT_SUCCESS); + } + + error = strtol(errstr, &errmsg, 0); + while (errmsg[0] == ' ') + errmsg++; + if (errmsg[0] != '\0') + errc(EXIT_FAILURE, error, "%s", errmsg); + else + errc(EXIT_FAILURE, error, NULL); } From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 21:42:14 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29CCE1065686; Sat, 29 Nov 2008 21:42:14 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F5B48FC0C; Sat, 29 Nov 2008 21:42:14 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATLgDVo063183; Sat, 29 Nov 2008 21:42:13 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATLgDqJ063182; Sat, 29 Nov 2008 21:42:13 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200811292142.mATLgDqJ063182@svn.freebsd.org> From: Robert Watson Date: Sat, 29 Nov 2008 21:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185455 - in releng/7.1/contrib/smbfs: . lib/smb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 21:42:14 -0000 Author: rwatson Date: Sat Nov 29 21:42:13 2008 New Revision: 185455 URL: http://svn.freebsd.org/changeset/base/185455 Log: Merge r185437 from stable/7 to releng/7.1: Merge r184567 from head to stable/7: When encoding an smb name, truncate one byte earlier in order than we did previously in order to ensure it fit properly in the bufer when encoded. This prevents a debugging printf from firing if a source or destination host name for an smb mount exceeds 15 characters. Obtained from: Apple, Inc. Approved by: re (kensmith) Modified: releng/7.1/contrib/smbfs/ (props changed) releng/7.1/contrib/smbfs/lib/smb/nb_name.c Modified: releng/7.1/contrib/smbfs/lib/smb/nb_name.c ============================================================================== --- releng/7.1/contrib/smbfs/lib/smb/nb_name.c Sat Nov 29 21:20:07 2008 (r185454) +++ releng/7.1/contrib/smbfs/lib/smb/nb_name.c Sat Nov 29 21:42:13 2008 (r185455) @@ -169,7 +169,7 @@ nb_name_encode(struct nb_name *np, u_cha memsetw(cp + 2, NB_NAMELEN - 1, NBENCODE(' ')); cp += NB_ENCNAMELEN; } else { - for (i = 0; *name && i < NB_NAMELEN; i++, cp += 2, name++) + for (i = 0; *name && i < NB_NAMELEN - 1; i++, cp += 2, name++) *(u_short*)cp = NBENCODE(toupper(*name)); i = NB_NAMELEN - i - 1; if (i > 0) { From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 21:46:28 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A72D9106564A; Sat, 29 Nov 2008 21:46:28 +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 9D60C8FC14; Sat, 29 Nov 2008 21:46:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATLkS62063323; Sat, 29 Nov 2008 21:46:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATLkSee063322; Sat, 29 Nov 2008 21:46:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811292146.mATLkSee063322@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 29 Nov 2008 21:46:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185456 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 21:46:28 -0000 Author: kib Date: Sat Nov 29 21:46:28 2008 New Revision: 185456 URL: http://svn.freebsd.org/changeset/base/185456 Log: Unlock the malloc() locks in the child process after fork(). This gives us working malloc in the fork child of the multithreaded process. Although POSIX requires that only async-signal safe functions shall be operable after fork in multithreaded process, not having malloc lower the quality of our implementation. Tested by: rink Discussed with: kan, davidxu Reviewed by: kan MFC after: 1 month Modified: head/lib/libthr/thread/thr_fork.c Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Sat Nov 29 21:42:13 2008 (r185455) +++ head/lib/libthr/thread/thr_fork.c Sat Nov 29 21:46:28 2008 (r185456) @@ -172,6 +172,7 @@ _fork(void) if (unlock_malloc) { _rtld_atfork_post(rtld_locks); + _malloc_postfork(); } /* Run down atfork child handlers. */ From owner-svn-src-all@FreeBSD.ORG Sat Nov 29 21:48:13 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3999C106567C; Sat, 29 Nov 2008 21:48:13 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F8998FC14; Sat, 29 Nov 2008 21:48:13 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mATLmDWP063390; Sat, 29 Nov 2008 21:48:13 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mATLmCdT063389; Sat, 29 Nov 2008 21:48:12 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200811292148.mATLmCdT063389@svn.freebsd.org> From: Robert Watson Date: Sat, 29 Nov 2008 21:48:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185457 - in releng/7.1/sys: . security/mac_bsdextended X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2008 21:48:13 -0000 Author: rwatson Date: Sat Nov 29 21:48:12 2008 New Revision: 185457 URL: http://svn.freebsd.org/changeset/base/185457 Log: Merge r185440 from stable/7 to releng/7.1: Merge r184367 from head to stable/7: When the mac_bsdextended policy is unloaded, free rule memory. Obtained from: TrustedBSD Project Approved by: re (kensmith) Modified: releng/7.1/sys/ (props changed) releng/7.1/sys/security/mac_bsdextended/mac_bsdextended.c Modified: releng/7.1/sys/security/mac_bsdextended/mac_bsdextended.c ============================================================================== --- releng/7.1/sys/security/mac_bsdextended/mac_bsdextended.c Sat Nov 29 21:46:28 2008 (r185456) +++ releng/7.1/sys/security/mac_bsdextended/mac_bsdextended.c Sat Nov 29 21:48:12 2008 (r185457) @@ -208,7 +208,12 @@ ugidfw_init(struct mac_policy_conf *mpc) static void ugidfw_destroy(struct mac_policy_conf *mpc) { + int i; + for (i = 0; i < MAC_BSDEXTENDED_MAXRULES; i++) { + if (rules[i] != NULL) + free(rules[i], M_MACBSDEXTENDED); + } mtx_destroy(&ugidfw_mtx); }