From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 05:44:57 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 199E41065673; Sun, 22 Mar 2009 05:44:57 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 05D838FC15; Sun, 22 Mar 2009 05:44:57 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2M5iuie058243; Sun, 22 Mar 2009 05:44:56 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2M5iuAT058241; Sun, 22 Mar 2009 05:44:56 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903220544.n2M5iuAT058241@svn.freebsd.org> From: David Schultz Date: Sun, 22 Mar 2009 05:44:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190240 - stable/7/usr.bin/ncal 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, 22 Mar 2009 05:44:57 -0000 Author: das Date: Sun Mar 22 05:44:56 2009 New Revision: 190240 URL: http://svn.freebsd.org/changeset/base/190240 Log: MFC r189804: Multibyte character support for cal(1). PR: 131578 Modified: stable/7/usr.bin/ncal/ (props changed) stable/7/usr.bin/ncal/ncal.1 stable/7/usr.bin/ncal/ncal.c Modified: stable/7/usr.bin/ncal/ncal.1 ============================================================================== --- stable/7/usr.bin/ncal/ncal.1 Sun Mar 22 04:32:05 2009 (r190239) +++ stable/7/usr.bin/ncal/ncal.1 Sun Mar 22 05:44:56 2009 (r190240) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 23, 2005 +.Dd March 14, 2009 .Dt CAL 1 .Os .Sh NAME @@ -134,7 +134,3 @@ command and manual were written by .Sh BUGS The assignment of Julian\(emGregorian switching dates to country codes is historically naive for many countries. -.Pp -The -.Nm -utility does not recognize multibyte characters. Modified: stable/7/usr.bin/ncal/ncal.c ============================================================================== --- stable/7/usr.bin/ncal/ncal.c Sun Mar 22 04:32:05 2009 (r190239) +++ stable/7/usr.bin/ncal/ncal.c Sun Mar 22 05:44:56 2009 (r190240) @@ -40,6 +40,8 @@ static const char rcsid[] = #include #include #include +#include +#include /* Width of one month with backward compatibility */ #define MONTH_WIDTH_B_J 27 @@ -53,13 +55,13 @@ static const char rcsid[] = typedef struct date date; struct monthlines { - char name[MAX_WIDTH + 1]; + wchar_t name[MAX_WIDTH + 1]; char lines[7][MAX_WIDTH + 1]; char weeks[MAX_WIDTH + 1]; }; struct weekdays { - char names[7][4]; + wchar_t names[7][4]; }; /* The switches from Julian to Gregorian in some countries */ @@ -159,6 +161,7 @@ int nswitch; /* user defined switch int nswitchb; /* switch date for backward compatibility */ char *center(char *s, char *t, int w); +wchar_t *wcenter(wchar_t *s, wchar_t *t, int w); void mkmonth(int year, int month, int jd_flag, struct monthlines * monthl); void mkmonthb(int year, int month, int jd_flag, struct monthlines * monthl); void mkweekdays(struct weekdays * wds); @@ -418,9 +421,9 @@ printmonth(int y, int m, int jd_flag) mkmonth(y, m - 1, jd_flag, &month); mkweekdays(&wds); - printf(" %s %d\n", month.name, y); + printf(" %ls %d\n", month.name, y); for (i = 0; i != 7; i++) - printf("%.2s%s\n", wds.names[i], month.lines[i]); + printf("%.2ls%s\n", wds.names[i], month.lines[i]); if (flag_weeks) printf(" %s\n", month.weeks); } @@ -430,7 +433,7 @@ printmonthb(int y, int m, int jd_flag) { struct monthlines month; struct weekdays wds; - char s[MAX_WIDTH], t[MAX_WIDTH]; + wchar_t s[MAX_WIDTH], t[MAX_WIDTH]; int i; int mw; @@ -439,16 +442,17 @@ printmonthb(int y, int m, int jd_flag) mw = jd_flag ? MONTH_WIDTH_B_J : MONTH_WIDTH_B; - sprintf(s, "%s %d", month.name, y); - printf("%s\n", center(t, s, mw)); + swprintf(s, MAX_WIDTH, L"%ls %d", month.name, y); + wprintf(L"%ls\n", wcenter(t, s, mw)); if (jd_flag) - printf(" %s %s %s %s %s %s %.2s\n", wds.names[6], wds.names[0], + wprintf(L" %ls %ls %ls %ls %ls %ls %.2ls\n", + wds.names[6], wds.names[0], wds.names[1], wds.names[2], wds.names[3], wds.names[4], wds.names[5]); else - printf("%s%s%s%s%s%s%.2s\n", wds.names[6], wds.names[0], - wds.names[1], wds.names[2], wds.names[3], + wprintf(L"%ls%ls%ls%ls%ls%ls%.2ls\n", wds.names[6], + wds.names[0], wds.names[1], wds.names[2], wds.names[3], wds.names[4], wds.names[5]); for (i = 0; i != 6; i++) @@ -475,17 +479,17 @@ printyear(int y, int jd_flag) printf("%s\n", center(t, s, mpl * mw)); for (j = 0; j != 12; j += mpl) { - printf(" %-*s%-*s", + printf(" %-*ls%-*ls", mw, year[j].name, mw, year[j + 1].name); if (mpl == 3) - printf("%s\n", year[j + 2].name); + printf("%ls\n", year[j + 2].name); else - printf("%-*s%s\n", + printf("%-*ls%ls\n", mw, year[j + 2].name, year[j + 3].name); for (i = 0; i != 7; i++) { - printf("%.2s%-*s%-*s", + printf("%.2ls%-*s%-*s", wds.names[i], mw, year[j].lines[i], mw, year[j + 1].lines[i]); @@ -518,6 +522,7 @@ printyearb(int y, int jd_flag) struct monthlines year[12]; struct weekdays wds; char s[80], t[80]; + wchar_t ws[80], wt[80]; int i, j; int mpl; int mw; @@ -532,17 +537,17 @@ printyearb(int y, int jd_flag) printf("%s\n\n", center(t, s, mw * mpl + mpl)); for (j = 0; j != 12; j += mpl) { - printf("%-*s ", mw, center(s, year[j].name, mw)); + printf("%-*ls ", mw, wcenter(ws, year[j].name, mw)); if (mpl == 2) - printf("%s\n", center(s, year[j + 1].name, mw)); + printf("%ls\n", wcenter(ws, year[j + 1].name, mw)); else - printf("%-*s %s\n", mw, - center(s, year[j + 1].name, mw), - center(t, year[j + 2].name, mw)); + printf("%-*ls %ls\n", mw, + wcenter(ws, year[j + 1].name, mw), + wcenter(wt, year[j + 2].name, mw)); if (mpl == 2) - printf(" %s %s %s %s %s %s %s " - " %s %s %s %s %s %s %.2s\n", + wprintf(L" %ls %ls %ls %ls %ls %ls %ls " + " %ls %ls %ls %ls %ls %ls %.2ls\n", wds.names[6], wds.names[0], wds.names[1], wds.names[2], wds.names[3], wds.names[4], wds.names[5], @@ -550,9 +555,9 @@ printyearb(int y, int jd_flag) wds.names[2], wds.names[3], wds.names[4], wds.names[5]); else - printf("%s%s%s%s%s%s%s " - "%s%s%s%s%s%s%s " - "%s%s%s%s%s%s%.2s\n", + wprintf(L"%ls%ls%ls%ls%ls%ls%ls " + "%ls%ls%ls%ls%ls%ls%ls " + "%ls%ls%ls%ls%ls%ls%.2ls\n", wds.names[6], wds.names[0], wds.names[1], wds.names[2], wds.names[3], wds.names[4], wds.names[5], @@ -596,8 +601,9 @@ mkmonth(int y, int m, int jd_flag, struc /* Set name of month. */ memset(&tm, 0, sizeof(tm)); tm.tm_mon = m; - strftime(mlines->name, sizeof(mlines->name), "%OB", &tm); - mlines->name[0] = toupper((unsigned char)mlines->name[0]); + wcsftime(mlines->name, sizeof(mlines->name) / sizeof(mlines->name[0]), + L"%OB", &tm); + mlines->name[0] = towupper(mlines->name[0]); /* * Set first and last to the day number of the first day of this @@ -688,8 +694,9 @@ mkmonthb(int y, int m, int jd_flag, stru /* Set name of month centered */ memset(&tm, 0, sizeof(tm)); tm.tm_mon = m; - strftime(mlines->name, sizeof(mlines->name), "%OB", &tm); - mlines->name[0] = toupper((unsigned char)mlines->name[0]); + wcsftime(mlines->name, sizeof(mlines->name) / sizeof(mlines->name[0]), + L"%OB", &tm); + mlines->name[0] = towupper(mlines->name[0]); /* * Set first and last to the day number of the first day of this @@ -754,18 +761,18 @@ mkweekdays(struct weekdays *wds) { int i, len; struct tm tm; - char buf[20]; + wchar_t buf[20]; memset(&tm, 0, sizeof(tm)); for (i = 0; i != 7; i++) { tm.tm_wday = (i+1) % 7; - strftime(buf, sizeof(buf), "%a", &tm); - len = strlen(buf); + wcsftime(buf, sizeof(buf), L"%a", &tm); + len = wcslen(buf); if (len > 2) len = 2; - strcpy(wds->names[i], " "); - strncpy(wds->names[i] + 2 - len, buf, len); + wcscpy(wds->names[i], L" "); + wcsncpy(wds->names[i] + 2 - len, buf, len); } } @@ -858,6 +865,17 @@ center(char *s, char *t, int w) return (s); } +/* Center string t in string s of length w by putting enough leading blanks */ +wchar_t * +wcenter(wchar_t *s, wchar_t *t, int w) +{ + char blanks[80]; + + memset(blanks, ' ', sizeof(blanks)); + swprintf(s, MAX_WIDTH, L"%.*s%ls", (int)(w - wcslen(t)) / 2, blanks, t); + return (s); +} + int parsemonth(const char *s) { From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 06:01:33 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E3891065690; Sun, 22 Mar 2009 06:01:33 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70DCC8FC1D; Sun, 22 Mar 2009 06:01:33 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2M61XGI058614; Sun, 22 Mar 2009 06:01:33 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2M61XwC058613; Sun, 22 Mar 2009 06:01:33 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903220601.n2M61XwC058613@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 22 Mar 2009 06:01: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: r190241 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/txp 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, 22 Mar 2009 06:01:34 -0000 Author: yongari Date: Sun Mar 22 06:01:33 2009 New Revision: 190241 URL: http://svn.freebsd.org/changeset/base/190241 Log: MFC r189685: K&R -> ANSI C function definitions. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/txp/if_txp.c Modified: stable/7/sys/dev/txp/if_txp.c ============================================================================== --- stable/7/sys/dev/txp/if_txp.c Sun Mar 22 05:44:56 2009 (r190240) +++ stable/7/sys/dev/txp/if_txp.c Sun Mar 22 06:01:33 2009 (r190241) @@ -186,8 +186,7 @@ MODULE_DEPEND(txp, pci, 1, 1, 1); MODULE_DEPEND(txp, ether, 1, 1, 1); static int -txp_probe(dev) - device_t dev; +txp_probe(device_t dev) { struct txp_type *t; @@ -206,8 +205,7 @@ txp_probe(dev) } static int -txp_attach(dev) - device_t dev; +txp_attach(device_t dev) { struct txp_softc *sc; struct ifnet *ifp; @@ -363,8 +361,7 @@ fail: } static int -txp_detach(dev) - device_t dev; +txp_detach(device_t dev) { struct txp_softc *sc; struct ifnet *ifp; @@ -392,8 +389,7 @@ txp_detach(dev) } static void -txp_release_resources(sc) - struct txp_softc *sc; +txp_release_resources(struct txp_softc *sc) { device_t dev; @@ -418,8 +414,7 @@ txp_release_resources(sc) } static int -txp_chip_init(sc) - struct txp_softc *sc; +txp_chip_init(struct txp_softc *sc) { /* disable interrupts */ WRITE_REG(sc, TXP_IER, 0); @@ -456,8 +451,7 @@ txp_chip_init(sc) } static int -txp_reset_adapter(sc) - struct txp_softc *sc; +txp_reset_adapter(struct txp_softc *sc) { u_int32_t r; int i; @@ -484,8 +478,7 @@ txp_reset_adapter(sc) } static int -txp_download_fw(sc) - struct txp_softc *sc; +txp_download_fw(struct txp_softc *sc) { struct txp_fw_file_header *fileheader; struct txp_fw_section_header *secthead; @@ -573,8 +566,7 @@ fail: } static int -txp_download_fw_wait(sc) - struct txp_softc *sc; +txp_download_fw_wait(struct txp_softc *sc) { u_int32_t i, r; @@ -602,10 +594,8 @@ txp_download_fw_wait(sc) } static int -txp_download_fw_section(sc, sect, sectnum) - struct txp_softc *sc; - struct txp_fw_section_header *sect; - int sectnum; +txp_download_fw_section(struct txp_softc *sc, + struct txp_fw_section_header *sect, int sectnum) { vm_offset_t dma; int rseg, err = 0; @@ -670,8 +660,7 @@ bail: } static void -txp_intr(vsc) - void *vsc; +txp_intr(void *vsc) { struct txp_softc *sc = vsc; struct txp_hostvar *hv = sc->sc_hostvar; @@ -718,9 +707,7 @@ txp_intr(vsc) } static void -txp_rx_reclaim(sc, r) - struct txp_softc *sc; - struct txp_rx_ring *r; +txp_rx_reclaim(struct txp_softc *sc, struct txp_rx_ring *r) { struct ifnet *ifp = sc->sc_ifp; struct txp_rx_desc *rxd; @@ -810,8 +797,7 @@ next: } static void -txp_rxbuf_reclaim(sc) - struct txp_softc *sc; +txp_rxbuf_reclaim(struct txp_softc *sc) { struct ifnet *ifp = sc->sc_ifp; struct txp_hostvar *hv = sc->sc_hostvar; @@ -859,9 +845,7 @@ txp_rxbuf_reclaim(sc) * Reclaim mbufs and entries from a transmit ring. */ static void -txp_tx_reclaim(sc, r) - struct txp_softc *sc; - struct txp_tx_ring *r; +txp_tx_reclaim(struct txp_softc *sc, struct txp_tx_ring *r) { struct ifnet *ifp = sc->sc_ifp; u_int32_t idx = TXP_OFFSET2IDX(*(r->r_off)); @@ -906,8 +890,7 @@ txp_tx_reclaim(sc, r) } static int -txp_shutdown(dev) - device_t dev; +txp_shutdown(device_t dev) { struct txp_softc *sc; @@ -930,8 +913,7 @@ txp_shutdown(dev) } static int -txp_alloc_rings(sc) - struct txp_softc *sc; +txp_alloc_rings(struct txp_softc *sc) { struct txp_boot_record *boot; struct txp_ldata *ld; @@ -1066,10 +1048,7 @@ txp_alloc_rings(sc) } static int -txp_ioctl(ifp, command, data) - struct ifnet *ifp; - u_long command; - caddr_t data; +txp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct txp_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; @@ -1110,8 +1089,7 @@ txp_ioctl(ifp, command, data) } static int -txp_rxring_fill(sc) - struct txp_softc *sc; +txp_rxring_fill(struct txp_softc *sc) { int i; struct ifnet *ifp; @@ -1141,8 +1119,7 @@ txp_rxring_fill(sc) } static void -txp_rxring_empty(sc) - struct txp_softc *sc; +txp_rxring_empty(struct txp_softc *sc) { int i; struct txp_swdesc *sd; @@ -1167,8 +1144,7 @@ txp_rxring_empty(sc) } static void -txp_init(xsc) - void *xsc; +txp_init(void *xsc) { struct txp_softc *sc; @@ -1179,8 +1155,7 @@ txp_init(xsc) } static void -txp_init_locked(sc) - struct txp_softc *sc; +txp_init_locked(struct txp_softc *sc) { struct ifnet *ifp; u_int16_t p1; @@ -1229,8 +1204,7 @@ txp_init_locked(sc) } static void -txp_tick(vsc) - void *vsc; +txp_tick(void *vsc) { struct txp_softc *sc = vsc; struct ifnet *ifp = sc->sc_ifp; @@ -1269,8 +1243,7 @@ out: } static void -txp_start(ifp) - struct ifnet *ifp; +txp_start(struct ifnet *ifp) { struct txp_softc *sc; @@ -1281,8 +1254,7 @@ txp_start(ifp) } static void -txp_start_locked(ifp) - struct ifnet *ifp; +txp_start_locked(struct ifnet *ifp) { struct txp_softc *sc = ifp->if_softc; struct txp_tx_ring *r = &sc->sc_txhir; @@ -1527,9 +1499,8 @@ txp_response(struct txp_softc *sc, u_int } static void -txp_rsp_fixup(sc, rsp, dst) - struct txp_softc *sc; - struct txp_rsp_desc *rsp, *dst; +txp_rsp_fixup(struct txp_softc *sc, struct txp_rsp_desc *rsp, + struct txp_rsp_desc *dst) { struct txp_rsp_desc *src = rsp; struct txp_hostvar *hv = sc->sc_hostvar; @@ -1553,8 +1524,7 @@ txp_rsp_fixup(sc, rsp, dst) } static int -txp_cmd_desc_numfree(sc) - struct txp_softc *sc; +txp_cmd_desc_numfree(struct txp_softc *sc) { struct txp_hostvar *hv = sc->sc_hostvar; struct txp_boot_record *br = sc->sc_boot; @@ -1578,8 +1548,7 @@ txp_cmd_desc_numfree(sc) } static void -txp_stop(sc) - struct txp_softc *sc; +txp_stop(struct txp_softc *sc) { struct ifnet *ifp; @@ -1599,15 +1568,13 @@ txp_stop(sc) } static void -txp_watchdog(ifp) - struct ifnet *ifp; +txp_watchdog(struct ifnet *ifp) { return; } static int -txp_ifmedia_upd(ifp) - struct ifnet *ifp; +txp_ifmedia_upd(struct ifnet *ifp) { struct txp_softc *sc = ifp->if_softc; struct ifmedia *ifm = &sc->sc_ifmedia; @@ -1651,9 +1618,7 @@ txp_ifmedia_upd(ifp) } static void -txp_ifmedia_sts(ifp, ifmr) - struct ifnet *ifp; - struct ifmediareq *ifmr; +txp_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { struct txp_softc *sc = ifp->if_softc; struct ifmedia *ifm = &sc->sc_ifmedia; @@ -1726,8 +1691,7 @@ bail: #ifdef TXP_DEBUG static void -txp_show_descriptor(d) - void *d; +txp_show_descriptor(void *d) { struct txp_cmd_desc *cmd = d; struct txp_rsp_desc *rsp = d; @@ -1770,8 +1734,7 @@ txp_show_descriptor(d) #endif static void -txp_set_filter(sc) - struct txp_softc *sc; +txp_set_filter(struct txp_softc *sc) { struct ifnet *ifp = sc->sc_ifp; u_int32_t crc, carry, hashbit, hash[2]; @@ -1838,8 +1801,7 @@ setit: } static void -txp_capabilities(sc) - struct txp_softc *sc; +txp_capabilities(struct txp_softc *sc) { struct ifnet *ifp = sc->sc_ifp; struct txp_rsp_desc *rsp = NULL; From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 06:04:16 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D16D1106566B; Sun, 22 Mar 2009 06:04:16 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE3818FC17; Sun, 22 Mar 2009 06:04:16 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2M64GZ2058713; Sun, 22 Mar 2009 06:04:16 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2M64Gbd058712; Sun, 22 Mar 2009 06:04:16 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903220604.n2M64Gbd058712@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 22 Mar 2009 06:04:16 +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: r190242 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/txp 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, 22 Mar 2009 06:04:17 -0000 Author: yongari Date: Sun Mar 22 06:04:16 2009 New Revision: 190242 URL: http://svn.freebsd.org/changeset/base/190242 Log: MFC r189686: Remove extra tab characters. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/txp/if_txp.c Modified: stable/7/sys/dev/txp/if_txp.c ============================================================================== --- stable/7/sys/dev/txp/if_txp.c Sun Mar 22 06:01:33 2009 (r190241) +++ stable/7/sys/dev/txp/if_txp.c Sun Mar 22 06:04:16 2009 (r190242) @@ -534,7 +534,7 @@ txp_download_fw(struct txp_softc *sc) sizeof(struct txp_fw_file_header)); for (sect = 0; sect < fileheader->nsections; sect++) { - + if (txp_download_fw_section(sc, secthead, sect)) { error = -1; goto fail; @@ -659,7 +659,7 @@ bail: return (err); } -static void +static void txp_intr(void *vsc) { struct txp_softc *sc = vsc; @@ -1519,7 +1519,7 @@ txp_rsp_fixup(struct txp_softc *sc, stru src++; sc->sc_rspring.lastwrite = hv->hv_resp_read_idx = ridx; } - + hv->hv_resp_read_idx = ridx; } From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 06:07:04 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 076321065676; Sun, 22 Mar 2009 06:07:04 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE1D18FC17; Sun, 22 Mar 2009 06:07:03 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2M6733c058813; Sun, 22 Mar 2009 06:07:03 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2M673s7058812; Sun, 22 Mar 2009 06:07:03 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903220607.n2M673s7058812@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 22 Mar 2009 06:07:03 +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: r190243 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/txp 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, 22 Mar 2009 06:07:04 -0000 Author: yongari Date: Sun Mar 22 06:07:03 2009 New Revision: 190243 URL: http://svn.freebsd.org/changeset/base/190243 Log: MFC r189687: Remove return statement at the end of function that returns void. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/txp/if_txp.c Modified: stable/7/sys/dev/txp/if_txp.c ============================================================================== --- stable/7/sys/dev/txp/if_txp.c Sun Mar 22 06:04:16 2009 (r190242) +++ stable/7/sys/dev/txp/if_txp.c Sun Mar 22 06:07:03 2009 (r190243) @@ -409,8 +409,6 @@ txp_release_resources(struct txp_softc * if (sc->sc_ifp) if_free(sc->sc_ifp); - - return; } static int @@ -702,8 +700,6 @@ txp_intr(void *vsc) txp_start_locked(sc->sc_ifp); TXP_UNLOCK(sc); - - return; } static void @@ -792,8 +788,6 @@ next: } *r->r_roff = woff; - - return; } static void @@ -837,8 +831,6 @@ txp_rxbuf_reclaim(struct txp_softc *sc) } sc->sc_rxbufprod = i; - - return; } /* @@ -1139,8 +1131,6 @@ txp_rxring_empty(struct txp_softc *sc) sd->sd_mbuf = NULL; } } - - return; } static void @@ -1238,8 +1228,6 @@ out: free(rsp, M_DEVBUF); callout_reset(&sc->sc_tick, hz, txp_tick, sc); - - return; } static void @@ -1355,7 +1343,6 @@ oactive: r->r_prod = firstprod; r->r_cnt = firstcnt; IF_PREPEND(&ifp->if_snd, m); - return; } /* @@ -1563,14 +1550,12 @@ txp_stop(struct txp_softc *sc) txp_command(sc, TXP_CMD_RX_DISABLE, 0, 0, 0, NULL, NULL, NULL, 1); txp_rxring_empty(sc); - - return; } static void txp_watchdog(struct ifnet *ifp) { - return; + } static int @@ -1796,8 +1781,6 @@ setit: txp_command(sc, TXP_CMD_RX_FILTER_WRITE, filter, 0, 0, NULL, NULL, NULL, 1); - - return; } static void @@ -1864,6 +1847,4 @@ txp_capabilities(struct txp_softc *sc) out: if (rsp != NULL) free(rsp, M_DEVBUF); - - return; } From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 06:11:35 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7081B106564A; Sun, 22 Mar 2009 06:11:35 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52CE08FC17; Sun, 22 Mar 2009 06:11:35 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2M6BZA6058951; Sun, 22 Mar 2009 06:11:35 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2M6BZDV058950; Sun, 22 Mar 2009 06:11:35 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903220611.n2M6BZDV058950@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 22 Mar 2009 06:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190244 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/txp 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, 22 Mar 2009 06:11:36 -0000 Author: yongari Date: Sun Mar 22 06:11:35 2009 New Revision: 190244 URL: http://svn.freebsd.org/changeset/base/190244 Log: MFC r189688: style(9) - space after keywords. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/txp/if_txp.c Modified: stable/7/sys/dev/txp/if_txp.c ============================================================================== --- stable/7/sys/dev/txp/if_txp.c Sun Mar 22 06:07:03 2009 (r190243) +++ stable/7/sys/dev/txp/if_txp.c Sun Mar 22 06:11:35 2009 (r190244) @@ -192,16 +192,16 @@ txp_probe(device_t dev) t = txp_devs; - while(t->txp_name != NULL) { + while (t->txp_name != NULL) { if ((pci_get_vendor(dev) == t->txp_vid) && (pci_get_device(dev) == t->txp_did)) { device_set_desc(dev, t->txp_name); - return(BUS_PROBE_DEFAULT); + return (BUS_PROBE_DEFAULT); } t++; } - return(ENXIO); + return (ENXIO); } static int @@ -352,12 +352,12 @@ txp_attach(device_t dev) goto fail; } - return(0); + return (0); fail: txp_release_resources(sc); mtx_destroy(&sc->sc_mtx); - return(error); + return (error); } static int @@ -385,7 +385,7 @@ txp_detach(device_t dev) txp_release_resources(sc); mtx_destroy(&sc->sc_mtx); - return(0); + return (0); } static void @@ -901,7 +901,7 @@ txp_shutdown(device_t dev) txp_command(sc, TXP_CMD_HALT, 0, 0, 0, NULL, NULL, NULL, 0); TXP_UNLOCK(sc); - return(0); + return (0); } static int @@ -990,7 +990,7 @@ txp_alloc_rings(struct txp_softc *sc) sc->sc_rxbufs[i].rb_sd = malloc(sizeof(struct txp_swdesc), M_DEVBUF, M_NOWAIT); if (sc->sc_rxbufs[i].rb_sd == NULL) - return(ENOBUFS); + return (ENOBUFS); sd = sc->sc_rxbufs[i].rb_sd; sd->sd_mbuf = NULL; } @@ -1011,7 +1011,7 @@ txp_alloc_rings(struct txp_softc *sc) if (r != STAT_WAITING_FOR_BOOT) { device_printf(sc->sc_dev, "not waiting for boot\n"); - return(ENXIO); + return (ENXIO); } WRITE_REG(sc, TXP_H2A_2, 0); @@ -1027,7 +1027,7 @@ txp_alloc_rings(struct txp_softc *sc) } if (r != STAT_RUNNING) { device_printf(sc->sc_dev, "fw not running\n"); - return(ENXIO); + return (ENXIO); } /* Clear TX and CMD ring write registers */ @@ -1046,7 +1046,7 @@ txp_ioctl(struct ifnet *ifp, u_long comm struct ifreq *ifr = (struct ifreq *)data; int error = 0; - switch(command) { + switch (command) { case SIOCSIFFLAGS: TXP_LOCK(sc); if (ifp->if_flags & IFF_UP) { @@ -1077,7 +1077,7 @@ txp_ioctl(struct ifnet *ifp, u_long comm break; } - return(error); + return (error); } static int @@ -1094,7 +1094,7 @@ txp_rxring_fill(struct txp_softc *sc) sd = sc->sc_rxbufs[i].rb_sd; sd->sd_mbuf = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if (sd->sd_mbuf == NULL) - return(ENOBUFS); + return (ENOBUFS); sd->sd_mbuf->m_pkthdr.len = sd->sd_mbuf->m_len = MCLBYTES; sd->sd_mbuf->m_pkthdr.rcvif = ifp; @@ -1107,7 +1107,7 @@ txp_rxring_fill(struct txp_softc *sc) sc->sc_hostvar->hv_rx_buf_write_idx = (RXBUF_ENTRIES - 1) * sizeof(struct txp_rxbuf_desc); - return(0); + return (0); } static void From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 06:16:45 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4816A106564A; Sun, 22 Mar 2009 06:16:45 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33A6D8FC08; Sun, 22 Mar 2009 06:16:45 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2M6GjZY059094; Sun, 22 Mar 2009 06:16:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2M6GjaE059092; Sun, 22 Mar 2009 06:16:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903220616.n2M6GjaE059092@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 22 Mar 2009 06:16:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190245 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/txp 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, 22 Mar 2009 06:16:45 -0000 Author: yongari Date: Sun Mar 22 06:16:44 2009 New Revision: 190245 URL: http://svn.freebsd.org/changeset/base/190245 Log: MFC r189689: s/u_int8_t/uint8_t/g s/u_int16_t/uint16_t/g s/u_int32_t/uint32_t/g s/u_int64_t/uint64_t/g Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/txp/if_txp.c stable/7/sys/dev/txp/if_txpreg.h Modified: stable/7/sys/dev/txp/if_txp.c ============================================================================== --- stable/7/sys/dev/txp/if_txp.c Sun Mar 22 06:11:35 2009 (r190244) +++ stable/7/sys/dev/txp/if_txp.c Sun Mar 22 06:16:44 2009 (r190245) @@ -136,12 +136,12 @@ static void txp_rxring_empty(struct txp_ static void txp_set_filter(struct txp_softc *); static int txp_cmd_desc_numfree(struct txp_softc *); -static int txp_command(struct txp_softc *, u_int16_t, u_int16_t, u_int32_t, - u_int32_t, u_int16_t *, u_int32_t *, u_int32_t *, int); -static int txp_command2(struct txp_softc *, u_int16_t, u_int16_t, - u_int32_t, u_int32_t, struct txp_ext_desc *, u_int8_t, +static int txp_command(struct txp_softc *, uint16_t, uint16_t, uint32_t, + uint32_t, uint16_t *, uint32_t *, uint32_t *, int); +static int txp_command2(struct txp_softc *, uint16_t, uint16_t, + uint32_t, uint32_t, struct txp_ext_desc *, uint8_t, struct txp_rsp_desc **, int); -static int txp_response(struct txp_softc *, u_int32_t, u_int16_t, u_int16_t, +static int txp_response(struct txp_softc *, uint32_t, uint16_t, uint16_t, struct txp_rsp_desc **); static void txp_rsp_fixup(struct txp_softc *, struct txp_rsp_desc *, struct txp_rsp_desc *); @@ -209,8 +209,8 @@ txp_attach(device_t dev) { struct txp_softc *sc; struct ifnet *ifp; - u_int16_t p1; - u_int32_t p2; + uint16_t p1; + uint32_t p2; int error = 0, rid; u_char eaddr[6]; @@ -296,12 +296,12 @@ txp_attach(device_t dev) goto fail; } - eaddr[0] = ((u_int8_t *)&p1)[1]; - eaddr[1] = ((u_int8_t *)&p1)[0]; - eaddr[2] = ((u_int8_t *)&p2)[3]; - eaddr[3] = ((u_int8_t *)&p2)[2]; - eaddr[4] = ((u_int8_t *)&p2)[1]; - eaddr[5] = ((u_int8_t *)&p2)[0]; + eaddr[0] = ((uint8_t *)&p1)[1]; + eaddr[1] = ((uint8_t *)&p1)[0]; + eaddr[2] = ((uint8_t *)&p2)[3]; + eaddr[3] = ((uint8_t *)&p2)[2]; + eaddr[4] = ((uint8_t *)&p2)[1]; + eaddr[5] = ((uint8_t *)&p2)[0]; sc->sc_cold = 0; @@ -451,7 +451,7 @@ txp_chip_init(struct txp_softc *sc) static int txp_reset_adapter(struct txp_softc *sc) { - u_int32_t r; + uint32_t r; int i; r = 0; @@ -481,7 +481,7 @@ txp_download_fw(struct txp_softc *sc) struct txp_fw_file_header *fileheader; struct txp_fw_section_header *secthead; int error, sect; - u_int32_t r, i, ier, imr; + uint32_t r, i, ier, imr; r = 0; error = 0; @@ -528,7 +528,7 @@ txp_download_fw(struct txp_softc *sc) goto fail; } - secthead = (struct txp_fw_section_header *)(((u_int8_t *)tc990image) + + secthead = (struct txp_fw_section_header *)(((uint8_t *)tc990image) + sizeof(struct txp_fw_file_header)); for (sect = 0; sect < fileheader->nsections; sect++) { @@ -538,7 +538,7 @@ txp_download_fw(struct txp_softc *sc) goto fail; } secthead = (struct txp_fw_section_header *) - (((u_int8_t *)secthead) + secthead->nbytes + + (((uint8_t *)secthead) + secthead->nbytes + sizeof(*secthead)); } @@ -566,7 +566,7 @@ fail: static int txp_download_fw_wait(struct txp_softc *sc) { - u_int32_t i, r; + uint32_t i, r; r = 0; for (i = 0; i < 10000; i++) { @@ -598,14 +598,14 @@ txp_download_fw_section(struct txp_softc vm_offset_t dma; int rseg, err = 0; struct mbuf m; - u_int16_t csum; + uint16_t csum; /* Skip zero length sections */ if (sect->nbytes == 0) return (0); /* Make sure we aren't past the end of the image */ - rseg = ((u_int8_t *)sect) - ((u_int8_t *)tc990image); + rseg = ((uint8_t *)sect) - ((uint8_t *)tc990image); if (rseg >= sizeof(tc990image)) { device_printf(sc->sc_dev, "fw invalid section address, " "section %d\n", sectnum); @@ -620,7 +620,7 @@ txp_download_fw_section(struct txp_softc return (-1); } - bcopy(((u_int8_t *)sect) + sizeof(*sect), sc->sc_fwbuf, sect->nbytes); + bcopy(((uint8_t *)sect) + sizeof(*sect), sc->sc_fwbuf, sect->nbytes); dma = vtophys(sc->sc_fwbuf); /* @@ -662,7 +662,7 @@ txp_intr(void *vsc) { struct txp_softc *sc = vsc; struct txp_hostvar *hv = sc->sc_hostvar; - u_int32_t isr; + uint32_t isr; /* mask all interrupts */ TXP_LOCK(sc); @@ -709,7 +709,7 @@ txp_rx_reclaim(struct txp_softc *sc, str struct txp_rx_desc *rxd; struct mbuf *m; struct txp_swdesc *sd = NULL; - u_int32_t roff, woff; + uint32_t roff, woff; TXP_LOCK_ASSERT(sc); roff = *r->r_roff; @@ -797,7 +797,7 @@ txp_rxbuf_reclaim(struct txp_softc *sc) struct txp_hostvar *hv = sc->sc_hostvar; struct txp_rxbuf_desc *rbd; struct txp_swdesc *sd; - u_int32_t i; + uint32_t i; TXP_LOCK_ASSERT(sc); if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) @@ -840,8 +840,8 @@ static void txp_tx_reclaim(struct txp_softc *sc, struct txp_tx_ring *r) { struct ifnet *ifp = sc->sc_ifp; - u_int32_t idx = TXP_OFFSET2IDX(*(r->r_off)); - u_int32_t cons = r->r_cons, cnt = r->r_cnt; + uint32_t idx = TXP_OFFSET2IDX(*(r->r_off)); + uint32_t cons = r->r_cons, cnt = r->r_cnt; struct txp_tx_desc *txd = r->r_desc + cons; struct txp_swdesc *sd = sc->sc_txd + cons; struct mbuf *m; @@ -909,7 +909,7 @@ txp_alloc_rings(struct txp_softc *sc) { struct txp_boot_record *boot; struct txp_ldata *ld; - u_int32_t r; + uint32_t r; int i; r = 0; @@ -997,7 +997,7 @@ txp_alloc_rings(struct txp_softc *sc) sc->sc_rxbufprod = 0; /* zero dma */ - bzero(&ld->txp_zero, sizeof(u_int32_t)); + bzero(&ld->txp_zero, sizeof(uint32_t)); boot->br_zero_lo = vtophys(&ld->txp_zero); boot->br_zero_hi = 0; @@ -1148,8 +1148,8 @@ static void txp_init_locked(struct txp_softc *sc) { struct ifnet *ifp; - u_int16_t p1; - u_int32_t p2; + uint16_t p1; + uint32_t p2; TXP_LOCK_ASSERT(sc); ifp = sc->sc_ifp; @@ -1163,12 +1163,12 @@ txp_init_locked(struct txp_softc *sc) NULL, NULL, NULL, 1); /* Set station address. */ - ((u_int8_t *)&p1)[1] = IF_LLADDR(sc->sc_ifp)[0]; - ((u_int8_t *)&p1)[0] = IF_LLADDR(sc->sc_ifp)[1]; - ((u_int8_t *)&p2)[3] = IF_LLADDR(sc->sc_ifp)[2]; - ((u_int8_t *)&p2)[2] = IF_LLADDR(sc->sc_ifp)[3]; - ((u_int8_t *)&p2)[1] = IF_LLADDR(sc->sc_ifp)[4]; - ((u_int8_t *)&p2)[0] = IF_LLADDR(sc->sc_ifp)[5]; + ((uint8_t *)&p1)[1] = IF_LLADDR(sc->sc_ifp)[0]; + ((uint8_t *)&p1)[0] = IF_LLADDR(sc->sc_ifp)[1]; + ((uint8_t *)&p2)[3] = IF_LLADDR(sc->sc_ifp)[2]; + ((uint8_t *)&p2)[2] = IF_LLADDR(sc->sc_ifp)[3]; + ((uint8_t *)&p2)[1] = IF_LLADDR(sc->sc_ifp)[4]; + ((uint8_t *)&p2)[0] = IF_LLADDR(sc->sc_ifp)[5]; txp_command(sc, TXP_CMD_STATION_ADDRESS_WRITE, p1, p2, 0, NULL, NULL, NULL, 1); @@ -1250,7 +1250,7 @@ txp_start_locked(struct ifnet *ifp) struct txp_frag_desc *fxd; struct mbuf *m, *m0; struct txp_swdesc *sd; - u_int32_t firstprod, firstcnt, prod, cnt; + uint32_t firstprod, firstcnt, prod, cnt; TXP_LOCK_ASSERT(sc); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != @@ -1349,8 +1349,8 @@ oactive: * Handle simple commands sent to the typhoon */ static int -txp_command(struct txp_softc *sc, u_int16_t id, u_int16_t in1, u_int32_t in2, - u_int32_t in3, u_int16_t *out1, u_int32_t *out2, u_int32_t *out3, int wait) +txp_command(struct txp_softc *sc, uint16_t id, uint16_t in1, uint32_t in2, + uint32_t in3, uint16_t *out1, uint32_t *out2, uint32_t *out3, int wait) { struct txp_rsp_desc *rsp = NULL; @@ -1371,15 +1371,15 @@ txp_command(struct txp_softc *sc, u_int1 } static int -txp_command2(struct txp_softc *sc, u_int16_t id, u_int16_t in1, u_int32_t in2, - u_int32_t in3, struct txp_ext_desc *in_extp, u_int8_t in_extn, +txp_command2(struct txp_softc *sc, uint16_t id, uint16_t in1, uint32_t in2, + uint32_t in3, struct txp_ext_desc *in_extp, uint8_t in_extn, struct txp_rsp_desc **rspp, int wait) { struct txp_hostvar *hv = sc->sc_hostvar; struct txp_cmd_desc *cmd; struct txp_ext_desc *ext; - u_int32_t idx, i; - u_int16_t seq; + uint32_t idx, i; + uint16_t seq; if (txp_cmd_desc_numfree(sc) < (in_extn + 1)) { device_printf(sc->sc_dev, "no free cmd descriptors\n"); @@ -1387,7 +1387,7 @@ txp_command2(struct txp_softc *sc, u_int } idx = sc->sc_cmdring.lastwrite; - cmd = (struct txp_cmd_desc *)(((u_int8_t *)sc->sc_cmdring.base) + idx); + cmd = (struct txp_cmd_desc *)(((uint8_t *)sc->sc_cmdring.base) + idx); bzero(cmd, sizeof(*cmd)); cmd->cmd_numdesc = in_extn; @@ -1404,7 +1404,7 @@ txp_command2(struct txp_softc *sc, u_int idx = 0; for (i = 0; i < in_extn; i++) { - ext = (struct txp_ext_desc *)(((u_int8_t *)sc->sc_cmdring.base) + idx); + ext = (struct txp_ext_desc *)(((uint8_t *)sc->sc_cmdring.base) + idx); bcopy(in_extp, ext, sizeof(struct txp_ext_desc)); in_extp++; idx += sizeof(struct txp_cmd_desc); @@ -1439,14 +1439,14 @@ txp_command2(struct txp_softc *sc, u_int } static int -txp_response(struct txp_softc *sc, u_int32_t ridx, u_int16_t id, u_int16_t seq, +txp_response(struct txp_softc *sc, uint32_t ridx, uint16_t id, uint16_t seq, struct txp_rsp_desc **rspp) { struct txp_hostvar *hv = sc->sc_hostvar; struct txp_rsp_desc *rsp; while (ridx != hv->hv_resp_write_idx) { - rsp = (struct txp_rsp_desc *)(((u_int8_t *)sc->sc_rspring.base) + ridx); + rsp = (struct txp_rsp_desc *)(((uint8_t *)sc->sc_rspring.base) + ridx); if (id == rsp->rsp_id && rsp->rsp_seq == seq) { *rspp = (struct txp_rsp_desc *)malloc( @@ -1491,7 +1491,7 @@ txp_rsp_fixup(struct txp_softc *sc, stru { struct txp_rsp_desc *src = rsp; struct txp_hostvar *hv = sc->sc_hostvar; - u_int32_t i, ridx; + uint32_t i, ridx; ridx = hv->hv_resp_read_idx; @@ -1515,7 +1515,7 @@ txp_cmd_desc_numfree(struct txp_softc *s { struct txp_hostvar *hv = sc->sc_hostvar; struct txp_boot_record *br = sc->sc_boot; - u_int32_t widx, ridx, nfree; + uint32_t widx, ridx, nfree; widx = sc->sc_cmdring.lastwrite; ridx = hv->hv_cmd_read_idx; @@ -1563,7 +1563,7 @@ txp_ifmedia_upd(struct ifnet *ifp) { struct txp_softc *sc = ifp->if_softc; struct ifmedia *ifm = &sc->sc_ifmedia; - u_int16_t new_xcvr; + uint16_t new_xcvr; TXP_LOCK(sc); if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) { @@ -1607,7 +1607,7 @@ txp_ifmedia_sts(struct ifnet *ifp, struc { struct txp_softc *sc = ifp->if_softc; struct ifmedia *ifm = &sc->sc_ifmedia; - u_int16_t bmsr, bmcr, anar, anlpar; + uint16_t bmsr, bmcr, anar, anlpar; ifmr->ifm_status = IFM_AVALID; ifmr->ifm_active = IFM_ETHER; @@ -1722,9 +1722,9 @@ static void txp_set_filter(struct txp_softc *sc) { struct ifnet *ifp = sc->sc_ifp; - u_int32_t crc, carry, hashbit, hash[2]; - u_int16_t filter; - u_int8_t octet; + uint32_t crc, carry, hashbit, hash[2]; + uint16_t filter; + uint8_t octet; int i, j, mcnt = 0; struct ifmultiaddr *ifma; char *enm; @@ -1765,7 +1765,7 @@ txp_set_filter(struct txp_softc *sc) carry; } } - hashbit = (u_int16_t)(crc & (64 - 1)); + hashbit = (uint16_t)(crc & (64 - 1)); hash[hashbit / 32] |= (1 << hashbit % 32); } IF_ADDR_UNLOCK(ifp); Modified: stable/7/sys/dev/txp/if_txpreg.h ============================================================================== --- stable/7/sys/dev/txp/if_txpreg.h Sun Mar 22 06:11:35 2009 (r190244) +++ stable/7/sys/dev/txp/if_txpreg.h Sun Mar 22 06:16:44 2009 (r190245) @@ -225,12 +225,12 @@ #define TXP_STAT_UDPCKSUMGOOD 0x0200 struct txp_tx_desc { - volatile u_int8_t tx_flags; /* type/descriptor flags */ - volatile u_int8_t tx_numdesc; /* number of descriptors */ - volatile u_int16_t tx_totlen; /* total packet length */ - volatile u_int32_t tx_addrlo; /* virt addr low word */ - volatile u_int32_t tx_addrhi; /* virt addr high word */ - volatile u_int32_t tx_pflags; /* processing flags */ + volatile uint8_t tx_flags; /* type/descriptor flags */ + volatile uint8_t tx_numdesc; /* number of descriptors */ + volatile uint16_t tx_totlen; /* total packet length */ + volatile uint32_t tx_addrlo; /* virt addr low word */ + volatile uint32_t tx_addrhi; /* virt addr high word */ + volatile uint32_t tx_pflags; /* processing flags */ }; #define TX_FLAGS_TYPE_M 0x07 /* type mask */ #define TX_FLAGS_TYPE_FRAG 0x00 /* type: fragment */ @@ -256,21 +256,21 @@ struct txp_tx_desc { #define TX_PFLAGS_VLANTAG_S 12 /* amount to shift tag */ struct txp_rx_desc { - volatile u_int8_t rx_flags; /* type/descriptor flags */ - volatile u_int8_t rx_numdesc; /* number of descriptors */ - volatile u_int16_t rx_len; /* frame length */ + volatile uint8_t rx_flags; /* type/descriptor flags */ + volatile uint8_t rx_numdesc; /* number of descriptors */ + volatile uint16_t rx_len; /* frame length */ #ifdef notdef - volatile u_int32_t rx_vaddrlo; /* virtual address, lo word */ - volatile u_int32_t rx_vaddrhi; /* virtual address, hi word */ + volatile uint32_t rx_vaddrlo; /* virtual address, lo word */ + volatile uint32_t rx_vaddrhi; /* virtual address, hi word */ #endif union { struct txp_swdesc *rx_sd; - u_int64_t rx_dummy; + uint64_t rx_dummy; } txp_rx_u; - volatile u_int32_t rx_stat; /* status */ - volatile u_int16_t rx_filter; /* filter status */ - volatile u_int16_t rx_hash; /* hash status */ - volatile u_int32_t rx_vlan; /* vlan tag/priority */ + volatile uint32_t rx_stat; /* status */ + volatile uint16_t rx_filter; /* filter status */ + volatile uint16_t rx_hash; /* hash status */ + volatile uint32_t rx_vlan; /* vlan tag/priority */ }; #define rx_sd txp_rx_u.rx_sd @@ -316,15 +316,15 @@ struct txp_rx_desc { struct txp_rxbuf_desc { - volatile u_int32_t rb_paddrlo; - volatile u_int32_t rb_paddrhi; + volatile uint32_t rb_paddrlo; + volatile uint32_t rb_paddrhi; #ifdef notdef - volatile u_int32_t rb_vaddrlo; - volatile u_int32_t rb_vaddrhi; + volatile uint32_t rb_vaddrlo; + volatile uint32_t rb_vaddrhi; #endif union { struct txp_swdesc *rb_sd; - u_int64_t rb_dummy; + uint64_t rb_dummy; } txp_rb_u; }; @@ -332,20 +332,20 @@ struct txp_rxbuf_desc { /* Extension descriptor */ struct txp_ext_desc { - volatile u_int32_t ext_1; - volatile u_int32_t ext_2; - volatile u_int32_t ext_3; - volatile u_int32_t ext_4; + volatile uint32_t ext_1; + volatile uint32_t ext_2; + volatile uint32_t ext_3; + volatile uint32_t ext_4; }; struct txp_cmd_desc { - volatile u_int8_t cmd_flags; - volatile u_int8_t cmd_numdesc; - volatile u_int16_t cmd_id; - volatile u_int16_t cmd_seq; - volatile u_int16_t cmd_par1; - volatile u_int32_t cmd_par2; - volatile u_int32_t cmd_par3; + volatile uint8_t cmd_flags; + volatile uint8_t cmd_numdesc; + volatile uint16_t cmd_id; + volatile uint16_t cmd_seq; + volatile uint16_t cmd_par1; + volatile uint32_t cmd_par2; + volatile uint32_t cmd_par3; }; #define CMD_FLAGS_TYPE_M 0x07 /* type mask */ #define CMD_FLAGS_TYPE_FRAG 0x00 /* type: fragment */ @@ -358,13 +358,13 @@ struct txp_cmd_desc { #define CMD_FLAGS_VALID 0x80 /* valid descriptor */ struct txp_rsp_desc { - volatile u_int8_t rsp_flags; - volatile u_int8_t rsp_numdesc; - volatile u_int16_t rsp_id; - volatile u_int16_t rsp_seq; - volatile u_int16_t rsp_par1; - volatile u_int32_t rsp_par2; - volatile u_int32_t rsp_par3; + volatile uint8_t rsp_flags; + volatile uint8_t rsp_numdesc; + volatile uint16_t rsp_id; + volatile uint16_t rsp_seq; + volatile uint16_t rsp_par1; + volatile uint32_t rsp_par2; + volatile uint32_t rsp_par3; }; #define RSP_FLAGS_TYPE_M 0x07 /* type mask */ #define RSP_FLAGS_TYPE_FRAG 0x00 /* type: fragment */ @@ -376,12 +376,12 @@ struct txp_rsp_desc { #define RSP_FLAGS_ERROR 0x40 /* response error */ struct txp_frag_desc { - volatile u_int8_t frag_flags; /* type/descriptor flags */ - volatile u_int8_t frag_rsvd1; - volatile u_int16_t frag_len; /* bytes in this fragment */ - volatile u_int32_t frag_addrlo; /* phys addr low word */ - volatile u_int32_t frag_addrhi; /* phys addr high word */ - volatile u_int32_t frag_rsvd2; + volatile uint8_t frag_flags; /* type/descriptor flags */ + volatile uint8_t frag_rsvd1; + volatile uint16_t frag_len; /* bytes in this fragment */ + volatile uint32_t frag_addrlo; /* phys addr low word */ + volatile uint32_t frag_addrhi; /* phys addr high word */ + volatile uint32_t frag_rsvd2; }; #define FRAG_FLAGS_TYPE_M 0x07 /* type mask */ #define FRAG_FLAGS_TYPE_FRAG 0x00 /* type: fragment */ @@ -392,44 +392,44 @@ struct txp_frag_desc { #define FRAG_FLAGS_TYPE_RESP 0x05 /* type: response */ struct txp_opt_desc { - u_int8_t opt_desctype:3, + uint8_t opt_desctype:3, opt_rsvd:1, opt_type:4; - u_int8_t opt_num; - u_int16_t opt_dep1; - u_int32_t opt_dep2; - u_int32_t opt_dep3; - u_int32_t opt_dep4; + uint8_t opt_num; + uint16_t opt_dep1; + uint32_t opt_dep2; + uint32_t opt_dep3; + uint32_t opt_dep4; }; struct txp_ipsec_desc { - u_int8_t ipsec_desctpe:3, + uint8_t ipsec_desctpe:3, ipsec_rsvd:1, ipsec_type:4; - u_int8_t ipsec_num; - u_int16_t ipsec_flags; - u_int16_t ipsec_ah1; - u_int16_t ipsec_esp1; - u_int16_t ipsec_ah2; - u_int16_t ipsec_esp2; - u_int32_t ipsec_rsvd1; + uint8_t ipsec_num; + uint16_t ipsec_flags; + uint16_t ipsec_ah1; + uint16_t ipsec_esp1; + uint16_t ipsec_ah2; + uint16_t ipsec_esp2; + uint32_t ipsec_rsvd1; }; struct txp_tcpseg_desc { - u_int8_t tcpseg_desctype:3, + uint8_t tcpseg_desctype:3, tcpseg_rsvd:1, tcpseg_type:4; - u_int8_t tcpseg_num; + uint8_t tcpseg_num; - u_int16_t tcpseg_mss:12, + uint16_t tcpseg_mss:12, tcpseg_misc:4; - u_int32_t tcpseg_respaddr; - u_int32_t tcpseg_txbytes; - u_int32_t tcpseg_lss; + uint32_t tcpseg_respaddr; + uint32_t tcpseg_txbytes; + uint32_t tcpseg_lss; }; /* @@ -463,48 +463,48 @@ struct txp_tcpseg_desc { * boot record (pointers to rings) */ struct txp_boot_record { - volatile u_int32_t br_hostvar_lo; /* host ring pointer */ - volatile u_int32_t br_hostvar_hi; - volatile u_int32_t br_txlopri_lo; /* tx low pri ring */ - volatile u_int32_t br_txlopri_hi; - volatile u_int32_t br_txlopri_siz; - volatile u_int32_t br_txhipri_lo; /* tx high pri ring */ - volatile u_int32_t br_txhipri_hi; - volatile u_int32_t br_txhipri_siz; - volatile u_int32_t br_rxlopri_lo; /* rx low pri ring */ - volatile u_int32_t br_rxlopri_hi; - volatile u_int32_t br_rxlopri_siz; - volatile u_int32_t br_rxbuf_lo; /* rx buffer ring */ - volatile u_int32_t br_rxbuf_hi; - volatile u_int32_t br_rxbuf_siz; - volatile u_int32_t br_cmd_lo; /* command ring */ - volatile u_int32_t br_cmd_hi; - volatile u_int32_t br_cmd_siz; - volatile u_int32_t br_resp_lo; /* response ring */ - volatile u_int32_t br_resp_hi; - volatile u_int32_t br_resp_siz; - volatile u_int32_t br_zero_lo; /* zero word */ - volatile u_int32_t br_zero_hi; - volatile u_int32_t br_rxhipri_lo; /* rx high pri ring */ - volatile u_int32_t br_rxhipri_hi; - volatile u_int32_t br_rxhipri_siz; + volatile uint32_t br_hostvar_lo; /* host ring pointer */ + volatile uint32_t br_hostvar_hi; + volatile uint32_t br_txlopri_lo; /* tx low pri ring */ + volatile uint32_t br_txlopri_hi; + volatile uint32_t br_txlopri_siz; + volatile uint32_t br_txhipri_lo; /* tx high pri ring */ + volatile uint32_t br_txhipri_hi; + volatile uint32_t br_txhipri_siz; + volatile uint32_t br_rxlopri_lo; /* rx low pri ring */ + volatile uint32_t br_rxlopri_hi; + volatile uint32_t br_rxlopri_siz; + volatile uint32_t br_rxbuf_lo; /* rx buffer ring */ + volatile uint32_t br_rxbuf_hi; + volatile uint32_t br_rxbuf_siz; + volatile uint32_t br_cmd_lo; /* command ring */ + volatile uint32_t br_cmd_hi; + volatile uint32_t br_cmd_siz; + volatile uint32_t br_resp_lo; /* response ring */ + volatile uint32_t br_resp_hi; + volatile uint32_t br_resp_siz; + volatile uint32_t br_zero_lo; /* zero word */ + volatile uint32_t br_zero_hi; + volatile uint32_t br_rxhipri_lo; /* rx high pri ring */ + volatile uint32_t br_rxhipri_hi; + volatile uint32_t br_rxhipri_siz; }; /* * hostvar structure (shared with typhoon) */ struct txp_hostvar { - volatile u_int32_t hv_rx_hi_read_idx; /* host->arm */ - volatile u_int32_t hv_rx_lo_read_idx; /* host->arm */ - volatile u_int32_t hv_rx_buf_write_idx; /* host->arm */ - volatile u_int32_t hv_resp_read_idx; /* host->arm */ - volatile u_int32_t hv_tx_lo_desc_read_idx; /* arm->host */ - volatile u_int32_t hv_tx_hi_desc_read_idx; /* arm->host */ - volatile u_int32_t hv_rx_lo_write_idx; /* arm->host */ - volatile u_int32_t hv_rx_buf_read_idx; /* arm->host */ - volatile u_int32_t hv_cmd_read_idx; /* arm->host */ - volatile u_int32_t hv_resp_write_idx; /* arm->host */ - volatile u_int32_t hv_rx_hi_write_idx; /* arm->host */ + volatile uint32_t hv_rx_hi_read_idx; /* host->arm */ + volatile uint32_t hv_rx_lo_read_idx; /* host->arm */ + volatile uint32_t hv_rx_buf_write_idx; /* host->arm */ + volatile uint32_t hv_resp_read_idx; /* host->arm */ + volatile uint32_t hv_tx_lo_desc_read_idx; /* arm->host */ + volatile uint32_t hv_tx_hi_desc_read_idx; /* arm->host */ + volatile uint32_t hv_rx_lo_write_idx; /* arm->host */ + volatile uint32_t hv_rx_buf_read_idx; /* arm->host */ + volatile uint32_t hv_cmd_read_idx; /* arm->host */ + volatile uint32_t hv_resp_write_idx; /* arm->host */ + volatile uint32_t hv_rx_hi_write_idx; /* arm->host */ }; /* @@ -546,23 +546,23 @@ struct txp_hostvar { struct txp_cmd_ring { struct txp_cmd_desc *base; - u_int32_t lastwrite; - u_int32_t size; + uint32_t lastwrite; + uint32_t size; }; struct txp_rsp_ring { struct txp_rsp_desc *base; - u_int32_t lastwrite; - u_int32_t size; + uint32_t lastwrite; + uint32_t size; }; struct txp_tx_ring { struct txp_tx_desc *r_desc; /* base address of descs */ - u_int32_t r_reg; /* register to activate */ - u_int32_t r_prod; /* producer */ - u_int32_t r_cons; /* consumer */ - u_int32_t r_cnt; /* # descs in use */ - volatile u_int32_t *r_off; /* hostvar index pointer */ + uint32_t r_reg; /* register to activate */ + uint32_t r_prod; /* producer */ + uint32_t r_cons; /* consumer */ + uint32_t r_cnt; /* # descs in use */ + volatile uint32_t *r_off; /* hostvar index pointer */ }; struct txp_swdesc { @@ -572,8 +572,8 @@ struct txp_swdesc { struct txp_rx_ring { struct txp_rx_desc *r_desc; /* base address of descs */ - volatile u_int32_t *r_roff; /* hv read offset ptr */ - volatile u_int32_t *r_woff; /* hv write offset ptr */ + volatile uint32_t *r_roff; /* hv read offset ptr */ + volatile uint32_t *r_woff; /* hv write offset ptr */ }; struct txp_ldata { @@ -586,7 +586,7 @@ struct txp_ldata { struct txp_rx_desc txp_rxloring[RX_ENTRIES]; struct txp_cmd_desc txp_cmdring[CMD_ENTRIES]; struct txp_rsp_desc txp_rspring[RSP_ENTRIES]; - u_int32_t txp_zero; + uint32_t txp_zero; }; struct txp_softc { @@ -611,25 +611,25 @@ struct txp_softc { struct txp_tx_ring sc_txhir, sc_txlor; struct txp_rxbuf_desc *sc_rxbufs; struct txp_rx_ring sc_rxhir, sc_rxlor; - u_int16_t sc_xcvr; - u_int16_t sc_seq; + uint16_t sc_xcvr; + uint16_t sc_seq; int sc_cold; - u_int32_t sc_rx_capability, sc_tx_capability; + uint32_t sc_rx_capability, sc_tx_capability; }; struct txp_fw_file_header { - u_int8_t magicid[8]; /* TYPHOON\0 */ - u_int32_t version; - u_int32_t nsections; - u_int32_t addr; - u_int32_t hmac[5]; + uint8_t magicid[8]; /* TYPHOON\0 */ + uint32_t version; + uint32_t nsections; + uint32_t addr; + uint32_t hmac[5]; }; struct txp_fw_section_header { - u_int32_t nbytes; - u_int16_t cksum; - u_int16_t reserved; - u_int32_t addr; + uint32_t nbytes; + uint16_t cksum; + uint16_t reserved; + uint32_t addr; }; #define TXP_MAX_SEGLEN 0xffff @@ -660,7 +660,7 @@ struct txp_fw_section_header { #define TXP_DEVICEID_3CR990B_SRV 0x990A struct txp_type { - u_int16_t txp_vid; - u_int16_t txp_did; + uint16_t txp_vid; + uint16_t txp_did; char *txp_name; }; From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 06:21:36 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12F70106564A; Sun, 22 Mar 2009 06:21:36 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F38648FC08; Sun, 22 Mar 2009 06:21:35 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2M6LZa0059229; Sun, 22 Mar 2009 06:21:35 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2M6LZHe059227; Sun, 22 Mar 2009 06:21:35 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903220621.n2M6LZHe059227@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 22 Mar 2009 06:21:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190246 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/txp 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, 22 Mar 2009 06:21:36 -0000 Author: yongari Date: Sun Mar 22 06:21:35 2009 New Revision: 190246 URL: http://svn.freebsd.org/changeset/base/190246 Log: MFC r189690: Replace local CRC32 routine with ether_crc32_be(). This should have happened long time ago. Also simplify Rx filter logic. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/txp/if_txp.c stable/7/sys/dev/txp/if_txpreg.h Modified: stable/7/sys/dev/txp/if_txp.c ============================================================================== --- stable/7/sys/dev/txp/if_txp.c Sun Mar 22 06:16:44 2009 (r190245) +++ stable/7/sys/dev/txp/if_txp.c Sun Mar 22 06:21:35 2009 (r190246) @@ -1721,60 +1721,44 @@ txp_show_descriptor(void *d) static void txp_set_filter(struct txp_softc *sc) { - struct ifnet *ifp = sc->sc_ifp; - uint32_t crc, carry, hashbit, hash[2]; + struct ifnet *ifp; + uint32_t crc, mchash[2]; uint16_t filter; - uint8_t octet; - int i, j, mcnt = 0; struct ifmultiaddr *ifma; - char *enm; + int mcnt; - if (ifp->if_flags & IFF_PROMISC) { - filter = TXP_RXFILT_PROMISC; - goto setit; - } + TXP_LOCK_ASSERT(sc); + ifp = sc->sc_ifp; filter = TXP_RXFILT_DIRECT; - - if (ifp->if_flags & IFF_BROADCAST) + if ((ifp->if_flags & IFF_BROADCAST) != 0) filter |= TXP_RXFILT_BROADCAST; + if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) { + if ((ifp->if_flags & IFF_ALLMULTI) != 0) + filter |= TXP_RXFILT_ALLMULTI; + if ((ifp->if_flags & IFF_PROMISC) != 0) + filter = TXP_RXFILT_PROMISC; + goto setit; + } - if (ifp->if_flags & IFF_ALLMULTI) - filter |= TXP_RXFILT_ALLMULTI; - else { - hash[0] = hash[1] = 0; - - IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - enm = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - mcnt++; - crc = 0xffffffff; - - for (i = 0; i < ETHER_ADDR_LEN; i++) { - octet = enm[i]; - for (j = 0; j < 8; j++) { - carry = ((crc & 0x80000000) ? 1 : 0) ^ - (octet & 1); - crc <<= 1; - octet >>= 1; - if (carry) - crc = (crc ^ TXP_POLYNOMIAL) | - carry; - } - } - hashbit = (uint16_t)(crc & (64 - 1)); - hash[hashbit / 32] |= (1 << hashbit % 32); - } - IF_ADDR_UNLOCK(ifp); - - if (mcnt > 0) { - filter |= TXP_RXFILT_HASHMULTI; - txp_command(sc, TXP_CMD_MCAST_HASH_MASK_WRITE, - 2, hash[0], hash[1], NULL, NULL, NULL, 0); - } + mchash[0] = mchash[1] = 0; + mcnt = 0; + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) + ifma->ifma_addr), ETHER_ADDR_LEN); + crc &= 0x3f; + mchash[crc >> 5] |= 1 << (crc & 0x1f); + mcnt++; + } + IF_ADDR_UNLOCK(ifp); + + if (mcnt > 0) { + filter |= TXP_RXFILT_HASHMULTI; + txp_command(sc, TXP_CMD_MCAST_HASH_MASK_WRITE, 2, mchash[0], + mchash[1], NULL, NULL, NULL, 0); } setit: Modified: stable/7/sys/dev/txp/if_txpreg.h ============================================================================== --- stable/7/sys/dev/txp/if_txpreg.h Sun Mar 22 06:16:44 2009 (r190245) +++ stable/7/sys/dev/txp/if_txpreg.h Sun Mar 22 06:21:35 2009 (r190246) @@ -456,9 +456,6 @@ struct txp_tcpseg_desc { #define TXP_RXFILT_PROMISC 0x0008 /* promiscuous mode */ #define TXP_RXFILT_HASHMULTI 0x0010 /* use multicast filter */ -/* multicast polynomial */ -#define TXP_POLYNOMIAL 0x04c11db7 - /* * boot record (pointers to rings) */ From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 06:26:48 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D40C106566C; Sun, 22 Mar 2009 06:26:48 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 083E28FC16; Sun, 22 Mar 2009 06:26:48 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2M6QlRx059390; Sun, 22 Mar 2009 06:26:47 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2M6Qlq4059388; Sun, 22 Mar 2009 06:26:47 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903220626.n2M6Qlq4059388@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 22 Mar 2009 06:26: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: r190247 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/txp 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, 22 Mar 2009 06:26:48 -0000 Author: yongari Date: Sun Mar 22 06:26:47 2009 New Revision: 190247 URL: http://svn.freebsd.org/changeset/base/190247 Log: MFC r189714: bus_dma(9) conversion and make txp(4) work on all architectures. o Header file cleanup. o bus_dma(9) conversion. - Removed all consumers of vtophys(9) and converted to use bus_dma(9). - Typhoon2 functional specification says the controller supports 64bit DMA addressing. However all Typhoon controllers are known to lack of DAC support so 64bit DMA support was disabled. - The hardware can't handle more 16 fragmented Tx DMA segments so teach txp(4) to collapse these segments to be less than 16. - Added Rx buffer alignment requirements(4 bytes alignment) and implemented fixup code to align receive frame. Previously txp(4) always copied Rx frame to align it on 2 byte boundary but its copy overhead is much higher than unaligned access on i386/amd64. Alignment fixup code is now applied only for strict-alignment architectures. With this change i386 and amd64 will get instant Rx performance boost. Typhoon2 datasheet mentions a command that pads arbitrary bytes in Rx buffer but that command does not work. - Nuked pointer trick in descriptor ring. This does not work on sparc64 and replaced it with bcopy. Alternatively txp(4) can embed a 32 bits index value into the descriptor and compute real buffer address but it may make code complicated. - Added endianness support code in various Tx/Rx/command/response descriptor access. With this change txp(4) should work on all architectures. o Added comments for known firmware bugs(Tx checksum offloading, TSO, VLAN stripping and Rx buffer padding control). o Prefer faster memory space register access to I/O space access. Added fall-back mechanism to use alternative I/O space access. The hardware supports both memory and I/O mapped access. Users can still force to use old I/O space access by setting hw.txp.prefer_iomap tunable to 1 in /boot/loader.conf. o Added experimental suspend/resume methods. o Nuke error prone Rx buffer handling code and implemented local buffer management with TAILQ. Be definition the controller can't pass the last received frame to host if no Rx free buffers are available to use as head and tail pointer of Rx descriptor ring can't have the same value. In that case the Rx buffer pointer in Rx buffer ring still holds a valid buffer and txp_rxbuf_reclaim() can't fill Rx buffers as the first buffer is still valid. Instead of relying on the value of Rx buffer ring, introduce local buffer management code to handle empty buffer situation. This should fix a long standing bug which completely hangs the controller under high network load. I could easily trigger the issue by sending 64 bytes UDP frames with netperf. I have no idea how this bugs was not fixed for a long time. o Converted ithread interrupt handler to filter based one. o Rearranged txp_detach routine such that it's now used for general clean-up routine. o Show sleep image version on device attach time. This will help to know what action should be taken depending on sleep image version. The version information in datasheet was wrong for newer NV images so I followed Linux which seems to correctly extract version numbers from response descriptors. o Firmware image is no longer downloaded in device attach time. Now it is reloaded whenever if_init is invoked. This is to ensure correct operation of hardware when something goes wrong. Previously the controller always run without regard to running state of firmware. This change will add additional controller initialization time but it give more robust operation as txp(4) always start off from a known state. The controller is put into sleep state until administrator explicitly up the interface. o As firmware is loaded in if_init handler, it's now possible to implement real watchdog timeout handler. When watchdog timer is expired, full-reset the controller and initialize the hardware again as most other drivers do. While I'm here use our own timer for watchdog instead of using if_watchdog/if_timer interface. o Instead of masking specific interrupts with TXP_IMR register, program TXP_IER register with the interrupts to be raised and use TXP_IMR to toggle interrupt generation. o Implemented txp_wait() to wait a specific state of a controller. o Separate boot related code from txp_download_fw() and name it txp_boot() to handle boot process. o Added bus_barrier(9) to host to ARM communication. o Added endianness to all typhoon command processing. The ARM93C always expects little-endian format of command/data. o Removed __STRICT_ALIGNMENT which is not valid on FreeBSD. __NO_STRICT_ALIGNMENT is provided for that purpose on FreeBSD. Previously __STRICT_ALIGNMENT was unconditionally defined for all architectures. o Rewrote SIOCSIFCAP ioctl handler such that each capability can be controlled by ifconfig(8). Note, disabling VLAN hardware tagging has no effect due to the bug of firmware. o Don't send TXP_CMD_CLEAR_STATISTICS to clear MAC statistics in txp_tick(). The command is not atomic. Instead, just read the statistics and reflect saved statistics to the statistics. dev.txp.%d.stats sysctl node provides detailed MAC statistics. This also reduces a lot of waste of CPU cycles as processing a command ring takes a very long time on ARM93C. Note, Rx multicast and broadcast statistics does not seem to right. It might be another bug of firmware. o Implemented link state change handling in txp_tick(). Now sending packets is allowed only after establishing a valid link. Also invoke link state change notification whenever its state is changed so pseudo drivers like lagg(4) that relies on link state can work with failover or link aggregation without hacks. if_baudrate is updated to resolved speed so SNMP agents can get correct bandwidth parameters. o Overhauled Tx routine such that it now honors number of allowable DMA segments and checks for 4 free descriptors before trying to send a frame. A frame may require 4 descriptors(1 frame descriptor, 1 or more frame descriptors, 1 TSO option descriptor, one free descriptor to prevent descriptor wrap-around) at least so it's necessary to check available free descriptors prior to setting up DMA operation. o Added a sysctl variable dev.txp.%d.process_limit to control how many received frames should be served in Rx handler. Valid ranges are 16 to 128(default 64) in unit of frames. o Added ALTQ(4) support. o Added missing IFCAP_VLAN_HWCSUM as txp(4) can offload checksum calculation as well as VLAN tag insertion/stripping. o Fixed media header length for VLAN. o Don't set if_mtu in device attach, it's already set in ether_ifattach(). o Enabled MWI. o Fixed module unload panic when bpf listeners are active. o Rearranged ethernet address programming logic such that it works on strict-alignment architectures. o Removed unused member variables in softc. o Added support for WOL. o Removed now unused TXP_PCI_LOMEM/TXP_PCI_LOIO. o Added wakeup command TXP_BOOTCMD_WAKEUP definition. o Added a new firmware version query command, TXP_CMD_READ_VERSION. o Removed volatile keyword in softc as bus_dmamap_sync(9) should take care of this. o Removed embedded union trick of a structure used to to access a pointer on LP64 systems. o Added a few TSO related definitions for struct txp_tcpseg_desc. However TSO is not used at all due to the limitation of hardware. o Redefined PKT_MAX_PKTLEN to theoretical maximum size of a frame. o Switched from bus_space_{read|write}_4 to bus_{read|write}_4. o Added a new macro TXP_DESC_INC to compute next descriptor index. Tested by: don.nasco <> gmail dot com Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/txp/if_txp.c stable/7/sys/dev/txp/if_txpreg.h Modified: stable/7/sys/dev/txp/if_txp.c ============================================================================== --- stable/7/sys/dev/txp/if_txp.c Sun Mar 22 06:21:35 2009 (r190246) +++ stable/7/sys/dev/txp/if_txp.c Sun Mar 22 06:26:47 2009 (r190247) @@ -42,53 +42,82 @@ __FBSDID("$FreeBSD$"); */ #include #include -#include -#include -#include +#include +#include #include +#include +#include +#include #include +#include +#include +#include #include +#include +#include +#include +#include #include #include #include #include +#include #include #include #include #include -#include #include -#include -#include - -#include - -#include - -#include /* for vtophys */ -#include /* for vtophys */ -#include -#include -#include -#include #include -#include + #include #include -#define TXP_USEIOSPACE -#define __STRICT_ALIGNMENT +#include +#include #include #include -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif +MODULE_DEPEND(txp, pci, 1, 1, 1); +MODULE_DEPEND(txp, ether, 1, 1, 1); + +/* + * XXX Known Typhoon firmware issues. + * + * 1. It seems that firmware has Tx TCP/UDP checksum offloading bug. + * The firmware hangs when it's told to compute TCP/UDP checksum. + * I'm not sure whether the firmware requires special alignment to + * do checksum offloading but datasheet says nothing about that. + * 2. Datasheet says nothing for maximum number of fragmented + * descriptors supported. Experimentation shows up to 16 fragment + * descriptors are supported in the firmware. For TSO case, upper + * stack can send 64KB sized IP datagram plus link header size( + * ethernet header + VLAN tag) frame but controller can handle up + * to 64KB frame given that PAGE_SIZE is 4KB(i.e. 16 * PAGE_SIZE). + * Because frames that need TSO operation of hardware can be + * larger than 64KB I disabled TSO capability. TSO operation for + * less than or equal to 16 fragment descriptors works without + * problems, though. + * 3. VLAN hardware tag stripping is always enabled in the firmware + * even if it's explicitly told to not strip the tag. It's + * possible to add the tag back in Rx handler if VLAN hardware + * tag is not active but I didn't try that as it would be + * layering violation. + * 4. TXP_CMD_RECV_BUFFER_CONTROL does not work as expected in + * datasheet such that driver should handle the alignment + * restriction by copying received frame to align the frame on + * 32bit boundary on strict-alignment architectures. This adds a + * lot of CPU burden and it effectively reduce Rx performance on + * strict-alignment architectures(e.g. sparc64, arm, mips and ia64). + * + * Unfortunately it seems that 3Com have no longer interests in + * releasing fixed firmware so we may have to live with these bugs. + */ + +#define TXP_CSUM_FEATURES (CSUM_IP) /* * Various supported device vendors/types and their names. @@ -112,25 +141,36 @@ static struct txp_type txp_devs[] = { static int txp_probe(device_t); static int txp_attach(device_t); static int txp_detach(device_t); -static void txp_intr(void *); -static void txp_tick(void *); static int txp_shutdown(device_t); +static int txp_suspend(device_t); +static int txp_resume(device_t); +static int txp_intr(void *); +static void txp_int_task(void *, int); +static void txp_tick(void *); static int txp_ioctl(struct ifnet *, u_long, caddr_t); static void txp_start(struct ifnet *); static void txp_start_locked(struct ifnet *); +static int txp_encap(struct txp_softc *, struct txp_tx_ring *, struct mbuf **); static void txp_stop(struct txp_softc *); static void txp_init(void *); static void txp_init_locked(struct txp_softc *); -static void txp_watchdog(struct ifnet *); +static void txp_watchdog(struct txp_softc *); -static void txp_release_resources(struct txp_softc *); -static int txp_chip_init(struct txp_softc *); -static int txp_reset_adapter(struct txp_softc *); +static int txp_reset(struct txp_softc *); +static int txp_boot(struct txp_softc *, uint32_t); +static int txp_sleep(struct txp_softc *, int); +static int txp_wait(struct txp_softc *, uint32_t); static int txp_download_fw(struct txp_softc *); static int txp_download_fw_wait(struct txp_softc *); static int txp_download_fw_section(struct txp_softc *, struct txp_fw_section_header *, int); static int txp_alloc_rings(struct txp_softc *); +static void txp_init_rings(struct txp_softc *); +static int txp_dma_alloc(struct txp_softc *, char *, bus_dma_tag_t *, + bus_size_t, bus_size_t, bus_dmamap_t *, void **, bus_size_t, bus_addr_t *); +static void txp_dma_free(struct txp_softc *, bus_dma_tag_t *, bus_dmamap_t *, + void **); +static void txp_free_rings(struct txp_softc *); static int txp_rxring_fill(struct txp_softc *); static void txp_rxring_empty(struct txp_softc *); static void txp_set_filter(struct txp_softc *); @@ -138,14 +178,14 @@ static void txp_set_filter(struct txp_so static int txp_cmd_desc_numfree(struct txp_softc *); static int txp_command(struct txp_softc *, uint16_t, uint16_t, uint32_t, uint32_t, uint16_t *, uint32_t *, uint32_t *, int); -static int txp_command2(struct txp_softc *, uint16_t, uint16_t, +static int txp_ext_command(struct txp_softc *, uint16_t, uint16_t, uint32_t, uint32_t, struct txp_ext_desc *, uint8_t, struct txp_rsp_desc **, int); -static int txp_response(struct txp_softc *, uint32_t, uint16_t, uint16_t, +static int txp_response(struct txp_softc *, uint16_t, uint16_t, struct txp_rsp_desc **); static void txp_rsp_fixup(struct txp_softc *, struct txp_rsp_desc *, struct txp_rsp_desc *); -static void txp_capabilities(struct txp_softc *); +static int txp_set_capabilities(struct txp_softc *); static void txp_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int txp_ifmedia_upd(struct ifnet *); @@ -154,15 +194,18 @@ static void txp_show_descriptor(void *); #endif static void txp_tx_reclaim(struct txp_softc *, struct txp_tx_ring *); static void txp_rxbuf_reclaim(struct txp_softc *); -static void txp_rx_reclaim(struct txp_softc *, struct txp_rx_ring *); - -#ifdef TXP_USEIOSPACE -#define TXP_RES SYS_RES_IOPORT -#define TXP_RID TXP_PCI_LOIO -#else -#define TXP_RES SYS_RES_MEMORY -#define TXP_RID TXP_PCI_LOMEM +#ifndef __NO_STRICT_ALIGNMENT +static __inline void txp_fixup_rx(struct mbuf *); #endif +static int txp_rx_reclaim(struct txp_softc *, struct txp_rx_ring *, int); +static void txp_stats_save(struct txp_softc *); +static void txp_stats_update(struct txp_softc *, struct txp_rsp_desc *); +static void txp_sysctl_node(struct txp_softc *); +static int sysctl_int_range(SYSCTL_HANDLER_ARGS, int, int); +static int sysctl_hw_txp_proc_limit(SYSCTL_HANDLER_ARGS); + +static int prefer_iomap = 0; +TUNABLE_INT("hw.txp.prefer_iomap", &prefer_iomap); static device_method_t txp_methods[] = { /* Device interface */ @@ -170,7 +213,10 @@ static device_method_t txp_methods[] = { DEVMETHOD(device_attach, txp_attach), DEVMETHOD(device_detach, txp_detach), DEVMETHOD(device_shutdown, txp_shutdown), - { 0, 0 } + DEVMETHOD(device_suspend, txp_suspend), + DEVMETHOD(device_resume, txp_resume), + + { NULL, NULL } }; static driver_t txp_driver = { @@ -182,8 +228,6 @@ static driver_t txp_driver = { static devclass_t txp_devclass; DRIVER_MODULE(txp, pci, txp_driver, txp_devclass, 0, 0); -MODULE_DEPEND(txp, pci, 1, 1, 1); -MODULE_DEPEND(txp, ether, 1, 1, 1); static int txp_probe(device_t dev) @@ -209,36 +253,65 @@ txp_attach(device_t dev) { struct txp_softc *sc; struct ifnet *ifp; + struct txp_rsp_desc *rsp; uint16_t p1; - uint32_t p2; - int error = 0, rid; - u_char eaddr[6]; + uint32_t p2, reg; + int error = 0, pmc, rid; + uint8_t eaddr[ETHER_ADDR_LEN], *ver; sc = device_get_softc(dev); sc->sc_dev = dev; - sc->sc_cold = 1; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); + TASK_INIT(&sc->sc_int_task, 0, txp_int_task, sc); + TAILQ_INIT(&sc->sc_busy_list); + TAILQ_INIT(&sc->sc_free_list); - /* - * Map control/status registers. - */ - pci_enable_busmaster(dev); - - rid = TXP_RID; - sc->sc_res = bus_alloc_resource_any(dev, TXP_RES, &rid, - RF_ACTIVE); + ifmedia_init(&sc->sc_ifmedia, 0, txp_ifmedia_upd, txp_ifmedia_sts); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_10_T, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_10_T | IFM_HDX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_10_T | IFM_FDX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_100_TX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_100_TX | IFM_HDX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_100_TX | IFM_FDX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_AUTO, 0, NULL); + pci_enable_busmaster(dev); + /* Prefer memory space register mapping over IO space. */ + if (prefer_iomap == 0) { + sc->sc_res_id = PCIR_BAR(1); + sc->sc_res_type = SYS_RES_MEMORY; + } else { + sc->sc_res_id = PCIR_BAR(0); + sc->sc_res_type = SYS_RES_IOPORT; + } + sc->sc_res = bus_alloc_resource_any(dev, sc->sc_res_type, + &sc->sc_res_id, RF_ACTIVE); + if (sc->sc_res == NULL && prefer_iomap == 0) { + sc->sc_res_id = PCIR_BAR(0); + sc->sc_res_type = SYS_RES_IOPORT; + sc->sc_res = bus_alloc_resource_any(dev, sc->sc_res_type, + &sc->sc_res_id, RF_ACTIVE); + } if (sc->sc_res == NULL) { device_printf(dev, "couldn't map ports/memory\n"); - error = ENXIO; - goto fail; + ifmedia_removeall(&sc->sc_ifmedia); + mtx_destroy(&sc->sc_mtx); + return (ENXIO); } - sc->sc_bt = rman_get_bustag(sc->sc_res); - sc->sc_bh = rman_get_bushandle(sc->sc_res); + /* Enable MWI. */ + reg = pci_read_config(dev, PCIR_COMMAND, 2); + reg |= PCIM_CMD_MWRICEN; + pci_write_config(dev, PCIR_COMMAND, reg, 2); + /* Check cache line size. */ + reg = pci_read_config(dev, PCIR_CACHELNSZ, 1); + reg <<= 4; + if (reg == 0 || (reg % 16) != 0) + device_printf(sc->sc_dev, + "invalid cache line size : %u\n", reg); /* Allocate interrupt */ rid = 0; @@ -251,112 +324,155 @@ txp_attach(device_t dev) goto fail; } - if (txp_chip_init(sc)) { - error = ENXIO; - goto fail; - } - - sc->sc_fwbuf = contigmalloc(32768, M_DEVBUF, - M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0); - if (sc->sc_fwbuf == NULL) { - device_printf(dev, "no memory for firmware\n"); - error = ENXIO; - goto fail; - } - error = txp_download_fw(sc); - contigfree(sc->sc_fwbuf, 32768, M_DEVBUF); - sc->sc_fwbuf = NULL; - - if (error) + if ((error = txp_alloc_rings(sc)) != 0) goto fail; - - sc->sc_ldata = contigmalloc(sizeof(struct txp_ldata), M_DEVBUF, - M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0); - if (sc->sc_ldata == NULL) { - device_printf(dev, "no memory for descriptor ring\n"); - error = ENXIO; - goto fail; - } - bzero(sc->sc_ldata, sizeof(struct txp_ldata)); - - if (txp_alloc_rings(sc)) { + txp_init_rings(sc); + txp_sysctl_node(sc); + /* Reset controller and make it reload sleep image. */ + if (txp_reset(sc) != 0) { error = ENXIO; goto fail; } - if (txp_command(sc, TXP_CMD_MAX_PKT_SIZE_WRITE, TXP_MAX_PKTLEN, 0, 0, - NULL, NULL, NULL, 1)) { + /* Let controller boot from sleep image. */ + if (txp_boot(sc, STAT_WAITING_FOR_HOST_REQUEST) != 0) { + device_printf(sc->sc_dev, "could not boot sleep image\n"); error = ENXIO; goto fail; } + /* Get station address. */ if (txp_command(sc, TXP_CMD_STATION_ADDRESS_READ, 0, 0, 0, - &p1, &p2, NULL, 1)) { + &p1, &p2, NULL, TXP_CMD_WAIT)) { error = ENXIO; goto fail; } + p1 = le16toh(p1); eaddr[0] = ((uint8_t *)&p1)[1]; eaddr[1] = ((uint8_t *)&p1)[0]; + p2 = le32toh(p2); eaddr[2] = ((uint8_t *)&p2)[3]; eaddr[3] = ((uint8_t *)&p2)[2]; eaddr[4] = ((uint8_t *)&p2)[1]; eaddr[5] = ((uint8_t *)&p2)[0]; - sc->sc_cold = 0; - - ifmedia_init(&sc->sc_ifmedia, 0, txp_ifmedia_upd, txp_ifmedia_sts); - ifmedia_add(&sc->sc_ifmedia, IFM_ETHER|IFM_10_T, 0, NULL); - ifmedia_add(&sc->sc_ifmedia, IFM_ETHER|IFM_10_T|IFM_HDX, 0, NULL); - ifmedia_add(&sc->sc_ifmedia, IFM_ETHER|IFM_10_T|IFM_FDX, 0, NULL); - ifmedia_add(&sc->sc_ifmedia, IFM_ETHER|IFM_100_TX, 0, NULL); - ifmedia_add(&sc->sc_ifmedia, IFM_ETHER|IFM_100_TX|IFM_HDX, 0, NULL); - ifmedia_add(&sc->sc_ifmedia, IFM_ETHER|IFM_100_TX|IFM_FDX, 0, NULL); - ifmedia_add(&sc->sc_ifmedia, IFM_ETHER|IFM_AUTO, 0, NULL); - - sc->sc_xcvr = TXP_XCVR_AUTO; - txp_command(sc, TXP_CMD_XCVR_SELECT, TXP_XCVR_AUTO, 0, 0, - NULL, NULL, NULL, 0); - ifmedia_set(&sc->sc_ifmedia, IFM_ETHER|IFM_AUTO); - ifp = sc->sc_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { - device_printf(dev, "can not if_alloc()\n"); + device_printf(dev, "can not allocate ifnet structure\n"); error = ENOSPC; goto fail; } + + /* + * Show sleep image version information which may help to + * diagnose sleep image specific issues. + */ + rsp = NULL; + if (txp_ext_command(sc, TXP_CMD_READ_VERSION, 0, 0, 0, NULL, 0, + &rsp, TXP_CMD_WAIT)) { + device_printf(dev, "can not read sleep image version\n"); + error = ENXIO; + goto fail; + } + if (rsp->rsp_numdesc == 0) { + p2 = le32toh(rsp->rsp_par2) & 0xFFFF; + device_printf(dev, "Typhoon 1.0 sleep image (2000/%02u/%02u)\n", + p2 >> 8, p2 & 0xFF); + } else if (rsp->rsp_numdesc == 2) { + p2 = le32toh(rsp->rsp_par2); + ver = (uint8_t *)(rsp + 1); + /* + * Even if datasheet says the command returns a NULL + * terminated version string, explicitly terminate + * the string. Given that several bugs of firmware + * I can't trust this simple one. + */ + ver[25] = '\0'; + device_printf(dev, + "Typhoon 1.1+ sleep image %02u.%03u.%03u %s\n", + p2 >> 24, (p2 >> 12) & 0xFFF, p2 & 0xFFF, ver); + } else { + p2 = le32toh(rsp->rsp_par2); + device_printf(dev, + "Unknown Typhoon sleep image version: %u:0x%08x\n", + rsp->rsp_numdesc, p2); + } + if (rsp != NULL) + free(rsp, M_DEVBUF); + + sc->sc_xcvr = TXP_XCVR_AUTO; + txp_command(sc, TXP_CMD_XCVR_SELECT, TXP_XCVR_AUTO, 0, 0, + NULL, NULL, NULL, TXP_CMD_NOWAIT); + ifmedia_set(&sc->sc_ifmedia, IFM_ETHER | IFM_AUTO); + ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = txp_ioctl; ifp->if_start = txp_start; - ifp->if_watchdog = txp_watchdog; ifp->if_init = txp_init; - ifp->if_baudrate = 100000000; - ifp->if_snd.ifq_maxlen = TX_ENTRIES; - ifp->if_hwassist = 0; - txp_capabilities(sc); - + ifp->if_snd.ifq_drv_maxlen = TX_ENTRIES - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); + IFQ_SET_READY(&ifp->if_snd); /* - * Attach us everywhere + * It's possible to read firmware's offload capability but + * we have not downloaded the firmware yet so announce + * working capability here. We're not interested in IPSec + * capability and due to the lots of firmware bug we can't + * advertise the whole capability anyway. */ + ifp->if_capabilities = IFCAP_RXCSUM | IFCAP_TXCSUM; + if (pci_find_extcap(dev, PCIY_PMG, &pmc) == 0) + ifp->if_capabilities |= IFCAP_WOL_MAGIC; + /* Enable all capabilities. */ + ifp->if_capenable = ifp->if_capabilities; + ether_ifattach(ifp, eaddr); + /* VLAN capability setup. */ + ifp->if_capabilities |= IFCAP_VLAN_MTU; + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM; + ifp->if_capenable = ifp->if_capabilities; + /* Tell the upper layer(s) we support long frames. */ + ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); + + WRITE_REG(sc, TXP_IER, TXP_INTR_NONE); + WRITE_REG(sc, TXP_IMR, TXP_INTR_ALL); + + /* Create local taskq. */ + sc->sc_tq = taskqueue_create_fast("txp_taskq", M_WAITOK, + taskqueue_thread_enqueue, &sc->sc_tq); + if (sc->sc_tq == NULL) { + device_printf(dev, "could not create taskqueue.\n"); + ether_ifdetach(ifp); + error = ENXIO; + goto fail; + } + taskqueue_start_threads(&sc->sc_tq, 1, PI_NET, "%s taskq", + device_get_nameunit(sc->sc_dev)); + + /* Put controller into sleep. */ + if (txp_sleep(sc, 0) != 0) { + ether_ifdetach(ifp); + error = ENXIO; + goto fail; + } + error = bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_NET | INTR_MPSAFE, - NULL, txp_intr, sc, &sc->sc_intrhand); + txp_intr, NULL, sc, &sc->sc_intrhand); - if (error) { + if (error != 0) { ether_ifdetach(ifp); - device_printf(dev, "couldn't set up irq\n"); + device_printf(dev, "couldn't set up interrupt handler.\n"); goto fail; } return (0); fail: - txp_release_resources(sc); - mtx_destroy(&sc->sc_mtx); + if (error != 0) + txp_detach(dev); return (error); } @@ -365,101 +481,57 @@ txp_detach(device_t dev) { struct txp_softc *sc; struct ifnet *ifp; - int i; sc = device_get_softc(dev); - ifp = sc->sc_ifp; - TXP_LOCK(sc); - txp_stop(sc); - TXP_UNLOCK(sc); - txp_shutdown(dev); - callout_drain(&sc->sc_tick); + ifp = sc->sc_ifp; + if (device_is_attached(dev)) { + TXP_LOCK(sc); + sc->sc_flags |= TXP_FLAG_DETACH; + txp_stop(sc); + TXP_UNLOCK(sc); + callout_drain(&sc->sc_tick); + taskqueue_drain(sc->sc_tq, &sc->sc_int_task); + ether_ifdetach(ifp); + } + WRITE_REG(sc, TXP_IMR, TXP_INTR_ALL); ifmedia_removeall(&sc->sc_ifmedia); - ether_ifdetach(ifp); - - for (i = 0; i < RXBUF_ENTRIES; i++) - free(sc->sc_rxbufs[i].rb_sd, M_DEVBUF); - - txp_release_resources(sc); - - mtx_destroy(&sc->sc_mtx); - return (0); -} - -static void -txp_release_resources(struct txp_softc *sc) -{ - device_t dev; - - dev = sc->sc_dev; - if (sc->sc_intrhand != NULL) bus_teardown_intr(dev, sc->sc_irq, sc->sc_intrhand); - if (sc->sc_irq != NULL) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq); - if (sc->sc_res != NULL) - bus_release_resource(dev, TXP_RES, TXP_RID, sc->sc_res); - - if (sc->sc_ldata != NULL) - contigfree(sc->sc_ldata, sizeof(struct txp_ldata), M_DEVBUF); - - if (sc->sc_ifp) + bus_release_resource(dev, sc->sc_res_type, sc->sc_res_id, + sc->sc_res); + if (sc->sc_ifp != NULL) { if_free(sc->sc_ifp); -} - -static int -txp_chip_init(struct txp_softc *sc) -{ - /* disable interrupts */ - WRITE_REG(sc, TXP_IER, 0); - WRITE_REG(sc, TXP_IMR, - TXP_INT_SELF | TXP_INT_PCI_TABORT | TXP_INT_PCI_MABORT | - TXP_INT_DMA3 | TXP_INT_DMA2 | TXP_INT_DMA1 | TXP_INT_DMA0 | - TXP_INT_LATCH); - - /* ack all interrupts */ - WRITE_REG(sc, TXP_ISR, TXP_INT_RESERVED | TXP_INT_LATCH | - TXP_INT_A2H_7 | TXP_INT_A2H_6 | TXP_INT_A2H_5 | TXP_INT_A2H_4 | - TXP_INT_SELF | TXP_INT_PCI_TABORT | TXP_INT_PCI_MABORT | - TXP_INT_DMA3 | TXP_INT_DMA2 | TXP_INT_DMA1 | TXP_INT_DMA0 | - TXP_INT_A2H_3 | TXP_INT_A2H_2 | TXP_INT_A2H_1 | TXP_INT_A2H_0); - - if (txp_reset_adapter(sc)) - return (-1); - - /* disable interrupts */ - WRITE_REG(sc, TXP_IER, 0); - WRITE_REG(sc, TXP_IMR, - TXP_INT_SELF | TXP_INT_PCI_TABORT | TXP_INT_PCI_MABORT | - TXP_INT_DMA3 | TXP_INT_DMA2 | TXP_INT_DMA1 | TXP_INT_DMA0 | - TXP_INT_LATCH); - - /* ack all interrupts */ - WRITE_REG(sc, TXP_ISR, TXP_INT_RESERVED | TXP_INT_LATCH | - TXP_INT_A2H_7 | TXP_INT_A2H_6 | TXP_INT_A2H_5 | TXP_INT_A2H_4 | - TXP_INT_SELF | TXP_INT_PCI_TABORT | TXP_INT_PCI_MABORT | - TXP_INT_DMA3 | TXP_INT_DMA2 | TXP_INT_DMA1 | TXP_INT_DMA0 | - TXP_INT_A2H_3 | TXP_INT_A2H_2 | TXP_INT_A2H_1 | TXP_INT_A2H_0); + sc->sc_ifp = NULL; + } + txp_free_rings(sc); + mtx_destroy(&sc->sc_mtx); return (0); } static int -txp_reset_adapter(struct txp_softc *sc) +txp_reset(struct txp_softc *sc) { uint32_t r; int i; + /* Disable interrupts. */ + WRITE_REG(sc, TXP_IER, TXP_INTR_NONE); + WRITE_REG(sc, TXP_IMR, TXP_INTR_ALL); + /* Ack all pending interrupts. */ + WRITE_REG(sc, TXP_ISR, TXP_INTR_ALL); + r = 0; WRITE_REG(sc, TXP_SRR, TXP_SRR_ALL); DELAY(1000); WRITE_REG(sc, TXP_SRR, 0); - /* Should wait max 6 seconds */ + /* Should wait max 6 seconds. */ for (i = 0; i < 6000; i++) { r = READ_REG(sc, TXP_A2H_0); if (r == STAT_WAITING_FOR_HOST_REQUEST) @@ -467,11 +539,55 @@ txp_reset_adapter(struct txp_softc *sc) DELAY(1000); } - if (r != STAT_WAITING_FOR_HOST_REQUEST) { + if (r != STAT_WAITING_FOR_HOST_REQUEST) device_printf(sc->sc_dev, "reset hung\n"); - return (-1); + + WRITE_REG(sc, TXP_IER, TXP_INTR_NONE); + WRITE_REG(sc, TXP_IMR, TXP_INTR_ALL); + WRITE_REG(sc, TXP_ISR, TXP_INTR_ALL); + + /* + * Give more time to complete loading sleep image before + * trying to boot from sleep image. + */ + DELAY(5000); + + return (0); +} + +static int +txp_boot(struct txp_softc *sc, uint32_t state) +{ + + /* See if it's waiting for boot, and try to boot it. */ + if (txp_wait(sc, state) != 0) { + device_printf(sc->sc_dev, "not waiting for boot\n"); + return (ENXIO); + } + + WRITE_REG(sc, TXP_H2A_2, TXP_ADDR_HI(sc->sc_ldata.txp_boot_paddr)); + TXP_BARRIER(sc, TXP_H2A_2, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_1, TXP_ADDR_LO(sc->sc_ldata.txp_boot_paddr)); + TXP_BARRIER(sc, TXP_H2A_1, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_0, TXP_BOOTCMD_REGISTER_BOOT_RECORD); + TXP_BARRIER(sc, TXP_H2A_0, 4, BUS_SPACE_BARRIER_WRITE); + + /* See if it booted. */ + if (txp_wait(sc, STAT_RUNNING) != 0) { + device_printf(sc->sc_dev, "firmware not running\n"); + return (ENXIO); } + /* Clear TX and CMD ring write registers. */ + WRITE_REG(sc, TXP_H2A_1, TXP_BOOTCMD_NULL); + TXP_BARRIER(sc, TXP_H2A_1, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_2, TXP_BOOTCMD_NULL); + TXP_BARRIER(sc, TXP_H2A_2, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_3, TXP_BOOTCMD_NULL); + TXP_BARRIER(sc, TXP_H2A_3, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_0, TXP_BOOTCMD_NULL); + TXP_BARRIER(sc, TXP_H2A_0, 4, BUS_SPACE_BARRIER_WRITE); + return (0); } @@ -480,10 +596,11 @@ txp_download_fw(struct txp_softc *sc) { struct txp_fw_file_header *fileheader; struct txp_fw_section_header *secthead; - int error, sect; - uint32_t r, i, ier, imr; + int sect; + uint32_t error, ier, imr; + + TXP_LOCK_ASSERT(sc); - r = 0; error = 0; ier = READ_REG(sc, TXP_IER); WRITE_REG(sc, TXP_IER, ier | TXP_INT_A2H_0); @@ -491,68 +608,60 @@ txp_download_fw(struct txp_softc *sc) imr = READ_REG(sc, TXP_IMR); WRITE_REG(sc, TXP_IMR, imr | TXP_INT_A2H_0); - for (i = 0; i < 10000; i++) { - r = READ_REG(sc, TXP_A2H_0); - if (r == STAT_WAITING_FOR_HOST_REQUEST) - break; - DELAY(50); - } - if (r != STAT_WAITING_FOR_HOST_REQUEST) { + if (txp_wait(sc, STAT_WAITING_FOR_HOST_REQUEST) != 0) { device_printf(sc->sc_dev, "not waiting for host request\n"); - error = -1; + error = ETIMEDOUT; goto fail; } - /* Ack the status */ + /* Ack the status. */ WRITE_REG(sc, TXP_ISR, TXP_INT_A2H_0); fileheader = (struct txp_fw_file_header *)tc990image; if (bcmp("TYPHOON", fileheader->magicid, sizeof(fileheader->magicid))) { - device_printf(sc->sc_dev, "fw invalid magic\n"); - error = -1; + device_printf(sc->sc_dev, "firmware invalid magic\n"); goto fail; } - /* Tell boot firmware to get ready for image */ - WRITE_REG(sc, TXP_H2A_1, fileheader->addr); - WRITE_REG(sc, TXP_H2A_2, fileheader->hmac[0]); - WRITE_REG(sc, TXP_H2A_3, fileheader->hmac[1]); - WRITE_REG(sc, TXP_H2A_4, fileheader->hmac[2]); - WRITE_REG(sc, TXP_H2A_5, fileheader->hmac[3]); - WRITE_REG(sc, TXP_H2A_6, fileheader->hmac[4]); + /* Tell boot firmware to get ready for image. */ + WRITE_REG(sc, TXP_H2A_1, le32toh(fileheader->addr)); + TXP_BARRIER(sc, TXP_H2A_1, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_2, le32toh(fileheader->hmac[0])); + TXP_BARRIER(sc, TXP_H2A_2, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_3, le32toh(fileheader->hmac[1])); + TXP_BARRIER(sc, TXP_H2A_3, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_4, le32toh(fileheader->hmac[2])); + TXP_BARRIER(sc, TXP_H2A_4, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_5, le32toh(fileheader->hmac[3])); + TXP_BARRIER(sc, TXP_H2A_5, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_6, le32toh(fileheader->hmac[4])); + TXP_BARRIER(sc, TXP_H2A_6, 4, BUS_SPACE_BARRIER_WRITE); WRITE_REG(sc, TXP_H2A_0, TXP_BOOTCMD_RUNTIME_IMAGE); + TXP_BARRIER(sc, TXP_H2A_0, 4, BUS_SPACE_BARRIER_WRITE); if (txp_download_fw_wait(sc)) { - device_printf(sc->sc_dev, "fw wait failed, initial\n"); - error = -1; + device_printf(sc->sc_dev, "firmware wait failed, initial\n"); + error = ETIMEDOUT; goto fail; } secthead = (struct txp_fw_section_header *)(((uint8_t *)tc990image) + sizeof(struct txp_fw_file_header)); - for (sect = 0; sect < fileheader->nsections; sect++) { - - if (txp_download_fw_section(sc, secthead, sect)) { - error = -1; + for (sect = 0; sect < le32toh(fileheader->nsections); sect++) { + if ((error = txp_download_fw_section(sc, secthead, sect)) != 0) goto fail; - } secthead = (struct txp_fw_section_header *) - (((uint8_t *)secthead) + secthead->nbytes + + (((uint8_t *)secthead) + le32toh(secthead->nbytes) + sizeof(*secthead)); } WRITE_REG(sc, TXP_H2A_0, TXP_BOOTCMD_DOWNLOAD_COMPLETE); + TXP_BARRIER(sc, TXP_H2A_0, 4, BUS_SPACE_BARRIER_WRITE); - for (i = 0; i < 10000; i++) { - r = READ_REG(sc, TXP_A2H_0); - if (r == STAT_WAITING_FOR_BOOT) - break; - DELAY(50); - } - if (r != STAT_WAITING_FOR_BOOT) { + if (txp_wait(sc, STAT_WAITING_FOR_BOOT) != 0) { device_printf(sc->sc_dev, "not waiting for boot\n"); - error = -1; + error = ETIMEDOUT; goto fail; } @@ -566,27 +675,26 @@ fail: static int txp_download_fw_wait(struct txp_softc *sc) { - uint32_t i, r; + uint32_t i; - r = 0; - for (i = 0; i < 10000; i++) { - r = READ_REG(sc, TXP_ISR); - if (r & TXP_INT_A2H_0) + TXP_LOCK_ASSERT(sc); + + for (i = 0; i < TXP_TIMEOUT; i++) { + if ((READ_REG(sc, TXP_ISR) & TXP_INT_A2H_0) != 0) break; DELAY(50); } - if (!(r & TXP_INT_A2H_0)) { - device_printf(sc->sc_dev, "fw wait failed comm0\n"); - return (-1); + if (i == TXP_TIMEOUT) { + device_printf(sc->sc_dev, "firmware wait failed comm0\n"); + return (ETIMEDOUT); } WRITE_REG(sc, TXP_ISR, TXP_INT_A2H_0); - r = READ_REG(sc, TXP_A2H_0); - if (r != STAT_WAITING_FOR_SEGMENT) { - device_printf(sc->sc_dev, "fw not waiting for segment\n"); - return (-1); + if (READ_REG(sc, TXP_A2H_0) != STAT_WAITING_FOR_SEGMENT) { + device_printf(sc->sc_dev, "firmware not waiting for segment\n"); + return (ETIMEDOUT); } return (0); } @@ -595,180 +703,262 @@ static int txp_download_fw_section(struct txp_softc *sc, struct txp_fw_section_header *sect, int sectnum) { - vm_offset_t dma; + bus_dma_tag_t sec_tag; + bus_dmamap_t sec_map; + bus_addr_t sec_paddr; + uint8_t *sec_buf; int rseg, err = 0; struct mbuf m; uint16_t csum; - /* Skip zero length sections */ - if (sect->nbytes == 0) + TXP_LOCK_ASSERT(sc); + + /* Skip zero length sections. */ + if (le32toh(sect->nbytes) == 0) return (0); - /* Make sure we aren't past the end of the image */ + /* Make sure we aren't past the end of the image. */ rseg = ((uint8_t *)sect) - ((uint8_t *)tc990image); if (rseg >= sizeof(tc990image)) { - device_printf(sc->sc_dev, "fw invalid section address, " - "section %d\n", sectnum); - return (-1); + device_printf(sc->sc_dev, + "firmware invalid section address, section %d\n", sectnum); + return (EIO); } - /* Make sure this section doesn't go past the end */ - rseg += sect->nbytes; + /* Make sure this section doesn't go past the end. */ + rseg += le32toh(sect->nbytes); if (rseg >= sizeof(tc990image)) { - device_printf(sc->sc_dev, "fw truncated section %d\n", + device_printf(sc->sc_dev, "firmware truncated section %d\n", sectnum); - return (-1); + return (EIO); } - bcopy(((uint8_t *)sect) + sizeof(*sect), sc->sc_fwbuf, sect->nbytes); - dma = vtophys(sc->sc_fwbuf); + sec_tag = NULL; + sec_map = NULL; + sec_buf = NULL; + /* XXX */ + TXP_UNLOCK(sc); + err = txp_dma_alloc(sc, "firmware sections", &sec_tag, sizeof(uint32_t), + 0, &sec_map, (void **)&sec_buf, le32toh(sect->nbytes), &sec_paddr); + TXP_LOCK(sc); + if (err != 0) + goto bail; + bcopy(((uint8_t *)sect) + sizeof(*sect), sec_buf, + le32toh(sect->nbytes)); /* * dummy up mbuf and verify section checksum */ m.m_type = MT_DATA; m.m_next = m.m_nextpkt = NULL; - m.m_len = sect->nbytes; - m.m_data = sc->sc_fwbuf; + m.m_len = le32toh(sect->nbytes); + m.m_data = sec_buf; m.m_flags = 0; - csum = in_cksum(&m, sect->nbytes); + csum = in_cksum(&m, le32toh(sect->nbytes)); if (csum != sect->cksum) { - device_printf(sc->sc_dev, "fw section %d, bad " - "cksum (expected 0x%x got 0x%x)\n", - sectnum, sect->cksum, csum); - err = -1; + device_printf(sc->sc_dev, + "firmware section %d, bad cksum (expected 0x%x got 0x%x)\n", + sectnum, le16toh(sect->cksum), csum); + err = EIO; goto bail; } - WRITE_REG(sc, TXP_H2A_1, sect->nbytes); - WRITE_REG(sc, TXP_H2A_2, sect->cksum); - WRITE_REG(sc, TXP_H2A_3, sect->addr); - WRITE_REG(sc, TXP_H2A_4, 0); - WRITE_REG(sc, TXP_H2A_5, dma & 0xffffffff); + bus_dmamap_sync(sec_tag, sec_map, BUS_DMASYNC_PREWRITE); + + WRITE_REG(sc, TXP_H2A_1, le32toh(sect->nbytes)); + TXP_BARRIER(sc, TXP_H2A_1, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_2, le16toh(sect->cksum)); + TXP_BARRIER(sc, TXP_H2A_2, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_3, le32toh(sect->addr)); + TXP_BARRIER(sc, TXP_H2A_3, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_4, TXP_ADDR_HI(sec_paddr)); + TXP_BARRIER(sc, TXP_H2A_4, 4, BUS_SPACE_BARRIER_WRITE); + WRITE_REG(sc, TXP_H2A_5, TXP_ADDR_LO(sec_paddr)); + TXP_BARRIER(sc, TXP_H2A_5, 4, BUS_SPACE_BARRIER_WRITE); WRITE_REG(sc, TXP_H2A_0, TXP_BOOTCMD_SEGMENT_AVAILABLE); + TXP_BARRIER(sc, TXP_H2A_0, 4, BUS_SPACE_BARRIER_WRITE); if (txp_download_fw_wait(sc)) { - device_printf(sc->sc_dev, "fw wait failed, " - "section %d\n", sectnum); - err = -1; + device_printf(sc->sc_dev, + "firmware wait failed, section %d\n", sectnum); + err = ETIMEDOUT; } + bus_dmamap_sync(sec_tag, sec_map, BUS_DMASYNC_POSTWRITE); bail: + txp_dma_free(sc, &sec_tag, &sec_map, (void **)&sec_buf); return (err); } -static void +static int txp_intr(void *vsc) { - struct txp_softc *sc = vsc; - struct txp_hostvar *hv = sc->sc_hostvar; + struct txp_softc *sc; + uint32_t status; + + sc = vsc; + status = READ_REG(sc, TXP_ISR); + if ((status & TXP_INT_LATCH) == 0) + return (FILTER_STRAY); + WRITE_REG(sc, TXP_ISR, status); + WRITE_REG(sc, TXP_IMR, TXP_INTR_ALL); + taskqueue_enqueue(sc->sc_tq, &sc->sc_int_task); + + return (FILTER_HANDLED); +} + +static void +txp_int_task(void *arg, int pending) +{ + struct txp_softc *sc; + struct ifnet *ifp; + struct txp_hostvar *hv; uint32_t isr; + int more; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 06:28:54 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F15631065675; Sun, 22 Mar 2009 06:28:53 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DDF348FC0A; Sun, 22 Mar 2009 06:28:53 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2M6SrIK059474; Sun, 22 Mar 2009 06:28:53 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2M6Srhw059473; Sun, 22 Mar 2009 06:28:53 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903220628.n2M6Srhw059473@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 22 Mar 2009 06:28: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: r190248 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb sparc64/conf 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, 22 Mar 2009 06:28:55 -0000 Author: yongari Date: Sun Mar 22 06:28:53 2009 New Revision: 190248 URL: http://svn.freebsd.org/changeset/base/190248 Log: MFC r189715: Uncomment txp(4), txp(4) should work on all architectures. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/sparc64/conf/GENERIC Modified: stable/7/sys/sparc64/conf/GENERIC ============================================================================== --- stable/7/sys/sparc64/conf/GENERIC Sun Mar 22 06:26:47 2009 (r190247) +++ stable/7/sys/sparc64/conf/GENERIC Sun Mar 22 06:28:53 2009 (r190248) @@ -155,7 +155,7 @@ device uart # Multi-uart driver device em # Intel PRO/1000 adapter Gigabit Ethernet Card #device ixgb # Intel PRO/10GbE Ethernet Card device le # AMD Am7900 LANCE and Am79C9xx PCnet -#device txp # 3Com 3cR990 (``Typhoon'') +device txp # 3Com 3cR990 (``Typhoon'') #device vx # 3Com 3c590, 3c595 (``Vortex'') # PCI Ethernet NICs that use the common MII bus controller code. From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 06:30:54 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FF38106566B; Sun, 22 Mar 2009 06:30:54 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D6A58FC1A; Sun, 22 Mar 2009 06:30:54 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2M6UsN6059572; Sun, 22 Mar 2009 06:30:54 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2M6UsOb059571; Sun, 22 Mar 2009 06:30:54 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903220630.n2M6UsOb059571@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 22 Mar 2009 06:30: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: r190249 - 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: Sun, 22 Mar 2009 06:30:55 -0000 Author: yongari Date: Sun Mar 22 06:30:54 2009 New Revision: 190249 URL: http://svn.freebsd.org/changeset/base/190249 Log: MFC r189716: Add txp(4) to the list of drivers supporting ALTQ. Modified: stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/altq.4 stable/7/share/man/man4/igb.4 (props changed) Modified: stable/7/share/man/man4/altq.4 ============================================================================== --- stable/7/share/man/man4/altq.4 Sun Mar 22 06:28:53 2009 (r190248) +++ stable/7/share/man/man4/altq.4 Sun Mar 22 06:30:54 2009 (r190249) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 12, 2008 +.Dd March 12, 2009 .Dt ALTQ 4 .Os .Sh NAME @@ -152,6 +152,7 @@ They have been applied to the following .Xr sk 4 , .Xr ste 4 , .Xr stge 4 , +.Xr txp 4 , .Xr udav 4 , .Xr ural 4 , .Xr vge 4 , From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 06:31:59 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B23A0106566B; Sun, 22 Mar 2009 06:31:59 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9FA608FC0A; Sun, 22 Mar 2009 06:31:59 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2M6VxAl059640; Sun, 22 Mar 2009 06:31:59 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2M6VxEW059639; Sun, 22 Mar 2009 06:31:59 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903220631.n2M6VxEW059639@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 22 Mar 2009 06:31: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: r190250 - 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: Sun, 22 Mar 2009 06:32:00 -0000 Author: yongari Date: Sun Mar 22 06:31:59 2009 New Revision: 190250 URL: http://svn.freebsd.org/changeset/base/190250 Log: MFC r189717: Xref altq.4 and bump .Dd Modified: stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/igb.4 (props changed) stable/7/share/man/man4/txp.4 Modified: stable/7/share/man/man4/txp.4 ============================================================================== --- stable/7/share/man/man4/txp.4 Sun Mar 22 06:30:54 2009 (r190249) +++ stable/7/share/man/man4/txp.4 Sun Mar 22 06:31:59 2009 (r190250) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd March 12, 2009 .Dt TXP 4 .Os .Sh NAME @@ -134,6 +134,7 @@ driver supports the following cards: 3Com 3cR990B-SRV .El .Sh SEE ALSO +.Xr altq 4 , .Xr arp 4 , .Xr inet 4 , .Xr intro 4 , From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 06:37:15 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31BC2106566C; Sun, 22 Mar 2009 06:37:15 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 145FA8FC13; Sun, 22 Mar 2009 06:37:15 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2M6bEam059790; Sun, 22 Mar 2009 06:37:14 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2M6bEfW059785; Sun, 22 Mar 2009 06:37:14 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <200903220637.n2M6bEfW059785@svn.freebsd.org> From: Nick Hibma Date: Sun, 22 Mar 2009 06:37:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190251 - stable/7/sys/dev/usb 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, 22 Mar 2009 06:37:16 -0000 Author: n_hibma Date: Sun Mar 22 06:37:14 2009 New Revision: 190251 URL: http://svn.freebsd.org/changeset/base/190251 Log: MFC 184941: Add a reset device command to ugen.c. This is needed to make some devices work that require a firmware upload and a USB reset afterwards. Modified: stable/7/sys/dev/usb/ugen.c stable/7/sys/dev/usb/usb.h stable/7/sys/dev/usb/usb_subr.c stable/7/sys/dev/usb/usbdi.c stable/7/sys/dev/usb/usbdi.h Modified: stable/7/sys/dev/usb/ugen.c ============================================================================== --- stable/7/sys/dev/usb/ugen.c Sun Mar 22 06:31:59 2009 (r190250) +++ stable/7/sys/dev/usb/ugen.c Sun Mar 22 06:37:14 2009 (r190251) @@ -1059,8 +1059,8 @@ ugen_isoc_rintr(usbd_xfer_handle xfer, u sce->cur += count; if(sce->cur >= sce->limit) sce->cur = sce->ibuf + (sce->limit - sce->cur); - DPRINTFN(5, ("ugen_isoc_rintr: throwing away %d bytes\n", - count)); + DPRINTF(("ugen_isoc_rintr: throwing away %d bytes\n", + count)); } isize = UGETW(sce->edesc->wMaxPacketSize); @@ -1427,7 +1427,6 @@ ugen_do_ioctl(struct ugen_softc *sc, int struct iovec iov; struct uio uio; void *ptr = 0; - usbd_status err; int error = 0; if (!(flag & FWRITE)) @@ -1485,6 +1484,11 @@ ugen_do_ioctl(struct ugen_softc *sc, int usbd_fill_deviceinfo(sc->sc_udev, (struct usb_device_info *)addr, 1); break; + case USB_RESET_DEVICE: + err = usbd_reset_device(sc->sc_udev); + if (err) + return EIO; + break; default: return (EINVAL); } Modified: stable/7/sys/dev/usb/usb.h ============================================================================== --- stable/7/sys/dev/usb/usb.h Sun Mar 22 06:31:59 2009 (r190250) +++ stable/7/sys/dev/usb/usb.h Sun Mar 22 06:37:14 2009 (r190251) @@ -697,6 +697,7 @@ struct usb_event { #define USB_GET_DEVICEINFO _IOR ('U', 112, struct usb_device_info) #define USB_SET_SHORT_XFER _IOW ('U', 113, int) #define USB_SET_TIMEOUT _IOW ('U', 114, int) +#define USB_RESET_DEVICE _IO ('U', 115) /* Modem device */ #define USB_GET_CM_OVER_DATA _IOR ('U', 130, int) Modified: stable/7/sys/dev/usb/usb_subr.c ============================================================================== --- stable/7/sys/dev/usb/usb_subr.c Sun Mar 22 06:31:59 2009 (r190250) +++ stable/7/sys/dev/usb/usb_subr.c Sun Mar 22 06:37:14 2009 (r190251) @@ -322,16 +322,10 @@ usbd_delay_ms(usbd_device_handle dev, u_ usbd_status usbd_reset_port(usbd_device_handle dev, int port, usb_port_status_t *ps) { - usb_device_request_t req; usbd_status err; int n; - req.bmRequestType = UT_WRITE_CLASS_OTHER; - req.bRequest = UR_SET_FEATURE; - USETW(req.wValue, UHF_PORT_RESET); - USETW(req.wIndex, port); - USETW(req.wLength, 0); - err = usbd_do_request(dev, &req, 0); + err = usbd_set_port_feature(dev, port, UHF_PORT_RESET); DPRINTFN(1,("usbd_reset_port: port %d reset done, error=%s\n", port, usbd_errstr(err))); if (err) @@ -685,11 +679,11 @@ usbd_set_config_index(usbd_device_handle DPRINTF(("power exceeded %d %d\n", power,dev->powersrc->power)); /* XXX print nicer message. */ if (msg) - printf("%s: device addr %d (config %d) exceeds power " - "budget, %d mA > %d mA\n", - device_get_nameunit(dev->bus->bdev), dev->address, - cdp->bConfigurationValue, - power, dev->powersrc->power); + device_printf(dev->bus->bdev, + "device addr %d (config %d) exceeds " + "power budget, %d mA > %d mA\n", + dev->address, cdp->bConfigurationValue, + power, dev->powersrc->power); err = USBD_NO_POWER; goto bad; } @@ -1023,8 +1017,7 @@ usbd_new_device(device_t parent, usbd_bu bus, port, depth, speed)); addr = usbd_getnewaddr(bus); if (addr < 0) { - printf("%s: No free USB addresses, new device ignored.\n", - device_get_nameunit(bus->bdev)); + device_printf(bus->bdev, "No free USB addresses\n"); return (USBD_NO_ADDR); } @@ -1370,11 +1363,14 @@ usb_disconnect_port(struct usbd_port *up if (dev->subdevs != NULL) { DPRINTFN(3,("usb_disconnect_port: disconnect subdevs\n")); for (i = 0; dev->subdevs[i]; i++) { - printf("%s: at %s", device_get_nameunit(dev->subdevs[i]), - hubname); - if (up->portno != 0) - printf(" port %d", up->portno); - printf(" (addr %d) disconnected\n", dev->address); + if (!device_is_quiet(dev->subdevs[i])) { + device_printf(dev->subdevs[i], + "at %s", hubname); + if (up->portno != 0) + printf(" port %d", up->portno); + printf(" (addr %d) disconnected\n", dev->address); + } + struct usb_attach_arg *uaap = device_get_ivars(dev->subdevs[i]); device_detach(dev->subdevs[i]); Modified: stable/7/sys/dev/usb/usbdi.c ============================================================================== --- stable/7/sys/dev/usb/usbdi.c Sun Mar 22 06:31:59 2009 (r190250) +++ stable/7/sys/dev/usb/usbdi.c Sun Mar 22 06:37:14 2009 (r190251) @@ -1230,6 +1230,15 @@ usbd_set_polling(usbd_device_handle dev, dev->bus->methods->soft_intr(dev->bus); } +usbd_status +usbd_reset_device(usbd_device_handle dev) +{ + usbd_device_handle parent = dev->myhub; + struct usbd_port *up = dev->powersrc; + + return usbd_reset_port(parent, up->portno, &up->status); +} + usb_endpoint_descriptor_t * usbd_get_endpoint_descriptor(usbd_interface_handle iface, u_int8_t address) Modified: stable/7/sys/dev/usb/usbdi.h ============================================================================== --- stable/7/sys/dev/usb/usbdi.h Sun Mar 22 06:31:59 2009 (r190250) +++ stable/7/sys/dev/usb/usbdi.h Sun Mar 22 06:37:14 2009 (r190251) @@ -158,6 +158,7 @@ usb_endpoint_descriptor_t *usbd_find_ede void usbd_dopoll(usbd_interface_handle); void usbd_set_polling(usbd_device_handle, int); +usbd_status usbd_reset_device(usbd_device_handle); const char *usbd_errstr(usbd_status); From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 06:53:53 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1677E106566C for ; Sun, 22 Mar 2009 06:53:53 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id 52CE38FC0C for ; Sun, 22 Mar 2009 06:53:51 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 22 Mar 2009 06:27:10 -0000 Received: from p54A3FD39.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.253.57] by mail.gmx.net (mp045) with SMTP; 22 Mar 2009 07:27:10 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX19yHBo7tf1yrGq0m7JM3c+OjahQ7V8s5wHbIUPLe4 5zK/rAokhWx1aM Message-ID: <49C5DA3C.9010800@gmx.de> Date: Sun, 22 Mar 2009 07:27:08 +0100 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: David Schultz References: <200903220544.n2M5iuAT058241@svn.freebsd.org> In-Reply-To: <200903220544.n2M5iuAT058241@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.64 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r190240 - stable/7/usr.bin/ncal 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, 22 Mar 2009 06:53:53 -0000 David Schultz schrieb: > Author: das > Date: Sun Mar 22 05:44:56 2009 > New Revision: 190240 > URL: http://svn.freebsd.org/changeset/base/190240 > > Log: > MFC r189804: > Multibyte character support for cal(1). > > PR: 131578 > > Modified: > stable/7/usr.bin/ncal/ (props changed) > stable/7/usr.bin/ncal/ncal.1 > stable/7/usr.bin/ncal/ncal.c Hi David, did you see my former email that this change is partly erroneous? It is invalid to mix byte and wide functions (here printf() and wprintf()) on the same stream (C99 §7.19.2:5). I also attached a patch. Here's a link to the previous email: http://lists.freebsd.org/pipermail/svn-src-all/2009-March/006296.html Christoph From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 08:09:16 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DB34106564A; Sun, 22 Mar 2009 08:09:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B3BB8FC0C; Sun, 22 Mar 2009 08:09:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2M89GYE061660; Sun, 22 Mar 2009 08:09:16 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2M89GAr061659; Sun, 22 Mar 2009 08:09:16 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200903220809.n2M89GAr061659@svn.freebsd.org> From: Ed Schouten Date: Sun, 22 Mar 2009 08:09:16 +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: r190253 - stable/7/bin/sh 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, 22 Mar 2009 08:09:17 -0000 Author: ed Date: Sun Mar 22 08:09:16 2009 New Revision: 190253 URL: http://svn.freebsd.org/changeset/base/190253 Log: MFC: Don't disable CR-to-NL translation when waiting for data to arrive. A difference between the old and the new TTY layer is that the new implementation does not perform any post-processing before returning data back to userspace when calling read(). sh(1)'s read turns the TTY into a raw mode before calling select(). This means that the first character will not receive any ICRNL processing. Inherit this flag from the original terminal attributes. Even though this issue is not present on RELENG_*, I'm MFCing it to make sh(1) in jails behave better. PR: bin/129566 Modified: stable/7/bin/sh/ (props changed) stable/7/bin/sh/miscbltin.c Modified: stable/7/bin/sh/miscbltin.c ============================================================================== --- stable/7/bin/sh/miscbltin.c Sun Mar 22 06:47:29 2009 (r190252) +++ stable/7/bin/sh/miscbltin.c Sun Mar 22 08:09:16 2009 (r190253) @@ -147,6 +147,7 @@ readcmd(int argc __unused, char **argv _ if (tcgetattr(0, &told) == 0) { memcpy(&tnew, &told, sizeof(told)); cfmakeraw(&tnew); + tnew.c_iflag |= told.c_iflag & ICRNL; tcsetattr(0, TCSANOW, &tnew); tsaved = 1; } From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 09:57:57 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBD4B106566B; Sun, 22 Mar 2009 09:57:57 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AEB468FC0C; Sun, 22 Mar 2009 09:57:57 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2M9vvmJ063805; Sun, 22 Mar 2009 09:57:57 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2M9vvEH063804; Sun, 22 Mar 2009 09:57:57 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903220957.n2M9vvEH063804@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 09:57:57 +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: r190255 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb 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: Sun, 22 Mar 2009 09:57:58 -0000 Author: marius Date: Sun Mar 22 09:57:57 2009 New Revision: 190255 URL: http://svn.freebsd.org/changeset/base/190255 Log: MFC: r181640, r190003 - Add sys_tick and the USIII and beyond sys_tick_cmpr to state_regs[]. - Const'ify and static'ize as appropriate. - Use __FBSDID(). Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/sparc64/sparc64/db_disasm.c Modified: stable/7/sys/sparc64/sparc64/db_disasm.c ============================================================================== --- stable/7/sys/sparc64/sparc64/db_disasm.c Sun Mar 22 08:14:01 2009 (r190254) +++ stable/7/sys/sparc64/sparc64/db_disasm.c Sun Mar 22 09:57:57 2009 (r190255) @@ -28,9 +28,11 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * from: NetBSD: db_disasm.c,v 1.9 2000/08/16 11:29:42 pk Exp - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include #include @@ -76,18 +78,18 @@ struct sparc_insn { unsigned int match; - char* name; - char* format; + const char* name; + const char* format; }; -char* regs[] = { +static const char *const regs[] = { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7", "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7" }; -char* priv_regs[] = { +static const char *const priv_regs[] = { "tpc", "tnpc", "tstate", "tt", "tick", "tba", "pstate", "tl", "pil", "cwp", "cansave", "canrestore", "cleanwin", "otherwin", "wstate", "fq", @@ -95,18 +97,18 @@ char* priv_regs[] = { "", "", "", "", "", "", "", "ver" }; -char* state_regs[] = { +static const char *const state_regs[] = { "y", "", "ccr", "asi", "tick", "pc", "fprs", "asr", "", "", "", "", "", "", "", "", - "pcr", "pic", "dcr", "gsr", "set_softint", "clr_softint", "softint", "tick_cmpr", "", - "", "", "", "", "", "", "", "" + "pcr", "pic", "dcr", "gsr", "set_softint", "clr_softint", "softint", + "tick_cmpr", "sys_tick", "sys_tick_cmpr", "", "", "", "", "", "", "" }; -char* ccodes[] = { +static const char *const ccodes[] = { "fcc0", "fcc1", "fcc2", "fcc3", "icc", "", "xcc", "" }; -char* prefetch[] = { +static const char *const prefetch[] = { "n_reads", "one_read", "n_writes", "one_write", "page" }; @@ -162,7 +164,7 @@ V8 only: */ -struct sparc_insn sparc_i[] = { +static const struct sparc_insn sparc_i[] = { /* * Format 1: Call @@ -803,11 +805,10 @@ struct sparc_insn sparc_i[] = { db_addr_t db_disasm(db_addr_t loc, boolean_t altfmt) { - struct sparc_insn* i_ptr = (struct sparc_insn *)&sparc_i; - + const struct sparc_insn* i_ptr = (struct sparc_insn *)&sparc_i; unsigned int insn, you_lose, bitmask; int matchp; - char* f_ptr, *cp; + const char* f_ptr, *cp; you_lose = 0; matchp = 0; @@ -1028,4 +1029,3 @@ db_disasm(db_addr_t loc, boolean_t altfm return (loc + 4); } - From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 10:08:42 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17B2D10656CA; Sun, 22 Mar 2009 10:08:42 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EECB08FC18; Sun, 22 Mar 2009 10:08:41 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MA8fb8065555; Sun, 22 Mar 2009 10:08:41 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MA8f6i065552; Sun, 22 Mar 2009 10:08:41 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903221008.n2MA8f6i065552@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 10:08: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: r190256 - in stable/7/sys: . conf contrib/pf dev/ath/ath_hal dev/cxgb 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: Sun, 22 Mar 2009 10:08:42 -0000 Author: marius Date: Sun Mar 22 10:08:41 2009 New Revision: 190256 URL: http://svn.freebsd.org/changeset/base/190256 Log: MFC: r182918 Add drivers for the power management devices found on Fireplane/ Safari- and JBus-based machines. Currently the main purpose of these drivers is debugging of the resource allocation on nexus(4) and the register content of these devices though. Added: stable/7/sys/sparc64/sparc64/jbusppm.c - copied unchanged from r182918, head/sys/sparc64/sparc64/jbusppm.c stable/7/sys/sparc64/sparc64/schppm.c - copied unchanged from r182918, head/sys/sparc64/sparc64/schppm.c Modified: stable/7/sys/ (props changed) stable/7/sys/conf/files.sparc64 stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/conf/files.sparc64 ============================================================================== --- stable/7/sys/conf/files.sparc64 Sun Mar 22 09:57:57 2009 (r190255) +++ stable/7/sys/conf/files.sparc64 Sun Mar 22 10:08:41 2009 (r190256) @@ -101,6 +101,7 @@ sparc64/sparc64/interrupt.S standard no- compile-with "${NORMAL_S} -mcpu=ultrasparc" sparc64/sparc64/intr_machdep.c standard sparc64/sparc64/iommu.c standard +sparc64/sparc64/jbusppm.c standard sparc64/sparc64/locore.S standard no-obj sparc64/sparc64/machdep.c standard sparc64/sparc64/mem.c optional mem @@ -116,6 +117,7 @@ sparc64/sparc64/prof_machdep.c optional sparc64/sparc64/rtc.c optional rtc ebus | rtc isa sparc64/sparc64/rwindow.c standard sparc64/sparc64/sc_machdep.c optional sc +sparc64/sparc64/schppm.c standard sparc64/sparc64/spitfire.c standard sparc64/sparc64/stack_machdep.c optional ddb | stack sparc64/sparc64/support.S standard \ Copied: stable/7/sys/sparc64/sparc64/jbusppm.c (from r182918, head/sys/sparc64/sparc64/jbusppm.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sys/sparc64/sparc64/jbusppm.c Sun Mar 22 10:08:41 2009 (r190256, copy of r182918, head/sys/sparc64/sparc64/jbusppm.c) @@ -0,0 +1,226 @@ +/*- + * Copyright (c) 2008 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 +#include +#include + +#include + +#include +#include + +#define JBUSPPM_NREG 2 + +#define JBUSPPM_DEVID 0 +#define JBUSPPM_ESTAR 1 + +#define JBUSPPM_DEVID_JID 0x00 +#define JBUSPPM_DEVID_JID_MASTER 0x00040000 + +#define JBUSPPM_ESTAR_CTRL 0x00 +#define JBUSPPM_ESTAR_CTRL_1 0x00000001 +#define JBUSPPM_ESTAR_CTRL_2 0x00000002 +#define JBUSPPM_ESTAR_CTRL_32 0x00000020 +#define JBUSPPM_ESTAR_CTRL_MASK \ + (JBUSPPM_ESTAR_CTRL_1 | JBUSPPM_ESTAR_CTRL_2 | JBUSPPM_ESTAR_CTRL_32) +#define JBUSPPM_ESTAR_JCHNG 0x08 +#define JBUSPPM_ESTAR_JCHNG_DELAY_MASK 0x00000007 +#define JBUSPPM_ESTAR_JCHNG_START 0x00000010 +#define JBUSPPM_ESTAR_JCHNG_OCCURED 0x00000018 + +struct jbusppm_softc { + struct resource *sc_res[JBUSPPM_NREG]; + bus_space_tag_t sc_bt[JBUSPPM_NREG]; + bus_space_handle_t sc_bh[JBUSPPM_NREG]; +}; + +#define JBUSPPM_READ(sc, reg, off) \ + bus_space_read_8((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off)) +#define JBUSPPM_WRITE(sc, reg, off, val) \ + bus_space_write_8((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off), (val)) + +static device_probe_t jbusppm_probe; +static device_attach_t jbusppm_attach; + +static device_method_t jbusppm_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, jbusppm_probe), + DEVMETHOD(device_attach, jbusppm_attach), + + { NULL, NULL } +}; + +static devclass_t jbusppm_devclass; + +DEFINE_CLASS_0(jbusppm, jbusppm_driver, jbusppm_methods, + sizeof(struct jbusppm_softc)); +DRIVER_MODULE(jbusppm, nexus, jbusppm_driver, jbusppm_devclass, 0, 0); + +static int +jbusppm_probe(device_t dev) +{ + const char* compat; + + compat = ofw_bus_get_compat(dev); + if (compat != NULL && strcmp(ofw_bus_get_name(dev), "ppm") == 0 && + strcmp(compat, "jbus-ppm") == 0) { + device_set_desc(dev, "JBus power management"); + return (BUS_PROBE_DEFAULT); + } + return (ENXIO); +} + +static int +jbusppm_attach(device_t dev) +{ + struct jbusppm_softc *sc; + int i, rid; +#if 1 + device_t *children, tomatillo; + u_long tcount, tstart, jcount, jstart; + int j, nchildren; +#endif + + sc = device_get_softc(dev); + for (i = JBUSPPM_DEVID; i <= JBUSPPM_ESTAR; i++) { + rid = i; + /* + * The JBUSPPM_ESTAR resources is shared with that of the + * Tomatillo bus A controller configuration register bank. + */ +#if 0 + sc->sc_res[i] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &rid, (i == JBUSPPM_ESTAR ? RF_SHAREABLE : 0) | RF_ACTIVE); + if (sc->sc_res[i] == NULL) { + device_printf(dev, + "could not allocate resource %d\n", i); + goto fail; + } + sc->sc_bt[i] = rman_get_bustag(sc->sc_res[i]); + sc->sc_bh[i] = rman_get_bushandle(sc->sc_res[i]); +#else + /* + * Workaround for the fact that rman(9) only allows to + * share resources of the same size. + */ + if (i == JBUSPPM_ESTAR) { + if (bus_get_resource(dev, SYS_RES_MEMORY, i, &jstart, + &jcount) != 0) { + device_printf(dev, + "could not determine Estar resource\n"); + goto fail; + } + if (device_get_children(device_get_parent(dev), + &children, &nchildren) != 0) { + device_printf(dev, "could not get children\n"); + goto fail; + } + tomatillo = NULL; + for (j = 0; j < nchildren; j++) { + if (ofw_bus_get_type(children[j]) != NULL && + strcmp(ofw_bus_get_type(children[j]), + "pci") == 0 && + ofw_bus_get_compat(children[j]) != NULL && + strcmp(ofw_bus_get_compat(children[j]), + "pci108e,a801") == 0 && + ((bus_get_resource_start(children[j], + SYS_RES_MEMORY, 0) >> 20) & 1) == 0) { + tomatillo = children[j]; + break; + } + } + free(children, M_TEMP); + if (tomatillo == NULL) { + device_printf(dev, + "could not find Tomatillo\n"); + goto fail; + } + if (bus_get_resource(tomatillo, SYS_RES_MEMORY, 1, + &tstart, &tcount) != 0) { + device_printf(dev, + "could not determine Tomatillo " + "resource\n"); + goto fail; + } + sc->sc_res[i] = bus_alloc_resource(dev, SYS_RES_MEMORY, + &rid, tstart, tstart + tcount - 1, tcount, + RF_SHAREABLE | RF_ACTIVE); + } else + sc->sc_res[i] = bus_alloc_resource_any(dev, + SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->sc_res[i] == NULL) { + device_printf(dev, + "could not allocate resource %d\n", i); + goto fail; + } + sc->sc_bt[i] = rman_get_bustag(sc->sc_res[i]); + sc->sc_bh[i] = rman_get_bushandle(sc->sc_res[i]); + if (i == JBUSPPM_ESTAR) + bus_space_subregion(sc->sc_bt[i], sc->sc_bh[i], + jstart - tstart, jcount, &sc->sc_bh[i]); +#endif + } + + if (bootverbose) { + if ((JBUSPPM_READ(sc, JBUSPPM_DEVID, JBUSPPM_DEVID_JID) & + JBUSPPM_DEVID_JID_MASTER) != 0) + device_printf(dev, "master I/O bridge\n"); + device_printf(dev, "running at "); + switch (JBUSPPM_READ(sc, JBUSPPM_ESTAR, JBUSPPM_ESTAR_CTRL) & + JBUSPPM_ESTAR_CTRL_MASK) { + case JBUSPPM_ESTAR_CTRL_1: + printf("full"); + break; + case JBUSPPM_ESTAR_CTRL_2: + printf("half"); + break; + case JBUSPPM_ESTAR_CTRL_32: + printf("1/32"); + break; + default: + printf("unknown"); + break; + } + printf(" speed\n"); + } + + return (0); + + fail: + for (i = JBUSPPM_DEVID; i <= JBUSPPM_ESTAR && sc->sc_res[i] != NULL; + i++) + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->sc_res[i]), sc->sc_res[i]); + return (ENXIO); +} Copied: stable/7/sys/sparc64/sparc64/schppm.c (from r182918, head/sys/sparc64/sparc64/schppm.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sys/sparc64/sparc64/schppm.c Sun Mar 22 10:08:41 2009 (r190256, copy of r182918, head/sys/sparc64/sparc64/schppm.c) @@ -0,0 +1,132 @@ +/*- + * Copyright (c) 2008 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 +#include +#include + +#include + +#include +#include + +#define SCHPPM_NREG 1 + +#define SCHPPM_ESTAR 0 + +#define SCHPPM_ESTAR_CTRL 0x00 +#define SCHPPM_ESTAR_CTRL_1 0x00000001 +#define SCHPPM_ESTAR_CTRL_2 0x00000002 +#define SCHPPM_ESTAR_CTRL_32 0x00000020 +#define SCHPPM_ESTAR_CTRL_MASK \ + (SCHPPM_ESTAR_CTRL_1 | SCHPPM_ESTAR_CTRL_2 | SCHPPM_ESTAR_CTRL_32) + +static struct resource_spec schppm_res_spec[] = { + { SYS_RES_MEMORY, SCHPPM_ESTAR, RF_ACTIVE }, + { -1, 0 } +}; + +struct schppm_softc { + struct resource *sc_res[SCHPPM_NREG]; +}; + +#define SCHPPM_READ(sc, reg, off) \ + bus_read_8((sc)->sc_res[(reg)], (off)) +#define SCHPPM_WRITE(sc, reg, off, val) \ + bus_write_8((sc)->sc_res[(reg)], (off), (val)) + +static device_probe_t schppm_probe; +static device_attach_t schppm_attach; + +static device_method_t schppm_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, schppm_probe), + DEVMETHOD(device_attach, schppm_attach), + + { NULL, NULL } +}; + +static devclass_t schppm_devclass; + +DEFINE_CLASS_0(schppm, schppm_driver, schppm_methods, + sizeof(struct schppm_softc)); +DRIVER_MODULE(schppm, nexus, schppm_driver, schppm_devclass, 0, 0); + +static int +schppm_probe(device_t dev) +{ + const char* compat; + + compat = ofw_bus_get_compat(dev); + if (compat != NULL && strcmp(ofw_bus_get_name(dev), "ppm") == 0 && + strcmp(compat, "gp2-ppm") == 0) { + device_set_desc(dev, "Schizo power management"); + return (BUS_PROBE_DEFAULT); + } + return (ENXIO); +} + +static int +schppm_attach(device_t dev) +{ + struct schppm_softc *sc; + + sc = device_get_softc(dev); + if (bus_alloc_resources(dev, schppm_res_spec, sc->sc_res)) { + device_printf(dev, "failed to allocate resources\n"); + bus_release_resources(dev, schppm_res_spec, sc->sc_res); + return (ENXIO); + } + + if (bootverbose) { + device_printf(dev, "running at "); + switch (SCHPPM_READ(sc, SCHPPM_ESTAR, SCHPPM_ESTAR_CTRL) & + SCHPPM_ESTAR_CTRL_MASK) { + case SCHPPM_ESTAR_CTRL_1: + printf("full"); + break; + case SCHPPM_ESTAR_CTRL_2: + printf("half"); + break; + case SCHPPM_ESTAR_CTRL_32: + printf("1/32"); + break; + default: + printf("unknown"); + break; + } + printf(" speed\n"); + } + + return (0); +} From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 10:33:11 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45BD21065670; Sun, 22 Mar 2009 10:33:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30EB58FC12; Sun, 22 Mar 2009 10:33:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MAXBXn066196; Sun, 22 Mar 2009 10:33:11 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MAXBme066193; Sun, 22 Mar 2009 10:33:11 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903221033.n2MAXBme066193@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 10:33:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190257 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb 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: Sun, 22 Mar 2009 10:33:12 -0000 Author: marius Date: Sun Mar 22 10:33:10 2009 New Revision: 190257 URL: http://svn.freebsd.org/changeset/base/190257 Log: MFC: r183142, r186395, 190106 - Newer firmware versions no longer provide SUNW,stop-self so just disable interrupts and loop forever instead. We still could use SUNW,stop-self if implemented but acording to comments in OpenBSD, E{2,4}50 tend to have fragile firmware versions which wedge when using the OFW test service, so given that we don't really depend on SUNW,stop-self just nuke it altogether instead of risking problems. - Hide all MP-related bits in underneath #ifdef SMP. - Inline ipi_all_but_self(9) and ipi_selected(9). We don't expose any additional bits but save a few cycles by doing so. - Remove ipi_all(9), which actually only called panic(9). It can't be implemented natively anyway and having it removed at least causes MI users to already fail when linking. - At least Fire V880 have a small hardware glitch which causes the reception of IDR_NACKs for CPUs we actually haven't tried to send an IPI to, even not as part of the initial try. According to tests this apparently can be safely ignored though, so just return if checking for the individual IDR_NACKs indicates no outstanding dispatch. Serializing the sending of IPIs between MD and MI code by the combined usage of smp_ipi_mtx makes no difference to this phenomenon. [1] - Provide relevant debugging bits already with the initial panic in case of problems with the IPI dispatch, which would have allowed to diagnose the above problem without a specially built kernel. - In case of cheetah_ipi_selected() base the delay we wait for other CPUs which also might want to dispatch IPIs on the total amount of CPUs instead of just the number of CPUs we let this CPU send IPIs to because in the worst case all CPUs also want to IPI us at the same time. - There's no need to wrap kdb_active in #ifdef KDB as it's always available. Reported and access for extensive tests provided by: beat [1] Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/sparc64/include/smp.h stable/7/sys/sparc64/sparc64/genassym.c stable/7/sys/sparc64/sparc64/mp_machdep.c Modified: stable/7/sys/sparc64/include/smp.h ============================================================================== --- stable/7/sys/sparc64/include/smp.h Sun Mar 22 10:08:41 2009 (r190256) +++ stable/7/sys/sparc64/include/smp.h Sun Mar 22 10:33:10 2009 (r190257) @@ -29,6 +29,8 @@ #ifndef _MACHINE_SMP_H_ #define _MACHINE_SMP_H_ +#ifdef SMP + #define CPU_TICKSYNC 1 #define CPU_STICKSYNC 2 #define CPU_INIT 3 @@ -91,10 +93,6 @@ void cpu_mp_shutdown(void); typedef void cpu_ipi_selected_t(u_int, u_long, u_long, u_long); extern cpu_ipi_selected_t *cpu_ipi_selected; -void ipi_selected(u_int cpus, u_int ipi); -void ipi_all(u_int ipi); -void ipi_all_but_self(u_int ipi); - void mp_init(void); extern struct mtx ipi_mtx; @@ -117,7 +115,19 @@ extern char tl_ipi_tlb_context_demap[]; extern char tl_ipi_tlb_page_demap[]; extern char tl_ipi_tlb_range_demap[]; -#ifdef SMP +static __inline void +ipi_all_but_self(u_int ipi) +{ + + cpu_ipi_selected(PCPU_GET(other_cpus), 0, (u_long)tl_ipi_level, ipi); +} + +static __inline void +ipi_selected(u_int cpus, u_int ipi) +{ + + cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); +} #if defined(_MACHINE_PMAP_H_) && defined(_SYS_MUTEX_H_) @@ -224,8 +234,12 @@ ipi_wait(void *cookie) #endif /* _MACHINE_PMAP_H_ && _SYS_MUTEX_H_ */ +#endif /* !LOCORE */ + #else +#ifndef LOCORE + static __inline void * ipi_dcache_page_inval(void *func, vm_paddr_t pa) { @@ -267,8 +281,26 @@ ipi_wait(void *cookie) } -#endif /* SMP */ +static __inline void +tl_ipi_cheetah_dcache_page_inval(void) +{ + +} + +static __inline void +tl_ipi_spitfire_dcache_page_inval(void) +{ + +} + +static __inline void +tl_ipi_spitfire_icache_page_inval(void) +{ + +} #endif /* !LOCORE */ +#endif /* SMP */ + #endif /* !_MACHINE_SMP_H_ */ Modified: stable/7/sys/sparc64/sparc64/genassym.c ============================================================================== --- stable/7/sys/sparc64/sparc64/genassym.c Sun Mar 22 10:08:41 2009 (r190256) +++ stable/7/sys/sparc64/sparc64/genassym.c Sun Mar 22 10:33:10 2009 (r190257) @@ -83,6 +83,7 @@ ASSYM(PAGE_SHIFT_4M, PAGE_SHIFT_4M); ASSYM(PAGE_SIZE, PAGE_SIZE); ASSYM(PAGE_SIZE_4M, PAGE_SIZE_4M); +#ifdef SMP ASSYM(CSA_PCPU, offsetof(struct cpu_start_args, csa_pcpu)); ASSYM(CSA_STATE, offsetof(struct cpu_start_args, csa_state)); #ifdef SUN4U @@ -95,6 +96,7 @@ ASSYM(CSA_VER, offsetof(struct cpu_start #ifdef SUN4V ASSYM(CSA_CPUID, offsetof(struct cpu_start_args, csa_cpuid)); #endif +#endif #ifdef SUN4U ASSYM(DC_SIZE, offsetof(struct cacheinfo, dc_size)); @@ -103,7 +105,9 @@ ASSYM(IC_SIZE, offsetof(struct cacheinfo ASSYM(IC_LINESIZE, offsetof(struct cacheinfo, ic_linesize)); #endif +#ifdef SMP ASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa)); +#endif ASSYM(KTR_SIZEOF, sizeof(struct ktr_entry)); ASSYM(KTR_LINE, offsetof(struct ktr_entry, ktr_line)); @@ -210,11 +214,13 @@ ASSYM(IR_ARG, offsetof(struct intr_reque ASSYM(IR_PRI, offsetof(struct intr_request, ir_pri)); ASSYM(IR_VEC, offsetof(struct intr_request, ir_vec)); +#ifdef SMP ASSYM(ITA_MASK, offsetof(struct ipi_tlb_args, ita_mask)); ASSYM(ITA_PMAP, offsetof(struct ipi_tlb_args, ita_pmap)); ASSYM(ITA_START, offsetof(struct ipi_tlb_args, ita_start)); ASSYM(ITA_END, offsetof(struct ipi_tlb_args, ita_end)); ASSYM(ITA_VA, offsetof(struct ipi_tlb_args, ita_va)); +#endif ASSYM(IV_FUNC, offsetof(struct intr_vector, iv_func)); ASSYM(IV_ARG, offsetof(struct intr_vector, iv_arg)); Modified: stable/7/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/mp_machdep.c Sun Mar 22 10:08:41 2009 (r190256) +++ stable/7/sys/sparc64/sparc64/mp_machdep.c Sun Mar 22 10:33:10 2009 (r190257) @@ -92,6 +92,9 @@ __FBSDID("$FreeBSD$"); #include #include +#define SUNW_STARTCPU "SUNW,start-cpu" +#define SUNW_STOPSELF "SUNW,stop-self" + static ih_func_t cpu_ipi_ast; static ih_func_t cpu_ipi_preempt; static ih_func_t cpu_ipi_stop; @@ -119,7 +122,6 @@ static volatile u_int shutdown_cpus; static void cpu_mp_unleash(void *v); static void spitfire_ipi_send(u_int mid, u_long d0, u_long d1, u_long d2); static void sun4u_startcpu(phandle_t cpu, void *func, u_long arg); -static void sun4u_stopself(void); static cpu_ipi_selected_t cheetah_ipi_selected; static cpu_ipi_selected_t spitfire_ipi_selected; @@ -203,7 +205,7 @@ sun4u_startcpu(phandle_t cpu, void *func cell_t func; cell_t arg; } args = { - (cell_t)"SUNW,start-cpu", + (cell_t)SUNW_STARTCPU, 3, }; @@ -214,24 +216,6 @@ sun4u_startcpu(phandle_t cpu, void *func } /* - * Stop the calling CPU. - */ -static void -sun4u_stopself(void) -{ - static struct { - cell_t name; - cell_t nargs; - cell_t nreturns; - } args = { - (cell_t)"SUNW,stop-self", - }; - - openfirmware_exit(&args); - panic("%s: failed.", __func__); -} - -/* * Fire up any non-boot processors. */ void @@ -422,8 +406,6 @@ cpu_mp_shutdown(void) break; } } - /* XXX: delay a bit to allow the CPUs to actually enter the PROM. */ - DELAY(100000); critical_exit(); } @@ -443,7 +425,9 @@ cpu_ipi_stop(struct trapframe *tf) while ((started_cpus & PCPU_GET(cpumask)) == 0) { if ((shutdown_cpus & PCPU_GET(cpumask)) != 0) { atomic_clear_int(&shutdown_cpus, PCPU_GET(cpumask)); - sun4u_stopself(); + (void)intr_disable(); + for (;;) + ; } } atomic_clear_rel_int(&started_cpus, PCPU_GET(cpumask)); @@ -519,15 +503,12 @@ spitfire_ipi_send(u_int mid, u_long d0, */ DELAY(2); } - if ( -#ifdef KDB - kdb_active || -#endif - panicstr != NULL) + if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", __func__, mid); else - panic("%s: couldn't send IPI", __func__); + panic("%s: couldn't send IPI to module 0x%u", + __func__, mid); } static void @@ -581,40 +562,23 @@ cheetah_ipi_selected(u_int cpus, u_long } } /* + * On at least Fire V880 we may receive IDR_NACKs for + * CPUs we actually haven't tried to send an IPI to, + * but which apparently can be safely ignored. + */ + if (cpus == 0) + return; + /* * Leave interrupts enabled for a bit before retrying * in order to avoid deadlocks if the other CPUs are * also trying to send IPIs. */ - DELAY(2 * bnp); + DELAY(2 * mp_ncpus); } - if ( -#ifdef KDB - kdb_active || -#endif - panicstr != NULL) + if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI (cpus=0x%u ids=0x%lu)\n", __func__, cpus, ids); else - panic("%s: couldn't send IPI", __func__); -} - -void -ipi_selected(u_int cpus, u_int ipi) -{ - - cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); -} - -void -ipi_all(u_int ipi) -{ - - panic("%s", __func__); -} - -void -ipi_all_but_self(u_int ipi) -{ - - cpu_ipi_selected(PCPU_GET(other_cpus), 0, (u_long)tl_ipi_level, ipi); + panic("%s: couldn't send IPI (cpus=0x%u ids=0x%lu)", + __func__, cpus, ids); } From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 10:51:41 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44548106567A; Sun, 22 Mar 2009 10:51:41 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 31A818FC1C; Sun, 22 Mar 2009 10:51:41 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MApeLT066683; Sun, 22 Mar 2009 10:51:40 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MApeGb066682; Sun, 22 Mar 2009 10:51:40 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200903221051.n2MApeGb066682@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 22 Mar 2009 10:51: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: r190259 - stable/7/sbin/fdisk_pc98 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, 22 Mar 2009 10:51:42 -0000 Author: nyan Date: Sun Mar 22 10:51:40 2009 New Revision: 190259 URL: http://svn.freebsd.org/changeset/base/190259 Log: MFC: r190027 Use the common PC98_SID_ACTIVE define instead of a local define. Modified: stable/7/sbin/fdisk_pc98/ (props changed) stable/7/sbin/fdisk_pc98/fdisk.c Modified: stable/7/sbin/fdisk_pc98/fdisk.c ============================================================================== --- stable/7/sbin/fdisk_pc98/fdisk.c Sun Mar 22 10:42:07 2009 (r190258) +++ stable/7/sbin/fdisk_pc98/fdisk.c Sun Mar 22 10:51:40 2009 (r190259) @@ -84,8 +84,6 @@ struct mboot { static struct mboot mboot; static int fd; -#define ACTIVE 0x80 - static uint dos_cyls; static uint dos_heads; static uint dos_sectors; @@ -520,7 +518,7 @@ change_active(int which) active = -1; for (i = 0; i < NDOSPART; i++) { - if ((partp[i].dp_sid & ACTIVE) == 0) + if ((partp[i].dp_sid & PC98_SID_ACTIVE) == 0) continue; printf("Partition %d is marked active\n", i + 1); if (active == -1) @@ -545,7 +543,7 @@ setactive: active = new; } while (!ok("Are you happy with this choice")); if (active > 0 && active <= 8) - partp[active-1].dp_sid |= ACTIVE; + partp[active-1].dp_sid |= PC98_SID_ACTIVE; } static void From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 10:55:08 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02B1B106564A; Sun, 22 Mar 2009 10:55:08 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E38858FC13; Sun, 22 Mar 2009 10:55:07 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MAt7uM066806; Sun, 22 Mar 2009 10:55:07 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MAt7j9066805; Sun, 22 Mar 2009 10:55:07 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200903221055.n2MAt7j9066805@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 22 Mar 2009 10:55: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: r190260 - in stable/7/sys: . boot/pc98/libpc98 contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Mar 2009 10:55:08 -0000 Author: nyan Date: Sun Mar 22 10:55:07 2009 New Revision: 190260 URL: http://svn.freebsd.org/changeset/base/190260 Log: MFC: r190029 Use the common PC98_MID_* defines instead of a magic number. Modified: stable/7/sys/ (props changed) stable/7/sys/boot/pc98/libpc98/biosdisk.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/boot/pc98/libpc98/biosdisk.c ============================================================================== --- stable/7/sys/boot/pc98/libpc98/biosdisk.c Sun Mar 22 10:51:40 2009 (r190259) +++ stable/7/sys/boot/pc98/libpc98/biosdisk.c Sun Mar 22 10:55:07 2009 (r190260) @@ -602,9 +602,9 @@ bd_bestslice(struct open_disk *od) dp = &od->od_slicetab[0]; for (i = 0; i < od->od_nslices; i++, dp++) { - switch(dp->dp_mid & 0x7f) { - case DOSMID_386BSD & 0x7f: /* FreeBSD */ - if ((dp->dp_mid & 0x80) && + switch(dp->dp_mid & PC98_MID_MASK) { + case PC98_MID_386BSD: /* FreeBSD */ + if ((dp->dp_mid & PC98_MID_BOOTABLE) && (preflevel > PREF_FBSD_ACT)) { pref = i; preflevel = PREF_FBSD_ACT; @@ -620,7 +620,7 @@ bd_bestslice(struct open_disk *od) case 0x22: case 0x23: case 0x63: - if ((dp->dp_mid & 0x80) && + if ((dp->dp_mid & PC98_MID_BOOTABLE) && (preflevel > PREF_DOS_ACT)) { pref = i; preflevel = PREF_DOS_ACT; From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 11:03:25 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37E861065674; Sun, 22 Mar 2009 11:03:25 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23ED98FC18; Sun, 22 Mar 2009 11:03:25 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MB3OXv067043; Sun, 22 Mar 2009 11:03:24 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MB3Oai067042; Sun, 22 Mar 2009 11:03:24 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200903221103.n2MB3Oai067042@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 22 Mar 2009 11:03: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: r190261 - in stable/7/sys: . boot/pc98/libpc98 contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Mar 2009 11:03:27 -0000 Author: nyan Date: Sun Mar 22 11:03:24 2009 New Revision: 190261 URL: http://svn.freebsd.org/changeset/base/190261 Log: MFC: r190146, r190147 Teach the BIOS CD driver to use bounce buffers when the destination address is > 1 MB. Modified: stable/7/sys/ (props changed) stable/7/sys/boot/pc98/libpc98/bioscd.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/boot/pc98/libpc98/bioscd.c ============================================================================== --- stable/7/sys/boot/pc98/libpc98/bioscd.c Sun Mar 22 10:55:07 2009 (r190260) +++ stable/7/sys/boot/pc98/libpc98/bioscd.c Sun Mar 22 11:03:24 2009 (r190261) @@ -170,9 +170,9 @@ bc_add(int biosdev) static void bc_print(int verbose) { - int i; char line[80]; - + int i; + for (i = 0; i < nbcinfo; i++) { sprintf(line, " cd%d: Device 0x%x\n", i, bcinfo[i].bc_sp.sp_devicespec); @@ -232,7 +232,7 @@ bc_strategy(void *devdata, int rw, daddr if (dblk % (BIOSCD_SECSIZE / DEV_BSIZE) != 0) return (EINVAL); dblk /= (BIOSCD_SECSIZE / DEV_BSIZE); - DEBUG("read %d from %d to %p", blks, dblk, buf); + DEBUG("read %d from %lld to %p", blks, dblk, buf); if (rsize) *rsize = 0; @@ -241,9 +241,9 @@ bc_strategy(void *devdata, int rw, daddr return (EIO); } #ifdef BD_SUPPORT_FRAGS - DEBUG("bc_strategy: frag read %d from %d+%d to %p", + DEBUG("frag read %d from %lld+%d to %p", fragsize, dblk, blks, buf + (blks * BIOSCD_SECSIZE)); - if (fragsize && bc_read(unit, dblk + blks, 1, fragsize)) { + if (fragsize && bc_read(unit, dblk + blks, 1, fragbuf)) { DEBUG("frag read error"); return(EIO); } @@ -254,11 +254,14 @@ bc_strategy(void *devdata, int rw, daddr return (0); } +/* Max number of sectors to bounce-buffer at a time. */ +#define CD_BOUNCEBUF 8 + static int bc_read(int unit, daddr_t dblk, int blks, caddr_t dest) { - u_int result, retry; - static unsigned short packet[8]; + u_int maxfer, resid, result, retry, x; + caddr_t bbuf, p, xp; int biosdev; #ifdef DISK_DEBUG int error; @@ -272,40 +275,73 @@ bc_read(int unit, daddr_t dblk, int blks if (blks == 0) return (0); + /* Decide whether we have to bounce */ + if (VTOP(dest) >> 20 != 0) { + /* + * The destination buffer is above first 1MB of + * physical memory so we have to arrange a suitable + * bounce buffer. + */ + x = min(CD_BOUNCEBUF, (unsigned)blks); + bbuf = alloca(x * BIOSCD_SECSIZE); + maxfer = x; + } else { + bbuf = NULL; + maxfer = 0; + } + biosdev = bc_unit2bios(unit); - /* - * Loop retrying the operation a couple of times. The BIOS - * may also retry. - */ - for (retry = 0; retry < 3; retry++) { - /* If retrying, reset the drive */ - if (retry > 0) { + resid = blks; + p = dest; + + while (resid > 0) { + if (bbuf) + xp = bbuf; + else + xp = p; + x = resid; + if (maxfer > 0) + x = min(x, maxfer); + + /* + * Loop retrying the operation a couple of times. The BIOS + * may also retry. + */ + for (retry = 0; retry < 3; retry++) { + /* If retrying, reset the drive */ + if (retry > 0) { + v86.ctl = V86_FLAGS; + v86.addr = 0x1b; + v86.eax = 0x0300 | biosdev; + v86int(); + } + v86.ctl = V86_FLAGS; v86.addr = 0x1b; - v86.eax = 0x0300 | biosdev; + v86.eax = 0x0600 | (biosdev & 0x7f); + v86.ebx = x * BIOSCD_SECSIZE; + v86.ecx = dblk & 0xffff; + v86.edx = (dblk >> 16) & 0xffff; + v86.ebp = VTOPOFF(xp); + v86.es = VTOPSEG(xp); v86int(); + result = (v86.efl & PSL_C); + if (result == 0) + break; } - - v86.ctl = V86_FLAGS; - v86.addr = 0x1b; - v86.eax = 0x0600 | (biosdev & 0x7f); - v86.ebx = blks * BIOSCD_SECSIZE; - v86.ecx = dblk & 0xffff; - v86.edx = (dblk >> 16) & 0xffff; - v86.ebp = VTOPOFF(dest); - v86.es = VTOPSEG(dest); - v86int(); - result = (v86.efl & PSL_C); - if (result == 0) - break; - } #ifdef DISK_DEBUG - error = (v86.eax >> 8) & 0xff; + error = (v86.eax >> 8) & 0xff; #endif - DEBUG("%d sectors from %ld to %p (0x%x) %s", blks, dblk, dest, - VTOP(dest), result ? "failed" : "ok"); - DEBUG("unit %d status 0x%x", unit, error); + DEBUG("%d sectors from %lld to %p (0x%x) %s", x, dblk, p, + VTOP(p), result ? "failed" : "ok"); + DEBUG("unit %d status 0x%x", unit, error); + if (bbuf != NULL) + bcopy(bbuf, p, x * BIOSCD_SECSIZE); + p += (x * BIOSCD_SECSIZE); + dblk += x; + resid -= x; + } /* hexdump(dest, (blks * BIOSCD_SECSIZE)); */ return(0); From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 15:46:12 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C024B10656C3; Sun, 22 Mar 2009 15:46:12 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD8318FC12; Sun, 22 Mar 2009 15:46:12 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MFkCt9072599; Sun, 22 Mar 2009 15:46:12 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MFkCDv072598; Sun, 22 Mar 2009 15:46:12 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <200903221546.n2MFkCDv072598@svn.freebsd.org> From: Nick Hibma Date: Sun, 22 Mar 2009 15:46:12 +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: r190267 - stable/7/sys/kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Mar 2009 15:46:13 -0000 Author: n_hibma Date: Sun Mar 22 15:46:12 2009 New Revision: 190267 URL: http://svn.freebsd.org/changeset/base/190267 Log: If the device marked itself quiet, make detachment quiet as well. This avoids 'XX: detached' messages when the 'attached' message was suppressed. Modified: stable/7/sys/kern/subr_bus.c Modified: stable/7/sys/kern/subr_bus.c ============================================================================== --- stable/7/sys/kern/subr_bus.c Sun Mar 22 15:29:12 2009 (r190266) +++ stable/7/sys/kern/subr_bus.c Sun Mar 22 15:46:12 2009 (r190267) @@ -2444,7 +2444,8 @@ device_detach(device_t dev) if ((error = DEVICE_DETACH(dev)) != 0) return (error); devremoved(dev); - device_printf(dev, "detached\n"); + if (!device_is_quiet(dev)) + device_printf(dev, "detached\n"); if (dev->parent) BUS_CHILD_DETACHED(dev->parent, dev); From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 16:27:15 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A64E106564A; Sun, 22 Mar 2009 16:27:15 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 159FD8FC0C; Sun, 22 Mar 2009 16:27:15 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MGRErF073619; Sun, 22 Mar 2009 16:27:14 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MGREaS073611; Sun, 22 Mar 2009 16:27:14 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <200903221627.n2MGREaS073611@svn.freebsd.org> From: Nick Hibma Date: Sun, 22 Mar 2009 16:27:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190268 - in stable/7: share/man/man4 sys/conf sys/dev/usb sys/modules sys/modules/u3g 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, 22 Mar 2009 16:27:15 -0000 Author: n_hibma Date: Sun Mar 22 16:27:14 2009 New Revision: 190268 URL: http://svn.freebsd.org/changeset/base/190268 Log: MFC the (current) u3g driver, a driver for USB based 3G cards and dongles. This includes changes to ubsa (removing attachment from that device), and small changes to ucom. Note: A change to umass reducing the attach priority for it was committed already. Added: stable/7/share/man/man4/u3g.4 (contents, props changed) stable/7/sys/dev/usb/u3g.c (contents, props changed) stable/7/sys/modules/u3g/ stable/7/sys/modules/u3g/Makefile (contents, props changed) Modified: stable/7/share/man/man4/Makefile stable/7/sys/conf/NOTES stable/7/sys/conf/files stable/7/sys/conf/options stable/7/sys/dev/usb/ubsa.c stable/7/sys/dev/usb/ucom.c stable/7/sys/dev/usb/usbdevs stable/7/sys/modules/Makefile Modified: stable/7/share/man/man4/Makefile ============================================================================== --- stable/7/share/man/man4/Makefile Sun Mar 22 15:46:12 2009 (r190267) +++ stable/7/share/man/man4/Makefile Sun Mar 22 16:27:14 2009 (r190268) @@ -373,6 +373,7 @@ MAN= aac.4 \ twe.4 \ tx.4 \ txp.4 \ + u3g.4 \ uark.4 \ uart.4 \ ubsa.4 \ @@ -538,6 +539,7 @@ MLINKS+=tl.4 if_tl.4 MLINKS+=tun.4 if_tun.4 MLINKS+=tx.4 if_tx.4 MLINKS+=txp.4 if_txp.4 +MLINKS+=u3g.4 u3gstub.4 MLINKS+=udav.4 if_udav.4 MLINKS+=ural.4 if_ural.4 MLINKS+=vge.4 if_vge.4 Added: stable/7/share/man/man4/u3g.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/share/man/man4/u3g.4 Sun Mar 22 16:27:14 2009 (r190268) @@ -0,0 +1,125 @@ +.\" +.\" Copyright (c) 2008 AnyWi Technologies +.\" All rights reserved. +.\" +.\" This code is derived from uark.c +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 7, 2008 +.Dt U3G 4 +.Os +.Sh NAME +.Nm u3g +.Nd USB support for 3G datacards +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device u3g" +.Cd "device ucom" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +u3g_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the multiple USB-to-serial interfaces exposed by +many 3G USB/PCCard modems. +.Pp +The device is accessed through the +.Xr ucom 4 +driver which makes it behave like a +.Xr tty 4 . +.Sh HARDWARE +The +.Nm +driver supports the following adapters: +.Pp +.Bl -bullet -compact +.It +Option GT 3G Fusion, GT Fusion Quad, etc. (only 3G part, not WLAN) +.It +Option GT 3G, GT 3G Quad, etc. +.It +Vodafone Mobile Connect Card 3G +.It +Qualcomm Inc. CDMA MSM +.It +Huawei B190, E220 ('') +.It +Novatal U740, MC950D, X950D, etc. +.It +Sierra MC875U, MC8775U, etc. +.El +.Pp +(See +.Pa /sys/dev/u3g.c +for the complete list of supported cards for each vendor +mentioned above.) +.Pp +The supported 3G cards provide the necessary modem port for ppp, pppd, or mpd +connections as well as extra ports (depending on the specific device) to +provide other functions (additional command port, diagnostic port, SIM toolkit +port). +.Pp +In some of these devices a mass storage device supported by the +.Xr umass 4 +driver is present which contains Windows and Mac OS X drivers. +The device starts up in disk mode (TruInstall, ZeroCD, etc.) and requires +additional commands to switch it to modem mode. +.Pp +The +.Xr u3gstub 4 +device will attach temporarily to a 3G device with a mass storage device and +force it to switch to modem mode, +The attach and detach of +.Xr u3gstub +and any driver disk device present on the 3G device is is hidden, unless the +machine was booted in verbose mode (see +.Xr boot 8 ) . +To temporarily unhide the device, set +.Va debug.bootverbose +to 1 using +.Xr sysctl 8 +and replug the device. +.Sh SEE ALSO +.Xr tty 4 , +.Xr ucom 4 , +.Xr usb 4 +.Sh HISTORY +The +.Nm +driver appeared in +.Fx 8.0 , +is based on the +.Xr uark 4 +driver, and written by +.An Andrea Guzzo Aq aguzzo@anywi.com +in September 2008. +.Sh AUTHORS +The +.Nm +driver was written by +.An Andrea Guzzo Aq aguzzo@anywi.com +and +.An Nick Hibma Aq n_hibma@freebsd.org . +Hardware for testing was provided by AnyWi Technologies, Leiden, NL. Modified: stable/7/sys/conf/NOTES ============================================================================== --- stable/7/sys/conf/NOTES Sun Mar 22 15:46:12 2009 (r190267) +++ stable/7/sys/conf/NOTES Sun Mar 22 16:27:14 2009 (r190268) @@ -2429,6 +2429,8 @@ device uscanner # # USB serial support device ucom +# USB support for 3G modem cards by Option, Novatel, Huawei and Sierra +device u3g # USB support for Technologies ARK3116 based serial adapters device uark # USB support for Belkin F5U103 and compatible serial adapters Modified: stable/7/sys/conf/files ============================================================================== --- stable/7/sys/conf/files Sun Mar 22 15:46:12 2009 (r190267) +++ stable/7/sys/conf/files Sun Mar 22 16:27:14 2009 (r190268) @@ -1286,6 +1286,7 @@ dev/usb/ohci_pci.c optional ohci pci dev/usb/sl811hs.c optional slhci dev/usb/slhci_pccard.c optional slhci pccard dev/usb/uark.c optional uark +dev/usb/u3g.c optional u3g dev/usb/ubsa.c optional ubsa dev/usb/ubser.c optional ubser dev/usb/ucom.c optional ucom Modified: stable/7/sys/conf/options ============================================================================== --- stable/7/sys/conf/options Sun Mar 22 15:46:12 2009 (r190267) +++ stable/7/sys/conf/options Sun Mar 22 16:27:14 2009 (r190268) @@ -619,6 +619,7 @@ UKBD_DFLT_KEYMAP opt_ukbd.h UPLCOM_INTR_INTERVAL opt_uplcom.h UVSCOM_DEFAULT_OPKTSIZE opt_uvscom.h UVSCOM_INTR_INTERVAL opt_uvscom.h +U3G_DEBUG opt_u3g.h # Embedded system options INIT_PATH Added: stable/7/sys/dev/usb/u3g.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sys/dev/usb/u3g.c Sun Mar 22 16:27:14 2009 (r190268) @@ -0,0 +1,799 @@ +/* + * Copyright (c) 2008 AnyWi Technologies + * Author: Andrea Guzzo + * * based on uark.c 1.1 2006/08/14 08:30:22 jsg * + * * parts from ubsa.c 183348 2008-09-25 12:00:56Z phk * + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ + +/* + * Notes: + * - The detour through the tty layer is ridiculously expensive wrt buffering + * due to the high speeds. + * We should consider adding a simple r/w device which allows attaching of PPP + * in a more efficient way. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#if __FreeBSD_version >= 800000 +#include "opt_u3g.h" +#endif +#include "usbdevs.h" + +//#define U3G_DEBUG +#ifdef U3G_DEBUG +#define DPRINTF(x...) do { if (u3gdebug) device_printf(sc->sc_dev, ##x); } while (0) +int u3gdebug = 1; +#else +#define DPRINTF(x...) /* nop */ +#endif + +#define U3G_MAXPORTS 4 +#define U3G_CONFIG_INDEX 0 + +struct u3g_softc { + struct ucom_softc sc_ucom[U3G_MAXPORTS]; + device_t sc_dev; + usbd_device_handle sc_udev; + u_int8_t sc_speed; + u_int8_t sc_flags; + u_char sc_numports; +}; + +static int u3g_open(void *addr, int portno); +static void u3g_close(void *addr, int portno); + +struct ucom_callback u3g_callback = { + NULL, + NULL, + NULL, + NULL, + u3g_open, + u3g_close, + NULL, + NULL, +}; + + +struct u3g_speeds_s { + u_int32_t ispeed; + u_int32_t ospeed; +}; + +static const struct u3g_speeds_s u3g_speeds[] = { +#define U3GSP_GPRS 0 + {64000, 64000}, +#define U3GSP_EDGE 1 + {384000, 64000}, +#define U3GSP_CDMA 2 + {384000, 64000}, +#define U3GSP_UMTS 3 + {384000, 64000}, +#define U3GSP_HSDPA 4 + {1200000, 384000}, +#define U3GSP_HSUPA 5 + {1200000, 384000}, +#define U3GSP_HSPA 6 + {7200000, 384000}, +}; + +#define U3GIBUFSIZE 1024 +#define U3GOBUFSIZE 1024 + +/* + * Various supported device vendors/products. + */ +struct u3g_dev_type_s { + struct usb_devno devno; + u_int8_t speed; + u_int8_t flags; +#define U3GFL_NONE 0x00 +#define U3GFL_HUAWEI_INIT 0x01 // Requires init command (Huawei cards) +#define U3GFL_SCSI_EJECT 0x02 // Requires SCSI eject command (Novatel) +#define U3GFL_SIERRA_INIT 0x04 // Requires init command (Sierra cards) +#define U3GFL_CMOTECH_INIT 0x08 // Requires init command (CMOTECH cards) +#define U3GFL_STUB_WAIT 0x80 // Device reappears after a short delay +}; + +// Note: The entries marked with XXX should be checked for the correct speed +// indication to set the buffer sizes. +static const struct u3g_dev_type_s u3g_devs[] = { + /* OEM: Option */ + {{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3G }, U3GSP_UMTS, U3GFL_NONE }, + {{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GQUAD }, U3GSP_UMTS, U3GFL_NONE }, + {{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GPLUS }, U3GSP_UMTS, U3GFL_NONE }, + {{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAX36 }, U3GSP_HSDPA, U3GFL_NONE }, + {{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAXHSUPA }, U3GSP_HSDPA, U3GFL_NONE }, + {{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_VODAFONEMC3G }, U3GSP_UMTS, U3GFL_NONE }, + /* OEM: Qualcomm, Inc. */ + {{ USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_ZTE_STOR }, U3GSP_CDMA, U3GFL_SCSI_EJECT }, + {{ USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_CDMA_MSM }, U3GSP_CDMA, U3GFL_SCSI_EJECT }, + /* OEM: Huawei */ + {{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE }, U3GSP_HSDPA, U3GFL_HUAWEI_INIT }, + {{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E220 }, U3GSP_HSPA, U3GFL_HUAWEI_INIT }, + /* OEM: Novatel */ + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_CDMA_MODEM }, U3GSP_CDMA, U3GFL_SCSI_EJECT }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_ES620 }, U3GSP_UMTS, U3GFL_SCSI_EJECT }, // XXX + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_MC950D }, U3GSP_HSUPA, U3GFL_SCSI_EJECT }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U720 }, U3GSP_UMTS, U3GFL_SCSI_EJECT }, // XXX + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U727 }, U3GSP_UMTS, U3GFL_SCSI_EJECT }, // XXX + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740 }, U3GSP_HSDPA, U3GFL_SCSI_EJECT }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740_2 }, U3GSP_HSDPA, U3GFL_SCSI_EJECT }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U870 }, U3GSP_UMTS, U3GFL_SCSI_EJECT }, // XXX + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V620 }, U3GSP_UMTS, U3GFL_SCSI_EJECT }, // XXX + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V640 }, U3GSP_UMTS, U3GFL_SCSI_EJECT }, // XXX + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V720 }, U3GSP_UMTS, U3GFL_SCSI_EJECT }, // XXX + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V740 }, U3GSP_HSDPA, U3GFL_SCSI_EJECT }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_X950D }, U3GSP_HSUPA, U3GFL_SCSI_EJECT }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_XU870 }, U3GSP_HSDPA, U3GFL_SCSI_EJECT }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_ZEROCD }, U3GSP_HSUPA, U3GFL_SCSI_EJECT }, + {{ USB_VENDOR_DELL, USB_PRODUCT_DELL_U740 }, U3GSP_HSDPA, U3GFL_SCSI_EJECT }, + /* OEM: Merlin */ + {{ USB_VENDOR_MERLIN, USB_PRODUCT_MERLIN_V620 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + /* OEM: Sierra Wireless: */ + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD580 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD595 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC595U }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC597E }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_C597 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880E }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880U }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881E }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881U }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_EM5625 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5720 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5720_2 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5725 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MINI5725 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD875 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755_2 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755_3 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8765 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC875U }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8775_2 }, U3GSP_HSDPA, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8780 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8781 }, U3GSP_UMTS, U3GFL_NONE }, // XXX + {{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_TRUINSTALL }, U3GSP_UMTS, U3GFL_SIERRA_INIT }, + {{ USB_VENDOR_HP, USB_PRODUCT_HP_HS2300 }, U3GSP_HSDPA, U3GFL_NONE }, + /* OEM: CMOTECH */ + {{ USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CGU628 }, U3GSP_HSDPA, U3GFL_CMOTECH_INIT }, + {{ USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_DISK }, U3GSP_HSDPA, U3GFL_NONE }, +}; +#define u3g_lookup(v, p) ((const struct u3g_dev_type_s *)usb_lookup(u3g_devs, v, p)) + +static int +u3g_match(device_t self) +{ + struct usb_attach_arg *uaa = device_get_ivars(self); + const struct u3g_dev_type_s *u3g_dev_type; + + if (!uaa->iface) + return UMATCH_NONE; + + u3g_dev_type = u3g_lookup(uaa->vendor, uaa->product); + if (!u3g_dev_type) + return UMATCH_NONE; + + if (u3g_dev_type->flags&U3GFL_HUAWEI_INIT) { + /* If the interface class of the first interface is no longer + * mass storage the card has changed to modem (see u3g_attach() + * below). + */ + usb_interface_descriptor_t *id; + id = usbd_get_interface_descriptor(uaa->iface); + if (!id || id->bInterfaceClass == UICLASS_MASS) + return UMATCH_NONE; + } + + return UMATCH_VENDOR_PRODUCT_CONF_IFACE; +} + +static int +u3g_attach(device_t self) +{ + struct u3g_softc *sc = device_get_softc(self); + struct usb_attach_arg *uaa = device_get_ivars(self); + const struct u3g_dev_type_s *u3g_dev_type; + usbd_device_handle dev = uaa->device; + usb_interface_descriptor_t *id; + usb_endpoint_descriptor_t *ed; + int i, n; + usb_config_descriptor_t *cd; + char devnamefmt[32]; + +#if __FreeBSD_version < 700000 + char *devinfo = malloc(1024, M_USBDEV, M_WAITOK); + usbd_devinfo(dev, 0, devinfo); + device_printf(self, "%s\n", devinfo); + free(devinfo, M_USBDEV); +#endif + + /* get the config descriptor */ + cd = usbd_get_config_descriptor(dev); + if (cd == NULL) { + device_printf(self, "failed to get configuration descriptor\n"); + return ENXIO; + } + + sc->sc_dev = self; + sc->sc_udev = dev; + + u3g_dev_type = u3g_lookup(uaa->vendor, uaa->product); + sc->sc_flags = u3g_dev_type->flags; + sc->sc_speed = u3g_dev_type->speed; + + sprintf(devnamefmt,"U%d.%%d", device_get_unit(self)); + int portno = 0; + for (i = 0; i < uaa->nifaces && portno < U3G_MAXPORTS; i++) { + if (uaa->ifaces[i] == NULL) + continue; + + id = usbd_get_interface_descriptor(uaa->ifaces[i]); + if (id && id->bInterfaceClass == UICLASS_MASS) { + /* We attach to the interface instead of the device as + * some devices have a built-in SD card reader. + * Claim the first umass device (cdX) as it contains + * only Windows drivers anyway (CD-ROM), hiding it. + */ +#ifndef U3G_DEBUG + if (!bootverbose) + if (uaa->vendor == USB_VENDOR_HUAWEI) + if (id->bInterfaceNumber == 2) + uaa->ifaces[i] = NULL; +#endif + continue; + } + + int bulkin_no = -1, bulkout_no = -1; + int claim_iface = 0; + for (n = 0; n < id->bNumEndpoints && portno < U3G_MAXPORTS; n++) { + ed = usbd_interface2endpoint_descriptor(uaa->ifaces[i], n); + if (ed == NULL) + continue; + if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN + && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) + bulkin_no = ed->bEndpointAddress; + else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT + && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) + bulkout_no = ed->bEndpointAddress; + + /* If we have found a pair of bulk-in/-out endpoints + * create a serial port for it. Note: We assume that + * the bulk-in and bulk-out endpoints appear in pairs. + */ + if (bulkin_no != -1 && bulkout_no != -1) { + struct ucom_softc *ucom = &sc->sc_ucom[portno]; + + ucom->sc_dev = self; + ucom->sc_udev = dev; + ucom->sc_iface = uaa->ifaces[i]; + ucom->sc_bulkin_no = bulkin_no; + ucom->sc_bulkout_no = bulkout_no; + ucom->sc_ibufsize = U3GIBUFSIZE; + ucom->sc_ibufsizepad = U3GIBUFSIZE; + ucom->sc_obufsize = U3GOBUFSIZE; + ucom->sc_opkthdrlen = 0; + + ucom->sc_callback = &u3g_callback; + ucom->sc_parent = sc; + ucom->sc_portno = portno; + + DPRINTF("port=%d iface=%d in=0x%x out=0x%x\n", + portno, i, + ucom->sc_bulkin_no, + ucom->sc_bulkout_no); +#if __FreeBSD_version < 700000 + ucom_attach_tty(ucom, MINOR_CALLOUT, devnamefmt, portno); +#elif __FreeBSD_version < 800000 + ucom_attach_tty(ucom, TS_CALLOUT, devnamefmt, portno); +#else + ucom_attach_tty(ucom, devnamefmt, portno); +#endif + + claim_iface = 1; + portno++; + bulkin_no = bulkout_no = -1; + } + } + if (claim_iface) + uaa->ifaces[i] = NULL; // claim the interface + } + sc->sc_numports = portno; + + device_printf(self, "configured %d serial ports (%s)\n", + sc->sc_numports, devnamefmt); + return 0; +} + +static int +u3g_detach(device_t self) +{ + struct u3g_softc *sc = device_get_softc(self); + int rv = 0; + int i; + + for (i = 0; i < sc->sc_numports; i++) { + sc->sc_ucom[i].sc_dying = 1; + rv = ucom_detach(&sc->sc_ucom[i]); + if (rv != 0) { + device_printf(self, "ucom_detach(U%d.%d\n", device_get_unit(self), i); + return rv; + } + } + + return 0; +} + +static int +u3g_open(void *addr, int portno) +{ +#if __FreeBSD_version < 800000 + /* Supply generous buffering for these cards to avoid disappointments + * when setting the speed incorrectly. Only do this for the first port + * assuming that the rest of the ports are used for diagnostics only + * anyway. + * Note: We abuse the fact that ucom sets the speed through + * ispeed/ospeed, not through ispeedwat/ospeedwat. + */ + if (portno == 0) { + struct u3g_softc *sc = addr; + struct ucom_softc *ucom = &sc->sc_ucom[portno]; + struct tty *tp = ucom->sc_tty; + + tp->t_ispeedwat = u3g_speeds[sc->sc_speed].ispeed; + tp->t_ospeedwat = u3g_speeds[sc->sc_speed].ospeed; + + /* Avoid excessive buffer sizes. + * XXX The values here should be checked. Lower them and see + * whether 'lost chars' messages appear. + */ + if (tp->t_ispeedwat > 384000) + tp->t_ispeedwat = 384000; + if (tp->t_ospeedwat > 384000) + tp->t_ospeedwat = 384000; + + ttsetwater(tp); + } +#endif + + return 0; +} + +static void +u3g_close(void *addr, int portno) +{ +#if __FreeBSD_version < 800000 + if (portno == 0) { /* see u3g_open() */ + /* Reduce the buffers allocated above again */ + struct u3g_softc *sc = addr; + struct ucom_softc *ucom = &sc->sc_ucom[portno]; + struct tty *tp = ucom->sc_tty; +#ifdef U3G_DEBUG + device_t self = sc->sc_dev; +#endif + + tp->t_ispeedwat = (speed_t)-1; + tp->t_ospeedwat = (speed_t)-1; + + ttsetwater(tp); + } +#endif +} + +static device_method_t u3g_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, u3g_match), + DEVMETHOD(device_attach, u3g_attach), + DEVMETHOD(device_detach, u3g_detach), + + { 0, 0 } +}; + +static driver_t u3g_driver = { + "ucom", + u3g_methods, + sizeof (struct u3g_softc) +}; + +DRIVER_MODULE(u3g, uhub, u3g_driver, ucom_devclass, usbd_driver_load, 0); +MODULE_DEPEND(u3g, usb, 1, 1, 1); +MODULE_DEPEND(u3g, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER); +MODULE_VERSION(u3g, 1); + +/******************************************************************* + ****** Stub driver to hide devices that need to reinitialise ****** + *******************************************************************/ + +struct u3gstub_softc { + device_t sc_dev; + usbd_device_handle sc_udev; + usbd_pipe_handle sc_pipe_out, sc_pipe_in; + usbd_xfer_handle sc_xfer; +}; + +static int +u3gstub_huawei_init(struct u3gstub_softc *sc, struct usb_attach_arg *uaa) +{ + usb_device_request_t req; + + req.bmRequestType = UT_WRITE_DEVICE; + req.bRequest = UR_SET_FEATURE; + USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP); + USETW(req.wIndex, UHF_PORT_SUSPEND); + USETW(req.wLength, 0); + + (void) usbd_do_request(uaa->device, &req, 0); /* ignore any error */ + + return 1; +} + +static void +u3gstub_BBB_cb(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status err) +{ + struct u3gstub_softc *sc = (struct u3gstub_softc *) priv; + unsigned char cmd[13]; + + if (err) { + device_printf(sc->sc_dev, + "Failed to send CD eject command to " + "change to modem mode\n"); + } else { + usbd_setup_xfer(sc->sc_xfer, sc->sc_pipe_in, NULL, cmd, sizeof(cmd), + 0, USBD_DEFAULT_TIMEOUT, NULL); + int err = usbd_transfer(sc->sc_xfer) != USBD_NORMAL_COMPLETION; + if (err != USBD_NORMAL_COMPLETION && err != USBD_IN_PROGRESS) + DPRINTF("failed to start transfer (CSW)\n"); + } +} + +static int +u3gstub_scsi_eject(struct u3gstub_softc *sc, struct usb_attach_arg *uaa) +{ + /* See definition of umass_bbb_cbw_t in sys/dev/usb/umass.c and struct + * scsi_start_stop_unit in sys/cam/scsi/scsi_all.h . + */ + unsigned char cmd[31] = { + 0x55, 0x53, 0x42, 0x43, /* 0..3: Command Block Wrapper (CBW) signature */ + 0x01, 0x00, 0x00, 0x00, /* 4..7: CBW Tag, unique 32-bit number */ + 0x00, 0x00, 0x00, 0x00, /* 8..11: CBW Transfer Length, no data here */ + 0x00, /* 12: CBW Flag: output */ + 0x00, /* 13: CBW Lun */ + 0x06, /* 14: CBW Length */ + + 0x1b, /* 15+0: opcode: SCSI START/STOP */ + 0x00, /* 15+1: byte2: Not immediate */ + 0x00, 0x00, /* 15+2..3: reserved */ + 0x02, /* 15+4: Load/Eject command */ + 0x00, /* 15+5: control */ + 0x00, 0x00, 0x00, 0x00, /* 15+6..15: unused */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 + }; + + usb_interface_descriptor_t *id; + usb_endpoint_descriptor_t *ed = NULL; + int i; + + + /* Find the bulk-out endpoints */ + id = usbd_get_interface_descriptor(uaa->iface); + for (i = 0 ; i < id->bNumEndpoints; i++) { + ed = usbd_interface2endpoint_descriptor(uaa->iface, i); + if (ed != NULL + && (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) { + if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT) { + if (usbd_open_pipe(uaa->iface, + ed->bEndpointAddress, + USBD_EXCLUSIVE_USE, + &sc->sc_pipe_out) + != USBD_NORMAL_COMPLETION) { + DPRINTF("failed to open bulk-out pipe on endpoint %d\n", + ed->bEndpointAddress); + return 0; + } + } else { + if (usbd_open_pipe(uaa->iface, + ed->bEndpointAddress, + USBD_EXCLUSIVE_USE, + &sc->sc_pipe_in) + != USBD_NORMAL_COMPLETION) { + DPRINTF("failed to open bulk-in pipe on endpoint %d\n", + ed->bEndpointAddress); + return 0; + } + } + } + if (sc->sc_pipe_out && sc->sc_pipe_in) + break; + } + + if (i == id->bNumEndpoints) { + DPRINTF("failed to find bulk-out pipe\n"); + return 0; + } + + sc->sc_xfer = usbd_alloc_xfer(uaa->device); + if (sc->sc_xfer == NULL) { + DPRINTF("failed to allocate xfer\n"); + return 0; + } + + usbd_setup_xfer(sc->sc_xfer, sc->sc_pipe_out, NULL, cmd, sizeof(cmd), + 0, USBD_DEFAULT_TIMEOUT, u3gstub_BBB_cb); + int err = usbd_transfer(sc->sc_xfer) != USBD_NORMAL_COMPLETION; + if (err != USBD_NORMAL_COMPLETION && err != USBD_IN_PROGRESS) { + DPRINTF("failed to start transfer (CBW)\n"); + return 0; + } + + return 1; +} + +static int +u3gstub_cmotech_init(struct u3gstub_softc *sc, struct usb_attach_arg *uaa) +{ + /* See definition of umass_bbb_cbw_t in sys/dev/usb/umass.c + * in sys/cam/scsi/scsi_all.h . + */ + unsigned char cmd[31] = { + 0x55, 0x53, 0x42, 0x43, /* 0..3: Command Block Wrapper (CBW) signature */ + 0x01, 0x00, 0x00, 0x00, /* 4..7: CBW Tag, unique 32-bit number */ + 0x00, 0x00, 0x00, 0x00, /* 8..11: CBW Transfer Length, no data here */ + 0x80, /* 12: CBW Flag: output, so 0 */ + 0x00, /* 13: CBW Lun */ + 0x08, /* 14: CBW Length */ + + 0xff, /* 15+0 */ + 0x52, /* 15+1 */ + 0x44, /* 15+2 */ + 0x45, /* 15+2 */ + 0x56, /* 15+4 */ + 0x43, /* 15+5 */ + 0x48, /* 15+5 */ + 0x47, /* 15+5 */ + 0x00, 0x00, 0x00, 0x00, /* 15+8..15: unused */ + 0x00, 0x00, 0x00, 0x00 + }; + + usb_interface_descriptor_t *id; + usb_endpoint_descriptor_t *ed = NULL; + int i; + + + /* Find the bulk-out endpoints */ + id = usbd_get_interface_descriptor(uaa->iface); + for (i = 0 ; i < id->bNumEndpoints ; i++) { + ed = usbd_interface2endpoint_descriptor(uaa->iface, i); + if (ed != NULL + && (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) { + if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT) { + if (usbd_open_pipe(uaa->iface, + ed->bEndpointAddress, + USBD_EXCLUSIVE_USE, + &sc->sc_pipe_out) + != USBD_NORMAL_COMPLETION) { + DPRINTF("failed to open bulk-out pipe on endpoint %d\n", + ed->bEndpointAddress); + return 0; + } + } else { + if (usbd_open_pipe(uaa->iface, + ed->bEndpointAddress, + USBD_EXCLUSIVE_USE, + &sc->sc_pipe_in) + != USBD_NORMAL_COMPLETION) { + DPRINTF("failed to open bulk-in pipe on endpoint %d\n", + ed->bEndpointAddress); + return 0; + } + } + } + if (sc->sc_pipe_out && sc->sc_pipe_in) + break; + } + + if (i == id->bNumEndpoints) { + DPRINTF("failed to find bulk-out pipe\n"); + return 0; + } + + sc->sc_xfer = usbd_alloc_xfer(uaa->device); + if (sc->sc_xfer == NULL) { + DPRINTF("failed to allocate xfer\n"); + return 0; + } + + usbd_setup_xfer(sc->sc_xfer, sc->sc_pipe_out, NULL, cmd, sizeof(cmd), + 0, USBD_DEFAULT_TIMEOUT, u3gstub_BBB_cb); + int err = usbd_transfer(sc->sc_xfer) != USBD_NORMAL_COMPLETION; + if (err != USBD_NORMAL_COMPLETION && err != USBD_IN_PROGRESS) { + DPRINTF("failed to start transfer (CBW)\n"); + return 0; + } + + return 1; +} + +static int +u3gstub_sierra_init(struct u3gstub_softc *sc, struct usb_attach_arg *uaa) +{ + usb_device_request_t req; + + req.bmRequestType = UT_VENDOR; + req.bRequest = UR_SET_INTERFACE; + USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP); + USETW(req.wIndex, UHF_PORT_CONNECTION); + USETW(req.wLength, 0); + + (void) usbd_do_request(uaa->device, &req, 0); /* ignore any error */ + + return 1; +} + +static int +u3gstub_match(device_t self) +{ + struct usb_attach_arg *uaa = device_get_ivars(self); + const struct u3g_dev_type_s *u3g_dev_type; + usb_interface_descriptor_t *id; + + /* This stub handles 3G modem devices (E220, Mobile, etc.) with + * auto-install flash disks for Windows/MacOSX on the first interface. + * After some command or some delay they change appearance to a modem. + */ + + if (!uaa->iface) + return UMATCH_NONE; + + u3g_dev_type = u3g_lookup(uaa->vendor, uaa->product); + if (!u3g_dev_type) + return UMATCH_NONE; + + if (u3g_dev_type->flags&U3GFL_HUAWEI_INIT + || u3g_dev_type->flags&U3GFL_SCSI_EJECT + || u3g_dev_type->flags&U3GFL_SIERRA_INIT + || u3g_dev_type->flags&U3GFL_CMOTECH_INIT + || u3g_dev_type->flags&U3GFL_STUB_WAIT) { + /* We assume that if the first interface is still a mass + * storage device the device has not yet changed appearance. + */ + id = usbd_get_interface_descriptor(uaa->iface); + if (id && id->bInterfaceNumber == 0 + && id->bInterfaceClass == UICLASS_MASS) { +#ifndef U3G_DEBUG + if (!bootverbose) + device_quiet(self); +#endif + + return UMATCH_VENDOR_PRODUCT; + } + } + + return UMATCH_NONE; +} + +static int +u3gstub_attach(device_t self) +{ + struct u3gstub_softc *sc = device_get_softc(self); + struct usb_attach_arg *uaa = device_get_ivars(self); + const struct u3g_dev_type_s *u3g_dev_type; + int i; + +#ifndef U3G_DEBUG + if (!bootverbose) + device_quiet(self); +#endif + + sc->sc_dev = self; + sc->sc_udev = uaa->device; + + for (i = 0; i < uaa->nifaces; i++) + uaa->ifaces[i] = NULL; // claim all interfaces + + u3g_dev_type = u3g_lookup(uaa->vendor, uaa->product); + if (u3g_dev_type->flags&U3GFL_HUAWEI_INIT) { + if (bootverbose) + device_printf(sc->sc_dev, + "changing Huawei modem to modem mode\n"); + if (!u3gstub_huawei_init(sc, uaa)) + return ENXIO; + } else if (u3g_dev_type->flags&U3GFL_SCSI_EJECT) { + if (bootverbose) + device_printf(sc->sc_dev, "sending CD eject command to " + "change to modem mode\n"); + if (!u3gstub_scsi_eject(sc, uaa)) + return ENXIO; + } else if (u3g_dev_type->flags&U3GFL_SIERRA_INIT) { + if (bootverbose) + device_printf(sc->sc_dev, + "changing Sierra modem to modem mode\n"); + if (!u3gstub_sierra_init(sc, uaa)) + return ENXIO; + } else if (u3g_dev_type->flags&U3GFL_CMOTECH_INIT) { + if (bootverbose) + device_printf(sc->sc_dev, + "changing CMOTECH modem to modem mode\n"); + if (!u3gstub_cmotech_init(sc, uaa)) + return ENXIO; + } else if (u3g_dev_type->flags&U3GFL_STUB_WAIT) { + if (bootverbose) + device_printf(sc->sc_dev, "waiting for modem to change " + "to modem mode\n"); + /* nop */ + } + + return 0; +} + +static int +u3gstub_detach(device_t self) +{ + struct u3gstub_softc *sc = device_get_softc(self); + + if (sc->sc_xfer) + usbd_free_xfer(sc->sc_xfer); + + if (sc->sc_pipe_in) { + usbd_abort_pipe(sc->sc_pipe_in); + usbd_close_pipe(sc->sc_pipe_in); + } + if (sc->sc_pipe_out) { + usbd_abort_pipe(sc->sc_pipe_out); + usbd_close_pipe(sc->sc_pipe_out); + } + + return 0; +} + +static device_method_t u3gstub_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, u3gstub_match), + DEVMETHOD(device_attach, u3gstub_attach), + DEVMETHOD(device_detach, u3gstub_detach), + + { 0, 0 } +}; + +static driver_t u3gstub_driver = { + "u3g", + u3gstub_methods, + sizeof (struct u3gstub_softc) +}; + +DRIVER_MODULE(u3gstub, uhub, u3gstub_driver, ucom_devclass, usbd_driver_load, 0); +MODULE_DEPEND(u3gstub, usb, 1, 1, 1); Modified: stable/7/sys/dev/usb/ubsa.c ============================================================================== --- stable/7/sys/dev/usb/ubsa.c Sun Mar 22 15:46:12 2009 (r190267) +++ stable/7/sys/dev/usb/ubsa.c Sun Mar 22 16:27:14 2009 (r190268) @@ -210,8 +210,12 @@ static const struct ubsa_product { uint16_t vendor; uint16_t product; } ubsa_products [] = { + /* AnyData ADU-500A */ + { USB_VENDOR_ANYDATA, USB_PRODUCT_ANYDATA_ADU_500A }, /* AnyData ADU-E100A/H */ { USB_VENDOR_ANYDATA, USB_PRODUCT_ANYDATA_ADU_E100X }, + /* Axesstel MV100H */ + { USB_VENDOR_AXESSTEL, USB_PRODUCT_AXESSTEL_DATAMODEM }, /* BELKIN F5U103 */ { USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U103 }, /* BELKIN F5U120 */ @@ -222,24 +226,6 @@ static const struct ubsa_product { { USB_VENDOR_GOHUBS, USB_PRODUCT_GOHUBS_GOCOM232 }, /* Peracom */ { USB_VENDOR_PERACOM, USB_PRODUCT_PERACOM_SERIAL1 }, - /* Novatel Wireless Merlin cards */ - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740 }, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 20:36:27 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25F5B1065678; Sun, 22 Mar 2009 20:36:27 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1380A8FC2C; Sun, 22 Mar 2009 20:36:27 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MKaQhR082449; Sun, 22 Mar 2009 20:36:26 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MKaQqJ082448; Sun, 22 Mar 2009 20:36:26 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903222036.n2MKaQqJ082448@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 20:36:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190273 - stable/7/usr.sbin/eeprom 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, 22 Mar 2009 20:36:28 -0000 Author: marius Date: Sun Mar 22 20:36:26 2009 New Revision: 190273 URL: http://svn.freebsd.org/changeset/base/190273 Log: MFC: 190097 - Sprinkle const. - Remove incorrect __unused. Modified: stable/7/usr.sbin/eeprom/ (props changed) stable/7/usr.sbin/eeprom/ofw_options.c Modified: stable/7/usr.sbin/eeprom/ofw_options.c ============================================================================== --- stable/7/usr.sbin/eeprom/ofw_options.c Sun Mar 22 18:56:26 2009 (r190272) +++ stable/7/usr.sbin/eeprom/ofw_options.c Sun Mar 22 20:36:26 2009 (r190273) @@ -52,18 +52,18 @@ __FBSDID("$FreeBSD$"); struct ofwo_extabent { const char *ex_prop; - int (*ex_handler)(struct ofwo_extabent *, int, const void *, - int, const char *); + int (*ex_handler)(const struct ofwo_extabent *, int, + const void *, int, const char *); }; -static int ofwo_oemlogo(struct ofwo_extabent *, int, const void *, int, - const char *); -static int ofwo_secmode(struct ofwo_extabent *, int, const void *, int, - const char *); -static int ofwo_secpwd(struct ofwo_extabent *, int, const void *, int, - const char *); +static int ofwo_oemlogo(const struct ofwo_extabent *, int, const void *, + int, const char *); +static int ofwo_secmode(const struct ofwo_extabent *, int, const void *, + int, const char *); +static int ofwo_secpwd(const struct ofwo_extabent *, int, const void *, + int, const char *); -static struct ofwo_extabent ofwo_extab[] = { +static const struct ofwo_extabent const ofwo_extab[] = { { "oem-logo", ofwo_oemlogo }, { "security-mode", ofwo_secmode }, { "security-password", ofwo_secpwd }, @@ -81,8 +81,8 @@ ofwo_printprop(const char *prop, const c } static int -ofwo_oemlogo(struct ofwo_extabent *exent, int fd, const void *buf, int buflen, - const char *val) +ofwo_oemlogo(const struct ofwo_extabent *exent, int fd, const void *buf, + int buflen, const char *val) { int lfd; char logo[OFWO_LOGO + 1]; @@ -117,8 +117,8 @@ ofwo_oemlogo(struct ofwo_extabent *exent } static int -ofwo_secmode(struct ofwo_extabent *exent, int fd, const void *buf, int buflen, - const char *val) +ofwo_secmode(const struct ofwo_extabent *exent, int fd, const void *buf, + int buflen, const char *val) { int res; @@ -145,8 +145,8 @@ ofwo_secmode(struct ofwo_extabent *exent } static int -ofwo_secpwd(struct ofwo_extabent *exent, int fd __unused, - const void *buf __unused, __unused int buflen, const char *val) +ofwo_secpwd(const struct ofwo_extabent *exent, int fd, const void *buf, + int buflen, const char *val) { void *pbuf; int len, pblen, rv; @@ -246,14 +246,14 @@ ofwo_dump(void) int fd, len, nlen, pblen; phandle_t optnode; char prop[OFWO_MAXPROP + 1]; - struct ofwo_extabent *ex; + const struct ofwo_extabent *ex; pblen = 0; pbuf = NULL; fd = ofw_open(O_RDONLY); optnode = ofw_optnode(fd); for (nlen = ofw_firstprop(fd, optnode, prop, sizeof(prop)); nlen != 0; - nlen = ofw_nextprop(fd, optnode, prop, prop, sizeof(prop))) { + nlen = ofw_nextprop(fd, optnode, prop, prop, sizeof(prop))) { len = ofw_getprop_alloc(fd, optnode, prop, &pbuf, &pblen, 1); if (len < 0) continue; @@ -277,7 +277,7 @@ ofwo_action(const char *prop, const char { void *pbuf; int fd, len, pblen, rv; - struct ofwo_extabent *ex; + const struct ofwo_extabent *ex; pblen = 0; rv = EX_OK; @@ -300,7 +300,7 @@ ofwo_action(const char *prop, const char rv = (*ex->ex_handler)(ex, fd, pbuf, len, val); else if (val) rv = ofwo_setstr(fd, pbuf, len, prop, val); - else + else ofwo_printprop(prop, (char *)pbuf, len); out: if (pbuf != NULL) From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 20:46:39 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF6EB1065673; Sun, 22 Mar 2009 20:46:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC3D18FC14; Sun, 22 Mar 2009 20:46:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MKkc6T082805; Sun, 22 Mar 2009 20:46:38 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MKkcUu082801; Sun, 22 Mar 2009 20:46:38 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200903222046.n2MKkcUu082801@svn.freebsd.org> From: Alan Cox Date: Sun, 22 Mar 2009 20:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190275 - in stable/7/sys: amd64/amd64 amd64/include i386/i386 i386/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: Sun, 22 Mar 2009 20:46:40 -0000 Author: alc Date: Sun Mar 22 20:46:37 2009 New Revision: 190275 URL: http://svn.freebsd.org/changeset/base/190275 Log: MFC r188932, r189785, r189795, and r190272 Optimize free_pv_entry(); specifically, avoid repeated TAILQ_REMOVE()s. Update the pmap's resident page count when a page table page is freed in pmap_remove_pde() and pmap_remove_pages(). Update stale comments. The alternate address space mapping was eliminated when PAE support was added to i386. The direct mapping exists on amd64. Modified: stable/7/sys/amd64/amd64/pmap.c stable/7/sys/amd64/include/pmap.h stable/7/sys/i386/i386/pmap.c stable/7/sys/i386/include/pmap.h Modified: stable/7/sys/amd64/amd64/pmap.c ============================================================================== --- stable/7/sys/amd64/amd64/pmap.c Sun Mar 22 20:36:37 2009 (r190274) +++ stable/7/sys/amd64/amd64/pmap.c Sun Mar 22 20:46:37 2009 (r190275) @@ -1905,15 +1905,15 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv pc->pc_map[field] |= 1ul << bit; /* move to head of list */ TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); - TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); if (pc->pc_map[0] != PC_FREE0 || pc->pc_map[1] != PC_FREE1 || - pc->pc_map[2] != PC_FREE2) + pc->pc_map[2] != PC_FREE2) { + TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); return; + } PV_STAT(pv_entry_spare -= _NPCPV); PV_STAT(pc_chunk_count--); PV_STAT(pc_chunk_frees++); /* entire chunk is free, return it */ - TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); dump_drop_page(m->phys_addr); vm_page_unwire(m, 0); @@ -2325,6 +2325,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t mpte = pmap_lookup_pt_page(pmap, sva); if (mpte != NULL) { pmap_remove_pt_page(pmap, mpte); + pmap->pm_stats.resident_count--; KASSERT(mpte->wire_count == NPTEPG, ("pmap_remove_pde: pte page wire count error")); mpte->wire_count = 0; @@ -3797,6 +3798,7 @@ pmap_remove_pages(pmap_t pmap) mpte = pmap_lookup_pt_page(pmap, pv->pv_va); if (mpte != NULL) { pmap_remove_pt_page(pmap, mpte); + pmap->pm_stats.resident_count--; KASSERT(mpte->wire_count == NPTEPG, ("pmap_remove_pages: pte page wire count error")); mpte->wire_count = 0; Modified: stable/7/sys/amd64/include/pmap.h ============================================================================== --- stable/7/sys/amd64/include/pmap.h Sun Mar 22 20:36:37 2009 (r190274) +++ stable/7/sys/amd64/include/pmap.h Sun Mar 22 20:46:37 2009 (r190275) @@ -156,13 +156,7 @@ typedef u_int64_t pml4_entry_t; #define PDESHIFT (3) /* - * Address of current and alternate address space page table maps - * and directories. - * XXX it might be saner to just direct map all of physical memory - * into the kernel using 2MB pages. We have enough space to do - * it (2^47 bits of KVM, while current max physical addressability - * is 2^40 physical bits). Then we can get rid of the evil hole - * in the page tables and the evil overlapping. + * Address of current address space page table maps and directories. */ #ifdef _KERNEL #define addr_PTmap (KVADDR(PML4PML4I, 0, 0, 0)) Modified: stable/7/sys/i386/i386/pmap.c ============================================================================== --- stable/7/sys/i386/i386/pmap.c Sun Mar 22 20:36:37 2009 (r190274) +++ stable/7/sys/i386/i386/pmap.c Sun Mar 22 20:46:37 2009 (r190275) @@ -1973,15 +1973,15 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv pc->pc_map[field] |= 1ul << bit; /* move to head of list */ TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); - TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); for (idx = 0; idx < _NPCM; idx++) - if (pc->pc_map[idx] != pc_freemask[idx]) + if (pc->pc_map[idx] != pc_freemask[idx]) { + TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); return; + } PV_STAT(pv_entry_spare -= _NPCPV); PV_STAT(pc_chunk_count--); PV_STAT(pc_chunk_frees++); /* entire chunk is free, return it */ - TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); m = PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)pc)); pmap_qremove((vm_offset_t)pc, 1); vm_page_unwire(m, 0); @@ -2431,6 +2431,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t mpte = pmap_lookup_pt_page(pmap, sva); if (mpte != NULL) { pmap_remove_pt_page(pmap, mpte); + pmap->pm_stats.resident_count--; KASSERT(mpte->wire_count == NPTEPG, ("pmap_remove_pde: pte page wire count error")); mpte->wire_count = 0; @@ -3935,6 +3936,7 @@ pmap_remove_pages(pmap_t pmap) mpte = pmap_lookup_pt_page(pmap, pv->pv_va); if (mpte != NULL) { pmap_remove_pt_page(pmap, mpte); + pmap->pm_stats.resident_count--; KASSERT(mpte->wire_count == NPTEPG, ("pmap_remove_pages: pte page wire count error")); mpte->wire_count = 0; Modified: stable/7/sys/i386/include/pmap.h ============================================================================== --- stable/7/sys/i386/include/pmap.h Sun Mar 22 20:36:37 2009 (r190274) +++ stable/7/sys/i386/include/pmap.h Sun Mar 22 20:46:37 2009 (r190275) @@ -174,8 +174,7 @@ typedef uint32_t pt_entry_t; #endif /* - * Address of current and alternate address space page table maps - * and directories. + * Address of current address space page table maps and directories. */ #ifdef _KERNEL extern pt_entry_t PTmap[]; From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 20:50:46 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE7F010656D2; Sun, 22 Mar 2009 20:50:45 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D9F548FC27; Sun, 22 Mar 2009 20:50:45 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MKojAf083031; Sun, 22 Mar 2009 20:50:45 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MKojsg083030; Sun, 22 Mar 2009 20:50:45 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903222050.n2MKojsg083030@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 20:50:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190278 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb sys 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, 22 Mar 2009 20:50:49 -0000 Author: marius Date: Sun Mar 22 20:50:45 2009 New Revision: 190278 URL: http://svn.freebsd.org/changeset/base/190278 Log: MFC: 188040 Use NULL in preference to 0 for pointers. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/sys/kobj.h Modified: stable/7/sys/sys/kobj.h ============================================================================== --- stable/7/sys/sys/kobj.h Sun Mar 22 20:49:26 2009 (r190277) +++ stable/7/sys/sys/kobj.h Sun Mar 22 20:50:45 2009 (r190278) @@ -114,7 +114,7 @@ DEFINE_CLASS_0(name, name ## _class, met #define DEFINE_CLASS_0(name, classvar, methods, size) \ \ struct kobj_class classvar = { \ - #name, methods, size, 0 \ + #name, methods, size, NULL \ } /* @@ -127,7 +127,7 @@ struct kobj_class classvar = { \ base1) \ \ static kobj_class_t name ## _baseclasses[] = \ - { &base1, 0 }; \ + { &base1, NULL }; \ struct kobj_class classvar = { \ #name, methods, size, name ## _baseclasses \ } @@ -143,7 +143,7 @@ struct kobj_class classvar = { \ \ static kobj_class_t name ## _baseclasses[] = \ { &base1, \ - &base2, 0 }; \ + &base2, NULL }; \ struct kobj_class name ## _class = { \ #name, methods, size, name ## _baseclasses \ } @@ -160,7 +160,7 @@ struct kobj_class name ## _class = { \ static kobj_class_t name ## _baseclasses[] = \ { &base1, \ &base2, \ - &base3, 0 }; \ + &base3, NULL }; \ struct kobj_class name ## _class = { \ #name, methods, size, name ## _baseclasses \ } From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 20:52:43 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB5421065670; Sun, 22 Mar 2009 20:52:43 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A7EC58FC25; Sun, 22 Mar 2009 20:52:43 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MKqhSQ083145; Sun, 22 Mar 2009 20:52:43 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MKqhbk083144; Sun, 22 Mar 2009 20:52:43 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903222052.n2MKqhbk083144@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 20:52:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190279 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb sys 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, 22 Mar 2009 20:52:45 -0000 Author: marius Date: Sun Mar 22 20:52:43 2009 New Revision: 190279 URL: http://svn.freebsd.org/changeset/base/190279 Log: MFC: r188475 o Introduce KOBJMETHOD_END for the end of the kobj list. o Fix a minor indentation problem. o Put in the extra-strict KOBJMETHOD define, but commented out since the tree isn't yet ready. Reviewed by: (1) was posted to arch@ without objection (and 1 go for it) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/sys/kobj.h Modified: stable/7/sys/sys/kobj.h ============================================================================== --- stable/7/sys/sys/kobj.h Sun Mar 22 20:50:45 2009 (r190278) +++ stable/7/sys/sys/kobj.h Sun Mar 22 20:52:43 2009 (r190279) @@ -92,7 +92,17 @@ struct kobjop_desc { /* * Shorthand for constructing method tables. */ +#if 1 #define KOBJMETHOD(NAME, FUNC) { &NAME##_desc, (kobjop_t) FUNC } +#else /* notyet */ +#define KOBJMETHOD(NAME, FUNC) \ +{ &NAME##_desc, (kobjop_t) (FUNC != (NAME##_t *)NULL ? FUNC : NULL) } +#endif + +/* + * + */ +#define KOBJMETHOD_END { NULL, NULL } /* * Declare a class (which should be defined in another file. @@ -127,7 +137,7 @@ struct kobj_class classvar = { \ base1) \ \ static kobj_class_t name ## _baseclasses[] = \ - { &base1, NULL }; \ + { &base1, NULL }; \ struct kobj_class classvar = { \ #name, methods, size, name ## _baseclasses \ } From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 20:54:22 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84260106566C; Sun, 22 Mar 2009 20:54:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FDC68FC2A; Sun, 22 Mar 2009 20:54:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MKsMlT083256; Sun, 22 Mar 2009 20:54:22 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MKsMAR083254; Sun, 22 Mar 2009 20:54:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903222054.n2MKsMAR083254@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 20:54: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: r190281 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb sparc64/fhc 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: Sun, 22 Mar 2009 20:54:23 -0000 Author: marius Date: Sun Mar 22 20:54:22 2009 New Revision: 190281 URL: http://svn.freebsd.org/changeset/base/190281 Log: MFC: r190098 - Failing to register as interrupt controller during attach shouldn't be fatal so just inform about this instead of panicing. - Sort device methods. - Take advantage of KOBJMETHOD_END. - Remove some redundant variables. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/sparc64/fhc/fhc.c stable/7/sys/sparc64/sparc64/upa.c Modified: stable/7/sys/sparc64/fhc/fhc.c ============================================================================== --- stable/7/sys/sparc64/fhc/fhc.c Sun Mar 22 20:52:44 2009 (r190280) +++ stable/7/sys/sparc64/fhc/fhc.c Sun Mar 22 20:54:22 2009 (r190281) @@ -90,14 +90,14 @@ static device_method_t fhc_methods[] = { /* Bus interface */ DEVMETHOD(bus_print_child, fhc_print_child), DEVMETHOD(bus_probe_nomatch, fhc_probe_nomatch), - DEVMETHOD(bus_setup_intr, fhc_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_alloc_resource, fhc_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_get_resource_list, fhc_get_resource_list), + DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), + DEVMETHOD(bus_setup_intr, fhc_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), + DEVMETHOD(bus_get_resource_list, fhc_get_resource_list), /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_devinfo, fhc_get_devinfo), @@ -107,7 +107,7 @@ static device_method_t fhc_methods[] = { DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - { NULL, NULL } + KOBJMETHOD_END }; static driver_t fhc_driver = { @@ -165,9 +165,7 @@ fhc_attach(device_t dev) int central; int error; int i; - int nintr; - int nreg; - int rid; + int j; sc = device_get_softc(dev); node = ofw_bus_get_node(dev); @@ -177,9 +175,9 @@ fhc_attach(device_t dev) central = 1; for (i = 0; i < FHC_NREG; i++) { - rid = i; + j = i; sc->sc_memres[i] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &rid, RF_ACTIVE); + &j, RF_ACTIVE); if (sc->sc_memres[i] == NULL) { device_printf(dev, "cannot allocate resource %d\n", i); error = ENXIO; @@ -239,7 +237,8 @@ fhc_attach(device_t dev) /* * Hunt through all the interrupt mapping regs and register * our interrupt controller for the corresponding interrupt - * vectors. + * vectors. We do this early in order to be able to catch + * stray interrupts. */ for (i = FHC_FANFAIL; i <= FHC_TOD; i++) { fica = malloc(sizeof(*fica), M_DEVBUF, M_NOWAIT); @@ -259,11 +258,13 @@ fhc_attach(device_t dev) * the IGN and the IGN is constant for all devices * on that FireHose controller. */ - if (intr_controller_register(INTMAP_VEC(sc->sc_ign, + j = intr_controller_register(INTMAP_VEC(sc->sc_ign, INTINO(bus_read_4(fica->fica_memres, FHC_IMAP))), - &fhc_ic, fica) != 0) - panic("%s: could not register interrupt " - "controller for map %d", __func__, i); + &fhc_ic, fica); + if (j != 0) + device_printf(dev, "could not register " + "interrupt controller for map %d (%d)\n", + i, j); } } else { snprintf(ledname, sizeof(ledname), "board%d", board); @@ -276,9 +277,9 @@ fhc_attach(device_t dev) free(fdi, M_DEVBUF); continue; } - nreg = OF_getprop_alloc(child, "reg", sizeof(*reg), + i = OF_getprop_alloc(child, "reg", sizeof(*reg), (void **)®); - if (nreg == -1) { + if (i == -1) { device_printf(dev, "<%s>: incomplete\n", fdi->fdi_obdinfo.obd_name); ofw_bus_gen_destroy_devinfo(&fdi->fdi_obdinfo); @@ -286,19 +287,19 @@ fhc_attach(device_t dev) continue; } resource_list_init(&fdi->fdi_rl); - for (i = 0; i < nreg; i++) - resource_list_add(&fdi->fdi_rl, SYS_RES_MEMORY, i, - reg[i].sbr_offset, reg[i].sbr_offset + - reg[i].sbr_size, reg[i].sbr_size); + for (j = 0; j < i; j++) + resource_list_add(&fdi->fdi_rl, SYS_RES_MEMORY, j, + reg[j].sbr_offset, reg[j].sbr_offset + + reg[j].sbr_size, reg[j].sbr_size); free(reg, M_OFWPROP); if (central == 1) { - nintr = OF_getprop_alloc(child, "interrupts", + i = OF_getprop_alloc(child, "interrupts", sizeof(*intr), (void **)&intr); - if (nintr != -1) { - for (i = 0; i < nintr; i++) { - iv = INTMAP_VEC(sc->sc_ign, intr[i]); + if (i != -1) { + for (j = 0; j < i; j++) { + iv = INTMAP_VEC(sc->sc_ign, intr[j]); resource_list_add(&fdi->fdi_rl, - SYS_RES_IRQ, i, iv, iv, 1); + SYS_RES_IRQ, j, iv, iv, 1); } free(intr, M_OFWPROP); } Modified: stable/7/sys/sparc64/sparc64/upa.c ============================================================================== --- stable/7/sys/sparc64/sparc64/upa.c Sun Mar 22 20:52:44 2009 (r190280) +++ stable/7/sys/sparc64/sparc64/upa.c Sun Mar 22 20:54:22 2009 (r190281) @@ -144,7 +144,7 @@ static device_method_t upa_methods[] = { DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - { NULL, NULL } + KOBJMETHOD_END }; static devclass_t upa_devclass; @@ -241,7 +241,7 @@ upa_attach(device_t dev) "pci108e,8001") == 0 && ((bus_get_resource_start(children[j], SYS_RES_MEMORY, 0) >> 20) & 1) == 1) { - schizo = children[j]; + schizo = children[j]; break; } } @@ -287,9 +287,10 @@ upa_attach(device_t dev) goto fail; } - /* + /* * Hunt through all the interrupt mapping regs and register our * interrupt controller for the corresponding interrupt vectors. + * We do this early in order to be able to catch stray interrupts. */ for (i = UPA_INO_BASE; i <= UPA_INO_MAX; i++) { imr = 0; @@ -312,10 +313,11 @@ upa_attach(device_t dev) device_printf(dev, "intr map (INO %d) IMR%d: %#lx\n", i, imr, (u_long)UPA_READ(sc, imr, 0x0)); #endif - if (intr_controller_register(INTMAP_VEC(sc->sc_ign, i), - &upa_ic, uica) != 0) - panic("%s: could not register interrupt controller " - "for INO %d", __func__, i); + j = intr_controller_register(INTMAP_VEC(sc->sc_ign, i), + &upa_ic, uica); + if (j != 0) + device_printf(dev, "could not register interrupt " + "controller for INO %d (%d)\n", i, j); } /* Make sure the power level is appropriate for normal operation. */ @@ -345,13 +347,13 @@ upa_attach(device_t dev) device_printf(dev, "could not determine upa-portid of child 0x%lx\n", (unsigned long)child); - continue; + continue; } if (portid > 1) { device_printf(dev, "upa-portid %d of child 0x%lx invalid\n", portid, (unsigned long)child); - continue; + continue; } if ((udi = upa_setup_dinfo(dev, sc, child, portid)) == NULL) continue; @@ -493,12 +495,12 @@ upa_setup_intr(device_t dev, device_t ch /* * Make sure the vector is fully specified and we registered * our interrupt controller for it. - */ + */ vec = rman_get_start(ires); if (INTIGN(vec) != sc->sc_ign || intr_vectors[vec].iv_ic != &upa_ic) { device_printf(dev, "invalid interrupt vector 0x%lx\n", vec); - return (EINVAL); - } + return (EINVAL); + } return (bus_generic_setup_intr(dev, child, ires, flags, filt, func, arg, cookiep)); } From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 21:14:34 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F3841065675; Sun, 22 Mar 2009 21:14:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B34D8FC12; Sun, 22 Mar 2009 21:14:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MLEYSS083936; Sun, 22 Mar 2009 21:14:34 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MLEXFg083930; Sun, 22 Mar 2009 21:14:33 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903222114.n2MLEXFg083930@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 21:14: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: r190286 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb sparc64/central sparc64/ebus sparc64/pci sparc64/sbus 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: Sun, 22 Mar 2009 21:14:34 -0000 Author: marius Date: Sun Mar 22 21:14:33 2009 New Revision: 190286 URL: http://svn.freebsd.org/changeset/base/190286 Log: MFC: r190099 - Sort device methods. - Take advantage of KOBJMETHOD_END. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/sparc64/central/central.c stable/7/sys/sparc64/ebus/ebus.c stable/7/sys/sparc64/pci/apb.c stable/7/sys/sparc64/pci/ofw_pcib.c stable/7/sys/sparc64/sbus/dma_sbus.c stable/7/sys/sparc64/sparc64/nexus.c Modified: stable/7/sys/sparc64/central/central.c ============================================================================== --- stable/7/sys/sparc64/central/central.c Sun Mar 22 21:12:00 2009 (r190285) +++ stable/7/sys/sparc64/central/central.c Sun Mar 22 21:14:33 2009 (r190286) @@ -76,14 +76,14 @@ static device_method_t central_methods[] /* Bus interface */ DEVMETHOD(bus_print_child, central_print_child), DEVMETHOD(bus_probe_nomatch, central_probe_nomatch), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_alloc_resource, central_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_get_resource_list, central_get_resource_list), + DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), + DEVMETHOD(bus_get_resource_list, central_get_resource_list), /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_devinfo, central_get_devinfo), @@ -93,7 +93,7 @@ static device_method_t central_methods[] DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - { NULL, NULL } + KOBJMETHOD_END }; static driver_t central_driver = { Modified: stable/7/sys/sparc64/ebus/ebus.c ============================================================================== --- stable/7/sys/sparc64/ebus/ebus.c Sun Mar 22 21:12:00 2009 (r190285) +++ stable/7/sys/sparc64/ebus/ebus.c Sun Mar 22 21:14:33 2009 (r190286) @@ -110,14 +110,14 @@ static device_method_t ebus_methods[] = /* Bus interface */ DEVMETHOD(bus_print_child, ebus_print_child), DEVMETHOD(bus_probe_nomatch, ebus_probe_nomatch), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_alloc_resource, ebus_alloc_resource), - DEVMETHOD(bus_get_resource_list, ebus_get_resource_list), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_release_resource, ebus_release_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), + DEVMETHOD(bus_get_resource_list, ebus_get_resource_list), /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_devinfo, ebus_get_devinfo), @@ -127,7 +127,7 @@ static device_method_t ebus_methods[] = DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - { 0, 0 } + KOBJMETHOD_END }; static driver_t ebus_driver = { Modified: stable/7/sys/sparc64/pci/apb.c ============================================================================== --- stable/7/sys/sparc64/pci/apb.c Sun Mar 22 21:12:00 2009 (r190285) +++ stable/7/sys/sparc64/pci/apb.c Sun Mar 22 21:14:33 2009 (r190286) @@ -91,9 +91,9 @@ static device_method_t apb_methods[] = { DEVMETHOD(bus_read_ivar, pcib_read_ivar), DEVMETHOD(bus_write_ivar, pcib_write_ivar), DEVMETHOD(bus_alloc_resource, apb_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), @@ -106,7 +106,7 @@ static device_method_t apb_methods[] = { /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, ofw_pcib_gen_get_node), - { 0, 0 } + KOBJMETHOD_END }; static devclass_t pcib_devclass; Modified: stable/7/sys/sparc64/pci/ofw_pcib.c ============================================================================== --- stable/7/sys/sparc64/pci/ofw_pcib.c Sun Mar 22 21:12:00 2009 (r190285) +++ stable/7/sys/sparc64/pci/ofw_pcib.c Sun Mar 22 21:14:33 2009 (r190286) @@ -72,9 +72,9 @@ static device_method_t ofw_pcib_methods[ DEVMETHOD(bus_read_ivar, pcib_read_ivar), DEVMETHOD(bus_write_ivar, pcib_write_ivar), DEVMETHOD(bus_alloc_resource, pcib_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), @@ -87,7 +87,7 @@ static device_method_t ofw_pcib_methods[ /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, ofw_pcib_gen_get_node), - { 0, 0 } + KOBJMETHOD_END }; static devclass_t pcib_devclass; Modified: stable/7/sys/sparc64/sbus/dma_sbus.c ============================================================================== --- stable/7/sys/sparc64/sbus/dma_sbus.c Sun Mar 22 21:12:00 2009 (r190285) +++ stable/7/sys/sparc64/sbus/dma_sbus.c Sun Mar 22 21:14:33 2009 (r190286) @@ -122,14 +122,14 @@ static device_method_t dma_methods[] = { /* Bus interface */ DEVMETHOD(bus_print_child, dma_print_child), DEVMETHOD(bus_probe_nomatch, dma_probe_nomatch), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_alloc_resource, bus_generic_rl_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_get_resource_list, dma_get_resource_list), + DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), + DEVMETHOD(bus_get_resource_list, dma_get_resource_list), /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_devinfo, dma_get_devinfo), @@ -139,7 +139,7 @@ static device_method_t dma_methods[] = { DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - { 0, 0 } + KOBJMETHOD_END }; static driver_t dma_driver = { Modified: stable/7/sys/sparc64/sparc64/nexus.c ============================================================================== --- stable/7/sys/sparc64/sparc64/nexus.c Sun Mar 22 21:12:00 2009 (r190285) +++ stable/7/sys/sparc64/sparc64/nexus.c Sun Mar 22 21:14:33 2009 (r190286) @@ -122,11 +122,11 @@ static device_method_t nexus_methods[] = DEVMETHOD(bus_release_resource, nexus_release_resource), DEVMETHOD(bus_setup_intr, nexus_setup_intr), DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), + DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), + DEVMETHOD(bus_get_resource_list, nexus_get_resource_list), #ifdef SMP DEVMETHOD(bus_bind_intr, nexus_bind_intr), #endif - DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), - DEVMETHOD(bus_get_resource_list, nexus_get_resource_list), DEVMETHOD(bus_get_dma_tag, nexus_get_dma_tag), /* ofw_bus interface */ @@ -137,7 +137,7 @@ static device_method_t nexus_methods[] = DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - { 0, 0 } + KOBJMETHOD_END }; static devclass_t nexus_devclass; From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 21:16:10 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9B751065677; Sun, 22 Mar 2009 21:16:10 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA3DF8FC29; Sun, 22 Mar 2009 21:16:10 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MLGADk084022; Sun, 22 Mar 2009 21:16:10 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MLGADC084018; Sun, 22 Mar 2009 21:16:10 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903222116.n2MLGADC084018@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 21:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190287 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb sparc64/pci 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: Sun, 22 Mar 2009 21:16:12 -0000 Author: marius Date: Sun Mar 22 21:16:10 2009 New Revision: 190287 URL: http://svn.freebsd.org/changeset/base/190287 Log: MFC: r190101 Take advantage of KOBJMETHOD_END. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/sparc64/pci/ofw_pcibus.c stable/7/sys/sparc64/sparc64/eeprom.c stable/7/sys/sparc64/sparc64/rtc.c stable/7/sys/sparc64/sparc64/sc_machdep.c Modified: stable/7/sys/sparc64/pci/ofw_pcibus.c ============================================================================== --- stable/7/sys/sparc64/pci/ofw_pcibus.c Sun Mar 22 21:14:33 2009 (r190286) +++ stable/7/sys/sparc64/pci/ofw_pcibus.c Sun Mar 22 21:16:10 2009 (r190287) @@ -88,7 +88,7 @@ static device_method_t ofw_pcibus_method DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - { 0, 0 } + KOBJMETHOD_END }; struct ofw_pcibus_devinfo { Modified: stable/7/sys/sparc64/sparc64/eeprom.c ============================================================================== --- stable/7/sys/sparc64/sparc64/eeprom.c Sun Mar 22 21:14:33 2009 (r190286) +++ stable/7/sys/sparc64/sparc64/eeprom.c Sun Mar 22 21:16:10 2009 (r190287) @@ -91,7 +91,7 @@ static device_method_t eeprom_methods[] DEVMETHOD(clock_gettime, mk48txx_gettime), DEVMETHOD(clock_settime, mk48txx_settime), - { 0, 0 } + KOBJMETHOD_END }; static driver_t eeprom_driver = { Modified: stable/7/sys/sparc64/sparc64/rtc.c ============================================================================== --- stable/7/sys/sparc64/sparc64/rtc.c Sun Mar 22 21:14:33 2009 (r190286) +++ stable/7/sys/sparc64/sparc64/rtc.c Sun Mar 22 21:16:10 2009 (r190287) @@ -89,7 +89,7 @@ static device_method_t rtc_ebus_methods[ DEVMETHOD(clock_gettime, mc146818_gettime), DEVMETHOD(clock_settime, mc146818_settime), - { 0, 0 } + KOBJMETHOD_END }; static driver_t rtc_ebus_driver = { Modified: stable/7/sys/sparc64/sparc64/sc_machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/sc_machdep.c Sun Mar 22 21:14:33 2009 (r190286) +++ stable/7/sys/sparc64/sparc64/sc_machdep.c Sun Mar 22 21:16:10 2009 (r190287) @@ -57,7 +57,7 @@ static device_method_t sc_methods[] = { DEVMETHOD(device_probe, sc_probe), DEVMETHOD(device_attach, sc_attach), - { 0, 0 } + KOBJMETHOD_END }; static driver_t sc_driver = { From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 21:17:21 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BCBA1065748; Sun, 22 Mar 2009 21:17:21 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46E928FC21; Sun, 22 Mar 2009 21:17:21 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MLHLui084104; Sun, 22 Mar 2009 21:17:21 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MLHLYs084102; Sun, 22 Mar 2009 21:17:21 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903222117.n2MLHLYs084102@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 21:17:21 +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: r190288 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb 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: Sun, 22 Mar 2009 21:17:24 -0000 Author: marius Date: Sun Mar 22 21:17:20 2009 New Revision: 190288 URL: http://svn.freebsd.org/changeset/base/190288 Log: MFC: r190103 Take advantage of KOBJMETHOD_END. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/sparc64/sparc64/jbusppm.c stable/7/sys/sparc64/sparc64/schppm.c Modified: stable/7/sys/sparc64/sparc64/jbusppm.c ============================================================================== --- stable/7/sys/sparc64/sparc64/jbusppm.c Sun Mar 22 21:16:10 2009 (r190287) +++ stable/7/sys/sparc64/sparc64/jbusppm.c Sun Mar 22 21:17:20 2009 (r190288) @@ -78,7 +78,7 @@ static device_method_t jbusppm_methods[] DEVMETHOD(device_probe, jbusppm_probe), DEVMETHOD(device_attach, jbusppm_attach), - { NULL, NULL } + KOBJMETHOD_END }; static devclass_t jbusppm_devclass; Modified: stable/7/sys/sparc64/sparc64/schppm.c ============================================================================== --- stable/7/sys/sparc64/sparc64/schppm.c Sun Mar 22 21:16:10 2009 (r190287) +++ stable/7/sys/sparc64/sparc64/schppm.c Sun Mar 22 21:17:20 2009 (r190288) @@ -73,7 +73,7 @@ static device_method_t schppm_methods[] DEVMETHOD(device_probe, schppm_probe), DEVMETHOD(device_attach, schppm_attach), - { NULL, NULL } + KOBJMETHOD_END }; static devclass_t schppm_devclass; From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 21:31:03 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47549106566C; Sun, 22 Mar 2009 21:31:03 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3375F8FC12; Sun, 22 Mar 2009 21:31:03 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MLV3GQ084415; Sun, 22 Mar 2009 21:31:03 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MLV2Ka084411; Sun, 22 Mar 2009 21:31:02 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903222131.n2MLV2Ka084411@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 21:31:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190289 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb sparc64/include sparc64/sparc64 sun4v/include sun4v/sun4v 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, 22 Mar 2009 21:31:04 -0000 Author: marius Date: Sun Mar 22 21:31:02 2009 New Revision: 190289 URL: http://svn.freebsd.org/changeset/base/190289 Log: MFC: 190107 (partial) - There's no need to wrap kdb_active and kdb_trap() in #ifdef KDB as they're always available. - Remove unused variable. [1] - Add a missing const. - Sort includes. Submitted by: Christoph Mallon [1] Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/sparc64/include/trap.h stable/7/sys/sparc64/sparc64/trap.c stable/7/sys/sun4v/include/trap.h stable/7/sys/sun4v/sun4v/trap.c Modified: stable/7/sys/sparc64/include/trap.h ============================================================================== --- stable/7/sys/sparc64/include/trap.h Sun Mar 22 21:17:20 2009 (r190288) +++ stable/7/sys/sparc64/include/trap.h Sun Mar 22 21:31:02 2009 (r190289) @@ -91,7 +91,7 @@ #ifndef LOCORE void sun4u_set_traptable(void *tba_addr); -extern const char *trap_msg[]; +extern const char *const trap_msg[]; #endif #endif Modified: stable/7/sys/sparc64/sparc64/trap.c ============================================================================== --- stable/7/sys/sparc64/sparc64/trap.c Sun Mar 22 21:17:20 2009 (r190288) +++ stable/7/sys/sparc64/sparc64/trap.c Sun Mar 22 21:31:02 2009 (r190289) @@ -83,7 +83,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -113,7 +112,7 @@ extern char fas_nofault_end[]; extern char *syscallnames[]; -const char *trap_msg[] = { +const char *const trap_msg[] = { "reserved", "instruction access exception", "instruction access error", @@ -328,15 +327,12 @@ trap(struct trapframe *tf) KASSERT((tf->tf_type & T_KERNEL) != 0, ("trap: kernel trap isn't")); -#ifdef KDB if (kdb_active) { kdb_reenter(); return; } -#endif switch (tf->tf_type & ~T_KERNEL) { -#ifdef KDB case T_BREAKPOINT: case T_KSTACK_FAULT: error = (kdb_trap(tf->tf_type, 0, tf) == 0); @@ -348,7 +344,6 @@ trap(struct trapframe *tf) error = db_watch_trap(tf); break; #endif -#endif case T_DATA_MISS: case T_DATA_PROTECTION: case T_INSTRUCTION_MISS: @@ -408,7 +403,6 @@ static int trap_pfault(struct thread *td, struct trapframe *tf) { struct vmspace *vm; - struct pcb *pcb; struct proc *p; vm_offset_t va; vm_prot_t prot; @@ -428,7 +422,6 @@ trap_pfault(struct thread *td, struct tr rv = KERN_SUCCESS; ctx = TLB_TAR_CTX(tf->tf_tar); - pcb = td->td_pcb; type = tf->tf_type & ~T_KERNEL; va = TLB_TAR_VA(tf->tf_tar); @@ -558,11 +551,6 @@ syscall(struct trapframe *tf) PCPU_INC(cnt.v_syscall); - narg = 0; - error = 0; - reg = 0; - regcnt = REG_MAXARGS; - td->td_pticks = 0; td->td_frame = tf; if (td->td_ucred != p->p_ucred) @@ -580,6 +568,8 @@ syscall(struct trapframe *tf) tpc = tf->tf_tpc; TF_DONE(tf); + reg = 0; + regcnt = REG_MAXARGS; if (p->p_sysent->sv_prepsyscall) { /* * The prep code is MP aware. Modified: stable/7/sys/sun4v/include/trap.h ============================================================================== --- stable/7/sys/sun4v/include/trap.h Sun Mar 22 21:17:20 2009 (r190288) +++ stable/7/sys/sun4v/include/trap.h Sun Mar 22 21:31:02 2009 (r190289) @@ -144,7 +144,7 @@ #ifndef LOCORE -extern const char *trap_msg[]; +extern const char *const trap_msg[]; extern void set_mmfsa_traptable(void *, uint64_t); extern void trap_init(void); #endif Modified: stable/7/sys/sun4v/sun4v/trap.c ============================================================================== --- stable/7/sys/sun4v/sun4v/trap.c Sun Mar 22 21:17:20 2009 (r190288) +++ stable/7/sys/sun4v/sun4v/trap.c Sun Mar 22 21:31:02 2009 (r190289) @@ -81,7 +81,6 @@ #include #include #include -#include #include #include #include @@ -119,7 +118,7 @@ extern char fas_nofault_end[]; extern char *syscallnames[]; -const char *trap_msg[] = { +const char *const trap_msg[] = { "reserved", "instruction access exception", "instruction access error", @@ -390,21 +389,17 @@ trap(struct trapframe *tf, int64_t type, ("trap: kernel trap isn't - trap: %ld:%s: 0x%lx at 0x%lx on cpu=%d\n", trapno, trap_msg[trapno], data, tf->tf_tpc, curcpu)); -#ifdef KDB if (kdb_active) { kdb_reenter(); return; } -#endif switch (trapno) { -#ifdef KDB case T_BREAKPOINT: case T_KSTACK_FAULT: error = (kdb_trap(trapno, 0, tf) == 0); TF_DONE(tf); break; -#endif case T_DATA_MISS: case T_DATA_PROTECTION: case T_INSTRUCTION_MISS: @@ -460,7 +455,6 @@ static int trap_pfault(struct thread *td, struct trapframe *tf, int64_t type, uint64_t data) { struct vmspace *vm; - struct pcb *pcb; struct proc *p; vm_offset_t va; vm_prot_t prot; @@ -475,7 +469,6 @@ trap_pfault(struct thread *td, struct tr rv = KERN_SUCCESS; ctx = TLB_TAR_CTX(data); - pcb = td->td_pcb; type = type & ~T_KERNEL; va = TLB_TAR_VA(data); @@ -603,11 +596,6 @@ syscall(struct trapframe *tf) PCPU_INC(cnt.v_syscall); - narg = 0; - error = 0; - reg = 0; - regcnt = REG_MAXARGS; - td->td_pticks = 0; td->td_frame = tf; if (td->td_ucred != p->p_ucred) @@ -621,6 +609,8 @@ syscall(struct trapframe *tf) tpc = tf->tf_tpc; TF_DONE(tf); + reg = 0; + regcnt = REG_MAXARGS; if (p->p_sysent->sv_prepsyscall) { /* * The prep code is MP aware. From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 21:38:25 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 397E11065675; Sun, 22 Mar 2009 21:38:25 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 25CF68FC0C; Sun, 22 Mar 2009 21:38:25 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MLcPZG084615; Sun, 22 Mar 2009 21:38:25 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MLcOnK084613; Sun, 22 Mar 2009 21:38:24 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903222138.n2MLcOnK084613@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 21:38: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: r190290 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb sparc64/pci 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, 22 Mar 2009 21:38:25 -0000 Author: marius Date: Sun Mar 22 21:38:24 2009 New Revision: 190290 URL: http://svn.freebsd.org/changeset/base/190290 Log: MFC: r190109 - Ensure we find no unexpected partner. - Failing to register as interrupt controller during attach shouldn't be fatal so just inform about this instead of panicing. - Disable rerun of the streaming cache as workaround for a silicon bug of certain Psycho versions. - Remove the comment regarding lack of newbus'ified bus_dma(9) as being able to associate a DMA tag with a device would allow to implement CDMA flushing/syncing in bus_dmamap_sync(9) but that would totally kill performance. Given that for devices not behind a PCI-PCI bridge the host-to-PCI bridges also only do CDMA flushing/syncing based on interrupts there's no additional disadvantage for polling(4) callbacks in the case schizo(4) has to do the CDMA flushing/syncing but rather a general problem. - Don't panic if the power failure, power management or over-temperature interrupts doesn't exist as these aren't mandatory and not available with all controllers (not even Psychos). [1] - Take advantage of KOBJMETHOD_END. - Remove some redundant variables. - Add missing const. PR: 131371 [1] Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/sparc64/pci/psycho.c stable/7/sys/sparc64/pci/psychovar.h Modified: stable/7/sys/sparc64/pci/psycho.c ============================================================================== --- stable/7/sys/sparc64/pci/psycho.c Sun Mar 22 21:31:02 2009 (r190289) +++ stable/7/sys/sparc64/pci/psycho.c Sun Mar 22 21:38:24 2009 (r190290) @@ -84,7 +84,7 @@ static void psycho_set_intr(struct psych driver_filter_t, driver_intr_t); static int psycho_find_intrmap(struct psycho_softc *, u_int, bus_addr_t *, bus_addr_t *, u_long *); -static driver_filter_t psycho_dmasync; +static driver_filter_t psycho_dma_sync_stub; static void psycho_intr_enable(void *); static void psycho_intr_disable(void *); static void psycho_intr_assign(void *); @@ -151,7 +151,7 @@ static device_method_t psycho_methods[] /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, psycho_get_node), - { 0, 0 } + KOBJMETHOD_END }; static devclass_t psycho_devclass; @@ -176,7 +176,7 @@ struct psycho_icarg { bus_addr_t pica_clr; }; -struct psycho_dmasync { +struct psycho_dma_sync { struct psycho_softc *pds_sc; driver_filter_t *pds_handler; /* handler to call */ void *pds_arg; /* argument for the handler */ @@ -233,14 +233,14 @@ struct psycho_desc { const char *pd_name; }; -static const struct psycho_desc psycho_compats[] = { +static const struct psycho_desc const psycho_compats[] = { { "pci108e,8000", PSYCHO_MODE_PSYCHO, "Psycho compatible" }, { "pci108e,a000", PSYCHO_MODE_SABRE, "Sabre compatible" }, { "pci108e,a001", PSYCHO_MODE_SABRE, "Hummingbird compatible" }, { NULL, 0, NULL } }; -static const struct psycho_desc psycho_models[] = { +static const struct psycho_desc const psycho_models[] = { { "SUNW,psycho", PSYCHO_MODE_PSYCHO, "Psycho" }, { "SUNW,sabre", PSYCHO_MODE_SABRE, "Sabre" }, { NULL, 0, NULL } @@ -297,8 +297,8 @@ psycho_attach(device_t dev) phandle_t child, node; uint32_t dvmabase, prop, prop_array[2]; int32_t rev; - u_int ver; - int i, n, nrange, rid; + u_int rerun, ver; + int i, n; node = ofw_bus_get_node(dev); sc = device_get_softc(dev); @@ -316,7 +316,7 @@ psycho_attach(device_t dev) * (2) the shared Psycho configuration registers */ if (sc->sc_mode == PSYCHO_MODE_PSYCHO) { - rid = 2; + i = 2; sc->sc_pcictl = bus_get_resource_start(dev, SYS_RES_MEMORY, 0) - bus_get_resource_start(dev, SYS_RES_MEMORY, 2); @@ -333,18 +333,18 @@ psycho_attach(device_t dev) /* NOTREACHED */ } } else { - rid = 0; + i = 0; sc->sc_pcictl = PSR_PCICTL0; sc->sc_half = 0; } - sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &i, (sc->sc_mode == PSYCHO_MODE_PSYCHO ? RF_SHAREABLE : 0) | RF_ACTIVE); if (sc->sc_mem_res == NULL) panic("%s: could not allocate registers", __func__); /* - * Match other Psycho's that are already configured against + * Match other Psychos that are already configured against * the base physical address. This will be the same for a * pair of devices that share register space. */ @@ -364,6 +364,8 @@ psycho_attach(device_t dev) panic("%s: could not malloc mutex", __func__); mtx_init(sc->sc_mtx, "pcib_mtx", NULL, MTX_SPIN); } else { + if (sc->sc_mode != PSYCHO_MODE_PSYCHO) + panic("%s: no partner expected", __func__); if (mtx_initialized(osc->sc_mtx) == 0) panic("%s: mutex not initialized", __func__); sc->sc_mtx = osc->sc_mtx; @@ -409,16 +411,17 @@ psycho_attach(device_t dev) case 0: dr |= DIAG_RTRY_DIS; dr &= ~DIAG_DWSYNC_DIS; - /* XXX need to also disable rerun of the streaming buffers. */ + rerun = 0; break; case 1: csr &= ~PCICTL_ARB_PARK; dr |= DIAG_RTRY_DIS | DIAG_DWSYNC_DIS; - /* XXX need to also disable rerun of the streaming buffers. */ + rerun = 0; break; default: dr |= DIAG_DWSYNC_DIS; dr &= ~DIAG_RTRY_DIS; + rerun = 1; break; } @@ -461,13 +464,12 @@ psycho_attach(device_t dev) rman_manage_region(&sc->sc_pci_mem_rman, 0, PSYCHO_MEM_SIZE) != 0) panic("%s: failed to set up memory rman", __func__); - nrange = OF_getprop_alloc(node, "ranges", sizeof(*range), - (void **)&range); + n = OF_getprop_alloc(node, "ranges", sizeof(*range), (void **)&range); /* * Make sure that the expected ranges are present. The * OFW_PCI_CS_MEM64 one is not currently used though. */ - if (nrange != PSYCHO_NRANGE) + if (n != PSYCHO_NRANGE) panic("%s: unsupported number of ranges", __func__); /* * Find the addresses of the various bus spaces. @@ -494,7 +496,8 @@ psycho_attach(device_t dev) /* * Hunt through all the interrupt mapping regs and register * our interrupt controller for the corresponding interrupt - * vectors. + * vectors. We do this early in order to be able to catch + * stray interrupts. */ for (n = 0; n <= PSYCHO_MAX_INO; n++) { if (psycho_find_intrmap(sc, n, &intrmap, &intrclr, @@ -524,22 +527,23 @@ psycho_attach(device_t dev) INTMAP_ENABLE(INTMAP_VEC(sc->sc_ign, n), PCPU_GET(mid))); #endif - if (intr_controller_register(INTMAP_VEC(sc->sc_ign, n), - &psycho_ic, pica) != 0) - panic("%s: could not register interrupt " - "controller for INO %d", __func__, n); + i = intr_controller_register(INTMAP_VEC(sc->sc_ign, n), + &psycho_ic, pica); + if (i != 0) + device_printf(dev, "could not register " + "interrupt controller for INO %d (%d)\n", + n, i); } - if (sc->sc_mode == PSYCHO_MODE_PSYCHO) { - /* Initialize the counter-timer. */ + if (sc->sc_mode == PSYCHO_MODE_PSYCHO) sparc64_counter_init(device_get_nameunit(dev), rman_get_bustag(sc->sc_mem_res), rman_get_bushandle(sc->sc_mem_res), PSR_TC0); - } /* * Set up IOMMU and PCI configuration if we're the first - * of a pair of Psycho's to arrive here. + * of a pair of Psychos to arrive here or a Hummingbird + * or Sabre. * * We should calculate a TSB size based on amount of RAM * and number of bus controllers and number and type of @@ -557,10 +561,10 @@ psycho_attach(device_t dev) else sc->sc_is->is_pmaxaddr = IOMMU_MAXADDR(PSYCHO_IOMMU_BITS); - sc->sc_is->is_sb[0] = 0; - sc->sc_is->is_sb[1] = 0; + sc->sc_is->is_sb[0] = sc->sc_is->is_sb[1] = 0; if (OF_getproplen(node, "no-streaming-cache") < 0) sc->sc_is->is_sb[0] = sc->sc_pcictl + PCR_STRBUF; + sc->sc_is->is_flags |= (rerun != 1) ? IOMMU_RERUN_DISABLE : 0; psycho_iommu_init(sc, 3, dvmabase); } else { /* Just copy IOMMU state, config tag and address. */ @@ -695,12 +699,20 @@ psycho_set_intr(struct psycho_softc *sc, rid = index; sc->sc_irq_res[index] = bus_alloc_resource_any(sc->sc_dev, SYS_RES_IRQ, &rid, RF_ACTIVE); + if (sc->sc_irq_res[index] == NULL && intrmap >= PSR_POWER_INT_MAP) { + /* + * These interrupts aren't mandatory and not available + * with all controllers (not even Psychos). + */ + return; + } if (sc->sc_irq_res[index] == NULL || INTIGN(vec = rman_get_start(sc->sc_irq_res[index])) != sc->sc_ign || INTVEC(PSYCHO_READ8(sc, intrmap)) != vec || intr_vectors[vec].iv_ic != &psycho_ic || - bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index], INTR_TYPE_MISC, - filt, intr, sc, &sc->sc_ihand[index]) != 0) + bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index], + INTR_TYPE_MISC | INTR_FAST, filt, intr, sc, + &sc->sc_ihand[index]) != 0) panic("%s: failed to set up interrupt %d", __func__, index); } @@ -1066,9 +1078,9 @@ psycho_read_ivar(device_t dev, device_t } static int -psycho_dmasync(void *arg) +psycho_dma_sync_stub(void *arg) { - struct psycho_dmasync *pds = arg; + struct psycho_dma_sync *pds = arg; (void)PCIB_READ_CONFIG(pds->pds_ppb, pds->pds_bus, pds->pds_slot, pds->pds_func, PCIR_VENDOR, 2); @@ -1126,7 +1138,7 @@ psycho_setup_intr(device_t dev, device_t devclass_t pci_devclass; device_t cdev, pdev, pcidev; struct psycho_softc *sc; - struct psycho_dmasync *pds; + struct psycho_dma_sync *pds; u_long vec; int error; @@ -1143,17 +1155,12 @@ psycho_setup_intr(device_t dev, device_t } /* - * The Sabre-APB-combination has a bug where it does not drain - * DMA write data for devices behind additional PCI-PCI bridges - * underneath the APB PCI-PCI bridge. The workaround is to do - * a read on the farest PCI-PCI bridge followed by a read of the - * PCI DMA write sync register of the Sabre. - * XXX installing the wrapper for an affected device and the - * actual workaround in psycho_dmasync() should be moved to - * psycho(4)-specific bus_dma_tag_create() and bus_dmamap_sync() - * methods, respectively, once DMA tag creation is newbus'ified, - * so the workaround isn't only applied for interrupt handlers - * but also for polling(4) callbacks. + * The Sabre-APB-combination does not automatically flush DMA + * write data for devices behind additional PCI-PCI bridges + * underneath the APB PCI-PCI bridge. The procedure for a + * manual flush is to do a PIO read on the far side of the + * farthest PCI-PCI bridge followed by a read of the PCI DMA + * write sync register of the Sabre. */ if (sc->sc_mode == PSYCHO_MODE_SABRE) { pds = malloc(sizeof(*pds), M_DEVBUF, M_NOWAIT | M_ZERO); @@ -1192,20 +1199,20 @@ psycho_setup_intr(device_t dev, device_t pds->pds_func = pci_get_function(pcidev); if (bootverbose) device_printf(dev, "installed DMA sync " - "workaround for device %d.%d on bus %d\n", + "wrapper for device %d.%d on bus %d\n", pds->pds_slot, pds->pds_func, pds->pds_bus); if (intr == NULL) { pds->pds_handler = filt; error = bus_generic_setup_intr(dev, child, - ires, flags, psycho_dmasync, intr, pds, - cookiep); + ires, flags, psycho_dma_sync_stub, intr, + pds, cookiep); } else { pds->pds_handler = (driver_filter_t *)intr; error = bus_generic_setup_intr(dev, child, ires, flags, filt, - (driver_intr_t *)psycho_dmasync, pds, - cookiep); + (driver_intr_t *)psycho_dma_sync_stub, + pds, cookiep); } } else error = bus_generic_setup_intr(dev, child, ires, @@ -1227,7 +1234,7 @@ psycho_teardown_intr(device_t dev, devic void *cookie) { struct psycho_softc *sc; - struct psycho_dmasync *pds; + struct psycho_dma_sync *pds; int error; sc = device_get_softc(dev); @@ -1315,8 +1322,8 @@ psycho_activate_resource(device_t bus, d type, rid, r)); if (type == SYS_RES_MEMORY) { /* - * Need to memory-map the device space, as some drivers depend - * on the virtual address being set and useable. + * Need to memory-map the device space, as some drivers + * depend on the virtual address being set and usable. */ error = sparc64_bus_mem_map(rman_get_bustag(r), rman_get_bushandle(r), rman_get_size(r), 0, 0, &p); Modified: stable/7/sys/sparc64/pci/psychovar.h ============================================================================== --- stable/7/sys/sparc64/pci/psychovar.h Sun Mar 22 21:31:02 2009 (r190289) +++ stable/7/sys/sparc64/pci/psychovar.h Sun Mar 22 21:38:24 2009 (r190290) @@ -49,8 +49,8 @@ struct psycho_softc { phandle_t sc_node; /* Firmware node */ u_int sc_mode; -#define PSYCHO_MODE_SABRE 1 -#define PSYCHO_MODE_PSYCHO 2 +#define PSYCHO_MODE_SABRE 0 +#define PSYCHO_MODE_PSYCHO 1 /* Bus A or B of a psycho pair? */ u_int sc_half; From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 22:00:20 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3231A106564A; Sun, 22 Mar 2009 22:00:20 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F5098FC14; Sun, 22 Mar 2009 22:00:20 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MM0Kr6085085; Sun, 22 Mar 2009 22:00:20 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MM0KJ9085084; Sun, 22 Mar 2009 22:00:20 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903222200.n2MM0KJ9085084@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 22:00: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: r190291 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb 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: Sun, 22 Mar 2009 22:00:21 -0000 Author: marius Date: Sun Mar 22 22:00:19 2009 New Revision: 190291 URL: http://svn.freebsd.org/changeset/base/190291 Log: MFC: r190111 Add device found in B100. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/sparc64/isa/isa.c Modified: stable/7/sys/sparc64/isa/isa.c ============================================================================== --- stable/7/sys/sparc64/isa/isa.c Sun Mar 22 21:38:24 2009 (r190290) +++ stable/7/sys/sparc64/isa/isa.c Sun Mar 22 22:00:19 2009 (r190291) @@ -118,7 +118,7 @@ isa_init(device_t dev) static const struct { const char *name; uint32_t id; -} ofw_isa_pnp_map[] = { +} const ofw_isa_pnp_map[] = { { "SUNW,lomh", 0x0000ae4e }, /* SUN0000 */ { "dma", 0x0002d041 }, /* PNP0200 */ { "floppy", 0x0007d041 }, /* PNP0700 */ @@ -130,6 +130,7 @@ static const struct { { "rmc-comm", 0x0300ae4e }, /* SUN0003 */ { "kb_ps2", 0x0303d041 }, /* PNP0303 */ { "kdmouse", 0x030fd041 }, /* PNP0F03 */ + { "bscbus", 0x0400ae4e }, /* SUN0004 */ { "power", 0x0c0cd041 }, /* PNP0C0C */ { NULL, 0x0 } }; From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 22:05:22 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAEF81065672; Sun, 22 Mar 2009 22:05:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C73048FC1C; Sun, 22 Mar 2009 22:05:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MM5MaF085264; Sun, 22 Mar 2009 22:05:22 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MM5MtV085262; Sun, 22 Mar 2009 22:05:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903222205.n2MM5MtV085262@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 22:05: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: r190292 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb sparc64/sbus 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, 22 Mar 2009 22:05:23 -0000 Author: marius Date: Sun Mar 22 22:05:22 2009 New Revision: 190292 URL: http://svn.freebsd.org/changeset/base/190292 Log: MFC: r190112 - As suggested by OpenSolaris use up-burst-sizes for determining the supported burst sizes. - Add support for 64-bit burst sizes (required for SBus GEM). - Register our interrupt filters with the revived INTR_FAST so they these interrupts can even interrupt filters of device drivers as necessary. - Failing to register as interrupt controller during attach shouldn't be fatal so just inform about this instead of panicing. - Take advantage of KOBJMETHOD_END. - Remove some redundant variables. - Add missing const. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/sparc64/sbus/sbus.c stable/7/sys/sparc64/sbus/sbusvar.h Modified: stable/7/sys/sparc64/sbus/sbus.c ============================================================================== --- stable/7/sys/sparc64/sbus/sbus.c Sun Mar 22 22:00:19 2009 (r190291) +++ stable/7/sys/sparc64/sbus/sbus.c Sun Mar 22 22:05:22 2009 (r190292) @@ -190,7 +190,7 @@ static bus_deactivate_resource_t sbus_de static bus_get_dma_tag_t sbus_get_dma_tag; static ofw_bus_get_devinfo_t sbus_get_devinfo; -static int sbus_inlist(const char *, const char **); +static int sbus_inlist(const char *, const char *const *); static struct sbus_devinfo * sbus_setup_dinfo(device_t, struct sbus_softc *, phandle_t); static void sbus_destroy_dinfo(struct sbus_devinfo *); @@ -217,14 +217,14 @@ static device_method_t sbus_methods[] = DEVMETHOD(bus_print_child, sbus_print_child), DEVMETHOD(bus_probe_nomatch, sbus_probe_nomatch), DEVMETHOD(bus_read_ivar, sbus_read_ivar), - DEVMETHOD(bus_setup_intr, sbus_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_alloc_resource, sbus_alloc_resource), DEVMETHOD(bus_activate_resource, sbus_activate_resource), DEVMETHOD(bus_deactivate_resource, sbus_deactivate_resource), DEVMETHOD(bus_release_resource, sbus_release_resource), - DEVMETHOD(bus_get_resource_list, sbus_get_resource_list), + DEVMETHOD(bus_setup_intr, sbus_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), + DEVMETHOD(bus_get_resource_list, sbus_get_resource_list), DEVMETHOD(bus_get_dma_tag, sbus_get_dma_tag), /* ofw_bus interface */ @@ -235,7 +235,7 @@ static device_method_t sbus_methods[] = DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), - { 0, 0 } + KOBJMETHOD_END }; static driver_t sbus_driver = { @@ -265,14 +265,14 @@ struct sbus_icarg { bus_addr_t sica_clr; }; -static const char *sbus_order_first[] = { +static const char *const sbus_order_first[] = { "auxio", "dma", NULL }; static int -sbus_inlist(const char *name, const char **list) +sbus_inlist(const char *name, const char *const *list) { int i; @@ -312,32 +312,33 @@ sbus_attach(device_t dev) bus_size_t size; u_long vec; phandle_t child, node; - int clock, i, intr, rid; + uint32_t prop; + int i, j; sc = device_get_softc(dev); sc->sc_dev = dev; node = ofw_bus_get_node(dev); - rid = 0; - sc->sc_sysio_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + i = 0; + sc->sc_sysio_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &i, RF_ACTIVE); if (sc->sc_sysio_res == NULL) panic("%s: cannot allocate device memory", __func__); - if (OF_getprop(node, "interrupts", &intr, sizeof(intr)) == -1) + if (OF_getprop(node, "interrupts", &prop, sizeof(prop)) == -1) panic("%s: cannot get IGN", __func__); - sc->sc_ign = INTIGN(intr); + sc->sc_ign = INTIGN(prop); sc->sc_cbustag = sbus_alloc_bustag(sc); /* * Record clock frequency for synchronous SCSI. * IS THIS THE CORRECT DEFAULT?? */ - if (OF_getprop(node, "clock-frequency", &clock, sizeof(clock)) == -1) - clock = 25000000; - sc->sc_clockfreq = clock; - clock /= 1000; - device_printf(dev, "clock %d.%03d MHz\n", clock / 1000, clock % 1000); + if (OF_getprop(node, "clock-frequency", &prop, sizeof(prop)) == -1) + prop = 25000000; + sc->sc_clockfreq = prop; + prop /= 1000; + device_printf(dev, "clock %d.%03d MHz\n", prop / 1000, prop % 1000); /* * Collect address translations from the OBP. @@ -361,9 +362,9 @@ sbus_attach(device_t dev) sc->sc_rd[i].rd_slot = range[i].cspace; sc->sc_rd[i].rd_coffset = range[i].coffset; sc->sc_rd[i].rd_cend = sc->sc_rd[i].rd_coffset + size; - rid = resource_list_add_next(rl, SYS_RES_MEMORY, phys, + j = resource_list_add_next(rl, SYS_RES_MEMORY, phys, phys + size - 1, size); - if ((res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + if ((res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &j, RF_ACTIVE)) == NULL) panic("%s: cannot allocate decoded range", __func__); sc->sc_rd[i].rd_bushandle = rman_get_bushandle(res); @@ -380,11 +381,12 @@ sbus_attach(device_t dev) /* * Get the SBus burst transfer size if burst transfers are supported. - * XXX: is the default correct? */ - if (OF_getprop(node, "burst-sizes", &sc->sc_burst, + if (OF_getprop(node, "up-burst-sizes", &sc->sc_burst, sizeof(sc->sc_burst)) == -1 || sc->sc_burst == 0) - sc->sc_burst = SBUS_BURST_DEF; + sc->sc_burst = + (SBUS_BURST64_DEF << SBUS_BURST64_SHIFT) | SBUS_BURST_DEF; + /* initalise the IOMMU */ @@ -420,6 +422,7 @@ sbus_attach(device_t dev) /* * Hunt through all the interrupt mapping regs and register our * interrupt controller for the corresponding interrupt vectors. + * We do this early in order to be able to catch stray interrupts. */ for (i = 0; i <= SBUS_MAX_INO; i++) { if (sbus_find_intrmap(sc, i, &intrmap, &intrclr) == 0) @@ -438,31 +441,32 @@ sbus_attach(device_t dev) (u_long)intrmap, (u_long)SYSIO_READ8(sc, intrmap), (u_long)intrclr); #endif - if (intr_controller_register(INTMAP_VEC(sc->sc_ign, i), - &sbus_ic, sica) != 0) - panic("%s: could not register interrupt controller " - "for INO %d", __func__, i); + j = intr_controller_register(INTMAP_VEC(sc->sc_ign, i), + &sbus_ic, sica); + if (j != 0) + device_printf(dev, "could not register interrupt " + "controller for INO %d (%d)\n", i, j); } /* Enable the over-temperature and power-fail interrupts. */ - rid = 4; - sc->sc_ot_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + i = 4; + sc->sc_ot_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i, RF_ACTIVE); if (sc->sc_ot_ires == NULL || INTIGN(vec = rman_get_start(sc->sc_ot_ires)) != sc->sc_ign || INTVEC(SYSIO_READ8(sc, SBR_THERM_INT_MAP)) != vec || intr_vectors[vec].iv_ic != &sbus_ic || - bus_setup_intr(dev, sc->sc_ot_ires, INTR_TYPE_MISC, + bus_setup_intr(dev, sc->sc_ot_ires, INTR_TYPE_MISC | INTR_FAST, NULL, sbus_overtemp, sc, &sc->sc_ot_ihand) != 0) panic("%s: failed to set up temperature interrupt", __func__); - rid = 3; - sc->sc_pf_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + i = 3; + sc->sc_pf_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i, RF_ACTIVE); if (sc->sc_pf_ires == NULL || INTIGN(vec = rman_get_start(sc->sc_pf_ires)) != sc->sc_ign || INTVEC(SYSIO_READ8(sc, SBR_POWER_INT_MAP)) != vec || intr_vectors[vec].iv_ic != &sbus_ic || - bus_setup_intr(dev, sc->sc_pf_ires, INTR_TYPE_MISC, + bus_setup_intr(dev, sc->sc_pf_ires, INTR_TYPE_MISC | INTR_FAST, NULL, sbus_pwrfail, sc, &sc->sc_pf_ihand) != 0) panic("%s: failed to set up power fail interrupt", __func__); @@ -848,8 +852,8 @@ sbus_activate_resource(device_t bus, dev } if (type == SYS_RES_MEMORY) { /* - * Need to memory-map the device space, as some drivers depend - * on the virtual address being set and useable. + * Need to memory-map the device space, as some drivers + * depend on the virtual address being set and usable. */ error = sparc64_bus_mem_map(rman_get_bustag(r), rman_get_bushandle(r), rman_get_size(r), 0, 0, &p); Modified: stable/7/sys/sparc64/sbus/sbusvar.h ============================================================================== --- stable/7/sys/sparc64/sbus/sbusvar.h Sun Mar 22 22:00:19 2009 (r190291) +++ stable/7/sys/sparc64/sbus/sbusvar.h Sun Mar 22 22:05:22 2009 (r190292) @@ -77,7 +77,7 @@ */ #ifndef _SPARC64_SBUS_SBUSVAR_H_ -#define _SPARC64_SBUS_SBUSVAR_H_ +#define _SPARC64_SBUS_SBUSVAR_H_ /* * Macros for probe order @@ -88,18 +88,24 @@ /* * PROM-reported DMA burst sizes for the SBus */ -#define SBUS_BURST_1 0x1 -#define SBUS_BURST_2 0x2 -#define SBUS_BURST_4 0x4 -#define SBUS_BURST_8 0x8 -#define SBUS_BURST_16 0x10 -#define SBUS_BURST_32 0x20 -#define SBUS_BURST_64 0x40 +#define SBUS_BURST_1 (1 << 0) +#define SBUS_BURST_2 (1 << 1) +#define SBUS_BURST_4 (1 << 2) +#define SBUS_BURST_8 (1 << 3) +#define SBUS_BURST_16 (1 << 4) +#define SBUS_BURST_32 (1 << 5) +#define SBUS_BURST_64 (1 << 6) +#define SBUS_BURST_MASK ((1 << SBUS_BURST_SIZE) - 1) +#define SBUS_BURST_SIZE 16 +#define SBUS_BURST64_MASK (SBUS_BURST_MASK << SBUS_BURST64_SHIFT) +#define SBUS_BURST64_SHIFT 16 /* Used if no burst sizes are specified for the bus. */ #define SBUS_BURST_DEF \ (SBUS_BURST_1 | SBUS_BURST_2 | SBUS_BURST_4 | SBUS_BURST_8 | \ - SBUS_BURST_16) + SBUS_BURST_16 | SBUS_BURST_32 | SBUS_BURST_64) +#define SBUS_BURST64_DEF \ + (SBUS_BURST_8 | SBUS_BURST_16 | SBUS_BURST_32 | SBUS_BURST_64) enum sbus_device_ivars { SBUS_IVAR_BURSTSZ, @@ -111,7 +117,7 @@ enum sbus_device_ivars { /* * Simplified accessors for sbus devices */ -#define SBUS_ACCESSOR(var, ivar, type) \ +#define SBUS_ACCESSOR(var, ivar, type) \ __BUS_ACCESSOR(sbus, var, SBUS, ivar, type) SBUS_ACCESSOR(burstsz, BURSTSZ, int) From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 22:08:31 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59FF910656C6; Sun, 22 Mar 2009 22:08:31 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C3478FC1E; Sun, 22 Mar 2009 22:08:31 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MM8UZt085421; Sun, 22 Mar 2009 22:08:30 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MM8Uu4085419; Sun, 22 Mar 2009 22:08:30 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903222208.n2MM8Uu4085419@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 22:08:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190294 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/dc 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, 22 Mar 2009 22:08:33 -0000 Author: marius Date: Sun Mar 22 22:08:30 2009 New Revision: 190294 URL: http://svn.freebsd.org/changeset/base/190294 Log: MFC: r190117 - Set MIIF_NOLOOP and don't add IFM_LOOP as loopback apparently isn't supported with these pseudo-PHYs. The MIIF_NOLOOP flag currently triggers nothing but hopefully will be respected by mii_phy_setmedia() later on. - Don't add IFM_NONE as isolation isn't supported by these pseudo-PHYs. - Use mii_phy_add_media() instead of mii_add_media() so the latter can be eventually retired. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/dc/dcphy.c stable/7/sys/dev/dc/pnphy.c Modified: stable/7/sys/dev/dc/dcphy.c ============================================================================== --- stable/7/sys/dev/dc/dcphy.c Sun Mar 22 22:07:52 2009 (r190293) +++ stable/7/sys/dev/dc/dcphy.c Sun Mar 22 22:08:30 2009 (r190294) @@ -154,13 +154,12 @@ dcphy_attach(device_t dev) sc->mii_service = dcphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; - mii->mii_instance++; - -#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) + /* + * Apparently, we can neither isolate nor do loopback. + */ + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), - BMCR_ISO); + mii->mii_instance++; /*dcphy_reset(sc);*/ dc_sc = mii->mii_ifp->if_softc; @@ -186,9 +185,8 @@ dcphy_attach(device_t dev) sc->mii_capabilities &= ma->mii_capmask; device_printf(dev, " "); - mii_add_media(sc); + mii_phy_add_media(sc); printf("\n"); -#undef ADD MIIBUS_MEDIAINIT(sc->mii_dev); return (0); Modified: stable/7/sys/dev/dc/pnphy.c ============================================================================== --- stable/7/sys/dev/dc/pnphy.c Sun Mar 22 22:07:52 2009 (r190293) +++ stable/7/sys/dev/dc/pnphy.c Sun Mar 22 22:08:30 2009 (r190294) @@ -137,24 +137,19 @@ pnphy_attach(device_t dev) sc->mii_service = pnphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; - mii->mii_instance++; + /* + * Apparently, we can neither isolate nor do loopback. + */ + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; -#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) + mii->mii_instance++; sc->mii_capabilities = BMSR_100TXFDX | BMSR_100TXHDX | BMSR_10TFDX | BMSR_10THDX; sc->mii_capabilities &= ma->mii_capmask; device_printf(dev, " "); - mii_add_media(sc); + mii_phy_add_media(sc); printf("\n"); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), - BMCR_ISO); - - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), - BMCR_LOOP|BMCR_S100); - -#undef ADD MIIBUS_MEDIAINIT(sc->mii_dev); return (0); From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 22:19:54 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E65CD1065672; Sun, 22 Mar 2009 22:19:54 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1F528FC16; Sun, 22 Mar 2009 22:19:54 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MMJsRT085867; Sun, 22 Mar 2009 22:19:54 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MMJsPB085861; Sun, 22 Mar 2009 22:19:54 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903222219.n2MMJsPB085861@svn.freebsd.org> From: Marius Strobl Date: Sun, 22 Mar 2009 22:19: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: r190297 - in stable/7/sys: . conf contrib/pf dev/ath/ath_hal dev/cxgb sparc64/pci 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: Sun, 22 Mar 2009 22:19:55 -0000 Author: marius Date: Sun Mar 22 22:19:54 2009 New Revision: 190297 URL: http://svn.freebsd.org/changeset/base/190297 Log: MFC: r183423, r184428, r185133, r186290, r190108 Add a driver for `Schizo' Fireplane/Safari to PCI 2.1 and `Tomatillo' JBus to PCI 2.2 bridges including subsequent fixes and improvements as of r190108. Added: stable/7/sys/sparc64/pci/schizo.c - copied, changed from r183423, head/sys/sparc64/pci/schizo.c stable/7/sys/sparc64/pci/schizoreg.h - copied, changed from r183423, head/sys/sparc64/pci/schizoreg.h stable/7/sys/sparc64/pci/schizovar.h - copied, changed from r183423, head/sys/sparc64/pci/schizovar.h Modified: stable/7/sys/ (props changed) stable/7/sys/conf/files.sparc64 stable/7/sys/conf/options.sparc64 stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/sparc64/sparc64/nexus.c Modified: stable/7/sys/conf/files.sparc64 ============================================================================== --- stable/7/sys/conf/files.sparc64 Sun Mar 22 22:14:46 2009 (r190296) +++ stable/7/sys/conf/files.sparc64 Sun Mar 22 22:19:54 2009 (r190297) @@ -74,6 +74,7 @@ sparc64/pci/ofw_pcib.c optional pci sparc64/pci/ofw_pcib_subr.c optional pci sparc64/pci/ofw_pcibus.c optional pci sparc64/pci/psycho.c optional pci +sparc64/pci/schizo.c optional pci sparc64/sbus/dma_sbus.c optional sbus sparc64/sbus/sbus.c optional sbus sparc64/sbus/lsi64854.c optional sbus Modified: stable/7/sys/conf/options.sparc64 ============================================================================== --- stable/7/sys/conf/options.sparc64 Sun Mar 22 22:14:46 2009 (r190296) +++ stable/7/sys/conf/options.sparc64 Sun Mar 22 22:19:54 2009 (r190297) @@ -24,5 +24,7 @@ PSM_RESETAFTERSUSPEND opt_psm.h DEBUGGER_ON_POWERFAIL opt_psycho.h PSYCHO_DEBUG opt_psycho.h +SCHIZO_DEBUG opt_schizo.h + SUNKBD_DFLT_KEYMAP opt_sunkbd.h SUNKBD_EMULATE_ATKBD opt_sunkbd.h Copied and modified: stable/7/sys/sparc64/pci/schizo.c (from r183423, head/sys/sparc64/pci/schizo.c) ============================================================================== --- head/sys/sparc64/pci/schizo.c Sun Sep 28 00:07:05 2008 (r183423, copy source) +++ stable/7/sys/sparc64/pci/schizo.c Sun Mar 22 22:19:54 2009 (r190297) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -79,11 +80,13 @@ __FBSDID("$FreeBSD$"); static const struct schizo_desc *schizo_get_desc(device_t); static void schizo_set_intr(struct schizo_softc *, u_int, u_int, driver_filter_t); -static driver_filter_t schizo_dmasync; +static driver_filter_t schizo_dma_sync_stub; +static driver_filter_t ichip_dma_sync_stub; static void schizo_intr_enable(void *); static void schizo_intr_disable(void *); static void schizo_intr_assign(void *); static void schizo_intr_clear(void *); +static int schizo_intr_register(struct schizo_softc *sc, u_int ino); static int schizo_get_intrmap(struct schizo_softc *, u_int, bus_addr_t *, bus_addr_t *); static bus_space_tag_t schizo_alloc_bus_tag(struct schizo_softc *, int); @@ -94,6 +97,7 @@ static driver_filter_t schizo_pci_bus; static driver_filter_t schizo_ue; static driver_filter_t schizo_ce; static driver_filter_t schizo_host_bus; +static driver_filter_t schizo_cdma; /* IOMMU support */ static void schizo_iommu_init(struct schizo_softc *, int, uint32_t); @@ -145,7 +149,7 @@ static device_method_t schizo_methods[] /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, schizo_get_node), - { 0, 0 } + KOBJMETHOD_END }; static devclass_t schizo_devclass; @@ -170,14 +174,16 @@ struct schizo_icarg { bus_addr_t sica_clr; }; -struct schizo_dmasync { +struct schizo_dma_sync { struct schizo_softc *sds_sc; driver_filter_t *sds_handler; void *sds_arg; void *sds_cookie; - bus_size_t sds_syncreg; uint64_t sds_syncval; - u_int sds_bswar; + device_t sds_ppb; /* farest PCI-PCI bridge */ + uint8_t sds_bus; /* bus of farest PCI device */ + uint8_t sds_slot; /* slot of farest PCI device */ + uint8_t sds_func; /* func. of farest PCI device */ }; #define SCHIZO_PERF_CNT_QLTY 100 @@ -212,7 +218,7 @@ struct schizo_desc { const char *sd_name; }; -static const struct schizo_desc schizo_compats[] = { +static const struct schizo_desc const schizo_compats[] = { { "pci108e,8001", SCHIZO_MODE_SCZ, "Schizo" }, { "pci108e,a801", SCHIZO_MODE_TOM, "Tomatillo" }, { NULL, 0, NULL } @@ -252,10 +258,8 @@ schizo_attach(device_t dev) { struct ofw_pci_ranges *range; const struct schizo_desc *desc; - struct schizo_icarg *sica; struct schizo_softc *asc, *sc, *osc; struct timecounter *tc; - bus_addr_t intrclr, intrmap; uint64_t ino_bitmap, reg; phandle_t node; uint32_t prop, prop_array[2]; @@ -269,6 +273,7 @@ schizo_attach(device_t dev) sc->sc_dev = dev; sc->sc_node = node; sc->sc_mode = mode; + sc->sc_flags = 0; /* * The Schizo has three register banks: @@ -322,6 +327,8 @@ schizo_attach(device_t dev) panic("%s: could not malloc mutex", __func__); mtx_init(sc->sc_mtx, "pcib_mtx", NULL, MTX_SPIN); } else { + if (sc->sc_mode != SCHIZO_MODE_SCZ) + panic("%s: no partner expected", __func__); if (mtx_initialized(osc->sc_mtx) == 0) panic("%s: mutex not initialized", __func__); sc->sc_mtx = osc->sc_mtx; @@ -388,9 +395,10 @@ schizo_attach(device_t dev) /* * Hunt through all the interrupt mapping regs and register - * the interrupt controller for our interrupt vectors. This - * is complicated by the fact that a pair of Schizo PBMs - * share one IGN. + * the interrupt controller for our interrupt vectors. We do + * this early in order to be able to catch stray interrupts. + * This is complicated by the fact that a pair of Schizo PBMs + * shares one IGN. */ n = OF_getprop(node, "ino-bitmap", (void *)prop_array, sizeof(prop_array)); @@ -403,24 +411,10 @@ schizo_attach(device_t dev) if (n == STX_FB0_INO || n == STX_FB1_INO) /* Leave for upa(4). */ continue; - if (schizo_get_intrmap(sc, n, &intrmap, &intrclr) == 0) - continue; - sica = malloc(sizeof(*sica), M_DEVBUF, M_NOWAIT); - if (sica == NULL) - panic("%s: could not allocate interrupt controller " - "argument", __func__); - sica->sica_sc = sc; - sica->sica_map = intrmap; - sica->sica_clr = intrclr; -#ifdef SCHIZO_DEBUG - device_printf(dev, "intr map (INO %d) %#lx: %#lx, clr: %#lx\n", - n, (u_long)intrmap, (u_long)SCHIZO_PCI_READ_8(sc, intrmap), - (u_long)intrclr); -#endif - if (intr_controller_register(INTMAP_VEC(sc->sc_ign, n), - &schizo_ic, sica) != 0) - panic("%s: could not register interrupt controller " - "for INO %d", __func__, n); + i = schizo_intr_register(sc, n); + if (i != 0) + device_printf(dev, "could not register interrupt " + "controller for INO %d (%d)\n", n, i); } /* @@ -456,11 +450,16 @@ schizo_attach(device_t dev) tc_init(tc); } - /* Set up the IOMMU. Both Schizo and Tomatillo have one per PBM. */ + /* + * Set up the IOMMU. Schizo, Tomatillo and XMITS all have + * one per PBM. Schizo and XMITS additionally have a streaming + * buffer, in Schizo version < 5 (i.e. revision < 2.3) it's + * affected by several errata and basically unusable though. + */ sc->sc_is.is_pmaxaddr = IOMMU_MAXADDR(STX_IOMMU_BITS); - sc->sc_is.is_sb[0] = 0; - sc->sc_is.is_sb[1] = 0; - if (OF_getproplen(node, "no-streaming-cache") < 0) + sc->sc_is.is_sb[0] = sc->sc_is.is_sb[1] = 0; + if (OF_getproplen(node, "no-streaming-cache") < 0 && + !(sc->sc_mode == SCHIZO_MODE_SCZ && sc->sc_ver < 5)) sc->sc_is.is_sb[0] = STX_PCI_STRBUF; #define TSBCASE(x) \ @@ -489,6 +488,7 @@ schizo_attach(device_t dev) } schizo_iommu_init(sc, tsbsize, prop_array[0]); } + #undef TSBCASE /* Initialize memory and I/O rmans. */ @@ -627,6 +627,39 @@ schizo_attach(device_t dev) schizo_set_intr(sc, 3, STX_BUS_INO, schizo_host_bus); /* + * According to the Schizo Errata I-13, consistent DMA flushing/ + * syncing is FUBAR in version < 5 (i.e. revision < 2.3) bridges, + * so we can't use it and need to live with the consequences. + * With Schizo version >= 5, CDMA flushing/syncing is usable + * but requires the the workaround described in Schizo Errata + * I-23. With Tomatillo and XMITS, CDMA flushing/syncing works + * as expected, Tomatillo version <= 4 (i.e. revision <= 2.3) + * bridges additionally require a block store after a write to + * TOMXMS_PCI_DMA_SYNC_PEND though. + */ + if ((sc->sc_mode == SCHIZO_MODE_SCZ && sc->sc_ver >= 5) || + sc->sc_mode == SCHIZO_MODE_TOM || sc->sc_mode == SCHIZO_MODE_XMS) { + sc->sc_flags |= SCHIZO_FLAGS_CDMA; + if (sc->sc_mode == SCHIZO_MODE_SCZ) { + n = STX_CDMA_A_INO + sc->sc_half; + if (bus_set_resource(dev, SYS_RES_IRQ, 5, + INTMAP_VEC(sc->sc_ign, n), 1) != 0) + panic("%s: failed to add CDMA interrupt", + __func__); + i = schizo_intr_register(sc, n); + if (i != 0) + panic("%s: could not register interrupt " + "controller for CDMA (%d)", __func__, i); + (void)schizo_get_intrmap(sc, n, NULL, + &sc->sc_cdma_clr); + sc->sc_cdma_state = SCHIZO_CDMA_STATE_DONE; + schizo_set_intr(sc, 5, n, schizo_cdma); + } + if (sc->sc_mode == SCHIZO_MODE_TOM && sc->sc_ver <= 4) + sc->sc_flags |= SCHIZO_FLAGS_BSWAR; + } + + /* * Set the latency timer register as this isn't always done by the * firmware. */ @@ -653,12 +686,40 @@ schizo_set_intr(struct schizo_softc *sc, INTIGN(vec = rman_get_start(sc->sc_irq_res[index])) != sc->sc_ign || INTINO(vec) != ino || intr_vectors[vec].iv_ic != &schizo_ic || - bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index], INTR_TYPE_MISC, - handler, NULL, sc, &sc->sc_ihand[index]) != 0) + bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index], + INTR_TYPE_MISC | INTR_FAST, handler, NULL, sc, + &sc->sc_ihand[index]) != 0) panic("%s: failed to set up interrupt %d", __func__, index); } static int +schizo_intr_register(struct schizo_softc *sc, u_int ino) +{ + struct schizo_icarg *sica; + bus_addr_t intrclr, intrmap; + int error; + + if (schizo_get_intrmap(sc, ino, &intrmap, &intrclr) == 0) + return (ENXIO); + sica = malloc(sizeof(*sica), M_DEVBUF, M_NOWAIT); + if (sica == NULL) + return (ENOMEM); + sica->sica_sc = sc; + sica->sica_map = intrmap; + sica->sica_clr = intrclr; +#ifdef SCHIZO_DEBUG + device_printf(sc->sc_dev, "intr map (INO %d) %#lx: %#lx, clr: %#lx\n", + ino, (u_long)intrmap, (u_long)SCHIZO_PCI_READ_8(sc, intrmap), + (u_long)intrclr); +#endif + error = (intr_controller_register(INTMAP_VEC(sc->sc_ign, ino), + &schizo_ic, sica)); + if (error != 0) + free(sica, M_DEVBUF); + return (error); +} + +static int schizo_get_intrmap(struct schizo_softc *sc, u_int ino, bus_addr_t *intrmapptr, bus_addr_t *intrclrptr) { @@ -801,6 +862,15 @@ schizo_host_bus(void *arg) return (FILTER_HANDLED); } +static int +schizo_cdma(void *arg) +{ + struct schizo_softc *sc = arg; + + atomic_store_rel_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_DONE); + return (FILTER_HANDLED); +} + static void schizo_iommu_init(struct schizo_softc *sc, int tsbsize, uint32_t dvmabase) { @@ -947,33 +1017,65 @@ schizo_read_ivar(device_t dev, device_t return (ENOENT); } +static int +schizo_dma_sync_stub(void *arg) +{ + struct timeval cur, end; + struct schizo_dma_sync *sds = arg; + struct schizo_softc *sc = sds->sds_sc; + uint32_t state; + + (void)PCIB_READ_CONFIG(sds->sds_ppb, sds->sds_bus, sds->sds_slot, + sds->sds_func, PCIR_VENDOR, 2); + for (; atomic_cmpset_acq_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_DONE, + SCHIZO_CDMA_STATE_PENDING) == 0;) + ; + SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_clr, 1); + microuptime(&cur); + end.tv_sec = 1; + end.tv_usec = 0; + timevaladd(&end, &cur); + for (; (state = atomic_load_32(&sc->sc_cdma_state)) != + SCHIZO_CDMA_STATE_DONE && timevalcmp(&cur, &end, <=);) + microuptime(&cur); + if (state != SCHIZO_CDMA_STATE_DONE) + panic("%s: DMA does not sync", __func__); + return (sds->sds_handler(sds->sds_arg)); +} + #define VIS_BLOCKSIZE 64 static int -schizo_dmasync(void *arg) +ichip_dma_sync_stub(void *arg) { static u_char buf[VIS_BLOCKSIZE] __aligned(VIS_BLOCKSIZE); - struct schizo_dmasync *sds = arg; + struct timeval cur, end; + struct schizo_dma_sync *sds = arg; struct schizo_softc *sc = sds->sds_sc; - uint64_t reg; - int timeout; + register_t reg, s; - SCHIZO_PCI_WRITE_8(sc, sds->sds_syncreg, sds->sds_syncval); - timeout = 1000000; - for (; (SCHIZO_PCI_READ_8(sc, sds->sds_syncreg) & - sds->sds_syncval) != 0;) - if (--timeout < 0) - panic("%s: DMA does not sync", __func__); + (void)PCIB_READ_CONFIG(sds->sds_ppb, sds->sds_bus, sds->sds_slot, + sds->sds_func, PCIR_VENDOR, 2); + SCHIZO_PCI_WRITE_8(sc, TOMXMS_PCI_DMA_SYNC_PEND, sds->sds_syncval); + microuptime(&cur); + end.tv_sec = 1; + end.tv_usec = 0; + timevaladd(&end, &cur); + for (; ((reg = SCHIZO_PCI_READ_8(sc, TOMXMS_PCI_DMA_SYNC_PEND)) & + sds->sds_syncval) != 0 && timevalcmp(&cur, &end, <=);) + microuptime(&cur); + if ((reg & sds->sds_syncval) != 0) + panic("%s: DMA does not sync", __func__); - if (sds->sds_bswar != 0) { - critical_enter(); + if ((sc->sc_flags & SCHIZO_FLAGS_BSWAR) != 0) { + s = intr_disable(); reg = rd(fprs); wr(fprs, reg | FPRS_FEF, 0); - __asm__ __volatile__("stda %%f0, [%0] %1" + __asm __volatile("stda %%f0, [%0] %1" : : "r" (buf), "n" (ASI_BLK_COMMIT_S)); - wr(fprs, reg, 0); membar(Sync); - critical_exit(); + wr(fprs, reg, 0); + intr_restore(s); } return (sds->sds_handler(sds->sds_arg)); } @@ -1021,56 +1123,109 @@ schizo_setup_intr(device_t dev, device_t int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { - struct schizo_dmasync *sds; + devclass_t pci_devclass; + device_t cdev, pdev, pcidev; + struct schizo_dma_sync *sds; struct schizo_softc *sc; u_long vec; - int error; + int error, found; sc = device_get_softc(dev); /* - * Make sure the vector is fully specified and we registered - * our interrupt controller for it. + * Make sure the vector is fully specified. */ vec = rman_get_start(ires); - if (INTIGN(vec) != sc->sc_ign || - intr_vectors[vec].iv_ic != &schizo_ic) { + if (INTIGN(vec) != sc->sc_ign) { device_printf(dev, "invalid interrupt vector 0x%lx\n", vec); return (EINVAL); } + if (intr_vectors[vec].iv_ic == &schizo_ic) { + /* + * Ensure we use the right softc in case the interrupt + * is routed to our companion PBM for some odd reason. + */ + sc = ((struct schizo_icarg *)intr_vectors[vec].iv_icarg)-> + sica_sc; + } else if (intr_vectors[vec].iv_ic == NULL) { + /* + * Work around broken firmware which misses entries in + * the ino-bitmap. + */ + error = schizo_intr_register(sc, INTINO(vec)); + if (error != 0) { + device_printf(dev, "could not register interrupt " + "controller for vector 0x%lx (%d)\n", vec, error); + return (error); + } + if (bootverbose) + device_printf(dev, "belatedly registered as " + "interrupt controller for vector 0x%lx\n", vec); + } else { + device_printf(dev, + "invalid interrupt controller for vector 0x%lx\n", vec); + return (EINVAL); + } + /* - * Schizo revision >= 2.3 (i.e. version >= 5) and Tomatillo bridges - * need to be manually told to sync DMA writes. - * Tomatillo revision <= 2.3 (i.e. version <= 4) bridges additionally - * need a block store as a workaround for a hardware bug. - * XXX setup of the wrapper and the contents of schizo_dmasync() - * should be moved to schizo(4)-specific bus_dma_tag_create() and - * bus_dmamap_sync() methods, respectively, once DMA tag creation - * is newbus'ified, so the wrapper isn't only applied for interrupt - * handlers but also for polling(4) callbacks. + * Install a a wrapper for CDMA flushing/syncing for devices + * behind PCI-PCI bridges if possible. */ - if ((sc->sc_mode == SCHIZO_MODE_SCZ && sc->sc_ver >= 5) || - sc->sc_mode == SCHIZO_MODE_TOM) { + pcidev = NULL; + found = 0; + pci_devclass = devclass_find("pci"); + for (cdev = child; cdev != dev; cdev = pdev) { + pdev = device_get_parent(cdev); + if (pcidev == NULL) { + if (device_get_devclass(pdev) != pci_devclass) + continue; + pcidev = cdev; + continue; + } + if (pci_get_class(cdev) == PCIC_BRIDGE && + pci_get_subclass(cdev) == PCIS_BRIDGE_PCI) + found = 1; + } + if ((sc->sc_flags & SCHIZO_FLAGS_CDMA) != 0) { sds = malloc(sizeof(*sds), M_DEVBUF, M_NOWAIT | M_ZERO); if (sds == NULL) return (ENOMEM); - sds->sds_sc = sc; - sds->sds_arg = arg; - sds->sds_syncreg = sc->sc_mode == SCHIZO_MODE_SCZ ? - SCZ_PCI_DMA_SYNC : TOMXMS_PCI_DMA_SYNC_PEND; - sds->sds_syncval = 1ULL << INTINO(vec); - if (sc->sc_mode == SCHIZO_MODE_TOM && sc->sc_ver <= 4) - sds->sds_bswar = 1; - if (intr == NULL) { - sds->sds_handler = filt; - error = bus_generic_setup_intr(dev, child, ires, - flags, schizo_dmasync, intr, sds, cookiep); - } else { - sds->sds_handler = (driver_filter_t *)intr; + if (found != 0 && pcidev != NULL) { + sds->sds_sc = sc; + sds->sds_arg = arg; + sds->sds_ppb = + device_get_parent(device_get_parent(pcidev)); + sds->sds_bus = pci_get_bus(pcidev); + sds->sds_slot = pci_get_slot(pcidev); + sds->sds_func = pci_get_function(pcidev); + sds->sds_syncval = 1ULL << INTINO(vec); + if (bootverbose) + device_printf(dev, "installed DMA sync " + "wrapper for device %d.%d on bus %d\n", + sds->sds_slot, sds->sds_func, + sds->sds_bus); + +#define DMA_SYNC_STUB \ + (sc->sc_mode == SCHIZO_MODE_SCZ ? schizo_dma_sync_stub : \ + ichip_dma_sync_stub) + + if (intr == NULL) { + sds->sds_handler = filt; + error = bus_generic_setup_intr(dev, child, + ires, flags, DMA_SYNC_STUB, intr, sds, + cookiep); + } else { + sds->sds_handler = (driver_filter_t *)intr; + error = bus_generic_setup_intr(dev, child, + ires, flags, filt, (driver_intr_t *) + DMA_SYNC_STUB, sds, cookiep); + } + +#undef DMA_SYNC_STUB + + } else error = bus_generic_setup_intr(dev, child, ires, - flags, filt, (driver_intr_t *)schizo_dmasync, - sds, cookiep); - } + flags, filt, intr, arg, cookiep); if (error != 0) { free(sds, M_DEVBUF); return (error); @@ -1078,7 +1233,9 @@ schizo_setup_intr(device_t dev, device_t sds->sds_cookie = *cookiep; *cookiep = sds; return (error); - } + } else if (found != 0) + device_printf(dev, "WARNING: using devices behind PCI-PCI " + "bridges may cause data corruption\n"); return (bus_generic_setup_intr(dev, child, ires, flags, filt, intr, arg, cookiep)); } @@ -1087,12 +1244,12 @@ static int schizo_teardown_intr(device_t dev, device_t child, struct resource *vec, void *cookie) { - struct schizo_dmasync *sds; + struct schizo_dma_sync *sds; struct schizo_softc *sc; int error; sc = device_get_softc(dev); - if (sc->sc_mode == SCHIZO_MODE_TOM) { + if ((sc->sc_flags & SCHIZO_FLAGS_CDMA) != 0) { sds = cookie; error = bus_generic_teardown_intr(dev, child, vec, sds->sds_cookie); @@ -1176,8 +1333,8 @@ schizo_activate_resource(device_t bus, d type, rid, r)); if (type == SYS_RES_MEMORY) { /* - * Need to memory-map the device space, as some drivers depend - * on the virtual address being set and useable. + * Need to memory-map the device space, as some drivers + * depend on the virtual address being set and usable. */ error = sparc64_bus_mem_map(rman_get_bustag(r), rman_get_bushandle(r), rman_get_size(r), 0, 0, &p); Copied and modified: stable/7/sys/sparc64/pci/schizoreg.h (from r183423, head/sys/sparc64/pci/schizoreg.h) ============================================================================== --- head/sys/sparc64/pci/schizoreg.h Sun Sep 28 00:07:05 2008 (r183423, copy source) +++ stable/7/sys/sparc64/pci/schizoreg.h Sun Mar 22 22:19:54 2009 (r190297) @@ -31,7 +31,7 @@ #ifndef _SPARC64_PCI_SCHIZOREG_H_ #define _SPARC64_PCI_SCHIZOREG_H_ -#define STX_NINTR 4 +#define STX_NINTR 5 /* 4 via OFW + 1 CDMA */ #define STX_NRANGE 4 #define SCZ_NREG 3 #define TOM_NREG 4 @@ -276,6 +276,8 @@ #define STX_PCIERR_A_INO 0x32 /* PCI bus A error */ #define STX_PCIERR_B_INO 0x33 /* PCI bus B error */ #define STX_BUS_INO 0x34 /* Safari/JBus error */ +#define STX_CDMA_A_INO 0x35 /* PCI bus A CDMA */ +#define STX_CDMA_B_INO 0x36 /* PCI bus B CDMA */ #define STX_MAX_INO 0x37 /* Device space defines */ Copied and modified: stable/7/sys/sparc64/pci/schizovar.h (from r183423, head/sys/sparc64/pci/schizovar.h) ============================================================================== --- head/sys/sparc64/pci/schizovar.h Sun Sep 28 00:07:05 2008 (r183423, copy source) +++ stable/7/sys/sparc64/pci/schizovar.h Sun Mar 22 22:19:54 2009 (r190297) @@ -39,9 +39,18 @@ struct schizo_softc { phandle_t sc_node; u_int sc_mode; -#define SCHIZO_MODE_SCZ 1 -#define SCHIZO_MODE_TOM 2 -#define SCHIZO_MODE_XMS 3 +#define SCHIZO_MODE_SCZ 0 +#define SCHIZO_MODE_TOM 1 +#define SCHIZO_MODE_XMS 2 + + u_int sc_flags; +#define SCHIZO_FLAGS_BSWAR (1 << 0) +#define SCHIZO_FLAGS_CDMA (1 << 1) + + bus_addr_t sc_cdma_clr; + uint32_t sc_cdma_state; +#define SCHIZO_CDMA_STATE_DONE (1 << 0) +#define SCHIZO_CDMA_STATE_PENDING (1 << 1) u_int sc_half; uint32_t sc_ign; Modified: stable/7/sys/sparc64/sparc64/nexus.c ============================================================================== --- stable/7/sys/sparc64/sparc64/nexus.c Sun Mar 22 22:14:46 2009 (r190296) +++ stable/7/sys/sparc64/sparc64/nexus.c Sun Mar 22 22:19:54 2009 (r190297) @@ -96,7 +96,7 @@ static ofw_bus_get_devinfo_t nexus_get_d #ifdef SMP static int nexus_bind_intr(device_t, device_t, struct resource *, int); #endif -static int nexus_inlist(const char *, const char **); +static int nexus_inlist(const char *, const char *const *); static struct nexus_devinfo * nexus_setup_dinfo(device_t, phandle_t); static void nexus_destroy_dinfo(struct nexus_devinfo *); static int nexus_print_res(struct nexus_devinfo *); @@ -122,6 +122,7 @@ static device_method_t nexus_methods[] = DEVMETHOD(bus_release_resource, nexus_release_resource), DEVMETHOD(bus_setup_intr, nexus_setup_intr), DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), + DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), DEVMETHOD(bus_get_resource_list, nexus_get_resource_list), #ifdef SMP @@ -145,7 +146,7 @@ static devclass_t nexus_devclass; DEFINE_CLASS_0(nexus, nexus_driver, nexus_methods, sizeof(struct nexus_softc)); DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0); -static const char *nexus_excl_name[] = { +static const char *const nexus_excl_name[] = { "aliases", "associations", "chosen", @@ -159,7 +160,7 @@ static const char *nexus_excl_name[] = { NULL }; -static const char *nexus_excl_type[] = { +static const char *const nexus_excl_type[] = { "cpu", NULL }; @@ -168,7 +169,7 @@ extern struct bus_space_tag nexus_bustag extern struct bus_dma_tag nexus_dmatag; static int -nexus_inlist(const char *name, const char **list) +nexus_inlist(const char *name, const char *const *list) { int i; From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 23:00:00 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83E1E106564A; Sun, 22 Mar 2009 23:00:00 +0000 (UTC) (envelope-from silby@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63EB28FC19; Sun, 22 Mar 2009 23:00:00 +0000 (UTC) (envelope-from silby@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2MN00f2086772; Sun, 22 Mar 2009 23:00:00 GMT (envelope-from silby@svn.freebsd.org) Received: (from silby@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2MN00IO086771; Sun, 22 Mar 2009 23:00:00 GMT (envelope-from silby@svn.freebsd.org) Message-Id: <200903222300.n2MN00IO086771@svn.freebsd.org> From: Mike Silbersack Date: Sun, 22 Mar 2009 23:00: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: r190299 - stable/7/sys/kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Mar 2009 23:00:09 -0000 Author: silby Date: Sun Mar 22 23:00:00 2009 New Revision: 190299 URL: http://svn.freebsd.org/changeset/base/190299 Log: Fix unp_gc so that it recognizes file descriptors that are currently in the process of being passed between processes as alive and does not try to garbage collect them. The full description of the problem and a test program to reproduce it can be found in PR 112554. This fix was inspired by similar fixes in NetBSD and BSD/OS. However, it does not apply to FreeBSD 8 and above - when this code was rewritten and optimized, the bug was fixed in a different way. The test program in the PR passes on 8-current with flying colors. PR: 112554 Submitted by: Spencer Minear Reviewed by: Mike Silbersack Obtained from: Secure Computing Corp MFC after: 4 weeks Modified: stable/7/sys/kern/uipc_usrreq.c Modified: stable/7/sys/kern/uipc_usrreq.c ============================================================================== --- stable/7/sys/kern/uipc_usrreq.c Sun Mar 22 22:57:53 2009 (r190298) +++ stable/7/sys/kern/uipc_usrreq.c Sun Mar 22 23:00:00 2009 (r190299) @@ -1878,6 +1878,7 @@ unp_gc(__unused void *arg, int pending) { struct file *fp, *nextfp; struct socket *so; + struct socket *soa; struct file **extra_ref, **fpp; int nunref, i; int nfiles_snap; @@ -1984,6 +1985,20 @@ unp_gc(__unused void *arg, int pending) SOCKBUF_UNLOCK(&so->so_rcv); /* + * If socket is in listening state, then sockets + * in its accept queue are accessible, and so + * are any descriptors in those sockets' receive + * queues. + */ + ACCEPT_LOCK(); + TAILQ_FOREACH(soa, &so->so_comp, so_list) { + SOCKBUF_LOCK(&soa->so_rcv); + unp_scan(soa->so_rcv.sb_mb, unp_mark); + SOCKBUF_UNLOCK(&soa->so_rcv); + } + ACCEPT_UNLOCK(); + + /* * Wake up any threads waiting in fdrop(). */ FILE_LOCK(fp); From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 23:05:54 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0590106566B; Sun, 22 Mar 2009 23:05:54 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id BAE9A8FC22; Sun, 22 Mar 2009 23:05:54 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 622E946B58; Sun, 22 Mar 2009 19:05:54 -0400 (EDT) Date: Sun, 22 Mar 2009 23:05:54 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Mike Silbersack In-Reply-To: <200903222300.n2MN00IO086771@svn.freebsd.org> Message-ID: References: <200903222300.n2MN00IO086771@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r190299 - stable/7/sys/kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Mar 2009 23:05:55 -0000 On Sun, 22 Mar 2009, Mike Silbersack wrote: > Fix unp_gc so that it recognizes file descriptors > that are currently in the process of being passed > between processes as alive and does not > try to garbage collect them. > > The full description of the problem and a test > program to reproduce it can be found in PR 112554. > > This fix was inspired by similar fixes in NetBSD and BSD/OS. > However, it does not apply to FreeBSD 8 and above - > when this code was rewritten and optimized, the bug > was fixed in a different way. The test program in the > PR passes on 8-current with flying colors. We have a UNIX domain socket-passing regression test that creates various contortion-esque situations and then looks to see if sockets were leaked. If it doesn't yet capture this failure mode, could you add it to that test? Robert N M Watson Computer Laboratory University of Cambridge > > PR: 112554 > Submitted by: Spencer Minear > Reviewed by: Mike Silbersack > Obtained from: Secure Computing Corp > MFC after: 4 weeks > > Modified: > stable/7/sys/kern/uipc_usrreq.c > > Modified: stable/7/sys/kern/uipc_usrreq.c > ============================================================================== > --- stable/7/sys/kern/uipc_usrreq.c Sun Mar 22 22:57:53 2009 (r190298) > +++ stable/7/sys/kern/uipc_usrreq.c Sun Mar 22 23:00:00 2009 (r190299) > @@ -1878,6 +1878,7 @@ unp_gc(__unused void *arg, int pending) > { > struct file *fp, *nextfp; > struct socket *so; > + struct socket *soa; > struct file **extra_ref, **fpp; > int nunref, i; > int nfiles_snap; > @@ -1984,6 +1985,20 @@ unp_gc(__unused void *arg, int pending) > SOCKBUF_UNLOCK(&so->so_rcv); > > /* > + * If socket is in listening state, then sockets > + * in its accept queue are accessible, and so > + * are any descriptors in those sockets' receive > + * queues. > + */ > + ACCEPT_LOCK(); > + TAILQ_FOREACH(soa, &so->so_comp, so_list) { > + SOCKBUF_LOCK(&soa->so_rcv); > + unp_scan(soa->so_rcv.sb_mb, unp_mark); > + SOCKBUF_UNLOCK(&soa->so_rcv); > + } > + ACCEPT_UNLOCK(); > + > + /* > * Wake up any threads waiting in fdrop(). > */ > FILE_LOCK(fp); > From owner-svn-src-stable-7@FreeBSD.ORG Sun Mar 22 23:42:32 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DD361065673 for ; Sun, 22 Mar 2009 23:42:32 +0000 (UTC) (envelope-from silby@silby.com) Received: from relay01.pair.com (relay01.pair.com [209.68.5.15]) by mx1.freebsd.org (Postfix) with SMTP id 1E7368FC12 for ; Sun, 22 Mar 2009 23:42:31 +0000 (UTC) (envelope-from silby@silby.com) Received: (qmail 28058 invoked from network); 22 Mar 2009 23:15:50 -0000 Received: from 209.68.2.70 (HELO localhost) (209.68.2.70) by relay01.pair.com with SMTP; 22 Mar 2009 23:15:50 -0000 X-pair-Authenticated: 209.68.2.70 Date: Sun, 22 Mar 2009 18:15:49 -0500 (CDT) From: Mike Silbersack To: Robert Watson In-Reply-To: Message-ID: References: <200903222300.n2MN00IO086771@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-stable-7@freebsd.org, svn-src-stable@freebsd.org, svn-src-all@freebsd.org, Mike Silbersack , src-committers@freebsd.org Subject: Re: svn commit: r190299 - stable/7/sys/kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Mar 2009 23:42:33 -0000 On Sun, 22 Mar 2009, Robert Watson wrote: > On Sun, 22 Mar 2009, Mike Silbersack wrote: > >> Fix unp_gc so that it recognizes file descriptors >> that are currently in the process of being passed >> between processes as alive and does not >> try to garbage collect them. >> >> The full description of the problem and a test >> program to reproduce it can be found in PR 112554. >> >> This fix was inspired by similar fixes in NetBSD and BSD/OS. >> However, it does not apply to FreeBSD 8 and above - >> when this code was rewritten and optimized, the bug >> was fixed in a different way. The test program in the >> PR passes on 8-current with flying colors. > > We have a UNIX domain socket-passing regression test that creates various > contortion-esque situations and then looks to see if sockets were leaked. If > it doesn't yet capture this failure mode, could you add it to that test? > > Robert N M Watson > Computer Laboratory > University of Cambridge I've been meaning to do that for two years, that's what delayed me from committing this. I finally decided to get it in before I missed another release. So I can try, but I won't make any guarantees. Mike "Silby" Silbersack From owner-svn-src-stable-7@FreeBSD.ORG Mon Mar 23 00:00:50 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE501106566B; Mon, 23 Mar 2009 00:00:50 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7BA058FC08; Mon, 23 Mar 2009 00:00:50 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2N00oRi088171; Mon, 23 Mar 2009 00:00:50 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2N00ogM088169; Mon, 23 Mar 2009 00:00:50 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200903230000.n2N00ogM088169@svn.freebsd.org> From: Colin Percival Date: Mon, 23 Mar 2009 00: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: r190301 - head/sys/kern releng/7.0 releng/7.0/sys/conf releng/7.0/sys/kern releng/7.1 releng/7.1/sys/conf releng/7.1/sys/kern stable/7/sys/kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Mar 2009 00:00:51 -0000 Author: cperciva Date: Mon Mar 23 00:00:50 2009 New Revision: 190301 URL: http://svn.freebsd.org/changeset/base/190301 Log: Correctly sanity-check timer IDs. [SA-09:06] Limit the size of malloced buffer when dumping environment variables. [EN-09:01] Approved by: so (cperciva) Approved by: re (kensmith) Security: FreeBSD-SA-09:06.ktimer Errata: FreeBSD-EN-09:01.kenv Modified: stable/7/sys/kern/kern_environment.c stable/7/sys/kern/kern_time.c Changes in other areas also in this revision: Modified: head/sys/kern/kern_environment.c head/sys/kern/kern_time.c releng/7.0/UPDATING releng/7.0/sys/conf/newvers.sh releng/7.0/sys/kern/kern_environment.c releng/7.0/sys/kern/kern_time.c releng/7.1/UPDATING releng/7.1/sys/conf/newvers.sh releng/7.1/sys/kern/kern_environment.c releng/7.1/sys/kern/kern_time.c Modified: stable/7/sys/kern/kern_environment.c ============================================================================== --- stable/7/sys/kern/kern_environment.c Sun Mar 22 23:00:52 2009 (r190300) +++ stable/7/sys/kern/kern_environment.c Mon Mar 23 00:00:50 2009 (r190301) @@ -87,7 +87,7 @@ kenv(td, uap) } */ *uap; { char *name, *value, *buffer = NULL; - size_t len, done, needed; + size_t len, done, needed, buflen; int error, i; KASSERT(dynamic_kenv, ("kenv: dynamic_kenv = 0")); @@ -100,13 +100,17 @@ kenv(td, uap) return (error); #endif done = needed = 0; + buflen = uap->len; + if (buflen > KENV_SIZE * (KENV_MNAMELEN + KENV_MVALLEN + 2)) + buflen = KENV_SIZE * (KENV_MNAMELEN + + KENV_MVALLEN + 2); if (uap->len > 0 && uap->value != NULL) - buffer = malloc(uap->len, M_TEMP, M_WAITOK|M_ZERO); + buffer = malloc(buflen, M_TEMP, M_WAITOK|M_ZERO); mtx_lock(&kenv_lock); for (i = 0; kenvp[i] != NULL; i++) { len = strlen(kenvp[i]) + 1; needed += len; - len = min(len, uap->len - done); + len = min(len, buflen - done); /* * If called with a NULL or insufficiently large * buffer, just keep computing the required size. Modified: stable/7/sys/kern/kern_time.c ============================================================================== --- stable/7/sys/kern/kern_time.c Sun Mar 22 23:00:52 2009 (r190300) +++ stable/7/sys/kern/kern_time.c Mon Mar 23 00:00:50 2009 (r190301) @@ -1079,7 +1079,8 @@ itimer_find(struct proc *p, int timerid) struct itimer *it; PROC_LOCK_ASSERT(p, MA_OWNED); - if ((p->p_itimers == NULL) || (timerid >= TIMER_MAX) || + if ((p->p_itimers == NULL) || + (timerid < 0) || (timerid >= TIMER_MAX) || (it = p->p_itimers->its_timers[timerid]) == NULL) { return (NULL); } From owner-svn-src-stable-7@FreeBSD.ORG Mon Mar 23 00:15:38 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6259B1065670; Mon, 23 Mar 2009 00:15:38 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DCB58FC1E; Mon, 23 Mar 2009 00:15:38 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2N0Fcv3088569; Mon, 23 Mar 2009 00:15:38 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2N0Fcd6088568; Mon, 23 Mar 2009 00:15:38 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200903230015.n2N0Fcd6088568@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 23 Mar 2009 00:15:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190302 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb powerpc/powerpc 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, 23 Mar 2009 00:15:39 -0000 Author: nwhitehorn Date: Mon Mar 23 00:15:38 2009 New Revision: 190302 URL: http://svn.freebsd.org/changeset/base/190302 Log: MFC r189675: Change the PVO zone for fictitious pages to the unmanaged PVO zone, to match the unmanaged flag set in the PVO attributes. Without doing this, pmap_remove() could try to remove fictitious pages (like those created by mmap of physical memory) from the wrong UMA zone, causing a panic. Reported by: Justin Hibbits Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/powerpc/powerpc/mmu_oea.c Modified: stable/7/sys/powerpc/powerpc/mmu_oea.c ============================================================================== --- stable/7/sys/powerpc/powerpc/mmu_oea.c Mon Mar 23 00:00:50 2009 (r190301) +++ stable/7/sys/powerpc/powerpc/mmu_oea.c Mon Mar 23 00:15:38 2009 (r190302) @@ -1102,8 +1102,11 @@ moea_enter_locked(pmap_t pmap, vm_offset PMAP_LOCK_ASSERT(pmap, MA_OWNED); /* XXX change the pvo head for fake pages */ - if ((m->flags & PG_FICTITIOUS) == PG_FICTITIOUS) + if ((m->flags & PG_FICTITIOUS) == PG_FICTITIOUS) { + pvo_flags &= ~PVO_MANAGED; pvo_head = &moea_pvo_kunmanaged; + zone = moea_upvo_zone; + } /* * If this is a managed page, and it's the first reference to the page, From owner-svn-src-stable-7@FreeBSD.ORG Mon Mar 23 03:03:44 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7BB38106566C; Mon, 23 Mar 2009 03:03:44 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68B4C8FC15; Mon, 23 Mar 2009 03:03:44 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2N33iPZ092235; Mon, 23 Mar 2009 03:03:44 GMT (envelope-from scf@svn.freebsd.org) Received: (from scf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2N33iGT092234; Mon, 23 Mar 2009 03:03:44 GMT (envelope-from scf@svn.freebsd.org) Message-Id: <200903230303.n2N33iGT092234@svn.freebsd.org> From: Sean Farley Date: Mon, 23 Mar 2009 03:03: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: r190307 - stable/7/sys/net 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, 23 Mar 2009 03:03:45 -0000 Author: scf Date: Mon Mar 23 03:03:44 2009 New Revision: 190307 URL: http://svn.freebsd.org/changeset/base/190307 Log: Merge r189866 from head to stable/7: Add the SIOCSIFMTU ioctl handling directly to tap(4) permitting it to have its MTU set higher than 1500 (ETHERMTU). Its new limit is now 65535 as enforced by ifhwioctl() in if.c This allows a tap(4) device to be added to a bridge, which requires all interface members to have the same MTU, with an interface configured for jumbo frames. QEMU may now connect to a network via tap(4) without requiring the real interface to have its MTU set to 1500 or lower. Reviewed by: rpaulo, bms Merge r189907 from head to stable/7: Remove the splimp()/splx() calls around the setting of the MTU. They are no-op's that I inadvertently added. Even if locking is needed in general for the ioctl's, setting a single long will not need it due to the operation being atomic. Reported by: rwatson Modified: stable/7/sys/net/if_tap.c Modified: stable/7/sys/net/if_tap.c ============================================================================== --- stable/7/sys/net/if_tap.c Mon Mar 23 01:24:17 2009 (r190306) +++ stable/7/sys/net/if_tap.c Mon Mar 23 03:03:44 2009 (r190307) @@ -600,6 +600,7 @@ static int tapifioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct tap_softc *tp = ifp->if_softc; + struct ifreq *ifr = (struct ifreq *)data; struct ifstat *ifs = NULL; int s, dummy; @@ -609,6 +610,10 @@ tapifioctl(struct ifnet *ifp, u_long cmd case SIOCDELMULTI: break; + case SIOCSIFMTU: + ifp->if_mtu = ifr->ifr_mtu; + break; + case SIOCGIFSTATUS: s = splimp(); ifs = (struct ifstat *)data; From owner-svn-src-stable-7@FreeBSD.ORG Mon Mar 23 03:26:02 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F9FF106564A; Mon, 23 Mar 2009 03:26:02 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F06F38FC0C; Mon, 23 Mar 2009 03:26:01 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2N3Q1wv093035; Mon, 23 Mar 2009 03:26:01 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2N3Q1XC093033; Mon, 23 Mar 2009 03:26:01 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200903230326.n2N3Q1XC093033@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 23 Mar 2009 03:26: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: r190308 - 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, 23 Mar 2009 03:26:02 -0000 Author: edwin Date: Mon Mar 23 03:26:01 2009 New Revision: 190308 URL: http://svn.freebsd.org/changeset/base/190308 Log: MFC of ... r187524: Latest bulletin C from Daniel GAMBIS: no leap at the end of june 2009. r188436: MFV of tzdata2009b. - Updated leapseconds r189923: MFV of tzdata2009c - Cuba has DST again. Modified: stable/7/share/zoneinfo/ (props changed) stable/7/share/zoneinfo/leapseconds stable/7/share/zoneinfo/northamerica Modified: stable/7/share/zoneinfo/leapseconds ============================================================================== --- stable/7/share/zoneinfo/leapseconds Mon Mar 23 03:03:44 2009 (r190307) +++ stable/7/share/zoneinfo/leapseconds Mon Mar 23 03:26:01 2009 (r190308) @@ -58,28 +58,19 @@ Leap 2008 Dec 31 23:59:60 + S # e-mail : services.iers@obspm.fr # http://hpiers.obspm.fr/eop-pc # -# Paris, 4 July 2008 +# Paris, 15 January 2009 # -# Bulletin C 36 +# Bulletin C 37 # # To authorities responsible # for the measurement and # distribution of time # -# UTC TIME STEP -# on the 1st of January 2009 -# -# A positive leap second will be introduced at the end of December 2008. -# The sequence of dates of the UTC second markers will be: -# -# 2008 December 31, 23h 59m 59s -# 2008 December 31, 23h 59m 60s -# 2009 January 1, 0h 0m 0s -# -# The difference between UTC and the International Atomic Time TAI is: -# -# from 2006 January 1, 0h UTC, to 2009 January 1 0h UTC : UTC-TAI = - 33s -# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = - 34s +# NO positive leap second will be introduced at the end of June 2009. +# The difference between Coordinated Universal Time UTC and the +# International Atomic Time TAI is : +# +# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s # # Leap seconds can be introduced in UTC at the end of the months of December # or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every Modified: stable/7/share/zoneinfo/northamerica ============================================================================== --- stable/7/share/zoneinfo/northamerica Mon Mar 23 03:03:44 2009 (r190307) +++ stable/7/share/zoneinfo/northamerica Mon Mar 23 03:26:01 2009 (r190308) @@ -1,4 +1,4 @@ -# @(#)northamerica 8.26 +# @(#)northamerica 8.27 #
 
 # also includes Central America and the Caribbean
@@ -2258,6 +2258,25 @@ Zone America/Costa_Rica	-5:36:20 -	LMT	1
 # From Arthur David Olson (2008-03-12):
 # Assume Sun>=15 (third Sunday) going forward.
 
+# From Alexander Krivenyshev (2009-03-04)
+# According to the Radio Reloj - Cuba will start Daylight Saving Time on
+# midnight between Saturday, March 07, 2009 and Sunday, March 08, 2009-
+# not on midnight March 14 / March 15 as previously thought.
+#
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_cuba05.html
+# (in Spanish)
+# 
+
+# From Arthur David Olson (2009-03-09)
+# I listened over the Internet to
+# 
+# http://media.enet.cu/readioreloj
+# 
+# this morning; when it was 10:05 a. m. here in Bethesda, Maryland the
+# the time was announced as "diez cinco"--the same time as here, indicating
+# that has indeed switched to DST. Assume second Sunday from 2009 forward.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Cuba	1928	only	-	Jun	10	0:00	1:00	D
 Rule	Cuba	1928	only	-	Oct	10	0:00	0	S
@@ -2290,7 +2309,8 @@ Rule	Cuba	1998	2003	-	Oct	lastSun	0:00s	
 Rule	Cuba	2000	2004	-	Apr	Sun>=1	0:00s	1:00	D
 Rule	Cuba	2006	max	-	Oct	lastSun	0:00s	0	S
 Rule	Cuba	2007	only	-	Mar	Sun>=8	0:00s	1:00	D
-Rule	Cuba	2008	max	-	Mar	Sun>=15	0:00s	1:00	D
+Rule	Cuba	2008	only	-	Mar	Sun>=15	0:00s	1:00	D
+Rule	Cuba	2009	max	-	Mar	Sun>=8	0:00s	1:00	D
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	America/Havana	-5:29:28 -	LMT	1890

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 04:06:21 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 887341065673;
	Mon, 23 Mar 2009 04:06:21 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 74E598FC13;
	Mon, 23 Mar 2009 04:06:21 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2N46LPI093839;
	Mon, 23 Mar 2009 04:06:21 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2N46L7V093838;
	Mon, 23 Mar 2009 04:06:21 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200903230406.n2N46L7V093838@svn.freebsd.org>
From: Andrew Thompson 
Date: Mon, 23 Mar 2009 04:06:21 +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: r190310 - stable/7/sys/dev/usb
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, 23 Mar 2009 04:06:22 -0000

Author: thompsa
Date: Mon Mar 23 04:06:21 2009
New Revision: 190310
URL: http://svn.freebsd.org/changeset/base/190310

Log:
  Sync usbdevs to HEAD, keeping name compat.

Modified:
  stable/7/sys/dev/usb/usbdevs

Modified: stable/7/sys/dev/usb/usbdevs
==============================================================================
--- stable/7/sys/dev/usb/usbdevs	Mon Mar 23 03:26:03 2009	(r190309)
+++ stable/7/sys/dev/usb/usbdevs	Mon Mar 23 04:06:21 2009	(r190310)
@@ -151,6 +151,7 @@ vendor PLANTRONICS	0x047f	Plantronics
 vendor KYOCERA		0x0482	Kyocera Wireless Corp.
 vendor STMICRO		0x0483	STMicroelectronics
 vendor FOXCONN		0x0489	Foxconn
+vendor MEIZU		0x0492	Meizu Electronics
 vendor YAMAHA		0x0499	YAMAHA
 vendor COMPAQ		0x049f	Compaq
 vendor HITACHI		0x04a4	Hitachi
@@ -282,6 +283,7 @@ vendor INSYSTEM		0x05ab	In-System Design
 vendor APPLE		0x05ac	Apple Computer
 vendor YCCABLE		0x05ad	Y.C. Cable
 vendor DIGITALPERSONA	0x05ba	DigitalPersona
+vendor 3G		0x05bc	3G Green Green Globe
 vendor RAFI		0x05bd	RAFI
 vendor TYCO		0x05be	Tyco
 vendor KAWASAKI		0x05c1	Kawasaki
@@ -364,6 +366,7 @@ vendor SYNTECH		0x0745	Syntech Informati
 vendor DIGITALSTREAM	0x074e	Digital Stream
 vendor AUREAL		0x0755	Aureal Semiconductor
 vendor MIDIMAN		0x0763	Midiman
+vendor CYBERPOWER	0x0764	Cyber Power Systems, Inc.
 vendor SURECOM		0x0769	Surecom Technology
 vendor LINKSYS2		0x077b	Linksys
 vendor GRIFFIN		0x077d	Griffin Technology
@@ -435,6 +438,7 @@ vendor AUDIOTECHNICA	0x0909	Audio-Techni
 vendor TRUMPION		0x090a	Trumpion Microelectronics
 vendor FEIYA		0x090c	Feiya
 vendor ALATION		0x0910	Alation Systems
+vendor GLOBESPAN	0x0915	Globespan
 vendor CONCORDCAMERA	0x0919	Concord Camera
 vendor GARMIN		0x091e	Garmin International
 vendor GOHUBS		0x0921	GoHubs
@@ -497,6 +501,7 @@ vendor AMBIT		0x0bb2	Ambit Microsystems
 vendor HTC		0x0bb4	HTC
 vendor REALTEK		0x0bda	Realtek
 vendor ADDONICS2	0x0bf6	Addonics Technology
+vendor FSC		0x0bf8	Fujitsu Siemens Computers
 vendor AGATE		0x0c08	Agate Technologies
 vendor DMI		0x0c0b	DMI
 vendor MICRODIA		0x0c45	Chicony
@@ -522,6 +527,7 @@ vendor HAWKING		0x0e66	Hawking
 vendor FOSSIL		0x0e67	Fossil, Inc
 vendor GMATE		0x0e7e	G.Mate, Inc
 vendor OTI		0x0ea0	Ours Technology
+vendor YISO		0x0eab	Yiso Wireless Co.
 vendor PILOTECH		0x0eaf	Pilotech
 vendor NOVATECH		0x0eb0	NovaTech
 vendor ITEGNO		0x0eba	iTegno
@@ -587,6 +593,7 @@ vendor SILICOM		0x1485	Silicom
 vendor RALINK		0x148f	Ralink Technology
 vendor IMAGINATION	0x149a	Imagination Technologies
 vendor CONCEPTRONIC2	0x14b2	Conceptronic
+vendor SUPERTOP		0x14cd	Super Top
 vendor PLANEX3		0x14ea	Planex Communications
 vendor SILICONPORTALS	0x1527	Silicon Portals
 vendor UBIQUAM		0x1529	UBIQUAM Co., Ltd.
@@ -607,8 +614,8 @@ vendor GIGASET		0x1690	Gigaset
 vendor GLOBALSUN	0x16ab	Global Sun Technology
 vendor ANYDATA		0x16d5	AnyDATA Corporation
 vendor JABLOTRON	0x16d6	Jablotron
-vendor CMOTECH		0x16d8	CMOTECH Co., Ltd.
-vendor AXESSTEL		0x1726	Axesstel Co., Ltd.
+vendor CMOTECH		0x16d8	C-motech
+vendor AXESSTEL		0x1726  Axesstel Co., Ltd.
 vendor LINKSYS4		0x1737	Linksys
 vendor SENAO		0x1740	Senao
 vendor METAGEEK		0x1781	MetaGeek
@@ -616,6 +623,8 @@ vendor AMIT		0x18c5	AMIT
 vendor QCOM		0x18e8	Qcom
 vendor LINKSYS3		0x1915	Linksys
 vendor QUALCOMMINC	0x19d2	Qualcomm, Incorporated
+vendor STELERA		0x1a8d	Stelera Wireless
+vendor DRESDENELEKTRONIK 0x1cf1 dresden elektronik
 vendor DLINK		0x2001	D-Link
 vendor PLANEX2		0x2019	Planex Communications
 vendor ERICSSON		0x2282	Ericsson
@@ -700,6 +709,7 @@ product ACCTON USB320_EC	0x1046	USB320-E
 product ACCTON 2664W		0x3501	2664W
 product ACCTON 111		0x3503	T-Sinus 111 Wireless Adapter
 product ACCTON SMCWUSBG		0x4505	SMCWUSB-G
+product ACCTON PRISM_GT		0x4521	PrismGT USB 2.0 WLAN
 product ACCTON SS1001		0x5046	SpeedStream Ethernet Adapter
 product ACCTON ZD1211B		0xe501	ZD1211B
 
@@ -801,6 +811,7 @@ product AKS USBHASP		0x0001	USB-HASP 0.0
 /* Alcor Micro, Inc. products */
 product ALCOR2 KBD_HUB		0x2802	Kbd Hub
 
+product ALCOR TRANSCEND		0x6387	Transcend JetFlash Drive
 product ALCOR MA_KBD_HUB	0x9213	MacAlly Kbd Hub
 product ALCOR AU9814		0x9215	AU9814 Hub
 product ALCOR UMCR_9361		0x9361	USB Multimedia Card Reader
@@ -879,6 +890,7 @@ product ASUS WL159G		0x170c	WL-159g
 product ASUS A9T_WIFI		0x171b	A9T wireless
 product ASUS RT2573_1		0x1723	RT2573
 product ASUS RT2573_2		0x1724	RT2573
+product ASUS LCM		0x1726	LCM display
 product ASUS P535		0x420f	ASUS P535 PDA
 
 /* ATen products */
@@ -900,6 +912,7 @@ product ATHEROS2 AR5523_3	0x0005	AR5523
 product ATHEROS2 AR5523_3_NF	0x0006	AR5523 (no firmware)
 
 /* Atmel Comp. products */
+product ATMEL STK541		0x2109	Zigbee Controller
 product ATMEL UHB124		0x3301	UHB124 hub
 product ATMEL DWL120		0x7603	DWL-120 Wireless Adapter
 product ATMEL BW002		0x7605	BW002 Wireless Adapter
@@ -910,7 +923,7 @@ product ATMEL AT76C505A		0x7614	AT76c505
 product AVISION 1200U		0x0268	1200U scanner
 
 /* Axesstel products */
-product AXESSTEL DATAMODEM	0x1000	Data Modem
+product AXESSTEL DATAMODEM	0x1000  Data Modem
 
 /* Baltech products */
 product BALTECH CARDREADER	0x9999	Card reader
@@ -926,6 +939,7 @@ product BELKIN FBT003V		0x0084	FBT003v2 
 product BELKIN F5U103		0x0103	F5U103 Serial
 product BELKIN F5U109		0x0109	F5U109 Serial
 product BELKIN USB2SCSI		0x0115	USB to SCSI
+product BELKIN F8T012		0x0121	F8T012xx1 Bluetooth USB Adapter
 product BELKIN USB2LAN		0x0121	USB to LAN
 product BELKIN F5U208		0x0208	F5U208 VideoBus II
 product BELKIN F5U237		0x0237	F5U237 USB 2.0 7-Port Hub
@@ -938,6 +952,7 @@ product BELKIN F5D5055		0x5055	F5D5055
 product BELKIN F5D7050		0x7050	F5D7050 Wireless Adapter
 product BELKIN F5D7051		0x7051	F5D7051 54g USB Network Adapter
 product BELKIN F5D7050A		0x705a	F5D7050A Wireless Adapter
+/* Also sold as 'Ativa 802.11g wireless card' */
 product BELKIN F5D7050_V4000	0x705c	F5D7050 v4000 Wireless Adapter
 product BELKIN F5D9050V3	0x905b	F5D9050 ver 3 Wireless Adapter
 product BELKIN2 F5U002		0x0002	F5U002 Parallel printer
@@ -968,6 +983,7 @@ product CANON LIDE25		0x2220	CanoScan LI
 product CANON S10		0x3041	PowerShot S10
 product CANON S100		0x3045	PowerShot S100
 product CANON S200		0x3065	PowerShot S200
+product CANON REBELXT		0x30ef	Digital Rebel XT
 
 /* CATC products */
 product CATC NETMATE		0x000a	Netmate Ethernet
@@ -977,6 +993,7 @@ product CATC ANDROMEDA		0x1237	Andromeda
 
 /* CASIO products */
 product CASIO QV_DIGICAM	0x1001	QV DigiCam
+product CASIO EXS880		0x1105	Exilim EX-S880
 product CASIO BE300		0x2002	BE-300 PDA
 product CASIO NAMELAND		0x4001	CASIO Nameland EZ-USB
 
@@ -1030,6 +1047,7 @@ product COMPAQ IPAQLINUX	0x505a	iPAQ Lin
 product COMPOSITE USBPS2	0x0001	USB to PS2 Adaptor
 
 /* Conceptronic products */
+product CONCEPTRONIC PRISM_GT	0x3762	PrismGT USB 2.0 WLAN
 product CONCEPTRONIC C11U	0x7100	C11U
 product CONCEPTRONIC WL210	0x7110	WL-210
 product CONCEPTRONIC AR5523_1	0x7801	AR5523
@@ -1050,6 +1068,8 @@ product COREGA FETHER_USB_TXS	0x000d	FEt
 product COREGA WLANUSB		0x0012	Wireless LAN Stick-11
 product COREGA FETHER_USB2_TX	0x0017	FEther USB2-TX
 product COREGA WLUSB_11_KEY	0x001a	ULUSB-11 Key
+product COREGA CGWLUSB2GL	0x002d	CG-WLUSB2GL
+product COREGA CGWLUSB2GPX	0x002e	CG-WLUSB2GPX
 product COREGA WLUSB_11_STICK	0x7613	WLAN USB Stick 11
 product COREGA FETHER_USB_TXC	0x9601	FEther USB-TXC
 
@@ -1072,6 +1092,9 @@ product CURITEL HX550C		0x1101	CDMA 2000
 product CURITEL HX57XB		0x2101	CDMA 2000 1xRTT USB modem (HX-570/575B/PR-600)
 product CURITEL PC5740		0x3701	Broadband Wireless modem
 
+/* CyberPower products */
+product CYBERPOWER 1500CAVRLCD	0x0501	1500CAVRLCD
+
 /* CyberTAN Technology products */
 product CYBERTAN TG54USB	0x1666	TG54USB
 
@@ -1092,8 +1115,11 @@ product DALLAS J6502		0x4201	J-6502 spea
 
 /* Dell products */
 product DELL PORT		0x0058	Port Replicator
+product DELL AIO926		0x5115	Photo AIO Printer 926
 product DELL BC02		0x8000	BC02 Bluetooth USB Adapter
+product DELL PRISM_GT_1		0x8102	PrismGT USB 2.0 WLAN
 product DELL TM350		0x8103	TrueMobile 350 Bluetooth USB Adapter
+product DELL PRISM_GT_2		0x8104	PrismGT USB 2.0 WLAN
 product DELL U740		0x8135	Dell U740 CDMA
 
 /* Delorme Paublishing products */
@@ -1148,6 +1174,10 @@ product DMI CFSM_RW		0xa109	CF/SM Reader
 /* DrayTek products */
 product DRAYTEK VIGOR550	0x0550	Vigor550
 
+/* dresden elektronik products */
+product DRESDENELEKTRONIK SENSORTERMINALBOARD  0x0001 SensorTerminalBoard
+product DRESDENELEKTRONIK WIRELESSHANDHELDTERMINAL  0x0004 Wireless Handheld Terminal
+
 /* Dynastream Innovations */
 product DYNASTREAM ANTDEVBOARD	0x1003	ANT dev board
 
@@ -1220,12 +1250,18 @@ product EPSON STYLUS_895	0x0602	Stylus P
 product EPSON CX5400		0x0808	CX5400 scanner
 product EPSON 3500		0x080e	CX-3500/3600/3650 MFP
 product EPSON RX425		0x080f	Stylus Photo RX425 scanner
-product EPSON 4800		0x0819	CX4800 MP scanner
-product EPSON 4200		0x0820	CX4200 MP scanner
-product EPSON 5000		0x082b	DX-50x0 MFP scanner
-product EPSON 6000		0x082e	DX-60x0 MFP scanner
-product EPSON DX7400		0x0838	DX7400/CX7300 scanner
-product EPSON DX8400		0x0839	DX8400 scanner
+product EPSON DX3800		0x0818	CX3700/CX3800/DX38x0 MFP scanner
+product EPSON 4800		0x0819	CX4700/CX4800/DX48x0 MFP scanner
+product EPSON 4200		0x0820	CX4100/CX4200/DX4200 MFP scanner
+product EPSON 5000		0x082b  CX4900/CX5000/DX50x0 MFP scanner
+product EPSON 6000		0x082e  CX5900/CX6000/DX60x0 MFP scanner
+product EPSON DX4000		0x082f  DX4000 MFP scanner
+product EPSON DX7400		0x0838	CX7300/CX7400/DX7400 MFP scanner
+product EPSON DX8400		0x0839	CX8300/CX8400/DX8400 MFP scanner
+product EPSON SX100		0x0841	SX100/NX100 MFP scanner
+product EPSON NX300		0x0848	NX300 MFP scanner
+product EPSON SX200		0x0849	SX200/SX205 MFP scanner
+product EPSON SX400		0x084a	SX400/NX400/TX400 MFP scanner
 
 /* e-TEK Labs products */
 product ETEK 1COM		0x8007	Serial
@@ -1245,6 +1281,9 @@ product FOSSIL WRISTPDA		0x0002	Wrist PD
 /* Freecom products */
 product FREECOM DVD		0xfc01	DVD drive
 
+/* Fujitsu Siemens Computers products */
+product FSC E5400		0x1009	PrismGT USB 2.0 WLAN
+
 /* Future Technology Devices products */
 product FTDI SERIAL_8U100AX	0x8372	8U100AX Serial
 product FTDI SERIAL_8U232AM	0x6001	8U232AM Serial
@@ -1258,6 +1297,7 @@ product FTDI UOPTBR		0xe889	USB-RS232 Op
 product FTDI EMCU2D		0xe88a	Expert mouseCLOCK USB II
 product FTDI PCMSFU		0xe88b	Precision Clock MSF USB
 product FTDI EMCU2H		0xe88c	Expert mouseCLOCK USB II HBG
+product	FTDI MAXSTREAM		0xee18	Maxstream PKG-U
 product FTDI USBSERIAL		0xfa00	Matrix Orbital USB Serial
 product FTDI MX2_3		0xfa01	Matrix Orbital MX2 or MX3
 product FTDI MX4_5		0xfa02	Matrix Orbital MX4 or MX5
@@ -1312,6 +1352,10 @@ product GLOBALSUN AR5523_1_NF	0x7802	AR5
 product GLOBALSUN AR5523_2	0x7811	AR5523
 product GLOBALSUN AR5523_2_NF	0x7812	AR5523 (no firmware)
 
+/* Globespan products */
+product GLOBESPAN PRISM_GT_1	0x2000	PrismGT USB 2.0 WLAN
+product GLOBESPAN PRISM_GT_2	0x2002	PrismGT USB 2.0 WLAN
+
 /* G.Mate, Inc products */
 product GMATE YP3X00		0x1001	YP3X00 PDA
 
@@ -1391,8 +1435,9 @@ product HP 840C			0x0604	DeskJet 840c
 product HP 2200C		0x0605	ScanJet 2200C
 product HP 5300C		0x0701	Scanjet 5300C
 product HP 4400C		0x0705	Scanjet 4400C
+product	HP 4470C		0x0805	Scanjet 4470C
 product HP 82x0C		0x0b01	Scanjet 82x0C
-product HP 2300D		0x0b17	Laserjet 2300d
+product HP 2300D 		0x0b17	Laserjet 2300d
 product HP 970CSE		0x1004	Deskjet 970Cse
 product HP 5400C		0x1005	Scanjet 5400C
 product HP 2215			0x1016	iPAQ 22xx/Jornada 548
@@ -1403,6 +1448,7 @@ product HP HS2300		0x1e1d  HS2300 HSDPA 
 product HP 640C			0x2004	DeskJet 640c
 product HP 4670V		0x3005	ScanJet 4670v
 product HP P1100		0x3102	Photosmart P1100
+product HP OJ4215		0x3d11	OfficeJet 4215
 product HP HN210E		0x811c	Ethernet HN210E
 product HP2 C500		0x6002	PhotoSmart C500
 
@@ -1440,6 +1486,7 @@ product INTEL EASYPC_CAMERA	0x0110	Easy 
 product INTEL TESTBOARD		0x9890	82930 test board
 
 /* Intersil products */
+product INTERSIL PRISM_GT	0x1000	PrismGT USB 2.0 WLAN
 product INTERSIL PRISM_2X	0x3642	Prism2.x or Atmel WLAN
 
 /* Interpid Control Systems products */
@@ -1466,6 +1513,7 @@ product IOMEGA ZIP250		0x0030	Zip 250
 
 /* Ituner networks products */
 product ITUNERNET USBLCD2X20	0x0002	USB-LCD 2x20
+product ITUNERNET USBLCD4X20	0xc001	USB-LCD 4x20
 
 /* Jablotron products */
 product JABLOTRON PC60B		0x0001	PC-60B
@@ -1585,6 +1633,7 @@ product LOGITECH QUICKCAMWEB	0x0801	Quic
 product LOGITECH QUICKCAMPRO	0x0810	QuickCam Pro
 product LOGITECH QUICKCAMEXP	0x0840	QuickCam Express
 product LOGITECH QUICKCAM	0x0850	QuickCam
+product LOGITECH QUICKCAMPRO3	0x0990	QuickCam Pro 9000
 product LOGITECH N43		0xc000	N43
 product LOGITECH N48		0xc001	N48 mouse
 product LOGITECH MBA47		0xc002	M-BA47 mouse
@@ -1620,6 +1669,9 @@ product MCT DU_H3SP_USB232	0x0200	D-Link
 product MCT USB232		0x0210	USB-232 Interface
 product MCT SITECOM_USB232	0x0230	Sitecom USB-232 Products
 
+/* Meizu Electronics */
+product MEIZU M6_SL		0x0140	MiniPlayer M6 (SL)
+
 /* Melco, Inc products */
 product MELCO LUATX1		0x0001	LUA-TX Ethernet
 product MELCO LUATX5		0x0005	LUA-TX Ethernet
@@ -1635,6 +1687,10 @@ product MELCO PCOPRS1		0x00b3	PC-OP-RS1 
 product MELCO SG54HP		0x00d8	WLI-U2-SG54HP
 product MELCO G54HP		0x00d9	WLI-U2-G54HP
 product MELCO KG54L		0x00da	WLI-U2-KG54L
+product MELCO SG54HG		0x00f4	WLI-U2-SG54HG
+
+/* Merlin products */
+product MERLIN V620             0x1110  Merlin V620
 
 /* MetaGeek products */
 product METAGEEK WISPY1B	0x083e	MetaGeek Wi-Spy
@@ -1675,6 +1731,7 @@ product MICROSOFT MN510		0x006e	MN510 Wi
 product MICROSOFT MN110		0x007a	10/100 USB NIC
 product MICROSOFT WLINTELLIMOUSE 0x008c	Wireless Optical IntelliMouse
 product MICROSOFT WLNOTEBOOK	0x00b9	Wireless Optical Mouse (Model 1023)
+product MICROSOFT COMFORT3000	0x00d1	Comfort Optical Mouse 3000 (Model 1043)
 product MICROSOFT WLNOTEBOOK2	0x00e1	Wireless Optical Mouse 3000 (Model 1056)
 product MICROSOFT WLNOTEBOOK3	0x00d2	Wireless Optical Mouse 3000 (Model 1049)
 product MICROSOFT WLUSBMOUSE	0x00b9	Wireless USB Mouse
@@ -1757,6 +1814,7 @@ product MSYSTEMS DISKONKEY2	0x0011	DiskO
 
 /* Myson products */
 product MYSON HEDEN		0x8818	USB-IDE
+product MYSON STARREADER	0x9920	USB flash card adapter
 
 /* National Semiconductor */
 product NATIONAL BEARPAW1200	0x1000	BearPaw 1200
@@ -1784,8 +1842,10 @@ product NETGEAR EA101		0x1001	Ethernet
 product NETGEAR EA101X		0x1002	Ethernet
 product NETGEAR FA101		0x1020	Ethernet 10/100, USB1.1
 product NETGEAR FA120		0x1040	USB 2.0 Ethernet
+product NETGEAR WG111V2_2	0x4240	PrismGT USB 2.0 WLAN
 product NETGEAR WG111U		0x4300	WG111U
 product NETGEAR WG111U_NF	0x4301	WG111U (no firmware)
+product NETGEAR WG111V2		0x6a00	WG111V2
 product NETGEAR2 MA101		0x4100	MA101
 product NETGEAR2 MA101B		0x4102	MA101 Rev B
 product NETGEAR3 WG111T		0x4250	WG111T
@@ -1821,6 +1881,8 @@ product NOVATEL U720		0x2110	Merlin U720
 product NOVATEL U727		0x4100	Merlin U727 CDMA
 product NOVATEL MC950D		0x4400	Novatel MC950D HSUPA
 product NOVATEL ZEROCD		0x5010	Novatel ZeroCD
+product NOVATEL ZEROCD2		0x5030	Novatel ZeroCD
+product NOVATEL U760		0x6000	Novatel U760
 product NOVATEL2 FLEXPACKGPS	0x0100	NovAtel FlexPack GPS receiver
 
 /* Merlin products */
@@ -1846,16 +1908,15 @@ product ONSPEC CFSM_COMBO	0xa109	USB to 
 product ONSPEC UCF100		0xa400	FlashLink UCF-100 CompactFlash Reader
 product ONSPEC2 IMAGEMATE_SDDR55	0xa103	ImageMate SDDR55
 
-
 /* Option products */
 product OPTION VODAFONEMC3G	0x5000	Vodafone Mobile Connect 3G datacard
 product OPTION GT3G		0x6000	GlobeTrotter 3G datacard
 product OPTION GT3GQUAD		0x6300	GlobeTrotter 3G QUAD datacard
 product OPTION GT3GPLUS		0x6600	GlobeTrotter 3G+ datacard
+product OPTION GTICON322	0xd033	GlobeTrotter Icon322 storage
 product OPTION GTMAX36		0x6701	GlobeTrotter Max 3.6 Modem
 product OPTION GTMAXHSUPA	0x7001	GlobeTrotter HSUPA
 
-
 /* OQO */
 product OQO WIFI01		0x0002	model 01 WiFi interface
 product OQO BT01		0x0003	model 01 Bluetooth interface
@@ -1914,6 +1975,7 @@ product PLANEX2 GWUS54HP	0xab01	GW-US54H
 product PLANEX2 GWUS54MINI2	0xab50	GW-US54Mini2
 product PLANEX2 GWUS54SG	0xc002	GW-US54SG
 product PLANEX2 GWUS54GZL	0xc007	GW-US54GZL
+product PLANEX2 GWUS54GD	0xed01	GW-US54GD
 product PLANEX2 GWUSMM		0xed02	GW-USMM
 product PLANEX3 GWUS54GZ	0xab10	GW-US54GZ
 product PLANEX3 GU1000T		0xab11	GU-1000T
@@ -1978,6 +2040,7 @@ product QUALCOMM2 RWT_FCT	0x3100	RWT FCT
 product QUALCOMM2 CDMA_MSM	0x3196	CDMA Technologies MSM modem
 product QUALCOMMINC CDMA_MSM	0x0001	CDMA Technologies MSM modem
 product QUALCOMMINC ZTE_STOR	0x2000	USB ZTE Storage
+product QUALCOMMINC AC8700	0xfffe	CDMA 1xEVDO USB modem
 
 /* Qtronix products */
 product QTRONIX 980N		0x2011	Scorpion-980N keyboard
@@ -2002,6 +2065,15 @@ product RALINK RT2573_2		0x9021	RT2501US
 /* ReakTek products */
 /* Green House and CompUSA OEM this part */
 product REALTEK USBKR100	0x8150	USBKR100 USB Ethernet
+product REALTEK RTL8187		0x8187	RTL8187 Wireless Adapter
+
+/* Ricoh products */
+product RICOH VGPVCC2		0x1830	VGP-VCC2 Camera
+product RICOH VGPVCC3		0x1832	VGP-VCC3 Camera
+product RICOH VGPVCC2_2		0x1833	VGP-VCC2 Camera
+product RICOH VGPVCC2_3		0x1834	VGP-VCC2 Camera
+product RICOH VGPVCC7		0x183a	VGP-VCC7 Camera
+product RICOH VGPVCC8		0x183b	VGP-VCC8 Camera
 
 /* Roland products */
 product ROLAND UM1		0x0009	UM-1 MIDI I/F
@@ -2039,7 +2111,7 @@ product SANDISK SDCZ4_128	0x7112	Cruzer 
 product SANDISK SDCZ4_256	0x7113	Cruzer Micro 256MB
 
 /* Sanyo Electric products */
-product SANYO SCP4900		0x0701	Sanyo SCP-4900 USB Phone
+product SANYO SCP4900 		0x0701	Sanyo SCP-4900 USB Phone
 
 /* ScanLogic products */
 product SCANLOGIC SL11R		0x0002	SL11R IDE Adapter
@@ -2050,6 +2122,7 @@ product SENAO NUB8301		0x2000	NUB-8301
 
 /* ShanTou products */
 product SHANTOU ST268		0x0268	ST268
+product SHANTOU DM9601		0x9601	DM 9601
 
 /* Shark products */
 product SHARK PA		0x0400	Pocket Adapter
@@ -2080,7 +2153,7 @@ product SHUTTLE EUSBORCA	0x0325	eUSB ORC
 product SIEMENS SPEEDSTREAM	0x1001	SpeedStream
 product SIEMENS SPEEDSTREAM22	0x1022	SpeedStream 1022
 product SIEMENS2 WLL013		0x001b	WLL013
-product SIEMENS2 ES75		0x0034	GSM module MC35
+product SIEMENS2 ES75		0x0034  GSM module MC35
 product SIEMENS2 WL54G		0x3c06	54g USB Network Adapter
 product SIEMENS3 SX1		0x0001	SX1
 product SIEMENS3 X65		0x0003	X65
@@ -2092,12 +2165,14 @@ product SIERRA AIRCARD595	0x0019	Sierra 
 product SIERRA AC595U		0x0120	Sierra Wireless AirCard 595U
 product SIERRA AC597E		0x0021	Sierra Wireless AirCard 597E
 product SIERRA C597		0x0023	Sierra Wireless Compass 597
+product SIERRA AC875		0x6820	Sierra Wireless AirCard 875
 product SIERRA AC880		0x6850	Sierra Wireless AirCard 880
 product SIERRA AC881		0x6851	Sierra Wireless AirCard 881
 product SIERRA AC880E		0x6852	Sierra Wireless AirCard 880E
 product SIERRA AC881E		0x6853	Sierra Wireless AirCard 881E
 product SIERRA AC880U		0x6855	Sierra Wireless AirCard 880U
 product SIERRA AC881U		0x6856	Sierra Wireless AirCard 881U
+product SIERRA AC885U		0x6880	Sierra Wireless AirCard 885U
 product SIERRA EM5625		0x0017	EM5625
 product SIERRA MC5720		0x0218	MC5720 Wireless Modem
 product SIERRA MC5720_2		0x0018	MC5720
@@ -2114,7 +2189,6 @@ product SIERRA MC8780		0x6832	MC8780
 product SIERRA MC8781		0x6833	MC8781
 product SIERRA TRUINSTALL	0x0fff	Aircard Tru Installer
 
-
 /* Sigmatel products */
 product SIGMATEL I_BEAD100	0x8008	i-Bead 100 MP3 Player
 
@@ -2131,6 +2205,7 @@ product SILICOM GPE		0x0002	Psion Gold P
 
 /* SI Labs */
 product SILABS	POLOLU		0x803b	Pololu Serial
+product SILABS	SAEL		0x8053	SA-EL USB
 product SILABS	ARGUSISP	0x8066	Argussoft ISP
 product SILABS	CRUMB128	0x807a	Crumb128 board
 product SILABS	DEGREE		0x80ca	Degree Controls Inc
@@ -2216,11 +2291,15 @@ product SOURCENEXT KEIKAI8	0x039f	Keikai
 product SOURCENEXT KEIKAI8_CHG	0x012e	KeikaiDenwa 8 with charger
 
 /* SparkLAN products */
-product SPARKLAN RT2573		0x0004	RT2573
+product SPARKLAN RT2573		0x0004	 RT2573
 
 /* Sphairon Access Systems GmbH products */
 product SPHAIRON UB801R		0x0110	UB801R
 
+/* Stelera Wireless products */
+product STELERA ZEROCD		0x1000	Zerocd Installer
+product STELERA C105		0x1002	Stelera/Bandrish C105 USB
+
 /* STMicroelectronics products */
 product STMICRO BIOCPU		0x2016	Biometric Coprocessor
 product STMICRO COMMUNICATOR	0x7554	USB Communicator
@@ -2238,8 +2317,13 @@ product SUNTAC AS144L4		0x0011	SUNTAC U-
 
 /* Sun Microsystems products */
 product SUN KEYBOARD		0x0005	Type 6 USB keyboard
+product SUN KEYBOARD_TYPE_7	0x00a2	Type 7 USB keyboard
 /* XXX The above is a North American PC style keyboard possibly */
 product SUN MOUSE		0x0100	Type 6 USB mouse
+product SUN KBD_HUB		0x100e	Kbd Hub
+
+/* Super Top products */
+product	SUPERTOP IDE		0x6600	USB-IDE
 
 /* Supra products */
 product DIAMOND2 SUPRAEXPRESS56K 0x07da	Supra Express 56K modem
@@ -2378,7 +2462,8 @@ product WACOM GRAPHIRE		0x0010	Graphire
 product WACOM GRAPHIRE3_4X5	0x0013	Graphire 3 4x5
 product WACOM INTUOSA5		0x0021	Intuos A5
 product WACOM GD0912U		0x0022	Intuos 9x12 Graphics Tablet
-
+/* WCH products*/
+product WCH CH341SER		0x5523	CH341/CH340 USB-Serial Bridge
 /* Western Digital products */
 product WESTERN COMBO		0x0200	Firewire USB Combo
 product WESTERN EXTHDD		0x0400	External HDD
@@ -2392,6 +2477,7 @@ product WINBOND UH104		0x5518	4-port USB
 product WINMAXGROUP FLASH64MC	0x6660	USB Flash Disk 64M-C
 
 /* Wistron NeWeb products */
+product WISTRONNEWEB UR045G	0x0427	PrismGT USB 2.0 WLAN
 product WISTRONNEWEB UR055G	0x0711	UR055G
 product WISTRONNEWEB AR5523_1	0x0826	AR5523
 product WISTRONNEWEB AR5523_1_NF	0x0827	AR5523 (no firmware)
@@ -2404,6 +2490,10 @@ product XEROX WCM15		0xffef	WorkCenter M
 /* Xirlink products */
 product XIRLINK PCCAM		0x8080	IBM PC Camera
 
+/* Xyratex products */
+product XYRATEX PRISM_GT_1	0x2000	PrismGT USB 2.0 WLAN
+product XYRATEX PRISM_GT_2	0x2002	PrismGT USB 2.0 WLAN
+
 /* Y-E Data products */
 product YEDATA FLASHBUSTERU	0x0000	Flashbuster-U
 
@@ -2419,10 +2509,14 @@ product YAMAHA RTW65I		0x4002	NetVolante
 product YANO U640MO		0x0101	U640MO-03
 product YANO FW800HD		0x05fc	METALWEAR-HDD
 
+/* Yiso Wireless Co. products */
+product	YISO C893		0xc893	CDMA 2000 1xEVDO PC Card
+
 /* Z-Com products */
 product ZCOM M4Y750		0x0001	M4Y-750
 product ZCOM XI725		0x0002	XI-725/726
 product ZCOM XI735		0x0005	XI-735
+product ZCOM XG703A		0x0008	PrismGT USB 2.0 WLAN
 product ZCOM ZD1211		0x0011	ZD1211
 product ZCOM AR5523		0x0012	AR5523
 product ZCOM AR5523_NF		0x0013	AR5523 driver (no firmware)

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 04:07:46 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8C0C5106566B;
	Mon, 23 Mar 2009 04:07:46 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5ED8D8FC14;
	Mon, 23 Mar 2009 04:07:46 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2N47kZZ093897;
	Mon, 23 Mar 2009 04:07:46 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2N47kLB093896;
	Mon, 23 Mar 2009 04:07:46 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200903230407.n2N47kLB093896@svn.freebsd.org>
From: Andrew Thompson 
Date: Mon, 23 Mar 2009 04:07:46 +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: r190311 - stable/7/sys/dev/usb
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, 23 Mar 2009 04:07:47 -0000

Author: thompsa
Date: Mon Mar 23 04:07:46 2009
New Revision: 190311
URL: http://svn.freebsd.org/changeset/base/190311

Log:
  Sync umass quirks to HEAD.

Modified:
  stable/7/sys/dev/usb/umass.c

Modified: stable/7/sys/dev/usb/umass.c
==============================================================================
--- stable/7/sys/dev/usb/umass.c	Mon Mar 23 04:06:21 2009	(r190310)
+++ stable/7/sys/dev/usb/umass.c	Mon Mar 23 04:07:46 2009	(r190311)
@@ -340,6 +340,10 @@ static struct umass_devdescr_t umass_dev
 	  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
 	  NO_QUIRKS
 	},
+	{ USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_TRANSCEND, RID_WILDCARD,
+	  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
+	  NO_GETMAXLUN
+	},
 	{ USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_UMCR_9361, RID_WILDCARD,
 	  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
 	  NO_GETMAXLUN
@@ -414,7 +418,8 @@ static struct umass_devdescr_t umass_dev
 	},
 	{ USB_VENDOR_GENESYS,  USB_PRODUCT_GENESYS_GL641USB2IDE, RID_WILDCARD,
 	  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-	  FORCE_SHORT_INQUIRY | NO_START_STOP | IGNORE_RESIDUE
+	  FORCE_SHORT_INQUIRY | NO_START_STOP | IGNORE_RESIDUE |
+	  NO_SYNCHRONIZE_CACHE
 	},
 	{ USB_VENDOR_GENESYS,  USB_PRODUCT_GENESYS_GL641USB2IDE_2, RID_WILDCARD,
 	  UMASS_PROTO_ATAPI | UMASS_PROTO_BBB,
@@ -564,7 +569,11 @@ static struct umass_devdescr_t umass_dev
 	},
 	{ USB_VENDOR_MYSON,  USB_PRODUCT_MYSON_HEDEN, RID_WILDCARD,
 	  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-	  NO_INQUIRY | IGNORE_RESIDUE
+	  NO_INQUIRY | IGNORE_RESIDUE | NO_SYNCHRONIZE_CACHE
+	},
+	{ USB_VENDOR_MYSON, USB_PRODUCT_MYSON_STARREADER, RID_WILDCARD,
+	  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
+	  NO_SYNCHRONIZE_CACHE
 	},
 	{ USB_VENDOR_NEODIO, USB_PRODUCT_NEODIO_ND3260, RID_WILDCARD,
 	  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
@@ -798,6 +807,10 @@ static struct umass_devdescr_t umass_dev
 	  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
 	  NO_QUIRKS
 	},
+	{ USB_VENDOR_SUPERTOP, USB_PRODUCT_SUPERTOP_IDE, RID_WILDCARD,
+	  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
+	  IGNORE_RESIDUE | NO_SYNCHRONIZE_CACHE
+	},
 	{ USB_VENDOR_TAUGA, USB_PRODUCT_TAUGA_CAMERAMATE, RID_WILDCARD,
 	  UMASS_PROTO_SCSI,
 	  NO_QUIRKS
@@ -870,6 +883,10 @@ static struct umass_devdescr_t umass_dev
 	  UMASS_PROTO_ATAPI | UMASS_PROTO_CBI,
 	  NO_QUIRKS
 	},
+	{ USB_VENDOR_MEIZU, USB_PRODUCT_MEIZU_M6_SL, RID_WILDCARD,
+	  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
+	  NO_INQUIRY | NO_SYNCHRONIZE_CACHE
+	},
 	{ VID_EOT, PID_EOT, RID_EOT, 0, 0 }
 };
 

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 04:54:52 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C449D1065672;
	Mon, 23 Mar 2009 04:54:52 +0000 (UTC)
	(envelope-from gshapiro@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B0C618FC26;
	Mon, 23 Mar 2009 04:54:52 +0000 (UTC)
	(envelope-from gshapiro@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2N4sqEC094855;
	Mon, 23 Mar 2009 04:54:52 GMT
	(envelope-from gshapiro@svn.freebsd.org)
Received: (from gshapiro@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2N4sqmG094854;
	Mon, 23 Mar 2009 04:54:52 GMT
	(envelope-from gshapiro@svn.freebsd.org)
Message-Id: <200903230454.n2N4sqmG094854@svn.freebsd.org>
From: Gregory Neil Shapiro 
Date: Mon, 23 Mar 2009 04:54:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190312 - in stable/7/etc: . mail periodic/weekly
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, 23 Mar 2009 04:54:53 -0000

Author: gshapiro
Date: Mon Mar 23 04:54:52 2009
New Revision: 190312
URL: http://svn.freebsd.org/changeset/base/190312

Log:
  MFC r190304: Add the URL for RFC2142
  
  PR:		conf/127510

Modified:
  stable/7/etc/   (props changed)
  stable/7/etc/mail/aliases
  stable/7/etc/periodic/weekly/   (props changed)

Modified: stable/7/etc/mail/aliases
==============================================================================
--- stable/7/etc/mail/aliases	Mon Mar 23 04:07:46 2009	(r190311)
+++ stable/7/etc/mail/aliases	Mon Mar 23 04:54:52 2009	(r190312)
@@ -11,6 +11,7 @@
 #
 # See also RFC 2142, `MAILBOX NAMES FOR COMMON SERVICES, ROLES
 # AND FUNCTIONS', May 1997
+# 	http://tools.ietf.org/html/rfc2142
 
 # Pretty much everything else in this file points to "root", so
 # you would do well in either reading root's mailbox or forwarding

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 08:33:20 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2C521106566B;
	Mon, 23 Mar 2009 08:33:20 +0000 (UTC)
	(envelope-from rodrigc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 178AD8FC08;
	Mon, 23 Mar 2009 08:33:20 +0000 (UTC)
	(envelope-from rodrigc@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2N8XJAu000496;
	Mon, 23 Mar 2009 08:33:19 GMT (envelope-from rodrigc@svn.freebsd.org)
Received: (from rodrigc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2N8XJd2000495;
	Mon, 23 Mar 2009 08:33:19 GMT (envelope-from rodrigc@svn.freebsd.org)
Message-Id: <200903230833.n2N8XJd2000495@svn.freebsd.org>
From: Craig Rodrigues 
Date: Mon, 23 Mar 2009 08:33: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: r190315 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb nfsclient
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, 23 Mar 2009 08:33:20 -0000

Author: rodrigc
Date: Mon Mar 23 08:33:19 2009
New Revision: 190315
URL: http://svn.freebsd.org/changeset/base/190315

Log:
  MFC 183005, 187812:
  
  Add code to parse mount options passed as individual
  items of the nmount() iovec.

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

Modified: stable/7/sys/nfsclient/nfs_vfsops.c
==============================================================================
--- stable/7/sys/nfsclient/nfs_vfsops.c	Mon Mar 23 05:46:28 2009	(r190314)
+++ stable/7/sys/nfsclient/nfs_vfsops.c	Mon Mar 23 08:33:19 2009	(r190315)
@@ -717,7 +717,15 @@ nfs_decode_args(struct mount *mp, struct
 	}
 }
 
-static const char *nfs_opts[] = { "from", "nfs_args", NULL };
+static const char *nfs_opts[] = { "from", "nfs_args",
+    "noatime", "noexec", "suiddir", "nosuid", "nosymfollow", "union",
+    "noclusterr", "noclusterw", "multilabel", "acls", "force", "update",
+    "async", "dumbtimer", "noconn", "nolockd", "intr", "rdirplus", "resvport",
+    "readdirsize", "soft", "hard", "mntudp", "tcp", "udp", "wsize", "rsize",
+    "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", 
+    "deadthresh", "hostname", "timeout", "addr", "fh", "nfsv3",
+    "maxgroups",
+    NULL };
 
 /*
  * VFS Operations.
@@ -732,13 +740,20 @@ static const char *nfs_opts[] = { "from"
 static int
 nfs_mount(struct mount *mp, struct thread *td)
 {
-	int error;
+	int error, ret, has_nfs_args_opt;
+	int has_addr_opt, has_fh_opt, has_hostname_opt;
 	struct nfs_args args;
 	struct sockaddr *nam;
 	struct vnode *vp;
 	char hst[MNAMELEN];
 	size_t len;
 	u_char nfh[NFSX_V3FHMAX];
+	char *opt;
+
+	has_nfs_args_opt = 0;
+	has_addr_opt = 0;
+	has_fh_opt = 0;
+	has_hostname_opt = 0;
 
 	if (vfs_filteropt(mp->mnt_optnew, nfs_opts)) {
 		error = EINVAL;
@@ -750,12 +765,223 @@ nfs_mount(struct mount *mp, struct threa
 		goto out;
 	}
 
-	error = vfs_copyopt(mp->mnt_optnew, "nfs_args", &args, sizeof args);
-	if (error)
-		goto out;
+	/*
+	 * The old mount_nfs program passed the struct nfs_args
+	 * from userspace to kernel.  The new mount_nfs program
+	 * passes string options via nmount() from userspace to kernel
+	 * and we populate the struct nfs_args in the kernel.
+	 */
+	if (vfs_getopt(mp->mnt_optnew, "nfs_args", NULL, NULL) == 0) {
+		error = vfs_copyopt(mp->mnt_optnew, "nfs_args", &args,
+		    sizeof args);
+		if (error)
+			goto out;
+
+		if (args.version != NFS_ARGSVERSION) {
+			error = EPROGMISMATCH;
+			goto out;
+		}
+		has_nfs_args_opt = 1;
+	}
 
-	if (args.version != NFS_ARGSVERSION) {
-		error = EPROGMISMATCH;
+	if (vfs_getopt(mp->mnt_optnew, "dumbtimer", NULL, NULL) == 0)
+		args.flags |= NFSMNT_DUMBTIMR;
+	if (vfs_getopt(mp->mnt_optnew, "noconn", NULL, NULL) == 0)
+		args.flags |= NFSMNT_NOCONN;
+	if (vfs_getopt(mp->mnt_optnew, "conn", NULL, NULL) == 0)
+		args.flags |= NFSMNT_NOCONN;
+	if (vfs_getopt(mp->mnt_optnew, "nolockd", NULL, NULL) == 0)
+		args.flags |= NFSMNT_NOLOCKD;
+	if (vfs_getopt(mp->mnt_optnew, "lockd", NULL, NULL) == 0)
+		args.flags &= ~NFSMNT_NOLOCKD;
+	if (vfs_getopt(mp->mnt_optnew, "intr", NULL, NULL) == 0)
+		args.flags |= NFSMNT_INT;
+	if (vfs_getopt(mp->mnt_optnew, "rdirplus", NULL, NULL) == 0)
+		args.flags |= NFSMNT_RDIRPLUS;
+	if (vfs_getopt(mp->mnt_optnew, "resvport", NULL, NULL) == 0)
+		args.flags |= NFSMNT_RESVPORT;
+	if (vfs_getopt(mp->mnt_optnew, "noresvport", NULL, NULL) == 0)
+		args.flags &= ~NFSMNT_RESVPORT;
+	if (vfs_getopt(mp->mnt_optnew, "soft", NULL, NULL) == 0)
+		args.flags |= NFSMNT_SOFT;
+	if (vfs_getopt(mp->mnt_optnew, "hard", NULL, NULL) == 0)
+		args.flags &= ~NFSMNT_SOFT;
+	if (vfs_getopt(mp->mnt_optnew, "mntudp", NULL, NULL) == 0)
+		args.sotype = SOCK_DGRAM;
+	if (vfs_getopt(mp->mnt_optnew, "udp", NULL, NULL) == 0)
+		args.sotype = SOCK_DGRAM;
+	if (vfs_getopt(mp->mnt_optnew, "tcp", NULL, NULL) == 0)
+		args.sotype = SOCK_STREAM;
+	if (vfs_getopt(mp->mnt_optnew, "nfsv3", NULL, NULL) == 0)
+		args.flags |= NFSMNT_NFSV3;
+	if (vfs_getopt(mp->mnt_optnew, "readdirsize", (void **)&opt, NULL) == 0) {
+		if (opt == NULL) { 
+			vfs_mount_error(mp, "illegal readdirsize");
+			error = EINVAL;
+			goto out;
+		}
+		ret = sscanf(opt, "%d", &args.readdirsize);
+		if (ret != 1 || args.readdirsize <= 0) {
+			vfs_mount_error(mp, "illegal readdirsize: %s",
+			    opt);
+			error = EINVAL;
+			goto out;
+		}
+		args.flags |= NFSMNT_READDIRSIZE;
+	}
+	if (vfs_getopt(mp->mnt_optnew, "readahead", (void **)&opt, NULL) == 0) {
+		if (opt == NULL) { 
+			vfs_mount_error(mp, "illegal readahead");
+			error = EINVAL;
+			goto out;
+		}
+		ret = sscanf(opt, "%d", &args.readahead);
+		if (ret != 1 || args.readahead <= 0) {
+			vfs_mount_error(mp, "illegal readahead: %s",
+			    opt);
+			error = EINVAL;
+			goto out;
+		}
+		args.flags |= NFSMNT_READAHEAD;
+	}
+	if (vfs_getopt(mp->mnt_optnew, "wsize", (void **)&opt, NULL) == 0) {
+		if (opt == NULL) { 
+			vfs_mount_error(mp, "illegal wsize");
+			error = EINVAL;
+			goto out;
+		}
+		ret = sscanf(opt, "%d", &args.wsize);
+		if (ret != 1 || args.wsize <= 0) {
+			vfs_mount_error(mp, "illegal wsize: %s",
+			    opt);
+			error = EINVAL;
+			goto out;
+		}
+		args.flags |= NFSMNT_WSIZE;
+	}
+	if (vfs_getopt(mp->mnt_optnew, "rsize", (void **)&opt, NULL) == 0) {
+		if (opt == NULL) { 
+			vfs_mount_error(mp, "illegal rsize");
+			error = EINVAL;
+			goto out;
+		}
+		ret = sscanf(opt, "%d", &args.rsize);
+		if (ret != 1 || args.rsize <= 0) {
+			vfs_mount_error(mp, "illegal wsize: %s",
+			    opt);
+			error = EINVAL;
+			goto out;
+		}
+		args.flags |= NFSMNT_RSIZE;
+	}
+	if (vfs_getopt(mp->mnt_optnew, "retrans", (void **)&opt, NULL) == 0) {
+		if (opt == NULL) { 
+			vfs_mount_error(mp, "illegal retrans");
+			error = EINVAL;
+			goto out;
+		}
+		ret = sscanf(opt, "%d", &args.retrans);
+		if (ret != 1 || args.retrans <= 0) {
+			vfs_mount_error(mp, "illegal retrans: %s",
+			    opt);
+			error = EINVAL;
+			goto out;
+		}
+		args.flags |= NFSMNT_RETRANS;
+	}
+	if (vfs_getopt(mp->mnt_optnew, "acregmin", (void **)&opt, NULL) == 0) {
+		ret = sscanf(opt, "%d", &args.acregmin);
+		if (ret != 1 || args.acregmin < 0) {
+			vfs_mount_error(mp, "illegal acregmin: %s",
+			    opt);
+			error = EINVAL;
+			goto out;
+		}
+		args.flags |= NFSMNT_ACREGMIN;
+	}
+	if (vfs_getopt(mp->mnt_optnew, "acregmax", (void **)&opt, NULL) == 0) {
+		ret = sscanf(opt, "%d", &args.acregmax);
+		if (ret != 1 || args.acregmax < 0) {
+			vfs_mount_error(mp, "illegal acregmax: %s",
+			    opt);
+			error = EINVAL;
+			goto out;
+		}
+		args.flags |= NFSMNT_ACREGMAX;
+	}
+	if (vfs_getopt(mp->mnt_optnew, "acdirmin", (void **)&opt, NULL) == 0) {
+		ret = sscanf(opt, "%d", &args.acdirmin);
+		if (ret != 1 || args.acdirmin < 0) {
+			vfs_mount_error(mp, "illegal acdirmin: %s",
+			    opt);
+			error = EINVAL;
+			goto out;
+		}
+		args.flags |= NFSMNT_ACDIRMIN;
+	}
+	if (vfs_getopt(mp->mnt_optnew, "acdirmax", (void **)&opt, NULL) == 0) {
+		ret = sscanf(opt, "%d", &args.acdirmax);
+		if (ret != 1 || args.acdirmax < 0) {
+			vfs_mount_error(mp, "illegal acdirmax: %s",
+			    opt);
+			error = EINVAL;
+			goto out;
+		}
+		args.flags |= NFSMNT_ACDIRMAX;
+	}
+	if (vfs_getopt(mp->mnt_optnew, "deadthresh", (void **)&opt, NULL) == 0) {
+		ret = sscanf(opt, "%d", &args.deadthresh);
+		if (ret != 1 || args.deadthresh <= 0) {
+			vfs_mount_error(mp, "illegal deadthresh: %s",
+			    opt);
+			error = EINVAL;
+			goto out;
+		}
+		args.flags |= NFSMNT_DEADTHRESH;
+	}
+	if (vfs_getopt(mp->mnt_optnew, "timeout", (void **)&opt, NULL) == 0) {
+		ret = sscanf(opt, "%d", &args.timeo);
+		if (ret != 1 || args.timeo <= 0) {
+			vfs_mount_error(mp, "illegal timeout: %s",
+			    opt);
+			error = EINVAL;
+			goto out;
+		}
+		args.flags |= NFSMNT_TIMEO;
+	}
+	if (vfs_getopt(mp->mnt_optnew, "maxgroups", (void **)&opt, NULL) == 0) {
+		ret = sscanf(opt, "%d", &args.maxgrouplist);
+		if (ret != 1 || args.timeo <= 0) {
+			vfs_mount_error(mp, "illegal maxgroups: %s",
+			    opt);
+			error = EINVAL;
+			goto out;
+		}
+		args.flags |= NFSMNT_MAXGRPS;
+	}
+	if (vfs_getopt(mp->mnt_optnew, "addr", (void **)&args.addr,
+		&args.addrlen) == 0) {
+		has_addr_opt = 1;
+		if (args.addrlen > SOCK_MAXADDRLEN) {
+			error = ENAMETOOLONG;
+			goto out;
+		}
+		MALLOC(nam, struct sockaddr *, args.addrlen, M_SONAME,
+		    M_WAITOK);
+		bcopy(args.addr, nam, args.addrlen);
+		nam->sa_len = args.addrlen;
+	}
+	if (vfs_getopt(mp->mnt_optnew, "fh", (void **)&args.fh,
+		&args.fhsize) == 0) {
+		has_fh_opt = 1;
+	}
+	if (vfs_getopt(mp->mnt_optnew, "hostname", (void **)&args.hostname,
+		NULL) == 0) {
+		has_hostname_opt = 1;
+	}
+	if (args.hostname == NULL) {
+		vfs_mount_error(mp, "Invalid hostname");
+		error = EINVAL;
 		goto out;
 	}
 	if (mp->mnt_flag & MNT_UPDATE) {
@@ -788,23 +1014,38 @@ nfs_mount(struct mount *mp, struct threa
 	 */
 	if (nfs_ip_paranoia == 0)
 		args.flags |= NFSMNT_NOCONN;
-	if (args.fhsize < 0 || args.fhsize > NFSX_V3FHMAX) {
-		error = EINVAL;
-		goto out;
+
+	if (has_nfs_args_opt) {
+		/*
+		 * In the 'nfs_args' case, the pointers in the args
+		 * structure are in userland - we copy them in here.
+		 */
+		if (!has_fh_opt) {
+			error = copyin((caddr_t)args.fh, (caddr_t)nfh,
+			    args.fhsize);
+			if (error) {
+				goto out;
+			}
+			args.fh = nfh;
+		}
+		if (!has_hostname_opt) {
+			error = copyinstr(args.hostname, hst, MNAMELEN-1, &len);
+			if (error) {
+				goto out;
+			}
+			bzero(&hst[len], MNAMELEN - len);
+			args.hostname = hst;
+		}
+		if (!has_addr_opt) {
+			/* sockargs() call must be after above copyin() calls */
+			error = getsockaddr(&nam, (caddr_t)args.addr,
+			    args.addrlen);
+			if (error) {
+				goto out;
+			}
+		}
 	}
-	error = copyin((caddr_t)args.fh, (caddr_t)nfh, args.fhsize);
-	if (error)
-		goto out;
-	error = copyinstr(args.hostname, hst, MNAMELEN-1, &len);
-	if (error)
-		goto out;
-	bzero(&hst[len], MNAMELEN - len);
-	/* sockargs() call must be after above copyin() calls */
-	error = getsockaddr(&nam, (caddr_t)args.addr, args.addrlen);
-	if (error)
-		goto out;
-	args.fh = nfh;
-	error = mountnfs(&args, mp, nam, hst, &vp, td->td_ucred);
+	error = mountnfs(&args, mp, nam, args.hostname, &vp, td->td_ucred);
 out:
 	if (!error) {
 		MNT_ILOCK(mp);

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 09:00:33 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BBC67106566B;
	Mon, 23 Mar 2009 09:00:33 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A7D7D8FC0A;
	Mon, 23 Mar 2009 09:00:33 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2N90Xu5001149;
	Mon, 23 Mar 2009 09:00:33 GMT (envelope-from maxim@svn.freebsd.org)
Received: (from maxim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2N90XbS001147;
	Mon, 23 Mar 2009 09:00:33 GMT (envelope-from maxim@svn.freebsd.org)
Message-Id: <200903230900.n2N90XbS001147@svn.freebsd.org>
From: Maxim Konovalov 
Date: Mon, 23 Mar 2009 09:00: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: r190316 - stable/7/usr.sbin/gstat
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, 23 Mar 2009 09:00:34 -0000

Author: maxim
Date: Mon Mar 23 09:00:33 2009
New Revision: 190316
URL: http://svn.freebsd.org/changeset/base/190316

Log:
  MFC r175118: when the ms/req fields exceed 1 second, drop the fractions
  to fit more digits.
  MFC r183665: batch mode.
  MFC r189738: fix man page sinopsys; remove BUG section.
  MFC r189739: turn the batch mode on if stdout is not tty.
  > Description of fields to fill in above:                     76 columns --|
  > PR:            If a GNATS PR is affected by the change.
  > Submitted by:  If someone else sent in the change.
  > Reviewed by:   If someone else reviewed your modification.
  > Approved by:   If you needed approval for this commit.
  > Obtained from: If the change is from a third party.
  > MFC after:     N [day[s]|week[s]|month[s]].  Request a reminder email.
  > Security:      Vulnerability reference (one per line) or description.
  > Empty fields above will be automatically removed.
  
  _M   gstat
  M    gstat/gstat.c
  M    gstat/gstat.8

Modified:
  stable/7/usr.sbin/gstat/   (props changed)
  stable/7/usr.sbin/gstat/gstat.8
  stable/7/usr.sbin/gstat/gstat.c

Modified: stable/7/usr.sbin/gstat/gstat.8
==============================================================================
--- stable/7/usr.sbin/gstat/gstat.8	Mon Mar 23 08:33:19 2009	(r190315)
+++ stable/7/usr.sbin/gstat/gstat.8	Mon Mar 23 09:00:33 2009	(r190316)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 20, 2006
+.Dd March 12, 2009
 .Dt GSTAT 8
 .Os
 .Sh NAME
@@ -32,7 +32,7 @@
 .Nd print statistics about GEOM disks
 .Sh SYNOPSIS
 .Nm
-.Op Fl acd
+.Op Fl abcd
 .Op Fl f Ar filter
 .Op Fl I Ar interval
 .Sh DESCRIPTION
@@ -46,6 +46,10 @@ The options are as follows:
 .Bl -tag -width indent
 .It Fl a
 Only display providers that are at least 0.1% busy.
+.It Fl b
+Batch mode.
+Collect numbers, print and exit.
+Default if stdout is not a tty.
 .It Fl c
 Enable display of
 .Xr geom 4
@@ -90,15 +94,3 @@ A
 .Nm
 utility appeared in
 .Fx 5.0 .
-.Sh BUGS
-The
-.Nm
-utility only works interactively.
-It should probably detect when it is run non-interactively and produce
-simple
-.Tn ASCII
-text output.
-Otherwise, this utility should probably be folded into
-.Xr systat 1
-which only works interactively and is the obvious utility to run for
-various other forms of system statistics.

Modified: stable/7/usr.sbin/gstat/gstat.c
==============================================================================
--- stable/7/usr.sbin/gstat/gstat.c	Mon Mar 23 08:33:19 2009	(r190315)
+++ stable/7/usr.sbin/gstat/gstat.c	Mon Mar 23 09:00:33 2009	(r190316)
@@ -51,9 +51,16 @@
 #include 
 #include 
 
-static int flag_a, flag_c, flag_d;
+static int flag_a, flag_b, flag_c, flag_d;
 static int flag_I = 1000000;
 
+#define PRINTMSG(...) do {						\
+		if (flag_b && !loop)					\
+			printf(__VA_ARGS__);				\
+		else if (!flag_b)					\
+			printw(__VA_ARGS__);				\
+	} while(0)
+
 static void usage(void);
 
 static const char*
@@ -67,7 +74,7 @@ int
 main(int argc, char **argv)
 {
 	int error, i, quit;
-	int curx, cury, maxx, maxy, line_len, max_flen;
+	int curx, cury, maxx, maxy, line_len, loop, max_flen;
 	struct devstat *gsp, *gsq;
 	void *sp, *sq;
 	double dt;
@@ -87,12 +94,24 @@ main(int argc, char **argv)
 	History *hist;
 	HistEvent hist_ev;
 
+	hist = NULL;
+	el = NULL;
+	maxx = -1;
+	curx = -1;
+	loop = 1;
+	/* Turn on batch mode if output is not tty. */
+	if (!isatty(fileno(stdout)))
+		flag_b = 1;
+
 	f_s[0] = '\0';
-	while ((i = getopt(argc, argv, "adcf:I:")) != -1) {
+	while ((i = getopt(argc, argv, "adcf:I:b")) != -1) {
 		switch (i) {
 		case 'a':
 			flag_a = 1;
 			break;
+		case 'b':
+			flag_b = 1;
+			break;
 		case 'c':
 			flag_c = 1;
 			break;
@@ -141,34 +160,36 @@ main(int argc, char **argv)
 	sq = geom_stats_snapshot_get();
 	if (sq == NULL)
 		err(1, "geom_stats_snapshot()");
-	/* Setup curses */
-	initscr();
-	start_color();
-	use_default_colors();
-	pair_content(0, &cf, &cb);
-	init_pair(1, COLOR_GREEN, cb);
-	init_pair(2, COLOR_MAGENTA, cb);
-	init_pair(3, COLOR_RED, cb);
-	cbreak();
-	noecho();
-	nonl();
-	nodelay(stdscr, 1);
-	intrflush(stdscr, FALSE);
-	keypad(stdscr, TRUE);
-	/* Setup libedit */
-	hist = history_init();
-	if (hist == NULL)
-		err(EX_SOFTWARE, "history_init()");
-	history(hist, &hist_ev, H_SETSIZE, 100);
-	el = el_init("gstat", stdin, stdout, stderr);
-	if (el == NULL)
-		err(EX_SOFTWARE, "el_init");
-	el_set(el, EL_EDITOR, "emacs");
-	el_set(el, EL_SIGNAL, 1);
-	el_set(el, EL_HIST, history, hist);
-	el_set(el, EL_PROMPT, el_prompt);
-	if (f_s[0] != '\0')
-		history(hist, &hist_ev, H_ENTER, f_s);
+	if (!flag_b) {
+		/* Setup curses */
+		initscr();
+		start_color();
+		use_default_colors();
+		pair_content(0, &cf, &cb);
+		init_pair(1, COLOR_GREEN, cb);
+		init_pair(2, COLOR_MAGENTA, cb);
+		init_pair(3, COLOR_RED, cb);
+		cbreak();
+		noecho();
+		nonl();
+		nodelay(stdscr, 1);
+		intrflush(stdscr, FALSE);
+		keypad(stdscr, TRUE);
+		/* Setup libedit */
+		hist = history_init();
+		if (hist == NULL)
+			err(EX_SOFTWARE, "history_init()");
+		history(hist, &hist_ev, H_SETSIZE, 100);
+		el = el_init("gstat", stdin, stdout, stderr);
+		if (el == NULL)
+			err(EX_SOFTWARE, "el_init");
+		el_set(el, EL_EDITOR, "emacs");
+		el_set(el, EL_SIGNAL, 1);
+		el_set(el, EL_HIST, history, hist);
+		el_set(el, EL_PROMPT, el_prompt);
+		if (f_s[0] != '\0')
+			history(hist, &hist_ev, H_ENTER, f_s);
+	}
 	geom_stats_snapshot_timestamp(sq, &tq);
 	for (quit = 0; !quit;) {
 		sp = geom_stats_snapshot_get();
@@ -182,12 +203,13 @@ main(int argc, char **argv)
 		geom_stats_snapshot_reset(sp);
 		geom_stats_snapshot_reset(sq);
 		move(0,0);
-		printw("dT: %5.3fs  w: %.3fs",
-		    dt, (float)flag_I / 1000000);
+		PRINTMSG("dT: %5.3fs  w: %.3fs", dt, (float)flag_I / 1000000);
 		if (f_s[0] != '\0') {
-			printw("  filter: ");
-			getyx(stdscr, cury, curx);
-			getmaxyx(stdscr, maxy, maxx);
+			PRINTMSG("  filter: ");
+			if (!flag_b) {
+				getyx(stdscr, cury, curx);
+				getmaxyx(stdscr, maxy, maxx);
+			}
 			strncpy(pf_s, f_s, sizeof(pf_s));
 			max_flen = maxx - curx - 1;
 			if ((int)strlen(f_s) > max_flen && max_flen >= 0) {
@@ -199,15 +221,15 @@ main(int argc, char **argv)
 					pf_s[max_flen - 1] = '.';
 				pf_s[max_flen] = '\0';
 			}
-			printw("%s", pf_s);
+			PRINTMSG("%s", pf_s);
 		}
-		printw("\n");
-		printw(" L(q)  ops/s   ");
-		printw(" r/s   kBps   ms/r   ");
-		printw(" w/s   kBps   ms/w   ");
+		PRINTMSG("\n");
+		PRINTMSG(" L(q)  ops/s   ");
+		PRINTMSG(" r/s   kBps   ms/r   ");
+		PRINTMSG(" w/s   kBps   ms/w   ");
 		if (flag_d)
-			printw(" d/s   kBps   ms/d   ");
-		printw("%%busy Name\n");
+			PRINTMSG(" d/s   kBps   ms/d   ");
+		PRINTMSG("%%busy Name\n");
 		for (;;) {
 			gsp = geom_stats_snapshot_next(sp);
 			gsq = geom_stats_snapshot_next(sq);
@@ -228,9 +250,11 @@ main(int argc, char **argv)
 			if (gid->lg_what == ISCONSUMER && !flag_c)
 				continue;
 			/* Do not print past end of window */
-			getyx(stdscr, cury, curx);
-			if (curx > 0)
-				continue;
+			if (!flag_b) {
+				getyx(stdscr, cury, curx);
+				if (curx > 0)
+					continue;
+			}
 			if ((gid->lg_what == ISPROVIDER
 			    || gid->lg_what == ISCONSUMER) && f_s[0] != '\0') {
 				pp = gid->lg_ptr;
@@ -239,7 +263,7 @@ main(int argc, char **argv)
 				  continue;
 			}
 			if (gsp->sequence0 != gsp->sequence1) {
-				printw("*\n");
+				PRINTMSG("*\n");
 				continue;
 			}
 			devstat_compute_statistics(gsp, gsq, dt, 
@@ -265,19 +289,28 @@ main(int argc, char **argv)
 				continue;
 			}
 
-			printw(" %4ju", (uintmax_t)u64);
-			printw(" %6.0f", (double)ld[0]);
-			printw(" %6.0f", (double)ld[1]);
-			printw(" %6.0f", (double)ld[2] * 1024);
-			printw(" %6.1f", (double)ld[3]);
-			printw(" %6.0f", (double)ld[4]);
-			printw(" %6.0f", (double)ld[5] * 1024);
-			printw(" %6.1f", (double)ld[6]);
+			PRINTMSG(" %4ju", (uintmax_t)u64);
+			PRINTMSG(" %6.0f", (double)ld[0]);
+			PRINTMSG(" %6.0f", (double)ld[1]);
+			PRINTMSG(" %6.0f", (double)ld[2] * 1024);
+			if (ld[3] > 1e3) 
+				PRINTMSG(" %6.0f", (double)ld[3]);
+			else
+				PRINTMSG(" %6.1f", (double)ld[3]);
+			PRINTMSG(" %6.0f", (double)ld[4]);
+			PRINTMSG(" %6.0f", (double)ld[5] * 1024);
+			if (ld[6] > 1e3) 
+				PRINTMSG(" %6.0f", (double)ld[6]);
+			else
+				PRINTMSG(" %6.1f", (double)ld[6]);
 
 			if (flag_d) {
-				printw(" %6.0f", (double)ld[8]);
-				printw(" %6.0f", (double)ld[9] * 1024);
-				printw(" %6.1f", (double)ld[10]);
+				PRINTMSG(" %6.0f", (double)ld[8]);
+				PRINTMSG(" %6.0f", (double)ld[9] * 1024);
+				if (ld[10] > 1e3) 
+					PRINTMSG(" %6.0f", (double)ld[10]);
+				else
+					PRINTMSG(" %6.1f", (double)ld[10]);
 			}
 
 			if (ld[7] > 80)
@@ -286,27 +319,40 @@ main(int argc, char **argv)
 				i = 2;
 			else 
 				i = 1;
-			attron(COLOR_PAIR(i));
-			printw(" %6.1lf", (double)ld[7]);
-			attroff(COLOR_PAIR(i));
-			printw("|");
+			if (!flag_b)
+				attron(COLOR_PAIR(i));
+			PRINTMSG(" %6.1lf", (double)ld[7]);
+			if (!flag_b) {
+				attroff(COLOR_PAIR(i));
+				PRINTMSG("|");
+			} else
+				PRINTMSG(" ");
 			if (gid == NULL) {
-				printw(" ??");
+				PRINTMSG(" ??");
 			} else if (gid->lg_what == ISPROVIDER) {
 				pp = gid->lg_ptr;
-				printw(" %s", pp->lg_name);
+				PRINTMSG(" %s", pp->lg_name);
 			} else if (gid->lg_what == ISCONSUMER) {
 				cp = gid->lg_ptr;
-				printw(" %s/%s/%s",
+				PRINTMSG(" %s/%s/%s",
 				    cp->lg_geom->lg_class->lg_name,
 				    cp->lg_geom->lg_name,
 				    cp->lg_provider->lg_name);
 			}
-			clrtoeol();
-			printw("\n");
+			if (!flag_b)
+				clrtoeol();
+			PRINTMSG("\n");
 			*gsq = *gsp;
 		}
 		geom_stats_snapshot_free(sp);
+		if (flag_b) {
+			/* We loop extra to make sure we get the information. */
+			if (!loop)
+				break;
+			loop = 0;
+			usleep(flag_I);
+			continue;
+		}
 		getyx(stdscr, cury, curx);
 		getmaxyx(stdscr, maxy, maxx);
 		clrtobot();
@@ -369,15 +415,17 @@ main(int argc, char **argv)
 		}
 	}
 
-	endwin();
-	el_end(el);
+	if (!flag_b) {
+		endwin();
+		el_end(el);
+	}
 	exit(EX_OK);
 }
 
 static void
 usage(void)
 {
-	fprintf(stderr, "usage: gstat [-acd] [-f filter] [-I interval]\n");
+	fprintf(stderr, "usage: gstat [-abcd] [-f filter] [-I interval]\n");
 	exit(EX_USAGE);
         /* NOTREACHED */
 }

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 12:07:30 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F222710658BB;
	Mon, 23 Mar 2009 12:07:29 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BBC6E8FC12;
	Mon, 23 Mar 2009 12:07:29 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2NC7TIC008833;
	Mon, 23 Mar 2009 12:07:29 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2NC7Tl8008829;
	Mon, 23 Mar 2009 12:07:29 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200903231207.n2NC7Tl8008829@svn.freebsd.org>
From: Jamie Gritton 
Date: Mon, 23 Mar 2009 12:07:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190318 - in stable/7: sbin/ifconfig sys sys/contrib/pf
	sys/dev/ath/ath_hal sys/dev/cxgb sys/net
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, 23 Mar 2009 12:08:04 -0000

Author: jamie
Date: Mon Mar 23 12:07:29 2009
New Revision: 190318
URL: http://svn.freebsd.org/changeset/base/190318

Log:
  MFC:
  
   r189864:
     Default to AF_LOCAL instead of AF_INET sockets for non-family-specific
     operations.  This allows the query operations to work in non-IPv4 jails,
     and will be necessary in a future of possible non-INET networking.
     (reprise r189970)
  
   r190151:
     Call the interface's if_ioctl from ifioctl(), if the protocol didn't
     handle the ioctl.  There are other paths that already call it, but this
     allows for a non-interface socket (like AF_LOCAL which ifconfig now
     uses) to use a broader class of interface ioctls.
  
  Approved by:	bz (mentor)

Modified:
  stable/7/sbin/ifconfig/   (props changed)
  stable/7/sbin/ifconfig/ifclone.c
  stable/7/sbin/ifconfig/ifconfig.c
  stable/7/sbin/ifconfig/ifgroup.c
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/net/if.c

Modified: stable/7/sbin/ifconfig/ifclone.c
==============================================================================
--- stable/7/sbin/ifconfig/ifclone.c	Mon Mar 23 11:07:34 2009	(r190317)
+++ stable/7/sbin/ifconfig/ifclone.c	Mon Mar 23 12:07:29 2009	(r190318)
@@ -53,9 +53,9 @@ list_cloners(void)
 	int idx;
 	int s;
 
-	s = socket(AF_INET, SOCK_DGRAM, 0);
+	s = socket(AF_LOCAL, SOCK_DGRAM, 0);
 	if (s == -1)
-		err(1, "socket(AF_INET,SOCK_DGRAM)");
+		err(1, "socket(AF_LOCAL,SOCK_DGRAM)");
 
 	memset(&ifcr, 0, sizeof(ifcr));
 

Modified: stable/7/sbin/ifconfig/ifconfig.c
==============================================================================
--- stable/7/sbin/ifconfig/ifconfig.c	Mon Mar 23 11:07:34 2009	(r190317)
+++ stable/7/sbin/ifconfig/ifconfig.c	Mon Mar 23 12:07:29 2009	(r190318)
@@ -434,21 +434,22 @@ static const struct cmd setifdstaddr_cmd
 	DEF_CMD("ifdstaddr", 0, setifdstaddr);
 
 static int
-ifconfig(int argc, char *const *argv, int iscreate, const struct afswtch *afp)
+ifconfig(int argc, char *const *argv, int iscreate, const struct afswtch *uafp)
 {
-	const struct afswtch *nafp;
+	const struct afswtch *afp, *nafp;
 	struct callback *cb;
 	int s;
 
 	strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name);
+	afp = uafp != NULL ? uafp : af_getbyname("inet");
 top:
-	if (afp == NULL)
-		afp = af_getbyname("inet");
 	ifr.ifr_addr.sa_family =
 		afp->af_af == AF_LINK || afp->af_af == AF_UNSPEC ?
-		AF_INET : afp->af_af;
+		AF_LOCAL : afp->af_af;
 
-	if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
+	if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0 &&
+	    (uafp != NULL || errno != EPROTONOSUPPORT ||
+	     (s = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0))
 		err(1, "socket(family %u,SOCK_DGRAM", ifr.ifr_addr.sa_family);
 
 	while (argc > 0) {
@@ -792,11 +793,12 @@ status(const struct afswtch *afp, const 
 
 	if (afp == NULL) {
 		allfamilies = 1;
-		afp = af_getbyname("inet");
-	} else
+		ifr.ifr_addr.sa_family = AF_LOCAL;
+	} else {
 		allfamilies = 0;
-
-	ifr.ifr_addr.sa_family = afp->af_af == AF_LINK ? AF_INET : afp->af_af;
+		ifr.ifr_addr.sa_family =
+		    afp->af_af == AF_LINK ? AF_LOCAL : afp->af_af;
+	}
 	strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
 
 	s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0);

Modified: stable/7/sbin/ifconfig/ifgroup.c
==============================================================================
--- stable/7/sbin/ifconfig/ifgroup.c	Mon Mar 23 11:07:34 2009	(r190317)
+++ stable/7/sbin/ifconfig/ifgroup.c	Mon Mar 23 12:07:29 2009	(r190318)
@@ -131,9 +131,9 @@ printgroup(const char *groupname)
 	int			 len, cnt = 0;
 	int			 s;
 
-	s = socket(AF_INET, SOCK_DGRAM, 0);
+	s = socket(AF_LOCAL, SOCK_DGRAM, 0);
 	if (s == -1)
-		err(1, "socket(AF_INET,SOCK_DGRAM)");
+		err(1, "socket(AF_LOCAL,SOCK_DGRAM)");
 	bzero(&ifgr, sizeof(ifgr));
 	strlcpy(ifgr.ifgr_name, groupname, sizeof(ifgr.ifgr_name));
 	if (ioctl(s, SIOCGIFGMEMB, (caddr_t)&ifgr) == -1) {

Modified: stable/7/sys/net/if.c
==============================================================================
--- stable/7/sys/net/if.c	Mon Mar 23 11:07:34 2009	(r190317)
+++ stable/7/sys/net/if.c	Mon Mar 23 12:07:29 2009	(r190318)
@@ -1968,6 +1968,8 @@ ifioctl(struct socket *so, u_long cmd, c
 	error = ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd,
 								 data,
 								 ifp, td));
+	if (error == EOPNOTSUPP && ifp != NULL && ifp->if_ioctl != NULL)
+		error = (*ifp->if_ioctl)(ifp, cmd, data);
 #else
 	{
 		int ocmd = cmd;
@@ -2009,6 +2011,9 @@ ifioctl(struct socket *so, u_long cmd, c
 								   cmd,
 								   data,
 								   ifp, td));
+		if (error == EOPNOTSUPP && ifp != NULL &&
+		    ifp->if_ioctl != NULL)
+			error = (*ifp->if_ioctl)(ifp, cmd, data);
 		switch (ocmd) {
 
 		case OSIOCGIFADDR:

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 12:52:03 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C3EAA106564A;
	Mon, 23 Mar 2009 12:52:03 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 93F4A8FC2D;
	Mon, 23 Mar 2009 12:52:03 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net
	[98.109.39.197])
	by cyrus.watson.org (Postfix) with ESMTPSA id 4189746B6C;
	Mon, 23 Mar 2009 08:52:03 -0400 (EDT)
Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0)
	by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n2NCpvNx052767;
	Mon, 23 Mar 2009 08:51:57 -0400 (EDT) (envelope-from jhb@freebsd.org)
From: John Baldwin 
To: Craig Rodrigues 
Date: Mon, 23 Mar 2009 08:42:01 -0400
User-Agent: KMail/1.9.7
References: <200903212116.n2LLG589047158@svn.freebsd.org>
In-Reply-To: <200903212116.n2LLG589047158@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200903230842.01826.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by
	milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]);
	Mon, 23 Mar 2009 08:51:57 -0400 (EDT)
X-Virus-Scanned: ClamAV 0.94.2/9151/Mon Mar 23 01:23:57 2009 on
	server.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 
	autolearn=ham version=3.1.3
X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-7@freebsd.org
Subject: Re: svn commit: r190217 - in stable/7/etc: defaults 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: Mon, 23 Mar 2009 12:52:04 -0000

On Saturday 21 March 2009 5:16:05 pm Craig Rodrigues wrote:
> Author: rodrigc
> Date: Sat Mar 21 21:16:05 2009
> New Revision: 190217
> URL: http://svn.freebsd.org/changeset/base/190217
> 
> Log:
>   MFC r182460:
>   
>   Add the ability to run /usr/sbin/crashinfo on a new core dump 
automatically
>   during boot.  Right now this is disabled by default, but it can be enabled
>   by setting 'crashinfo_enable=YES' in rc.conf.

This isn't quite right and is why I haven't merged it yet.  You only want to 
run crashinfo if savecore found an actual crash dump.

-- 
John Baldwin

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 14:53:22 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 44677106566B;
	Mon, 23 Mar 2009 14:53:22 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 16E458FC30;
	Mon, 23 Mar 2009 14:53:22 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2NErLP5012457;
	Mon, 23 Mar 2009 14:53:21 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2NErLZL012455;
	Mon, 23 Mar 2009 14:53:21 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200903231453.n2NErLZL012455@svn.freebsd.org>
From: Doug Barton 
Date: Mon, 23 Mar 2009 14:53:21 +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: r190321 - stable/7/usr.sbin/mergemaster
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, 23 Mar 2009 14:53:23 -0000

Author: dougb
Date: Mon Mar 23 14:53:21 2009
New Revision: 190321
URL: http://svn.freebsd.org/changeset/base/190321

Log:
  MFC 190320, don't expand example $FreeBSD strings

Modified:
  stable/7/usr.sbin/mergemaster/   (props changed)
  stable/7/usr.sbin/mergemaster/mergemaster.8
  stable/7/usr.sbin/mergemaster/mergemaster.sh

Modified: stable/7/usr.sbin/mergemaster/mergemaster.8
==============================================================================
--- stable/7/usr.sbin/mergemaster/mergemaster.8	Mon Mar 23 14:42:41 2009	(r190320)
+++ stable/7/usr.sbin/mergemaster/mergemaster.8	Mon Mar 23 14:53:21 2009	(r190321)
@@ -82,7 +82,7 @@ merge by hand later.
 By default it creates the temporary root in
 .Pa /var/tmp/temproot
 and compares the
-Version Control System (VCS) Id strings ($FreeBSD$)
+Version Control System (VCS) Id strings ($FreeBSD)
 for files that have them, deleting
 the temporary file if the strings match.
 If there is
@@ -216,7 +216,7 @@ Compares only files known to be essentia
 including
 .Pa /etc/make.conf .
 .It Fl F
-If the files differ only by VCS Id ($FreeBSD$)
+If the files differ only by VCS Id ($FreeBSD)
 install the new file.
 .It Fl C
 After a standard
@@ -338,7 +338,7 @@ with all values commented out:
 # Type of diff, such as unified, context, etc.
 #DIFF_FLAG='-u'
 #
-# Install the new file if it differs only by VCS Id ($FreeBSD$)
+# Install the new file if it differs only by VCS Id ($FreeBSD)
 #FREEBSD_ID=
 #
 # Verbose mode includes more details and additional checks

Modified: stable/7/usr.sbin/mergemaster/mergemaster.sh
==============================================================================
--- stable/7/usr.sbin/mergemaster/mergemaster.sh	Mon Mar 23 14:42:41 2009	(r190320)
+++ stable/7/usr.sbin/mergemaster/mergemaster.sh	Mon Mar 23 14:53:21 2009	(r190321)
@@ -26,7 +26,7 @@ display_usage () {
   echo "  -h  Display more complete help"
   echo '  -i  Automatically install files that do not exist in destination directory'
   echo '  -p  Pre-buildworld mode, only compares crucial files'
-  echo '  -F  Install files that differ only by revision control Id ($FreeBSD$)'
+  echo '  -F  Install files that differ only by revision control Id ($FreeBSD)'
   echo '  -C  Compare local rc.conf variables to the defaults'
   echo '  -P  Preserve files that are overwritten'
   echo "  -U  Attempt to auto upgrade files that have not been user modified"

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 16:01:54 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 25BBD106564A;
	Mon, 23 Mar 2009 16:01:54 +0000 (UTC)
	(envelope-from jh@saunalahti.fi)
Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi
	[195.197.172.115])
	by mx1.freebsd.org (Postfix) with ESMTP id D4E1F8FC18;
	Mon, 23 Mar 2009 16:01:53 +0000 (UTC)
	(envelope-from jh@saunalahti.fi)
Received: from a91-153-125-115.elisa-laajakaista.fi
	(a91-153-125-115.elisa-laajakaista.fi [91.153.125.115])
	by gw01.mail.saunalahti.fi (Postfix) with SMTP id EBF97151861;
	Mon, 23 Mar 2009 17:45:36 +0200 (EET)
Date: Mon, 23 Mar 2009 17:45:36 +0200
From: Jaakko Heinonen 
To: Sam Leffler 
Message-ID: <20090323154536.GA2853@a91-153-125-115.elisa-laajakaista.fi>
References: <200903190028.n2J0SsTa042656@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200903190028.n2J0SsTa042656@svn.freebsd.org>
User-Agent: Mutt/1.5.18 (2008-05-17)
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-7@freebsd.org
Subject: Re: svn commit: r190006 - in stable/7/usr.sbin: . makefs
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, 23 Mar 2009 16:01:54 -0000

On 2009-03-19, Sam Leffler wrote:
> Log:
>   MFC makefs: a tool for creating a file system image from a directory tree

FYI, images created with sector size (-S option) other than 512 don't
work on FreeBSD. (PR 131341)

Sector size affects to the value of the fs_fsbtodb super block field.
Looks like FreeBSD ffs requires that it's always calculated with
DEV_BSIZE (512). newfs(8) sets the sector size to DEV_BSIZE before
calculating fs_fsbtodb (however the code is marked with XXX).

Here is a workaround to recalculate fs_fsbtodb at mount time if it's not
based on DEV_BSIZE:

http://www.saunalahti.fi/~jh3/patches/ffs-fs_fsbtodb.diff

-- 
Jaakko

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 18:04:22 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 794081065675;
	Mon, 23 Mar 2009 18:04:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4BAFE8FC20;
	Mon, 23 Mar 2009 18:04:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2NI4M2Y016658;
	Mon, 23 Mar 2009 18:04:22 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2NI4MAe016657;
	Mon, 23 Mar 2009 18:04:22 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200903231804.n2NI4MAe016657@svn.freebsd.org>
From: John Baldwin 
Date: Mon, 23 Mar 2009 18:04: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: r190326 - in stable/7/etc: . periodic/weekly
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, 23 Mar 2009 18:04:24 -0000

Author: jhb
Date: Mon Mar 23 18:04:22 2009
New Revision: 190326
URL: http://svn.freebsd.org/changeset/base/190326

Log:
  Merge 187210 to /etc to consolidate mergeinfo.

Modified:
  stable/7/etc/   (props changed)
  stable/7/etc/periodic/weekly/   (props changed)

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 18:13:18 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CA772106564A;
	Mon, 23 Mar 2009 18:13:18 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B7BD98FC20;
	Mon, 23 Mar 2009 18:13:18 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2NIDIei016878;
	Mon, 23 Mar 2009 18:13:18 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2NIDIkx016877;
	Mon, 23 Mar 2009 18:13:18 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200903231813.n2NIDIkx016877@svn.freebsd.org>
From: Andrew Thompson 
Date: Mon, 23 Mar 2009 18:13:18 +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: r190327 - stable/7/sys/dev/usb
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, 23 Mar 2009 18:13:20 -0000

Author: thompsa
Date: Mon Mar 23 18:13:18 2009
New Revision: 190327
URL: http://svn.freebsd.org/changeset/base/190327

Log:
  MFC r189905
  
  Fix checking of the IGNORE_RESIDUE quirk.
  
  Submitted by:	marius

Modified:
  stable/7/sys/dev/usb/umass.c

Modified: stable/7/sys/dev/usb/umass.c
==============================================================================
--- stable/7/sys/dev/usb/umass.c	Mon Mar 23 18:04:22 2009	(r190326)
+++ stable/7/sys/dev/usb/umass.c	Mon Mar 23 18:13:18 2009	(r190327)
@@ -1872,6 +1872,7 @@ umass_bbb_state(usbd_xfer_handle xfer, u
 {
 	struct umass_softc *sc = (struct umass_softc *) priv;
 	usbd_xfer_handle next_xfer;
+	int Residue;
 
 	KASSERT(sc->proto & UMASS_PROTO_BBB,
 		("%s: umass_bbb_state: wrong sc->proto 0x%02x\n",
@@ -2056,10 +2057,8 @@ umass_bbb_state(usbd_xfer_handle xfer, u
 				USETDW(sc->csw.dCSWSignature, CSWSIGNATURE);
 		}
 
-		int Residue;
 		Residue = UGETDW(sc->csw.dCSWDataResidue);
-		if (Residue == 0 &&
-		    sc->transfer_datalen - sc->transfer_actlen != 0)
+		if (Residue == 0 || (sc->quirks & IGNORE_RESIDUE))
 			Residue = sc->transfer_datalen - sc->transfer_actlen;
 
 		/* Check CSW and handle any error */

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 20:23:28 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BF80B1065678;
	Mon, 23 Mar 2009 20:23:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ACEE78FC08;
	Mon, 23 Mar 2009 20:23:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2NKNSBk020671;
	Mon, 23 Mar 2009 20:23:28 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2NKNSlf020670;
	Mon, 23 Mar 2009 20:23:28 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200903232023.n2NKNSlf020670@svn.freebsd.org>
From: John Baldwin 
Date: Mon, 23 Mar 2009 20:23: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: r190332 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb kern
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 23 Mar 2009 20:23:29 -0000

Author: jhb
Date: Mon Mar 23 20:23:28 2009
New Revision: 190332
URL: http://svn.freebsd.org/changeset/base/190332

Log:
  MFC: Move the debug.hashstat sysctl tree under DIAGNOSTIC.

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

Modified: stable/7/sys/kern/vfs_cache.c
==============================================================================
--- stable/7/sys/kern/vfs_cache.c	Mon Mar 23 20:18:06 2009	(r190331)
+++ stable/7/sys/kern/vfs_cache.c	Mon Mar 23 20:23:28 2009	(r190332)
@@ -179,6 +179,7 @@ static MALLOC_DEFINE(M_VFSCACHE, "vfscac
  */
 #define NCF_WHITE	1
 
+#ifdef DIAGNOSTIC
 /*
  * Grab an atomic snapshot of the name cache hash chain lengths
  */
@@ -259,6 +260,7 @@ sysctl_debug_hashstat_nchash(SYSCTL_HAND
 SYSCTL_PROC(_debug_hashstat, OID_AUTO, nchash, CTLTYPE_INT|CTLFLAG_RD|
 	CTLFLAG_MPSAFE, 0, 0, sysctl_debug_hashstat_nchash, "I",
 	"nchash chain lengths");
+#endif
 
 /*
  * cache_zap():

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 20:29:54 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A7224106566C;
	Mon, 23 Mar 2009 20:29:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 952718FC34;
	Mon, 23 Mar 2009 20:29:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2NKTsQ3020863;
	Mon, 23 Mar 2009 20:29:54 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2NKTsP3020862;
	Mon, 23 Mar 2009 20:29:54 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200903232029.n2NKTsP3020862@svn.freebsd.org>
From: John Baldwin 
Date: Mon, 23 Mar 2009 20:29: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: r190333 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb kern
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 23 Mar 2009 20:29:55 -0000

Author: jhb
Date: Mon Mar 23 20:29:54 2009
New Revision: 190333
URL: http://svn.freebsd.org/changeset/base/190333

Log:
  MFC: Export the current values of nbuf, ncallout, and nswbuf via read-only
  sysctls that match the tunable names.

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

Modified: stable/7/sys/kern/subr_param.c
==============================================================================
--- stable/7/sys/kern/subr_param.c	Mon Mar 23 20:23:28 2009	(r190332)
+++ stable/7/sys/kern/subr_param.c	Mon Mar 23 20:29:54 2009	(r190333)
@@ -87,6 +87,12 @@ u_long	maxssiz;			/* max stack size */
 u_long	sgrowsiz;			/* amount to grow stack */
 
 SYSCTL_INT(_kern, OID_AUTO, hz, CTLFLAG_RDTUN, &hz, 0, "ticks/second");
+SYSCTL_INT(_kern, OID_AUTO, ncallout, CTLFLAG_RDTUN, &ncallout, 0,
+    "Number of pre-allocated timer events");
+SYSCTL_INT(_kern, OID_AUTO, nbuf, CTLFLAG_RDTUN, &nbuf, 0,
+    "Number of buffer-cache I/O buffers");
+SYSCTL_INT(_kern, OID_AUTO, nswbuf, CTLFLAG_RDTUN, &nswbuf, 0,
+    "Number of swap buffers");
 SYSCTL_INT(_kern, OID_AUTO, maxswzone, CTLFLAG_RDTUN, &maxswzone, 0,
     "max swmeta KVA storage");
 SYSCTL_INT(_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN, &maxbcache, 0,

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 20:37:38 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9BF8C1065670;
	Mon, 23 Mar 2009 20:37:38 +0000 (UTC)
	(envelope-from vanhu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A15D78FC29;
	Mon, 23 Mar 2009 20:37:37 +0000 (UTC)
	(envelope-from vanhu@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2NKbbj3021052;
	Mon, 23 Mar 2009 20:37:37 GMT (envelope-from vanhu@svn.freebsd.org)
Received: (from vanhu@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2NKbb8M021051;
	Mon, 23 Mar 2009 20:37:37 GMT (envelope-from vanhu@svn.freebsd.org)
Message-Id: <200903232037.n2NKbb8M021051@svn.freebsd.org>
From: VANHULLEBUS Yvan 
Date: Mon, 23 Mar 2009 20:37: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: r190334 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb netipsec
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, 23 Mar 2009 20:37:40 -0000

Author: vanhu
Date: Mon Mar 23 20:37:37 2009
New Revision: 190334
URL: http://svn.freebsd.org/changeset/base/190334

Log:
  SAs are valid (but dying) when they reached soft lifetime,
  even if they have never been used.
  
  Approved by:	gnn(mentor)

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

Modified: stable/7/sys/netipsec/key.c
==============================================================================
--- stable/7/sys/netipsec/key.c	Mon Mar 23 20:29:54 2009	(r190333)
+++ stable/7/sys/netipsec/key.c	Mon Mar 23 20:37:37 2009	(r190334)
@@ -4109,22 +4109,20 @@ key_flush_sad(time_t now)
 			/* check SOFT lifetime */
 			if (sav->lft_s->addtime != 0 &&
 			    now - sav->created > sav->lft_s->addtime) {
-				/*
-				 * check SA to be used whether or not.
-				 * when SA hasn't been used, delete it.
+				key_sa_chgstate(sav, SADB_SASTATE_DYING);
+				/* 
+				 * Actually, only send expire message if
+				 * SA has been used, as it was done before,
+				 * but should we always send such message,
+				 * and let IKE daemon decide if it should be
+				 * renegotiated or not ?
+				 * XXX expire message will actually NOT be
+				 * sent if SA is only used after soft
+				 * lifetime has been reached, see below
+				 * (DYING state)
 				 */
-				if (sav->lft_c->usetime == 0) {
-					key_sa_chgstate(sav, SADB_SASTATE_DEAD);
-					KEY_FREESAV(&sav);
-				} else {
-					key_sa_chgstate(sav, SADB_SASTATE_DYING);
-					/*
-					 * XXX If we keep to send expire
-					 * message in the status of
-					 * DYING. Do remove below code.
-					 */
+				if (sav->lft_c->usetime != 0)
 					key_expire(sav);
-				}
 			}
 			/* check SOFT lifetime by bytes */
 			/*

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 20:53:39 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1BAD810657D9;
	Mon, 23 Mar 2009 20:53:39 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 07F438FC2A;
	Mon, 23 Mar 2009 20:53:39 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2NKrcND021385;
	Mon, 23 Mar 2009 20:53:38 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2NKrc2O021383;
	Mon, 23 Mar 2009 20:53:38 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200903232053.n2NKrc2O021383@svn.freebsd.org>
From: Marius Strobl 
Date: Mon, 23 Mar 2009 20:53:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190335 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/bge dev/cxgb
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Mon, 23 Mar 2009 20:53:40 -0000

Author: marius
Date: Mon Mar 23 20:53:38 2009
New Revision: 190335
URL: http://svn.freebsd.org/changeset/base/190335

Log:
  MFC: r190194
  
  - In bge_ifmedia_upd_locked() take advantrage of LIST_FOREACH().
  - If boot verbose, print asicrev, chiprev and bus type on attach.
  - For PCI Express devices:
    1) Adjust max read request size to 4Kbytes
    2) Turn on FIFO_LONG_BURST in RDMA during bge_blockinit()
    Though 1) does not seem to have much to do with the poor TX performance
    observed on PCI Express bge(4), 2) does fix the problem. [1]
  - Nuke the RX CPU self-diag, which prevents working cards from working
    (Linux tg3 does not have this diag neither does OpenBSD's bge(4)).
    The increasing of the firmware handshaking timeout to 20000 retries
    done as part of the original commit isn't merged as way already have a
    way higher BGE_TIMEOUT of 100000.
  
  PR:		119361 [1]
  Obtained from:	tg3 via DragonflyBSD [1], DragonflyBSD

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/bge/if_bge.c
  stable/7/sys/dev/bge/if_bgereg.h
  stable/7/sys/dev/cxgb/   (props changed)

Modified: stable/7/sys/dev/bge/if_bge.c
==============================================================================
--- stable/7/sys/dev/bge/if_bge.c	Mon Mar 23 20:37:37 2009	(r190334)
+++ stable/7/sys/dev/bge/if_bge.c	Mon Mar 23 20:53:38 2009	(r190335)
@@ -384,6 +384,7 @@ static uint32_t bge_readreg_ind(struct b
 #endif
 static void bge_writemem_direct(struct bge_softc *, int, int);
 static void bge_writereg_ind(struct bge_softc *, int, int);
+static void bge_set_max_readrq(struct bge_softc *, int);
 
 static int bge_miibus_readreg(device_t, int, int);
 static int bge_miibus_writereg(device_t, int, int, int);
@@ -523,6 +524,34 @@ bge_writemem_ind(struct bge_softc *sc, i
 	pci_write_config(dev, BGE_PCI_MEMWIN_BASEADDR, 0, 4);
 }
 
+/*
+ * PCI Express only
+ */
+static void
+bge_set_max_readrq(struct bge_softc *sc, int expr_ptr)
+{
+	device_t dev;
+	uint16_t val;
+
+	KASSERT((sc->bge_flags & BGE_FLAG_PCIE) && expr_ptr != 0,
+	    ("%s: not applicable", __func__));
+
+	dev = sc->bge_dev;
+
+	val = pci_read_config(dev, expr_ptr + BGE_PCIE_DEVCTL, 2);
+	if ((val & BGE_PCIE_DEVCTL_MAX_READRQ_MASK) !=
+	    BGE_PCIE_DEVCTL_MAX_READRQ_4096) {
+		if (bootverbose)
+			device_printf(dev, "adjust device control 0x%04x ",
+			    val);
+		val &= ~BGE_PCIE_DEVCTL_MAX_READRQ_MASK;
+		val |= BGE_PCIE_DEVCTL_MAX_READRQ_4096;
+		pci_write_config(dev, expr_ptr + BGE_PCIE_DEVCTL, val, 2);
+		if (bootverbose)
+			printf("-> 0x%04x\n", val);
+	}
+}
+
 #ifdef notdef
 static uint32_t
 bge_readreg_ind(struct bge_softc *sc, int off)
@@ -1278,18 +1307,6 @@ bge_chipinit(struct bge_softc *sc)
 	/* Set endianness before we access any non-PCI registers. */
 	pci_write_config(sc->bge_dev, BGE_PCI_MISC_CTL, BGE_INIT, 4);
 
-	/*
-	 * Check the 'ROM failed' bit on the RX CPU to see if
-	 * self-tests passed. Skip this check when there's no
-	 * chip containing the Ethernet address fitted, since
-	 * in that case it will always fail.
-	 */
-	if ((sc->bge_flags & BGE_FLAG_EADDR) &&
-	    CSR_READ_4(sc, BGE_RXCPU_MODE) & BGE_RXCPUMODE_ROMFAIL) {
-		device_printf(sc->bge_dev, "RX CPU self-diagnostics failed!\n");
-		return (ENODEV);
-	}
-
 	/* Clear the MAC control register */
 	CSR_WRITE_4(sc, BGE_MAC_MODE, 0);
 
@@ -1742,14 +1759,18 @@ bge_blockinit(struct bge_softc *sc)
 	/* Enable host coalescing bug fix. */
 	if (sc->bge_asicrev == BGE_ASICREV_BCM5755 ||
 	    sc->bge_asicrev == BGE_ASICREV_BCM5787)
-			val |= 1 << 29;
+		val |= 1 << 29;
 
 	/* Turn on write DMA state machine */
 	CSR_WRITE_4(sc, BGE_WDMA_MODE, val);
+	DELAY(40);
 
 	/* Turn on read DMA state machine */
-	CSR_WRITE_4(sc, BGE_RDMA_MODE,
-	    BGE_RDMAMODE_ENABLE | BGE_RDMAMODE_ALL_ATTNS);
+	val = BGE_RDMAMODE_ENABLE | BGE_RDMAMODE_ALL_ATTNS;
+	if (sc->bge_flags & BGE_FLAG_PCIE)
+		val |= BGE_RDMAMODE_FIFO_LONG_BURST;
+	CSR_WRITE_4(sc, BGE_RDMA_MODE, val);
+	DELAY(40);
 
 	/* Turn on RX data completion state machine */
 	CSR_WRITE_4(sc, BGE_RDC_MODE, BGE_RDCMODE_ENABLE);
@@ -2387,7 +2408,7 @@ bge_attach(device_t dev)
 		goto fail;
 	}
 
-	/* Save ASIC rev. */
+	/* Save various chip information. */
 	sc->bge_chipid =
 	    pci_read_config(dev, BGE_PCI_MISC_CTL, 4) &
 	    BGE_PCIMISCCTL_ASICREV;
@@ -2470,14 +2491,17 @@ bge_attach(device_t dev)
 		 * Found a PCI Express capabilities register, this
 		 * must be a PCI Express device.
 		 */
-		if (reg != 0)
+		if (reg != 0) {
 			sc->bge_flags |= BGE_FLAG_PCIE;
 #else
 	if (BGE_IS_5705_PLUS(sc)) {
 		reg = pci_read_config(dev, BGE_PCIE_CAPID_REG, 4);
-		if ((reg & 0xFF) == BGE_PCIE_CAPID)
+		if ((reg & 0xFF) == BGE_PCIE_CAPID) {
 			sc->bge_flags |= BGE_FLAG_PCIE;
+			reg = BGE_PCIE_CAPID;
 #endif
+			bge_set_max_readrq(sc, reg);
+		}
 	} else {
 		/*
 		 * Check if the device is in PCI-X Mode.
@@ -2522,6 +2546,13 @@ bge_attach(device_t dev)
 		goto fail;
 	}
 
+	if (bootverbose)
+		device_printf(dev,
+		    "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; %s\n",
+		    sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev,
+		    (sc->bge_flags & BGE_FLAG_PCIX) ? "PCI-X" :
+		    ((sc->bge_flags & BGE_FLAG_PCIE) ? "PCI-E" : "PCI"));
+
 	BGE_LOCK_INIT(sc, device_get_nameunit(dev));
 
 	/* Try to reset the chip. */
@@ -3882,6 +3913,7 @@ bge_ifmedia_upd_locked(struct ifnet *ifp
 {
 	struct bge_softc *sc = ifp->if_softc;
 	struct mii_data *mii;
+	struct mii_softc *miisc;
 	struct ifmedia *ifm;
 
 	BGE_LOCK_ASSERT(sc);
@@ -3932,12 +3964,9 @@ bge_ifmedia_upd_locked(struct ifnet *ifp
 
 	sc->bge_link_evt++;
 	mii = device_get_softc(sc->bge_miibus);
-	if (mii->mii_instance) {
-		struct mii_softc *miisc;
-		for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL;
-		    miisc = LIST_NEXT(miisc, mii_list))
+	if (mii->mii_instance)
+		LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
 			mii_phy_reset(miisc);
-	}
 	mii_mediachg(mii);
 
 	/*

Modified: stable/7/sys/dev/bge/if_bgereg.h
==============================================================================
--- stable/7/sys/dev/bge/if_bgereg.h	Mon Mar 23 20:37:37 2009	(r190334)
+++ stable/7/sys/dev/bge/if_bgereg.h	Mon Mar 23 20:53:38 2009	(r190335)
@@ -176,6 +176,22 @@
 #define	BGE_PCI_MSI_ADDR_LO		0x60
 #define	BGE_PCI_MSI_DATA		0x64
 
+/*
+ * PCI Express definitions
+ * According to
+ * PCI Express base specification, REV. 1.0a
+ */
+
+/* PCI Express device control, 16bits */
+#define	BGE_PCIE_DEVCTL			0x08
+#define	BGE_PCIE_DEVCTL_MAX_READRQ_MASK	0x7000
+#define	BGE_PCIE_DEVCTL_MAX_READRQ_128	0x0000
+#define	BGE_PCIE_DEVCTL_MAX_READRQ_256	0x1000
+#define	BGE_PCIE_DEVCTL_MAX_READRQ_512	0x2000
+#define	BGE_PCIE_DEVCTL_MAX_READRQ_1024	0x3000
+#define	BGE_PCIE_DEVCTL_MAX_READRQ_2048	0x4000
+#define	BGE_PCIE_DEVCTL_MAX_READRQ_4096	0x5000
+
 /* PCI MSI. ??? */
 #define	BGE_PCIE_CAPID_REG		0xD0
 #define	BGE_PCIE_CAPID			0x10
@@ -1359,6 +1375,8 @@
 #define	BGE_RDMAMODE_PCI_FIFOOREAD_ATTN	0x00000100
 #define	BGE_RDMAMODE_LOCWRITE_TOOBIG	0x00000200
 #define	BGE_RDMAMODE_ALL_ATTNS		0x000003FC
+#define	BGE_RDMAMODE_FIFO_SIZE_128	0x00020000
+#define	BGE_RDMAMODE_FIFO_LONG_BURST	0x00030000
 
 /* Read DMA status register */
 #define	BGE_RDMASTAT_PCI_TGT_ABRT_ATTN	0x00000004

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 21:32:03 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B04AB1065720;
	Mon, 23 Mar 2009 21:32:03 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9CECF8FC0C;
	Mon, 23 Mar 2009 21:32:03 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2NLW3MA022185;
	Mon, 23 Mar 2009 21:32:03 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2NLW3Mv022184;
	Mon, 23 Mar 2009 21:32:03 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <200903232132.n2NLW3Mv022184@svn.freebsd.org>
From: Luigi Rizzo 
Date: Mon, 23 Mar 2009 21:32:03 +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: r190338 - stable/7/release/picobsd/build
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, 23 Mar 2009 21:32:06 -0000

Author: luigi
Date: Mon Mar 23 21:32:03 2009
New Revision: 190338
URL: http://svn.freebsd.org/changeset/base/190338

Log:
  MFC: add support for local config files and non-chroot
  copy of files from the host filesystem

Modified:
  stable/7/release/picobsd/build/picobsd

Modified: stable/7/release/picobsd/build/picobsd
==============================================================================
--- stable/7/release/picobsd/build/picobsd	Mon Mar 23 21:16:21 2009	(r190337)
+++ stable/7/release/picobsd/build/picobsd	Mon Mar 23 21:32:03 2009	(r190338)
@@ -284,6 +284,9 @@ build_image() {
     if [ -f ${MY_TREE}/config ] ; then
 	. ${MY_TREE}/config
     fi
+    if [ -f ${o_additional_config} ] ; then
+	. ${o_additional_config}
+    fi
 
     # location of the object directory
     PICO_OBJ=${l_objtree}/picobsd/${THETYPE}
@@ -529,6 +532,32 @@ populate_floppy_fs() {		# OK
     ) || true
 }
 
+# Copy the specified files to the destination filesystem.
+# Each file is specified as a pair "src dst", dst is assumed to be
+# a directory (and created with mkdir -p) if it has a trailing /
+# Be careful to escape metacharacters.
+# You can use ${CROSS} to point to the root of the cross build
+# (remember that it might be incomplete)
+
+do_copyfiles() {	# rootdir varname
+	log Copy files to $1
+	local root=$1
+	local srcs dst
+	local CROSS=${_SHLIBDIRPREFIX}
+	eval set "\${${2}}"
+        srcs=""
+	for dst in $* ; do
+		[ x"$srcs" = x ] && srcs=$dst && continue
+		eval srcs="$srcs"	# expand wildcard and vars
+		case x"$dst" in
+		*/ )	mkdir -p ${root}/${dst} ;;
+		# * )	mkdir -p `dirname ${root}/${dst}` ;;
+		esac
+		cp -p ${srcs} ${root}/${dst} || true
+		srcs=""
+        done
+}
+
 # Populate the memory filesystem with binaries and non-variable
 # configuration files.
 # First do an mtree pass, then create directory links and device entries,
@@ -537,7 +566,7 @@ populate_floppy_fs() {		# OK
 # Finally, if required, make a copy of the floppy.tree onto /fd
 
 populate_mfs_tree() {
-    local a dst MFS_TREE
+    local i j a dst MFS_TREE
 
     log "populate_mfs_tree()"
     dst=${BUILDDIR}/mfs.tree
@@ -552,12 +581,15 @@ populate_mfs_tree() {
     log "Running mtree using $a..."
     mtree -deU -f $a -p ${dst} > /dev/null || fail $? mtree
 
-    # XXX create links
+    # Create symlinks using relative pathnames, so it is possible
+    # to follow them also when building the image.
+    # Note that names in STAND_LINKS should not have a leading /
     for i in ${STAND_LINKS}; do
-	ln -s /stand ${dst}/$i
+	j=`echo $i | sed -E 's:^[^/]+::;s:/[^/]+:../:g'`
+	ln -s ${j}stand ${dst}/$i
     done
-    ln -s /dev/null ${dst}/var/run/log
-    ln -s /etc/termcap ${dst}/usr/share/misc/termcap
+    ln -s ../../dev/null ${dst}/var/run/log
+    ln -s ../../../etc/termcap ${dst}/usr/share/misc/termcap
 
     ### now build the crunched binaries ###
     (
@@ -629,6 +661,13 @@ populate_mfs_tree() {
 	(cd ${dst}; chown -R root . )
     fi
 
+    if [ -n "${copy_files}" ] ; then
+	do_copyfiles ${dst} copy_files
+    fi
+
+    # The 'import_files' mechanism is deprecated, as it requires
+    # root permissions to follow the symlinks, and also does
+    # not let you rename the entries.
     if [ -n "${import_files}" ] ; then
 	log "importing ${import_files} into mfs"
 	# We do it in a chroot environment on the target so
@@ -641,6 +680,7 @@ populate_mfs_tree() {
 	rm -rf ${dst}/rescue
     fi
 
+    # final step -- build the mfs image
     (cd ${BUILDDIR}
 	# override the owner
 	echo "/set uid=0 gid=0" > mtree.out
@@ -916,6 +956,11 @@ while [ true ]; do
 	generate_iso="YES"
 	;;
 
+    --cfg) # read additional config from this file
+	o_additional_config=`realpath $2`
+	shift
+	;;
+
     *)
 	break
 	;;

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Mar 23 23:32:21 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 49C48106566B;
	Mon, 23 Mar 2009 23:32:21 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 373798FC19;
	Mon, 23 Mar 2009 23:32:21 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2NNWLP2024785;
	Mon, 23 Mar 2009 23:32:21 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2NNWLKc024784;
	Mon, 23 Mar 2009 23:32:21 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903232332.n2NNWLKc024784@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Mon, 23 Mar 2009 23:32:21 +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: r190343 - stable/7/lib/libelf
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, 23 Mar 2009 23:32:22 -0000

Author: obrien
Date: Mon Mar 23 23:32:20 2009
New Revision: 190343
URL: http://svn.freebsd.org/changeset/base/190343

Log:
  MFC: r189721: don't need to set symbol, default value OK

Modified:
  stable/7/lib/libelf/Makefile

Modified: stable/7/lib/libelf/Makefile
==============================================================================
--- stable/7/lib/libelf/Makefile	Mon Mar 23 23:22:09 2009	(r190342)
+++ stable/7/lib/libelf/Makefile	Mon Mar 23 23:32:20 2009	(r190343)
@@ -148,7 +148,7 @@ VERSION_MAP=		${.CURDIR}/Version.map
 
 LIBELF_TEST_HOOKS?=	1
 .if defined(LIBELF_TEST_HOOKS) && (${LIBELF_TEST_HOOKS} > 0)
-CFLAGS+=	-DLIBELF_TEST_HOOKS=1
+CFLAGS+= -DLIBELF_TEST_HOOKS
 .endif
 
 libelf_convert.c:	elf_types.m4 libelf_convert.m4

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 00:07:18 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 75C5D106564A;
	Tue, 24 Mar 2009 00:07:18 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 61A6E8FC0A;
	Tue, 24 Mar 2009 00:07:18 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O07IUs025595;
	Tue, 24 Mar 2009 00:07:18 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O07H1w025582;
	Tue, 24 Mar 2009 00:07:17 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903240007.n2O07H1w025582@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 24 Mar 2009 00:07: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: r190345 - stable/7/usr.bin/make
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, 24 Mar 2009 00:07:19 -0000

Author: obrien
Date: Tue Mar 24 00:07:17 2009
New Revision: 190345
URL: http://svn.freebsd.org/changeset/base/190345

Log:
  MFC:
  r187475: Remove inlining of functions that are used mostly in different
  	 object files.  This lets use to remove NO_WERROR.
  r186558: Consistently use Var_SetGlobal().
  r186713: Add the -Q be-quiet flag for parallel jobs.
  r186279: Exit with error code 2 when run with -k (continue if errors)
  	 and build failed.
  r186559: Add the ability to tweak the token output before targets in job mode.
  r181021: Add POSIX -p flag to make(1).
  r186502: Clarify the behaviour of conditionals when dealing with comparisons.

Modified:
  stable/7/usr.bin/make/Makefile
  stable/7/usr.bin/make/buf.c
  stable/7/usr.bin/make/for.c
  stable/7/usr.bin/make/globals.h
  stable/7/usr.bin/make/job.c
  stable/7/usr.bin/make/job.h
  stable/7/usr.bin/make/main.c
  stable/7/usr.bin/make/make.1
  stable/7/usr.bin/make/make.c
  stable/7/usr.bin/make/make.h
  stable/7/usr.bin/make/parse.c
  stable/7/usr.bin/make/suff.c
  stable/7/usr.bin/make/var.c

Modified: stable/7/usr.bin/make/Makefile
==============================================================================
--- stable/7/usr.bin/make/Makefile	Mon Mar 23 23:43:07 2009	(r190344)
+++ stable/7/usr.bin/make/Makefile	Tue Mar 24 00:07:17 2009	(r190345)
@@ -8,7 +8,6 @@ SRCS=	arch.c buf.c cond.c dir.c for.c ha
 	lst.c main.c make.c parse.c proc.c shell.c str.c suff.c targ.c	\
 	util.c var.c
 
-NO_WERROR=
 WARNS?=	6
 NO_SHARED?=	YES
 
@@ -52,7 +51,7 @@ hash:
 	  echo ' * DO NOT EDIT' ;					\
 	  echo ' * $$''FreeBSD$$' ;					\
 	  echo -n ' * auto-generated from ' ;				\
-	  sed -nEe '/\$$FreeBSD/s/^.*\$$(.*)\$$.*$$/\1/p'		\
+	  sed -nEe '/\$$FreeBSD$/\1/p'		\
 		${.CURDIR}/parse.c ;					\
 	  echo ' * DO NOT EDIT' ;					\
 	  echo ' */' ;							\

Modified: stable/7/usr.bin/make/buf.c
==============================================================================
--- stable/7/usr.bin/make/buf.c	Mon Mar 23 23:43:07 2009	(r190344)
+++ stable/7/usr.bin/make/buf.c	Tue Mar 24 00:07:17 2009	(r190345)
@@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$");
  * Returns the number of bytes in the buffer.  Doesn't include the
  * null-terminating byte.
  */
-inline size_t
+size_t
 Buf_Size(const Buffer *buf)
 {
 
@@ -70,7 +70,7 @@ Buf_Size(const Buffer *buf)
  *  
  * @note Adding data to the Buffer object may invalidate the reference.
  */
-inline char *
+char *
 Buf_Data(const Buffer *bp)
 {
 
@@ -98,7 +98,7 @@ BufExpand(Buffer *bp, size_t nb)
 /**
  * Add a single byte to the buffer.
  */
-inline void
+void
 Buf_AddByte(Buffer *bp, Byte byte)
 {
 

Modified: stable/7/usr.bin/make/for.c
==============================================================================
--- stable/7/usr.bin/make/for.c	Mon Mar 23 23:43:07 2009	(r190344)
+++ stable/7/usr.bin/make/for.c	Tue Mar 24 00:07:17 2009	(r190345)
@@ -254,7 +254,7 @@ For_Run(int lineno)
 
 	LST_FOREACH(ln, &values) {
 		val = Lst_Datum(ln);
-		Var_Set(var, val, VAR_GLOBAL);
+		Var_SetGlobal(var, val);
 
 		DEBUGF(FOR, ("--- %s = %s\n", var, val));
 		str = Buf_Peel(Var_SubstOnly(var, Buf_Data(buf), FALSE));

Modified: stable/7/usr.bin/make/globals.h
==============================================================================
--- stable/7/usr.bin/make/globals.h	Mon Mar 23 23:43:07 2009	(r190344)
+++ stable/7/usr.bin/make/globals.h	Tue Mar 24 00:07:17 2009	(r190345)
@@ -70,11 +70,13 @@ extern struct Path parseIncPath;
 extern struct Path sysIncPath;
 
 extern int	jobLimit;	/* -j argument: maximum number of jobs */
+extern int	makeErrors;	/* Number of targets not remade due to errors */
 extern Boolean	jobsRunning;	/* True if jobs are running */
 extern Boolean	compatMake;	/* True if we are make compatible */
 extern Boolean	ignoreErrors;	/* True if should ignore all errors */
 extern Boolean	beSilent;	/* True if should print no commands */
 extern Boolean	beVerbose;	/* True if should print extra cruft */
+extern Boolean	beQuiet;	/* True if want quiet headers with -j */
 extern Boolean	noExecute;	/* True if should execute nothing */
 extern Boolean	allPrecious;	/* True if every target is precious */
 extern Boolean	is_posix;	/* .POSIX target seen */

Modified: stable/7/usr.bin/make/job.c
==============================================================================
--- stable/7/usr.bin/make/job.c	Mon Mar 23 23:43:07 2009	(r190344)
+++ stable/7/usr.bin/make/job.c	Tue Mar 24 00:07:17 2009	(r190345)
@@ -263,7 +263,6 @@ TAILQ_HEAD(JobList, Job);
 /*
  * error handling variables
  */
-static int	errors = 0;	/* number of errors reported */
 static int	aborting = 0;	/* why is the make aborting? */
 #define	ABORT_ERROR	1	/* Because of an error */
 #define	ABORT_INTERRUPT	2	/* Because it was interrupted */
@@ -322,10 +321,11 @@ static GNode	*lastNode;	/* The node for 
 static const char *targFmt;	/* Format string to use to head output from a
 				 * job when it's not the most-recent job heard
 				 * from */
+static char *targPrefix = NULL;	/* What we print at the start of targFmt */
 
-#define	TARG_FMT  "--- %s ---\n" /* Default format */
+#define TARG_FMT  "%s %s ---\n"	/* Default format */
 #define	MESSAGE(fp, gn) \
-	 fprintf(fp, targFmt, gn->name);
+	fprintf(fp, targFmt, targPrefix, gn->name);
 
 /*
  * When JobStart attempts to run a job but isn't allowed to
@@ -844,7 +844,7 @@ JobClose(Job *job)
  *
  *	If we got an error and are aborting (aborting == ABORT_ERROR) and
  *	the job list is now empty, we are done for the day.
- *	If we recognized an error (errors !=0), we set the aborting flag
+ *	If we recognized an error (makeErrors !=0), we set the aborting flag
  *	to ABORT_ERROR so no more jobs will be started.
  */
 static void
@@ -1119,7 +1119,7 @@ JobFinish(Job *job, int *status)
 		free(job);
 
 	} else if (*status != 0) {
-		errors += 1;
+		makeErrors++;
 		free(job);
 	}
 
@@ -1128,7 +1128,7 @@ JobFinish(Job *job, int *status)
 	/*
 	 * Set aborting if any error.
 	 */
-	if (errors && !keepgoing && aborting != ABORT_INTERRUPT) {
+	if (makeErrors && !keepgoing && aborting != ABORT_INTERRUPT) {
 		/*
 		 * If we found any errors in this batch of children and the -k
 		 * flag wasn't given, we set the aborting flag so no more jobs
@@ -1141,7 +1141,7 @@ JobFinish(Job *job, int *status)
 		/*
 		 * If we are aborting and the job table is now empty, we finish.
 		 */
-		Finish(errors);
+		Finish(makeErrors);
 	}
 }
 
@@ -2279,6 +2279,18 @@ Job_Make(GNode *gn)
 	JobStart(gn, 0, NULL);
 }
 
+void
+Job_SetPrefix(void)
+{
+
+	if (targPrefix) {
+		free(targPrefix);
+	} else if (!Var_Exists(MAKE_JOB_PREFIX, VAR_GLOBAL)) {
+		Var_SetGlobal(MAKE_JOB_PREFIX, "---");
+	}
+	targPrefix = Var_Subst("${" MAKE_JOB_PREFIX "}", VAR_GLOBAL, 0)->buf;
+}
+
 /**
  * Job_Init
  *	Initialize the process module, given a maximum number of jobs.
@@ -2342,11 +2354,10 @@ Job_Init(int maxproc)
 	nJobs = 0;
 
 	aborting = 0;
-	errors = 0;
+	makeErrors = 0;
 
 	lastNode = NULL;
-
-	if ((maxJobs == 1 && fifoFd < 0) || beVerbose == 0) {
+	if ((maxJobs == 1 && fifoFd < 0) || !beVerbose || is_posix || beQuiet) {
 		/*
 		 * If only one job can run at a time, there's no need for a
 		 * banner, no is there?
@@ -2534,14 +2545,14 @@ JobInterrupt(int runINTERRUPT, int signo
  *	attached to the .END target.
  *
  * Results:
- *	Number of errors reported.
+ *	None.
  */
-int
+void
 Job_Finish(void)
 {
 
 	if (postCommands != NULL && !Lst_IsEmpty(&postCommands->commands)) {
-		if (errors) {
+		if (makeErrors) {
 			Error("Errors reported so .END ignored");
 		} else {
 			JobStart(postCommands, JOB_SPECIAL | JOB_IGNDOTS, NULL);
@@ -2558,7 +2569,6 @@ Job_Finish(void)
 		if (fifoMaster)
 			unlink(fifoName);
 	}
-	return (errors);
 }
 
 /**
@@ -3322,7 +3332,6 @@ void
 Compat_Run(Lst *targs)
 {
 	GNode	*gn = NULL;	/* Current root target */
-	int	error_cnt;		/* Number of targets not remade due to errors */
 	LstNode	*ln;
 
 	Compat_InstallSignalHandlers();
@@ -3355,7 +3364,7 @@ Compat_Run(Lst *targs)
 	 *	ABORTED	  gn was not remade because one of its inferiors
 	 *		  could not be made due to errors.
 	 */
-	error_cnt = 0;
+	makeErrors = 0;
 	while (!Lst_IsEmpty(targs)) {
 		gn = Lst_DeQueue(targs);
 		Compat_Make(gn, gn);
@@ -3365,18 +3374,17 @@ Compat_Run(Lst *targs)
 		} else if (gn->made == ABORTED) {
 			printf("`%s' not remade because of errors.\n",
 			    gn->name);
-			error_cnt += 1;
+			makeErrors++;
 		}
 	}
 
 	/*
 	 * If the user has defined a .END target, run its commands.
 	 */
-	if (error_cnt == 0) {
+	if (makeErrors == 0) {
 		LST_FOREACH(ln, &ENDNode->commands) {
 			if (Compat_RunCommand(Lst_Datum(ln), ENDNode))
 				break;
 		}
 	}
 }
-

Modified: stable/7/usr.bin/make/job.h
==============================================================================
--- stable/7/usr.bin/make/job.h	Mon Mar 23 23:43:07 2009	(r190344)
+++ stable/7/usr.bin/make/job.h	Tue Mar 24 00:07:17 2009	(r190345)
@@ -64,9 +64,10 @@ void Job_Make(struct GNode *);
 void Job_Init(int);
 Boolean Job_Full(void);
 Boolean Job_Empty(void);
-int Job_Finish(void);
+void Job_Finish(void);
 void Job_Wait(void);
 void Job_AbortAll(void);
+void Job_SetPrefix(void);
 
 void Proc_Init(void);
 

Modified: stable/7/usr.bin/make/main.c
==============================================================================
--- stable/7/usr.bin/make/main.c	Mon Mar 23 23:43:07 2009	(r190344)
+++ stable/7/usr.bin/make/main.c	Tue Mar 24 00:07:17 2009	(r190345)
@@ -126,13 +126,16 @@ Boolean		is_posix;	/* .POSIX target seen
 Boolean		mfAutoDeps;	/* .MAKEFILEDEPS target seen */
 Boolean		beSilent;	/* -s flag */
 Boolean		beVerbose;	/* -v flag */
+Boolean		beQuiet;	/* -Q flag */
 Boolean		compatMake;	/* -B argument */
 int		debug;		/* -d flag */
 Boolean		ignoreErrors;	/* -i flag */
 int		jobLimit;	/* -j argument */
+int		makeErrors;	/* Number of targets not remade due to errors */
 Boolean		jobsRunning;	/* TRUE if the jobs might be running */
 Boolean		keepgoing;	/* -k flag */
 Boolean		noExecute;	/* -n flag */
+Boolean		printGraphOnly;	/* -p flag */
 Boolean		queryFlag;	/* -q flag */
 Boolean		touchFlag;	/* -t flag */
 Boolean		usePipes;	/* !-P flag */
@@ -150,7 +153,7 @@ static void
 usage(void)
 {
 	fprintf(stderr,
-	    "usage: make [-BPSXeiknqrstv] [-C directory] [-D variable]\n"
+	    "usage: make [-BPSXeiknpqrstv] [-C directory] [-D variable]\n"
 	    "\t[-d flags] [-E variable] [-f makefile] [-I directory]\n"
 	    "\t[-j max_jobs] [-m directory] [-V variable]\n"
 	    "\t[variable=value] [target ...]\n");
@@ -368,7 +371,7 @@ MainParseArgs(int argc, char **argv)
 rearg:
 	optind = 1;	/* since we're called more than once */
 	optreset = 1;
-#define OPTFLAGS "ABC:D:E:I:PSV:Xd:ef:ij:km:nqrstvx:"
+#define OPTFLAGS "ABC:D:d:E:ef:I:ij:km:nPpQqrSstV:vXx:"
 	for (;;) {
 		if ((optind < argc) && strcmp(argv[optind], "--") == 0) {
 			found_dd = TRUE;
@@ -382,6 +385,11 @@ rearg:
 			arch_fatal = FALSE;
 			MFLAGS_append("-A", NULL);
 			break;
+		case 'B':
+			compatMake = TRUE;
+			MFLAGS_append("-B", NULL);
+			unsetenv("MAKE_JOBS_FIFO");
+			break;
 		case 'C':
 			if (chdir(optarg) == -1)
 				err(1, "chdir %s", optarg);
@@ -390,30 +398,6 @@ rearg:
 			Var_SetGlobal(optarg, "1");
 			MFLAGS_append("-D", optarg);
 			break;
-		case 'I':
-			Parse_AddIncludeDir(optarg);
-			MFLAGS_append("-I", optarg);
-			break;
-		case 'V':
-			Lst_AtEnd(&variables, estrdup(optarg));
-			MFLAGS_append("-V", optarg);
-			break;
-		case 'X':
-			expandVars = FALSE;
-			break;
-		case 'B':
-			compatMake = TRUE;
-			MFLAGS_append("-B", NULL);
-			unsetenv("MAKE_JOBS_FIFO");
-			break;
-		case 'P':
-			usePipes = FALSE;
-			MFLAGS_append("-P", NULL);
-			break;
-		case 'S':
-			keepgoing = FALSE;
-			MFLAGS_append("-S", NULL);
-			break;
 		case 'd': {
 			char *modules = optarg;
 
@@ -481,6 +465,10 @@ rearg:
 		case 'f':
 			Lst_AtEnd(&makefiles, estrdup(optarg));
 			break;
+		case 'I':
+			Parse_AddIncludeDir(optarg);
+			MFLAGS_append("-I", optarg);
+			break;
 		case 'i':
 			ignoreErrors = TRUE;
 			MFLAGS_append("-i", NULL);
@@ -510,6 +498,19 @@ rearg:
 			noExecute = TRUE;
 			MFLAGS_append("-n", NULL);
 			break;
+		case 'P':
+			usePipes = FALSE;
+			MFLAGS_append("-P", NULL);
+			break;
+		case 'p':
+			printGraphOnly = TRUE;
+			debug |= DEBUG_GRAPH1;
+			break;
+		case 'Q':
+			beQuiet = TRUE;
+			beVerbose = FALSE;
+			MFLAGS_append("-Q", NULL);
+			break;
 		case 'q':
 			queryFlag = TRUE;
 			/* Kind of nonsensical, wot? */
@@ -519,6 +520,10 @@ rearg:
 			noBuiltins = TRUE;
 			MFLAGS_append("-r", NULL);
 			break;
+		case 'S':
+			keepgoing = FALSE;
+			MFLAGS_append("-S", NULL);
+			break;
 		case 's':
 			beSilent = TRUE;
 			MFLAGS_append("-s", NULL);
@@ -527,10 +532,18 @@ rearg:
 			touchFlag = TRUE;
 			MFLAGS_append("-t", NULL);
 			break;
+		case 'V':
+			Lst_AtEnd(&variables, estrdup(optarg));
+			MFLAGS_append("-V", optarg);
+			break;
 		case 'v':
 			beVerbose = TRUE;
+			beQuiet = FALSE;
 			MFLAGS_append("-v", NULL);
 			break;
+		case 'X':
+			expandVars = FALSE;
+			break;
 		case 'x':
 			if (Main_ParseWarn(optarg, 1) != -1)
 				MFLAGS_append("-x", optarg);
@@ -903,6 +916,7 @@ main(int argc, char **argv)
 	beSilent = FALSE;		/* Print commands as executed */
 	ignoreErrors = FALSE;		/* Pay attention to non-zero returns */
 	noExecute = FALSE;		/* Execute all commands */
+	printGraphOnly = FALSE;		/* Don't stop after printing graph */
 	keepgoing = FALSE;		/* Stop on error */
 	allPrecious = FALSE;		/* Remove targets when interrupted */
 	queryFlag = FALSE;		/* This is not just a check-run */
@@ -933,14 +947,13 @@ main(int argc, char **argv)
 #endif
 
 	/*
-	 * FreeBSD/pc98 kernel used to set the utsname.machine to
-	 * "i386", and MACHINE was defined as "i386", so it could
-	 * not be distinguished from FreeBSD/i386.  Therefore, we
-	 * had to check machine.ispc98 and adjust the MACHINE
-	 * variable.
-	 * NOTE: The code is still here to be able to compile new
-	 * make binary on old FreeBSD/pc98 systems, and have the
-	 * MACHINE variable set properly.
+	 * Prior to 7.0, FreeBSD/pc98 kernel used to set the
+	 * utsname.machine to "i386", and MACHINE was defined as
+	 * "i386", so it could not be distinguished from FreeBSD/i386.
+	 * Therefore, we had to check machine.ispc98 and adjust the
+	 * MACHINE variable.  NOTE: The code is still here to be able
+	 * to compile new make binary on old FreeBSD/pc98 systems, and
+	 * have the MACHINE variable set properly.
 	 */
 	if ((machine = getenv("MACHINE")) == NULL) {
 		int	ispc98;
@@ -1023,6 +1036,16 @@ main(int argc, char **argv)
 #ifdef MAKE_VERSION
 	Var_SetGlobal("MAKE_VERSION", MAKE_VERSION);
 #endif
+	Var_SetGlobal(".newline", "\n");	/* handy for :@ loops */
+	{
+		char tmp[64];
+
+		snprintf(tmp, sizeof(tmp), "%u", getpid());
+		Var_SetGlobal(".MAKE.PID", tmp);
+		snprintf(tmp, sizeof(tmp), "%u", getppid());
+		Var_SetGlobal(".MAKE.PPID", tmp);
+	}
+	Job_SetPrefix();
 
 	/*
 	 * First snag things out of the MAKEFLAGS environment
@@ -1243,7 +1266,7 @@ main(int argc, char **argv)
 		Targ_PrintGraph(1);
 
 	/* print the values of any variables requested by the user */
-	if (Lst_IsEmpty(&variables)) {
+	if (Lst_IsEmpty(&variables) && !printGraphOnly) {
 		/*
 		 * Since the user has not requested that any variables
 		 * be printed, we can build targets.
@@ -1306,9 +1329,11 @@ main(int argc, char **argv)
 	if (DEBUG(GRAPH2))
 		Targ_PrintGraph(2);
 
-	if (queryFlag && outOfDate)
-		return (1);
-	else
-		return (0);
-}
+	if (queryFlag)
+		return (outOfDate);
 
+	if (makeErrors != 0)
+		Finish(makeErrors);
+
+	return (0);
+}

Modified: stable/7/usr.bin/make/make.1
==============================================================================
--- stable/7/usr.bin/make/make.1	Mon Mar 23 23:43:07 2009	(r190344)
+++ stable/7/usr.bin/make/make.1	Tue Mar 24 00:07:17 2009	(r190345)
@@ -32,7 +32,7 @@
 .\"	@(#)make.1	8.8 (Berkeley) 6/13/95
 .\" $FreeBSD$
 .\"
-.Dd March 24, 2008
+.Dd December 29, 2008
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -40,7 +40,7 @@
 .Nd maintain program dependencies
 .Sh SYNOPSIS
 .Nm
-.Op Fl ABPSXeiknqrstv
+.Op Fl ABPSXeiknpqrstv
 .Op Fl C Ar directory
 .Op Fl D Ar variable
 .Op Fl d Ar flags
@@ -249,6 +249,18 @@ instead of mixing the output of parallel
 This option has no effect unless
 .Fl j
 is used too.
+.It Fl p
+Only print the input graph, not executing any commands.
+The output is the same as
+.Fl d Ar g1 .
+When combined with
+.Fl f Pa /dev/null ,
+only the builtin rules of
+.Nm
+are displayed.
+.It Fl Q
+Be extra quiet.
+For multi-job makes, this will cause file banners not to be generated.
 .It Fl q
 Do not execute any commands, but exit 0 if the specified targets are
 up-to-date and 1, otherwise.
@@ -280,7 +292,7 @@ the variables will be printed one per li
 with a blank line for each null or undefined variable.
 .It Fl v
 Be extra verbose.
-For multi-job makes, this will cause file banners to be generated.
+Print any extra information.
 .It Fl X
 When using the
 .Fl V
@@ -754,6 +766,31 @@ contains all the options from the
 environment variable plus any options specified on
 .Nm Ns 's
 command line.
+.It Va .MAKE.PID
+The process-id of
+.Nm .
+.It Va .MAKE.PPID
+The parent process-id of
+.Nm .
+.It Va .MAKE.JOB.PREFIX
+If
+.Nm
+is run with
+.Fl j Fl v
+then output for each target is prefixed with a token
+.Ql --- target ---
+the first part of which can be controlled via
+.Va .MAKE.JOB.PREFIX .
+.br
+For example:
+.Li .MAKE.JOB.PREFIX=${.newline}---${MAKE:T}[${.MAKE.PID}]
+would produce tokens like
+.Ql ---make[1234] target ---
+or
+.Li .MAKE.JOB.PREFIX=---pid[${.MAKE.PID}],ppid[${.MAKE.PPID}]
+would produce tokens like
+.Ql ---pid[56789],ppid[1234] target ---
+making it easier to track the degree of parallelism being achieved.
 .It Va .TARGETS
 List of targets
 .Nm
@@ -1121,24 +1158,34 @@ has been defined.
 .Pp
 An
 .Ar expression
-may also be an arithmetic or string comparison, with the left-hand side
-being a variable expansion.
-Variable expansion is
-performed on both sides of the comparison, after which the integral
+may also be a numeric or string comparison:
+in this case, the left-hand side
+.Ar must be
+a variable expansion, whereas the right-hand side can be a
+constant or a variable expansion.
+Variable expansion is performed on both sides, after which the resulting
 values are compared.
 A value is interpreted as hexadecimal if it is
 preceded by 0x, otherwise it is decimal; octal numbers are not supported.
-The standard C relational operators are all supported.
-If after
-variable expansion, either the left or right hand side of a
+.Pp
+String comparison can only use the
 .Sq Ic ==
 or
 .Sq Ic !=
-operator is not an integral value, then
-string comparison is performed between the expanded
-variables.
-If no relational operator is given, it is assumed that the expanded
-variable is being compared against 0.
+operators, whereas numeric values (both integer and floating point)
+can also be compared using the
+.Sq Ic > ,
+.Sq Ic >= ,
+.Sq Ic <
+and
+.Sq Ic <=
+operators.
+.Pp
+If no relational operator (and right-hand value) are given, an implicit
+.Sq Ic != 0
+is used.
+However be very careful in using this feature especially
+when the left-hand side variable expansion returns a string.
 .Pp
 When
 .Nm

Modified: stable/7/usr.bin/make/make.c
==============================================================================
--- stable/7/usr.bin/make/make.c	Mon Mar 23 23:43:07 2009	(r190344)
+++ stable/7/usr.bin/make/make.c	Tue Mar 24 00:07:17 2009	(r190345)
@@ -713,7 +713,6 @@ Make_Run(Lst *targs)
 	GNode	*gn;		/* a temporary pointer */
 	GNode	*cgn;
 	Lst	examine;	/* List of targets to examine */
-	int	errors;		/* Number of errors the Job module reports */
 	LstNode	*ln;
 
 	Lst_Init(&examine);
@@ -793,15 +792,14 @@ Make_Run(Lst *targs)
 		MakeStartJobs();
 	}
 
-	errors = Job_Finish();
+	Job_Finish();
 
 	/*
 	 * Print the final status of each target. E.g. if it wasn't made
 	 * because some inferior reported an error.
 	 */
-	errors = ((errors == 0) && (numNodes != 0));
 	LST_FOREACH(ln, targs)
-		MakePrintStatus(Lst_Datum(ln), errors);
+		MakePrintStatus(Lst_Datum(ln), (makeErrors == 0) && (numNodes != 0));
 
 	return (TRUE);
 }

Modified: stable/7/usr.bin/make/make.h
==============================================================================
--- stable/7/usr.bin/make/make.h	Mon Mar 23 23:43:07 2009	(r190344)
+++ stable/7/usr.bin/make/make.h	Tue Mar 24 00:07:17 2009	(r190345)
@@ -49,6 +49,8 @@
 
 #include "util.h"
 
+#define	MAKE_JOB_PREFIX	".MAKE.JOB.PREFIX"
+
 struct GNode;
 struct Lst;
 struct Buffer;

Modified: stable/7/usr.bin/make/parse.c
==============================================================================
--- stable/7/usr.bin/make/parse.c	Mon Mar 23 23:43:07 2009	(r190344)
+++ stable/7/usr.bin/make/parse.c	Tue Mar 24 00:07:17 2009	(r190345)
@@ -1076,7 +1076,7 @@ ParseDoDependency(char *line)
 			break;
 		  case Posix:
 			is_posix = TRUE;
-			Var_Set("%POSIX", "1003.2", VAR_GLOBAL);
+			Var_SetGlobal("%POSIX", "1003.2");
 			break;
 		  default:
 			break;
@@ -1533,6 +1533,8 @@ Parse_DoVar(char *line, GNode *ctxt)
 		 */
 		Var_Set(line, cp, ctxt);
 	}
+	if (strcmp(line, MAKE_JOB_PREFIX) == 0)
+		Job_SetPrefix();
 }
 
 /*-

Modified: stable/7/usr.bin/make/suff.c
==============================================================================
--- stable/7/usr.bin/make/suff.c	Mon Mar 23 23:43:07 2009	(r190344)
+++ stable/7/usr.bin/make/suff.c	Tue Mar 24 00:07:17 2009	(r190345)
@@ -514,6 +514,7 @@ Suff_AddTransform(char *line)
 	Suff	*s;	/* source suffix */
 	Suff	*t;	/* target suffix */
 
+	s = t = NULL;	/* silence gcc */
 	gn = SuffTransFind(line);
 	if (gn == NULL) {
 		/*
@@ -785,11 +786,11 @@ Suff_DoPaths(void)
 	}
 
 	ptr = Path_MakeFlags("-I", &inIncludes);
-	Var_Set(".INCLUDES", ptr, VAR_GLOBAL);
+	Var_SetGlobal(".INCLUDES", ptr);
 	free(ptr);
 
 	ptr = Path_MakeFlags("-L", &inLibs);
-	Var_Set(".LIBS", ptr, VAR_GLOBAL);
+	Var_SetGlobal(".LIBS", ptr);
 	free(ptr);
 
 	Path_Clear(&inIncludes);

Modified: stable/7/usr.bin/make/var.c
==============================================================================
--- stable/7/usr.bin/make/var.c	Mon Mar 23 23:43:07 2009	(r190344)
+++ stable/7/usr.bin/make/var.c	Tue Mar 24 00:07:17 2009	(r190345)
@@ -946,12 +946,14 @@ VarFindAny(const char name[], GNode *ctx
  *	The name and val arguments are duplicated so they may
  *	safely be freed.
  */
-static void
+static Var *
 VarAdd(const char *name, const char *val, GNode *ctxt)
 {
+	Var *v;
 
-	Lst_AtFront(&ctxt->context, VarCreate(name, val, 0));
+	Lst_AtFront(&ctxt->context, v = VarCreate(name, val, 0));
 	DEBUGF(VAR, ("%s:%s = %s\n", ctxt->name, name, val));
+	return (v);
 }
 
 /**
@@ -1004,30 +1006,22 @@ Var_Set(const char *name, const char *va
 	n = VarPossiblyExpand(name, ctxt);
 	v = VarFindOnly(n, ctxt);
 	if (v == NULL) {
-		VarAdd(n, val, ctxt);
-		if (ctxt == VAR_CMD) {
-			/*
-			 * Any variables given on the command line
-			 * are automatically exported to the
-			 * environment (as per POSIX standard)
-			 */
-			setenv(n, val, 1);
-		}
+		v = VarAdd(n, val, ctxt);
 	} else {
 		Buf_Clear(v->val);
 		Buf_Append(v->val, val);
-
-		if (ctxt == VAR_CMD || (v->flags & VAR_TO_ENV)) {
-			/*
-			 * Any variables given on the command line
-			 * are automatically exported to the
-			 * environment (as per POSIX standard)
-			 */
-			setenv(n, val, 1);
-		}
 		DEBUGF(VAR, ("%s:%s = %s\n", ctxt->name, n, val));
 	}
 
+	if (ctxt == VAR_CMD || (v->flags & VAR_TO_ENV)) {
+		/*
+		 * Any variables given on the command line
+		 * are automatically exported to the
+		 * environment (as per POSIX standard)
+		 */
+		setenv(n, val, 1);
+	}
+
 	free(n);
 }
 

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 00:30:07 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 410C2106564A;
	Tue, 24 Mar 2009 00:30:07 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2EA248FC0A;
	Tue, 24 Mar 2009 00:30:07 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O0U7Kn026149;
	Tue, 24 Mar 2009 00:30:07 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O0U74q026148;
	Tue, 24 Mar 2009 00:30:07 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903240030.n2O0U74q026148@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 24 Mar 2009 00:30: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: r190348 - stable/7/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: Tue, 24 Mar 2009 00:30:07 -0000

Author: obrien
Date: Tue Mar 24 00:30:06 2009
New Revision: 190348
URL: http://svn.freebsd.org/changeset/base/190348

Log:
  MFC: r187724 / r187969: unsplit _PATH_SYSPATH & _PATH_STDPATH.

Modified:
  stable/7/include/paths.h

Modified: stable/7/include/paths.h
==============================================================================
--- stable/7/include/paths.h	Tue Mar 24 00:09:35 2009	(r190347)
+++ stable/7/include/paths.h	Tue Mar 24 00:30:06 2009	(r190348)
@@ -42,11 +42,9 @@
 /* Default search path. */
 #define	_PATH_DEFPATH	"/usr/bin:/bin"
 /* All standard utilities path. */
-#define	_PATH_STDPATH \
-	"/usr/bin:/bin:/usr/sbin:/sbin:"
-/* Locate system binaries */
-#define _PATH_SYSPATH	\
-	"/sbin:/usr/sbin"
+#define	_PATH_STDPATH	"/usr/bin:/bin:/usr/sbin:/sbin:"
+/* Locate system binaries. */
+#define	_PATH_SYSPATH	"/sbin:/usr/sbin"
 
 #define	_PATH_AUTHCONF	"/etc/auth.conf"
 #define	_PATH_BSHELL	"/bin/sh"

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 00:34:55 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BC7F0106566B;
	Tue, 24 Mar 2009 00:34:55 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A12218FC28;
	Tue, 24 Mar 2009 00:34:55 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O0YtB4026298;
	Tue, 24 Mar 2009 00:34:55 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O0Ytwe026295;
	Tue, 24 Mar 2009 00:34:55 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903240034.n2O0Ytwe026295@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 24 Mar 2009 00:34: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: r190349 - in stable/7/usr.sbin/crunch: crunchgen
	crunchide
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, 24 Mar 2009 00:34:56 -0000

Author: obrien
Date: Tue Mar 24 00:34:55 2009
New Revision: 190349
URL: http://svn.freebsd.org/changeset/base/190349

Log:
  MFC:
  r173412: Cleanup of userland __P use.
  r187943: Run with -B and just .POSIX.
  r173067: Include  for the right prototype for exit(3).
  r173065: Set the program name if the crunched program is selected
  	 through argv[1] to mimic crt0 behaviour.

Modified:
  stable/7/usr.sbin/crunch/crunchgen/crunched_main.c
  stable/7/usr.sbin/crunch/crunchgen/crunchgen.c
  stable/7/usr.sbin/crunch/crunchide/crunchide.c

Modified: stable/7/usr.sbin/crunch/crunchgen/crunched_main.c
==============================================================================
--- stable/7/usr.sbin/crunch/crunchgen/crunched_main.c	Tue Mar 24 00:30:06 2009	(r190348)
+++ stable/7/usr.sbin/crunch/crunchgen/crunched_main.c	Tue Mar 24 00:34:55 2009	(r190349)
@@ -34,6 +34,7 @@
  *	the crunched binary without creating all the links.
  */
 #include 
+#include 
 #include 
 
 struct stub {
@@ -41,6 +42,7 @@ struct stub {
     int (*f)();
 };
 
+extern char *__progname;
 extern struct stub entry_points[];
 
 int main(int argc, char **argv, char **envp)
@@ -83,12 +85,16 @@ int crunched_here(char *path)
 
 int crunched_main(int argc, char **argv, char **envp)
 {
+    char *slash;
     struct stub *ep;
     int columns, len;
 
     if(argc <= 1)
 	crunched_usage();
 
+    slash = strrchr(argv[1], '/');
+    __progname = slash? slash+1 : argv[1];
+
     return main(--argc, ++argv, envp);
 }
 

Modified: stable/7/usr.sbin/crunch/crunchgen/crunchgen.c
==============================================================================
--- stable/7/usr.sbin/crunch/crunchgen/crunchgen.c	Tue Mar 24 00:30:06 2009	(r190348)
+++ stable/7/usr.sbin/crunch/crunchgen/crunchgen.c	Tue Mar 24 00:34:55 2009	(r190349)
@@ -709,12 +709,13 @@ void fillin_program_objs(prog_t *p, char
 	if (outhdrname[0] != '\0')
 		fprintf(f, ".include \"%s\"\n", outhdrname);
 	fprintf(f, ".include \"%s\"\n", path);
+	fprintf(f, ".POSIX:\n");
 	if (buildopts) {
 		fprintf(f, "BUILDOPTS+=");
 		output_strlst(f, buildopts);
 	}
-	fprintf(f, ".if defined(PROG) && !defined(%s)\n", objvar);
-	fprintf(f, "%s=${PROG}.o\n", objvar);
+	fprintf(f, ".if defined(PROG)\n");
+	fprintf(f, "%s?=${PROG}.o\n", objvar);
 	fprintf(f, ".endif\n");
 	fprintf(f, "loop:\n\t@echo 'OBJS= '${%s}\n", objvar);
 
@@ -727,7 +728,7 @@ void fillin_program_objs(prog_t *p, char
 
 	fclose(f);
 
-	snprintf(line, MAXLINELEN, "cd %s && make -f %s crunchgen_objs",
+	snprintf(line, MAXLINELEN, "cd %s && make -f %s -B crunchgen_objs",
 	    p->srcdir, tempfname);
 	if ((f = popen(line, "r")) == NULL) {
 		warn("submake pipe");

Modified: stable/7/usr.sbin/crunch/crunchide/crunchide.c
==============================================================================
--- stable/7/usr.sbin/crunch/crunchide/crunchide.c	Tue Mar 24 00:30:06 2009	(r190348)
+++ stable/7/usr.sbin/crunch/crunchide/crunchide.c	Tue Mar 24 00:34:55 2009	(r190349)
@@ -87,7 +87,7 @@ int hide_syms(const char *filename);
 
 int verbose;
 
-int main __P((int, char *[]));
+int main(int, char *[]);
 
 int main(argc, argv)
 int argc;

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 00:43:12 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A22721065674;
	Tue, 24 Mar 2009 00:43:12 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8E3A58FC22;
	Tue, 24 Mar 2009 00:43:12 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O0hCaN026547;
	Tue, 24 Mar 2009 00:43:12 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O0hCtb026540;
	Tue, 24 Mar 2009 00:43:12 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903240043.n2O0hCtb026540@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 24 Mar 2009 00:43:12 +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: r190350 - in stable/7/sbin: fsck fsck_ffs
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, 24 Mar 2009 00:43:13 -0000

Author: obrien
Date: Tue Mar 24 00:43:12 2009
New Revision: 190350
URL: http://svn.freebsd.org/changeset/base/190350

Log:
  MFC: r187931: Add the '-C' "check clean" flag.

Modified:
  stable/7/sbin/fsck/fsck.8
  stable/7/sbin/fsck/fsck.c
  stable/7/sbin/fsck/fsutil.h
  stable/7/sbin/fsck_ffs/fsck.h
  stable/7/sbin/fsck_ffs/fsck_ffs.8
  stable/7/sbin/fsck_ffs/main.c
  stable/7/sbin/fsck_ffs/setup.c

Modified: stable/7/sbin/fsck/fsck.8
==============================================================================
--- stable/7/sbin/fsck/fsck.8	Tue Mar 24 00:34:55 2009	(r190349)
+++ stable/7/sbin/fsck/fsck.8	Tue Mar 24 00:43:12 2009	(r190350)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 25, 2001
+.Dd January 25, 2009
 .Dt FSCK 8
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd file system consistency check and interactive repair
 .Sh SYNOPSIS
 .Nm
-.Op Fl dfnpvy
+.Op Fl Cdfnpvy
 .Op Fl B | F
 .Op Fl T Ar fstype : Ns Ar fsoptions
 .Op Fl t Ar fstype
@@ -112,6 +112,11 @@ to be the partition and slice designator
 .Pp
 The options are as follows:
 .Bl -tag -width indent
+.It Fl C
+Check if the
+.Dq clean
+flag is set in the superblock and skip file system checks if file system was
+properly dismounted and marked clean.
 .It Fl d
 Debugging mode.
 Just print the commands without executing them.

Modified: stable/7/sbin/fsck/fsck.c
==============================================================================
--- stable/7/sbin/fsck/fsck.c	Tue Mar 24 00:34:55 2009	(r190349)
+++ stable/7/sbin/fsck/fsck.c	Tue Mar 24 00:43:12 2009	(r190350)
@@ -103,7 +103,7 @@ main(int argc, char *argv[])
 	TAILQ_INIT(&selhead);
 	TAILQ_INIT(&opthead);
 
-	while ((i = getopt(argc, argv, "BdvpfFnyl:t:T:")) != -1)
+	while ((i = getopt(argc, argv, "BCdvpfFnyl:t:T:")) != -1)
 		switch (i) {
 		case 'B':
 			if (flags & CHECK_BACKGRD)
@@ -128,6 +128,9 @@ main(int argc, char *argv[])
 		case 'p':
 			flags |= CHECK_PREEN;
 			/*FALLTHROUGH*/
+		case 'C':
+			flags |= CHECK_CLEAN;
+			/*FALLTHROUGH*/
 		case 'n':
 		case 'y':
 			globopt[1] = i;
@@ -566,7 +569,7 @@ static void
 usage(void)
 {
 	static const char common[] =
-	    "[-dfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]";
+	    "[-Cdfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]";
 
 	(void)fprintf(stderr, "usage: %s %s [special | node] ...\n",
 	    getprogname(), common);

Modified: stable/7/sbin/fsck/fsutil.h
==============================================================================
--- stable/7/sbin/fsck/fsutil.h	Tue Mar 24 00:34:55 2009	(r190349)
+++ stable/7/sbin/fsck/fsutil.h	Tue Mar 24 00:43:12 2009	(r190350)
@@ -48,6 +48,7 @@ char *estrdup(const char *);
 #define	CHECK_DEBUG	0x0004
 #define	CHECK_BACKGRD	0x0008
 #define	DO_BACKGRD	0x0010
+#define	CHECK_CLEAN	0x0020
 
 struct fstab;
 int checkfstab(int, int (*)(struct fstab *), 

Modified: stable/7/sbin/fsck_ffs/fsck.h
==============================================================================
--- stable/7/sbin/fsck_ffs/fsck.h	Tue Mar 24 00:34:55 2009	(r190349)
+++ stable/7/sbin/fsck_ffs/fsck.h	Tue Mar 24 00:43:12 2009	(r190350)
@@ -271,6 +271,7 @@ int	bkgrdflag;		/* use a snapshot to run
 int	bflag;			/* location of alternate super block */
 int	debug;			/* output debugging info */
 char	damagedflag;		/* run in damaged mode */
+char	ckclean;		/* only do work if not cleanly unmounted */
 int	cvtlevel;		/* convert to newer file system format */
 int	bkgrdcheck;		/* determine if background check is possible */
 int	bkgrdsumadj;		/* whether the kernel have ability to adjust superblock summary */

Modified: stable/7/sbin/fsck_ffs/fsck_ffs.8
==============================================================================
--- stable/7/sbin/fsck_ffs/fsck_ffs.8	Tue Mar 24 00:34:55 2009	(r190349)
+++ stable/7/sbin/fsck_ffs/fsck_ffs.8	Tue Mar 24 00:43:12 2009	(r190350)
@@ -29,7 +29,7 @@
 .\"	@(#)fsck.8	8.4 (Berkeley) 5/9/95
 .\" $FreeBSD$
 .\"
-.Dd January 20, 2009
+.Dd January 25, 2009
 .Dt FSCK_FFS 8
 .Os
 .Sh NAME
@@ -46,9 +46,9 @@
 .Ar ...
 .Sh DESCRIPTION
 The specified disk partitions and/or file systems are checked.
-In "preen" mode the clean flag of each file system's superblock is examined
-and only those file systems that
-are not marked clean are checked.
+In "preen" or "check clean" mode the clean flag of each file system's
+superblock is examined and only those file systems that are not marked clean
+are checked.
 File systems are marked clean when they are unmounted,
 when they have been mounted read-only, or when
 .Nm
@@ -175,6 +175,14 @@ Use the block specified immediately afte
 the super block for the file system.
 An alternate super block is usually located at block 32 for UFS1,
 and block 160 for UFS2.
+.It Fl C
+Check if file system was dismouted cleanly.
+If so, skip file system checks (like "preen").
+However, if the file system was not cleanly dismounted, do full checks,
+is if
+.Nm
+was invoked without
+.Fl C .
 .It Fl c
 Convert the file system to the specified level.
 Note that the level of a file system can only be raised.

Modified: stable/7/sbin/fsck_ffs/main.c
==============================================================================
--- stable/7/sbin/fsck_ffs/main.c	Tue Mar 24 00:34:55 2009	(r190349)
+++ stable/7/sbin/fsck_ffs/main.c	Tue Mar 24 00:43:12 2009	(r190350)
@@ -82,7 +82,7 @@ main(int argc, char *argv[])
 	sync();
 	skipclean = 1;
 	damagedflag = 0;
-	while ((ch = getopt(argc, argv, "b:Bc:dDfFm:npy")) != -1) {
+	while ((ch = getopt(argc, argv, "b:Bc:CdDfFm:npy")) != -1) {
 		switch (ch) {
 		case 'b':
 			skipclean = 0;
@@ -132,6 +132,10 @@ main(int argc, char *argv[])
 
 		case 'p':
 			preen++;
+			/*FALLTHROUGH*/
+
+		case 'C':
+			ckclean++;
 			break;
 
 		case 'y':
@@ -151,7 +155,7 @@ main(int argc, char *argv[])
 
 	if (signal(SIGINT, SIG_IGN) != SIG_IGN)
 		(void)signal(SIGINT, catch);
-	if (preen)
+	if (ckclean)
 		(void)signal(SIGQUIT, catchquit);
 	signal(SIGINFO, infohandler);
 	if (bkgrdflag) {
@@ -216,7 +220,7 @@ checkfilesys(char *filesys)
 	errmsg[0] = '\0';
 
 	cdevname = filesys;
-	if (debug && preen)
+	if (debug && ckclean)
 		pwarn("starting\n");
 	/*
 	 * Make best effort to get the disk name. Check first to see
@@ -251,7 +255,7 @@ checkfilesys(char *filesys)
 			exit(7);	/* Filesystem clean, report it now */
 		exit(0);
 	}
-	if (preen && skipclean) {
+	if (ckclean && skipclean) {
 		/*
 		 * If file system is gjournaled, check it here.
 		 */
@@ -302,7 +306,7 @@ checkfilesys(char *filesys)
 					    "CANNOT RUN IN BACKGROUND\n");
 				}
 				if ((sblock.fs_flags & FS_UNCLEAN) == 0 &&
-				    skipclean && preen) {
+				    skipclean && ckclean) {
 					/*
 					 * file system is clean;
 					 * skip snapshot and report it clean

Modified: stable/7/sbin/fsck_ffs/setup.c
==============================================================================
--- stable/7/sbin/fsck_ffs/setup.c	Tue Mar 24 00:34:55 2009	(r190349)
+++ stable/7/sbin/fsck_ffs/setup.c	Tue Mar 24 00:43:12 2009	(r190350)
@@ -65,7 +65,7 @@ static struct disklabel *getdisklabel(ch
 /*
  * Read in a superblock finding an alternate if necessary.
  * Return 1 if successful, 0 if unsuccessful, -1 if file system
- * is already clean (preen mode only).
+ * is already clean (ckclean and preen mode only).
  */
 int
 setup(char *dev)
@@ -201,7 +201,7 @@ setup(char *dev)
 		pwarn("USING ALTERNATE SUPERBLOCK AT %d\n", bflag);
 		bflag = 0;
 	}
-	if (skipclean && preen && sblock.fs_clean) {
+	if (skipclean && ckclean && sblock.fs_clean) {
 		pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n");
 		return (-1);
 	}

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 00:44:30 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EEC48106566B;
	Tue, 24 Mar 2009 00:44:30 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DBFD58FC26;
	Tue, 24 Mar 2009 00:44:30 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O0iUWV026630;
	Tue, 24 Mar 2009 00:44:30 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O0iU62026629;
	Tue, 24 Mar 2009 00:44:30 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903240044.n2O0iU62026629@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 24 Mar 2009 00:44:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190351 - stable/7/gnu/usr.bin/grep
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, 24 Mar 2009 00:44:31 -0000

Author: obrien
Date: Tue Mar 24 00:44:30 2009
New Revision: 190351
URL: http://svn.freebsd.org/changeset/base/190351

Log:
  MFC: r187907: For files not named on the command line, only the basename is
  compared to the exclude pattern.

Modified:
  stable/7/gnu/usr.bin/grep/savedir.c

Modified: stable/7/gnu/usr.bin/grep/savedir.c
==============================================================================
--- stable/7/gnu/usr.bin/grep/savedir.c	Tue Mar 24 00:43:12 2009	(r190350)
+++ stable/7/gnu/usr.bin/grep/savedir.c	Tue Mar 24 00:44:30 2009	(r190351)
@@ -17,6 +17,9 @@
 
 /* Written by David MacKenzie . */
 
+#include 
+__FBSDID("$FreeBSD$");
+
 #if HAVE_CONFIG_H
 # include 
 #endif
@@ -137,10 +140,10 @@ savedir (const char *dir, off_t name_siz
 	      && !isdir1 (dir, dp->d_name))
 	    {
 	      if (included_patterns
-		  && !excluded_filename (included_patterns, dp->d_name, 0))
+		  && !excluded_filename (included_patterns, path, 0))
 		continue;
 	      if (excluded_patterns
-		  && excluded_filename (excluded_patterns, dp->d_name, 0))
+		  && excluded_filename (excluded_patterns, path, 0))
 		continue;
 	    }
 

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 00:46:44 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C327E1065678;
	Tue, 24 Mar 2009 00:46:44 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AD5958FC0A;
	Tue, 24 Mar 2009 00:46:44 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O0kia9026726;
	Tue, 24 Mar 2009 00:46:44 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O0ki43026725;
	Tue, 24 Mar 2009 00:46:44 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903240046.n2O0ki43026725@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 24 Mar 2009 00:46: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: r190352 - stable/7/usr.bin/gprof
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, 24 Mar 2009 00:46:46 -0000

Author: obrien
Date: Tue Mar 24 00:46:44 2009
New Revision: 190352
URL: http://svn.freebsd.org/changeset/base/190352

Log:
  MFC: r187116: If running with "-K" really do not information about symbols
  from the a.out argument.

Modified:
  stable/7/usr.bin/gprof/gprof.c

Modified: stable/7/usr.bin/gprof/gprof.c
==============================================================================
--- stable/7/usr.bin/gprof/gprof.c	Tue Mar 24 00:44:30 2009	(r190351)
+++ stable/7/usr.bin/gprof/gprof.c	Tue Mar 24 00:46:44 2009	(r190352)
@@ -165,7 +165,7 @@ main(argc, argv)
 	 *	get information from the executable file.
 	 */
     if ((Kflag && kernel_getnfile(a_outname, &defaultEs) == -1) ||
-      (elf_getnfile(a_outname, &defaultEs) == -1 &&
+      (!Kflag && elf_getnfile(a_outname, &defaultEs) == -1 &&
       aout_getnfile(a_outname, &defaultEs) == -1))
 	errx(1, "%s: bad format", a_outname);
 	/*

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 01:18:35 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6ABD410656D5;
	Tue, 24 Mar 2009 01:18:35 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5795E8FC24;
	Tue, 24 Mar 2009 01:18:35 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O1IZH5027411;
	Tue, 24 Mar 2009 01:18:35 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O1IZLl027410;
	Tue, 24 Mar 2009 01:18:35 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903240118.n2O1IZLl027410@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 24 Mar 2009 01:18:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190353 - stable/7/tools/tools/usb
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, 24 Mar 2009 01:18:36 -0000

Author: obrien
Date: Tue Mar 24 01:18:35 2009
New Revision: 190353
URL: http://svn.freebsd.org/changeset/base/190353

Log:
  MFC: r187102 / r187107: Update fech URL.

Modified:
  stable/7/tools/tools/usb/   (props changed)
  stable/7/tools/tools/usb/print-usb-if-vids.sh

Modified: stable/7/tools/tools/usb/print-usb-if-vids.sh
==============================================================================
--- stable/7/tools/tools/usb/print-usb-if-vids.sh	Tue Mar 24 00:46:44 2009	(r190352)
+++ stable/7/tools/tools/usb/print-usb-if-vids.sh	Tue Mar 24 01:18:35 2009	(r190353)
@@ -27,5 +27,5 @@
 # $FreeBSD$
 
 
-fetch -o /tmp/usb.if http://www.usb.org/app/pub/dump/comp_dump/
+fetch -o /tmp/usb.if http://www.usb.org/developers/tools/comp_dump/
 awk -F '|' '{ printf "%#06x\t%s\n", $1, $2 }' < /tmp/usb.if | sort

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 01:31:42 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 992501065677;
	Tue, 24 Mar 2009 01:31:42 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 84CA78FC18;
	Tue, 24 Mar 2009 01:31:42 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O1Vgn9027853;
	Tue, 24 Mar 2009 01:31:42 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O1Vgts027851;
	Tue, 24 Mar 2009 01:31:42 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903240131.n2O1Vgts027851@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 24 Mar 2009 01:31:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190355 - stable/7/sbin/mount
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, 24 Mar 2009 01:31:43 -0000

Author: obrien
Date: Tue Mar 24 01:31:42 2009
New Revision: 190355
URL: http://svn.freebsd.org/changeset/base/190355

Log:
  MFC:
  r189397: Add a -o mountprog parameter to mount which explicitly allows an
  	 alternative program to be used for mounting a file system.
  r187035/r187093/r187130: Don't overflow buffers when processing -o options.

Modified:
  stable/7/sbin/mount/   (props changed)
  stable/7/sbin/mount/mount.8
  stable/7/sbin/mount/mount.c

Modified: stable/7/sbin/mount/mount.8
==============================================================================
--- stable/7/sbin/mount/mount.8	Tue Mar 24 01:22:12 2009	(r190354)
+++ stable/7/sbin/mount/mount.8	Tue Mar 24 01:31:42 2009	(r190355)
@@ -28,7 +28,7 @@
 .\"     @(#)mount.8	8.8 (Berkeley) 6/16/94
 .\" $FreeBSD$
 .\"
-.Dd July 12, 2006
+.Dd March 11, 2008
 .Dt MOUNT 8
 .Os
 .Sh NAME
@@ -163,6 +163,15 @@ is run with the
 flag but without the
 .Fl l
 flag.
+.It Cm mountprog Ns = Ns Aq Ar program
+Force
+.Nm
+to use the specified program to mount the file system, instead of calling
+.Xr nmount 2
+directly.  For example:
+.Bd -literal
+mount -t foofs -o mountprog=/mydir/fooprog /dev/acd0 /mnt
+.Ed
 .It Cm multilabel
 Enable multi-label Mandatory Access Control, or MAC, on the specified file
 system.
@@ -335,14 +344,14 @@ For example, the
 .Nm
 command:
 .Bd -literal -offset indent
-mount -t unionfs -o -b /sys $HOME/sys
+mount -t cd9660 -o -e /dev/cd0 /cdrom
 .Ed
 .Pp
 causes
 .Nm
 to execute the equivalent of:
 .Bd -literal -offset indent
-/sbin/mount_unionfs -b /sys $HOME/sys
+/sbin/mount_cd9660 -e /dev/cd0 /cdrom
 .Ed
 .Pp
 Additional options specific to file system types
@@ -510,7 +519,6 @@ support for a particular file system mig
 .Xr mount_nwfs 8 ,
 .Xr mount_portalfs 8 ,
 .Xr mount_smbfs 8 ,
-.Xr mount_std 8 ,
 .Xr mount_udf 8 ,
 .Xr mount_unionfs 8 ,
 .Xr umount 8

Modified: stable/7/sbin/mount/mount.c
==============================================================================
--- stable/7/sbin/mount/mount.c	Tue Mar 24 01:22:12 2009	(r190354)
+++ stable/7/sbin/mount/mount.c	Tue Mar 24 01:31:42 2009	(r190355)
@@ -31,16 +31,14 @@
 static const char copyright[] =
 "@(#) Copyright (c) 1980, 1989, 1993, 1994\n\
 	The Regents of the University of California.  All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
 #if 0
 static char sccsid[] = "@(#)mount.c	8.25 (Berkeley) 5/8/95";
 #endif
-static const char rcsid[] =
-  "$FreeBSD$";
 #endif /* not lint */
 
+#include 
+__FBSDID("$FreeBSD$");
+
 #include 
 #include 
 #include 
@@ -70,12 +68,18 @@ static const char rcsid[] =
 
 int debug, fstab_style, verbose;
 
+struct cpa {
+	char	**a;
+	ssize_t	sz;
+	int	c;
+};
+
 char   *catopt(char *, const char *);
 struct statfs *getmntpt(const char *);
 int	hasopt(const char *, const char *);
 int	ismounted(struct fstab *, struct statfs *, int);
 int	isremountable(const char *);
-void	mangle(char *, int *, char *[]);
+void	mangle(char *, struct cpa *);
 char   *update_options(char *, char *, int);
 int	mountfs(const char *, const char *, const char *,
 			int, const char *, const char *);
@@ -125,6 +129,8 @@ remountable_fs_names[] = {
 static const char userquotaeq[] = "userquota=";
 static const char groupquotaeq[] = "groupquota=";
 
+static char *mountprog = NULL;
+
 static int
 use_mountprog(const char *vfstype)
 {
@@ -139,11 +145,14 @@ use_mountprog(const char *vfstype)
 	NULL
 	};
 
+	if (mountprog != NULL)
+		return (1);
+
 	for (i = 0; fs[i] != NULL; ++i) {
 		if (strcmp(vfstype, fs[i]) == 0)
 			return (1);
 	}
-	
+
 	return (0);
 }
 
@@ -161,8 +170,10 @@ exec_mountprog(const char *name, const c
 		/* Go find an executable. */
 		execvP(execname, _PATH_SYSPATH, argv);
 		if (errno == ENOENT) {
-			warn("exec %s not found in %s", execname,
-			    _PATH_SYSPATH);
+			warn("exec %s not found", execname);
+			if (execname[0] != '/') {
+				warnx("in path: %s", _PATH_SYSPATH);
+			}
 		}
 		exit(1);
 	default:				/* Parent. */
@@ -208,7 +219,7 @@ static void
 restart_mountd(void)
 {
 	struct pidfh *pfh;
-	pid_t mountdpid; 
+	pid_t mountdpid;
 
 	pfh = pidfile_open(_PATH_MOUNTDPID, 0600, &mountdpid);
 	if (pfh != NULL) {
@@ -300,7 +311,7 @@ main(int argc, char *argv[])
 
 	if ((init_flags & MNT_UPDATE) && (ro == 0))
 		options = catopt(options, "noro");
- 
+
 	rval = 0;
 	switch (argc) {
 	case 0:
@@ -497,14 +508,26 @@ hasopt(const char *mntopts, const char *
 	return (found);
 }
 
+static void
+append_arg(struct cpa *sa, char *arg)
+{
+	if (sa->c + 1 == sa->sz) {
+		sa->sz = sa->sz == 0 ? 8 : sa->sz * 2;
+		sa->a = realloc(sa->a, sizeof(sa->a) * sa->sz);
+		if (sa->a == NULL)
+			errx(1, "realloc failed");
+	}
+	sa->a[++sa->c] = arg;
+}
+
 int
 mountfs(const char *vfstype, const char *spec, const char *name, int flags,
 	const char *options, const char *mntopts)
 {
-	char *argv[100];
 	struct statfs sf;
-	int argc, i, ret;
+	int i, ret;
 	char *optbuf, execname[PATH_MAX], mntpath[PATH_MAX];
+	static struct cpa mnt_argv;
 
 	/* resolve the mountpoint with realpath(3) */
 	(void)checkpath(name, mntpath);
@@ -539,28 +562,31 @@ mountfs(const char *vfstype, const char 
 	/* Construct the name of the appropriate mount command */
 	(void)snprintf(execname, sizeof(execname), "mount_%s", vfstype);
 
-	argc = 0;
-	argv[argc++] = execname;
-	mangle(optbuf, &argc, argv);
-	argv[argc++] = strdup(spec);
-	argv[argc++] = strdup(name);
-	argv[argc] = NULL;
+	mnt_argv.c = -1;
+	append_arg(&mnt_argv, execname);
+	mangle(optbuf, &mnt_argv);
+	if (mountprog != NULL)
+		strcpy(execname, mountprog);
+
+	append_arg(&mnt_argv, strdup(spec));
+	append_arg(&mnt_argv, strdup(name));
+	append_arg(&mnt_argv, NULL);
 
 	if (debug) {
 		if (use_mountprog(vfstype))
-			printf("exec: mount_%s", vfstype);
+			printf("exec: %s", execname);
 		else
 			printf("mount -t %s", vfstype);
-		for (i = 1; i < argc; i++)
-			(void)printf(" %s", argv[i]);
+		for (i = 1; i < mnt_argv.c; i++)
+			(void)printf(" %s", mnt_argv.a[i]);
 		(void)printf("\n");
 		return (0);
 	}
 
 	if (use_mountprog(vfstype)) {
-		ret = exec_mountprog(name, execname, argv);
+		ret = exec_mountprog(name, execname, mnt_argv.a);
 	} else {
-		ret = mount_fs(vfstype, argc, argv); 
+		ret = mount_fs(vfstype, mnt_argv.c, mnt_argv.a);
 	}
 
 	free(optbuf);
@@ -663,12 +689,10 @@ catopt(char *s0, const char *s1)
 }
 
 void
-mangle(char *options, int *argcp, char *argv[])
+mangle(char *options, struct cpa *a)
 {
-	char *p, *s;
-	int argc;
+	char *p, *s, *val;
 
-	argc = *argcp;
 	for (s = options; (p = strsep(&s, ",")) != NULL;)
 		if (*p != '\0') {
 			if (strcmp(p, "noauto") == 0) {
@@ -689,6 +713,22 @@ mangle(char *options, int *argcp, char *
 				 * before mountd starts.
 				 */
 				continue;
+			} else if (strncmp(p, "mountprog", 9) == 0) {
+				/*
+				 * "mountprog" is used to force the use of
+				 * userland mount programs.
+				 */
+				val = strchr(p, '=');
+                        	if (val != NULL) {
+                                	++val;
+					if (*val != '\0')
+						mountprog = strdup(val);
+				}
+
+				if (mountprog == NULL) {
+					errx(1, "Need value for -o mountprog");
+				}
+				continue;
 			} else if (strcmp(p, "userquota") == 0) {
 				continue;
 			} else if (strncmp(p, userquotaeq,
@@ -700,19 +740,17 @@ mangle(char *options, int *argcp, char *
 			    sizeof(groupquotaeq) - 1) == 0) {
 				continue;
 			} else if (*p == '-') {
-				argv[argc++] = p;
+				append_arg(a, p);
 				p = strchr(p, '=');
 				if (p != NULL) {
 					*p = '\0';
-					argv[argc++] = p+1;
+					append_arg(a, p + 1);
 				}
 			} else {
-				argv[argc++] = strdup("-o");
-				argv[argc++] = p;
+				append_arg(a, strdup("-o"));
+				append_arg(a, p);
 			}
 		}
-
-	*argcp = argc;
 }
 
 

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 01:35:59 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4315C106566C;
	Tue, 24 Mar 2009 01:35:59 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 261178FC0A;
	Tue, 24 Mar 2009 01:35:59 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O1Zxcn028001;
	Tue, 24 Mar 2009 01:35:59 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O1ZxP4027999;
	Tue, 24 Mar 2009 01:35:59 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903240135.n2O1ZxP4027999@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 24 Mar 2009 01:35: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: r190356 - stable/7/usr.sbin/burncd
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, 24 Mar 2009 01:35:59 -0000

Author: obrien
Date: Tue Mar 24 01:35:58 2009
New Revision: 190356
URL: http://svn.freebsd.org/changeset/base/190356

Log:
  MFC: r186337/r186444/186784: burncd(8) doesn't handle signals and interrupting
  burncd during operation.  Add signal handling by doing a CDRIOCFLUSH ioctl
  to attempt to leave burner in a sane state when burning is interrupted with
  SIGHUP, SIGINT, SIGTERM, or in case an I/O error occurs during write.

Modified:
  stable/7/usr.sbin/burncd/   (props changed)
  stable/7/usr.sbin/burncd/Makefile
  stable/7/usr.sbin/burncd/burncd.c

Modified: stable/7/usr.sbin/burncd/Makefile
==============================================================================
--- stable/7/usr.sbin/burncd/Makefile	Tue Mar 24 01:31:42 2009	(r190355)
+++ stable/7/usr.sbin/burncd/Makefile	Tue Mar 24 01:35:58 2009	(r190356)
@@ -3,6 +3,6 @@
 PROG=	burncd
 MAN=	burncd.8
 
-WARNS?=	5
+WARNS?=	6
 
 .include 

Modified: stable/7/usr.sbin/burncd/burncd.c
==============================================================================
--- stable/7/usr.sbin/burncd/burncd.c	Tue Mar 24 01:31:42 2009	(r190355)
+++ stable/7/usr.sbin/burncd/burncd.c	Tue Mar 24 01:35:58 2009	(r190356)
@@ -29,6 +29,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -57,7 +58,8 @@ struct track_info {
 	int	addr;
 };
 static struct track_info tracks[100];
-static int global_fd_for_cleanup, quiet, verbose, saved_block_size, notracks;
+static int quiet, verbose, saved_block_size, notracks;
+static volatile sig_atomic_t global_fd_for_cleanup;
 
 void add_track(char *, int, int, int);
 void do_DAO(int fd, int, int);
@@ -67,6 +69,8 @@ int write_file(int fd, struct track_info
 int roundup_blocks(struct track_info *);
 void cue_ent(struct cdr_cue_entry *, int, int, int, int, int, int, int);
 void cleanup(int);
+void cleanup_flush(void);
+void cleanup_signal(int);
 void usage(void);
 
 int
@@ -157,6 +161,9 @@ main(int argc, char **argv)
 
 	global_fd_for_cleanup = fd;
 	err_set_exit(cleanup);
+	signal(SIGHUP, cleanup_signal);
+	signal(SIGINT, cleanup_signal);
+	signal(SIGTERM, cleanup_signal);
 
 	for (arg = 0; arg < argc; arg++) {
 		if (!strcasecmp(argv[arg], "fixate")) {
@@ -319,6 +326,10 @@ main(int argc, char **argv)
 	if (eject)
 		if (ioctl(fd, CDIOCEJECT) < 0)
 			err(EX_IOERR, "ioctl(CDIOCEJECT)");
+
+	signal(SIGHUP, SIG_DFL);
+	signal(SIGINT, SIG_DFL);
+	signal(SIGTERM, SIG_DFL);
 	close(fd);
 	exit(EX_OK);
 }
@@ -469,8 +480,10 @@ do_DAO(int fd, int test_write, int multi
 		err(EX_IOERR, "ioctl(CDRIOCSENDCUE)");
 
 	for (i = 0; i < notracks; i++) {
-		if (write_file(fd, &tracks[i]))
+		if (write_file(fd, &tracks[i])) {
+			cleanup_flush();
 			err(EX_IOERR, "write_file");
+		}
 	}
 
 	ioctl(fd, CDRIOCFLUSH);
@@ -499,8 +512,10 @@ do_TAO(int fd, int test_write, int preem
 		if (!quiet)
 			fprintf(stderr, "next writeable LBA %d\n",
 				tracks[i].addr);
-		if (write_file(fd, &tracks[i]))
+		if (write_file(fd, &tracks[i])) {
+			cleanup_flush();
 			err(EX_IOERR, "write_file");
+		}
 		if (ioctl(fd, CDRIOCFLUSH) < 0)
 			err(EX_IOERR, "ioctl(CDRIOCFLUSH)");
 	}
@@ -630,9 +645,11 @@ write_file(int fd, struct track_info *tr
 				track_info->block_size;
 		}
 		if ((res = write(fd, buf, count)) != count) {
-			if (res == -1)
-				fprintf(stderr, "\n%s\n", strerror(errno));
-			else
+			if (res == -1) {
+				fprintf(stderr, "\n");
+				close(track_info->file);
+				return errno;
+			} else
 				fprintf(stderr, "\nonly wrote %d of %jd"
 				    " bytes\n", res, (intmax_t)count);
 			break;
@@ -693,6 +710,22 @@ cleanup(int dummy __unused)
 }
 
 void
+cleanup_flush(void)
+{
+	if (ioctl(global_fd_for_cleanup, CDRIOCFLUSH) < 0)
+		err(EX_IOERR, "ioctl(CDRIOCFLUSH)");
+}
+
+void
+cleanup_signal(int sig)
+{
+	signal(sig, SIG_IGN);
+	ioctl(global_fd_for_cleanup, CDRIOCFLUSH);
+	write(STDERR_FILENO, "\nAborted\n", 10);
+	_exit(EXIT_FAILURE);
+}
+
+void
 usage(void)
 {
 	fprintf(stderr,

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 01:51:42 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D29101065670;
	Tue, 24 Mar 2009 01:51:42 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BC25D8FC0C;
	Tue, 24 Mar 2009 01:51:42 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O1pgEG028703;
	Tue, 24 Mar 2009 01:51:42 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O1pgT0028693;
	Tue, 24 Mar 2009 01:51:42 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903240151.n2O1pgT0028693@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 24 Mar 2009 01:51:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190357 - in stable/7: gnu/usr.bin/grep include
	lib/libelf sbin/fsck sbin/fsck_ffs sbin/mount usr.bin/gprof
	usr.bin/make usr.sbin/crunch usr.sbin/sade usr.sbin/sysinstall
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, 24 Mar 2009 01:51:43 -0000

Author: obrien
Date: Tue Mar 24 01:51:42 2009
New Revision: 190357
URL: http://svn.freebsd.org/changeset/base/190357

Log:
  MFC: r186581: Sound less scary about errorousous disk geometry.

Modified:
  stable/7/gnu/usr.bin/grep/   (props changed)
  stable/7/include/   (props changed)
  stable/7/lib/libelf/   (props changed)
  stable/7/sbin/fsck/   (props changed)
  stable/7/sbin/fsck/fsck.8
  stable/7/sbin/fsck/fsck.c
  stable/7/sbin/fsck/fsutil.h
  stable/7/sbin/fsck_ffs/   (props changed)
  stable/7/sbin/fsck_ffs/fsck.h
  stable/7/sbin/fsck_ffs/fsck_ffs.8
  stable/7/sbin/fsck_ffs/main.c
  stable/7/sbin/fsck_ffs/setup.c
  stable/7/sbin/mount/   (props changed)
  stable/7/usr.bin/gprof/   (props changed)
  stable/7/usr.bin/make/   (props changed)
  stable/7/usr.sbin/crunch/   (props changed)
  stable/7/usr.sbin/sade/   (props changed)
  stable/7/usr.sbin/sade/disks.c
  stable/7/usr.sbin/sysinstall/   (props changed)
  stable/7/usr.sbin/sysinstall/disks.c
  stable/7/usr.sbin/sysinstall/sysinstall.8

Modified: stable/7/sbin/fsck/fsck.8
==============================================================================
--- stable/7/sbin/fsck/fsck.8	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/sbin/fsck/fsck.8	Tue Mar 24 01:51:42 2009	(r190357)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 25, 2009
+.Dd April 25, 2001
 .Dt FSCK 8
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd file system consistency check and interactive repair
 .Sh SYNOPSIS
 .Nm
-.Op Fl Cdfnpvy
+.Op Fl dfnpvy
 .Op Fl B | F
 .Op Fl T Ar fstype : Ns Ar fsoptions
 .Op Fl t Ar fstype
@@ -112,11 +112,6 @@ to be the partition and slice designator
 .Pp
 The options are as follows:
 .Bl -tag -width indent
-.It Fl C
-Check if the
-.Dq clean
-flag is set in the superblock and skip file system checks if file system was
-properly dismounted and marked clean.
 .It Fl d
 Debugging mode.
 Just print the commands without executing them.

Modified: stable/7/sbin/fsck/fsck.c
==============================================================================
--- stable/7/sbin/fsck/fsck.c	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/sbin/fsck/fsck.c	Tue Mar 24 01:51:42 2009	(r190357)
@@ -103,7 +103,7 @@ main(int argc, char *argv[])
 	TAILQ_INIT(&selhead);
 	TAILQ_INIT(&opthead);
 
-	while ((i = getopt(argc, argv, "BCdvpfFnyl:t:T:")) != -1)
+	while ((i = getopt(argc, argv, "BdvpfFnyl:t:T:")) != -1)
 		switch (i) {
 		case 'B':
 			if (flags & CHECK_BACKGRD)
@@ -128,9 +128,6 @@ main(int argc, char *argv[])
 		case 'p':
 			flags |= CHECK_PREEN;
 			/*FALLTHROUGH*/
-		case 'C':
-			flags |= CHECK_CLEAN;
-			/*FALLTHROUGH*/
 		case 'n':
 		case 'y':
 			globopt[1] = i;
@@ -569,7 +566,7 @@ static void
 usage(void)
 {
 	static const char common[] =
-	    "[-Cdfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]";
+	    "[-dfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]";
 
 	(void)fprintf(stderr, "usage: %s %s [special | node] ...\n",
 	    getprogname(), common);

Modified: stable/7/sbin/fsck/fsutil.h
==============================================================================
--- stable/7/sbin/fsck/fsutil.h	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/sbin/fsck/fsutil.h	Tue Mar 24 01:51:42 2009	(r190357)
@@ -48,7 +48,6 @@ char *estrdup(const char *);
 #define	CHECK_DEBUG	0x0004
 #define	CHECK_BACKGRD	0x0008
 #define	DO_BACKGRD	0x0010
-#define	CHECK_CLEAN	0x0020
 
 struct fstab;
 int checkfstab(int, int (*)(struct fstab *), 

Modified: stable/7/sbin/fsck_ffs/fsck.h
==============================================================================
--- stable/7/sbin/fsck_ffs/fsck.h	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/sbin/fsck_ffs/fsck.h	Tue Mar 24 01:51:42 2009	(r190357)
@@ -271,7 +271,6 @@ int	bkgrdflag;		/* use a snapshot to run
 int	bflag;			/* location of alternate super block */
 int	debug;			/* output debugging info */
 char	damagedflag;		/* run in damaged mode */
-char	ckclean;		/* only do work if not cleanly unmounted */
 int	cvtlevel;		/* convert to newer file system format */
 int	bkgrdcheck;		/* determine if background check is possible */
 int	bkgrdsumadj;		/* whether the kernel have ability to adjust superblock summary */

Modified: stable/7/sbin/fsck_ffs/fsck_ffs.8
==============================================================================
--- stable/7/sbin/fsck_ffs/fsck_ffs.8	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/sbin/fsck_ffs/fsck_ffs.8	Tue Mar 24 01:51:42 2009	(r190357)
@@ -29,7 +29,7 @@
 .\"	@(#)fsck.8	8.4 (Berkeley) 5/9/95
 .\" $FreeBSD$
 .\"
-.Dd January 25, 2009
+.Dd January 20, 2009
 .Dt FSCK_FFS 8
 .Os
 .Sh NAME
@@ -46,9 +46,9 @@
 .Ar ...
 .Sh DESCRIPTION
 The specified disk partitions and/or file systems are checked.
-In "preen" or "check clean" mode the clean flag of each file system's
-superblock is examined and only those file systems that are not marked clean
-are checked.
+In "preen" mode the clean flag of each file system's superblock is examined
+and only those file systems that
+are not marked clean are checked.
 File systems are marked clean when they are unmounted,
 when they have been mounted read-only, or when
 .Nm
@@ -175,14 +175,6 @@ Use the block specified immediately afte
 the super block for the file system.
 An alternate super block is usually located at block 32 for UFS1,
 and block 160 for UFS2.
-.It Fl C
-Check if file system was dismouted cleanly.
-If so, skip file system checks (like "preen").
-However, if the file system was not cleanly dismounted, do full checks,
-is if
-.Nm
-was invoked without
-.Fl C .
 .It Fl c
 Convert the file system to the specified level.
 Note that the level of a file system can only be raised.

Modified: stable/7/sbin/fsck_ffs/main.c
==============================================================================
--- stable/7/sbin/fsck_ffs/main.c	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/sbin/fsck_ffs/main.c	Tue Mar 24 01:51:42 2009	(r190357)
@@ -82,7 +82,7 @@ main(int argc, char *argv[])
 	sync();
 	skipclean = 1;
 	damagedflag = 0;
-	while ((ch = getopt(argc, argv, "b:Bc:CdDfFm:npy")) != -1) {
+	while ((ch = getopt(argc, argv, "b:Bc:dDfFm:npy")) != -1) {
 		switch (ch) {
 		case 'b':
 			skipclean = 0;
@@ -132,10 +132,6 @@ main(int argc, char *argv[])
 
 		case 'p':
 			preen++;
-			/*FALLTHROUGH*/
-
-		case 'C':
-			ckclean++;
 			break;
 
 		case 'y':
@@ -155,7 +151,7 @@ main(int argc, char *argv[])
 
 	if (signal(SIGINT, SIG_IGN) != SIG_IGN)
 		(void)signal(SIGINT, catch);
-	if (ckclean)
+	if (preen)
 		(void)signal(SIGQUIT, catchquit);
 	signal(SIGINFO, infohandler);
 	if (bkgrdflag) {
@@ -220,7 +216,7 @@ checkfilesys(char *filesys)
 	errmsg[0] = '\0';
 
 	cdevname = filesys;
-	if (debug && ckclean)
+	if (debug && preen)
 		pwarn("starting\n");
 	/*
 	 * Make best effort to get the disk name. Check first to see
@@ -255,7 +251,7 @@ checkfilesys(char *filesys)
 			exit(7);	/* Filesystem clean, report it now */
 		exit(0);
 	}
-	if (ckclean && skipclean) {
+	if (preen && skipclean) {
 		/*
 		 * If file system is gjournaled, check it here.
 		 */
@@ -306,7 +302,7 @@ checkfilesys(char *filesys)
 					    "CANNOT RUN IN BACKGROUND\n");
 				}
 				if ((sblock.fs_flags & FS_UNCLEAN) == 0 &&
-				    skipclean && ckclean) {
+				    skipclean && preen) {
 					/*
 					 * file system is clean;
 					 * skip snapshot and report it clean

Modified: stable/7/sbin/fsck_ffs/setup.c
==============================================================================
--- stable/7/sbin/fsck_ffs/setup.c	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/sbin/fsck_ffs/setup.c	Tue Mar 24 01:51:42 2009	(r190357)
@@ -65,7 +65,7 @@ static struct disklabel *getdisklabel(ch
 /*
  * Read in a superblock finding an alternate if necessary.
  * Return 1 if successful, 0 if unsuccessful, -1 if file system
- * is already clean (ckclean and preen mode only).
+ * is already clean (preen mode only).
  */
 int
 setup(char *dev)
@@ -201,7 +201,7 @@ setup(char *dev)
 		pwarn("USING ALTERNATE SUPERBLOCK AT %d\n", bflag);
 		bflag = 0;
 	}
-	if (skipclean && ckclean && sblock.fs_clean) {
+	if (skipclean && preen && sblock.fs_clean) {
 		pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n");
 		return (-1);
 	}

Modified: stable/7/usr.sbin/sade/disks.c
==============================================================================
--- stable/7/usr.sbin/sade/disks.c	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/usr.sbin/sade/disks.c	Tue Mar 24 01:51:42 2009	(r190357)
@@ -103,6 +103,47 @@ record_chunks(Disk *d)
 static daddr_t Total;
 
 static void
+check_geometry(Disk *d)
+{
+    int sg;
+
+#ifdef PC98
+    if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256)
+#else
+    if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64)
+#endif
+    {
+	dialog_clear_norefresh();
+	sg = msgYesNo("WARNING:  It is safe to use a geometry of %lu/%lu/%lu for %s on\n"
+		      "computers with modern BIOS versions.  If this disk is to be used\n"
+		      "on rather old machines, however, it is recommended to ensure that\n"
+		      "it does not have more than 65535 cylinders, or more than 255 heads\n"
+		      "or more than "
+#ifdef PC98
+		      "255"
+#else
+		      "63"
+#endif
+		      " sectors per track.\n"
+		      "\n"
+		      "Would you like that to keep using the current geometry?\n",
+		      d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
+	if (sg == 1) {
+	    Sanitize_Bios_Geom(d);
+	    msgConfirm("A geometry of %lu/%lu/%lu was calculated for %s.\n"
+		       "\n"
+		       "If you are not sure about this, please consult the Hardware Guide\n"
+		       "in the Documentation submenu or use the (G)eometry command to\n"
+		       "change it.  Remember: you need to enter whatever your BIOS thinks\n"
+		       "the geometry is!  For IDE, it's what you were told in the BIOS\n"
+		       "setup.  For SCSI, it's the translation mode your controller is\n"
+		       "using.  Do NOT use a ``physical geometry''.\n",
+		       d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
+	}
+    }
+}
+
+static void
 print_chunks(Disk *d, int u)
 {
     int row;
@@ -116,26 +157,6 @@ print_chunks(Disk *d, int u)
     Total = 0;
     for (i = 0; chunk_info[i]; i++)
 	Total += chunk_info[i]->size;
-#ifdef PC98
-    if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256) {
-#else
-    if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
-#endif
-	dialog_clear_norefresh();
-	msgConfirm("WARNING:  A geometry of %lu/%lu/%lu for %s is incorrect.  Using\n"
-		   "a more likely geometry.  If this geometry is incorrect or you\n"
-		   "are unsure as to whether or not it's correct, please consult\n"
-		   "the Hardware Guide in the Documentation submenu or use the\n"
-		   "(G)eometry command to change it now.\n\n"
-		   "Remember: you need to enter whatever your BIOS thinks the\n"
-		   "geometry is!  For IDE, it's what you were told in the BIOS\n"
-		   "setup. For SCSI, it's the translation mode your controller is\n"
-		   "using.  Do NOT use a ``physical geometry''.",
-	  d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
-	Sanitize_Bios_Geom(d);
-	msgDebug("Sanitized geometry for %s is %lu/%lu/%lu.\n",
-	    d->name, d->bios_cyl, d->bios_hd, d->bios_sect);
-    }
     attrset(A_NORMAL);
     mvaddstr(0, 0, "Disk name:\t");
     clrtobot();
@@ -339,6 +360,9 @@ diskPartition(Device *dev)
     /* Set up the chunk array */
     record_chunks(d);
 
+    /* Give the user a chance to sanitize the disk geometry, if necessary */
+    check_geometry(d);
+
     while (chunking) {
 	char *val, geometry[80];
 	    
@@ -909,22 +933,25 @@ diskPartitionNonInteractive(Device *dev)
     record_chunks(d);
     cp = variable_get(VAR_GEOMETRY);
     if (cp) {
-	msgDebug("Setting geometry from script to: %s\n", cp);
-	d->bios_cyl = strtol(cp, &cp, 0);
-	d->bios_hd = strtol(cp + 1, &cp, 0);
-	d->bios_sect = strtol(cp + 1, 0, 0);
-    }
-
+	if (!strcasecmp(cp, "sane")) {
 #ifdef PC98
-    if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256) {
+	    if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256)
 #else
-    if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
+	    if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64)
 #endif
-	msgDebug("Warning:  A geometry of %lu/%lu/%lu for %s is incorrect.\n",
-	    d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
-	Sanitize_Bios_Geom(d);
-	msgDebug("Sanitized geometry for %s is %lu/%lu/%lu.\n",
-	    d->name, d->bios_cyl, d->bios_hd, d->bios_sect);
+	    {
+		msgDebug("Warning:  A geometry of %lu/%lu/%lu for %s is incorrect.\n",
+		    d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
+		Sanitize_Bios_Geom(d);
+		msgDebug("Sanitized geometry for %s is %lu/%lu/%lu.\n",
+		    d->name, d->bios_cyl, d->bios_hd, d->bios_sect);
+	    }
+	} else {
+	    msgDebug("Setting geometry from script to: %s\n", cp);
+	    d->bios_cyl = strtol(cp, &cp, 0);
+	    d->bios_hd = strtol(cp + 1, &cp, 0);
+	    d->bios_sect = strtol(cp + 1, 0, 0);
+	}
     }
 
     cp = variable_get(VAR_PARTITION);

Modified: stable/7/usr.sbin/sysinstall/disks.c
==============================================================================
--- stable/7/usr.sbin/sysinstall/disks.c	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/usr.sbin/sysinstall/disks.c	Tue Mar 24 01:51:42 2009	(r190357)
@@ -106,6 +106,47 @@ record_chunks(Disk *d)
 static daddr_t Total;
 
 static void
+check_geometry(Disk *d)
+{
+    int sg;
+
+#ifdef PC98
+    if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256)
+#else
+    if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64)
+#endif
+    {
+	dialog_clear_norefresh();
+	sg = msgYesNo("WARNING:  It is safe to use a geometry of %lu/%lu/%lu for %s on\n"
+		      "computers with modern BIOS versions.  If this disk is to be used\n"
+		      "on rather old machines, however, it is recommended to ensure that\n"
+		      "it does not have more than 65535 cylinders, or more than 255 heads\n"
+		      "or more than "
+#ifdef PC98
+		      "255"
+#else
+		      "63"
+#endif
+		      " sectors per track.\n"
+		      "\n"
+		      "Would you like that to keep using the current geometry?\n",
+		      d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
+	if (sg == 1) {
+	    Sanitize_Bios_Geom(d);
+	    msgConfirm("A geometry of %lu/%lu/%lu was calculated for %s.\n"
+		       "\n"
+		       "If you are not sure about this, please consult the Hardware Guide\n"
+		       "in the Documentation submenu or use the (G)eometry command to\n"
+		       "change it.  Remember: you need to enter whatever your BIOS thinks\n"
+		       "the geometry is!  For IDE, it's what you were told in the BIOS\n"
+		       "setup.  For SCSI, it's the translation mode your controller is\n"
+		       "using.  Do NOT use a ``physical geometry''.\n",
+		       d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
+	}
+    }
+}
+
+static void
 print_chunks(Disk *d, int u)
 {
     int row;
@@ -119,24 +160,6 @@ print_chunks(Disk *d, int u)
     Total = 0;
     for (i = 0; chunk_info[i]; i++)
 	Total += chunk_info[i]->size;
-#ifdef PC98
-    if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256) {
-#else
-    if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
-#endif
-	dialog_clear_norefresh();
-	msgConfirm("WARNING:  A geometry of %lu/%lu/%lu for %s is incorrect.  Using\n"
-		   "a more likely geometry.  If this geometry is incorrect or you\n"
-		   "are unsure as to whether or not it's correct, please consult\n"
-		   "the Hardware Guide in the Documentation submenu or use the\n"
-		   "(G)eometry command to change it now.\n\n"
-		   "Remember: you need to enter whatever your BIOS thinks the\n"
-		   "geometry is!  For IDE, it's what you were told in the BIOS\n"
-		   "setup. For SCSI, it's the translation mode your controller is\n"
-		   "using.  Do NOT use a ``physical geometry''.",
-	  d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
-	Sanitize_Bios_Geom(d);
-    }
     attrset(A_NORMAL);
     mvaddstr(0, 0, "Disk name:\t");
     clrtobot();
@@ -341,6 +364,9 @@ diskPartition(Device *dev)
     /* Set up the chunk array */
     record_chunks(d);
 
+    /* Give the user a chance to sanitize the disk geometry, if necessary */
+    check_geometry(d);
+
     while (chunking) {
 	char *val, geometry[80];
 	    
@@ -916,21 +942,24 @@ diskPartitionNonInteractive(Device *dev)
     record_chunks(d);
     cp = variable_get(VAR_GEOMETRY);
     if (cp) {
-	msgDebug("Setting geometry from script to: %s\n", cp);
-	d->bios_cyl = strtol(cp, &cp, 0);
-	d->bios_hd = strtol(cp + 1, &cp, 0);
-	d->bios_sect = strtol(cp + 1, 0, 0);
-    } else {
+	if (!strcasecmp(cp, "sane")) {
 #ifdef PC98
-	if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256) {
+	    if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256)
 #else
-	if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
+	    if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64)
 #endif
-	    msgDebug("Warning:  A geometry of %lu/%lu/%lu for %s is incorrect.\n",
-		d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
-	    Sanitize_Bios_Geom(d);
-	    msgDebug("Sanitized geometry for %s is %lu/%lu/%lu.\n",
-		d->name, d->bios_cyl, d->bios_hd, d->bios_sect);
+	    {
+		msgDebug("Warning:  A geometry of %lu/%lu/%lu for %s is incorrect.\n",
+		    d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
+		Sanitize_Bios_Geom(d);
+		msgDebug("Sanitized geometry for %s is %lu/%lu/%lu.\n",
+		    d->name, d->bios_cyl, d->bios_hd, d->bios_sect);
+	    }
+	} else {
+	    msgDebug("Setting geometry from script to: %s\n", cp);
+	    d->bios_cyl = strtol(cp, &cp, 0);
+	    d->bios_hd = strtol(cp + 1, &cp, 0);
+	    d->bios_sect = strtol(cp + 1, 0, 0);
 	}
     }
 

Modified: stable/7/usr.sbin/sysinstall/sysinstall.8
==============================================================================
--- stable/7/usr.sbin/sysinstall/sysinstall.8	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/usr.sbin/sysinstall/sysinstall.8	Tue Mar 24 01:51:42 2009	(r190357)
@@ -249,6 +249,12 @@ Invokes the disk partition (MBR) editor.
 .Bl -tag -width findx
 .It geometry
 The disk geometry, as a cyls/heads/sectors formatted string.
+The word "sane" instructs
+.Nm
+to calculate a safe (not necessarily optimal) geometry if the
+current one has more than 65535 cylinders, more than 256 heads or
+more than 63 sectors per track (255 sectors on the PC98
+architecture).
 Default: no
 change to geometry.
 .It partition

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 01:54:17 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D1661106566B;
	Tue, 24 Mar 2009 01:54:17 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BCFA48FC0C;
	Tue, 24 Mar 2009 01:54:17 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O1sHFj028847;
	Tue, 24 Mar 2009 01:54:17 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O1sHqE028846;
	Tue, 24 Mar 2009 01:54:17 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903240154.n2O1sHqE028846@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 24 Mar 2009 01:54: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: r190358 - stable/7/sbin/mount
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, 24 Mar 2009 01:54:18 -0000

Author: obrien
Date: Tue Mar 24 01:54:17 2009
New Revision: 190358
URL: http://svn.freebsd.org/changeset/base/190358

Log:
  MFC: 186291: Use strlcpy().

Modified:
  stable/7/sbin/mount/   (props changed)
  stable/7/sbin/mount/mount_fs.c   (contents, props changed)

Modified: stable/7/sbin/mount/mount_fs.c
==============================================================================
--- stable/7/sbin/mount/mount_fs.c	Tue Mar 24 01:51:42 2009	(r190357)
+++ stable/7/sbin/mount/mount_fs.c	Tue Mar 24 01:54:17 2009	(r190358)
@@ -88,7 +88,7 @@ mount_fs(const char *vfstype, int argc, 
 	char *p, *val;
 	int ret;
 
-	strncpy(fstype, vfstype, sizeof(fstype));
+	strlcpy(fstype, vfstype, sizeof(fstype));
 	memset(errmsg, 0, sizeof(errmsg));
 
 	getmnt_silent = 1;

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 01:56:16 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 99467106566B;
	Tue, 24 Mar 2009 01:56:16 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 85AC18FC18;
	Tue, 24 Mar 2009 01:56:16 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O1uGMs028960;
	Tue, 24 Mar 2009 01:56:16 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O1uGXF028958;
	Tue, 24 Mar 2009 01:56:16 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903240156.n2O1uGXF028958@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 24 Mar 2009 01:56:16 +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: r190359 - stable/7/usr.sbin/syslogd
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, 24 Mar 2009 01:56:17 -0000

Author: obrien
Date: Tue Mar 24 01:56:16 2009
New Revision: 190359
URL: http://svn.freebsd.org/changeset/base/190359

Log:
  MFC: r186234/r186236: Use passed parameter rather than a hard coded value.
  Bump WARNS to 3.

Modified:
  stable/7/usr.sbin/syslogd/   (props changed)
  stable/7/usr.sbin/syslogd/Makefile
  stable/7/usr.sbin/syslogd/syslogd.c

Modified: stable/7/usr.sbin/syslogd/Makefile
==============================================================================
--- stable/7/usr.sbin/syslogd/Makefile	Tue Mar 24 01:54:17 2009	(r190358)
+++ stable/7/usr.sbin/syslogd/Makefile	Tue Mar 24 01:56:16 2009	(r190359)
@@ -12,7 +12,7 @@ SRCS=	syslogd.c ttymsg.c
 DPADD=	${LIBUTIL}
 LDADD=	-lutil
 
-WARNS?=	1
+WARNS?=	3
 
 .if ${MK_INET6_SUPPORT} != "no"
 CFLAGS+= -DINET6

Modified: stable/7/usr.sbin/syslogd/syslogd.c
==============================================================================
--- stable/7/usr.sbin/syslogd/syslogd.c	Tue Mar 24 01:54:17 2009	(r190358)
+++ stable/7/usr.sbin/syslogd/syslogd.c	Tue Mar 24 01:56:16 2009	(r190359)
@@ -330,7 +330,7 @@ static void	reapchild(int);
 static void	usage(void);
 static int	validate(struct sockaddr *, const char *);
 static void	unmapped(struct sockaddr *);
-static void	wallmsg(struct filed *, struct iovec *);
+static void	wallmsg(struct filed *, struct iovec *, const int iovlen);
 static int	waitdaemon(int, int, int);
 static void	timedout(int);
 static void	double_rbuf(int);
@@ -1060,10 +1060,11 @@ dofsync(void)
 	}
 }
 
+#define IOV_SIZE 7
 static void
 fprintlog(struct filed *f, int flags, const char *msg)
 {
-	struct iovec iov[7];
+	struct iovec iov[IOV_SIZE];
 	struct iovec *v;
 	struct addrinfo *r;
 	int i, l, lsent = 0;
@@ -1248,7 +1249,7 @@ fprintlog(struct filed *f, int flags, co
 		dprintf(" %s\n", f->f_un.f_fname);
 		v->iov_base = lf;
 		v->iov_len = 1;
-		if (writev(f->f_file, iov, 7) < 0) {
+		if (writev(f->f_file, iov, IOV_SIZE) < 0) {
 			/*
 			 * If writev(2) fails for potentially transient errors
 			 * like the filesystem being full, ignore it.
@@ -1279,7 +1280,7 @@ fprintlog(struct filed *f, int flags, co
 				break;
 			}
 		}
-		if (writev(f->f_file, iov, 7) < 0) {
+		if (writev(f->f_file, iov, IOV_SIZE) < 0) {
 			int e = errno;
 			(void)close(f->f_file);
 			if (f->f_un.f_pipe.f_pid > 0)
@@ -1304,7 +1305,7 @@ fprintlog(struct filed *f, int flags, co
 		v->iov_len = 2;
 
 		errno = 0;	/* ttymsg() only sometimes returns an errno */
-		if ((msgret = ttymsg(iov, 7, f->f_un.f_fname, 10))) {
+		if ((msgret = ttymsg(iov, IOV_SIZE, f->f_un.f_fname, 10))) {
 			f->f_type = F_UNUSED;
 			logerror(msgret);
 		}
@@ -1315,7 +1316,7 @@ fprintlog(struct filed *f, int flags, co
 		dprintf("\n");
 		v->iov_base = crlf;
 		v->iov_len = 2;
-		wallmsg(f, iov);
+		wallmsg(f, iov, IOV_SIZE);
 		break;
 	}
 	f->f_prevcount = 0;
@@ -1329,7 +1330,7 @@ fprintlog(struct filed *f, int flags, co
  *	world, or a list of approved users.
  */
 static void
-wallmsg(struct filed *f, struct iovec *iov)
+wallmsg(struct filed *f, struct iovec *iov, const int iovlen)
 {
 	static int reenter;			/* avoid calling ourselves */
 	FILE *uf;
@@ -1353,7 +1354,8 @@ wallmsg(struct filed *f, struct iovec *i
 		strncpy(line, ut.ut_line, sizeof(line) - 1);
 		line[sizeof(line) - 1] = '\0';
 		if (f->f_type == F_WALL) {
-			if ((p = ttymsg(iov, 7, line, TTYMSGTIME)) != NULL) {
+			if ((p = ttymsg(iov, iovlen, line, TTYMSGTIME)) !=
+			    NULL) {
 				errno = 0;	/* already in msg */
 				logerror(p);
 			}
@@ -1365,8 +1367,8 @@ wallmsg(struct filed *f, struct iovec *i
 				break;
 			if (!strncmp(f->f_un.f_uname[i], ut.ut_name,
 			    UT_NAMESIZE)) {
-				if ((p = ttymsg(iov, 7, line, TTYMSGTIME))
-								!= NULL) {
+				if ((p = ttymsg(iov, iovlen, line, TTYMSGTIME))
+				    != NULL) {
 					errno = 0;	/* already in msg */
 					logerror(p);
 				}

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 02:09:48 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6EFDC106564A;
	Tue, 24 Mar 2009 02:09:48 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 51B438FC0C;
	Tue, 24 Mar 2009 02:09:48 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O29mB8029267;
	Tue, 24 Mar 2009 02:09:48 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O29mPB029266;
	Tue, 24 Mar 2009 02:09:48 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903240209.n2O29mPB029266@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 24 Mar 2009 02:09:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190360 - in stable/7/sys: . amd64/linux32 contrib/pf
	dev/ath/ath_hal dev/cxgb
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Tue, 24 Mar 2009 02:09:49 -0000

Author: obrien
Date: Tue Mar 24 02:09:48 2009
New Revision: 190360
URL: http://svn.freebsd.org/changeset/base/190360

Log:
  MFC: r187964: Fix the inconsistent tabbing.

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

Modified: stable/7/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- stable/7/sys/amd64/linux32/linux32_sysvec.c	Tue Mar 24 01:56:16 2009	(r190359)
+++ stable/7/sys/amd64/linux32/linux32_sysvec.c	Tue Mar 24 02:09:48 2009	(r190360)
@@ -353,11 +353,11 @@ linux_rt_sendsig(sig_t catcher, ksiginfo
 	bsd_to_linux_sigset(mask, &frame.sf_sc.uc_sigmask);
 
 	frame.sf_sc.uc_mcontext.sc_mask   = frame.sf_sc.uc_sigmask.__bits[0];
-        frame.sf_sc.uc_mcontext.sc_gs     = rgs();
-        frame.sf_sc.uc_mcontext.sc_fs     = rfs();
-        __asm __volatile("movl %%es,%0" :
+	frame.sf_sc.uc_mcontext.sc_gs     = rgs();
+	frame.sf_sc.uc_mcontext.sc_fs     = rfs();
+	__asm __volatile("movl %%es,%0" :
 	    "=rm" (frame.sf_sc.uc_mcontext.sc_es));
-        __asm __volatile("movl %%ds,%0" :
+	__asm __volatile("movl %%ds,%0" :
 	    "=rm" (frame.sf_sc.uc_mcontext.sc_ds));
 	frame.sf_sc.uc_mcontext.sc_edi    = regs->tf_rdi;
 	frame.sf_sc.uc_mcontext.sc_esi    = regs->tf_rsi;
@@ -487,10 +487,10 @@ linux_sendsig(sig_t catcher, ksiginfo_t 
 	 * Build the signal context to be used by sigreturn.
 	 */
 	frame.sf_sc.sc_mask   = lmask.__bits[0];
-        frame.sf_sc.sc_gs     = rgs();
-        frame.sf_sc.sc_fs     = rfs();
-        __asm __volatile("movl %%es,%0" : "=rm" (frame.sf_sc.sc_es));
-        __asm __volatile("movl %%ds,%0" : "=rm" (frame.sf_sc.sc_ds));
+	frame.sf_sc.sc_gs     = rgs();
+	frame.sf_sc.sc_fs     = rfs();
+	__asm __volatile("movl %%es,%0" : "=rm" (frame.sf_sc.sc_es));
+	__asm __volatile("movl %%ds,%0" : "=rm" (frame.sf_sc.sc_ds));
 	frame.sf_sc.sc_edi    = regs->tf_rdi;
 	frame.sf_sc.sc_esi    = regs->tf_rsi;
 	frame.sf_sc.sc_ebp    = regs->tf_rbp;
@@ -772,35 +772,36 @@ static int	exec_linux_imgact_try(struct 
 static int
 exec_linux_imgact_try(struct image_params *imgp)
 {
-    const char *head = (const char *)imgp->image_header;
-    char *rpath;
-    int error = -1, len;
-
-    /*
-     * The interpreter for shell scripts run from a linux binary needs
-     * to be located in /compat/linux if possible in order to recursively
-     * maintain linux path emulation.
-     */
-    if (((const short *)head)[0] == SHELLMAGIC) {
-	    /*
-	     * Run our normal shell image activator.  If it succeeds attempt
-	     * to use the alternate path for the interpreter.  If an alternate
-	     * path is found, use our stringspace to store it.
-	     */
-	    if ((error = exec_shell_imgact(imgp)) == 0) {
-		    linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc),
-			imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0);
-		    if (rpath != NULL) {
-			    len = strlen(rpath) + 1;
-
-			    if (len <= MAXSHELLCMDLEN) {
-				    memcpy(imgp->interpreter_name, rpath, len);
-			    }
-			    free(rpath, M_TEMP);
-		    }
-	    }
-    }
-    return(error);
+	const char *head = (const char *)imgp->image_header;
+	char *rpath;
+	int error = -1, len;
+
+	/*
+	 * The interpreter for shell scripts run from a linux binary needs
+	 * to be located in /compat/linux if possible in order to recursively
+	 * maintain linux path emulation.
+	 */
+	if (((const short *)head)[0] == SHELLMAGIC) {
+		/*
+		 * Run our normal shell image activator.  If it succeeds
+		 * attempt to use the alternate path for the interpreter.  If
+		 * an alternate path is found, use our stringspace to store it.
+		 */
+		if ((error = exec_shell_imgact(imgp)) == 0) {
+			linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc),
+			    imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0);
+			if (rpath != NULL) {
+				len = strlen(rpath) + 1;
+
+				if (len <= MAXSHELLCMDLEN) {
+					memcpy(imgp->interpreter_name, rpath,
+					    len);
+				}
+				free(rpath, M_TEMP);
+			}
+		}
+	}
+	return(error);
 }
 
 /*
@@ -868,7 +869,7 @@ linux_copyout_strings(struct image_param
 	arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS;
 	sigcodesz = *(imgp->proc->p_sysent->sv_szsigcode);
 	destp =	(caddr_t)arginfo - sigcodesz - SPARE_USRSPACE -
-		roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *));
+	    roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *));
 
 	/*
 	 * install sigcode
@@ -886,23 +887,24 @@ linux_copyout_strings(struct image_param
 		 * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for
 		 * lower compatibility.
 		 */
-		imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size
-			: (AT_COUNT * 2);
+		imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size :
+		    (AT_COUNT * 2);
 		/*
 		 * The '+ 2' is for the null pointers at the end of each of
 		 * the arg and env vector sets,and imgp->auxarg_size is room
 		 * for argument of Runtime loader.
 		 */
-		vectp = (u_int32_t *) (destp - (imgp->args->argc + imgp->args->envc + 2 +
-				       imgp->auxarg_size) * sizeof(u_int32_t));
+		vectp = (u_int32_t *)(destp - (imgp->args->argc +
+		    imgp->args->envc + 2 + imgp->auxarg_size) *
+		    sizeof(u_int32_t));
 
 	} else
 		/*
 		 * The '+ 2' is for the null pointers at the end of each of
 		 * the arg and env vector sets
 		 */
-		vectp = (u_int32_t *)
-			(destp - (imgp->args->argc + imgp->args->envc + 2) * sizeof(u_int32_t));
+		vectp = (u_int32_t *)(destp - (imgp->args->argc +
+		    imgp->args->envc + 2) * sizeof(u_int32_t));
 
 	/*
 	 * vectp also becomes our initial stack base
@@ -974,7 +976,7 @@ linux32_fixlimit(struct rlimit *rl, int 
 
 	switch (which) {
 	case RLIMIT_DATA:
-		if (linux32_maxdsiz != 0) {			
+		if (linux32_maxdsiz != 0) {
 			if (rl->rlim_cur > linux32_maxdsiz)
 				rl->rlim_cur = linux32_maxdsiz;
 			if (rl->rlim_max > linux32_maxdsiz)
@@ -1083,12 +1085,12 @@ linux_elf_modevent(module_t mod, int typ
 			sx_init(&emul_shared_lock, "emuldata->shared lock");
 			LIST_INIT(&futex_list);
 			sx_init(&futex_sx, "futex protection lock");
-			linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit,
-			      NULL, 1000);
-			linux_schedtail_tag = EVENTHANDLER_REGISTER(schedtail, linux_schedtail,
-			      NULL, 1000);
-			linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec,
-			      NULL, 1000);
+			linux_exit_tag = EVENTHANDLER_REGISTER(process_exit,
+			    linux_proc_exit, NULL, 1000);
+			linux_schedtail_tag = EVENTHANDLER_REGISTER(schedtail,
+			    linux_schedtail, NULL, 1000);
+			linux_exec_tag = EVENTHANDLER_REGISTER(process_exec,
+			    linux_proc_exec, NULL, 1000);
 			if (bootverbose)
 				printf("Linux ELF exec handler installed\n");
 		} else

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 02:28:47 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A14F1106566B;
	Tue, 24 Mar 2009 02:28:47 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 73C548FC18;
	Tue, 24 Mar 2009 02:28:47 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O2SlrX029745;
	Tue, 24 Mar 2009 02:28:47 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O2Slgr029742;
	Tue, 24 Mar 2009 02:28:47 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200903240228.n2O2Slgr029742@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 24 Mar 2009 02:28: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: r190361 - stable/7/sbin/fsck
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, 24 Mar 2009 02:28:48 -0000

Author: obrien
Date: Tue Mar 24 02:28:46 2009
New Revision: 190361
URL: http://svn.freebsd.org/changeset/base/190361

Log:
  Revert r190357, in which I was just trying to get the merge info set at
  the src level.
  (turns out svn+ssh://obrien@svn.freebsd.org/base/head and
  svn+ssh://svn.freebsd.org/base/stable/7 are seen as two totally different
  repositories... Jeez subversion can be dumb...)

Modified:
  stable/7/sbin/fsck/fsck.8
  stable/7/sbin/fsck/fsck.c
  stable/7/sbin/fsck/fsutil.h

Modified: stable/7/sbin/fsck/fsck.8
==============================================================================
--- stable/7/sbin/fsck/fsck.8	Tue Mar 24 02:09:48 2009	(r190360)
+++ stable/7/sbin/fsck/fsck.8	Tue Mar 24 02:28:46 2009	(r190361)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 25, 2001
+.Dd January 25, 2009
 .Dt FSCK 8
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd file system consistency check and interactive repair
 .Sh SYNOPSIS
 .Nm
-.Op Fl dfnpvy
+.Op Fl Cdfnpvy
 .Op Fl B | F
 .Op Fl T Ar fstype : Ns Ar fsoptions
 .Op Fl t Ar fstype
@@ -112,6 +112,11 @@ to be the partition and slice designator
 .Pp
 The options are as follows:
 .Bl -tag -width indent
+.It Fl C
+Check if the
+.Dq clean
+flag is set in the superblock and skip file system checks if file system was
+properly dismounted and marked clean.
 .It Fl d
 Debugging mode.
 Just print the commands without executing them.

Modified: stable/7/sbin/fsck/fsck.c
==============================================================================
--- stable/7/sbin/fsck/fsck.c	Tue Mar 24 02:09:48 2009	(r190360)
+++ stable/7/sbin/fsck/fsck.c	Tue Mar 24 02:28:46 2009	(r190361)
@@ -103,7 +103,7 @@ main(int argc, char *argv[])
 	TAILQ_INIT(&selhead);
 	TAILQ_INIT(&opthead);
 
-	while ((i = getopt(argc, argv, "BdvpfFnyl:t:T:")) != -1)
+	while ((i = getopt(argc, argv, "BCdvpfFnyl:t:T:")) != -1)
 		switch (i) {
 		case 'B':
 			if (flags & CHECK_BACKGRD)
@@ -128,6 +128,9 @@ main(int argc, char *argv[])
 		case 'p':
 			flags |= CHECK_PREEN;
 			/*FALLTHROUGH*/
+		case 'C':
+			flags |= CHECK_CLEAN;
+			/*FALLTHROUGH*/
 		case 'n':
 		case 'y':
 			globopt[1] = i;
@@ -566,7 +569,7 @@ static void
 usage(void)
 {
 	static const char common[] =
-	    "[-dfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]";
+	    "[-Cdfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]";
 
 	(void)fprintf(stderr, "usage: %s %s [special | node] ...\n",
 	    getprogname(), common);

Modified: stable/7/sbin/fsck/fsutil.h
==============================================================================
--- stable/7/sbin/fsck/fsutil.h	Tue Mar 24 02:09:48 2009	(r190360)
+++ stable/7/sbin/fsck/fsutil.h	Tue Mar 24 02:28:46 2009	(r190361)
@@ -48,6 +48,7 @@ char *estrdup(const char *);
 #define	CHECK_DEBUG	0x0004
 #define	CHECK_BACKGRD	0x0008
 #define	DO_BACKGRD	0x0010
+#define	CHECK_CLEAN	0x0020
 
 struct fstab;
 int checkfstab(int, int (*)(struct fstab *), 

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 02:46:05 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D17F9106564A;
	Tue, 24 Mar 2009 02:46:05 +0000 (UTC) (envelope-from sam@freebsd.org)
Received: from ebb.errno.com (ebb.errno.com [69.12.149.25])
	by mx1.freebsd.org (Postfix) with ESMTP id A2DD28FC15;
	Tue, 24 Mar 2009 02:46:05 +0000 (UTC) (envelope-from sam@freebsd.org)
Received: from trouble.errno.com (trouble.errno.com [10.0.0.248])
	(authenticated bits=0)
	by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n2O2T3qI030896
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Mon, 23 Mar 2009 19:29:03 -0700 (PDT) (envelope-from sam@freebsd.org)
Message-ID: <49C8456E.2000903@freebsd.org>
Date: Mon, 23 Mar 2009 19:29:02 -0700
From: Sam Leffler 
Organization: FreeBSD Project
User-Agent: Thunderbird 2.0.0.18 (X11/20081209)
MIME-Version: 1.0
To: "David E. O'Brien" 
References: <200903240007.n2O07H1w025582@svn.freebsd.org>
In-Reply-To: <200903240007.n2O07H1w025582@svn.freebsd.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-DCC-sonic.net-Metrics: ebb.errno.com; whitelist
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-7@freebsd.org
Subject: Re: svn commit: r190345 - stable/7/usr.bin/make
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, 24 Mar 2009 02:46:06 -0000

David E. O'Brien wrote:
> Author: obrien
> Date: Tue Mar 24 00:07:17 2009
> New Revision: 190345
> URL: http://svn.freebsd.org/changeset/base/190345
>
> Log:
>   MFC:
>   r187475: Remove inlining of functions that are used mostly in different
>   	 object files.  This lets use to remove NO_WERROR.
>   r186558: Consistently use Var_SetGlobal().
>   r186713: Add the -Q be-quiet flag for parallel jobs.
>   r186279: Exit with error code 2 when run with -k (continue if errors)
>   	 and build failed.
>   r186559: Add the ability to tweak the token output before targets in job mode.
>   r181021: Add POSIX -p flag to make(1).
>   r186502: Clarify the behaviour of conditionals when dealing with comparisons.
>
>   

I find this combination of unrelated changes worrisome; especially the 
day the tree is supposed to freeze for release.  Please make changes 
separately so any problems can be cross-referenced against limited commits.

     Sam


From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 02:46:06 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1B3BA106566B;
	Tue, 24 Mar 2009 02:46:06 +0000 (UTC) (envelope-from sam@freebsd.org)
Received: from ebb.errno.com (ebb.errno.com [69.12.149.25])
	by mx1.freebsd.org (Postfix) with ESMTP id DF8DE8FC16;
	Tue, 24 Mar 2009 02:46:05 +0000 (UTC) (envelope-from sam@freebsd.org)
Received: from trouble.errno.com (trouble.errno.com [10.0.0.248])
	(authenticated bits=0)
	by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n2O2PfaC030869
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Mon, 23 Mar 2009 19:25:41 -0700 (PDT) (envelope-from sam@freebsd.org)
Message-ID: <49C844A5.5080506@freebsd.org>
Date: Mon, 23 Mar 2009 19:25:41 -0700
From: Sam Leffler 
Organization: FreeBSD Project
User-Agent: Thunderbird 2.0.0.18 (X11/20081209)
MIME-Version: 1.0
To: "David E. O'Brien" 
References: <200903240151.n2O1pgT0028693@svn.freebsd.org>
In-Reply-To: <200903240151.n2O1pgT0028693@svn.freebsd.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-DCC-sonic.net-Metrics: ebb.errno.com; whitelist
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-7@freebsd.org
Subject: Re: svn commit: r190357 - in stable/7: gnu/usr.bin/grep include
 lib/libelf
 sbin/fsck sbin/fsck_ffs sbin/mount usr.bin/gprof usr.bin/make
 usr.sbin/crunch usr.sbin/sade usr.sbin/sysinstall
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, 24 Mar 2009 02:46:06 -0000

David E. O'Brien wrote:
> Author: obrien
> Date: Tue Mar 24 01:51:42 2009
> New Revision: 190357
> URL: http://svn.freebsd.org/changeset/base/190357
>
> Log:
>   MFC: r186581: Sound less scary about errorousous disk geometry.
>
> Modified:
>   stable/7/gnu/usr.bin/grep/   (props changed)
>   stable/7/include/   (props changed)
>   stable/7/lib/libelf/   (props changed)
>   stable/7/sbin/fsck/   (props changed)
>   stable/7/sbin/fsck/fsck.8
>   stable/7/sbin/fsck/fsck.c
>   stable/7/sbin/fsck/fsutil.h
>   stable/7/sbin/fsck_ffs/   (props changed)
>   stable/7/sbin/fsck_ffs/fsck.h
>   stable/7/sbin/fsck_ffs/fsck_ffs.8
>   stable/7/sbin/fsck_ffs/main.c
>   stable/7/sbin/fsck_ffs/setup.c
>   stable/7/sbin/mount/   (props changed)
>   stable/7/usr.bin/gprof/   (props changed)
>   stable/7/usr.bin/make/   (props changed)
>   stable/7/usr.sbin/crunch/   (props changed)
>   stable/7/usr.sbin/sade/   (props changed)
>   stable/7/usr.sbin/sade/disks.c
>   stable/7/usr.sbin/sysinstall/   (props changed)
>   stable/7/usr.sbin/sysinstall/disks.c
>   stable/7/usr.sbin/sysinstall/sysinstall.8
>
>   

This looks to have many changes unrelated to r186581.  For example you 
just removed the -C option to fsck.

    Sam


From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 02:48:56 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B00161065674;
	Tue, 24 Mar 2009 02:48:56 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9BF878FC1A;
	Tue, 24 Mar 2009 02:48:56 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O2muKg030284;
	Tue, 24 Mar 2009 02:48:56 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O2mt6p030250;
	Tue, 24 Mar 2009 02:48:55 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200903240248.n2O2mt6p030250@svn.freebsd.org>
From: Doug Barton 
Date: Tue, 24 Mar 2009 02:48: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: r190362 - 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: Tue, 24 Mar 2009 02:48:57 -0000

Author: dougb
Date: Tue Mar 24 02:48:54 2009
New Revision: 190362
URL: http://svn.freebsd.org/changeset/base/190362

Log:
  MFC r180564, addition of the SHUTDOWN keyword to those scripts that
  start persistent services.

Modified:
  stable/7/etc/   (props changed)
  stable/7/etc/rc.d/amd
  stable/7/etc/rc.d/apmd
  stable/7/etc/rc.d/bsnmpd
  stable/7/etc/rc.d/bthidd
  stable/7/etc/rc.d/devd
  stable/7/etc/rc.d/ftp-proxy
  stable/7/etc/rc.d/ftpd
  stable/7/etc/rc.d/hcsecd
  stable/7/etc/rc.d/idmapd
  stable/7/etc/rc.d/keyserv
  stable/7/etc/rc.d/lockd
  stable/7/etc/rc.d/lpd
  stable/7/etc/rc.d/mountd
  stable/7/etc/rc.d/moused
  stable/7/etc/rc.d/nfsd
  stable/7/etc/rc.d/nscd
  stable/7/etc/rc.d/ntpd
  stable/7/etc/rc.d/powerd
  stable/7/etc/rc.d/rpcbind
  stable/7/etc/rc.d/rtadvd
  stable/7/etc/rc.d/rwho
  stable/7/etc/rc.d/sdpd
  stable/7/etc/rc.d/sendmail
  stable/7/etc/rc.d/sshd
  stable/7/etc/rc.d/statd
  stable/7/etc/rc.d/timed
  stable/7/etc/rc.d/ugidfw
  stable/7/etc/rc.d/watchdogd
  stable/7/etc/rc.d/ypbind
  stable/7/etc/rc.d/yppasswdd
  stable/7/etc/rc.d/ypserv
  stable/7/etc/rc.d/ypset
  stable/7/etc/rc.d/ypupdated
  stable/7/etc/rc.d/ypxfrd

Modified: stable/7/etc/rc.d/amd
==============================================================================
--- stable/7/etc/rc.d/amd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/amd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,7 +6,7 @@
 # PROVIDE: amd
 # REQUIRE: rpcbind ypbind nfsclient cleanvar ldconfig
 # BEFORE: DAEMON
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/apmd
==============================================================================
--- stable/7/etc/rc.d/apmd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/apmd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,7 +6,7 @@
 # PROVIDE: apmd
 # REQUIRE: DAEMON apm
 # BEFORE:  LOGIN
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/bsnmpd
==============================================================================
--- stable/7/etc/rc.d/bsnmpd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/bsnmpd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -5,7 +5,7 @@
 
 # PROVIDE: bsnmpd
 # REQUIRE: NETWORKING syslogd
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/bthidd
==============================================================================
--- stable/7/etc/rc.d/bthidd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/bthidd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,7 +6,7 @@
 # PROVIDE: bthidd
 # REQUIRE: DAEMON hcsecd
 # BEFORE: LOGIN
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/devd
==============================================================================
--- stable/7/etc/rc.d/devd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/devd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,7 +6,7 @@
 # PROVIDE: devd
 # REQUIRE: netif network_ipv6
 # BEFORE: NETWORKING mountcritremote
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/ftp-proxy
==============================================================================
--- stable/7/etc/rc.d/ftp-proxy	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/ftp-proxy	Tue Mar 24 02:48:54 2009	(r190362)
@@ -5,6 +5,7 @@
 
 # PROVIDE: ftp-proxy
 # REQUIRE: DAEMON pf
+# KEYWORD: shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/ftpd
==============================================================================
--- stable/7/etc/rc.d/ftpd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/ftpd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -5,6 +5,7 @@
 
 # PROVIDE: ftpd
 # REQUIRE: LOGIN cleanvar
+# KEYWORD: shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/hcsecd
==============================================================================
--- stable/7/etc/rc.d/hcsecd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/hcsecd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,7 +6,7 @@
 # PROVIDE: hcsecd
 # REQUIRE: DAEMON
 # BEFORE: LOGIN
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/idmapd
==============================================================================
--- stable/7/etc/rc.d/idmapd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/idmapd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -5,7 +5,7 @@
 
 # PROVIDE: idmapd
 # REQUIRE: rpcbind
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/keyserv
==============================================================================
--- stable/7/etc/rc.d/keyserv	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/keyserv	Tue Mar 24 02:48:54 2009	(r190362)
@@ -8,6 +8,7 @@
 # PROVIDE: keyserv
 # REQUIRE: ypbind
 # BEFORE: DAEMON
+# KEYWORD: shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/lockd
==============================================================================
--- stable/7/etc/rc.d/lockd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/lockd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -7,7 +7,7 @@
 # PROVIDE: lockd
 # REQUIRE: nfsserver nfsclient nfsd rpcbind statd
 # BEFORE:  DAEMON
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/lpd
==============================================================================
--- stable/7/etc/rc.d/lpd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/lpd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,6 +6,7 @@
 # PROVIDE: lpd
 # REQUIRE: DAEMON
 # BEFORE:  LOGIN
+# KEYWORD: shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/mountd
==============================================================================
--- stable/7/etc/rc.d/mountd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/mountd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -5,7 +5,7 @@
 
 # PROVIDE: mountd
 # REQUIRE: NETWORKING nfsserver rpcbind quota
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/moused
==============================================================================
--- stable/7/etc/rc.d/moused	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/moused	Tue Mar 24 02:48:54 2009	(r190362)
@@ -5,7 +5,7 @@
 
 # PROVIDE: moused
 # REQUIRE: DAEMON cleanvar
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/nfsd
==============================================================================
--- stable/7/etc/rc.d/nfsd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/nfsd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -5,7 +5,7 @@
 
 # PROVIDE: nfsd
 # REQUIRE: mountd
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/nscd
==============================================================================
--- stable/7/etc/rc.d/nscd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/nscd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,6 +6,7 @@
 # PROVIDE: nscd
 # REQUIRE: DAEMON
 # BEFORE: LOGIN
+# KEYWORD: shutdown
 
 #
 # Add the following lines to /etc/rc.conf to enable nscd:

Modified: stable/7/etc/rc.d/ntpd
==============================================================================
--- stable/7/etc/rc.d/ntpd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/ntpd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,7 +6,7 @@
 # PROVIDE: ntpd
 # REQUIRE: DAEMON ntpdate cleanvar devfs
 # BEFORE:  LOGIN
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/powerd
==============================================================================
--- stable/7/etc/rc.d/powerd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/powerd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,7 +6,7 @@
 # PROVIDE: powerd
 # REQUIRE: DAEMON
 # BEFORE: LOGIN
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/rpcbind
==============================================================================
--- stable/7/etc/rc.d/rpcbind	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/rpcbind	Tue Mar 24 02:48:54 2009	(r190362)
@@ -5,6 +5,7 @@
 
 # PROVIDE: rpcbind
 # REQUIRE: NETWORKING ntpdate syslogd named
+# KEYWORD: shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/rtadvd
==============================================================================
--- stable/7/etc/rc.d/rtadvd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/rtadvd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,7 +6,7 @@
 # PROVIDE: rtadvd
 # REQUIRE: DAEMON
 # BEFORE:  LOGIN
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/rwho
==============================================================================
--- stable/7/etc/rc.d/rwho	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/rwho	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,6 +6,7 @@
 # PROVIDE: rwho
 # REQUIRE: DAEMON
 # BEFORE:  LOGIN
+# KEYWORD: shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/sdpd
==============================================================================
--- stable/7/etc/rc.d/sdpd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/sdpd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,7 +6,7 @@
 # PROVIDE: sdpd
 # REQUIRE: DAEMON
 # BEFORE: LOGIN
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/sendmail
==============================================================================
--- stable/7/etc/rc.d/sendmail	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/sendmail	Tue Mar 24 02:48:54 2009	(r190362)
@@ -7,6 +7,7 @@
 # REQUIRE: LOGIN cleanvar
 #	we make mail start late, so that things like .forward's are not
 #	processed until the system is fully operational
+# KEYWORD: shutdown
 
 # XXX - Get together with sendmail mantainer to figure out how to
 #	better handle SENDMAIL_ENABLE and 3rd party MTAs.

Modified: stable/7/etc/rc.d/sshd
==============================================================================
--- stable/7/etc/rc.d/sshd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/sshd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -5,6 +5,7 @@
 
 # PROVIDE: sshd
 # REQUIRE: LOGIN cleanvar
+# KEYWORD: shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/statd
==============================================================================
--- stable/7/etc/rc.d/statd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/statd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -7,7 +7,7 @@
 # PROVIDE: statd
 # REQUIRE: nfsserver nfsclient nfsd rpcbind
 # BEFORE:  DAEMON
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/timed
==============================================================================
--- stable/7/etc/rc.d/timed	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/timed	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,7 +6,7 @@
 # PROVIDE: timed
 # REQUIRE: DAEMON
 # BEFORE:  LOGIN
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/ugidfw
==============================================================================
--- stable/7/etc/rc.d/ugidfw	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/ugidfw	Tue Mar 24 02:48:54 2009	(r190362)
@@ -4,7 +4,7 @@
 
 # PROVIDE: ugidfw
 # BEFORE: LOGIN
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/watchdogd
==============================================================================
--- stable/7/etc/rc.d/watchdogd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/watchdogd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -29,7 +29,7 @@
 
 # PROVIDE: watchdogd
 # REQUIRE: DAEMON cleanvar
-# KEYWORD: nojail
+# KEYWORD: nojail shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/ypbind
==============================================================================
--- stable/7/etc/rc.d/ypbind	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/ypbind	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,6 +6,7 @@
 # PROVIDE: ypbind
 # REQUIRE: ypserv
 # BEFORE:  DAEMON
+# KEYWORD: shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/yppasswdd
==============================================================================
--- stable/7/etc/rc.d/yppasswdd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/yppasswdd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -6,6 +6,7 @@
 # PROVIDE: yppasswdd
 # REQUIRE: ypserv ypbind
 # BEFORE:  LOGIN
+# KEYWORD: shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/ypserv
==============================================================================
--- stable/7/etc/rc.d/ypserv	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/ypserv	Tue Mar 24 02:48:54 2009	(r190362)
@@ -5,6 +5,7 @@
 
 # PROVIDE: ypserv
 # REQUIRE: rpcbind
+# KEYWORD: shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/ypset
==============================================================================
--- stable/7/etc/rc.d/ypset	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/ypset	Tue Mar 24 02:48:54 2009	(r190362)
@@ -5,6 +5,7 @@
 
 # PROVIDE: ypset
 # REQUIRE: ypbind
+# KEYWORD: shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/ypupdated
==============================================================================
--- stable/7/etc/rc.d/ypupdated	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/ypupdated	Tue Mar 24 02:48:54 2009	(r190362)
@@ -5,6 +5,7 @@
 
 # PROVIDE: ypupdated
 # REQUIRE: rpcbind ypserv
+# KEYWORD: shutdown
 
 . /etc/rc.subr
 

Modified: stable/7/etc/rc.d/ypxfrd
==============================================================================
--- stable/7/etc/rc.d/ypxfrd	Tue Mar 24 02:28:46 2009	(r190361)
+++ stable/7/etc/rc.d/ypxfrd	Tue Mar 24 02:48:54 2009	(r190362)
@@ -5,6 +5,7 @@
 
 # PROVIDE: ypxfrd
 # REQUIRE: rpcbind ypserv
+# KEYWORD: shutdown
 
 . /etc/rc.subr
 

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 02:54:15 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9E304106564A;
	Tue, 24 Mar 2009 02:54:15 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 710ED8FC0A;
	Tue, 24 Mar 2009 02:54:15 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O2sFMs030456;
	Tue, 24 Mar 2009 02:54:15 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O2sFNp030455;
	Tue, 24 Mar 2009 02:54:15 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200903240254.n2O2sFNp030455@svn.freebsd.org>
From: Doug Barton 
Date: Tue, 24 Mar 2009 02:54:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190363 - 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: Tue, 24 Mar 2009 02:54:16 -0000

Author: dougb
Date: Tue Mar 24 02:54:15 2009
New Revision: 190363
URL: http://svn.freebsd.org/changeset/base/190363

Log:
  MFC r181114, make sure services and protocols are in the chroot /etc
  MFC r188293, improve handling of chroot inside of a jail

Modified:
  stable/7/etc/   (props changed)
  stable/7/etc/rc.d/named

Modified: stable/7/etc/rc.d/named
==============================================================================
--- stable/7/etc/rc.d/named	Tue Mar 24 02:48:54 2009	(r190362)
+++ stable/7/etc/rc.d/named	Tue Mar 24 02:54:15 2009	(r190363)
@@ -32,6 +32,8 @@ stop_postcmd="named_poststop"
 #
 chroot_autoupdate()
 {
+	local file
+
 	# Create (or update) the chroot directory structure
 	#
 	if [ -r /etc/mtree/BIND.chroot.dist ]; then
@@ -59,17 +61,32 @@ chroot_autoupdate()
 
 	# Mount a devfs in the chroot directory if needed
 	#
-	umount ${named_chrootdir}/dev 2>/dev/null
-	devfs_domount ${named_chrootdir}/dev devfsrules_hide_all
-	devfs -m ${named_chrootdir}/dev rule apply path null unhide
-	devfs -m ${named_chrootdir}/dev rule apply path random unhide
-
-	# Copy local timezone information if it is not up to date.
-	#
-	if [ -r /etc/localtime ]; then
-		cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" ||
-		    cp -p /etc/localtime "${named_chrootdir}/etc/localtime"
+	if [ `${SYSCTL_N} security.jail.jailed` -eq 0 ]; then
+		umount ${named_chrootdir}/dev 2>/dev/null
+		devfs_domount ${named_chrootdir}/dev devfsrules_hide_all
+		devfs -m ${named_chrootdir}/dev rule apply path null unhide
+		devfs -m ${named_chrootdir}/dev rule apply path random unhide
+	else
+		if [ -c ${named_chrootdir}/dev/null -a \
+		    -c ${named_chrootdir}/dev/random ]; then
+			info "named chroot: using pre-mounted devfs."
+		else
+			err 1 "named chroot: devfs cannot be mounted from" \
+			    "within a jail. Thus a chrooted named cannot" \
+			    "be run from within a jail." \
+			    "To run named without chrooting it, set" \
+			    "named_chrootdir=\"\" in /etc/rc.conf."
+		fi
 	fi
+
+	# Copy and/or update key files to the chroot /etc 
+	#
+	for file in localtime protocols services; do
+		if [ -r /etc/$file ]; then
+			cmp -s /etc/$file "${named_chrootdir}/etc/$file" ||
+			    cp -p /etc/$file "${named_chrootdir}/etc/$file"
+		fi
+	done
 }
 
 # Make symlinks to the correct pid file
@@ -109,7 +126,12 @@ named_stop()
 named_poststop()
 {
 	if [ -n "${named_chrootdir}" -a -c ${named_chrootdir}/dev/null ]; then
-		umount ${named_chrootdir}/dev 2>/dev/null || true
+		if [ `${SYSCTL_N} security.jail.jailed` -eq 0 ]; then
+			umount ${named_chrootdir}/dev 2>/dev/null || true
+		else
+			warn "named chroot:" \
+			    "cannot unmount devfs from inside jail!"
+		fi
 	fi
 }
 

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 02:56:50 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C7D031065670;
	Tue, 24 Mar 2009 02:56:50 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B52C88FC12;
	Tue, 24 Mar 2009 02:56:50 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2O2uo5S030600;
	Tue, 24 Mar 2009 02:56:50 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2O2uolg030599;
	Tue, 24 Mar 2009 02:56:50 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200903240256.n2O2uolg030599@svn.freebsd.org>
From: Doug Barton 
Date: Tue, 24 Mar 2009 02:56: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: r190364 - in stable/7/etc: . defaults
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, 24 Mar 2009 02:56:51 -0000

Author: dougb
Date: Tue Mar 24 02:56:50 2009
New Revision: 190364
URL: http://svn.freebsd.org/changeset/base/190364

Log:
  MFC r181113, -c named_flags example and capitalization fix

Modified:
  stable/7/etc/   (props changed)
  stable/7/etc/defaults/rc.conf

Modified: stable/7/etc/defaults/rc.conf
==============================================================================
--- stable/7/etc/defaults/rc.conf	Tue Mar 24 02:54:15 2009	(r190363)
+++ stable/7/etc/defaults/rc.conf	Tue Mar 24 02:56:50 2009	(r190364)
@@ -239,8 +239,8 @@ inetd_flags="-wW -C 60"		# Optional flag
 # details.
 #
 named_enable="NO"		# Run named, the DNS server (or NO).
-named_program="/usr/sbin/named"	# path to named, if you want a different one.
-#named_flags="" 		# Flags for named
+named_program="/usr/sbin/named" # Path to named, if you want a different one.
+#named_flags="-c /etc/namedb/named.conf" # Uncomment for named not in /usr/sbin
 named_pidfile="/var/run/named/pid" # Must set this in named.conf as well
 named_uid="bind" 		# User to run named as
 named_chrootdir="/var/named"	# Chroot directory (or "" not to auto-chroot it)

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 04:59:35 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A5622106564A;
	Tue, 24 Mar 2009 04:59:35 +0000 (UTC) (envelope-from obrien@NUXI.org)
Received: from dragon.nuxi.org (trang.nuxi.org [74.95.12.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 7F66A8FC15;
	Tue, 24 Mar 2009 04:59:35 +0000 (UTC) (envelope-from obrien@NUXI.org)
Received: from dragon.nuxi.org (obrien@localhost [127.0.0.1])
	by dragon.nuxi.org (8.14.3/8.14.3) with ESMTP id n2O4aPGl038999;
	Mon, 23 Mar 2009 21:36:25 -0700 (PDT)
	(envelope-from obrien@dragon.nuxi.org)
Received: (from obrien@localhost)
	by dragon.nuxi.org (8.14.3/8.14.2/Submit) id n2O4aONf038998;
	Mon, 23 Mar 2009 21:36:24 -0700 (PDT) (envelope-from obrien)
Date: Mon, 23 Mar 2009 21:36:24 -0700
From: "David O'Brien" 
To: Sam Leffler 
Message-ID: <20090324043624.GB34952@dragon.NUXI.org>
References: <200903240151.n2O1pgT0028693@svn.freebsd.org>
	<49C844A5.5080506@freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <49C844A5.5080506@freebsd.org>
X-Operating-System: FreeBSD 8.0-CURRENT
User-Agent: Mutt/1.5.16 (2007-06-09)
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-7@freebsd.org
Subject: Re: svn commit: r190357 - in stable/7: gnu/usr.bin/grep include
	lib/libelf sbin/fsck sbin/fsck_ffs sbin/mount usr.bin/gprof
	usr.bin/make usr.sbin/crunch usr.sbin/sade usr.sbin/sysinstall
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: obrien@freebsd.org
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, 24 Mar 2009 04:59:36 -0000

On Mon, Mar 23, 2009 at 07:25:41PM -0700, Sam Leffler wrote:
> David E. O'Brien wrote:
>> Author: obrien
>> Date: Tue Mar 24 01:51:42 2009
>> New Revision: 190357
>> URL: http://svn.freebsd.org/changeset/base/190357
>> 
>> Log:
>>   MFC: r186581: Sound less scary about errorousous disk geometry.
..
> This looks to have many changes unrelated to r186581.  For example you
> just removed the -C option to fsck.

I found out that Subversion wasn't getting the mergeinfo right.
It considers svn+ssh://obrien@svn.freebsd.org/base/ and
svn+ssh://svn.freebsd.org/base/ to be two totally seperate repositories.

So I did some 'merge -c ... --record-only' to get the earlier merges.
I fat fingered the ones for fsck, forgetting the --record-only the
first time.  Not sure where 'svn revert -R sbin/fsck*' went wrong when I
did that before doing the merge again with '--record-only'.

Subversions merge handling seems to be one of its warts.

-- 
-- David  (obrien@FreeBSD.org)

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 14:47:11 2009
Return-Path: 
Delivered-To: svn-src-stable-7@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CD4A61065688;
	Tue, 24 Mar 2009 14:47:11 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 814EB8FC18;
	Tue, 24 Mar 2009 14:47:11 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n2OEj41h092883;
	Tue, 24 Mar 2009 08:45:04 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Tue, 24 Mar 2009 08:45:40 -0600 (MDT)
Message-Id: <20090324.084540.796901802.imp@bsdimp.com>
To: obrien@FreeBSD.org
From: "M. Warner Losh" 
In-Reply-To: <20090324043624.GB34952@dragon.NUXI.org>
References: <200903240151.n2O1pgT0028693@svn.freebsd.org>
	<49C844A5.5080506@freebsd.org>
	<20090324043624.GB34952@dragon.NUXI.org>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-stable-7@FreeBSD.org, svn-src-stable@FreeBSD.org,
	svn-src-all@FreeBSD.org, sam@FreeBSD.org, src-committers@FreeBSD.org
Subject: Re: svn commit: r190357 - in stable/7: gnu/usr.bin/grep include
 lib/libelf sbin/fsck sbin/fsck_ffs sbin/mount usr.bin/gprof usr.bin/make
 usr.sbin/crunch usr.sbin/sade usr.sbin/sysinstall
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, 24 Mar 2009 14:47:12 -0000

In message: <20090324043624.GB34952@dragon.NUXI.org>
            "David O'Brien"  writes:
: On Mon, Mar 23, 2009 at 07:25:41PM -0700, Sam Leffler wrote:
: > David E. O'Brien wrote:
: >> Author: obrien
: >> Date: Tue Mar 24 01:51:42 2009
: >> New Revision: 190357
: >> URL: http://svn.freebsd.org/changeset/base/190357
: >> 
: >> Log:
: >>   MFC: r186581: Sound less scary about errorousous disk geometry.
: ..
: > This looks to have many changes unrelated to r186581.  For example you
: > just removed the -C option to fsck.
: 
: I found out that Subversion wasn't getting the mergeinfo right.
: It considers svn+ssh://obrien@svn.freebsd.org/base/ and
: svn+ssh://svn.freebsd.org/base/ to be two totally seperate repositories.

This is documented in the wiki page where the base name must be
identical.

Warner

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 16:53:55 2009
Return-Path: 
Delivered-To: svn-src-stable-7@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A2A9410657CA;
	Tue, 24 Mar 2009 16:53:55 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 7263E8FC23;
	Tue, 24 Mar 2009 16:53:55 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from fledge.watson.org (fledge.watson.org [65.122.17.41])
	by cyrus.watson.org (Postfix) with ESMTPS id 1FDEE46B09;
	Tue, 24 Mar 2009 12:53:55 -0400 (EDT)
Date: Tue, 24 Mar 2009 16:53:55 +0000 (GMT)
From: Robert Watson 
X-X-Sender: robert@fledge.watson.org
To: "M. Warner Losh" 
In-Reply-To: <20090324.084540.796901802.imp@bsdimp.com>
Message-ID: 
References: <200903240151.n2O1pgT0028693@svn.freebsd.org>
	<49C844A5.5080506@freebsd.org>
	<20090324043624.GB34952@dragon.NUXI.org>
	<20090324.084540.796901802.imp@bsdimp.com>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-stable-7@FreeBSD.org, svn-src-stable@FreeBSD.org,
	svn-src-all@FreeBSD.org, obrien@FreeBSD.org, sam@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r190357 - in stable/7: gnu/usr.bin/grep include
 lib/libelf sbin/fsck sbin/fsck_ffs sbin/mount usr.bin/gprof usr.bin/make
 usr.sbin/crunch usr.sbin/sade usr.sbin/sysinstall
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, 24 Mar 2009 16:53:59 -0000

On Tue, 24 Mar 2009, M. Warner Losh wrote:

> In message: <20090324043624.GB34952@dragon.NUXI.org>
>            "David O'Brien"  writes:
> : On Mon, Mar 23, 2009 at 07:25:41PM -0700, Sam Leffler wrote:
> : > David E. O'Brien wrote:
> : >> Author: obrien
> : >> Date: Tue Mar 24 01:51:42 2009
> : >> New Revision: 190357
> : >> URL: http://svn.freebsd.org/changeset/base/190357
> : >>
> : >> Log:
> : >>   MFC: r186581: Sound less scary about errorousous disk geometry.
> : ..
> : > This looks to have many changes unrelated to r186581.  For example you
> : > just removed the -C option to fsck.
> :
> : I found out that Subversion wasn't getting the mergeinfo right.
> : It considers svn+ssh://obrien@svn.freebsd.org/base/ and
> : svn+ssh://svn.freebsd.org/base/ to be two totally seperate repositories.
>
> This is documented in the wiki page where the base name must be identical.

And for those of us with over-eager shift keys, FreeBSD.org != freebsd.org 
according to svn.  I usually do an "svn info" and just copy and paste the base 
to avoid getting confusing errors.

Robert N M Watson
Computer Laboratory
University of Cambridge

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 18:09:40 2009
Return-Path: 
Delivered-To: svn-src-stable-7@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B091C1065689
	for ;
	Tue, 24 Mar 2009 18:09:40 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from mail2.fluidhosting.com (mx22.fluidhosting.com [204.14.89.5])
	by mx1.freebsd.org (Postfix) with ESMTP id 366308FC15
	for ;
	Tue, 24 Mar 2009 18:09:39 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: (qmail 29274 invoked by uid 399); 24 Mar 2009 17:42:58 -0000
Received: from localhost (HELO lap.dougb.net) (dougb@dougbarton.us@127.0.0.1)
	by localhost with ESMTPAM; 24 Mar 2009 17:42:58 -0000
X-Originating-IP: 127.0.0.1
X-Sender: dougb@dougbarton.us
Message-ID: <49C91BA0.1040306@FreeBSD.org>
Date: Tue, 24 Mar 2009 10:42:56 -0700
From: Doug Barton 
Organization: http://www.FreeBSD.org/
User-Agent: Thunderbird 2.0.0.21 (X11/20090321)
MIME-Version: 1.0
To: Robert Watson 
References: <200903240151.n2O1pgT0028693@svn.freebsd.org>
	<49C844A5.5080506@freebsd.org>
	<20090324043624.GB34952@dragon.NUXI.org>
	<20090324.084540.796901802.imp@bsdimp.com>
	
In-Reply-To: 
X-Enigmail-Version: 0.95.7
OpenPGP: id=D5B2F0FB
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: src-committers@FreeBSD.org, svn-src-stable@FreeBSD.org,
	svn-src-all@FreeBSD.org, obrien@FreeBSD.org, sam@FreeBSD.org,
	svn-src-stable-7@FreeBSD.org, "M. Warner Losh" 
Subject: Re: svn commit: r190357 - in stable/7: gnu/usr.bin/grep include
 lib/libelf
 sbin/fsck sbin/fsck_ffs sbin/mount usr.bin/gprof usr.bin/make
 usr.sbin/crunch usr.sbin/sade usr.sbin/sysinstall
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, 24 Mar 2009 18:09:42 -0000

Robert Watson wrote:
> On Tue, 24 Mar 2009, M. Warner Losh wrote:
>> This is documented in the wiki page where the base name must be
>> identical.
> 
> And for those of us with over-eager shift keys, FreeBSD.org !=
> freebsd.org according to svn.  I usually do an "svn info" and just copy
> and paste the base to avoid getting confusing errors.

Since a lot of our documentation for svn refers to "$REPO" I set that
variable in my shell thusly: REPO=svn+ssh://svn.freebsd.org/base/

That is easier to type, allows me to copy and paste from a lot of our
examples, and avoids the inconsistent fReEBSd.oRG issues.


hth,

Doug

-- 

    This .signature sanitized for your protection


From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 18:34:20 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0252A106566C;
	Tue, 24 Mar 2009 18:34:20 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E45F78FC16;
	Tue, 24 Mar 2009 18:34:19 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2OIYJ4A053677;
	Tue, 24 Mar 2009 18:34:19 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2OIYJTu053676;
	Tue, 24 Mar 2009 18:34:19 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <200903241834.n2OIYJTu053676@svn.freebsd.org>
From: Luigi Rizzo 
Date: Tue, 24 Mar 2009 18: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: r190388 - stable/7/release/picobsd/bridge
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, 24 Mar 2009 18:34:20 -0000

Author: luigi
Date: Tue Mar 24 18:34:19 2009
New Revision: 190388
URL: http://svn.freebsd.org/changeset/base/190388

Log:
  make the mfs larger to give room for shared libs.
  Build /dev/random so ssh can find it
  
  Approved by:	re (blanket on picobsd)

Modified:
  stable/7/release/picobsd/bridge/PICOBSD

Modified: stable/7/release/picobsd/bridge/PICOBSD
==============================================================================
--- stable/7/release/picobsd/bridge/PICOBSD	Tue Mar 24 18:16:42 2009	(r190387)
+++ stable/7/release/picobsd/bridge/PICOBSD	Tue Mar 24 18:34:19 2009	(r190388)
@@ -3,8 +3,8 @@
 #
 # Line starting with #PicoBSD contains PicoBSD build parameters
 #marker         def_sz  init    MFS_inodes      floppy_inodes
-#PicoBSD	3200	init	8192		32768
-options MD_ROOT_SIZE=3200      # same as def_sz
+#PicoBSD	5000	init	8192		32768
+options MD_ROOT_SIZE=5000      # same as def_sz
 
 hints	"PICOBSD.hints"
 
@@ -45,6 +45,7 @@ options		DUMMYNET
 device		if_bridge
 options		HZ=1000
 
+device		random	# ssh needs /dev/random
 device		pci
 
 # Floppy drives

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 18:35:01 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B8EF010656C0;
	Tue, 24 Mar 2009 18:35:01 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4ACD38FC17;
	Tue, 24 Mar 2009 18:35:01 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2OIZ1jL053731;
	Tue, 24 Mar 2009 18:35:01 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2OIZ1ep053730;
	Tue, 24 Mar 2009 18:35:01 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <200903241835.n2OIZ1ep053730@svn.freebsd.org>
From: Luigi Rizzo 
Date: Tue, 24 Mar 2009 18:35: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: r190389 - stable/7/release/picobsd/bridge
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, 24 Mar 2009 18:35:03 -0000

Author: luigi
Date: Tue Mar 24 18:35:01 2009
New Revision: 190389
URL: http://svn.freebsd.org/changeset/base/190389

Log:
  remove unused entries and stale comments on the size of objects
  
  Approved by:	re (blanket on picobsd)

Modified:
  stable/7/release/picobsd/bridge/crunch.conf

Modified: stable/7/release/picobsd/bridge/crunch.conf
==============================================================================
--- stable/7/release/picobsd/bridge/crunch.conf	Tue Mar 24 18:34:19 2009	(r190388)
+++ stable/7/release/picobsd/bridge/crunch.conf	Tue Mar 24 18:35:01 2009	(r190389)
@@ -48,13 +48,13 @@ srcdirs /usr/src/libexec
 # variables contain the list of sources and objects, and so on.
 
 # init is almost always necessary.
-progs init # 4KB.
+progs init
 # fsck is almost always necessary, unless you have everything on the
 # image and use 'tar' or something similar to read/write raw blocks
 # from the floppy.
-progs fsck # 24KB.
+progs fsck
 # ifconfig is needed if you want to configure interfaces...
-progs ifconfig # 4KB.
+progs ifconfig
 #
 # You will also need a shell and a bunch of utilities.
 # The standard shell is not that large, but you need many
@@ -64,117 +64,96 @@ progs ifconfig # 4KB.
 # no additional memory.
 # There are a few exceptions such as 'less', which in 4.x is
 # rather large.
-progs sh # 36KB.
+progs sh
 ln sh -sh
-progs echo # 0KB.
+progs echo
 progs pwd
 progs mkdir rmdir
 progs chmod chown
-progs mv ln # 0KB.
+progs mv ln
 progs mount
-progs minigzip # 0KB.
+progs minigzip
 ln minigzip gzip
-progs cp # 0KB.
+progs cp
 progs rm
 progs ls
 progs kill
-progs df # 0KB.
-progs ps # 4KB.
-progs ns # 4KB.
+progs df
+progs ps
+progs ns
 ln ns netstat
-progs vm # 0KB.
-progs cat # 0KB.
-progs test # 0KB.
+progs vm
+progs cat
+progs test
 ln test [
-progs hostname # 0KB.
-progs login # 4KB.
-progs getty # 4KB.
-progs stty # 4KB.
-progs w # 0KB.
-progs msg # 0KB.
+progs hostname
+progs login
+progs getty
+progs stty
+progs w
+progs msg
 ln msg dmesg
-progs reboot # 0KB.
-#progs less # 36KB
-#ln less more
-#progs more # 12KB
-special more srcdir /usr/ports/misc/44bsd-more/work
+progs reboot
+progs less
+ln less more
 
 progs sysctl
-progs swapon # 0KB.
-progs pwd_mkdb # 0KB.
+progs swapon
+progs pwd_mkdb
 progs umount
-progs du # 0KB.
-progs tail # 0KB.
-progs tee # 0KB.
-progs passwd # 0KB.
+progs du
+progs tail
+progs tee
+progs passwd
 
-progs route # 8KB
+progs route
 # progs mount_msdosfs
 # progs comcontrol
 #
 # If you want to run natd, remember the alias library
-#progs natd # 20KB
+#progs natd
 #libs -lalias	# natd
 #
 # ppp is rather large. Note that as of Jan.01, RELEASE_CRUNCH
 # makes ppp not use libalias, so you cannot have aliasing.
-#progs ppp # 112KB
+#progs ppp
 
 # You need an editor. ee is relatively small, though there are
 # smaller ones. vi is much larger.
 # The editor also usually need a curses library.
-progs ee # 32KB.
+progs ee
 libs -lncurses
 # progs vi # ??
 # libs -lcurses # for vi
 
-#progs tcpdump # 100KB.
+#progs tcpdump
 special tcpdump srcdir /usr/src/usr.sbin/tcpdump/tcpdump
 
-progs arp # 0KB.
+progs arp
 
-progs bsdlabel # 4KB.
-progs fdisk # 4KB.
-progs mdconfig # 0KB.
+progs bsdlabel
+progs fdisk
+progs mdconfig
 
 progs kldload kldunload kldstat kldxref
-#progs grep # 16KB.
-progs date # 4KB.
-#progs mount_nfs # 0KB.
+#progs grep
+progs date
+#progs mount_nfs
 ln mount_nfs nfs
-progs ping # 4KB.
-#progs routed # 32KB.
-progs ipfw # 12KB.
-progs traceroute # 0KB.
+progs ping
+#progs routed
+progs ipfw
+progs traceroute
 progs mdmfs
 ln mdmfs mount_mfs
-# progs mount_cd9660 # 4KB.
+# progs mount_cd9660
 # ln mount_cd9660 cd9660
 progs newfs
 #ln newfs mount_mfs
 ln chown chgrp
 # ln mount_msdosfs msdos
 
-# If you need to access the box remotely, and maybe copy files
-# from/to it, you can use telnet, rsh or ssh.
-# inetd is only needed for telnet and rshd
-#progs inetd # 12KB.
-#progs telnet # 20KB.
-#progs telnetd # 12KB.
-#progs ftp # 28KB.
-#progs tar # 32KB.
-
-# Check the ssh license! If you want to use this,
-# go to /usr/ports/security/ssh-picobsd, do a make extract configure
-# You also need to install /usr/ports/math/libgmp-freebsd
-#progs sshd	# includes ssh and scp
-special sshd objvar SSHD_OBJS
-special sshd srcdir /usr/ports/picobsd/ssh-picobsd/work/ssh-1.2.27
-special sshd objdir /usr/ports/picobsd/ssh-picobsd/work/ssh-1.2.27
-ln sshd ssh
-ln sshd ssh1
-ln sshd scp
-#libs /usr/local/lib/libgmp.a
+# For a small ssh client/server use dropbear
 
 libs -ll       # used by sh
 libs -lufs     # used by mount

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Mar 24 20:57:11 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 64D501065674;
	Tue, 24 Mar 2009 20:57:11 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4E94C8FC30;
	Tue, 24 Mar 2009 20:57:11 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2OKvBxX056722;
	Tue, 24 Mar 2009 20:57:11 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2OKvAFb056699;
	Tue, 24 Mar 2009 20:57:10 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200903242057.n2OKvAFb056699@svn.freebsd.org>
From: Konstantin Belousov 
Date: Tue, 24 Mar 2009 20:57:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190393 - in stable/7: include lib/libc/gen
	lib/libc/include lib/libc/stdlib lib/libthr
	lib/libthr/arch/amd64/include lib/libthr/arch/i386
	lib/libthr/thread libexec/rtld-elf sys/kern sy...
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, 24 Mar 2009 20:57:13 -0000

Author: kib
Date: Tue Mar 24 20:57:10 2009
New Revision: 190393
URL: http://svn.freebsd.org/changeset/base/190393

Log:
  Mostly synchronize  lib/libthr and sys/kern/kern_umtx.c with the code
  from HEAD.
  
  Since libkse is still built on RELENG_7, pthread_cleanup_push/pop
  are left as the functions, but the support code in libthr is present for
  the macro versions.
  
  Malloc in RELENG_7 does not require thread exit hook, but I decided
  to add empty handler for it, instead of removing callback from thr_exit().
  
  No mergeinfo since this change is prepared by patching libthr and then
  bringing in required missed bits.
  
  Requested by:	bms
  Reviewed by:	davidxu
  Tested by:	bms, Mykola Dzham 
  Approved by:	re (kensmith)

Added:
  stable/7/lib/libthr/thread/thr_affinity.c   (contents, props changed)
  stable/7/lib/libthr/thread/thr_getcpuclockid.c   (contents, props changed)
Modified:
  stable/7/include/pthread.h
  stable/7/include/pthread_np.h
  stable/7/lib/libc/gen/Symbol.map
  stable/7/lib/libc/gen/dlfcn.c
  stable/7/lib/libc/include/libc_private.h
  stable/7/lib/libc/stdlib/Symbol.map
  stable/7/lib/libc/stdlib/malloc.c
  stable/7/lib/libthr/Makefile
  stable/7/lib/libthr/arch/amd64/include/pthread_md.h
  stable/7/lib/libthr/arch/i386/Makefile.inc
  stable/7/lib/libthr/pthread.map
  stable/7/lib/libthr/thread/Makefile.inc
  stable/7/lib/libthr/thread/thr_attr.c
  stable/7/lib/libthr/thread/thr_clean.c
  stable/7/lib/libthr/thread/thr_create.c
  stable/7/lib/libthr/thread/thr_event.c
  stable/7/lib/libthr/thread/thr_exit.c
  stable/7/lib/libthr/thread/thr_fork.c
  stable/7/lib/libthr/thread/thr_init.c
  stable/7/lib/libthr/thread/thr_mutex.c
  stable/7/lib/libthr/thread/thr_once.c
  stable/7/lib/libthr/thread/thr_private.h
  stable/7/lib/libthr/thread/thr_pspinlock.c
  stable/7/lib/libthr/thread/thr_resume_np.c
  stable/7/lib/libthr/thread/thr_rtld.c
  stable/7/lib/libthr/thread/thr_sem.c
  stable/7/lib/libthr/thread/thr_sig.c
  stable/7/lib/libthr/thread/thr_spinlock.c
  stable/7/lib/libthr/thread/thr_suspend_np.c
  stable/7/lib/libthr/thread/thr_syscalls.c
  stable/7/lib/libthr/thread/thr_umtx.c
  stable/7/lib/libthr/thread/thr_umtx.h
  stable/7/libexec/rtld-elf/Symbol.map
  stable/7/libexec/rtld-elf/rtld.c
  stable/7/libexec/rtld-elf/rtld_lock.c
  stable/7/libexec/rtld-elf/rtld_lock.h
  stable/7/sys/kern/kern_thr.c
  stable/7/sys/kern/kern_umtx.c
  stable/7/sys/sys/umtx.h

Modified: stable/7/include/pthread.h
==============================================================================
--- stable/7/include/pthread.h	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/include/pthread.h	Tue Mar 24 20:57:10 2009	(r190393)
@@ -135,6 +135,10 @@ enum pthread_mutextype {
 
 #define PTHREAD_MUTEX_DEFAULT		PTHREAD_MUTEX_ERRORCHECK
 
+struct _pthread_cleanup_info {
+	__uintptr_t	pthread_cleanup_pad[8];
+};
+
 /*
  * Thread function prototype definitions:
  */
@@ -185,6 +189,7 @@ int		pthread_detach(pthread_t);
 int		pthread_equal(pthread_t, pthread_t);
 void		pthread_exit(void *) __dead2;
 void		*pthread_getspecific(pthread_key_t);
+int		pthread_getcpuclockid(pthread_t, clockid_t *);
 int		pthread_join(pthread_t, void **);
 int		pthread_key_create(pthread_key_t *,
 			void (*) (void *));
@@ -267,6 +272,10 @@ int		pthread_setschedparam(pthread_t, in
 			const struct sched_param *);
 int		pthread_getconcurrency(void);
 int		pthread_setconcurrency(int);
+
+void		__pthread_cleanup_push_imp(void (*)(void *), void *,
+			struct _pthread_cleanup_info *);
+void		__pthread_cleanup_pop_imp(int);
 __END_DECLS
 
 #endif

Modified: stable/7/include/pthread_np.h
==============================================================================
--- stable/7/include/pthread_np.h	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/include/pthread_np.h	Tue Mar 24 20:57:10 2009	(r190393)
@@ -10,10 +10,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.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
+ * 3. Neither the name of the author nor the names of any co-contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -34,6 +31,9 @@
 #ifndef _PTHREAD_NP_H_
 #define _PTHREAD_NP_H_
 
+#include 
+#include 
+
 /*
  * Non-POSIX type definitions:
  */
@@ -45,6 +45,9 @@ typedef void	(*pthread_switch_routine_t)
 __BEGIN_DECLS
 int pthread_attr_setcreatesuspend_np(pthread_attr_t *);
 int pthread_attr_get_np(pthread_t, pthread_attr_t *);
+int pthread_attr_getaffinity_np(const pthread_attr_t *, size_t, cpuset_t *);
+int pthread_attr_setaffinity_np(pthread_attr_t *, size_t, const cpuset_t *);
+int pthread_getaffinity_np(pthread_t, size_t, cpuset_t *);
 int pthread_main_np(void);
 int pthread_multi_np(void);
 int pthread_mutexattr_getkind_np(pthread_mutexattr_t);
@@ -52,6 +55,12 @@ int pthread_mutexattr_setkind_np(pthread
 void pthread_resume_all_np(void);
 int pthread_resume_np(pthread_t);
 void pthread_set_name_np(pthread_t, const char *);
+int pthread_mutex_getspinloops_np(pthread_mutex_t *mutex, int *count);
+int pthread_mutex_setspinloops_np(pthread_mutex_t *mutex, int count);
+int pthread_mutex_getyieldloops_np(pthread_mutex_t *mutex, int *count);
+int pthread_mutex_setyieldloops_np(pthread_mutex_t *mutex, int count);
+int pthread_mutex_isowned_np(pthread_mutex_t *mutex);
+int pthread_setaffinity_np(pthread_t, size_t, const cpuset_t *);
 int pthread_single_np(void);
 void pthread_suspend_all_np(void);
 int pthread_suspend_np(pthread_t);

Modified: stable/7/lib/libc/gen/Symbol.map
==============================================================================
--- stable/7/lib/libc/gen/Symbol.map	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libc/gen/Symbol.map	Tue Mar 24 20:57:10 2009	(r190393)
@@ -403,6 +403,8 @@ FBSDprivate_1.0 {
 	_spinlock;
 	_spinlock_debug;
 	_spinunlock;
+	_rtld_atfork_pre;
+	_rtld_atfork_post;
 	_rtld_error;		/* for private use */
 	_rtld_thread_init;	/* for private use */
 	_err;

Modified: stable/7/lib/libc/gen/dlfcn.c
==============================================================================
--- stable/7/lib/libc/gen/dlfcn.c	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libc/gen/dlfcn.c	Tue Mar 24 20:57:10 2009	(r190393)
@@ -137,3 +137,15 @@ dl_iterate_phdr(int (*callback)(struct d
 	_rtld_error(sorry);
 	return 0;
 }
+
+#pragma weak _rtld_atfork_pre
+void
+_rtld_atfork_pre(int *locks)
+{
+}
+
+#pragma weak _rtld_atfork_post
+void
+_rtld_atfork_post(int *locks)
+{
+}

Modified: stable/7/lib/libc/include/libc_private.h
==============================================================================
--- stable/7/lib/libc/include/libc_private.h	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libc/include/libc_private.h	Tue Mar 24 20:57:10 2009	(r190393)
@@ -158,6 +158,12 @@ void _set_tp(void *tp);
 extern const char *__progname;
 
 /*
+ * This function is used by the threading libraries to notify malloc that a
+ * thread is exiting.
+ */
+void _malloc_thread_cleanup(void);
+
+/*
  * These functions are used by the threading libraries in order to protect
  * malloc across fork().
  */

Modified: stable/7/lib/libc/stdlib/Symbol.map
==============================================================================
--- stable/7/lib/libc/stdlib/Symbol.map	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libc/stdlib/Symbol.map	Tue Mar 24 20:57:10 2009	(r190393)
@@ -95,6 +95,7 @@ FBSD_1.0 {
 
 FBSDprivate_1.0 {
 	__use_pts;
+	_malloc_thread_cleanup;
 	_malloc_prefork;
 	_malloc_postfork;
 	__system;

Modified: stable/7/lib/libc/stdlib/malloc.c
==============================================================================
--- stable/7/lib/libc/stdlib/malloc.c	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libc/stdlib/malloc.c	Tue Mar 24 20:57:10 2009	(r190393)
@@ -4693,6 +4693,17 @@ malloc_usable_size(const void *ptr)
 /*
  * End non-standard functions.
  */
+
+/*
+ * We provide an unpublished interface in order to receive notifications from
+ * the pthreads library whenever a thread exits.  This allows us to clean up
+ * thread caches.
+ */
+void
+_malloc_thread_cleanup(void)
+{
+}
+
 /******************************************************************************/
 /*
  * Begin library-private functions, used by threading libraries for protection

Modified: stable/7/lib/libthr/Makefile
==============================================================================
--- stable/7/lib/libthr/Makefile	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libthr/Makefile	Tue Mar 24 20:57:10 2009	(r190393)
@@ -9,6 +9,7 @@
 # system call stubs.
 
 .include 
+MK_SSP=	no
 
 .if (${DEFAULT_THREAD_LIB} == "libthr" || ${MK_LIBKSE} == "no") && \
     ${SHLIBDIR} == "/usr/lib"
@@ -17,7 +18,7 @@ SHLIBDIR= /lib
 
 LIB=thr
 SHLIB_MAJOR= 3
-WARNS?= 2
+WARNS?=	3
 CFLAGS+=-DPTHREAD_KERNEL
 CFLAGS+=-I${.CURDIR}/../libc/include -I${.CURDIR}/thread \
 	-I${.CURDIR}/../../include
@@ -28,9 +29,8 @@ CFLAGS+=-I${.CURDIR}/../../libexec/rtld-
 CFLAGS+=-I${.CURDIR}/../libthread_db
 CFLAGS+=-Winline
 
-# CFLAGS+=-DSYSTEM_SCOPE_ONLY
-
-VERSION_MAP=${.CURDIR}/pthread.map
+VERSION_DEF=${.CURDIR}/../libc/Versions.def
+SYMBOL_MAPS=${.CURDIR}/pthread.map
 
 MAN=	libthr.3
 
@@ -54,4 +54,8 @@ SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpth
 .endif
 .endif
 
+.if !defined(WITHOUT_SYSCALL_COMPAT)
+CFLAGS+=-DSYSCALL_COMPAT
+.endif
+
 .include 

Modified: stable/7/lib/libthr/arch/amd64/include/pthread_md.h
==============================================================================
--- stable/7/lib/libthr/arch/amd64/include/pthread_md.h	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libthr/arch/amd64/include/pthread_md.h	Tue Mar 24 20:57:10 2009	(r190393)
@@ -98,6 +98,6 @@ _get_curthread(void)
 	return (TCB_GET64(tcb_thread));
 }
 
-#define HAS__UMTX_OP_ERR	1
+#define	HAS__UMTX_OP_ERR	1
 
 #endif

Modified: stable/7/lib/libthr/arch/i386/Makefile.inc
==============================================================================
--- stable/7/lib/libthr/arch/i386/Makefile.inc	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libthr/arch/i386/Makefile.inc	Tue Mar 24 20:57:10 2009	(r190393)
@@ -2,4 +2,4 @@
 
 .PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
 
-SRCS+=	pthread_md.c  _umtx_op_err.S
+SRCS+=	pthread_md.c _umtx_op_err.S

Modified: stable/7/lib/libthr/pthread.map
==============================================================================
--- stable/7/lib/libthr/pthread.map	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libthr/pthread.map	Tue Mar 24 20:57:10 2009	(r190393)
@@ -6,7 +6,6 @@
  * Use the same naming scheme as libc.
  */
 FBSD_1.0 {
-global:
 	__error;
 	accept;
 	aio_suspend;
@@ -118,8 +117,8 @@ global:
 	pthread_rwlockattr_getpshared;
 	pthread_rwlockattr_init;
 	pthread_rwlockattr_setpshared;
-	pthread_self;
 	pthread_set_name_np;
+	pthread_self;
 	pthread_setcancelstate;
 	pthread_setcanceltype;
 	pthread_setconcurrency;
@@ -165,15 +164,12 @@ global:
 	system;
 	tcdrain;
 	usleep;
-	vfork;
 	wait;
 	wait3;
 	wait4;
 	waitpid;
 	write;
 	writev;
-local:
-	*;
 };
 
 /*
@@ -181,7 +177,6 @@ local:
  * These are not part of our application ABI.
  */
 FBSDprivate_1.0 {
-global:
 	___creat;
 	___pause;
 	___pselect;
@@ -233,6 +228,7 @@ global:
 	_pthread_barrierattr_setpshared;
 	_pthread_attr_destroy;
 	_pthread_attr_get_np;
+	_pthread_attr_getaffinity_np;
 	_pthread_attr_getdetachstate;
 	_pthread_attr_getguardsize;
 	_pthread_attr_getinheritsched;
@@ -243,6 +239,7 @@ global:
 	_pthread_attr_getstackaddr;
 	_pthread_attr_getstacksize;
 	_pthread_attr_init;
+	_pthread_attr_setaffinity_np;
 	_pthread_attr_setcreatesuspend_np;
 	_pthread_attr_setdetachstate;
 	_pthread_attr_setguardsize;
@@ -272,7 +269,9 @@ global:
 	_pthread_detach;
 	_pthread_equal;
 	_pthread_exit;
+	_pthread_getaffinity_np;
 	_pthread_getconcurrency;
+	_pthread_getcpuclockid;
 	_pthread_getprio;
 	_pthread_getschedparam;
 	_pthread_getspecific;
@@ -284,10 +283,15 @@ global:
 	_pthread_multi_np;
 	_pthread_mutex_destroy;
 	_pthread_mutex_getprioceiling;
+	_pthread_mutex_getspinloops_np;
+	_pthread_mutex_getyieldloops_np;
 	_pthread_mutex_init;
 	_pthread_mutex_init_calloc_cb;
+	_pthread_mutex_isowned_np;
 	_pthread_mutex_lock;
 	_pthread_mutex_setprioceiling;
+	_pthread_mutex_setspinloops_np;
+	_pthread_mutex_setyieldloops_np;
 	_pthread_mutex_timedlock;
 	_pthread_mutex_trylock;
 	_pthread_mutex_unlock;
@@ -321,6 +325,7 @@ global:
 	_pthread_rwlockattr_setpshared;
 	_pthread_self;
 	_pthread_set_name_np;
+	_pthread_setaffinity_np;
 	_pthread_setcancelstate;
 	_pthread_setcanceltype;
 	_pthread_setconcurrency;
@@ -358,7 +363,6 @@ global:
 	_spinlock;
 	_spinlock_debug;
 	_spinunlock;
-	_vfork;
 
 	/* Debugger needs these. */
 	_libthr_debug;
@@ -386,6 +390,19 @@ global:
 	_thread_size_key;
 	_thread_state_running;
 	_thread_state_zoombie;
-local:
-	*;
+};
+
+FBSD_1.1 {
+	__pthread_cleanup_pop_imp;
+	__pthread_cleanup_push_imp;
+	pthread_attr_getaffinity_np;
+	pthread_attr_setaffinity_np;
+	pthread_getaffinity_np;
+	pthread_getcpuclockid;
+	pthread_setaffinity_np;
+	pthread_mutex_getspinloops_np;
+	pthread_mutex_getyieldloops_np;
+	pthread_mutex_isowned_np;
+	pthread_mutex_setspinloops_np;
+	pthread_mutex_setyieldloops_np;
 };

Modified: stable/7/lib/libthr/thread/Makefile.inc
==============================================================================
--- stable/7/lib/libthr/thread/Makefile.inc	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libthr/thread/Makefile.inc	Tue Mar 24 20:57:10 2009	(r190393)
@@ -4,6 +4,7 @@
 .PATH: ${.CURDIR}/thread
 
 SRCS+= \
+	thr_affinity.c \
 	thr_attr.c \
 	thr_barrier.c \
 	thr_barrierattr.c \
@@ -19,6 +20,7 @@ SRCS+= \
 	thr_exit.c \
 	thr_fork.c \
 	thr_getprio.c \
+	thr_getcpuclockid.c \
 	thr_getschedparam.c \
 	thr_info.c \
 	thr_init.c \

Added: stable/7/lib/libthr/thread/thr_affinity.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/7/lib/libthr/thread/thr_affinity.c	Tue Mar 24 20:57:10 2009	(r190393)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2008, David Xu 
+ * 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 unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ *
+ */
+
+#include "namespace.h"
+#include 
+#include 
+#include 
+#include "un-namespace.h"
+
+#include "thr_private.h"
+
+__weak_reference(_pthread_getaffinity_np, pthread_getaffinity_np);
+__weak_reference(_pthread_setaffinity_np, pthread_setaffinity_np);
+
+int
+_pthread_setaffinity_np(pthread_t td, size_t cpusetsize, const cpuset_t *cpusetp)
+{
+	struct pthread	*curthread = _get_curthread();
+	lwpid_t		tid;
+	int		error;
+
+	if (td == curthread) {
+		error = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID,
+			-1, cpusetsize, cpusetp);
+		if (error == -1)
+			error = errno;
+	} else {
+		THR_THREAD_LOCK(curthread, td);
+		if (td->state == PS_DEAD) {
+			THR_THREAD_UNLOCK(curthread, td);
+			return (EINVAL);
+		}
+		tid = TID(td);
+		error = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, tid,
+			cpusetsize, cpusetp);
+		if (error == -1)
+			error = errno;
+		THR_THREAD_UNLOCK(curthread, td);
+	}
+	return (error);
+}
+
+int
+_pthread_getaffinity_np(pthread_t td, size_t cpusetsize, cpuset_t *cpusetp)
+{
+	struct pthread	*curthread = _get_curthread();
+	lwpid_t tid;
+	int error;
+
+	tid = TID(td);
+	error = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID,
+		(td == curthread) ? -1 : tid, cpusetsize, cpusetp);
+	if (error == -1)
+		error = errno;
+	return (error);
+}

Modified: stable/7/lib/libthr/thread/thr_attr.c
==============================================================================
--- stable/7/lib/libthr/thread/thr_attr.c	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libthr/thread/thr_attr.c	Tue Mar 24 20:57:10 2009	(r190393)
@@ -99,6 +99,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "un-namespace.h"
 
 #include "thr_private.h"
@@ -148,7 +149,9 @@ _pthread_attr_get_np(pthread_t pid, pthr
 		attr.flags |= PTHREAD_DETACHED;
 	_thr_ref_delete(curthread, pid);
 	memcpy(*dst, &attr, sizeof(struct pthread_attr));
-
+	/* XXX */
+	(*dst)->cpuset = NULL;
+	(*dst)->cpusetsize = 0;
 	return (0);
 }
 
@@ -543,3 +546,92 @@ _pthread_attr_setstacksize(pthread_attr_
 	}
 	return(ret);
 }
+
+static size_t
+_get_kern_cpuset_size(void)
+{
+	static int kern_cpuset_size = 0;
+
+	if (kern_cpuset_size == 0) {
+		size_t len;
+
+		len = sizeof(kern_cpuset_size);
+		if (sysctlbyname("kern.smp.maxcpus", &kern_cpuset_size,
+		    &len, NULL, 0))
+			PANIC("failed to get sysctl kern.smp.maxcpus");
+
+		kern_cpuset_size = (kern_cpuset_size + 7) / 8;
+	}
+
+	return (kern_cpuset_size);
+}
+
+__weak_reference(_pthread_attr_setaffinity_np, pthread_attr_setaffinity_np);
+int
+_pthread_attr_setaffinity_np(pthread_attr_t *pattr, size_t cpusetsize,
+	const cpuset_t *cpusetp)
+{
+	pthread_attr_t attr;
+	int ret;
+
+	if (pattr == NULL || (attr = (*pattr)) == NULL)
+		ret = EINVAL;
+	else {
+		if (cpusetsize == 0 || cpusetp == NULL) {
+			if (attr->cpuset != NULL) {
+				free(attr->cpuset);
+				attr->cpuset = NULL;
+				attr->cpusetsize = 0;
+			}
+			return (0);
+		}
+			
+		if (cpusetsize > attr->cpusetsize) {
+			size_t kern_size = _get_kern_cpuset_size();
+			if (cpusetsize > kern_size) {
+				size_t i;
+				for (i = kern_size; i < cpusetsize; ++i) {
+					if (((char *)cpusetp)[i])
+						return (EINVAL);
+				}
+			}
+			void *newset = realloc(attr->cpuset, cpusetsize);
+       			if (newset == NULL)
+		            return (ENOMEM);
+			attr->cpuset = newset;
+			attr->cpusetsize = cpusetsize;
+		} else {
+			memset(((char *)attr->cpuset) + cpusetsize, 0,
+				attr->cpusetsize - cpusetsize);
+			attr->cpusetsize = cpusetsize;
+		}
+		memcpy(attr->cpuset, cpusetp, cpusetsize);
+		ret = 0;
+	}
+	return (ret);
+}
+
+__weak_reference(_pthread_attr_getaffinity_np, pthread_attr_getaffinity_np);
+int
+_pthread_attr_getaffinity_np(const pthread_attr_t *pattr, size_t cpusetsize,
+	cpuset_t *cpusetp)
+{
+	pthread_attr_t attr;
+	int ret = 0;
+
+	if (pattr == NULL || (attr = (*pattr)) == NULL)
+		ret = EINVAL;
+	else if (attr->cpuset != NULL) {
+		memcpy(cpusetp, attr->cpuset, MIN(cpusetsize, attr->cpusetsize));
+		if (cpusetsize > attr->cpusetsize)
+			memset(((char *)cpusetp) + attr->cpusetsize, 0, 
+				cpusetsize - attr->cpusetsize);
+	} else {
+		size_t kern_size = _get_kern_cpuset_size();
+		memset(cpusetp, -1, MIN(cpusetsize, kern_size));
+		if (cpusetsize > kern_size)
+			memset(((char *)cpusetp) + kern_size, 0,
+				cpusetsize - kern_size);
+	}
+	return (ret);
+}

Modified: stable/7/lib/libthr/thread/thr_clean.c
==============================================================================
--- stable/7/lib/libthr/thread/thr_clean.c	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libthr/thread/thr_clean.c	Tue Mar 24 20:57:10 2009	(r190393)
@@ -38,38 +38,61 @@
 
 #include "thr_private.h"
 
+#undef pthread_cleanup_push
+#undef pthread_cleanup_pop
+
+/* old binary compatible interfaces */
 __weak_reference(_pthread_cleanup_push, pthread_cleanup_push);
 __weak_reference(_pthread_cleanup_pop, pthread_cleanup_pop);
 
 void
-_pthread_cleanup_push(void (*routine) (void *), void *routine_arg)
+__pthread_cleanup_push_imp(void (*routine)(void *), void *arg,
+	struct _pthread_cleanup_info *info)
 {
 	struct pthread	*curthread = _get_curthread();
-	struct pthread_cleanup *new;
-
-	if ((new = (struct pthread_cleanup *)
-	    malloc(sizeof(struct pthread_cleanup))) != NULL) {
-		new->routine = routine;
-		new->routine_arg = routine_arg;
-		new->onstack = 0;
-		new->next = curthread->cleanup;
+	struct pthread_cleanup *newbuf;
 
-		curthread->cleanup = new;
-	}
+	newbuf = (void *)info;
+	newbuf->routine = routine;
+	newbuf->routine_arg = arg;
+	newbuf->onheap = 0;
+	newbuf->prev = curthread->cleanup;
+	curthread->cleanup = newbuf;
 }
 
 void
-_pthread_cleanup_pop(int execute)
+__pthread_cleanup_pop_imp(int execute)
 {
 	struct pthread	*curthread = _get_curthread();
 	struct pthread_cleanup *old;
 
 	if ((old = curthread->cleanup) != NULL) {
-		curthread->cleanup = old->next;
-		if (execute) {
+		curthread->cleanup = old->prev;
+		if (execute)
 			old->routine(old->routine_arg);
-		}
-		if (old->onstack == 0)
+		if (old->onheap)
 			free(old);
 	}
 }
+
+void
+_pthread_cleanup_push(void (*routine) (void *), void *arg)
+{
+	struct pthread	*curthread = _get_curthread();
+	struct pthread_cleanup *newbuf;
+
+	if ((newbuf = (struct pthread_cleanup *)
+	    malloc(sizeof(struct _pthread_cleanup_info))) != NULL) {
+		newbuf->routine = routine;
+		newbuf->routine_arg = arg;
+		newbuf->onheap = 1;
+		newbuf->prev = curthread->cleanup;
+		curthread->cleanup = newbuf;
+	}
+}
+
+void
+_pthread_cleanup_pop(int execute)
+{
+	__pthread_cleanup_pop_imp(execute);
+}

Modified: stable/7/lib/libthr/thread/thr_create.c
==============================================================================
--- stable/7/lib/libthr/thread/thr_create.c	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libthr/thread/thr_create.c	Tue Mar 24 20:57:10 2009	(r190393)
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "un-namespace.h"
 
 #include "thr_private.h"
@@ -55,6 +56,8 @@ _pthread_create(pthread_t * thread, cons
 	struct rtprio rtp;
 	int ret = 0, locked, create_suspended;
 	sigset_t set, oset;
+	cpuset_t *cpusetp = NULL;
+	int cpusetsize = 0;
 
 	_thr_check_init();
 
@@ -73,8 +76,13 @@ _pthread_create(pthread_t * thread, cons
 	if (attr == NULL || *attr == NULL)
 		/* Use the default thread attributes: */
 		new_thread->attr = _pthread_attr_default;
-	else
+	else {
 		new_thread->attr = *(*attr);
+		cpusetp = new_thread->attr.cpuset;
+		cpusetsize = new_thread->attr.cpusetsize;
+		new_thread->attr.cpuset = NULL;
+		new_thread->attr.cpusetsize = 0;
+	}
 	if (new_thread->attr.sched_inherit == PTHREAD_INHERIT_SCHED) {
 		/* inherit scheduling contention scope */
 		if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM)
@@ -129,7 +137,7 @@ _pthread_create(pthread_t * thread, cons
 	_thr_link(curthread, new_thread);
 	/* Return thread pointer eariler so that new thread can use it. */
 	(*thread) = new_thread;
-	if (SHOULD_REPORT_EVENT(curthread, TD_CREATE)) {
+	if (SHOULD_REPORT_EVENT(curthread, TD_CREATE) || cpusetp != NULL) {
 		THR_THREAD_LOCK(curthread, new_thread);
 		locked = 1;
 	} else
@@ -147,7 +155,7 @@ _pthread_create(pthread_t * thread, cons
 		param.flags |= THR_SYSTEM_SCOPE;
 	if (new_thread->attr.sched_inherit == PTHREAD_INHERIT_SCHED)
 		param.rtp = NULL;
-	else {
+	else { 	 
 		sched_param.sched_priority = new_thread->attr.prio;
 		_schedparam_to_rtp(new_thread->attr.sched_policy,
 			&sched_param, &rtp);
@@ -160,6 +168,7 @@ _pthread_create(pthread_t * thread, cons
 		SIGDELSET(set, SIGTRAP);
 		__sys_sigprocmask(SIG_SETMASK, &set, &oset);
 		new_thread->sigmask = oset;
+		SIGDELSET(new_thread->sigmask, SIGCANCEL);
 	}
 
 	ret = thr_new(¶m, sizeof(param));
@@ -183,7 +192,7 @@ _pthread_create(pthread_t * thread, cons
 		new_thread->tid = TID_TERMINATED;
 		if (new_thread->flags & THR_FLAGS_NEED_SUSPEND) {
 			new_thread->cycle++;
-			_thr_umtx_wake(&new_thread->cycle, INT_MAX);
+			_thr_umtx_wake(&new_thread->cycle, INT_MAX, 0);
 		}
 		THR_THREAD_UNLOCK(curthread, new_thread);
 		THREAD_LIST_LOCK(curthread);
@@ -191,11 +200,31 @@ _pthread_create(pthread_t * thread, cons
 		new_thread->tlflags |= TLFLAGS_DETACHED;
 		_thr_ref_delete_unlocked(curthread, new_thread);
 		THREAD_LIST_UNLOCK(curthread);
-		(*thread) = 0;
 	} else if (locked) {
+		if (cpusetp != NULL) {
+			if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID,
+				TID(new_thread), cpusetsize, cpusetp)) {
+				ret = errno;
+				/* kill the new thread */
+				new_thread->force_exit = 1;
+				THR_THREAD_UNLOCK(curthread, new_thread);
+				goto out;
+			}
+		}
+
 		_thr_report_creation(curthread, new_thread);
 		THR_THREAD_UNLOCK(curthread, new_thread);
+out:
+		if (ret) {
+			THREAD_LIST_LOCK(curthread);
+			new_thread->tlflags |= TLFLAGS_DETACHED;
+			THR_GCLIST_ADD(new_thread);
+			THREAD_LIST_UNLOCK(curthread);
+		}
 	}
+
+	if (ret)
+		(*thread) = 0;
 	return (ret);
 }
 
@@ -231,6 +260,9 @@ thread_start(struct pthread *curthread)
 	THR_LOCK(curthread);
 	THR_UNLOCK(curthread);
 
+	if (curthread->force_exit)
+		_pthread_exit(PTHREAD_CANCELED);
+
 	if (curthread->unblock_sigcancel) {
 		sigset_t set1;
 

Modified: stable/7/lib/libthr/thread/thr_event.c
==============================================================================
--- stable/7/lib/libthr/thread/thr_event.c	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libthr/thread/thr_event.c	Tue Mar 24 20:57:10 2009	(r190393)
@@ -42,7 +42,7 @@ void
 _thr_report_creation(struct pthread *curthread, struct pthread *newthread)
 {
 	curthread->event_buf.event = TD_CREATE;
-	curthread->event_buf.th_p = (td_thrhandle_t *)newthread;
+	curthread->event_buf.th_p = (uintptr_t)newthread;
 	curthread->event_buf.data = 0;
 	THR_UMUTEX_LOCK(curthread, &_thr_event_lock);
 	_thread_last_event = curthread;
@@ -55,7 +55,7 @@ void
 _thr_report_death(struct pthread *curthread)
 {
 	curthread->event_buf.event = TD_DEATH;
-	curthread->event_buf.th_p = (td_thrhandle_t *)curthread;
+	curthread->event_buf.th_p = (uintptr_t)curthread;
 	curthread->event_buf.data = 0;
 	THR_UMUTEX_LOCK(curthread, &_thr_event_lock);
 	_thread_last_event = curthread;

Modified: stable/7/lib/libthr/thread/thr_exit.c
==============================================================================
--- stable/7/lib/libthr/thread/thr_exit.c	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libthr/thread/thr_exit.c	Tue Mar 24 20:57:10 2009	(r190393)
@@ -29,11 +29,14 @@
  * $FreeBSD$
  */
 
+#include "namespace.h"
 #include 
 #include 
 #include 
 #include 
+#include "un-namespace.h"
 
+#include "libc_private.h"
 #include "thr_private.h"
 
 void	_pthread_exit(void *status);
@@ -60,22 +63,6 @@ _thread_exit(const char *fname, int line
 void
 _thr_exit_cleanup(void)
 {
-	struct pthread	*curthread = _get_curthread();
-
-	/*
-	 * POSIX states that cancellation/termination of a thread should
-	 * not release any visible resources (such as mutexes) and that
-	 * it is the applications responsibility.  Resources that are
-	 * internal to the threads library, including file and fd locks,
-	 * are not visible to the application and need to be released.
-	 */
-	/* Unlock all private mutexes: */
-	_mutex_unlock_private(curthread);
-
-	/*
-	 * This still isn't quite correct because we don't account
-	 * for held spinlocks (see libc/stdlib/malloc.c).
-	 */
 }
 
 void
@@ -100,7 +87,7 @@ _pthread_exit(void *status)
 	/* Save the return value: */
 	curthread->ret = status;
 	while (curthread->cleanup != NULL) {
-		pthread_cleanup_pop(1);
+		_pthread_cleanup_pop(1);
 	}
 
 	/* Check if there is thread specific data: */
@@ -119,8 +106,18 @@ _pthread_exit(void *status)
 		exit(0);
 		/* Never reach! */
 	}
+	THREAD_LIST_UNLOCK(curthread);
+
+	/* Tell malloc that the thread is exiting. */
+	_malloc_thread_cleanup();
+
+	THREAD_LIST_LOCK(curthread);
 	THR_LOCK(curthread);
 	curthread->state = PS_DEAD;
+	if (curthread->flags & THR_FLAGS_NEED_SUSPEND) {
+		curthread->cycle++;
+		_thr_umtx_wake(&curthread->cycle, INT_MAX, 0);
+	}
 	THR_UNLOCK(curthread);
 	/*
 	 * Thread was created with initial refcount 1, we drop the
@@ -130,7 +127,7 @@ _pthread_exit(void *status)
 	if (curthread->tlflags & TLFLAGS_DETACHED)
 		THR_GCLIST_ADD(curthread);
 	THREAD_LIST_UNLOCK(curthread);
-	if (SHOULD_REPORT_EVENT(curthread, TD_DEATH))
+	if (!curthread->force_exit && SHOULD_REPORT_EVENT(curthread, TD_DEATH))
 		_thr_report_death(curthread);
 
 	/*

Modified: stable/7/lib/libthr/thread/thr_fork.c
==============================================================================
--- stable/7/lib/libthr/thread/thr_fork.c	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libthr/thread/thr_fork.c	Tue Mar 24 20:57:10 2009	(r190393)
@@ -67,6 +67,7 @@
 #include "un-namespace.h"
 
 #include "libc_private.h"
+#include "rtld_lock.h"
 #include "thr_private.h"
 
 __weak_reference(_pthread_atfork, pthread_atfork);
@@ -105,6 +106,7 @@ _fork(void)
 	pid_t ret;
 	int errsave;
 	int unlock_malloc;
+	int rtld_locks[MAX_RTLD_LOCKS];
 
 	if (!_thr_is_inited())
 		return (__sys_fork());
@@ -127,6 +129,7 @@ _fork(void)
 	if (_thr_isthreaded() != 0) {
 		unlock_malloc = 1;
 		_malloc_prefork();
+		_rtld_atfork_pre(rtld_locks);
 	} else {
 		unlock_malloc = 0;
 	}
@@ -155,6 +158,9 @@ _fork(void)
 		/* clear other threads locked us. */
 		_thr_umutex_init(&curthread->lock);
 		_thr_umutex_init(&_thr_atfork_lock);
+
+		if (unlock_malloc)
+			_rtld_atfork_post(rtld_locks);
 		_thr_setthreaded(0);
 
 		/* reinitialize libc spinlocks. */
@@ -167,6 +173,12 @@ _fork(void)
 		/* Ready to continue, unblock signals. */ 
 		_thr_signal_unblock(curthread);
 
+		if (unlock_malloc) {
+			__isthreaded = 1;
+			_malloc_postfork();
+			__isthreaded = 0;
+		}
+
 		/* Run down atfork child handlers. */
 		TAILQ_FOREACH(af, &_thr_atfork_list, qe) {
 			if (af->child != NULL)
@@ -179,8 +191,10 @@ _fork(void)
 		/* Ready to continue, unblock signals. */ 
 		_thr_signal_unblock(curthread);
 
-		if (unlock_malloc)
+		if (unlock_malloc) {
+			_rtld_atfork_post(rtld_locks);
 			_malloc_postfork();
+		}
 
 		/* Run down atfork parent handlers. */
 		TAILQ_FOREACH(af, &_thr_atfork_list, qe) {

Added: stable/7/lib/libthr/thread/thr_getcpuclockid.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/7/lib/libthr/thread/thr_getcpuclockid.c	Tue Mar 24 20:57:10 2009	(r190393)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2008 David Xu 
+ * 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 JOHN BIRRELL 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$
+ */
+
+#include "namespace.h"
+#include 
+#include 
+#include 
+#include "un-namespace.h"
+
+#include "thr_private.h"
+
+__weak_reference(_pthread_getcpuclockid, pthread_getcpuclockid);
+
+int
+_pthread_getcpuclockid(pthread_t pthread, clockid_t *clock_id)
+{
+	if (pthread == NULL)
+		return (EINVAL);
+
+	*clock_id = CLOCK_THREAD_CPUTIME_ID;
+	return (0);
+}

Modified: stable/7/lib/libthr/thread/thr_init.c
==============================================================================
--- stable/7/lib/libthr/thread/thr_init.c	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libthr/thread/thr_init.c	Tue Mar 24 20:57:10 2009	(r190393)
@@ -75,20 +75,21 @@ struct pthread_prio	_thr_priorities[3] =
 
 struct pthread_attr _pthread_attr_default = {
 	.sched_policy = SCHED_OTHER,
-	.sched_inherit = 0,
+	.sched_inherit = PTHREAD_INHERIT_SCHED,
 	.prio = 0,
 	.suspend = THR_CREATE_RUNNING,
 	.flags = PTHREAD_SCOPE_SYSTEM,
 	.stackaddr_attr = NULL,
 	.stacksize_attr = THR_STACK_DEFAULT,
-	.guardsize_attr = 0
+	.guardsize_attr = 0,
+	.cpusetsize = 0,
+	.cpuset = NULL
 };
 
 struct pthread_mutex_attr _pthread_mutexattr_default = {
 	.m_type = PTHREAD_MUTEX_DEFAULT,
 	.m_protocol = PTHREAD_PRIO_NONE,
-	.m_ceiling = 0,
-	.m_flags = 0
+	.m_ceiling = 0
 };
 
 /* Default condition variable attributes: */
@@ -158,7 +159,6 @@ STATIC_LIB_REQUIRE(_spinlock);
 STATIC_LIB_REQUIRE(_spinlock_debug);
 STATIC_LIB_REQUIRE(_spinunlock);
 STATIC_LIB_REQUIRE(_thread_init_hack);
-STATIC_LIB_REQUIRE(_vfork);
 
 /*
  * These are needed when linking statically.  All references within

Modified: stable/7/lib/libthr/thread/thr_mutex.c
==============================================================================
--- stable/7/lib/libthr/thread/thr_mutex.c	Tue Mar 24 20:46:02 2009	(r190392)
+++ stable/7/lib/libthr/thread/thr_mutex.c	Tue Mar 24 20:57:10 2009	(r190393)
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "un-namespace.h"
 
 #include "thr_private.h"
@@ -50,12 +51,12 @@
 	(m)->m_qe.tqe_next = NULL;			\

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

From owner-svn-src-stable-7@FreeBSD.ORG  Wed Mar 25 14:11:29 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BE8F91065672;
	Wed, 25 Mar 2009 14:11:29 +0000 (UTC)
	(envelope-from vanhu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AB8558FC1F;
	Wed, 25 Mar 2009 14:11:29 +0000 (UTC)
	(envelope-from vanhu@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2PEBTgX078638;
	Wed, 25 Mar 2009 14:11:29 GMT (envelope-from vanhu@svn.freebsd.org)
Received: (from vanhu@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2PEBTet078637;
	Wed, 25 Mar 2009 14:11:29 GMT (envelope-from vanhu@svn.freebsd.org)
Message-Id: <200903251411.n2PEBTet078637@svn.freebsd.org>
From: VANHULLEBUS Yvan 
Date: Wed, 25 Mar 2009 14:11:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190412 - stable/7/contrib/libpcap
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, 25 Mar 2009 14:11:30 -0000

Author: vanhu
Date: Wed Mar 25 14:11:29 2009
New Revision: 190412
URL: http://svn.freebsd.org/changeset/base/190412

Log:
  MFC: Added DLT_ENC to map list, so it is now possible
  to save dumps on enc0
  
  Approved by:	re (gnn)
  Obtained from:	NETASQ

Modified:
  stable/7/contrib/libpcap/   (props changed)
  stable/7/contrib/libpcap/savefile.c

Modified: stable/7/contrib/libpcap/savefile.c
==============================================================================
--- stable/7/contrib/libpcap/savefile.c	Wed Mar 25 14:02:26 2009	(r190411)
+++ stable/7/contrib/libpcap/savefile.c	Wed Mar 25 14:11:29 2009	(r190412)
@@ -811,6 +811,9 @@ static struct linktype_map {
 	/* IPMB */
 	{ DLT_IPMB,		LINKTYPE_IPMB },
 
+	/* enc0 device */
+	{ DLT_ENC,		LINKTYPE_ENC },
+
 	{ -1,			-1 }
 };
 

From owner-svn-src-stable-7@FreeBSD.ORG  Wed Mar 25 14:26:38 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D72F5106564A;
	Wed, 25 Mar 2009 14:26:38 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BB9998FC0A;
	Wed, 25 Mar 2009 14:26:38 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2PEQcVe078998;
	Wed, 25 Mar 2009 14:26:38 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2PEQccK078996;
	Wed, 25 Mar 2009 14:26:38 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200903251426.n2PEQccK078996@svn.freebsd.org>
From: Alexander Motin 
Date: Wed, 25 Mar 2009 14:26:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190414 - in stable/7/sys: . contrib/pf dev/ata
	dev/ath/ath_hal dev/cxgb
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 25 Mar 2009 14:26:39 -0000

Author: mav
Date: Wed Mar 25 14:26:38 2009
New Revision: 190414
URL: http://svn.freebsd.org/changeset/base/190414

Log:
  MFC rev. 188846:
  
  Handle nForce MCP67 and MCP73 SATA controllers as AHCI. They report
  itself as ATA RAID, but generic ATAPCI driver unable to detect drives
  there. AHCI driver reported to handle them fine. Linux does the same.
  
  Submitted by:	Andrey V. Elsukov on stable@
  PR:		kern/125713
  Approved by:	re (kib)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ata/ata-chipset.c
  stable/7/sys/dev/ata/ata-pci.h
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)

Modified: stable/7/sys/dev/ata/ata-chipset.c
==============================================================================
--- stable/7/sys/dev/ata/ata-chipset.c	Wed Mar 25 14:17:08 2009	(r190413)
+++ stable/7/sys/dev/ata/ata-chipset.c	Wed Mar 25 14:26:38 2009	(r190414)
@@ -3131,7 +3131,31 @@ ata_nvidia_ident(device_t dev)
      { ATA_NFORCE_MCP61_S3, 0, 0,         NV4|NVQ, ATA_SA300, "nForce MCP61" },
      { ATA_NFORCE_MCP65,    0, AMDNVIDIA, NVIDIA,  ATA_UDMA6, "nForce MCP65" },
      { ATA_NFORCE_MCP67,    0, AMDNVIDIA, NVIDIA,  ATA_UDMA6, "nForce MCP67" },
+     { ATA_NFORCE_MCP67_A0, 0, NVAHCI,  0, ATA_SA300, "nForce MCP67" },
+     { ATA_NFORCE_MCP67_A1, 0, NVAHCI,  0, ATA_SA300, "nForce MCP67" },
+     { ATA_NFORCE_MCP67_A2, 0, NVAHCI,  0, ATA_SA300, "nForce MCP67" },
+     { ATA_NFORCE_MCP67_A3, 0, NVAHCI,  0, ATA_SA300, "nForce MCP67" },
+     { ATA_NFORCE_MCP67_A4, 0, NVAHCI,  0, ATA_SA300, "nForce MCP67" },
+     { ATA_NFORCE_MCP67_A5, 0, NVAHCI,  0, ATA_SA300, "nForce MCP67" },
+     { ATA_NFORCE_MCP67_A6, 0, NVAHCI,  0, ATA_SA300, "nForce MCP67" },
+     { ATA_NFORCE_MCP67_A7, 0, NVAHCI,  0, ATA_SA300, "nForce MCP67" },
+     { ATA_NFORCE_MCP67_A8, 0, NVAHCI,  0, ATA_SA300, "nForce MCP67" },
+     { ATA_NFORCE_MCP67_A9, 0, NVAHCI,  0, ATA_SA300, "nForce MCP67" },
+     { ATA_NFORCE_MCP67_AA, 0, NVAHCI,  0, ATA_SA300, "nForce MCP67" },
+     { ATA_NFORCE_MCP67_AB, 0, NVAHCI,  0, ATA_SA300, "nForce MCP67" },
      { ATA_NFORCE_MCP73,    0, AMDNVIDIA, NVIDIA,  ATA_UDMA6, "nForce MCP73" },
+     { ATA_NFORCE_MCP73_A0, 0, NVAHCI,  0, ATA_SA300, "nForce MCP73" },
+     { ATA_NFORCE_MCP73_A1, 0, NVAHCI,  0, ATA_SA300, "nForce MCP73" },
+     { ATA_NFORCE_MCP73_A2, 0, NVAHCI,  0, ATA_SA300, "nForce MCP73" },
+     { ATA_NFORCE_MCP73_A3, 0, NVAHCI,  0, ATA_SA300, "nForce MCP73" },
+     { ATA_NFORCE_MCP73_A4, 0, NVAHCI,  0, ATA_SA300, "nForce MCP73" },
+     { ATA_NFORCE_MCP73_A5, 0, NVAHCI,  0, ATA_SA300, "nForce MCP73" },
+     { ATA_NFORCE_MCP73_A6, 0, NVAHCI,  0, ATA_SA300, "nForce MCP73" },
+     { ATA_NFORCE_MCP73_A7, 0, NVAHCI,  0, ATA_SA300, "nForce MCP73" },
+     { ATA_NFORCE_MCP73_A8, 0, NVAHCI,  0, ATA_SA300, "nForce MCP73" },
+     { ATA_NFORCE_MCP73_A9, 0, NVAHCI,  0, ATA_SA300, "nForce MCP73" },
+     { ATA_NFORCE_MCP73_AA, 0, NVAHCI,  0, ATA_SA300, "nForce MCP73" },
+     { ATA_NFORCE_MCP73_AB, 0, NVAHCI,  0, ATA_SA300, "nForce MCP73" },
      { ATA_NFORCE_MCP77,    0, AMDNVIDIA, NVIDIA,  ATA_UDMA6, "nForce MCP77" },
      { 0, 0, 0, 0, 0, 0}} ;
 
@@ -3139,7 +3163,10 @@ ata_nvidia_ident(device_t dev)
 	return ENXIO;
 
     ata_set_desc(dev);
-    ctlr->chipinit = ata_nvidia_chipinit;
+    if (ctlr->chip->cfg1 & NVAHCI)
+    	ctlr->chipinit = ata_ahci_chipinit;
+    else
+    	ctlr->chipinit = ata_nvidia_chipinit;
     return 0;
 }
 

Modified: stable/7/sys/dev/ata/ata-pci.h
==============================================================================
--- stable/7/sys/dev/ata/ata-pci.h	Wed Mar 25 14:17:08 2009	(r190413)
+++ stable/7/sys/dev/ata/ata-pci.h	Wed Mar 25 14:26:38 2009	(r190414)
@@ -250,8 +250,32 @@ struct ata_connect_task {
 #define ATA_NFORCE_MCP61_S2     0x03f610de
 #define ATA_NFORCE_MCP61_S3     0x03f710de
 #define ATA_NFORCE_MCP65        0x044810de
+#define ATA_NFORCE_MCP67_A0     0x055010de
+#define ATA_NFORCE_MCP67_A1     0x055110de
+#define ATA_NFORCE_MCP67_A2     0x055210de
+#define ATA_NFORCE_MCP67_A3     0x055310de
+#define ATA_NFORCE_MCP67_A4     0x055410de
+#define ATA_NFORCE_MCP67_A5     0x055510de
+#define ATA_NFORCE_MCP67_A6     0x055610de
+#define ATA_NFORCE_MCP67_A7     0x055710de
+#define ATA_NFORCE_MCP67_A8     0x055810de
+#define ATA_NFORCE_MCP67_A9     0x055910de
+#define ATA_NFORCE_MCP67_AA     0x055A10de
+#define ATA_NFORCE_MCP67_AB     0x055B10de
 #define ATA_NFORCE_MCP67        0x056010de
 #define ATA_NFORCE_MCP73        0x056c10de
+#define ATA_NFORCE_MCP73_A0     0x07f010de
+#define ATA_NFORCE_MCP73_A1     0x07f110de
+#define ATA_NFORCE_MCP73_A2     0x07f210de
+#define ATA_NFORCE_MCP73_A3     0x07f310de
+#define ATA_NFORCE_MCP73_A4     0x07f410de
+#define ATA_NFORCE_MCP73_A5     0x07f510de
+#define ATA_NFORCE_MCP73_A6     0x07f610de
+#define ATA_NFORCE_MCP73_A7     0x07f710de
+#define ATA_NFORCE_MCP73_A8     0x07f810de
+#define ATA_NFORCE_MCP73_A9     0x07f910de
+#define ATA_NFORCE_MCP73_AA     0x07fa10de
+#define ATA_NFORCE_MCP73_AB     0x07fb10de
 #define ATA_NFORCE_MCP77        0x075910de
 
 #define ATA_PROMISE_ID          0x105a
@@ -458,6 +482,7 @@ struct ata_connect_task {
 #define NVIDIA          0x0004
 #define NV4             0x0010
 #define NVQ             0x0020
+#define NVAHCI          0x0040
 #define VIACLK          0x0100
 #define VIABUG          0x0200
 #define VIABAR          0x0400

From owner-svn-src-stable-7@FreeBSD.ORG  Wed Mar 25 15:42:07 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EDCF61065670;
	Wed, 25 Mar 2009 15:42:07 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DB4678FC08;
	Wed, 25 Mar 2009 15:42:07 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2PFg71L080604;
	Wed, 25 Mar 2009 15:42:07 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2PFg74U080603;
	Wed, 25 Mar 2009 15:42:07 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200903251542.n2PFg74U080603@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 25 Mar 2009 15:42: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: r190415 - in stable/7/lib/libc: . string
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 25 Mar 2009 15:42:08 -0000

Author: kib
Date: Wed Mar 25 15:42:07 2009
New Revision: 190415
URL: http://svn.freebsd.org/changeset/base/190415

Log:
  MFC r190266:
  7.2 will be the first release where strndup() appears.
  
  Approved by:	re (kensmith)

Modified:
  stable/7/lib/libc/   (props changed)
  stable/7/lib/libc/string/ffsll.c   (props changed)
  stable/7/lib/libc/string/flsll.c   (props changed)
  stable/7/lib/libc/string/strdup.3

Modified: stable/7/lib/libc/string/strdup.3
==============================================================================
--- stable/7/lib/libc/string/strdup.3	Wed Mar 25 14:26:38 2009	(r190414)
+++ stable/7/lib/libc/string/strdup.3	Wed Mar 25 15:42:07 2009	(r190415)
@@ -80,4 +80,4 @@ function first appeared in
 The
 .Fn strndup
 function was added in
-.Fx 8.0 .
+.Fx 7.2 .

From owner-svn-src-stable-7@FreeBSD.ORG  Wed Mar 25 17:22:16 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 339AA10656C3;
	Wed, 25 Mar 2009 17:22:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 19A4E8FC20;
	Wed, 25 Mar 2009 17:22:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2PHMGSs082670;
	Wed, 25 Mar 2009 17:22:16 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2PHMFLg082656;
	Wed, 25 Mar 2009 17:22:15 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200903251722.n2PHMFLg082656@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 25 Mar 2009 17:22:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190418 - in stable/7/sys: . amd64/amd64 amd64/ia32
	amd64/include amd64/linux32 compat/linux contrib/pf
	dev/ath/ath_hal dev/cxgb i386/i386 i386/include i386/isa i386/linux
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Wed, 25 Mar 2009 17:22:20 -0000

Author: jhb
Date: Wed Mar 25 17:22:15 2009
New Revision: 190418
URL: http://svn.freebsd.org/changeset/base/190418

Log:
  Allow different ABIs to use different initial control words for the FPU on
  amd64 and i386.  This fixes a bug were 32-bit binaries would run with a
  different floating point exception mask under FreeBSD/amd64 vs FreeBSD/i386.
  This commit also includes a few other minor changes to keep the code in
  sync with 8.
  
  Approved by:	re (kib)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/amd64/amd64/fpu.c
  stable/7/sys/amd64/amd64/machdep.c
  stable/7/sys/amd64/amd64/trap.c
  stable/7/sys/amd64/ia32/ia32_signal.c
  stable/7/sys/amd64/include/fpu.h
  stable/7/sys/amd64/include/pcb.h
  stable/7/sys/amd64/linux32/linux32_sysvec.c
  stable/7/sys/compat/linux/linux_misc.h
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/i386/i386/machdep.c
  stable/7/sys/i386/i386/mp_machdep.c
  stable/7/sys/i386/include/npx.h
  stable/7/sys/i386/include/pcb.h
  stable/7/sys/i386/isa/npx.c
  stable/7/sys/i386/linux/linux_sysvec.c

Modified: stable/7/sys/amd64/amd64/fpu.c
==============================================================================
--- stable/7/sys/amd64/amd64/fpu.c	Wed Mar 25 17:02:05 2009	(r190417)
+++ stable/7/sys/amd64/amd64/fpu.c	Wed Mar 25 17:22:15 2009	(r190418)
@@ -98,16 +98,15 @@ typedef u_char bool_t;
 
 static	void	fpu_clean_state(void);
 
-int	hw_float = 1;
-SYSCTL_INT(_hw,HW_FLOATINGPT, floatingpoint,
-	CTLFLAG_RD, &hw_float, 0, 
-	"Floatingpoint instructions executed in hardware");
+SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD,
+    NULL, 1, "Floating point instructions executed in hardware");
 
 static	struct savefpu		fpu_cleanstate;
-static	bool_t			fpu_cleanstate_ready;
 
 /*
- * Initialize floating point unit.
+ * Initialize the floating point unit.  On the boot CPU we generate a
+ * clean state that is used to initialize the floating point unit when
+ * it is first used by a process.
  */
 void
 fpuinit(void)
@@ -117,22 +116,22 @@ fpuinit(void)
 	u_short control;
 
 	savecrit = intr_disable();
-	PCPU_SET(fpcurthread, 0);
 	stop_emulating();
 	fninit();
 	control = __INITIAL_FPUCW__;
 	fldcw(&control);
 	mxcsr = __INITIAL_MXCSR__;
 	ldmxcsr(mxcsr);
-	fxsave(&fpu_cleanstate);
-	if (fpu_cleanstate.sv_env.en_mxcsr_mask)
-		cpu_mxcsr_mask = fpu_cleanstate.sv_env.en_mxcsr_mask;
-	else
-		cpu_mxcsr_mask = 0xFFBF;
+	if (PCPU_GET(cpuid) == 0) {
+		fxsave(&fpu_cleanstate);
+		if (fpu_cleanstate.sv_env.en_mxcsr_mask)
+			cpu_mxcsr_mask = fpu_cleanstate.sv_env.en_mxcsr_mask;
+		else
+			cpu_mxcsr_mask = 0xFFBF;
+		bzero(fpu_cleanstate.sv_fp, sizeof(fpu_cleanstate.sv_fp));
+		bzero(fpu_cleanstate.sv_xmm, sizeof(fpu_cleanstate.sv_xmm));
+	}
 	start_emulating();
-	bzero(fpu_cleanstate.sv_fp, sizeof(fpu_cleanstate.sv_fp));
-	bzero(fpu_cleanstate.sv_xmm, sizeof(fpu_cleanstate.sv_xmm));
-	fpu_cleanstate_ready = 1;
 	intr_restore(savecrit);
 }
 
@@ -386,8 +385,8 @@ fputrap()
 
 static int err_count = 0;
 
-int
-fpudna()
+void
+fpudna(void)
 {
 	struct pcb *pcb;
 	register_t s;
@@ -396,7 +395,7 @@ fpudna()
 		printf("fpudna: fpcurthread == curthread %d times\n",
 		    ++err_count);
 		stop_emulating();
-		return (1);
+		return;
 	}
 	if (PCPU_GET(fpcurthread) != NULL) {
 		printf("fpudna: fpcurthread = %p (%d), curthread = %p (%d)\n",
@@ -421,12 +420,12 @@ fpudna()
 		 * explicitly load sanitized registers.
 		 */
 		fxrstor(&fpu_cleanstate);
+		if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__)
+			fldcw(&pcb->pcb_initial_fpucw);
 		pcb->pcb_flags |= PCB_FPUINITDONE;
 	} else
 		fxrstor(&pcb->pcb_save);
 	intr_restore(s);
-
-	return (1);
 }
 
 /*
@@ -454,10 +453,8 @@ fpugetregs(struct thread *td, struct sav
 	register_t s;
 
 	if ((td->td_pcb->pcb_flags & PCB_FPUINITDONE) == 0) {
-		if (fpu_cleanstate_ready)
-			bcopy(&fpu_cleanstate, addr, sizeof(fpu_cleanstate));
-		else
-			bzero(addr, sizeof(*addr));
+		bcopy(&fpu_cleanstate, addr, sizeof(fpu_cleanstate));
+		addr->sv_env.en_cw = td->td_pcb->pcb_initial_fpucw;
 		return (_MC_FPOWNED_NONE);
 	}
 	s = intr_disable();

Modified: stable/7/sys/amd64/amd64/machdep.c
==============================================================================
--- stable/7/sys/amd64/amd64/machdep.c	Wed Mar 25 17:02:05 2009	(r190417)
+++ stable/7/sys/amd64/amd64/machdep.c	Wed Mar 25 17:22:15 2009	(r190418)
@@ -586,7 +586,7 @@ cpu_idle(void)
 void (*cpu_idle_hook)(void) = cpu_idle_default;
 
 /*
- * Clear registers on exec
+ * Reset registers to default values on exec.
  */
 void
 exec_setregs(td, entry, stack, ps_strings)
@@ -613,6 +613,7 @@ exec_setregs(td, entry, stack, ps_string
 	pcb->pcb_es = _udatasel;
 	pcb->pcb_fs = _udatasel;
 	pcb->pcb_gs = _udatasel;
+	pcb->pcb_initial_fpucw = __INITIAL_FPUCW__;
 
 	bzero((char *)regs, sizeof(struct trapframe));
 	regs->tf_rip = entry;

Modified: stable/7/sys/amd64/amd64/trap.c
==============================================================================
--- stable/7/sys/amd64/amd64/trap.c	Wed Mar 25 17:02:05 2009	(r190417)
+++ stable/7/sys/amd64/amd64/trap.c	Wed Mar 25 17:22:15 2009	(r190418)
@@ -421,13 +421,8 @@ trap(struct trapframe *frame)
 
 		case T_DNA:
 			/* transparent fault (due to context switch "late") */
-			if (fpudna())
-				goto userout;
-			printf("pid %d killed due to lack of floating point\n",
-				p->p_pid);
-			i = SIGKILL;
-			ucode = 0;
-			break;
+			fpudna();
+			goto userout;
 
 		case T_FPOPFLT:		/* FPU operand fetch fault */
 			ucode = ILL_COPROC;
@@ -455,11 +450,9 @@ trap(struct trapframe *frame)
 			 * XXX this should be fatal unless the kernel has
 			 * registered such use.
 			 */
-			if (fpudna()) {
-				printf("fpudna in kernel mode!\n");
-				goto out;
-			}
-			break;
+			fpudna();
+			printf("fpudna in kernel mode!\n");
+			goto out;
 
 		case T_STKFLT:		/* stack fault */
 			break;

Modified: stable/7/sys/amd64/ia32/ia32_signal.c
==============================================================================
--- stable/7/sys/amd64/ia32/ia32_signal.c	Wed Mar 25 17:02:05 2009	(r190417)
+++ stable/7/sys/amd64/ia32/ia32_signal.c	Wed Mar 25 17:22:15 2009	(r190418)
@@ -727,6 +727,7 @@ ia32_setregs(td, entry, stack, ps_string
 	pcb->pcb_es = _udatasel;
 	pcb->pcb_fs = _udatasel;
 	pcb->pcb_gs = _udatasel;
+	pcb->pcb_initial_fpucw = __INITIAL_FPUCW_I386__;
 
 	bzero((char *)regs, sizeof(struct trapframe));
 	regs->tf_rip = entry;

Modified: stable/7/sys/amd64/include/fpu.h
==============================================================================
--- stable/7/sys/amd64/include/fpu.h	Wed Mar 25 17:02:05 2009	(r190417)
+++ stable/7/sys/amd64/include/fpu.h	Wed Mar 25 17:22:15 2009	(r190418)
@@ -92,11 +92,12 @@ struct  savefpu {
  * SSE2 based math.  For FreeBSD/amd64, we go with the default settings.
  */
 #define	__INITIAL_FPUCW__	0x037F
+#define	__INITIAL_FPUCW_I386__	0x127F
 #define	__INITIAL_MXCSR__	0x1F80
 #define	__INITIAL_MXCSR_MASK__	0xFFBF
 
 #ifdef _KERNEL
-int	fpudna(void);
+void	fpudna(void);
 void	fpudrop(void);
 void	fpuexit(struct thread *td);
 int	fpuformat(void);

Modified: stable/7/sys/amd64/include/pcb.h
==============================================================================
--- stable/7/sys/amd64/include/pcb.h	Wed Mar 25 17:02:05 2009	(r190417)
+++ stable/7/sys/amd64/include/pcb.h	Wed Mar 25 17:22:15 2009	(r190418)
@@ -55,6 +55,13 @@ struct pcb {
 	register_t	pcb_rip;
 	register_t	pcb_fsbase;
 	register_t	pcb_gsbase;
+	u_long		pcb_flags;
+#define	PCB_DBREGS	0x02	/* process using debug registers */
+#define	PCB_FPUINITDONE	0x08	/* fpu state is initialized */
+#define	PCB_GS32BIT	0x20	/* linux gs switch */
+#define	PCB_32BIT	0x40	/* process has 32 bit context (segs etc) */
+#define	PCB_FULLCTX	0x80	/* full context restore on sysret */
+
 	u_int32_t	pcb_ds;
 	u_int32_t	pcb_es;
 	u_int32_t	pcb_fs;
@@ -67,12 +74,7 @@ struct pcb {
 	u_int64_t	pcb_dr7;
 
 	struct	savefpu	pcb_save;
-	u_long	pcb_flags;
-#define	PCB_DBREGS	0x02	/* process using debug registers */
-#define	PCB_FPUINITDONE	0x08	/* fpu state is initialized */
-#define	PCB_GS32BIT	0x20	/* linux gs switch */
-#define	PCB_32BIT	0x40	/* process has 32 bit context (segs etc) */
-#define	PCB_FULLCTX	0x80	/* full context restore on sysret */
+	uint16_t	pcb_initial_fpucw;
 
 	caddr_t	pcb_onfault;	/* copyin/out fault recovery */
 

Modified: stable/7/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- stable/7/sys/amd64/linux32/linux32_sysvec.c	Wed Mar 25 17:02:05 2009	(r190417)
+++ stable/7/sys/amd64/linux32/linux32_sysvec.c	Wed Mar 25 17:22:15 2009	(r190418)
@@ -832,6 +832,7 @@ exec_linux_setregs(td, entry, stack, ps_
 	pcb->pcb_es = _udatasel;
 	pcb->pcb_fs = _udatasel;
 	pcb->pcb_gs = _udatasel;
+	pcb->pcb_initial_fpucw = __LINUX_NPXCW__;
 
 	bzero((char *)regs, sizeof(struct trapframe));
 	regs->tf_rip = entry;

Modified: stable/7/sys/compat/linux/linux_misc.h
==============================================================================
--- stable/7/sys/compat/linux/linux_misc.h	Wed Mar 25 17:02:05 2009	(r190417)
+++ stable/7/sys/compat/linux/linux_misc.h	Wed Mar 25 17:22:15 2009	(r190418)
@@ -45,4 +45,9 @@
 #define	LINUX_MREMAP_MAYMOVE	1
 #define	LINUX_MREMAP_FIXED	2
 
+/* Linux sets the i387 to extended precision. */
+#if defined(__i386__) || defined(__amd64__)
+#define	__LINUX_NPXCW__		0x37f
+#endif
+
 #endif	/* _LINUX_MISC_H_ */

Modified: stable/7/sys/i386/i386/machdep.c
==============================================================================
--- stable/7/sys/i386/i386/machdep.c	Wed Mar 25 17:02:05 2009	(r190417)
+++ stable/7/sys/i386/i386/machdep.c	Wed Mar 25 17:22:15 2009	(r190418)
@@ -1188,7 +1188,7 @@ cpu_idle(void)
 void (*cpu_idle_hook)(void) = cpu_idle_default;
 
 /*
- * Clear registers on exec
+ * Reset registers to default values on exec.
  */
 void
 exec_setregs(td, entry, stack, ps_strings)
@@ -1253,6 +1253,7 @@ exec_setregs(td, entry, stack, ps_string
 	 * emulators don't provide an entry point for initialization.
 	 */
 	td->td_pcb->pcb_flags &= ~FP_SOFTFP;
+	pcb->pcb_initial_npxcw = __INITIAL_NPXCW__;
 
 	/*
 	 * Drop the FP state if we hold it, so that the process gets a

Modified: stable/7/sys/i386/i386/mp_machdep.c
==============================================================================
--- stable/7/sys/i386/i386/mp_machdep.c	Wed Mar 25 17:02:05 2009	(r190417)
+++ stable/7/sys/i386/i386/mp_machdep.c	Wed Mar 25 17:22:15 2009	(r190418)
@@ -575,7 +575,7 @@ init_secondary(void)
 	cpu_setregs();
 
 	/* set up FPU state on the AP */
-	npxinit(__INITIAL_NPXCW__);
+	npxinit();
 
 	/* set up SSE registers */
 	enable_sse();

Modified: stable/7/sys/i386/include/npx.h
==============================================================================
--- stable/7/sys/i386/include/npx.h	Wed Mar 25 17:02:05 2009	(r190417)
+++ stable/7/sys/i386/include/npx.h	Wed Mar 25 17:22:15 2009	(r190418)
@@ -151,7 +151,7 @@ void	npxdrop(void);
 void	npxexit(struct thread *td);
 int	npxformat(void);
 int	npxgetregs(struct thread *td, union savefpu *addr);
-void	npxinit(u_short control);
+void	npxinit(void);
 void	npxsave(union savefpu *addr);
 void	npxsetregs(struct thread *td, union savefpu *addr);
 int	npxtrap(void);

Modified: stable/7/sys/i386/include/pcb.h
==============================================================================
--- stable/7/sys/i386/include/pcb.h	Wed Mar 25 17:02:05 2009	(r190417)
+++ stable/7/sys/i386/include/pcb.h	Wed Mar 25 17:22:15 2009	(r190418)
@@ -61,6 +61,7 @@ struct pcb {
 	int     pcb_dr7;
 
 	union	savefpu	pcb_save;
+	uint16_t pcb_initial_npxcw;
 	u_int	pcb_flags;
 #define	FP_SOFTFP	0x01	/* process using software fltng pnt emulator */
 #define	PCB_DBREGS	0x02	/* process using debug registers */

Modified: stable/7/sys/i386/isa/npx.c
==============================================================================
--- stable/7/sys/i386/isa/npx.c	Wed Mar 25 17:02:05 2009	(r190417)
+++ stable/7/sys/i386/isa/npx.c	Wed Mar 25 17:22:15 2009	(r190418)
@@ -132,11 +132,19 @@ void	stop_emulating(void);
 	(cpu_fxsr ? \
 		(thread)->td_pcb->pcb_save.sv_xmm.sv_env.en_sw : \
 		(thread)->td_pcb->pcb_save.sv_87.sv_env.en_sw)
+#define SET_FPU_CW(savefpu, value) do { \
+	if (cpu_fxsr) \
+		(savefpu)->sv_xmm.sv_env.en_cw = (value); \
+	else \
+		(savefpu)->sv_87.sv_env.en_cw = (value); \
+} while (0)
 #else /* CPU_ENABLE_SSE */
 #define GET_FPU_CW(thread) \
 	(thread->td_pcb->pcb_save.sv_87.sv_env.en_cw)
 #define GET_FPU_SW(thread) \
 	(thread->td_pcb->pcb_save.sv_87.sv_env.en_sw)
+#define SET_FPU_CW(savefpu, value) \
+	(savefpu)->sv_87.sv_env.en_cw = (value)
 #endif /* CPU_ENABLE_SSE */
 
 typedef u_char bool_t;
@@ -158,15 +166,13 @@ static	long	timezero(const char *funcnam
 
 int	hw_float;		/* XXX currently just alias for npx_exists */
 
-SYSCTL_INT(_hw,HW_FLOATINGPT, floatingpoint,
-	CTLFLAG_RD, &hw_float, 0, 
-	"Floatingpoint instructions executed in hardware");
+SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD,
+    &hw_float, 0, "Floating point instructions executed in hardware");
 
 static	volatile u_int		npx_intrs_while_probing;
 static	volatile u_int		npx_traps_while_probing;
 
 static	union savefpu		npx_cleanstate;
-static	bool_t			npx_cleanstate_ready;
 static	bool_t			npx_ex16;
 static	bool_t			npx_exists;
 static	bool_t			npx_irq13;
@@ -368,19 +374,14 @@ npx_probe(dev)
 				return (0);
 			}
 			/*
-			 * Worse, even IRQ13 is broken.  Use emulator.
+			 * Worse, even IRQ13 is broken.
 			 */
 		}
 	}
-	/*
-	 * Probe failed, but we want to get to npxattach to initialize the
-	 * emulator and say that it has been installed.  XXX handle devices
-	 * that aren't really devices better.
-	 */
-#ifdef SMP
-	if (mp_ncpus > 1)
-		panic("npx0 cannot be emulated on an SMP system");
-#endif
+
+	/* Probe failed.  Floating point simply won't work. */
+	device_printf(dev, "WARNING: no FPU!\n");
+
 	/* FALLTHROUGH */
 no_irq13:
 	idt[IDT_MF] = save_idt_npxtrap;
@@ -389,7 +390,7 @@ no_irq13:
 		bus_release_resource(dev, SYS_RES_IRQ, irq_rid, irq_res);
 	}
 	bus_release_resource(dev, SYS_RES_IOPORT, ioport_rid, ioport_res);
-	return (0);
+	return (npx_exists ? 0 : ENXIO);
 }
 
 /*
@@ -406,32 +407,34 @@ npx_attach(dev)
 
 	if (npx_irq13)
 		device_printf(dev, "IRQ 13 interface\n");
-	else if (!npx_ex16)
-		device_printf(dev, "WARNING: no FPU!\n");
 	else if (!device_is_quiet(dev) || bootverbose)
 		device_printf(dev, "INT 16 interface\n");
 
-	npxinit(__INITIAL_NPXCW__);
+	npxinit();
 
-	if (npx_cleanstate_ready == 0) {
-		s = intr_disable();
-		stop_emulating();
-		fpusave(&npx_cleanstate);
-		start_emulating();
+	s = intr_disable();
+	stop_emulating();
+	fpusave(&npx_cleanstate);
+	start_emulating();
 #ifdef CPU_ENABLE_SSE
-		if (cpu_fxsr) {
-			if (npx_cleanstate.sv_xmm.sv_env.en_mxcsr_mask)
-				cpu_mxcsr_mask = 
-			    	    npx_cleanstate.sv_xmm.sv_env.en_mxcsr_mask;
-			else
-				cpu_mxcsr_mask = 0xFFBF;
-		}
+	if (cpu_fxsr) {
+		if (npx_cleanstate.sv_xmm.sv_env.en_mxcsr_mask)
+			cpu_mxcsr_mask = 
+			    npx_cleanstate.sv_xmm.sv_env.en_mxcsr_mask;
+		else
+			cpu_mxcsr_mask = 0xFFBF;
+		bzero(npx_cleanstate.sv_xmm.sv_fp,
+		    sizeof(npx_cleanstate.sv_xmm.sv_fp));
+		bzero(npx_cleanstate.sv_xmm.sv_xmm,
+		    sizeof(npx_cleanstate.sv_xmm.sv_xmm));
+		/* XXX might need even more zeroing. */
+	} else
 #endif
-		npx_cleanstate_ready = 1;
-		intr_restore(s);
-	}
+		bzero(npx_cleanstate.sv_87.sv_ac,
+		    sizeof(npx_cleanstate.sv_87.sv_ac));
+	intr_restore(s);
 #ifdef I586_CPU_XXX
-	if (cpu_class == CPUCLASS_586 && npx_ex16 && npx_exists &&
+	if (cpu_class == CPUCLASS_586 && npx_ex16 &&
 	    timezero("i586_bzero()", i586_bzero) <
 	    timezero("bzero()", bzero) * 4 / 5) {
 		if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY))
@@ -452,10 +455,11 @@ npx_attach(dev)
  * Initialize floating point unit.
  */
 void
-npxinit(u_short control)
+npxinit(void)
 {
 	static union savefpu dummy;
 	register_t savecrit;
+	u_short control;
 
 	if (!npx_exists)
 		return;
@@ -472,6 +476,7 @@ npxinit(u_short control)
 	if (cpu_fxsr)
 		fninit();
 #endif
+	control = __INITIAL_NPXCW__;
 	fldcw(&control);
 	start_emulating();
 	intr_restore(savecrit);
@@ -752,14 +757,10 @@ npxtrap()
 static int err_count = 0;
 
 int
-npxdna()
+npxdna(void)
 {
 	struct pcb *pcb;
 	register_t s;
-#ifdef CPU_ENABLE_SSE
-	int mxcsr;
-#endif
-	u_short control;
 
 	if (!npx_exists)
 		return (0);
@@ -788,22 +789,16 @@ npxdna()
 		/*
 		 * This is the first time this thread has used the FPU or
 		 * the PCB doesn't contain a clean FPU state.  Explicitly
-		 * initialize the FPU and load the default control word.
+		 * load sanitized registers.
 		 */
-		fninit();
-		control = __INITIAL_NPXCW__;
-		fldcw(&control);
-#ifdef CPU_ENABLE_SSE
-		if (cpu_fxsr) {
-			mxcsr = __INITIAL_MXCSR__;
-			ldmxcsr(mxcsr);
-		}
-#endif
+		fpurstor(&npx_cleanstate);
+		if (pcb->pcb_initial_npxcw != __INITIAL_NPXCW__)
+			fldcw(&pcb->pcb_initial_npxcw);
 		pcb->pcb_flags |= PCB_NPXINITDONE;
 	} else {
 		/*
-		 * The following frstor may cause an IRQ13 when the state
-		 * being restored has a pending error.  The error will
+		 * The following fpurstor() may cause an IRQ13 when the
+		 * state being restored has a pending error.  The error will
 		 * appear to have been triggered by the current (npx) user
 		 * instruction even when that instruction is a no-wait
 		 * instruction that should not trigger an error (e.g.,
@@ -896,10 +891,8 @@ npxgetregs(td, addr)
 		return (_MC_FPOWNED_NONE);
 
 	if ((td->td_pcb->pcb_flags & PCB_NPXINITDONE) == 0) {
-		if (npx_cleanstate_ready)
-			bcopy(&npx_cleanstate, addr, sizeof(npx_cleanstate));
-		else
-			bzero(addr, sizeof(*addr));
+		bcopy(&npx_cleanstate, addr, sizeof(npx_cleanstate));
+		SET_FPU_CW(addr, td->td_pcb->pcb_initial_npxcw);
 		return (_MC_FPOWNED_NONE);
 	}
 	s = intr_disable();

Modified: stable/7/sys/i386/linux/linux_sysvec.c
==============================================================================
--- stable/7/sys/i386/linux/linux_sysvec.c	Wed Mar 25 17:02:05 2009	(r190417)
+++ stable/7/sys/i386/linux/linux_sysvec.c	Wed Mar 25 17:22:15 2009	(r190418)
@@ -86,9 +86,6 @@ MALLOC_DEFINE(M_LINUX, "linux", "Linux m
 #define	LINUX_SYS_linux_rt_sendsig	0
 #define	LINUX_SYS_linux_sendsig		0
 
-#define	fldcw(addr)		__asm("fldcw %0" : : "m" (*(addr)))
-#define	__LINUX_NPXCW__		0x37f
-
 extern char linux_sigcode[];
 extern int linux_szsigcode;
 
@@ -800,16 +797,15 @@ static void
 exec_linux_setregs(struct thread *td, u_long entry,
 		   u_long stack, u_long ps_strings)
 {
-	static const u_short control = __LINUX_NPXCW__;
 	struct pcb *pcb = td->td_pcb;
 
 	exec_setregs(td, entry, stack, ps_strings);
 
 	/* Linux sets %gs to 0, we default to _udatasel */
-	pcb->pcb_gs = 0; load_gs(0);
+	pcb->pcb_gs = 0;
+	load_gs(0);
 
-	/* Linux sets the i387 to extended precision. */
-	fldcw(&control);
+	pcb->pcb_initial_npxcw = __LINUX_NPXCW__;
 }
 
 struct sysentvec linux_sysvec = {

From owner-svn-src-stable-7@FreeBSD.ORG  Thu Mar 26 12:13:20 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 34F7310657BB;
	Thu, 26 Mar 2009 12:13:20 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 166308FC16;
	Thu, 26 Mar 2009 12:13:20 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2QCDJQj016893;
	Thu, 26 Mar 2009 12:13:19 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2QCDJPB016892;
	Thu, 26 Mar 2009 12:13:19 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200903261213.n2QCDJPB016892@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 26 Mar 2009 12:13: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: r190439 - in stable/7/sys: amd64/linux32 i386/linux
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Thu, 26 Mar 2009 12:13:31 -0000

Author: kib
Date: Thu Mar 26 12:13:19 2009
New Revision: 190439
URL: http://svn.freebsd.org/changeset/base/190439

Log:
  Include linux_misc.h to get the definition for __LINUX_NPXCW__.
  
  Approved by:	re (kensmith)

Modified:
  stable/7/sys/amd64/linux32/linux32_sysvec.c
  stable/7/sys/i386/linux/linux_sysvec.c

Modified: stable/7/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- stable/7/sys/amd64/linux32/linux32_sysvec.c	Thu Mar 26 10:22:40 2009	(r190438)
+++ stable/7/sys/amd64/linux32/linux32_sysvec.c	Thu Mar 26 12:13:19 2009	(r190439)
@@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 

Modified: stable/7/sys/i386/linux/linux_sysvec.c
==============================================================================
--- stable/7/sys/i386/linux/linux_sysvec.c	Thu Mar 26 10:22:40 2009	(r190438)
+++ stable/7/sys/i386/linux/linux_sysvec.c	Thu Mar 26 12:13:19 2009	(r190439)
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 

From owner-svn-src-stable-7@FreeBSD.ORG  Thu Mar 26 13:22:30 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 00D611065776;
	Thu, 26 Mar 2009 13:22:30 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E1F118FC18;
	Thu, 26 Mar 2009 13:22:29 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2QDMTno018790;
	Thu, 26 Mar 2009 13:22:29 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2QDMTF9018789;
	Thu, 26 Mar 2009 13:22:29 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200903261322.n2QDMTF9018789@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Thu, 26 Mar 2009 13:22:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190440 - in stable/7/sys: . contrib/pf dev/cxgb
	netinet6
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, 26 Mar 2009 13:22:30 -0000

Author: bz
Date: Thu Mar 26 13:22:29 2009
New Revision: 190440
URL: http://svn.freebsd.org/changeset/base/190440

Log:
  MFC r186393:
  
    Correct variable name in comment.
  
  Approved by:	re (rwatson)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/netinet6/ip6_input.c

Modified: stable/7/sys/netinet6/ip6_input.c
==============================================================================
--- stable/7/sys/netinet6/ip6_input.c	Thu Mar 26 12:13:19 2009	(r190439)
+++ stable/7/sys/netinet6/ip6_input.c	Thu Mar 26 13:22:29 2009	(r190440)
@@ -155,7 +155,7 @@ ip6_init(void)
 	if (pr == 0)
 		panic("ip6_init");
 
-	/* Initialize the entire ip_protox[] array to IPPROTO_RAW. */
+	/* Initialize the entire ip6_protox[] array to IPPROTO_RAW. */
 	for (i = 0; i < IPPROTO_MAX; i++)
 		ip6_protox[i] = pr - inet6sw;
 	/*

From owner-svn-src-stable-7@FreeBSD.ORG  Thu Mar 26 13:27:27 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 05F5F1065674;
	Thu, 26 Mar 2009 13:27:27 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E60008FC0A;
	Thu, 26 Mar 2009 13:27:26 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2QDRQAI018935;
	Thu, 26 Mar 2009 13:27:26 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2QDRQEr018934;
	Thu, 26 Mar 2009 13:27:26 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200903261327.n2QDRQEr018934@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Thu, 26 Mar 2009 13:27:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190441 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb netinet
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, 26 Mar 2009 13:27:27 -0000

Author: bz
Date: Thu Mar 26 13:27:26 2009
New Revision: 190441
URL: http://svn.freebsd.org/changeset/base/190441

Log:
  MFC r184097:
  
    Update a comment which to my reading had been misplaced in rev. 1.12
    already (but probably had been way above as the code was there twice)
    and describe what was last changed in rev. 1.199 there (which now is
    in sync with in6_src.c r184096(HEAD), r189956(stable/7)).
  
  Approved by:	re (rwatson)

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

Modified: stable/7/sys/netinet/in_pcb.c
==============================================================================
--- stable/7/sys/netinet/in_pcb.c	Thu Mar 26 13:22:29 2009	(r190440)
+++ stable/7/sys/netinet/in_pcb.c	Thu Mar 26 13:27:26 2009	(r190441)
@@ -440,8 +440,9 @@ in_pcbbind_setup(struct inpcb *inp, stru
 		if (pcbinfo != &udbinfo)
 			ipport_tcpallocs++;
 		/*
-		 * Simple check to ensure all ports are not used up causing
-		 * a deadlock here.
+		 * Instead of having two loops further down counting up or down
+		 * make sure that first is always <= last and go with only one
+		 * code path implementing all logic.
 		 *
 		 * We split the two cases (up and down) so that the direction
 		 * is not being tested on each round of the loop.

From owner-svn-src-stable-7@FreeBSD.ORG  Thu Mar 26 14:20:17 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E31F51065857;
	Thu, 26 Mar 2009 14:20:16 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CC35F8FC19;
	Thu, 26 Mar 2009 14:20:16 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2QEKGDw020149;
	Thu, 26 Mar 2009 14:20:16 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2QEKGrk020147;
	Thu, 26 Mar 2009 14:20:16 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200903261420.n2QEKGrk020147@svn.freebsd.org>
From: Robert Watson 
Date: Thu, 26 Mar 2009 14:20:16 +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: r190442 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb netinet
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, 26 Mar 2009 14:20:22 -0000

Author: rwatson
Date: Thu Mar 26 14:20:16 2009
New Revision: 190442
URL: http://svn.freebsd.org/changeset/base/190442

Log:
  Merge r189657 from head to stable/7:
  
    Add INP_INHASHLIST flag for inpcb->inp_flags to indicate whether
    or not the inpcb is currenty on various hash lookup lists, rather
    than using (lport != 0) to detect this.  This means that the full
    4-tuple of a connection can be retained after close, which should
    lead to more sensible netstat output in the window between TCP
    close and socket close.
  
  Approved by:	re (kib)

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

Modified: stable/7/sys/netinet/in_pcb.c
==============================================================================
--- stable/7/sys/netinet/in_pcb.c	Thu Mar 26 13:27:26 2009	(r190441)
+++ stable/7/sys/netinet/in_pcb.c	Thu Mar 26 14:20:16 2009	(r190442)
@@ -1,7 +1,7 @@
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993, 1995
  *	The Regents of the University of California.
- * Copyright (c) 2007 Robert N. M. Watson
+ * Copyright (c) 2007-2009 Robert N. M. Watson
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -955,7 +955,7 @@ in_pcbdrop(struct inpcb *inp)
 	INP_WLOCK_ASSERT(inp);
 
 	inp->inp_vflag |= INP_DROPPED;
-	if (inp->inp_lport) {
+	if (inp->inp_flags & INP_INHASHLIST) {
 		struct inpcbport *phd = inp->inp_phd;
 
 		LIST_REMOVE(inp, inp_hash);
@@ -964,7 +964,7 @@ in_pcbdrop(struct inpcb *inp)
 			LIST_REMOVE(phd, phd_hash);
 			free(phd, M_PCB);
 		}
-		inp->inp_lport = 0;
+		inp->inp_flags &= ~INP_INHASHLIST;
 	}
 }
 
@@ -1344,6 +1344,8 @@ in_pcbinshash(struct inpcb *inp)
 
 	INP_INFO_WLOCK_ASSERT(pcbinfo);
 	INP_WLOCK_ASSERT(inp);
+	KASSERT((inp->inp_flags & INP_INHASHLIST) == 0,
+	    ("in_pcbinshash: INP_INHASHLIST"));
 
 #ifdef INET6
 	if (inp->inp_vflag & INP_IPV6)
@@ -1380,6 +1382,7 @@ in_pcbinshash(struct inpcb *inp)
 	inp->inp_phd = phd;
 	LIST_INSERT_HEAD(&phd->phd_pcblist, inp, inp_portlist);
 	LIST_INSERT_HEAD(pcbhash, inp, inp_hash);
+	inp->inp_flags |= INP_INHASHLIST;
 	return (0);
 }
 
@@ -1398,6 +1401,8 @@ in_pcbrehash(struct inpcb *inp)
 
 	INP_INFO_WLOCK_ASSERT(pcbinfo);
 	INP_WLOCK_ASSERT(inp);
+	KASSERT(inp->inp_flags & INP_INHASHLIST,
+	    ("in_pcbrehash: !INP_INHASHLIST"));
 
 #ifdef INET6
 	if (inp->inp_vflag & INP_IPV6)
@@ -1425,7 +1430,7 @@ in_pcbremlists(struct inpcb *inp)
 	INP_WLOCK_ASSERT(inp);
 
 	inp->inp_gencnt = ++pcbinfo->ipi_gencnt;
-	if (inp->inp_lport) {
+	if (inp->inp_flags & INP_INHASHLIST) {
 		struct inpcbport *phd = inp->inp_phd;
 
 		LIST_REMOVE(inp, inp_hash);
@@ -1434,6 +1439,7 @@ in_pcbremlists(struct inpcb *inp)
 			LIST_REMOVE(phd, phd_hash);
 			free(phd, M_PCB);
 		}
+		inp->inp_flags &= ~INP_INHASHLIST;
 	}
 	LIST_REMOVE(inp, inp_list);
 	pcbinfo->ipi_count--;

Modified: stable/7/sys/netinet/in_pcb.h
==============================================================================
--- stable/7/sys/netinet/in_pcb.h	Thu Mar 26 13:27:26 2009	(r190441)
+++ stable/7/sys/netinet/in_pcb.h	Thu Mar 26 14:20:16 2009	(r190442)
@@ -436,6 +436,7 @@ void 	inp_4tuple_get(struct inpcb *inp, 
 #define	INP_FAITH		0x200	/* accept FAITH'ed connections */
 #define	INP_RECVTTL		0x400	/* receive incoming IP TTL */
 #define	INP_DONTFRAG		0x800	/* don't fragment packet */
+#define	INP_INHASHLIST		0x2000	/* in_pcbinshash() has been called */
 
 #define IN6P_IPV6_V6ONLY	0x008000 /* restrict AF_INET6 socket for v6 */
 

From owner-svn-src-stable-7@FreeBSD.ORG  Thu Mar 26 17:04:09 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 09061106567F;
	Thu, 26 Mar 2009 17:04:09 +0000 (UTC)
	(envelope-from nyan@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E9A788FC20;
	Thu, 26 Mar 2009 17:04:08 +0000 (UTC)
	(envelope-from nyan@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2QH48DB023493;
	Thu, 26 Mar 2009 17:04:08 GMT (envelope-from nyan@svn.freebsd.org)
Received: (from nyan@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2QH48O4023492;
	Thu, 26 Mar 2009 17:04:08 GMT (envelope-from nyan@svn.freebsd.org)
Message-Id: <200903261704.n2QH48O4023492@svn.freebsd.org>
From: Takahashi Yoshihiro 
Date: Thu, 26 Mar 2009 17:04: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: r190444 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb pc98/pc98
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, 26 Mar 2009 17:04:10 -0000

Author: nyan
Date: Thu Mar 26 17:04:08 2009
New Revision: 190444
URL: http://svn.freebsd.org/changeset/base/190444

Log:
  MFC: r189446
  
    Allow different ABIs to use different initial control words for the FPU.
  
  Approved by:	re (Kostik Belousov)

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

Modified: stable/7/sys/pc98/pc98/machdep.c
==============================================================================
--- stable/7/sys/pc98/pc98/machdep.c	Thu Mar 26 16:42:24 2009	(r190443)
+++ stable/7/sys/pc98/pc98/machdep.c	Thu Mar 26 17:04:08 2009	(r190444)
@@ -1155,7 +1155,7 @@ cpu_idle(void)
 void (*cpu_idle_hook)(void) = cpu_idle_default;
 
 /*
- * Clear registers on exec
+ * Reset registers to default values on exec.
  */
 void
 exec_setregs(td, entry, stack, ps_strings)
@@ -1220,6 +1220,7 @@ exec_setregs(td, entry, stack, ps_string
 	 * emulators don't provide an entry point for initialization.
 	 */
 	td->td_pcb->pcb_flags &= ~FP_SOFTFP;
+	pcb->pcb_initial_npxcw = __INITIAL_NPXCW__;
 
 	/*
 	 * Drop the FP state if we hold it, so that the process gets a

From owner-svn-src-stable-7@FreeBSD.ORG  Thu Mar 26 22:54:20 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C0CDD1065670;
	Thu, 26 Mar 2009 22:54:20 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AAE028FC1D;
	Thu, 26 Mar 2009 22:54:20 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2QMsKxP040895;
	Thu, 26 Mar 2009 22:54:20 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2QMsJfC040883;
	Thu, 26 Mar 2009 22:54:19 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200903262254.n2QMsJfC040883@svn.freebsd.org>
From: Robert Watson 
Date: Thu, 26 Mar 2009 22:54: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: r190457 - in stable/7: . sys sys/contrib/pf
	sys/dev/ath/ath_hal sys/dev/cxgb sys/netinet sys/netinet6
	usr.bin/netstat usr.bin/sockstat usr.bin/systat
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, 26 Mar 2009 22:54:21 -0000

Author: rwatson
Date: Thu Mar 26 22:54:19 2009
New Revision: 190457
URL: http://svn.freebsd.org/changeset/base/190457

Log:
  r189615:
  
    Remove now-unused INP_UNMAPPABLEOPTS.
  
    Discussd with: bz
  
  r189637:
  
    Avoid use of IPv6  macro aliases to inpcb fields and inp_flags; we don't
    remove their defintions as some third-party tools may use them (such as
    net-snmp), unlike in the 8.x change.
  
    References to in6p_lport and in6_fport in sockstat are also replaced with
    normal inp_lport and inp_fport references.
  
    Reviewed by:   bz
  
  r189848:
  
    Correct a number of evolved problems with inp_vflag and inp_flags:
    certain flags that should have been in inp_flags ended up in inp_vflag,
    meaning that they were inconsistently locked, and in one case,
    interpreted.  Move the following flags from inp_vflag to gaps in the
    inp_flags space (and clean up the inp_flags constants to make gaps
    more obvious to future takers):
  
      INP_TIMEWAIT
      INP_SOCKREF
      INP_ONESBCAST
      INP_DROPPED
  
    Some aspects of this change have no effect on kernel ABI at all, as these
    are UDP/TCP/IP-internal uses; however, netstat and sockstat detect
    INP_TIMEWAIT when listing TCP sockets, so any MFC will need to take this
    into account.
  
    MFC after:      1 week (or after dependencies are MFC'd)
    Reviewed by:    bz
  
  Note that this change requires netstat, systat, and sockstat to be
  recompiled in order to properly print TIMEWAIT connection state; this
  minor API change (documented in UPDATING) is considered worth it in
  order to fix the above bugs.  This change fixes the INP_ONESBCAST bug
  describted in kern/124282 by disambiguating flag use.
  
  Approved by:    re (kib)
  PR:             kern/124282
  r189637 discussed with:	pav

Modified:
  stable/7/UPDATING
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/netinet/in_pcb.c
  stable/7/sys/netinet/in_pcb.h
  stable/7/sys/netinet/tcp_input.c
  stable/7/sys/netinet/tcp_subr.c
  stable/7/sys/netinet/tcp_timer.c
  stable/7/sys/netinet/tcp_timewait.c
  stable/7/sys/netinet/tcp_usrreq.c
  stable/7/sys/netinet6/in6_pcb.c
  stable/7/usr.bin/netstat/   (props changed)
  stable/7/usr.bin/netstat/inet.c
  stable/7/usr.bin/sockstat/   (props changed)
  stable/7/usr.bin/sockstat/sockstat.c
  stable/7/usr.bin/systat/   (props changed)
  stable/7/usr.bin/systat/netstat.c

Modified: stable/7/UPDATING
==============================================================================
--- stable/7/UPDATING	Thu Mar 26 21:29:38 2009	(r190456)
+++ stable/7/UPDATING	Thu Mar 26 22:54:19 2009	(r190457)
@@ -8,6 +8,11 @@ Items affecting the ports and packages s
 /usr/ports/UPDATING.  Please read that file before running
 portupgrade.
 
+20090326:
+	Following bug-fixes to TCP connection state flags, netstat, systat,
+	and sockstat will need to be rebuilt in order to properly print
+	connections in the TIMEWAIT state.
+
 20090318:
 	Change IPv6 ephemeral port allocation from sequential to
 	random allocation, like IPv4 has done for more than four years.

Modified: stable/7/sys/netinet/in_pcb.c
==============================================================================
--- stable/7/sys/netinet/in_pcb.c	Thu Mar 26 21:29:38 2009	(r190456)
+++ stable/7/sys/netinet/in_pcb.c	Thu Mar 26 22:54:19 2009	(r190457)
@@ -358,7 +358,7 @@ in_pcbbind_setup(struct inpcb *inp, stru
 	 * This entire block sorely needs a rewrite.
 	 */
 				if (t &&
-				    ((t->inp_vflag & INP_TIMEWAIT) == 0) &&
+				    ((t->inp_flags & INP_TIMEWAIT) == 0) &&
 				    (so->so_type != SOCK_STREAM ||
 				     ntohl(t->inp_faddr.s_addr) == INADDR_ANY) &&
 				    (ntohl(sin->sin_addr.s_addr) != INADDR_ANY ||
@@ -371,7 +371,7 @@ in_pcbbind_setup(struct inpcb *inp, stru
 			}
 			t = in_pcblookup_local(pcbinfo, sin->sin_addr,
 			    lport, wild, cred);
-			if (t && (t->inp_vflag & INP_TIMEWAIT)) {
+			if (t && (t->inp_flags & INP_TIMEWAIT)) {
 				/*
 				 * XXXRW: If an incpb has had its timewait
 				 * state recycled, we treat the address as
@@ -954,7 +954,7 @@ in_pcbdrop(struct inpcb *inp)
 	INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo);
 	INP_WLOCK_ASSERT(inp);
 
-	inp->inp_vflag |= INP_DROPPED;
+	inp->inp_flags |= INP_DROPPED;
 	if (inp->inp_flags & INP_INHASHLIST) {
 		struct inpcbport *phd = inp->inp_phd;
 
@@ -1746,6 +1746,22 @@ db_print_inpflags(int inp_flags)
 		db_printf("%sIN6P_AUTOFLOWLABEL", comma ? ", " : "");
 		comma = 1;
 	}
+	if (inp_flags & INP_TIMEWAIT) {
+		db_printf("%sINP_TIMEWAIT", comma ? ", " : "");
+		comma  = 1;
+	}
+	if (inp_flags & INP_ONESBCAST) {
+		db_printf("%sINP_ONESBCAST", comma ? ", " : "");
+		comma  = 1;
+	}
+	if (inp_flags & INP_DROPPED) {
+		db_printf("%sINP_DROPPED", comma ? ", " : "");
+		comma  = 1;
+	}
+	if (inp_flags & INP_SOCKREF) {
+		db_printf("%sINP_SOCKREF", comma ? ", " : "");
+		comma  = 1;
+	}
 	if (inp_flags & IN6P_RFC2292) {
 		db_printf("%sIN6P_RFC2292", comma ? ", " : "");
 		comma = 1;
@@ -1774,22 +1790,6 @@ db_print_inpvflag(u_char inp_vflag)
 		db_printf("%sINP_IPV6PROTO", comma ? ", " : "");
 		comma  = 1;
 	}
-	if (inp_vflag & INP_TIMEWAIT) {
-		db_printf("%sINP_TIMEWAIT", comma ? ", " : "");
-		comma  = 1;
-	}
-	if (inp_vflag & INP_ONESBCAST) {
-		db_printf("%sINP_ONESBCAST", comma ? ", " : "");
-		comma  = 1;
-	}
-	if (inp_vflag & INP_DROPPED) {
-		db_printf("%sINP_DROPPED", comma ? ", " : "");
-		comma  = 1;
-	}
-	if (inp_vflag & INP_SOCKREF) {
-		db_printf("%sINP_SOCKREF", comma ? ", " : "");
-		comma  = 1;
-	}
 }
 
 void

Modified: stable/7/sys/netinet/in_pcb.h
==============================================================================
--- stable/7/sys/netinet/in_pcb.h	Thu Mar 26 21:29:38 2009	(r190456)
+++ stable/7/sys/netinet/in_pcb.h	Thu Mar 26 22:54:19 2009	(r190457)
@@ -416,38 +416,38 @@ void 	inp_4tuple_get(struct inpcb *inp, 
 #define	INP_IPV4	0x1
 #define	INP_IPV6	0x2
 #define	INP_IPV6PROTO	0x4		/* opened under IPv6 protocol */
-#define	INP_TIMEWAIT	0x8		/* inpcb in TIMEWAIT, ppcb is tcptw */
-#define	INP_ONESBCAST	0x10		/* send all-ones broadcast */
-#define	INP_DROPPED	0x20		/* protocol drop flag */
-#define	INP_SOCKREF	0x40		/* strong socket reference */
 
 /*
  * Flags for inp_flag.
  */
-#define	INP_RECVOPTS		0x01	/* receive incoming IP options */
-#define	INP_RECVRETOPTS		0x02	/* receive IP options for reply */
-#define	INP_RECVDSTADDR		0x04	/* receive IP dst address */
-#define	INP_HDRINCL		0x08	/* user supplies entire IP header */
-#define	INP_HIGHPORT		0x10	/* user wants "high" port binding */
-#define	INP_LOWPORT		0x20	/* user wants "low" port binding */
-#define	INP_ANONPORT		0x40	/* port chosen for user */
-#define	INP_RECVIF		0x80	/* receive incoming interface */
-#define	INP_MTUDISC		0x100	/* user can do MTU discovery */
-#define	INP_FAITH		0x200	/* accept FAITH'ed connections */
-#define	INP_RECVTTL		0x400	/* receive incoming IP TTL */
-#define	INP_DONTFRAG		0x800	/* don't fragment packet */
-#define	INP_INHASHLIST		0x2000	/* in_pcbinshash() has been called */
-
-#define IN6P_IPV6_V6ONLY	0x008000 /* restrict AF_INET6 socket for v6 */
-
-#define	IN6P_PKTINFO		0x010000 /* receive IP6 dst and I/F */
-#define	IN6P_HOPLIMIT		0x020000 /* receive hoplimit */
-#define	IN6P_HOPOPTS		0x040000 /* receive hop-by-hop options */
-#define	IN6P_DSTOPTS		0x080000 /* receive dst options after rthdr */
-#define	IN6P_RTHDR		0x100000 /* receive routing header */
-#define	IN6P_RTHDRDSTOPTS	0x200000 /* receive dstoptions before rthdr */
-#define	IN6P_TCLASS		0x400000 /* receive traffic class value */
-#define	IN6P_AUTOFLOWLABEL	0x800000 /* attach flowlabel automatically */
+#define	INP_RECVOPTS		0x00000001 /* receive incoming IP options */
+#define	INP_RECVRETOPTS		0x00000002 /* receive IP options for reply */
+#define	INP_RECVDSTADDR		0x00000004 /* receive IP dst address */
+#define	INP_HDRINCL		0x00000008 /* user supplies entire IP header */
+#define	INP_HIGHPORT		0x00000010 /* user wants "high" port binding */
+#define	INP_LOWPORT		0x00000020 /* user wants "low" port binding */
+#define	INP_ANONPORT		0x00000040 /* port chosen for user */
+#define	INP_RECVIF		0x00000080 /* receive incoming interface */
+#define	INP_MTUDISC		0x00000100 /* user can do MTU discovery */
+#define	INP_FAITH		0x00000200 /* accept FAITH'ed connections */
+#define	INP_RECVTTL		0x00000400 /* receive incoming IP TTL */
+#define	INP_DONTFRAG		0x00000800 /* don't fragment packet */
+#define	INP_NONLOCALOK		0x00001000 /* Allow bind to spoof any address */
+					/* - requires options IP_NONLOCALBIND */
+#define	INP_INHASHLIST		0x00002000 /* in_pcbinshash() has been called */
+#define	IN6P_IPV6_V6ONLY	0x00008000 /* restrict AF_INET6 socket for v6 */
+#define	IN6P_PKTINFO		0x00010000 /* receive IP6 dst and I/F */
+#define	IN6P_HOPLIMIT		0x00020000 /* receive hoplimit */
+#define	IN6P_HOPOPTS		0x00040000 /* receive hop-by-hop options */
+#define	IN6P_DSTOPTS		0x00080000 /* receive dst options after rthdr */
+#define	IN6P_RTHDR		0x00100000 /* receive routing header */
+#define	IN6P_RTHDRDSTOPTS	0x00200000 /* receive dstoptions before rthdr */
+#define	IN6P_TCLASS		0x00400000 /* receive traffic class value */
+#define	IN6P_AUTOFLOWLABEL	0x00800000 /* attach flowlabel automatically */
+#define	INP_TIMEWAIT		0x01000000 /* in TIMEWAIT, ppcb is tcptw */
+#define	INP_ONESBCAST		0x02000000 /* send all-ones broadcast */
+#define	INP_DROPPED		0x04000000 /* protocol drop flag */
+#define	INP_SOCKREF		0x08000000 /* strong socket reference */
 #define	IN6P_RFC2292		0x40000000 /* used RFC2292 API on the socket */
 #define	IN6P_MTU		0x80000000 /* receive path MTU */
 
@@ -457,8 +457,6 @@ void 	inp_4tuple_get(struct inpcb *inp, 
 				 IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\
 				 IN6P_TCLASS|IN6P_AUTOFLOWLABEL|IN6P_RFC2292|\
 				 IN6P_MTU)
-#define	INP_UNMAPPABLEOPTS	(IN6P_HOPOPTS|IN6P_DSTOPTS|IN6P_RTHDR|\
-				 IN6P_TCLASS|IN6P_AUTOFLOWLABEL)
 
  /* for KAME src sync over BSD*'s */
 #define	IN6P_HIGHPORT		INP_HIGHPORT

Modified: stable/7/sys/netinet/tcp_input.c
==============================================================================
--- stable/7/sys/netinet/tcp_input.c	Thu Mar 26 21:29:38 2009	(r190456)
+++ stable/7/sys/netinet/tcp_input.c	Thu Mar 26 22:54:19 2009	(r190457)
@@ -511,7 +511,7 @@ findpcb:
 	 * was a legitimate new connection attempt the old INPCB gets
 	 * removed and we can try again to find a listening socket.
 	 */
-	if (inp->inp_vflag & INP_TIMEWAIT) {
+	if (inp->inp_flags & INP_TIMEWAIT) {
 		if (thflags & TH_SYN)
 			tcp_dooptions(&to, optp, optlen, TO_SYN);
 		/*

Modified: stable/7/sys/netinet/tcp_subr.c
==============================================================================
--- stable/7/sys/netinet/tcp_subr.c	Thu Mar 26 21:29:38 2009	(r190456)
+++ stable/7/sys/netinet/tcp_subr.c	Thu Mar 26 22:54:19 2009	(r190457)
@@ -781,10 +781,10 @@ tcp_close(struct tcpcb *tp)
 	KASSERT(inp->inp_socket != NULL, ("tcp_close: inp_socket NULL"));
 	so = inp->inp_socket;
 	soisdisconnected(so);
-	if (inp->inp_vflag & INP_SOCKREF) {
+	if (inp->inp_flags & INP_SOCKREF) {
 		KASSERT(so->so_state & SS_PROTOREF,
 		    ("tcp_close: !SS_PROTOREF"));
-		inp->inp_vflag &= ~INP_SOCKREF;
+		inp->inp_flags &= ~INP_SOCKREF;
 		INP_WUNLOCK(inp);
 		ACCEPT_LOCK();
 		SOCK_LOCK(so);
@@ -814,7 +814,7 @@ tcp_drain(void)
 	 */
 		INP_INFO_RLOCK(&tcbinfo);
 		LIST_FOREACH(inpb, tcbinfo.ipi_listhead, inp_list) {
-			if (inpb->inp_vflag & INP_TIMEWAIT)
+			if (inpb->inp_flags & INP_TIMEWAIT)
 				continue;
 			INP_WLOCK(inpb);
 			if ((tcpb = intotcpcb(inpb)) != NULL) {
@@ -850,8 +850,8 @@ tcp_notify(struct inpcb *inp, int error)
 	INP_INFO_WLOCK_ASSERT(&tcbinfo);
 	INP_WLOCK_ASSERT(inp);
 
-	if ((inp->inp_vflag & INP_TIMEWAIT) ||
-	    (inp->inp_vflag & INP_DROPPED))
+	if ((inp->inp_flags & INP_TIMEWAIT) ||
+	    (inp->inp_flags & INP_DROPPED))
 		return (inp);
 
 	tp = intotcpcb(inp);
@@ -950,7 +950,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
 			 * TCP state changes, is not quite right, but for
 			 * now, better than nothing.
 			 */
-			if (inp->inp_vflag & INP_TIMEWAIT) {
+			if (inp->inp_flags & INP_TIMEWAIT) {
 				if (intotw(inp) != NULL)
 					error = cr_cansee(req->td->td_ucred,
 					    intotw(inp)->tw_cred);
@@ -981,7 +981,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
 			inp_ppcb = inp->inp_ppcb;
 			if (inp_ppcb == NULL)
 				bzero((char *) &xt.xt_tp, sizeof xt.xt_tp);
-			else if (inp->inp_vflag & INP_TIMEWAIT) {
+			else if (inp->inp_flags & INP_TIMEWAIT) {
 				bzero((char *) &xt.xt_tp, sizeof xt.xt_tp);
 				xt.xt_tp.t_state = TCPS_TIME_WAIT;
 			} else
@@ -1176,8 +1176,8 @@ tcp_ctlinput(int cmd, struct sockaddr *s
 		    ip->ip_src, th->th_sport, 0, NULL);
 		if (inp != NULL)  {
 			INP_WLOCK(inp);
-			if (!(inp->inp_vflag & INP_TIMEWAIT) &&
-			    !(inp->inp_vflag & INP_DROPPED) &&
+			if (!(inp->inp_flags & INP_TIMEWAIT) &&
+			    !(inp->inp_flags & INP_DROPPED) &&
 			    !(inp->inp_socket == NULL)) {
 				icmp_tcp_seq = htonl(th->th_seq);
 				tp = intotcpcb(inp);
@@ -1448,8 +1448,8 @@ tcp_drop_syn_sent(struct inpcb *inp, int
 	INP_INFO_WLOCK_ASSERT(&tcbinfo);
 	INP_WLOCK_ASSERT(inp);
 
-	if ((inp->inp_vflag & INP_TIMEWAIT) ||
-	    (inp->inp_vflag & INP_DROPPED))
+	if ((inp->inp_flags & INP_TIMEWAIT) ||
+	    (inp->inp_flags & INP_DROPPED))
 		return (inp);
 
 	tp = intotcpcb(inp);
@@ -1482,8 +1482,8 @@ tcp_mtudisc(struct inpcb *inp, int errno
 #endif /* INET6 */
 
 	INP_WLOCK_ASSERT(inp);
-	if ((inp->inp_vflag & INP_TIMEWAIT) ||
-	    (inp->inp_vflag & INP_DROPPED))
+	if ((inp->inp_flags & INP_TIMEWAIT) ||
+	    (inp->inp_flags & INP_DROPPED))
 		return (inp);
 
 	tp = intotcpcb(inp);
@@ -2108,7 +2108,7 @@ sysctl_drop(SYSCTL_HANDLER_ARGS)
 	}
 	if (inp != NULL) {
 		INP_WLOCK(inp);
-		if (inp->inp_vflag & INP_TIMEWAIT) {
+		if (inp->inp_flags & INP_TIMEWAIT) {
 			/*
 			 * XXXRW: There currently exists a state where an
 			 * inpcb is present, but its timewait state has been
@@ -2120,7 +2120,7 @@ sysctl_drop(SYSCTL_HANDLER_ARGS)
 				tcp_twclose(tw, 0);
 			else
 				INP_WUNLOCK(inp);
-		} else if (!(inp->inp_vflag & INP_DROPPED) &&
+		} else if (!(inp->inp_flags & INP_DROPPED) &&
 			   !(inp->inp_socket->so_options & SO_ACCEPTCONN)) {
 			tp = intotcpcb(inp);
 			tp = tcp_drop(tp, ECONNABORTED);

Modified: stable/7/sys/netinet/tcp_timer.c
==============================================================================
--- stable/7/sys/netinet/tcp_timer.c	Thu Mar 26 21:29:38 2009	(r190456)
+++ stable/7/sys/netinet/tcp_timer.c	Thu Mar 26 22:54:19 2009	(r190457)
@@ -168,7 +168,7 @@ tcp_timer_delack(void *xtp)
 	}
 	INP_WLOCK(inp);
 	INP_INFO_RUNLOCK(&tcbinfo);
-	if ((inp->inp_vflag & INP_DROPPED) || callout_pending(&tp->t_timers->tt_delack)
+	if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_delack)
 	    || !callout_active(&tp->t_timers->tt_delack)) {
 		INP_WUNLOCK(inp);
 		return;
@@ -210,7 +210,7 @@ tcp_timer_2msl(void *xtp)
 	}
 	INP_WLOCK(inp);
 	tcp_free_sackholes(tp);
-	if ((inp->inp_vflag & INP_DROPPED) || callout_pending(&tp->t_timers->tt_2msl) ||
+	if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_2msl) ||
 	    !callout_active(&tp->t_timers->tt_2msl)) {
 		INP_WUNLOCK(tp->t_inpcb);
 		INP_INFO_WUNLOCK(&tcbinfo);
@@ -277,7 +277,7 @@ tcp_timer_keep(void *xtp)
 		return;
 	}
 	INP_WLOCK(inp);
-	if ((inp->inp_vflag & INP_DROPPED) || callout_pending(&tp->t_timers->tt_keep)
+	if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_keep)
 	    || !callout_active(&tp->t_timers->tt_keep)) {
 		INP_WUNLOCK(inp);
 		INP_INFO_WUNLOCK(&tcbinfo);
@@ -367,7 +367,7 @@ tcp_timer_persist(void *xtp)
 		return;
 	}
 	INP_WLOCK(inp);
-	if ((inp->inp_vflag & INP_DROPPED) || callout_pending(&tp->t_timers->tt_persist)
+	if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_persist)
 	    || !callout_active(&tp->t_timers->tt_persist)) {
 		INP_WUNLOCK(inp);
 		INP_INFO_WUNLOCK(&tcbinfo);
@@ -436,7 +436,7 @@ tcp_timer_rexmt(void * xtp)
 		return;
 	}
 	INP_WLOCK(inp);
-	if ((inp->inp_vflag & INP_DROPPED) || callout_pending(&tp->t_timers->tt_rexmt)
+	if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_rexmt)
 	    || !callout_active(&tp->t_timers->tt_rexmt)) {
 		INP_WUNLOCK(inp);
 		INP_INFO_WUNLOCK(&tcbinfo);

Modified: stable/7/sys/netinet/tcp_timewait.c
==============================================================================
--- stable/7/sys/netinet/tcp_timewait.c	Thu Mar 26 21:29:38 2009	(r190456)
+++ stable/7/sys/netinet/tcp_timewait.c	Thu Mar 26 22:54:19 2009	(r190457)
@@ -256,17 +256,17 @@ tcp_twstart(struct tcpcb *tp)
 	if (acknow)
 		tcp_twrespond(tw, TH_ACK);
 	inp->inp_ppcb = tw;
-	inp->inp_vflag |= INP_TIMEWAIT;
+	inp->inp_flags |= INP_TIMEWAIT;
 	tcp_tw_2msl_reset(tw, 0);
 
 	/*
 	 * If the inpcb owns the sole reference to the socket, then we can
 	 * detach and free the socket as it is not needed in time wait.
 	 */
-	if (inp->inp_vflag & INP_SOCKREF) {
+	if (inp->inp_flags & INP_SOCKREF) {
 		KASSERT(so->so_state & SS_PROTOREF,
 		    ("tcp_twstart: !SS_PROTOREF"));
-		inp->inp_vflag &= ~INP_SOCKREF;
+		inp->inp_flags &= ~INP_SOCKREF;
 		INP_WUNLOCK(inp);
 		ACCEPT_LOCK();
 		SOCK_LOCK(so);
@@ -466,7 +466,7 @@ tcp_twclose(struct tcptw *tw, int reuse)
 	 *     notify the socket layer.
 	 */
 	inp = tw->tw_inpcb;
-	KASSERT((inp->inp_vflag & INP_TIMEWAIT), ("tcp_twclose: !timewait"));
+	KASSERT((inp->inp_flags & INP_TIMEWAIT), ("tcp_twclose: !timewait"));
 	KASSERT(intotw(inp) == tw, ("tcp_twclose: inp_ppcb != tw"));
 	INP_INFO_WLOCK_ASSERT(&tcbinfo);	/* tcp_tw_2msl_stop(). */
 	INP_WLOCK_ASSERT(inp);
@@ -484,8 +484,8 @@ tcp_twclose(struct tcptw *tw, int reuse)
 		 * in which case another reference exists (XXXRW: think
 		 * about this more), and we don't need to take action.
 		 */
-		if (inp->inp_vflag & INP_SOCKREF) {
-			inp->inp_vflag &= ~INP_SOCKREF;
+		if (inp->inp_flags & INP_SOCKREF) {
+			inp->inp_flags &= ~INP_SOCKREF;
 			INP_WUNLOCK(inp);
 			ACCEPT_LOCK();
 			SOCK_LOCK(so);

Modified: stable/7/sys/netinet/tcp_usrreq.c
==============================================================================
--- stable/7/sys/netinet/tcp_usrreq.c	Thu Mar 26 21:29:38 2009	(r190456)
+++ stable/7/sys/netinet/tcp_usrreq.c	Thu Mar 26 22:54:19 2009	(r190457)
@@ -164,7 +164,7 @@ tcp_detach(struct socket *so, struct inp
 
 	tp = intotcpcb(inp);
 
-	if (inp->inp_vflag & INP_TIMEWAIT) {
+	if (inp->inp_flags & INP_TIMEWAIT) {
 		/*
 		 * There are two cases to handle: one in which the time wait
 		 * state is being discarded (INP_DROPPED), and one in which
@@ -177,7 +177,7 @@ tcp_detach(struct socket *so, struct inp
 		 *
 		 * XXXRW: Would it be cleaner to free the tcptw here?
 		 */
-		if (inp->inp_vflag & INP_DROPPED) {
+		if (inp->inp_flags & INP_DROPPED) {
 			KASSERT(tp == NULL, ("tcp_detach: INP_TIMEWAIT && "
 			    "INP_DROPPED && tp != NULL"));
 			in_pcbdetach(inp);
@@ -196,7 +196,7 @@ tcp_detach(struct socket *so, struct inp
 		 *
 		 * XXXRW: Does the second case still occur?
 		 */
-		if (inp->inp_vflag & INP_DROPPED ||
+		if (inp->inp_flags & INP_DROPPED ||
 		    tp->t_state < TCPS_SYN_SENT) {
 			tcp_discardcb(tp);
 			in_pcbdetach(inp);
@@ -255,7 +255,7 @@ tcp_usr_bind(struct socket *so, struct s
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("tcp_usr_bind: inp == NULL"));
 	INP_WLOCK(inp);
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
 		error = EINVAL;
 		goto out;
 	}
@@ -295,7 +295,7 @@ tcp6_usr_bind(struct socket *so, struct 
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("tcp6_usr_bind: inp == NULL"));
 	INP_WLOCK(inp);
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
 		error = EINVAL;
 		goto out;
 	}
@@ -341,7 +341,7 @@ tcp_usr_listen(struct socket *so, int ba
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("tcp_usr_listen: inp == NULL"));
 	INP_WLOCK(inp);
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
 		error = EINVAL;
 		goto out;
 	}
@@ -378,7 +378,7 @@ tcp6_usr_listen(struct socket *so, int b
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("tcp6_usr_listen: inp == NULL"));
 	INP_WLOCK(inp);
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
 		error = EINVAL;
 		goto out;
 	}
@@ -438,7 +438,7 @@ tcp_usr_connect(struct socket *so, struc
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("tcp_usr_connect: inp == NULL"));
 	INP_WLOCK(inp);
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
 		error = EINVAL;
 		goto out;
 	}
@@ -479,7 +479,7 @@ tcp6_usr_connect(struct socket *so, stru
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("tcp6_usr_connect: inp == NULL"));
 	INP_WLOCK(inp);
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
 		error = EINVAL;
 		goto out;
 	}
@@ -544,7 +544,7 @@ tcp_usr_disconnect(struct socket *so)
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("tcp_usr_disconnect: inp == NULL"));
 	INP_WLOCK(inp);
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
 		error = ECONNRESET;
 		goto out;
 	}
@@ -580,7 +580,7 @@ tcp_usr_accept(struct socket *so, struct
 	KASSERT(inp != NULL, ("tcp_usr_accept: inp == NULL"));
 	INP_INFO_RLOCK(&tcbinfo);
 	INP_WLOCK(inp);
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
 		error = ECONNABORTED;
 		goto out;
 	}
@@ -623,7 +623,7 @@ tcp6_usr_accept(struct socket *so, struc
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("tcp6_usr_accept: inp == NULL"));
 	INP_WLOCK(inp);
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
 		error = ECONNABORTED;
 		goto out;
 	}
@@ -672,7 +672,7 @@ tcp_usr_shutdown(struct socket *so)
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("inp == NULL"));
 	INP_WLOCK(inp);
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
 		error = ECONNRESET;
 		goto out;
 	}
@@ -680,7 +680,7 @@ tcp_usr_shutdown(struct socket *so)
 	TCPDEBUG1();
 	socantsendmore(so);
 	tcp_usrclosed(tp);
-	if (!(inp->inp_vflag & INP_DROPPED))
+	if (!(inp->inp_flags & INP_DROPPED))
 		error = tcp_output_disconnect(tp);
 
 out:
@@ -705,7 +705,7 @@ tcp_usr_rcvd(struct socket *so, int flag
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("tcp_usr_rcvd: inp == NULL"));
 	INP_WLOCK(inp);
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
 		error = ECONNRESET;
 		goto out;
 	}
@@ -755,7 +755,7 @@ tcp_usr_send(struct socket *so, int flag
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("tcp_usr_send: inp == NULL"));
 	INP_WLOCK(inp);
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
 		if (control)
 			m_freem(control);
 		if (m)
@@ -813,7 +813,7 @@ tcp_usr_send(struct socket *so, int flag
 			INP_INFO_WUNLOCK(&tcbinfo);
 			headlocked = 0;
 		}
-		if (!(inp->inp_vflag & INP_DROPPED)) {
+		if (!(inp->inp_flags & INP_DROPPED)) {
 			if (flags & PRUS_MORETOCOME)
 				tp->t_flags |= TF_MORETOCOME;
 			error = tcp_output_send(tp);
@@ -900,18 +900,18 @@ tcp_usr_abort(struct socket *so)
 	/*
 	 * If we still have full TCP state, and we're not dropped, drop.
 	 */
-	if (!(inp->inp_vflag & INP_TIMEWAIT) &&
-	    !(inp->inp_vflag & INP_DROPPED)) {
+	if (!(inp->inp_flags & INP_TIMEWAIT) &&
+	    !(inp->inp_flags & INP_DROPPED)) {
 		tp = intotcpcb(inp);
 		TCPDEBUG1();
 		tcp_drop(tp, ECONNABORTED);
 		TCPDEBUG2(PRU_ABORT);
 	}
-	if (!(inp->inp_vflag & INP_DROPPED)) {
+	if (!(inp->inp_flags & INP_DROPPED)) {
 		SOCK_LOCK(so);
 		so->so_state |= SS_PROTOREF;
 		SOCK_UNLOCK(so);
-		inp->inp_vflag |= INP_SOCKREF;
+		inp->inp_flags |= INP_SOCKREF;
 	}
 	INP_WUNLOCK(inp);
 	INP_INFO_WUNLOCK(&tcbinfo);
@@ -939,18 +939,18 @@ tcp_usr_close(struct socket *so)
 	 * If we still have full TCP state, and we're not dropped, initiate
 	 * a disconnect.
 	 */
-	if (!(inp->inp_vflag & INP_TIMEWAIT) &&
-	    !(inp->inp_vflag & INP_DROPPED)) {
+	if (!(inp->inp_flags & INP_TIMEWAIT) &&
+	    !(inp->inp_flags & INP_DROPPED)) {
 		tp = intotcpcb(inp);
 		TCPDEBUG1();
 		tcp_disconnect(tp);
 		TCPDEBUG2(PRU_CLOSE);
 	}
-	if (!(inp->inp_vflag & INP_DROPPED)) {
+	if (!(inp->inp_flags & INP_DROPPED)) {
 		SOCK_LOCK(so);
 		so->so_state |= SS_PROTOREF;
 		SOCK_UNLOCK(so);
-		inp->inp_vflag |= INP_SOCKREF;
+		inp->inp_flags |= INP_SOCKREF;
 	}
 	INP_WUNLOCK(inp);
 	INP_INFO_WUNLOCK(&tcbinfo);
@@ -970,7 +970,7 @@ tcp_usr_rcvoob(struct socket *so, struct
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("tcp_usr_rcvoob: inp == NULL"));
 	INP_WLOCK(inp);
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
 		error = ECONNRESET;
 		goto out;
 	}
@@ -1221,7 +1221,7 @@ tcp_fill_info(struct tcpcb *tp, struct t
  */
 #define INP_WLOCK_RECHECK(inp) do {					\
 	INP_WLOCK(inp);							\
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {		\
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {		\
 		INP_WUNLOCK(inp);					\
 		return (ECONNRESET);					\
 	}								\
@@ -1254,7 +1254,7 @@ tcp_ctloutput(struct socket *so, struct 
 #endif
 		return (error);
 	}
-	if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
+	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
 		INP_WUNLOCK(inp);
 		return (ECONNRESET);
 	}
@@ -1490,7 +1490,7 @@ tcp_disconnect(struct tcpcb *tp)
 		soisdisconnecting(so);
 		sbflush(&so->so_rcv);
 		tcp_usrclosed(tp);
-		if (!(inp->inp_vflag & INP_DROPPED))
+		if (!(inp->inp_flags & INP_DROPPED))
 			tcp_output_disconnect(tp);
 	}
 }

Modified: stable/7/sys/netinet6/in6_pcb.c
==============================================================================
--- stable/7/sys/netinet6/in6_pcb.c	Thu Mar 26 21:29:38 2009	(r190456)
+++ stable/7/sys/netinet6/in6_pcb.c	Thu Mar 26 22:54:19 2009	(r190457)
@@ -191,7 +191,7 @@ in6_pcbbind(register struct inpcb *inp, 
 				    &sin6->sin6_addr, lport,
 				    INPLOOKUP_WILDCARD, cred);
 				if (t &&
-				    ((t->inp_vflag & INP_TIMEWAIT) == 0) &&
+				    ((t->inp_flags & INP_TIMEWAIT) == 0) &&
 				    (so->so_type != SOCK_STREAM ||
 				     IN6_IS_ADDR_UNSPECIFIED(&t->in6p_faddr)) &&
 				    (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr) ||
@@ -209,7 +209,7 @@ in6_pcbbind(register struct inpcb *inp, 
 					    sin.sin_addr, lport,
 					    INPLOOKUP_WILDCARD, cred);
 					if (t &&
-					    ((t->inp_vflag &
+					    ((t->inp_flags &
 					      INP_TIMEWAIT) == 0) &&
 					    (so->so_type != SOCK_STREAM ||
 					     ntohl(t->inp_faddr.s_addr) ==
@@ -221,7 +221,7 @@ in6_pcbbind(register struct inpcb *inp, 
 			}
 			t = in6_pcblookup_local(pcbinfo, &sin6->sin6_addr,
 			    lport, wild, cred);
-			if (t && (reuseport & ((t->inp_vflag & INP_TIMEWAIT) ?
+			if (t && (reuseport & ((t->inp_flags & INP_TIMEWAIT) ?
 			    intotw(t)->tw_so_options :
 			    t->inp_socket->so_options)) == 0)
 				return (EADDRINUSE);
@@ -232,7 +232,7 @@ in6_pcbbind(register struct inpcb *inp, 
 				in6_sin6_2_sin(&sin, sin6);
 				t = in_pcblookup_local(pcbinfo, sin.sin_addr,
 				    lport, wild, cred);
-				if (t && t->inp_vflag & INP_TIMEWAIT) {
+				if (t && t->inp_flags & INP_TIMEWAIT) {
 					if ((reuseport &
 					    intotw(t)->tw_so_options) == 0 &&
 					    (ntohl(t->inp_laddr.s_addr) !=

Modified: stable/7/usr.bin/netstat/inet.c
==============================================================================
--- stable/7/usr.bin/netstat/inet.c	Thu Mar 26 21:29:38 2009	(r190456)
+++ stable/7/usr.bin/netstat/inet.c	Thu Mar 26 22:54:19 2009	(r190457)
@@ -255,7 +255,7 @@ pcblist_kvm(u_long off, char **bufp, int
 		if (istcp) {
 			if (inp->inp_ppcb == NULL)
 				bzero(&xt.xt_tp, sizeof xt.xt_tp);
-			else if (inp->inp_vflag & INP_TIMEWAIT) {
+			else if (inp->inp_flags & INP_TIMEWAIT) {
 				bzero(&xt.xt_tp, sizeof xt.xt_tp);
 				xt.xt_tp.t_state = TCPS_TIME_WAIT;
 			} else

Modified: stable/7/usr.bin/sockstat/sockstat.c
==============================================================================
--- stable/7/usr.bin/sockstat/sockstat.c	Thu Mar 26 21:29:38 2009	(r190456)
+++ stable/7/usr.bin/sockstat/sockstat.c	Thu Mar 26 22:54:19 2009	(r190457)
@@ -343,8 +343,8 @@ gather_inet(int proto)
 			    (inp->inp_fport != 0 && !opt_c))
 				continue;
 		} else if (inp->inp_vflag & INP_IPV6) {
-			if ((inp->in6p_fport == 0 && !opt_l) ||
-			    (inp->in6p_fport != 0 && !opt_c))
+			if ((inp->inp_fport == 0 && !opt_l) ||
+			    (inp->inp_fport != 0 && !opt_c))
 				continue;
 		} else {
 			if (opt_v)
@@ -364,9 +364,9 @@ gather_inet(int proto)
 		} else if (inp->inp_vflag & INP_IPV6) {
 			sock->family = AF_INET6;
 			sockaddr(&sock->laddr, sock->family,
-			    &inp->in6p_laddr, inp->in6p_lport);
+			    &inp->in6p_laddr, inp->inp_lport);
 			sockaddr(&sock->faddr, sock->family,
-			    &inp->in6p_faddr, inp->in6p_fport);
+			    &inp->in6p_faddr, inp->inp_fport);
 		}
 		sock->vflag = inp->inp_vflag;
 		sock->protoname = protoname;

Modified: stable/7/usr.bin/systat/netstat.c
==============================================================================
--- stable/7/usr.bin/systat/netstat.c	Thu Mar 26 21:29:38 2009	(r190456)
+++ stable/7/usr.bin/systat/netstat.c	Thu Mar 26 22:54:19 2009	(r190457)
@@ -223,7 +223,7 @@ again:
 		if (nports && !checkport(&inpcb))
 			continue;
 		if (istcp) {
-			if (inpcb.inp_vflag & INP_TIMEWAIT) {
+			if (inpcb.inp_flags & INP_TIMEWAIT) {
 				bzero(&sockb, sizeof(sockb));
 				enter_kvm(&inpcb, &sockb, TCPS_TIME_WAIT,
 					 "tcp");

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

Author: kib
Date: Fri Mar 27 13:05:29 2009
New Revision: 190465
URL: http://svn.freebsd.org/changeset/base/190465

Log:
  MFC r190141:
  When ktracing namei operations, log a result of the __getcwd().
  
  Approved by:	re (kensmith)

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

Modified: stable/7/sys/kern/vfs_cache.c
==============================================================================
--- stable/7/sys/kern/vfs_cache.c	Fri Mar 27 11:03:02 2009	(r190464)
+++ stable/7/sys/kern/vfs_cache.c	Fri Mar 27 13:05:29 2009	(r190465)
@@ -35,6 +35,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_ktrace.h"
+
 #include 
 #include 
 #include 
@@ -50,6 +52,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#ifdef KTRACE
+#include 
+#endif
 
 #include 
 
@@ -737,6 +742,10 @@ kern___getcwd(struct thread *td, u_char 
 			bcopy(bp, buf, strlen(bp) + 1);
 		else
 			error = copyout(bp, buf, strlen(bp) + 1);
+#ifdef KTRACE
+	if (KTRPOINT(curthread, KTR_NAMEI))
+		ktrnamei(bp);
+#endif
 	}
 	free(tmpbuf, M_TEMP);
 	return (error);

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Mar 27 15:19:52 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 84396106564A;
	Fri, 27 Mar 2009 15:19:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 717718FC1B;
	Fri, 27 Mar 2009 15:19:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2RFJqR8064324;
	Fri, 27 Mar 2009 15:19:52 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2RFJqA4064323;
	Fri, 27 Mar 2009 15:19:52 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200903271519.n2RFJqA4064323@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 27 Mar 2009 15:19:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190467 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb dev/my
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, 27 Mar 2009 15:19:53 -0000

Author: jhb
Date: Fri Mar 27 15:19:51 2009
New Revision: 190467
URL: http://svn.freebsd.org/changeset/base/190467

Log:
  MFC: Release driver lock at the end of the watchdog routine instead of
  trying to acquire it again.
  
  Approved by:	re (kib)

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

Modified: stable/7/sys/dev/my/if_my.c
==============================================================================
--- stable/7/sys/dev/my/if_my.c	Fri Mar 27 13:13:59 2009	(r190466)
+++ stable/7/sys/dev/my/if_my.c	Fri Mar 27 15:19:51 2009	(r190467)
@@ -1700,7 +1700,7 @@ my_watchdog(struct ifnet * ifp)
 	my_init_locked(sc);
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		my_start_locked(ifp);
-	MY_LOCK(sc);
+	MY_UNLOCK(sc);
 	return;
 }
 

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Mar 27 15:45:53 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 081B0106567D;
	Fri, 27 Mar 2009 15:45:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DF6D78FC23;
	Fri, 27 Mar 2009 15:45:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2RFjqd2064930;
	Fri, 27 Mar 2009 15:45:52 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2RFjqan064928;
	Fri, 27 Mar 2009 15:45:52 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200903271545.n2RFjqan064928@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 27 Mar 2009 15:45:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190468 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb kern
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 27 Mar 2009 15:45:53 -0000

Author: jhb
Date: Fri Mar 27 15:45:52 2009
New Revision: 190468
URL: http://svn.freebsd.org/changeset/base/190468

Log:
  MFC: Improve the description of a few sysctls.
  
  Approved by:	re (kib)

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

Modified: stable/7/sys/kern/subr_param.c
==============================================================================
--- stable/7/sys/kern/subr_param.c	Fri Mar 27 15:19:51 2009	(r190467)
+++ stable/7/sys/kern/subr_param.c	Fri Mar 27 15:45:52 2009	(r190468)
@@ -86,29 +86,30 @@ u_long	dflssiz;			/* initial stack size 
 u_long	maxssiz;			/* max stack size */
 u_long	sgrowsiz;			/* amount to grow stack */
 
-SYSCTL_INT(_kern, OID_AUTO, hz, CTLFLAG_RDTUN, &hz, 0, "ticks/second");
+SYSCTL_INT(_kern, OID_AUTO, hz, CTLFLAG_RDTUN, &hz, 0,
+    "Number of clock ticks per second");
 SYSCTL_INT(_kern, OID_AUTO, ncallout, CTLFLAG_RDTUN, &ncallout, 0,
     "Number of pre-allocated timer events");
 SYSCTL_INT(_kern, OID_AUTO, nbuf, CTLFLAG_RDTUN, &nbuf, 0,
-    "Number of buffer-cache I/O buffers");
+    "Number of buffers in the buffer cache");
 SYSCTL_INT(_kern, OID_AUTO, nswbuf, CTLFLAG_RDTUN, &nswbuf, 0,
     "Number of swap buffers");
 SYSCTL_INT(_kern, OID_AUTO, maxswzone, CTLFLAG_RDTUN, &maxswzone, 0,
-    "max swmeta KVA storage");
+    "Maximum memory for swap metadata");
 SYSCTL_INT(_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN, &maxbcache, 0,
-    "max buffer cache KVA storage");
+    "Maximum value of vfs.maxbufspace");
 SYSCTL_ULONG(_kern, OID_AUTO, maxtsiz, CTLFLAG_RDTUN, &maxtsiz, 0,
-    "max text size");
+    "Maximum text size");
 SYSCTL_ULONG(_kern, OID_AUTO, dfldsiz, CTLFLAG_RDTUN, &dfldsiz, 0,
-    "initial data size limit");
+    "Initial data size limit");
 SYSCTL_ULONG(_kern, OID_AUTO, maxdsiz, CTLFLAG_RDTUN, &maxdsiz, 0,
-    "max data size");
+    "Maximum data size");
 SYSCTL_ULONG(_kern, OID_AUTO, dflssiz, CTLFLAG_RDTUN, &dflssiz, 0,
-    "initial stack size limit");
+    "Initial stack size limit");
 SYSCTL_ULONG(_kern, OID_AUTO, maxssiz, CTLFLAG_RDTUN, &maxssiz, 0,
-    "max stack size");
+    "Maximum stack size");
 SYSCTL_ULONG(_kern, OID_AUTO, sgrowsiz, CTLFLAG_RDTUN, &sgrowsiz, 0,
-    "amount to grow stack");
+    "Amount to grow stack on a stack fault");
 
 /*
  * These have to be allocated somewhere; allocating

Modified: stable/7/sys/kern/vfs_bio.c
==============================================================================
--- stable/7/sys/kern/vfs_bio.c	Fri Mar 27 15:19:51 2009	(r190467)
+++ stable/7/sys/kern/vfs_bio.c	Fri Mar 27 15:45:52 2009	(r190468)
@@ -117,7 +117,7 @@ SYSCTL_INT(_vfs, OID_AUTO, runningbufspa
     "Amount of presently outstanding async buffer io");
 static int bufspace;
 SYSCTL_INT(_vfs, OID_AUTO, bufspace, CTLFLAG_RD, &bufspace, 0,
-    "KVA memory used for bufs");
+    "Virtual memory used for buffers");
 static int maxbufspace;
 SYSCTL_INT(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0,
     "Maximum allowed value of bufspace (including buf_daemon)");

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Mar 27 15:57:53 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6D1581065673;
	Fri, 27 Mar 2009 15:57:53 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 54B2F8FC22;
	Fri, 27 Mar 2009 15:57:53 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2RFvrf6065251;
	Fri, 27 Mar 2009 15:57:53 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2RFvruq065248;
	Fri, 27 Mar 2009 15:57:53 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200903271557.n2RFvruq065248@svn.freebsd.org>
From: Konstantin Belousov 
Date: Fri, 27 Mar 2009 15:57: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: r190470 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb ufs/ffs ufs/ufs
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, 27 Mar 2009 15:57:59 -0000

Author: kib
Date: Fri Mar 27 15:57:52 2009
New Revision: 190470
URL: http://svn.freebsd.org/changeset/base/190470

Log:
  MFC r189737:
  The non-modifying EA VOPs are executed with only shared vnode lock taken.
  Provide a custom lock around initializing and tearing down EA area,
  to prevent both memory leaks and double-free of it. Count the number
  of EA area accessors.
  
  Put the new field i_ea_refs to the end of the struct inode to keep
  structure layout stable on releng branch for the benefit of lsof.
  
  MFC r190469:
  Correct typo.
  
  ABI issue pointed out by:	kensmith
  Approved by:	re (kensmith)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/ufs/ffs/ffs_vfsops.c
  stable/7/sys/ufs/ffs/ffs_vnops.c
  stable/7/sys/ufs/ufs/inode.h

Modified: stable/7/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- stable/7/sys/ufs/ffs/ffs_vfsops.c	Fri Mar 27 15:46:02 2009	(r190469)
+++ stable/7/sys/ufs/ffs/ffs_vfsops.c	Fri Mar 27 15:57:52 2009	(r190470)
@@ -1451,6 +1451,7 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags
 	ip->i_fs = fs;
 	ip->i_dev = dev;
 	ip->i_number = ino;
+	ip->i_ea_refs = 0;
 #ifdef QUOTA
 	{
 		int i;

Modified: stable/7/sys/ufs/ffs/ffs_vnops.c
==============================================================================
--- stable/7/sys/ufs/ffs/ffs_vnops.c	Fri Mar 27 15:46:02 2009	(r190469)
+++ stable/7/sys/ufs/ffs/ffs_vnops.c	Fri Mar 27 15:57:52 2009	(r190470)
@@ -1225,6 +1225,35 @@ ffs_rdextattr(u_char **p, struct vnode *
 	return (0);
 }
 
+static void
+ffs_lock_ea(struct vnode *vp)
+{
+	struct inode *ip;
+
+	ip = VTOI(vp);
+	VI_LOCK(vp);
+	while (ip->i_flag & IN_EA_LOCKED) {
+		ip->i_flag |= IN_EA_LOCKWAIT;
+		msleep(&ip->i_ea_refs, &vp->v_interlock, PINOD + 2, "ufs_ea",
+		    0);
+	}
+	ip->i_flag |= IN_EA_LOCKED;
+	VI_UNLOCK(vp);
+}
+
+static void
+ffs_unlock_ea(struct vnode *vp)
+{
+	struct inode *ip;
+
+	ip = VTOI(vp);
+	VI_LOCK(vp);
+	if (ip->i_flag & IN_EA_LOCKWAIT)
+		wakeup(&ip->i_ea_refs);
+	ip->i_flag &= ~(IN_EA_LOCKED | IN_EA_LOCKWAIT);
+	VI_UNLOCK(vp);
+}
+
 static int
 ffs_open_ea(struct vnode *vp, struct ucred *cred, struct thread *td)
 {
@@ -1234,14 +1263,22 @@ ffs_open_ea(struct vnode *vp, struct ucr
 
 	ip = VTOI(vp);
 
-	if (ip->i_ea_area != NULL)
-		return (EBUSY);
+	ffs_lock_ea(vp);
+	if (ip->i_ea_area != NULL) {
+		ip->i_ea_refs++;
+		ffs_unlock_ea(vp);
+		return (0);
+	}
 	dp = ip->i_din2;
 	error = ffs_rdextattr(&ip->i_ea_area, vp, td, 0);
-	if (error)
+	if (error) {
+		ffs_unlock_ea(vp);
 		return (error);
+	}
 	ip->i_ea_len = dp->di_extsize;
 	ip->i_ea_error = 0;
+	ip->i_ea_refs++;
+	ffs_unlock_ea(vp);
 	return (0);
 }
 
@@ -1258,11 +1295,16 @@ ffs_close_ea(struct vnode *vp, int commi
 	struct ufs2_dinode *dp;
 
 	ip = VTOI(vp);
-	if (ip->i_ea_area == NULL)
+
+	ffs_lock_ea(vp);
+	if (ip->i_ea_area == NULL) {
+		ffs_unlock_ea(vp);
 		return (EINVAL);
+	}
 	dp = ip->i_din2;
 	error = ip->i_ea_error;
 	if (commit && error == 0) {
+		ASSERT_VOP_ELOCKED(vp, "ffs_close_ea commit");
 		if (cred == NOCRED)
 			cred =  vp->v_mount->mnt_cred;
 		liovec.iov_base = ip->i_ea_area;
@@ -1279,10 +1321,13 @@ ffs_close_ea(struct vnode *vp, int commi
 			error = ffs_truncate(vp, 0, IO_EXT, cred, td);
 		error = ffs_extwrite(vp, &luio, IO_EXT | IO_SYNC, cred);
 	}
-	free(ip->i_ea_area, M_TEMP);
-	ip->i_ea_area = NULL;
-	ip->i_ea_len = 0;
-	ip->i_ea_error = 0;
+	if (--ip->i_ea_refs == 0) {
+		free(ip->i_ea_area, M_TEMP);
+		ip->i_ea_area = NULL;
+		ip->i_ea_len = 0;
+		ip->i_ea_error = 0;
+	}
+	ffs_unlock_ea(vp);
 	return (error);
 }
 
@@ -1392,7 +1437,6 @@ vop_deleteextattr {
 	uint32_t ealength, ul;
 	int ealen, olen, eapad1, eapad2, error, i, easize;
 	u_char *eae, *p;
-	int stand_alone;
 
 	ip = VTOI(ap->a_vp);
 	fs = ip->i_fs;
@@ -1409,19 +1453,19 @@ vop_deleteextattr {
 	error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace,
 	    ap->a_cred, ap->a_td, IWRITE);
 	if (error) {
+
+		/*
+		 * ffs_lock_ea is not needed there, because the vnode
+		 * must be exclusively locked.
+		 */
 		if (ip->i_ea_area != NULL && ip->i_ea_error == 0)
 			ip->i_ea_error = error;
 		return (error);
 	}
 
-	if (ip->i_ea_area == NULL) {
-		error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td);
-		if (error)
-			return (error);
-		stand_alone = 1;
-	} else {
-		stand_alone = 0;
-	}
+	error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td);
+	if (error)
+		return (error);
 
 	ealength = eapad1 = ealen = eapad2 = 0;
 
@@ -1434,8 +1478,7 @@ vop_deleteextattr {
 	if (olen == -1) {
 		/* delete but nonexistent */
 		free(eae, M_TEMP);
-		if (stand_alone)
-			ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
+		ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
 		return(ENOATTR);
 	}
 	bcopy(p, &ul, sizeof ul);
@@ -1446,9 +1489,8 @@ vop_deleteextattr {
 	}
 	if (easize > NXADDR * fs->fs_bsize) {
 		free(eae, M_TEMP);
-		if (stand_alone)
-			ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
-		else if (ip->i_ea_error == 0)
+		ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
+		if (ip->i_ea_area != NULL && ip->i_ea_error == 0)
 			ip->i_ea_error = ENOSPC;
 		return(ENOSPC);
 	}
@@ -1456,8 +1498,7 @@ vop_deleteextattr {
 	ip->i_ea_area = eae;
 	ip->i_ea_len = easize;
 	free(p, M_TEMP);
-	if (stand_alone)
-		error = ffs_close_ea(ap->a_vp, 1, ap->a_cred, ap->a_td);
+	error = ffs_close_ea(ap->a_vp, 1, ap->a_cred, ap->a_td);
 	return(error);
 }
 
@@ -1482,7 +1523,7 @@ vop_getextattr {
 	struct fs *fs;
 	u_char *eae, *p;
 	unsigned easize;
-	int error, ealen, stand_alone;
+	int error, ealen;
 
 	ip = VTOI(ap->a_vp);
 	fs = ip->i_fs;
@@ -1495,14 +1536,10 @@ vop_getextattr {
 	if (error)
 		return (error);
 
-	if (ip->i_ea_area == NULL) {
-		error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td);
-		if (error)
-			return (error);
-		stand_alone = 1;
-	} else {
-		stand_alone = 0;
-	}
+	error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td);
+	if (error)
+		return (error);
+
 	eae = ip->i_ea_area;
 	easize = ip->i_ea_len;
 
@@ -1516,8 +1553,8 @@ vop_getextattr {
 			error = uiomove(p, ealen, ap->a_uio);
 	} else
 		error = ENOATTR;
-	if (stand_alone)
-		ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
+
+	ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
 	return(error);
 }
 
@@ -1542,7 +1579,7 @@ vop_listextattr {
 	u_char *eae, *p, *pe, *pn;
 	unsigned easize;
 	uint32_t ul;
-	int error, ealen, stand_alone;
+	int error, ealen;
 
 	ip = VTOI(ap->a_vp);
 	fs = ip->i_fs;
@@ -1555,14 +1592,9 @@ vop_listextattr {
 	if (error)
 		return (error);
 
-	if (ip->i_ea_area == NULL) {
-		error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td);
-		if (error)
-			return (error);
-		stand_alone = 1;
-	} else {
-		stand_alone = 0;
-	}
+	error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td);
+	if (error)
+		return (error);
 	eae = ip->i_ea_area;
 	easize = ip->i_ea_len;
 
@@ -1586,8 +1618,7 @@ vop_listextattr {
 			error = uiomove(p, ealen + 1, ap->a_uio);
 		}
 	}
-	if (stand_alone)
-		ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
+	ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
 	return(error);
 }
 
@@ -1612,7 +1643,6 @@ vop_setextattr {
 	uint32_t ealength, ul;
 	int ealen, olen, eapad1, eapad2, error, i, easize;
 	u_char *eae, *p;
-	int stand_alone;
 
 	ip = VTOI(ap->a_vp);
 	fs = ip->i_fs;
@@ -1633,19 +1663,19 @@ vop_setextattr {
 	error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace,
 	    ap->a_cred, ap->a_td, IWRITE);
 	if (error) {
+
+		/*
+		 * ffs_lock_ea is not needed there, because the vnode
+		 * must be exclusively locked.
+		 */
 		if (ip->i_ea_area != NULL && ip->i_ea_error == 0)
 			ip->i_ea_error = error;
 		return (error);
 	}
 
-	if (ip->i_ea_area == NULL) {
-		error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td);
-		if (error)
-			return (error);
-		stand_alone = 1;
-	} else {
-		stand_alone = 0;
-	}
+	error = ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td);
+	if (error)
+		return (error);
 
 	ealen = ap->a_uio->uio_resid;
 	ealength = sizeof(uint32_t) + 3 + strlen(ap->a_name);
@@ -1677,9 +1707,8 @@ vop_setextattr {
 	}
 	if (easize > NXADDR * fs->fs_bsize) {
 		free(eae, M_TEMP);
-		if (stand_alone)
-			ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
-		else if (ip->i_ea_error == 0)
+		ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
+		if (ip->i_ea_area != NULL && ip->i_ea_error == 0)
 			ip->i_ea_error = ENOSPC;
 		return(ENOSPC);
 	}
@@ -1695,9 +1724,8 @@ vop_setextattr {
 	error = uiomove(p, ealen, ap->a_uio);
 	if (error) {
 		free(eae, M_TEMP);
-		if (stand_alone)
-			ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
-		else if (ip->i_ea_error == 0)
+		ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
+		if (ip->i_ea_area != NULL && ip->i_ea_error == 0)
 			ip->i_ea_error = error;
 		return(error);
 	}
@@ -1708,8 +1736,7 @@ vop_setextattr {
 	ip->i_ea_area = eae;
 	ip->i_ea_len = easize;
 	free(p, M_TEMP);
-	if (stand_alone)
-		error = ffs_close_ea(ap->a_vp, 1, ap->a_cred, ap->a_td);
+	error = ffs_close_ea(ap->a_vp, 1, ap->a_cred, ap->a_td);
 	return(error);
 }
 

Modified: stable/7/sys/ufs/ufs/inode.h
==============================================================================
--- stable/7/sys/ufs/ufs/inode.h	Fri Mar 27 15:46:02 2009	(r190469)
+++ stable/7/sys/ufs/ufs/inode.h	Fri Mar 27 15:57:52 2009	(r190470)
@@ -112,6 +112,12 @@ struct inode {
 		struct ufs1_dinode *din1;	/* UFS1 on-disk dinode. */
 		struct ufs2_dinode *din2;	/* UFS2 on-disk dinode. */
 	} dinode_u;
+
+	/*
+	 * i_ea_refs is added at the end of the structure to
+	 * keep struct inode layout on releng branch.
+	 */
+	int	  i_ea_refs;	/* Number of users of EA area */
 };
 /*
  * These flags are kept in i_flag.
@@ -125,6 +131,8 @@ struct inode {
 #define	IN_SPACECOUNTED	0x0080		/* Blocks to be freed in free count. */
 #define	IN_LAZYACCESS	0x0100		/* Process IN_ACCESS after the
 					   suspension finished */
+#define	IN_EA_LOCKED	0x0200
+#define	IN_EA_LOCKWAIT	0x0400
 
 #define i_devvp i_ump->um_devvp
 #define i_umbufobj i_ump->um_bo

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Mar 27 21:21:23 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 15895106566B;
	Fri, 27 Mar 2009 21:21:23 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DA1548FC1B;
	Fri, 27 Mar 2009 21:21:22 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2RLLM8o071688;
	Fri, 27 Mar 2009 21:21:22 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2RLLMQW071686;
	Fri, 27 Mar 2009 21:21:22 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200903272121.n2RLLMQW071686@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 27 Mar 2009 21:21: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: r190478 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/bge dev/cxgb
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	
List-Unsubscribe: , 
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: , 
	
X-List-Received-Date: Fri, 27 Mar 2009 21:21:24 -0000

Author: marius
Date: Fri Mar 27 21:21:22 2009
New Revision: 190478
URL: http://svn.freebsd.org/changeset/base/190478

Log:
  MFC: r190319
  
  - Ensure that INTx isn't disabled, as these chips apparently have a
    quirk requiring it to be enabled even when using MSI. This makes
    the latter work again after r189568.
  - Remove a comment which no longer applies since r190335.
  
  Approved by:	re (kib)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/bge/if_bge.c
  stable/7/sys/dev/bge/if_bgereg.h
  stable/7/sys/dev/cxgb/   (props changed)

Modified: stable/7/sys/dev/bge/if_bge.c
==============================================================================
--- stable/7/sys/dev/bge/if_bge.c	Fri Mar 27 21:13:14 2009	(r190477)
+++ stable/7/sys/dev/bge/if_bge.c	Fri Mar 27 21:21:22 2009	(r190478)
@@ -1295,8 +1295,7 @@ bge_stop_fw(sc)
 }
 
 /*
- * Do endian, PCI and DMA initialization. Also check the on-board ROM
- * self-test results.
+ * Do endian, PCI and DMA initialization.
  */
 static int
 bge_chipinit(struct bge_softc *sc)
@@ -1404,9 +1403,11 @@ bge_chipinit(struct bge_softc *sc)
 
 	/*
 	 * Disable memory write invalidate.  Apparently it is not supported
-	 * properly by these devices.
+	 * properly by these devices.  Also ensure that INTx isn't disabled,
+	 * as these chips need it even when using MSI.
 	 */
-	PCI_CLRBIT(sc->bge_dev, BGE_PCI_CMD, PCIM_CMD_MWIEN, 4);
+	PCI_CLRBIT(sc->bge_dev, BGE_PCI_CMD,
+	    PCIM_CMD_INTxDIS | PCIM_CMD_MWIEN, 4);
 
 	/* Set the timer prescaler (always 66Mhz) */
 	CSR_WRITE_4(sc, BGE_MISC_CFG, BGE_32BITTIME_66MHZ);

Modified: stable/7/sys/dev/bge/if_bgereg.h
==============================================================================
--- stable/7/sys/dev/bge/if_bgereg.h	Fri Mar 27 21:13:14 2009	(r190477)
+++ stable/7/sys/dev/bge/if_bgereg.h	Fri Mar 27 21:21:22 2009	(r190478)
@@ -404,6 +404,9 @@
 #ifndef PCIM_CMD_MWIEN
 #define	PCIM_CMD_MWIEN			0x0010
 #endif
+#ifndef PCIM_CMD_INTxDIS
+#define	PCIM_CMD_INTxDIS		0x0400
+#endif
 
 /*
  * High priority mailbox registers

From owner-svn-src-stable-7@FreeBSD.ORG  Sat Mar 28 16:12:32 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E4E641065673;
	Sat, 28 Mar 2009 16:12:32 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D20368FC16;
	Sat, 28 Mar 2009 16:12:32 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2SGCW7V006722;
	Sat, 28 Mar 2009 16:12:32 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2SGCW0I006721;
	Sat, 28 Mar 2009 16:12:32 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200903281612.n2SGCW0I006721@svn.freebsd.org>
From: Robert Watson 
Date: Sat, 28 Mar 2009 16:12:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190506 - stable/7/sys/netinet
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, 28 Mar 2009 16:12:33 -0000

Author: rwatson
Date: Sat Mar 28 16:12:32 2009
New Revision: 190506
URL: http://svn.freebsd.org/changeset/base/190506

Log:
  Enable soreceive_dgram() use by UDP by default in 7.x.  This can lead
  to a significant performance improvement for multi-threaded UDP socket
  receive, such as found in BIND, memcached, VoIP applications, etc.
  
  Requested by:	Florian Smeets 
  Approved by:	re (kib)

Modified:
  stable/7/sys/netinet/udp_usrreq.c

Modified: stable/7/sys/netinet/udp_usrreq.c
==============================================================================
--- stable/7/sys/netinet/udp_usrreq.c	Sat Mar 28 15:54:08 2009	(r190505)
+++ stable/7/sys/netinet/udp_usrreq.c	Sat Mar 28 16:12:32 2009	(r190506)
@@ -131,7 +131,7 @@ u_long	udp_recvspace = 40 * (1024 +
 SYSCTL_ULONG(_net_inet_udp, UDPCTL_RECVSPACE, recvspace, CTLFLAG_RW,
     &udp_recvspace, 0, "Maximum space for incoming UDP datagrams");
 
-static int udp_soreceive_dgram;
+static int udp_soreceive_dgram = 1;
 SYSCTL_INT(_net_inet_udp, OID_AUTO, soreceive_dgram_enabled,
     CTLFLAG_RD | CTLFLAG_TUN, &udp_soreceive_dgram, 0,
     "Use experimental optimized datagram receive");

From owner-svn-src-stable-7@FreeBSD.ORG  Sat Mar 28 19:23:10 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D80D3106564A;
	Sat, 28 Mar 2009 19:23:10 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C49FC8FC1E;
	Sat, 28 Mar 2009 19:23:10 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2SJNAQv010615;
	Sat, 28 Mar 2009 19:23:10 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2SJNAkH010614;
	Sat, 28 Mar 2009 19:23:10 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200903281923.n2SJNAkH010614@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 28 Mar 2009 19:23:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r190510 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb modules/opensolaris
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, 28 Mar 2009 19:23:11 -0000

Author: marius
Date: Sat Mar 28 19:23:10 2009
New Revision: 190510
URL: http://svn.freebsd.org/changeset/base/190510

Log:
  MFC: r190374
  
  As with ZFS use real atomic operations for sparc64.
  
  Approved by:	re (kib)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/modules/opensolaris/Makefile

Modified: stable/7/sys/modules/opensolaris/Makefile
==============================================================================
--- stable/7/sys/modules/opensolaris/Makefile	Sat Mar 28 19:09:30 2009	(r190509)
+++ stable/7/sys/modules/opensolaris/Makefile	Sat Mar 28 19:23:10 2009	(r190510)
@@ -7,7 +7,7 @@ SRCS=		opensolaris.c		\
 		opensolaris_cmn_err.c	\
 		opensolaris_kmem.c
 
-.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64"
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64" || ${MACHINE_ARCH} == "sparc64"
 .PATH:	${.CURDIR}/../../cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}
 SRCS+=		atomic.S
 .else

From owner-svn-src-stable-7@FreeBSD.ORG  Sat Mar 28 19:47:46 2009
Return-Path: 
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ED5E3106566B;
	Sat, 28 Mar 2009 19:47:46 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DA2C48FC08;
	Sat, 28 Mar 2009 19:47:46 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2SJlkkb011097;
	Sat, 28 Mar 2009 19:47:46 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2SJlkFH011096;
	Sat, 28 Mar 2009 19:47:46 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200903281947.n2SJlkFH011096@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 28 Mar 2009 19:47:46 +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: r190511 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
	dev/cxgb modules
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, 28 Mar 2009 19:47:47 -0000

Author: marius
Date: Sat Mar 28 19:47:46 2009
New Revision: 190511
URL: http://svn.freebsd.org/changeset/base/190511

Log:
  MFC: r190375, r190376
  
  Given that zfs.ko depends on opensolaris.ko also build the latter by
  default on sparc64.
  
  Approved by:	re (kib)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/modules/Makefile

Modified: stable/7/sys/modules/Makefile
==============================================================================
--- stable/7/sys/modules/Makefile	Sat Mar 28 19:23:10 2009	(r190510)
+++ stable/7/sys/modules/Makefile	Sat Mar 28 19:47:46 2009	(r190511)
@@ -624,6 +624,9 @@ _auxio=		auxio
 _em=		em
 _i2c=		i2c
 _igb=		igb
+.if ${MK_CDDL} != "no" || defined(ALL_MODULES)
+_opensolaris=	opensolaris
+.endif
 _sound=		sound
 .if ${MK_ZFS} != "no" || defined(ALL_MODULES)
 _zfs=		zfs