From owner-svn-src-stable-7@FreeBSD.ORG Sun May 9 08:22:33 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EA6B31065670; Sun, 9 May 2010 08:22:33 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D952A8FC12; Sun, 9 May 2010 08:22:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o498MXUC077397; Sun, 9 May 2010 08:22:33 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o498MXWF077394; Sun, 9 May 2010 08:22:33 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201005090822.o498MXWF077394@svn.freebsd.org> From: Doug Barton Date: Sun, 9 May 2010 08:22:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207811 - in stable/7/etc: . rc.d X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2010 08:22:34 -0000 Author: dougb Date: Sun May 9 08:22:33 2010 New Revision: 207811 URL: http://svn.freebsd.org/changeset/base/207811 Log: rc_quiet does not exist in RELENG_7, so hand-merge the part of r179870 that I did not think was applicable here (namely bailing out of run_rc_command before printing the warning) but use rc_fast as the trigger instead of rc_quiet. The former exists in all supported branches, and is set at boot time so it does the job. The only remaining element that isn't already covered by 'faststart' is an instance of '/etc/rc.d/ipfilter resync' in rc.d/netif, so make that fastresync to also silence the warning there. This is similar to what was done in r175676, although that used quietresync (as described above). Pointed out by: jhell Modified: stable/7/etc/rc.d/netif stable/7/etc/rc.subr Modified: stable/7/etc/rc.d/netif ============================================================================== --- stable/7/etc/rc.d/netif Sun May 9 06:52:32 2010 (r207810) +++ stable/7/etc/rc.d/netif Sun May 9 08:22:33 2010 (r207811) @@ -72,7 +72,7 @@ network_start() if [ -f /etc/rc.d/ipfilter ] ; then # Resync ipfilter - /etc/rc.d/ipfilter resync + /etc/rc.d/ipfilter fastresync fi if [ -f /etc/rc.d/bridge -a -n "$cmdifn" ] ; then /etc/rc.d/bridge start $cmdifn Modified: stable/7/etc/rc.subr ============================================================================== --- stable/7/etc/rc.subr Sun May 9 06:52:32 2010 (r207810) +++ stable/7/etc/rc.subr Sun May 9 08:22:33 2010 (r207811) @@ -616,6 +616,9 @@ run_rc_command() # if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" -a -z "${rc_pid}" ]; then if ! checkyesno ${rcvar}; then + if [ -n "$rc_fast" ]; then + return 0 + fi echo -n "Cannot '${rc_arg}' $name. Set ${rcvar} to " echo -n "YES in /etc/rc.conf or use 'one${rc_arg}' " echo "instead of '${rc_arg}'." From owner-svn-src-stable-7@FreeBSD.ORG Sun May 9 15:41:27 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D55831065675; Sun, 9 May 2010 15:41:27 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C475D8FC1F; Sun, 9 May 2010 15:41:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o49FfRhg074977; Sun, 9 May 2010 15:41:27 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o49FfRCD074975; Sun, 9 May 2010 15:41:27 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201005091541.o49FfRCD074975@svn.freebsd.org> From: Fabien Thomas Date: Sun, 9 May 2010 15:41:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207819 - stable/7/usr.sbin/pmcstat X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2010 15:41:27 -0000 Author: fabient Date: Sun May 9 15:41:27 2010 New Revision: 207819 URL: http://svn.freebsd.org/changeset/base/207819 Log: MFC r207731: Exclude undefined symbol from ELF file when doing function resolve. Modified: stable/7/usr.sbin/pmcstat/pmcstat_log.c Directory Properties: stable/7/usr.sbin/pmcstat/ (props changed) Modified: stable/7/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcstat_log.c Sun May 9 15:39:49 2010 (r207818) +++ stable/7/usr.sbin/pmcstat/pmcstat_log.c Sun May 9 15:41:27 2010 (r207819) @@ -539,6 +539,8 @@ pmcstat_image_add_symbols(struct pmcstat return; if (GELF_ST_TYPE(sym.st_info) != STT_FUNC) continue; + if (sym.st_shndx == STN_UNDEF) + continue; if (!firsttime && pmcstat_symbol_search(image, sym.st_value)) continue; /* We've seen this symbol already. */ From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 01:23:31 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EAA251065679; Mon, 10 May 2010 01:23:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id DA4BA8FC25; Mon, 10 May 2010 01:23:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4A1NVp4002887; Mon, 10 May 2010 01:23:31 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4A1NVQh002885; Mon, 10 May 2010 01:23:31 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201005100123.o4A1NVQh002885@svn.freebsd.org> From: Ed Maste Date: Mon, 10 May 2010 01:23:31 +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: r207836 - stable/7/usr.sbin/zic X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 01:23:32 -0000 Author: emaste Date: Mon May 10 01:23:31 2010 New Revision: 207836 URL: http://svn.freebsd.org/changeset/base/207836 Log: MFC r207590: Update GRANDPARENTED text to match the contents of tzdata/factory r19879. This eliminates "warning: time zone abbreviation differs from POSIX" on installworld. Modified: stable/7/usr.sbin/zic/private.h Directory Properties: stable/7/usr.sbin/zic/ (props changed) Modified: stable/7/usr.sbin/zic/private.h ============================================================================== --- stable/7/usr.sbin/zic/private.h Mon May 10 01:22:29 2010 (r207835) +++ stable/7/usr.sbin/zic/private.h Mon May 10 01:23:31 2010 (r207836) @@ -34,7 +34,7 @@ static const char privatehid[] = "@(#)pr #endif /* !defined NOID */ #endif /* !defined lint */ -#define GRANDPARENTED "Local time zone must be set--see zic manual page" +#define GRANDPARENTED "Local time zone must be set--use tzsetup" /* ** Defaults for preprocessor symbols. From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 02:09:53 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D3AD7106566B; Mon, 10 May 2010 02:09:53 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C220E8FC17; Mon, 10 May 2010 02:09:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4A29rLo013210; Mon, 10 May 2010 02:09:53 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4A29rEZ013206; Mon, 10 May 2010 02:09:53 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201005100209.o4A29rEZ013206@svn.freebsd.org> From: Xin LI Date: Mon, 10 May 2010 02:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207839 - stable/7/usr.bin/gzip X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 02:09:53 -0000 Author: delphij Date: Mon May 10 02:09:53 2010 New Revision: 207839 URL: http://svn.freebsd.org/changeset/base/207839 Log: MFC most of the recent changes to gzip(1) back to RELENG_7. Modified: stable/7/usr.bin/gzip/gzip.1 stable/7/usr.bin/gzip/gzip.c stable/7/usr.bin/gzip/unbzip2.c Directory Properties: stable/7/usr.bin/gzip/ (props changed) Modified: stable/7/usr.bin/gzip/gzip.1 ============================================================================== --- stable/7/usr.bin/gzip/gzip.1 Mon May 10 02:07:57 2010 (r207838) +++ stable/7/usr.bin/gzip/gzip.1 Mon May 10 02:09:53 2010 (r207839) @@ -25,7 +25,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd June 24, 2009 +.Dd April 27, 2010 .Dt GZIP 1 .Os .Sh NAME @@ -205,18 +205,21 @@ This implementation of .Nm was ported based on the .Nx -.Nm -20090412, and first appeared in +.Nm , +and first appeared in .Fx 7.0 . .Sh AUTHORS +.An -nosplit This implementation of .Nm was written by -.An Matthew R. Green Aq mrg@eterna.com.au . +.An Matthew R. Green Aq mrg@eterna.com.au +with unpack support written by +.An Xin LI Aq delphij@FreeBSD.org . .Sh BUGS According to RFC 1952, the recorded file size is stored in a 32-bit -integer and therefore it can not represent files that is bigger than -4GB in size. This limitation also applies to +integer, therefore, it can not represent files larger than 4GB. +This limitation also applies to .Fl l option of .Nm Modified: stable/7/usr.bin/gzip/gzip.c ============================================================================== --- stable/7/usr.bin/gzip/gzip.c Mon May 10 02:07:57 2010 (r207838) +++ stable/7/usr.bin/gzip/gzip.c Mon May 10 02:09:53 2010 (r207839) @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.94 2009/04/12 10:31:14 lukem Exp $ */ +/* $NetBSD: gzip.c,v 1.97 2009/10/11 09:17:21 mrg Exp $ */ /*- * Copyright (c) 1997, 1998, 2003, 2004, 2006 Matthew R. Green @@ -43,7 +43,6 @@ __RCSID("$FreeBSD$"); * * TODO: * - use mmap where possible - * - handle some signals better (remove outfile?) * - make bzip2/compress -v/-t/-l support work as well as possible */ @@ -149,8 +148,9 @@ static suffixes_t suffixes[] = { #undef SUFFIX }; #define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0]) +#define SUFFIX_MAXLEN 30 -static const char gzip_version[] = "FreeBSD gzip 20090621"; +static const char gzip_version[] = "FreeBSD gzip 20100407"; #ifndef SMALL static const char gzip_copyright[] = \ @@ -193,6 +193,7 @@ static int qflag; /* quiet mode */ static int rflag; /* recursive mode */ static int tflag; /* test */ static int vflag; /* verbose mode */ +static const char *remove_file = NULL; /* file to be removed upon SIGINT */ #else #define qflag 0 #define tflag 0 @@ -204,7 +205,7 @@ static char *infile; /* name of file co static void maybe_err(const char *fmt, ...) __dead2 __attribute__((__format__(__printf__, 1, 2))); -#ifndef NO_BZIP2_SUPPORT +#if !defined(NO_BZIP2_SUPPORT) || !defined(NO_PACK_SUPPORT) static void maybe_errx(const char *fmt, ...) __dead2 __attribute__((__format__(__printf__, 1, 2))); #endif @@ -230,6 +231,7 @@ static void usage(void); static void display_version(void); #ifndef SMALL static void display_license(void); +static void sigint_handler(int); #endif static const suffixes_t *check_suffix(char *, int); static ssize_t read_retry(int, void *, size_t); @@ -299,11 +301,10 @@ main(int argc, char **argv) #endif int ch; - /* XXX set up signals */ - #ifndef SMALL if ((gzip = getenv("GZIP")) != NULL) prepend_gzip(gzip, &argc, &argv); + signal(SIGINT, sigint_handler); #endif /* @@ -372,6 +373,8 @@ main(int argc, char **argv) case 'S': len = strlen(optarg); if (len != 0) { + if (len > SUFFIX_MAXLEN) + errx(1, "incorrect suffix: '%s': too long", optarg); suffixes[0].zipped = optarg; suffixes[0].ziplen = len; } else { @@ -457,7 +460,7 @@ maybe_err(const char *fmt, ...) exit(2); } -#ifndef NO_BZIP2_SUPPORT +#if !defined(NO_BZIP2_SUPPORT) || !defined(NO_PACK_SUPPORT) /* ... without an errno. */ void maybe_errx(const char *fmt, ...) @@ -1168,6 +1171,15 @@ unlink_input(const char *file, const str return; unlink(file); } + +static void +sigint_handler(int signo __unused) +{ + + if (remove_file != NULL) + unlink(remove_file); + _exit(2); +} #endif static const suffixes_t * @@ -1236,7 +1248,7 @@ file_compress(char *file, char *outfile, /* Add (usually) .gz to filename */ if ((size_t)snprintf(outfile, outsize, "%s%s", file, suffixes[0].zipped) >= outsize) - memcpy(outfile - suffixes[0].ziplen - 1, + memcpy(outfile + outsize - suffixes[0].ziplen - 1, suffixes[0].zipped, suffixes[0].ziplen + 1); #ifndef SMALL @@ -1254,6 +1266,9 @@ file_compress(char *file, char *outfile, fclose(stdin); return -1; } +#ifndef SMALL + remove_file = outfile; +#endif } else out = STDOUT_FILENO; @@ -1285,6 +1300,7 @@ file_compress(char *file, char *outfile, } copymodes(out, &isb, outfile); + remove_file = NULL; #endif if (close(out) == -1) maybe_warn("couldn't close output"); @@ -1315,6 +1331,7 @@ file_uncompress(char *file, char *outfil enum filetype method; int fd, ofd, zfd = -1; #ifndef SMALL + ssize_t rv; time_t timestamp = 0; unsigned char name[PATH_MAX + 1]; #endif @@ -1360,7 +1377,6 @@ file_uncompress(char *file, char *outfil #ifndef SMALL if (method == FT_GZIP && Nflag) { unsigned char ts[4]; /* timestamp */ - ssize_t rv; rv = pread(fd, ts, sizeof ts, GZIP_TIMESTAMP); if (rv >= 0 && rv < (ssize_t)(sizeof ts)) @@ -1421,6 +1437,9 @@ file_uncompress(char *file, char *outfil maybe_warn("can't open %s", outfile); goto lose; } +#ifndef SMALL + remove_file = outfile; +#endif } else zfd = STDOUT_FILENO; @@ -1552,11 +1571,12 @@ file_uncompress(char *file, char *outfil unlink(outfile); return -1; } - unlink_input(file, &isb); #ifndef SMALL copymodes(ofd, &isb, outfile); + remove_file = NULL; #endif close(ofd); + unlink_input(file, &isb); return size; unexpected_EOF: @@ -2050,7 +2070,7 @@ static void display_license(void) { - fprintf(stderr, "%s (based on NetBSD gzip 20060927)\n", gzip_version); + fprintf(stderr, "%s (based on NetBSD gzip 20091011)\n", gzip_version); fprintf(stderr, "%s\n", gzip_copyright); exit(0); } @@ -2096,4 +2116,3 @@ read_retry(int fd, void *buf, size_t sz) return sz - left; } - Modified: stable/7/usr.bin/gzip/unbzip2.c ============================================================================== --- stable/7/usr.bin/gzip/unbzip2.c Mon May 10 02:07:57 2010 (r207838) +++ stable/7/usr.bin/gzip/unbzip2.c Mon May 10 02:09:53 2010 (r207839) @@ -1,4 +1,4 @@ -/* $NetBSD: unbzip2.c,v 1.12 2009/10/11 05:17:20 mrg Exp $ */ +/* $NetBSD: unbzip2.c,v 1.13 2009/12/05 03:23:37 mrg Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 18:40:37 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A7F681065670; Mon, 10 May 2010 18:40:37 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 9633A8FC16; Mon, 10 May 2010 18:40:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AIeb4Y034235; Mon, 10 May 2010 18:40:37 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AIebWP034233; Mon, 10 May 2010 18:40:37 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201005101840.o4AIebWP034233@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 10 May 2010 18:40: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: r207856 - stable/7/sys/dev/sge X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 18:40:37 -0000 Author: yongari Date: Mon May 10 18:40:37 2010 New Revision: 207856 URL: http://svn.freebsd.org/changeset/base/207856 Log: MFC r207545,207625: r207545: Fix wrong dma tag usage. Previously it used TX descriptor ring dma tag which should be TX mbuf dma tag. r207625: Remove clearing RxHashTable2 register. The register is reprogrammed in sge_rxfilter(). Modified: stable/7/sys/dev/sge/if_sge.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/sge/if_sge.c ============================================================================== --- stable/7/sys/dev/sge/if_sge.c Mon May 10 18:37:46 2010 (r207855) +++ stable/7/sys/dev/sge/if_sge.c Mon May 10 18:40:37 2010 (r207856) @@ -1421,7 +1421,7 @@ sge_encap(struct sge_softc *sc, struct m } *m_head = m; } - error = bus_dmamap_load_mbuf_sg(sc->sge_cdata.sge_tx_tag, map, + error = bus_dmamap_load_mbuf_sg(sc->sge_cdata.sge_txmbuf_tag, map, *m_head, txsegs, &nsegs, 0); if (error != 0) { m_freem(*m_head); @@ -1430,10 +1430,11 @@ sge_encap(struct sge_softc *sc, struct m } /* Check descriptor overrun. */ if (sc->sge_cdata.sge_tx_cnt + nsegs >= SGE_TX_RING_CNT) { - bus_dmamap_unload(sc->sge_cdata.sge_tx_tag, map); + bus_dmamap_unload(sc->sge_cdata.sge_txmbuf_tag, map); return (ENOBUFS); } - bus_dmamap_sync(sc->sge_cdata.sge_tx_tag, map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->sge_cdata.sge_txmbuf_tag, map, + BUS_DMASYNC_PREWRITE); cflags = 0; if ((*m_head)->m_pkthdr.csum_flags & CSUM_IP) @@ -1576,7 +1577,6 @@ sge_init_locked(struct sge_softc *sc) CSR_WRITE_4(sc, RX_DESC, SGE_ADDR_LO(sc->sge_ldata.sge_rx_paddr)); CSR_WRITE_4(sc, TxMacControl, 0x60); - CSR_WRITE_4(sc, 0x6c, 0); CSR_WRITE_4(sc, RxWakeOnLan, 0); CSR_WRITE_4(sc, RxWakeOnLanData, 0); /* Allow receiving VLAN frames. */ From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 18:43:45 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0A3A71065678; Mon, 10 May 2010 18:43:45 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id ECDA78FC1E; Mon, 10 May 2010 18:43:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AIhi52035103; Mon, 10 May 2010 18:43:44 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AIhi3t035102; Mon, 10 May 2010 18:43:44 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005101843.o4AIhi3t035102@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 18:43:44 +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: r207858 - stable/7/sys/sparc64/sparc64 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 18:43:45 -0000 Author: marius Date: Mon May 10 18:43:44 2010 New Revision: 207858 URL: http://svn.freebsd.org/changeset/base/207858 Log: MFC: r207240 Skip the pseudo-devices found in Fujitsu Siemens PRIMEPOWER250. Modified: stable/7/sys/sparc64/sparc64/nexus.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/sparc64/nexus.c ============================================================================== --- stable/7/sys/sparc64/sparc64/nexus.c Mon May 10 18:41:27 2010 (r207857) +++ stable/7/sys/sparc64/sparc64/nexus.c Mon May 10 18:43:44 2010 (r207858) @@ -152,6 +152,7 @@ DRIVER_MODULE(nexus, root, nexus_driver, MODULE_VERSION(nexus, 1); static const char *const nexus_excl_name[] = { + "FJSV,system", "aliases", "associations", "chosen", @@ -162,6 +163,7 @@ static const char *const nexus_excl_name "openprom", "options", "packages", + "physical-memory", "rsc", "sgcn", "todsg", From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 18:45:20 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D7D35106566B; Mon, 10 May 2010 18:45:20 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C69958FC13; Mon, 10 May 2010 18:45:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AIjK5R035541; Mon, 10 May 2010 18:45:20 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AIjKjb035539; Mon, 10 May 2010 18:45:20 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005101845.o4AIjKjb035539@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 18:45: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: r207860 - stable/7/sys/sparc64/isa X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 18:45:21 -0000 Author: marius Date: Mon May 10 18:45:20 2010 New Revision: 207860 URL: http://svn.freebsd.org/changeset/base/207860 Log: MFC: r207241 - Add a missing const. - Map the NS16550 found in Fujitsu Siemens PRIMEPOWER250 to PNP0501 as well. Modified: stable/7/sys/sparc64/isa/isa.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/isa/isa.c ============================================================================== --- stable/7/sys/sparc64/isa/isa.c Mon May 10 18:45:18 2010 (r207859) +++ stable/7/sys/sparc64/isa/isa.c Mon May 10 18:45:20 2010 (r207860) @@ -116,7 +116,7 @@ isa_init(device_t dev) } static const struct { - const char *name; + const char *const name; uint32_t id; } const ofw_isa_pnp_map[] = { { "SUNW,lomh", 0x0000ae4e }, /* SUN0000 */ @@ -126,6 +126,7 @@ static const struct { { "flashprom", 0x0100ae4e }, /* SUN0001 */ { "parallel", 0x0104d041 }, /* PNP0401 */ { "serial", 0x0105d041 }, /* PNP0501 */ + { "su", 0x0105d041 }, /* PNP0501 */ { "i2c", 0x0200ae4e }, /* SUN0002 */ { "rmc-comm", 0x0300ae4e }, /* SUN0003 */ { "kb_ps2", 0x0303d041 }, /* PNP0303 */ From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 18:46:38 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 27B771065679; Mon, 10 May 2010 18:46:38 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 165BB8FC14; Mon, 10 May 2010 18:46:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AIkbRm035940; Mon, 10 May 2010 18:46:37 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AIkbh8035938; Mon, 10 May 2010 18:46:37 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005101846.o4AIkbh8035938@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 18:46: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: r207862 - stable/7/sys/dev/bge X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 18:46:38 -0000 Author: marius Date: Mon May 10 18:46:37 2010 New Revision: 207862 URL: http://svn.freebsd.org/changeset/base/207862 Log: MFC: r207242 For the on-board interfaces found in Fujitsu SPARC64 machines obtain the MAC address via OFW as well. Modified: stable/7/sys/dev/bge/if_bge.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Mon May 10 18:46:37 2010 (r207861) +++ stable/7/sys/dev/bge/if_bge.c Mon May 10 18:46:37 2010 (r207862) @@ -520,7 +520,7 @@ bge_has_eaddr(struct bge_softc *sc) */ if (OF_getprop(ofw_bus_get_node(dev), SPARC64_OFW_SUBVENDOR, &subvendor, sizeof(subvendor)) == sizeof(subvendor) && - subvendor == SUN_VENDORID) + (subvendor == FJTSU_VENDORID || subvendor == SUN_VENDORID)) return (0); memset(buf, 0, sizeof(buf)); if (OF_package_to_path(ofw_bus_get_node(dev), buf, sizeof(buf)) > 0) { From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 18:47:54 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D954E1065676; Mon, 10 May 2010 18:47:54 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C714F8FC19; Mon, 10 May 2010 18:47:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AIls62036305; Mon, 10 May 2010 18:47:54 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AIls4v036301; Mon, 10 May 2010 18:47:54 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005101847.o4AIls4v036301@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 18:47:54 +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: r207864 - in stable/7/sys: sparc64/include sparc64/sparc64 sun4v/include X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 18:47:55 -0000 Author: marius Date: Mon May 10 18:47:54 2010 New Revision: 207864 URL: http://svn.freebsd.org/changeset/base/207864 Log: MFC: r207243 Add OF_getscsinitid(), a helper similar to OF_getetheraddr() but for obtaining the initiator ID to be used for SPI controllers from the Open Firmware device tree. Modified: stable/7/sys/sparc64/include/ofw_machdep.h stable/7/sys/sparc64/sparc64/ofw_machdep.c stable/7/sys/sun4v/include/ofw_machdep.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/include/ofw_machdep.h ============================================================================== --- stable/7/sys/sparc64/include/ofw_machdep.h Mon May 10 18:47:52 2010 (r207863) +++ stable/7/sys/sparc64/include/ofw_machdep.h Mon May 10 18:47:54 2010 (r207864) @@ -32,6 +32,7 @@ int OF_decode_addr(phandle_t, int, int *, bus_addr_t *); void OF_getetheraddr(device_t, u_char *); +u_int OF_getscsinitid(device_t); void cpu_shutdown(void *); void openfirmware_exit(void *); Modified: stable/7/sys/sparc64/sparc64/ofw_machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/ofw_machdep.c Mon May 10 18:47:52 2010 (r207863) +++ stable/7/sys/sparc64/sparc64/ofw_machdep.c Mon May 10 18:47:54 2010 (r207864) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2001 by Thomas Moestl . - * Copyright (c) 2005 - 2009 by Marius Strobl . + * Copyright (c) 2005 - 2010 by Marius Strobl . * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -69,6 +69,19 @@ OF_getetheraddr(device_t dev, u_char *ad bcopy(&idp.id_ether, addr, ETHER_ADDR_LEN); } +u_int +OF_getscsinitid(device_t dev) +{ + phandle_t node; + uint32_t id; + + for (node = ofw_bus_get_node(dev); node != 0; node = OF_parent(node)) + if (OF_getprop(node, "scsi-initiator-id", &id, + sizeof(id)) > 0) + return (id); + return (7); +} + static __inline uint32_t phys_hi_mask_space(const char *bus, uint32_t phys_hi) { Modified: stable/7/sys/sun4v/include/ofw_machdep.h ============================================================================== --- stable/7/sys/sun4v/include/ofw_machdep.h Mon May 10 18:47:52 2010 (r207863) +++ stable/7/sys/sun4v/include/ofw_machdep.h Mon May 10 18:47:54 2010 (r207864) @@ -32,6 +32,7 @@ int OF_decode_addr(phandle_t, int, int *, bus_addr_t *); void OF_getetheraddr(device_t, u_char *); +u_int OF_getscsinitid(device_t); void cpu_shutdown(void *); void openfirmware_exit(void *); From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 18:50:28 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A732A106566C; Mon, 10 May 2010 18:50:28 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 953128FC21; Mon, 10 May 2010 18:50:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AIoS0k036967; Mon, 10 May 2010 18:50:28 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AIoSvv036961; Mon, 10 May 2010 18:50:28 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005101850.o4AIoSvv036961@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 18:50:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207866 - stable/7/sys/sparc64/sparc64 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 18:50:28 -0000 Author: marius Date: Mon May 10 18:50:28 2010 New Revision: 207866 URL: http://svn.freebsd.org/changeset/base/207866 Log: MFC: r207248 Don't bother enabling interrupts before we're ready to handle them. This prevents the firmware of Fujitsu Siemens PRIMEPOWER250, which both causes stray interrupts and erroneously enables interrupts at least when calling SUNW,set-trap-table, from shooting itself in the foot. Modified: stable/7/sys/sparc64/sparc64/cheetah.c stable/7/sys/sparc64/sparc64/locore.S stable/7/sys/sparc64/sparc64/machdep.c stable/7/sys/sparc64/sparc64/mp_locore.S stable/7/sys/sparc64/sparc64/mp_machdep.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/sparc64/cheetah.c ============================================================================== --- stable/7/sys/sparc64/sparc64/cheetah.c Mon May 10 18:50:26 2010 (r207865) +++ stable/7/sys/sparc64/sparc64/cheetah.c Mon May 10 18:50:28 2010 (r207866) @@ -58,13 +58,6 @@ void cheetah_init(u_int cpu_impl) { u_long val; - register_t s; - - /* - * Disable interrupts for safety, this shouldn't be actually - * necessary though. - */ - s = intr_disable(); /* Ensure the TSB Extension Registers hold 0 as TSB_Base. */ @@ -134,8 +127,6 @@ cheetah_init(u_int cpu_impl) val &= ~DCR_DTPE; } wr(asr18, val, 0); - - intr_restore(s); } /* Modified: stable/7/sys/sparc64/sparc64/locore.S ============================================================================== --- stable/7/sys/sparc64/sparc64/locore.S Mon May 10 18:50:26 2010 (r207865) +++ stable/7/sys/sparc64/sparc64/locore.S Mon May 10 18:50:28 2010 (r207866) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -47,7 +48,7 @@ ENTRY(btext) ENTRY(_start) /* * Initialize misc. state to known values: interrupts disabled, normal - * globals, windows flushed (cr = 0, cs = nwindows - 1), PIL 0 and + * globals, windows flushed (cr = 0, cs = nwindows - 1), PIL_TICK and * floating point disabled. * Note that some firmware versions don't implement a clean window * trap handler so we unfortunately can't clear the windows by setting @@ -55,7 +56,7 @@ ENTRY(_start) */ wrpr %g0, PSTATE_NORMAL, %pstate flushw - wrpr %g0, 0, %pil + wrpr %g0, PIL_TICK, %pil wr %g0, 0, %fprs /* @@ -66,11 +67,6 @@ ENTRY(_start) sub %l0, SPOFF + CCFSZ, %sp /* - * Enable interrupts. - */ - wrpr %g0, PSTATE_KERNEL, %pstate - - /* * Do initial bootstrap to setup pmap and thread0. */ call sparc64_init @@ -97,7 +93,7 @@ ENTRY(cpu_setregs) ldx [%o0 + PC_CURPCB], %o1 /* - * Disable interrupts, normal globals. + * Ensure we are on normal globals. */ wrpr %g0, PSTATE_NORMAL, %pstate @@ -147,11 +143,6 @@ ENTRY(cpu_setregs) wrpr %o1, 0, %tba stw %o3, [%o2] - /* - * Re-enable interrupts. - */ - wrpr %g0, PSTATE_KERNEL, %pstate - retl nop END(cpu_setregs) Modified: stable/7/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/machdep.c Mon May 10 18:50:26 2010 (r207865) +++ stable/7/sys/sparc64/sparc64/machdep.c Mon May 10 18:50:28 2010 (r207866) @@ -340,7 +340,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l cpu_impl = VER_IMPL(rdpr(ver)); /* - * Do CPU-specific Initialization. + * Do CPU-specific initialization. */ if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) cheetah_init(cpu_impl); @@ -469,6 +469,10 @@ sparc64_init(caddr_t mdp, u_long o1, u_l sizeof(itlb_slots)) == -1) panic("sparc64_init: cannot determine number of iTLB slots"); + /* + * Initialize and enable the caches. Note that his may include + * applying workarounds. + */ cache_init(pc); cache_enable(cpu_impl); uma_set_align(pc->pc_cache.dc_linesize - 1); @@ -558,8 +562,18 @@ sparc64_init(caddr_t mdp, u_long o1, u_l */ msgbufinit(msgbufp, MSGBUF_SIZE); + /* + * Initialize mutexes. + */ mutex_init(); + + /* + * Finish the interrupt initialization now that mutexes work and + * enable them. + */ intr_init2(); + wrpr(pil, 0, PIL_TICK); + wrpr(pstate, 0, PSTATE_KERNEL); /* * Finish pmap initialization now that we're ready for mutexes. Modified: stable/7/sys/sparc64/sparc64/mp_locore.S ============================================================================== --- stable/7/sys/sparc64/sparc64/mp_locore.S Mon May 10 18:50:26 2010 (r207865) +++ stable/7/sys/sparc64/sparc64/mp_locore.S Mon May 10 18:50:28 2010 (r207866) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -44,14 +45,14 @@ __FBSDID("$FreeBSD$"); _ALIGN_TEXT /* * Initialize misc. state to known values: interrupts disabled, normal - * globals, windows flushed (cr = 0, cs = nwindows - 1), PIL 0 and + * globals, windows flushed (cr = 0, cs = nwindows - 1), PIL_TICK and * floating point disabled. * Note that some firmware versions don't implement a clean window * trap handler so we unfortunately can't clear the windows by setting * %cleanwin to zero here. */ 1: wrpr %g0, PSTATE_NORMAL, %pstate - wrpr %g0, 0, %pil + wrpr %g0, PIL_TICK, %pil wr %g0, 0, %fprs rdpr %ver, %l7 @@ -262,11 +263,6 @@ ENTRY(mp_startup) add %l1, %l2, %l1 sub %l1, SPOFF + CCFSZ, %sp - /* - * Enable interrupts. - */ - wrpr %g0, PSTATE_KERNEL, %pstate - #if KTR_COMPILE & KTR_SMP CATR(KTR_SMP, "mp_startup: bootstrap cpuid=%d mid=%d pcpu=%#lx data=%#lx sp=%#lx" Modified: stable/7/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/mp_machdep.c Mon May 10 18:50:26 2010 (r207865) +++ stable/7/sys/sparc64/sparc64/mp_machdep.c Mon May 10 18:50:28 2010 (r207866) @@ -401,16 +401,32 @@ cpu_mp_bootstrap(struct pcpu *pc) volatile struct cpu_start_args *csa; csa = &cpu_start_args; + + /* Do CPU-specific initialization. */ if (pc->pc_impl >= CPU_IMPL_ULTRASPARCIII) cheetah_init(pc->pc_impl); + /* + * Enable the caches. Note that his may include applying workarounds. + */ cache_enable(pc->pc_impl); + + /* Lock the kernel TSB in the TLB. */ pmap_map_tsb(); + /* * Flush all non-locked TLB entries possibly left over by the * firmware. */ tlb_flush_nonlocked(); + + /* Initialize global registers. */ cpu_setregs(pc); + + /* Enable interrupts. */ + wrpr(pil, 0, PIL_TICK); + wrpr(pstate, 0, PSTATE_KERNEL); + + /* Start the (S)TICK interrupts. */ tick_start(); smp_cpus++; From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 18:52:01 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1A4791065674; Mon, 10 May 2010 18:52:01 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 090398FC12; Mon, 10 May 2010 18:52:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AIq06d037423; Mon, 10 May 2010 18:52:00 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AIq0Sv037421; Mon, 10 May 2010 18:52:00 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005101852.o4AIq0Sv037421@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 18:52:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207868 - stable/7/sys/dev/esp X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 18:52:01 -0000 Author: marius Date: Mon May 10 18:52:00 2010 New Revision: 207868 URL: http://svn.freebsd.org/changeset/base/207868 Log: MFC: r207281 Take advantage of OF_getscsinitid(). Modified: stable/7/sys/dev/esp/esp_sbus.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/esp/esp_sbus.c ============================================================================== --- stable/7/sys/dev/esp/esp_sbus.c Mon May 10 18:51:49 2010 (r207867) +++ stable/7/sys/dev/esp/esp_sbus.c Mon May 10 18:52:00 2010 (r207868) @@ -466,9 +466,7 @@ espattach(struct esp_softc *esc, const s goto fail_lock; } - if (OF_getprop(ofw_bus_get_node(esc->sc_dev), "scsi-initiator-id", - &sc->sc_id, sizeof(sc->sc_id)) == -1) - sc->sc_id = 7; + sc->sc_id = OF_getscsinitid(esc->sc_dev); #ifdef ESP_SBUS_DEBUG device_printf(esc->sc_dev, "%s: sc_id %d, freq %d\n", From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 18:53:44 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E5B191065675; Mon, 10 May 2010 18:53:44 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D45C98FC13; Mon, 10 May 2010 18:53:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AIrifP037888; Mon, 10 May 2010 18:53:44 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AIriOi037886; Mon, 10 May 2010 18:53:44 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005101853.o4AIriOi037886@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 18:53:44 +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: r207870 - stable/7/sys/dev/sym X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 18:53:45 -0000 Author: marius Date: Mon May 10 18:53:44 2010 New Revision: 207870 URL: http://svn.freebsd.org/changeset/base/207870 Log: MFC: r207285 - On sparc64 obtain the initiator ID from the Open Firmware device tree in order to match what the PROM built-in driver uses. - Remove some no longer used includes. Modified: stable/7/sys/dev/sym/sym_hipd.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/sym/sym_hipd.c ============================================================================== --- stable/7/sys/dev/sym/sym_hipd.c Mon May 10 18:53:32 2010 (r207869) +++ stable/7/sys/dev/sym/sym_hipd.c Mon May 10 18:53:44 2010 (r207870) @@ -87,6 +87,12 @@ __FBSDID("$FreeBSD$"); #include #include + +#ifdef __sparc64__ +#include +#include +#endif + #include #include @@ -98,10 +104,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include - /* Short and quite clear integer types */ typedef int8_t s8; typedef int16_t s16; @@ -2682,6 +2684,9 @@ static int sym_prepare_setting(hcb_p np, */ np->myaddr = 255; sym_nvram_setup_host (np, nvram); +#ifdef __sparc64__ + np->myaddr = OF_getscsinitid(np->device); +#endif /* * Get SCSI addr of host adapter (set by bios?). From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 18:54:59 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D964B106566C; Mon, 10 May 2010 18:54:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C82A08FC20; Mon, 10 May 2010 18:54:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AIsxKt038247; Mon, 10 May 2010 18:54:59 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AIsxHD038245; Mon, 10 May 2010 18:54:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005101854.o4AIsxHD038245@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 18:54: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: r207872 - stable/7/sys/dev/mpt X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 18:55:00 -0000 Author: marius Date: Mon May 10 18:54:59 2010 New Revision: 207872 URL: http://svn.freebsd.org/changeset/base/207872 Log: MFC: r207286 Replace a magic value with the appropriate macro. Modified: stable/7/sys/dev/mpt/mpt_cam.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/mpt/mpt_cam.c ============================================================================== --- stable/7/sys/dev/mpt/mpt_cam.c Mon May 10 18:54:58 2010 (r207871) +++ stable/7/sys/dev/mpt/mpt_cam.c Mon May 10 18:54:59 2010 (r207872) @@ -1058,12 +1058,13 @@ mpt_read_config_info_spi(struct mpt_soft static int mpt_set_initial_config_spi(struct mpt_softc *mpt) { - int i, pp1val = ((1 << mpt->mpt_ini_id) << 16) | mpt->mpt_ini_id; - int error; + int error, i, pp1val; mpt->mpt_disc_enable = 0xff; mpt->mpt_tag_enable = 0; + pp1val = ((1 << mpt->mpt_ini_id) << + MPI_SCSIPORTPAGE1_CFG_SHIFT_PORT_RESPONSE_ID) | mpt->mpt_ini_id; if (mpt->mpt_port_page1.Configuration != pp1val) { CONFIG_PAGE_SCSI_PORT_1 tmp; From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 18:56:40 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B740F106567E; Mon, 10 May 2010 18:56:40 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 9C96B8FC19; Mon, 10 May 2010 18:56:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AIueCN038754; Mon, 10 May 2010 18:56:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AIue38038750; Mon, 10 May 2010 18:56:40 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005101856.o4AIue38038750@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 18:56: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: r207874 - stable/7/sys/dev/mpt X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 18:56:40 -0000 Author: marius Date: Mon May 10 18:56:40 2010 New Revision: 207874 URL: http://svn.freebsd.org/changeset/base/207874 Log: MFC: r207287 On sparc64 obtain the initiator ID to be used for SPI HBAs from the Open Firmware device tree in order to match what the PROM built-in driver uses. This is especially important when netbooting Fujitsu Siemens PRIMEPOWER250 as in that case the built-in driver isn't used and the port facts PortSCSIID defaults to 0, conflicting with the disk at the same address. Modified: stable/7/sys/dev/mpt/mpt.c stable/7/sys/dev/mpt/mpt.h stable/7/sys/dev/mpt/mpt_pci.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/mpt/mpt.c ============================================================================== --- stable/7/sys/dev/mpt/mpt.c Mon May 10 18:56:36 2010 (r207873) +++ stable/7/sys/dev/mpt/mpt.c Mon May 10 18:56:40 2010 (r207874) @@ -2659,6 +2659,8 @@ mpt_configure_ioc(struct mpt_softc *mpt, mpt->is_fc = 0; mpt->is_sas = 0; mpt->is_spi = 1; + if (mpt->mpt_ini_id == MPT_INI_ID_NONE) + mpt->mpt_ini_id = pfp->PortSCSIID; } else if (pfp->PortType == MPI_PORTFACTS_PORTTYPE_ISCSI) { mpt_prt(mpt, "iSCSI not supported yet\n"); return (ENXIO); Modified: stable/7/sys/dev/mpt/mpt.h ============================================================================== --- stable/7/sys/dev/mpt/mpt.h Mon May 10 18:56:36 2010 (r207873) +++ stable/7/sys/dev/mpt/mpt.h Mon May 10 18:56:40 2010 (r207874) @@ -130,6 +130,11 @@ #include #endif +#ifdef __sparc64__ +#include +#include +#endif + #include #if __FreeBSD_version < 500000 @@ -172,6 +177,8 @@ #define MPT_ROLE_BOTH 3 #define MPT_ROLE_DEFAULT MPT_ROLE_INITIATOR +#define MPT_INI_ID_NONE -1 + /**************************** Forward Declarations ****************************/ struct mpt_softc; struct mpt_personality; @@ -644,7 +651,6 @@ struct mpt_softc { * Port Facts */ MSG_PORT_FACTS_REPLY * port_facts; -#define mpt_ini_id port_facts[0].PortSCSIID #define mpt_max_tgtcmds port_facts[0].MaxPostedCmdBuffers /* @@ -657,6 +663,7 @@ struct mpt_softc { CONFIG_PAGE_SCSI_PORT_2 _port_page2; CONFIG_PAGE_SCSI_DEVICE_0 _dev_page0[16]; CONFIG_PAGE_SCSI_DEVICE_1 _dev_page1[16]; + int _ini_id; uint16_t _tag_enable; uint16_t _disc_enable; } spi; @@ -665,6 +672,7 @@ struct mpt_softc { #define mpt_port_page2 cfg.spi._port_page2 #define mpt_dev_page0 cfg.spi._dev_page0 #define mpt_dev_page1 cfg.spi._dev_page1 +#define mpt_ini_id cfg.spi._ini_id #define mpt_tag_enable cfg.spi._tag_enable #define mpt_disc_enable cfg.spi._disc_enable struct mpi_fc_cfg { Modified: stable/7/sys/dev/mpt/mpt_pci.c ============================================================================== --- stable/7/sys/dev/mpt/mpt_pci.c Mon May 10 18:56:36 2010 (r207873) +++ stable/7/sys/dev/mpt/mpt_pci.c Mon May 10 18:56:40 2010 (r207874) @@ -460,6 +460,11 @@ mpt_pci_attach(device_t dev) mpt->raid_queue_depth = MPT_RAID_QUEUE_DEPTH_DEFAULT; mpt->verbose = MPT_PRT_NONE; mpt->role = MPT_ROLE_NONE; + mpt->mpt_ini_id = MPT_INI_ID_NONE; +#ifdef __sparc64__ + if (mpt->is_spi) + mpt->mpt_ini_id = OF_getscsinitid(dev); +#endif mpt_set_options(mpt); if (mpt->verbose == MPT_PRT_NONE) { mpt->verbose = MPT_PRT_WARN; From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 19:02:22 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D350B106566C; Mon, 10 May 2010 19:02:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C20BB8FC1D; Mon, 10 May 2010 19:02:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AJ2MXJ040084; Mon, 10 May 2010 19:02:22 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AJ2MaI040082; Mon, 10 May 2010 19:02:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005101902.o4AJ2MaI040082@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 19:02:22 +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: r207876 - stable/7/sys/sparc64/sparc64 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 19:02:22 -0000 Author: marius Date: Mon May 10 19:02:22 2010 New Revision: 207876 URL: http://svn.freebsd.org/changeset/base/207876 Log: MFC: r207500 Add a hack for SPARC64 V CPUs, which set some undocumented bits in the first data word. Modified: stable/7/sys/sparc64/sparc64/interrupt.S Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/sparc64/interrupt.S ============================================================================== --- stable/7/sys/sparc64/sparc64/interrupt.S Mon May 10 19:02:21 2010 (r207875) +++ stable/7/sys/sparc64/sparc64/interrupt.S Mon May 10 19:02:22 2010 (r207876) @@ -83,8 +83,11 @@ ENTRY(intr_vector) * The 2nd word points to code to execute and the 3rd is an argument * to pass. Jump to it. */ - brnz,a,pt %g3, 1f - nop + brnz,pt %g3, 1f + /* + * NB: Zeus CPUs set some undocumented bits in the first data word. + */ + and %g3, IV_MAX - 1, %g3 jmpl %g4, %g0 nop /* NOTREACHED */ From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 19:22:35 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 304EA1065678; Mon, 10 May 2010 19:22:35 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 1F1868FC15; Mon, 10 May 2010 19:22:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AJMZXj044777; Mon, 10 May 2010 19:22:35 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AJMYHU044774; Mon, 10 May 2010 19:22:34 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201005101922.o4AJMYHU044774@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 10 May 2010 19:22:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207880 - stable/7/sys/dev/sound/pcm X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 19:22:35 -0000 Author: jkim Date: Mon May 10 19:22:34 2010 New Revision: 207880 URL: http://svn.freebsd.org/changeset/base/207880 Log: MFC: r207330, r207620 - Remove dead code. Calculated greatest common divisor was not used at all. - Prefer u_int32_t over unsigned int to make its intention more clearer. - Move the function to a header file and make it a static inline function. Modified: stable/7/sys/dev/sound/pcm/buffer.c stable/7/sys/dev/sound/pcm/buffer.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/sound/pcm/buffer.c ============================================================================== --- stable/7/sys/dev/sound/pcm/buffer.c Mon May 10 19:21:50 2010 (r207879) +++ stable/7/sys/dev/sound/pcm/buffer.c Mon May 10 19:22:34 2010 (r207880) @@ -548,30 +548,6 @@ sndbuf_updateprevtotal(struct snd_dbuf * } unsigned int -snd_xbytes(unsigned int v, unsigned int from, unsigned int to) -{ - unsigned int w, x, y; - - if (from == to) - return v; - - if (from == 0 || to == 0 || v == 0) - return 0; - - x = from; - y = to; - while (y != 0) { - w = x % y; - x = y; - y = w; - } - from /= x; - to /= x; - - return (unsigned int)(((u_int64_t)v * to) / from); -} - -unsigned int sndbuf_xbytes(unsigned int v, struct snd_dbuf *from, struct snd_dbuf *to) { if (from == NULL || to == NULL || v == 0) Modified: stable/7/sys/dev/sound/pcm/buffer.h ============================================================================== --- stable/7/sys/dev/sound/pcm/buffer.h Mon May 10 19:21:50 2010 (r207879) +++ stable/7/sys/dev/sound/pcm/buffer.h Mon May 10 19:22:34 2010 (r207880) @@ -110,7 +110,6 @@ unsigned int sndbuf_getreadyptr(struct s unsigned int sndbuf_getblocks(struct snd_dbuf *b); unsigned int sndbuf_getprevblocks(struct snd_dbuf *b); unsigned int sndbuf_gettotal(struct snd_dbuf *b); -unsigned int snd_xbytes(unsigned int v, unsigned int from, unsigned int to); unsigned int sndbuf_xbytes(unsigned int v, struct snd_dbuf *from, struct snd_dbuf *to); u_int8_t sndbuf_zerodata(u_int32_t fmt); void sndbuf_updateprevtotal(struct snd_dbuf *b); @@ -131,3 +130,14 @@ void sndbuf_dmabounce(struct snd_dbuf *b #ifdef OSSV4_EXPERIMENT void sndbuf_getpeaks(struct snd_dbuf *b, int *lp, int *rp); #endif + +static inline u_int32_t +snd_xbytes(u_int32_t v, u_int32_t from, u_int32_t to) +{ + + if (from == to) + return (v); + if (from == 0) + return (0); + return ((u_int64_t)v * to / from); +} From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 19:54:01 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A5928106566B; Mon, 10 May 2010 19:54:01 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 9377A8FC08; Mon, 10 May 2010 19:54:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AJs15A051837; Mon, 10 May 2010 19:54:01 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AJs12V051834; Mon, 10 May 2010 19:54:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201005101954.o4AJs12V051834@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 10 May 2010 19:54:01 +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: r207882 - stable/7/sys/dev/sge X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 19:54:01 -0000 Author: yongari Date: Mon May 10 19:54:01 2010 New Revision: 207882 URL: http://svn.freebsd.org/changeset/base/207882 Log: MFC r207628,207635: r207628: Enable multi-descriptor transmisstion for fragmented mbufs. There is no more need to defragment mbufs. After transmitting the multi-fragmented frame, the controller updates only the first descriptor of multi-descriptor transmission so it's driver's responsibility to clear OWN bits of remaining descriptor of multi-descriptor transmission. It seems the controller behaves much like jme(4) controllers in descriptor handling. r207635: Free entire mbuf chain instead of the first mbuf. Modified: stable/7/sys/dev/sge/if_sge.c stable/7/sys/dev/sge/if_sgereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/sge/if_sge.c ============================================================================== --- stable/7/sys/dev/sge/if_sge.c Mon May 10 19:47:37 2010 (r207881) +++ stable/7/sys/dev/sge/if_sge.c Mon May 10 19:54:01 2010 (r207882) @@ -756,6 +756,8 @@ sge_dma_alloc(struct sge_softc *sc) { struct sge_chain_data *cd; struct sge_list_data *ld; + struct sge_rxdesc *rxd; + struct sge_txdesc *txd; int error, i; cd = &sc->sge_cdata; @@ -869,8 +871,12 @@ sge_dma_alloc(struct sge_softc *sc) /* Create DMA maps for Tx buffers. */ for (i = 0; i < SGE_TX_RING_CNT; i++) { + txd = &cd->sge_txdesc[i]; + txd->tx_m = NULL; + txd->tx_dmamap = NULL; + txd->tx_ndesc = 0; error = bus_dmamap_create(cd->sge_txmbuf_tag, 0, - &cd->sge_tx_map[i]); + &txd->tx_dmamap); if (error != 0) { device_printf(sc->sge_dev, "could not create Tx DMA map.\n"); @@ -886,8 +892,11 @@ sge_dma_alloc(struct sge_softc *sc) } /* Create DMA maps for Rx buffers. */ for (i = 0; i < SGE_RX_RING_CNT; i++) { + rxd = &cd->sge_rxdesc[i]; + rxd->rx_m = NULL; + rxd->rx_dmamap = NULL; error = bus_dmamap_create(cd->sge_rxmbuf_tag, 0, - &cd->sge_rx_map[i]); + &rxd->rx_dmamap); if (error) { device_printf(sc->sge_dev, "could not create Rx DMA map.\n"); @@ -903,6 +912,8 @@ sge_dma_free(struct sge_softc *sc) { struct sge_chain_data *cd; struct sge_list_data *ld; + struct sge_rxdesc *rxd; + struct sge_txdesc *txd; int i; cd = &sc->sge_cdata; @@ -934,10 +945,11 @@ sge_dma_free(struct sge_softc *sc) /* Rx buffers. */ if (cd->sge_rxmbuf_tag != NULL) { for (i = 0; i < SGE_RX_RING_CNT; i++) { - if (cd->sge_rx_map[i] != NULL) { + rxd = &cd->sge_rxdesc[i]; + if (rxd->rx_dmamap != NULL) { bus_dmamap_destroy(cd->sge_rxmbuf_tag, - cd->sge_rx_map[i]); - cd->sge_rx_map[i] = NULL; + rxd->rx_dmamap); + rxd->rx_dmamap = NULL; } } if (cd->sge_rx_spare_map != NULL) { @@ -951,10 +963,11 @@ sge_dma_free(struct sge_softc *sc) /* Tx buffers. */ if (cd->sge_txmbuf_tag != NULL) { for (i = 0; i < SGE_TX_RING_CNT; i++) { - if (cd->sge_tx_map[i] != NULL) { + txd = &cd->sge_txdesc[i]; + if (txd->tx_dmamap != NULL) { bus_dmamap_destroy(cd->sge_txmbuf_tag, - cd->sge_tx_map[i]); - cd->sge_tx_map[i] = NULL; + txd->tx_dmamap); + txd->tx_dmamap = NULL; } } bus_dma_tag_destroy(cd->sge_txmbuf_tag); @@ -991,18 +1004,20 @@ static int sge_list_tx_free(struct sge_softc *sc) { struct sge_chain_data *cd; + struct sge_txdesc *txd; int i; SGE_LOCK_ASSERT(sc); cd = &sc->sge_cdata; for (i = 0; i < SGE_TX_RING_CNT; i++) { - if (cd->sge_tx_mbuf[i] != NULL) { - bus_dmamap_sync(cd->sge_txmbuf_tag, - cd->sge_tx_map[i], BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(cd->sge_txmbuf_tag, - cd->sge_tx_map[i]); - m_free(cd->sge_tx_mbuf[i]); - cd->sge_tx_mbuf[i] = NULL; + txd = &cd->sge_txdesc[i]; + if (txd->tx_m != NULL) { + bus_dmamap_sync(cd->sge_txmbuf_tag, txd->tx_dmamap, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(cd->sge_txmbuf_tag, txd->tx_dmamap); + m_freem(txd->tx_m); + txd->tx_m = NULL; + txd->tx_ndesc = 0; } } @@ -1037,18 +1052,20 @@ static int sge_list_rx_free(struct sge_softc *sc) { struct sge_chain_data *cd; + struct sge_rxdesc *rxd; int i; SGE_LOCK_ASSERT(sc); cd = &sc->sge_cdata; for (i = 0; i < SGE_RX_RING_CNT; i++) { - if (cd->sge_rx_mbuf[i] != NULL) { - bus_dmamap_sync(cd->sge_rxmbuf_tag, cd->sge_rx_map[i], + rxd = &cd->sge_rxdesc[i]; + if (rxd->rx_m != NULL) { + bus_dmamap_sync(cd->sge_rxmbuf_tag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(cd->sge_rxmbuf_tag, - cd->sge_rx_map[i]); - m_free(cd->sge_rx_mbuf[i]); - cd->sge_rx_mbuf[i] = NULL; + rxd->rx_dmamap); + m_freem(rxd->rx_m); + rxd->rx_m = NULL; } } return (0); @@ -1063,6 +1080,7 @@ sge_newbuf(struct sge_softc *sc, int pro struct mbuf *m; struct sge_desc *desc; struct sge_chain_data *cd; + struct sge_rxdesc *rxd; bus_dma_segment_t segs[1]; bus_dmamap_t map; int error, nsegs; @@ -1082,17 +1100,18 @@ sge_newbuf(struct sge_softc *sc, int pro return (error); } KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); - if (cd->sge_rx_mbuf[prod] != NULL) { - bus_dmamap_sync(cd->sge_rxmbuf_tag, cd->sge_rx_map[prod], + rxd = &cd->sge_rxdesc[prod]; + if (rxd->rx_m != NULL) { + bus_dmamap_sync(cd->sge_rxmbuf_tag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(cd->sge_rxmbuf_tag, cd->sge_rx_map[prod]); + bus_dmamap_unload(cd->sge_rxmbuf_tag, rxd->rx_dmamap); } - map = cd->sge_rx_map[prod]; - cd->sge_rx_map[prod] = cd->sge_rx_spare_map; + map = rxd->rx_dmamap; + rxd->rx_dmamap = cd->sge_rx_spare_map; cd->sge_rx_spare_map = map; - bus_dmamap_sync(cd->sge_rxmbuf_tag, cd->sge_rx_map[prod], + bus_dmamap_sync(cd->sge_rxmbuf_tag, rxd->rx_dmamap, BUS_DMASYNC_PREREAD); - cd->sge_rx_mbuf[prod] = m; + rxd->rx_m = m; desc = &sc->sge_ldata.sge_rx_ring[prod]; desc->sge_sts_size = 0; @@ -1178,7 +1197,7 @@ sge_rxeof(struct sge_softc *sc) ifp->if_ierrors++; continue; } - m = cd->sge_rx_mbuf[cons]; + m = cd->sge_rxdesc[cons].rx_m; if (sge_newbuf(sc, cons) != 0) { sge_discard_rxbuf(sc, cons); ifp->if_iqdrops++; @@ -1245,8 +1264,9 @@ sge_txeof(struct sge_softc *sc) struct ifnet *ifp; struct sge_list_data *ld; struct sge_chain_data *cd; + struct sge_txdesc *txd; uint32_t txstat; - int cons, prod; + int cons, nsegs, prod; SGE_LOCK_ASSERT(sc); @@ -1260,33 +1280,47 @@ sge_txeof(struct sge_softc *sc) BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); cons = cd->sge_tx_cons; prod = cd->sge_tx_prod; - for (; cons != prod; SGE_INC(cons, SGE_TX_RING_CNT)) { + for (; cons != prod;) { txstat = le32toh(ld->sge_tx_ring[cons].sge_cmdsts); if ((txstat & TDC_OWN) != 0) break; - cd->sge_tx_cnt--; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - if (cd->sge_tx_mbuf[cons] != NULL) { - bus_dmamap_sync(cd->sge_txmbuf_tag, - cd->sge_tx_map[cons], BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(cd->sge_txmbuf_tag, - cd->sge_tx_map[cons]); - m_freem(cd->sge_tx_mbuf[cons]); - cd->sge_tx_mbuf[cons] = NULL; - if (SGE_TX_ERROR(txstat) != 0) { + /* + * Only the first descriptor of multi-descriptor transmission + * is updated by controller. Driver should skip entire + * chained buffers for the transmitted frame. In other words + * TDC_OWN bit is valid only at the first descriptor of a + * multi-descriptor transmission. + */ + if (SGE_TX_ERROR(txstat) != 0) { #ifdef SGE_SHOW_ERRORS - device_printf(sc->sge_dev, "Tx error : 0x%b\n", - txstat, TX_ERR_BITS); + device_printf(sc->sge_dev, "Tx error : 0x%b\n", + txstat, TX_ERR_BITS); #endif - ifp->if_oerrors++; - } else { + ifp->if_oerrors++; + } else { #ifdef notyet - ifp->if_collisions += (txstat & 0xFFFF) - 1; + ifp->if_collisions += (txstat & 0xFFFF) - 1; #endif - ifp->if_opackets++; - } + ifp->if_opackets++; } - + txd = &cd->sge_txdesc[cons]; + for (nsegs = 0; nsegs < txd->tx_ndesc; nsegs++) { + ld->sge_tx_ring[cons].sge_cmdsts = 0; + SGE_INC(cons, SGE_TX_RING_CNT); + } + /* Reclaim transmitted mbuf. */ + KASSERT(txd->tx_m != NULL, + ("%s: freeing NULL mbuf\n", __func__)); + bus_dmamap_sync(cd->sge_txmbuf_tag, txd->tx_dmamap, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(cd->sge_txmbuf_tag, txd->tx_dmamap); + m_freem(txd->tx_m); + txd->tx_m = NULL; + cd->sge_tx_cnt -= txd->tx_ndesc; + KASSERT(cd->sge_tx_cnt >= 0, + ("%s: Active Tx desc counter was garbled\n", __func__)); + txd->tx_ndesc = 0; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } cd->sge_tx_cons = cons; if (cd->sge_tx_cnt == 0) @@ -1388,73 +1422,78 @@ sge_encap(struct sge_softc *sc, struct m { struct mbuf *m; struct sge_desc *desc; + struct sge_txdesc *txd; bus_dma_segment_t txsegs[SGE_MAXTXSEGS]; - bus_dmamap_t map; uint32_t cflags; - int error, nsegs, prod; + int error, i, nsegs, prod, si; SGE_LOCK_ASSERT(sc); - prod = sc->sge_cdata.sge_tx_prod; - map = sc->sge_cdata.sge_tx_map[prod]; - /* - * Reading Windows inf file indicates SiS controller supports - * TSO, VLAN hardware tag insertion/stripping, interrupt - * moderation and Tx/Rx checksum offloading. Unfortunately - * vendor didn't release these information so we're guessing - * descriptor usage with trial and errors. - * - * Controller seems to support multi-fragmented buffers but - * don't know how to enable that feature so limit number of - * fragmented Tx buffers to single buffer until we understand - * the controller internals. - * I assume the controller can pad zero bytes if frame length - * is less than 60 bytes and I also think the controller has - * no Tx buffer alignment limitation. - Need testing! - */ - if ((*m_head)->m_next != NULL) { - m = m_defrag(*m_head, M_DONTWAIT); + si = prod = sc->sge_cdata.sge_tx_prod; + txd = &sc->sge_cdata.sge_txdesc[prod]; + error = bus_dmamap_load_mbuf_sg(sc->sge_cdata.sge_txmbuf_tag, + txd->tx_dmamap, *m_head, txsegs, &nsegs, 0); + if (error == EFBIG) { + m = m_collapse(*m_head, M_DONTWAIT, SGE_MAXTXSEGS); if (m == NULL) { m_freem(*m_head); *m_head = NULL; return (ENOBUFS); } *m_head = m; - } - error = bus_dmamap_load_mbuf_sg(sc->sge_cdata.sge_txmbuf_tag, map, - *m_head, txsegs, &nsegs, 0); - if (error != 0) { - m_freem(*m_head); - *m_head = NULL; + error = bus_dmamap_load_mbuf_sg(sc->sge_cdata.sge_txmbuf_tag, + txd->tx_dmamap, *m_head, txsegs, &nsegs, 0); + if (error != 0) { + m_freem(*m_head); + *m_head = NULL; + return (error); + } + } else if (error != 0) return (error); - } + + KASSERT(nsegs != 0, ("zero segment returned")); /* Check descriptor overrun. */ if (sc->sge_cdata.sge_tx_cnt + nsegs >= SGE_TX_RING_CNT) { - bus_dmamap_unload(sc->sge_cdata.sge_txmbuf_tag, map); + bus_dmamap_unload(sc->sge_cdata.sge_txmbuf_tag, txd->tx_dmamap); return (ENOBUFS); } - bus_dmamap_sync(sc->sge_cdata.sge_txmbuf_tag, map, + bus_dmamap_sync(sc->sge_cdata.sge_txmbuf_tag, txd->tx_dmamap, BUS_DMASYNC_PREWRITE); + m = *m_head; cflags = 0; - if ((*m_head)->m_pkthdr.csum_flags & CSUM_IP) + if (m->m_pkthdr.csum_flags & CSUM_IP) cflags |= TDC_IP_CSUM; - if ((*m_head)->m_pkthdr.csum_flags & CSUM_TCP) + if (m->m_pkthdr.csum_flags & CSUM_TCP) cflags |= TDC_TCP_CSUM; - if ((*m_head)->m_pkthdr.csum_flags & CSUM_UDP) + if (m->m_pkthdr.csum_flags & CSUM_UDP) cflags |= TDC_UDP_CSUM; - desc = &sc->sge_ldata.sge_tx_ring[prod]; - desc->sge_sts_size = htole32((*m_head)->m_pkthdr.len); - desc->sge_ptr = htole32(SGE_ADDR_LO(txsegs[0].ds_addr)); - desc->sge_flags = htole32(txsegs[0].ds_len); - if (prod == SGE_TX_RING_CNT - 1) - desc->sge_flags |= htole32(RING_END); + for (i = 0; i < nsegs; i++) { + desc = &sc->sge_ldata.sge_tx_ring[prod]; + if (i == 0) { + desc->sge_sts_size = htole32(m->m_pkthdr.len); + desc->sge_cmdsts = 0; + } else { + desc->sge_sts_size = 0; + desc->sge_cmdsts = htole32(TDC_OWN); + } + desc->sge_ptr = htole32(SGE_ADDR_LO(txsegs[i].ds_addr)); + desc->sge_flags = htole32(txsegs[i].ds_len); + if (prod == SGE_TX_RING_CNT - 1) + desc->sge_flags |= htole32(RING_END); + sc->sge_cdata.sge_tx_cnt++; + SGE_INC(prod, SGE_TX_RING_CNT); + } + /* Update producer index. */ + sc->sge_cdata.sge_tx_prod = prod; + + desc = &sc->sge_ldata.sge_tx_ring[si]; /* Configure VLAN. */ - if(((*m_head)->m_flags & M_VLANTAG) != 0) { - cflags |= (*m_head)->m_pkthdr.ether_vtag; + if((m->m_flags & M_VLANTAG) != 0) { + cflags |= m->m_pkthdr.ether_vtag; desc->sge_sts_size |= htole32(TDS_INS_VLAN); } - desc->sge_cmdsts = htole32(TDC_DEF | TDC_CRC | TDC_PAD | cflags); + desc->sge_cmdsts |= htole32(TDC_DEF | TDC_CRC | TDC_PAD | cflags); #if 1 if ((sc->sge_flags & SGE_FLAG_SPEED_1000) != 0) desc->sge_cmdsts |= htole32(TDC_BST); @@ -1466,13 +1505,9 @@ sge_encap(struct sge_softc *sc, struct m } #endif /* Request interrupt and give ownership to controller. */ - if ((prod % SGE_TX_INTR_FRAMES) == 0) - desc->sge_cmdsts |= htole32(TDC_OWN | TDC_INTR); - else - desc->sge_cmdsts |= htole32(TDC_OWN); - sc->sge_cdata.sge_tx_mbuf[prod] = *m_head; - sc->sge_cdata.sge_tx_cnt++; - SGE_INC(sc->sge_cdata.sge_tx_prod, SGE_TX_RING_CNT); + desc->sge_cmdsts |= htole32(TDC_OWN | TDC_INTR); + txd->tx_m = m; + txd->tx_ndesc = nsegs; return (0); } @@ -1503,7 +1538,8 @@ sge_start_locked(struct ifnet *ifp) return; for (queued = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { - if (sc->sge_cdata.sge_tx_cnt == SGE_TX_RING_CNT - 1) { + if (sc->sge_cdata.sge_tx_cnt > (SGE_TX_RING_CNT - + SGE_MAXTXSEGS)) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } Modified: stable/7/sys/dev/sge/if_sgereg.h ============================================================================== --- stable/7/sys/dev/sge/if_sgereg.h Mon May 10 19:47:37 2010 (r207881) +++ stable/7/sys/dev/sge/if_sgereg.h Mon May 10 19:54:01 2010 (r207882) @@ -283,7 +283,7 @@ struct sge_desc { #define SGE_RX_RING_CNT 256 /* [8, 1024] */ #define SGE_TX_RING_CNT 256 /* [8, 8192] */ #define SGE_DESC_ALIGN 16 -#define SGE_MAXTXSEGS 1 +#define SGE_MAXTXSEGS 16 #define SGE_RX_BUF_ALIGN sizeof(uint64_t) #define SGE_RX_RING_SZ (SGE_RX_RING_CNT * sizeof(struct sge_desc)) @@ -298,6 +298,17 @@ struct sge_list_data { bus_addr_t sge_tx_paddr; }; +struct sge_txdesc { + struct mbuf *tx_m; + bus_dmamap_t tx_dmamap; + int tx_ndesc; +}; + +struct sge_rxdesc { + struct mbuf *rx_m; + bus_dmamap_t rx_dmamap; +}; + struct sge_chain_data { bus_dma_tag_t sge_tag; bus_dma_tag_t sge_rx_tag; @@ -306,11 +317,9 @@ struct sge_chain_data { bus_dmamap_t sge_tx_dmamap; bus_dma_tag_t sge_txmbuf_tag; bus_dma_tag_t sge_rxmbuf_tag; - struct mbuf *sge_rx_mbuf[SGE_RX_RING_CNT]; - struct mbuf *sge_tx_mbuf[SGE_TX_RING_CNT]; - bus_dmamap_t sge_rx_map[SGE_RX_RING_CNT]; + struct sge_txdesc sge_txdesc[SGE_TX_RING_CNT]; + struct sge_rxdesc sge_rxdesc[SGE_RX_RING_CNT]; bus_dmamap_t sge_rx_spare_map; - bus_dmamap_t sge_tx_map[SGE_TX_RING_CNT]; int sge_rx_cons; int sge_tx_prod; int sge_tx_cons; From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 20:00:50 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CF7D41065674; Mon, 10 May 2010 20:00:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id BD7ED8FC0C; Mon, 10 May 2010 20:00:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AK0oGF053453; Mon, 10 May 2010 20:00:50 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AK0oVq053448; Mon, 10 May 2010 20:00:50 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005102000.o4AK0oVq053448@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 20:00:50 +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: r207883 - in stable/7/sys: dev/ofw powerpc/include sparc64/include sun4v/include X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 20:00:50 -0000 Author: marius Date: Mon May 10 20:00:50 2010 New Revision: 207883 URL: http://svn.freebsd.org/changeset/base/207883 Log: Partial MFC 186347 and 186355 in order to remove differences in headers required. Modified: stable/7/sys/dev/ofw/openfirm.h stable/7/sys/powerpc/include/ofw_machdep.h stable/7/sys/sparc64/include/ofw_machdep.h stable/7/sys/sun4v/include/ofw_machdep.h Modified: stable/7/sys/dev/ofw/openfirm.h ============================================================================== --- stable/7/sys/dev/ofw/openfirm.h Mon May 10 19:54:01 2010 (r207882) +++ stable/7/sys/dev/ofw/openfirm.h Mon May 10 20:00:50 2010 (r207883) @@ -74,6 +74,8 @@ typedef unsigned int phandle_t; #include #include +#include + MALLOC_DECLARE(M_OFWPROP); /* Modified: stable/7/sys/powerpc/include/ofw_machdep.h ============================================================================== --- stable/7/sys/powerpc/include/ofw_machdep.h Mon May 10 19:54:01 2010 (r207882) +++ stable/7/sys/powerpc/include/ofw_machdep.h Mon May 10 20:00:50 2010 (r207883) @@ -28,7 +28,11 @@ #ifndef _MACHINE_OFW_MACHDEP_H_ #define _MACHINE_OFW_MACHDEP_H_ +#include +#include +#include #include +#include int OF_decode_addr(phandle_t, int, bus_space_tag_t *, bus_space_handle_t *); void OF_getetheraddr(device_t dev, u_char *addr); Modified: stable/7/sys/sparc64/include/ofw_machdep.h ============================================================================== --- stable/7/sys/sparc64/include/ofw_machdep.h Mon May 10 19:54:01 2010 (r207882) +++ stable/7/sys/sparc64/include/ofw_machdep.h Mon May 10 20:00:50 2010 (r207883) @@ -29,6 +29,8 @@ #define _MACHINE_OFW_MACHDEP_H_ #include +#include +#include int OF_decode_addr(phandle_t, int, int *, bus_addr_t *); void OF_getetheraddr(device_t, u_char *); Modified: stable/7/sys/sun4v/include/ofw_machdep.h ============================================================================== --- stable/7/sys/sun4v/include/ofw_machdep.h Mon May 10 19:54:01 2010 (r207882) +++ stable/7/sys/sun4v/include/ofw_machdep.h Mon May 10 20:00:50 2010 (r207883) @@ -29,6 +29,8 @@ #define _MACHINE_OFW_MACHDEP_H_ #include +#include +#include int OF_decode_addr(phandle_t, int, int *, bus_addr_t *); void OF_getetheraddr(device_t, u_char *); From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 20:08:01 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BFD961065677; Mon, 10 May 2010 20:08:01 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id AE9A18FC18; Mon, 10 May 2010 20:08:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AK81dI055271; Mon, 10 May 2010 20:08:01 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AK81mN055269; Mon, 10 May 2010 20:08:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201005102008.o4AK81mN055269@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 10 May 2010 20:08:01 +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: r207886 - stable/7/sys/dev/msk X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 20:08:01 -0000 Author: yongari Date: Mon May 10 20:08:01 2010 New Revision: 207886 URL: http://svn.freebsd.org/changeset/base/207886 Log: MFC r207622-207623,207638 r207622: Drop driver lock before exiting from interrupt handler. r207623: Make sure to check whether driver is running before processing received frames. Also check driver has valid ifp pointer before calling msk_stop() in device_shutdown handler. While I'm here remove unnecessary accesses to interrupt mask registers in device_shutdown handler because driver puts the controller into reset state. With these changes, msk(4) now survive from heavy RX traffic(1byte UDP frame) while reboot is in progress. r207638: When VLAN hardware tagging is disabled, make sure to disable VLAN checksum offloading as well as TSO over VLAN. Modified: stable/7/sys/dev/msk/if_msk.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/msk/if_msk.c ============================================================================== --- stable/7/sys/dev/msk/if_msk.c Mon May 10 20:02:39 2010 (r207885) +++ stable/7/sys/dev/msk/if_msk.c Mon May 10 20:08:01 2010 (r207886) @@ -1017,7 +1017,8 @@ msk_ioctl(struct ifnet *ifp, u_long comm (IFCAP_VLAN_HWTAGGING & ifp->if_capabilities) != 0) { ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; if ((IFCAP_VLAN_HWTAGGING & ifp->if_capenable) == 0) - ifp->if_capenable &= ~IFCAP_VLAN_HWTSO; + ifp->if_capenable &= + ~(IFCAP_VLAN_HWTSO | IFCAP_VLAN_HWCSUM); msk_setvlan(sc_if, ifp); } if (ifp->if_mtu > ETHERMTU && @@ -2828,20 +2829,15 @@ mskc_shutdown(device_t dev) sc = device_get_softc(dev); MSK_LOCK(sc); for (i = 0; i < sc->msk_num_port; i++) { - if (sc->msk_if[i] != NULL) + if (sc->msk_if[i] != NULL && sc->msk_if[i]->msk_ifp != NULL && + ((sc->msk_if[i]->msk_ifp->if_drv_flags & + IFF_DRV_RUNNING) != 0)) msk_stop(sc->msk_if[i]); } - - /* Disable all interrupts. */ - CSR_WRITE_4(sc, B0_IMSK, 0); - CSR_READ_4(sc, B0_IMSK); - CSR_WRITE_4(sc, B0_HWE_IMSK, 0); - CSR_READ_4(sc, B0_HWE_IMSK); + MSK_UNLOCK(sc); /* Put hardware reset. */ CSR_WRITE_2(sc, B0_CTST, CS_RST_SET); - - MSK_UNLOCK(sc); return (0); } @@ -3376,6 +3372,8 @@ msk_handle_events(struct msk_softc *sc) sc_if->msk_vtag = ntohs(len); break; case OP_RXSTAT: + if (!(sc_if->msk_ifp->if_drv_flags & IFF_DRV_RUNNING)) + break; if (sc_if->msk_framesize > (MCLBYTES - MSK_RX_BUF_ALIGN)) msk_jumbo_rxeof(sc_if, status, control, len); @@ -3445,6 +3443,7 @@ msk_intr(void *xsc) (sc->msk_pflags & MSK_FLAG_SUSPEND) != 0 || (status & sc->msk_intrmask) == 0) { CSR_WRITE_4(sc, B0_Y2_SP_ICR, 2); + MSK_UNLOCK(sc); return; } From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 20:15:40 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C12BF1065672; Mon, 10 May 2010 20:15:40 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B07128FC12; Mon, 10 May 2010 20:15:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AKFeiL057082; Mon, 10 May 2010 20:15:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AKFet9057080; Mon, 10 May 2010 20:15:40 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005102015.o4AKFet9057080@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 20:15: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: r207889 - stable/7/sys/dev/uart X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 20:15:40 -0000 Author: marius Date: Mon May 10 20:15:40 2010 New Revision: 207889 URL: http://svn.freebsd.org/changeset/base/207889 Log: MFC: r207533 (partial) Remove redundant checking of sc_leaving (uart_intr() already handles this). Modified: stable/7/sys/dev/uart/uart_dev_ns8250.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/uart/uart_dev_ns8250.c ============================================================================== --- stable/7/sys/dev/uart/uart_dev_ns8250.c Mon May 10 20:15:39 2010 (r207888) +++ stable/7/sys/dev/uart/uart_dev_ns8250.c Mon May 10 20:15:40 2010 (r207889) @@ -580,7 +580,7 @@ ns8250_bus_ipend(struct uart_softc *sc) if (ipend == 0) ns8250_clrint(bas); uart_unlock(sc->sc_hwmtx); - return ((sc->sc_leaving) ? 0 : ipend); + return (ipend); } static int From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 20:25:52 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 03B3A106566B; Mon, 10 May 2010 20:25:52 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E4DA28FC18; Mon, 10 May 2010 20:25:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AKPpeY059437; Mon, 10 May 2010 20:25:51 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AKPpvk059413; Mon, 10 May 2010 20:25:51 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005102025.o4AKPpvk059413@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 20:25:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207891 - in stable/7/sys: boot/sparc64/loader conf sparc64/include sparc64/sparc64 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 20:25:52 -0000 Author: marius Date: Mon May 10 20:25:51 2010 New Revision: 207891 URL: http://svn.freebsd.org/changeset/base/207891 Log: MFC: r207537 Add support for SPARC64 V (and where it already makes sense for other HAL/Fujitsu) CPUs. For the most part this consists of fleshing out the MMU and cache handling, it doesn't add pmap optimizations possible with these CPU, yet, though. With these changes FreeBSD runs stable on Fujitsu Siemens PRIMEPOWER 250 and likely also other models based on SPARC64 V like 450, 650 and 850. Thanks go to Michael Moll for providing access to a PRIMEPOWER 250. Added: stable/7/sys/sparc64/include/mcntl.h - copied unchanged from r207537, head/sys/sparc64/include/mcntl.h stable/7/sys/sparc64/sparc64/zeus.c - copied unchanged from r207537, head/sys/sparc64/sparc64/zeus.c Modified: stable/7/sys/boot/sparc64/loader/main.c stable/7/sys/conf/files.sparc64 stable/7/sys/sparc64/include/asi.h stable/7/sys/sparc64/include/cache.h stable/7/sys/sparc64/sparc64/cache.c stable/7/sys/sparc64/sparc64/cheetah.c stable/7/sys/sparc64/sparc64/identcpu.c stable/7/sys/sparc64/sparc64/machdep.c stable/7/sys/sparc64/sparc64/mp_locore.S stable/7/sys/sparc64/sparc64/mp_machdep.c stable/7/sys/sparc64/sparc64/pmap.c stable/7/sys/sparc64/sparc64/tick.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/boot/sparc64/loader/main.c ============================================================================== --- stable/7/sys/boot/sparc64/loader/main.c Mon May 10 20:25:51 2010 (r207890) +++ stable/7/sys/boot/sparc64/loader/main.c Mon May 10 20:25:51 2010 (r207891) @@ -452,7 +452,8 @@ dtlb_va_to_pa_sun4u(vm_offset_t va) reg = dtlb_get_data_sun4u(i); wrpr(pstate, pstate, 0); reg >>= TD_PA_SHIFT; - if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) return (reg & TD_PA_CH_MASK); return (reg & TD_PA_SF_MASK); } @@ -475,7 +476,8 @@ itlb_va_to_pa_sun4u(vm_offset_t va) reg = itlb_get_data_sun4u(i); wrpr(pstate, pstate, 0); reg >>= TD_PA_SHIFT; - if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) return (reg & TD_PA_CH_MASK); return (reg & TD_PA_SF_MASK); } @@ -697,6 +699,7 @@ cpu_cpuid_prop_sun4u(void) switch (cpu_impl) { case CPU_IMPL_SPARC64: + case CPU_IMPL_SPARC64V: case CPU_IMPL_ULTRASPARCI: case CPU_IMPL_ULTRASPARCII: case CPU_IMPL_ULTRASPARCIIi: @@ -721,6 +724,7 @@ cpu_get_mid_sun4u(void) switch (cpu_impl) { case CPU_IMPL_SPARC64: + case CPU_IMPL_SPARC64V: case CPU_IMPL_ULTRASPARCI: case CPU_IMPL_ULTRASPARCII: case CPU_IMPL_ULTRASPARCIIi: Modified: stable/7/sys/conf/files.sparc64 ============================================================================== --- stable/7/sys/conf/files.sparc64 Mon May 10 20:25:51 2010 (r207890) +++ stable/7/sys/conf/files.sparc64 Mon May 10 20:25:51 2010 (r207891) @@ -134,3 +134,4 @@ sparc64/sparc64/tsb.c standard sparc64/sparc64/uio_machdep.c standard sparc64/sparc64/upa.c optional creator sparc64/sparc64/vm_machdep.c standard +sparc64/sparc64/zeus.c standard Modified: stable/7/sys/sparc64/include/asi.h ============================================================================== --- stable/7/sys/sparc64/include/asi.h Mon May 10 20:25:51 2010 (r207890) +++ stable/7/sys/sparc64/include/asi.h Mon May 10 20:25:51 2010 (r207891) @@ -82,7 +82,10 @@ #define ASI_DCACHE_SNOOP_TAG 0x44 /* US-III Cu */ /* Named ASI_DCUCR on US-III, but is mostly identical except for added bits. */ -#define ASI_LSU_CTL_REG 0x45 +#define ASI_LSU_CTL_REG 0x45 /* US only */ + +#define ASI_MCNTL 0x45 /* SPARC64 only */ +#define AA_MCNTL 0x08 #define ASI_DCACHE_DATA 0x46 #define ASI_DCACHE_TAG 0x47 @@ -167,6 +170,8 @@ #define ASI_ICACHE_PRE_DECODE 0x6e /* US-I, II */ #define ASI_ICACHE_PRE_NEXT_FIELD 0x6f /* US-I, II */ +#define ASI_FLUSH_L1I 0x67 /* SPARC64 only */ + #define ASI_BLK_AUIP 0x70 #define ASI_BLK_AIUS 0x71 Modified: stable/7/sys/sparc64/include/cache.h ============================================================================== --- stable/7/sys/sparc64/include/cache.h Mon May 10 20:25:51 2010 (r207890) +++ stable/7/sys/sparc64/include/cache.h Mon May 10 20:25:51 2010 (r207891) @@ -113,6 +113,10 @@ extern cache_flush_t *cache_flush; extern dcache_page_inval_t *dcache_page_inval; extern icache_page_inval_t *icache_page_inval; +cache_flush_t zeus_cache_flush; +dcache_page_inval_t zeus_dcache_page_inval; +icache_page_inval_t zeus_icache_page_inval; + #endif /* KERNEL */ #endif /* !LOCORE */ Copied: stable/7/sys/sparc64/include/mcntl.h (from r207537, head/sys/sparc64/include/mcntl.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sys/sparc64/include/mcntl.h Mon May 10 20:25:51 2010 (r207891, copy of r207537, head/sys/sparc64/include/mcntl.h) @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2010 Marius Strobl + * 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 _MACHINE_MCNTL_H +#define _MACHINE_MCNTL_H + +/* + * Definitions for the SPARC64 V, VI, VII and VIIIfx Memory Control Register + */ +#define MCNTL_JPS1_TSBP (1UL << 8) + +#define MCNTL_RMD_SHIFT 12 +#define MCNTL_RMD_BITS 2 +#define MCNTL_RMD_MASK \ + (((1UL << MCNTL_RMD_BITS) - 1) << MCNTL_RMD_SHIFT) +#define MCNTL_RMD_FULL (0UL << MCNTL_RMD_SHIFT) +#define MCNTL_RMD_1024 (2UL << MCNTL_RMD_SHIFT) +#define MCNTL_RMD_512 (3UL << MCNTL_RMD_SHIFT) + +#define MCNTL_FW_FDTLB (1UL << 14) +#define MCNTL_FW_FITLB (1UL << 15) +#define MCNTL_NC_CACHE (1UL << 16) + +/* The following bits are valid for the SPARC64 VI, VII and VIIIfx only. */ +#define MCNTL_MPG_SDTLB (1UL << 6) +#define MCNTL_MPG_SITLB (1UL << 7) + +/* The following bits are valid for the SPARC64 VIIIfx only. */ +#define MCNTL_HPF_SHIFT 18 +#define MCNTL_HPF_BITS 2 +#define MCNTL_HPF_MASK \ + (((1UL << MCNTL_HPF_BITS) - 1) << MCNTL_HPF_SHIFT) +#define MCNTL_HPF_STRONG (0UL << MCNTL_HPF_SHIFT) +#define MCNTL_HPF_NOT (1UL << MCNTL_HPF_SHIFT) +#define MCNTL_HPF_WEAK (2UL << MCNTL_HPF_SHIFT) + +#endif /* _MACHINE_MCNTL_H */ Modified: stable/7/sys/sparc64/sparc64/cache.c ============================================================================== --- stable/7/sys/sparc64/sparc64/cache.c Mon May 10 20:25:51 2010 (r207890) +++ stable/7/sys/sparc64/sparc64/cache.c Mon May 10 20:25:51 2010 (r207891) @@ -141,7 +141,12 @@ cache_init(struct pcpu *pcpu) if ((pcpu->pc_cache.dc_size & ~(1UL << (ffs(pcpu->pc_cache.dc_size) - 1))) != 0) panic("cache_init: D$ size not a power of 2"); - if (((pcpu->pc_cache.dc_size / pcpu->pc_cache.dc_assoc) / + /* + * For CPUs which don't support unaliasing in hardware ensure that + * the data cache doesn't have too many virtual colors. + */ + if (pcpu->pc_impl != CPU_IMPL_SPARC64V && + ((pcpu->pc_cache.dc_size / pcpu->pc_cache.dc_assoc) / PAGE_SIZE) != DCACHE_COLORS) panic("cache_init: too many D$ colors"); set = pcpu->pc_cache.ec_size / pcpu->pc_cache.ec_assoc; @@ -155,12 +160,21 @@ cache_init(struct pcpu *pcpu) icache_page_inval = cheetah_icache_page_inval; tlb_flush_nonlocked = cheetah_tlb_flush_nonlocked; tlb_flush_user = cheetah_tlb_flush_user; - } else { + } else if (pcpu->pc_impl == CPU_IMPL_SPARC64V) { + cache_enable = cheetah_cache_enable; + cache_flush = zeus_cache_flush; + dcache_page_inval = zeus_dcache_page_inval; + icache_page_inval = zeus_icache_page_inval; + tlb_flush_nonlocked = cheetah_tlb_flush_nonlocked; + tlb_flush_user = cheetah_tlb_flush_user; + } else if (pcpu->pc_impl >= CPU_IMPL_ULTRASPARCI && + pcpu->pc_impl < CPU_IMPL_ULTRASPARCIII) { cache_enable = spitfire_cache_enable; cache_flush = spitfire_cache_flush; dcache_page_inval = spitfire_dcache_page_inval; icache_page_inval = spitfire_icache_page_inval; tlb_flush_nonlocked = spitfire_tlb_flush_nonlocked; tlb_flush_user = spitfire_tlb_flush_user; - } + } else + panic("cache_init: unknown CPU"); } Modified: stable/7/sys/sparc64/sparc64/cheetah.c ============================================================================== --- stable/7/sys/sparc64/sparc64/cheetah.c Mon May 10 20:25:51 2010 (r207890) +++ stable/7/sys/sparc64/sparc64/cheetah.c Mon May 10 20:25:51 2010 (r207891) @@ -39,11 +39,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -52,7 +54,8 @@ __FBSDID("$FreeBSD$"); #define CHEETAH_ICACHE_TAG_LOWER 0x30 /* - * CPU-specific initialization + * CPU-specific initialization - this is used for both the Sun Cheetah and + * later as well as the Fujitsu Zeus and later CPUs. */ void cheetah_init(u_int cpu_impl) @@ -75,6 +78,14 @@ cheetah_init(u_int cpu_impl) stxa(AA_IMMU_TSB_NEXT_REG, ASI_IMMU, 0); membar(Sync); + if (cpu_impl == CPU_IMPL_SPARC64V) { + /* Ensure MCNTL_JPS1_TSBP is 0. */ + val = ldxa(AA_MCNTL, ASI_MCNTL); + val &= ~MCNTL_JPS1_TSBP; + stxa(AA_MCNTL, ASI_MCNTL, val); + return; + } + /* * Configure the first large dTLB to hold 4MB pages (e.g. for direct * mappings) for all three contexts and ensure the second one is set @@ -207,7 +218,7 @@ cheetah_dcache_page_inval(vm_paddr_t spa * consistency is maintained by hardware. */ void -cheetah_icache_page_inval(vm_paddr_t pa) +cheetah_icache_page_inval(vm_paddr_t pa __unused) { } Modified: stable/7/sys/sparc64/sparc64/identcpu.c ============================================================================== --- stable/7/sys/sparc64/sparc64/identcpu.c Mon May 10 20:25:51 2010 (r207890) +++ stable/7/sys/sparc64/sparc64/identcpu.c Mon May 10 20:25:51 2010 (r207891) @@ -34,7 +34,7 @@ cpu_identify(u_long vers, u_int freq, u_ switch (VER_MANUF(vers)) { case 0x04: - manus = "HAL"; + manus = "HAL/Fujitsu"; break; case 0x13: case 0x17: @@ -50,6 +50,27 @@ cpu_identify(u_long vers, u_int freq, u_ case CPU_IMPL_SPARC64: impls = "SPARC64"; break; + case CPU_IMPL_SPARC64II: + impls = "SPARC64-II"; + break; + case CPU_IMPL_SPARC64III: + impls = "SPARC64-III"; + break; + case CPU_IMPL_SPARC64IV: + impls = "SPARC64-IV"; + break; + case CPU_IMPL_SPARC64V: + impls = "SPARC64-V"; + break; + case CPU_IMPL_SPARC64VI: + impls = "SPARC64-VI"; + break; + case CPU_IMPL_SPARC64VII: + impls = "SPARC64-VII"; + break; + case CPU_IMPL_SPARC64VIIIfx: + impls = "SPARC64-VIIIfx"; + break; case CPU_IMPL_ULTRASPARCI: impls = "UltraSparc-I"; break; @@ -60,7 +81,6 @@ cpu_identify(u_long vers, u_int freq, u_ impls = "UltraSparc-IIi"; break; case CPU_IMPL_ULTRASPARCIIe: - /* V9 Manual says `UltraSparc-e'. I assume this is wrong. */ impls = "UltraSparc-IIe"; break; case CPU_IMPL_ULTRASPARCIII: Modified: stable/7/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/machdep.c Mon May 10 20:25:51 2010 (r207890) +++ stable/7/sys/sparc64/sparc64/machdep.c Mon May 10 20:25:51 2010 (r207891) @@ -275,6 +275,7 @@ cpu_cpuid_prop(u_int cpu_impl) switch (cpu_impl) { case CPU_IMPL_SPARC64: + case CPU_IMPL_SPARC64V: case CPU_IMPL_ULTRASPARCI: case CPU_IMPL_ULTRASPARCII: case CPU_IMPL_ULTRASPARCIIi: @@ -299,6 +300,7 @@ cpu_get_mid(u_int cpu_impl) switch (cpu_impl) { case CPU_IMPL_SPARC64: + case CPU_IMPL_SPARC64V: case CPU_IMPL_ULTRASPARCI: case CPU_IMPL_ULTRASPARCII: case CPU_IMPL_ULTRASPARCIIi: @@ -342,7 +344,8 @@ sparc64_init(caddr_t mdp, u_long o1, u_l /* * Do CPU-specific initialization. */ - if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) cheetah_init(cpu_impl); /* @@ -483,6 +486,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l if (cpu_use_vis) { switch (cpu_impl) { case CPU_IMPL_SPARC64: + case CPU_IMPL_SPARC64V: case CPU_IMPL_ULTRASPARCI: case CPU_IMPL_ULTRASPARCII: case CPU_IMPL_ULTRASPARCIIi: Modified: stable/7/sys/sparc64/sparc64/mp_locore.S ============================================================================== --- stable/7/sys/sparc64/sparc64/mp_locore.S Mon May 10 20:25:51 2010 (r207890) +++ stable/7/sys/sparc64/sparc64/mp_locore.S Mon May 10 20:25:51 2010 (r207891) @@ -200,19 +200,25 @@ ENTRY(mp_startup) srlx %l1, VER_IMPL_SHIFT, %l1 sll %l1, VER_IMPL_SIZE, %l1 srl %l1, VER_IMPL_SIZE, %l1 + cmp %l1, CPU_IMPL_SPARC64V + bl %icc, 4f + nop + cmp %l1, CPU_IMPL_ULTRASPARCI + bl %icc, 2f + nop cmp %l1, CPU_IMPL_ULTRASPARCIII bl %icc, 3f nop - mov CPU_STICKSYNC, %l2 +2: mov CPU_STICKSYNC, %l2 membar #StoreLoad stw %l2, [%l0 + CSA_STATE] -2: ldx [%l0 + CSA_STICK], %l2 - brz %l2, 2b +3: ldx [%l0 + CSA_STICK], %l2 + brz %l2, 3b nop wr %l2, 0, %asr24 -3: call cpu_get_mid +4: call cpu_get_mid mov %l1, %o0 /* @@ -225,9 +231,9 @@ ENTRY(mp_startup) /* * Wait till its our turn to bootstrap. */ -4: lduw [%l0 + CSA_MID], %l1 +5: lduw [%l0 + CSA_MID], %l1 cmp %l1, %o0 - bne %xcc, 4b + bne %xcc, 5b nop add %l0, CSA_TTES, %l1 @@ -236,7 +242,7 @@ ENTRY(mp_startup) /* * Map the per-CPU pages. */ -5: sllx %l2, TTE_SHIFT, %l3 +6: sllx %l2, TTE_SHIFT, %l3 add %l1, %l3, %l3 ldx [%l3 + TTE_VPN], %l4 @@ -251,7 +257,7 @@ ENTRY(mp_startup) add %l2, 1, %l2 cmp %l2, PCPU_PAGES - bne %xcc, 5b + bne %xcc, 6b nop /* Modified: stable/7/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/mp_machdep.c Mon May 10 20:25:51 2010 (r207890) +++ stable/7/sys/sparc64/sparc64/mp_machdep.c Mon May 10 20:25:51 2010 (r207891) @@ -164,7 +164,8 @@ mp_init(u_int cpu_impl) if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi || cpu_impl == CPU_IMPL_ULTRASPARCIIIip) isjbus = 1; - if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) cpu_ipi_selected = cheetah_ipi_selected; else cpu_ipi_selected = spitfire_ipi_selected; @@ -308,7 +309,8 @@ ap_start(phandle_t node, u_int mid, u_in ; membar(StoreLoad); csa->csa_tick = rd(tick); - if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) { + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) { while (csa->csa_state != CPU_STICKSYNC) ; membar(StoreLoad); @@ -403,7 +405,8 @@ cpu_mp_bootstrap(struct pcpu *pc) csa = &cpu_start_args; /* Do CPU-specific initialization. */ - if (pc->pc_impl >= CPU_IMPL_ULTRASPARCIII) + if (pc->pc_impl == CPU_IMPL_SPARC64V || + pc->pc_impl >= CPU_IMPL_ULTRASPARCIII) cheetah_init(pc->pc_impl); /* * Enable the caches. Note that his may include applying workarounds. Modified: stable/7/sys/sparc64/sparc64/pmap.c ============================================================================== --- stable/7/sys/sparc64/sparc64/pmap.c Mon May 10 20:25:51 2010 (r207890) +++ stable/7/sys/sparc64/sparc64/pmap.c Mon May 10 20:25:51 2010 (r207891) @@ -522,7 +522,8 @@ pmap_bootstrap(u_int cpu_impl) tp->tte_data = ((translations[i].om_tte & ~((TD_SOFT2_MASK << TD_SOFT2_SHIFT) | - (cpu_impl < CPU_IMPL_ULTRASPARCIII ? + (cpu_impl >= CPU_IMPL_ULTRASPARCI && + cpu_impl < CPU_IMPL_ULTRASPARCIII ? (TD_DIAG_SF_MASK << TD_DIAG_SF_SHIFT) : (TD_RSVD_CH_MASK << TD_RSVD_CH_SHIFT)) | (TD_SOFT_MASK << TD_SOFT_SHIFT))) | TD_EXEC) + Modified: stable/7/sys/sparc64/sparc64/tick.c ============================================================================== --- stable/7/sys/sparc64/sparc64/tick.c Mon May 10 20:25:51 2010 (r207890) +++ stable/7/sys/sparc64/sparc64/tick.c Mon May 10 20:25:51 2010 (r207891) @@ -120,7 +120,8 @@ cpu_initclocks(void) */ } else { clock = PCPU_GET(clock); - intr_setup(PIL_TICK, PCPU_GET(impl) < CPU_IMPL_ULTRASPARCIII ? + intr_setup(PIL_TICK, PCPU_GET(impl) >= CPU_IMPL_ULTRASPARCI && + PCPU_GET(impl) < CPU_IMPL_ULTRASPARCIII ? tick_hardclock_bbwar : tick_hardclock, -1, NULL, NULL); set_cputicker(tick_cputicks, clock, 0); } @@ -325,7 +326,8 @@ void tick_clear(u_int cpu_impl) { - if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) wrstick(0, 0); wrpr(tick, 0, 0); } @@ -334,7 +336,8 @@ void tick_stop(u_int cpu_impl) { - if (cpu_impl >= CPU_IMPL_ULTRASPARCIII) + if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) wrstickcmpr(1L << 63, 0); wrtickcmpr(1L << 63, 0); } Copied: stable/7/sys/sparc64/sparc64/zeus.c (from r207537, head/sys/sparc64/sparc64/zeus.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sys/sparc64/sparc64/zeus.c Mon May 10 20:25:51 2010 (r207891, copy of r207537, head/sys/sparc64/sparc64/zeus.c) @@ -0,0 +1,65 @@ +/*- + * Copyright (c) 2010 Marius Strobl + * 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 +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include + +/* + * Flush all lines from the level 1 caches. + */ +void +zeus_cache_flush(void) +{ + + stxa_sync(0, ASI_FLUSH_L1I, 0); +} + +/* + * Flush a physical page from the data cache. Data cache consistency is + * maintained by hardware. + */ +void +zeus_dcache_page_inval(vm_paddr_t spa __unused) +{ + +} + +/* + * Flush a physical page from the intsruction cache. Instruction cache + * consistency is maintained by hardware. + */ +void +zeus_icache_page_inval(vm_paddr_t pa __unused) +{ + +} From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 20:34:19 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A5A6D106566C; Mon, 10 May 2010 20:34:19 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 949B68FC17; Mon, 10 May 2010 20:34:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AKYJkC061404; Mon, 10 May 2010 20:34:19 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AKYJwJ061401; Mon, 10 May 2010 20:34:19 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005102034.o4AKYJwJ061401@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 20:34: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: r207893 - stable/7/sys/dev/isp X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 20:34:19 -0000 Author: marius Date: Mon May 10 20:34:19 2010 New Revision: 207893 URL: http://svn.freebsd.org/changeset/base/207893 Log: MFC: r207570 On sparc64 obtain the initiator ID from the Open Firmware device tree in order to match what the PROM built-in driver uses. Modified: stable/7/sys/dev/isp/isp_pci.c stable/7/sys/dev/isp/isp_sbus.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/isp/isp_pci.c ============================================================================== --- stable/7/sys/dev/isp/isp_pci.c Mon May 10 20:34:16 2010 (r207892) +++ stable/7/sys/dev/isp/isp_pci.c Mon May 10 20:34:19 2010 (r207893) @@ -46,6 +46,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef __sparc64__ +#include +#include +#endif + #include static uint32_t isp_pci_rd_reg(ispsoftc_t *, int); @@ -517,7 +522,11 @@ isp_get_specific_options(device_t dev, i if (IS_FC(isp)) { ISP_FC_PC(isp, chan)->default_id = 109 - chan; } else { +#ifdef __sparc64__ + ISP_SPI_PC(isp, chan)->iid = OF_getscsinitid(dev); +#else ISP_SPI_PC(isp, chan)->iid = 7; +#endif } } else { if (IS_FC(isp)) { Modified: stable/7/sys/dev/isp/isp_sbus.c ============================================================================== --- stable/7/sys/dev/isp/isp_sbus.c Mon May 10 20:34:16 2010 (r207892) +++ stable/7/sys/dev/isp/isp_sbus.c Mon May 10 20:34:19 2010 (r207893) @@ -41,8 +41,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include #include #include @@ -264,11 +266,7 @@ isp_sbus_attach(device_t dev) isp->isp_confopts |= ISP_CFG_OWNLOOPID; } if (default_id == -1) { - /* - * XXX: should be a way to get properties w/o having - * XXX: to call OF_xxx functions - */ - default_id = 7; + default_id = OF_getscsinitid(dev); } ISP_SPI_PC(isp, 0)->iid = default_id; From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 20:55:25 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1057D1065673; Mon, 10 May 2010 20:55:25 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id F2FC38FC1B; Mon, 10 May 2010 20:55:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AKtO5L066374; Mon, 10 May 2010 20:55:24 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AKtOpW066372; Mon, 10 May 2010 20:55:24 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005102055.o4AKtOpW066372@svn.freebsd.org> From: Marius Strobl Date: Mon, 10 May 2010 20:55: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: r207895 - stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 20:55:25 -0000 Author: marius Date: Mon May 10 20:55:24 2010 New Revision: 207895 URL: http://svn.freebsd.org/changeset/base/207895 Log: MFC: r207683 - Fix broken symlinks on cross platform zfs send/recv. [1] - Enable zfs_ace_byteswap() on FreeBSD as it works just fine (tested between amd64 and sparc64 in both directions by Michael Moll). PR: 146272 Approved by: mm, pjd Obtained from: OpenSolaris (onnv rev. 8283:1ca59f393041; Bug ID 6764193) [1] Modified: stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c ============================================================================== --- stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c Mon May 10 20:55:24 2010 (r207894) +++ stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c Mon May 10 20:55:24 2010 (r207895) @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -50,7 +48,6 @@ zfs_oldace_byteswap(ace_t *ace, int ace_ void zfs_ace_byteswap(void *buf, size_t size, boolean_t zfs_layout) { -#ifdef TODO caddr_t end; caddr_t ptr; zfs_ace_t *zacep; @@ -64,6 +61,20 @@ zfs_ace_byteswap(void *buf, size_t size, while (ptr < end) { if (zfs_layout) { + /* + * Avoid overrun. Embedded aces can have one + * of several sizes. We don't know exactly + * how many our present, only the size of the + * buffer containing them. That size may be + * larger than needed to hold the aces + * present. As long as we do not do any + * swapping beyond the end of our block we are + * okay. It it safe to swap any non-ace data + * within the block since it is just zeros. + */ + if (ptr + sizeof (zfs_ace_hdr_t) > end) { + break; + } zacep = (zfs_ace_t *)ptr; zacep->z_hdr.z_access_mask = BSWAP_32(zacep->z_hdr.z_access_mask); @@ -72,6 +83,10 @@ zfs_ace_byteswap(void *buf, size_t size, BSWAP_16(zacep->z_hdr.z_type); entry_type = zacep->z_hdr.z_flags & ACE_TYPE_FLAGS; } else { + /* Overrun avoidance */ + if (ptr + sizeof (ace_t) > end) { + break; + } acep = (ace_t *)ptr; acep->a_access_mask = BSWAP_32(acep->a_access_mask); acep->a_flags = BSWAP_16(acep->a_flags); @@ -88,8 +103,14 @@ zfs_ace_byteswap(void *buf, size_t size, break; case ACE_IDENTIFIER_GROUP: default: + /* Overrun avoidance */ if (zfs_layout) { - zacep->z_fuid = BSWAP_64(zacep->z_fuid); + if (ptr + sizeof (zfs_ace_t) <= end) { + zacep->z_fuid = BSWAP_64(zacep->z_fuid); + } else { + entry_size = sizeof (zfs_ace_t); + break; + } } switch (ace_type) { case ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE: @@ -108,9 +129,6 @@ zfs_ace_byteswap(void *buf, size_t size, } ptr = ptr + entry_size; } -#else /* TODO */ - panic("%s:%u: TODO", __func__, __LINE__); -#endif /* TODO */ } /* ARGSUSED */ @@ -173,7 +191,8 @@ zfs_znode_byteswap(void *buf, size_t siz if (zp->zp_acl.z_acl_version == ZFS_ACL_VERSION) { zfs_acl_byteswap((void *)&zp->zp_acl.z_ace_data[0], ZFS_ACE_SPACE); - } else + } else { zfs_oldace_byteswap((ace_t *)&zp->zp_acl.z_ace_data[0], ACE_SLOT_CNT); + } } From owner-svn-src-stable-7@FreeBSD.ORG Mon May 10 21:04:40 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D03B91065670; Mon, 10 May 2010 21:04:40 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B53C68FC1E; Mon, 10 May 2010 21:04:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AL4eim068645; Mon, 10 May 2010 21:04:40 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AL4e7Z068642; Mon, 10 May 2010 21:04:40 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201005102104.o4AL4e7Z068642@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 10 May 2010 21:04: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: r207900 - stable/7/share/zoneinfo X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 21:04:40 -0000 Author: edwin Date: Mon May 10 21:04:40 2010 New Revision: 207900 URL: http://svn.freebsd.org/changeset/base/207900 Log: MFC of 207898, tzdata2010j: - Bahia de Banderas (Mexican state of Nayarit) changed time zone UTC-7 to new time zone UTC-6 on April 4, 2010 (to share the same time zone as nearby city Puerto Vallarta, Jalisco). Modified: stable/7/share/zoneinfo/northamerica stable/7/share/zoneinfo/zone.tab Directory Properties: stable/7/share/zoneinfo/ (props changed) Modified: stable/7/share/zoneinfo/northamerica ============================================================================== --- stable/7/share/zoneinfo/northamerica Mon May 10 21:04:37 2010 (r207899) +++ stable/7/share/zoneinfo/northamerica Mon May 10 21:04:40 2010 (r207900) @@ -1,5 +1,5 @@ #
-# @(#)northamerica	8.30
+# @(#)northamerica	8.31
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -2089,7 +2089,44 @@ Zone America/Hermosillo	-7:23:52 -	LMT	1
 			-8:00	-	PST	1970
 			-7:00	Mexico	M%sT	1999
 			-7:00	-	MST
+
+# From Alexander Krivenyshev (2010-04-21):
+# According to news, Bahía de Banderas (Mexican state of Nayarit)
+# changed time zone UTC-7 to new time zone UTC-6 on April 4, 2010 (to
+# share the same time zone as nearby city Puerto Vallarta, Jalisco).
+#
+# (Spanish)
+# Bahía de Banderas homologa su horario al del centro del
+# país, a partir de este domingo
+# 
+# http://www.nayarit.gob.mx/notes.asp?id=20748
+# 
+#
+# Bahía de Banderas homologa su horario con el del Centro del
+# País
+# 
+# http://www.bahiadebanderas.gob.mx/principal/index.php?option=com_content&view=article&id=261:bahia-de-banderas-homologa-su-horario-con-el-del-centro-del-pais&catid=42:comunicacion-social&Itemid=50"
+# 
+#
+# (English)
+# Puerto Vallarta and Bahía de Banderas: One Time Zone
+# 
+# http://virtualvallarta.com/puertovallarta/puertovallarta/localnews/2009-12-03-Puerto-Vallarta-and-Bahia-de-Banderas-One-Time-Zone.shtml
+# 
+#
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_mexico08.html
+# 
+#
+# "Mexico's Senate approved the amendments to the Mexican Schedule System that
+# will allow Bahía de Banderas and Puerto Vallarta to share the same time
+# zone ..."
 # Baja California Sur, Nayarit, Sinaloa
+
+# From Arthur David Olson (2010-05-01):
+# Use "Bahia_Banderas" to keep the name to fourteen characters.
+
 Zone America/Mazatlan	-7:05:40 -	LMT	1921 Dec 31 23:54:20
 			-7:00	-	MST	1927 Jun 10 23:00
 			-6:00	-	CST	1930 Nov 15
@@ -2100,6 +2137,19 @@ Zone America/Mazatlan	-7:05:40 -	LMT	192
 			-7:00	-	MST	1949 Jan 14
 			-8:00	-	PST	1970
 			-7:00	Mexico	M%sT
+
+Zone America/Bahia_Banderas	-7:01:00 -	LMT	1921 Dec 31 23:59:00
+			-7:00	-	MST	1927 Jun 10 23:00
+			-6:00	-	CST	1930 Nov 15
+			-7:00	-	MST	1931 May  1 23:00
+			-6:00	-	CST	1931 Oct
+			-7:00	-	MST	1932 Apr  1
+			-6:00	-	CST	1942 Apr 24
+			-7:00	-	MST	1949 Jan 14
+			-8:00	-	PST	1970
+			-7:00	Mexico	M%sT	2010 Apr 4
+			-6:00	Mexico	C%sT
+
 # Baja California (near US border)
 Zone America/Tijuana	-7:48:04 -	LMT	1922 Jan  1  0:11:56
 			-7:00	-	MST	1924

Modified: stable/7/share/zoneinfo/zone.tab
==============================================================================
--- stable/7/share/zoneinfo/zone.tab	Mon May 10 21:04:37 2010	(r207899)
+++ stable/7/share/zoneinfo/zone.tab	Mon May 10 21:04:40 2010	(r207900)
@@ -1,5 +1,5 @@
 # 
-# @(#)zone.tab	8.35
+# @(#)zone.tab	8.36
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 #
@@ -288,6 +288,7 @@ MX	+2934-10425	America/Ojinaga	US Mounta
 MX	+2904-11058	America/Hermosillo	Mountain Standard Time - Sonora
 MX	+3232-11701	America/Tijuana	US Pacific Time - Baja California near US border
 MX	+3018-11452	America/Santa_Isabel	Mexican Pacific Time - Baja California away from US border
+MX	+2048-10515	America/Bahia_Banderas	Mexican Central Time - Bahia de Banderas
 MY	+0310+10142	Asia/Kuala_Lumpur	peninsular Malaysia
 MY	+0133+11020	Asia/Kuching	Sabah & Sarawak
 MZ	-2558+03235	Africa/Maputo

From owner-svn-src-stable-7@FreeBSD.ORG  Tue May 11 07:07:44 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id AD38F106564A;
	Tue, 11 May 2010 07:07:44 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 9B56A8FC28;
	Tue, 11 May 2010 07:07:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4B77ikP001050;
	Tue, 11 May 2010 07:07:44 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4B77iPW001047;
	Tue, 11 May 2010 07:07:44 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201005110707.o4B77iPW001047@svn.freebsd.org>
From: Martin Matuska 
Date: Tue, 11 May 2010 07:07:44 +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: r207907 -
	stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 11 May 2010 07:07:44 -0000

Author: mm
Date: Tue May 11 07:07:44 2010
New Revision: 207907
URL: http://svn.freebsd.org/changeset/base/207907

Log:
  MFC r207624:
  
  Fix deadlock during zfs receive.
  
  OpenSolaris onnv revision:	9299:8809e849f63e
  
  PR:		kern/146296
  Approved by:	pjd, delphij (mentor)
  Obtained from:	OpenSolaris (Bug ID 6783818, 6826836)

Modified:
  stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==============================================================================
--- stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c	Tue May 11 07:02:29 2010	(r207906)
+++ stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c	Tue May 11 07:07:44 2010	(r207907)
@@ -464,15 +464,15 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t
 	ASSERT(db->db_buf == NULL);
 
 	if (db->db_blkid == DB_BONUS_BLKID) {
-		int bonuslen = dn->dn_bonuslen;
+		int bonuslen = MIN(dn->dn_bonuslen, dn->dn_phys->dn_bonuslen);
 
 		ASSERT3U(bonuslen, <=, db->db.db_size);
 		db->db.db_data = zio_buf_alloc(DN_MAX_BONUSLEN);
 		arc_space_consume(DN_MAX_BONUSLEN);
 		if (bonuslen < DN_MAX_BONUSLEN)
 			bzero(db->db.db_data, DN_MAX_BONUSLEN);
-		bcopy(DN_BONUS(dn->dn_phys), db->db.db_data,
-		    bonuslen);
+		if (bonuslen)
+			bcopy(DN_BONUS(dn->dn_phys), db->db.db_data, bonuslen);
 		dbuf_update_data(db);
 		db->db_state = DB_CACHED;
 		mutex_exit(&db->db_mtx);

Modified: stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c
==============================================================================
--- stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c	Tue May 11 07:02:29 2010	(r207906)
+++ stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c	Tue May 11 07:07:44 2010	(r207907)
@@ -128,15 +128,6 @@ dmu_object_reclaim(objset_t *os, uint64_
 		return (0);
 	}
 
-	tx = dmu_tx_create(os);
-	dmu_tx_hold_bonus(tx, object);
-	err = dmu_tx_assign(tx, TXG_WAIT);
-	if (err) {
-		dmu_tx_abort(tx);
-		dnode_rele(dn, FTAG);
-		return (err);
-	}
-
 	nblkptr = 1 + ((DN_MAX_BONUSLEN - bonuslen) >> SPA_BLKPTRSHIFT);
 
 	/*
@@ -144,16 +135,27 @@ dmu_object_reclaim(objset_t *os, uint64_
 	 * be a new file instance.   We must clear out the previous file
 	 * contents before we can change this type of metadata in the dnode.
 	 */
-	if (dn->dn_nblkptr > nblkptr || dn->dn_datablksz != blocksize)
-		dmu_free_long_range(os, object, 0, DMU_OBJECT_END);
+	if (dn->dn_nblkptr > nblkptr || dn->dn_datablksz != blocksize) {
+		err = dmu_free_long_range(os, object, 0, DMU_OBJECT_END);
+		if (err)
+			goto out;
+	}
+
+	tx = dmu_tx_create(os);
+	dmu_tx_hold_bonus(tx, object);
+	err = dmu_tx_assign(tx, TXG_WAIT);
+	if (err) {
+		dmu_tx_abort(tx);
+		goto out;
+	}
 
 	dnode_reallocate(dn, ot, blocksize, bonustype, bonuslen, tx);
 
 	dmu_tx_commit(tx);
-
+out:
 	dnode_rele(dn, FTAG);
 
-	return (0);
+	return (err);
 }
 
 int

From owner-svn-src-stable-7@FreeBSD.ORG  Tue May 11 19:26:17 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F0124106566B;
	Tue, 11 May 2010 19:26:17 +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 DF2398FC2C;
	Tue, 11 May 2010 19:26:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4BJQHkt073854;
	Tue, 11 May 2010 19:26:17 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4BJQHd1073852;
	Tue, 11 May 2010 19:26:17 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <201005111926.o4BJQHd1073852@svn.freebsd.org>
From: Xin LI 
Date: Tue, 11 May 2010 19:26:17 +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: r207931 - stable/7
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 11 May 2010 19:26:18 -0000

Author: delphij
Date: Tue May 11 19:26:17 2010
New Revision: 207931
URL: http://svn.freebsd.org/changeset/base/207931

Log:
  MFC r205622:
  
  Expose MACHINE_CPU while building lib32 target.

Modified:
  stable/7/Makefile.inc1   (contents, props changed)

Modified: stable/7/Makefile.inc1
==============================================================================
--- stable/7/Makefile.inc1	Tue May 11 19:25:13 2010	(r207930)
+++ stable/7/Makefile.inc1	Tue May 11 19:26:17 2010	(r207931)
@@ -263,6 +263,7 @@ LIB32WMAKEENV=	MAKEOBJDIRPREFIX=${OBJTRE
 		VERSION="${VERSION}" \
 		MACHINE=i386 \
 		MACHINE_ARCH=i386 \
+		MACHINE_CPU="i686 mmx sse sse2" \
 		INSTALL="sh ${.CURDIR}/tools/install.sh" \
 		PATH=${TMPPATH} \
 		CC="${CC} ${LIB32FLAGS}" \

From owner-svn-src-stable-7@FreeBSD.ORG  Wed May 12 17:12:48 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2C2F21065769;
	Wed, 12 May 2010 17:12:48 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1AA8C8FC19;
	Wed, 12 May 2010 17:12:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4CHCmsd070721;
	Wed, 12 May 2010 17:12:48 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4CHClHZ070719;
	Wed, 12 May 2010 17:12:47 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201005121712.o4CHClHZ070719@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 12 May 2010 17:12: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: r207976 - stable/7/sys/dev/fxp
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 12 May 2010 17:12:48 -0000

Author: yongari
Date: Wed May 12 17:12:47 2010
New Revision: 207976
URL: http://svn.freebsd.org/changeset/base/207976

Log:
  MFC r207748:
    It seems controller has two types of promiscuous control, one for
    unicast and the other for multicast. To receive multicast frames
    that host didn't join in promiscuous mode, driver have to set
    promiscuous mode for multicast frames as well.
    The Open Source Software Developer Manual for i8255x was not clear
    how to handle promiscuous mode.
  
    PR:		kern/145905

Modified:
  stable/7/sys/dev/fxp/if_fxp.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/fxp/if_fxp.c
==============================================================================
--- stable/7/sys/dev/fxp/if_fxp.c	Wed May 12 17:12:38 2010	(r207975)
+++ stable/7/sys/dev/fxp/if_fxp.c	Wed May 12 17:12:47 2010	(r207976)
@@ -2339,7 +2339,7 @@ fxp_init_body(struct fxp_softc *sc)
 	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 */
-	cbp->mc_all =		ifp->if_flags & IFF_ALLMULTI ? 1 : 0;
+	cbp->mc_all =		ifp->if_flags & IFF_ALLMULTI ? 1 : prm;
 	cbp->gamla_rx =		sc->flags & FXP_FLAG_EXT_RFA ? 1 : 0;
 	cbp->vlan_strip_en =	((sc->flags & FXP_FLAG_EXT_RFA) != 0 &&
 	    (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) ? 1 : 0;

From owner-svn-src-stable-7@FreeBSD.ORG  Wed May 12 17:34:51 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B447E1065674;
	Wed, 12 May 2010 17:34:51 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A32C28FC1A;
	Wed, 12 May 2010 17:34:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4CHYpEj075772;
	Wed, 12 May 2010 17:34:51 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4CHYphQ075770;
	Wed, 12 May 2010 17:34:51 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201005121734.o4CHYphQ075770@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 12 May 2010 17:34:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207980 - stable/7/sys/dev/re
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 12 May 2010 17:34:51 -0000

Author: yongari
Date: Wed May 12 17:34:51 2010
New Revision: 207980
URL: http://svn.freebsd.org/changeset/base/207980

Log:
  MFC r207763:
    Don't change PCIe maximum read request size to 2048 on RTL810x
    controllers. It caused device timeouts.
  
    Reported by:	McLone < mclone <> gmail dot com >
    Tested by:	McLone < mclone <> gmail dot com >

Modified:
  stable/7/sys/dev/re/if_re.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/re/if_re.c
==============================================================================
--- stable/7/sys/dev/re/if_re.c	Wed May 12 17:30:46 2010	(r207979)
+++ stable/7/sys/dev/re/if_re.c	Wed May 12 17:34:51 2010	(r207980)
@@ -1163,9 +1163,11 @@ re_attach(device_t dev)
 	msic = 0;
 	if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) {
 		sc->rl_flags |= RL_FLAG_PCIE;
-		/* Set PCIe maximum read request size to 2048. */
-		if (pci_get_max_read_req(dev) < 2048)
-			pci_set_max_read_req(dev, 2048);
+		if (devid != RT_DEVICEID_8101E) {
+			/* Set PCIe maximum read request size to 2048. */
+			if (pci_get_max_read_req(dev) < 2048)
+				pci_set_max_read_req(dev, 2048);
+		}
 		msic = pci_msi_count(dev);
 		if (bootverbose)
 			device_printf(dev, "MSI count : %d\n", msic);

From owner-svn-src-stable-7@FreeBSD.ORG  Thu May 13 15:28:35 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 323D41065673;
	Thu, 13 May 2010 15:28:35 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1FEC28FC15;
	Thu, 13 May 2010 15:28:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4DFSZWh072820;
	Thu, 13 May 2010 15:28:35 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4DFSYs4072813;
	Thu, 13 May 2010 15:28:34 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201005131528.o4DFSYs4072813@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Thu, 13 May 2010 15:28:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r208029 - stable/7/contrib/telnet/telnet
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 13 May 2010 15:28:35 -0000

Author: jilles
Date: Thu May 13 15:28:34 2010
New Revision: 208029
URL: http://svn.freebsd.org/changeset/base/208029

Log:
  MFC r207449: telnet: Fix infinite loop if local output generates SIGPIPE.
  
  Instead of catching SIGPIPE and jumping out of the signal handler with
  longjmp, ignore it and handle write errors to the local output by exiting
  from there. I have changed the error message to mention the local output
  instead of NetBSD's wrong "Connection closed by foreign host". Write errors
  to the network were already handled by exiting immediately and this now
  applies to EPIPE too.
  
  The code assumed that SIGPIPE could only be generated by the network
  connection; if it was generated by the local output, it would longjmp out of
  the signal handler and write an error message which caused another SIGPIPE.
  
  PR:		19773
  Obtained from:	NetBSD

Modified:
  stable/7/contrib/telnet/telnet/commands.c
  stable/7/contrib/telnet/telnet/externs.h
  stable/7/contrib/telnet/telnet/network.c
  stable/7/contrib/telnet/telnet/sys_bsd.c
  stable/7/contrib/telnet/telnet/telnet.c
  stable/7/contrib/telnet/telnet/terminal.c
Directory Properties:
  stable/7/contrib/telnet/   (props changed)

Modified: stable/7/contrib/telnet/telnet/commands.c
==============================================================================
--- stable/7/contrib/telnet/telnet/commands.c	Thu May 13 12:08:11 2010	(r208028)
+++ stable/7/contrib/telnet/telnet/commands.c	Thu May 13 15:28:34 2010	(r208029)
@@ -2491,8 +2491,7 @@ tn(int argc, char *argv[])
 	env_export("USER");
     }
     (void) call(status, "status", "notmuch", 0);
-    if (setjmp(peerdied) == 0)
-	telnet(user);
+    telnet(user); 
     (void) NetClose(net);
     ExitString("Connection closed by foreign host.\n",1);
     /*NOTREACHED*/

Modified: stable/7/contrib/telnet/telnet/externs.h
==============================================================================
--- stable/7/contrib/telnet/telnet/externs.h	Thu May 13 12:08:11 2010	(r208028)
+++ stable/7/contrib/telnet/telnet/externs.h	Thu May 13 15:28:34 2010	(r208029)
@@ -233,7 +233,6 @@ extern void
     SetNetTrace(char *);	/* Function to change where debugging goes */
 
 extern jmp_buf
-    peerdied,
     toplevel;		/* For error conditions. */
 
 extern void

Modified: stable/7/contrib/telnet/telnet/network.c
==============================================================================
--- stable/7/contrib/telnet/telnet/network.c	Thu May 13 12:08:11 2010	(r208028)
+++ stable/7/contrib/telnet/telnet/network.c	Thu May 13 15:28:34 2010	(r208029)
@@ -158,7 +158,7 @@ netflush(void)
 	    perror(hostname);
 	    (void)NetClose(net);
 	    ring_clear_mark(&netoring);
-	    longjmp(peerdied, -1);
+	    ExitString("Connection closed by foreign host.\n", 1);
 	    /*NOTREACHED*/
 	}
 	n = 0;

Modified: stable/7/contrib/telnet/telnet/sys_bsd.c
==============================================================================
--- stable/7/contrib/telnet/telnet/sys_bsd.c	Thu May 13 12:08:11 2010	(r208028)
+++ stable/7/contrib/telnet/telnet/sys_bsd.c	Thu May 13 15:28:34 2010	(r208029)
@@ -809,14 +809,6 @@ NetNonblockingIO(int fd, int onoff)
  */
 
 /* ARGSUSED */
-static SIG_FUNC_RET
-deadpeer(int sig __unused)
-{
-	setcommandmode();
-	longjmp(peerdied, -1);
-}
-
-/* ARGSUSED */
 SIG_FUNC_RET
 intr(int sig __unused)
 {
@@ -884,7 +876,7 @@ sys_telnet_init(void)
 {
     (void) signal(SIGINT, intr);
     (void) signal(SIGQUIT, intr2);
-    (void) signal(SIGPIPE, deadpeer);
+    (void) signal(SIGPIPE, SIG_IGN);
 #ifdef	SIGWINCH
     (void) signal(SIGWINCH, sendwin);
 #endif

Modified: stable/7/contrib/telnet/telnet/telnet.c
==============================================================================
--- stable/7/contrib/telnet/telnet/telnet.c	Thu May 13 12:08:11 2010	(r208028)
+++ stable/7/contrib/telnet/telnet/telnet.c	Thu May 13 15:28:34 2010	(r208029)
@@ -146,7 +146,6 @@ unsigned char telopt_environ = TELOPT_NE
 #endif
 
 jmp_buf	toplevel;
-jmp_buf	peerdied;
 
 int	flushline;
 int	linemode;

Modified: stable/7/contrib/telnet/telnet/terminal.c
==============================================================================
--- stable/7/contrib/telnet/telnet/terminal.c	Thu May 13 12:08:11 2010	(r208028)
+++ stable/7/contrib/telnet/telnet/terminal.c	Thu May 13 15:28:34 2010	(r208029)
@@ -111,7 +111,8 @@ init_terminal(void)
 }
 
 /*
- *		Send as much data as possible to the terminal.
+ *		Send as much data as possible to the terminal, else exits if
+ *		it encounters a permanent failure when writing to the tty.
  *
  *		Return value:
  *			-1: No useful work done, data waiting to go out.
@@ -152,8 +153,19 @@ ttyflush(int drop)
 	}
 	ring_consumed(&ttyoring, n);
     }
-    if (n < 0)
+    if (n < 0) {
+	if (errno == EAGAIN || errno == EINTR) {
+	    return -1;
+	} else {
+	    ring_consumed(&ttyoring, ring_full_count(&ttyoring));
+	    setconnmode(0);
+	    setcommandmode();
+	    NetClose(net);
+	    fprintf(stderr, "Write error on local output.\n");
+	    exit(1);
+	}
 	return -1;
+    }
     if (n == n0) {
 	if (n0)
 	    return -1;

From owner-svn-src-stable-7@FreeBSD.ORG  Fri May 14 08:56:08 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 04901106566B;
	Fri, 14 May 2010 08:56:08 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E72F28FC21;
	Fri, 14 May 2010 08:56:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4E8u7AE006099;
	Fri, 14 May 2010 08:56:07 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4E8u7vH006098;
	Fri, 14 May 2010 08:56:07 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201005140856.o4E8u7vH006098@svn.freebsd.org>
From: Martin Matuska 
Date: Fri, 14 May 2010 08:56:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r208061 -
	stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 14 May 2010 08:56:08 -0000

Author: mm
Date: Fri May 14 08:56:07 2010
New Revision: 208061
URL: http://svn.freebsd.org/changeset/base/208061

Log:
  MFC r207480:
  
  Change description of tunable group vfs.zfs.txg to be more
  understandable.
  
  Approved by:	pjd, delphij (mentor)

Modified:
  stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c
==============================================================================
--- stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c	Fri May 14 04:53:57 2010	(r208060)
+++ stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c	Fri May 14 08:56:07 2010	(r208061)
@@ -40,7 +40,8 @@ int zfs_txg_timeout = 30;	/* max seconds
 extern int zfs_txg_synctime;
 
 SYSCTL_DECL(_vfs_zfs);
-SYSCTL_NODE(_vfs_zfs, OID_AUTO, txg, CTLFLAG_RW, 0, "ZFS TXG");
+SYSCTL_NODE(_vfs_zfs, OID_AUTO, txg, CTLFLAG_RW, 0,
+    "ZFS transaction groups (TXG)");
 TUNABLE_INT("vfs.zfs.txg.timeout", &zfs_txg_timeout);
 SYSCTL_INT(_vfs_zfs_txg, OID_AUTO, timeout, CTLFLAG_RDTUN, &zfs_txg_timeout, 0,
     "Maximum seconds worth of delta per txg");

From owner-svn-src-stable-7@FreeBSD.ORG  Fri May 14 09:02:31 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D21341065670;
	Fri, 14 May 2010 09:02:31 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C0E8D8FC1E;
	Fri, 14 May 2010 09:02:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4E92V9o007613;
	Fri, 14 May 2010 09:02:31 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4E92VlN007611;
	Fri, 14 May 2010 09:02:31 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201005140902.o4E92VlN007611@svn.freebsd.org>
From: Martin Matuska 
Date: Fri, 14 May 2010 09:02:31 +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: r208063 -
	stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 14 May 2010 09:02:31 -0000

Author: mm
Date: Fri May 14 09:02:31 2010
New Revision: 208063
URL: http://svn.freebsd.org/changeset/base/208063

Log:
  MFC r207427:
  
  Fix improper pool write throughput calculation.
  
  OpenSolaris onnv revision:      9366:17553395a745
  
  PR:		kern/146108
  Obtained from:	OpenSolaris (Bug ID 6817339)
  Approved by:	pjd, delphij (mentor)

Modified:
  stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
==============================================================================
--- stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c	Fri May 14 09:00:29 2010	(r208062)
+++ stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c	Fri May 14 09:02:31 2010	(r208063)
@@ -300,6 +300,7 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t t
 	tx = dmu_tx_create_assigned(dp, txg);
 
 	dp->dp_read_overhead = 0;
+	start = gethrtime();
 	zio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED);
 	while (ds = txg_list_remove(&dp->dp_dirty_datasets, txg)) {
 		if (!list_link_active(&ds->ds_synced_link))
@@ -310,7 +311,6 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t t
 	}
 	DTRACE_PROBE(pool_sync__1setup);
 
-	start = gethrtime();
 	err = zio_wait(zio);
 	write_time = gethrtime() - start;
 	ASSERT(err == 0);

From owner-svn-src-stable-7@FreeBSD.ORG  Fri May 14 09:09:09 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 062D41065674;
	Fri, 14 May 2010 09:09:09 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E8F9D8FC0A;
	Fri, 14 May 2010 09:09:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4E998ae009134;
	Fri, 14 May 2010 09:09:08 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4E998YB009132;
	Fri, 14 May 2010 09:09:08 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201005140909.o4E998YB009132@svn.freebsd.org>
From: Martin Matuska 
Date: Fri, 14 May 2010 09:09: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: r208065 -
	stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 14 May 2010 09:09:09 -0000

Author: mm
Date: Fri May 14 09:09:08 2010
New Revision: 208065
URL: http://svn.freebsd.org/changeset/base/208065

Log:
  MFC r207908:
  
  Fix endianess bug in ZFS intent log (ZIL).
  
  OpenSolaris onnv revision:	8109:6147a1bdd359
  
  Approved by:	pjd, delphij (mentor)
  Obtained from:	OpenSolaris (Bug ID 6760048)

Modified:
  stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
==============================================================================
--- stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c	Fri May 14 09:06:49 2010	(r208064)
+++ stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c	Fri May 14 09:09:08 2010	(r208065)
@@ -362,14 +362,20 @@ zil_create(zilog_t *zilog)
 	blk = zh->zh_log;
 
 	/*
-	 * If we don't already have an initial log block, allocate one now.
+	 * If we don't already have an initial log block or we have one
+	 * but it's the wrong endianness then allocate one.
 	 */
-	if (BP_IS_HOLE(&blk)) {
+	if (BP_IS_HOLE(&blk) || BP_SHOULD_BYTESWAP(&blk)) {
 		tx = dmu_tx_create(zilog->zl_os);
 		(void) dmu_tx_assign(tx, TXG_WAIT);
 		dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx);
 		txg = dmu_tx_get_txg(tx);
 
+		if (!BP_IS_HOLE(&blk)) {
+			zio_free_blk(zilog->zl_spa, &blk, txg);
+			BP_ZERO(&blk);
+		}
+
 		error = zio_alloc_blk(zilog->zl_spa, ZIL_MIN_BLKSZ, &blk,
 		    NULL, txg);
 

From owner-svn-src-stable-7@FreeBSD.ORG  Fri May 14 10:04:11 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C8E2C106564A;
	Fri, 14 May 2010 10:04:11 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ADA038FC16;
	Fri, 14 May 2010 10:04:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4EA4Bfn021378;
	Fri, 14 May 2010 10:04:11 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4EA4BCO021376;
	Fri, 14 May 2010 10:04:11 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201005141004.o4EA4BCO021376@svn.freebsd.org>
From: Martin Matuska 
Date: Fri, 14 May 2010 10:04: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: r208068 -
	stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 14 May 2010 10:04:12 -0000

Author: mm
Date: Fri May 14 10:04:11 2010
New Revision: 208068
URL: http://svn.freebsd.org/changeset/base/208068

Log:
  MFC r207909, r207910, r207911:
  
  MFC r207909:
  Fix zfs rename (may occasionally fail with dataset busy).
  OpenSolaris onnv revision:	8517:41a0783dde17
  
  MFC r207910:
  Fix possible panic with zfs destroy.
  OpenSolaris onnv revision:	8779:f164e0e90508
  
  MFC r207911:
  Fix failed assertion on destroying datasets from an older pool version.
  OpenSolaris onnv revision:	9390:887948510f80
  
  PR:		kern/146471
  Approved by:	pjd, delphij (mentor)
  Obtained from:	OpenSolaris (Bug ID 6784757, 6784924, 6826861)

Modified:
  stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
==============================================================================
--- stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c	Fri May 14 09:57:10 2010	(r208067)
+++ stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c	Fri May 14 10:04:11 2010	(r208068)
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -554,6 +554,7 @@ dsl_dataset_own_obj(dsl_pool_t *dp, uint
 		return (err);
 	if (!dsl_dataset_tryown(*dsp, DS_MODE_IS_INCONSISTENT(flags), owner)) {
 		dsl_dataset_rele(*dsp, owner);
+		*dsp = NULL;
 		return (EBUSY);
 	}
 	return (0);
@@ -1267,8 +1268,7 @@ dsl_dataset_rollback_sync(void *arg1, vo
 		(void) zio_wait(zio);
 	}
 
-	ASSERT(!(ds->ds_phys->ds_flags & DS_FLAG_UNIQUE_ACCURATE) ||
-	    ds->ds_phys->ds_unique_bytes == 0);
+	ASSERT(!DS_UNIQUE_IS_ACCURATE(ds) || ds->ds_phys->ds_unique_bytes == 0);
 
 	if (ds->ds_prev && ds->ds_prev != ds->ds_dir->dd_pool->dp_origin_snap) {
 		/* Change our contents to that of the prev snapshot */
@@ -1660,7 +1660,7 @@ dsl_dataset_destroy_sync(void *arg1, voi
 		err = traverse_dsl_dataset(ds, ds->ds_phys->ds_prev_snap_txg,
 		    ADVANCE_POST, kill_blkptr, &ka);
 		ASSERT3U(err, ==, 0);
-		ASSERT(spa_version(dp->dp_spa) < SPA_VERSION_UNIQUE_ACCURATE ||
+		ASSERT(!DS_UNIQUE_IS_ACCURATE(ds) ||
 		    ds->ds_phys->ds_unique_bytes == 0);
 	}
 
@@ -2205,6 +2205,12 @@ dsl_dataset_rename(char *oldname, const 
 	err = dsl_dir_open(oldname, FTAG, &dd, &tail);
 	if (err)
 		return (err);
+	/*
+	 * If there are more than 2 references there may be holds
+	 * hanging around that haven't been cleared out yet.
+	 */
+	if (dmu_buf_refcount(dd->dd_dbuf) > 2)
+		txg_wait_synced(dd->dd_pool, 0);
 	if (tail == NULL) {
 		int delta = strlen(newname) - strlen(oldname);
 
@@ -2578,7 +2584,7 @@ snaplist_destroy(list_t *l, boolean_t ow
 {
 	struct promotenode *snap;
 
-	if (!list_link_active(&l->list_head))
+	if (!l || !list_link_active(&l->list_head))
 		return;
 
 	while ((snap = list_tail(l)) != NULL) {

From owner-svn-src-stable-7@FreeBSD.ORG  Fri May 14 10:06:21 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4593A1065676;
	Fri, 14 May 2010 10:06:21 +0000 (UTC) (envelope-from mm@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 33BCB8FC25;
	Fri, 14 May 2010 10:06:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4EA6KmO023875;
	Fri, 14 May 2010 10:06:20 GMT (envelope-from mm@svn.freebsd.org)
Received: (from mm@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4EA6Kti023873;
	Fri, 14 May 2010 10:06:20 GMT (envelope-from mm@svn.freebsd.org)
Message-Id: <201005141006.o4EA6Kti023873@svn.freebsd.org>
From: Martin Matuska 
Date: Fri, 14 May 2010 10:06: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: r208069 - stable/7/cddl/contrib/opensolaris/cmd/ztest
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 14 May 2010 10:06:21 -0000

Author: mm
Date: Fri May 14 10:06:20 2010
New Revision: 208069
URL: http://svn.freebsd.org/changeset/base/208069

Log:
  MFC r207910:
  (cddl/contrib/opensolaris part)
  
  Fix possible panic with zfs destroy.
  OpenSolaris onnv revision:	8779:f164e0e90508
  
  PR:		kern/146471
  Approved by:	pjd, delphij (mentor)
  Obtained from:	OpenSolaris (Bug ID 6784924)

Modified:
  stable/7/cddl/contrib/opensolaris/cmd/ztest/ztest.c
Directory Properties:
  stable/7/cddl/contrib/opensolaris/   (props changed)

Modified: stable/7/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==============================================================================
--- stable/7/cddl/contrib/opensolaris/cmd/ztest/ztest.c	Fri May 14 10:04:11 2010	(r208068)
+++ stable/7/cddl/contrib/opensolaris/cmd/ztest/ztest.c	Fri May 14 10:06:20 2010	(r208069)
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -93,6 +93,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -174,6 +175,7 @@ ztest_func_t ztest_traverse;
 ztest_func_t ztest_dsl_prop_get_set;
 ztest_func_t ztest_dmu_objset_create_destroy;
 ztest_func_t ztest_dmu_snapshot_create_destroy;
+ztest_func_t ztest_dsl_dataset_promote_busy;
 ztest_func_t ztest_spa_create_destroy;
 ztest_func_t ztest_fault_inject;
 ztest_func_t ztest_spa_rename;
@@ -208,6 +210,7 @@ ztest_info_t ztest_info[] = {
 	{ ztest_dsl_prop_get_set,		1,	&zopt_sometimes	},
 	{ ztest_dmu_objset_create_destroy,	1,	&zopt_sometimes },
 	{ ztest_dmu_snapshot_create_destroy,	1,	&zopt_sometimes },
+	{ ztest_dsl_dataset_promote_busy,	1,	&zopt_sometimes },
 	{ ztest_spa_create_destroy,		1,	&zopt_sometimes },
 	{ ztest_fault_inject,			1,	&zopt_sometimes	},
 	{ ztest_spa_rename,			1,	&zopt_rarely	},
@@ -1592,6 +1595,109 @@ ztest_traverse(ztest_args_t *za)
 }
 
 /*
+ * Verify dsl_dataset_promote handles EBUSY
+ */
+void
+ztest_dsl_dataset_promote_busy(ztest_args_t *za)
+{
+	int error;
+	objset_t *os = za->za_os;
+	objset_t *clone;
+	dsl_dataset_t *ds;
+	char snap1name[100];
+	char clone1name[100];
+	char snap2name[100];
+	char clone2name[100];
+	char snap3name[100];
+	char osname[MAXNAMELEN];
+	static uint64_t uniq = 0;
+	uint64_t curval;
+
+	curval = atomic_add_64_nv(&uniq, 5) - 5;
+
+	(void) rw_rdlock(&ztest_shared->zs_name_lock);
+
+	dmu_objset_name(os, osname);
+	(void) snprintf(snap1name, 100, "%s@s1_%llu", osname, curval++);
+	(void) snprintf(clone1name, 100, "%s/c1_%llu", osname, curval++);
+	(void) snprintf(snap2name, 100, "%s@s2_%llu", clone1name, curval++);
+	(void) snprintf(clone2name, 100, "%s/c2_%llu", osname, curval++);
+	(void) snprintf(snap3name, 100, "%s@s3_%llu", clone1name, curval++);
+
+	error = dmu_objset_snapshot(osname, strchr(snap1name, '@')+1, FALSE);
+	if (error == ENOSPC)
+		ztest_record_enospc("dmu_take_snapshot");
+	else if (error != 0 && error != EEXIST)
+		fatal(0, "dmu_take_snapshot = %d", error);
+
+	error = dmu_objset_open(snap1name, DMU_OST_OTHER,
+	    DS_MODE_USER | DS_MODE_READONLY, &clone);
+	if (error)
+		fatal(0, "dmu_open_snapshot(%s) = %d", snap1name, error);
+
+	error = dmu_objset_create(clone1name, DMU_OST_OTHER, clone, 0,
+	    NULL, NULL);
+	if (error)
+		fatal(0, "dmu_objset_create(%s) = %d", clone1name, error);
+	dmu_objset_close(clone);
+
+	error = dmu_objset_snapshot(clone1name, strchr(snap2name, '@')+1,
+	    FALSE);
+	if (error == ENOSPC)
+		ztest_record_enospc("dmu_take_snapshot");
+	else if (error != 0 && error != EEXIST)
+		fatal(0, "dmu_take_snapshot = %d", error);
+
+	error = dmu_objset_snapshot(clone1name, strchr(snap3name, '@')+1,
+	    FALSE);
+	if (error == ENOSPC)
+		ztest_record_enospc("dmu_take_snapshot");
+	else if (error != 0 && error != EEXIST)
+		fatal(0, "dmu_take_snapshot = %d", error);
+
+	error = dmu_objset_open(snap3name, DMU_OST_OTHER,
+	    DS_MODE_USER | DS_MODE_READONLY, &clone);
+	if (error)
+		fatal(0, "dmu_open_snapshot(%s) = %d", snap3name, error);
+
+	error = dmu_objset_create(clone2name, DMU_OST_OTHER, clone, 0,
+	    NULL, NULL);
+	if (error)
+		fatal(0, "dmu_objset_create(%s) = %d", clone2name, error);
+	dmu_objset_close(clone);
+
+	error = dsl_dataset_own(snap1name, 0, FTAG, &ds);
+	if (error)
+		fatal(0, "dsl_dataset_own(%s) = %d", snap1name, error);
+	error = dsl_dataset_promote(clone2name);
+	if (error != EBUSY)
+		fatal(0, "dsl_dataset_promote(%s), %d, not EBUSY", clone2name,
+		    error);
+	dsl_dataset_disown(ds, FTAG);
+
+	error = dmu_objset_destroy(clone2name);
+	if (error)
+		fatal(0, "dmu_objset_destroy(%s) = %d", clone2name, error);
+
+	error = dmu_objset_destroy(snap3name);
+	if (error)
+		fatal(0, "dmu_objset_destroy(%s) = %d", snap2name, error);
+
+	error = dmu_objset_destroy(snap2name);
+	if (error)
+		fatal(0, "dmu_objset_destroy(%s) = %d", snap2name, error);
+
+	error = dmu_objset_destroy(clone1name);
+	if (error)
+		fatal(0, "dmu_objset_destroy(%s) = %d", clone1name, error);
+	error = dmu_objset_destroy(snap1name);
+	if (error)
+		fatal(0, "dmu_objset_destroy(%s) = %d", snap1name, error);
+
+	(void) rw_unlock(&ztest_shared->zs_name_lock);
+}
+
+/*
  * Verify that dmu_object_{alloc,free} work as expected.
  */
 void

From owner-svn-src-stable-7@FreeBSD.ORG  Fri May 14 13:43:23 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E3BC41065674;
	Fri, 14 May 2010 13:43:23 +0000 (UTC)
	(envelope-from fabient@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D20708FC15;
	Fri, 14 May 2010 13:43:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4EDhNSu071556;
	Fri, 14 May 2010 13:43:23 GMT (envelope-from fabient@svn.freebsd.org)
Received: (from fabient@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4EDhN1Q071554;
	Fri, 14 May 2010 13:43:23 GMT (envelope-from fabient@svn.freebsd.org)
Message-Id: <201005141343.o4EDhN1Q071554@svn.freebsd.org>
From: Fabien Thomas 
Date: Fri, 14 May 2010 13:43:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r208072 - stable/7/usr.sbin/pmcstat
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 14 May 2010 13:43:24 -0000

Author: fabient
Date: Fri May 14 13:43:23 2010
New Revision: 208072
URL: http://svn.freebsd.org/changeset/base/208072

Log:
  MFC r207755:
  Rework the calltree top view by critical callchain.
  The percentage shown is the sum of the cost for the codepath.

Modified:
  stable/7/usr.sbin/pmcstat/pmcpl_calltree.c
Directory Properties:
  stable/7/usr.sbin/pmcstat/   (props changed)

Modified: stable/7/usr.sbin/pmcstat/pmcpl_calltree.c
==============================================================================
--- stable/7/usr.sbin/pmcstat/pmcpl_calltree.c	Fri May 14 13:42:17 2010	(r208071)
+++ stable/7/usr.sbin/pmcstat/pmcpl_calltree.c	Fri May 14 13:43:23 2010	(r208072)
@@ -120,8 +120,15 @@ struct pmcpl_ct_node_hash {
 struct pmcpl_ct_sample pmcpl_ct_callid;
 
 #define PMCPL_CT_MAXCOL		PMC_CALLCHAIN_DEPTH_MAX	
-#define PMCPL_CT_MAXLINE	256
-struct pmcpl_ct_node  *pmcpl_ct_topscreen[PMCPL_CT_MAXCOL][PMCPL_CT_MAXLINE];
+#define PMCPL_CT_MAXLINE	1024	/* TODO: dynamic. */
+
+struct pmcpl_ct_line {
+	unsigned	ln_sum;
+	unsigned	ln_index;
+};
+
+struct pmcpl_ct_line	pmcpl_ct_topmax[PMCPL_CT_MAXLINE+1];
+struct pmcpl_ct_node	*pmcpl_ct_topscreen[PMCPL_CT_MAXCOL+1][PMCPL_CT_MAXLINE+1];
 
 /*
  * All nodes indexed by function/image name are placed in a hash table.
@@ -225,28 +232,6 @@ pmcpl_ct_arc_grow(int cursize, int *maxs
 }
 
 /*
- * Compare two arc by samples value.
- */
-static int
-pmcpl_ct_arc_compare(void *thunk, const void *a, const void *b)
-{
-	const struct pmcpl_ct_arc *ct1, *ct2;
-	int pmcin = *(int *)thunk;
-
-	ct1 = (const struct pmcpl_ct_arc *) a;
-	ct2 = (const struct pmcpl_ct_arc *) b;
-
-	/* Sort in reverse order */
-	if (PMCPL_CT_SAMPLE(pmcin, &ct1->pcta_samples) <
-	    PMCPL_CT_SAMPLE(pmcin, &ct2->pcta_samples))
-		return (1);
-	if (PMCPL_CT_SAMPLE(pmcin, &ct1->pcta_samples) >
-	    PMCPL_CT_SAMPLE(pmcin, &ct2->pcta_samples))
-		return (-1);
-	return (0);
-}
-
-/*
  * Grow the instr table.
  */
 
@@ -366,9 +351,9 @@ pmcpl_ct_node_cleartag(void)
 
 static int
 pmcpl_ct_node_dumptop(int pmcin, struct pmcpl_ct_node *ct,
-    struct pmcpl_ct_sample *rsamples, int x, int *y, int maxy)
+    struct pmcpl_ct_sample *rsamples, int x, int *y)
 {
-	int i;
+	int i, terminal;
 
 	if (ct->pct_flags & PMCPL_PCT_TAG)
 		return 0;
@@ -382,12 +367,21 @@ pmcpl_ct_node_dumptop(int pmcin, struct 
 	pmcpl_ct_topscreen[x][*y] = ct;
 
 	/*
-	 * This is a terminal node
+	 * Check if this is a terminal node.
+	 * We need to check that some samples exist
+	 * for at least one arc for that PMC.
 	 */
-	if (ct->pct_narc == 0) {
+	terminal = 1;
+	for (i = 0; i < ct->pct_narc; i++)
+		if (PMCPL_CT_SAMPLE(pmcin,
+		    &ct->pct_arc[i].pcta_samples) != 0) {
+			terminal = 0;
+			break;
+		}
+
+	if (ct->pct_narc == 0 || terminal) {
 		pmcpl_ct_topscreen[x+1][*y] = NULL;
-		if (*y >= PMCPL_CT_MAXLINE ||
-		    *y >= maxy)
+		if (*y >= PMCPL_CT_MAXLINE)
 			return 1;
 		*y = *y + 1;
 		for (i=0; i < x; i++)
@@ -396,14 +390,7 @@ pmcpl_ct_node_dumptop(int pmcin, struct 
 		return 0;
 	}
 
-	/*
-	 * Quicksort the arcs.
-	 */
-	qsort_r(ct->pct_arc, ct->pct_narc, sizeof(struct pmcpl_ct_arc),
-	    &pmcin, pmcpl_ct_arc_compare);
-
 	for (i = 0; i < ct->pct_narc; i++) {
-		/* Skip this arc if there is no sample at all. */
 		if (PMCPL_CT_SAMPLE(pmcin,
 		    &ct->pct_arc[i].pcta_samples) == 0)
 			continue;
@@ -411,7 +398,7 @@ pmcpl_ct_node_dumptop(int pmcin, struct 
 		    &ct->pct_arc[i].pcta_samples) > pmcstat_threshold) {
 			if (pmcpl_ct_node_dumptop(pmcin,
 			        ct->pct_arc[i].pcta_child,
-			        rsamples, x+1, y, maxy))
+			        rsamples, x+1, y))
 				return 1;
 		}
 	}
@@ -420,12 +407,36 @@ pmcpl_ct_node_dumptop(int pmcin, struct 
 }
 
 /*
+ * Compare two top line by sum.
+ */
+static int
+pmcpl_ct_line_compare(const void *a, const void *b)
+{
+	const struct pmcpl_ct_line *ct1, *ct2;
+
+	ct1 = (const struct pmcpl_ct_line *) a;
+	ct2 = (const struct pmcpl_ct_line *) b;
+
+	/* Sort in reverse order */
+	if (ct1->ln_sum < ct2->ln_sum)
+		return (1);
+	if (ct1->ln_sum > ct2->ln_sum)
+		return (-1);
+	return (0);
+}
+
+/*
  * Format and display given PMC index.
  */
 
 static void
 pmcpl_ct_node_printtop(struct pmcpl_ct_sample *rsamples, int pmcin, int maxy)
 {
+#undef	TS
+#undef	TSI
+#define	TS(x, y)	(pmcpl_ct_topscreen[x][y])
+#define	TSI(x, y)	(pmcpl_ct_topscreen[x][pmcpl_ct_topmax[y].ln_index])
+
 	int v_attrs, ns_len, vs_len, is_len, width, indentwidth, x, y;
 	float v;
 	char ns[30], vs[10], is[20];
@@ -433,33 +444,60 @@ pmcpl_ct_node_printtop(struct pmcpl_ct_s
 	struct pmcstat_symbol *sym;
 	const char *space = " ";
 
+	/*
+	 * Sort by line cost.
+	 */
+	for (y = 0; ; y++) {
+		ct = TS(1, y);
+		if (ct == NULL)
+			break;
+
+		pmcpl_ct_topmax[y].ln_sum = 0;
+		pmcpl_ct_topmax[y].ln_index = y;
+		for (x = 1; TS(x, y) != NULL; x++) {
+			pmcpl_ct_topmax[y].ln_sum +=
+			    PMCPL_CT_SAMPLE(pmcin, &TS(x, y)->pct_samples);
+		}
+	}
+	qsort(pmcpl_ct_topmax, y, sizeof(pmcpl_ct_topmax[0]),
+	    pmcpl_ct_line_compare);
+	pmcpl_ct_topmax[y].ln_index = y;
+
 	for (y = 0; y < maxy; y++) {
-		/* Output image. */
-		ct = pmcpl_ct_topscreen[0][y];
-		snprintf(is, sizeof(is), "%-10.10s",
-		    pmcstat_string_unintern(ct->pct_image->pi_name));
-		PMCSTAT_PRINTW("%s ", is);
-		width = indentwidth = 11;
+		ct = TSI(1, y);
+		if (ct == NULL)
+			break;
 
-		for (x = 0; pmcpl_ct_topscreen[x][y] !=NULL; x++) {
+		if (y > 0)
+			PMCSTAT_PRINTW("\n");
 
-			ct = pmcpl_ct_topscreen[x][y];
+		/* Output sum. */
+		v = pmcpl_ct_topmax[y].ln_sum * 100.0 /
+		    rsamples->sb[pmcin];
+		snprintf(vs, sizeof(vs), "%.1f", v);
+		v_attrs = PMCSTAT_ATTRPERCENT(v);
+		PMCSTAT_ATTRON(v_attrs);
+		PMCSTAT_PRINTW("%5.5s ", vs);
+		PMCSTAT_ATTROFF(v_attrs);
+
+		width = indentwidth = 5 + 1;
+
+		for (x = 1; (ct = TSI(x, y)) != NULL; x++) {
 
-			ns[0] = '\0'; ns_len = 0;
 			vs[0] = '\0'; vs_len = 0;
 			is[0] = '\0'; is_len = 0;
 
 			/* Format value. */
 			v = PMCPL_CT_SAMPLEP(pmcin, &ct->pct_samples);
 			if (v > pmcstat_threshold)
-				vs_len  = snprintf(vs, sizeof(vs), "(%.1f%%)", v);
+				vs_len  = snprintf(vs, sizeof(vs),
+				    "(%.1f%%)", v);
 			v_attrs = PMCSTAT_ATTRPERCENT(v);
 
 			if (pmcstat_skiplink && v <= pmcstat_threshold) {
-				PMCSTAT_PRINTW(". ");
-				width += 2;
-				continue;
-			}
+				strlcpy(ns, ".", sizeof(ns));
+				ns_len = 1;
+			} else {
 			sym = pmcstat_symbol_search(ct->pct_image, ct->pct_func);
 			if (sym != NULL) {
 				ns_len = snprintf(ns, sizeof(ns), "%s",
@@ -469,12 +507,14 @@ pmcpl_ct_node_printtop(struct pmcpl_ct_s
 				    (void *)ct->pct_func);
 
 			/* Format image. */
-			if (x > 0 && pmcpl_ct_topscreen[x-1][y]->pct_image != ct->pct_image)
+			if (x == 1 ||
+			    TSI(x-1, y)->pct_image != ct->pct_image)
 				is_len = snprintf(is, sizeof(is), "@%s",
 				    pmcstat_string_unintern(ct->pct_image->pi_name));
 
 			/* Check for line wrap. */
 			width += ns_len + is_len + vs_len + 1;
+			}
 			if (width >= pmcstat_displaywidth) {
 				maxy--;
 				if (y >= maxy)
@@ -487,7 +527,6 @@ pmcpl_ct_node_printtop(struct pmcpl_ct_s
 			PMCSTAT_PRINTW("%s%s%s ", ns, is, vs);
 			PMCSTAT_ATTROFF(v_attrs);
 		}
-		PMCSTAT_PRINTW("\n");
 	}
 }
 
@@ -498,46 +537,25 @@ pmcpl_ct_node_printtop(struct pmcpl_ct_s
 void
 pmcpl_ct_topdisplay(void)
 {
-	int i, x, y, pmcin;
+	int y;
 	struct pmcpl_ct_sample r, *rsamples;
 
 	rsamples = &r;
 	pmcpl_ct_samples_root(rsamples);
 
-	PMCSTAT_PRINTW("%-10.10s %s\n", "IMAGE", "CALLTREE");
+	pmcpl_ct_node_cleartag();
 
-	for (pmcin = 0; pmcin < pmcstat_npmcs; pmcin++) {
-		/* Filter PMCs. */
-		if (pmcstat_pmcinfilter != pmcin)
-			continue;
+	PMCSTAT_PRINTW("%5.5s %s\n", "%SAMP", "CALLTREE");
 
-		pmcpl_ct_node_cleartag();
+	y = 0;
+	if (pmcpl_ct_node_dumptop(pmcstat_pmcinfilter,
+	    pmcpl_ct_root, rsamples, 0, &y))
+		PMCSTAT_PRINTW("...\n");
+	pmcpl_ct_topscreen[1][y] = NULL;
 
-		/* Quicksort the arcs. */
-		qsort_r(pmcpl_ct_root->pct_arc,
-		    pmcpl_ct_root->pct_narc,
-		    sizeof(struct pmcpl_ct_arc),
-		    &pmcin, pmcpl_ct_arc_compare);
-
-		x = y = 0;
-		for (i = 0; i < pmcpl_ct_root->pct_narc; i++) {
-			/* Skip this arc if there is no sample at all. */
-			if (PMCPL_CT_SAMPLE(pmcin,
-			    &pmcpl_ct_root->pct_arc[i].pcta_samples) == 0)
-				continue;
-			if (PMCPL_CT_SAMPLEP(pmcin,
-			    &pmcpl_ct_root->pct_arc[i].pcta_samples) <=
-			    pmcstat_threshold)
-				continue;
-			if (pmcpl_ct_node_dumptop(pmcin,
-			        pmcpl_ct_root->pct_arc[i].pcta_child,
-			        rsamples, x, &y, pmcstat_displayheight - 2)) {
-				break;
-			}
-		}
+	pmcpl_ct_node_printtop(rsamples,
+	    pmcstat_pmcinfilter, pmcstat_displayheight - 2);
 
-		pmcpl_ct_node_printtop(rsamples, pmcin, y);
-	}
 	pmcpl_ct_samples_free(rsamples);
 }
 

From owner-svn-src-stable-7@FreeBSD.ORG  Fri May 14 19:12:01 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 92BB41065780;
	Fri, 14 May 2010 19:12:01 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8034F8FC13;
	Fri, 14 May 2010 19:12:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4EJC1Yd044619;
	Fri, 14 May 2010 19:12:01 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4EJC1iv044616;
	Fri, 14 May 2010 19:12:01 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201005141912.o4EJC1iv044616@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 14 May 2010 19:12:01 +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: r208087 - stable/7/sys/dev/cas
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 14 May 2010 19:12:01 -0000

Author: marius
Date: Fri May 14 19:12:01 2010
New Revision: 208087
URL: http://svn.freebsd.org/changeset/base/208087

Log:
  MFC: r207585
  
  - Don't set CAS_PCS_DATAPATH to anything except CAS_PCS_DATAPATH_SERDES
    on Cassini using the external PCS SERDES otherwise unaligned access
    traps and other strange effects happen with some machines. Don't touch
    the MIF which is unused in that case either. These changes require the
    PHY type to use to be determined via the OFW device tree or from the
    VPD in machines without the former.
  - Disable the SERDES pins of Saturn when not used in order to save power
    and ensure they are enabled otherwise.
  - In cas_attach() use the correct register offset for CAS_PCS_CONF_EN.
  - Add some bus space barriers missing in the PCS code path.
  
  These changes make the Sun GigaSwift Ethernet 1.0 MMF cards as well as
  the on-board interfaces found in Sun Fire B100s Blade Server work.
  
  PR:	144867

Modified:
  stable/7/sys/dev/cas/if_cas.c
  stable/7/sys/dev/cas/if_casreg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/cas/if_cas.c
==============================================================================
--- stable/7/sys/dev/cas/if_cas.c	Fri May 14 19:11:41 2010	(r208086)
+++ stable/7/sys/dev/cas/if_cas.c	Fri May 14 19:12:01 2010	(r208087)
@@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #if defined(__powerpc__) || defined(__sparc64__)
+#include 
 #include 
 #include 
 #endif
@@ -321,55 +322,82 @@ cas_attach(struct cas_softc *sc)
 		}
 	}
 
-	CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_MII);
-
-	cas_mifinit(sc);
-
-	/*
-	 * Look for an external PHY.
-	 */
-	error = ENXIO;
-	v = CAS_READ_4(sc, CAS_MIF_CONF);
-	if ((v & CAS_MIF_CONF_MDI1) != 0) {
-		v |= CAS_MIF_CONF_PHY_SELECT;
-		CAS_WRITE_4(sc, CAS_MIF_CONF, v);
-		switch (sc->sc_variant) {
-		default:
-			sc->sc_phyad = -1;
-			break;
+	if ((sc->sc_flags & CAS_SERDES) == 0) {
+		CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_MII);
+		CAS_BARRIER(sc, CAS_PCS_DATAPATH, 4,
+		    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+		cas_mifinit(sc);
+		/*
+		 * Look for an external PHY.
+		 */
+		error = ENXIO;
+		v = CAS_READ_4(sc, CAS_MIF_CONF);
+		if ((v & CAS_MIF_CONF_MDI1) != 0) {
+			v |= CAS_MIF_CONF_PHY_SELECT;
+			CAS_WRITE_4(sc, CAS_MIF_CONF, v);
+			CAS_BARRIER(sc, CAS_MIF_CONF, 4,
+			    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+			/* Enable/unfreeze the GMII pins of Saturn. */
+			if (sc->sc_variant == CAS_SATURN) {
+				CAS_WRITE_4(sc, CAS_SATURN_PCFG, 0);
+				CAS_BARRIER(sc, CAS_SATURN_PCFG, 4,
+				    BUS_SPACE_BARRIER_READ |
+				    BUS_SPACE_BARRIER_WRITE);
+			}
+			switch (sc->sc_variant) {
+			default:
+				sc->sc_phyad = -1;
+				break;
+			}
+			error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
+			    cas_mediachange, cas_mediastatus);
 		}
-		error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
-		    cas_mediachange, cas_mediastatus);
-	}
-
-	/*
-	 * Fall back on an internal PHY if no external PHY was found.
-	 */
-	if (error != 0 && (v & CAS_MIF_CONF_MDI0) != 0) {
-		v &= ~CAS_MIF_CONF_PHY_SELECT;
-		CAS_WRITE_4(sc, CAS_MIF_CONF, v);
-		switch (sc->sc_variant) {
-		default:
-			sc->sc_phyad = -1;
-			break;
+		/*
+		 * Fall back on an internal PHY if no external PHY was found.
+		 */
+		if (error != 0 && (v & CAS_MIF_CONF_MDI0) != 0) {
+			v &= ~CAS_MIF_CONF_PHY_SELECT;
+			CAS_WRITE_4(sc, CAS_MIF_CONF, v);
+			CAS_BARRIER(sc, CAS_MIF_CONF, 4,
+			    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+			/* Freeze the GMII pins of Saturn for saving power. */
+			if (sc->sc_variant == CAS_SATURN) {
+				CAS_WRITE_4(sc, CAS_SATURN_PCFG,
+				    CAS_SATURN_PCFG_FSI);
+				CAS_BARRIER(sc, CAS_SATURN_PCFG, 4,
+				    BUS_SPACE_BARRIER_READ |
+				    BUS_SPACE_BARRIER_WRITE);
+			}
+			switch (sc->sc_variant) {
+			default:
+				sc->sc_phyad = -1;
+				break;
+			}
+			error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
+			    cas_mediachange, cas_mediastatus);
 		}
-		error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
-		    cas_mediachange, cas_mediastatus);
-	}
-
-	/*
-	 * Try the external PCS SERDES if we didn't find any PHYs.
-	 */
-	if (error != 0) {
+	} else {
+		/*
+		 * Use the external PCS SERDES.
+		 */
 		CAS_WRITE_4(sc, CAS_PCS_DATAPATH, CAS_PCS_DATAPATH_SERDES);
+		CAS_BARRIER(sc, CAS_PCS_DATAPATH, 4, BUS_SPACE_BARRIER_WRITE);
+		/* Enable/unfreeze the SERDES pins of Saturn. */
+		if (sc->sc_variant == CAS_SATURN) {
+			CAS_WRITE_4(sc, CAS_SATURN_PCFG, 0);
+			CAS_BARRIER(sc, CAS_SATURN_PCFG, 4,
+			    BUS_SPACE_BARRIER_WRITE);
+		}
 		CAS_WRITE_4(sc, CAS_PCS_SERDES_CTRL, CAS_PCS_SERDES_CTRL_ESD);
-		CAS_WRITE_4(sc, CAS_PCS_CONF_EN, CAS_PCS_CONF_EN);
-		sc->sc_flags |= CAS_SERDES;
+		CAS_BARRIER(sc, CAS_PCS_SERDES_CTRL, 4,
+		    BUS_SPACE_BARRIER_WRITE);
+		CAS_WRITE_4(sc, CAS_PCS_CONF, CAS_PCS_CONF_EN);
+		CAS_BARRIER(sc, CAS_PCS_CONF, 4,
+		    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 		sc->sc_phyad = CAS_PHYAD_EXTERNAL;
 		error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
 		    cas_mediachange, cas_mediastatus);
 	}
-
 	if (error != 0) {
 		device_printf(sc->sc_dev, "PHY probe failed: %d\n", error);
 		goto fail_rxmap;
@@ -956,8 +984,9 @@ cas_init_locked(struct cas_softc *sc)
 	    __func__);
 #endif
 
-	/* Re-initialize the MIF. */
-	cas_mifinit(sc);
+	if ((sc->sc_flags & CAS_SERDES) == 0)
+		/* Re-initialize the MIF. */
+		cas_mifinit(sc);
 
 	/* step 3.  Setup data structures in host memory. */
 	cas_meminit(sc);
@@ -2105,6 +2134,8 @@ cas_mifinit(struct cas_softc *sc)
 	/* Configure the MIF in frame mode. */
 	CAS_WRITE_4(sc, CAS_MIF_CONF,
 	    CAS_READ_4(sc, CAS_MIF_CONF) & ~CAS_MIF_CONF_BB_MODE);
+	CAS_BARRIER(sc, CAS_MIF_CONF, 4,
+	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 }
 
 /*
@@ -2219,10 +2250,16 @@ cas_mii_writereg(device_t dev, int phy, 
 			CAS_BARRIER(sc, CAS_PCS_CONF, 4,
 			    BUS_SPACE_BARRIER_WRITE);
 			CAS_WRITE_4(sc, CAS_PCS_ANAR, val);
+			CAS_BARRIER(sc, CAS_PCS_ANAR, 4,
+			    BUS_SPACE_BARRIER_WRITE);
 			CAS_WRITE_4(sc, CAS_PCS_SERDES_CTRL,
 			    CAS_PCS_SERDES_CTRL_ESD);
+			CAS_BARRIER(sc, CAS_PCS_CONF, 4,
+			    BUS_SPACE_BARRIER_WRITE);
 			CAS_WRITE_4(sc, CAS_PCS_CONF,
 			    CAS_PCS_CONF_EN);
+			CAS_BARRIER(sc, CAS_PCS_CONF, 4,
+			    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 			return (0);
 		case MII_ANLPAR:
 			reg = CAS_PCS_ANLPAR;
@@ -2233,6 +2270,8 @@ cas_mii_writereg(device_t dev, int phy, 
 			return (0);
 		}
 		CAS_WRITE_4(sc, reg, val);
+		CAS_BARRIER(sc, reg, 4,
+		    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 		return (0);
 	}
 
@@ -2630,15 +2669,20 @@ static struct resource_spec cas_pci_res_
 	{ -1, 0 }
 };
 
+#define	CAS_LOCAL_MAC_ADDRESS	"local-mac-address"
+#define	CAS_PHY_INTERFACE	"phy-interface"
+#define	CAS_PHY_TYPE		"phy-type"
+#define	CAS_PHY_TYPE_PCS	"pcs"
+
 static int
 cas_pci_attach(device_t dev)
 {
+	char buf[sizeof(CAS_LOCAL_MAC_ADDRESS)];
 	struct cas_softc *sc;
 	int i;
 #if !(defined(__powerpc__) || defined(__sparc64__))
 	u_char enaddr[4][ETHER_ADDR_LEN];
-	char lma[sizeof("local-mac-address")];
-	int found, j;
+	u_int j, k, lma, pcs[4], phy;
 #endif
 
 	sc = device_get_softc(dev);
@@ -2679,13 +2723,20 @@ cas_pci_attach(device_t dev)
 
 #if defined(__powerpc__) || defined(__sparc64__)
 	OF_getetheraddr(dev, sc->sc_enaddr);
+	if (OF_getprop(ofw_bus_get_node(dev), CAS_PHY_INTERFACE, buf,
+	    sizeof(buf)) > 0 || OF_getprop(ofw_bus_get_node(dev),
+	    CAS_PHY_TYPE, buf, sizeof(buf)) > 0) {
+		buf[sizeof(buf) - 1] = '\0';
+		if (strcmp(buf, CAS_PHY_TYPE_PCS) == 0)
+			sc->sc_flags |= CAS_SERDES;
+	}
 #else
 	/*
-	 * Dig out VPD (vital product data) and read the MAX address.
-	 * The VPD resides in the PCI Expansion ROM (PCI FCode) and
-	 * can't be accessed via the PCI capability pointer.
-	 * SUNW,pci-ce and SUNW,pci-qge use the Enhanced VPD format
-	 * described in US Patent 7149820.
+	 * Dig out VPD (vital product data) and read the MAC address as well
+	 * as the PHY type.  The VPD resides in the PCI Expansion ROM (PCI
+	 * FCode) and can't be accessed via the PCI capability pointer.
+	 * SUNW,pci-ce and SUNW,pci-qge use the Enhanced VPD format described
+	 * in the free US Patent 7149820.
 	 */
 
 #define	PCI_ROMHDR_SIZE			0x1c
@@ -2719,7 +2770,10 @@ cas_pci_attach(device_t dev)
 #define	CAS_ROM_READ_4(sc, offs)					\
 	CAS_READ_4((sc), CAS_PCI_ROM_OFFSET + (offs))
 
-	found = 0;
+	lma = phy = 0;
+	memset(enaddr, 0, sizeof(enaddr));
+	memset(pcs, 0, sizeof(pcs));
+
 	/* Enable PCI Expansion ROM access. */
 	CAS_WRITE_4(sc, CAS_BIM_LDEV_OEN,
 	    CAS_BIM_LDEV_OEN_PAD | CAS_BIM_LDEV_OEN_PROM);
@@ -2768,23 +2822,51 @@ cas_pci_attach(device_t dev)
 			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE) != 'I')
 				/* no instance property */
 				continue;
-			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) != 'B')
-				/* no byte array */
-				continue;
-			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 4) !=
-			    ETHER_ADDR_LEN)
-				continue;
-			bus_read_region_1(sc->sc_res[CAS_RES_MEM],
-			    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5,
-			    lma, sizeof(lma));
-			if (strcmp(lma, "local-mac-address") != 0)
-				continue;
-			bus_read_region_1(sc->sc_res[CAS_RES_MEM],
-			    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5 +
-			    sizeof(lma), enaddr[found],
-			    sizeof(enaddr[found]));
-			if (found++ == 4)
-				break;
+			if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) == 'B') {
+				/* byte array */
+				if (CAS_ROM_READ_1(sc,
+				    j + PCI_VPD_SIZE + 4) != ETHER_ADDR_LEN)
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5,
+				    buf, sizeof(buf));
+				buf[sizeof(buf) - 1] = '\0';
+				if (strcmp(buf, CAS_LOCAL_MAC_ADDRESS) != 0)
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE +
+				    5 + sizeof(CAS_LOCAL_MAC_ADDRESS),
+				    enaddr[lma], sizeof(enaddr[lma]));
+				lma++;
+				if (lma == 4 && phy == 4)
+					break;
+			} else if (CAS_ROM_READ_1(sc, j + PCI_VPD_SIZE + 3) ==
+			   'S') {
+				/* string */
+				if (CAS_ROM_READ_1(sc,
+				    j + PCI_VPD_SIZE + 4) !=
+				    sizeof(CAS_PHY_TYPE_PCS))
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE + 5,
+				    buf, sizeof(buf));
+				buf[sizeof(buf) - 1] = '\0';
+				if (strcmp(buf, CAS_PHY_INTERFACE) == 0)
+					k = sizeof(CAS_PHY_INTERFACE);
+				else if (strcmp(buf, CAS_PHY_TYPE) == 0)
+					k = sizeof(CAS_PHY_TYPE);
+				else
+					continue;
+				bus_read_region_1(sc->sc_res[CAS_RES_MEM],
+				    CAS_PCI_ROM_OFFSET + j + PCI_VPD_SIZE +
+				    5 + k, buf, sizeof(buf));
+				buf[sizeof(buf) - 1] = '\0';
+				if (strcmp(buf, CAS_PHY_TYPE_PCS) == 0)
+					pcs[phy] = 1;
+				phy++;
+				if (lma == 4 && phy == 4)
+					break;
+			}
 		}
 		break;
 	default:
@@ -2795,14 +2877,24 @@ cas_pci_attach(device_t dev)
  fail_prom:
 	CAS_WRITE_4(sc, CAS_BIM_LDEV_OEN, 0);
 
-	if (found == 0) {
+	if (lma == 0) {
 		device_printf(dev, "could not determine Ethernet address\n");
 		goto fail;
 	}
 	i = 0;
-	if (found > 1 && pci_get_slot(dev) < sizeof(enaddr) / sizeof(*enaddr))
+	if (lma > 1 && pci_get_slot(dev) < sizeof(enaddr) / sizeof(*enaddr))
 		i = pci_get_slot(dev);
 	memcpy(sc->sc_enaddr, enaddr[i], ETHER_ADDR_LEN);
+
+	if (phy == 0) {
+		device_printf(dev, "could not determine PHY type\n");
+		goto fail;
+	}
+	i = 0;
+	if (phy > 1 && pci_get_slot(dev) < sizeof(pcs) / sizeof(*pcs))
+		i = pci_get_slot(dev);
+	if (pcs[i] != 0)
+		sc->sc_flags |= CAS_SERDES;
 #endif
 
 	if (cas_attach(sc) != 0) {

Modified: stable/7/sys/dev/cas/if_casreg.h
==============================================================================
--- stable/7/sys/dev/cas/if_casreg.h	Fri May 14 19:11:41 2010	(r208086)
+++ stable/7/sys/dev/cas/if_casreg.h	Fri May 14 19:12:01 2010	(r208087)
@@ -68,6 +68,7 @@
 #define	CAS_STATUS4		0x105c	/* interrupt status 4 for INTD */
 #define	CAS_CLEAR_ALIAS4	0x1060	/* clear mask alias 4 for INTD */
 #define	CAS_STATUS_ALIAS4	0x1064	/* interrupt status alias 4 for INTD */
+#define	CAS_SATURN_PCFG		0x106c	/* internal MACPHY pin configuration */
 
 #define	CAS_CAW_RX_WGHT_MASK	0x00000003	/* RX DMA factor for... */
 #define	CAS_CAW_RX_WGHT_SHFT	0		/* ...weighted round robin */
@@ -171,6 +172,17 @@
 /* INTn enable bit for CAS_INTMASK[2-4] */
 #define	CAS_INTMASKN_EN		0x00000080	/* INT[B-D] enable */
 
+#define	CAS_SATURN_PCFG_TLA	0x00000001	/* PHY activity LED */
+#define	CAS_SATURN_PCFG_FLA	0x00000002	/* PHY 10MBit/sec LED */
+#define	CAS_SATURN_PCFG_CLA	0x00000004	/* PHY 100MBit/sec LED */
+#define	CAS_SATURN_PCFG_LLA	0x00000008	/* PHY 1000MBit/sec LED */
+#define	CAS_SATURN_PCFG_RLA	0x00000010	/* PHY full-duplex LED */
+#define	CAS_SATURN_PCFG_PDS	0x00000020	/* PHY debug mode */
+#define	CAS_SATURN_PCFG_MTP	0x00000080	/* test point select */
+#define	CAS_SATURN_PCFG_GMO	0x00000100	/* GMII observe */
+#define	CAS_SATURN_PCFG_FSI	0x00000200	/* freeze GMII/SERDES */
+#define	CAS_SATURN_PCFG_LAD	0x00000800	/* MAC LED control active low */
+
 /* TX DMA registers */
 #define	CAS_TX_CONF		0x2004	/* TX configuration */
 #define	CAS_TX_FIFO_WR		0x2014	/* FIFO write pointer */

From owner-svn-src-stable-7@FreeBSD.ORG  Fri May 14 19:15:55 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 90F4D1065676;
	Fri, 14 May 2010 19:15:55 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 801988FC1E;
	Fri, 14 May 2010 19:15:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4EJFtdh045668;
	Fri, 14 May 2010 19:15:55 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4EJFta8045666;
	Fri, 14 May 2010 19:15:55 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201005141915.o4EJFta8045666@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 14 May 2010 19:15:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r208091 - stable/7/share/man/man4
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 14 May 2010 19:15:55 -0000

Author: marius
Date: Fri May 14 19:15:55 2010
New Revision: 208091
URL: http://svn.freebsd.org/changeset/base/208091

Log:
  MFC: r207586
  
  Sun GigaSwift Ethernet 1.0 MMF work with r207585 (MFC'ed to stable/7 in
  r208087) in place.

Modified:
  stable/7/share/man/man4/cas.4
Directory Properties:
  stable/7/share/man/man4/   (props changed)

Modified: stable/7/share/man/man4/cas.4
==============================================================================
--- stable/7/share/man/man4/cas.4	Fri May 14 19:15:51 2010	(r208090)
+++ stable/7/share/man/man4/cas.4	Fri May 14 19:15:55 2010	(r208091)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 15, 2009
+.Dd May 3, 2010
 .Dt CAS 4
 .Os
 .Sh NAME
@@ -91,6 +91,9 @@ driver at this time:
 .Pp
 .Bl -bullet -compact
 .It
+Sun GigaSwift Ethernet 1.0 MMF (Cassini Kuheen)
+(part no.\& 501-5524)
+.It
 Sun GigaSwift Ethernet 1.0 UTP (Cassini)
 (part no.\& 501-5902)
 .It

From owner-svn-src-stable-7@FreeBSD.ORG  Fri May 14 19:18:06 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DC07C1065670;
	Fri, 14 May 2010 19:18:06 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CB4B88FC16;
	Fri, 14 May 2010 19:18:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4EJI6eg046201;
	Fri, 14 May 2010 19:18:06 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4EJI6YY046199;
	Fri, 14 May 2010 19:18:06 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201005141918.o4EJI6YY046199@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 14 May 2010 19:18:06 +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: r208092 - stable/7/sys/dev/esp
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 14 May 2010 19:18:07 -0000

Author: marius
Date: Fri May 14 19:18:06 2010
New Revision: 208092
URL: http://svn.freebsd.org/changeset/base/208092

Log:
  MFC: r207885
  
  Include  for OF_getscsinitid().

Modified:
  stable/7/sys/dev/esp/esp_sbus.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/esp/esp_sbus.c
==============================================================================
--- stable/7/sys/dev/esp/esp_sbus.c	Fri May 14 19:15:55 2010	(r208091)
+++ stable/7/sys/dev/esp/esp_sbus.c	Fri May 14 19:18:06 2010	(r208092)
@@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 

From owner-svn-src-stable-7@FreeBSD.ORG  Fri May 14 19:36:12 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DF2C8106566B;
	Fri, 14 May 2010 19:36:11 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CC5078FC16;
	Fri, 14 May 2010 19:36:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4EJaBHN050332;
	Fri, 14 May 2010 19:36:11 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4EJaBHd050312;
	Fri, 14 May 2010 19:36:11 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201005141936.o4EJaBHd050312@svn.freebsd.org>
From: Doug Barton 
Date: Fri, 14 May 2010 19:36: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: r208095 - in stable/7/etc: . defaults periodic/daily
	periodic/weekly rc.d
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 14 May 2010 19:36:12 -0000

Author: dougb
Date: Fri May 14 19:36:11 2010
New Revision: 208095
URL: http://svn.freebsd.org/changeset/base/208095

Log:
  MFC 208060:
  
  Remove trailing white space. No functional changes.
  
  Hand-delete trailing ws from rc.firewall while I'm here.

Modified:
  stable/7/etc/defaults/rc.conf
  stable/7/etc/network.subr
  stable/7/etc/periodic/daily/310.accounting
  stable/7/etc/periodic/daily/440.status-mailq
  stable/7/etc/periodic/weekly/330.catman
  stable/7/etc/rc.d/bluetooth
  stable/7/etc/rc.d/bridge
  stable/7/etc/rc.d/cleanvar
  stable/7/etc/rc.d/geli
  stable/7/etc/rc.d/geli2
  stable/7/etc/rc.d/ipfw
  stable/7/etc/rc.d/mdconfig
  stable/7/etc/rc.d/mdconfig2
  stable/7/etc/rc.d/nscd
  stable/7/etc/rc.d/rfcomm_pppd_server
  stable/7/etc/rc.d/syscons
  stable/7/etc/rc.firewall
  stable/7/etc/rc.initdiskless
  stable/7/etc/services
Directory Properties:
  stable/7/etc/   (props changed)

Modified: stable/7/etc/defaults/rc.conf
==============================================================================
--- stable/7/etc/defaults/rc.conf	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/defaults/rc.conf	Fri May 14 19:36:11 2010	(r208095)
@@ -198,7 +198,7 @@ ifconfig_lo0="inet 127.0.0.1"	# default 
 #create_arg_vlan0="vlan 102"	# vlan tag for vlan0 device
 #ipv4_addrs_fxp0="192.168.0.1/24 192.168.1.1-5/28" # example IPv4 address entry.
 #
-#autobridge_interfaces="bridge0"	# List of bridges to check 
+#autobridge_interfaces="bridge0"	# List of bridges to check
 #autobridge_bridge0="tap* vlan0"	# Interface glob to automatically add to the bridge
 #
 # If you have any sppp(4) interfaces above, you might also want to set
@@ -636,11 +636,11 @@ jail_sysvipc_allow="NO"	# Allow SystemV 
 #jail_example_rootdir="/usr/jail/default"	# Jail's root directory
 #jail_example_hostname="default.domain.com"	# Jail's hostname
 #jail_example_interface=""			# Jail's interface variable to create IP aliases on
-#jail_example_fib="0"				# Routing table for setfib(1) 
+#jail_example_fib="0"				# Routing table for setfib(1)
 #jail_example_ip="192.0.2.10,2001:db8::17"	# Jail's primary IPv4 and IPv6 address
 #jail_example_ip_multi0="2001:db8::10"		#  and another IPv6 address
 #jail_example_exec_start="/bin/sh /etc/rc"		# command to execute in jail for starting
-#jail_example_exec_afterstart0="/bin/sh command"	# command to execute after the one for 
+#jail_example_exec_afterstart0="/bin/sh command"	# command to execute after the one for
 							# starting the jail. More than one can be
 							# specified using a trailing number
 #jail_example_exec_stop="/bin/sh /etc/rc.shutdown"	# command to execute in jail for stopping

Modified: stable/7/etc/network.subr
==============================================================================
--- stable/7/etc/network.subr	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/network.subr	Fri May 14 19:36:11 2010	(r208095)
@@ -308,7 +308,7 @@ ifexists()
 }
 
 # ipv4_up if
-#  add IPv4 addresses to the interface $if 
+#  add IPv4 addresses to the interface $if
 ipv4_up()
 {
 	_if=$1
@@ -353,14 +353,14 @@ ipv4_down()
 #   Evaluate the ifconfig_if_ipv4 arguments for interface $if
 #   and use $action to add or remove IPv4 addresses from $if.
 ipv4_addrs_common()
-{  
+{
 	_ret=1
 	_if=$1
 	_action=$2
-    
+
 	# get ipv4-addresses
 	cidr_addr=`get_if_var $_if ipv4_addrs_IF`
-    
+
 	for _cidr in ${cidr_addr}; do
 		_ipaddr=${_cidr%%/*}
 		_netmask="/"${_cidr##*/}
@@ -373,7 +373,7 @@ ipv4_addrs_common()
 		if [ "${_action}" = "-alias" ]; then
 			_netmask=""
 		fi
-        
+
 		_ipcount=${_iplow}
 		while [ "${_ipcount}" -le "${_iphigh}" ]; do
 			eval "ifconfig ${_if} ${_action} ${_ipnet}.${_ipcount}${_netmask}"

Modified: stable/7/etc/periodic/daily/310.accounting
==============================================================================
--- stable/7/etc/periodic/daily/310.accounting	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/periodic/daily/310.accounting	Fri May 14 19:36:11 2010	(r208095)
@@ -29,7 +29,7 @@ case "$daily_accounting_enable" in
 
 	    cd /var/account
 	    rc=0
-	
+
 	    n=$daily_accounting_save
 	    rm -f acct.$n.gz acct.$n || rc=3
 	    m=$n

Modified: stable/7/etc/periodic/daily/440.status-mailq
==============================================================================
--- stable/7/etc/periodic/daily/440.status-mailq	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/periodic/daily/440.status-mailq	Fri May 14 19:36:11 2010	(r208095)
@@ -59,7 +59,7 @@ case "$daily_status_mailq_enable" in
 		fi;;
 	    esac
 	fi;;
-		
+
     *)  rc=0;;
 esac
 

Modified: stable/7/etc/periodic/weekly/330.catman
==============================================================================
--- stable/7/etc/periodic/weekly/330.catman	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/periodic/weekly/330.catman	Fri May 14 19:36:11 2010	(r208095)
@@ -27,13 +27,13 @@ case "$weekly_catman_enable" in
 	    then
 		if [ -z "${MANPATH}" ]
 		then
-		    echo "manpath failed to find any manpath directories" 
+		    echo "manpath failed to find any manpath directories"
 		    rc=3
 		else
 		    man_locales=`/usr/bin/manpath -qL`
 		    rc=0
-         
-		    # Preformat original, non-localized manpages  
+
+		    # Preformat original, non-localized manpages
 		    echo /usr/libexec/catman.local -r "$MANPATH" |
 			su -fm man || rc=3
 

Modified: stable/7/etc/rc.d/bluetooth
==============================================================================
--- stable/7/etc/rc.d/bluetooth	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/rc.d/bluetooth	Fri May 14 19:36:11 2010	(r208095)
@@ -95,7 +95,7 @@ bluetooth_setup_stack()
 	hook=$1
 	shift
 
-	# Setup HCI 
+	# Setup HCI
 	ngctl mkpeer ${dev}: hci ${hook} drv \
 		> /dev/null 2>&1 || return 1
 
@@ -282,7 +282,7 @@ bluetooth_start()
 		;;
 	esac
 
-	# Be backward compatible and setup reasonable defaults 
+	# Be backward compatible and setup reasonable defaults
 	bluetooth_device_authentication_enable="0"
 	bluetooth_device_class="ff:01:0c"
 	bluetooth_device_connectable="1"
@@ -312,7 +312,7 @@ bluetooth_start()
 		bluetooth_shutdown_stack $dev
 		err 1 "Unable to setup Bluetooth stack for device ${dev}"
 	fi
-		
+
 	return 0
 }
 

Modified: stable/7/etc/rc.d/bridge
==============================================================================
--- stable/7/etc/rc.d/bridge	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/rc.d/bridge	Fri May 14 19:36:11 2010	(r208095)
@@ -42,7 +42,7 @@ glob_int () {
 		$2 ) true ;;
 		* ) false ;;
 	esac
-} 
+}
 
 bridge_test () {
 	bridge=$1

Modified: stable/7/etc/rc.d/cleanvar
==============================================================================
--- stable/7/etc/rc.d/cleanvar	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/rc.d/cleanvar	Fri May 14 19:36:11 2010	(r208095)
@@ -54,7 +54,7 @@ cleanvar_prestart()
 	rm -f /var/run/clean_var /var/spool/lock/clean_var
 }
 
-cleanvar_start () 
+cleanvar_start ()
 {
 	if [ -d /var/run -a ! -f /var/run/clean_var ]; then
 		purgedir /var/run

Modified: stable/7/etc/rc.d/geli
==============================================================================
--- stable/7/etc/rc.d/geli	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/rc.d/geli	Fri May 14 19:36:11 2010	(r208095)
@@ -11,7 +11,7 @@
 # 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 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

Modified: stable/7/etc/rc.d/geli2
==============================================================================
--- stable/7/etc/rc.d/geli2	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/rc.d/geli2	Fri May 14 19:36:11 2010	(r208095)
@@ -11,7 +11,7 @@
 # 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 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

Modified: stable/7/etc/rc.d/ipfw
==============================================================================
--- stable/7/etc/rc.d/ipfw	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/rc.d/ipfw	Fri May 14 19:36:11 2010	(r208095)
@@ -29,14 +29,14 @@ ipfw_prestart()
 		if ! checkyesno natd_enable; then
 			required_modules="$required_modules ipfw_nat"
 		fi
-	fi 
+	fi
 }
 
 ipfw_start()
 {
 	local   _firewall_type
 
-	_firewall_type=$1 
+	_firewall_type=$1
 
 	# set the firewall rules script if none was specified
 	[ -z "${firewall_script}" ] && firewall_script=/etc/rc.firewall

Modified: stable/7/etc/rc.d/mdconfig
==============================================================================
--- stable/7/etc/rc.d/mdconfig	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/rc.d/mdconfig	Fri May 14 19:36:11 2010	(r208095)
@@ -49,7 +49,7 @@ is_readonly()
 		*" ${_mp} "*read-only*)
 			echo "yes"
 			;;
-		
+
 		*)
 			;;
 		esac;
@@ -139,7 +139,7 @@ mdconfig_start()
 				if ! eval ${_fsck_cmd} -p ${_dev} >/dev/null; then
 					echo "Fsck failed on ${_dev}, not mounting the filesystem."
 					continue
-					
+
 				fi
 			else
 				newfs ${_newfs} ${_dev} >/dev/null
@@ -194,5 +194,5 @@ if [ -z "${_mdconfig_list}" ]; then
 		fi
 	done
 fi
-	
+
 run_rc_command "${_mdconfig_cmd}"

Modified: stable/7/etc/rc.d/mdconfig2
==============================================================================
--- stable/7/etc/rc.d/mdconfig2	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/rc.d/mdconfig2	Fri May 14 19:36:11 2010	(r208095)
@@ -49,7 +49,7 @@ is_readonly()
 		*" ${_mp} "*read-only*)
 			echo "yes"
 			;;
-		
+
 		*)
 			;;
 		esac;
@@ -223,5 +223,5 @@ if [ -z "${_mdconfig2_list}" ]; then
 		fi
 	done
 fi
-	
+
 run_rc_command "${_mdconfig2_cmd}"

Modified: stable/7/etc/rc.d/nscd
==============================================================================
--- stable/7/etc/rc.d/nscd	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/rc.d/nscd	Fri May 14 19:36:11 2010	(r208095)
@@ -34,7 +34,7 @@ _nscd_set_option() {
 
 	_nscd_opt_val=$(eval "echo \$nscd_${_optname}")
 	_cached_opt_val=$(eval "echo \$cached_${_optname}")
-	
+
 	if [ -n "$_cached_opt_val" -a "$_nscd_opt_val" != "$_defoptval" ]; then
 		warn "You should use nscd_${_optname} instead of" \
 		    "cached_${_optname}"

Modified: stable/7/etc/rc.d/rfcomm_pppd_server
==============================================================================
--- stable/7/etc/rc.d/rfcomm_pppd_server	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/rc.d/rfcomm_pppd_server	Fri May 14 19:36:11 2010	(r208095)
@@ -46,7 +46,7 @@ rfcomm_pppd_server_start_profile()
 		_channel=1
 	fi
 	rc_flags="${rc_flags} -C ${_channel}"
-	
+
 	# Check for RFCOMM PPP profile register SP override
 	#
 	eval _x=\$rfcomm_pppd_server_${_profile_cleaned}_register_sp
@@ -55,7 +55,7 @@ rfcomm_pppd_server_start_profile()
 			rc_flags="${rc_flags} -S"
 		fi
 	fi
-	
+
 	# Check for RFCOMM PPP profile register DUN override
 	#
 	eval _x=\$rfcomm_pppd_server_${_profile_cleaned}_register_dun

Modified: stable/7/etc/rc.d/syscons
==============================================================================
--- stable/7/etc/rc.d/syscons	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/rc.d/syscons	Fri May 14 19:36:11 2010	(r208095)
@@ -106,7 +106,7 @@ syscons_configure_keyboard()
 syscons_setkeyboard()
 {
 	kbd=$1
-                
+
 	if [ -z "${kbd}" ]; then
 		return 1
 	fi

Modified: stable/7/etc/rc.firewall
==============================================================================
--- stable/7/etc/rc.firewall	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/rc.firewall	Fri May 14 19:36:11 2010	(r208095)
@@ -310,10 +310,10 @@ case ${firewall_type} in
 	#			 	 offers services.
 	#  firewall_allowservices:	List of IPs which has access to
 	#				 $firewall_myservices.
-	#  firewall_trusted:		List of IPs which has full access 
-	#				 to this host. Be very carefull 
+	#  firewall_trusted:		List of IPs which has full access
+	#				 to this host. Be very carefull
 	#				 when setting this. This option can
-	#				 seriously degrade the level of 
+	#				 seriously degrade the level of
 	#				 protection provided by the firewall.
 	#  firewall_logdeny:		Boolean (YES/NO) specifying if the
 	#				 default denied packets should be
@@ -321,7 +321,7 @@ case ${firewall_type} in
 	#  firewall_nologports:		List of TCP/UDP ports for which
 	#				 denied incomming packets are not
 	#				 logged.
-	
+
 	# Allow packets for which a state has been built.
 	${fwcmd} add check-state
 
@@ -337,20 +337,20 @@ case ${firewall_type} in
 	${fwcmd} add pass udp  from 0.0.0.0 68 to 255.255.255.255 67 out
 	${fwcmd} add pass udp  from any 67     to me 68 in
 	${fwcmd} add pass udp  from any 67     to 255.255.255.255 68 in
-	# Some servers will ping the IP while trying to decide if it's 
+	# Some servers will ping the IP while trying to decide if it's
 	# still in use.
 	${fwcmd} add pass icmp from any to any icmptype 8
 
 	# Allow "mandatory" ICMP in.
 	${fwcmd} add pass icmp from any to any icmptype 3,4,11
-	
+
 	# Add permits for this workstations published services below
 	# Only IPs and nets in firewall_allowservices is allowed in.
-	# If you really wish to let anyone use services on your 
+	# If you really wish to let anyone use services on your
 	# workstation, then set "firewall_allowservices='any'" in /etc/rc.conf
 	#
 	# Note: We don't use keep-state as that would allow DoS of
-	#       our statetable. 
+	#       our statetable.
 	#       You can add 'keep-state' to the lines for slightly
 	#       better performance if you fell that DoS of your
 	#       workstation won't be a problem.
@@ -367,7 +367,7 @@ case ${firewall_type} in
 	for i in ${firewall_trusted} ; do
 	  ${fwcmd} add pass ip from $i to me
 	done
-	
+
 	${fwcmd} add 65000 count ip from any to any
 
 	# Drop packets to ports where we don't want logging

Modified: stable/7/etc/rc.initdiskless
==============================================================================
--- stable/7/etc/rc.initdiskless	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/rc.initdiskless	Fri May 14 19:36:11 2010	(r208095)
@@ -119,7 +119,7 @@
 #		Similar to /conf/T/M/diskless_remount above, but allows
 #		all of /conf to be remounted.  This can be used to allow
 #		multiple roots to share the same /conf.
-#		
+#
 #
 # You will almost universally want to create the following files under /conf
 #

Modified: stable/7/etc/services
==============================================================================
--- stable/7/etc/services	Fri May 14 19:28:16 2010	(r208094)
+++ stable/7/etc/services	Fri May 14 19:36:11 2010	(r208095)
@@ -1243,8 +1243,8 @@ dctp		675/tcp
 dctp		675/udp
 vpps-via	676/tcp    #VPPS Via
 vpps-via	676/udp    #VPPS Via
-vpp		677/tcp    #Virtual Presence Protocol 
-vpp		677/udp    #Virtual Presence Protocol 
+vpp		677/tcp    #Virtual Presence Protocol
+vpp		677/udp    #Virtual Presence Protocol
 ggf-ncp		678/tcp    #GNU Generation Foundation NCP
 ggf-ncp		678/udp    #GNU Generation Foundation NCP
 mrm             679/tcp
@@ -1255,8 +1255,8 @@ entrust-aams	681/tcp
 entrust-aams	681/udp
 xfr             682/tcp
 xfr             682/udp
-corba-iiop      683/tcp    #CORBA IIOP 
-corba-iiop      683/udp    #CORBA IIOP 
+corba-iiop      683/tcp    #CORBA IIOP
+corba-iiop      683/udp    #CORBA IIOP
 corba-iiop-ssl	684/tcp    #CORBA IIOP SSL
 corba-iiop-ssl	684/udp    #CORBA IIOP SSL
 mdc-portmapper	685/tcp    #MDC Port Mapper
@@ -1311,8 +1311,8 @@ cisco-tdp       711/tcp    #Cisco TDP
 cisco-tdp       711/udp    #Cisco TDP
 tbrpf           712/tcp
 tbrpf           712/udp
-iris-xpc	713/tcp    #IRIS over XPC 
-iris-xpc	713/udp    #IRIS over XPC 
+iris-xpc	713/tcp    #IRIS over XPC
+iris-xpc	713/udp    #IRIS over XPC
 iris-xpcs	714/tcp    #IRIS over XPCS
 iris-xpcs	714/udp    #IRIS over XPCS
 iris-lwz	715/tcp
@@ -1412,7 +1412,7 @@ pkix-3-ca-ra	829/tcp    #PKIX-3 CA/RA
 pkix-3-ca-ra    829/udp    #PKIX-3 CA/RA
 netconf-ssh     830/tcp    #NETCONF over SSH
 netconf-ssh     830/udp    #NETCONF over SSH
-netconf-beep    831/tcp    #NETCONF over BEEP 
+netconf-beep    831/tcp    #NETCONF over BEEP
 netconf-beep    831/udp    #NETCONF over BEEP
 netconfsoaphttp 832/tcp    #NETCONF for SOAP over HTTPS
 netconfsoaphttp 832/udp    #NETCONF for SOAP over HTTPS
@@ -1444,14 +1444,14 @@ ideafarm-chat   902/tcp
 ideafarm-chat   902/udp
 ideafarm-catch  903/tcp
 ideafarm-catch  903/udp
-kink            910/tcp    #Kerberized Internet Negotiation of Keys (KINK) 
+kink            910/tcp    #Kerberized Internet Negotiation of Keys (KINK)
 kink            910/udp    #Kerberized Internet Negotiation of Keys (KINK)
 xact-backup     911/tcp
 xact-backup     911/udp
 apex-mesh       912/tcp    #APEX relay-relay service
 apex-mesh       912/udp    #APEX relay-relay service
 apex-edge       913/tcp    #APEX endpoint-relay service
-apex-edge       913/udp    #APEX endpoint-relay service    
+apex-edge       913/udp    #APEX endpoint-relay service
 rndc		953/tcp	   # named's rndc control socket
 ftps-data	989/tcp	   # ftp protocol, data, over TLS/SSL
 ftps-data	989/udp

From owner-svn-src-stable-7@FreeBSD.ORG  Fri May 14 22:39:52 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 01DA1106566B;
	Fri, 14 May 2010 22:39:52 +0000 (UTC) (envelope-from jfv@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AD8348FC13;
	Fri, 14 May 2010 22:39:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4EMdp84092046;
	Fri, 14 May 2010 22:39:51 GMT (envelope-from jfv@svn.freebsd.org)
Received: (from jfv@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4EMdpEs092036;
	Fri, 14 May 2010 22:39:51 GMT (envelope-from jfv@svn.freebsd.org)
Message-Id: <201005142239.o4EMdpEs092036@svn.freebsd.org>
From: Jack F Vogel 
Date: Fri, 14 May 2010 22:39:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r208105 - in stable/7/sys: conf dev/e1000 modules/em
	modules/igb
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 14 May 2010 22:39:52 -0000

Author: jfv
Date: Fri May 14 22:39:51 2010
New Revision: 208105
URL: http://svn.freebsd.org/changeset/base/208105

Log:
  MFC the new em/lem/igb drivers for stable/7

Modified:
  stable/7/sys/conf/files
  stable/7/sys/dev/e1000/e1000_80003es2lan.c
  stable/7/sys/dev/e1000/e1000_80003es2lan.h
  stable/7/sys/dev/e1000/e1000_82540.c
  stable/7/sys/dev/e1000/e1000_82541.c
  stable/7/sys/dev/e1000/e1000_82542.c
  stable/7/sys/dev/e1000/e1000_82543.c
  stable/7/sys/dev/e1000/e1000_82571.c
  stable/7/sys/dev/e1000/e1000_82575.c
  stable/7/sys/dev/e1000/e1000_82575.h
  stable/7/sys/dev/e1000/e1000_api.c
  stable/7/sys/dev/e1000/e1000_api.h
  stable/7/sys/dev/e1000/e1000_defines.h
  stable/7/sys/dev/e1000/e1000_hw.h
  stable/7/sys/dev/e1000/e1000_ich8lan.c
  stable/7/sys/dev/e1000/e1000_ich8lan.h
  stable/7/sys/dev/e1000/e1000_mac.c
  stable/7/sys/dev/e1000/e1000_mac.h
  stable/7/sys/dev/e1000/e1000_manage.c
  stable/7/sys/dev/e1000/e1000_nvm.c
  stable/7/sys/dev/e1000/e1000_nvm.h
  stable/7/sys/dev/e1000/e1000_osdep.c
  stable/7/sys/dev/e1000/e1000_osdep.h
  stable/7/sys/dev/e1000/e1000_phy.c
  stable/7/sys/dev/e1000/e1000_phy.h
  stable/7/sys/dev/e1000/e1000_regs.h
  stable/7/sys/dev/e1000/if_em.c
  stable/7/sys/dev/e1000/if_em.h
  stable/7/sys/dev/e1000/if_igb.c
  stable/7/sys/dev/e1000/if_igb.h
  stable/7/sys/modules/em/Makefile
  stable/7/sys/modules/igb/Makefile

Modified: stable/7/sys/conf/files
==============================================================================
--- stable/7/sys/conf/files	Fri May 14 22:20:58 2010	(r208104)
+++ stable/7/sys/conf/files	Fri May 14 22:39:51 2010	(r208105)
@@ -782,6 +782,8 @@ dev/eisa/eisa_if.m		standard
 dev/eisa/eisaconf.c		optional eisa
 dev/e1000/if_em.c		optional em \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
+dev/e1000/if_lem.c		optional em \
+	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/if_igb.c		optional igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_80003es2lan.c	optional em | igb \

Modified: stable/7/sys/dev/e1000/e1000_80003es2lan.c
==============================================================================
--- stable/7/sys/dev/e1000/e1000_80003es2lan.c	Fri May 14 22:20:58 2010	(r208104)
+++ stable/7/sys/dev/e1000/e1000_80003es2lan.c	Fri May 14 22:39:51 2010	(r208105)
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2008, Intel Corporation 
+  Copyright (c) 2001-2010, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -43,9 +43,7 @@ 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,
@@ -173,7 +171,7 @@ static s32 e1000_init_nvm_params_80003es
 		break;
 	}
 
-	nvm->type               = e1000_nvm_eeprom_spi;
+	nvm->type = e1000_nvm_eeprom_spi;
 
 	size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >>
 	                  E1000_EECD_SIZE_EX_SHIFT);
@@ -208,17 +206,22 @@ static s32 e1000_init_nvm_params_80003es
 static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw)
 {
 	struct e1000_mac_info *mac = &hw->mac;
-	s32 ret_val = E1000_SUCCESS;
 
 	DEBUGFUNC("e1000_init_mac_params_80003es2lan");
 
-	/* Set media type */
+	/* Set media type and media-dependent function pointers */
 	switch (hw->device_id) {
 	case E1000_DEV_ID_80003ES2LAN_SERDES_DPT:
 		hw->phy.media_type = e1000_media_type_internal_serdes;
+		mac->ops.check_for_link = e1000_check_for_serdes_link_generic;
+		mac->ops.setup_physical_interface =
+			e1000_setup_fiber_serdes_link_generic;
 		break;
 	default:
 		hw->phy.media_type = e1000_media_type_copper;
+		mac->ops.check_for_link = e1000_check_for_copper_link_generic;
+		mac->ops.setup_physical_interface =
+			e1000_setup_copper_link_80003es2lan;
 		break;
 	}
 
@@ -228,10 +231,14 @@ static s32 e1000_init_mac_params_80003es
 	mac->rar_entry_count = E1000_RAR_ENTRIES;
 	/* Set if part includes ASF firmware */
 	mac->asf_firmware_present = TRUE;
-	/* Set if manageability features are enabled. */
+	/* FWSM register */
+	mac->has_fwsm = TRUE;
+	/* ARC supported; valid only if manageability features are enabled. */
 	mac->arc_subsystem_valid =
 	        (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK)
 	                ? TRUE : FALSE;
+	/* Adaptive IFS not supported */
+	mac->adaptive_ifs = FALSE;
 
 	/* Function pointers */
 
@@ -243,27 +250,6 @@ static s32 e1000_init_mac_params_80003es
 	mac->ops.init_hw = e1000_init_hw_80003es2lan;
 	/* link setup */
 	mac->ops.setup_link = e1000_setup_link_generic;
-	/* physical interface link setup */
-	mac->ops.setup_physical_interface =
-	        (hw->phy.media_type == e1000_media_type_copper)
-	                ? e1000_setup_copper_link_80003es2lan
-	                : e1000_setup_fiber_serdes_link_generic;
-	/* check for link */
-	switch (hw->phy.media_type) {
-	case e1000_media_type_copper:
-		mac->ops.check_for_link = e1000_check_for_copper_link_generic;
-		break;
-	case e1000_media_type_fiber:
-		mac->ops.check_for_link = e1000_check_for_fiber_link_generic;
-		break;
-	case e1000_media_type_internal_serdes:
-		mac->ops.check_for_link = e1000_check_for_serdes_link_generic;
-		break;
-	default:
-		ret_val = -E1000_ERR_CONFIG;
-		goto out;
-		break;
-	}
 	/* check management mode */
 	mac->ops.check_mng_mode = e1000_check_mng_mode_generic;
 	/* multicast address update */
@@ -272,10 +258,10 @@ static s32 e1000_init_mac_params_80003es
 	mac->ops.write_vfta = e1000_write_vfta_generic;
 	/* clearing VFTA */
 	mac->ops.clear_vfta = e1000_clear_vfta_generic;
-	/* setting MTA */
-	mac->ops.mta_set = e1000_mta_set_generic;
 	/* read mac address */
 	mac->ops.read_mac_addr = e1000_read_mac_addr_80003es2lan;
+	/* ID LED init */
+	mac->ops.id_led_init = e1000_id_led_init_generic;
 	/* blink LED */
 	mac->ops.blink_led = e1000_blink_led_generic;
 	/* setup LED */
@@ -290,8 +276,10 @@ static s32 e1000_init_mac_params_80003es
 	/* link info */
 	mac->ops.get_link_up_info = e1000_get_link_up_info_80003es2lan;
 
-out:
-	return ret_val;
+	/* set lan id for port to determine which phy lock to use */
+	hw->mac.ops.set_lan_id(hw);
+
+	return E1000_SUCCESS;
 }
 
 /**
@@ -307,7 +295,6 @@ 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);
 }
 
 /**
@@ -342,7 +329,6 @@ static void e1000_release_phy_80003es2la
 	e1000_release_swfw_sync_80003es2lan(hw, mask);
 }
 
-
 /**
  *  e1000_acquire_mac_csr_80003es2lan - Acquire rights to access Kumeran register
  *  @hw: pointer to the HW structure
@@ -532,28 +518,36 @@ static s32 e1000_read_phy_reg_gg82563_80
 		goto out;
 	}
 
-	/*
-	 * The "ready" bit in the MDIC register may be incorrectly set
-	 * before the device has completed the "Page Select" MDI
-	 * transaction.  So we wait 200us after each MDI command...
-	 */
-	usec_delay(200);
+	if (hw->dev_spec._80003es2lan.mdic_wa_enable == TRUE) {
+		/*
+		 * The "ready" bit in the MDIC register may be incorrectly set
+		 * before the device has completed the "Page Select" MDI
+		 * transaction.  So we wait 200us after each MDI command...
+		 */
+		usec_delay(200);
 
-	/* ...and verify the command was successful. */
-	ret_val = e1000_read_phy_reg_mdic(hw, page_select, &temp);
+		/* ...and verify the command was successful. */
+		ret_val = e1000_read_phy_reg_mdic(hw, page_select, &temp);
 
-	if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) {
-		ret_val = -E1000_ERR_PHY;
-		e1000_release_phy_80003es2lan(hw);
-		goto out;
-	}
+		if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) {
+			ret_val = -E1000_ERR_PHY;
+			e1000_release_phy_80003es2lan(hw);
+			goto out;
+		}
 
-	usec_delay(200);
+		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);
+	} else {
+		ret_val = e1000_read_phy_reg_mdic(hw,
+		                                  MAX_PHY_REG_ADDRESS & offset,
+		                                  data);
+	}
 
-	usec_delay(200);
 	e1000_release_phy_80003es2lan(hw);
 
 out:
@@ -599,29 +593,36 @@ static s32 e1000_write_phy_reg_gg82563_8
 		goto out;
 	}
 
+	if (hw->dev_spec._80003es2lan.mdic_wa_enable == TRUE) {
+		/*
+		 * The "ready" bit in the MDIC register may be incorrectly set
+		 * before the device has completed the "Page Select" MDI
+		 * transaction.  So we wait 200us after each MDI command...
+		 */
+		usec_delay(200);
 
-	/*
-	 * The "ready" bit in the MDIC register may be incorrectly set
-	 * before the device has completed the "Page Select" MDI
-	 * transaction.  So we wait 200us after each MDI command...
-	 */
-	usec_delay(200);
+		/* ...and verify the command was successful. */
+		ret_val = e1000_read_phy_reg_mdic(hw, page_select, &temp);
 
-	/* ...and verify the command was successful. */
-	ret_val = e1000_read_phy_reg_mdic(hw, page_select, &temp);
+		if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) {
+			ret_val = -E1000_ERR_PHY;
+			e1000_release_phy_80003es2lan(hw);
+			goto out;
+		}
 
-	if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) {
-		ret_val = -E1000_ERR_PHY;
-		e1000_release_phy_80003es2lan(hw);
-		goto out;
-	}
+		usec_delay(200);
 
-	usec_delay(200);
+		ret_val = e1000_write_phy_reg_mdic(hw,
+		                                  MAX_PHY_REG_ADDRESS & offset,
+		                                  data);
 
-	ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
-	                                  data);
+		usec_delay(200);
+	} else {
+		ret_val = e1000_write_phy_reg_mdic(hw,
+		                                  MAX_PHY_REG_ADDRESS & offset,
+		                                  data);
+	}
 
-	usec_delay(200);
 	e1000_release_phy_80003es2lan(hw);
 
 out:
@@ -802,17 +803,16 @@ static s32 e1000_get_cable_length_80003e
 
 	index = phy_data & GG82563_DSPD_CABLE_LENGTH;
 
-	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;
+	if (index >= GG82563_CABLE_LENGTH_TABLE_SIZE - 5) {
+		ret_val = -E1000_ERR_PHY;
+		goto out;
 	}
 
+	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;
+
 out:
 	return ret_val;
 }
@@ -892,7 +892,7 @@ static s32 e1000_reset_hw_80003es2lan(st
 	E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
 	icr = E1000_READ_REG(hw, E1000_ICR);
 
-	e1000_check_alt_mac_addr_generic(hw);
+	ret_val = e1000_check_alt_mac_addr_generic(hw);
 
 out:
 	return ret_val;
@@ -916,11 +916,10 @@ static s32 e1000_init_hw_80003es2lan(str
 	e1000_initialize_hw_bits_80003es2lan(hw);
 
 	/* Initialize identification LED */
-	ret_val = e1000_id_led_init_generic(hw);
-	if (ret_val) {
+	ret_val = mac->ops.id_led_init(hw);
+	if (ret_val)
 		DEBUGOUT("Error initializing identification LED\n");
 		/* This is not fatal and we should not stop init due to this */
-	}
 
 	/* Disabling VLAN filtering */
 	DEBUGOUT("Initializing the IEEE VLAN\n");
@@ -970,6 +969,19 @@ static s32 e1000_init_hw_80003es2lan(str
 	reg_data &= ~0x00100000;
 	E1000_WRITE_REG_ARRAY(hw, E1000_FFLT, 0x0001, reg_data);
 
+	/* default to TRUE to enable the MDIC W/A */
+	hw->dev_spec._80003es2lan.mdic_wa_enable = TRUE;
+
+	ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
+	                              E1000_KMRNCTRLSTA_OFFSET >>
+	                              E1000_KMRNCTRLSTA_OFFSET_SHIFT,
+	                              &i);
+	if (!ret_val) {
+		if ((i & E1000_KMRNCTRLSTA_OPMODE_MASK) ==
+		     E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO)
+			hw->dev_spec._80003es2lan.mdic_wa_enable = FALSE;
+	}
+
 	/*
 	 * Clear all of the statistics registers (clear on read).  It is
 	 * important that we do this after we have tried to establish link
@@ -1036,77 +1048,78 @@ static s32 e1000_copper_link_setup_gg825
 
 	DEBUGFUNC("e1000_copper_link_setup_gg82563_80003es2lan");
 
-	if (!phy->reset_disable) {
-		ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL,
-		                             &data);
-		if (ret_val)
-			goto out;
+	if (phy->reset_disable)
+		goto skip_reset;
 
-		data |= GG82563_MSCR_ASSERT_CRS_ON_TX;
-		/* Use 25MHz for both link down and 1000Base-T for Tx clock. */
-		data |= GG82563_MSCR_TX_CLK_1000MBPS_25;
+	ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL,
+				     &data);
+	if (ret_val)
+		goto out;
 
-		ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL,
-		                              data);
-		if (ret_val)
-			goto out;
+	data |= GG82563_MSCR_ASSERT_CRS_ON_TX;
+	/* Use 25MHz for both link down and 1000Base-T for Tx clock. */
+	data |= GG82563_MSCR_TX_CLK_1000MBPS_25;
 
-		/*
-		 * Options:
-		 *   MDI/MDI-X = 0 (default)
-		 *   0 - Auto for all speeds
-		 *   1 - MDI mode
-		 *   2 - MDI-X mode
-		 *   3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes)
-		 */
-		ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_SPEC_CTRL, &data);
-		if (ret_val)
-			goto out;
+	ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL,
+				      data);
+	if (ret_val)
+		goto out;
 
-		data &= ~GG82563_PSCR_CROSSOVER_MODE_MASK;
+	/*
+	 * Options:
+	 *   MDI/MDI-X = 0 (default)
+	 *   0 - Auto for all speeds
+	 *   1 - MDI mode
+	 *   2 - MDI-X mode
+	 *   3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes)
+	 */
+	ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_SPEC_CTRL, &data);
+	if (ret_val)
+		goto out;
 
-		switch (phy->mdix) {
-		case 1:
-			data |= GG82563_PSCR_CROSSOVER_MODE_MDI;
-			break;
-		case 2:
-			data |= GG82563_PSCR_CROSSOVER_MODE_MDIX;
-			break;
-		case 0:
-		default:
-			data |= GG82563_PSCR_CROSSOVER_MODE_AUTO;
-			break;
-		}
+	data &= ~GG82563_PSCR_CROSSOVER_MODE_MASK;
 
-		/*
-		 * Options:
-		 *   disable_polarity_correction = 0 (default)
-		 *       Automatic Correction for Reversed Cable Polarity
-		 *   0 - Disabled
-		 *   1 - Enabled
-		 */
-		data &= ~GG82563_PSCR_POLARITY_REVERSAL_DISABLE;
-		if (phy->disable_polarity_correction)
-			data |= GG82563_PSCR_POLARITY_REVERSAL_DISABLE;
+	switch (phy->mdix) {
+	case 1:
+		data |= GG82563_PSCR_CROSSOVER_MODE_MDI;
+		break;
+	case 2:
+		data |= GG82563_PSCR_CROSSOVER_MODE_MDIX;
+		break;
+	case 0:
+	default:
+		data |= GG82563_PSCR_CROSSOVER_MODE_AUTO;
+		break;
+	}
 
-		ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_SPEC_CTRL, data);
-		if (ret_val)
-			goto out;
+	/*
+	 * Options:
+	 *   disable_polarity_correction = 0 (default)
+	 *       Automatic Correction for Reversed Cable Polarity
+	 *   0 - Disabled
+	 *   1 - Enabled
+	 */
+	data &= ~GG82563_PSCR_POLARITY_REVERSAL_DISABLE;
+	if (phy->disable_polarity_correction)
+		data |= GG82563_PSCR_POLARITY_REVERSAL_DISABLE;
 
-		/* SW Reset the PHY so all changes take effect */
-		ret_val = hw->phy.ops.commit(hw);
-		if (ret_val) {
-			DEBUGOUT("Error Resetting the PHY\n");
-			goto out;
-		}
+	ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_SPEC_CTRL, data);
+	if (ret_val)
+		goto out;
 
+	/* SW Reset the PHY so all changes take effect */
+	ret_val = hw->phy.ops.commit(hw);
+	if (ret_val) {
+		DEBUGOUT("Error Resetting the PHY\n");
+		goto out;
 	}
 
+skip_reset:
 	/* Bypass Rx and Tx FIFO's */
 	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);
+					E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL,
+					E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS |
+					E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS);
 	if (ret_val)
 		goto out;
 
@@ -1147,22 +1160,19 @@ static s32 e1000_copper_link_setup_gg825
 	if (!(hw->mac.ops.check_mng_mode(hw))) {
 		/* 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,
+		ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_PWR_MGMT_CTRL,
 		                                data);
 		if (ret_val)
 			goto out;
-		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,
+		                               &data);
+		if (ret_val)
+			goto out;
 
 		data &= ~GG82563_KMCR_PASS_FALSE_CARRIER;
-		ret_val = hw->phy.ops.write_reg(hw,
-		                                GG82563_PHY_KMRN_MODE_CTRL,
+		ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
 		                                data);
-
 		if (ret_val)
 			goto out;
 	}
@@ -1261,7 +1271,6 @@ static s32 e1000_cfg_on_link_up_80003es2
 	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);
@@ -1308,7 +1317,6 @@ static s32 e1000_cfg_kmrn_10_100_80003es
 	tipg |= DEFAULT_TIPG_IPGT_10_100_80003ES2LAN;
 	E1000_WRITE_REG(hw, E1000_TIPG, tipg);
 
-
 	do {
 		ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
 		                               ®_data);
@@ -1362,7 +1370,6 @@ static s32 e1000_cfg_kmrn_1000_80003es2l
 	tipg |= DEFAULT_TIPG_IPGT_1000_80003ES2LAN;
 	E1000_WRITE_REG(hw, E1000_TIPG, tipg);
 
-
 	do {
 		ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
 		                               ®_data);
@@ -1393,7 +1400,8 @@ out:
  *  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)
+static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
+                                           u16 *data)
 {
 	u32 kmrnctrlsta;
 	s32 ret_val = E1000_SUCCESS;
@@ -1429,7 +1437,8 @@ out:
  *  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)
+static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
+                                            u16 data)
 {
 	u32 kmrnctrlsta;
 	s32 ret_val = E1000_SUCCESS;
@@ -1461,9 +1470,19 @@ static s32 e1000_read_mac_addr_80003es2l
 	s32 ret_val = E1000_SUCCESS;
 
 	DEBUGFUNC("e1000_read_mac_addr_80003es2lan");
-	if (e1000_check_alt_mac_addr_generic(hw))
-		ret_val = e1000_read_mac_addr_generic(hw);
 
+	/*
+	 * If there's an alternate MAC address place it in RAR0
+	 * so that it will override the Si installed default perm
+	 * address.
+	 */
+	ret_val = e1000_check_alt_mac_addr_generic(hw);
+	if (ret_val)
+		goto out;
+
+	ret_val = e1000_read_mac_addr_generic(hw);
+
+out:
 	return ret_val;
 }
 

Modified: stable/7/sys/dev/e1000/e1000_80003es2lan.h
==============================================================================
--- stable/7/sys/dev/e1000/e1000_80003es2lan.h	Fri May 14 22:20:58 2010	(r208104)
+++ stable/7/sys/dev/e1000/e1000_80003es2lan.h	Fri May 14 22:39:51 2010	(r208105)
@@ -1,6 +1,6 @@
-/*******************************************************************************
+/******************************************************************************
 
-  Copyright (c) 2001-2008, Intel Corporation 
+  Copyright (c) 2001-2009, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -29,10 +29,9 @@
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   POSSIBILITY OF SUCH DAMAGE.
 
-*******************************************************************************/
+******************************************************************************/
 /*$FreeBSD$*/
 
-
 #ifndef _E1000_80003ES2LAN_H_
 #define _E1000_80003ES2LAN_H_
 
@@ -49,6 +48,9 @@
 #define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT   0x0000
 #define E1000_KMRNCTRLSTA_OPMODE_E_IDLE          0x2000
 
+#define E1000_KMRNCTRLSTA_OPMODE_MASK            0x000C
+#define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO     0x0004
+
 #define E1000_TCTL_EXT_GCEX_MASK 0x000FFC00 /* Gigabit Carry Extend Padding */
 #define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN        0x00010000
 

Modified: stable/7/sys/dev/e1000/e1000_82540.c
==============================================================================
--- stable/7/sys/dev/e1000/e1000_82540.c	Fri May 14 22:20:58 2010	(r208104)
+++ stable/7/sys/dev/e1000/e1000_82540.c	Fri May 14 22:39:51 2010	(r208105)
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2008, Intel Corporation 
+  Copyright (c) 2001-2010, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -57,6 +57,7 @@ static s32  e1000_set_vco_speed_82540(st
 static s32  e1000_setup_copper_link_82540(struct e1000_hw *hw);
 static s32  e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw);
 static void e1000_power_down_phy_copper_82540(struct e1000_hw *hw);
+static s32  e1000_read_mac_addr_82540(struct e1000_hw *hw);
 
 /**
  * e1000_init_phy_params_82540 - Init PHY func ptrs.
@@ -227,8 +228,10 @@ static s32 e1000_init_mac_params_82540(s
 	mac->ops.write_vfta = e1000_write_vfta_generic;
 	/* clearing VFTA */
 	mac->ops.clear_vfta = e1000_clear_vfta_generic;
-	/* setting MTA */
-	mac->ops.mta_set = e1000_mta_set_generic;
+	/* read mac address */
+	mac->ops.read_mac_addr = e1000_read_mac_addr_82540;
+	/* ID LED init */
+	mac->ops.id_led_init = e1000_id_led_init_generic;
 	/* setup LED */
 	mac->ops.setup_led = e1000_setup_led_generic;
 	/* cleanup LED */
@@ -332,7 +335,7 @@ static s32 e1000_init_hw_82540(struct e1
 	DEBUGFUNC("e1000_init_hw_82540");
 
 	/* Initialize identification LED */
-	ret_val = e1000_id_led_init_generic(hw);
+	ret_val = mac->ops.id_led_init(hw);
 	if (ret_val) {
 		DEBUGOUT("Error initializing identification LED\n");
 		/* This is not fatal and we should not stop init due to this */
@@ -674,3 +677,45 @@ static void e1000_clear_hw_cntrs_82540(s
 	E1000_READ_REG(hw, E1000_MGTPTC);
 }
 
+/**
+ *  e1000_read_mac_addr_82540 - Read device MAC address
+ *  @hw: pointer to the HW structure
+ *
+ *  Reads the device MAC address from the EEPROM and stores the value.
+ *  Since devices with two ports use the same EEPROM, we increment the
+ *  last bit in the MAC address for the second port.
+ *
+ *  This version is being used over generic because of customer issues
+ *  with VmWare and Virtual Box when using generic. It seems in
+ *  the emulated 82545, RAR[0] does NOT have a valid address after a
+ *  reset, this older method works and using this breaks nothing for
+ *  these legacy adapters.
+ **/
+s32 e1000_read_mac_addr_82540(struct e1000_hw *hw)
+{
+	s32  ret_val = E1000_SUCCESS;
+	u16 offset, nvm_data, i;
+
+	DEBUGFUNC("e1000_read_mac_addr");
+
+	for (i = 0; i < ETH_ADDR_LEN; i += 2) {
+		offset = i >> 1;
+		ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
+		if (ret_val) {
+			DEBUGOUT("NVM Read Error\n");
+			goto out;
+		}
+		hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF);
+		hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8);
+	}
+
+	/* Flip last bit of mac address if we're on second port */
+	if (hw->bus.func == E1000_FUNC_1)
+		hw->mac.perm_addr[5] ^= 1;
+
+	for (i = 0; i < ETH_ADDR_LEN; i++)
+		hw->mac.addr[i] = hw->mac.perm_addr[i];
+
+out:
+	return ret_val;
+}

Modified: stable/7/sys/dev/e1000/e1000_82541.c
==============================================================================
--- stable/7/sys/dev/e1000/e1000_82541.c	Fri May 14 22:20:58 2010	(r208104)
+++ stable/7/sys/dev/e1000/e1000_82541.c	Fri May 14 22:39:51 2010	(r208105)
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2008, Intel Corporation 
+  Copyright (c) 2001-2010, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -59,6 +59,7 @@ static s32  e1000_set_d3_lplu_state_8254
 static s32  e1000_setup_led_82541(struct e1000_hw *hw);
 static s32  e1000_cleanup_led_82541(struct e1000_hw *hw);
 static void e1000_clear_hw_cntrs_82541(struct e1000_hw *hw);
+static s32  e1000_read_mac_addr_82541(struct e1000_hw *hw);
 static s32  e1000_config_dsp_after_link_change_82541(struct e1000_hw *hw,
                                                      bool link_up);
 static s32  e1000_phy_init_script_82541(struct e1000_hw *hw);
@@ -259,8 +260,10 @@ static s32 e1000_init_mac_params_82541(s
 	mac->ops.write_vfta = e1000_write_vfta_generic;
 	/* clearing VFTA */
 	mac->ops.clear_vfta = e1000_clear_vfta_generic;
-	/* setting MTA */
-	mac->ops.mta_set = e1000_mta_set_generic;
+	/* read mac address */
+	mac->ops.read_mac_addr = e1000_read_mac_addr_82541;
+	/* ID LED init */
+	mac->ops.id_led_init = e1000_id_led_init_generic;
 	/* setup LED */
 	mac->ops.setup_led = e1000_setup_led_82541;
 	/* cleanup LED */
@@ -375,17 +378,25 @@ static s32 e1000_reset_hw_82541(struct e
 static s32 e1000_init_hw_82541(struct e1000_hw *hw)
 {
 	struct e1000_mac_info *mac = &hw->mac;
+	struct e1000_dev_spec_82541 *dev_spec = &hw->dev_spec._82541;
 	u32 i, txdctl;
 	s32 ret_val;
 
 	DEBUGFUNC("e1000_init_hw_82541");
 
 	/* Initialize identification LED */
-	ret_val = e1000_id_led_init_generic(hw);
+	ret_val = mac->ops.id_led_init(hw);
 	if (ret_val) {
 		DEBUGOUT("Error initializing identification LED\n");
 		/* This is not fatal and we should not stop init due to this */
 	}
+        
+	/* Storing the Speed Power Down  value for later use */
+	ret_val = hw->phy.ops.read_reg(hw,
+	                               IGP01E1000_GMII_FIFO,
+	                               &dev_spec->spd_default);
+	if (ret_val)
+		goto out;
 
 	/* Disabling VLAN filtering */
 	DEBUGOUT("Initializing the IEEE VLAN\n");
@@ -423,6 +434,7 @@ static s32 e1000_init_hw_82541(struct e1
 	 */
 	e1000_clear_hw_cntrs_82541(hw);
 
+out:
 	return ret_val;
 }
 
@@ -1281,3 +1293,35 @@ static void e1000_clear_hw_cntrs_82541(s
 	E1000_READ_REG(hw, E1000_MGTPDC);
 	E1000_READ_REG(hw, E1000_MGTPTC);
 }
+
+/**
+ *  e1000_read_mac_addr_82541 - Read device MAC address
+ *  @hw: pointer to the HW structure
+ *
+ *  Reads the device MAC address from the EEPROM and stores the value.
+ **/
+static s32 e1000_read_mac_addr_82541(struct e1000_hw *hw)
+{
+	s32  ret_val = E1000_SUCCESS;
+	u16 offset, nvm_data, i;
+
+	DEBUGFUNC("e1000_read_mac_addr");
+
+	for (i = 0; i < ETH_ADDR_LEN; i += 2) {
+		offset = i >> 1;
+		ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
+		if (ret_val) {
+			DEBUGOUT("NVM Read Error\n");
+			goto out;
+		}
+		hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF);
+		hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8);
+	}
+
+	for (i = 0; i < ETH_ADDR_LEN; i++)
+		hw->mac.addr[i] = hw->mac.perm_addr[i];
+
+out:
+	return ret_val;
+}
+

Modified: stable/7/sys/dev/e1000/e1000_82542.c
==============================================================================
--- stable/7/sys/dev/e1000/e1000_82542.c	Fri May 14 22:20:58 2010	(r208104)
+++ stable/7/sys/dev/e1000/e1000_82542.c	Fri May 14 22:39:51 2010	(r208105)
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2008, Intel Corporation 
+  Copyright (c) 2001-2010, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -49,6 +49,8 @@ static s32  e1000_led_on_82542(struct e1
 static s32  e1000_led_off_82542(struct e1000_hw *hw);
 static void e1000_rar_set_82542(struct e1000_hw *hw, u8 *addr, u32 index);
 static void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw);
+static s32  e1000_read_mac_addr_82542(struct e1000_hw *hw);
+
 
 /**
  *  e1000_init_phy_params_82542 - Init PHY func ptrs.
@@ -132,8 +134,8 @@ static s32 e1000_init_mac_params_82542(s
 	mac->ops.write_vfta = e1000_write_vfta_generic;
 	/* clearing VFTA */
 	mac->ops.clear_vfta = e1000_clear_vfta_generic;
-	/* setting MTA */
-	mac->ops.mta_set = e1000_mta_set_generic;
+	/* read mac address */
+	mac->ops.read_mac_addr = e1000_read_mac_addr_82542;
 	/* set RAR */
 	mac->ops.rar_set = e1000_rar_set_82542;
 	/* turn on/off LED */
@@ -554,3 +556,34 @@ static void e1000_clear_hw_cntrs_82542(s
 	E1000_READ_REG(hw, E1000_PTC1023);
 	E1000_READ_REG(hw, E1000_PTC1522);
 }
+
+/**
+ *  e1000_read_mac_addr_82542 - Read device MAC address
+ *  @hw: pointer to the HW structure
+ *
+ *  Reads the device MAC address from the EEPROM and stores the value.
+ **/
+static s32 e1000_read_mac_addr_82542(struct e1000_hw *hw)
+{
+	s32  ret_val = E1000_SUCCESS;
+	u16 offset, nvm_data, i;
+
+	DEBUGFUNC("e1000_read_mac_addr");
+
+	for (i = 0; i < ETH_ADDR_LEN; i += 2) {
+		offset = i >> 1;
+		ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
+		if (ret_val) {
+			DEBUGOUT("NVM Read Error\n");
+			goto out;
+		}
+		hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF);
+		hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8);
+	}
+
+	for (i = 0; i < ETH_ADDR_LEN; i++)
+		hw->mac.addr[i] = hw->mac.perm_addr[i];
+
+out:
+	return ret_val;
+}

Modified: stable/7/sys/dev/e1000/e1000_82543.c
==============================================================================
--- stable/7/sys/dev/e1000/e1000_82543.c	Fri May 14 22:20:58 2010	(r208104)
+++ stable/7/sys/dev/e1000/e1000_82543.c	Fri May 14 22:39:51 2010	(r208105)
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2008, Intel Corporation 
+  Copyright (c) 2001-2010, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -63,7 +63,6 @@ static s32  e1000_led_on_82543(struct e1
 static s32  e1000_led_off_82543(struct e1000_hw *hw);
 static void e1000_write_vfta_82543(struct e1000_hw *hw, u32 offset,
                                    u32 value);
-static void e1000_mta_set_82543(struct e1000_hw *hw, u32 hash_value);
 static void e1000_clear_hw_cntrs_82543(struct e1000_hw *hw);
 static s32  e1000_config_mac_to_phy_82543(struct e1000_hw *hw);
 static bool e1000_init_phy_disabled_82543(struct e1000_hw *hw);
@@ -75,6 +74,8 @@ static void e1000_shift_out_mdi_bits_825
                                            u16 count);
 static bool e1000_tbi_compatibility_enabled_82543(struct e1000_hw *hw);
 static void e1000_set_tbi_sbp_82543(struct e1000_hw *hw, bool state);
+static s32  e1000_read_mac_addr_82543(struct e1000_hw *hw);
+
 
 /**
  *  e1000_init_phy_params_82543 - Init PHY func ptrs.
@@ -244,8 +245,8 @@ static s32 e1000_init_mac_params_82543(s
 	mac->ops.write_vfta = e1000_write_vfta_82543;
 	/* clearing VFTA */
 	mac->ops.clear_vfta = e1000_clear_vfta_generic;
-	/* setting MTA */
-	mac->ops.mta_set = e1000_mta_set_82543;
+	/* read mac address */
+	mac->ops.read_mac_addr = e1000_read_mac_addr_82543;
 	/* turn on/off LED */
 	mac->ops.led_on = e1000_led_on_82543;
 	mac->ops.led_off = e1000_led_off_82543;
@@ -1477,45 +1478,6 @@ static void e1000_write_vfta_82543(struc
 }
 
 /**
- *  e1000_mta_set_82543 - Set multicast filter table address
- *  @hw: pointer to the HW structure
- *  @hash_value: determines the MTA register and bit to set
- *
- *  The multicast table address is a register array of 32-bit registers.
- *  The hash_value is used to determine what register the bit is in, the
- *  current value is read, the new bit is OR'd in and the new value is
- *  written back into the register.
- **/
-static void e1000_mta_set_82543(struct e1000_hw *hw, u32 hash_value)
-{
-	u32 hash_bit, hash_reg, mta, temp;
-
-	DEBUGFUNC("e1000_mta_set_82543");
-
-	hash_reg = (hash_value >> 5);
-
-	/*
-	 * If we are on an 82544 and we are trying to write an odd offset
-	 * in the MTA, save off the previous entry before writing and
-	 * restore the old value after writing.
-	 */
-	if ((hw->mac.type == e1000_82544) && (hash_reg & 1)) {
-		hash_reg &= (hw->mac.mta_reg_count - 1);
-		hash_bit = hash_value & 0x1F;
-		mta = E1000_READ_REG_ARRAY(hw, E1000_MTA, hash_reg);
-		mta |= (1 << hash_bit);
-		temp = E1000_READ_REG_ARRAY(hw, E1000_MTA, hash_reg - 1);
-
-		E1000_WRITE_REG_ARRAY(hw, E1000_MTA, hash_reg, mta);
-		E1000_WRITE_FLUSH(hw);
-		E1000_WRITE_REG_ARRAY(hw, E1000_MTA, hash_reg - 1, temp);
-		E1000_WRITE_FLUSH(hw);
-	} else {
-		e1000_mta_set_generic(hw, hash_value);
-	}
-}
-
-/**
  *  e1000_led_on_82543 - Turn on SW controllable LED
  *  @hw: pointer to the HW structure
  *
@@ -1600,3 +1562,41 @@ static void e1000_clear_hw_cntrs_82543(s
 	E1000_READ_REG(hw, E1000_TSCTC);
 	E1000_READ_REG(hw, E1000_TSCTFC);
 }
+
+/**
+ *  e1000_read_mac_addr_82543 - Read device MAC address
+ *  @hw: pointer to the HW structure
+ *
+ *  Reads the device MAC address from the EEPROM and stores the value.
+ *  Since devices with two ports use the same EEPROM, we increment the
+ *  last bit in the MAC address for the second port.
+ *
+ **/
+s32 e1000_read_mac_addr_82543(struct e1000_hw *hw)
+{
+	s32  ret_val = E1000_SUCCESS;
+	u16 offset, nvm_data, i;
+
+	DEBUGFUNC("e1000_read_mac_addr");
+
+	for (i = 0; i < ETH_ADDR_LEN; i += 2) {
+		offset = i >> 1;
+		ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
+		if (ret_val) {
+			DEBUGOUT("NVM Read Error\n");
+			goto out;
+		}
+		hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF);
+		hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8);
+	}
+
+	/* Flip last bit of mac address if we're on second port */
+	if (hw->bus.func == E1000_FUNC_1)
+		hw->mac.perm_addr[5] ^= 1;
+
+	for (i = 0; i < ETH_ADDR_LEN; i++)
+		hw->mac.addr[i] = hw->mac.perm_addr[i];
+
+out:
+	return ret_val;
+}

Modified: stable/7/sys/dev/e1000/e1000_82571.c
==============================================================================
--- stable/7/sys/dev/e1000/e1000_82571.c	Fri May 14 22:20:58 2010	(r208104)
+++ stable/7/sys/dev/e1000/e1000_82571.c	Fri May 14 22:39:51 2010	(r208105)
@@ -1,6 +1,6 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2008, Intel Corporation 
+  Copyright (c) 2001-2010, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -46,6 +46,7 @@
  * 82573E Gigabit Ethernet Controller (Copper)
  * 82573L Gigabit Ethernet Controller
  * 82574L Gigabit Network Connection
+ * 82583V Gigabit Network Connection
  */
 
 #include "e1000_api.h"
@@ -67,11 +68,9 @@ static s32  e1000_init_hw_82571(struct e
 static void e1000_clear_vfta_82571(struct e1000_hw *hw);
 static bool e1000_check_mng_mode_82574(struct e1000_hw *hw);
 static s32 e1000_led_on_82574(struct e1000_hw *hw);
-static void e1000_update_mc_addr_list_82571(struct e1000_hw *hw,
-                                           u8 *mc_addr_list, u32 mc_addr_count,
-                                           u32 rar_used_count, u32 rar_count);
 static s32  e1000_setup_link_82571(struct e1000_hw *hw);
 static s32  e1000_setup_copper_link_82571(struct e1000_hw *hw);

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

From owner-svn-src-stable-7@FreeBSD.ORG  Sat May 15 07:01:42 2010
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0FFA81065679;
	Sat, 15 May 2010 07:01:42 +0000 (UTC) (envelope-from jfv@FreeBSD.org)
Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F0FAA8FC21;
	Sat, 15 May 2010 07:01:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4F71fu6002351;
	Sat, 15 May 2010 07:01:41 GMT (envelope-from jfv@svn.freebsd.org)
Received: (from jfv@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4F71fBS002349;
	Sat, 15 May 2010 07:01:41 GMT (envelope-from jfv@svn.freebsd.org)
Message-Id: <201005150701.o4F71fBS002349@svn.freebsd.org>
From: Jack F Vogel 
Date: Sat, 15 May 2010 07:01:41 +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: r208108 - stable/7/sys/dev/e1000
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Sat, 15 May 2010 07:01:42 -0000

Author: jfv
Date: Sat May 15 07:01:41 2010
New Revision: 208108
URL: http://svn.freebsd.org/changeset/base/208108

Log:
  Add missing lem files to the MFC

Added:
  stable/7/sys/dev/e1000/if_lem.c   (contents, props changed)
  stable/7/sys/dev/e1000/if_lem.h   (contents, props changed)

Added: stable/7/sys/dev/e1000/if_lem.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/7/sys/dev/e1000/if_lem.c	Sat May 15 07:01:41 2010	(r208108)
@@ -0,0 +1,4552 @@
+/******************************************************************************
+
+  Copyright (c) 2001-2010, Intel Corporation 
+  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. Neither the name of the Intel Corporation nor the names of its 
+      contributors may be used to endorse or promote products derived from 
+      this software without specific prior written permission.
+  
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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$*/
+
+#ifdef HAVE_KERNEL_OPTION_HEADERS
+#include "opt_device_polling.h"
+#include "opt_inet.h"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#if __FreeBSD_version >= 700029
+#include 
+#endif
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "e1000_api.h"
+#include "if_lem.h"
+
+/*********************************************************************
+ *  Set this to one to display debug statistics
+ *********************************************************************/
+int	lem_display_debug_stats = 0;
+
+/*********************************************************************
+ *  Legacy Em Driver version:
+ *********************************************************************/
+char lem_driver_version[] = "1.0.1";
+
+
+/*********************************************************************
+ *  PCI Device ID Table
+ *
+ *  Used by probe to select devices to load on
+ *  Last field stores an index into e1000_strings
+ *  Last entry must be all 0s
+ *
+ *  { Vendor ID, Device ID, SubVendor ID, SubDevice ID, String Index }
+ *********************************************************************/
+
+static em_vendor_info_t lem_vendor_info_array[] =
+{
+	/* Intel(R) PRO/1000 Network Connection */
+	{ 0x8086, E1000_DEV_ID_82540EM,		PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82540EM_LOM,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82540EP,		PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82540EP_LOM,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82540EP_LP,	PCI_ANY_ID, PCI_ANY_ID, 0},
+
+	{ 0x8086, E1000_DEV_ID_82541EI,		PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82541ER,		PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82541ER_LOM,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82541EI_MOBILE,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82541GI,		PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82541GI_LF,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82541GI_MOBILE,	PCI_ANY_ID, PCI_ANY_ID, 0},
+
+	{ 0x8086, E1000_DEV_ID_82542,		PCI_ANY_ID, PCI_ANY_ID, 0},
+
+	{ 0x8086, E1000_DEV_ID_82543GC_FIBER,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82543GC_COPPER,	PCI_ANY_ID, PCI_ANY_ID, 0},
+
+	{ 0x8086, E1000_DEV_ID_82544EI_COPPER,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82544EI_FIBER,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82544GC_COPPER,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82544GC_LOM,	PCI_ANY_ID, PCI_ANY_ID, 0},
+
+	{ 0x8086, E1000_DEV_ID_82545EM_COPPER,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82545EM_FIBER,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82545GM_COPPER,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82545GM_FIBER,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82545GM_SERDES,	PCI_ANY_ID, PCI_ANY_ID, 0},
+
+	{ 0x8086, E1000_DEV_ID_82546EB_COPPER,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82546EB_FIBER,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82546EB_QUAD_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82546GB_COPPER,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82546GB_FIBER,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82546GB_SERDES,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82546GB_PCIE,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82546GB_QUAD_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3,
+						PCI_ANY_ID, PCI_ANY_ID, 0},
+
+	{ 0x8086, E1000_DEV_ID_82547EI,		PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82547EI_MOBILE,	PCI_ANY_ID, PCI_ANY_ID, 0},
+	{ 0x8086, E1000_DEV_ID_82547GI,		PCI_ANY_ID, PCI_ANY_ID, 0},
+	/* required last entry */
+	{ 0, 0, 0, 0, 0}
+};
+
+/*********************************************************************
+ *  Table of branding strings for all supported NICs.
+ *********************************************************************/
+
+static char *lem_strings[] = {
+	"Intel(R) PRO/1000 Legacy Network Connection"
+};
+
+/*********************************************************************
+ *  Function prototypes
+ *********************************************************************/
+static int	lem_probe(device_t);
+static int	lem_attach(device_t);
+static int	lem_detach(device_t);
+static int	lem_shutdown(device_t);
+static int	lem_suspend(device_t);
+static int	lem_resume(device_t);
+static void	lem_start(struct ifnet *);
+static void	lem_start_locked(struct ifnet *ifp);
+static int	lem_ioctl(struct ifnet *, u_long, caddr_t);
+static void	lem_init(void *);
+static void	lem_init_locked(struct adapter *);
+static void	lem_stop(void *);
+static void	lem_media_status(struct ifnet *, struct ifmediareq *);
+static int	lem_media_change(struct ifnet *);
+static void	lem_identify_hardware(struct adapter *);
+static int	lem_allocate_pci_resources(struct adapter *);
+static int	lem_allocate_irq(struct adapter *adapter);
+static void	lem_free_pci_resources(struct adapter *);
+static void	lem_local_timer(void *);
+static int	lem_hardware_init(struct adapter *);
+static void	lem_setup_interface(device_t, struct adapter *);
+static void	lem_setup_transmit_structures(struct adapter *);
+static void	lem_initialize_transmit_unit(struct adapter *);
+static int	lem_setup_receive_structures(struct adapter *);
+static void	lem_initialize_receive_unit(struct adapter *);
+static void	lem_enable_intr(struct adapter *);
+static void	lem_disable_intr(struct adapter *);
+static void	lem_free_transmit_structures(struct adapter *);
+static void	lem_free_receive_structures(struct adapter *);
+static void	lem_update_stats_counters(struct adapter *);
+static void	lem_txeof(struct adapter *);
+static void	lem_tx_purge(struct adapter *);
+static int	lem_allocate_receive_structures(struct adapter *);
+static int	lem_allocate_transmit_structures(struct adapter *);
+static int	lem_rxeof(struct adapter *, int);
+#ifndef __NO_STRICT_ALIGNMENT
+static int	lem_fixup_rx(struct adapter *);
+#endif
+static void	lem_receive_checksum(struct adapter *, struct e1000_rx_desc *,
+		    struct mbuf *);
+static void	lem_transmit_checksum_setup(struct adapter *, struct mbuf *,
+		    u32 *, u32 *);
+static void	lem_set_promisc(struct adapter *);
+static void	lem_disable_promisc(struct adapter *);
+static void	lem_set_multi(struct adapter *);
+static void	lem_print_hw_stats(struct adapter *);
+static void	lem_update_link_status(struct adapter *);
+static int	lem_get_buf(struct adapter *, int);
+#if __FreeBSD_version >= 700029
+static void	lem_register_vlan(void *, struct ifnet *, u16);
+static void	lem_unregister_vlan(void *, struct ifnet *, u16);
+static void	lem_setup_vlan_hw_support(struct adapter *);
+#endif
+static int	lem_xmit(struct adapter *, struct mbuf **);
+static void	lem_smartspeed(struct adapter *);
+static int	lem_82547_fifo_workaround(struct adapter *, int);
+static void	lem_82547_update_fifo_head(struct adapter *, int);
+static int	lem_82547_tx_fifo_reset(struct adapter *);
+static void	lem_82547_move_tail(void *);
+static int	lem_dma_malloc(struct adapter *, bus_size_t,
+		    struct em_dma_alloc *, int);
+static void	lem_dma_free(struct adapter *, struct em_dma_alloc *);
+static void	lem_print_debug_info(struct adapter *);
+static void	lem_print_nvm_info(struct adapter *);
+static int 	lem_is_valid_ether_addr(u8 *);
+static int	lem_sysctl_stats(SYSCTL_HANDLER_ARGS);
+static int	lem_sysctl_debug_info(SYSCTL_HANDLER_ARGS);
+static u32	lem_fill_descriptors (bus_addr_t address, u32 length,
+		    PDESC_ARRAY desc_array);
+static int	lem_sysctl_int_delay(SYSCTL_HANDLER_ARGS);
+static void	lem_add_int_delay_sysctl(struct adapter *, const char *,
+		    const char *, struct em_int_delay_info *, int, int);
+/* Management and WOL Support */
+static void	lem_init_manageability(struct adapter *);
+static void	lem_release_manageability(struct adapter *);
+static void     lem_get_hw_control(struct adapter *);
+static void     lem_release_hw_control(struct adapter *);
+static void	lem_get_wakeup(device_t);
+static void     lem_enable_wakeup(device_t);
+static int	lem_enable_phy_wakeup(struct adapter *);
+static void	lem_led_func(void *, int);
+
+#ifdef EM_LEGACY_IRQ
+static void	lem_intr(void *);
+#else /* FAST IRQ */
+#if __FreeBSD_version < 700000
+static void	lem_irq_fast(void *);
+#else
+static int	lem_irq_fast(void *);
+#endif
+static void	lem_handle_rxtx(void *context, int pending);
+static void	lem_handle_link(void *context, int pending);
+static void	lem_add_rx_process_limit(struct adapter *, const char *,
+		    const char *, int *, int);
+#endif /* ~EM_LEGACY_IRQ */
+
+#ifdef DEVICE_POLLING
+static poll_handler_t lem_poll;
+#endif /* POLLING */
+
+/*********************************************************************
+ *  FreeBSD Device Interface Entry Points
+ *********************************************************************/
+
+static device_method_t lem_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe, lem_probe),
+	DEVMETHOD(device_attach, lem_attach),
+	DEVMETHOD(device_detach, lem_detach),
+	DEVMETHOD(device_shutdown, lem_shutdown),
+	DEVMETHOD(device_suspend, lem_suspend),
+	DEVMETHOD(device_resume, lem_resume),
+	{0, 0}
+};
+
+static driver_t lem_driver = {
+	"em", lem_methods, sizeof(struct adapter),
+};
+
+extern devclass_t em_devclass;
+DRIVER_MODULE(lem, pci, lem_driver, em_devclass, 0, 0);
+MODULE_DEPEND(lem, pci, 1, 1, 1);
+MODULE_DEPEND(lem, ether, 1, 1, 1);
+
+/*********************************************************************
+ *  Tunable default values.
+ *********************************************************************/
+
+#define EM_TICKS_TO_USECS(ticks)	((1024 * (ticks) + 500) / 1000)
+#define EM_USECS_TO_TICKS(usecs)	((1000 * (usecs) + 512) / 1024)
+
+static int lem_tx_int_delay_dflt = EM_TICKS_TO_USECS(EM_TIDV);
+static int lem_rx_int_delay_dflt = EM_TICKS_TO_USECS(EM_RDTR);
+static int lem_tx_abs_int_delay_dflt = EM_TICKS_TO_USECS(EM_TADV);
+static int lem_rx_abs_int_delay_dflt = EM_TICKS_TO_USECS(EM_RADV);
+static int lem_rxd = EM_DEFAULT_RXD;
+static int lem_txd = EM_DEFAULT_TXD;
+static int lem_smart_pwr_down = FALSE;
+
+/* Controls whether promiscuous also shows bad packets */
+static int lem_debug_sbp = FALSE;
+
+TUNABLE_INT("hw.em.tx_int_delay", &lem_tx_int_delay_dflt);
+TUNABLE_INT("hw.em.rx_int_delay", &lem_rx_int_delay_dflt);
+TUNABLE_INT("hw.em.tx_abs_int_delay", &lem_tx_abs_int_delay_dflt);
+TUNABLE_INT("hw.em.rx_abs_int_delay", &lem_rx_abs_int_delay_dflt);
+TUNABLE_INT("hw.em.rxd", &lem_rxd);
+TUNABLE_INT("hw.em.txd", &lem_txd);
+TUNABLE_INT("hw.em.smart_pwr_down", &lem_smart_pwr_down);
+TUNABLE_INT("hw.em.sbp", &lem_debug_sbp);
+
+#ifndef EM_LEGACY_IRQ
+/* How many packets rxeof tries to clean at a time */
+static int lem_rx_process_limit = 100;
+TUNABLE_INT("hw.em.rx_process_limit", &lem_rx_process_limit);
+#endif
+
+/* Flow control setting - default to FULL */
+static int lem_fc_setting = e1000_fc_full;
+TUNABLE_INT("hw.em.fc_setting", &lem_fc_setting);
+
+/*
+** Shadow VFTA table, this is needed because
+** the real vlan filter table gets cleared during
+** a soft reset and the driver needs to be able
+** to repopulate it.
+*/
+static u32 lem_shadow_vfta[EM_VFTA_SIZE];
+
+/* Global used in WOL setup with multiport cards */
+static int global_quad_port_a = 0;
+
+/*********************************************************************
+ *  Device identification routine
+ *
+ *  em_probe determines if the driver should be loaded on
+ *  adapter based on PCI vendor/device id of the adapter.
+ *
+ *  return BUS_PROBE_DEFAULT on success, positive on failure
+ *********************************************************************/
+
+static int
+lem_probe(device_t dev)
+{
+	char		adapter_name[60];
+	u16		pci_vendor_id = 0;
+	u16		pci_device_id = 0;
+	u16		pci_subvendor_id = 0;
+	u16		pci_subdevice_id = 0;
+	em_vendor_info_t *ent;
+
+	INIT_DEBUGOUT("em_probe: begin");
+
+	pci_vendor_id = pci_get_vendor(dev);
+	if (pci_vendor_id != EM_VENDOR_ID)
+		return (ENXIO);
+
+	pci_device_id = pci_get_device(dev);
+	pci_subvendor_id = pci_get_subvendor(dev);
+	pci_subdevice_id = pci_get_subdevice(dev);
+
+	ent = lem_vendor_info_array;
+	while (ent->vendor_id != 0) {
+		if ((pci_vendor_id == ent->vendor_id) &&
+		    (pci_device_id == ent->device_id) &&
+
+		    ((pci_subvendor_id == ent->subvendor_id) ||
+		    (ent->subvendor_id == PCI_ANY_ID)) &&
+
+		    ((pci_subdevice_id == ent->subdevice_id) ||
+		    (ent->subdevice_id == PCI_ANY_ID))) {
+			sprintf(adapter_name, "%s %s",
+				lem_strings[ent->index],
+				lem_driver_version);
+			device_set_desc_copy(dev, adapter_name);
+			return (BUS_PROBE_DEFAULT);
+		}
+		ent++;
+	}
+
+	return (ENXIO);
+}
+
+/*********************************************************************
+ *  Device initialization routine
+ *
+ *  The attach entry point is called when the driver is being loaded.
+ *  This routine identifies the type of hardware, allocates all resources
+ *  and initializes the hardware.
+ *
+ *  return 0 on success, positive on failure
+ *********************************************************************/
+
+static int
+lem_attach(device_t dev)
+{
+	struct adapter	*adapter;
+	int		tsize, rsize;
+	int		error = 0;
+
+	INIT_DEBUGOUT("lem_attach: begin");
+
+	adapter = device_get_softc(dev);
+	adapter->dev = adapter->osdep.dev = dev;
+	EM_CORE_LOCK_INIT(adapter, device_get_nameunit(dev));
+	EM_TX_LOCK_INIT(adapter, device_get_nameunit(dev));
+	EM_RX_LOCK_INIT(adapter, device_get_nameunit(dev));
+
+	/* SYSCTL stuff */
+	SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
+	    OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
+	    lem_sysctl_debug_info, "I", "Debug Information");
+
+	SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
+	    OID_AUTO, "stats", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
+	    lem_sysctl_stats, "I", "Statistics");
+
+	callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0);
+	callout_init_mtx(&adapter->tx_fifo_timer, &adapter->tx_mtx, 0);
+
+	/* Determine hardware and mac info */
+	lem_identify_hardware(adapter);
+
+	/* Setup PCI resources */
+	if (lem_allocate_pci_resources(adapter)) {
+		device_printf(dev, "Allocation of PCI resources failed\n");
+		error = ENXIO;
+		goto err_pci;
+	}
+
+	/* Do Shared Code initialization */
+	if (e1000_setup_init_funcs(&adapter->hw, TRUE)) {
+		device_printf(dev, "Setup of Shared code failed\n");
+		error = ENXIO;
+		goto err_pci;
+	}
+
+	e1000_get_bus_info(&adapter->hw);
+
+	/* Set up some sysctls for the tunable interrupt delays */
+	lem_add_int_delay_sysctl(adapter, "rx_int_delay",
+	    "receive interrupt delay in usecs", &adapter->rx_int_delay,
+	    E1000_REGISTER(&adapter->hw, E1000_RDTR), lem_rx_int_delay_dflt);
+	lem_add_int_delay_sysctl(adapter, "tx_int_delay",
+	    "transmit interrupt delay in usecs", &adapter->tx_int_delay,
+	    E1000_REGISTER(&adapter->hw, E1000_TIDV), lem_tx_int_delay_dflt);
+	if (adapter->hw.mac.type >= e1000_82540) {
+		lem_add_int_delay_sysctl(adapter, "rx_abs_int_delay",
+		    "receive interrupt delay limit in usecs",
+		    &adapter->rx_abs_int_delay,
+		    E1000_REGISTER(&adapter->hw, E1000_RADV),
+		    lem_rx_abs_int_delay_dflt);
+		lem_add_int_delay_sysctl(adapter, "tx_abs_int_delay",
+		    "transmit interrupt delay limit in usecs",
+		    &adapter->tx_abs_int_delay,
+		    E1000_REGISTER(&adapter->hw, E1000_TADV),
+		    lem_tx_abs_int_delay_dflt);
+	}
+
+#ifndef EM_LEGACY_IRQ
+	/* Sysctls for limiting the amount of work done in the taskqueue */
+	lem_add_rx_process_limit(adapter, "rx_processing_limit",
+	    "max number of rx packets to process", &adapter->rx_process_limit,
+	    lem_rx_process_limit);
+#endif
+
+	/*
+	 * Validate number of transmit and receive descriptors. It
+	 * must not exceed hardware maximum, and must be multiple
+	 * of E1000_DBA_ALIGN.
+	 */
+	if (((lem_txd * sizeof(struct e1000_tx_desc)) % EM_DBA_ALIGN) != 0 ||
+	    (adapter->hw.mac.type >= e1000_82544 && lem_txd > EM_MAX_TXD) ||
+	    (adapter->hw.mac.type < e1000_82544 && lem_txd > EM_MAX_TXD_82543) ||
+	    (lem_txd < EM_MIN_TXD)) {
+		device_printf(dev, "Using %d TX descriptors instead of %d!\n",
+		    EM_DEFAULT_TXD, lem_txd);
+		adapter->num_tx_desc = EM_DEFAULT_TXD;
+	} else
+		adapter->num_tx_desc = lem_txd;
+	if (((lem_rxd * sizeof(struct e1000_rx_desc)) % EM_DBA_ALIGN) != 0 ||
+	    (adapter->hw.mac.type >= e1000_82544 && lem_rxd > EM_MAX_RXD) ||
+	    (adapter->hw.mac.type < e1000_82544 && lem_rxd > EM_MAX_RXD_82543) ||
+	    (lem_rxd < EM_MIN_RXD)) {
+		device_printf(dev, "Using %d RX descriptors instead of %d!\n",
+		    EM_DEFAULT_RXD, lem_rxd);
+		adapter->num_rx_desc = EM_DEFAULT_RXD;
+	} else
+		adapter->num_rx_desc = lem_rxd;
+
+	adapter->hw.mac.autoneg = DO_AUTO_NEG;
+	adapter->hw.phy.autoneg_wait_to_complete = FALSE;
+	adapter->hw.phy.autoneg_advertised = AUTONEG_ADV_DEFAULT;
+	adapter->rx_buffer_len = 2048;
+
+	e1000_init_script_state_82541(&adapter->hw, TRUE);
+	e1000_set_tbi_compatibility_82543(&adapter->hw, TRUE);
+
+	/* Copper options */
+	if (adapter->hw.phy.media_type == e1000_media_type_copper) {
+		adapter->hw.phy.mdix = AUTO_ALL_MODES;
+		adapter->hw.phy.disable_polarity_correction = FALSE;
+		adapter->hw.phy.ms_type = EM_MASTER_SLAVE;
+	}
+
+	/*
+	 * Set the frame limits assuming
+	 * standard ethernet sized frames.
+	 */
+	adapter->max_frame_size = ETHERMTU + ETHER_HDR_LEN + ETHERNET_FCS_SIZE;
+	adapter->min_frame_size = ETH_ZLEN + ETHERNET_FCS_SIZE;
+
+	/*
+	 * This controls when hardware reports transmit completion
+	 * status.
+	 */
+	adapter->hw.mac.report_tx_early = 1;
+
+	tsize = roundup2(adapter->num_tx_desc * sizeof(struct e1000_tx_desc),
+	    EM_DBA_ALIGN);
+
+	/* Allocate Transmit Descriptor ring */
+	if (lem_dma_malloc(adapter, tsize, &adapter->txdma, BUS_DMA_NOWAIT)) {
+		device_printf(dev, "Unable to allocate tx_desc memory\n");
+		error = ENOMEM;
+		goto err_tx_desc;
+	}
+	adapter->tx_desc_base = 
+	    (struct e1000_tx_desc *)adapter->txdma.dma_vaddr;
+
+	rsize = roundup2(adapter->num_rx_desc * sizeof(struct e1000_rx_desc),
+	    EM_DBA_ALIGN);
+
+	/* Allocate Receive Descriptor ring */
+	if (lem_dma_malloc(adapter, rsize, &adapter->rxdma, BUS_DMA_NOWAIT)) {
+		device_printf(dev, "Unable to allocate rx_desc memory\n");
+		error = ENOMEM;
+		goto err_rx_desc;
+	}
+	adapter->rx_desc_base =
+	    (struct e1000_rx_desc *)adapter->rxdma.dma_vaddr;
+
+	/*
+	** Start from a known state, this is
+	** important in reading the nvm and
+	** mac from that.
+	*/
+	e1000_reset_hw(&adapter->hw);
+
+	/* Make sure we have a good EEPROM before we read from it */
+	if (e1000_validate_nvm_checksum(&adapter->hw) < 0) {
+		/*
+		** Some PCI-E parts fail the first check due to
+		** the link being in sleep state, call it again,
+		** if it fails a second time its a real issue.
+		*/
+		if (e1000_validate_nvm_checksum(&adapter->hw) < 0) {
+			device_printf(dev,
+			    "The EEPROM Checksum Is Not Valid\n");
+			error = EIO;
+			goto err_hw_init;
+		}
+	}
+
+	/* Copy the permanent MAC address out of the EEPROM */
+	if (e1000_read_mac_addr(&adapter->hw) < 0) {
+		device_printf(dev, "EEPROM read error while reading MAC"
+		    " address\n");
+		error = EIO;
+		goto err_hw_init;
+	}
+
+	if (!lem_is_valid_ether_addr(adapter->hw.mac.addr)) {
+		device_printf(dev, "Invalid MAC address\n");
+		error = EIO;
+		goto err_hw_init;
+	}
+
+	/* Initialize the hardware */
+	if (lem_hardware_init(adapter)) {
+		device_printf(dev, "Unable to initialize the hardware\n");
+		error = EIO;
+		goto err_hw_init;
+	}
+
+	/* Allocate transmit descriptors and buffers */
+	if (lem_allocate_transmit_structures(adapter)) {
+		device_printf(dev, "Could not setup transmit structures\n");
+		error = ENOMEM;
+		goto err_tx_struct;
+	}
+
+	/* Allocate receive descriptors and buffers */
+	if (lem_allocate_receive_structures(adapter)) {
+		device_printf(dev, "Could not setup receive structures\n");
+		error = ENOMEM;
+		goto err_rx_struct;
+	}
+
+	/*
+	**  Do interrupt configuration
+	*/
+	error = lem_allocate_irq(adapter);
+	if (error)
+		goto err_rx_struct;
+
+	/*
+	 * Get Wake-on-Lan and Management info for later use
+	 */
+	lem_get_wakeup(dev);
+
+	/* Setup OS specific network interface */
+	lem_setup_interface(dev, adapter);
+
+	/* Initialize statistics */
+	lem_update_stats_counters(adapter);
+
+	adapter->hw.mac.get_link_status = 1;
+	lem_update_link_status(adapter);
+
+	/* Indicate SOL/IDER usage */
+	if (e1000_check_reset_block(&adapter->hw))
+		device_printf(dev,
+		    "PHY reset is blocked due to SOL/IDER session.\n");
+
+	/* Do we need workaround for 82544 PCI-X adapter? */
+	if (adapter->hw.bus.type == e1000_bus_type_pcix &&
+	    adapter->hw.mac.type == e1000_82544)
+		adapter->pcix_82544 = TRUE;
+	else
+		adapter->pcix_82544 = FALSE;
+
+#if __FreeBSD_version >= 700029
+	/* Register for VLAN events */
+	adapter->vlan_attach = EVENTHANDLER_REGISTER(vlan_config,
+	    lem_register_vlan, adapter, EVENTHANDLER_PRI_FIRST);
+	adapter->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig,
+	    lem_unregister_vlan, adapter, EVENTHANDLER_PRI_FIRST); 
+#endif
+
+	/* Non-AMT based hardware can now take control from firmware */
+	if (adapter->has_manage && !adapter->has_amt)
+		lem_get_hw_control(adapter);
+
+	/* Tell the stack that the interface is not active */
+	adapter->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+
+	adapter->led_dev = led_create(lem_led_func, adapter,
+	    device_get_nameunit(dev));
+
+	INIT_DEBUGOUT("lem_attach: end");
+
+	return (0);
+
+err_rx_struct:
+	lem_free_transmit_structures(adapter);
+err_tx_struct:
+err_hw_init:
+	lem_release_hw_control(adapter);
+	lem_dma_free(adapter, &adapter->rxdma);
+err_rx_desc:
+	lem_dma_free(adapter, &adapter->txdma);
+err_tx_desc:
+err_pci:
+	lem_free_pci_resources(adapter);
+	EM_TX_LOCK_DESTROY(adapter);
+	EM_RX_LOCK_DESTROY(adapter);
+	EM_CORE_LOCK_DESTROY(adapter);
+
+	return (error);
+}
+
+/*********************************************************************
+ *  Device removal routine
+ *
+ *  The detach entry point is called when the driver is being removed.
+ *  This routine stops the adapter and deallocates all the resources
+ *  that were allocated for driver operation.
+ *
+ *  return 0 on success, positive on failure
+ *********************************************************************/
+
+static int
+lem_detach(device_t dev)
+{
+	struct adapter	*adapter = device_get_softc(dev);
+	struct ifnet	*ifp = adapter->ifp;
+
+	INIT_DEBUGOUT("em_detach: begin");
+
+	/* Make sure VLANS are not using driver */
+#if __FreeBSD_version >= 700000
+	if (adapter->ifp->if_vlantrunk != NULL) {
+#else
+	if (adapter->ifp->if_nvlans != 0) {
+#endif   
+		device_printf(dev,"Vlan in use, detach first\n");
+		return (EBUSY);
+	}
+
+#ifdef DEVICE_POLLING
+	if (ifp->if_capenable & IFCAP_POLLING)
+		ether_poll_deregister(ifp);
+#endif
+
+	if (adapter->led_dev != NULL)
+		led_destroy(adapter->led_dev);
+
+	EM_CORE_LOCK(adapter);
+	EM_TX_LOCK(adapter);
+	adapter->in_detach = 1;
+	lem_stop(adapter);
+	e1000_phy_hw_reset(&adapter->hw);
+
+	lem_release_manageability(adapter);
+
+	EM_TX_UNLOCK(adapter);
+	EM_CORE_UNLOCK(adapter);
+
+#if __FreeBSD_version >= 700029
+	/* 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
+
+	ether_ifdetach(adapter->ifp);
+	callout_drain(&adapter->timer);
+	callout_drain(&adapter->tx_fifo_timer);
+
+	lem_free_pci_resources(adapter);
+	bus_generic_detach(dev);
+	if_free(ifp);
+
+	lem_free_transmit_structures(adapter);
+	lem_free_receive_structures(adapter);
+
+	/* Free Transmit Descriptor ring */
+	if (adapter->tx_desc_base) {
+		lem_dma_free(adapter, &adapter->txdma);
+		adapter->tx_desc_base = NULL;
+	}
+
+	/* Free Receive Descriptor ring */
+	if (adapter->rx_desc_base) {
+		lem_dma_free(adapter, &adapter->rxdma);
+		adapter->rx_desc_base = NULL;
+	}
+
+	lem_release_hw_control(adapter);
+	EM_TX_LOCK_DESTROY(adapter);
+	EM_RX_LOCK_DESTROY(adapter);
+	EM_CORE_LOCK_DESTROY(adapter);
+
+	return (0);
+}
+
+/*********************************************************************
+ *
+ *  Shutdown entry point
+ *
+ **********************************************************************/
+
+static int
+lem_shutdown(device_t dev)
+{
+	return lem_suspend(dev);
+}
+
+/*
+ * Suspend/resume device methods.
+ */
+static int
+lem_suspend(device_t dev)
+{
+	struct adapter *adapter = device_get_softc(dev);
+
+	EM_CORE_LOCK(adapter);
+
+	lem_release_manageability(adapter);
+	lem_release_hw_control(adapter);
+	lem_enable_wakeup(dev);
+
+	EM_CORE_UNLOCK(adapter);
+
+	return bus_generic_suspend(dev);
+}
+
+static int
+lem_resume(device_t dev)
+{
+	struct adapter *adapter = device_get_softc(dev);
+	struct ifnet *ifp = adapter->ifp;
+
+	EM_CORE_LOCK(adapter);
+	lem_init_locked(adapter);
+	lem_init_manageability(adapter);
+	EM_CORE_UNLOCK(adapter);
+	lem_start(ifp);
+
+	return bus_generic_resume(dev);
+}
+
+
+static void
+lem_start_locked(struct ifnet *ifp)
+{
+	struct adapter	*adapter = ifp->if_softc;
+	struct mbuf	*m_head;
+
+	EM_TX_LOCK_ASSERT(adapter);
+
+	if ((ifp->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) !=
+	    IFF_DRV_RUNNING)
+		return;
+	if (!adapter->link_active)
+		return;
+
+	while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
+
+                IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
+		if (m_head == NULL)
+			break;
+		/*
+		 *  Encapsulation can modify our pointer, and or make it
+		 *  NULL on failure.  In that event, we can't requeue.
+		 */
+		if (lem_xmit(adapter, &m_head)) {
+			if (m_head == NULL)
+				break;
+			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+			IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
+			break;
+		}
+
+		/* Send a copy of the frame to the BPF listener */
+		ETHER_BPF_MTAP(ifp, m_head);
+
+		/* Set timeout in case hardware has problems transmitting. */
+		adapter->watchdog_check = TRUE;
+		adapter->watchdog_time = ticks;
+	}
+	if (adapter->num_tx_desc_avail <= EM_TX_OP_THRESHOLD)
+		ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+
+	return;
+}
+
+static void
+lem_start(struct ifnet *ifp)
+{
+	struct adapter *adapter = ifp->if_softc;
+
+	EM_TX_LOCK(adapter);
+	if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+		lem_start_locked(ifp);
+	EM_TX_UNLOCK(adapter);
+}
+
+/*********************************************************************
+ *  Ioctl entry point
+ *
+ *  em_ioctl is called when the user wants to configure the
+ *  interface.
+ *
+ *  return 0 on success, positive on failure
+ **********************************************************************/
+
+static int
+lem_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
+{
+	struct adapter	*adapter = ifp->if_softc;
+	struct ifreq *ifr = (struct ifreq *)data;
+#ifdef INET
+	struct ifaddr *ifa = (struct ifaddr *)data;
+#endif
+	int error = 0;
+
+	if (adapter->in_detach)
+		return (error);
+
+	switch (command) {
+	case SIOCSIFADDR:
+#ifdef INET
+		if (ifa->ifa_addr->sa_family == AF_INET) {
+			/*
+			 * XXX
+			 * Since resetting hardware takes a very long time
+			 * and results in link renegotiation we only
+			 * initialize the hardware only when it is absolutely
+			 * required.
+			 */
+			ifp->if_flags |= IFF_UP;
+			if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+				EM_CORE_LOCK(adapter);
+				lem_init_locked(adapter);
+				EM_CORE_UNLOCK(adapter);
+			}
+			arp_ifinit(ifp, ifa);
+		} else
+#endif
+			error = ether_ioctl(ifp, command, data);
+		break;
+	case SIOCSIFMTU:
+	    {
+		int max_frame_size;
+
+		IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFMTU (Set Interface MTU)");
+
+		EM_CORE_LOCK(adapter);
+		switch (adapter->hw.mac.type) {
+		case e1000_82542:
+			max_frame_size = ETHER_MAX_LEN;
+			break;
+		default:
+			max_frame_size = MAX_JUMBO_FRAME_SIZE;
+		}
+		if (ifr->ifr_mtu > max_frame_size - ETHER_HDR_LEN -
+		    ETHER_CRC_LEN) {
+			EM_CORE_UNLOCK(adapter);
+			error = EINVAL;
+			break;
+		}
+
+		ifp->if_mtu = ifr->ifr_mtu;
+		adapter->max_frame_size =
+		    ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+		lem_init_locked(adapter);
+		EM_CORE_UNLOCK(adapter);
+		break;
+	    }
+	case SIOCSIFFLAGS:
+		IOCTL_DEBUGOUT("ioctl rcv'd:\
+		    SIOCSIFFLAGS (Set Interface Flags)");
+		EM_CORE_LOCK(adapter);
+		if (ifp->if_flags & IFF_UP) {
+			if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+				if ((ifp->if_flags ^ adapter->if_flags) &
+				    (IFF_PROMISC | IFF_ALLMULTI)) {
+					lem_disable_promisc(adapter);
+					lem_set_promisc(adapter);
+				}
+			} else
+				lem_init_locked(adapter);
+		} else
+			if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+				EM_TX_LOCK(adapter);
+				lem_stop(adapter);
+				EM_TX_UNLOCK(adapter);
+			}
+		adapter->if_flags = ifp->if_flags;
+		EM_CORE_UNLOCK(adapter);
+		break;
+	case SIOCADDMULTI:
+	case SIOCDELMULTI:
+		IOCTL_DEBUGOUT("ioctl rcv'd: SIOC(ADD|DEL)MULTI");
+		if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+			EM_CORE_LOCK(adapter);
+			lem_disable_intr(adapter);
+			lem_set_multi(adapter);
+			if (adapter->hw.mac.type == e1000_82542 && 
+	    		    adapter->hw.revision_id == E1000_REVISION_2) {
+				lem_initialize_receive_unit(adapter);
+			}
+#ifdef DEVICE_POLLING
+			if (!(ifp->if_capenable & IFCAP_POLLING))
+#endif
+				lem_enable_intr(adapter);
+			EM_CORE_UNLOCK(adapter);
+		}
+		break;
+	case SIOCSIFMEDIA:
+		/* Check SOL/IDER usage */
+		EM_CORE_LOCK(adapter);
+		if (e1000_check_reset_block(&adapter->hw)) {
+			EM_CORE_UNLOCK(adapter);
+			device_printf(adapter->dev, "Media change is"
+			    " blocked due to SOL/IDER session.\n");
+			break;
+		}
+		EM_CORE_UNLOCK(adapter);
+	case SIOCGIFMEDIA:
+		IOCTL_DEBUGOUT("ioctl rcv'd: \
+		    SIOCxIFMEDIA (Get/Set Interface Media)");
+		error = ifmedia_ioctl(ifp, ifr, &adapter->media, command);
+		break;

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